From patchwork Thu Jul 11 15:16:13 2019 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Tom Tromey X-Patchwork-Id: 33676 Received: (qmail 84240 invoked by alias); 11 Jul 2019 15:16:27 -0000 Mailing-List: contact gdb-patches-help@sourceware.org; run by ezmlm Precedence: bulk List-Id: List-Unsubscribe: List-Subscribe: List-Archive: List-Post: List-Help: , Sender: gdb-patches-owner@sourceware.org Delivered-To: mailing list gdb-patches@sourceware.org Received: (qmail 84232 invoked by uid 89); 11 Jul 2019 15:16:27 -0000 Authentication-Results: sourceware.org; auth=none X-Spam-SWARE-Status: No, score=-22.4 required=5.0 tests=AWL, BAYES_00, GIT_PATCH_0, GIT_PATCH_1, GIT_PATCH_2, GIT_PATCH_3, RCVD_IN_DNSWL_NONE, SPF_PASS autolearn=ham version=3.3.1 spammy=HContent-Transfer-Encoding:8bit X-HELO: rock.gnat.com Received: from rock.gnat.com (HELO rock.gnat.com) (205.232.38.15) by sourceware.org (qpsmtpd/0.93/v0.84-503-g423c35a) with ESMTP; Thu, 11 Jul 2019 15:16:16 +0000 Received: from localhost (localhost.localdomain [127.0.0.1]) by filtered-rock.gnat.com (Postfix) with ESMTP id 83C0C11674E; Thu, 11 Jul 2019 11:16:15 -0400 (EDT) Received: from rock.gnat.com ([127.0.0.1]) by localhost (rock.gnat.com [127.0.0.1]) (amavisd-new, port 10024) with LMTP id DyOKKhLWxidb; Thu, 11 Jul 2019 11:16:15 -0400 (EDT) Received: from murgatroyd.Home (97-122-178-82.hlrn.qwest.net [97.122.178.82]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by rock.gnat.com (Postfix) with ESMTPSA id 1FC89561FC; Thu, 11 Jul 2019 11:16:15 -0400 (EDT) From: Tom Tromey To: gdb-patches@sourceware.org Cc: Tom Tromey Subject: [FYI] Fix use-after-move bug in add_thread_object Date: Thu, 11 Jul 2019 09:16:13 -0600 Message-Id: <20190711151613.3228-1-tromey@adacore.com> MIME-Version: 1.0 commit 05b08ac1608 ("Reduce manual reference counting in py-inferior.c") introduced a use-after-move bug in add_thread_object, causing a test suite failure. This patch fixes the bug. Tested on x86-64 Fedora 29. gdb/ChangeLog 2019-07-11 Tom Tromey * python/py-inferior.c (add_thread_object): Don't use thread_obj after it has been moved. --- gdb/ChangeLog | 5 +++++ gdb/python/py-inferior.c | 2 +- 2 files changed, 6 insertions(+), 1 deletion(-) diff --git a/gdb/python/py-inferior.c b/gdb/python/py-inferior.c index bf43012352b..28882221a90 100644 --- a/gdb/python/py-inferior.c +++ b/gdb/python/py-inferior.c @@ -344,7 +344,7 @@ add_thread_object (struct thread_info *tp) return; gdbpy_ref<> event = create_thread_event_object (&new_thread_event_object_type, - (PyObject *) thread_obj.get ()); + (PyObject *) inf_obj); if (event == NULL || evpy_emit_event (event.get (), gdb_py_events.new_thread) < 0) gdbpy_print_stack ();