diff --git a/dwarf_loader.c b/dwarf_loader.c index afcf762..632fe5d 100644 --- a/dwarf_loader.c +++ b/dwarf_loader.c @@ -2528,4 +2528,5 @@ struct debug_fmt_ops dwarf__ops = { .tag__decl_file = dwarf_tag__decl_file, .tag__decl_line = dwarf_tag__decl_line, .tag__orig_id = dwarf_tag__orig_id, + .has_alignment_info = true, }; diff --git a/dwarves.c b/dwarves.c index 358f3a6..8492d77 100644 --- a/dwarves.c +++ b/dwarves.c @@ -1682,6 +1682,9 @@ int cus__load_file(struct cus *cus, struct conf_load *conf, if (loader == -1) break; + if (conf->conf_fprintf) + conf->conf_fprintf->has_alignment_info = debug_fmt_table[loader]->has_alignment_info; + err = 0; if (debug_fmt_table[loader]->load_file(cus, conf, filename) == 0) @@ -1698,6 +1701,8 @@ int cus__load_file(struct cus *cus, struct conf_load *conf, } while (debug_fmt_table[i] != NULL) { + if (conf->conf_fprintf) + conf->conf_fprintf->has_alignment_info = debug_fmt_table[i]->has_alignment_info; if (debug_fmt_table[i]->load_file(cus, conf, filename) == 0) return 0; ++i; diff --git a/dwarves.h b/dwarves.h index b297d32..77be0ab 100644 --- a/dwarves.h +++ b/dwarves.h @@ -33,6 +33,8 @@ enum load_steal_kind { */ typedef uint32_t type_id_t; +struct conf_fprintf; + /** struct conf_load - load configuration * @extra_dbg_info - keep original debugging format extra info * (e.g. DWARF's decl_{line,file}, id, etc) @@ -47,6 +49,7 @@ struct conf_load { bool extra_dbg_info; bool fixup_silly_bitfields; bool get_addr_info; + struct conf_fprintf *conf_fprintf; }; /** struct conf_fprintf - hints to the __fprintf routines @@ -69,6 +72,7 @@ struct conf_fprintf { uint8_t rel_offset:1; uint8_t emit_stats:1; uint8_t suppress_comments:1; + uint8_t has_alignment_info:1; uint8_t suppress_aligned_attribute:1; uint8_t suppress_offset_comment:1; uint8_t show_decl_info:1; @@ -180,6 +184,7 @@ struct debug_fmt_ops { const struct cu *cu); const char *(*strings__ptr)(const struct cu *cu, strings_t s); void (*cu__delete)(struct cu *cu); + bool has_alignment_info; }; struct cu { diff --git a/pahole.c b/pahole.c index 5593d90..07b96a0 100644 --- a/pahole.c +++ b/pahole.c @@ -62,7 +62,9 @@ static struct conf_fprintf conf = { .emit_stats = 1, }; -static struct conf_load conf_load; +static struct conf_load conf_load = { + .conf_fprintf = &conf, +}; struct structure { struct list_head node; diff --git a/pdwtags.c b/pdwtags.c index d3c823a..a869767 100644 --- a/pdwtags.c +++ b/pdwtags.c @@ -81,6 +81,7 @@ static enum load_steal_kind pdwtags_stealer(struct cu *cu, static struct conf_load pdwtags_conf_load = { .steal = pdwtags_stealer, + .conf_fprintf = &conf, }; /* Name and version of program. */ diff --git a/pfunct.c b/pfunct.c index 027db16..6cc895a 100644 --- a/pfunct.c +++ b/pfunct.c @@ -36,7 +36,9 @@ static uint64_t addr; static struct conf_fprintf conf; -static struct conf_load conf_load; +static struct conf_load conf_load = { + .conf_fprintf = &conf, +}; struct fn_stats { struct list_head node;