diff --git a/chb/app/CHVersion.py b/chb/app/CHVersion.py index 3861035a..f54d8706 100644 --- a/chb/app/CHVersion.py +++ b/chb/app/CHVersion.py @@ -1,3 +1,3 @@ -chbversion: str = "0.3.0-20260617" +chbversion: str = "0.3.0-20260619" minimum_required_chb_version = "0.6.0_20260617" diff --git a/chb/app/Function.py b/chb/app/Function.py index 02706b8b..a11f468b 100644 --- a/chb/app/Function.py +++ b/chb/app/Function.py @@ -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 @@ -622,6 +622,7 @@ def to_string( opcodewidth: int = 25, # alignment width for opcode text sp: bool = True, proofobligations: bool = False, + formatstrings: bool = False, typingrules: bool = False, stacklayout: bool = False) -> str: ... diff --git a/chb/arm/ARMFunction.py b/chb/arm/ARMFunction.py index 5245b2fd..d4ecba91 100644 --- a/chb/arm/ARMFunction.py +++ b/chb/arm/ARMFunction.py @@ -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 @@ -294,6 +294,7 @@ def to_string( opcodewidth: int = 40, sp: bool = True, proofobligations: bool = False, + formatstrings: bool = False, typingrules: bool = False, stacklayout: bool = False) -> str: lines: List[str] = [] @@ -304,6 +305,20 @@ def to_string( if proofobligations: lines.append(str(self.proofobligations)) lines.append(".~" * 40) + if formatstrings: + fmtstrings = self.formatstrings.items() + if len(fmtstrings) > 0: + lines.append("Format strings:") + for (iaddr, (s, fmtspec)) in fmtstrings: + lines.append( + " " + + iaddr + + ": fmtstring: " + + s + + " (spec: " + + str(fmtspec) + + ")") + lines.append(".~" * 40) for b in sorted(self.blocks): lines.append( self.blocks[b].to_string( diff --git a/chb/cmdline/chkx b/chb/cmdline/chkx index 4f6dcd21..6c562c36 100755 --- a/chb/cmdline/chkx +++ b/chb/cmdline/chkx @@ -937,6 +937,10 @@ def parse() -> argparse.Namespace: "--proofobligations", action="store_true", help="include proofobligations at the top of the function") + resultsfunctions.add_argument( + "--formatstrings", + action="store_true", + help="include format strings at the top of the function") resultsfunctions.add_argument( "--loglevel", "-log", choices=UL.LogLevel.options(), @@ -990,6 +994,10 @@ def parse() -> argparse.Namespace: "--proofobligations", action="store_true", help="include proofobligations at the top of the function") + resultsfunction.add_argument( + "--formatstrings", + action="store_true", + help="include format strings at the top of the function") resultsfunction.add_argument( "--typingrules", action="store_true", diff --git a/chb/cmdline/commandutil.py b/chb/cmdline/commandutil.py index d5082f29..ee511239 100644 --- a/chb/cmdline/commandutil.py +++ b/chb/cmdline/commandutil.py @@ -1123,6 +1123,7 @@ def results_functions(args: argparse.Namespace) -> NoReturn: opcodewidth: int = args.opcodewidth stacklayout: bool = args.stacklayout proofobligations: bool = args.proofobligations + formatstrings: bool = args.formatstrings loglevel: str = args.loglevel logfilename: Optional[str] = args.logfilename logfilemode: str = args.logfilemode @@ -1173,6 +1174,7 @@ def results_functions(args: argparse.Namespace) -> NoReturn: opcodetxt=True, opcodewidth=opcodewidth, proofobligations=proofobligations, + formatstrings=formatstrings, stacklayout=stacklayout)) except UF.CHBError as e: @@ -1202,6 +1204,7 @@ def results_function(args: argparse.Namespace) -> NoReturn: txtoutput: bool = not xjson stacklayout: bool = args.stacklayout proofobligations: bool = args.proofobligations + formatstrings: bool = args.formatstrings typingrules: bool = args.typingrules loglevel: str = args.loglevel logfilename: Optional[str] = args.logfilename @@ -1265,6 +1268,7 @@ def results_function(args: argparse.Namespace) -> NoReturn: sp=True, opcodetxt=True, proofobligations=proofobligations, + formatstrings=formatstrings, typingrules=typingrules, stacklayout=stacklayout, opcodewidth=opcodewidth)) diff --git a/chb/mips/MIPSFunction.py b/chb/mips/MIPSFunction.py index 9531c00f..c19d998d 100644 --- a/chb/mips/MIPSFunction.py +++ b/chb/mips/MIPSFunction.py @@ -6,7 +6,7 @@ # # Copyright (c) 2016-2020 Kestrel Technology LLC # Copyright (c) 2020-2021 Henny Sipma -# 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 @@ -340,6 +340,7 @@ def to_string( opcodewidth: int = 25, sp: bool = True, proofobligations: bool = False, + formatstrings: bool = False, typingrules: bool = False, stacklayout: bool = False) -> str: lines: List[str] = [] diff --git a/chb/pwr/PowerFunction.py b/chb/pwr/PowerFunction.py index b3c3161a..60b0eae2 100644 --- a/chb/pwr/PowerFunction.py +++ b/chb/pwr/PowerFunction.py @@ -4,7 +4,7 @@ # ------------------------------------------------------------------------------ # The MIT License (MIT) # -# Copyright (c) 2023-2025 Aarno Labs LLC +# Copyright (c) 2023-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 @@ -182,6 +182,7 @@ def to_string( opcodewidth: int = 40, sp: bool = True, proofobligations: bool = False, + formatstrings: bool = False, typingrules: bool = False, stacklayout: bool = False) -> str: lines: List[str] = [] diff --git a/chb/x86/X86Function.py b/chb/x86/X86Function.py index a5ce767f..13ad5e08 100644 --- a/chb/x86/X86Function.py +++ b/chb/x86/X86Function.py @@ -6,7 +6,7 @@ # # Copyright (c) 2016-2020 Kestrel Technology LLC # Copyright (c) 2020 Henny Sipma -# 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 @@ -439,6 +439,7 @@ def to_string( opcodewidth: int = 25, sp: bool = True, proofobligations: bool = False, + formatstrings: bool = False, typingrules: bool = False, stacklayout: bool = False) -> str: lines: List[str] = []