summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorDominique Martinet <asmadeus@codewreck.org>2017-10-04 09:02:53 +0900
committerDominique Martinet <asmadeus@codewreck.org>2017-10-04 09:22:05 +0900
commitf5f6c36784b0b2bb4d5d890b3b9db067f0b73bab (patch)
tree18a0b5191f0bf8315032acc7b5d160abd3337626
parent914e802a67a00b0341d9ad57f3ae5644df20c35a (diff)
fix struct format
-rw-r--r--dwarf-extract-struct.c10
1 files changed, 5 insertions, 5 deletions
diff --git a/dwarf-extract-struct.c b/dwarf-extract-struct.c
index 1007a5c..6f026dc 100644
--- a/dwarf-extract-struct.c
+++ b/dwarf-extract-struct.c
@@ -436,12 +436,12 @@ static void print_field(Dwarf_Debug dbg, Dwarf_Die die, const char *field_name,
}
if (type_tag == DW_TAG_structure_type) {
- snprintf(type_buf, 1024, "struct %s%s",
- pointer ? "*" : "", type_name);
+ snprintf(type_buf, 1024, "struct %s %s",
+ type_name, pointer ? "*" : "");
} else if (type_tag == DW_TAG_base_type
|| type_tag == DW_TAG_typedef) {
- snprintf(type_buf, 1024, "%s%s", pointer ? "*" : "",
- type_name);
+ snprintf(type_buf, 1024, "%s %s", type_name,
+ pointer ? "*" : "");
} else {
const char *tag_name;
@@ -462,7 +462,7 @@ static void print_field(Dwarf_Debug dbg, Dwarf_Die die, const char *field_name,
dwarf_dealloc(dbg, type_die, DW_DLA_DIE);
}
- printf("\t\tstruct {\n\t\t\tchar padding%i[%u]\n\t\t\t%s %s\n\t\t};\n",
+ printf("\t\tstruct {\n\t\t\tchar padding%i[%u];\n\t\t\t%s%s;\n\t\t};\n",
padnum,
(unsigned int) offset,
type_buf, field_name);