Merge branch 'master' of master.kernel.org:/pub/scm/linux/kernel/git/acme/pahole
This commit is contained in:
commit
f62770c4a2
8
codiff.c
8
codiff.c
|
@ -408,7 +408,7 @@ static void show_diffs_function(struct function *function, const struct cu *cu,
|
|||
else {
|
||||
char proto[1024], twin_proto[1024];
|
||||
|
||||
printf(" # %zd -> %zd", function__size(function),
|
||||
printf(" # %d -> %d", function__size(function),
|
||||
function__size(twin));
|
||||
if (function->lexblock.nr_lexblocks !=
|
||||
twin->lexblock.nr_lexblocks)
|
||||
|
@ -422,7 +422,7 @@ static void show_diffs_function(struct function *function, const struct cu *cu,
|
|||
twin->lexblock.nr_inline_expansions);
|
||||
if (function->lexblock.size_inline_expansions !=
|
||||
twin->lexblock.size_inline_expansions)
|
||||
printf(", size inlines: %zd -> %zd",
|
||||
printf(", size inlines: %d -> %d",
|
||||
function->lexblock.size_inline_expansions,
|
||||
twin->lexblock.size_inline_expansions);
|
||||
|
||||
|
@ -797,7 +797,7 @@ failure:
|
|||
/* If old_file is a character device, leave its cus empty */
|
||||
if (!S_ISCHR(st.st_mode)) {
|
||||
filenames[0] = old_filename;
|
||||
err = cus__loadfl(old_cus, filenames);
|
||||
err = cus__loadfl(old_cus, NULL, filenames);
|
||||
if (err != 0) {
|
||||
cus__print_error_msg("codiff", old_cus, old_filename, err);
|
||||
return EXIT_FAILURE;
|
||||
|
@ -812,7 +812,7 @@ failure:
|
|||
/* If old_file is a character device, leave its cus empty */
|
||||
if (!S_ISCHR(st.st_mode)) {
|
||||
filenames[0] = new_filename;
|
||||
err = cus__loadfl(new_cus, filenames);
|
||||
err = cus__loadfl(new_cus, NULL, filenames);
|
||||
if (err != 0) {
|
||||
cus__print_error_msg("codiff", new_cus, new_filename, err);
|
||||
return EXIT_FAILURE;
|
||||
|
|
|
@ -879,7 +879,8 @@ static int cus__fixup_ctf_bitfields(struct cus *self)
|
|||
return err;
|
||||
}
|
||||
|
||||
int ctf__load(struct cus *self, char *filenames[])
|
||||
int ctf__load(struct cus *self, struct conf_load *conf __unused,
|
||||
char *filenames[])
|
||||
{
|
||||
struct ctf_state state;
|
||||
int wordsize;
|
||||
|
|
|
@ -9,7 +9,8 @@
|
|||
*/
|
||||
|
||||
struct cus;
|
||||
struct conf_load;
|
||||
|
||||
int ctf__load(struct cus *self, char *filenames[]);
|
||||
int ctf__load(struct cus *self, struct conf_load *conf, char *filenames[]);
|
||||
|
||||
#endif /* _CTF_LOADER_H_ */
|
||||
|
|
|
@ -698,7 +698,7 @@ static int function__emit_probes(struct function *self, uint32_t function_id,
|
|||
parameter__name(pos));
|
||||
|
||||
fprintf(fp_methods,
|
||||
"\tctracer__method_hook(%d, %d, $%s%s%s, %zd);\n",
|
||||
"\tctracer__method_hook(%d, %d, $%s%s%s, %d);\n",
|
||||
probe_type,
|
||||
function_id,
|
||||
parameter__name(pos),
|
||||
|
|
|
@ -49,7 +49,7 @@ int main(int argc __unused, char *argv[])
|
|||
return EXIT_FAILURE;
|
||||
}
|
||||
|
||||
err = cus__loadfl(cus, argv + 1);
|
||||
err = cus__loadfl(cus, NULL, argv + 1);
|
||||
if (err != 0)
|
||||
return EXIT_FAILURE;
|
||||
|
||||
|
|
|
@ -247,18 +247,24 @@ static int attr_location(Dwarf_Die *die, Dwarf_Op **expr, size_t *exprlen)
|
|||
|
||||
static void *tag__alloc(size_t size)
|
||||
{
|
||||
struct dwarf_tag *dtag;
|
||||
struct tag *self = malloc(size + sizeof(*dtag));
|
||||
struct dwarf_tag *dtag = malloc(sizeof(*dtag));
|
||||
|
||||
if (self != NULL) {
|
||||
dtag = ((void *)self) + size;
|
||||
dtag->tag = self;
|
||||
self->priv = dtag;
|
||||
dtag->type = 0;
|
||||
self->type = 0;
|
||||
self->top_level = 0;
|
||||
if (dtag == NULL)
|
||||
return NULL;
|
||||
|
||||
struct tag *self = malloc(size);
|
||||
|
||||
if (self == NULL) {
|
||||
free(dtag);
|
||||
return NULL;
|
||||
}
|
||||
|
||||
dtag->tag = self;
|
||||
self->priv = dtag;
|
||||
dtag->type = 0;
|
||||
self->type = 0;
|
||||
self->top_level = 0;
|
||||
|
||||
return self;
|
||||
}
|
||||
|
||||
|
@ -545,11 +551,16 @@ static struct class *class__new(Dwarf_Die *die)
|
|||
|
||||
static void lexblock__init(struct lexblock *self, Dwarf_Die *die)
|
||||
{
|
||||
if (dwarf_highpc(die, &self->high_pc))
|
||||
self->high_pc = 0;
|
||||
Dwarf_Off high_pc;
|
||||
|
||||
if (dwarf_lowpc(die, &self->low_pc))
|
||||
self->low_pc = 0;
|
||||
|
||||
if (dwarf_highpc(die, &high_pc))
|
||||
self->size = 0;
|
||||
else
|
||||
self->size = high_pc - self->low_pc;
|
||||
|
||||
INIT_LIST_HEAD(&self->tags);
|
||||
|
||||
self->size_inline_expansions =
|
||||
|
@ -1491,31 +1502,32 @@ static void cu__recode_dwarf_types(struct cu *self)
|
|||
}
|
||||
|
||||
static const char *dwarf_tag__decl_file(const struct tag *self,
|
||||
const struct cu *cu __unused)
|
||||
const struct cu *cu)
|
||||
{
|
||||
struct dwarf_tag *dtag = self->priv;
|
||||
return dtag ? strings__ptr(strings, dtag->decl_file) : NULL;
|
||||
return cu->extra_dbg_info ?
|
||||
strings__ptr(strings, dtag->decl_file) : NULL;
|
||||
}
|
||||
|
||||
static uint32_t dwarf_tag__decl_line(const struct tag *self,
|
||||
const struct cu *cu __unused)
|
||||
const struct cu *cu)
|
||||
{
|
||||
struct dwarf_tag *dtag = self->priv;
|
||||
return dtag ? dtag->decl_line : 0;
|
||||
return cu->extra_dbg_info ? dtag->decl_line : 0;
|
||||
}
|
||||
|
||||
static unsigned long long dwarf_tag__orig_id(const struct tag *self,
|
||||
const struct cu *cu __unused)
|
||||
const struct cu *cu)
|
||||
{
|
||||
struct dwarf_tag *dtag = self->priv;
|
||||
return dtag ? dtag->id : 0;
|
||||
return cu->extra_dbg_info ? dtag->id : 0;
|
||||
}
|
||||
|
||||
static unsigned long long dwarf_tag__orig_type(const struct tag *self,
|
||||
const struct cu *cu __unused)
|
||||
const struct cu *cu)
|
||||
{
|
||||
struct dwarf_tag *dtag = self->priv;
|
||||
return dtag ? dtag->type : 0;
|
||||
return cu->extra_dbg_info ? dtag->type : 0;
|
||||
}
|
||||
|
||||
static struct cu_orig_info dwarf_orig_info_ops = {
|
||||
|
@ -1525,6 +1537,14 @@ static struct cu_orig_info dwarf_orig_info_ops = {
|
|||
.tag__orig_type = dwarf_tag__orig_type,
|
||||
};
|
||||
|
||||
static int tag__delete_priv(struct tag *self, struct cu *cu __unused,
|
||||
void *cookie __unused)
|
||||
{
|
||||
free(self->priv);
|
||||
self->priv = NULL;
|
||||
return 0;
|
||||
}
|
||||
|
||||
static void die__process(Dwarf_Die *die, struct cu *cu)
|
||||
{
|
||||
Dwarf_Die child;
|
||||
|
@ -1555,7 +1575,8 @@ static void die__process(Dwarf_Die *die, struct cu *cu)
|
|||
cu__recode_dwarf_types(cu);
|
||||
}
|
||||
|
||||
static void cus__load_module(struct cus *self, Dwfl_Module *mod, Dwarf *dw)
|
||||
static void cus__load_module(struct cus *self, struct conf_load *conf,
|
||||
Dwfl_Module *mod, Dwarf *dw)
|
||||
{
|
||||
Dwarf_Off off = 0, noff;
|
||||
size_t cuhl;
|
||||
|
@ -1579,19 +1600,28 @@ static void cus__load_module(struct cus *self, Dwfl_Module *mod, Dwarf *dw)
|
|||
build_id, build_id_len);
|
||||
if (cu == NULL)
|
||||
oom("cu__new");
|
||||
cu->extra_dbg_info = conf ? conf->extra_dbg_info : 0;
|
||||
die__process(cu_die, cu);
|
||||
cus__add(self, cu);
|
||||
if (!cu->extra_dbg_info)
|
||||
cu__for_all_tags(cu, tag__delete_priv, NULL);
|
||||
off = noff;
|
||||
}
|
||||
}
|
||||
|
||||
struct process_dwflmod_parms {
|
||||
struct cus *cus;
|
||||
struct conf_load *conf;
|
||||
};
|
||||
|
||||
static int cus__process_dwflmod(Dwfl_Module *dwflmod,
|
||||
void **userdata __unused,
|
||||
const char *name __unused,
|
||||
Dwarf_Addr base __unused,
|
||||
void *arg)
|
||||
{
|
||||
struct cus *self = arg;
|
||||
struct process_dwflmod_parms *parms = arg;
|
||||
struct cus *self = parms->cus;
|
||||
/*
|
||||
* WARNING: Don't remove the seemingly useless call to
|
||||
* dwfl_module_getelf, as it will change dwflmod internal state in a
|
||||
|
@ -1604,7 +1634,7 @@ static int cus__process_dwflmod(Dwfl_Module *dwflmod,
|
|||
Dwarf *dw = dwfl_module_getdwarf(dwflmod, &dwbias);
|
||||
|
||||
if (dw != NULL)
|
||||
cus__load_module(self, dwflmod, dw);
|
||||
cus__load_module(self, parms->conf, dwflmod, dw);
|
||||
/*
|
||||
* XXX We will fall back to try finding other debugging
|
||||
* formats (CTF), so no point in telling this to the user
|
||||
|
@ -1618,7 +1648,8 @@ static int cus__process_dwflmod(Dwfl_Module *dwflmod,
|
|||
return DWARF_CB_OK;
|
||||
}
|
||||
|
||||
static int cus__process_file(struct cus *self, int fd, const char *filename)
|
||||
static int cus__process_file(struct cus *self, struct conf_load *conf, int fd,
|
||||
const char *filename)
|
||||
{
|
||||
/* Duplicate an fd for dwfl_report_offline to swallow. */
|
||||
int dwfl_fd = dup(fd);
|
||||
|
@ -1646,8 +1677,13 @@ static int cus__process_file(struct cus *self, int fd, const char *filename)
|
|||
|
||||
dwfl_report_end(dwfl, NULL, NULL);
|
||||
|
||||
struct process_dwflmod_parms parms = {
|
||||
.cus = self,
|
||||
.conf = conf,
|
||||
};
|
||||
|
||||
/* Process the one or more modules gleaned from this file. */
|
||||
dwfl_getmodules(dwfl, cus__process_dwflmod, self, 0);
|
||||
dwfl_getmodules(dwfl, cus__process_dwflmod, &parms, 0);
|
||||
dwfl_end(dwfl);
|
||||
return 0;
|
||||
}
|
||||
|
@ -1696,7 +1732,7 @@ out:
|
|||
return err;
|
||||
}
|
||||
|
||||
int dwarf__load(struct cus *self, char *filenames[], bool parsed __unused)
|
||||
int dwarf__load(struct cus *self, struct conf_load *conf, char *filenames[])
|
||||
{
|
||||
int err = 0, i = 0;
|
||||
|
||||
|
@ -1711,7 +1747,7 @@ int dwarf__load(struct cus *self, char *filenames[], bool parsed __unused)
|
|||
++i;
|
||||
continue;
|
||||
}
|
||||
cus__process_file(self, fd, filenames[i]);
|
||||
cus__process_file(self, conf, fd, filenames[i]);
|
||||
close(fd);
|
||||
++i;
|
||||
}
|
||||
|
|
|
@ -9,8 +9,9 @@
|
|||
*/
|
||||
|
||||
struct cus;
|
||||
struct conf_load;
|
||||
|
||||
int dwarf__load_filename(struct cus *self, const char *filename);
|
||||
int dwarf__load(struct cus *self, char *filenames[]);
|
||||
int dwarf__load(struct cus *self, struct conf_load *conf, char *filenames[]);
|
||||
|
||||
#endif /* _DWARF_LOADER_H_ */
|
||||
|
|
74
dwarves.c
74
dwarves.c
|
@ -517,8 +517,7 @@ int cu__add_tag(struct cu *self, struct tag *tag, long *id)
|
|||
}
|
||||
|
||||
struct cu *cu__new(const char *name, uint8_t addr_size,
|
||||
const unsigned char *build_id,
|
||||
int build_id_len)
|
||||
const unsigned char *build_id, int build_id_len)
|
||||
{
|
||||
struct cu *self = malloc(sizeof(*self) + build_id_len);
|
||||
|
||||
|
@ -541,6 +540,7 @@ struct cu *cu__new(const char *name, uint8_t addr_size,
|
|||
INIT_LIST_HEAD(&self->tool_list);
|
||||
|
||||
self->addr_size = addr_size;
|
||||
self->extra_dbg_info = 0;
|
||||
|
||||
self->nr_inline_expansions = 0;
|
||||
self->size_inline_expansions = 0;
|
||||
|
@ -659,7 +659,7 @@ struct tag *cu__find_base_type_by_name(const struct cu *self,
|
|||
|
||||
struct tag *cu__find_base_type_by_name_and_size(const struct cu *self,
|
||||
const char *name,
|
||||
size_t bit_size,
|
||||
uint16_t bit_size,
|
||||
uint16_t *idp)
|
||||
{
|
||||
uint16_t id;
|
||||
|
@ -1491,7 +1491,7 @@ void lexblock__add_label(struct lexblock *self, struct label *label)
|
|||
|
||||
const struct class_member *class__find_bit_hole(const struct class *self,
|
||||
const struct class_member *trailer,
|
||||
const size_t bit_hole_size)
|
||||
const uint16_t bit_hole_size)
|
||||
{
|
||||
struct class_member *pos;
|
||||
const size_t byte_hole_size = bit_hole_size / 8;
|
||||
|
@ -1855,10 +1855,9 @@ size_t lexblock__fprintf(const struct lexblock *self, const struct cu *cu,
|
|||
printed += function__tag_fprintf(pos, cu, function, indent + 1, fp);
|
||||
printed += fprintf(fp, "%.*s}", indent, tabs);
|
||||
|
||||
if (function->lexblock.low_pc != self->low_pc) {
|
||||
const size_t size = self->high_pc - self->low_pc;
|
||||
printed += fprintf(fp, " /* lexblock size=%zd */", size);
|
||||
}
|
||||
if (function->lexblock.low_pc != self->low_pc)
|
||||
printed += fprintf(fp, " /* lexblock size=%d */", self->size);
|
||||
|
||||
return printed;
|
||||
}
|
||||
|
||||
|
@ -1906,7 +1905,7 @@ size_t function__fprintf_stats(const struct tag *tag_self,
|
|||
struct function *self = tag__function(tag_self);
|
||||
size_t printed = lexblock__fprintf(&self->lexblock, cu, self, 0, fp);
|
||||
|
||||
printed += fprintf(fp, "/* size: %zd", function__size(self));
|
||||
printed += fprintf(fp, "/* size: %d", function__size(self));
|
||||
if (self->lexblock.nr_variables > 0)
|
||||
printed += fprintf(fp, ", variables: %u",
|
||||
self->lexblock.nr_variables);
|
||||
|
@ -1914,7 +1913,7 @@ size_t function__fprintf_stats(const struct tag *tag_self,
|
|||
printed += fprintf(fp, ", goto labels: %u",
|
||||
self->lexblock.nr_labels);
|
||||
if (self->lexblock.nr_inline_expansions > 0)
|
||||
printed += fprintf(fp, ", inline expansions: %u (%zd bytes)",
|
||||
printed += fprintf(fp, ", inline expansions: %u (%d bytes)",
|
||||
self->lexblock.nr_inline_expansions,
|
||||
self->lexblock.size_inline_expansions);
|
||||
return printed + fprintf(fp, " */\n");
|
||||
|
@ -2301,8 +2300,8 @@ size_t class__fprintf(struct class *self, const struct cu *cu,
|
|||
|
||||
if (sum + sum_holes != tself->size - self->padding &&
|
||||
tself->nr_members != 0)
|
||||
printed += fprintf(fp, "\n\n%.*s/* BRAIN FART ALERT! %zd != %u "
|
||||
"+ %u(holes), diff = %zd */\n",
|
||||
printed += fprintf(fp, "\n\n%.*s/* BRAIN FART ALERT! %d != %u "
|
||||
"+ %u(holes), diff = %d */\n",
|
||||
cconf.indent, tabs,
|
||||
tself->size, sum, sum_holes,
|
||||
tself->size - (sum + sum_holes));
|
||||
|
@ -2470,6 +2469,49 @@ int cu__for_each_tag(struct cu *self,
|
|||
return 0;
|
||||
}
|
||||
|
||||
static int list__for_all_tags(struct list_head *self, struct cu *cu,
|
||||
int (*iterator)(struct tag *tag,
|
||||
struct cu *cu, void *cookie),
|
||||
void *cookie)
|
||||
{
|
||||
struct tag *pos;
|
||||
|
||||
list_for_each_entry(pos, self, node) {
|
||||
if (tag__has_namespace(pos)) {
|
||||
if (list__for_all_tags(&tag__namespace(pos)->tags,
|
||||
cu, iterator, cookie))
|
||||
return 1;
|
||||
if (tag__is_struct(pos)) {
|
||||
if (list__for_all_tags(&tag__class(pos)->vtable,
|
||||
cu, iterator, cookie))
|
||||
return 1;
|
||||
}
|
||||
} if (tag__is_function(pos)) {
|
||||
if (list__for_all_tags(&tag__ftype(pos)->parms,
|
||||
cu, iterator, cookie))
|
||||
return 1;
|
||||
if (list__for_all_tags(&tag__function(pos)->lexblock.tags,
|
||||
cu, iterator, cookie))
|
||||
return 1;
|
||||
} if (pos->tag == DW_TAG_subroutine_type) {
|
||||
if (list__for_all_tags(&tag__ftype(pos)->parms,
|
||||
cu, iterator, cookie))
|
||||
return 1;
|
||||
}
|
||||
if (iterator(pos, cu, cookie))
|
||||
return 1;
|
||||
}
|
||||
return 0;
|
||||
}
|
||||
|
||||
int cu__for_all_tags(struct cu *self,
|
||||
int (*iterator)(struct tag *tag,
|
||||
struct cu *cu, void *cookie),
|
||||
void *cookie)
|
||||
{
|
||||
return list__for_all_tags(&self->tags, self, iterator, cookie);
|
||||
}
|
||||
|
||||
void cus__for_each_cu(struct cus *self,
|
||||
int (*iterator)(struct cu *cu, void *cookie),
|
||||
void *cookie,
|
||||
|
@ -2546,9 +2588,9 @@ int cus__load(struct cus *self, const char *filename)
|
|||
return err;
|
||||
}
|
||||
|
||||
int cus__loadfl(struct cus *self, char *filenames[])
|
||||
int cus__loadfl(struct cus *self, struct conf_load *conf, char *filenames[])
|
||||
{
|
||||
int err = dwarf__load(self, filenames);
|
||||
int err = dwarf__load(self, conf, filenames);
|
||||
/*
|
||||
* If dwarf__load fails, try ctf__load. Eventually we should just
|
||||
* register all the shared objects at some directory and ask them
|
||||
|
@ -2559,7 +2601,7 @@ int cus__loadfl(struct cus *self, char *filenames[])
|
|||
* by looking at the list of CUs found:
|
||||
*/
|
||||
if (list_empty(&self->cus))
|
||||
err = ctf__load(self, filenames);
|
||||
err = ctf__load(self, conf, filenames);
|
||||
|
||||
return err;
|
||||
}
|
||||
|
@ -2584,7 +2626,7 @@ struct cus *cus__new(void)
|
|||
return self;
|
||||
}
|
||||
|
||||
int dwarves__init(size_t user_cacheline_size)
|
||||
int dwarves__init(uint16_t user_cacheline_size)
|
||||
{
|
||||
strings = strings__new();
|
||||
|
||||
|
|
42
dwarves.h
42
dwarves.h
|
@ -21,6 +21,14 @@
|
|||
|
||||
extern struct strings *strings;
|
||||
|
||||
/** struct conf_load - load configuration
|
||||
* @extra_dbg_info - keep original debugging format extra info
|
||||
* (e.g. DWARF's decl_{line,file}, id, etc)
|
||||
*/
|
||||
struct conf_load {
|
||||
bool extra_dbg_info;
|
||||
};
|
||||
|
||||
struct cus {
|
||||
struct list_head cus;
|
||||
};
|
||||
|
@ -104,6 +112,7 @@ struct cu {
|
|||
void *priv;
|
||||
struct cu_orig_info *orig_info;
|
||||
uint8_t addr_size;
|
||||
uint8_t extra_dbg_info:1;
|
||||
uint16_t language;
|
||||
unsigned long nr_inline_expansions;
|
||||
size_t size_inline_expansions;
|
||||
|
@ -268,8 +277,8 @@ struct type {
|
|||
struct namespace namespace;
|
||||
struct list_head node;
|
||||
Dwarf_Off specification;
|
||||
size_t size;
|
||||
size_t size_diff;
|
||||
uint32_t size;
|
||||
int32_t size_diff;
|
||||
uint16_t nr_members;
|
||||
uint8_t declaration; /* only one bit used */
|
||||
uint8_t definition_emitted:1;
|
||||
|
@ -400,7 +409,7 @@ static inline int class__is_struct(const struct class *self)
|
|||
struct base_type {
|
||||
struct tag tag;
|
||||
strings_t name;
|
||||
size_t bit_size;
|
||||
uint16_t bit_size;
|
||||
};
|
||||
|
||||
static inline struct base_type *tag__base_type(const struct tag *self)
|
||||
|
@ -408,7 +417,7 @@ static inline struct base_type *tag__base_type(const struct tag *self)
|
|||
return (struct base_type *)self;
|
||||
}
|
||||
|
||||
static inline size_t base_type__size(const struct tag *self)
|
||||
static inline uint16_t base_type__size(const struct tag *self)
|
||||
{
|
||||
return tag__base_type(self)->bit_size / 8;
|
||||
}
|
||||
|
@ -464,12 +473,12 @@ struct lexblock {
|
|||
struct tag tag;
|
||||
struct list_head tags;
|
||||
Dwarf_Addr low_pc;
|
||||
Dwarf_Addr high_pc;
|
||||
uint32_t size;
|
||||
uint16_t nr_inline_expansions;
|
||||
uint16_t nr_labels;
|
||||
uint16_t nr_variables;
|
||||
uint16_t nr_lexblocks;
|
||||
size_t size_inline_expansions;
|
||||
uint32_t size_inline_expansions;
|
||||
};
|
||||
|
||||
static inline struct lexblock *tag__lexblock(const struct tag *self)
|
||||
|
@ -507,7 +516,7 @@ struct function {
|
|||
Dwarf_Off specification;
|
||||
strings_t name;
|
||||
strings_t linkage_name;
|
||||
size_t cu_total_size_inline_expansions;
|
||||
uint32_t cu_total_size_inline_expansions;
|
||||
uint16_t cu_total_nr_inline_expansions;
|
||||
uint8_t inlined:2;
|
||||
uint8_t external:1;
|
||||
|
@ -631,7 +640,7 @@ struct conf_fprintf {
|
|||
uint8_t show_first_biggest_size_base_type_member:1;
|
||||
};
|
||||
|
||||
int dwarves__init(size_t user_cacheline_size);
|
||||
int dwarves__init(uint16_t user_cacheline_size);
|
||||
|
||||
extern void class__find_holes(struct class *self, const struct cu *cu);
|
||||
extern int class__has_hole_ge(const struct class *self, const uint16_t size);
|
||||
|
@ -665,7 +674,8 @@ extern size_t lexblock__fprintf(const struct lexblock *self,
|
|||
const struct cu *cu, struct function *function,
|
||||
uint16_t indent, FILE *fp);
|
||||
|
||||
extern int cus__loadfl(struct cus *self, char *filenames[]);
|
||||
extern int cus__loadfl(struct cus *self, struct conf_load *conf,
|
||||
char *filenames[]);
|
||||
extern int cus__load(struct cus *self, const char *filename);
|
||||
extern int cus__load_dir(struct cus *self, const char *dirname,
|
||||
const char *filename_mask, const int recursive);
|
||||
|
@ -679,7 +689,7 @@ extern struct tag *cu__find_base_type_by_name(const struct cu *self,
|
|||
uint16_t *id);
|
||||
struct tag *cu__find_base_type_by_name_and_size(const struct cu *self,
|
||||
const char *name,
|
||||
size_t bit_size,
|
||||
uint16_t bit_size,
|
||||
uint16_t *id);
|
||||
extern struct tag *cus__find_struct_by_name(const struct cus *self,
|
||||
struct cu **cu,
|
||||
|
@ -718,6 +728,10 @@ extern int cu__for_each_tag(struct cu *self,
|
|||
struct tag *(*filter)(struct tag *tag,
|
||||
struct cu *cu,
|
||||
void *cookie));
|
||||
int cu__for_all_tags(struct cu *self,
|
||||
int (*iterator)(struct tag *tag,
|
||||
struct cu *cu, void *cookie),
|
||||
void *cookie);
|
||||
extern void cus__for_each_cu(struct cus *self,
|
||||
int (*iterator)(struct cu *cu,
|
||||
void *cookie),
|
||||
|
@ -727,14 +741,14 @@ extern void cus__for_each_cu(struct cus *self,
|
|||
extern const struct class_member *
|
||||
class__find_bit_hole(const struct class *self,
|
||||
const struct class_member *trailer,
|
||||
const size_t bit_hole_size);
|
||||
const uint16_t bit_hole_size);
|
||||
|
||||
extern struct tag *cu__find_function_by_name(const struct cu *cu,
|
||||
const char *name);
|
||||
|
||||
static inline size_t function__size(const struct function *self)
|
||||
static __pure inline uint32_t function__size(const struct function *self)
|
||||
{
|
||||
return self->lexblock.high_pc - self->lexblock.low_pc;
|
||||
return self->lexblock.size;
|
||||
}
|
||||
|
||||
static inline int function__declared_inline(const struct function *self)
|
||||
|
@ -793,7 +807,7 @@ static inline uint16_t class__nr_members(const struct class *self)
|
|||
return self->type.nr_members;
|
||||
}
|
||||
|
||||
static inline size_t class__size(const struct class *self)
|
||||
static inline uint32_t class__size(const struct class *self)
|
||||
{
|
||||
return self->type.size;
|
||||
}
|
||||
|
|
|
@ -477,7 +477,7 @@ static struct tag *cu__find_base_type_of_size(const struct cu *cu,
|
|||
type_name = "unsigned char"; break;
|
||||
case sizeof(unsigned short int):
|
||||
type_name = "short unsigned int";
|
||||
type_name = "unsigned short"; break;
|
||||
type_name_alt = "unsigned short"; break;
|
||||
case sizeof(unsigned int):
|
||||
type_name = "unsigned int";
|
||||
type_name_alt = "unsigned"; break;
|
||||
|
@ -746,9 +746,9 @@ static void class__fixup_member_types(struct class *self, const struct cu *cu,
|
|||
real_size,
|
||||
&new_type_id);
|
||||
if (new_type_tag == NULL) {
|
||||
fprintf(stderr, "pahole: couldn't find"
|
||||
fprintf(stderr, "%s: couldn't find"
|
||||
" a base_type of %d bytes!\n",
|
||||
real_size);
|
||||
__func__, real_size);
|
||||
continue;
|
||||
}
|
||||
class__fixup_bitfield_types(self,
|
||||
|
|
17
pahole.c
17
pahole.c
|
@ -57,6 +57,8 @@ static struct conf_fprintf conf = {
|
|||
.emit_stats = 1,
|
||||
};
|
||||
|
||||
static struct conf_load conf_load;
|
||||
|
||||
struct structure {
|
||||
struct list_head node;
|
||||
struct class *class;
|
||||
|
@ -196,7 +198,7 @@ static void nr_methods_formatter(struct structure *self)
|
|||
|
||||
static void size_formatter(struct structure *self)
|
||||
{
|
||||
printf("%s%c%zd%c%u\n", class__name(self->class), separator,
|
||||
printf("%s%c%d%c%u\n", class__name(self->class), separator,
|
||||
class__size(self->class), separator,
|
||||
self->class->nr_holes);
|
||||
}
|
||||
|
@ -988,13 +990,14 @@ static error_t pahole__options_parser(int key, char *arg,
|
|||
case 'c': cacheline_size = atoi(arg); break;
|
||||
case 'D': decl_exclude_prefix = arg;
|
||||
decl_exclude_prefix_len = strlen(decl_exclude_prefix);
|
||||
break;
|
||||
conf_load.extra_dbg_info = 1; break;
|
||||
case 'd': recursive = 1; break;
|
||||
case 'E': conf.expand_types = 1; break;
|
||||
case 'f': find_pointers_in_structs = 1;
|
||||
class_name = arg; break;
|
||||
case 'H': nr_holes = atoi(arg); break;
|
||||
case 'I': conf.show_decl_info = 1; break;
|
||||
case 'I': conf.show_decl_info = 1;
|
||||
conf_load.extra_dbg_info = 1; break;
|
||||
case 'i': find_containers = 1;
|
||||
class_name = arg; break;
|
||||
case 'l': conf.show_first_biggest_size_base_type_member = 1; break;
|
||||
|
@ -1002,8 +1005,10 @@ static error_t pahole__options_parser(int key, char *arg,
|
|||
case 'm': formatter = nr_methods_formatter; break;
|
||||
case 'N': formatter = class_name_len_formatter; break;
|
||||
case 'n': formatter = nr_members_formatter; break;
|
||||
case 'O': class_dwarf_offset = strtoul(arg, NULL, 0); break;
|
||||
case 'P': show_packable = 1; break;
|
||||
case 'O': class_dwarf_offset = strtoul(arg, NULL, 0);
|
||||
conf_load.extra_dbg_info = 1; break;
|
||||
case 'P': show_packable = 1;
|
||||
conf_load.extra_dbg_info = 1; break;
|
||||
case 'p': conf.expand_pointers = 1; break;
|
||||
case 'q': conf.emit_stats = 0;
|
||||
conf.suppress_comments = 1;
|
||||
|
@ -1061,7 +1066,7 @@ int main(int argc, char *argv[])
|
|||
return EXIT_FAILURE;
|
||||
}
|
||||
|
||||
err = cus__loadfl(cus, argv + remaining);
|
||||
err = cus__loadfl(cus, &conf_load, argv + remaining);
|
||||
if (err != 0) {
|
||||
fputs("pahole: No debugging information found\n", stderr);
|
||||
return EXIT_FAILURE;
|
||||
|
|
|
@ -112,7 +112,7 @@ int main(int argc, char *argv[])
|
|||
return EXIT_FAILURE;
|
||||
}
|
||||
|
||||
err = cus__loadfl(cus, argv + remaining);
|
||||
err = cus__loadfl(cus, NULL, argv + remaining);
|
||||
if (err != 0)
|
||||
return EXIT_FAILURE;
|
||||
|
||||
|
|
15
pfunct.c
15
pfunct.c
|
@ -29,6 +29,8 @@ static struct type_emissions emissions;
|
|||
|
||||
static struct conf_fprintf conf;
|
||||
|
||||
static struct conf_load conf_load;
|
||||
|
||||
struct fn_stats {
|
||||
struct list_head node;
|
||||
struct tag *tag;
|
||||
|
@ -79,7 +81,7 @@ static void fn_stats_inline_exps_fmtr(const struct fn_stats *self)
|
|||
{
|
||||
struct function *fn = tag__function(self->tag);
|
||||
if (fn->lexblock.nr_inline_expansions > 0)
|
||||
printf("%s: %u %zd\n", function__name(fn, self->cu),
|
||||
printf("%s: %u %d\n", function__name(fn, self->cu),
|
||||
fn->lexblock.nr_inline_expansions,
|
||||
fn->lexblock.size_inline_expansions);
|
||||
}
|
||||
|
@ -476,13 +478,16 @@ static error_t pfunct__options_parser(int key, char *arg,
|
|||
case 'g': formatter = fn_stats_labels_fmtr; break;
|
||||
case 'G': show_cc_uninlined = 1; break;
|
||||
case 'H': show_cc_inlined = 1; break;
|
||||
case 'i': show_inline_expansions = verbose = 1; break;
|
||||
case 'i': show_inline_expansions = verbose = 1;
|
||||
conf_load.extra_dbg_info = 1; break;
|
||||
case 'I': formatter = fn_stats_inline_exps_fmtr; break;
|
||||
case 'l': conf.show_decl_info = 1; break;
|
||||
case 'l': conf.show_decl_info = 1;
|
||||
conf_load.extra_dbg_info = 1; break;
|
||||
case 't': show_total_inline_expansion_stats = 1; break;
|
||||
case 'T': show_variables = 1; break;
|
||||
case 'N': formatter = fn_stats_name_len_fmtr; break;
|
||||
case 'V': verbose = 1; break;
|
||||
case 'V': verbose = 1;
|
||||
conf_load.extra_dbg_info = 1; break;
|
||||
default: return ARGP_ERR_UNKNOWN;
|
||||
}
|
||||
|
||||
|
@ -513,7 +518,7 @@ int main(int argc, char *argv[])
|
|||
return EXIT_FAILURE;
|
||||
}
|
||||
|
||||
err = cus__loadfl(cus, argv + remaining);
|
||||
err = cus__loadfl(cus, &conf_load, argv + remaining);
|
||||
if (err != 0)
|
||||
return EXIT_FAILURE;
|
||||
|
||||
|
|
|
@ -330,7 +330,7 @@ int main(int argc, char *argv[])
|
|||
return EXIT_FAILURE;
|
||||
}
|
||||
|
||||
err = cus__loadfl(cus, argv + remaining);
|
||||
err = cus__loadfl(cus, NULL, argv + remaining);
|
||||
if (err != 0)
|
||||
return EXIT_FAILURE;
|
||||
|
||||
|
|
|
@ -155,7 +155,7 @@ int main(int argc __unused, char *argv[])
|
|||
return EXIT_FAILURE;
|
||||
}
|
||||
|
||||
err = cus__loadfl(cus, argv + 1);
|
||||
err = cus__loadfl(cus, NULL, argv + 1);
|
||||
if (err != 0)
|
||||
return EXIT_FAILURE;
|
||||
|
||||
|
|
4
syscse.c
4
syscse.c
|
@ -55,7 +55,7 @@ static void zero_extend(const int regparm, const struct base_type *bt,
|
|||
}
|
||||
|
||||
printf("\t%s\t$a%d, $a%d, 0"
|
||||
"\t/* zero extend $a%d(%s %s) from %zd to 64-bit */\n",
|
||||
"\t/* zero extend $a%d(%s %s) from %d to 64-bit */\n",
|
||||
instr, regparm, regparm, regparm, base_type__name(bt),
|
||||
parm, bt->bit_size);
|
||||
}
|
||||
|
@ -159,7 +159,7 @@ int main(int argc, char *argv[])
|
|||
argp_help(&argp, stderr, ARGP_HELP_SEE, argv[0]);
|
||||
return EXIT_FAILURE;
|
||||
}
|
||||
err = cus__loadfl(cus, argv + remaining);
|
||||
err = cus__loadfl(cus, NULL, argv + remaining);
|
||||
if (err != 0)
|
||||
return EXIT_FAILURE;
|
||||
|
||||
|
|
Loading…
Reference in New Issue