diff --git a/classes.c b/classes.c index 97f8434..2ce9bfa 100644 --- a/classes.c +++ b/classes.c @@ -689,7 +689,7 @@ void cus__for_each_cu(int (*iterator)(struct cu *cu, void *cookie), break; } -void classes__print(const unsigned int tag) +void cu__print_classes(const unsigned int tag) { struct cu *cu_pos; @@ -708,7 +708,7 @@ void classes__print(const unsigned int tag) } } -static struct class *classes__current_class; +static struct class *cu__current_class; static struct cu *current_cu; static unsigned int current_cu_id; @@ -840,7 +840,7 @@ static uint64_t attr_numeric(Dwarf_Die *die, unsigned int name) return 0; } -static void classes__process_die(Dwarf *dwarf, Dwarf_Die *die) +static void cu__process_die(Dwarf *dwarf, Dwarf_Die *die) { Dwarf_Die child; Dwarf_Off cu_offset; @@ -865,9 +865,9 @@ static void classes__process_die(Dwarf *dwarf, Dwarf_Die *die) if (member == NULL) oom("class_member__new"); - class__add_member(classes__current_class, member); + class__add_member(cu__current_class, member); } else if (tag == DW_TAG_subrange_type) - classes__current_class->nr_entries = attr_upper_bound(die); + cu__current_class->nr_entries = attr_upper_bound(die); else if (tag == DW_TAG_variable) { char bf[1024]; uint64_t abstract_origin = attr_numeric(die, @@ -879,10 +879,10 @@ static void classes__process_die(Dwarf *dwarf, Dwarf_Die *die) if (variable == NULL) oom("variable__new"); - class__add_variable(classes__current_class, variable); + class__add_variable(cu__current_class, variable); cu__add_variable(current_cu, variable); } else if (tag == DW_TAG_label) - ++classes__current_class->nr_labels; + ++cu__current_class->nr_labels; else if (tag == DW_TAG_inlined_subroutine) { Dwarf_Addr high_pc, low_pc; if (dwarf_highpc(die, &high_pc)) high_pc = 0; @@ -907,7 +907,7 @@ static void classes__process_die(Dwarf *dwarf, Dwarf_Die *die) if (exp == NULL) oom("inline_expansion__new"); - class__add_inline_expansion(classes__current_class, exp); + class__add_inline_expansion(cu__current_class, exp); goto next_sibling; } else if (tag == DW_TAG_lexical_block) { /* @@ -925,25 +925,25 @@ static void classes__process_die(Dwarf *dwarf, Dwarf_Die *die) dwarf_decl_line(die, &decl_line); - if (classes__current_class != NULL) - cu__add_class(current_cu, classes__current_class); + if (cu__current_class != NULL) + cu__add_class(current_cu, cu__current_class); - classes__current_class = class__new(tag, cu_offset, + cu__current_class = class__new(tag, cu_offset, type, name, size, decl_file, decl_line, inlined, low_pc, high_pc); - if (classes__current_class == NULL) + if (cu__current_class == NULL) oom("class__new"); } if (dwarf_haschildren(die) != 0 && dwarf_child(die, &child) == 0) - classes__process_die(dwarf, &child); + cu__process_die(dwarf, &child); next_sibling: if (dwarf_siblingof (die, die) == 0) - classes__process_die(dwarf, die); + cu__process_die(dwarf, die); } -int classes__load(const char *filename) +int cu__load_file(const char *filename) { Dwarf_Off offset, last_offset, abbrev_offset; uint8_t addr_size, offset_size; @@ -972,7 +972,7 @@ int classes__load(const char *filename) if (current_cu == NULL) oom("cu__new"); ++current_cu_id; - classes__process_die(dwarf, &die); + cu__process_die(dwarf, &die); cus__add(current_cu); } diff --git a/classes.h b/classes.h index 1e01fc9..9d6b491 100644 --- a/classes.h +++ b/classes.h @@ -82,7 +82,7 @@ struct inline_expansion { extern void class__find_holes(struct class *self, const struct cu *cu); extern void class__print(struct class *self, const struct cu *cu); -extern int classes__load(const char *filename); +extern int cu__load_file(const char *filename); extern struct cu *cus__find_cu_by_id(const unsigned int type); extern struct class *cu__find_class_by_id(const struct cu *cu, const uint64_t type); @@ -90,7 +90,7 @@ extern struct class *cu__find_class_by_name(struct cu *cu, const char *name); extern int class__is_struct(const struct class *self, struct cu *cu, struct class **typedef_alias); -extern void classes__print(const unsigned int tag); +extern void cu__print_classes(const unsigned int tag); extern void class__print_inline_expansions(struct class *self, const struct cu *cu); extern void class__print_variables(struct class *self, diff --git a/pahole.c b/pahole.c index 4478fc2..ec39e89 100644 --- a/pahole.c +++ b/pahole.c @@ -182,7 +182,7 @@ int main(int argc, char *argv[]) } } - if (classes__load(file_name) != 0) { + if (cu__load_file(file_name) != 0) { fprintf(stderr, "pahole: couldn't load DWARF info from %s\n", file_name); return EXIT_FAILURE; @@ -206,7 +206,7 @@ int main(int argc, char *argv[]) } else printf("struct %s not found!\n", class_name); } else - classes__print(DW_TAG_structure_type); + cu__print_classes(DW_TAG_structure_type); return EXIT_SUCCESS; } diff --git a/pfunct.c b/pfunct.c index 2ca3c6f..988864f 100644 --- a/pfunct.c +++ b/pfunct.c @@ -347,7 +347,7 @@ int main(int argc, char *argv[]) } } - if (classes__load(file_name) != 0) { + if (cu__load_file(file_name) != 0) { fprintf(stderr, "pfunct: couldn't load DWARF info from %s\n", file_name); return EXIT_FAILURE; @@ -371,7 +371,7 @@ int main(int argc, char *argv[]) else if (class_name != NULL) cus__for_each_cu(cu_class_iterator, class_name); else if (function_name == NULL && !show_inline_expansions_stats) - classes__print(DW_TAG_subprogram); + cu__print_classes(DW_TAG_subprogram); else cus__for_each_cu(cu_function_iterator, function_name);