aboutsummaryrefslogtreecommitdiffstats
path: root/debug/Dwarfgen.ml
diff options
context:
space:
mode:
authorBernhard Schommer <bernhardschommer@gmail.com>2015-10-02 16:24:01 +0200
committerBernhard Schommer <bernhardschommer@gmail.com>2015-10-02 16:24:01 +0200
commit2bfa77d9eb3940b9b46865f7ebe760365164d312 (patch)
treed39bdaaa046c817f547ad6a04af0b83878176b06 /debug/Dwarfgen.ml
parenta0bef6920c64f2d0e51d4bdce2f08c927373fb66 (diff)
downloadcompcert-kvx-2bfa77d9eb3940b9b46865f7ebe760365164d312.tar.gz
compcert-kvx-2bfa77d9eb3940b9b46865f7ebe760365164d312.zip
First try of debug information for gcc.
Diffstat (limited to 'debug/Dwarfgen.ml')
-rw-r--r--debug/Dwarfgen.ml28
1 files changed, 22 insertions, 6 deletions
diff --git a/debug/Dwarfgen.ml b/debug/Dwarfgen.ml
index 0a18b4e3..d2cdecbf 100644
--- a/debug/Dwarfgen.ml
+++ b/debug/Dwarfgen.ml
@@ -440,7 +440,7 @@ let definition_to_entry file (acc,bcc) id t =
module StringMap = Map.Make(String)
let diab_file_loc sec (f,l) =
- Hashtbl.find filenum (sec,f),l
+ Diab_file_loc (Hashtbl.find filenum (sec,f),l)
let gen_diab_debug_info sec_name var_section : debug_entries =
let defs = Hashtbl.fold (fun id t acc ->
@@ -453,18 +453,34 @@ let gen_diab_debug_info sec_name var_section : debug_entries =
let defs,(ty,locs) = List.fold_left (fun (acc,bcc) (id,t) ->
let t,bcc = definition_to_entry (diab_file_loc s) bcc id t in
t::acc,bcc) ([],(IntSet.empty,[])) defs in
- let line_start,low_pc,debug_start,_ = Hashtbl.find compilation_section_start s
+ let low_pc = Hashtbl.find compilation_section_start s
+ and line_start,debug_start,_ = Hashtbl.find diab_additional s
and high_pc = Hashtbl.find compilation_section_end s in
let cp = {
compile_unit_name = !file_name;
compile_unit_low_pc = low_pc;
- compile_unit_high_pc = high_pc;
- compile_unit_stmt_list = line_start;
+ compile_unit_high_pc = high_pc;
} in
let cp = new_entry (next_id ()) (DW_TAG_compile_unit cp) in
let cp = add_children cp ((gen_types (diab_file_loc s) ty) @ defs) in
- (s,debug_start,cp,(low_pc,locs))::acc) defs [] in
+ (s,debug_start,line_start,cp,(low_pc,locs))::acc) defs [] in
Diab entries
+let gnu_file_loc (f,l) =
+ Gnu_file_loc ((fst (Hashtbl.find Fileinfo.filename_info f),l))
+
let gen_gnu_debug_info sec_name var_section : debug_entries =
- Diab []
+ let low_pc = Hashtbl.find compilation_section_start ".text"
+ and high_pc = Hashtbl.find compilation_section_end ".text" in
+ let defs,(ty,locs) = Hashtbl.fold (fun id t (acc,bcc) ->
+ let t,bcc = definition_to_entry gnu_file_loc bcc id t in
+ t::acc,bcc) definitions ([],(IntSet.empty,[])) in
+ let types = gen_types gnu_file_loc ty in
+ let cp = {
+ compile_unit_name = !file_name;
+ compile_unit_low_pc = low_pc;
+ compile_unit_high_pc = high_pc;
+ } in
+ let cp = new_entry (next_id ()) (DW_TAG_compile_unit cp) in
+ let cp = add_children cp (types@defs) in
+ Gnu (cp,(low_pc,locs))