[LIB]: Add the show_only_data_members field to struct conf_fprintf

So that tools can specify if they are interested in printing just the members
that use space in the class layout (DW_TAG_inheritance, DW_TAG_member) and not
things like constructors, private type definitions, etc.

Signed-off-by: Arnaldo Carvalho de Melo <acme@ghostprotocols.net>
This commit is contained in:
Arnaldo Carvalho de Melo 2007-05-30 11:36:54 -03:00
parent cd1e2a7a2d
commit 281955d800
3 changed files with 19 additions and 10 deletions

View File

@ -2194,10 +2194,12 @@ size_t class__fprintf(struct class *self, const struct cu *cu,
if (tag_pos->tag != DW_TAG_member &&
tag_pos->tag != DW_TAG_inheritance) {
printed += tag__fprintf(tag_pos, cu, &cconf, fp);
if (tag_pos->tag != DW_TAG_structure_type)
printed += fprintf(fp, ";\n");
printed += fprintf(fp, "\n");
if (!cconf.show_only_data_members) {
printed += tag__fprintf(tag_pos, cu, &cconf, fp);
if (tag_pos->tag != DW_TAG_structure_type)
printed += fprintf(fp, ";\n");
printed += fprintf(fp, "\n");
}
continue;
}
pos = tag__class_member(tag_pos);

View File

@ -368,14 +368,15 @@ struct enumerator {
struct conf_fprintf {
const char *prefix;
const char *suffix;
uint32_t base_offset;
uint8_t expand_types;
uint8_t rel_offset;
uint8_t emit_stats;
uint8_t show_decl_info;
uint8_t indent;
int32_t type_spacing;
int32_t name_spacing;
uint32_t base_offset;
uint8_t expand_types:1;
uint8_t rel_offset:1;
uint8_t emit_stats:1;
uint8_t show_decl_info:1;
uint8_t indent:1;
uint8_t show_only_data_members:1;
};
extern void dwarves__init(size_t user_cacheline_size);

View File

@ -541,6 +541,11 @@ static const struct argp_option pahole__options[] = {
.key = 'm',
.doc = "show number of methods",
},
{
.name = "show_only_data_members",
.key = 'M',
.doc = "show only the members that use space in the class layout",
},
{
.name = "sizes",
.key = 's',
@ -629,6 +634,7 @@ static error_t pahole__options_parser(int key, char *arg,
case 'n': formatter = nr_members_formatter; break;
case 'N': formatter = class_name_len_formatter; break;
case 'm': formatter = nr_methods_formatter; break;
case 'M': conf.show_only_data_members = 1; break;
case 'O': class_dwarf_offset = strtoul(arg, NULL, 0); break;
case 'P': show_packable = 1; break;
case 't': separator = arg[0]; break;