core: Allow the loaders to advertise features they have
For instance, DWARF has DW_AT_alignment, and some output features require that, so let loaders advertise such things, next patch will use this info. Signed-off-by: Arnaldo Carvalho de Melo <acme@redhat.com>
This commit is contained in:
parent
dc6b9437a3
commit
49c27bdd66
|
@ -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,
|
||||
};
|
||||
|
|
|
@ -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;
|
||||
|
|
|
@ -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 {
|
||||
|
|
4
pahole.c
4
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;
|
||||
|
|
|
@ -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. */
|
||||
|
|
Loading…
Reference in New Issue