aboutsummaryrefslogtreecommitdiff
path: root/tools/perf/util/callchain.c
diff options
context:
space:
mode:
Diffstat (limited to 'tools/perf/util/callchain.c')
-rw-r--r--tools/perf/util/callchain.c28
1 files changed, 15 insertions, 13 deletions
diff --git a/tools/perf/util/callchain.c b/tools/perf/util/callchain.c
index a093a15f048f..b0dafc758173 100644
--- a/tools/perf/util/callchain.c
+++ b/tools/perf/util/callchain.c
@@ -589,7 +589,7 @@ fill_node(struct callchain_node *node, struct callchain_cursor *cursor)
}
call->ip = cursor_node->ip;
call->ms = cursor_node->ms;
- map__get(call->ms.map);
+ call->ms.map = map__get(call->ms.map);
call->srcline = cursor_node->srcline;
if (cursor_node->branch) {
@@ -701,8 +701,8 @@ static enum match_result match_chain_strings(const char *left,
static enum match_result match_chain_dso_addresses(struct map *left_map, u64 left_ip,
struct map *right_map, u64 right_ip)
{
- struct dso *left_dso = left_map ? left_map->dso : NULL;
- struct dso *right_dso = right_map ? right_map->dso : NULL;
+ struct dso *left_dso = left_map ? map__dso(left_map) : NULL;
+ struct dso *right_dso = right_map ? map__dso(right_map) : NULL;
if (left_dso != right_dso)
return left_dso < right_dso ? MATCH_LT : MATCH_GT;
@@ -724,7 +724,7 @@ static enum match_result match_chain(struct callchain_cursor_node *node,
if (match != MATCH_ERROR)
break;
/* otherwise fall-back to symbol-based comparison below */
- __fallthrough;
+ fallthrough;
case CCKEY_FUNCTION:
if (node->ms.sym && cnode->ms.sym) {
/*
@@ -745,7 +745,7 @@ static enum match_result match_chain(struct callchain_cursor_node *node,
}
}
/* otherwise fall-back to IP-based comparison below */
- __fallthrough;
+ fallthrough;
case CCKEY_ADDRESS:
default:
match = match_chain_dso_addresses(cnode->ms.map, cnode->ip, node->ms.map, node->ip);
@@ -1067,7 +1067,7 @@ int callchain_cursor_append(struct callchain_cursor *cursor,
node->ip = ip;
map__zput(node->ms.map);
node->ms = *ms;
- map__get(node->ms.map);
+ node->ms.map = map__get(node->ms.map);
node->branch = branch;
node->nr_loop_iter = nr_loop_iter;
node->iter_cycles = iter_cycles;
@@ -1112,8 +1112,11 @@ int hist_entry__append_callchain(struct hist_entry *he, struct perf_sample *samp
int fill_callchain_info(struct addr_location *al, struct callchain_cursor_node *node,
bool hide_unresolved)
{
+ struct machine *machine = maps__machine(node->ms.maps);
+
al->maps = node->ms.maps;
- al->map = node->ms.map;
+ map__put(al->map);
+ al->map = map__get(node->ms.map);
al->sym = node->ms.sym;
al->srcline = node->srcline;
al->addr = node->ip;
@@ -1124,9 +1127,8 @@ int fill_callchain_info(struct addr_location *al, struct callchain_cursor_node *
if (al->map == NULL)
goto out;
}
-
- if (al->maps == machine__kernel_maps(al->maps->machine)) {
- if (machine__is_host(al->maps->machine)) {
+ if (al->maps == machine__kernel_maps(machine)) {
+ if (machine__is_host(machine)) {
al->cpumode = PERF_RECORD_MISC_KERNEL;
al->level = 'k';
} else {
@@ -1134,7 +1136,7 @@ int fill_callchain_info(struct addr_location *al, struct callchain_cursor_node *
al->level = 'g';
}
} else {
- if (machine__is_host(al->maps->machine)) {
+ if (machine__is_host(machine)) {
al->cpumode = PERF_RECORD_MISC_USER;
al->level = '.';
} else if (perf_guest) {
@@ -1173,7 +1175,7 @@ char *callchain_list__sym_name(struct callchain_list *cl,
if (show_dso)
scnprintf(bf + printed, bfsize - printed, " %s",
cl->ms.map ?
- cl->ms.map->dso->short_name :
+ map__dso(cl->ms.map)->short_name :
"unknown");
return bf;
@@ -1527,7 +1529,7 @@ int callchain_node__make_parent_list(struct callchain_node *node)
goto out;
*new = *chain;
new->has_children = false;
- map__get(new->ms.map);
+ new->ms.map = map__get(new->ms.map);
list_add_tail(&new->list, &head);
}
parent = parent->parent;