From patchwork Tue Mar 7 21:21:15 2023 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 8bit X-Patchwork-Submitter: =?utf-8?q?Alex_Benn=C3=A9e?= X-Patchwork-Id: 659850 Delivered-To: patch@linaro.org Received: by 2002:adf:a3c6:0:0:0:0:0 with SMTP id m6csp2606135wrb; Tue, 7 Mar 2023 13:23:58 -0800 (PST) X-Google-Smtp-Source: AK7set/E0fcEwjs4720HT/+KpEpJeOFH3JADIGWjmeFABNowAFRDMxt4HL7aTcFmYd5pjh20lnOq X-Received: by 2002:a05:622a:1899:b0:3bf:cac4:a3a1 with SMTP id v25-20020a05622a189900b003bfcac4a3a1mr470912qtc.66.1678224238203; Tue, 07 Mar 2023 13:23:58 -0800 (PST) ARC-Seal: i=1; a=rsa-sha256; t=1678224238; cv=none; d=google.com; s=arc-20160816; b=hepGmuoHbGh8ofeoGjsjO/fT1kh9RaHaYq0qsiNWgITd73pcAv0/fH2DQ0MHdTmVXb s7pkdz2DuJxTuuY+1IWaNG+aG5SEl3H9QQOBgJ9x+X3gyYH9Q7PqWjP4MyahdwJ4GyjG dwJ7Y9t/VfrIR2C1ni5GZb2GWUpqqjp5yTZhPNIFtb3ATueKc/l0r7Qcd8DKMVSWg/Kv RKk29QjIXgPtYoEPed2ybMoEcZ7RkWiacgeHnsGBby7Y+/knfxvBzCBJImmuJ4FzB2Y+ ysavw17OS8nERWFjyjabxb5QZrLvMb0pZ6/tfJ0hQ8+S29HV+N6M8L0UMKv4yLQIHmBy mSEA== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=sender:errors-to:list-subscribe:list-help:list-post:list-archive :list-unsubscribe:list-id:precedence:content-transfer-encoding :mime-version:references:in-reply-to:message-id:date:subject:cc:to :from:dkim-signature; bh=kkuXa4ph0rByhldOH7f3Geqb2lsU7GAApDQxnDBF41U=; b=lTvKofJ8+Lr0P/TK0VNHhsZLIr3sd9LhUiaKRHuvSEFxg/0AUqWdZq9aGrs8YTXVfv 0D4sc80lC8MGn5cfVaZBRZPj8e8hciGacXqu398vChWEhTgwFh6v0gu2gr9u4TPip+I4 8fOjfZIWPv+naNsdSBphXvbjV2I2njATdfGAsLAFysbQ2fXnoutalAnWqSU7btp/I9Ab o5OBnMQoBXeSrAZ0nOGR87nFcPBjn53aAOoLjGmHPdK8E4gJzyAfINgFSD2BYkabyUpa KIOcd1v0tOsuqcR0zraTg9R5EFLHBYh2I3wb5Wj7Y4tLRZgrXjjTqupYuszdgYO9Cyn4 UuBw== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@linaro.org header.s=google header.b=U1Of7TxJ; spf=pass (google.com: domain of qemu-devel-bounces+patch=linaro.org@nongnu.org designates 209.51.188.17 as permitted sender) smtp.mailfrom="qemu-devel-bounces+patch=linaro.org@nongnu.org"; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=linaro.org Return-Path: Received: from lists.gnu.org (lists.gnu.org. [209.51.188.17]) by mx.google.com with ESMTPS id c12-20020ac85a8c000000b003bfb4ddc5c7si10786942qtc.601.2023.03.07.13.23.58 for (version=TLS1_2 cipher=ECDHE-ECDSA-CHACHA20-POLY1305 bits=256/256); Tue, 07 Mar 2023 13:23:58 -0800 (PST) Received-SPF: pass (google.com: domain of qemu-devel-bounces+patch=linaro.org@nongnu.org designates 209.51.188.17 as permitted sender) client-ip=209.51.188.17; Authentication-Results: mx.google.com; dkim=pass header.i=@linaro.org header.s=google header.b=U1Of7TxJ; spf=pass (google.com: domain of qemu-devel-bounces+patch=linaro.org@nongnu.org designates 209.51.188.17 as permitted sender) smtp.mailfrom="qemu-devel-bounces+patch=linaro.org@nongnu.org"; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=linaro.org Received: from localhost ([::1] helo=lists1p.gnu.org) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1pZekw-0001pb-9w; Tue, 07 Mar 2023 16:21:58 -0500 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 1pZekm-0001fc-Ky for qemu-devel@nongnu.org; Tue, 07 Mar 2023 16:21:48 -0500 Received: from mail-wm1-x334.google.com ([2a00:1450:4864:20::334]) by eggs.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_128_GCM_SHA256:128) (Exim 4.90_1) (envelope-from ) id 1pZekj-00082V-LP for qemu-devel@nongnu.org; Tue, 07 Mar 2023 16:21:48 -0500 Received: by mail-wm1-x334.google.com with SMTP id p26so8665960wmc.4 for ; Tue, 07 Mar 2023 13:21:45 -0800 (PST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=linaro.org; s=google; t=1678224104; 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=kkuXa4ph0rByhldOH7f3Geqb2lsU7GAApDQxnDBF41U=; b=U1Of7TxJjIXEFZ9YXGqAwZ5whUE7fjfK+20eXKxBhLZlQnpRNcVwjCz2/Wajb4i1uS e4dt+/SspZUGff0nuiWjJym5cfa0YYwTLpNiMjme685kPC7xa0dGAw2gHAHaRMlnfhtl uRRSwQFrYJWMbM+5Uu/ZkBdITmMuigHn39vPJKMEwsydNl+rBbbu8mmHo+l7vTXJkyuP xi+Zb2ewFtiKcNZq+CBOBnlcFiQrlv2R+pqOyACUH1dP4dvNRIEXzyeMW7iGs/cQVfjL 9GMcl/1lRrGWNeBLNTvC8g4yiuLsCaSFPXRp2StQ6ypmwD3RnAjijhXTxvgS7KtCNmV6 giIA== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20210112; t=1678224104; 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=kkuXa4ph0rByhldOH7f3Geqb2lsU7GAApDQxnDBF41U=; b=DcjdbEzmFVKV6guvuT9gg6kwk7y8qivgQl7jC9xHeNa0Cf47oB8Li/SzYm1/m0iRJR T0i8opFgvvjRR9TtZA31f4+RPcXBAFktpDjCc+u49P9xQ22Eq2dtnx1rSF4ovEsDhfab Q/hlGYm4I/pLvgw884xTeqHdLuA5ly+LG495StO3aMBinq4WQg/pQ+Xd8Lg1RIKhdYMZ Qte60CU+7BoDPnSpk5AG9gh+iUv3Ii58WJR6zICQ8pDD4BS8dtzDoDfn5t4iBsxQsZwH sDreRXo3E/O/Fzu8gjvFDVmLQzKMzRIRFLzfidV35eT2bNZIi8RBAPendUCAJMFds3EZ pf6Q== X-Gm-Message-State: AO0yUKXNMCwOEZPYoQqZQfq2qhtq6GEZsALaDc/el9AIE9m+IzJQfBVG jgoHAVBmvav3ErX4GlwB70YY/wdTHPMT4L/wpRM= X-Received: by 2002:a05:600c:35c6:b0:3eb:42ab:7b5 with SMTP id r6-20020a05600c35c600b003eb42ab07b5mr14614980wmq.1.1678224104092; Tue, 07 Mar 2023 13:21:44 -0800 (PST) Received: from zen.linaroharston ([85.9.250.243]) by smtp.gmail.com with ESMTPSA id l5-20020a05600c16c500b003e20fa01a86sm13679647wmn.13.2023.03.07.13.21.40 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Tue, 07 Mar 2023 13:21:41 -0800 (PST) Received: from zen.lan (localhost [127.0.0.1]) by zen.linaroharston (Postfix) with ESMTP id C86B01FFBE; Tue, 7 Mar 2023 21:21:39 +0000 (GMT) From: =?utf-8?q?Alex_Benn=C3=A9e?= To: qemu-devel@nongnu.org Cc: peter.maydell@linaro.org, =?utf-8?q?Alex_Benn=C3=A9e?= , Richard Henderson , =?utf-8?q?Philippe_Mathie?= =?utf-8?q?u-Daud=C3=A9?= Subject: [PULL 06/30] gdbstub: move GDBState to shared internals header Date: Tue, 7 Mar 2023 21:21:15 +0000 Message-Id: <20230307212139.883112-7-alex.bennee@linaro.org> X-Mailer: git-send-email 2.39.2 In-Reply-To: <20230307212139.883112-1-alex.bennee@linaro.org> References: <20230307212139.883112-1-alex.bennee@linaro.org> MIME-Version: 1.0 Received-SPF: pass client-ip=2a00:1450:4864:20::334; envelope-from=alex.bennee@linaro.org; helo=mail-wm1-x334.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 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+patch=linaro.org@nongnu.org Sender: qemu-devel-bounces+patch=linaro.org@nongnu.org We are about to split softmmu and user mode helpers into different files. To facilitate this we will need to share access to the GDBState between those files. Reviewed-by: Richard Henderson Signed-off-by: Alex Bennée Message-Id: <20230302190846.2593720-7-alex.bennee@linaro.org> Message-Id: <20230303025805.625589-7-richard.henderson@linaro.org> diff --git a/gdbstub/internals.h b/gdbstub/internals.h index 7df0e11c47..32daaf73a3 100644 --- a/gdbstub/internals.h +++ b/gdbstub/internals.h @@ -11,6 +11,56 @@ #include "exec/cpu-common.h" +#define MAX_PACKET_LENGTH 4096 + +/* + * Shared structures and definitions + */ + +typedef struct GDBProcess { + uint32_t pid; + bool attached; + + char target_xml[1024]; +} GDBProcess; + +enum RSState { + RS_INACTIVE, + RS_IDLE, + RS_GETLINE, + RS_GETLINE_ESC, + RS_GETLINE_RLE, + RS_CHKSUM1, + RS_CHKSUM2, +}; + +typedef struct GDBState { + bool init; /* have we been initialised? */ + CPUState *c_cpu; /* current CPU for step/continue ops */ + CPUState *g_cpu; /* current CPU for other ops */ + CPUState *query_cpu; /* for q{f|s}ThreadInfo */ + enum RSState state; /* parsing state */ + char line_buf[MAX_PACKET_LENGTH]; + int line_buf_index; + int line_sum; /* running checksum */ + int line_csum; /* checksum at the end of the packet */ + GByteArray *last_packet; + int signal; + bool multiprocess; + GDBProcess *processes; + int process_num; + char syscall_buf[256]; + gdb_syscall_complete_cb current_syscall_cb; + GString *str_buf; + GByteArray *mem_buf; + int sstep_flags; + int supported_sstep_flags; +} GDBState; + +/* + * Break/Watch point support - there is an implementation for softmmu + * and user mode. + */ bool gdb_supports_guest_debug(void); int gdb_breakpoint_insert(CPUState *cs, int type, vaddr addr, vaddr len); int gdb_breakpoint_remove(CPUState *cs, int type, vaddr addr, vaddr len); diff --git a/gdbstub/gdbstub.c b/gdbstub/gdbstub.c index 1e6f8978b5..ef506faa8e 100644 --- a/gdbstub/gdbstub.c +++ b/gdbstub/gdbstub.c @@ -41,8 +41,6 @@ #include "hw/boards.h" #endif -#define MAX_PACKET_LENGTH 4096 - #include "qemu/sockets.h" #include "sysemu/hw_accel.h" #include "sysemu/runstate.h" @@ -325,23 +323,6 @@ typedef struct GDBRegisterState { struct GDBRegisterState *next; } GDBRegisterState; -typedef struct GDBProcess { - uint32_t pid; - bool attached; - - char target_xml[1024]; -} GDBProcess; - -enum RSState { - RS_INACTIVE, - RS_IDLE, - RS_GETLINE, - RS_GETLINE_ESC, - RS_GETLINE_RLE, - RS_CHKSUM1, - RS_CHKSUM2, -}; - #ifdef CONFIG_USER_ONLY typedef struct { int fd; @@ -357,29 +338,6 @@ typedef struct { static GDBSystemState gdbserver_system_state; #endif -typedef struct GDBState { - bool init; /* have we been initialised? */ - CPUState *c_cpu; /* current CPU for step/continue ops */ - CPUState *g_cpu; /* current CPU for other ops */ - CPUState *query_cpu; /* for q{f|s}ThreadInfo */ - enum RSState state; /* parsing state */ - char line_buf[MAX_PACKET_LENGTH]; - int line_buf_index; - int line_sum; /* running checksum */ - int line_csum; /* checksum at the end of the packet */ - GByteArray *last_packet; - int signal; - bool multiprocess; - GDBProcess *processes; - int process_num; - char syscall_buf[256]; - gdb_syscall_complete_cb current_syscall_cb; - GString *str_buf; - GByteArray *mem_buf; - int sstep_flags; - int supported_sstep_flags; -} GDBState; - static GDBState gdbserver_state; static void init_gdbserver_state(void)