-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
perf tools: Support for DWARF CFI unwinding on post processing
This brings the support for DWARF cfi unwinding on perf post processing. Call frame informations are retrieved and then passed to libunwind that requests memory and register content from the applications. Adding unwind object to handle the user stack backtrace based on the user register values and user stack dump. The unwind object access the libunwind via remote interface and provides to it all the necessary data to unwind the stack. The unwind interface provides following function: unwind__get_entries And callback (specified in above function) to retrieve the backtrace entries: typedef int (*unwind_entry_cb_t)(struct unwind_entry *entry, void *arg); Signed-off-by: Jiri Olsa <jolsa@redhat.com> Original-patch-by: Frederic Weisbecker <fweisbec@gmail.com> Cc: "Frank Ch. Eigler" <fche@redhat.com> Cc: Arun Sharma <asharma@fb.com> Cc: Benjamin Redelings <benjamin.redelings@nescent.org> Cc: Corey Ashford <cjashfor@linux.vnet.ibm.com> Cc: Cyrill Gorcunov <gorcunov@openvz.org> Cc: Frank Ch. Eigler <fche@redhat.com> Cc: Frederic Weisbecker <fweisbec@gmail.com> Cc: Ingo Molnar <mingo@elte.hu> Cc: Masami Hiramatsu <masami.hiramatsu.pt@hitachi.com> Cc: Paul Mackerras <paulus@samba.org> Cc: Peter Zijlstra <a.p.zijlstra@chello.nl> Cc: Robert Richter <robert.richter@amd.com> Cc: Stephane Eranian <eranian@google.com> Cc: Tom Zanussi <tzanussi@gmail.com> Cc: Ulrich Drepper <drepper@gmail.com> Link: http://lkml.kernel.org/r/1344345647-11536-12-git-send-email-jolsa@redhat.com [ Replaced use of perf_session by usage of perf_evsel ] Signed-off-by: Arnaldo Carvalho de Melo <acme@redhat.com>
- Loading branch information
Jiri Olsa
authored and
Arnaldo Carvalho de Melo
committed
Aug 11, 2012
1 parent
0f6a301
commit 71ad0f5
Showing
13 changed files
with
795 additions
and
30 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,111 @@ | ||
|
||
#include <errno.h> | ||
#include <libunwind.h> | ||
#include "perf_regs.h" | ||
#include "../../util/unwind.h" | ||
|
||
#ifdef ARCH_X86_64 | ||
int unwind__arch_reg_id(int regnum) | ||
{ | ||
int id; | ||
|
||
switch (regnum) { | ||
case UNW_X86_64_RAX: | ||
id = PERF_REG_X86_AX; | ||
break; | ||
case UNW_X86_64_RDX: | ||
id = PERF_REG_X86_DX; | ||
break; | ||
case UNW_X86_64_RCX: | ||
id = PERF_REG_X86_CX; | ||
break; | ||
case UNW_X86_64_RBX: | ||
id = PERF_REG_X86_BX; | ||
break; | ||
case UNW_X86_64_RSI: | ||
id = PERF_REG_X86_SI; | ||
break; | ||
case UNW_X86_64_RDI: | ||
id = PERF_REG_X86_DI; | ||
break; | ||
case UNW_X86_64_RBP: | ||
id = PERF_REG_X86_BP; | ||
break; | ||
case UNW_X86_64_RSP: | ||
id = PERF_REG_X86_SP; | ||
break; | ||
case UNW_X86_64_R8: | ||
id = PERF_REG_X86_R8; | ||
break; | ||
case UNW_X86_64_R9: | ||
id = PERF_REG_X86_R9; | ||
break; | ||
case UNW_X86_64_R10: | ||
id = PERF_REG_X86_R10; | ||
break; | ||
case UNW_X86_64_R11: | ||
id = PERF_REG_X86_R11; | ||
break; | ||
case UNW_X86_64_R12: | ||
id = PERF_REG_X86_R12; | ||
break; | ||
case UNW_X86_64_R13: | ||
id = PERF_REG_X86_R13; | ||
break; | ||
case UNW_X86_64_R14: | ||
id = PERF_REG_X86_R14; | ||
break; | ||
case UNW_X86_64_R15: | ||
id = PERF_REG_X86_R15; | ||
break; | ||
case UNW_X86_64_RIP: | ||
id = PERF_REG_X86_IP; | ||
break; | ||
default: | ||
pr_err("unwind: invalid reg id %d\n", regnum); | ||
return -EINVAL; | ||
} | ||
|
||
return id; | ||
} | ||
#else | ||
int unwind__arch_reg_id(int regnum) | ||
{ | ||
int id; | ||
|
||
switch (regnum) { | ||
case UNW_X86_EAX: | ||
id = PERF_REG_X86_AX; | ||
break; | ||
case UNW_X86_EDX: | ||
id = PERF_REG_X86_DX; | ||
break; | ||
case UNW_X86_ECX: | ||
id = PERF_REG_X86_CX; | ||
break; | ||
case UNW_X86_EBX: | ||
id = PERF_REG_X86_BX; | ||
break; | ||
case UNW_X86_ESI: | ||
id = PERF_REG_X86_SI; | ||
break; | ||
case UNW_X86_EDI: | ||
id = PERF_REG_X86_DI; | ||
break; | ||
case UNW_X86_EBP: | ||
id = PERF_REG_X86_BP; | ||
break; | ||
case UNW_X86_ESP: | ||
id = PERF_REG_X86_SP; | ||
break; | ||
case UNW_X86_EIP: | ||
id = PERF_REG_X86_IP; | ||
break; | ||
default: | ||
pr_err("unwind: invalid reg id %d\n", regnum); | ||
return -EINVAL; | ||
} | ||
|
||
return id; | ||
} | ||
#endif /* ARCH_X86_64 */ |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -10,5 +10,6 @@ | |
#endif | ||
|
||
#define __used __attribute__((__unused__)) | ||
#define __packed __attribute__((__packed__)) | ||
|
||
#endif |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Oops, something went wrong.