From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: from mail-wm1-f50.google.com (mail-wm1-f50.google.com [209.85.128.50]) by sourceware.org (Postfix) with ESMTPS id B58733858D38 for ; Mon, 6 Feb 2023 17:24:23 +0000 (GMT) DMARC-Filter: OpenDMARC Filter v1.4.2 sourceware.org B58733858D38 Authentication-Results: sourceware.org; dmarc=none (p=none dis=none) header.from=palves.net Authentication-Results: sourceware.org; spf=pass smtp.mailfrom=gmail.com Received: by mail-wm1-f50.google.com with SMTP id n13so9203112wmr.4 for ; Mon, 06 Feb 2023 09:24:23 -0800 (PST) X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20210112; h=content-transfer-encoding:content-language:in-reply-to:mime-version :user-agent:date:message-id:from:references:to:subject :x-gm-message-state:from:to:cc:subject:date:message-id:reply-to; bh=AxI10BEIZh12YtYQDl18GvEK2jK0WaTWceAG0Uc/2x4=; b=IO4gthJ3490tQc4RujYEwXv72dLHCiktoRtgtk6Yf1pNs7Uj/otDkTIQbfAzYIvVjK RtE6YH/ywEAQ+yOVDlitQaBJGpCTtG8HJa5Lw/h59XaBZxzw1TQq8Eh97kR/SQKWJ2YV jVrvbhoV9xTi1WKrdSunbX7CksYAaJ//7Frh6d3kFfOB8l5ZY2HpfMz2Adi6AodBx1/A iSidCp2BTMf+RYdmydzsfPo5Lz5yqfNUNg/LgF0VOAZ0FNUmlFfbYdi/c7FLDCbyac9m s59Rg3e1R6Z01wSEoJtCjDgD3QHnfZD4xDBt3mpOvsGzzcUjsN9I+uDKhZQAvyLNJovH JxIQ== X-Gm-Message-State: AO0yUKXd3POL3Mie9KIDwrpEsR3H3x4pLKYd694gTb4jGaz/oyAOvupe fiZFbN5UzhrWZhyFcghZgdihsut//zLxPA== X-Google-Smtp-Source: AK7set9EjpmmhvXUst0lS5WfAZt+872CQoHaGr079IZbZH1wfOch9WkOPOjcxchB2hGOtmza4AZZPQ== X-Received: by 2002:a05:600c:44d5:b0:3df:30c9:4865 with SMTP id f21-20020a05600c44d500b003df30c94865mr420963wmo.26.1675704262351; Mon, 06 Feb 2023 09:24:22 -0800 (PST) Received: from ?IPv6:2001:8a0:f92b:9e00::1fe? ([2001:8a0:f92b:9e00::1fe]) by smtp.gmail.com with ESMTPSA id e20-20020a5d5954000000b002bfd524255esm9462930wri.43.2023.02.06.09.24.21 (version=TLS1_3 cipher=TLS_AES_128_GCM_SHA256 bits=128/128); Mon, 06 Feb 2023 09:24:22 -0800 (PST) Subject: Re: [PATCHv2 5/6] gdb: add inferior-specific breakpoints and watchpoints To: Andrew Burgess , gdb-patches@sourceware.org References: <050da90b0b8c886983ec472a957b1075d4ecf7d6.1674207665.git.aburgess@redhat.com> <87k00yr8ns.fsf@redhat.com> From: Pedro Alves Message-ID: Date: Mon, 6 Feb 2023 17:24:18 +0000 User-Agent: Mozilla/5.0 (X11; Linux x86_64; rv:78.0) Gecko/20100101 Thunderbird/78.10.1 MIME-Version: 1.0 In-Reply-To: <87k00yr8ns.fsf@redhat.com> Content-Type: text/plain; charset=utf-8 Content-Language: en-US Content-Transfer-Encoding: 7bit X-Spam-Status: No, score=-4.7 required=5.0 tests=BAYES_00,FREEMAIL_FORGED_FROMDOMAIN,FREEMAIL_FROM,HEADER_FROM_DIFFERENT_DOMAINS,KAM_DMARC_STATUS,NICE_REPLY_A,RCVD_IN_DNSWL_NONE,RCVD_IN_MSPIKE_H2,SPF_HELO_NONE,SPF_PASS,TXREP autolearn=ham autolearn_force=no version=3.4.6 X-Spam-Checker-Version: SpamAssassin 3.4.6 (2021-04-09) on server2.sourceware.org List-Id: On 2023-02-03 4:55 p.m., Andrew Burgess wrote: > Pedro Alves writes: > >> On 2023-01-20 9:46 a.m., Andrew Burgess via Gdb-patches wrote: >>> This commit extends the breakpoint mechanism to allow for inferior >>> specific breakpoints (and watchpoints). >>> >>> As GDB gains better support for multiple connections, and so for >>> running multiple (possibly unrelated) inferiors, then it is not hard >>> to imagine that a user might wish to create breakpoints that apply to >>> any thread in a single inferior. To achieve this currently, the user >>> would need to create a condition possibly making use of the $_inferior >>> convenience variable, which, though functional, isn't the most user >>> friendly. >> >> So IIUC, if you do: >> >> (gdb) break foo inferior 1 >> >> and foo exists in other inferiors, the resulting breakpoint will still >> have locations for the other inferiors. Is that so? >> >> I think that instead, we should not get any location for other inferiors. >> I.e., we should do location pre-filtering, simply by not looking for >> locations in pspaces other than the inferior's. I think that can be >> done easily by simply passing the inferior's pspace as search_pspace argument >> to decode_line_full. > > Thanks for all your great feedback. I'll work through the rest of your > comments, but I want to follow up on this one. > > Baris already raised the point of filtering per-inferior breakpoints so > a to avoid adding extra locations. Ah, missed that. Apologies. > > I 100% agree that this is something that we should do, and this is on my > plan if/when I land this series. > > But I don't see any particular difference between per-inferior and > per-thread breakpoints in this regard. Please correct me if I'm wrong, > but a per-thread breakpoint will insert into every inferior despite only > ever triggering for a single thread in a single inferior (per thread > breakpoints are on the global thread-id). That is a very good point. Given that, I agree you don't need to change it in this patch. I filed it as a bug, here: https://sourceware.org/bugzilla/show_bug.cgi?id=30086 > > So, because this oddity already exists in GDB, my plan was to land this > feature, then follow up with a patch to limit both per-thread and > per-inferior breakpoints to only insert into the correct pspace. Agreed.