From nobody Fri Nov 7 09:08:04 2025 Delivered-To: importer@patchew.org Received-SPF: pass (zoho.com: domain of gnu.org designates 209.51.188.17 as permitted sender) client-ip=209.51.188.17; envelope-from=qemu-devel-bounces+importer=patchew.org@nongnu.org; helo=lists.gnu.org; Authentication-Results: mx.zohomail.com; dkim=fail; spf=pass (zoho.com: domain of gnu.org designates 209.51.188.17 as permitted sender) smtp.mailfrom=qemu-devel-bounces+importer=patchew.org@nongnu.org; dmarc=fail(p=none dis=none) header.from=linaro.org Return-Path: Received: from lists.gnu.org (lists.gnu.org [209.51.188.17]) by mx.zohomail.com with SMTPS id 154746712191989.12143009410727; Mon, 14 Jan 2019 03:58:41 -0800 (PST) Received: from localhost ([127.0.0.1]:57929 helo=lists.gnu.org) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1gj0t6-0007eH-Rp for importer@patchew.org; Mon, 14 Jan 2019 06:58:40 -0500 Received: from eggs.gnu.org ([209.51.188.92]:47208) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1gj0rI-0006YB-MA for qemu-devel@nongnu.org; Mon, 14 Jan 2019 06:56:49 -0500 Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71) (envelope-from ) id 1gj0rH-0005sE-9R for qemu-devel@nongnu.org; Mon, 14 Jan 2019 06:56:48 -0500 Received: from mail-wr1-x441.google.com ([2a00:1450:4864:20::441]:42483) by eggs.gnu.org with esmtps (TLS1.0:RSA_AES_128_CBC_SHA1:16) (Exim 4.71) (envelope-from ) id 1gj0rH-0005rM-12 for qemu-devel@nongnu.org; Mon, 14 Jan 2019 06:56:47 -0500 Received: by mail-wr1-x441.google.com with SMTP id q18so22473904wrx.9 for ; Mon, 14 Jan 2019 03:56:46 -0800 (PST) Received: from orth.archaic.org.uk (orth.archaic.org.uk. [81.2.115.148]) by smtp.gmail.com with ESMTPSA id 125sm47835842wmm.26.2019.01.14.03.56.44 (version=TLS1_2 cipher=ECDHE-RSA-AES128-SHA bits=128/128); Mon, 14 Jan 2019 03:56:45 -0800 (PST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=linaro.org; s=google; h=from:to:cc:subject:date:message-id:in-reply-to:references :mime-version:content-transfer-encoding; bh=z6np4aEV6kepum56jAKTLhBF7tWQywONgDj9IEtWngY=; b=j/ASMQEzYA/KqX2bLdRQVPbBv5RgluLJ+2ygfaJhmGoHogIMOg4Y25Pp5MjLwO3sng 1dF+C4IF5MrWuPRCt6O/E2RRlpwIt75HmsU8ZI/Q5q5rlD1dMM4qmteBypTCLWMWncfz q/WTpTODNVY1AeHH6b+DuGEdnJoWPJtnDW/v0= X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20161025; h=x-gm-message-state:from:to:cc:subject:date:message-id:in-reply-to :references:mime-version:content-transfer-encoding; bh=z6np4aEV6kepum56jAKTLhBF7tWQywONgDj9IEtWngY=; b=AMtzHWL/JeTj6Nibi+hfyssFWFhpBebtMqC1eIWhbG3SqqdC5LG1QhOIB9uye76ImB FZFUZgQYXpYczwyD8d8JAWj0iFppzytJTgd0hAFsAI+SRaUQwH6RWsq53x1VgtzcR9XM 3aOGHx4OGifJTGIgszEFL0puYl2g/pmDG+a5Ob+v6WhN34lRgL6j1j65PAa7564i83y0 km/0D2LuFzk/U/MEzyOfxW95yVnfzFuB3RL29+7sS2hLc1SffUe1tQLVWlO6WxylNwdi FLXN+qAJ2YMW0vSrfM8xQ+A/JjXr1eVIADP50dlHA7BCWTQty8Q/A1Ri49vq62nScn7g fWcg== X-Gm-Message-State: AJcUukc0E8hRol9LEyLIrF2+OXAUwOQm0Vxub5duNlpkpkdt5tHiIaVh IJHVspuNX1d2cbCgpTA0bsZGsX14SY2Kwg== X-Google-Smtp-Source: ALg8bN7FRXqygkdsb5DMj9eJUCkVMcFU6raPLzB30OfqlPW4C5AYqetc2FBjnqzwv604MIrWkfBTBw== X-Received: by 2002:adf:8464:: with SMTP id 91mr25199030wrf.251.1547467006185; Mon, 14 Jan 2019 03:56:46 -0800 (PST) From: Peter Maydell To: qemu-arm@nongnu.org, qemu-devel@nongnu.org Date: Mon, 14 Jan 2019 11:56:37 +0000 Message-Id: <20190114115637.6335-5-peter.maydell@linaro.org> X-Mailer: git-send-email 2.20.1 In-Reply-To: <20190114115637.6335-1-peter.maydell@linaro.org> References: <20190114115637.6335-1-peter.maydell@linaro.org> MIME-Version: 1.0 Content-Transfer-Encoding: quoted-printable X-detected-operating-system: by eggs.gnu.org: Genre and OS details not recognized. X-Received-From: 2a00:1450:4864:20::441 Subject: [Qemu-devel] [PATCH v2 4/4] gdbstub: Simplify gdb_get_cpu_pid() to use cpu->cluster_index X-BeenThere: qemu-devel@nongnu.org X-Mailman-Version: 2.1.21 Precedence: list List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Cc: Eduardo Habkost , Peter Crosthwaite , Alistair Francis , Richard Henderson , "Emilio G . Cota" , "Edgar E. Iglesias" , Paolo Bonzini , Aleksandar Markovic Errors-To: qemu-devel-bounces+importer=patchew.org@nongnu.org Sender: "Qemu-devel" X-ZohoMail-DKIM: fail (Header signature does not verify) Content-Type: text/plain; charset="utf-8" Now we're keeping the cluster index in the CPUState, we don't need to jump through hoops in gdb_get_cpu_pid() to find the associated cluster object. Signed-off-by: Peter Maydell Reviewed-by: Luc Michel --- gdbstub.c | 48 +++++------------------------------------------- 1 file changed, 5 insertions(+), 43 deletions(-) diff --git a/gdbstub.c b/gdbstub.c index bfc7afb5096..5d6cbea9d35 100644 --- a/gdbstub.c +++ b/gdbstub.c @@ -644,50 +644,12 @@ static int memtox(char *buf, const char *mem, int len) =20 static uint32_t gdb_get_cpu_pid(const GDBState *s, CPUState *cpu) { -#ifndef CONFIG_USER_ONLY - gchar *path, *name =3D NULL; - Object *obj; - CPUClusterState *cluster; - uint32_t ret; - - path =3D object_get_canonical_path(OBJECT(cpu)); - - if (path =3D=3D NULL) { - /* Return the default process' PID */ - ret =3D s->processes[s->process_num - 1].pid; - goto out; - } - - name =3D object_get_canonical_path_component(OBJECT(cpu)); - assert(name !=3D NULL); - - /* - * Retrieve the CPU parent path by removing the last '/' and the CPU n= ame - * from the CPU canonical path. - */ - path[strlen(path) - strlen(name) - 1] =3D '\0'; - - obj =3D object_resolve_path_type(path, TYPE_CPU_CLUSTER, NULL); - - if (obj =3D=3D NULL) { - /* Return the default process' PID */ - ret =3D s->processes[s->process_num - 1].pid; - goto out; - } - - cluster =3D CPU_CLUSTER(obj); - ret =3D cluster->cluster_id + 1; - -out: - g_free(name); - g_free(path); - - return ret; - -#else /* TODO: In user mode, we should use the task state PID */ - return s->processes[s->process_num - 1].pid; -#endif + if (cpu->cluster_index =3D=3D UNASSIGNED_CLUSTER_INDEX) { + /* Return the default process' PID */ + return s->processes[s->process_num - 1].pid; + } + return cpu->cluster_index + 1; } =20 static GDBProcess *gdb_get_process(const GDBState *s, uint32_t pid) --=20 2.20.1