Merge tag 'trace-printf-v6.13' of git://git.kernel.org/pub/scm/linux/kernel/git/trace...
[drm/drm-misc.git] / tools / perf / util / addr_location.c
blob51825ef8c0ab77a701414ba5b2ea0426dc511dc0
1 // SPDX-License-Identifier: GPL-2.0
2 #include "addr_location.h"
3 #include "map.h"
4 #include "maps.h"
5 #include "thread.h"
7 void addr_location__init(struct addr_location *al)
9 al->thread = NULL;
10 al->maps = NULL;
11 al->map = NULL;
12 al->sym = NULL;
13 al->srcline = NULL;
14 al->addr = 0;
15 al->level = 0;
16 al->filtered = 0;
17 al->cpumode = 0;
18 al->cpu = 0;
19 al->socket = 0;
23 * The preprocess_sample method will return with reference counts for the
24 * in it, when done using (and perhaps getting ref counts if needing to
25 * keep a pointer to one of those entries) it must be paired with
26 * addr_location__put(), so that the refcounts can be decremented.
28 void addr_location__exit(struct addr_location *al)
30 map__zput(al->map);
31 thread__zput(al->thread);
32 maps__zput(al->maps);
35 void addr_location__copy(struct addr_location *dst, struct addr_location *src)
37 thread__put(dst->thread);
38 maps__put(dst->maps);
39 map__put(dst->map);
40 *dst = *src;
41 dst->thread = thread__get(src->thread);
42 dst->maps = maps__get(src->maps);
43 dst->map = map__get(src->map);