aboutsummaryrefslogtreecommitdiffstats
path: root/debug/Dwarfgen.ml
diff options
context:
space:
mode:
authorBernhard Schommer <bernhardschommer@gmail.com>2015-09-23 16:49:13 +0200
committerBernhard Schommer <bernhardschommer@gmail.com>2015-09-23 16:49:13 +0200
commitb448fbba97c1008599610d0c9bc834881b9dc219 (patch)
treef244430d915c0818c8ae66c1235316fdac1d683d /debug/Dwarfgen.ml
parent806102dd5492a39b33c2ebb88d6646237ba7f9e6 (diff)
downloadcompcert-kvx-b448fbba97c1008599610d0c9bc834881b9dc219.tar.gz
compcert-kvx-b448fbba97c1008599610d0c9bc834881b9dc219.zip
Added support for printing local variables and fixed issue with .text
Local variables are now added with bogus lexical scopes to reflect the actually lexical scopes. Also this commit fixes assembler problems of the das when a user section with the name ".text" is defined.
Diffstat (limited to 'debug/Dwarfgen.ml')
-rw-r--r--debug/Dwarfgen.ml16
1 files changed, 13 insertions, 3 deletions
diff --git a/debug/Dwarfgen.ml b/debug/Dwarfgen.ml
index 8e29fcaf..15c63b66 100644
--- a/debug/Dwarfgen.ml
+++ b/debug/Dwarfgen.ml
@@ -305,7 +305,17 @@ and local_to_entry acc id =
| LocalVariable v -> local_variable_to_entry acc v id
| Scope v -> scope_to_entry acc v id
+let fun_scope_to_entries acc id =
+ match id with
+ | None -> [],acc
+ | Some id ->
+ let sc = Hashtbl.find local_variables id in
+ (match sc with
+ | Scope sc ->mmap local_to_entry acc sc.scope_variables
+ | _ -> assert false)
+
let function_to_entry acc id f =
+ Printf.printf "Generating information for %s with id %d\n" f.fun_name id;
let f_tag = {
subprogram_file_loc = f.fun_file_loc;
subprogram_external = Some f.fun_external;
@@ -318,8 +328,8 @@ let function_to_entry acc id f =
let acc = match f.fun_return_type with Some s -> IntSet.add s acc | None -> acc in
let f_entry = new_entry id (DW_TAG_subprogram f_tag) in
let params,acc = mmap function_parameter_to_entry acc f.fun_parameter in
-(* let vars = List.map local_variable_to_entry f.fun_locals in*)
- add_children f_entry params,acc
+ let vars,acc = fun_scope_to_entries acc f.fun_scope in
+ add_children f_entry (params@vars),acc
let definition_to_entry acc id t =
match t with
@@ -327,7 +337,7 @@ let definition_to_entry acc id t =
| Function f -> function_to_entry acc id f
let gen_defs () =
- let defs,typ = Hashtbl.fold (fun id t (acc,bcc) -> let t,bcc = definition_to_entry bcc id t in
+ let defs,typ = Hashtbl.fold (fun id t (acc,bcc) -> let t,bcc = definition_to_entry bcc id t in
t::acc,bcc) definitions ([],IntSet.empty) in
List.rev defs,typ