binutils-gdb/gdb/testsuite/gdb.threads
Philippe Waroquiers 7a81c1e2d4 Fix tid-reuse sometimes blocks for a very long (infinite?) time.
A failure that seems to cause a long/infinite time is the following:

For a not clear reason, tid-reuse.c spawner thread sometimes gets an error:
     tid-reuse: /bd/home/philippe/gdb/git/build_moreaa/gdb/testsuite/../../../moreaa/gdb/testsuite/gdb.threads/tid-reuse.c:58: spawner_thread_func: Assertion `rc == 0' failed.

which causes a SIGABRT to be trapped by gdb, and tid-reuse does not reach the
after_count breakpoint:
  Thread 2 "tid-reuse" received signal SIGABRT, Aborted.
  [Switching to Thread 0x7ffff7518700 (LWP 10368)]
  __GI_raise (sig=sig@entry=6) at ../sysdeps/unix/sysv/linux/raise.c:51
  51	../sysdeps/unix/sysv/linux/raise.c: No such file or directory.
  (gdb) FAIL: gdb.threads/tid-reuse.exp: continue to breakpoint: after_count

After that, tid-reuse.exp gets the value of reuse_time, but this one kept its
initial value of -1 (as unsigned) :
  print reuse_time
  $1 = 4294967295
  (gdb) PASS: gdb.threads/tid-reuse.exp: get reuse_time

tid-reuse then dies, and the .exp script continues (with some FAIL)
till it executes:
  set timeout [expr $reuse_time * 2]

leading to the error:

  (gdb) ERROR: integer value too large to represent as non-long integer
      while executing
  "expect {
  -i exp8 -timeout 8589934590
          -re ".*A problem internal to GDB has been detected" {
              fail "$message (GDB internal error)"
              gdb_intern..."
      ("uplevel" body line 1)
      invoked from within
  "uplevel $body" ARITH IOVERFLOW {integer value too large to represent as non-long integer} integer value too large to represent as non-long integer
  ERROR: GDB process no longer exists

and then everything blocks.
This last 'GDB process no longer exists' is strange, as I still see the gdb
when this all blocks, e.g.
philippe 16058 31085  0 20:30 pts/15   00:00:00                         /bin/bash -c rootme=`pwd`; export rootme; srcdir=../../../binutils-gdb/gdb/testsuite ; export srcdir ; EXPECT=`if [
philippe 16386 16058  0 20:30 pts/15   00:00:00                           expect -- /usr/share/dejagnu/runtest.exp --status GDB_PARALLEL=yes --outdir=outputs/gdb.threads/tid-reuse gdb.thre
philippe 24848 16386  0 20:30 pts/20   00:00:00                             /bd/home/philippe/gdb/git/build_binutils-gdb/gdb/testsuite/../../gdb/gdb -nw -nx -data-directory /bd/home/philip

This patch gives a default value of 60, so that if ever something wrong happens
in tid-reuse, then the value retrieved by the .exp script stays in a reasonable
range.

Simon verified the patch by:
"I replaced the pthread_create call with the value 1 to simulate a
failure, and the test succeeds to fail quickly with your patch applied.
Without your patch, I get the infinite hang that you describe."

Compared to V1:
As suggested by Pedro, this version checks the pthread calls return
code (in particular of pthread_create) and reports the failure reason,
instead of just aborting.

gdb/testsuite/ChangeLog

2018-12-09  Philippe Waroquiers  <philippe.waroquiers@skynet.be>

	* gdb.threads/tid-reuse.c (REUSE_TIME_CAP): Declare as 60.
	(reuse_time): Initialize to REUSE_TIME_CAP.
	(check_rc): New function.
	(main): Use REUSE_TIME_CAP instead of hardcoded 60.
	Check pthread_create rc.
	(spawner_thread_func): Check pthread_create and pthread_join rc.
2018-12-09 09:24:27 +01:00
..
attach-into-signal.c Update copyright year range in all GDB files 2018-01-02 07:38:06 +04:00
attach-into-signal.exp Testsuite: fully migrate to use_gdb_stub convenience func 2018-03-23 10:38:23 +01:00
attach-many-short-lived-threads.c Update copyright year range in all GDB files 2018-01-02 07:38:06 +04:00
attach-many-short-lived-threads.exp Update copyright year range in all GDB files 2018-01-02 07:38:06 +04:00
attach-slow-waitpid.c gdb: Don't drop SIGSTOP during stop_all_threads 2018-06-16 01:03:57 +01:00
attach-slow-waitpid.exp gdb: Don't drop SIGSTOP during stop_all_threads 2018-06-16 01:03:57 +01:00
attach-stopped.c Update copyright year range in all GDB files 2018-01-02 07:38:06 +04:00
attach-stopped.exp Testsuite: fully migrate to use_gdb_stub convenience func 2018-03-23 10:38:23 +01:00
bp_in_thread.c Update copyright year range in all GDB files 2018-01-02 07:38:06 +04:00
bp_in_thread.exp Update copyright year range in all GDB files 2018-01-02 07:38:06 +04:00
break-while-running.c Update copyright year range in all GDB files 2018-01-02 07:38:06 +04:00
break-while-running.exp Update copyright year range in all GDB files 2018-01-02 07:38:06 +04:00
check-libthread-db.c testsuite: Fix race condition in check-libthread-db 2018-09-27 10:48:20 +01:00
check-libthread-db.exp linux: Add maintenance commands to test libthread_db 2018-06-08 18:06:46 +01:00
clone-attach-detach.c Update copyright year range in all GDB files 2018-01-02 07:38:06 +04:00
clone-attach-detach.exp Enable 'set print inferior-events' and improve detach/fork/kill/exit messages 2018-04-24 15:46:15 -04:00
clone-new-thread-event.c Update copyright year range in all GDB files 2018-01-02 07:38:06 +04:00
clone-new-thread-event.exp Update copyright year range in all GDB files 2018-01-02 07:38:06 +04:00
clone-thread_db.c Update copyright year range in all GDB files 2018-01-02 07:38:06 +04:00
clone-thread_db.exp Update copyright year range in all GDB files 2018-01-02 07:38:06 +04:00
continue-pending-after-query.c Update copyright year range in all GDB files 2018-01-02 07:38:06 +04:00
continue-pending-after-query.exp Update copyright year range in all GDB files 2018-01-02 07:38:06 +04:00
continue-pending-status.c Update copyright year range in all GDB files 2018-01-02 07:38:06 +04:00
continue-pending-status.exp Update copyright year range in all GDB files 2018-01-02 07:38:06 +04:00
corethreads.c Update copyright year range in all GDB files 2018-01-02 07:38:06 +04:00
corethreads.exp Update copyright year range in all GDB files 2018-01-02 07:38:06 +04:00
create-fail.c Update copyright year range in all GDB files 2018-01-02 07:38:06 +04:00
create-fail.exp Update copyright year range in all GDB files 2018-01-02 07:38:06 +04:00
current-lwp-dead.c Update copyright year range in all GDB files 2018-01-02 07:38:06 +04:00
current-lwp-dead.exp Update copyright year range in all GDB files 2018-01-02 07:38:06 +04:00
dlopen-libpthread-lib.c Update copyright year range in all GDB files 2018-01-02 07:38:06 +04:00
dlopen-libpthread.c Update copyright year range in all GDB files 2018-01-02 07:38:06 +04:00
dlopen-libpthread.exp Update copyright year range in all GDB files 2018-01-02 07:38:06 +04:00
execl.c Update copyright year range in all GDB files 2018-01-02 07:38:06 +04:00
execl.exp Update copyright year range in all GDB files 2018-01-02 07:38:06 +04:00
execl1.c Update copyright year range in all GDB files 2018-01-02 07:38:06 +04:00
fork-child-threads.c Update copyright year range in all GDB files 2018-01-02 07:38:06 +04:00
fork-child-threads.exp Update copyright year range in all GDB files 2018-01-02 07:38:06 +04:00
fork-plus-threads.c Update copyright year range in all GDB files 2018-01-02 07:38:06 +04:00
fork-plus-threads.exp Update copyright year range in all GDB files 2018-01-02 07:38:06 +04:00
fork-thread-pending.c Update copyright year range in all GDB files 2018-01-02 07:38:06 +04:00
fork-thread-pending.exp Update copyright year range in all GDB files 2018-01-02 07:38:06 +04:00
forking-threads-plus-breakpoint.c Update copyright year range in all GDB files 2018-01-02 07:38:06 +04:00
forking-threads-plus-breakpoint.exp Update copyright year range in all GDB files 2018-01-02 07:38:06 +04:00
gcore-stale-thread.c Update copyright year range in all GDB files 2018-01-02 07:38:06 +04:00
gcore-stale-thread.exp Update copyright year range in all GDB files 2018-01-02 07:38:06 +04:00
gcore-thread.exp Update copyright year range in all GDB files 2018-01-02 07:38:06 +04:00
hand-call-in-threads.c Update copyright year range in all GDB files 2018-01-02 07:38:06 +04:00
hand-call-in-threads.exp Update copyright year range in all GDB files 2018-01-02 07:38:06 +04:00
hand-call-new-thread.c Update copyright year range in all GDB files 2018-01-02 07:38:06 +04:00
hand-call-new-thread.exp Update copyright year range in all GDB files 2018-01-02 07:38:06 +04:00
ia64-sigill.c Update copyright year range in all GDB files 2018-01-02 07:38:06 +04:00
ia64-sigill.exp Update copyright year range in all GDB files 2018-01-02 07:38:06 +04:00
info-threads-cur-sal-2.c Update copyright year range in all GDB files 2018-01-02 07:38:06 +04:00
info-threads-cur-sal.c Update copyright year range in all GDB files 2018-01-02 07:38:06 +04:00
info-threads-cur-sal.exp Update copyright year range in all GDB files 2018-01-02 07:38:06 +04:00
interrupt-while-step-over.c Update copyright year range in all GDB files 2018-01-02 07:38:06 +04:00
interrupt-while-step-over.exp Update copyright year range in all GDB files 2018-01-02 07:38:06 +04:00
interrupted-hand-call.c Update copyright year range in all GDB files 2018-01-02 07:38:06 +04:00
interrupted-hand-call.exp Update copyright year range in all GDB files 2018-01-02 07:38:06 +04:00
kill.c Update copyright year range in all GDB files 2018-01-02 07:38:06 +04:00
kill.exp Fix new inferior events output 2018-04-25 17:28:25 +01:00
killed.c Update copyright year range in all GDB files 2018-01-02 07:38:06 +04:00
killed.exp Update copyright year range in all GDB files 2018-01-02 07:38:06 +04:00
leader-exit.c Update copyright year range in all GDB files 2018-01-02 07:38:06 +04:00
leader-exit.exp Update copyright year range in all GDB files 2018-01-02 07:38:06 +04:00
linux-dp.c
linux-dp.exp Update copyright year range in all GDB files 2018-01-02 07:38:06 +04:00
local-watch-wrong-thread.c Update copyright year range in all GDB files 2018-01-02 07:38:06 +04:00
local-watch-wrong-thread.exp Update copyright year range in all GDB files 2018-01-02 07:38:06 +04:00
manythreads.c Update copyright year range in all GDB files 2018-01-02 07:38:06 +04:00
manythreads.exp Update copyright year range in all GDB files 2018-01-02 07:38:06 +04:00
multi-create-ns-info-thr.exp Update copyright year range in all GDB files 2018-01-02 07:38:06 +04:00
multi-create.c Update copyright year range in all GDB files 2018-01-02 07:38:06 +04:00
multi-create.exp Update copyright year range in all GDB files 2018-01-02 07:38:06 +04:00
multiple-step-overs.c Update copyright year range in all GDB files 2018-01-02 07:38:06 +04:00
multiple-step-overs.exp Update copyright year range in all GDB files 2018-01-02 07:38:06 +04:00
multiple-successive-infcall.c Add test case for a known hang in infrun 2018-04-19 23:02:35 -04:00
multiple-successive-infcall.exp gdb: Mark async event handler when event is already pending 2018-06-12 21:15:33 +01:00
names.c Update copyright year range in all GDB files 2018-01-02 07:38:06 +04:00
names.exp Improve alignment of "info threads" output, align "Target Id" column 2018-06-29 20:47:15 +01:00
next-bp-other-thread.c Update copyright year range in all GDB files 2018-01-02 07:38:06 +04:00
next-bp-other-thread.exp Update copyright year range in all GDB files 2018-01-02 07:38:06 +04:00
next-while-other-thread-longjmps.c Update copyright year range in all GDB files 2018-01-02 07:38:06 +04:00
next-while-other-thread-longjmps.exp Update copyright year range in all GDB files 2018-01-02 07:38:06 +04:00
no-unwaited-for-left.c Update copyright year range in all GDB files 2018-01-02 07:38:06 +04:00
no-unwaited-for-left.exp Update copyright year range in all GDB files 2018-01-02 07:38:06 +04:00
non-ldr-exc-1.c Update copyright year range in all GDB files 2018-01-02 07:38:06 +04:00
non-ldr-exc-1.exp Update copyright year range in all GDB files 2018-01-02 07:38:06 +04:00
non-ldr-exc-2.c Update copyright year range in all GDB files 2018-01-02 07:38:06 +04:00
non-ldr-exc-2.exp Update copyright year range in all GDB files 2018-01-02 07:38:06 +04:00
non-ldr-exc-3.c Update copyright year range in all GDB files 2018-01-02 07:38:06 +04:00
non-ldr-exc-3.exp Update copyright year range in all GDB files 2018-01-02 07:38:06 +04:00
non-ldr-exc-4.c Update copyright year range in all GDB files 2018-01-02 07:38:06 +04:00
non-ldr-exc-4.exp Update copyright year range in all GDB files 2018-01-02 07:38:06 +04:00
non-ldr-exit.c Update copyright year range in all GDB files 2018-01-02 07:38:06 +04:00
non-ldr-exit.exp Update copyright year range in all GDB files 2018-01-02 07:38:06 +04:00
non-stop-fair-events.c Update copyright year range in all GDB files 2018-01-02 07:38:06 +04:00
non-stop-fair-events.exp Update copyright year range in all GDB files 2018-01-02 07:38:06 +04:00
pending-step.c Update copyright year range in all GDB files 2018-01-02 07:38:06 +04:00
pending-step.exp Update copyright year range in all GDB files 2018-01-02 07:38:06 +04:00
print-threads.c
print-threads.exp Update copyright year range in all GDB files 2018-01-02 07:38:06 +04:00
process-dies-while-detaching.c Update copyright year range in all GDB files 2018-01-02 07:38:06 +04:00
process-dies-while-detaching.exp Enable 'set print inferior-events' and improve detach/fork/kill/exit messages 2018-04-24 15:46:15 -04:00
process-dies-while-handling-bp.c Update copyright year range in all GDB files 2018-01-02 07:38:06 +04:00
process-dies-while-handling-bp.exp Update copyright year range in all GDB files 2018-01-02 07:38:06 +04:00
pthread_cond_wait.c Update copyright year range in all GDB files 2018-01-02 07:38:06 +04:00
pthread_cond_wait.exp Update copyright year range in all GDB files 2018-01-02 07:38:06 +04:00
pthreads.c Update copyright year range in all GDB files 2018-01-02 07:38:06 +04:00
pthreads.exp Modify gdb.threads/pthreads.exp to test FLAG qcs arguments for thread apply. 2018-07-12 23:10:29 +02:00
queue-signal.c Update copyright year range in all GDB files 2018-01-02 07:38:06 +04:00
queue-signal.exp Update copyright year range in all GDB files 2018-01-02 07:38:06 +04:00
reconnect-signal.c Update copyright year range in all GDB files 2018-01-02 07:38:06 +04:00
reconnect-signal.exp Update copyright year range in all GDB files 2018-01-02 07:38:06 +04:00
schedlock.c Update copyright year range in all GDB files 2018-01-02 07:38:06 +04:00
schedlock.exp Update copyright year range in all GDB files 2018-01-02 07:38:06 +04:00
siginfo-threads.c Update copyright year range in all GDB files 2018-01-02 07:38:06 +04:00
siginfo-threads.exp Update copyright year range in all GDB files 2018-01-02 07:38:06 +04:00
signal-command-handle-nopass.c Update copyright year range in all GDB files 2018-01-02 07:38:06 +04:00
signal-command-handle-nopass.exp Update copyright year range in all GDB files 2018-01-02 07:38:06 +04:00
signal-command-multiple-signals-pending.c Update copyright year range in all GDB files 2018-01-02 07:38:06 +04:00
signal-command-multiple-signals-pending.exp Update copyright year range in all GDB files 2018-01-02 07:38:06 +04:00
signal-delivered-right-thread.c Update copyright year range in all GDB files 2018-01-02 07:38:06 +04:00
signal-delivered-right-thread.exp Update copyright year range in all GDB files 2018-01-02 07:38:06 +04:00
signal-sigtrap.c Update copyright year range in all GDB files 2018-01-02 07:38:06 +04:00
signal-sigtrap.exp Update copyright year range in all GDB files 2018-01-02 07:38:06 +04:00
signal-while-stepping-over-bp-other-thread.c Update copyright year range in all GDB files 2018-01-02 07:38:06 +04:00
signal-while-stepping-over-bp-other-thread.exp Update copyright year range in all GDB files 2018-01-02 07:38:06 +04:00
sigstep-threads.c Update copyright year range in all GDB files 2018-01-02 07:38:06 +04:00
sigstep-threads.exp Update copyright year range in all GDB files 2018-01-02 07:38:06 +04:00
sigthread.c
sigthread.exp Update copyright year range in all GDB files 2018-01-02 07:38:06 +04:00
slow-waitpid.c gdb: Don't drop SIGSTOP during stop_all_threads 2018-06-16 01:03:57 +01:00
staticthreads.c Update copyright year range in all GDB files 2018-01-02 07:38:06 +04:00
staticthreads.exp Update copyright year range in all GDB files 2018-01-02 07:38:06 +04:00
step-bg-decr-pc-switch-thread.c Update copyright year range in all GDB files 2018-01-02 07:38:06 +04:00
step-bg-decr-pc-switch-thread.exp Update copyright year range in all GDB files 2018-01-02 07:38:06 +04:00
step-over-lands-on-breakpoint.c Update copyright year range in all GDB files 2018-01-02 07:38:06 +04:00
step-over-lands-on-breakpoint.exp Update copyright year range in all GDB files 2018-01-02 07:38:06 +04:00
step-over-trips-on-watchpoint.c Update copyright year range in all GDB files 2018-01-02 07:38:06 +04:00
step-over-trips-on-watchpoint.exp Update copyright year range in all GDB files 2018-01-02 07:38:06 +04:00
stepi-random-signal.c Update copyright year range in all GDB files 2018-01-02 07:38:06 +04:00
stepi-random-signal.exp Update copyright year range in all GDB files 2018-01-02 07:38:06 +04:00
switch-threads.c Update copyright year range in all GDB files 2018-01-02 07:38:06 +04:00
switch-threads.exp Update copyright year range in all GDB files 2018-01-02 07:38:06 +04:00
thread-execl.c Update copyright year range in all GDB files 2018-01-02 07:38:06 +04:00
thread-execl.exp Update copyright year range in all GDB files 2018-01-02 07:38:06 +04:00
thread-find.exp Update copyright year range in all GDB files 2018-01-02 07:38:06 +04:00
thread-specific-bp.c Update copyright year range in all GDB files 2018-01-02 07:38:06 +04:00
thread-specific-bp.exp Update copyright year range in all GDB files 2018-01-02 07:38:06 +04:00
thread-specific.c Update copyright year range in all GDB files 2018-01-02 07:38:06 +04:00
thread-specific.exp Update copyright year range in all GDB files 2018-01-02 07:38:06 +04:00
thread-unwindonsignal.exp Update copyright year range in all GDB files 2018-01-02 07:38:06 +04:00
thread_check.c Update copyright year range in all GDB files 2018-01-02 07:38:06 +04:00
thread_check.exp Update copyright year range in all GDB files 2018-01-02 07:38:06 +04:00
thread_events.c Update copyright year range in all GDB files 2018-01-02 07:38:06 +04:00
thread_events.exp Update copyright year range in all GDB files 2018-01-02 07:38:06 +04:00
threadapply.c Update copyright year range in all GDB files 2018-01-02 07:38:06 +04:00
threadapply.exp Remove a bunch of usages of gdb_suppress_tests in 'runto_main'. 2018-10-27 14:47:36 +02:00
threxit-hop-specific.c Update copyright year range in all GDB files 2018-01-02 07:38:06 +04:00
threxit-hop-specific.exp Update copyright year range in all GDB files 2018-01-02 07:38:06 +04:00
tid-reuse.c Fix tid-reuse sometimes blocks for a very long (infinite?) time. 2018-12-09 09:24:27 +01:00
tid-reuse.exp Update copyright year range in all GDB files 2018-01-02 07:38:06 +04:00
tls-core.c testsuite: Extend TLS core file testing with an OS-generated dump 2018-05-24 15:31:32 +01:00
tls-core.exp testsuite: Extend TLS core file testing with an OS-generated dump 2018-05-24 15:31:32 +01:00
tls-main.c
tls-nodebug-pie.c Update copyright year range in all GDB files 2018-01-02 07:38:06 +04:00
tls-nodebug-pie.exp Update copyright year range in all GDB files 2018-01-02 07:38:06 +04:00
tls-nodebug.c
tls-nodebug.exp Update copyright year range in all GDB files 2018-01-02 07:38:06 +04:00
tls-shared.c
tls-shared.exp Update copyright year range in all GDB files 2018-01-02 07:38:06 +04:00
tls-so_extern.c Update copyright year range in all GDB files 2018-01-02 07:38:06 +04:00
tls-so_extern.exp Update copyright year range in all GDB files 2018-01-02 07:38:06 +04:00
tls-so_extern_main.c Update copyright year range in all GDB files 2018-01-02 07:38:06 +04:00
tls-var-main.c Update copyright year range in all GDB files 2018-01-02 07:38:06 +04:00
tls-var.c Update copyright year range in all GDB files 2018-01-02 07:38:06 +04:00
tls-var.exp Update copyright year range in all GDB files 2018-01-02 07:38:06 +04:00
tls.c
tls.exp Update copyright year range in all GDB files 2018-01-02 07:38:06 +04:00
tls2.c Update copyright year range in all GDB files 2018-01-02 07:38:06 +04:00
watchpoint-fork-child.c Update copyright year range in all GDB files 2018-01-02 07:38:06 +04:00
watchpoint-fork-mt.c Update copyright year range in all GDB files 2018-01-02 07:38:06 +04:00
watchpoint-fork-parent.c Update copyright year range in all GDB files 2018-01-02 07:38:06 +04:00
watchpoint-fork-st.c Update copyright year range in all GDB files 2018-01-02 07:38:06 +04:00
watchpoint-fork.exp Update copyright year range in all GDB files 2018-01-02 07:38:06 +04:00
watchpoint-fork.h Update copyright year range in all GDB files 2018-01-02 07:38:06 +04:00
watchthreads-reorder.c Update copyright year range in all GDB files 2018-01-02 07:38:06 +04:00
watchthreads-reorder.exp Update copyright year range in all GDB files 2018-01-02 07:38:06 +04:00
watchthreads.c Update copyright year range in all GDB files 2018-01-02 07:38:06 +04:00
watchthreads.exp Remove a bunch of usages of gdb_suppress_tests in 'runto_main'. 2018-10-27 14:47:36 +02:00
watchthreads2.c Update copyright year range in all GDB files 2018-01-02 07:38:06 +04:00
watchthreads2.exp Remove a bunch of usages of gdb_suppress_tests in 'runto_main'. 2018-10-27 14:47:36 +02:00
wp-replication.c Update copyright year range in all GDB files 2018-01-02 07:38:06 +04:00
wp-replication.exp Update copyright year range in all GDB files 2018-01-02 07:38:06 +04:00