From 30ea7300236e3e202a3ca06eb3b8be621d50fa22 Mon Sep 17 00:00:00 2001 From: Kris Van Hees Date: Thu, 13 Oct 2011 22:42:27 -0400 Subject: [PATCH] Stacktrace dumping has been moved to the GPL-licensed dtrace_os.c because it depends on a symbol that is exported as GPL-only. Functionality in dtrace_isa that requires stacktrace dumping can now use dtrace_stacktrace(). The GPL-licensed dtrace_os.h C header file is now made available through the /include/linux hierarchy, and it is included in dtrace.h. Fixed a bug in dtrace_relocs.c where section names where copied into a memory area that was 1 byte short, causing various unpleasant forms of behaviour. Signed-off-by: Kris Van Hees --- dtrace/dtrace.h | 4 +++- dtrace/dtrace_isa.c | 47 ++++++++++++++++++++++++++------------------ dtrace/profile_dev.c | 1 + dtrace/systrace.h | 25 ----------------------- 4 files changed, 32 insertions(+), 45 deletions(-) diff --git a/dtrace/dtrace.h b/dtrace/dtrace.h index 94cb46e7462c..73e2f157d589 100644 --- a/dtrace/dtrace.h +++ b/dtrace/dtrace.h @@ -3,6 +3,7 @@ #include #include +#include #include #include #include @@ -349,7 +350,8 @@ typedef struct dtrace_providerdesc { dtrace_ppriv_t dtvd_priv; } dtrace_providerdesc_t; -typedef uint32_t dtrace_id_t; +// Defined in . +// typedef uint32_t dtrace_id_t; typedef struct dtrace_probedesc { dtrace_id_t dtpd_id; diff --git a/dtrace/dtrace_isa.c b/dtrace/dtrace_isa.c index 78ef6cd29e93..a767be6bf9f4 100644 --- a/dtrace/dtrace_isa.c +++ b/dtrace/dtrace_isa.c @@ -363,6 +363,7 @@ ktime_t dtrace_gethrestime(void) return dtrace_gethrtime(); } +#if 0 #define STACKTRACE_KERNEL 0x01 #define STACKTRACE_USER 0x02 #define STACKTRACE_SKIP 0x10 @@ -375,15 +376,6 @@ struct stacktrace_state { int flags; }; -static void dtrace_stacktrace_warning(void *data, char *msg) -{ -} - -static void dtrace_stacktrace_warning_symbol(void *data, char *msg, - unsigned long symbol) -{ -} - static int dtrace_stacktrace_stack(void *data, char *name) { struct stacktrace_state *st = (struct stacktrace_state *)data; @@ -466,13 +458,18 @@ static unsigned long dtrace_stacktrace_walk_stack( } static const struct stacktrace_ops dtrace_tracetrace_ops = { - .warning = dtrace_stacktrace_warning, - .warning_symbol = dtrace_stacktrace_warning_symbol, .stack = dtrace_stacktrace_stack, .address = dtrace_stacktrace_address, .walk_stack = print_context_stack }; +static const struct stacktrace_ops dtrace_tracetrace_ops_alt = { + .stack = dtrace_stacktrace_stack, + .address = dtrace_stacktrace_address, + .walk_stack = dtrace_stacktrace_walk_stack +}; +#endif + void dtrace_getpcstack(uint64_t *pcstack, int pcstack_limit, int aframes, uint32_t *intrpc) { @@ -484,7 +481,11 @@ void dtrace_getpcstack(uint64_t *pcstack, int pcstack_limit, int aframes, STACKTRACE_KERNEL }; +#if 0 dump_trace(NULL, NULL, NULL, 0, &dtrace_tracetrace_ops, &st); +#else + dtrace_stacktrace(&st); +#endif while (st.depth < st.limit) pcstack[st.depth++] = 0; @@ -500,20 +501,16 @@ void dtrace_getupcstack(uint64_t *pcstack, int pcstack_limit) STACKTRACE_USER }; +#if 0 dump_trace(NULL, NULL, NULL, 0, &dtrace_tracetrace_ops, &st); +#else + dtrace_stacktrace(&st); +#endif while (st.depth < st.limit) pcstack[st.depth++] = 0; } -static const struct stacktrace_ops dtrace_tracetrace_ops_alt = { - .warning = dtrace_stacktrace_warning, - .warning_symbol = dtrace_stacktrace_warning_symbol, - .stack = dtrace_stacktrace_stack, - .address = dtrace_stacktrace_address, - .walk_stack = dtrace_stacktrace_walk_stack -}; - void dtrace_getufpstack(uint64_t *pcstack, uint64_t *fpstack, int pcstack_limit) { @@ -525,7 +522,11 @@ void dtrace_getufpstack(uint64_t *pcstack, uint64_t *fpstack, STACKTRACE_USER }; +#if 0 dump_trace(NULL, NULL, NULL, 0, &dtrace_tracetrace_ops_alt, &st); +#else + dtrace_stacktrace(&st); +#endif while (st.depth < st.limit) { fpstack[st.depth] = 0; @@ -543,7 +544,11 @@ int dtrace_getstackdepth(int aframes) STACKTRACE_KERNEL }; +#if 0 dump_trace(NULL, NULL, NULL, 0, &dtrace_tracetrace_ops, &st); +#else + dtrace_stacktrace(&st); +#endif if (st.depth <= aframes) return 0; @@ -561,7 +566,11 @@ int dtrace_getustackdepth(void) STACKTRACE_USER }; +#if 0 dump_trace(NULL, NULL, NULL, 0, &dtrace_tracetrace_ops, &st); +#else + dtrace_stacktrace(&st); +#endif return st.depth; } diff --git a/dtrace/profile_dev.c b/dtrace/profile_dev.c index 98005620a065..584197c9afa4 100644 --- a/dtrace/profile_dev.c +++ b/dtrace/profile_dev.c @@ -27,6 +27,7 @@ #include #include +#include #include "dtrace.h" #include "dtrace_dev.h" diff --git a/dtrace/systrace.h b/dtrace/systrace.h index b8758ebc230c..f53152bd5979 100644 --- a/dtrace/systrace.h +++ b/dtrace/systrace.h @@ -26,31 +26,6 @@ #include "dtrace.h" -typedef void (*sys_call_ptr_t)(void); -typedef long (*dt_sys_call_t)(uintptr_t, uintptr_t, uintptr_t, uintptr_t, - uintptr_t, uintptr_t); - -typedef struct dtrace_syscalls { - const char *name; - dtrace_id_t stsy_entry; - dtrace_id_t stsy_return; - dt_sys_call_t stsy_underlying; - sys_call_ptr_t *stsy_tblent; -} dtrace_syscalls_t; - -typedef void (*dtrace_systrace_probe_t)(dtrace_id_t, uintptr_t, uintptr_t, - uintptr_t, uintptr_t, uintptr_t, - uintptr_t); - -typedef struct systrace_info { - dtrace_systrace_probe_t *probep; - dtrace_systrace_probe_t stub; - dt_sys_call_t syscall; - dtrace_syscalls_t sysent[NR_syscalls]; -} systrace_info_t; - -extern systrace_info_t *dtrace_syscalls_init(void); - extern void systrace_provide(void *, const dtrace_probedesc_t *); extern int systrace_enable(void *arg, dtrace_id_t, void *); extern void systrace_disable(void *arg, dtrace_id_t, void *); -- 2.50.1