Skip to content

Commit

Permalink
---
Browse files Browse the repository at this point in the history
yaml
---
r: 169649
b: refs/heads/master
c: d3379ab
h: refs/heads/master
i:
  169647: 4d74a38
v: v3
  • Loading branch information
Arnaldo Carvalho de Melo authored and Ingo Molnar committed Nov 19, 2009
1 parent 69eae08 commit a04324d
Show file tree
Hide file tree
Showing 2 changed files with 17 additions and 37 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: b269876c8d57fb8c801bea1fc34b461646c5abd0
refs/heads/master: d3379ab9050e5522da2aac53d413651fc06be562
52 changes: 16 additions & 36 deletions trunk/tools/perf/util/symbol.c
Original file line number Diff line number Diff line change
Expand Up @@ -962,25 +962,6 @@ int filename__read_build_id(const char *filename, void *bf, size_t size)
return err;
}

static char *dso__read_build_id(struct dso *self)
{
int len;
char *build_id = NULL;
unsigned char rawbf[BUILD_ID_SIZE];

len = filename__read_build_id(self->long_name, rawbf, sizeof(rawbf));
if (len < 0)
goto out;

build_id = malloc(len * 2 + 1);
if (build_id == NULL)
goto out;

build_id__sprintf(rawbf, len, build_id);
out:
return build_id;
}

char dso__symtab_origin(const struct dso *self)
{
static const char origin[] = {
Expand All @@ -1001,7 +982,8 @@ char dso__symtab_origin(const struct dso *self)
int dso__load(struct dso *self, struct map *map, symbol_filter_t filter)
{
int size = PATH_MAX;
char *name = malloc(size), *build_id = NULL;
char *name = malloc(size);
u8 build_id[BUILD_ID_SIZE];
int ret = -1;
int fd;

Expand All @@ -1023,8 +1005,6 @@ int dso__load(struct dso *self, struct map *map, symbol_filter_t filter)

more:
do {
int berr = 0;

self->origin++;
switch (self->origin) {
case DSO__ORIG_FEDORA:
Expand All @@ -1036,12 +1016,18 @@ int dso__load(struct dso *self, struct map *map, symbol_filter_t filter)
self->long_name);
break;
case DSO__ORIG_BUILDID:
build_id = dso__read_build_id(self);
if (build_id != NULL) {
if (filename__read_build_id(self->long_name, build_id,
sizeof(build_id))) {
char build_id_hex[BUILD_ID_SIZE * 2 + 1];

build_id__sprintf(build_id, sizeof(build_id),
build_id_hex);
snprintf(name, size,
"/usr/lib/debug/.build-id/%.2s/%s.debug",
build_id, build_id + 2);
goto compare_build_id;
build_id_hex, build_id_hex + 2);
if (self->has_build_id)
goto compare_build_id;
break;
}
self->origin++;
/* Fall thru */
Expand All @@ -1054,18 +1040,12 @@ int dso__load(struct dso *self, struct map *map, symbol_filter_t filter)
}

if (self->has_build_id) {
bool match;
build_id = malloc(BUILD_ID_SIZE);
if (build_id == NULL)
if (filename__read_build_id(name, build_id,
sizeof(build_id)) < 0)
goto more;
berr = filename__read_build_id(name, build_id,
BUILD_ID_SIZE);
compare_build_id:
match = berr > 0 && memcmp(build_id, self->build_id,
sizeof(self->build_id)) == 0;
free(build_id);
build_id = NULL;
if (!match)
if (memcmp(build_id, self->build_id,
sizeof(self->build_id)) != 0)
goto more;
}

Expand Down

0 comments on commit a04324d

Please sign in to comment.