binutils-gdb/gdb/testsuite/gdb.threads
Tom de Vries 6b66b5a5a2 [gdb/testsuite] Fix check-libthread-db.exp FAILs with glibc 2.33
When running test-case gdb.threads/check-libthread-db.exp on openSUSE
Tumbleweed with glibc 2.33, I get:
...
(gdb) maint check libthread-db^M
Running libthread_db integrity checks:^M
  Got thread 0x7ffff7c79b80 => 9354 => 0x7ffff7c79b80; errno = 0 ... OK^M
libthread_db integrity checks passed.^M
(gdb) FAIL: gdb.threads/check-libthread-db.exp: user-initiated check: \
  libpthread.so not initialized (pattern 2)
...

The test-case expects instead:
...
  Got thread 0x0 => 9354 => 0x0 ... OK^M
...
which is what I get on openSUSE Leap 15.2 with glibc 2.26, and what is
described in the test-case like this:
...
    # libthread_db should fake a single thread with th_unique == NULL.
...

Using a breakpoint on check_thread_db_callback we can compare the two
scenarios, and find that in the latter case we hit this code in glibc function
iterate_thread_list in nptl_db/td_ta_thr_iter.c:
...
  if (next == 0 && fake_empty)
    {
      /* __pthread_initialize_minimal has not run.  There is just the main
         thread to return.  We cannot rely on its thread register.  They
         sometimes contain garbage that would confuse us, left by the
         kernel at exec.  So if it looks like initialization is incomplete,
         we only fake a special descriptor for the initial thread.  */
      td_thrhandle_t th = { ta, 0 };
      return callback (&th, cbdata_p) != 0 ? TD_DBERR : TD_OK;
    }
...
while in the former case we don't because this preceding statement doesn't
result in next == 0:
...
  err = DB_GET_FIELD (next, ta, head, list_t, next, 0);
...

Note that the comment mentions __pthread_initialize_minimal, but in both cases
it has already run before we hit the callback, so it's possible the comment is
no longer accurate.

The change in behaviour bisect to glibc commit 1daccf403b "nptl: Move stack
list variables into _rtld_global", which moves the initialization of stack
list variables such as __stack_user to an earlier moment, which explains well
enough the observed difference.

Fix this by updating the regexp patterns to agree with what libthread-db is
telling us.

Tested on x86_64-linux, both with glibc 2.33 and 2.26.

gdb/testsuite/ChangeLog:

2021-07-07  Tom de Vries  <tdevries@suse.de>

	PR testsuite/27690
	* gdb.threads/check-libthread-db.exp: Update patterns for glibc 2.33.
2021-07-13 15:56:49 +02:00
..
access-mem-running-thread-exit.c Linux: Access memory even if threads are running 2021-07-01 14:02:01 +01:00
access-mem-running-thread-exit.exp Linux: Access memory even if threads are running 2021-07-01 14:02:01 +01:00
async.c Update copyright year range in all GDB files 2021-01-01 12:12:21 +04:00
async.exp Update copyright year range in all GDB files 2021-01-01 12:12:21 +04:00
attach-into-signal.c Update copyright year range in all GDB files 2021-01-01 12:12:21 +04:00
attach-into-signal.exp Update copyright year range in all GDB files 2021-01-01 12:12:21 +04:00
attach-many-short-lived-threads.c Update copyright year range in all GDB files 2021-01-01 12:12:21 +04:00
attach-many-short-lived-threads.exp Update copyright year range in all GDB files 2021-01-01 12:12:21 +04:00
attach-non-stop.c Testcase for attaching in non-stop mode 2021-02-03 01:14:42 +00:00
attach-non-stop.exp Testcase for attaching in non-stop mode 2021-02-03 01:14:42 +00:00
attach-slow-waitpid.c Update copyright year range in all GDB files 2021-01-01 12:12:21 +04:00
attach-slow-waitpid.exp Update copyright year range in all GDB files 2021-01-01 12:12:21 +04:00
attach-stopped.c Update copyright year range in all GDB files 2021-01-01 12:12:21 +04:00
attach-stopped.exp Update copyright year range in all GDB files 2021-01-01 12:12:21 +04:00
bp_in_thread.c Update copyright year range in all GDB files 2021-01-01 12:12:21 +04:00
bp_in_thread.exp Update copyright year range in all GDB files 2021-01-01 12:12:21 +04:00
break-while-running.c Update copyright year range in all GDB files 2021-01-01 12:12:21 +04:00
break-while-running.exp Update copyright year range in all GDB files 2021-01-01 12:12:21 +04:00
check-libthread-db.c Update copyright year range in all GDB files 2021-01-01 12:12:21 +04:00
check-libthread-db.exp [gdb/testsuite] Fix check-libthread-db.exp FAILs with glibc 2.33 2021-07-13 15:56:49 +02:00
clone-attach-detach.c Update copyright year range in all GDB files 2021-01-01 12:12:21 +04:00
clone-attach-detach.exp Update copyright year range in all GDB files 2021-01-01 12:12:21 +04:00
clone-new-thread-event.c Update copyright year range in all GDB files 2021-01-01 12:12:21 +04:00
clone-new-thread-event.exp Update copyright year range in all GDB files 2021-01-01 12:12:21 +04:00
clone-thread_db.c Update copyright year range in all GDB files 2021-01-01 12:12:21 +04:00
clone-thread_db.exp Update copyright year range in all GDB files 2021-01-01 12:12:21 +04:00
continue-pending-after-query.c Update copyright year range in all GDB files 2021-01-01 12:12:21 +04:00
continue-pending-after-query.exp Update copyright year range in all GDB files 2021-01-01 12:12:21 +04:00
continue-pending-status.c Update copyright year range in all GDB files 2021-01-01 12:12:21 +04:00
continue-pending-status.exp Update copyright year range in all GDB files 2021-01-01 12:12:21 +04:00
corethreads.c Update copyright year range in all GDB files 2021-01-01 12:12:21 +04:00
corethreads.exp Update copyright year range in all GDB files 2021-01-01 12:12:21 +04:00
create-fail.c Update copyright year range in all GDB files 2021-01-01 12:12:21 +04:00
create-fail.exp Update copyright year range in all GDB files 2021-01-01 12:12:21 +04:00
current-lwp-dead.c Update copyright year range in all GDB files 2021-01-01 12:12:21 +04:00
current-lwp-dead.exp Update copyright year range in all GDB files 2021-01-01 12:12:21 +04:00
detach-step-over.c Testcase for detaching while stepping over breakpoint 2021-02-03 01:15:22 +00:00
detach-step-over.exp [gdb/testsuite] Fix timeout in gdb.threads/detach-step-over.exp with readnow 2021-05-05 15:13:17 +02:00
dlopen-libpthread-lib.c Update copyright year range in all GDB files 2021-01-01 12:12:21 +04:00
dlopen-libpthread.c Update copyright year range in all GDB files 2021-01-01 12:12:21 +04:00
dlopen-libpthread.exp Update copyright year range in all GDB files 2021-01-01 12:12:21 +04:00
execl.c Update copyright year range in all GDB files 2021-01-01 12:12:21 +04:00
execl.exp gdb/testsuite: squash duplicate test names in gdb.threads/*.exp 2021-03-16 09:31:06 +00:00
execl1.c Update copyright year range in all GDB files 2021-01-01 12:12:21 +04:00
fork-child-threads.c Update copyright year range in all GDB files 2021-01-01 12:12:21 +04:00
fork-child-threads.exp Update copyright year range in all GDB files 2021-01-01 12:12:21 +04:00
fork-plus-threads.c Update copyright year range in all GDB files 2021-01-01 12:12:21 +04:00
fork-plus-threads.exp [gdb/testsuite] Fix gdb.threads/fork-plus-threads.exp with readnow 2021-05-05 09:07:27 +02:00
fork-thread-pending.c Update copyright year range in all GDB files 2021-01-01 12:12:21 +04:00
fork-thread-pending.exp Update copyright year range in all GDB files 2021-01-01 12:12:21 +04:00
forking-threads-plus-breakpoint.c Update copyright year range in all GDB files 2021-01-01 12:12:21 +04:00
forking-threads-plus-breakpoint.exp Update copyright year range in all GDB files 2021-01-01 12:12:21 +04:00
gcore-stale-thread.c Update copyright year range in all GDB files 2021-01-01 12:12:21 +04:00
gcore-stale-thread.exp Update copyright year range in all GDB files 2021-01-01 12:12:21 +04:00
gcore-thread.exp [gdb/testsuite] Fix xfail handling in gdb.threads/gcore-thread.exp 2021-04-06 10:40:11 +02:00
hand-call-in-threads.c Update copyright year range in all GDB files 2021-01-01 12:12:21 +04:00
hand-call-in-threads.exp Update copyright year range in all GDB files 2021-01-01 12:12:21 +04:00
hand-call-new-thread.c Update copyright year range in all GDB files 2021-01-01 12:12:21 +04:00
hand-call-new-thread.exp Update copyright year range in all GDB files 2021-01-01 12:12:21 +04:00
ia64-sigill.c Update copyright year range in all GDB files 2021-01-01 12:12:21 +04:00
ia64-sigill.exp gdb: introduce scoped debug prints 2021-01-04 12:00:54 -05:00
info-threads-cur-sal-2.c Update copyright year range in all GDB files 2021-01-01 12:12:21 +04:00
info-threads-cur-sal.c Update copyright year range in all GDB files 2021-01-01 12:12:21 +04:00
info-threads-cur-sal.exp Update copyright year range in all GDB files 2021-01-01 12:12:21 +04:00
interrupt-while-step-over.c Update copyright year range in all GDB files 2021-01-01 12:12:21 +04:00
interrupt-while-step-over.exp Update copyright year range in all GDB files 2021-01-01 12:12:21 +04:00
interrupted-hand-call.c Update copyright year range in all GDB files 2021-01-01 12:12:21 +04:00
interrupted-hand-call.exp Update copyright year range in all GDB files 2021-01-01 12:12:21 +04:00
kill.c Update copyright year range in all GDB files 2021-01-01 12:12:21 +04:00
kill.exp Update copyright year range in all GDB files 2021-01-01 12:12:21 +04:00
killed-outside.c Update copyright year range in all GDB files 2021-01-01 12:12:21 +04:00
killed-outside.exp [gdb/testsuite] Fix gdb.threads/killed-outside.exp with -m32 2021-01-26 10:00:39 +01:00
killed.c Update copyright year range in all GDB files 2021-01-01 12:12:21 +04:00
killed.exp Update copyright year range in all GDB files 2021-01-01 12:12:21 +04:00
leader-exit.c Update copyright year range in all GDB files 2021-01-01 12:12:21 +04:00
leader-exit.exp Update copyright year range in all GDB files 2021-01-01 12:12:21 +04:00
linux-dp.c
linux-dp.exp Update copyright year range in all GDB files 2021-01-01 12:12:21 +04:00
local-watch-wrong-thread.c Update copyright year range in all GDB files 2021-01-01 12:12:21 +04:00
local-watch-wrong-thread.exp Update copyright year range in all GDB files 2021-01-01 12:12:21 +04:00
manythreads.c Update copyright year range in all GDB files 2021-01-01 12:12:21 +04:00
manythreads.exp Update copyright year range in all GDB files 2021-01-01 12:12:21 +04:00
multi-create-ns-info-thr.exp [gdb/testsuite] Fix gdb.threads/multi-create-ns-info-thr.exp 2021-06-08 10:04:44 +02:00
multi-create.c Update copyright year range in all GDB files 2021-01-01 12:12:21 +04:00
multi-create.exp Update copyright year range in all GDB files 2021-01-01 12:12:21 +04:00
multiple-step-overs.c Update copyright year range in all GDB files 2021-01-01 12:12:21 +04:00
multiple-step-overs.exp Update copyright year range in all GDB files 2021-01-01 12:12:21 +04:00
multiple-successive-infcall.c Update copyright year range in all GDB files 2021-01-01 12:12:21 +04:00
multiple-successive-infcall.exp Update copyright year range in all GDB files 2021-01-01 12:12:21 +04:00
names.c Update copyright year range in all GDB files 2021-01-01 12:12:21 +04:00
names.exp Update copyright year range in all GDB files 2021-01-01 12:12:21 +04:00
next-bp-other-thread.c Update copyright year range in all GDB files 2021-01-01 12:12:21 +04:00
next-bp-other-thread.exp Update copyright year range in all GDB files 2021-01-01 12:12:21 +04:00
next-while-other-thread-longjmps.c Update copyright year range in all GDB files 2021-01-01 12:12:21 +04:00
next-while-other-thread-longjmps.exp Update copyright year range in all GDB files 2021-01-01 12:12:21 +04:00
no-unwaited-for-left.c Update copyright year range in all GDB files 2021-01-01 12:12:21 +04:00
no-unwaited-for-left.exp Update copyright year range in all GDB files 2021-01-01 12:12:21 +04:00
non-ldr-exc-1.c Update copyright year range in all GDB files 2021-01-01 12:12:21 +04:00
non-ldr-exc-1.exp Update copyright year range in all GDB files 2021-01-01 12:12:21 +04:00
non-ldr-exc-2.c Update copyright year range in all GDB files 2021-01-01 12:12:21 +04:00
non-ldr-exc-2.exp Update copyright year range in all GDB files 2021-01-01 12:12:21 +04:00
non-ldr-exc-3.c Update copyright year range in all GDB files 2021-01-01 12:12:21 +04:00
non-ldr-exc-3.exp Update copyright year range in all GDB files 2021-01-01 12:12:21 +04:00
non-ldr-exc-4.c Update copyright year range in all GDB files 2021-01-01 12:12:21 +04:00
non-ldr-exc-4.exp Update copyright year range in all GDB files 2021-01-01 12:12:21 +04:00
non-ldr-exit.c Update copyright year range in all GDB files 2021-01-01 12:12:21 +04:00
non-ldr-exit.exp Update copyright year range in all GDB files 2021-01-01 12:12:21 +04:00
non-stop-fair-events.c Update copyright year range in all GDB files 2021-01-01 12:12:21 +04:00
non-stop-fair-events.exp Update copyright year range in all GDB files 2021-01-01 12:12:21 +04:00
omp-par-scope.c Update copyright year range in all GDB files 2021-01-01 12:12:21 +04:00
omp-par-scope.exp Update copyright year range in all GDB files 2021-01-01 12:12:21 +04:00
pending-step.c Update copyright year range in all GDB files 2021-01-01 12:12:21 +04:00
pending-step.exp Update copyright year range in all GDB files 2021-01-01 12:12:21 +04:00
print-threads.c
print-threads.exp gdb/testsuite: squash duplicate test names in gdb.threads/*.exp 2021-03-16 09:31:06 +00:00
process-dies-while-detaching.c Update copyright year range in all GDB files 2021-01-01 12:12:21 +04:00
process-dies-while-detaching.exp Update copyright year range in all GDB files 2021-01-01 12:12:21 +04:00
process-dies-while-handling-bp.c Update copyright year range in all GDB files 2021-01-01 12:12:21 +04:00
process-dies-while-handling-bp.exp Update copyright year range in all GDB files 2021-01-01 12:12:21 +04:00
pthread_cond_wait.c Update copyright year range in all GDB files 2021-01-01 12:12:21 +04:00
pthread_cond_wait.exp Update copyright year range in all GDB files 2021-01-01 12:12:21 +04:00
pthreads.c Update copyright year range in all GDB files 2021-01-01 12:12:21 +04:00
pthreads.exp Update copyright year range in all GDB files 2021-01-01 12:12:21 +04:00
queue-signal.c Update copyright year range in all GDB files 2021-01-01 12:12:21 +04:00
queue-signal.exp gdb/testsuite: squash duplicate test names in gdb.threads/*.exp 2021-03-16 09:31:06 +00:00
reconnect-signal.c Update copyright year range in all GDB files 2021-01-01 12:12:21 +04:00
reconnect-signal.exp Update copyright year range in all GDB files 2021-01-01 12:12:21 +04:00
schedlock.c Update copyright year range in all GDB files 2021-01-01 12:12:21 +04:00
schedlock.exp Update copyright year range in all GDB files 2021-01-01 12:12:21 +04:00
siginfo-threads.c Update copyright year range in all GDB files 2021-01-01 12:12:21 +04:00
siginfo-threads.exp Update copyright year range in all GDB files 2021-01-01 12:12:21 +04:00
signal-command-handle-nopass.c Update copyright year range in all GDB files 2021-01-01 12:12:21 +04:00
signal-command-handle-nopass.exp [testsuite] Don't use 'testfile' before 'standard_testfile'. 2021-02-09 20:35:21 +00:00
signal-command-multiple-signals-pending.c Update copyright year range in all GDB files 2021-01-01 12:12:21 +04:00
signal-command-multiple-signals-pending.exp gdb/testsuite: squash duplicate test names in gdb.threads/*.exp 2021-03-16 09:31:06 +00:00
signal-delivered-right-thread.c Update copyright year range in all GDB files 2021-01-01 12:12:21 +04:00
signal-delivered-right-thread.exp [testsuite] Don't use 'testfile' before 'standard_testfile'. 2021-02-09 20:35:21 +00:00
signal-sigtrap.c Update copyright year range in all GDB files 2021-01-01 12:12:21 +04:00
signal-sigtrap.exp [testsuite] Don't use 'testfile' before 'standard_testfile'. 2021-02-09 20:35:21 +00:00
signal-while-stepping-over-bp-other-thread.c Update copyright year range in all GDB files 2021-01-01 12:12:21 +04:00
signal-while-stepping-over-bp-other-thread.exp gdb/testsuite: fix race in gdb.threads/signal-while-stepping-over-bp-other-thread.exp 2021-01-06 10:53:22 -05:00
sigstep-threads.c Update copyright year range in all GDB files 2021-01-01 12:12:21 +04:00
sigstep-threads.exp Update copyright year range in all GDB files 2021-01-01 12:12:21 +04:00
sigthread.c
sigthread.exp Update copyright year range in all GDB files 2021-01-01 12:12:21 +04:00
slow-waitpid.c Update copyright year range in all GDB files 2021-01-01 12:12:21 +04:00
staticthreads.c Update copyright year range in all GDB files 2021-01-01 12:12:21 +04:00
staticthreads.exp Update copyright year range in all GDB files 2021-01-01 12:12:21 +04:00
step-bg-decr-pc-switch-thread.c Update copyright year range in all GDB files 2021-01-01 12:12:21 +04:00
step-bg-decr-pc-switch-thread.exp Update copyright year range in all GDB files 2021-01-01 12:12:21 +04:00
step-over-exec-execd.c Update copyright year range in all GDB files 2021-01-01 12:12:21 +04:00
step-over-exec.c Update copyright year range in all GDB files 2021-01-01 12:12:21 +04:00
step-over-exec.exp Update copyright year range in all GDB files 2021-01-01 12:12:21 +04:00
step-over-lands-on-breakpoint.c Update copyright year range in all GDB files 2021-01-01 12:12:21 +04:00
step-over-lands-on-breakpoint.exp Update copyright year range in all GDB files 2021-01-01 12:12:21 +04:00
step-over-trips-on-watchpoint.c Update copyright year range in all GDB files 2021-01-01 12:12:21 +04:00
step-over-trips-on-watchpoint.exp Update copyright year range in all GDB files 2021-01-01 12:12:21 +04:00
stepi-random-signal.c Update copyright year range in all GDB files 2021-01-01 12:12:21 +04:00
stepi-random-signal.exp gdb: introduce scoped debug prints 2021-01-04 12:00:54 -05:00
stop-with-handle.c Update copyright year range in all GDB files 2021-01-01 12:12:21 +04:00
stop-with-handle.exp Update copyright year range in all GDB files 2021-01-01 12:12:21 +04:00
switch-threads.c Update copyright year range in all GDB files 2021-01-01 12:12:21 +04:00
switch-threads.exp Update copyright year range in all GDB files 2021-01-01 12:12:21 +04:00
thread-execl.c Update copyright year range in all GDB files 2021-01-01 12:12:21 +04:00
thread-execl.exp Update copyright year range in all GDB files 2021-01-01 12:12:21 +04:00
thread-find.exp Update copyright year range in all GDB files 2021-01-01 12:12:21 +04:00
thread-specific-bp.c Update copyright year range in all GDB files 2021-01-01 12:12:21 +04:00
thread-specific-bp.exp Update copyright year range in all GDB files 2021-01-01 12:12:21 +04:00
thread-specific.c Update copyright year range in all GDB files 2021-01-01 12:12:21 +04:00
thread-specific.exp Update copyright year range in all GDB files 2021-01-01 12:12:21 +04:00
thread-unwindonsignal.exp Update copyright year range in all GDB files 2021-01-01 12:12:21 +04:00
thread_check.c Update copyright year range in all GDB files 2021-01-01 12:12:21 +04:00
thread_check.exp Update copyright year range in all GDB files 2021-01-01 12:12:21 +04:00
thread_events.c Update copyright year range in all GDB files 2021-01-01 12:12:21 +04:00
thread_events.exp Update copyright year range in all GDB files 2021-01-01 12:12:21 +04:00
threadapply.c Fix threadapply test 2021-06-02 10:29:36 -05:00
threadapply.exp Update copyright year range in all GDB files 2021-01-01 12:12:21 +04:00
threxit-hop-specific.c Update copyright year range in all GDB files 2021-01-01 12:12:21 +04:00
threxit-hop-specific.exp Update copyright year range in all GDB files 2021-01-01 12:12:21 +04:00
tid-reuse.c Update copyright year range in all GDB files 2021-01-01 12:12:21 +04:00
tid-reuse.exp Update copyright year range in all GDB files 2021-01-01 12:12:21 +04:00
tls-core.c Update copyright year range in all GDB files 2021-01-01 12:12:21 +04:00
tls-core.exp Update copyright year range in all GDB files 2021-01-01 12:12:21 +04:00
tls-main.c
tls-nodebug-pie.c Update copyright year range in all GDB files 2021-01-01 12:12:21 +04:00
tls-nodebug-pie.exp Update copyright year range in all GDB files 2021-01-01 12:12:21 +04:00
tls-nodebug.c
tls-nodebug.exp Update copyright year range in all GDB files 2021-01-01 12:12:21 +04:00
tls-shared.c
tls-shared.exp Update copyright year range in all GDB files 2021-01-01 12:12:21 +04:00
tls-so_extern.c Update copyright year range in all GDB files 2021-01-01 12:12:21 +04:00
tls-so_extern.exp Update copyright year range in all GDB files 2021-01-01 12:12:21 +04:00
tls-so_extern_main.c Update copyright year range in all GDB files 2021-01-01 12:12:21 +04:00
tls-var-main.c Update copyright year range in all GDB files 2021-01-01 12:12:21 +04:00
tls-var.c Update copyright year range in all GDB files 2021-01-01 12:12:21 +04:00
tls-var.exp Update copyright year range in all GDB files 2021-01-01 12:12:21 +04:00
tls.c
tls.exp Update copyright year range in all GDB files 2021-01-01 12:12:21 +04:00
tls2.c Update copyright year range in all GDB files 2021-01-01 12:12:21 +04:00
vfork-follow-child-exec.c Update copyright year range in all GDB files 2021-01-01 12:12:21 +04:00
vfork-follow-child-exec.exp Update copyright year range in all GDB files 2021-01-01 12:12:21 +04:00
vfork-follow-child-exit.c Update copyright year range in all GDB files 2021-01-01 12:12:21 +04:00
vfork-follow-child-exit.exp Update copyright year range in all GDB files 2021-01-01 12:12:21 +04:00
watchpoint-fork-child.c Update copyright year range in all GDB files 2021-01-01 12:12:21 +04:00
watchpoint-fork-mt.c Update copyright year range in all GDB files 2021-01-01 12:12:21 +04:00
watchpoint-fork-parent.c Update copyright year range in all GDB files 2021-01-01 12:12:21 +04:00
watchpoint-fork-st.c Update copyright year range in all GDB files 2021-01-01 12:12:21 +04:00
watchpoint-fork.exp Update copyright year range in all GDB files 2021-01-01 12:12:21 +04:00
watchpoint-fork.h Update copyright year range in all GDB files 2021-01-01 12:12:21 +04:00
watchthreads-reorder.c Update copyright year range in all GDB files 2021-01-01 12:12:21 +04:00
watchthreads-reorder.exp gdb: introduce scoped debug prints 2021-01-04 12:00:54 -05:00
watchthreads.c Update copyright year range in all GDB files 2021-01-01 12:12:21 +04:00
watchthreads.exp Update copyright year range in all GDB files 2021-01-01 12:12:21 +04:00
watchthreads2.c Update copyright year range in all GDB files 2021-01-01 12:12:21 +04:00
watchthreads2.exp Update copyright year range in all GDB files 2021-01-01 12:12:21 +04:00
wp-replication.c Update copyright year range in all GDB files 2021-01-01 12:12:21 +04:00
wp-replication.exp Update copyright year range in all GDB files 2021-01-01 12:12:21 +04:00