summaryrefslogtreecommitdiffstats
path: root/tapsets.cxx
diff options
context:
space:
mode:
authorFrank Ch. Eigler <fche@elastic.org>2009-09-09 13:33:51 -0400
committerFrank Ch. Eigler <fche@elastic.org>2009-09-09 13:36:59 -0400
commit259d54c0270e85f6fbeb4fb966b95c3e52e0dac0 (patch)
treed4c7d573c6fff9d44dcd27cf8546bb25c2751a56 /tapsets.cxx
parent3cb3a7dd723bf5219e5cd97d5160b7bce59ba0b4 (diff)
downloadsystemtap-steved-259d54c0270e85f6fbeb4fb966b95c3e52e0dac0.tar.gz
systemtap-steved-259d54c0270e85f6fbeb4fb966b95c3e52e0dac0.tar.xz
systemtap-steved-259d54c0270e85f6fbeb4fb966b95c3e52e0dac0.zip
PR10602: improved fix for REG_IP lvalue
* runtime/regs.h (SET_REG_IP): Define. (REG_IP_LVALUE): Undefine. * tapsets.cxx (*::emit_module_decls): Use SET_REG_IP() instead of old LVALUE? conditional. Written by jkenisto & jistone.
Diffstat (limited to 'tapsets.cxx')
-rw-r--r--tapsets.cxx54
1 files changed, 12 insertions, 42 deletions
diff --git a/tapsets.cxx b/tapsets.cxx
index 5b3e9169..7912ed99 100644
--- a/tapsets.cxx
+++ b/tapsets.cxx
@@ -3080,18 +3080,13 @@ dwarf_derived_probe_group::emit_module_decls (systemtap_session& s)
// Make it look like the IP is set as it wouldn't have been replaced
// by a breakpoint instruction when calling real probe handler. Reset
// IP regs on return, so we don't confuse kprobes. PR10458
- // But only for architectures where REG_IP is a proper lvalue. PR10491
- s.op->newline() << "#ifdef REG_IP_LVALUE";
s.op->newline() << "{";
s.op->indent(1);
s.op->newline() << "unsigned long kprobes_ip = REG_IP(c->regs);";
- s.op->newline() << "REG_IP(regs) = (unsigned long) inst->addr;";
+ s.op->newline() << "SET_REG_IP(regs, (unsigned long) inst->addr);";
s.op->newline() << "(*sdp->ph) (c);";
- s.op->newline() << "REG_IP(regs) = kprobes_ip;";
+ s.op->newline() << "SET_REG_IP(regs, kprobes_ip);";
s.op->newline(-1) << "}";
- s.op->newline() << "#else";
- s.op->newline() << "(*sdp->ph) (c);";
- s.op->newline() << "#endif";
common_probe_entryfn_epilogue (s.op);
s.op->newline() << "return 0;";
@@ -3119,18 +3114,13 @@ dwarf_derived_probe_group::emit_module_decls (systemtap_session& s)
// Make it look like the IP is set as it wouldn't have been replaced
// by a breakpoint instruction when calling real probe handler. Reset
// IP regs on return, so we don't confuse kprobes. PR10458
- // But only for architectures where REG_IP is a proper lvalue. PR10491
- s.op->newline() << "#ifdef REG_IP_LVALUE";
s.op->newline() << "{";
s.op->indent(1);
s.op->newline() << "unsigned long kprobes_ip = REG_IP(c->regs);";
- s.op->newline() << "REG_IP(regs) = (unsigned long) inst->rp->kp.addr;";
+ s.op->newline() << "SET_REG_IP(regs, (unsigned long) inst->rp->kp.addr);";
s.op->newline() << "(*sdp->ph) (c);";
- s.op->newline() << "REG_IP(regs) = kprobes_ip;";
+ s.op->newline() << "SET_REG_IP(regs, kprobes_ip);";
s.op->newline(-1) << "}";
- s.op->newline() << "#else";
- s.op->newline() << "(*sdp->ph) (c);";
- s.op->newline() << "#endif";
common_probe_entryfn_epilogue (s.op);
s.op->newline() << "return 0;";
@@ -4553,18 +4543,13 @@ uprobe_derived_probe_group::emit_module_decls (systemtap_session& s)
// Make it look like the IP is set as it would in the actual user
// task when calling real probe handler. Reset IP regs on return, so
// we don't confuse uprobes. PR10458
- // But only for architectures where REG_IP is a proper lvalue. PR10491
- s.op->newline() << "#ifdef REG_IP_LVALUE";
s.op->newline() << "{";
s.op->indent(1);
s.op->newline() << "unsigned long uprobes_ip = REG_IP(c->regs);";
- s.op->newline() << "REG_IP(regs) = inst->vaddr;";
+ s.op->newline() << "SET_REG_IP(regs, inst->vaddr);";
s.op->newline() << "(*sups->ph) (c);";
- s.op->newline() << "REG_IP(regs) = uprobes_ip;";
+ s.op->newline() << "SET_REG_IP(regs, uprobes_ip);";
s.op->newline(-1) << "}";
- s.op->newline() << "#else";
- s.op->newline() << "(*sdp->ph) (c);";
- s.op->newline() << "#endif";
common_probe_entryfn_epilogue (s.op);
s.op->newline(-1) << "}";
@@ -4581,18 +4566,13 @@ uprobe_derived_probe_group::emit_module_decls (systemtap_session& s)
// Make it look like the IP is set as it would in the actual user
// task when calling real probe handler. Reset IP regs on return, so
// we don't confuse uprobes. PR10458
- // But only for architectures where REG_IP is a proper lvalue. PR10491
- s.op->newline() << "#ifdef REG_IP_LVALUE";
s.op->newline() << "{";
s.op->indent(1);
s.op->newline() << "unsigned long uprobes_ip = REG_IP(c->regs);";
- s.op->newline() << "REG_IP(regs) = inst->rp->u.vaddr;";
+ s.op->newline() << "SET_REG_IP(regs, inst->rp->u.vaddr);";
s.op->newline() << "(*sups->ph) (c);";
- s.op->newline() << "REG_IP(regs) = uprobes_ip;";
+ s.op->newline() << "SET_REG_IP(regs, uprobes_ip);";
s.op->newline(-1) << "}";
- s.op->newline() << "#else";
- s.op->newline() << "(*sdp->ph) (c);";
- s.op->newline() << "#endif";
common_probe_entryfn_epilogue (s.op);
s.op->newline(-1) << "}";
@@ -5166,18 +5146,13 @@ kprobe_derived_probe_group::emit_module_decls (systemtap_session& s)
// Make it look like the IP is set as it wouldn't have been replaced
// by a breakpoint instruction when calling real probe handler. Reset
// IP regs on return, so we don't confuse kprobes. PR10458
- // But only for architectures where REG_IP is a proper lvalue. PR10491
- s.op->newline() << "#ifdef REG_IP_LVALUE";
s.op->newline() << "{";
s.op->indent(1);
s.op->newline() << "unsigned long kprobes_ip = REG_IP(c->regs);";
- s.op->newline() << "REG_IP(regs) = (unsigned long) inst->addr;";
+ s.op->newline() << "SET_REG_IP(regs, (unsigned long) inst->addr);";
s.op->newline() << "(*sdp->ph) (c);";
- s.op->newline() << "REG_IP(regs) = kprobes_ip;";
+ s.op->newline() << "SET_REG_IP(regs, kprobes_ip);";
s.op->newline(-1) << "}";
- s.op->newline() << "#else";
- s.op->newline() << "(*sdp->ph) (c);";
- s.op->newline() << "#endif";
common_probe_entryfn_epilogue (s.op);
s.op->newline() << "return 0;";
@@ -5205,18 +5180,13 @@ kprobe_derived_probe_group::emit_module_decls (systemtap_session& s)
// Make it look like the IP is set as it wouldn't have been replaced
// by a breakpoint instruction when calling real probe handler. Reset
// IP regs on return, so we don't confuse kprobes. PR10458
- // But only for architectures where REG_IP is a proper lvalue. PR10491
- s.op->newline() << "#ifdef REG_IP_LVALUE";
s.op->newline() << "{";
s.op->indent(1);
s.op->newline() << "unsigned long kprobes_ip = REG_IP(c->regs);";
- s.op->newline() << "REG_IP(regs) = (unsigned long) inst->rp->kp.addr;";
+ s.op->newline() << "SET_REG_IP(regs, (unsigned long) inst->rp->kp.addr);";
s.op->newline() << "(*sdp->ph) (c);";
- s.op->newline() << "REG_IP(regs) = kprobes_ip;";
+ s.op->newline() << "SET_REG_IP(regs, kprobes_ip);";
s.op->newline(-1) << "}";
- s.op->newline() << "#else";
- s.op->newline() << "(*sdp->ph) (c);";
- s.op->newline() << "#endif";
common_probe_entryfn_epilogue (s.op);
s.op->newline() << "return 0;";