diff --git a/CodeHawk/CHB/bchcmdline/bCHXBinaryAnalyzer.ml b/CodeHawk/CHB/bchcmdline/bCHXBinaryAnalyzer.ml index 6c4a9258..c18dd1a8 100644 --- a/CodeHawk/CHB/bchcmdline/bCHXBinaryAnalyzer.ml +++ b/CodeHawk/CHB/bchcmdline/bCHXBinaryAnalyzer.ml @@ -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 @@ -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. *) @@ -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 diff --git a/CodeHawk/CHB/bchlib/bCHCallSemanticsRecorder.ml b/CodeHawk/CHB/bchlib/bCHCallSemanticsRecorder.ml index ca140f4d..5aaf199d 100644 --- a/CodeHawk/CHB/bchlib/bCHCallSemanticsRecorder.ml +++ b/CodeHawk/CHB/bchlib/bCHCallSemanticsRecorder.ml @@ -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 -> diff --git a/CodeHawk/CHB/bchlib/bCHFunctionInterface.ml b/CodeHawk/CHB/bchlib/bCHFunctionInterface.ml index 06a1df86..d9a31669 100644 --- a/CodeHawk/CHB/bchlib/bCHFunctionInterface.ml +++ b/CodeHawk/CHB/bchlib/bCHFunctionInterface.ml @@ -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, _)) @@ -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 = diff --git a/CodeHawk/CHB/bchlib/bCHFunctionPODischarge.ml b/CodeHawk/CHB/bchlib/bCHFunctionPODischarge.ml index dd4550a2..7fb6b6a1 100644 --- a/CodeHawk/CHB/bchlib/bCHFunctionPODischarge.ml +++ b/CodeHawk/CHB/bchlib/bCHFunctionPODischarge.ml @@ -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 @@ -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 @@ -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 diff --git a/CodeHawk/CHB/bchlib/bCHFunctionSummary.ml b/CodeHawk/CHB/bchlib/bCHFunctionSummary.ml index cf37f6fb..cc8980f7 100644 --- a/CodeHawk/CHB/bchlib/bCHFunctionSummary.ml +++ b/CodeHawk/CHB/bchlib/bCHFunctionSummary.ml @@ -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 diff --git a/CodeHawk/CHB/bchlib/bCHVersion.ml b/CodeHawk/CHB/bchlib/bCHVersion.ml index 6239d2c5..c6e66e7a 100644 --- a/CodeHawk/CHB/bchlib/bCHVersion.ml +++ b/CodeHawk/CHB/bchlib/bCHVersion.ml @@ -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 ()