[Ltrace-devel] r76 - in ltrace/trunk: . testsuite/ltrace.torture
Petr Machata
pmachata-guest at alioth.debian.org
Wed May 9 17:21:42 UTC 2007
Author: pmachata-guest
Date: 2007-05-09 17:21:42 +0000 (Wed, 09 May 2007)
New Revision: 76
Added:
ltrace/trunk/testsuite/ltrace.torture/ia64-sigill.exp
ltrace/trunk/testsuite/ltrace.torture/ia64-sigill.s
Modified:
ltrace/trunk/ChangeLog
ltrace/trunk/wait_for_something.c
Log:
* wait_for_something.c (wait_for_something): Interpret SIGILL,
SIGEMT and SIGSEGV as valid breakpoint signals, if instruction
pointer referes to breakpoint.
* testsuite/ltrace.torture/ia64-sigill.s,
* testsuite/ltrace.torture/ia64-sigill.exp: Testcase for same.
IA64-centric, because the only reproducer is there.
Modified: ltrace/trunk/ChangeLog
===================================================================
--- ltrace/trunk/ChangeLog 2007-01-25 17:05:44 UTC (rev 75)
+++ ltrace/trunk/ChangeLog 2007-05-09 17:21:42 UTC (rev 76)
@@ -1,3 +1,12 @@
+2007-05-09 Petr Machata <pmachata at redhat.com>
+
+ * wait_for_something.c (wait_for_something): Interpret SIGILL,
+ SIGEMT and SIGSEGV as valid breakpoint signals, if instruction
+ pointer referes to breakpoint.
+ * testsuite/ltrace.torture/ia64-sigill.s,
+ * testsuite/ltrace.torture/ia64-sigill.exp: Testcase for same.
+ IA64-centric, because the only reproducer is there.
+
2007-01-19 Petr Machata <pmachata at redhat.com>
* sysdeps/linux-gnu/trace.c (trace_pid): wait for child to stop,
Added: ltrace/trunk/testsuite/ltrace.torture/ia64-sigill.exp
===================================================================
--- ltrace/trunk/testsuite/ltrace.torture/ia64-sigill.exp 2007-01-25 17:05:44 UTC (rev 75)
+++ ltrace/trunk/testsuite/ltrace.torture/ia64-sigill.exp 2007-05-09 17:21:42 UTC (rev 76)
@@ -0,0 +1,33 @@
+# This file was written by Yao Qi <qiyao at cn.ibm.com>.
+
+set testfile "ia64-sigill"
+set srcfile ${testfile}.s
+set binfile ${testfile}
+
+if { [istarget ia64-*] } then {
+ verbose "compiling source file now....."
+ # Build the shared libraries this test case needs.
+ if { [ ltrace_compile "${srcdir}/${subdir}/${testfile}.s" "${srcdir}/${subdir}/${binfile}" executable {debug} ] != "" } {
+ send_user "Testcase compile failed, so all tests in this file will automatically fail\n."
+ }
+
+ # Run PUT for ltarce.
+ set exec_output [ltrace_runtest $srcdir/$subdir $srcdir/$subdir/$binfile]
+
+ # Check the output of this program.
+ verbose "ltrace runtest output: $exec_output\n"
+ if [regexp {ELF from incompatible architecture} $exec_output] {
+ fail "32-bit ltrace can not perform on 64-bit PUTs and rebuild ltrace in 64 bit mode!"
+ return
+ } elseif [ regexp {Couldn't get .hash data} $exec_output ] {
+ fail "Couldn't get .hash data!"
+ return
+ }
+
+ catch "exec sh -c {grep SIGILL ${srcdir}/${subdir}/${testfile}.ltrace | wc -l ;exit}" output
+ if { $output == 0 } then {
+ pass "ltrace did interpret SIGILL as breakpoint."
+ } else {
+ fail "ltrace failed to interpret SIGILL as breakpoint."
+ }
+}
Added: ltrace/trunk/testsuite/ltrace.torture/ia64-sigill.s
===================================================================
--- ltrace/trunk/testsuite/ltrace.torture/ia64-sigill.s 2007-01-25 17:05:44 UTC (rev 75)
+++ ltrace/trunk/testsuite/ltrace.torture/ia64-sigill.s 2007-05-09 17:21:42 UTC (rev 76)
@@ -0,0 +1,43 @@
+ .file "pokus.c"
+ .pred.safe_across_calls p1-p5,p16-p63
+ .section .rodata
+ .align 8
+.LC0:
+ stringz ""
+ .text
+ .align 16
+ .global main#
+ .proc main#
+main:
+ .prologue 14, 32
+ .save ar.pfs, r33
+ alloc r33 = ar.pfs, 0, 4, 1, 0
+ .vframe r34
+ mov r34 = r12
+ mov r35 = r1
+ .save rp, r32
+ mov r32 = b0
+ .body
+ addl r36 = @ltoffx(.LC0), r1
+ ;;
+ ld8.mov r36 = [r36], .LC0
+ br.call.sptk.many b0 = printf#
+ nop.b 0x0
+ nop.b 0x1
+ nop.b 0x2
+ nop.b 0x0
+ nop.b 0x1
+ nop.b 0x2
+ mov r1 = r35
+ addl r14 = 234, r0
+ ;;
+ mov r8 = r14
+ mov ar.pfs = r33
+ mov b0 = r32
+ .restore sp
+ mov r12 = r34
+ br.ret.sptk.many b0
+ ;;
+ .endp main#
+ .section .note.GNU-stack,"", at progbits
+ .ident "GCC: (GNU) 3.4.6 20060404 (Red Hat 3.4.6-3)"
Modified: ltrace/trunk/wait_for_something.c
===================================================================
--- ltrace/trunk/wait_for_something.c 2007-01-25 17:05:44 UTC (rev 75)
+++ ltrace/trunk/wait_for_something.c 2007-05-09 17:21:42 UTC (rev 76)
@@ -25,6 +25,7 @@
pid_t pid;
int status;
int tmp;
+ int stop_signal;
if (!list_of_processes) {
debug(1, "No more children");
@@ -86,10 +87,31 @@
event.thing = LT_EV_UNKNOWN;
return &event;
}
- if ((WSTOPSIG(status) != (SIGTRAP | event.proc->tracesysgood)) &&
- (WSTOPSIG(status) != SIGTRAP)) {
+
+ stop_signal = WSTOPSIG(status);
+
+ /* On some targets, breakpoints are signalled not using
+ SIGTRAP, but also with SIGILL, SIGSEGV or SIGEMT. Check
+ for these. */
+ if (stop_signal == SIGSEGV
+ || stop_signal == SIGILL
+#ifdef SIGEMT
+ || stop_signal == SIGEMT
+#endif
+ ) {
+ // If we didn't need to know IP so far, get it now.
+ void * addr = opt_i
+ ? event.proc->instruction_pointer
+ : (event.proc->instruction_pointer = get_instruction_pointer (event.proc));
+
+ if (address2bpstruct(event.proc, addr))
+ stop_signal = SIGTRAP;
+ }
+
+ if (stop_signal != (SIGTRAP | event.proc->tracesysgood)
+ && stop_signal != SIGTRAP) {
event.thing = LT_EV_SIGNAL;
- event.e_un.signum = WSTOPSIG(status);
+ event.e_un.signum = stop_signal;
return &event;
}
event.thing = LT_EV_BREAKPOINT;
More information about the Ltrace-devel
mailing list