From patchwork Mon Nov 19 15:27:44 2018 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Pedro Alves X-Patchwork-Id: 30199 Received: (qmail 124076 invoked by alias); 19 Nov 2018 15:27:49 -0000 Mailing-List: contact gdb-patches-help@sourceware.org; run by ezmlm Precedence: bulk List-Id: List-Unsubscribe: List-Subscribe: List-Archive: List-Post: List-Help: , Sender: gdb-patches-owner@sourceware.org Delivered-To: mailing list gdb-patches@sourceware.org Received: (qmail 124061 invoked by uid 89); 19 Nov 2018 15:27:48 -0000 Authentication-Results: sourceware.org; auth=none X-Spam-SWARE-Status: No, score=-26.9 required=5.0 tests=BAYES_00, GIT_PATCH_0, GIT_PATCH_1, GIT_PATCH_2, GIT_PATCH_3, SPF_HELO_PASS autolearn=ham version=3.3.2 spammy=Hx-languages-length:2539, 2144 X-HELO: mx1.redhat.com Received: from mx1.redhat.com (HELO mx1.redhat.com) (209.132.183.28) by sourceware.org (qpsmtpd/0.93/v0.84-503-g423c35a) with ESMTP; Mon, 19 Nov 2018 15:27:47 +0000 Received: from smtp.corp.redhat.com (int-mx06.intmail.prod.int.phx2.redhat.com [10.5.11.16]) (using TLSv1.2 with cipher AECDH-AES256-SHA (256/256 bits)) (No client certificate requested) by mx1.redhat.com (Postfix) with ESMTPS id 6079B3084257; Mon, 19 Nov 2018 15:27:46 +0000 (UTC) Received: from [127.0.0.1] (ovpn04.gateway.prod.ext.ams2.redhat.com [10.39.146.4]) by smtp.corp.redhat.com (Postfix) with ESMTP id B54495C57B; Mon, 19 Nov 2018 15:27:45 +0000 (UTC) Subject: Re: [PATCH v2] Avoid crash when calling warning too early To: Tom Tromey References: <20181031181820.24308-1-tom@tromey.com> <5993d96c-afe2-99b1-af8d-56173ea73e08@redhat.com> <87zhuasziq.fsf@tromey.com> <37033fcd-ce27-ecc9-3bb6-7ac7d062fdd8@redhat.com> <87ftvy8br4.fsf@tromey.com> Cc: gdb-patches@sourceware.org From: Pedro Alves Message-ID: <5fbdbc93-3cb0-4e0b-fc50-4667dc96efcb@redhat.com> Date: Mon, 19 Nov 2018 15:27:44 +0000 User-Agent: Mozilla/5.0 (X11; Linux x86_64; rv:52.0) Gecko/20100101 Thunderbird/52.9.1 MIME-Version: 1.0 In-Reply-To: <87ftvy8br4.fsf@tromey.com> On 11/18/2018 06:46 PM, Tom Tromey wrote: >>>>>> "Pedro" == Pedro Alves writes: > > Pedro> Hmm, by using gdb_spawn directly, or better, gdb_spawn_with_cmdline_opts > Pedro> instead of gdb_start? > > [...] > > Pedro> So, WDYT of this version? > > Look good to me, thanks. > I've pushed it in now. From 6769f2765db0d94eeb8437b41a925e2bd871f514 Mon Sep 17 00:00:00 2001 From: Pedro Alves Date: Mon, 19 Nov 2018 15:08:46 +0000 Subject: [PATCH] gdb.base/warning.exp tweaks #1- Check that the warning is emitted. #2- Avoid overriding INTERNAL_GDBFLAGS, as per documentated in gdb/testsuite/README: ~~~ The testsuite does not override a value provided by the user. ~~~ We don't actually need to tweak INTERNAL_GDBFLAGS, we just need to append out -data-directory to GDBFLAGS, because each passed -data-directory option leads to a call to the warning: $ ./gdb -data-directory=foo -data-directory=bar Warning: foo: No such file or directory. Warning: bar: No such file or directory. [...] gdb/ChangeLog 2018-11-19 Pedro Alves * gdb.base/warning.exp: Don't override INTERNAL_FLAGS. Use gdb_spawn_with_cmdline_opts instead of gdb_start. Check that we see the expected warning. --- gdb/testsuite/ChangeLog | 6 ++++++ gdb/testsuite/gdb.base/warning.exp | 10 +++++----- 2 files changed, 11 insertions(+), 5 deletions(-) diff --git a/gdb/testsuite/ChangeLog b/gdb/testsuite/ChangeLog index c0de6f2d6c..9acaa79e2b 100644 --- a/gdb/testsuite/ChangeLog +++ b/gdb/testsuite/ChangeLog @@ -1,3 +1,9 @@ +2018-11-19 Pedro Alves + + * gdb.base/warning.exp: Don't override INTERNAL_FLAGS. Use + gdb_spawn_with_cmdline_opts instead of gdb_start. Check that we + see the expected warning. + 2018-11-16 Alan Hayward PR gdb/22736: diff --git a/gdb/testsuite/gdb.base/warning.exp b/gdb/testsuite/gdb.base/warning.exp index 53067f48d5..134218acb9 100644 --- a/gdb/testsuite/gdb.base/warning.exp +++ b/gdb/testsuite/gdb.base/warning.exp @@ -25,12 +25,12 @@ set fd [open $tname w] puts $fd "anything" close $fd -set save $INTERNAL_GDBFLAGS -set INTERNAL_GDBFLAGS "-nw -nx -data-directory $tname" +gdb_spawn_with_cmdline_opts \ + "-iex \"set pagination off\" -data-directory $tname" -gdb_start +# Make sure we see the warning. +gdb_test "" "warning: $tname is not a directory.*" \ + "got warning" # Make sure gdb started up. gdb_test "echo 23\\n" "23" - -set INTERNAL_GDBFLAGS $save