From nobody Sat Sep 28 22:46:03 2024 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 (209.51.188.17 [209.51.188.17]) by mx.zohomail.com with SMTPS id 154870171842484.01166925130917; Mon, 28 Jan 2019 10:55:18 -0800 (PST) Received: from localhost ([127.0.0.1]:37019 helo=lists.gnu.org) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1goC3s-0004BO-CY for importer@patchew.org; Mon, 28 Jan 2019 13:55:12 -0500 Received: from eggs.gnu.org ([209.51.188.92]:41232) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1goBNe-0003AN-Jg for qemu-devel@nongnu.org; Mon, 28 Jan 2019 13:11:35 -0500 Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71) (envelope-from ) id 1goBNc-0000Z9-RJ for qemu-devel@nongnu.org; Mon, 28 Jan 2019 13:11:34 -0500 Received: from mail-wm1-x334.google.com ([2a00:1450:4864:20::334]:39124) by eggs.gnu.org with esmtps (TLS1.0:RSA_AES_128_CBC_SHA1:16) (Exim 4.71) (envelope-from ) id 1goBNc-0000RX-HU for qemu-devel@nongnu.org; Mon, 28 Jan 2019 13:11:32 -0500 Received: by mail-wm1-x334.google.com with SMTP id y8so14923697wmi.4 for ; Mon, 28 Jan 2019 10:11:24 -0800 (PST) Received: from orth.archaic.org.uk (orth.archaic.org.uk. [81.2.115.148]) by smtp.gmail.com with ESMTPSA id b18sm97910681wrw.83.2019.01.28.10.11.21 for (version=TLS1_2 cipher=ECDHE-RSA-AES128-GCM-SHA256 bits=128/128); Mon, 28 Jan 2019 10:11:22 -0800 (PST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=linaro.org; s=google; h=from:to:subject:date:message-id:in-reply-to:references:mime-version :content-transfer-encoding; bh=nwGwMpkRmjjdlLHlXvvGrcmomf1JI1Bu3RSQ3qEja4k=; b=NreYdD4d896/HpdbtNpfU3CfXxu2t2+UeUoKTijBCTylJKgSoIf0hano+ykcMIivNc /rcwlwK6b7wsrCCAAlgg1gzoyzqMDyNqA3UcivfNDwBtK1dkZZQ96+uL/CtCLmmA/2qW Sfg0x1el+AVD51X8b9gpoKHeU0MuU/huLX1oM= X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20161025; h=x-gm-message-state:from:to:subject:date:message-id:in-reply-to :references:mime-version:content-transfer-encoding; bh=nwGwMpkRmjjdlLHlXvvGrcmomf1JI1Bu3RSQ3qEja4k=; b=gFGLjMW5YIDH5g6cDVMcBHGXgs5MCcfQaLfJTEtTt+U3A+R90cTsA7N4AlhpkJ4TXT ikYETCWHJC6C6LxYv6yFiuDidbS0R/h/VcZkQ1d3rxY9xqOZKyr4B/SEtU7av4ji2dhW X0vEVSguvXQYnf/mUdz+KVfBJ+PuOzTfbcdf5xAPYNU2mpUuZPgudRuXz9Le1/ZuLsNS YDSVJc6dnvYvtF5Ozhw+S2wJ17xuRNmF+yAlvwMkf2D9VVsr3BsCP+dCIndGKJm0mD0Z c4uWnKIHdCvwOlJDD+LQ8IR+v8d8rgbA7MnSPzPxuaFFymNuX3RL066p1C3MEiH3VT2U vF0A== X-Gm-Message-State: AJcUukcNxLkyY8S/vHwSOqAUwAe7RMpo/49hJ3rXfdSjhAONpP67HLz3 qyk9Fb5ZL62/jdxhrv0cPiJ/0YnCqQ5uRw== X-Google-Smtp-Source: ALg8bN40El3H4euxZYf7xLdCpN/diEvv7BInxsznNhqveSEDNDcFnzehZhZlaAgy9MXqPj1m+lUvOg== X-Received: by 2002:a7b:c04e:: with SMTP id u14mr18475699wmc.113.1548699082979; Mon, 28 Jan 2019 10:11:22 -0800 (PST) From: Peter Maydell To: qemu-devel@nongnu.org Date: Mon, 28 Jan 2019 18:10:47 +0000 Message-Id: <20190128181047.20781-27-peter.maydell@linaro.org> X-Mailer: git-send-email 2.20.1 In-Reply-To: <20190128181047.20781-1-peter.maydell@linaro.org> References: <20190128181047.20781-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::334 Subject: [Qemu-devel] [PULL 26/26] 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: , 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 Reviewed-by: Edgar E. Iglesias Message-id: 20190121152218.9592-5-peter.maydell@linaro.org --- gdbstub.c | 48 +++++------------------------------------------- 1 file changed, 5 insertions(+), 43 deletions(-) diff --git a/gdbstub.c b/gdbstub.c index d4cc6ecf99b..3129b5c2842 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