mirror of
https://github.com/torvalds/linux.git
synced 2024-11-23 12:42:02 +00:00
perf unwind: Use 'struct map_symbol' in 'struct unwind_entry'
To help in passing that info around to callchain routines that, for the same reason, are moving to use 'struct map_symbol'. Cc: Adrian Hunter <adrian.hunter@intel.com> Cc: Andi Kleen <ak@linux.intel.com> Cc: Jiri Olsa <jolsa@kernel.org> Cc: Namhyung Kim <namhyung@kernel.org> Link: https://lkml.kernel.org/n/tip-epsiibeprpxa8qpwji47uskc@git.kernel.org Signed-off-by: Arnaldo Carvalho de Melo <acme@redhat.com>
This commit is contained in:
parent
2975489458
commit
c1529738f5
@ -59,7 +59,7 @@ int test_dwarf_unwind__krava_1(struct thread *thread);
|
|||||||
static int unwind_entry(struct unwind_entry *entry, void *arg)
|
static int unwind_entry(struct unwind_entry *entry, void *arg)
|
||||||
{
|
{
|
||||||
unsigned long *cnt = (unsigned long *) arg;
|
unsigned long *cnt = (unsigned long *) arg;
|
||||||
char *symbol = entry->sym ? entry->sym->name : NULL;
|
char *symbol = entry->ms.sym ? entry->ms.sym->name : NULL;
|
||||||
static const char *funcs[MAX_STACK] = {
|
static const char *funcs[MAX_STACK] = {
|
||||||
"test__arch_unwind_sample",
|
"test__arch_unwind_sample",
|
||||||
"test_dwarf_unwind__thread",
|
"test_dwarf_unwind__thread",
|
||||||
|
@ -2448,9 +2448,10 @@ check_calls:
|
|||||||
return 0;
|
return 0;
|
||||||
}
|
}
|
||||||
|
|
||||||
static int append_inlines(struct callchain_cursor *cursor,
|
static int append_inlines(struct callchain_cursor *cursor, struct map_symbol *ms, u64 ip)
|
||||||
struct map *map, struct symbol *sym, u64 ip)
|
|
||||||
{
|
{
|
||||||
|
struct symbol *sym = ms->sym;
|
||||||
|
struct map *map = ms->map;
|
||||||
struct inline_node *inline_node;
|
struct inline_node *inline_node;
|
||||||
struct inline_list *ilist;
|
struct inline_list *ilist;
|
||||||
u64 addr;
|
u64 addr;
|
||||||
@ -2488,22 +2489,22 @@ static int unwind_entry(struct unwind_entry *entry, void *arg)
|
|||||||
const char *srcline = NULL;
|
const char *srcline = NULL;
|
||||||
u64 addr = entry->ip;
|
u64 addr = entry->ip;
|
||||||
|
|
||||||
if (symbol_conf.hide_unresolved && entry->sym == NULL)
|
if (symbol_conf.hide_unresolved && entry->ms.sym == NULL)
|
||||||
return 0;
|
return 0;
|
||||||
|
|
||||||
if (append_inlines(cursor, entry->map, entry->sym, entry->ip) == 0)
|
if (append_inlines(cursor, &entry->ms, entry->ip) == 0)
|
||||||
return 0;
|
return 0;
|
||||||
|
|
||||||
/*
|
/*
|
||||||
* Convert entry->ip from a virtual address to an offset in
|
* Convert entry->ip from a virtual address to an offset in
|
||||||
* its corresponding binary.
|
* its corresponding binary.
|
||||||
*/
|
*/
|
||||||
if (entry->map)
|
if (entry->ms.map)
|
||||||
addr = map__map_ip(entry->map, entry->ip);
|
addr = map__map_ip(entry->ms.map, entry->ip);
|
||||||
|
|
||||||
srcline = callchain_srcline(entry->map, entry->sym, addr);
|
srcline = callchain_srcline(entry->ms.map, entry->ms.sym, addr);
|
||||||
return callchain_cursor_append(cursor, entry->ip,
|
return callchain_cursor_append(cursor, entry->ip,
|
||||||
entry->map, entry->sym,
|
entry->ms.map, entry->ms.sym,
|
||||||
false, NULL, 0, 0, 0, srcline);
|
false, NULL, 0, 0, 0, srcline);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -80,9 +80,9 @@ static int entry(u64 ip, struct unwind_info *ui)
|
|||||||
if (__report_module(&al, ip, ui))
|
if (__report_module(&al, ip, ui))
|
||||||
return -1;
|
return -1;
|
||||||
|
|
||||||
e->ip = ip;
|
e->ip = ip;
|
||||||
e->map = al.map;
|
e->ms.map = al.map;
|
||||||
e->sym = al.sym;
|
e->ms.sym = al.sym;
|
||||||
|
|
||||||
pr_debug("unwind: %s:ip = 0x%" PRIx64 " (0x%" PRIx64 ")\n",
|
pr_debug("unwind: %s:ip = 0x%" PRIx64 " (0x%" PRIx64 ")\n",
|
||||||
al.sym ? al.sym->name : "''",
|
al.sym ? al.sym->name : "''",
|
||||||
|
@ -575,9 +575,9 @@ static int entry(u64 ip, struct thread *thread,
|
|||||||
struct unwind_entry e;
|
struct unwind_entry e;
|
||||||
struct addr_location al;
|
struct addr_location al;
|
||||||
|
|
||||||
e.sym = thread__find_symbol(thread, PERF_RECORD_MISC_USER, ip, &al);
|
e.ms.sym = thread__find_symbol(thread, PERF_RECORD_MISC_USER, ip, &al);
|
||||||
e.ip = ip;
|
e.ip = ip;
|
||||||
e.map = al.map;
|
e.ms.map = al.map;
|
||||||
|
|
||||||
pr_debug("unwind: %s:ip = 0x%" PRIx64 " (0x%" PRIx64 ")\n",
|
pr_debug("unwind: %s:ip = 0x%" PRIx64 " (0x%" PRIx64 ")\n",
|
||||||
al.sym ? al.sym->name : "''",
|
al.sym ? al.sym->name : "''",
|
||||||
|
@ -4,17 +4,15 @@
|
|||||||
|
|
||||||
#include <linux/compiler.h>
|
#include <linux/compiler.h>
|
||||||
#include <linux/types.h>
|
#include <linux/types.h>
|
||||||
|
#include "util/map_symbol.h"
|
||||||
|
|
||||||
struct map;
|
|
||||||
struct map_groups;
|
struct map_groups;
|
||||||
struct perf_sample;
|
struct perf_sample;
|
||||||
struct symbol;
|
|
||||||
struct thread;
|
struct thread;
|
||||||
|
|
||||||
struct unwind_entry {
|
struct unwind_entry {
|
||||||
struct map *map;
|
struct map_symbol ms;
|
||||||
struct symbol *sym;
|
u64 ip;
|
||||||
u64 ip;
|
|
||||||
};
|
};
|
||||||
|
|
||||||
typedef int (*unwind_entry_cb_t)(struct unwind_entry *entry, void *arg);
|
typedef int (*unwind_entry_cb_t)(struct unwind_entry *entry, void *arg);
|
||||||
|
Loading…
Reference in New Issue
Block a user