[4/4] mi-sym-info.exp: Increase timeout for 114-symbol-info-functions

Message ID 20210610172641.1052704-5-kevinb@redhat.com
State New
Headers show
Series
  • libthread_db initialization changes related to upcoming glibc-2.34
Related show

Commit Message

Lancelot SIX via Gdb-patches June 10, 2021, 5:26 p.m.
Loading libc.so's symbols increased the amount of time needed for
114-symbol-info-function to fetch symbols, causing a timeout during my
testing.  I enclosed the entire block with a "with_timeout_factor 4",
which fixes the problem for me.  (Using 2 also fixed it for me, but it
might not be enough when running this test on slower machines.)

gdb/testsuite/ChangeLog:

	* gdb.mi/mi-sym-info.exp (114-symbol-info-function test): Increase
	timeout.
---
 gdb/testsuite/gdb.mi/mi-sym-info.exp | 56 ++++++++++++++--------------
 1 file changed, 29 insertions(+), 27 deletions(-)

-- 
2.31.1

Comments

Lancelot SIX via Gdb-patches June 11, 2021, 8:11 p.m. | #1
On 2021-06-10 1:26 p.m., Kevin Buettner via Gdb-patches wrote:
> Loading libc.so's symbols increased the amount of time needed for

> 114-symbol-info-function to fetch symbols, causing a timeout during my

> testing.  I enclosed the entire block with a "with_timeout_factor 4",

> which fixes the problem for me.  (Using 2 also fixed it for me, but it

> might not be enough when running this test on slower machines.)

> 

> gdb/testsuite/ChangeLog:

> 

> 	* gdb.mi/mi-sym-info.exp (114-symbol-info-function test): Increase

> 	timeout.


This LGTM - as long as you can confirm that this is a case of "GDB
thinking for a long time before outputting something", and not a case of
"there's a lot of output and we are trying to chew too much in a single
match".  But it looks like the test is already written to consume little
chunks at a time, since:

    https://sourceware.org/git/gitweb.cgi?p=binutils-gdb.git;h=2d61316c32a9fa3e14786c3312d9ca87c9298db5

I'd be curious to try it, but I don't have access to my usual Ubuntu
development machine that has debug info for libc installed (and on the
machine I'm typing this on I can't install them easily).  Anyway, it's
probably fine.

My other comment would be: there are many with_timeout_factor in that
test, I'm thinking we should just wrap the entire test in a single
`with_timeout_factor 4`.

Simon
Lancelot SIX via Gdb-patches June 11, 2021, 9:07 p.m. | #2
On Fri, 11 Jun 2021 16:11:31 -0400
Simon Marchi <simon.marchi@polymtl.ca> wrote:

> On 2021-06-10 1:26 p.m., Kevin Buettner via Gdb-patches wrote:

> > Loading libc.so's symbols increased the amount of time needed for

> > 114-symbol-info-function to fetch symbols, causing a timeout during my

> > testing.  I enclosed the entire block with a "with_timeout_factor 4",

> > which fixes the problem for me.  (Using 2 also fixed it for me, but it

> > might not be enough when running this test on slower machines.)

> > 

> > gdb/testsuite/ChangeLog:

> > 

> > 	* gdb.mi/mi-sym-info.exp (114-symbol-info-function test): Increase

> > 	timeout.  

> 

> This LGTM - as long as you can confirm that this is a case of "GDB

> thinking for a long time before outputting something", 


Yes, confirmed.

> and not a case of

> "there's a lot of output and we are trying to chew too much in a single

> match".  But it looks like the test is already written to consume little

> chunks at a time, since:

> 

>     https://sourceware.org/git/gitweb.cgi?p=binutils-gdb.git;h=2d61316c32a9fa3e14786c3312d9ca87c9298db5

> 


Agreed.

Kevin

Patch

diff --git a/gdb/testsuite/gdb.mi/mi-sym-info.exp b/gdb/testsuite/gdb.mi/mi-sym-info.exp
index 18f85182a7b..dcd6f7d9187 100644
--- a/gdb/testsuite/gdb.mi/mi-sym-info.exp
+++ b/gdb/testsuite/gdb.mi/mi-sym-info.exp
@@ -123,33 +123,35 @@  gdb_test_multiple $cmd $testname -prompt "${mi_gdb_prompt}$" {
 # (from the symbol table).  There's often so much output output from
 # this command that we overflow expect's buffers, avoid this by
 # fetching the output piece by piece.
-set testname "List all functions"
-set cmd "114-symbol-info-functions --include-nondebug"
-set state 0
-gdb_test_multiple $cmd ${testname} -prompt "${mi_gdb_prompt}$" {
-    -re "114\\^done,symbols=\{" {
-	if { $state == 0 } { set state 1 }
-	exp_continue
-    }
-    -re "debug=\\\[${symtab_re}" {
-	if { $state == 1 } { set state 2 }
-	exp_continue
-    }
-    -re ",${symtab_re}" {
-	exp_continue
-    }
-    -re "\\\],nondebug=\\\[" {
-	if { $state == 2 } { set state 3 }
-	exp_continue
-    }
-    -re "\{address=${qstr},name=${qstr}\}," {
-	exp_continue
-    }
-    -re "\{address=${qstr},name=${qstr}\}\\\]\}\r\n${mi_gdb_prompt}$" {
-	if { $state == 3 } {
-	    pass $gdb_test_name
-	} else {
-	    fail $gdb_test_name
+with_timeout_factor 4 {
+    set testname "List all functions"
+    set cmd "114-symbol-info-functions --include-nondebug"
+    set state 0
+    gdb_test_multiple $cmd ${testname} -prompt "${mi_gdb_prompt}$" {
+	-re "114\\^done,symbols=\{" {
+	    if { $state == 0 } { set state 1 }
+	    exp_continue
+	}
+	-re "debug=\\\[${symtab_re}" {
+	    if { $state == 1 } { set state 2 }
+	    exp_continue
+	}
+	-re ",${symtab_re}" {
+	    exp_continue
+	}
+	-re "\\\],nondebug=\\\[" {
+	    if { $state == 2 } { set state 3 }
+	    exp_continue
+	}
+	-re "\{address=${qstr},name=${qstr}\}," {
+	    exp_continue
+	}
+	-re "\{address=${qstr},name=${qstr}\}\\\]\}\r\n${mi_gdb_prompt}$" {
+	    if { $state == 3 } {
+		pass $gdb_test_name
+	    } else {
+		fail $gdb_test_name
+	    }
 	}
     }
 }