From: Josh Stone Date: Tue, 2 Oct 2012 19:00:39 +0000 (-0700) Subject: stapdyn: Make sure dyninst probes have a pt_regs X-Git-Tag: release-2.0~47 X-Git-Url: https://sourceware.org/git/?a=commitdiff_plain;h=874d38bf63ec1f96550820fbf0ed00fbce9196fc;p=systemtap.git stapdyn: Make sure dyninst probes have a pt_regs loc2c-generated code assumes pt_regs are available, so use a dummy struct to make sure we always have *something* for it to dereference. --- diff --git a/tapsets.cxx b/tapsets.cxx index f55f73ed1..0516b97fa 100644 --- a/tapsets.cxx +++ b/tapsets.cxx @@ -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