[CLASSES]: Move passing the object file name from cus__new to cus__load
So that we can load many object files, that is what the next csets will do, to recursively look for files with debug info in a build tree, such as the kernel one. Signed-off-by: Arnaldo Carvalho de Melo <acme@mandriva.com>
This commit is contained in:
parent
a4f099385b
commit
3e7e387ddb
10
classes.c
10
classes.c
|
@ -1683,7 +1683,7 @@ next_sibling:
|
|||
cu__process_die(dwarf, die, cu);
|
||||
}
|
||||
|
||||
int cus__load(struct cus *self)
|
||||
int cus__load(struct cus *self, const char *filename)
|
||||
{
|
||||
Dwarf_Off offset, last_offset, abbrev_offset;
|
||||
uint8_t addr_size, offset_size;
|
||||
|
@ -1691,7 +1691,7 @@ int cus__load(struct cus *self)
|
|||
size_t hdr_size;
|
||||
Dwarf *dwarf;
|
||||
int err = -1;
|
||||
int fd = open(self->filename, O_RDONLY);
|
||||
int fd = open(filename, O_RDONLY);
|
||||
|
||||
if (fd < 0)
|
||||
goto out;
|
||||
|
@ -1729,14 +1729,12 @@ out:
|
|||
return err;
|
||||
}
|
||||
|
||||
struct cus *cus__new(const char *filename)
|
||||
struct cus *cus__new(void)
|
||||
{
|
||||
struct cus *self = malloc(sizeof(*self));
|
||||
|
||||
if (self != NULL) {
|
||||
if (self != NULL)
|
||||
INIT_LIST_HEAD(&self->cus);
|
||||
self->filename = strings__add(filename);
|
||||
}
|
||||
|
||||
return self;
|
||||
}
|
||||
|
|
|
@ -17,7 +17,6 @@
|
|||
|
||||
struct cus {
|
||||
struct list_head cus;
|
||||
const char *filename;
|
||||
};
|
||||
|
||||
struct cu {
|
||||
|
@ -146,8 +145,8 @@ extern void function__print(const struct function *self, int show_stats,
|
|||
const int show_variables,
|
||||
const int show_inline_expansions);
|
||||
|
||||
extern struct cus *cus__new(const char *filename);
|
||||
extern int cus__load(struct cus *self);
|
||||
extern struct cus *cus__new(void);
|
||||
extern int cus__load(struct cus *self, const char *filename);
|
||||
extern struct cu *cus__find_cu_by_name(const struct cus *self,
|
||||
const char *name);
|
||||
extern struct class *cu__find_class_by_id(const struct cu *cu,
|
||||
|
|
8
codiff.c
8
codiff.c
|
@ -434,20 +434,20 @@ int main(int argc, char *argv[])
|
|||
show_terse_type_changes == 0)
|
||||
show_function_diffs = show_struct_diffs = 1;
|
||||
|
||||
old_cus = cus__new(old_filename);
|
||||
new_cus = cus__new(new_filename);
|
||||
old_cus = cus__new();
|
||||
new_cus = cus__new();
|
||||
if (old_cus == NULL || new_cus == NULL) {
|
||||
fputs("codiff: insufficient memory\n", stderr);
|
||||
return EXIT_FAILURE;
|
||||
}
|
||||
|
||||
if (cus__load(old_cus) != 0) {
|
||||
if (cus__load(old_cus, old_filename) != 0) {
|
||||
fprintf(stderr, "codiff: couldn't load DWARF info from %s\n",
|
||||
old_filename);
|
||||
return EXIT_FAILURE;
|
||||
}
|
||||
|
||||
if (cus__load(new_cus) != 0) {
|
||||
if (cus__load(new_cus, new_filename) != 0) {
|
||||
fprintf(stderr, "codiff: couldn't load DWARF info from %s\n",
|
||||
new_filename);
|
||||
return EXIT_FAILURE;
|
||||
|
|
|
@ -191,13 +191,13 @@ int main(int argc, char *argv[])
|
|||
return EXIT_FAILURE;
|
||||
}
|
||||
|
||||
cus = cus__new(file_name);
|
||||
cus = cus__new();
|
||||
if (cus == NULL) {
|
||||
fputs("ctracer: insufficient memory\n", stderr);
|
||||
return EXIT_FAILURE;
|
||||
}
|
||||
|
||||
if (cus__load(cus) != 0) {
|
||||
if (cus__load(cus, file_name) != 0) {
|
||||
fprintf(stderr, "ctracer: couldn't load DWARF info from %s\n",
|
||||
file_name);
|
||||
return EXIT_FAILURE;
|
||||
|
|
4
pahole.c
4
pahole.c
|
@ -322,13 +322,13 @@ int main(int argc, char *argv[])
|
|||
return EXIT_FAILURE;
|
||||
}
|
||||
|
||||
cus = cus__new(file_name);
|
||||
cus = cus__new();
|
||||
if (cus == NULL) {
|
||||
fputs("pahole: insufficient memory\n", stderr);
|
||||
return EXIT_FAILURE;
|
||||
}
|
||||
|
||||
if (cus__load(cus) != 0) {
|
||||
if (cus__load(cus, file_name) != 0) {
|
||||
fprintf(stderr, "pahole: couldn't load DWARF info from %s\n",
|
||||
file_name);
|
||||
return EXIT_FAILURE;
|
||||
|
|
4
pfunct.c
4
pfunct.c
|
@ -352,13 +352,13 @@ int main(int argc, char *argv[])
|
|||
return EXIT_FAILURE;
|
||||
}
|
||||
|
||||
cus = cus__new(file_name);
|
||||
cus = cus__new();
|
||||
if (cus == NULL) {
|
||||
fputs("pfunct: insufficient memory\n", stderr);
|
||||
return EXIT_FAILURE;
|
||||
}
|
||||
|
||||
if (cus__load(cus) != 0) {
|
||||
if (cus__load(cus, file_name) != 0) {
|
||||
fprintf(stderr, "pfunct: couldn't load DWARF info from %s\n",
|
||||
file_name);
|
||||
return EXIT_FAILURE;
|
||||
|
|
|
@ -166,13 +166,13 @@ int main(int argc, char *argv[])
|
|||
return EXIT_FAILURE;
|
||||
}
|
||||
|
||||
cus = cus__new(file_name);
|
||||
cus = cus__new();
|
||||
if (cus == NULL) {
|
||||
fputs("prefcnt: insufficient memory\n", stderr);
|
||||
return EXIT_FAILURE;
|
||||
}
|
||||
|
||||
if (cus__load(cus) != 0) {
|
||||
if (cus__load(cus, file_name) != 0) {
|
||||
fprintf(stderr, "prefcnt: couldn't load DWARF info from %s\n",
|
||||
file_name);
|
||||
return EXIT_FAILURE;
|
||||
|
|
Loading…
Reference in New Issue