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

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