From nobody Tue Feb 10 20:14:23 2026 Delivered-To: importer@patchew.org Authentication-Results: mx.zohomail.com; dkim=pass; spf=pass (zohomail.com: domain of gnu.org designates 209.51.188.17 as permitted sender) smtp.mailfrom=qemu-devel-bounces+importer=patchew.org@nongnu.org; dmarc=pass(p=none dis=none) header.from=linaro.org ARC-Seal: i=1; a=rsa-sha256; t=1688392519; cv=none; d=zohomail.com; s=zohoarc; b=Z3ofFAplCXPnQdKj+MlKOmSW+RyVBoLhmla9BSjCpZGcpWH+eOCGMMXbwdqGSvOFd8PxB1lPQLtcWAFCJ/AVVBSG1DGey2BwSHzW0FpJdMupvTwGeSeFQcYtX1NcEi4R4+CcouDCKs/8k2tDrqGns8j0swU8V9VIHGcgCp5CkDw= ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=zohomail.com; s=zohoarc; t=1688392519; h=Content-Type:Content-Transfer-Encoding:Cc:Date:From:In-Reply-To:List-Subscribe:List-Post:List-Id:List-Archive:List-Help:List-Unsubscribe:MIME-Version:Message-ID:References:Sender:Subject:To; bh=Sa+wfZu+Nea0/Jly4iHaBSQb1C7qOF4WA65LCb+E1bE=; b=Es3GVT47RzxsMxbNtW5F1OlkSOpEDWds63yYfkVN0+GlOYFEM1BdeZR4+byueI6e6ReYW+seVOQQKnjX95uSxgLyZwErTpIVhZb6XHryy/uPxu9acFMXM1gjaTofEVWfDL5qvzcshPb3CF5uWl1R7NPerWOwK56HUOKWy3lZ4d8= ARC-Authentication-Results: i=1; mx.zohomail.com; dkim=pass; spf=pass (zohomail.com: domain of gnu.org designates 209.51.188.17 as permitted sender) smtp.mailfrom=qemu-devel-bounces+importer=patchew.org@nongnu.org; dmarc=pass header.from= (p=none dis=none) Return-Path: Received: from lists.gnu.org (lists.gnu.org [209.51.188.17]) by mx.zohomail.com with SMTPS id 1688392519908210.21100005259586; Mon, 3 Jul 2023 06:55:19 -0700 (PDT) Received: from localhost ([::1] helo=lists1p.gnu.org) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1qGK00-0000r7-7F; Mon, 03 Jul 2023 09:53:52 -0400 Received: from eggs.gnu.org ([2001:470:142:3::10]) by lists.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.90_1) (envelope-from ) id 1qGJzj-0000YG-HY for qemu-devel@nongnu.org; Mon, 03 Jul 2023 09:53:35 -0400 Received: from mail-wr1-x42f.google.com ([2a00:1450:4864:20::42f]) by eggs.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_128_GCM_SHA256:128) (Exim 4.90_1) (envelope-from ) id 1qGJzh-00083P-PJ for qemu-devel@nongnu.org; Mon, 03 Jul 2023 09:53:35 -0400 Received: by mail-wr1-x42f.google.com with SMTP id ffacd0b85a97d-3110ab7110aso5171568f8f.3 for ; Mon, 03 Jul 2023 06:53:33 -0700 (PDT) Received: from zen.linaroharston ([85.9.250.243]) by smtp.gmail.com with ESMTPSA id a11-20020a056000050b00b003110dc7f408sm25801998wrf.41.2023.07.03.06.53.29 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Mon, 03 Jul 2023 06:53:31 -0700 (PDT) Received: from zen.lan (localhost [127.0.0.1]) by zen.linaroharston (Postfix) with ESMTP id B22551FFD9; Mon, 3 Jul 2023 14:44:31 +0100 (BST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=linaro.org; s=google; t=1688392412; x=1690984412; h=content-transfer-encoding:mime-version:references:in-reply-to :message-id:date:subject:cc:to:from:from:to:cc:subject:date :message-id:reply-to; bh=Sa+wfZu+Nea0/Jly4iHaBSQb1C7qOF4WA65LCb+E1bE=; b=H6+sjVpMtyJgDkrpuWBa8TZDL8eqFuD3F0QZwLyApRSmCMwf8vYPtM+56oxmLAYOky zOUiqsu/obBJYrM4OhKl4BnxOfWCp3/mqQtUlfSfUFxq3DtwlB5rywBJOuWXlPEWkliu KKquyfA3biRf/j0oZ8GOapyU1VsBRJ92Obcsp3xO2vcwpQvSsnqkdb7g8VQBNH6YQ0nW utt0Be4LcpQGoEf7K8C1IMuH6nBuIWyexi+mSsPBQdkVhe+XwK3Y8RSn1Mo1Iv8cAr0j u9ak4XkFS83RaXmjcD4LfnnEo2dtKcARWSa35QrYeRbexnwDwvA5FRATVp1kwisEB37d T1KQ== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20221208; t=1688392412; x=1690984412; h=content-transfer-encoding:mime-version:references:in-reply-to :message-id:date:subject:cc:to:from:x-gm-message-state:from:to:cc :subject:date:message-id:reply-to; bh=Sa+wfZu+Nea0/Jly4iHaBSQb1C7qOF4WA65LCb+E1bE=; b=XCpc1n5RpB40U5vzuQUO8Jwe/2fhGoVX8oG+3wXRTTb+8rLf4teOAAsdRNZk6uBnuR myqjhr5jpwNhuvG+JfXOp3d+9u422oXBBGWLWOojJAJbIDDywS24HeIOfVBz99Wh+omz skgvxOBugkjdmByskiW6YL8vAohbo8rTPqHmxNphWFvwk6iJNLhqeT/5OBVYHLkKT2DL 75V/C/dNYxItelrd89NeF0mdWQJsdk4Ja1SbWXPpuZ3o/y7EMFu0NtlL1pZTrAzuycil Pz4Fz6RkA9EEuNSBecx/nOY97mKgd4qeca+to9FSXqHAUIDkP123Xf+kngCFHw4Cibz4 x4Yg== X-Gm-Message-State: ABy/qLZbH0CfOJgiq6oAml+ijoD+y7uze0n0tf/+19xXhWVw+5pyZy7R UeGf6p5FZJ6whTJ5AhDRwFZ1uQ== X-Google-Smtp-Source: APBJJlGaR7W1Y0I+l++kxgWd/Nut2Fv4fGcybvp/ptVolf1Cg2GXfwLoJPs3n0a+UPTyBUr17VJPpQ== X-Received: by 2002:a05:6000:1250:b0:313:e526:f6dc with SMTP id j16-20020a056000125000b00313e526f6dcmr8256973wrx.48.1688392412482; Mon, 03 Jul 2023 06:53:32 -0700 (PDT) From: =?UTF-8?q?Alex=20Benn=C3=A9e?= To: qemu-devel@nongnu.org Cc: richard.henderson@linaro.org, Ilya Leoshkevich , =?UTF-8?q?Alex=20Benn=C3=A9e?= , =?UTF-8?q?Philippe=20Mathieu-Daud=C3=A9?= Subject: [PULL 34/38] gdbstub: Expose gdb_get_process() and gdb_get_first_cpu_in_process() Date: Mon, 3 Jul 2023 14:44:23 +0100 Message-Id: <20230703134427.1389440-35-alex.bennee@linaro.org> X-Mailer: git-send-email 2.39.2 In-Reply-To: <20230703134427.1389440-1-alex.bennee@linaro.org> References: <20230703134427.1389440-1-alex.bennee@linaro.org> MIME-Version: 1.0 Content-Type: text/plain; charset="utf-8" Content-Transfer-Encoding: quoted-printable Received-SPF: pass (zohomail.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; Received-SPF: pass client-ip=2a00:1450:4864:20::42f; envelope-from=alex.bennee@linaro.org; helo=mail-wr1-x42f.google.com X-Spam_score_int: -20 X-Spam_score: -2.1 X-Spam_bar: -- X-Spam_report: (-2.1 / 5.0 requ) BAYES_00=-1.9, DKIM_SIGNED=0.1, DKIM_VALID=-0.1, DKIM_VALID_AU=-0.1, DKIM_VALID_EF=-0.1, RCVD_IN_DNSWL_NONE=-0.0001, SPF_HELO_NONE=0.001, SPF_PASS=-0.001, T_SCC_BODY_TEXT_LINE=-0.01 autolearn=ham autolearn_force=no X-Spam_action: no action X-BeenThere: qemu-devel@nongnu.org X-Mailman-Version: 2.1.29 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-bounces+importer=patchew.org@nongnu.org X-ZohoMail-DKIM: pass (identity @linaro.org) X-ZM-MESSAGEID: 1688392521918100001 From: Ilya Leoshkevich These functions will be needed by user-target.c in order to retrieve the name of the executable. Reviewed-by: Alex Benn=C3=A9e Signed-off-by: Ilya Leoshkevich Message-Id: <20230621203627.1808446-5-iii@linux.ibm.com> Signed-off-by: Alex Benn=C3=A9e Message-Id: <20230630180423.558337-35-alex.bennee@linaro.org> diff --git a/gdbstub/internals.h b/gdbstub/internals.h index 33d21d6488..25e4d5eeaa 100644 --- a/gdbstub/internals.h +++ b/gdbstub/internals.h @@ -129,6 +129,8 @@ void gdb_read_byte(uint8_t ch); */ bool gdb_got_immediate_ack(void); /* utility helpers */ +GDBProcess *gdb_get_process(uint32_t pid); +CPUState *gdb_get_first_cpu_in_process(GDBProcess *process); CPUState *gdb_first_attached_cpu(void); void gdb_append_thread_id(CPUState *cpu, GString *buf); int gdb_get_cpu_index(CPUState *cpu); diff --git a/gdbstub/gdbstub.c b/gdbstub/gdbstub.c index 49143c7d83..ce3e4a2671 100644 --- a/gdbstub/gdbstub.c +++ b/gdbstub/gdbstub.c @@ -211,7 +211,7 @@ static uint32_t gdb_get_cpu_pid(CPUState *cpu) return cpu->cluster_index + 1; } =20 -static GDBProcess *gdb_get_process(uint32_t pid) +GDBProcess *gdb_get_process(uint32_t pid) { int i; =20 @@ -247,7 +247,7 @@ static CPUState *find_cpu(uint32_t thread_id) return NULL; } =20 -static CPUState *get_first_cpu_in_process(GDBProcess *process) +CPUState *gdb_get_first_cpu_in_process(GDBProcess *process) { CPUState *cpu; =20 @@ -325,7 +325,7 @@ static CPUState *gdb_get_cpu(uint32_t pid, uint32_t tid) return NULL; } =20 - return get_first_cpu_in_process(process); + return gdb_get_first_cpu_in_process(process); } else { /* a specific thread */ cpu =3D find_cpu(tid); @@ -354,7 +354,7 @@ static const char *get_feature_xml(const char *p, const= char **newp, size_t len; int i; const char *name; - CPUState *cpu =3D get_first_cpu_in_process(process); + CPUState *cpu =3D gdb_get_first_cpu_in_process(process); CPUClass *cc =3D CPU_GET_CLASS(cpu); =20 len =3D 0; @@ -490,7 +490,7 @@ void gdb_register_coprocessor(CPUState *cpu, =20 static void gdb_process_breakpoint_remove_all(GDBProcess *p) { - CPUState *cpu =3D get_first_cpu_in_process(p); + CPUState *cpu =3D gdb_get_first_cpu_in_process(p); =20 while (cpu) { gdb_breakpoint_remove_all(cpu); @@ -647,7 +647,7 @@ static int gdb_handle_vcont(const char *p) return -EINVAL; } =20 - cpu =3D get_first_cpu_in_process(process); + cpu =3D gdb_get_first_cpu_in_process(process); while (cpu) { if (newstates[cpu->cpu_index] =3D=3D 1) { newstates[cpu->cpu_index] =3D cur_action; @@ -1270,7 +1270,7 @@ static void handle_v_attach(GArray *params, void *use= r_ctx) goto cleanup; } =20 - cpu =3D get_first_cpu_in_process(process); + cpu =3D gdb_get_first_cpu_in_process(process); if (!cpu) { goto cleanup; } @@ -1393,7 +1393,7 @@ static void handle_query_curr_tid(GArray *params, voi= d *user_ctx) * first thread). */ process =3D gdb_get_cpu_process(gdbserver_state.g_cpu); - cpu =3D get_first_cpu_in_process(process); + cpu =3D gdb_get_first_cpu_in_process(process); g_string_assign(gdbserver_state.str_buf, "QC"); gdb_append_thread_id(cpu, gdbserver_state.str_buf); gdb_put_strbuf(); --=20 2.39.2