summaryrefslogtreecommitdiff
path: root/src/elf_model/main.lem
blob: 501657cc2c973c7f0ceb987878854c76d3457705 (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
open import Function
open import String
open import Tuple

open import Bitstring
open import Default_printing
open import Error
open import Missing_pervasives
open import Show

open import Elf_header
open import Elf_file1
open import Elf_executable_file2
open import Elf_executable_file3
open import Elf_linking_file2
open import Elf_linking_file3

open import Sail_interface

let default_hdr_bdl =
  (default_os_specific_print, default_proc_specific_print)

let default_pht_bdl =
  (default_os_specific_print, default_proc_specific_print)

let default_sht_bdl =
  (default_os_specific_print, default_proc_specific_print, default_user_specific_print)

let _ =
  let res =
    Bitstring.acquire "test/power64-executable-2" >>= fun bs0 ->
    Elf_executable_file3.read_elf64_executable_file3 bs0 >>= fun f1 ->
    Elf_executable_file3.get_elf64_symbol_table f1 >>= fun symtab ->
    Elf_executable_file3.get_elf64_symbol_string_table f1 >>= fun strtab ->
    Elf_symbol_table.get_elf64_symbol_image_address symtab strtab >>= fun strs ->
    let _ = Missing_pervasives.print (show strs) in
    return f1
  in
    match res with
      | Fail err -> Missing_pervasives.print ("[!]: " ^ err)
      | Success _ -> Missing_pervasives.print "Success..."
    end