[binutils-gdb] gdb/testsuite: fix gdb.python/py-selected-context.exp with glibc debuginfo but no source

Jan Vrany via Gdb-cvs <[email protected]>
Newsgroups gmane.comp.gdb.cvs
Message-ID <[email protected]>
https://sourceware.org/git/gitweb.cgi?p=binutils-gdb.git;h=b357a30c6d1a5bc457b4c68bdc15d7c141f62bcc

commit b357a30c6d1a5bc457b4c68bdc15d7c141f62bcc
Author: Jan Vrany <[email protected]>
Date:   Tue Mar 10 13:13:42 2026 +0000

    gdb/testsuite: fix gdb.python/py-selected-context.exp with glibc debuginfo but no source
    
    When running gdb.python/py-selected-context.exp I get:
    
        thread 1
        [Switching to thread 1.1 (Thread 0x7ffff7da4740 (LWP 480841))]
        #0  __syscall_cancel_arch () at ../sysdeps/unix/sysv/linux/x86_64/syscall_cancel.S:56
        warning: 56     ../sysdeps/unix/sysv/linux/x86_64/syscall_cancel.S: No such file or directory
        Python Exception <class 'gdb.GdbError'>: error from gdb_selected_context_handler
        (gdb) FAIL: gdb.python/py-selected-context.exp: switch thread, handler raises an error
    
    The problem is that glibc debug info is present but sources are not,
    hence the warning.
    
    Fix this by updating the regexp. Tested on x86_64 Linux with and without
    glibc sources.
    
    Approved-By: Tom de Vries <[email protected]>

Diff:
---
 gdb/testsuite/gdb.python/py-selected-context.exp | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

diff --git a/gdb/testsuite/gdb.python/py-selected-context.exp b/gdb/testsuite/gdb.python/py-selected-context.exp
index 64fe2f35795..030543466d2 100644
--- a/gdb/testsuite/gdb.python/py-selected-context.exp
+++ b/gdb/testsuite/gdb.python/py-selected-context.exp
@@ -105,7 +105,7 @@ gdb_test "thread 1" \
     [multi_line \
 	 "\\\[Switching to thread 1\\.1\[^\r\n\]*\\\]" \
 	 "#0\\s+\[^\r\n\]+(" \
-	 "$decimal\t\[^\r\n\]+)?" \
+	 "(warning: )?$decimal\t\[^\r\n\]+)?" \
 	 "\[^\r\n\]+: error from gdb_selected_context_handler"] \
     "switch thread, handler raises an error"
 check_thread 1.1 "thread switched despite handler error"
lmpx.com only provides a reader for public news (NNTP) servers. It is not affiliated with the servers or forums shown here and is not responsible for the content of articles, which is written by their respective authors.