Commit b946cdfc authored by Bernhard Schommer's avatar Bernhard Schommer
Browse files

Allow Anonymous structs, unions and enums in debug info.

parent f3ca5a66
......@@ -29,10 +29,10 @@ let type_table: (string, int) Hashtbl.t = Hashtbl.create 7
let typedef_table: (string, int) Hashtbl.t = Hashtbl.create 7
(* Hashtable from composite table to entry id *)
let composite_types_table: (string, int) Hashtbl.t = Hashtbl.create 7
let composite_types_table: (int, int) Hashtbl.t = Hashtbl.create 7
(* Get the type id of a composite_type *)
let get_composite_type (name: string): int =
let get_composite_type (name: int): int =
try
Hashtbl.find composite_types_table name
with Not_found ->
......@@ -232,7 +232,7 @@ and type_to_dwarf_entry typ typ_string=
| TStruct (i,_)
| TUnion (i,_)
| TEnum (i,_) ->
let t = get_composite_type i.name in
let t = get_composite_type i.stamp in
t,[]
| TNamed (i,at) ->
let t = Hashtbl.find typedef_table i.name in
......@@ -353,9 +353,9 @@ let enum_to_dwarf (n,at,e) gloc =
enumeration_file_loc = Some gloc;
enumeration_byte_size = bs;
enumeration_declaration = Some false;
enumeration_name = n.name;
enumeration_name = if n.name <> "" then Some n.name else None;
} in
let id = get_composite_type n.name in
let id = get_composite_type n.stamp in
let child = List.map enumerator_to_dwarf e in
let enum =
{
......@@ -372,9 +372,9 @@ let struct_to_dwarf (n,at,m) env gloc =
structure_file_loc = Some gloc;
structure_byte_size = info.ci_sizeof;
structure_declaration = Some false;
structure_name = n.name;
structure_name = if n.name <> "" then Some n.name else None;
} in
let id = get_composite_type n.name in
let id = get_composite_type n.stamp in
let rec pack acc bcc l m =
match m with
| [] -> acc,bcc,[]
......@@ -435,9 +435,9 @@ let union_to_dwarf (n,at,m) env gloc =
union_file_loc = Some gloc;
union_byte_size = info.ci_sizeof;
union_declaration = Some false;
union_name = n.name;
union_name = if n.name <> "" then Some n.name else None;
} in
let id = get_composite_type n.name in
let id = get_composite_type n.stamp in
let children,e = mmap
(fun acc f ->
let t,e = type_to_dwarf f.fld_typ in
......
......@@ -112,7 +112,7 @@ module DwarfPrinter(Target: DWARF_TARGET)(DwarfAbbrevs:DWARF_ABBREVS):
add_attr_some e.enumeration_file_loc add_file_loc;
add_byte_size buf;
add_attr_some e.enumeration_declaration add_declaration;
add_name buf
add_attr_some e.enumeration_name add_name
| DW_TAG_enumerator e ->
prologue 0x28;
add_attr_some e.enumerator_file_loc add_file_loc;
......@@ -156,7 +156,7 @@ module DwarfPrinter(Target: DWARF_TARGET)(DwarfAbbrevs:DWARF_ABBREVS):
add_attr_some e.structure_file_loc add_file_loc;
add_attr_some e.structure_byte_size add_byte_size;
add_attr_some e.structure_declaration add_declaration;
add_name buf
add_attr_some e.structure_name add_name
| DW_TAG_subprogram e ->
prologue 0x2e;
add_attr_some e.subprogram_file_loc add_file_loc;
......@@ -187,7 +187,7 @@ module DwarfPrinter(Target: DWARF_TARGET)(DwarfAbbrevs:DWARF_ABBREVS):
add_attr_some e.union_file_loc add_file_loc;
add_attr_some e.union_byte_size add_byte_size;
add_attr_some e.union_declaration add_declaration;
add_name buf
add_attr_some e.union_name add_name
| DW_TAG_unspecified_parameter e ->
prologue 0x18;
add_attr_some e.unspecified_parameter_file_loc add_file_loc;
......@@ -344,7 +344,7 @@ module DwarfPrinter(Target: DWARF_TARGET)(DwarfAbbrevs:DWARF_ABBREVS):
print_file_loc oc et.enumeration_file_loc;
print_uleb128 oc et.enumeration_byte_size;
print_opt_value oc et.enumeration_declaration print_flag;
print_string oc et.enumeration_name
print_opt_value oc et.enumeration_name print_string
let print_enumerator oc en =
print_file_loc oc en.enumerator_file_loc;
......@@ -385,7 +385,7 @@ module DwarfPrinter(Target: DWARF_TARGET)(DwarfAbbrevs:DWARF_ABBREVS):
print_file_loc oc st.structure_file_loc;
print_opt_value oc st.structure_byte_size print_uleb128;
print_opt_value oc st.structure_declaration print_flag;
print_string oc st.structure_name
print_opt_value oc st.structure_name print_string
let print_subprogram oc sp =
let s,e = get_fun_addr sp.subprogram_name in
......@@ -415,7 +415,7 @@ module DwarfPrinter(Target: DWARF_TARGET)(DwarfAbbrevs:DWARF_ABBREVS):
print_file_loc oc ut.union_file_loc;
print_opt_value oc ut.union_byte_size print_uleb128;
print_opt_value oc ut.union_declaration print_flag;
print_string oc ut.union_name
print_opt_value oc ut.union_name print_string
let print_unspecified_parameter oc up =
print_file_loc oc up.unspecified_parameter_file_loc;
......
......@@ -80,7 +80,7 @@ type dw_tag_enumeration_type =
enumeration_file_loc: file_loc option;
enumeration_byte_size: constant;
enumeration_declaration: flag option;
enumeration_name: string;
enumeration_name: string option;
}
type dw_tag_enumerator =
......@@ -135,7 +135,7 @@ type dw_tag_structure_type =
structure_file_loc: file_loc option;
structure_byte_size: constant option;
structure_declaration: flag option;
structure_name: string;
structure_name: string option;
}
type dw_tag_subprogram =
......@@ -172,7 +172,7 @@ type dw_tag_union_type =
union_file_loc: file_loc option;
union_byte_size: constant option;
union_declaration: flag option;
union_name: string;
union_name: string option;
}
type dw_tag_unspecified_parameter =
......
Supports Markdown
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment