From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: from mx2.suse.de (mx2.suse.de [195.135.220.15]) by sourceware.org (Postfix) with ESMTPS id 7A6803AA8C0A for ; Fri, 13 Mar 2020 14:40:17 +0000 (GMT) X-Virus-Scanned: by amavisd-new at test-mx.suse.de Received: from relay2.suse.de (unknown [195.135.220.254]) by mx2.suse.de (Postfix) with ESMTP id 896C6AC8F for ; Fri, 13 Mar 2020 14:40:16 +0000 (UTC) Date: Fri, 13 Mar 2020 15:40:15 +0100 From: Tom de Vries To: gdb-patches@sourceware.org Subject: [committed][gdb/testsuite] Fix buffer full errors in gdb.mi/mi-sym-info.exp Message-ID: <20200313144013.GA26839@delia> MIME-Version: 1.0 Content-Type: text/plain; charset=us-ascii Content-Disposition: inline User-Agent: Mutt/1.10.1 (2018-07-13) X-Spam-Status: No, score=-26.9 required=5.0 tests=BAYES_00, GIT_PATCH_0, GIT_PATCH_1, GIT_PATCH_2, GIT_PATCH_3, RCVD_IN_MSPIKE_H3, RCVD_IN_MSPIKE_WL, SPF_HELO_NONE, SPF_PASS autolearn=ham autolearn_force=no version=3.4.2 X-Spam-Checker-Version: SpamAssassin 3.4.2 (2018-09-13) on server2.sourceware.org X-BeenThere: gdb-patches@sourceware.org X-Mailman-Version: 2.1.29 Precedence: list List-Id: Gdb-patches mailing list List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Fri, 13 Mar 2020 14:40:18 -0000 Hi, 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. Committed to trunk. Thanks, - Tom [gdb/testsuite] Fix buffer full errors in gdb.mi/mi-sym-info.exp gdb/testsuite/ChangeLog: 2020-03-13 Tom de Vries * gdb.mi/mi-sym-info.exp: Fix buffer full errors, and timeouts. --- gdb/testsuite/gdb.mi/mi-sym-info.exp | 169 +++++++++++++++++++++++++++++------ 1 file changed, 144 insertions(+), 25 deletions(-) diff --git a/gdb/testsuite/gdb.mi/mi-sym-info.exp b/gdb/testsuite/gdb.mi/mi-sym-info.exp index 0537eb1935..290fb46c41 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 + } + } } }