perf symbols: Shorten dso__(first|last)_symbol()
authorArnaldo Carvalho de Melo <acme@redhat.com>
Wed, 25 Apr 2018 20:01:46 +0000 (17:01 -0300)
committerArnaldo Carvalho de Melo <acme@redhat.com>
Thu, 26 Apr 2018 16:47:13 +0000 (13:47 -0300)
All users want MAP__FUNCTION, and this split is going away.

Cc: Adrian Hunter <adrian.hunter@intel.com>
Cc: David Ahern <dsahern@gmail.com>
Cc: Jiri Olsa <jolsa@kernel.org>
Cc: Namhyung Kim <namhyung@kernel.org>
Cc: Wang Nan <wangnan0@huawei.com>
Link: https://lkml.kernel.org/n/tip-sm72zwt1f03ma5uw78l6zze0@git.kernel.org
Signed-off-by: Arnaldo Carvalho de Melo <acme@redhat.com>
tools/perf/util/auxtrace.c
tools/perf/util/intel-pt.c
tools/perf/util/symbol.c
tools/perf/util/symbol.h

index 857de69a53610ebfeea697fc61df170986ef53ff..eaf1e10ae7552463e1d4c289671a052cd9dc40ce 100644 (file)
@@ -1915,7 +1915,7 @@ static void print_duplicate_syms(struct dso *dso, const char *sym_name)
 
        pr_err("Multiple symbols with name '%s'\n", sym_name);
 
-       sym = dso__first_symbol(dso, MAP__FUNCTION);
+       sym = dso__first_symbol(dso);
        while (sym) {
                if (dso_sym_match(sym, sym_name, &cnt, -1)) {
                        pr_err("#%d\t0x%"PRIx64"\t%c\t%s\n",
@@ -1945,7 +1945,7 @@ static int find_dso_sym(struct dso *dso, const char *sym_name, u64 *start,
        *start = 0;
        *size = 0;
 
-       sym = dso__first_symbol(dso, MAP__FUNCTION);
+       sym = dso__first_symbol(dso);
        while (sym) {
                if (*start) {
                        if (!*size)
@@ -1972,8 +1972,8 @@ static int find_dso_sym(struct dso *dso, const char *sym_name, u64 *start,
 
 static int addr_filter__entire_dso(struct addr_filter *filt, struct dso *dso)
 {
-       struct symbol *first_sym = dso__first_symbol(dso, MAP__FUNCTION);
-       struct symbol *last_sym = dso__last_symbol(dso, MAP__FUNCTION);
+       struct symbol *first_sym = dso__first_symbol(dso);
+       struct symbol *last_sym = dso__last_symbol(dso);
 
        if (!first_sym || !last_sym) {
                pr_err("Failed to determine filter for %s\nNo symbols found.\n",
index a272b35f6c5ad5aab655fe8b23edb34e17524624..492986a25ef66a78cfda4e4a601f2e4cae78b9d4 100644 (file)
@@ -1563,7 +1563,7 @@ static u64 intel_pt_switch_ip(struct intel_pt *pt, u64 *ptss_ip)
        if (map__load(map))
                return 0;
 
-       start = dso__first_symbol(map->dso, MAP__FUNCTION);
+       start = dso__first_symbol(map->dso);
 
        for (sym = start; sym; sym = dso__next_symbol(sym)) {
                if (sym->binding == STB_GLOBAL &&
index 25701078beab992ff7c376e0dd8a2f40eeac9184..7aa32372f08c178b762dd82098156ee1f122c7ed 100644 (file)
@@ -515,16 +515,26 @@ struct symbol *dso__find_symbol(struct dso *dso,
        return dso->last_find_result[type].symbol;
 }
 
-struct symbol *dso__first_symbol(struct dso *dso, enum map_type type)
+static struct symbol *__dso__first_symbol(struct dso *dso, enum map_type type)
 {
        return symbols__first(&dso->symbols[type]);
 }
 
-struct symbol *dso__last_symbol(struct dso *dso, enum map_type type)
+struct symbol *dso__first_symbol(struct dso *dso)
+{
+       return __dso__first_symbol(dso, MAP__FUNCTION);
+}
+
+static struct symbol *__dso__last_symbol(struct dso *dso, enum map_type type)
 {
        return symbols__last(&dso->symbols[type]);
 }
 
+struct symbol *dso__last_symbol(struct dso *dso)
+{
+       return __dso__last_symbol(dso, MAP__FUNCTION);
+}
+
 struct symbol *dso__next_symbol(struct symbol *sym)
 {
        return symbols__next(sym);
@@ -1218,7 +1228,7 @@ static int dso__load_kcore(struct dso *dso, struct map *map,
        }
 
        /* Find the kernel map using the first symbol */
-       sym = dso__first_symbol(dso, map->type);
+       sym = __dso__first_symbol(dso, map->type);
        list_for_each_entry(new_map, &md.maps, node) {
                if (sym && sym->start >= new_map->start &&
                    sym->start < new_map->end) {
index 70c16741f50a3b94e02f29d674e6d2856710997f..0e95d9478783d8e1fe76cc04553767cce1d57c89 100644 (file)
@@ -268,8 +268,8 @@ struct symbol *dso__find_symbol_by_name(struct dso *dso, enum map_type type,
                                        const char *name);
 struct symbol *symbol__next_by_name(struct symbol *sym);
 
-struct symbol *dso__first_symbol(struct dso *dso, enum map_type type);
-struct symbol *dso__last_symbol(struct dso *dso, enum map_type type);
+struct symbol *dso__first_symbol(struct dso *dso);
+struct symbol *dso__last_symbol(struct dso *dso);
 struct symbol *dso__next_symbol(struct symbol *sym);
 
 enum dso_type dso__type_fd(int fd);