diff options
author | Mark Wielaard <mjw@redhat.com> | 2009-06-03 15:36:03 +0200 |
---|---|---|
committer | Mark Wielaard <mjw@redhat.com> | 2009-06-03 15:36:03 +0200 |
commit | 129de9ef18cd142e31ed509a7704d4faf0879f4c (patch) | |
tree | 7c177716d871c8173a3b997581e2e9d3d18474ea /translate.cxx | |
parent | 987a37e77751d1a8aac0a0591c3b53fddf0de7cd (diff) | |
download | systemtap-steved-129de9ef18cd142e31ed509a7704d4faf0879f4c.tar.gz systemtap-steved-129de9ef18cd142e31ed509a7704d4faf0879f4c.tar.xz systemtap-steved-129de9ef18cd142e31ed509a7704d4faf0879f4c.zip |
Detect kretprobe trampoline and use fallback unwinder.
* runtime/sym.h (_stp_kretprobe_trampoline): Document.
* translate.cxx (unwindsym_dump_context): Add stp_kretprobe_trampoline_addr.
(dump_unwindsyms): Detect kretprobe_trampoline_holder symbol address.
(emit_symbol_data): Initialize and emit _stp_kretprobe_trampoline.
* runtime/transport/symbols.c (_stp_do_relocation): Detect kernel load
address and adjust _stp_kretprobe_trampoline.
* runtime/stack-i386.c (__stp_stack_print): Always use fallback unwinder
when hitting kretprobe_trampoline_holder.
* runtime/stack-x86_64.c (__stp_stack_print): Likewise.
Diffstat (limited to 'translate.cxx')
-rw-r--r-- | translate.cxx | 15 |
1 files changed, 14 insertions, 1 deletions
diff --git a/translate.cxx b/translate.cxx index 9631213e..76530cc4 100644 --- a/translate.cxx +++ b/translate.cxx @@ -4423,6 +4423,7 @@ struct unwindsym_dump_context systemtap_session& session; ostream& output; unsigned stp_module_index; + unsigned long stp_kretprobe_trampoline_addr; set<string> undone_unwindsym_modules; }; @@ -4660,6 +4661,11 @@ dump_unwindsyms (Dwfl_Module *m, secname = "_stext"; // NB: don't subtract session.sym_stext, which could be inconveniently NULL. // Instead, sym_addr will get compensated later via extra_offset. + + // We need to note this for the unwinder. + if (c->stp_kretprobe_trampoline_addr == (unsigned long) -1 + && ! strcmp (name, "kretprobe_trampoline_holder")) + c->stp_kretprobe_trampoline_addr = sym_addr; } else if (n > 0) { @@ -4709,6 +4715,10 @@ dump_unwindsyms (Dwfl_Module *m, } } + // Must be relative to actual kernel load address. + if (c->stp_kretprobe_trampoline_addr != (unsigned long) -1) + c->stp_kretprobe_trampoline_addr -= extra_offset; + // Add unwind data to be included if it exists for this module. void *debug_frame = NULL; size_t debug_len = 0; @@ -4893,7 +4903,7 @@ emit_symbol_data (systemtap_session& s) ofstream kallsyms_out ((s.tmpdir + "/" + symfile).c_str()); - unwindsym_dump_context ctx = { s, kallsyms_out, 0, s.unwindsym_modules }; + unwindsym_dump_context ctx = { s, kallsyms_out, 0, -1, s.unwindsym_modules }; // Micro optimization, mainly to speed up tiny regression tests // using just begin probe. @@ -5011,6 +5021,9 @@ emit_symbol_data_done (unwindsym_dump_context *ctx, systemtap_session& s) ctx->output << "};\n"; ctx->output << "static unsigned _stp_num_modules = " << ctx->stp_module_index << ";\n"; + ctx->output << "static unsigned long _stp_kretprobe_trampoline = 0x" + << hex << ctx->stp_kretprobe_trampoline_addr << dec << ";\n"; + // Some nonexistent modules may have been identified with "-d". Note them. for (set<string>::iterator it = ctx->undone_unwindsym_modules.begin(); it != ctx->undone_unwindsym_modules.end(); |