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.129.124]) by sourceware.org (Postfix) with ESMTPS id 1248C3848E25 for ; Tue, 6 Dec 2022 16:39:25 +0000 (GMT) DMARC-Filter: OpenDMARC Filter v1.4.1 sourceware.org 1248C3848E25 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=1670344764; h=from:from:reply-to:subject:subject:date:date:message-id:message-id: to:to:cc:cc:mime-version:mime-version:content-type:content-type: in-reply-to:in-reply-to:references:references; bh=CzZ6E2pQEEtl0Br4N5OxPy2L9WJeomeC2aIcazj1DGU=; b=RmBI4nkzkXkQsJmveZYgGSps7gNz+DnNW6lGyRP/anMcq8GXiEtnFx4rIOEyglZ4ob/l81 J1nU7X8OhOHNQ759Yid+B0vd0Vx88N3u+x16f7SMD44zUWaOfk0GDl961nYwiaQLou4xDp O+pIu95CYtDzh33mPYmVpF9I5DF+CCE= Received: from mail-wm1-f71.google.com (mail-wm1-f71.google.com [209.85.128.71]) by relay.mimecast.com with ESMTP with STARTTLS (version=TLSv1.3, cipher=TLS_AES_128_GCM_SHA256) id us-mta-29-78zet4cbMb63zw4Hqf_66w-1; Tue, 06 Dec 2022 11:39:20 -0500 X-MC-Unique: 78zet4cbMb63zw4Hqf_66w-1 Received: by mail-wm1-f71.google.com with SMTP id c187-20020a1c35c4000000b003cfee3c91cdso8650310wma.6 for ; Tue, 06 Dec 2022 08:39:19 -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:cc:to :from:x-gm-message-state:from:to:cc:subject:date:message-id:reply-to; bh=CzZ6E2pQEEtl0Br4N5OxPy2L9WJeomeC2aIcazj1DGU=; b=SMTdCapIP+9HFL7V53NSROo9H0hqlVuZvDRC2dycCShyiW4hOHLOHl95b7lF+W0Gws FSdIYMQe7m6GHnjQIP5vJFu04M3JM/OSFpdcUG7zapCbbvZNgdcmLNHLd5uUN9CrAsp1 3SVhK+yoK2HmDM+QHjrLiqMHnWhXutahgO8HfrS3Gjp4dz+59GCeub2W9GyRp/OGXpmz xVL7rJV1hKZ2fOnTLsh0x2rtOturLOBPjF/g1bJLcUPZfy9NMXcfj2LVVxKAdQH+9nfD kRqXHmhcKVVje4t+5lMpCpZmSdJS+qrOxhIOWKdh+TYjr6Pc9G6QU9v0z4IQFqzqcbge PJ6A== X-Gm-Message-State: ANoB5pnOCOdDTm9LyRq5ZhrGkZtqD80KLKrpUmpqWFzpSkKA12EjseIe SJP7h5237LqHIA8AhNfxfYdKROpGDEM4PAK+xOC0LtAL1jZWhxKcu+z3k+lnsbVzfB0aj0BwSuY 1R3IcHRYN7A9+tpwITI3n4G502rgz9ZQVaVChLmRxouTeRJv2XG4pGWfoWH0TWWP9sy8ctGcBnA == X-Received: by 2002:a1c:440a:0:b0:3d1:f076:26d8 with SMTP id r10-20020a1c440a000000b003d1f07626d8mr1550449wma.99.1670344758481; Tue, 06 Dec 2022 08:39:18 -0800 (PST) X-Google-Smtp-Source: AA0mqf4e3xczBDWBbnWZiPAewVslBywoioNqe/NFzJEcg6gfN74Tb5e5KzK5kfo8Dbq0YEZ4sTWoMA== X-Received: by 2002:a1c:440a:0:b0:3d1:f076:26d8 with SMTP id r10-20020a1c440a000000b003d1f07626d8mr1550439wma.99.1670344758269; Tue, 06 Dec 2022 08:39:18 -0800 (PST) Received: from localhost ([31.111.84.238]) by smtp.gmail.com with ESMTPSA id b18-20020a5d5512000000b0023c8026841csm16580556wrv.23.2022.12.06.08.39.17 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Tue, 06 Dec 2022 08:39:17 -0800 (PST) From: Andrew Burgess To: Simon Marchi via Gdb-patches , gdb-patches@sourceware.org Cc: Simon Marchi Subject: Re: [PATCH 04/12] gdb: add inferior_pre_detach observable In-Reply-To: <20221206135729.3937767-5-simon.marchi@efficios.com> References: <20221206135729.3937767-1-simon.marchi@efficios.com> <20221206135729.3937767-5-simon.marchi@efficios.com> Date: Tue, 06 Dec 2022 16:39:17 +0000 Message-ID: <871qpc4hca.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=-11.7 required=5.0 tests=BAYES_00,DKIMWL_WL_HIGH,DKIM_SIGNED,DKIM_VALID,DKIM_VALID_AU,DKIM_VALID_EF,GIT_PATCH_0,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: Simon Marchi via Gdb-patches writes: > Add an observable notified in target_detach just before calling the > detach method on the inferior's target stack. This allows observer to > do some work on the inferior while it's still ptrace-attached, in the > case of a native Linux inferior. Specifically, the amd-dbgapi target > will need it in order to call amd_dbgapi_process_detach before the > process gets ptrace-detached. LGTM. Thanks, Andrew > > Change-Id: I28b6065e251012a4c2db8a600fe13ba31671e3c9 > --- > gdb/observable.c | 1 + > gdb/observable.h | 3 +++ > gdb/target.c | 2 ++ > 3 files changed, 6 insertions(+) > > diff --git a/gdb/observable.c b/gdb/observable.c > index 0bc8697f137..7b23e038b25 100644 > --- a/gdb/observable.c > +++ b/gdb/observable.c > @@ -62,6 +62,7 @@ DEFINE_OBSERVABLE (architecture_changed); > DEFINE_OBSERVABLE (thread_ptid_changed); > DEFINE_OBSERVABLE (inferior_added); > DEFINE_OBSERVABLE (inferior_appeared); > +DEFINE_OBSERVABLE (inferior_pre_detach); > DEFINE_OBSERVABLE (inferior_exit); > DEFINE_OBSERVABLE (inferior_removed); > DEFINE_OBSERVABLE (memory_changed); > diff --git a/gdb/observable.h b/gdb/observable.h > index 1103c5c98a6..e8cc2d28a86 100644 > --- a/gdb/observable.h > +++ b/gdb/observable.h > @@ -181,6 +181,9 @@ extern observable inferior_added; > process. */ > extern observable inferior_appeared; > > +/* Inferior INF is about to be detached. */ > +extern observable inferior_pre_detach; > + > /* Either the inferior associated with INF has been detached from > the process, or the process has exited. */ > extern observable inferior_exit; > diff --git a/gdb/target.c b/gdb/target.c > index 1dd0f42af7d..04a4e1fd877 100644 > --- a/gdb/target.c > +++ b/gdb/target.c > @@ -2561,6 +2561,8 @@ target_detach (inferior *inf, int from_tty) > > prepare_for_detach (); > > + gdb::observers::inferior_pre_detach.notify (inf); > + > /* Hold a strong reference because detaching may unpush the > target. */ > auto proc_target_ref = target_ops_ref::new_reference (inf->process_target ()); > -- > 2.38.1