From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: from simark.ca by simark.ca with LMTP id iRXYBHgk7GBhaQAAWB0awg (envelope-from ) for ; Mon, 12 Jul 2021 07:16:08 -0400 Received: by simark.ca (Postfix, from userid 112) id 061EF1EDEC; Mon, 12 Jul 2021 07:16:08 -0400 (EDT) X-Spam-Checker-Version: SpamAssassin 3.4.2 (2018-09-13) on simark.ca X-Spam-Level: X-Spam-Status: No, score=-0.9 required=5.0 tests=DKIM_SIGNED, MAILING_LIST_MULTI,T_DKIM_INVALID,URIBL_BLOCKED autolearn=ham autolearn_force=no version=3.4.2 Received: from sourceware.org (server2.sourceware.org [8.43.85.97]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) key-exchange X25519 server-signature RSA-PSS (2048 bits) server-digest SHA256) (No client certificate requested) by simark.ca (Postfix) with ESMTPS id AD48F1E54D for ; Mon, 12 Jul 2021 07:16:06 -0400 (EDT) Received: from server2.sourceware.org (localhost [IPv6:::1]) by sourceware.org (Postfix) with ESMTP id 20E9C3888002 for ; Mon, 12 Jul 2021 11:16:06 +0000 (GMT) Received: from smtp-out2.suse.de (smtp-out2.suse.de [195.135.220.29]) by sourceware.org (Postfix) with ESMTPS id B61A93886C5E for ; Mon, 12 Jul 2021 11:15:13 +0000 (GMT) DMARC-Filter: OpenDMARC Filter v1.4.1 sourceware.org B61A93886C5E Authentication-Results: sourceware.org; dmarc=none (p=none dis=none) header.from=suse.de Authentication-Results: sourceware.org; spf=pass smtp.mailfrom=suse.de Received: from imap2.suse-dmz.suse.de (imap2.suse-dmz.suse.de [192.168.254.74]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) key-exchange X25519 server-signature ECDSA (P-521) server-digest SHA512) (No client certificate requested) by smtp-out2.suse.de (Postfix) with ESMTPS id E04081FF83; Mon, 12 Jul 2021 11:15:12 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=suse.de; s=susede2_rsa; t=1626088512; h=from:from:reply-to:date:date:message-id:message-id:to:to:cc:cc: mime-version:mime-version:content-type:content-type: in-reply-to:in-reply-to:references:references; bh=iIvEEZ/B8noG0SoPmd03/z7ilfIehm7bO1x1BLC/vO0=; b=pAx7U+D7ooT/ZfVOKQ/v4XYTdxFUF4BNDd8EymkDB+BI8yQWse24lNRPo5qM+tEoJ+f+mj d8qdWDQAdDfFYIGg/hCwpR0BngmhSMVawNxVqAg3rlzKTaxw7E5CUUySHNYFbcSVszjlfg iUTUDXjcf4zn6B5YqLtF/KjNYw24dIw= DKIM-Signature: v=1; a=ed25519-sha256; c=relaxed/relaxed; d=suse.de; s=susede2_ed25519; t=1626088512; h=from:from:reply-to:date:date:message-id:message-id:to:to:cc:cc: mime-version:mime-version:content-type:content-type: in-reply-to:in-reply-to:references:references; bh=iIvEEZ/B8noG0SoPmd03/z7ilfIehm7bO1x1BLC/vO0=; b=tby2STfMGAO8FfaoyIcC4o8masJ3pWb4S8xW0oM7uc1xxvJRG4zl/LuTFIOOt4Byt/BGlz uRpYx3e4LwA+ikBA== Received: from imap2.suse-dmz.suse.de (imap2.suse-dmz.suse.de [192.168.254.74]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) key-exchange X25519 server-signature ECDSA (P-521) server-digest SHA512) (No client certificate requested) by imap2.suse-dmz.suse.de (Postfix) with ESMTPS id CAB6813B95; Mon, 12 Jul 2021 11:15:12 +0000 (UTC) Received: from dovecot-director2.suse.de ([192.168.254.65]) by imap2.suse-dmz.suse.de with ESMTPSA id Y8tGMEAk7GBLRAAAMHmgww (envelope-from ); Mon, 12 Jul 2021 11:15:12 +0000 Subject: Re: [PATCH][gdb/testsuite] Fix gdb.mi/mi-info-sources.exp for extra debug info From: Tom de Vries To: gdb-patches@sourceware.org References: <20210705155244.GA18313@delia> Message-ID: <60e9b0a9-15a6-7e76-6ae1-c8352ab3f877@suse.de> Date: Mon, 12 Jul 2021 13:15:12 +0200 User-Agent: Mozilla/5.0 (X11; Linux x86_64; rv:78.0) Gecko/20100101 Thunderbird/78.11.0 MIME-Version: 1.0 In-Reply-To: <20210705155244.GA18313@delia> Content-Type: multipart/mixed; boundary="------------B1B48605781293073FB93625" Content-Language: en-US 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: , Errors-To: gdb-patches-bounces+public-inbox=simark.ca@sourceware.org Sender: "Gdb-patches" This is a multi-part message in MIME format. --------------B1B48605781293073FB93625 Content-Type: text/plain; charset=utf-8 Content-Transfer-Encoding: 7bit On 7/5/21 5:52 PM, Tom de Vries wrote: I ended up pushing this patch, which takes care of more problems with various target boards. Thanks, - Tom --------------B1B48605781293073FB93625 Content-Type: text/x-patch; charset=UTF-8; name="0001-gdb-testsuite-Fix-gdb.mi-mi-info-sources.exp-for-extra-debug-info.patch" Content-Transfer-Encoding: 7bit Content-Disposition: inline; filename*0="0001-gdb-testsuite-Fix-gdb.mi-mi-info-sources.exp-for-extra-"; filename*1="debug-info.patch" [gdb/testsuite] Fix gdb.mi/mi-info-sources.exp for extra debug info When running test-case gdb.mi/mi-info-sources.exp, I run into: ... Running src/gdb/testsuite/gdb.mi/mi-info-sources.exp ... ERROR: internal buffer is full. ... due to extra debug info from the shared libraries. Fix this by using "nosharedlibrary". Then I run into these FAILs: ... FAIL: gdb.mi/mi-info-sources.exp: debug_read=false: \ -file-list-exec-source-files (unexpected output) FAIL: gdb.mi/mi-info-sources.exp: debug_read=true: \ -file-list-exec-source-files (unexpected output) FAIL: gdb.mi/mi-info-sources.exp: debug_read=true: \ -file-list-exec-source-files --group-by-objfile, look for \ mi-info-sources.c (unexpected output) FAIL: gdb.mi/mi-info-sources.exp: debug_read=true: \ -file-list-exec-source-files --group-by-objfile, look for \ mi-info-sources-base.c (unexpected output) ... due to openSUSE executables which have debug info for objects from sources like sysdeps/x86_64/crtn.S. Fix these by updating the patterns, and adding "maint expand-symtabs" to reliably get fully-read objfiles. Then I run into FAILs when using the readnow target board. Fix these by skipping the relevant tests. Then I run into FAILs when using the cc-with-gnu-debuglink board. Fix these by updating the patterns. Tested on x86_64-linux, with native, check-read1, readnow, cc-with-gdb-index, cc-with-debug-names, cc-with-gnu-debuglink, cc-with-dwz, cc-with-dwz-m. gdb/testsuite/ChangeLog: 2021-07-05 Tom de Vries * lib/mi-support.exp (mi_readnow): New proc. * gdb.mi/mi-info-sources.exp: Use nosharedlibrary. Update patterns. Skip tests for readnow. Use "maint expand-symtabs". --- gdb/testsuite/gdb.mi/mi-info-sources.exp | 73 ++++++++++++++++++++++---------- gdb/testsuite/lib/mi-support.exp | 28 ++++++++++++ 2 files changed, 79 insertions(+), 22 deletions(-) diff --git a/gdb/testsuite/gdb.mi/mi-info-sources.exp b/gdb/testsuite/gdb.mi/mi-info-sources.exp index c4d6b910ef8..a43e939063a 100644 --- a/gdb/testsuite/gdb.mi/mi-info-sources.exp +++ b/gdb/testsuite/gdb.mi/mi-info-sources.exp @@ -28,8 +28,14 @@ if {[prepare_for_testing $testfile.exp $testfile \ mi_clean_restart $binfile +set readnow_p [mi_readnow] + mi_runto_main +# Unload symbols for shared libraries to prevent +# 'ERROR: internal buffer is full'. +mi_gdb_test "nosharedlibrary" ".*\\^done" "nosharedlibrary" + # Helper to build expected MI output pattern for a list. NAME is the # name of the list (which can be the empty string) and args is one # or more strings representing the fields of the list, which will be @@ -108,27 +114,45 @@ proc check_info_sources { debug_fully_read } { with_test_prefix "debug_read=${debug_fully_read}" { if { $debug_fully_read } { - set p [mi_list "files" \ - [mi_tuple "" \ - [mi_field "file" "\[^\"\]+/mi-info-sources-base\\.c"] \ - [mi_field "fullname" "\[^\"\]+/mi-info-sources-base\\.c"] \ - [mi_field "debug-fully-read" "${debug_fully_read}"]] \ - [mi_tuple "" \ - [mi_field "file" "\[^\"\]+/mi-info-sources\\.c"] \ - [mi_field "fullname" "\[^\"\]+/mi-info-sources\\.c"] \ - [mi_field "debug-fully-read" "true"]]] + set p1 \ + [mi_list "files" \ + ".*" \ + [mi_tuple "" \ + [mi_field "file" "\[^\"\]+/mi-info-sources-base\\.c"] \ + [mi_field "fullname" "\[^\"\]+/mi-info-sources-base\\.c"] \ + [mi_field "debug-fully-read" "${debug_fully_read}"]] \ + ".*"] + set p2 \ + [mi_list "files" \ + ".*" \ + [mi_tuple "" \ + [mi_field "file" "\[^\"\]+/mi-info-sources\\.c"] \ + [mi_field "fullname" "\[^\"\]+/mi-info-sources\\.c"] \ + [mi_field "debug-fully-read" "true"]] \ + ".*"] } else { - set p [mi_list "files" \ - [mi_tuple "" \ - [mi_field "file" "\[^\"\]+/mi-info-sources\\.c"] \ - [mi_field "fullname" "\[^\"\]+/mi-info-sources\\.c"] \ - [mi_field "debug-fully-read" "true"]] \ - [mi_tuple "" \ - [mi_field "file" "\[^\"\]+/mi-info-sources-base\\.c"] \ - [mi_field "fullname" "\[^\"\]+/mi-info-sources-base\\.c"] \ - [mi_field "debug-fully-read" "${debug_fully_read}"]]] + set p1 \ + [mi_list "files" \ + ".*" \ + [mi_tuple "" \ + [mi_field "file" "\[^\"\]+/mi-info-sources\\.c"] \ + [mi_field "fullname" "\[^\"\]+/mi-info-sources\\.c"] \ + [mi_field "debug-fully-read" "true"]] \ + ".*"] + set p2 \ + [mi_list "files" \ + ".*" \ + [mi_tuple "" \ + [mi_field "file" "\[^\"\]+/mi-info-sources-base\\.c"] \ + [mi_field "fullname" "\[^\"\]+/mi-info-sources-base\\.c"] \ + [mi_field "debug-fully-read" "${debug_fully_read}"]] \ + ".*"] } - mi_gdb_test "-file-list-exec-source-files" ".*\\^done,${p}" "-file-list-exec-source-files" + + mi_gdb_test "-file-list-exec-source-files" ".*\\^done,${p1}" \ + "-file-list-exec-source-files, src1" + mi_gdb_test "-file-list-exec-source-files" ".*\\^done,${p2}" \ + "-file-list-exec-source-files, src2" set p [mi_list "files" \ [mi_tuple "" \ @@ -147,7 +171,7 @@ proc check_info_sources { debug_fully_read } { set p [mi_list "files" \ [mi_tuple "" \ - [mi_field "filename" "\[^\"\]+/mi-info-sources"] \ + [mi_field "filename" "\[^\"\]+/mi-info-sources(\.debug)?"] \ [mi_field "debug-info" "${debug_info}"] \ [mi_list "sources" \ ".*" \ @@ -162,7 +186,7 @@ proc check_info_sources { debug_fully_read } { set p [mi_list "files" \ [mi_tuple "" \ - [mi_field "filename" "\[^\"\]+/mi-info-sources"] \ + [mi_field "filename" "\[^\"\]+/mi-info-sources(\.debug)?"] \ [mi_field "debug-info" "${debug_info}"] \ [mi_list "sources" \ ".*" \ @@ -177,8 +201,13 @@ proc check_info_sources { debug_fully_read } { } } -check_info_sources "false" +if { ! $readnow_p } { + check_info_sources "false" +} mi_continue_to "some_other_func" +# Force "fully-read". +mi_gdb_test "maint expand-symtabs" + check_info_sources "true" diff --git a/gdb/testsuite/lib/mi-support.exp b/gdb/testsuite/lib/mi-support.exp index d1c87dc7517..78290031763 100644 --- a/gdb/testsuite/lib/mi-support.exp +++ b/gdb/testsuite/lib/mi-support.exp @@ -663,6 +663,34 @@ proc mi_gdb_load { arg } { return 0 } +# Return 1 if symbols were read in using -readnow. Otherwise, return 0. +# Based on readnow from lib/gdb.exp. + +proc mi_readnow { args } { + global mi_gdb_prompt + + if { [llength $args] == 1 } { + set re [lindex $args 0] + } else { + set re "" + } + + set readnow_p 0 + set cmd "maint print objfiles $re" + send_gdb "$cmd\n" + gdb_expect { + -re ".gdb_index: faked for ..readnow.." { + # Record that we've seen the above pattern. + set readnow_p 1 + exp_continue + } + -re "\\^done\r\n$mi_gdb_prompt$" { + } + } + + return $readnow_p +} + # mi_gdb_test COMMAND PATTERN MESSAGE [IPATTERN] -- send a command to gdb; # test the result. # --------------B1B48605781293073FB93625--