Commit af07eeb0 authored by Arnaldo Carvalho de Melo's avatar Arnaldo Carvalho de Melo
Browse files

perf symbols: Remove map_type arg from dso__find_symbol()

One more step to ditch MAP__{VARIABLE,FUNCTION}

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-919d1k13ts62pjipnpibvgwd@git.kernel.org


Signed-off-by: default avatarArnaldo Carvalho de Melo <acme@redhat.com>
parent dce0478b
Loading
Loading
Loading
Loading
+1 −2
Original line number Diff line number Diff line
@@ -315,8 +315,7 @@ static struct call_path *call_path_from_sample(struct db_export *dbe,
		al.addr = node->ip;

		if (al.map && !al.sym)
			al.sym = dso__find_symbol(al.map->dso, MAP__FUNCTION,
						  al.addr);
			al.sym = dso__find_symbol(al.map->dso, al.addr);

		db_ids_from_al(dbe, &al, &dso_db_id, &sym_db_id, &offset);

+2 −2
Original line number Diff line number Diff line
@@ -353,7 +353,7 @@ struct symbol *map__find_symbol(struct map *map, u64 addr)
	if (map__load(map) < 0)
		return NULL;

	return dso__find_symbol(map->dso, map->type, addr);
	return __dso__find_symbol(map->dso, map->type, addr);
}

struct symbol *map__find_symbol_by_name(struct map *map, const char *name)
@@ -364,7 +364,7 @@ struct symbol *map__find_symbol_by_name(struct map *map, const char *name)
	if (!dso__sorted_by_name(map->dso, map->type))
		dso__sort_by_name(map->dso, map->type);

	return dso__find_symbol_by_name(map->dso, map->type, name);
	return __dso__find_symbol_by_name(map->dso, map->type, name);
}

struct map *map__clone(struct map *from)
+5 −5
Original line number Diff line number Diff line
@@ -504,7 +504,7 @@ void dso__insert_symbol(struct dso *dso, enum map_type type, struct symbol *sym)
	}
}

struct symbol *dso__find_symbol(struct dso *dso,
struct symbol *__dso__find_symbol(struct dso *dso,
				  enum map_type type, u64 addr)
{
	if (dso->last_find_result[type].addr != addr || dso->last_find_result[type].symbol == NULL) {
@@ -549,9 +549,9 @@ struct symbol *symbol__next_by_name(struct symbol *sym)
}

 /*
  * Teturns first symbol that matched with @name.
  * Returns first symbol that matched with @name.
  */
struct symbol *dso__find_symbol_by_name(struct dso *dso, enum map_type type,
struct symbol *__dso__find_symbol_by_name(struct dso *dso, enum map_type type,
					  const char *name)
{
	struct symbol *s = symbols__find_by_name(&dso->symbol_names[type], name,
+8 −4
Original line number Diff line number Diff line
@@ -262,10 +262,14 @@ int dso__load_kallsyms(struct dso *dso, const char *filename, struct map *map);
void dso__insert_symbol(struct dso *dso, enum map_type type,
			struct symbol *sym);

struct symbol *dso__find_symbol(struct dso *dso, enum map_type type,
				u64 addr);
struct symbol *dso__find_symbol_by_name(struct dso *dso, enum map_type type,
					const char *name);
struct symbol *__dso__find_symbol(struct dso *dso, enum map_type type, u64 addr);
struct symbol *__dso__find_symbol_by_name(struct dso *dso, enum map_type type, const char *name);

static inline struct symbol *dso__find_symbol(struct dso *dso, u64 addr)
{
	return __dso__find_symbol(dso, MAP__FUNCTION, addr);
}

struct symbol *symbol__next_by_name(struct symbol *sym);

struct symbol *dso__first_symbol(struct dso *dso);