From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: from us-smtp-delivery-124.mimecast.com (us-smtp-delivery-124.mimecast.com [170.10.133.124]) by sourceware.org (Postfix) with ESMTPS id 299C43883F06 for ; Wed, 14 Dec 2022 13:57:08 +0000 (GMT) DMARC-Filter: OpenDMARC Filter v1.4.1 sourceware.org 299C43883F06 Authentication-Results: sourceware.org; dmarc=pass (p=none dis=none) header.from=redhat.com Authentication-Results: sourceware.org; spf=pass smtp.mailfrom=redhat.com DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=redhat.com; s=mimecast20190719; t=1671026227; h=from:from:reply-to:subject:subject:date:date:message-id:message-id: to:to:cc:mime-version:mime-version:content-type:content-type: in-reply-to:in-reply-to:references:references; bh=u6a2Fg8xgjIdFqdHAmpwHdWz0hivSknmOyV7MMMAMHU=; b=D2DvgoruWEf/SFpTShqIvZAhHxQuLijnXkmzALsiTlNuOCKaQcpArOW4UXRiflEMMphAOH LFZOGmSiI87GFQXmB6t2sabqPcLY9CfqlZ6fS91bmBsd6ESDuCUJJxundA69fahVRmHPWQ ltF0VrjJUW2g9h4sp1E8F1Y3BmZxpUI= Received: from mail-wm1-f70.google.com (mail-wm1-f70.google.com [209.85.128.70]) by relay.mimecast.com with ESMTP with STARTTLS (version=TLSv1.3, cipher=TLS_AES_128_GCM_SHA256) id us-mta-338-oy4_6e-QNu2scOokWKTZxw-1; Wed, 14 Dec 2022 08:57:06 -0500 X-MC-Unique: oy4_6e-QNu2scOokWKTZxw-1 Received: by mail-wm1-f70.google.com with SMTP id c1-20020a7bc001000000b003cfe40fca79so4215323wmb.6 for ; Wed, 14 Dec 2022 05:57:06 -0800 (PST) X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20210112; h=mime-version:message-id:date:references:in-reply-to:subject:to:from :x-gm-message-state:from:to:cc:subject:date:message-id:reply-to; bh=u6a2Fg8xgjIdFqdHAmpwHdWz0hivSknmOyV7MMMAMHU=; b=ihzWhNzFcEqfzZlp9PVyGzqfWUC9LJ4zehhqzuTGOOjhvMCG1oOoQcwTbL4uHj/E2/ RirGO4WjXnY3FtfZdrIopIw3WSyUVjtP2bcuO54Ts+ItgpXNB+6zTnv5c54cUZWaK73k +WwPtXPf4IjwmUg2L02nIXNbX5PysDI7b3F8WEseGxI+R8B18A625nOoX7IWopNyVGjp nE7llG+x4ZYw89yJQoIXZe/by0tgiaPxQ7wA1VxDPa2BIbbrdDBKeYCLvHnN89PF9lJZ rOpDNIgZoekKv9ieui8bR0PIwIxfq0fB/yAA9yvYIz2eTYPkKPCn8eV8QDCbJf0gcszM gHzw== X-Gm-Message-State: ANoB5plQUsq9uZJVhMMAcYbDCftaw2QkFG53ANUuF85bOhqNh+VHJlnH 74qHKb5kZiBQOJj9+lRLo98tXqIElx9WrgOACHEeqGMuW/LgI1v872Ity3z0mkV5l0KU9rp9GfL SPWz416jCzDql4ffQ9nPKmg== X-Received: by 2002:adf:dbd2:0:b0:242:388b:c461 with SMTP id e18-20020adfdbd2000000b00242388bc461mr16319124wrj.55.1671026225036; Wed, 14 Dec 2022 05:57:05 -0800 (PST) X-Google-Smtp-Source: AA0mqf7/t/klkGfrk0DCXRZbdYzM6Kfs0uykcQC4wXz6DnNmKClnxz4FbTjIL3rFTt4owboi89Tcww== X-Received: by 2002:adf:dbd2:0:b0:242:388b:c461 with SMTP id e18-20020adfdbd2000000b00242388bc461mr16319113wrj.55.1671026224764; Wed, 14 Dec 2022 05:57:04 -0800 (PST) Received: from localhost ([31.111.84.238]) by smtp.gmail.com with ESMTPSA id l18-20020a5d4bd2000000b00236488f62d6sm2971349wrt.79.2022.12.14.05.57.04 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Wed, 14 Dec 2022 05:57:04 -0800 (PST) From: Andrew Burgess To: Tom Tromey , Andrew Burgess via Gdb-patches Subject: Re: [PATCHv3 7/7] gdb: some process_stratum_target should not be shared In-Reply-To: <87fsegqgur.fsf@tromey.com> References: <577f2c47793acb501c2611c0e6c7ea379f774830.1668789658.git.aburgess@redhat.com> <87fsegqgur.fsf@tromey.com> Date: Wed, 14 Dec 2022 13:57:03 +0000 Message-ID: <87h6xy1428.fsf@redhat.com> MIME-Version: 1.0 X-Mimecast-Spam-Score: 0 X-Mimecast-Originator: redhat.com Content-Type: text/plain X-Spam-Status: No, score=-5.7 required=5.0 tests=BAYES_00,DKIMWL_WL_HIGH,DKIM_SIGNED,DKIM_VALID,DKIM_VALID_AU,DKIM_VALID_EF,RCVD_IN_DNSWL_NONE,RCVD_IN_MSPIKE_H2,SPF_HELO_NONE,SPF_NONE,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: Tom Tromey writes: >>>>>> "Andrew" == Andrew Burgess via Gdb-patches writes: > > Andrew> For things like the Linux and FreeBSD native targets, as well as the > Andrew> remote target, this is absolutely true (or was made true). But some > Andrew> targets were never updated to be shareable, for example, the > Andrew> core_target, which is used when reading core-files, stores some of its > Andrew> state in the program_space, but also, the core-file and the executable > Andrew> being debugged are closely related. > > Andrew> As each add-inferior call creates an inferior with a new > Andrew> program_space, and doesn't automatically copy the executable, or the > Andrew> current core-file, I don't think it really makes sense to "share" > Andrew> core_target objects between inferiors. > > Yeah, probably the core target just doesn't even make sense to share. > > I guess if we did want to share it, we could move the state into the > core target. Maybe this is worthwhile to do anyway? I see a bunch of > uses of core_bfd (which is a #define reaching into the program space), > but some, e.g. in linux_read_core_file_mappings, seem like they could be > replaced with a parameter. > > Andrew> I think this behaviour might be confusing, so I'd like to have GDB not > Andrew> initially share the core connection. Instead, when the user tries to > Andrew> add the new inferior a warning is given, and the new inferior is > Andrew> created without a connection, like this: > > This makes sense to me. > > Andrew> + /* The core_target only works for the inferior in which it was initially > Andrew> + opened, and can't be copied to some other inferior's target_stack. */ > Andrew> + bool is_shareable () override > Andrew> + { return false; } Tom, Thanks for all the reviews on this series. Sorry it's taken me so long to look at these patches again. > > However, why only mark the core target this way? Mostly, because that was the only target I'd run into problems with. > I think there are a lot of other targets that can't be > shared... remote-sim, all the trace targets, even I think windows-nat, > since it isn't multi-inferior-capable yet. > > So maybe the default implementation should be 'return false' and then > specific known-good targets should override it? Mostly I'm just nervous about making such sweeping changes. As a result I tend to go smaller and try to only change the minimum needed to fix the issue I'm seeing. But I think you're right, I should probably consider if the default makes more sense the other way around. I've fixed all the issues you pointed out with patches 1->6, so I'm going to go ahead and merge them, then take another look at patch 7, and I'll post an updated version. Thanks, Andrew