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
8 changes: 4 additions & 4 deletions CodeHawk/CHB/bchcmdline/bCHXBinaryAnalyzer.ml
Original file line number Diff line number Diff line change
Expand Up @@ -556,14 +556,14 @@ let main () =
&& system_settings#is_elf then
let _ = system_info#initialize in
let t = ref (Unix.gettimeofday ()) in
let _ = load_elf_files () in
let _ = pr_timing [STR "elf files loaded"] in
let _ =
List.iter (fun f ->
parse_cil_file ~removeUnused:false f) system_info#ifiles in
let _ =
if (List.length system_info#ifiles) > 0 then
pr_timing [STR "c header files loaded"] in
let _ = load_elf_files () in
let _ = pr_timing [STR "elf files loaded"] in
let _ = disassemble_arm_sections () in
let _ = pr_timing [STR "sections disassembled"] in
let _ = disassembly_summary#record_disassembly_time
Expand Down Expand Up @@ -883,8 +883,6 @@ let main () =
STR "file metrics loaded (index ";
INT file_metrics#get_index;
STR ")"] in
let _ = load_elf_files () in
let _ = pr_timing [STR "elf files loaded"] in

(* symbolic addresses in userdata should be loaded before the header
files are parsed. *)
Expand All @@ -899,6 +897,8 @@ let main () =
let _ = BCHBCTypeXml.register_ch_named_struct_types () in
(* function annotations in userdata should be loaded after the header
files are parsed, so types in the function annotations can be resolved.*)
let _ = load_elf_files () in
let _ = pr_timing [STR "elf files loaded"] in
let _ = system_info#initialize_function_annotations in
let _ = pr_timing [STR "function annotations initialized"] in

Expand Down
3 changes: 2 additions & 1 deletion CodeHawk/CHB/bchlib/bCHCallSemanticsRecorder.ml
Original file line number Diff line number Diff line change
Expand Up @@ -325,7 +325,8 @@ object (self)
~xpr:(Some (XVar sevalue))
self#loc#ci
| _ ->
match self#xprxt#xpr_to_bterm ty addr with
let pty = t_ptrto ty in
match self#xprxt#xpr_to_bterm pty addr with
| Some t ->
(match self#xprxt#xpr_to_bterm t_int size with
| Some sizet ->
Expand Down
13 changes: 13 additions & 0 deletions CodeHawk/CHB/bchlib/bCHFunctionInterface.ml
Original file line number Diff line number Diff line change
Expand Up @@ -897,6 +897,7 @@ let add_function_register_parameter_location
| (RegisterParameter (r1, _, _), RegisterParameter (r2, _, _)) ->
register_equal r1 r2
| _ -> false in
(* returns true if existing type is better *)
let better (loc1: parameter_location_t) (loc2: parameter_location_t): bool =
match (loc1, loc2) with
| (RegisterParameter (r1, pd1, _), RegisterParameter (r2, pd2, _))
Expand All @@ -905,7 +906,19 @@ let add_function_register_parameter_location
false
else if is_unknown_type pd1.pld_type then
false
(* In some cases an integer type has been given as a default type; if
the new type is different, it is not a default, so the new type
is better. *)
else if btype_equal pd1.pld_type t_int then
false
else
let _ =
chlog#add
"reject new type"
(LBLOCK [STR "old type: ";
btype_to_pretty pd1.pld_type;
STR "; new type: ";
btype_to_pretty pd2.pld_type]) in
true
| _ -> false in
let newlocations =
Expand Down
6 changes: 3 additions & 3 deletions CodeHawk/CHB/bchlib/bCHFunctionPODischarge.ml
Original file line number Diff line number Diff line change
Expand Up @@ -1016,7 +1016,7 @@ let blockwrite_delegate
match xprxt#xpr_to_bterm BCHBCTypeUtil.t_int bwlen with
| Some bterm -> bterm
| _ -> RunTimeValue in
(match xprxt#xpr_to_bterm ty xpr with
(match xprxt#xpr_to_bterm (BCHBCTypeUtil.t_ptrto ty) xpr with
| Some (NumConstant n) when n#gt CHNumerical.numerical_zero ->
let dw = BCHDoubleword.numerical_mod_to_doubleword n in
let xxp = XXBlockWrite (ty, NumConstant n, xlenterm) in
Expand Down Expand Up @@ -1100,7 +1100,7 @@ let buffer_delegate
Open
end
| Some xprxt ->
(match xprxt#xpr_to_bterm ty xpr with
(match xprxt#xpr_to_bterm (BCHBCTypeUtil.t_ptrto ty) xpr with
| Some (NumConstant n) when n#gt CHNumerical.numerical_zero ->
let dw = BCHDoubleword.numerical_mod_to_doubleword n in
(match xprxt#xpr_to_bterm BCHBCTypeUtil.t_int bwlen with
Expand Down Expand Up @@ -1378,7 +1378,7 @@ let initialized_range_delegate
Open
end
| Some xprxt ->
(match xprxt#xpr_to_bterm ty xpr with
(match xprxt#xpr_to_bterm (BCHBCTypeUtil.t_ptrto ty) xpr with
| Some (NumConstant n) when n#gt CHNumerical.numerical_zero ->
let dw = BCHDoubleword.numerical_mod_to_doubleword n in
(match xprxt#xpr_to_bterm BCHBCTypeUtil.t_int size with
Expand Down
4 changes: 3 additions & 1 deletion CodeHawk/CHB/bchlib/bCHFunctionSummary.ml
Original file line number Diff line number Diff line change
Expand Up @@ -186,7 +186,9 @@ object (self:'a)
(LBLOCK [
STR (get_fintf_name self#get_function_interface);
STR ": ";
STR (register_to_string reg)]) in
STR (register_to_string reg);
STR "; ";
STR (BCHBCTypePretty.btype_to_string ty)]) in
{< finterface = add_function_register_parameter_location fintf reg ty size >}

method get_registers_preserved = fts.fts_registers_preserved
Expand Down
4 changes: 2 additions & 2 deletions CodeHawk/CHB/bchlib/bCHVersion.ml
Original file line number Diff line number Diff line change
Expand Up @@ -95,8 +95,8 @@ end


let version = new version_info_t
~version:"0.6.0_20260802"
~date:"2026-0802"
~version:"0.6.0_20260816"
~date:"2026-0816"
~licensee: None
~maxfilesize: None
()
Loading