From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: from simark.ca by simark.ca with LMTP id imrbA28biGC0BwAAWB0awg (envelope-from ) for ; Tue, 27 Apr 2021 10:10:55 -0400 Received: by simark.ca (Postfix, from userid 112) id 02D6C1F11C; Tue, 27 Apr 2021 10:10:55 -0400 (EDT) X-Spam-Checker-Version: SpamAssassin 3.4.2 (2018-09-13) on simark.ca X-Spam-Level: X-Spam-Status: No, score=-1.1 required=5.0 tests=DKIM_SIGNED,DKIM_VALID, DKIM_VALID_AU,MAILING_LIST_MULTI,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 1FCB01E01F for ; Tue, 27 Apr 2021 10:10:54 -0400 (EDT) Received: from server2.sourceware.org (localhost [IPv6:::1]) by sourceware.org (Postfix) with ESMTP id A243C3894C38; Tue, 27 Apr 2021 14:10:53 +0000 (GMT) DKIM-Filter: OpenDKIM Filter v2.11.0 sourceware.org A243C3894C38 DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=sourceware.org; s=default; t=1619532653; bh=oY9vkLbFL0fjyAiD8z/BfohAZV/dPpZ9xTawE2vFUHQ=; h=To:Subject:Date:List-Id:List-Unsubscribe:List-Archive:List-Post: List-Help:List-Subscribe:From:Reply-To:From; b=YfewmCSrdtw8SqPQP9DpoDvNbIerKyXtRmFLmxTifF8Yfs1YGvzG7K4yrll/5SoQG VsKaFa4dRoCzOCIBpYQAlPvOJ6oyXBXqquxsQxlbu/O8jDTnoDR1//2D1pQU3x7xpe vgooFLjd5PoIFD9p+EH5yBv6djeE8nR3tta9/DIY= Received: from mail-qt1-x831.google.com (mail-qt1-x831.google.com [IPv6:2607:f8b0:4864:20::831]) by sourceware.org (Postfix) with ESMTPS id E3EDD3848016 for ; Tue, 27 Apr 2021 14:10:50 +0000 (GMT) DMARC-Filter: OpenDMARC Filter v1.3.2 sourceware.org E3EDD3848016 Received: by mail-qt1-x831.google.com with SMTP id n22so4625654qtk.9 for ; Tue, 27 Apr 2021 07:10:50 -0700 (PDT) X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20161025; h=x-gm-message-state:from:to:subject:date:message-id:mime-version :content-transfer-encoding; bh=oY9vkLbFL0fjyAiD8z/BfohAZV/dPpZ9xTawE2vFUHQ=; b=gy0YqeW6nSef8BVliiR8PhQ7RQOtD/GLtE10XEY7nQ54XiATLkK3/bK2TaQvFwAMFl w2RcMuMeYW83TBXoFBiTnea8uFv/OEGlbZQVrYuhkATv9mW0aEZiQ7NGf4w7+yL03fJ3 LSlYg//RR6zHcPXc+VGKlmZ5wKra0U+fBsENEI2pRqLt0Z3Wj5ja2bZgrt/h7U+PLEU/ yeE6VhMBBr9fkcI1Zf1thAVjNm0aXbbPAxPta15p4chUbNJKIdj1Pfg1T0U1NGNOdq7c TjdbIy/a4pASWTa+Kb/iZxSEKyWZlr1+6YffTQP5ev/fBkY2pBjmzc89Zwsvx745N9oM o7KQ== X-Gm-Message-State: AOAM5315DXs932KXwrbCGHIFPc3m9t2fZFQbs06BYXAKdY3ZeF6t3dDI weh1f9SFYFcWUtbp7vqhlsw3QFi5KgIYkw== X-Google-Smtp-Source: ABdhPJzq7vdFUezQDy1JSa6ck9Ddt0giqwSbV4uKuLJlvJ0axqLO1SehWkE6gIfeN1NQ7z29VMnYUA== X-Received: by 2002:ac8:7eeb:: with SMTP id r11mr22460897qtc.64.1619532650351; Tue, 27 Apr 2021 07:10:50 -0700 (PDT) Received: from localhost.localdomain ([2804:7f0:4841:2d9e:8148:d364:eb52:965f]) by smtp.gmail.com with ESMTPSA id r185sm267176qkf.78.2021.04.27.07.10.48 for (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Tue, 27 Apr 2021 07:10:49 -0700 (PDT) To: gdb-patches@sourceware.org Subject: [PATCH] [testsuite] Fix timeout with maint print objfiles Date: Tue, 27 Apr 2021 11:10:44 -0300 Message-Id: <20210427141044.2573352-1-luis.machado@linaro.org> X-Mailer: git-send-email 2.25.1 MIME-Version: 1.0 Content-Transfer-Encoding: 8bit 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: , From: Luis Machado via Gdb-patches Reply-To: Luis Machado Errors-To: gdb-patches-bounces@sourceware.org Sender: "Gdb-patches" I'm seeing timeouts from gdb.rust/traits.exp when we attempt to print things with "maint print objfiles". This happens for two reasons: 1 - GDB does not explicitly split each entry into its own line, but rather relies on the terminal's width to insert line breaks. 2 - When running the GDB testsuite, such width may be unlimited, which will prevent GDB from inserting any line breaks. As a result, the output may be too lengthy and will come in big lines. Tweak the support library to match the patterns line-by-line, which gives us more time to match things. Also fix GDB's output to print one entry per line, regardless of the terminal width. A similar approach was used in another testcase using the same command (commit eaeaf44cfdc9a4096a0dd52fa0606f29d4bfd48e). With the new line breaks, we don't need a particular pattern, so clean up that test as well. gdb/ChangeLog: YYYY-MM-DD Luis Machado * psymtab.c (psymbol_functions::dump): Output newline. * symmisc.c (dump_objfile): Likewise. gdb/testsuite/ChangeLog: YYYY-MM-DD Luis Machado * gdb.base/maint.exp: Drop a pattern that is not needed. * lib/gdb.exp (readnow): Match line-by-line. --- gdb/psymtab.c | 2 +- gdb/symmisc.c | 4 ++-- gdb/testsuite/gdb.base/maint.exp | 3 --- gdb/testsuite/lib/gdb.exp | 17 ++++++++++++----- 4 files changed, 15 insertions(+), 11 deletions(-) diff --git a/gdb/psymtab.c b/gdb/psymtab.c index 75a307c89aa..e3032d60343 100644 --- a/gdb/psymtab.c +++ b/gdb/psymtab.c @@ -885,7 +885,7 @@ psymbol_functions::dump (struct objfile *objfile) printf_filtered ("%s at ", psymtab->filename); gdb_print_host_address (psymtab, gdb_stdout); - printf_filtered (", "); + printf_filtered ("\n"); wrap_here (" "); } printf_filtered ("\n\n"); diff --git a/gdb/symmisc.c b/gdb/symmisc.c index d992c671635..d70c5ecda49 100644 --- a/gdb/symmisc.c +++ b/gdb/symmisc.c @@ -131,11 +131,11 @@ dump_objfile (struct objfile *objfile) printf_filtered ("%s at ", symtab_to_filename_for_display (symtab)); gdb_print_host_address (symtab, gdb_stdout); - printf_filtered (", "); if (SYMTAB_OBJFILE (symtab) != objfile) { - printf_filtered ("NOT ON CHAIN! "); + printf_filtered (", NOT ON CHAIN!"); } + printf_filtered ("\n"); wrap_here (" "); } } diff --git a/gdb/testsuite/gdb.base/maint.exp b/gdb/testsuite/gdb.base/maint.exp index e72392220cc..6831d1ba720 100644 --- a/gdb/testsuite/gdb.base/maint.exp +++ b/gdb/testsuite/gdb.base/maint.exp @@ -230,9 +230,6 @@ gdb_test_multiple "maint print objfiles" "" -lbl { set symtabs 1 exp_continue } - -re " at $hex," { - exp_continue - } -re -wrap "" { pass $gdb_test_name } diff --git a/gdb/testsuite/lib/gdb.exp b/gdb/testsuite/lib/gdb.exp index 943112fcc80..01012b9a5a3 100644 --- a/gdb/testsuite/lib/gdb.exp +++ b/gdb/testsuite/lib/gdb.exp @@ -7511,17 +7511,24 @@ proc readnow { args } { } else { set re "" } + + global gdb_prompt + set readnow_p 0 + # Given the listing from the following command can be very verbose, match + # the patterns line-by-line. This prevents timeouts from waiting for + # too much data to come at once. set cmd "maint print objfiles $re" - gdb_test_multiple $cmd "" { - -re -wrap "\r\n.gdb_index: faked for \"readnow\"\r\n.*" { - return 1 + gdb_test_multiple $cmd "" -lbl { + -re "\r\n.gdb_index: faked for \"readnow\"" { + # Record the we've seen the above pattern. + set readnow_p 1 } -re -wrap "" { - return 0 + # We don't care about any other input. } } - return 0 + return $readnow_p } # Return 1 if partial symbols are available. Otherwise, return 0. -- 2.25.1