Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 1 addition & 1 deletion chb/app/CHVersion.py
Original file line number Diff line number Diff line change
@@ -1,3 +1,3 @@
chbversion: str = "0.3.20261001"
chbversion: str = "0.3.20261007"

minimum_required_chb_version = "0.6.0_20260802"
10 changes: 6 additions & 4 deletions chb/arm/ARMCallOpcode.py
Original file line number Diff line number Diff line change
Expand Up @@ -49,7 +49,7 @@

import chb.util.fileutil as UF
from chb.util.IndexedTable import IndexedTableValue
from chb.util.loggingutil import chklogger
from chb.util.loggingutil import chklogger, CHKLogID


if TYPE_CHECKING:
Expand Down Expand Up @@ -297,7 +297,8 @@ def ast_call_prov(
if finfo.has_call_target(iaddr):
calltarget = finfo.call_target(iaddr)
if calltarget.is_unknown:
chklogger.logger.error(
chklogger.logger.error_id(
CHKLogID.UNSP_INDCALL_0001,
"BL: Indirect call not yet handled at address %s", iaddr)

if finfo.has_call_target_info(iaddr):
Expand Down Expand Up @@ -509,8 +510,9 @@ def ast_call_prov(
hl_arg = astree.mk_address_of(
astree.mk_vinfo_lval(vinfo))
else:
chklogger.logger.error(
("Unknown global address %s as call "
chklogger.logger.error_id(
CHKLogID.USER_GLBDECL_0001,
("USER: Unknown global address %s as call "
+ "argument at address %s"),
hexgaddr, iaddr)
hl_arg = astree.mk_temp_lval_expression()
Expand Down
12 changes: 7 additions & 5 deletions chb/arm/ARMOpcode.py
Original file line number Diff line number Diff line change
Expand Up @@ -52,7 +52,7 @@

import chb.util.fileutil as UF
from chb.util.IndexedTable import IndexedTableValue
from chb.util.loggingutil import chklogger
from chb.util.loggingutil import chklogger, CHKLogID


if TYPE_CHECKING:
Expand Down Expand Up @@ -440,8 +440,9 @@ def ast_prov(
List[AST.ASTInstruction], List[AST.ASTInstruction]]:
"""Return default; should be overridden by instruction opcodes."""

chklogger.logger.error(
"no lifting support available for instruction %s at address %s",
chklogger.logger.error_id(
CHKLogID.UNSP_ASMINSTR_0001,
"UNSP: no lifting support available for instruction %s at address %s",
self.mnemonic, iaddr)
instrs = self.ast(astree, iaddr, bytestring, xdata)
return (instrs, instrs)
Expand Down Expand Up @@ -497,8 +498,9 @@ def ast_cc_condition_prov(
return (hl_astcond, ll_astcond)

else:
chklogger.logger.error(
"No condition found at address %s", iaddr)
chklogger.logger.error_id(
CHKLogID.RSLT_PRNOCC_0001,
"No instruction condition predicate found at address %s", iaddr)
hl_astcond = astree.mk_temp_lval_expression()
return (hl_astcond, ll_astcond)

Expand Down
7 changes: 4 additions & 3 deletions chb/arm/opcodes/ARMAdd.py
Original file line number Diff line number Diff line change
Expand Up @@ -40,7 +40,7 @@

import chb.util.fileutil as UF
from chb.util.IndexedTable import IndexedTableValue
from chb.util.loggingutil import chklogger
from chb.util.loggingutil import chklogger, CHKLogID


if TYPE_CHECKING:
Expand Down Expand Up @@ -260,8 +260,9 @@ def ast_prov(
annotations: List[str] = [iaddr, "ADD"]

if xdata.is_aggregate_jumptable:
chklogger.logger.warning(
"ADD: aggregate jumptable at address %s not yet handled",
chklogger.logger.error_id(
CHKLogID.UNSP_JMPTBL_0001,
"UNSP: ADD: aggregate jumptable at address %s not yet handled",
iaddr)
return ([], [])

Expand Down
9 changes: 5 additions & 4 deletions chb/arm/opcodes/ARMBranch.py
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,7 @@
# ------------------------------------------------------------------------------
# The MIT License (MIT)
#
# Copyright (c) 2021-2025 Aarno Labs LLC
# Copyright (c) 2021-2026 Aarno Labs LLC
#
# Permission is hereby granted, free of charge, to any person obtaining a copy
# of this software and associated documentation files (the "Software"), to deal
Expand Down Expand Up @@ -50,7 +50,7 @@

import chb.util.fileutil as UF
from chb.util.IndexedTable import IndexedTableValue
from chb.util.loggingutil import chklogger
from chb.util.loggingutil import chklogger, CHKLogID


if TYPE_CHECKING:
Expand Down Expand Up @@ -374,7 +374,8 @@ def default(condition: XXpr) -> AST.ASTExpr:
else:
condition = xd.txpr
else:
chklogger.logger.error(
chklogger.logger.error_id(
CHKLogID.RSLT_BRNOCC_0001,
"Bcc: conditional branch without branch conditions "
+ "at address %s", iaddr)
hl_astcond = astree.mk_temp_lval_expression()
Expand All @@ -394,7 +395,7 @@ def default(condition: XXpr) -> AST.ASTExpr:

elif len(ftconds) == 0:
chklogger.logger.error(
"No branch condition found at address %s", iaddr)
"BR: No branch condition found at address %s", iaddr)
hl_astcond = astree.mk_temp_lval_expression()
return (hl_astcond, ll_astcond)

Expand Down
14 changes: 8 additions & 6 deletions chb/arm/opcodes/ARMLoadRegister.py
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,7 @@
# ------------------------------------------------------------------------------
# The MIT License (MIT)
#
# Copyright (c) 2021-2025 Aarno Labs LLC
# Copyright (c) 2021-2026 Aarno Labs LLC
#
# Permission is hereby granted, free of charge, to any person obtaining a copy
# of this software and associated documentation files (the "Software"), to deal
Expand Down Expand Up @@ -42,7 +42,7 @@

import chb.util.fileutil as UF
from chb.util.IndexedTable import IndexedTableValue
from chb.util.loggingutil import chklogger
from chb.util.loggingutil import chklogger, CHKLogID


if TYPE_CHECKING:
Expand Down Expand Up @@ -255,8 +255,9 @@ def has_cast() -> bool:
lhs = xd.vrt

if str(lhs) == "PC":
chklogger.logger.error(
"LDR: Indirect call via Load to PC not yet handled at %s",
chklogger.logger.error_id(
CHKLogID.UNSP_INDCALL_0002,
"UNSP: LDR: Indirect call via Load to PC not yet handled at %s",
iaddr)
return ([], (ll_pre + [ll_assign] + ll_post))

Expand All @@ -279,8 +280,9 @@ def has_cast() -> bool:
hl_rhs = XU.xmemory_dereference_lval_expr(
xaddr, xdata, iaddr, astree)

chklogger.logger.warning(
"LDR: Unable to use a C expression for rhs. Fall back to "
chklogger.logger.warning_id(
CHKLogID.RSLT_ERRCXPR_0002,
"RSLT: LDR: Unable to use a C expression for rhs. Fall back to "
+ "native byte-based address: %s to form rhs %s at address %s",
str(xaddr), str(hl_rhs), iaddr)

Expand Down
19 changes: 13 additions & 6 deletions chb/arm/opcodes/ARMLoadRegisterByte.py
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,7 @@
# ------------------------------------------------------------------------------
# The MIT License (MIT)
#
# Copyright (c) 2021-2025 Aarno Labs LLC
# Copyright (c) 2021-2026 Aarno Labs LLC
#
# Permission is hereby granted, free of charge, to any person obtaining a copy
# of this software and associated documentation files (the "Software"), to deal
Expand Down Expand Up @@ -42,7 +42,7 @@

import chb.util.fileutil as UF
from chb.util.IndexedTable import IndexedTableValue
from chb.util.loggingutil import chklogger
from chb.util.loggingutil import chklogger, CHKLogID


if TYPE_CHECKING:
Expand Down Expand Up @@ -142,7 +142,12 @@ def annotation(self) -> str:
else:
crhs = "None"
cx = " (C: " + crhs + ")"
addr = str(self.xxaddr if self.is_xxaddr_ok else self.xaddr)
if self.is_xxaddr_ok:
addr = str(self.xxaddr)
elif self.is_xaddr_ok:
addr = str(self.xaddr)
else:
addr = "None"
caddr = str(self.cxaddr if self.is_cxaddr_ok else "None")
caddr = " (addr: " + addr + "; C: " + caddr + ")"
if self.is_ok or self.is_xrmem_ok:
Expand Down Expand Up @@ -278,13 +283,15 @@ def has_cast() -> bool:
hl_rhs = XU.xmemory_dereference_lval_expr(
xaddr, xdata, iaddr, astree)

chklogger.logger.warning(
"LDRB: Unable to use a C expression for rhs. Fall back to "
chklogger.logger.warning_id(
CHKLogID.RSLT_ERRCXPR_0003,
"RSLT: LDRB: Unable to use a C expression for rhs. Fall back to "
+ "native byte-based address: %s to form rhs %s at address %s",
str(xaddr), str(hl_rhs), iaddr)

else:
chklogger.logger.error(
chklogger.logger.error_id(
CHKLogID.RSLT_ERRVAL_0002,
"LDRB: both memory value and address values are error values "
+ "at address %s: ", iaddr)
return ([], (ll_pre + [ll_assign] + ll_post))
Expand Down
9 changes: 5 additions & 4 deletions chb/arm/opcodes/ARMLoadRegisterHalfword.py
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,7 @@
# ------------------------------------------------------------------------------
# The MIT License (MIT)
#
# Copyright (c) 2021-2025 Aarno Labs LLC
# Copyright (c) 2021-2026 Aarno Labs LLC
#
# Permission is hereby granted, free of charge, to any person obtaining a copy
# of this software and associated documentation files (the "Software"), to deal
Expand Down Expand Up @@ -42,7 +42,7 @@

import chb.util.fileutil as UF
from chb.util.IndexedTable import IndexedTableValue
from chb.util.loggingutil import chklogger
from chb.util.loggingutil import chklogger, CHKLogID

if TYPE_CHECKING:
from chb.arm.ARMDictionary import ARMDictionary
Expand Down Expand Up @@ -271,8 +271,9 @@ def has_cast() -> bool:
hl_rhs = XU.xmemory_dereference_lval_expr(
xaddr, xdata, iaddr, astree)

chklogger.logger.warning(
"LDRH: Unable to use a C expression for rhs. Fall back to "
chklogger.logger.warning_id(
CHKLogID.RSLT_ERRCXPR_0001,
"RSLT: LDRH: Unable to use a C expression for rhs. Fall back to "
+ "native byte-based address: %s to form rhs %s at address %s",
str(xaddr), str(hl_rhs), iaddr)

Expand Down
5 changes: 3 additions & 2 deletions chb/arm/opcodes/ARMPop.py
Original file line number Diff line number Diff line change
Expand Up @@ -40,7 +40,7 @@
import chb.invariants.XXprUtil as XU

import chb.util.fileutil as UF
from chb.util.loggingutil import chklogger
from chb.util.loggingutil import chklogger, CHKLogID
from chb.util.IndexedTable import IndexedTableValue

if TYPE_CHECKING:
Expand Down Expand Up @@ -236,7 +236,8 @@ def ast_prov(

xd = ARMPopXData(xdata)
if not xd.is_ok:
chklogger.logger.error(
chklogger.logger.error_id(
CHKLogID.RSLT_ERRVAL_0001,
"Encountered error value at address %s", iaddr)
return ([], [])

Expand Down
14 changes: 8 additions & 6 deletions chb/arm/opcodes/ARMStoreMultipleIncrementAfter.py
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,7 @@
# ------------------------------------------------------------------------------
# The MIT License (MIT)
#
# Copyright (c) 2021-2025 Aarno Labs LLC
# Copyright (c) 2021-2026 Aarno Labs LLC
#
# Permission is hereby granted, free of charge, to any person obtaining a copy
# of this software and associated documentation files (the "Software"), to deal
Expand Down Expand Up @@ -40,7 +40,7 @@

import chb.util.fileutil as UF
from chb.util.IndexedTable import IndexedTableValue
from chb.util.loggingutil import chklogger
from chb.util.loggingutil import chklogger, CHKLogID


if TYPE_CHECKING:
Expand Down Expand Up @@ -511,17 +511,19 @@ def ast_prov(
elif xd.are_memlhss_ok:
memlhss = xd.memlhss
else:
chklogger.logger.error(
"STM: Error value encountered in LHSs at address %s", iaddr)
chklogger.logger.error_id(
CHKLogID.RSLT_ERRVAL_0005,
"RSLT: STM: Error value encountered in LHSs at address %s", iaddr)
return ([], [])

if xd.are_crhss_ok:
regrhss = xd.crhss
elif xd.are_rrhss_ok:
regrhss = xd.rhss
else:
chklogger.logger.error(
"STM: Error value encountered in RHSs at address %s", iaddr)
chklogger.logger.error_id(
CHKLogID.RSLT_ERRVAL_0004,
"RSLT: STM: Error value encountered in RHSs at address %s", iaddr)
return ([], [])

annotations: List[str] = [iaddr, "STM"]
Expand Down
9 changes: 5 additions & 4 deletions chb/arm/opcodes/ARMStoreMultipleIncrementBefore.py
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,7 @@
# ------------------------------------------------------------------------------
# The MIT License (MIT)
#
# Copyright (c) 2021-2025 Aarno Labs LLC
# Copyright (c) 2021-2026 Aarno Labs LLC
#
# Permission is hereby granted, free of charge, to any person obtaining a copy
# of this software and associated documentation files (the "Software"), to deal
Expand Down Expand Up @@ -40,7 +40,7 @@

import chb.util.fileutil as UF
from chb.util.IndexedTable import IndexedTableValue
from chb.util.loggingutil import chklogger
from chb.util.loggingutil import chklogger, CHKLogID


if TYPE_CHECKING:
Expand Down Expand Up @@ -135,8 +135,9 @@ def ast_prov(

xd = ARMStoreMultipleIncrementBeforeXData(xdata)
if not xd.is_ok:
chklogger.logger.error(
"STMIB: Error value encountered at address %s", iaddr)
chklogger.logger.error_id(
CHKLogID.RSLT_ERRVAL_0003,
"RSLT: STMIB: Error value encountered at address %s", iaddr)
return ([], [])

annotations: List[str] = [iaddr, "STMIB"]
Expand Down
21 changes: 14 additions & 7 deletions chb/astinterface/ASTIProvenance.py
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,7 @@
# ------------------------------------------------------------------------------
# The MIT License (MIT)
#
# Copyright (c) 2022-2025 Aarno Labs LLC
# Copyright (c) 2022-2026 Aarno Labs LLC
#
# Permission is hereby granted, free of charge, to any person obtaining a copy
# of this software and associated documentation files (the "Software"), to deal
Expand Down Expand Up @@ -32,7 +32,7 @@
from chb.ast.ASTProvenance import ASTProvenance

import chb.util.fileutil as UF
from chb.util.loggingutil import chklogger
from chb.util.loggingutil import chklogger, CHKLogID

if TYPE_CHECKING:
from chb.invariants.VarInvariantFact import (
Expand Down Expand Up @@ -478,11 +478,18 @@ def resolve_reaching_defs(self) -> None:
else:
# temporarily silence warnings for payload addresses
if not addr.startswith("F"):
chklogger.logger.warning(
"Reaching definition address %s for variable %s "
+ " not found",
str(addr), str(v))

if "clobber" in str(addr):
chklogger.logger.warning_id(
CHKLogID.RDEF_CLOBBER_0001,
"RDEF: Reaching definition of address %s for clobbered "
+ "value %s not found",
str(addr), str(v))
else:
chklogger.logger.warning_id(
CHKLogID.RDEF_UNRESOLVED_0001,
"RDEF: Reaching definition address %s for variable %s "
+ " not found",
str(addr), str(v))

def resolve_flag_reaching_defs(self) -> None:
for (xid, frds) in self.flag_expr_rdefs.items():
Expand Down
Loading