From FEDORA_PATCHES Mon Sep 17 00:00:00 2001 From: Kevin Buettner Date: Mon, 14 Jun 2021 19:24:41 -0700 Subject: gdb-rhbz1971096-glibc2.34-3.patch ;; Backport testsuite patch for matching new libthread_db related output ;; when testing gdb on glibc-2.34 matchines (RH BZ 1971096). testsuite/glib-2.34: Match/consume optional libthread_db related output When using glibc-2.34, we now see messages related to the loading of the thread library for non-thread programs. E.g. for the test case, gdb.base/execl-update-breakpoints.exp, we will see the following when starting the program: (gdb) break -qualified main Breakpoint 1 at 0x100118c: file /ironwood1/sourceware-git/f34-2-glibc244_fix/bld/../../worktree-glibc244_fix/gdb/testsuite/gdb.base/execl-update-breakpoints.c, line 34. (gdb) run Starting program: [...]/execl-update-breakpoints1 [Thread debugging using libthread_db enabled] Using host libthread_db library "/lib64/libthread_db.so.1". The two lines of output related to libthread_db are new; we didn't see these in the past. This is a side effect of libc now containing the pthread API - we can no longer tell whether the program is multi-threaded by simply looking for libpthread.so. That said, I think that we now want to load libthread_db anyway since it's used to resolve TLS variables; i.e. we need it for correctly determining the value of errno. This commit adds the necessary regular expressions to match this (optional) additional output in the two tests which were failing without it. gdb/testsuite/ChangeLog: * gdb.base/execl-update-breakpoints.exp: Add regular expression for optionally matching output related to libthread_db. * gdb.base/fork-print-inferior-events.exp: Likewise. diff --git a/gdb/testsuite/gdb.base/execl-update-breakpoints.exp b/gdb/testsuite/gdb.base/execl-update-breakpoints.exp --- a/gdb/testsuite/gdb.base/execl-update-breakpoints.exp +++ b/gdb/testsuite/gdb.base/execl-update-breakpoints.exp @@ -132,6 +132,7 @@ proc test { always_inserted } { "Continuing\\.\r\n" \ "${not_nl} is executing new program: ${not_nl}\r\n" \ "(Reading ${not_nl} from remote target\\.\\.\\.\r\n)*" \ + "(?:.Thread debugging using .*? enabled.\r\nUsing .*? library .*?\\.\r\n)?" \ "\r\n" \ "Breakpoint 1, main.*$gdb_prompt $" set message "continue across exec" diff --git a/gdb/testsuite/gdb.base/fork-print-inferior-events.exp b/gdb/testsuite/gdb.base/fork-print-inferior-events.exp --- a/gdb/testsuite/gdb.base/fork-print-inferior-events.exp +++ b/gdb/testsuite/gdb.base/fork-print-inferior-events.exp @@ -59,6 +59,7 @@ set detach_child_re "${reading_re}\\\[Detaching after fork from child .*\\\]\r\n set detach_parent_re "${reading_re}\\\[Detaching after fork from parent .*\\\]\r\n" set new_inf_re "${reading_re}\\\[New inferior $decimal \\(.*\\)\\\]\r\n" set inf_detached_re "${reading_re}\\\[Inferior $decimal \\(.*\\) detached\\\]\r\n" +set thread_db_re "(?:\\\[Thread debugging using .*? enabled\\\]\r\nUsing .*? library .*?\\.\r\n)?" set expected_output [list \ "${attach_child_re}${new_inf_re}${detach_parent_re}${inf_detached_re}" \ @@ -84,7 +85,7 @@ foreach_with_prefix print_inferior_events { "on" "off" } { set output [lindex $expected_output $i] # Always add the "Starting program..." string so that we # match exactly the lines we want. - set output "Starting program: $binfile\\s*\r\n${output}${exited_normally_re}" + set output "Starting program: $binfile\\s*\r\n${thread_db_re}${output}${thread_db_re}${exited_normally_re}" set i [expr $i + 1] gdb_test "run" $output }