From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: from simark.ca by simark.ca with LMTP id D2hZEbScbmMpPxcAWB0awg (envelope-from ) for ; Fri, 11 Nov 2022 14:04:20 -0500 Received: by simark.ca (Postfix, from userid 112) id 3BAA21E124; Fri, 11 Nov 2022 14:04:20 -0500 (EST) Authentication-Results: simark.ca; dkim=pass (1024-bit key; secure) header.d=sourceware.org header.i=@sourceware.org header.a=rsa-sha256 header.s=default header.b=qMwTYeMv; dkim-atps=neutral X-Spam-Checker-Version: SpamAssassin 3.4.6 (2021-04-09) on simark.ca X-Spam-Level: X-Spam-Status: No, score=-5.3 required=5.0 tests=BAYES_00,DKIM_SIGNED, DKIM_VALID,DKIM_VALID_AU,MAILING_LIST_MULTI,NICE_REPLY_A, RCVD_IN_DNSWL_MED,RDNS_DYNAMIC,URIBL_BLOCKED autolearn=ham autolearn_force=no version=3.4.6 Received: from sourceware.org (ip-8-43-85-97.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 65BE31E11E for ; Fri, 11 Nov 2022 14:04:19 -0500 (EST) Received: from server2.sourceware.org (localhost [IPv6:::1]) by sourceware.org (Postfix) with ESMTP id CA63B3858D3C for ; Fri, 11 Nov 2022 19:04:10 +0000 (GMT) DKIM-Filter: OpenDKIM Filter v2.11.0 sourceware.org CA63B3858D3C DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=sourceware.org; s=default; t=1668193450; bh=MbQrTvv8gZuYnAf/RJPqXE0DxiejYbeidSM1qAEiCmo=; h=Date:Subject:To:References:In-Reply-To:List-Id:List-Unsubscribe: List-Archive:List-Post:List-Help:List-Subscribe:From:Reply-To: From; b=qMwTYeMvZipIlsDQQOj/+NU35Ba+uZuZtnBzg6ElGHlsCitX87jycaHvKPpCW7ZUV V98NGjyQOb7NmKUnjYQn2qgRCDacjQua/Nyle+Buh9auCHzD/Q2V1N6SEsH/YgVYTg JYAqBDibW0gNGFuGY3zynY4qS248poneuRDYLwpI= Received: from simark.ca (simark.ca [158.69.221.121]) by sourceware.org (Postfix) with ESMTPS id 7F2E33858D1E for ; Fri, 11 Nov 2022 19:03:50 +0000 (GMT) DMARC-Filter: OpenDMARC Filter v1.4.1 sourceware.org 7F2E33858D1E Received: from [10.0.0.11] (unknown [217.28.27.60]) (using TLSv1.3 with cipher TLS_AES_128_GCM_SHA256 (128/128 bits) key-exchange X25519 server-signature RSA-PSS (2048 bits) server-digest SHA256) (No client certificate requested) by simark.ca (Postfix) with ESMTPSA id E7A881E11E; Fri, 11 Nov 2022 14:03:49 -0500 (EST) Message-ID: Date: Fri, 11 Nov 2022 14:03:48 -0500 MIME-Version: 1.0 User-Agent: Mozilla/5.0 (X11; Linux x86_64; rv:102.0) Gecko/20100101 Thunderbird/102.4.1 Subject: Re: [PATCH v2] gdb: make "start" breakpoint inferior-specific Content-Language: en-US To: Tom de Vries , Simon Marchi , gdb-patches@sourceware.org References: <691c5a58-68ae-5fe9-2f3d-34fb7af69ad0@palves.net> <20221108212008.1792090-1-simon.marchi@efficios.com> <1c02e882-c19e-483e-e50c-634fbe282988@suse.de> <4c7b3e65-08a6-913a-8e0f-8d3812bbd005@efficios.com> <5d4c4f03-4aa5-cf36-cb4d-cf8293f247a1@suse.de> In-Reply-To: <5d4c4f03-4aa5-cf36-cb4d-cf8293f247a1@suse.de> Content-Type: text/plain; charset=UTF-8 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: Simon Marchi via Gdb-patches Reply-To: Simon Marchi Errors-To: gdb-patches-bounces+public-inbox=simark.ca@sourceware.org Sender: "Gdb-patches" On 11/11/22 10:21, Tom de Vries via Gdb-patches wrote: > On 11/11/22 14:53, Simon Marchi wrote: >> On 11/11/22 07:37, Tom de Vries wrote: >>> On 11/8/22 22:20, Simon Marchi via Gdb-patches wrote: >>>> -      std::string arg = string_printf ("-qualified %s", main_name ()); >>>> +      std::string arg = string_printf ("-qualified %s if $_inferior == %d", main_name (), >>>> +                       current_inferior ()->num); >>> >>> Hi, >>> >>> it seems ada doesn't like the syntax, we get: >>> ... >>> (gdb) start ^M >>> Error in expression, near `1'.^M >>> (gdb) UNTESTED: gdb.ada/start.exp: start failed to land inside the right procedure >> >> Huh, sorry, I missed it because it shows up as UNTESTED, which my CI job >> doesn't flag as a failure. >> > > I only noticed by glancing at gdb.log scrolling by, which got stuck waiting for "Starting program:" to appear.  Which I've just realized is a testsuite error, so I've fixed this with "[gdb/testsuite] Don't timeout on prompt in gdb_start_cmd". Thanks. I think it's strange for these tests to emit an UNTESTED if gdb_start_cmd fails. Clearly, something is wrong if that happens. I'll send a patch that changes them to fail. > >> Here's a patch that fixes it in a rather naive way.  Ideally, we would >> implement proper inferior-specific breakpoints, but in any case we want >> un-break the tests sooner than that. >> > > It fixes the "UNTESTED" for me, and LGTM. > > I did wonder if this could be fixed in a way that the expression is parsed independent of the current language, setting language to say C for the duration of the command.  And that does seem to work: > ... > diff --git a/gdb/infcmd.c b/gdb/infcmd.c > index bf4a68e3557..f7b1d763838 100644 > --- a/gdb/infcmd.c > +++ b/gdb/infcmd.c > @@ -430,7 +430,14 @@ run_command_1 (const char *args, int from_tty, enum run_ > how run_how) >          spaces unrelated to this inferior.  */ >        std::string arg = string_printf ("-qualified %s if $_inferior == %d", main_nam > e (), >                                        current_inferior ()->num); > -      tbreak_command (arg.c_str (), 0); > +      { > +       scoped_restore_current_language save_language; > +       scoped_restore save_language_mode > +         = make_scoped_restore (&language_mode); > +       language_mode = language_mode_manual; > +       current_language = language_def (language_c); > +       tbreak_command (arg.c_str (), 0); > +      } >      } > >    exec_file = get_exec_file (0); > ... > > I'm not sure if this is a better solution: it's more intrusive. Ah, that would be good too. We wouldn't have to bake in the knowledge of which languages use which operator. But I'm also a bit scared of other unintended consequences when looking up the main symbol, as I see the current_language is involved in some places. To be safe, I'll just go with my naive patch. Thanks for the suggestion. Simon