Modify elf_arrows accordingly

This commit is contained in:
Théophile Bastian 2019-11-18 11:35:27 +01:00
parent 700ca3db7f
commit 520d9527ab
2 changed files with 16 additions and 11 deletions

5
dune
View file

@ -1,4 +1,5 @@
(include_subdirs unqualified) (include_subdirs unqualified)
(executable (executable
(name test_objdump) (name elf_arrows)
(libraries linksem)) (libraries linksem jingoo))

View file

@ -12,7 +12,9 @@ let make_pp linksem_pp =
|> Format.fprintf fmt "%s") |> Format.fprintf fmt "%s")
type elf_path = string 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. *) (** Open an ELF file and loads its dwarf_static infos. *)
let open_elf elf_path = let open_elf elf_path =
@ -25,10 +27,11 @@ let open_elf elf_path =
| Error.Fail _ -> raise NotElf) | Error.Fail _ -> raise NotElf)
)) ))
>>= fun elf_file -> ( >>= fun elf_file -> (
let asm_info = Asm_acquire.acquire_asm elf_path in
let static_info = (match Dwarf.extract_dwarf_static elf_file with let static_info = (match Dwarf.extract_dwarf_static elf_file with
| Some static_info -> static_info | Some static_info -> static_info
| None -> raise NoDwarfStatic) in | 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 [] let elf_files = ref []
@ -46,10 +49,11 @@ let _ =
!elf_files !elf_files
in in
List.iter (fun (ElfHandle(path, _, static_info)) -> List.iter (fun (ElfHandle(path, _, static_info, asm)) ->
let line_info = static_info.ds_evaluated_line_info in ignore asm ;
Format.eprintf "Line infos <%s>:@. %a@." let line_info = static_info.ds_evaluated_line_info in
path Format.eprintf "Line infos <%s>:@. %a@."
(make_pp Dwarf.pp_evaluated_line_info) path
line_info ; (make_pp Dwarf.pp_evaluated_line_info)
) elf_handles line_info ;
) elf_handles