From 3d9889977397098d14c5be50f1dfef1c3eeb508f Mon Sep 17 00:00:00 2001 From: Mark Wielaard Date: Thu, 6 Aug 2009 10:41:46 +0200 Subject: PR10491 Don't assign to REG_IP if it isn't an lvalue (s390 and ia64). To fixup REG_IP to show the correct value after a [ku]probe trap we assigned the address of the actual instruction pointer of the probed instruction. That doesn't work on architectures, s390 and ia64, where REG_IP is not a simple lvalue. Just don't try to fixup the address in those cases. If this isn't enough, the uprobe_stmt_num.exp testcase will point this out. * runtime/regs.h: Define REG_IP_LVALUE for x86_64, i386, powerpc64 and arm. * tapsets.cxx (dwarf_derived_probe_group::emit_module_decls): Only fixup REG_IP when REG_IP_LVALUE is defined. (uprobe_derived_probe_group::emit_module_decls): Likewise. (kprobe_derived_probe_group::emit_module_decls): Likewise. --- tapsets.cxx | 30 ++++++++++++++++++++++++++++++ 1 file changed, 30 insertions(+) (limited to 'tapsets.cxx') diff --git a/tapsets.cxx b/tapsets.cxx index b1ca2998..66cb2383 100644 --- a/tapsets.cxx +++ b/tapsets.cxx @@ -3030,6 +3030,8 @@ 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);"; @@ -3037,6 +3039,9 @@ dwarf_derived_probe_group::emit_module_decls (systemtap_session& s) s.op->newline() << "(*sdp->ph) (c);"; s.op->newline() << "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;"; @@ -3064,6 +3069,8 @@ 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);"; @@ -3071,6 +3078,9 @@ dwarf_derived_probe_group::emit_module_decls (systemtap_session& s) s.op->newline() << "(*sdp->ph) (c);"; s.op->newline() << "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;"; @@ -4447,6 +4457,8 @@ 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);"; @@ -4454,6 +4466,9 @@ uprobe_derived_probe_group::emit_module_decls (systemtap_session& s) s.op->newline() << "(*sups->ph) (c);"; s.op->newline() << "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) << "}"; @@ -4470,6 +4485,8 @@ 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);"; @@ -4477,6 +4494,9 @@ uprobe_derived_probe_group::emit_module_decls (systemtap_session& s) s.op->newline() << "(*sups->ph) (c);"; s.op->newline() << "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) << "}"; @@ -4970,6 +4990,8 @@ 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);"; @@ -4977,6 +4999,9 @@ kprobe_derived_probe_group::emit_module_decls (systemtap_session& s) s.op->newline() << "(*sdp->ph) (c);"; s.op->newline() << "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;"; @@ -5004,6 +5029,8 @@ 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);"; @@ -5011,6 +5038,9 @@ kprobe_derived_probe_group::emit_module_decls (systemtap_session& s) s.op->newline() << "(*sdp->ph) (c);"; s.op->newline() << "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;"; -- cgit From 9b988eff8c29377e658606a85f371ceb9acfef7d Mon Sep 17 00:00:00 2001 From: Wenji Huang Date: Wed, 5 Aug 2009 22:58:46 -0400 Subject: PR10294: support wider range for statement probe * dwflpp.cxx (iterate_over_srcfile_lines): Add pattern parameter. * dwflpp.h (iterate_over_srcfile_lines): Ditto. * testsuite/systemtap.base/bz10294.c: Test case. * testsuite/systemtap.base/bz10294.stp: Ditto. * testsuite/systemtap.base/bz6905.exp: Deleted. * testsuite/systemtap.base/statement.exp: Merge bz10294 with bz6905. --- tapsets.cxx | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) (limited to 'tapsets.cxx') diff --git a/tapsets.cxx b/tapsets.cxx index 66cb2383..c953dd78 100644 --- a/tapsets.cxx +++ b/tapsets.cxx @@ -1452,7 +1452,7 @@ query_cu (Dwarf_Die * cudie, void * arg) for (set::const_iterator i = q->filtered_srcfiles.begin(); i != q->filtered_srcfiles.end(); ++i) q->dw.iterate_over_srcfile_lines (*i, q->line, q->has_statement_str, - q->line_type, query_srcfile_label, q); + q->line_type, query_srcfile_label, q->function, q); } else if ((q->has_statement_str || q->has_function_str) && (q->spec_type == function_file_and_line)) @@ -1462,7 +1462,7 @@ query_cu (Dwarf_Die * cudie, void * arg) for (set::const_iterator i = q->filtered_srcfiles.begin(); i != q->filtered_srcfiles.end(); ++i) q->dw.iterate_over_srcfile_lines (*i, q->line, q->has_statement_str, - q->line_type, query_srcfile_line, q); + q->line_type, query_srcfile_line, q->function, q); } else { -- cgit