summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
-rw-r--r--dwarf-extract-struct.c10
1 files changed, 9 insertions, 1 deletions
diff --git a/dwarf-extract-struct.c b/dwarf-extract-struct.c
index 6f026dc..466c6ce 100644
--- a/dwarf-extract-struct.c
+++ b/dwarf-extract-struct.c
@@ -378,7 +378,12 @@ static void print_field(Dwarf_Debug dbg, Dwarf_Die die, const char *field_name,
rc = dwarf_attr(type_die, DW_AT_type, &pointer_attr,
&err);
- if (rc != DW_DLV_OK) {
+ if (rc == DW_DLV_NO_ENTRY) {
+ /* assume void* */
+ /* XXX find better flow control than goto.. */
+ goto pointer_end;
+ }
+ if (rc == DW_DLV_ERROR) {
fprintf(stderr,
"Error getting pointer attr for type: %s\n",
dwarf_errmsg(err));
@@ -435,6 +440,7 @@ static void print_field(Dwarf_Debug dbg, Dwarf_Die die, const char *field_name,
exit(7);
}
+pointer_end:
if (type_tag == DW_TAG_structure_type) {
snprintf(type_buf, 1024, "struct %s %s",
type_name, pointer ? "*" : "");
@@ -442,6 +448,8 @@ static void print_field(Dwarf_Debug dbg, Dwarf_Die die, const char *field_name,
|| type_tag == DW_TAG_typedef) {
snprintf(type_buf, 1024, "%s %s", type_name,
pointer ? "*" : "");
+ } else if (type_tag == DW_TAG_pointer_type) {
+ snprintf(type_buf, 1024, "void *");
} else {
const char *tag_name;