summaryrefslogtreecommitdiff
path: root/checklink/Disassembler.ml
diff options
context:
space:
mode:
authorGravatar varobert <varobert@fca1b0fc-160b-0410-b1d3-a4f43f01ea2e>2012-06-01 13:57:16 +0000
committerGravatar varobert <varobert@fca1b0fc-160b-0410-b1d3-a4f43f01ea2e>2012-06-01 13:57:16 +0000
commit20d10f71ea444e326a7a77670844214375c72514 (patch)
tree35f45c9b96afb13e884aa8f8208c3cb1ef9061e7 /checklink/Disassembler.ml
parent53f005a11435008373bac84362cef8ddd63a4bc0 (diff)
checklink: new disassembler, error severity, ...
- Added the -disass command-line option to disassemble symbols found in the ELF ; - Field mismatch now stops the matching of two code fragments, while it used to only emit an error in the log ; - Fixed a long-lasting bug in the command-line option ; - Some error messages have been improved. git-svn-id: https://yquem.inria.fr/compcert/svn/compcert/trunk@1908 fca1b0fc-160b-0410-b1d3-a4f43f01ea2e
Diffstat (limited to 'checklink/Disassembler.ml')
-rw-r--r--checklink/Disassembler.ml15
1 files changed, 15 insertions, 0 deletions
diff --git a/checklink/Disassembler.ml b/checklink/Disassembler.ml
new file mode 100644
index 0000000..0e2c688
--- /dev/null
+++ b/checklink/Disassembler.ml
@@ -0,0 +1,15 @@
+open ELF_parsers
+open ELF_types
+open PPC_printers
+open PPC_utils
+
+let disassemble elf sym_name =
+ let sym =
+ List.find
+ (fun sym -> sym.st_name = sym_name)
+ (Array.to_list elf.e_symtab)
+ in
+ match code_of_sym elf sym with
+ | None -> "Couldn't find the code for that symbol name"
+ | Some(ecode) ->
+ string_of_instr_list ecode