aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
-rw-r--r--debug/DwarfTypes.ml2
-rw-r--r--debug/DwarfUtil.ml18
-rw-r--r--powerpc/PrintDiab.ml24
3 files changed, 41 insertions, 3 deletions
diff --git a/debug/DwarfTypes.ml b/debug/DwarfTypes.ml
index b2779e33..ecb346b9 100644
--- a/debug/DwarfTypes.ml
+++ b/debug/DwarfTypes.ml
@@ -36,7 +36,7 @@ type language =
| DW_LANG_C
| DW_LANG_C89
-type block = string (* Used as bitvector *)
+type block = string
type location_value =
| LocConst of constant
diff --git a/debug/DwarfUtil.ml b/debug/DwarfUtil.ml
index 2123d1d7..4e29c0bf 100644
--- a/debug/DwarfUtil.ml
+++ b/debug/DwarfUtil.ml
@@ -77,6 +77,11 @@ module type ABBRV_DEFS =
sig
val string_of_byte: bool -> string
val string_of_uleb: int -> string
+ val abbrv_section_start: out_channel -> unit
+ val abbrv_section_end: out_channel -> unit
+ val abbrv_prologue: out_channel -> int -> unit
+ val abbrv_epilogue: out_channel -> unit
+ val get_abbrv_start_addr: unit -> int
val sibling_type_abbr: int
val decl_file_type_abbr: int
val decl_line_type_abbr: int
@@ -115,7 +120,7 @@ module AbbrvPrinter(Defs:ABBRV_DEFS) =
let abbrv = !curr_abbrv in
incr curr_abbrv;abbrv
- let abbrvs: string list ref = ref []
+ let abbrvs: (string * int) list ref = ref []
let abbrv_mapping: (string,int) Hashtbl.t = Hashtbl.create 7
@@ -331,10 +336,19 @@ module AbbrvPrinter(Defs:ABBRV_DEFS) =
(try
Hashtbl.find abbrv_mapping abbrv_string
with Not_found ->
- abbrvs:=abbrv_string::!abbrvs;
let id = next_abbrv in
+ abbrvs:=(abbrv_string,id)::!abbrvs;
Hashtbl.add abbrv_mapping abbrv_string id;
id)
+ let print_abbrv oc =
+ let abbrvs = List.sort (fun (_,a) (_,b) -> Pervasives.compare a b) !abbrvs in
+ Defs.abbrv_section_start oc;
+ List.iter (fun (s,id) ->
+ Defs.abbrv_prologue oc id;
+ output_string oc s;
+ Defs.abbrv_epilogue oc) abbrvs;
+ Defs.abbrv_section_end oc
+
end)
diff --git a/powerpc/PrintDiab.ml b/powerpc/PrintDiab.ml
index 59a2951e..7606cbcf 100644
--- a/powerpc/PrintDiab.ml
+++ b/powerpc/PrintDiab.ml
@@ -106,6 +106,10 @@ module Diab_System =
let string_of_uleb v =
Printf.sprintf " .uleb128 %d\n" v
+
+ let abbrv_start_addr = ref (-1)
+
+ let get_abbrv_start_addr () = !abbrv_start_addr
let sibling_type_abbr = 0x13
let decl_file_type_abbr = 0x6
@@ -134,6 +138,26 @@ module Diab_System =
let data_location_ref_type_abbr = 0x13
let bound_const_type_abbr = 0xf
let bound_ref_type_abbr=0x13
+
+
+ let abbrv_section_start oc =
+ fprintf oc " .section .debug_abbrev,,n\n";
+ let lbl = new_label () in
+ abbrv_start_addr := lbl;
+ label oc lbl
+
+ let abbrv_section_end oc =
+ fprintf oc " .section .debug_abbrev,,n\n";
+ fprintf oc " .sleb128 0\n"
+
+ let abbrv_prologue oc id =
+ fprintf oc " .section .debug_abbrev,,n\n";
+ fprintf oc " .uleb128 %d\n" id
+
+ let abbrv_epilogue oc =
+ fprintf oc " .uleb128 0\n";
+ fprintf oc " .uleb128 0\n"
+
end:ABBRV_DEFS)
end:SYSTEM)