diff options
-rw-r--r-- | tools/perf/util/symbol.c | 15 | ||||
-rw-r--r-- | tools/perf/util/symbol.h | 1 |
2 files changed, 16 insertions, 0 deletions
diff --git a/tools/perf/util/symbol.c b/tools/perf/util/symbol.c index 19c9c558454f..aecff69a510d 100644 --- a/tools/perf/util/symbol.c +++ b/tools/perf/util/symbol.c | |||
@@ -345,6 +345,16 @@ static struct symbol *symbols__first(struct rb_root *symbols) | |||
345 | return NULL; | 345 | return NULL; |
346 | } | 346 | } |
347 | 347 | ||
348 | static struct symbol *symbols__last(struct rb_root *symbols) | ||
349 | { | ||
350 | struct rb_node *n = rb_last(symbols); | ||
351 | |||
352 | if (n) | ||
353 | return rb_entry(n, struct symbol, rb_node); | ||
354 | |||
355 | return NULL; | ||
356 | } | ||
357 | |||
348 | static struct symbol *symbols__next(struct symbol *sym) | 358 | static struct symbol *symbols__next(struct symbol *sym) |
349 | { | 359 | { |
350 | struct rb_node *n = rb_next(&sym->rb_node); | 360 | struct rb_node *n = rb_next(&sym->rb_node); |
@@ -466,6 +476,11 @@ struct symbol *dso__first_symbol(struct dso *dso, enum map_type type) | |||
466 | return symbols__first(&dso->symbols[type]); | 476 | return symbols__first(&dso->symbols[type]); |
467 | } | 477 | } |
468 | 478 | ||
479 | struct symbol *dso__last_symbol(struct dso *dso, enum map_type type) | ||
480 | { | ||
481 | return symbols__last(&dso->symbols[type]); | ||
482 | } | ||
483 | |||
469 | struct symbol *dso__next_symbol(struct symbol *sym) | 484 | struct symbol *dso__next_symbol(struct symbol *sym) |
470 | { | 485 | { |
471 | return symbols__next(sym); | 486 | return symbols__next(sym); |
diff --git a/tools/perf/util/symbol.h b/tools/perf/util/symbol.h index 0dacfb7d5b67..d964844eb314 100644 --- a/tools/perf/util/symbol.h +++ b/tools/perf/util/symbol.h | |||
@@ -259,6 +259,7 @@ struct symbol *dso__find_symbol_by_name(struct dso *dso, enum map_type type, | |||
259 | struct symbol *symbol__next_by_name(struct symbol *sym); | 259 | struct symbol *symbol__next_by_name(struct symbol *sym); |
260 | 260 | ||
261 | struct symbol *dso__first_symbol(struct dso *dso, enum map_type type); | 261 | struct symbol *dso__first_symbol(struct dso *dso, enum map_type type); |
262 | struct symbol *dso__last_symbol(struct dso *dso, enum map_type type); | ||
262 | struct symbol *dso__next_symbol(struct symbol *sym); | 263 | struct symbol *dso__next_symbol(struct symbol *sym); |
263 | 264 | ||
264 | enum dso_type dso__type_fd(int fd); | 265 | enum dso_type dso__type_fd(int fd); |