From patchwork Wed Oct 4 02:20:18 2023 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Simon Marchi X-Patchwork-Id: 77075 Return-Path: X-Original-To: patchwork@sourceware.org Delivered-To: patchwork@sourceware.org Received: from server2.sourceware.org (localhost [IPv6:::1]) by sourceware.org (Postfix) with ESMTP id AF9AE3857707 for ; Wed, 4 Oct 2023 02:24:03 +0000 (GMT) DKIM-Filter: OpenDKIM Filter v2.11.0 sourceware.org AF9AE3857707 DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=sourceware.org; s=default; t=1696386243; bh=uSt1N+I7YXohw1k1DHkIZZdAcp7R//m51oaW7rqWRtw=; h=To:Cc:Subject:Date:In-Reply-To:References:List-Id: List-Unsubscribe:List-Archive:List-Post:List-Help:List-Subscribe: From:Reply-To:From; b=upOwPC8QilWPJ8sVH7adq3fBuYDDacEDk6DVW/3IWPdWHJUl/gouFlc3KyBqMXwaM /IrmdYx7ApRqhhAur2Y8s0ihoRc0FuUFrkvFkpylHHdU6KvOlaW8/umAqJvsA7g9wb 6gdndTXkc3MmqjQ0y4dR+WVGnyip39gMkFgND9TQ= X-Original-To: gdb-patches@sourceware.org Delivered-To: gdb-patches@sourceware.org Received: from smtp.polymtl.ca (smtp.polymtl.ca [132.207.4.11]) by sourceware.org (Postfix) with ESMTPS id A0F90385842C for ; Wed, 4 Oct 2023 02:23:13 +0000 (GMT) DMARC-Filter: OpenDMARC Filter v1.4.2 sourceware.org A0F90385842C Received: from simark.ca (simark.ca [158.69.221.121]) (authenticated bits=0) by smtp.polymtl.ca (8.14.7/8.14.7) with ESMTP id 3942N7Ck025356 (version=TLSv1/SSLv3 cipher=ECDHE-RSA-AES256-GCM-SHA384 bits=256 verify=NOT); Tue, 3 Oct 2023 22:23:12 -0400 DKIM-Filter: OpenDKIM Filter v2.11.0 smtp.polymtl.ca 3942N7Ck025356 Received: from simark.localdomain (modemcable238.237-201-24.mc.videotron.ca [24.201.237.238]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) key-exchange X25519 server-signature ECDSA (prime256v1) server-digest SHA256) (No client certificate requested) by simark.ca (Postfix) with ESMTPSA id 5E47F1E0D0; Tue, 3 Oct 2023 22:23:07 -0400 (EDT) To: gdb-patches@sourceware.org Cc: Simon Marchi Subject: [PATCH 3/8] gdb: add program_space parameter to emit_clear_objfiles_event Date: Tue, 3 Oct 2023 22:20:18 -0400 Message-ID: <20231004022305.298534-4-simon.marchi@polymtl.ca> X-Mailer: git-send-email 2.42.0 In-Reply-To: <20231004022305.298534-1-simon.marchi@polymtl.ca> References: <20231004022305.298534-1-simon.marchi@polymtl.ca> MIME-Version: 1.0 X-Poly-FromMTA: (simark.ca [158.69.221.121]) at Wed, 4 Oct 2023 02:23:07 +0000 X-Spam-Status: No, score=-3188.6 required=5.0 tests=BAYES_00, DKIM_SIGNED, DKIM_VALID, DKIM_VALID_AU, DKIM_VALID_EF, GIT_PATCH_0, RCVD_IN_MSPIKE_H3, RCVD_IN_MSPIKE_WL, SPF_HELO_PASS, 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 X-BeenThere: gdb-patches@sourceware.org X-Mailman-Version: 2.1.30 Precedence: list List-Id: Gdb-patches mailing list List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-Patchwork-Original-From: Simon Marchi via Gdb-patches From: Simon Marchi Reply-To: Simon Marchi Errors-To: gdb-patches-bounces+patchwork=sourceware.org@sourceware.org Sender: "Gdb-patches" From: Simon Marchi Add program_space space parameters to emit_clear_objfiles_event and create_clear_objfiles_event_object, making the reference to current_program_space bubble up a bit. Change-Id: I5fde2071712781e5d45971fa0ab34d85d3a49a71 --- gdb/python/py-event.h | 2 +- gdb/python/py-inferior.c | 2 +- gdb/python/py-newobjfileevent.c | 8 ++++---- 3 files changed, 6 insertions(+), 6 deletions(-) diff --git a/gdb/python/py-event.h b/gdb/python/py-event.h index 01386dde84cd..b9e9af4d7329 100644 --- a/gdb/python/py-event.h +++ b/gdb/python/py-event.h @@ -78,7 +78,7 @@ extern gdbpy_ref<> create_thread_event_object (PyTypeObject *py_type, extern int emit_new_objfile_event (struct objfile *objfile); extern int emit_free_objfile_event (struct objfile *objfile); -extern int emit_clear_objfiles_event (void); +extern int emit_clear_objfiles_event (program_space *pspace); extern void evpy_dealloc (PyObject *self); extern int evpy_add_attribute (PyObject *event, diff --git a/gdb/python/py-inferior.c b/gdb/python/py-inferior.c index 906d402827ce..e7a9d822409b 100644 --- a/gdb/python/py-inferior.c +++ b/gdb/python/py-inferior.c @@ -196,7 +196,7 @@ python_new_objfile (struct objfile *objfile) if (objfile == NULL) { - if (emit_clear_objfiles_event () < 0) + if (emit_clear_objfiles_event (current_program_space) < 0) gdbpy_print_stack (); } else diff --git a/gdb/python/py-newobjfileevent.c b/gdb/python/py-newobjfileevent.c index 34e8e4923b58..2068d39353a4 100644 --- a/gdb/python/py-newobjfileevent.c +++ b/gdb/python/py-newobjfileevent.c @@ -93,14 +93,14 @@ emit_free_objfile_event (struct objfile *objfile) /* Subroutine of emit_clear_objfiles_event to simplify it. */ static gdbpy_ref<> -create_clear_objfiles_event_object (void) +create_clear_objfiles_event_object (program_space *pspace) { gdbpy_ref<> objfile_event = create_event_object (&clear_objfiles_event_object_type); if (objfile_event == NULL) return NULL; - gdbpy_ref<> py_progspace = pspace_to_pspace_object (current_program_space); + gdbpy_ref<> py_progspace = pspace_to_pspace_object (pspace); if (py_progspace == NULL || evpy_add_attribute (objfile_event.get (), "progspace", py_progspace.get ()) < 0) @@ -115,12 +115,12 @@ create_clear_objfiles_event_object (void) Return -1 if emit fails. */ int -emit_clear_objfiles_event (void) +emit_clear_objfiles_event (program_space *pspace) { if (evregpy_no_listeners_p (gdb_py_events.clear_objfiles)) return 0; - gdbpy_ref<> event = create_clear_objfiles_event_object (); + gdbpy_ref<> event = create_clear_objfiles_event_object (pspace); if (event != NULL) return evpy_emit_event (event.get (), gdb_py_events.clear_objfiles); return -1;