Skip to content

Commit 083f306

Browse files
committed
CHB:ARM: allow for printing data sections
1 parent c2782f7 commit 083f306

File tree

4 files changed

+352
-366
lines changed

4 files changed

+352
-366
lines changed

CodeHawk/CHB/bchcmdline/bCHXBinaryAnalyzer.ml

Lines changed: 12 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -107,6 +107,14 @@ let export_directory = ref ""
107107
let savecfgs = ref false
108108
let save_xml = ref false (* save disassembly status in xml *)
109109
let save_asm = ref false
110+
111+
let print_datasections = ref []
112+
let add_print_datasection (s: string) =
113+
if List.mem s !print_datasections then
114+
()
115+
else
116+
print_datasections := s :: !print_datasections
117+
110118
let save_asm_cfg_info = ref false (* save functions list with cfg info in xml *)
111119
let set_datablocks = ref false (* only supported for arm *)
112120
let construct_all_functions = ref false
@@ -210,6 +218,8 @@ let speclist =
210218
"save assembly listing in the analysis directory");
211219
("-save_asm_cfg_info", Arg.Unit (fun () -> save_asm_cfg_info := true),
212220
"save list of functions with cfg info to xml file (may be slow)");
221+
("-print_datasection", Arg.String (fun s -> add_print_datasection s),
222+
"print the data sections as part of the assembly listing");
213223
("-construct_all_functions",
214224
Arg.Unit (fun () -> construct_all_functions := true),
215225
"construct all functions even if analyzing only a few of them");
@@ -579,13 +589,13 @@ let main () =
579589
*)
580590
begin
581591
if !save_asm then
592+
let datarefs = get_arm_data_references () in
582593
begin
583-
let datarefs = get_arm_data_references () in
584594
file_output#saveFile
585595
(get_asm_listing_filename ())
586596
(let instrs = !BCHARMAssemblyInstructions.arm_assembly_instructions in
587597
(LBLOCK [
588-
STR (instrs#toString ~datarefs ());
598+
STR (instrs#toString ~datarefs ~datasections:!print_datasections ());
589599
arm_callsites_records#toPretty;
590600
arm_callsites_records#summary_to_pretty]));
591601
pr_timing [STR "assembly listing saved"];

CodeHawk/CHB/bchlib/bCHVersion.ml

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -95,8 +95,8 @@ end
9595

9696

9797
let version = new version_info_t
98-
~version:"0.6.0_20250830"
99-
~date:"2025-08-30"
98+
~version:"0.6.0_20250902"
99+
~date:"2025-09-02"
100100
~licensee: None
101101
~maxfilesize: None
102102
()

0 commit comments

Comments
 (0)