diff options
author | Tom de Vries <tdevries@suse.de> | 2020-03-13 15:38:19 +0100 |
---|---|---|
committer | Tom de Vries <tdevries@suse.de> | 2020-03-13 15:38:19 +0100 |
commit | 2d61316c32a9fa3e14786c3312d9ca87c9298db5 (patch) | |
tree | 9c34666627175f99b87c12c4cb12c1c13a2d673b | |
parent | 2e9145ace2a520f942d74fea7df9458cc8a16523 (diff) | |
download | gdb-2d61316c32a9fa3e14786c3312d9ca87c9298db5.zip gdb-2d61316c32a9fa3e14786c3312d9ca87c9298db5.tar.gz gdb-2d61316c32a9fa3e14786c3312d9ca87c9298db5.tar.bz2 |
[gdb/testsuite] Fix buffer full errors in gdb.mi/mi-sym-info.exp
With debug info packages for system libs installed, I run into buffer full
errors with test-case gdb.mi/mi-sym-info.exp. Fix these using exp_continue.
This exposes timeouts due to gdb taking a long time before starting to print
output. Fix these using with_timeout_factor.
Tested on x86_64-linux, with make targets check and check-read1.
gdb/testsuite/ChangeLog:
2020-03-13 Tom de Vries <tdevries@suse.de>
* gdb.mi/mi-sym-info.exp: Fix buffer full errors, and timeouts.
-rw-r--r-- | gdb/testsuite/ChangeLog | 4 | ||||
-rw-r--r-- | gdb/testsuite/gdb.mi/mi-sym-info.exp | 169 |
2 files changed, 148 insertions, 25 deletions
diff --git a/gdb/testsuite/ChangeLog b/gdb/testsuite/ChangeLog index 3c09acd..48d3c94 100644 --- a/gdb/testsuite/ChangeLog +++ b/gdb/testsuite/ChangeLog @@ -1,5 +1,9 @@ 2020-03-13 Tom de Vries <tdevries@suse.de> + * gdb.mi/mi-sym-info.exp: Fix buffer full errors, and timeouts. + +2020-03-13 Tom de Vries <tdevries@suse.de> + * gdb.mi/mi-sym-info.exp: Make matching more precise. 2020-03-13 Tom de Vries <tdevries@suse.de> diff --git a/gdb/testsuite/gdb.mi/mi-sym-info.exp b/gdb/testsuite/gdb.mi/mi-sym-info.exp index 0537eb1..290fb46 100644 --- a/gdb/testsuite/gdb.mi/mi-sym-info.exp +++ b/gdb/testsuite/gdb.mi/mi-sym-info.exp @@ -15,6 +15,13 @@ # Test -symbol-info-functions, -symbol-info-variables, and # -symbol-info-types. +# +# These tests can generate large amounts of output, which can cause gdb to be +# slow in two different ways: +# - it takes long before the command starts producing output +# - it takes long to print all the output +# We can prevent timeouts due to the latter using exp_continue, but for +# the former that doesn't work. There we use with_timeout_factor instead. load_lib mi-support.exp set MIFLAGS "-i=mi" @@ -51,17 +58,65 @@ set type_syms \ # Fetch all functions, variables and types without any non-debug # symbols. -mi_gdb_test "111-symbol-info-functions" \ - "111\\^done,${debug_only_syms}" \ - "List all functions from debug information only" +set testname "List all functions from debug information only" +set cmd "111-symbol-info-functions" +set state 0 +gdb_test_multiple $cmd $testname -prompt "${mi_gdb_prompt}$" { + -re "111\\^done,symbols=\{debug=\\\[${symtab_re}" { + if { $state == 0 } { incr state } + exp_continue + } + -re ",${symtab_re}" { + exp_continue + } + -re "\\\]\}\r\n${mi_gdb_prompt}$" { + if { $state == 1 } { + pass $gdb_test_name + } else { + fail $gdb_test_name + } + } +} -mi_gdb_test "112-symbol-info-variables" \ - "112\\^done,${debug_only_syms}" \ - "List all variables from debug information only" +set testname "List all variables from debug information only" +set cmd "112-symbol-info-variables" +set state 0 +gdb_test_multiple $cmd $testname -prompt "${mi_gdb_prompt}$" { + -re "112\\^done,symbols=\{debug=\\\[${symtab_re}" { + if { $state == 0 } { incr state } + exp_continue + } + -re ",${symtab_re}" { + exp_continue + } + -re "\\\]\}\r\n${mi_gdb_prompt}$" { + if { $state == 1 } { + pass $gdb_test_name + } else { + fail $gdb_test_name + } + } +} -mi_gdb_test "113-symbol-info-types" \ - "113\\^done,${type_syms}" \ - "List all types" +set testname "List all types" +set cmd "113-symbol-info-types" +set state 0 +gdb_test_multiple $cmd $testname -prompt "${mi_gdb_prompt}$" { + -re "113\\^done,symbols=\{debug=\\\[${symtab_type_re}" { + if { $state == 0 } { incr state } + exp_continue + } + -re ",${symtab_type_re}" { + exp_continue + } + -re "\\\]\}\r\n${mi_gdb_prompt}$" { + if { $state == 1 } { + pass $gdb_test_name + } else { + fail $gdb_test_name + } + } +} # Fetch functions and variables but also grab the non-debug symbols # (from the symbol table). There's often so much output output from @@ -69,34 +124,98 @@ mi_gdb_test "113-symbol-info-types" \ # 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=\{debug=\\\[${symtab_re}(?:,${symtab_re})*\\\],nondebug=\\\[" { + -re "114\\^done,symbols=\{" { + if { $state == 0 } { set state 1 } exp_continue } - - -re "\{address=${qstr},name=${qstr}\}," { + -re "debug=\\\[${symtab_re}" { + if { $state == 1 } { set state 2 } exp_continue } - - -re "\{address=${qstr},name=${qstr}\}\\\]\}\r\n${mi_gdb_prompt}$" { - pass ${testname} + -re ",${symtab_re}" { + exp_continue } -} - -set testname "List all variables" -set cmd "115-symbol-info-variables --include-nondebug" -gdb_test_multiple $cmd ${testname} -prompt "${mi_gdb_prompt}$" { - -re "115\\^done,symbols=\{debug=\\\[${symtab_re}(?:,${symtab_re})*\\\],nondebug=\\\[" { - verbose -log "Got the first part of the input" + -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}$" { - pass ${testname} + if { $state == 3 } { + pass $gdb_test_name + } else { + fail $gdb_test_name + } + } +} + +with_timeout_factor 2 { + set testname "List all variables" + set cmd "115-symbol-info-variables --include-nondebug" + set state 0 + gdb_test_multiple $cmd ${testname} -prompt "${mi_gdb_prompt}$" { + -re "115\\^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 2 { + set testname "List all variables" + set cmd "115-symbol-info-variables --include-nondebug" + set state 0 + gdb_test_multiple $cmd ${testname} -prompt "${mi_gdb_prompt}$" { + -re "115\\^done,symbols=\{" { + if { $state == 0 } { incr state } + exp_continue + } + -re "debug=\\\[${symtab_re}" { + if { $state == 1 } { incr state } + exp_continue + } + -re ",${symtab_re}" { + exp_continue + } + -re "\\\],nondebug=\\\[" { + if { $state == 2 } { incr state } + 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 + } + } } } |