From patchwork Wed Oct 25 05:27:24 2023 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 8bit X-Patchwork-Submitter: Akihiko Odaki X-Patchwork-Id: 1854740 Return-Path: X-Original-To: incoming@patchwork.ozlabs.org Delivered-To: patchwork-incoming@legolas.ozlabs.org Authentication-Results: legolas.ozlabs.org; dkim=pass (2048-bit key; unprotected) header.d=daynix-com.20230601.gappssmtp.com header.i=@daynix-com.20230601.gappssmtp.com header.a=rsa-sha256 header.s=20230601 header.b=Rmizg1Ad; dkim-atps=neutral Authentication-Results: legolas.ozlabs.org; spf=pass (sender SPF authorized) smtp.mailfrom=nongnu.org (client-ip=209.51.188.17; helo=lists.gnu.org; envelope-from=qemu-devel-bounces+incoming=patchwork.ozlabs.org@nongnu.org; receiver=patchwork.ozlabs.org) Received: from lists.gnu.org (lists.gnu.org [209.51.188.17]) (using TLSv1.2 with cipher ECDHE-ECDSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by legolas.ozlabs.org (Postfix) with ESMTPS id 4SFcwx1XFFz23jh for ; Wed, 25 Oct 2023 16:31:29 +1100 (AEDT) Received: from localhost ([::1] helo=lists1p.gnu.org) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1qvWR1-0003yt-UC; Wed, 25 Oct 2023 01:28:03 -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 1qvWQy-0003we-Bq for qemu-devel@nongnu.org; Wed, 25 Oct 2023 01:28:01 -0400 Received: from mail-pg1-x52a.google.com ([2607:f8b0:4864:20::52a]) by eggs.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_128_GCM_SHA256:128) (Exim 4.90_1) (envelope-from ) id 1qvWQw-0000yB-Pm for qemu-devel@nongnu.org; Wed, 25 Oct 2023 01:28:00 -0400 Received: by mail-pg1-x52a.google.com with SMTP id 41be03b00d2f7-53fbf2c42bfso3967744a12.3 for ; Tue, 24 Oct 2023 22:27:58 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=daynix-com.20230601.gappssmtp.com; s=20230601; t=1698211677; x=1698816477; darn=nongnu.org; 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=HmquHc4fVmtSSJQpb3DzKUGsBKKZi/AhuKxsiBAYgxY=; b=Rmizg1AdjHIGRysfS3kGhEQEL2uUym/KZUkPQpxmlxpHW+aQ5xpM4DEOsTEQ1XYDi8 B5WEGaMs+sfF5GxWOLy/Zu+7ibc5lZbvFLGRzQm5wfso36/Op9L7VtKk7XS7Wr51EkkN wyTdJ1NOTKNMkVkSXWRy9I2Y47ULvvTbSGLPzqL1QQqUmLA8kaA3BvlVliOpnmRL15t7 2raOUhMxWECL4b07nVcG2F/fEQj1IoWATz5oN2ambtlKBPzyBSXFC9+gjn2X1Cuwrpx8 U7aRf+vUx5rlVhdqACk6CKOK6zK7TM6P6BT2qL3Y38FRbC4MPSw3rBkwllvKeGOQffkV FFpA== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20230601; t=1698211677; x=1698816477; 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=HmquHc4fVmtSSJQpb3DzKUGsBKKZi/AhuKxsiBAYgxY=; b=pFhim4/i3isu7diVo0kgOm6cNOCLje0ivOj8xRDAdzQtQEFLSNAYOR14yOkBn/MBqm gVL60aLfDARhOmWOqDNRDRbgq4TPnYTauFLAcxG+x4CIUA4/q/uXQdA4NNdouzzzk7SD ShsEBuF0kMdejTsdfnZ0Jnlgfh5ptX9z8sRN7YZgboRqammaa1pOBZ5Ift+pFooL9rcL ayxZOx/5rqQ2qZqwr1stEv7Czo/8BSDsfGKFGH2rLRSUuUo5tpp3Pi4JDHBMl6YhKxLR iHI5wAAtLHVnKckStdaGi15u1wuKos3KYbsIqW2HfDjSasyr5f/GUzZtukHdkyv8cYwn omuA== X-Gm-Message-State: AOJu0YzXeZSodRI2VYuz2XVyPKfJc45T/bK8+w5nEcl4bmnq3P4gOfkG ExCBz/xMYoNopJoeNaUpa1r/ug== X-Google-Smtp-Source: AGHT+IEUWk6QPlXr4RKAxd5YvNwdrr7COjlT+5JV/VPzAjezg6v7JHWjDD3MnjrOJx0UcNLxorZazw== X-Received: by 2002:a05:6a20:7f8d:b0:161:7a0c:3c37 with SMTP id d13-20020a056a207f8d00b001617a0c3c37mr5837588pzj.5.1698211677267; Tue, 24 Oct 2023 22:27:57 -0700 (PDT) Received: from localhost ([157.82.204.207]) by smtp.gmail.com with UTF8SMTPSA id d18-20020a17090ad3d200b0027d219d3ac6sm9952974pjw.47.2023.10.24.22.27.55 (version=TLS1_3 cipher=TLS_AES_128_GCM_SHA256 bits=128/128); Tue, 24 Oct 2023 22:27:56 -0700 (PDT) From: Akihiko Odaki To: Cc: =?utf-8?q?Alex_Benn=C3=A9e?= , Mikhail Tyutin , Aleksandr Anenkov , qemu-devel@nongnu.org, =?utf-8?q?Philippe_Mathieu-Daud=C3=A9?= , Akihiko Odaki , Richard Henderson Subject: [PATCH v15 02/19] gdbstub: Introduce gdb_find_static_feature() Date: Wed, 25 Oct 2023 14:27:24 +0900 Message-ID: <20231025052744.20697-3-akihiko.odaki@daynix.com> X-Mailer: git-send-email 2.42.0 In-Reply-To: <20231025052744.20697-1-akihiko.odaki@daynix.com> References: <20231025052744.20697-1-akihiko.odaki@daynix.com> MIME-Version: 1.0 Received-SPF: none client-ip=2607:f8b0:4864:20::52a; envelope-from=akihiko.odaki@daynix.com; helo=mail-pg1-x52a.google.com X-Spam_score_int: -18 X-Spam_score: -1.9 X-Spam_bar: - X-Spam_report: (-1.9 / 5.0 requ) BAYES_00=-1.9, DKIM_SIGNED=0.1, DKIM_VALID=-0.1, RCVD_IN_DNSWL_NONE=-0.0001, SPF_HELO_NONE=0.001, SPF_NONE=0.001 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+incoming=patchwork.ozlabs.org@nongnu.org Sender: qemu-devel-bounces+incoming=patchwork.ozlabs.org@nongnu.org This function is useful to determine the number of registers exposed to GDB from the XML name. Signed-off-by: Akihiko Odaki Reviewed-by: Philippe Mathieu-Daudé Reviewed-by: Alex Bennée Reviewed-by: Richard Henderson --- include/exec/gdbstub.h | 8 ++++++++ gdbstub/gdbstub.c | 13 +++++++++++++ 2 files changed, 21 insertions(+) diff --git a/include/exec/gdbstub.h b/include/exec/gdbstub.h index a43aa34dad..7fe00506c7 100644 --- a/include/exec/gdbstub.h +++ b/include/exec/gdbstub.h @@ -44,6 +44,14 @@ void gdb_register_coprocessor(CPUState *cpu, */ int gdbserver_start(const char *port_or_device); +/** + * gdb_find_static_feature() - Find a static feature. + * @xmlname: The name of the XML. + * + * Return: The static feature. + */ +const GDBFeature *gdb_find_static_feature(const char *xmlname); + void gdb_set_stop_cpu(CPUState *cpu); /* in gdbstub-xml.c, generated by scripts/feature_to_c.py */ diff --git a/gdbstub/gdbstub.c b/gdbstub/gdbstub.c index 29540a0284..ae24c4848f 100644 --- a/gdbstub/gdbstub.c +++ b/gdbstub/gdbstub.c @@ -422,6 +422,19 @@ static const char *get_feature_xml(const char *p, const char **newp, return NULL; } +const GDBFeature *gdb_find_static_feature(const char *xmlname) +{ + const GDBFeature *feature; + + for (feature = gdb_static_features; feature->xmlname; feature++) { + if (!strcmp(feature->xmlname, xmlname)) { + return feature; + } + } + + g_assert_not_reached(); +} + static int gdb_read_register(CPUState *cpu, GByteArray *buf, int reg) { CPUClass *cc = CPU_GET_CLASS(cpu);