diff options
author | Jun FURUSE / 古瀬 淳 <jun.furuse@gmail.com> | 2008-01-28 05:29:20 +0000 |
---|---|---|
committer | Jun FURUSE / 古瀬 淳 <jun.furuse@gmail.com> | 2008-01-28 05:29:20 +0000 |
commit | 3f4a98da0fbf8a87c674d6737d8c6cec7e8567e5 (patch) | |
tree | f5aa13505824d708414ece1f00219b811315c44a /tools/dumpobj.ml | |
parent | 30f3fa2c5bc27f8c59930741aa1b6dd5a34a6b40 (diff) | |
download | ocaml-gcaml3090.tar.gz |
3.09.1 updategcaml3090
git-svn-id: http://caml.inria.fr/svn/ocaml/branches/gcaml3090@8792 f963ae5c-01c2-4b8c-9fe0-0dff7051ff02
Diffstat (limited to 'tools/dumpobj.ml')
-rw-r--r-- | tools/dumpobj.ml | 30 |
1 files changed, 21 insertions, 9 deletions
diff --git a/tools/dumpobj.ml b/tools/dumpobj.ml index c52942a123..3f39687024 100644 --- a/tools/dumpobj.ml +++ b/tools/dumpobj.ml @@ -14,15 +14,16 @@ (* Disassembler for executable and .cmo object files *) -open Obj -open Printf -open Config open Asttypes -open Lambda +open Config open Emitcode -open Opcodes open Instruct +open Lambda +open Location +open Obj +open Opcodes open Opnames +open Printf (* Read signed and unsigned integers *) @@ -107,6 +108,9 @@ let rec print_struct_const = function (* Print an obj *) +let same_custom x y = + Obj.field x 0 = Obj.field (Obj.repr y) 0 + let rec print_obj x = if Obj.is_block x then begin let tag = Obj.tag x in @@ -122,7 +126,13 @@ let rec print_obj x = printf "%.12g" a.(i) done; printf "|]" - end else if tag < Obj.no_scan_tag then begin + end else if tag = Obj.custom_tag && same_custom x 0l then + printf "%ldl" (Obj.magic x : int32) + else if tag = Obj.custom_tag && same_custom x 0n then + printf "%ndn" (Obj.magic x : nativeint) + else if tag = Obj.custom_tag && same_custom x 0L then + printf "%LdL" (Obj.magic x : int64) + else if tag < Obj.no_scan_tag then begin printf "<%d>" (Obj.tag x); match Obj.size x with 0 -> () @@ -388,9 +398,11 @@ let op_shapes = [ ];; let print_event ev = - printf "File \"%s\", line %d, character %d:\n" ev.ev_char.Lexing.pos_fname - ev.ev_char.Lexing.pos_lnum - (ev.ev_char.Lexing.pos_cnum - ev.ev_char.Lexing.pos_bol) + let ls = ev.ev_loc.loc_start in + let le = ev.ev_loc.loc_end in + printf "File \"%s\", line %d, characters %d-%d:\n" ls.Lexing.pos_fname + ls.Lexing.pos_lnum (ls.Lexing.pos_cnum - ls.Lexing.pos_bol) + (le.Lexing.pos_cnum - ls.Lexing.pos_bol) let print_instr ic = let pos = currpos ic in |