diff --git a/src/asm_acquire.ml b/src/asm_acquire.ml index 1b236c2..a574aa2 100644 --- a/src/asm_acquire.ml +++ b/src/asm_acquire.ml @@ -3,8 +3,6 @@ Uses `objdump -d` internally, and parses the output *) -module StrMap = Map.Make(String) - (** A memory address *) type addr_t = int @@ -21,7 +19,7 @@ type asm_sub_t = { sub_addr: addr_t; sub_asm: asm_t; } -type asm_info_t = asm_sub_t StrMap.t +type asm_info_t = asm_sub_t list exception ParseError of string @@ -49,7 +47,7 @@ let pp_asm_sub ppx asm_sub = pp_asm asm_sub.sub_asm let pp_asm_info ppx asm_info = - StrMap.iter (fun _ asm_sub -> Format.fprintf ppx "%a" pp_asm_sub asm_sub) + List.iter (fun asm_sub -> Format.fprintf ppx "%a" pp_asm_sub asm_sub) asm_info (** Reads the whole content of a Unix file descriptor, returning it as a Bytes @@ -173,7 +171,7 @@ let interpret_objdump objdump_out : asm_info_t = (* Commit in-flight *) let full_sub = { in_flight with sub_asm = List.rev asm } in ObjdumpAccu( - StrMap.add full_sub.sub_name full_sub cur_info, + full_sub::cur_info, cur_section, None, [] @@ -267,10 +265,12 @@ let interpret_objdump objdump_out : asm_info_t = String.split_on_char '\n' objdump_out |> drop_k 2 (* Two first lines are meaningless for us *) |> List.fold_left aggregate_info - (ObjdumpAccu(StrMap.empty, "", None, [])) + (ObjdumpAccu([], "", None, [])) in (match result with - | ObjdumpAccu(result, _, None, []) -> result + | ObjdumpAccu(result, _, None, []) -> + result + |> List.rev | _ -> raise (ParseError "Invalid end state"))