]> asedeno.scripts.mit.edu Git - linux.git/blobdiff - tools/perf/util/callchain.c
perf tools: Add a 'struct map_groups' pointer to 'struct map_symbol'
[linux.git] / tools / perf / util / callchain.c
index 89faa644b0bc21d228742d8c20e864c79d9d5b88..5cefce33b66bb9b09c477bce508cec7081bdc865 100644 (file)
@@ -582,8 +582,8 @@ fill_node(struct callchain_node *node, struct callchain_cursor *cursor)
                        return -1;
                }
                call->ip = cursor_node->ip;
-               call->ms.sym = cursor_node->sym;
-               call->ms.map = map__get(cursor_node->map);
+               call->ms = cursor_node->ms;
+               map__get(call->ms.map);
                call->srcline = cursor_node->srcline;
 
                if (cursor_node->branch) {
@@ -720,21 +720,21 @@ static enum match_result match_chain(struct callchain_cursor_node *node,
                /* otherwise fall-back to symbol-based comparison below */
                __fallthrough;
        case CCKEY_FUNCTION:
-               if (node->sym && cnode->ms.sym) {
+               if (node->ms.sym && cnode->ms.sym) {
                        /*
                         * Compare inlined frames based on their symbol name
                         * because different inlined frames will have the same
                         * symbol start. Otherwise do a faster comparison based
                         * on the symbol start address.
                         */
-                       if (cnode->ms.sym->inlined || node->sym->inlined) {
+                       if (cnode->ms.sym->inlined || node->ms.sym->inlined) {
                                match = match_chain_strings(cnode->ms.sym->name,
-                                                           node->sym->name);
+                                                           node->ms.sym->name);
                                if (match != MATCH_ERROR)
                                        break;
                        } else {
                                match = match_chain_dso_addresses(cnode->ms.map, cnode->ms.sym->start,
-                                                                 node->map, node->sym->start);
+                                                                 node->ms.map, node->ms.sym->start);
                                break;
                        }
                }
@@ -742,7 +742,7 @@ static enum match_result match_chain(struct callchain_cursor_node *node,
                __fallthrough;
        case CCKEY_ADDRESS:
        default:
-               match = match_chain_dso_addresses(cnode->ms.map, cnode->ip, node->map, node->ip);
+               match = match_chain_dso_addresses(cnode->ms.map, cnode->ip, node->ms.map, node->ip);
                break;
        }
 
@@ -1004,8 +1004,7 @@ merge_chain_branch(struct callchain_cursor *cursor,
        int err = 0;
 
        list_for_each_entry_safe(list, next_list, &src->val, list) {
-               callchain_cursor_append(cursor, list->ip,
-                                       list->ms.map, list->ms.sym,
+               callchain_cursor_append(cursor, list->ip, &list->ms,
                                        false, NULL, 0, 0, 0, list->srcline);
                list_del_init(&list->list);
                map__zput(list->ms.map);
@@ -1044,7 +1043,7 @@ int callchain_merge(struct callchain_cursor *cursor,
 }
 
 int callchain_cursor_append(struct callchain_cursor *cursor,
-                           u64 ip, struct map *map, struct symbol *sym,
+                           u64 ip, struct map_symbol *ms,
                            bool branch, struct branch_flags *flags,
                            int nr_loop_iter, u64 iter_cycles, u64 branch_from,
                            const char *srcline)
@@ -1060,9 +1059,9 @@ int callchain_cursor_append(struct callchain_cursor *cursor,
        }
 
        node->ip = ip;
-       map__zput(node->map);
-       node->map = map__get(map);
-       node->sym = sym;
+       map__zput(node->ms.map);
+       node->ms = *ms;
+       map__get(node->ms.map);
        node->branch = branch;
        node->nr_loop_iter = nr_loop_iter;
        node->iter_cycles = iter_cycles;
@@ -1107,8 +1106,9 @@ 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)
 {
-       al->map = node->map;
-       al->sym = node->sym;
+       al->mg  = node->ms.mg;
+       al->map = node->ms.map;
+       al->sym = node->ms.sym;
        al->srcline = node->srcline;
        al->addr = node->ip;
 
@@ -1571,7 +1571,7 @@ int callchain_cursor__copy(struct callchain_cursor *dst,
                if (node == NULL)
                        break;
 
-               rc = callchain_cursor_append(dst, node->ip, node->map, node->sym,
+               rc = callchain_cursor_append(dst, node->ip, &node->ms,
                                             node->branch, &node->branch_flags,
                                             node->nr_loop_iter,
                                             node->iter_cycles,
@@ -1597,5 +1597,5 @@ void callchain_cursor_reset(struct callchain_cursor *cursor)
        cursor->last = &cursor->first;
 
        for (node = cursor->first; node != NULL; node = node->next)
-               map__zput(node->map);
+               map__zput(node->ms.map);
 }