perf symbols: Rename dso->origin to dso->symtab_type

And the DSO__ORIG_ enum to SYMTAB__, to clarify that this is about from
where the symtab was obtained.

Cc: Frederic Weisbecker <fweisbec@gmail.com>
Cc: Ingo Molnar <mingo@elte.hu>
Cc: Mike Galbraith <efault@gmx.de>
Cc: Paul Mackerras <paulus@samba.org>
Cc: Peter Zijlstra <peterz@infradead.org>
Cc: Stephane Eranian <eranian@google.com>
Cc: Tom Zanussi <tzanussi@gmail.com>
LKML-Reference: <new-submission>
Signed-off-by: Arnaldo Carvalho de Melo <acme@redhat.com>
This commit is contained in:
Arnaldo Carvalho de Melo 2011-03-11 13:13:36 -03:00
Родитель 8b8ba4a9a5
Коммит 878b439dcc
4 изменённых файлов: 48 добавлений и 48 удалений

Просмотреть файл

@ -152,7 +152,7 @@ static int parse_source(struct sym_entry *syme)
/* /*
* We can't annotate with just /proc/kallsyms * We can't annotate with just /proc/kallsyms
*/ */
if (map->dso->origin == DSO__ORIG_KERNEL) { if (map->dso->symtab_type == SYMTAB__KALLSYMS) {
pr_err("Can't annotate %s: No vmlinux file was found in the " pr_err("Can't annotate %s: No vmlinux file was found in the "
"path\n", sym->name); "path\n", sym->name);
sleep(1); sleep(1);
@ -769,7 +769,7 @@ static void perf_event__process_sample(const union perf_event *event,
struct symbol *sym = sym_entry__symbol(top.sym_filter_entry); struct symbol *sym = sym_entry__symbol(top.sym_filter_entry);
pr_err("Can't annotate %s", sym->name); pr_err("Can't annotate %s", sym->name);
if (top.sym_filter_entry->map->dso->origin == DSO__ORIG_KERNEL) { if (top.sym_filter_entry->map->dso->symtab_type == SYMTAB__KALLSYMS) {
pr_err(": No vmlinux file was found in the path:\n"); pr_err(": No vmlinux file was found in the path:\n");
machine__fprintf_vmlinux_path(machine, stderr); machine__fprintf_vmlinux_path(machine, stderr);
} else } else

Просмотреть файл

@ -294,7 +294,7 @@ fallback:
free_filename = false; free_filename = false;
} }
if (dso->origin == DSO__ORIG_KERNEL) { if (dso->symtab_type == SYMTAB__KALLSYMS) {
char bf[BUILD_ID_SIZE * 2 + 16] = " with build id "; char bf[BUILD_ID_SIZE * 2 + 16] = " with build id ";
char *build_id_msg = NULL; char *build_id_msg = NULL;

Просмотреть файл

@ -207,7 +207,7 @@ struct dso *dso__new(const char *name)
dso__set_short_name(self, self->name); dso__set_short_name(self, self->name);
for (i = 0; i < MAP__NR_TYPES; ++i) for (i = 0; i < MAP__NR_TYPES; ++i)
self->symbols[i] = self->symbol_names[i] = RB_ROOT; self->symbols[i] = self->symbol_names[i] = RB_ROOT;
self->origin = DSO__ORIG_NOT_FOUND; self->symtab_type = SYMTAB__NOT_FOUND;
self->loaded = 0; self->loaded = 0;
self->sorted_by_name = 0; self->sorted_by_name = 0;
self->has_build_id = 0; self->has_build_id = 0;
@ -680,9 +680,9 @@ int dso__load_kallsyms(struct dso *self, const char *filename,
return -1; return -1;
if (self->kernel == DSO_TYPE_GUEST_KERNEL) if (self->kernel == DSO_TYPE_GUEST_KERNEL)
self->origin = DSO__ORIG_GUEST_KERNEL; self->symtab_type = SYMTAB__GUEST_KALLSYMS;
else else
self->origin = DSO__ORIG_KERNEL; self->symtab_type = SYMTAB__KALLSYMS;
return dso__split_kallsyms(self, map, filter); return dso__split_kallsyms(self, map, filter);
} }
@ -1204,7 +1204,7 @@ static int dso__load_sym(struct dso *self, struct map *map, const char *name,
} }
curr_map->map_ip = identity__map_ip; curr_map->map_ip = identity__map_ip;
curr_map->unmap_ip = identity__map_ip; curr_map->unmap_ip = identity__map_ip;
curr_dso->origin = self->origin; curr_dso->symtab_type = self->symtab_type;
map_groups__insert(kmap->kmaps, curr_map); map_groups__insert(kmap->kmaps, curr_map);
dsos__add(&self->node, curr_dso); dsos__add(&self->node, curr_dso);
dso__set_loaded(curr_dso, map->type); dso__set_loaded(curr_dso, map->type);
@ -1430,21 +1430,21 @@ out:
char dso__symtab_origin(const struct dso *self) char dso__symtab_origin(const struct dso *self)
{ {
static const char origin[] = { static const char origin[] = {
[DSO__ORIG_KERNEL] = 'k', [SYMTAB__KALLSYMS] = 'k',
[DSO__ORIG_JAVA_JIT] = 'j', [SYMTAB__JAVA_JIT] = 'j',
[DSO__ORIG_BUILD_ID_CACHE] = 'B', [SYMTAB__BUILD_ID_CACHE] = 'B',
[DSO__ORIG_FEDORA] = 'f', [SYMTAB__FEDORA_DEBUGINFO] = 'f',
[DSO__ORIG_UBUNTU] = 'u', [SYMTAB__UBUNTU_DEBUGINFO] = 'u',
[DSO__ORIG_BUILDID] = 'b', [SYMTAB__BUILDID_DEBUGINFO] = 'b',
[DSO__ORIG_DSO] = 'd', [SYMTAB__SYSTEM_PATH_DSO] = 'd',
[DSO__ORIG_KMODULE] = 'K', [SYMTAB__SYSTEM_PATH_KMODULE] = 'K',
[DSO__ORIG_GUEST_KERNEL] = 'g', [SYMTAB__GUEST_KALLSYMS] = 'g',
[DSO__ORIG_GUEST_KMODULE] = 'G', [SYMTAB__GUEST_KMODULE] = 'G',
}; };
if (self == NULL || self->origin == DSO__ORIG_NOT_FOUND) if (self == NULL || self->symtab_type == SYMTAB__NOT_FOUND)
return '!'; return '!';
return origin[self->origin]; return origin[self->symtab_type];
} }
int dso__load(struct dso *self, struct map *map, symbol_filter_t filter) int dso__load(struct dso *self, struct map *map, symbol_filter_t filter)
@ -1477,8 +1477,8 @@ int dso__load(struct dso *self, struct map *map, symbol_filter_t filter)
if (strncmp(self->name, "/tmp/perf-", 10) == 0) { if (strncmp(self->name, "/tmp/perf-", 10) == 0) {
ret = dso__load_perf_map(self, map, filter); ret = dso__load_perf_map(self, map, filter);
self->origin = ret > 0 ? DSO__ORIG_JAVA_JIT : self->symtab_type = ret > 0 ? SYMTAB__JAVA_JIT :
DSO__ORIG_NOT_FOUND; SYMTAB__NOT_FOUND;
return ret; return ret;
} }
@ -1486,26 +1486,26 @@ int dso__load(struct dso *self, struct map *map, symbol_filter_t filter)
* On the first pass, only load images if they have a full symtab. * On the first pass, only load images if they have a full symtab.
* Failing that, do a second pass where we accept .dynsym also * Failing that, do a second pass where we accept .dynsym also
*/ */
for (self->origin = DSO__ORIG_BUILD_ID_CACHE, want_symtab = 1; for (self->symtab_type = SYMTAB__BUILD_ID_CACHE, want_symtab = 1;
self->origin != DSO__ORIG_NOT_FOUND; self->symtab_type != SYMTAB__NOT_FOUND;
self->origin++) { self->symtab_type++) {
switch (self->origin) { switch (self->symtab_type) {
case DSO__ORIG_BUILD_ID_CACHE: case SYMTAB__BUILD_ID_CACHE:
/* skip the locally configured cache if a symfs is given */ /* skip the locally configured cache if a symfs is given */
if (symbol_conf.symfs[0] || if (symbol_conf.symfs[0] ||
(dso__build_id_filename(self, name, size) == NULL)) { (dso__build_id_filename(self, name, size) == NULL)) {
continue; continue;
} }
break; break;
case DSO__ORIG_FEDORA: case SYMTAB__FEDORA_DEBUGINFO:
snprintf(name, size, "%s/usr/lib/debug%s.debug", snprintf(name, size, "%s/usr/lib/debug%s.debug",
symbol_conf.symfs, self->long_name); symbol_conf.symfs, self->long_name);
break; break;
case DSO__ORIG_UBUNTU: case SYMTAB__UBUNTU_DEBUGINFO:
snprintf(name, size, "%s/usr/lib/debug%s", snprintf(name, size, "%s/usr/lib/debug%s",
symbol_conf.symfs, self->long_name); symbol_conf.symfs, self->long_name);
break; break;
case DSO__ORIG_BUILDID: { case SYMTAB__BUILDID_DEBUGINFO: {
char build_id_hex[BUILD_ID_SIZE * 2 + 1]; char build_id_hex[BUILD_ID_SIZE * 2 + 1];
if (!self->has_build_id) if (!self->has_build_id)
@ -1519,11 +1519,11 @@ int dso__load(struct dso *self, struct map *map, symbol_filter_t filter)
symbol_conf.symfs, build_id_hex, build_id_hex + 2); symbol_conf.symfs, build_id_hex, build_id_hex + 2);
} }
break; break;
case DSO__ORIG_DSO: case SYMTAB__SYSTEM_PATH_DSO:
snprintf(name, size, "%s%s", snprintf(name, size, "%s%s",
symbol_conf.symfs, self->long_name); symbol_conf.symfs, self->long_name);
break; break;
case DSO__ORIG_GUEST_KMODULE: case SYMTAB__GUEST_KMODULE:
if (map->groups && machine) if (map->groups && machine)
root_dir = machine->root_dir; root_dir = machine->root_dir;
else else
@ -1532,7 +1532,7 @@ int dso__load(struct dso *self, struct map *map, symbol_filter_t filter)
root_dir, self->long_name); root_dir, self->long_name);
break; break;
case DSO__ORIG_KMODULE: case SYMTAB__SYSTEM_PATH_KMODULE:
snprintf(name, size, "%s%s", symbol_conf.symfs, snprintf(name, size, "%s%s", symbol_conf.symfs,
self->long_name); self->long_name);
break; break;
@ -1544,7 +1544,7 @@ int dso__load(struct dso *self, struct map *map, symbol_filter_t filter)
*/ */
if (want_symtab) { if (want_symtab) {
want_symtab = 0; want_symtab = 0;
self->origin = DSO__ORIG_BUILD_ID_CACHE; self->symtab_type = SYMTAB__BUILD_ID_CACHE;
} else } else
continue; continue;
} }
@ -1757,9 +1757,9 @@ struct map *machine__new_module(struct machine *self, u64 start,
return NULL; return NULL;
if (machine__is_host(self)) if (machine__is_host(self))
dso->origin = DSO__ORIG_KMODULE; dso->symtab_type = SYMTAB__SYSTEM_PATH_KMODULE;
else else
dso->origin = DSO__ORIG_GUEST_KMODULE; dso->symtab_type = SYMTAB__GUEST_KMODULE;
map_groups__insert(&self->kmaps, map); map_groups__insert(&self->kmaps, map);
return map; return map;
} }

Просмотреть файл

@ -137,7 +137,7 @@ struct dso {
u8 annotate_warned:1; u8 annotate_warned:1;
u8 sname_alloc:1; u8 sname_alloc:1;
u8 lname_alloc:1; u8 lname_alloc:1;
unsigned char origin; unsigned char symtab_type;
u8 sorted_by_name; u8 sorted_by_name;
u8 loaded; u8 loaded;
u8 build_id[BUILD_ID_SIZE]; u8 build_id[BUILD_ID_SIZE];
@ -188,18 +188,18 @@ size_t dso__fprintf_buildid(struct dso *self, FILE *fp);
size_t dso__fprintf_symbols_by_name(struct dso *self, enum map_type type, FILE *fp); size_t dso__fprintf_symbols_by_name(struct dso *self, enum map_type type, FILE *fp);
size_t dso__fprintf(struct dso *self, enum map_type type, FILE *fp); size_t dso__fprintf(struct dso *self, enum map_type type, FILE *fp);
enum dso_origin { enum symtab_type {
DSO__ORIG_KERNEL = 0, SYMTAB__KALLSYMS = 0,
DSO__ORIG_GUEST_KERNEL, SYMTAB__GUEST_KALLSYMS,
DSO__ORIG_JAVA_JIT, SYMTAB__JAVA_JIT,
DSO__ORIG_BUILD_ID_CACHE, SYMTAB__BUILD_ID_CACHE,
DSO__ORIG_FEDORA, SYMTAB__FEDORA_DEBUGINFO,
DSO__ORIG_UBUNTU, SYMTAB__UBUNTU_DEBUGINFO,
DSO__ORIG_BUILDID, SYMTAB__BUILDID_DEBUGINFO,
DSO__ORIG_DSO, SYMTAB__SYSTEM_PATH_DSO,
DSO__ORIG_GUEST_KMODULE, SYMTAB__GUEST_KMODULE,
DSO__ORIG_KMODULE, SYMTAB__SYSTEM_PATH_KMODULE,
DSO__ORIG_NOT_FOUND, SYMTAB__NOT_FOUND,
}; };
char dso__symtab_origin(const struct dso *self); char dso__symtab_origin(const struct dso *self);