From nobody Wed Oct 1 02:59:12 2025 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=1687882608; cv=none; d=zohomail.com; s=zohoarc; b=TT6JdbsWZ+Hwvcvy8A0XoHBHt9zAx1XLHapdJ79vZzVSDPvGrYUYYRyACJJMoe0rjDYYb42O7Ea3OU64ewpYtu5MdlyaVsy9HEDXvchmWJf6UIQvuqErHO5NjUig3q8t6uJdKtBwfiqCYAlgd1/3QjCuGcqfNeGJV9Y4VtViKDI= ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=zohomail.com; s=zohoarc; t=1687882608; 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=81Ksm8uVTMPnt2+cnp4q2zmd0NQ6258gRF87FUOPn3E=; b=W4wqksoHLtSlxVldodaSIiwk6vyZpomg5hzfVPbN9GmhiCT7LdeEIteYzqZVfUAhMcz0NNNLRtmZr7bFUAFEAmQdMgyR0FYcaiAcNCxmcOFxo/6qVX3pR46H+ECavK4zYlhihXV0zcTv6jBMYvlYzXLcBznAtZOa4S6BLL+GUg4= 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 1687882608743363.9533523352452; Tue, 27 Jun 2023 09:16:48 -0700 (PDT) Received: from localhost ([::1] helo=lists1p.gnu.org) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1qEBMK-00016A-8K; Tue, 27 Jun 2023 12:16:04 -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 1qEBMH-00011M-2x for qemu-devel@nongnu.org; Tue, 27 Jun 2023 12:16:01 -0400 Received: from mail-wm1-x32e.google.com ([2a00:1450:4864:20::32e]) by eggs.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_128_GCM_SHA256:128) (Exim 4.90_1) (envelope-from ) id 1qEBMA-00088u-Gp for qemu-devel@nongnu.org; Tue, 27 Jun 2023 12:16:00 -0400 Received: by mail-wm1-x32e.google.com with SMTP id 5b1f17b1804b1-3fba64d9296so9233325e9.3 for ; Tue, 27 Jun 2023 09:15:53 -0700 (PDT) Received: from zen.linaroharston ([85.9.250.243]) by smtp.gmail.com with ESMTPSA id a16-20020adfdd10000000b00313ef2150dcsm7136675wrm.45.2023.06.27.09.15.49 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Tue, 27 Jun 2023 09:15:50 -0700 (PDT) Received: from zen.lan (localhost [127.0.0.1]) by zen.linaroharston (Postfix) with ESMTP id A75691FFD9; Tue, 27 Jun 2023 17:09:47 +0100 (BST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=linaro.org; s=google; t=1687882552; x=1690474552; 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=81Ksm8uVTMPnt2+cnp4q2zmd0NQ6258gRF87FUOPn3E=; b=e08SsTOg9xG2QdllDTmBh4BxNQ34xDnN0WEvIFDik4Q7Sb+otfh8AvdGlmDM8VbHNe 6U+RgzKtR9LLnI/QKhmLSGLFok6CiCzjWVfnW6TQyPUG4CXBgAmknPzD6NS8c7YB2Xd0 JaQUSBW7A5mGSUC8k2HGpnBJMNVyHM5QdrVcbNNO2d5P53aLflnDBAkGEvzXz7/UBwnk gXssVnwHV7OhGIgVYyBSYY61yDlMJRhdHPGsoEJtqZx5ALSxSktjBtxARKjoCgFbP3X5 9H6aG40AjAoRyiiB+JKSqHpIQfbjwAPh44ThRvVCqMkR6AqSQlb9qRpMcBQ3c1XlWnFE VZSA== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20221208; t=1687882552; x=1690474552; 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=81Ksm8uVTMPnt2+cnp4q2zmd0NQ6258gRF87FUOPn3E=; b=UU8HTAhtzQwDJjr7p58BCqxW9NE8bFZLZFhD1GpWXqFfYEL5lFNXjQSm7lV3MX6Fuv pNHZKTBkjQc8kxkzvfviMaefV7UN5iGp27OWKbpR8SlA2qnPjkvGdWr5fl05AIqhML/B mB364CBNJJelxtuQ9HqFvwsqSgHrCSc4lFs0V7BX/N32c+n7O0l7YoTs1wWgcVefE3Kx E34JRdc+bMVyG/iKQz1FqkiL5MEW5xM2jRAmbGkZG0ZfaaAjQx4Kab6S1jqdTZ9IgA79 8C3s9V0eVqLPbz7VU57u584Mz+4sPTgbCQ8cSyAcSq8rnLYs2Yqrp3eJhsNqoOkuaheU PJ7g== X-Gm-Message-State: AC+VfDyww3LUCxVrTh9T8n0voCnZgVkaWSA+JMK+x+N7J5RNupHgokcL xjq1p2SMkCuRq4cbTrUP0aC3gw== X-Google-Smtp-Source: ACHHUZ6nc3rX2BXRflcFq1kVX7972jAEjN026t2SoqecuUCXuQAlo5JbDlJI8lFBht7RCRJx+bDLFQ== X-Received: by 2002:a05:600c:219a:b0:3fa:993f:acc1 with SMTP id e26-20020a05600c219a00b003fa993facc1mr4264819wme.2.1687882552620; Tue, 27 Jun 2023 09:15:52 -0700 (PDT) From: =?UTF-8?q?Alex=20Benn=C3=A9e?= To: qemu-devel@nongnu.org Cc: Wainer dos Santos Moschetta , Juan Quintela , Thomas Huth , Cleber Rosa , Leonardo Bras , Beraldo Leal , Peter Maydell , Bin Meng , Yanan Wang , Darren Kenny , Alexander Bulekov , Marcel Apfelbaum , Peter Xu , Radoslaw Biernacki , Laurent Vivier , Paolo Bonzini , Eduardo Habkost , qemu-arm@nongnu.org, Stefan Hajnoczi , Richard Henderson , Bandan Das , =?UTF-8?q?Philippe=20Mathieu-Daud=C3=A9?= , =?UTF-8?q?Daniel=20P=2E=20Berrang=C3=A9?= , Alexandre Iooss , Marcin Juszkiewicz , Leif Lindholm , Laurent Vivier , Qiuhao Li , Mahmoud Mandour , Riku Voipio , =?UTF-8?q?Alex=20Benn=C3=A9e?= , Ilya Leoshkevich Subject: [PATCH v3 32/36] gdbstub: Expose gdb_get_process() and gdb_get_first_cpu_in_process() Date: Tue, 27 Jun 2023 17:09:39 +0100 Message-Id: <20230627160943.2956928-33-alex.bennee@linaro.org> X-Mailer: git-send-email 2.39.2 In-Reply-To: <20230627160943.2956928-1-alex.bennee@linaro.org> References: <20230627160943.2956928-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::32e; envelope-from=alex.bennee@linaro.org; helo=mail-wm1-x32e.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: 1687882610676100005 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 Reviewed-by: Philippe Mathieu-Daud=C3=A9 --- gdbstub/internals.h | 2 ++ gdbstub/gdbstub.c | 16 ++++++++-------- 2 files changed, 10 insertions(+), 8 deletions(-) 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