aboutsummaryrefslogtreecommitdiffstats
path: root/debug
diff options
context:
space:
mode:
authorBernhard Schommer <bernhardschommer@gmail.com>2015-08-24 17:21:01 +0200
committerBernhard Schommer <bernhardschommer@gmail.com>2015-08-24 17:21:01 +0200
commitc3579778940839b9d4753ec47169ceadda55c083 (patch)
tree3c2a835983cd5d3f093095902aa1f80dca3f7164 /debug
parent389f3e9554a7d29a8afa8d3c88804f9f988abdfe (diff)
downloadcompcert-kvx-c3579778940839b9d4753ec47169ceadda55c083.tar.gz
compcert-kvx-c3579778940839b9d4753ec47169ceadda55c083.zip
Fixed error in handling of anonymous struct/union/enum types.
Composite types should be always handled by the composite_type_info table and not by the normal type table.
Diffstat (limited to 'debug')
-rw-r--r--debug/CtoDwarf.ml23
1 files changed, 15 insertions, 8 deletions
diff --git a/debug/CtoDwarf.ml b/debug/CtoDwarf.ml
index 753f4cdd..c5f1142c 100644
--- a/debug/CtoDwarf.ml
+++ b/debug/CtoDwarf.ml
@@ -197,7 +197,7 @@ and array_to_dwarf_tag child size =
match s with
| None -> None
| Some i ->
- let i = Int64.to_int i in
+ let i = Int64.to_int (Int64.sub i Int64.one) in
let s =
{
subrange_type = None;
@@ -276,23 +276,30 @@ and attr_type_to_dwarf typ typ_string =
(* Translate a given type to its dwarf representation *)
and type_to_dwarf (typ: typ): int * dw_entry list =
- let typ = strip_attributes typ in
- let typ_string = typ_to_string typ in
- try
- Hashtbl.find type_table typ_string,[]
- with Not_found ->
- attr_type_to_dwarf typ typ_string
+ match typ with
+ | TStruct (i,_)
+ | TUnion (i,_)
+ | TEnum (i,_) ->
+ let t = get_composite_type i.stamp in
+ t,[]
+ | _ ->
+ let typ = strip_attributes typ in
+ let typ_string = typ_to_string typ in
+ try
+ Hashtbl.find type_table typ_string,[]
+ with Not_found ->
+ attr_type_to_dwarf typ typ_string
(* Translate a typedef to its corresponding dwarf representation *)
let typedef_to_dwarf gloc (name,t) =
let i,t = type_to_dwarf t in
- Hashtbl.add typedef_table name i;
let td = {
typedef_file_loc = gloc;
typedef_name = name;
typedef_type = i;
} in
let td = new_entry (DW_TAG_typedef td) in
+ Hashtbl.add typedef_table name td.id;
td::t
(* Translate a global var to its corresponding dwarf representation *)