Skip to content

Commit

Permalink
---
Browse files Browse the repository at this point in the history
yaml
---
r: 209241
b: refs/heads/master
c: c408fed
h: refs/heads/master
i:
  209239: 1a6a435
v: v3
  • Loading branch information
Arnaldo Carvalho de Melo committed Aug 5, 2010
1 parent 267bc47 commit 472c4e7
Show file tree
Hide file tree
Showing 4 changed files with 24 additions and 10 deletions.
2 changes: 1 addition & 1 deletion [refs]
Original file line number Diff line number Diff line change
@@ -1,2 +1,2 @@
---
refs/heads/master: a7c55cbee0c1bae9bf5a15a08300e91d88706e45
refs/heads/master: c408fedfc4a1fa16e611ffd6f3280301b38614be
1 change: 0 additions & 1 deletion trunk/arch/x86/oprofile/nmi_int.c
Original file line number Diff line number Diff line change
Expand Up @@ -668,7 +668,6 @@ static int __init ppro_init(char **cpu_type)
*cpu_type = "i386/core_2";
break;
case 0x1a:
case 0x1e:
case 0x2e:
spec = &op_arch_perfmon_spec;
*cpu_type = "i386/core_i7";
Expand Down
30 changes: 22 additions & 8 deletions trunk/tools/perf/util/symbol.c
Original file line number Diff line number Diff line change
Expand Up @@ -131,7 +131,8 @@ static void map_groups__fixup_end(struct map_groups *self)
__map_groups__fixup_end(self, i);
}

static struct symbol *symbol__new(u64 start, u64 len, const char *name)
static struct symbol *symbol__new(u64 start, u64 len, u8 binding,
const char *name)
{
size_t namelen = strlen(name) + 1;
struct symbol *self = calloc(1, (symbol_conf.priv_size +
Expand All @@ -144,6 +145,7 @@ static struct symbol *symbol__new(u64 start, u64 len, const char *name)

self->start = start;
self->end = len ? start + len - 1 : start;
self->binding = binding;
self->namelen = namelen - 1;

pr_debug4("%s: %s %#Lx-%#Lx\n", __func__, name, start, self->end);
Expand All @@ -160,8 +162,11 @@ void symbol__delete(struct symbol *self)

static size_t symbol__fprintf(struct symbol *self, FILE *fp)
{
return fprintf(fp, " %llx-%llx %s\n",
self->start, self->end, self->name);
return fprintf(fp, " %llx-%llx %c %s\n",
self->start, self->end,
self->binding == STB_GLOBAL ? 'g' :
self->binding == STB_LOCAL ? 'l' : 'w',
self->name);
}

void dso__set_long_name(struct dso *self, char *name)
Expand Down Expand Up @@ -453,6 +458,14 @@ struct process_kallsyms_args {
struct dso *dso;
};

static u8 kallsyms2elf_type(char type)
{
if (type == 'W')
return STB_WEAK;

return isupper(type) ? STB_GLOBAL : STB_LOCAL;
}

static int map__process_kallsym_symbol(void *arg, const char *name,
char type, u64 start)
{
Expand All @@ -466,7 +479,7 @@ static int map__process_kallsym_symbol(void *arg, const char *name,
/*
* Will fix up the end later, when we have all symbols sorted.
*/
sym = symbol__new(start, 0, name);
sym = symbol__new(start, 0, kallsyms2elf_type(type), name);

if (sym == NULL)
return -ENOMEM;
Expand Down Expand Up @@ -661,7 +674,7 @@ static int dso__load_perf_map(struct dso *self, struct map *map,
if (len + 2 >= line_len)
continue;

sym = symbol__new(start, size, line + len);
sym = symbol__new(start, size, STB_GLOBAL, line + len);

if (sym == NULL)
goto out_delete_line;
Expand Down Expand Up @@ -873,7 +886,7 @@ static int dso__synthesize_plt_symbols(struct dso *self, struct map *map,
"%s@plt", elf_sym__name(&sym, symstrs));

f = symbol__new(plt_offset, shdr_plt.sh_entsize,
sympltname);
STB_GLOBAL, sympltname);
if (!f)
goto out_elf_end;

Expand All @@ -895,7 +908,7 @@ static int dso__synthesize_plt_symbols(struct dso *self, struct map *map,
"%s@plt", elf_sym__name(&sym, symstrs));

f = symbol__new(plt_offset, shdr_plt.sh_entsize,
sympltname);
STB_GLOBAL, sympltname);
if (!f)
goto out_elf_end;

Expand Down Expand Up @@ -1146,7 +1159,8 @@ static int dso__load_sym(struct dso *self, struct map *map, const char *name,
if (demangled != NULL)
elf_name = demangled;
new_symbol:
f = symbol__new(sym.st_value, sym.st_size, elf_name);
f = symbol__new(sym.st_value, sym.st_size,
GELF_ST_BIND(sym.st_info), elf_name);
free(demangled);
if (!f)
goto out_elf_end;
Expand Down
1 change: 1 addition & 0 deletions trunk/tools/perf/util/symbol.h
Original file line number Diff line number Diff line change
Expand Up @@ -53,6 +53,7 @@ struct symbol {
u64 start;
u64 end;
u16 namelen;
u8 binding;
char name[0];
};

Expand Down

0 comments on commit 472c4e7

Please sign in to comment.