Skip to content

Commit

Permalink
---
Browse files Browse the repository at this point in the history
yaml
---
r: 169567
b: refs/heads/master
c: afb7b4f
h: refs/heads/master
i:
  169565: 9501c0a
  169563: 0c96107
  169559: 31b03ed
  169551: 02ff904
  169535: 75af5f6
v: v3
  • Loading branch information
Arnaldo Carvalho de Melo authored and Ingo Molnar committed Nov 2, 2009
1 parent b02818e commit ba5637a
Show file tree
Hide file tree
Showing 4 changed files with 24 additions and 20 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: 3ed67776fc23061180896086a206a02be649dd26
refs/heads/master: afb7b4f08e274cecd8337f9444affa288a9cd4c1
2 changes: 2 additions & 0 deletions trunk/tools/perf/util/event.h
Original file line number Diff line number Diff line change
Expand Up @@ -105,6 +105,8 @@ struct symbol;

typedef int (*symbol_filter_t)(struct map *map, struct symbol *sym);

void map__init(struct map *self, u64 start, u64 end, u64 pgoff,
struct dso *dso);
struct map *map__new(struct mmap_event *event, char *cwd, int cwdlen,
unsigned int sym_priv_size);
struct map *map__clone(struct map *self);
Expand Down
28 changes: 18 additions & 10 deletions trunk/tools/perf/util/map.c
Original file line number Diff line number Diff line change
Expand Up @@ -20,6 +20,18 @@ static int strcommon(const char *pathname, char *cwd, int cwdlen)
return n;
}

void map__init(struct map *self, u64 start, u64 end, u64 pgoff,
struct dso *dso)
{
self->start = start;
self->end = end;
self->pgoff = pgoff;
self->dso = dso;
self->map_ip = map__map_ip;
self->unmap_ip = map__unmap_ip;
RB_CLEAR_NODE(&self->rb_node);
}

struct map *map__new(struct mmap_event *event, char *cwd, int cwdlen,
unsigned int sym_priv_size)
{
Expand All @@ -28,6 +40,7 @@ struct map *map__new(struct mmap_event *event, char *cwd, int cwdlen,
if (self != NULL) {
const char *filename = event->filename;
char newfilename[PATH_MAX];
struct dso *dso;
int anon;

if (cwd) {
Expand All @@ -47,20 +60,15 @@ struct map *map__new(struct mmap_event *event, char *cwd, int cwdlen,
filename = newfilename;
}

self->start = event->start;
self->end = event->start + event->len;
self->pgoff = event->pgoff;

self->dso = dsos__findnew(filename, sym_priv_size);
if (self->dso == NULL)
dso = dsos__findnew(filename, sym_priv_size);
if (dso == NULL)
goto out_delete;

map__init(self, event->start, event->start + event->len,
event->pgoff, dso);

if (self->dso == vdso || anon)
self->map_ip = self->unmap_ip = identity__map_ip;
else {
self->map_ip = map__map_ip;
self->unmap_ip = map__unmap_ip;
}
}
return self;
out_delete:
Expand Down
12 changes: 3 additions & 9 deletions trunk/tools/perf/util/symbol.c
Original file line number Diff line number Diff line change
Expand Up @@ -1132,18 +1132,12 @@ static struct map *map__new2(u64 start, struct dso *dso)
struct map *self = malloc(sizeof(*self));

if (self != NULL) {
self->start = start;
/*
* Will be filled after we load all the symbols
* ->end will be filled after we load all the symbols
*/
self->end = 0;

self->pgoff = 0;
self->dso = dso;
self->map_ip = map__map_ip;
self->unmap_ip = map__unmap_ip;
RB_CLEAR_NODE(&self->rb_node);
map__init(self, start, 0, 0, dso);
}

return self;
}

Expand Down

0 comments on commit ba5637a

Please sign in to comment.