From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: from simark.ca by simark.ca with LMTP id +aG5CxR2fGoOlSAAWB0awg (envelope-from ) for ; Wed, 12 Aug 2026 09:33:08 -0400 Authentication-Results: simark.ca; dkim=pass (2048-bit key; unprotected) header.d=intel.com header.i=@intel.com header.a=rsa-sha256 header.s=Intel header.b=AMwglkE8; dkim-atps=neutral Received: by simark.ca (Postfix, from userid 112) id 2A8231E033; Wed, 12 Aug 2026 09:33:08 -0400 (EDT) X-Spam-Checker-Version: SpamAssassin 4.0.1 (2024-03-25) on simark.ca X-Spam-Level: X-Spam-Status: No, score=-6.4 required=5.0 tests=ARC_SIGNED,ARC_VALID,BAYES_00, DKIMWL_WL_HIGH,DKIM_SIGNED,DKIM_VALID,DKIM_VALID_AU,MAILING_LIST_MULTI, RCVD_IN_DNSWL_MED autolearn=ham autolearn_force=no version=4.0.1 Received: from vm01.sourceware.org (vm01.sourceware.org [IPv6:2620:52:6:3111::32]) (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 ESMTPS id 68FDC1E033 for ; Wed, 12 Aug 2026 09:33:07 -0400 (EDT) Received: from vm01.sourceware.org (localhost [IPv6:::1]) by sourceware.org (Postfix) with ESMTP id 31ED74BB3BA8 for ; Wed, 12 Aug 2026 13:33:06 +0000 (GMT) DKIM-Filter: OpenDKIM Filter v2.11.0 sourceware.org 31ED74BB3BA8 Authentication-Results: sourceware.org; dkim=pass (2048-bit key, unprotected) header.d=intel.com header.i=@intel.com header.a=rsa-sha256 header.s=Intel header.b=AMwglkE8 Received: from mgamail.intel.com (mgamail.intel.com [192.198.163.11]) by sourceware.org (Postfix) with ESMTPS id 7B8174B9DB6E for ; Wed, 12 Aug 2026 13:29:01 +0000 (GMT) DMARC-Filter: OpenDMARC Filter v1.4.2 sourceware.org 7B8174B9DB6E Authentication-Results: sourceware.org; dmarc=pass (p=none dis=none) header.from=intel.com Authentication-Results: sourceware.org; spf=pass smtp.mailfrom=intel.com ARC-Filter: OpenARC Filter v1.0.0 sourceware.org 7B8174B9DB6E Authentication-Results: sourceware.org; arc=none smtp.remote-ip=192.198.163.11 ARC-Seal: i=1; a=rsa-sha256; d=sourceware.org; s=key; t=1786541341; cv=none; b=Cp9lwSd2Ey7dhE6S71VeSNtciXx1zwn7LPowDT3I6dyaN64fWhsVGFL1/njXFtEnF4FwnM0+pH7UgnxmiTzScVH1HnZRt1a1G0Ogh4ikLN1KLRdgKLmvLAd/5Vg1L0AcZduake3/sWDYSRTQ4+2o9vDngmb08VtRPdeAF2oqDlI= ARC-Message-Signature: i=1; a=rsa-sha256; d=sourceware.org; s=key; t=1786541341; c=relaxed/simple; bh=HIXK1T8orsUZya7zF5KrBvnipTLRFFOZVpRYRQKD1KM=; h=DKIM-Signature:From:To:Subject:Date:Message-ID:MIME-Version; b=v1eM1ZBgGx3cabDFRIy0Z+fy4OKp/V0ETvWMS/q4c34UXf9vOUEQ+t+I5hCN1uZ1Xff369XyW4E94VVgRWCHn8JP3MUFb1BkFSppY2d37e5jHsX+Kw63ZNxqkJjOaP7661BLB6uDbXEZDl2/pcHBEVq+DMI5coEzDrt7VD38EAw= ARC-Authentication-Results: i=1; sourceware.org; dkim=pass (2048-bit key, unprotected) header.d=intel.com header.i=@intel.com header.a=rsa-sha256 header.s=Intel header.b=AMwglkE8 DKIM-Filter: OpenDKIM Filter v2.11.0 sourceware.org 7B8174B9DB6E DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=intel.com; i=@intel.com; q=dns/txt; s=Intel; t=1786541341; x=1818077341; h=from:to:subject:date:message-id:in-reply-to:references: mime-version:content-transfer-encoding; bh=HIXK1T8orsUZya7zF5KrBvnipTLRFFOZVpRYRQKD1KM=; b=AMwglkE8Rr2p7T2qh1Rm3S9uYPOOpz4/zCiqRkHMhssEJIF55ZQ19Rm/ hr3aLXirDPU54QbsvxT+ATnnycgdUXm3kSrOSchnUxx22VVueePC7XBGR /mBmEL15axjdVE6D0BHlLMgvRDWuKKdnRMRpASEBuGKSD+q2SINty5U98 6NFR4cxpObPczAGXJUiuLWJZfUDmQYy3rEytW7KfCPzj0ug5naTVq6rXV ie6V5gOA+khAGBqykfLBgiRRaIBwMo01QHFtnCaeyW6S3uuL3YKw8fAFu pyrhvldH4fl7Nj4Xsp5A6q/4mdym+IL2rMknGpMpe4sIWe3QDXT4axJtx w==; X-CSE-ConnectionGUID: sbMLNYYiQu697if2jp0q6Q== X-CSE-MsgGUID: +nSNdqSCSt2QsKvg0/4jAw== X-IronPort-AV: E=McAfee;i="6800,10657,11872"; a="97683622" X-IronPort-AV: E=Sophos;i="6.25,219,1779174000"; d="scan'208";a="97683622" Received: from orviesa008.jf.intel.com ([10.64.159.148]) by fmvoesa105.fm.intel.com with ESMTP/TLS/ECDHE-RSA-AES256-GCM-SHA384; 12 Aug 2026 06:29:00 -0700 X-CSE-ConnectionGUID: T8HeDFJuTfW+atWeSFF6Vg== X-CSE-MsgGUID: BigkFA6dShGb6Mj8gPjBjg== X-ExtLoop1: 1 X-IronPort-AV: E=Sophos;i="6.25,219,1779174000"; d="scan'208";a="263171359" Received: from gkldtt-dev-004.igk.intel.com (HELO localhost) ([10.123.221.202]) by orviesa008-auth.jf.intel.com with ESMTP/TLS/ECDHE-RSA-AES256-GCM-SHA384; 12 Aug 2026 06:28:58 -0700 From: Markus Metzger To: gdb-patches@sourceware.org Subject: [PATCH v4 16/44] gdb: use process in xfer_partial if inferior_ptid is null_ptid Date: Wed, 12 Aug 2026 15:27:36 +0200 Message-ID: <20260812132805.380163-17-markus.t.metzger@intel.com> X-Mailer: git-send-email 2.53.0 In-Reply-To: <20260812132805.380163-1-markus.t.metzger@intel.com> References: <20260812132805.380163-1-markus.t.metzger@intel.com> MIME-Version: 1.0 Content-Type: text/plain; charset="us-ascii" Content-Transfer-Encoding: 7bit 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: , Errors-To: gdb-patches-bounces~public-inbox=simark.ca@sourceware.org Some objects we want to xfer are per-process and do not necessarily require a thread, e.g. the target description or libraries. If we have not selected a thread, i.e. inferior_ptid is null_ptid, fall back to the process for setting the general thread. This allows fetching those per-process objects. This is in preparation for allowing inferiors without threads. --- gdb/remote.c | 11 ++++++++++- 1 file changed, 10 insertions(+), 1 deletion(-) diff --git a/gdb/remote.c b/gdb/remote.c index 05cda9d0b0c..50e90ad8440 100644 --- a/gdb/remote.c +++ b/gdb/remote.c @@ -12237,8 +12237,17 @@ remote_target::xfer_partial (enum target_object object, int unit_size = gdbarch_addressable_memory_unit_size (current_inferior ()->arch ()); + /* Some objects require a thread, whereas others only require a process. + If we have no current thread, use the current process, instead. */ + ptid_t ptid = inferior_ptid; + if (ptid == null_ptid) + { + inferior *inf = current_inferior (); + if (inf != nullptr) + ptid = ptid_t (inf->pid); + } set_remote_traceframe (); - set_general_thread (inferior_ptid); + set_general_thread (ptid); rs = get_remote_state (); -- 2.43.0 ________________________________________ Intel Deutschland GmbH Registered Address: Dornacher Strasse 1, 85622 Feldkirchen, Germany Tel: +49 (89) 99143-0 www.intel.de Managing Directors: Candice Moore, Jeffrey Schneiderman, Ramachandran Sitaraman Chairperson of the Supervisory Board: Sonja Pierer Registered Seat: Munich Commercial Register B: Amtsgericht Munich HRB 186928 This e-mail and any attachments may contain confidential material for the sole use of the intended recipient(s). Any review or distribution by others is strictly prohibited. If you are not the intended recipient, please contact the sender and delete all copies.