Files
erofs-linux/tools/perf/util/addr_location.c
T
Ian Rogers c4e3a00356 perf map_symbol: Switch from holding maps to holding thread
maps may belong to >1 thread. In contexts like symbolization
information from the thread may be useful, such as the ELF machine.

As the maps can be gained from the thread switch from holding maps in
struct map_symbol to holding the thread.

Holding the maps in addr_location is also redundant, switch this to
using thread__maps.

Reviewed-by: James Clark <[email protected]>
Signed-off-by: Ian Rogers <[email protected]>
Cc: Aditya Bodkhe <[email protected]>
Cc: Adrian Hunter <[email protected]>
Cc: Albert Ou <[email protected]>
Cc: Alexander Shishkin <[email protected]>
Cc: Alexandre Ghiti <[email protected]>
Cc: Athira Rajeev <[email protected]>
Cc: Bill Wendling <[email protected]>
Cc: Dr. David Alan Gilbert <[email protected]>
Cc: Guo Ren <[email protected]>
Cc: Howard Chu <[email protected]>
Cc: Ingo Molnar <[email protected]>
Cc: Jiri Olsa <[email protected]>
Cc: John Garry <[email protected]>
Cc: Julia Lawall <[email protected]>
Cc: Justin Stitt <[email protected]>
Cc: Krzysztof Łopatowski <[email protected]>
Cc: Leo Yan <[email protected]>
Cc: Namhyung Kim <[email protected]>
Cc: Nathan Chancellor <[email protected]>
Cc: Nick Desaulniers <[email protected]>
Cc: Palmer Dabbelt <[email protected]>
Cc: Paul Walmsley <[email protected]>
Cc: Peter Zijlstra <[email protected]>
Cc: Sergei Trofimovich <[email protected]>
Cc: Shimin Guo <[email protected]>
Cc: Suchit Karunakaran <[email protected]>
Cc: Thomas Falcon <[email protected]>
Cc: Tianyou Li <[email protected]>
Cc: Will Deacon <[email protected]>
Cc: Zecheng Li <[email protected]>
Signed-off-by: Arnaldo Carvalho de Melo <[email protected]>
2026-01-23 16:58:39 -03:00

42 lines
980 B
C

// SPDX-License-Identifier: GPL-2.0
#include "addr_location.h"
#include "map.h"
#include "maps.h"
#include "thread.h"
void addr_location__init(struct addr_location *al)
{
al->thread = NULL;
al->map = NULL;
al->sym = NULL;
al->srcline = NULL;
al->addr = 0;
al->level = 0;
al->filtered = 0;
al->cpumode = 0;
al->cpu = 0;
al->socket = 0;
al->parallelism = 1;
}
/*
* The preprocess_sample method will return with reference counts for the
* in it, when done using (and perhaps getting ref counts if needing to
* keep a pointer to one of those entries) it must be paired with
* addr_location__exit(), so that the refcounts can be decremented.
*/
void addr_location__exit(struct addr_location *al)
{
map__zput(al->map);
thread__zput(al->thread);
}
void addr_location__copy(struct addr_location *dst, struct addr_location *src)
{
thread__put(dst->thread);
map__put(dst->map);
*dst = *src;
dst->thread = thread__get(src->thread);
dst->map = map__get(src->map);
}