Blame SOURCES/gdb-rhbz1971095-libthread_db-update-3of5.patch

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