[binutils-gdb] [gdb/testsuite] Fix timeout in gdb.python/py-template.exp

Tom de Vries 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=d50fa0bfb428325c305f7cba56be90e79800823d

commit d50fa0bfb428325c305f7cba56be90e79800823d
Author: Tom de Vries <[email protected]>
Date:   Tue Mar 24 16:29:17 2026 +0100

    [gdb/testsuite] Fix timeout in gdb.python/py-template.exp
    
    With test-case gdb.python/py-template.exp, I run into a timeout with target
    board readnow.
    
    The problem triggers if package libstdc++6-debuginfo is installed.
    
    Fix this by:
    - not running to main
    - moving variable foo out of main.
    
    Approved-By: Tom Tromey <[email protected]>

Diff:
---
 gdb/testsuite/gdb.python/py-template.cc  | 3 ++-
 gdb/testsuite/gdb.python/py-template.exp | 3 ---
 2 files changed, 2 insertions(+), 4 deletions(-)

diff --git a/gdb/testsuite/gdb.python/py-template.cc b/gdb/testsuite/gdb.python/py-template.cc
index 88aec000be5..24d945ba60c 100644
--- a/gdb/testsuite/gdb.python/py-template.cc
+++ b/gdb/testsuite/gdb.python/py-template.cc
@@ -23,8 +23,9 @@ struct Foo {
 #define TYPE int
 #endif
 
+Foo<TYPE> foo;
+
 int main()
 {
-  Foo<TYPE> foo;
   return 0; // break here
 }
diff --git a/gdb/testsuite/gdb.python/py-template.exp b/gdb/testsuite/gdb.python/py-template.exp
index d3b1f8292ed..5a3c259673b 100644
--- a/gdb/testsuite/gdb.python/py-template.exp
+++ b/gdb/testsuite/gdb.python/py-template.exp
@@ -36,9 +36,6 @@ proc test_template_arg {exefile type} {
 	return -1
     }
     gdb_load ${exefile}
-    if {![runto_main]} {
-	return
-    }
     # There is no executable code in main(), so we are where we want to be
     gdb_test "print (foo)" ".*" \
 	"print (foo) in template test of $type"
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.