From a163848e8f97693cc160cff228eef8cd2555a6e0 Mon Sep 17 00:00:00 2001 From: Dominique Martinet Date: Wed, 4 Oct 2017 09:32:46 +0900 Subject: add kludge for void* type pointers --- dwarf-extract-struct.c | 10 +++++++++- 1 file changed, 9 insertions(+), 1 deletion(-) 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; -- cgit v1.2.1-2-g3f67