aboutsummaryrefslogtreecommitdiffstats
path: root/debug/DebugInformation.ml
diff options
context:
space:
mode:
authorBernhard Schommer <bernhardschommer@gmail.com>2015-09-16 19:43:35 +0200
committerBernhard Schommer <bernhardschommer@gmail.com>2015-09-16 19:43:35 +0200
commit98cddc7ba45b34fbd71d9a80c27a8e5ec6b311b0 (patch)
tree5a39f62c4e1526dd9e047f74efca164c59504f95 /debug/DebugInformation.ml
parent3344bcf59acb1ae8d43a0d15acb4b824689e706d (diff)
downloadcompcert-kvx-98cddc7ba45b34fbd71d9a80c27a8e5ec6b311b0.tar.gz
compcert-kvx-98cddc7ba45b34fbd71d9a80c27a8e5ec6b311b0.zip
Move more functionality in the new interface.
Added functions to add more information to the debuging interface, like the struct layout with offsets, bitifiled layout and removed the no longer needed mapping from stamp to atom.
Diffstat (limited to 'debug/DebugInformation.ml')
-rw-r--r--debug/DebugInformation.ml35
1 files changed, 30 insertions, 5 deletions
diff --git a/debug/DebugInformation.ml b/debug/DebugInformation.ml
index 30d026c7..53f73115 100644
--- a/debug/DebugInformation.ml
+++ b/debug/DebugInformation.ml
@@ -343,7 +343,9 @@ type function_information = {
fun_return_type: int option; (* Again the special case of void functions *)
fun_vararg: bool;
fun_parameter: parameter_information list;
- fun_locals: int list;
+ fun_locals: int list;
+ fun_low_pc: int option;
+ fun_high_pc: int option;
}
type definition_type =
@@ -373,6 +375,13 @@ let find_fun_stamp id =
| Function f -> id,f
| _ -> assert false
+let find_fun_atom id =
+ let id = (Hashtbl.find atom_to_definition id) in
+ let f = Hashtbl.find definitions id in
+ match f with
+ | Function f -> id,f
+ | _ -> assert false
+
let replace_var id var =
let var = GlobalVariable var in
@@ -388,7 +397,7 @@ let gen_comp_typ sou id at =
else
TUnion (id,at)
-let insert_declaration dec env =
+let insert_global_declaration env dec=
let insert d_dec stamp =
let id = next_id () in
Hashtbl.add definitions id d_dec;
@@ -441,6 +450,8 @@ let insert_declaration dec env =
fun_vararg = f.fd_vararg;
fun_parameter = params;
fun_locals = [];
+ fun_low_pc = None;
+ fun_high_pc = None;
} in
insert (Function fd) f.fd_name.stamp
| Gcompositedecl (sou,id,at) ->
@@ -481,18 +492,28 @@ let insert_declaration dec env =
{en with enum_file_loc = Some dec.gloc; enum_enumerators = enumerator;})
| Gpragma _ -> ()
-let set_member_offset str field offset byte_size =
+let set_member_offset str field offset =
let id = find_type (TStruct (str,[])) in
replace_composite id (fun comp ->
let name f = f.cfd_name = field || match f.cfd_bitfield with Some n -> n = field | _ -> false in
let members = List.map (fun a -> if name a then
- {a with cfd_byte_offset = Some offset; cfd_byte_size = Some byte_size;}
+ {a with cfd_byte_offset = Some offset;}
else a) comp.ct_members in
{comp with ct_members = members;})
let set_composite_size comp sou size =
let id = find_type (gen_comp_typ sou comp []) in
- replace_composite id (fun comp -> {comp with ct_sizeof = Some size;})
+ replace_composite id (fun comp -> {comp with ct_sizeof = size;})
+
+let set_bitfield_offset str field offset underlying size =
+ let id = find_type (TStruct (str,[])) in
+ replace_composite id (fun comp ->
+ let name f = f.cfd_name = field in
+ let members = List.map (fun a -> if name a then
+ {a with cfd_bit_offset = Some offset; cfd_bitfield = Some underlying; cfd_byte_size = Some size}
+ else
+ a) comp.ct_members in
+ {comp with ct_members = members;})
let atom_global_variable id atom =
let id,var = find_var_stamp id.stamp in
@@ -504,6 +525,10 @@ let atom_function id atom =
replace_fun id ({f with fun_atom = Some atom;});
Hashtbl.add atom_to_definition atom id
+let add_fun_addr atom (high,low) =
+ let id,f = find_fun_atom atom in
+ replace_fun id ({f with fun_high_pc = Some high; fun_low_pc = Some low;})
+
let init name =
id := 0;
file_name := name;