From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: from mga14.intel.com (mga14.intel.com [192.55.52.115]) by sourceware.org (Postfix) with ESMTPS id 158FE385800F for ; Fri, 19 Nov 2021 07:25:25 +0000 (GMT) DMARC-Filter: OpenDMARC Filter v1.4.1 sourceware.org 158FE385800F X-IronPort-AV: E=McAfee;i="6200,9189,10172"; a="234608555" X-IronPort-AV: E=Sophos;i="5.87,246,1631602800"; d="scan'208";a="234608555" Received: from orsmga008.jf.intel.com ([10.7.209.65]) by fmsmga103.fm.intel.com with ESMTP/TLS/ECDHE-RSA-AES256-GCM-SHA384; 18 Nov 2021 23:25:24 -0800 X-IronPort-AV: E=Sophos;i="5.87,246,1631602800"; d="scan'208";a="507800727" Received: from labpc2407.iul.intel.com (HELO localhost) ([172.28.50.61]) by orsmga008-auth.jf.intel.com with ESMTP/TLS/ECDHE-RSA-AES256-GCM-SHA384; 18 Nov 2021 23:25:22 -0800 From: Markus Metzger To: gdb-patches@sourceware.org Subject: [PATCH] gdb, thread-iter: handle null_ptid Date: Fri, 19 Nov 2021 08:23:48 +0100 Message-Id: <20211119072348.2543749-1-markus.t.metzger@intel.com> X-Mailer: git-send-email 2.31.1 MIME-Version: 1.0 Content-Type: text/plain; charset="us-ascii" Content-Transfer-Encoding: 7bit X-Spam-Status: No, score=-8.1 required=5.0 tests=BAYES_00, GIT_PATCH_0, KAM_DMARC_NONE, KAM_DMARC_STATUS, KAM_LAZY_DOMAIN_SECURITY, SPF_HELO_NONE, SPF_NONE, TXREP autolearn=ham autolearn_force=no version=3.4.4 X-Spam-Checker-Version: SpamAssassin 3.4.4 (2020-01-24) on server2.sourceware.org X-BeenThere: gdb-patches@sourceware.org X-Mailman-Version: 2.1.29 Precedence: list List-Id: Gdb-patches mailing list List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Fri, 19 Nov 2021 07:25:29 -0000 Fix a regression introduced by 0618ae41497 gdb: optimize all_matching_threads_iterator and exposed by FAIL: gdb.btrace/enable-new-thread.exp: ... (GDB internal error) When we learn about a new thread in a new inferior, we add both and notify GDB about them, but we do not set inferior_ptid. On the notification, record-btrace tries to enable recording of the new thread and, while reading the configuration, checks whether inferior_ptid is replaying. This causes the new all_matching_threads_iterator to think we want to iterate over a single thread, while in reality we do not really want to iterate over any thread. Handle that case. --- gdb/thread-iter.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/gdb/thread-iter.c b/gdb/thread-iter.c index e56ccd857b0..a2018fd7c10 100644 --- a/gdb/thread-iter.c +++ b/gdb/thread-iter.c @@ -117,7 +117,7 @@ all_matching_threads_iterator::all_matching_threads_iterator if (m_inf != nullptr) m_thr = &m_inf->thread_list.front (); } - else + else if (filter_ptid != null_ptid) { /* Iterate on a single thread. */ m_mode = mode::SINGLE_THREAD; -- 2.31.1 Intel Deutschland GmbH Registered Address: Am Campeon 10, 85579 Neubiberg, Germany Tel: +49 89 99 8853-0, www.intel.de Managing Directors: Christin Eisenschmid, Sharon Heck, Tiffany Doon Silva Chairperson of the Supervisory Board: Nicole Lau Registered Office: Munich Commercial Register: Amtsgericht Muenchen HRB 186928