From 520d9527ab949cd46786ff141ccc2a8e7ae5e5c0 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Th=C3=A9ophile=20Bastian?= Date: Mon, 18 Nov 2019 11:35:27 +0100 Subject: [PATCH] Modify elf_arrows accordingly --- dune | 5 +++-- src/elf_arrows.ml | 22 +++++++++++++--------- 2 files changed, 16 insertions(+), 11 deletions(-) diff --git a/dune b/dune index 835a970..a12f9d3 100644 --- a/dune +++ b/dune @@ -1,4 +1,5 @@ (include_subdirs unqualified) + (executable - (name test_objdump) - (libraries linksem)) + (name elf_arrows) + (libraries linksem jingoo)) diff --git a/src/elf_arrows.ml b/src/elf_arrows.ml index 7076d1f..efb16c3 100644 --- a/src/elf_arrows.ml +++ b/src/elf_arrows.ml @@ -12,7 +12,9 @@ let make_pp linksem_pp = |> Format.fprintf fmt "%s") type elf_path = string -type elf_handle = ElfHandle of elf_path * Elf_file.elf_file * Dwarf.dwarf_static +type elf_handle = + ElfHandle of elf_path * Elf_file.elf_file * Dwarf.dwarf_static + * Asm_info.NoAnnot.asm_info_t (** Open an ELF file and loads its dwarf_static infos. *) let open_elf elf_path = @@ -25,10 +27,11 @@ let open_elf elf_path = | Error.Fail _ -> raise NotElf) )) >>= fun elf_file -> ( + let asm_info = Asm_acquire.acquire_asm elf_path in let static_info = (match Dwarf.extract_dwarf_static elf_file with | Some static_info -> static_info | None -> raise NoDwarfStatic) in - Error.Success (ElfHandle (elf_path, elf_file, static_info))) + Error.Success (ElfHandle (elf_path, elf_file, static_info, asm_info))) let elf_files = ref [] @@ -46,10 +49,11 @@ let _ = !elf_files in - List.iter (fun (ElfHandle(path, _, static_info)) -> - let line_info = static_info.ds_evaluated_line_info in - Format.eprintf "Line infos <%s>:@. %a@." - path - (make_pp Dwarf.pp_evaluated_line_info) - line_info ; - ) elf_handles + List.iter (fun (ElfHandle(path, _, static_info, asm)) -> + ignore asm ; + let line_info = static_info.ds_evaluated_line_info in + Format.eprintf "Line infos <%s>:@. %a@." + path + (make_pp Dwarf.pp_evaluated_line_info) + line_info ; + ) elf_handles