From patchwork Fri Nov 16 13:30:45 2018 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Pedro Alves X-Patchwork-Id: 30170 Received: (qmail 99730 invoked by alias); 16 Nov 2018 13:31:03 -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 99527 invoked by uid 89); 16 Nov 2018 13:30:49 -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=HTo:U*tom 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; Fri, 16 Nov 2018 13:30: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 82C0F308428D; Fri, 16 Nov 2018 13:30: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 D8F8E17535; Fri, 16 Nov 2018 13:30: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> Cc: gdb-patches@sourceware.org From: Pedro Alves Message-ID: <37033fcd-ce27-ecc9-3bb6-7ac7d062fdd8@redhat.com> Date: Fri, 16 Nov 2018 13:30:45 +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: <87zhuasziq.fsf@tromey.com> On 11/15/2018 11:15 PM, Tom Tromey wrote: >>>>>> "Pedro" == Pedro Alves writes: > > Pedro> On 10/31/2018 06:18 PM, Tom Tromey wrote: >>> +set save $INTERNAL_GDBFLAGS >>> +set INTERNAL_GDBFLAGS "-nw -nx -data-directory $tname" >>> + >>> +gdb_start >>> + >>> +# Make sure gdb started up. >>> +gdb_test "echo 23\\n" "23" > > Pedro> I guess this could also check that the warning was emitted? > > I didn't know how to do that. > Modify gdb_start maybe? Hmm, by using gdb_spawn directly, or better, gdb_spawn_with_cmdline_opts instead of gdb_start? See patch below; it works here. Also, looking further into the INTERNAL_GDBFLAGS issue, it turns out we don't really need to frob INTERNAL_GDBFLAGS. 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. [...] (And if it didn't, I'd think we'd just have to make sure to put our -data-directory last, leaving the original one in place. I.e., just passing it in gdb_spawn_with_cmdline_opts should work even in that case.) So, WDYT of this version? From 7f3e6bf1b75e049c0abbab2a9cbf3d6e28f855ac Mon Sep 17 00:00:00 2001 From: Pedro Alves Date: Fri, 16 Nov 2018 13:13:56 +0000 Subject: [PATCH] warning --- gdb/testsuite/gdb.base/warning.exp | 10 +++++----- 1 file changed, 5 insertions(+), 5 deletions(-) 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