Jan Kratochvil 3a8cee8
http://sourceware.org/ml/gdb-patches/2016-01/msg00580.html
Jan Kratochvil 3a8cee8
Subject: [testsuite patch]#3 Fix PR threads/19422 regression + Guile regression [Re: [PATCH+doc] Fix PR threads/19422 - show which thread caused stop]
Jan Kratochvil c16b445
Jan Kratochvil c16b445
Jan Kratochvil 3a8cee8
--r5Pyd7+fXNt84Ff3
Jan Kratochvil c16b445
Content-Type: text/plain; charset=us-ascii
Jan Kratochvil c16b445
Content-Disposition: inline
Jan Kratochvil c16b445
Jan Kratochvil 3a8cee8
[ now moved the new test a bit lower ]
Jan Kratochvil 3a8cee8
# "signal SIGINT" could also switch the current thread.
Jan Kratochvil 3a8cee8
On Fri, 22 Jan 2016 18:31:00 +0100, Jan Kratochvil wrote:
Jan Kratochvil 3a8cee8
Jan Kratochvil c16b445
[ now with the patch]
Jan Kratochvil c16b445
On Fri, 22 Jan 2016 18:30:20 +0100, Jan Kratochvil wrote:
Jan Kratochvil c16b445
Jan Kratochvil c16b445
On Thu, 14 Jan 2016 15:08:40 +0100, Pedro Alves wrote:
Jan Kratochvil c16b445
> gdb/ChangeLog:
Jan Kratochvil c16b445
> 2016-01-14  Pedro Alves  <palves@redhat.com>
Jan Kratochvil c16b445
> 
Jan Kratochvil c16b445
> 	* NEWS: Mention that GDB now displays the ID and name of the
Jan Kratochvil c16b445
> 	thread that hit a breakpoint or received a signal.
Jan Kratochvil c16b445
> 	* break-catch-sig.c (signal_catchpoint_print_it): Use
Jan Kratochvil c16b445
> 	maybe_print_thread_hit_breakpoint.
Jan Kratochvil c16b445
> 	* break-catch-syscall.c (print_it_catch_syscall): Likewise.
Jan Kratochvil c16b445
> 	* break-catch-throw.c (print_it_exception_catchpoint): Likewise.
Jan Kratochvil c16b445
> 	* breakpoint.c (maybe_print_thread_hit_breakpoint): New function.
Jan Kratochvil c16b445
> 	(print_it_catch_fork, print_it_catch_vfork, print_it_catch_solib)
Jan Kratochvil c16b445
> 	(print_it_catch_exec, print_it_ranged_breakpoint)
Jan Kratochvil c16b445
> 	(print_it_watchpoint, print_it_masked_watchpoint, bkpt_print_it):
Jan Kratochvil c16b445
> 	Use maybe_print_thread_hit_breakpoint.
Jan Kratochvil c16b445
> 	* breakpoint.h (maybe_print_thread_hit_breakpoint): Declare.
Jan Kratochvil c16b445
> 	* gdbthread.h (show_thread_that_caused_stop): Declare.
Jan Kratochvil c16b445
> 	* infrun.c (print_signal_received_reason): Print which thread
Jan Kratochvil c16b445
> 	received signal.
Jan Kratochvil c16b445
> 	* thread.c (show_thread_that_caused_stop): New function.
Jan Kratochvil c16b445
Jan Kratochvil c16b445
There was already before a regression if --with-guile (which is default if
Jan Kratochvil c16b445
Guile is found) was used:
Jan Kratochvil c16b445
Jan Kratochvil c16b445
backtrace^M
Jan Kratochvil c16b445
#0  0x00007ffff6078da0 in __sigprocmask (how=2, set=0x7fffffffcc40, oset=0x0) at ../sysdeps/unix/sysv/linux/x86_64/sigprocmask.c:39^M
Jan Kratochvil c16b445
#1  0x0000000000966ce9 in _rl_handle_signal (sig=2) at signals.c:228^M
Jan Kratochvil c16b445
#2  0x0000000000966c05 in rl_signal_handler (sig=2) at signals.c:149^M
Jan Kratochvil c16b445
#3  <signal handler called>^M
Jan Kratochvil c16b445
#4  0x00007ffff613afc0 in __poll_nocancel () at ../sysdeps/unix/syscall-template.S:84^M
Jan Kratochvil c16b445
#5  0x00000000007d9a88 in gdb_wait_for_event (block=1) at event-loop.c:746^M
Jan Kratochvil c16b445
#6  0x00000000007d8e87 in gdb_do_one_event () at event-loop.c:323^M
Jan Kratochvil c16b445
#7  0x00000000007d8ed8 in start_event_loop () at event-loop.c:347^M
Jan Kratochvil c16b445
#8  0x00000000007da9dc in cli_command_loop (data=0x0) at event-top.c:186^M
Jan Kratochvil c16b445
#9  0x00000000007d0b4c in current_interp_command_loop () at interps.c:317^M
Jan Kratochvil c16b445
#10 0x00000000007d1f56 in captured_command_loop (data=0x0) at main.c:318^M
Jan Kratochvil c16b445
#11 0x00000000007cd6c9 in catch_errors (func=0x7d1f3b <captured_command_loop>, func_args=0x0, errstring=0x1167f75 "", mask=RETURN_MASK_ALL) at exceptions.c:240^M
Jan Kratochvil c16b445
#12 0x00000000007d3514 in captured_main (data=0x7fffffffd600) at main.c:1157^M
Jan Kratochvil c16b445
#13 0x00000000007cd6c9 in catch_errors (func=0x7d23d5 <captured_main>, func_args=0x7fffffffd600, errstring=0x1167f75 "", mask=RETURN_MASK_ALL) at exceptions.c:240^M
Jan Kratochvil c16b445
#14 0x00000000007d353d in gdb_main (args=0x7fffffffd600) at main.c:1165^M
Jan Kratochvil c16b445
#15 0x000000000049ae8c in main (argc=5, argv=0x7fffffffd708) at gdb.c:32^M
Jan Kratochvil c16b445
(gdb) PASS: gdb.gdb/selftest.exp: backtrace through signal handler
Jan Kratochvil c16b445
->
Jan Kratochvil c16b445
backtrace^M
Jan Kratochvil c16b445
#0  pthread_cond_wait@@GLIBC_2.3.2 () at ../sysdeps/unix/sysv/linux/x86_64/pthread_cond_wait.S:185^M
Jan Kratochvil c16b445
#1  0x00007ffff6db32b7 in GC_wait_marker () at pthread_support.c:2036^M
Jan Kratochvil c16b445
#2  0x00007ffff6da92ba in GC_help_marker (my_mark_no=my_mark_no@entry=4) at mark.c:1168^M
Jan Kratochvil c16b445
#3  0x00007ffff6db15ef in GC_mark_thread (id=<optimized out>) at pthread_support.c:389^M
Jan Kratochvil c16b445
#4  0x00007ffff6b8360a in start_thread (arg=0x7ffff337e700) at pthread_create.c:334^M
Jan Kratochvil c16b445
#5  0x00007ffff5847a4d in clone () at ../sysdeps/unix/sysv/linux/x86_64/clone.S:109^M
Jan Kratochvil c16b445
(gdb) FAIL: gdb.gdb/selftest.exp: backtrace through signal handler
Jan Kratochvil c16b445
Jan Kratochvil c16b445
Jan Kratochvil c16b445
Additionally this patchset added a new regression:
Jan Kratochvil c16b445
Jan Kratochvil c16b445
Program received signal SIGINT, Interrupt.^M
Jan Kratochvil c16b445
0x00007ffff613afc0 in __poll_nocancel () at ../sysdeps/unix/syscall-template.S:84^M
Jan Kratochvil c16b445
84      T_PSEUDO (SYSCALL_SYMBOL, SYSCALL_NAME, SYSCALL_NARGS)^M
Jan Kratochvil c16b445
(gdb) PASS: gdb.gdb/selftest.exp: send ^C to child process
Jan Kratochvil c16b445
->
Jan Kratochvil c16b445
Thread 1 "xgdb" received signal SIGINT, Interrupt.^M
Jan Kratochvil c16b445
0x00007ffff583bfdd in poll () at ../sysdeps/unix/syscall-template.S:84^M
Jan Kratochvil c16b445
84      T_PSEUDO (SYSCALL_SYMBOL, SYSCALL_NAME, SYSCALL_NARGS)^M
Jan Kratochvil c16b445
(gdb) FAIL: gdb.gdb/selftest.exp: send ^C to child process
Jan Kratochvil c16b445
Jan Kratochvil c16b445
Jan Kratochvil c16b445
OK to check-in the fix for both of these problems?
Jan Kratochvil c16b445
Jan Kratochvil c16b445
Tested on x86_64-fedora23-linux-gnu.
Jan Kratochvil c16b445
Jan Kratochvil c16b445
Jan Kratochvil c16b445
Thanks,
Jan Kratochvil c16b445
Jan
Jan Kratochvil c16b445
Jan Kratochvil 3a8cee8
--r5Pyd7+fXNt84Ff3
Jan Kratochvil c16b445
Content-Type: text/plain; charset=us-ascii
Jan Kratochvil c16b445
Content-Disposition: inline; filename=1
Jan Kratochvil c16b445
Jan Kratochvil c16b445
gdb/testsuite/ChangeLog
Jan Kratochvil c16b445
2016-01-22  Jan Kratochvil  <jan.kratochvil@redhat.com>
Jan Kratochvil c16b445
Jan Kratochvil c16b445
	Fix testsuite compatibility with Guile.
Jan Kratochvil c16b445
	* gdb.gdb/selftest.exp (send ^C to child process): Accept also Thread.
Jan Kratochvil c16b445
	(thread 1): New test for backtrace through signal handler.
Jan Kratochvil c16b445
Jan Kratochvil c16b445
diff --git a/gdb/testsuite/gdb.gdb/selftest.exp b/gdb/testsuite/gdb.gdb/selftest.exp
Jan Kratochvil 3a8cee8
index 4d55cb5..da7a80b 100644
Jan Kratochvil c16b445
--- a/gdb/testsuite/gdb.gdb/selftest.exp
Jan Kratochvil c16b445
+++ b/gdb/testsuite/gdb.gdb/selftest.exp
Jan Kratochvil c16b445
@@ -436,8 +436,9 @@ proc test_with_self { executable } {
Jan Kratochvil c16b445
     if ![target_info exists gdb,nointerrupts] {
Jan Kratochvil c16b445
 	set description "send ^C to child process"
Jan Kratochvil c16b445
 	send_gdb "\003"
Jan Kratochvil c16b445
+	# "Thread 1" is displayed iff Guile support is linked in.
Jan Kratochvil c16b445
 	gdb_expect {
Jan Kratochvil c16b445
-	    -re "Program received signal SIGINT.*$gdb_prompt $" {
Jan Kratochvil c16b445
+	    -re "(Thread 1 \"xgdb\"|Program) received signal SIGINT.*$gdb_prompt $" {
Jan Kratochvil c16b445
 		pass "$description"
Jan Kratochvil c16b445
 	    }
Jan Kratochvil c16b445
 	    -re ".*$gdb_prompt $" {
Jan Kratochvil 3a8cee8
@@ -453,6 +454,10 @@ proc test_with_self { executable } {
Jan Kratochvil 3a8cee8
     gdb_test "signal SIGINT" \
Jan Kratochvil 3a8cee8
 	"Continuing with signal SIGINT.*" \
Jan Kratochvil 3a8cee8
 	"$description"
Jan Kratochvil c16b445
+
Jan Kratochvil c16b445
+    # Switch back to the GDB thread if Guile support is linked in.
Jan Kratochvil 3a8cee8
+    # "signal SIGINT" could also switch the current thread.
Jan Kratochvil c16b445
+    gdb_test "thread 1" {\[Switching to thread 1 .*\].*}
Jan Kratochvil c16b445
     
Jan Kratochvil 3a8cee8
     # get a stack trace
Jan Kratochvil 3a8cee8
     #
Jan Kratochvil c16b445
Jan Kratochvil 3a8cee8
--r5Pyd7+fXNt84Ff3--
Jan Kratochvil c16b445