]> sourceware.org Git - systemtap.git/commitdiff
stapdyn: Make sure dyninst probes have a pt_regs
authorJosh Stone <jistone@redhat.com>
Tue, 2 Oct 2012 19:00:39 +0000 (12:00 -0700)
committerJosh Stone <jistone@redhat.com>
Tue, 2 Oct 2012 19:00:39 +0000 (12:00 -0700)
loc2c-generated code assumes pt_regs are available, so use a dummy
struct to make sure we always have *something* for it to dereference.

tapsets.cxx

index f55f73ed1e6693d8a067cad8332d15117b01778f..0516b97fad705034b46be91308a710ec33fe2062 100644 (file)
@@ -7730,6 +7730,10 @@ uprobe_derived_probe_group::emit_module_dyninst_decls (systemtap_session& s)
   s.op->newline(-1) << "};";
   s.op->assert_0_indent();
 
+  // loc2c-generated code assumes pt_regs are available, so use this to make
+  // sure we always have *something* for it to dereference...
+  s.op->newline() << "static struct pt_regs stapdu_dummy_uregs = {0};";
+
   // Declare the individual probes
   s.op->newline() << "static struct stapdu_probe stapdu_probes[] = {";
   s.op->indent(1);
@@ -7758,7 +7762,7 @@ uprobe_derived_probe_group::emit_module_dyninst_decls (systemtap_session& s)
   s.op->newline(1) << "struct stapdu_probe *sup = &stapdu_probes[index];";
   common_probe_entryfn_prologue (s, "STAP_SESSION_RUNNING", "sup->probe",
                                  "stp_probe_type_uprobe");
-  s.op->newline() << "c->uregs = regs;";
+  s.op->newline() << "c->uregs = regs ?: &stapdu_dummy_uregs;";
   s.op->newline() << "c->user_mode_p = 1;";
   // XXX: once we have regs, check how dyninst sets the IP
   // XXX: the way that dyninst rewrites stuff is probably going to be
This page took 0.038814 seconds and 5 git commands to generate.