From nobody Wed Nov 27 02:45:10 2024 Delivered-To: importer@patchew.org Authentication-Results: mx.zohomail.com; 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 Return-Path: Received: from lists.gnu.org (lists.gnu.org [209.51.188.17]) by mx.zohomail.com with SMTPS id 1701983111939792.6618885689384; Thu, 7 Dec 2023 13:05:11 -0800 (PST) Received: from localhost ([::1] helo=lists1p.gnu.org) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1rBLYB-0002oe-9Q; Thu, 07 Dec 2023 16:04:51 -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 1rBLY1-0002kB-5Y for qemu-devel@nongnu.org; Thu, 07 Dec 2023 16:04:41 -0500 Received: from smtp1.lauterbach.com ([62.154.241.196]) by eggs.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.90_1) (envelope-from ) id 1rBLXw-0005pG-PJ for qemu-devel@nongnu.org; Thu, 07 Dec 2023 16:04:40 -0500 Received: (qmail 10670 invoked by uid 484); 7 Dec 2023 21:04:24 -0000 Received: from nedpc1.intern.lauterbach.com (Authenticated_SSL:neder@[10.2.11.92]) (envelope-sender ) by smtp1.lauterbach.com (qmail-ldap-1.03) with TLS_AES_256_GCM_SHA384 encrypted SMTP for ; 7 Dec 2023 21:04:21 -0000 X-Qmail-Scanner-Diagnostics: from nedpc1.intern.lauterbach.com by smtp1.lauterbach.com (envelope-from , uid 484) with qmail-scanner-2.11 (mhr: 1.0. clamdscan: 0.99/21437. spamassassin: 3.4.0. Clear:RC:1(10.2.11.92):. Processed in 3e-06 secs); 07 Dec 2023 21:04:24 -0000 From: Nicolas Eder To: qemu-devel@nongnu.org Cc: "Nicolas Eder" , =?UTF-8?q?Philippe=20Mathieu-Daud=C3=A9?= , "Christian Boenig" , =?UTF-8?q?Alex=20Benn=C3=A9e?= Subject: [PATCH v4 14/17] mcdstub: state query added Date: Thu, 7 Dec 2023 22:03:55 +0100 Message-Id: <20231207210358.7409-15-nicolas.eder@lauterbach.com> X-Mailer: git-send-email 2.34.1 In-Reply-To: <20231207210358.7409-1-nicolas.eder@lauterbach.com> References: <20231207210358.7409-1-nicolas.eder@lauterbach.com> MIME-Version: 1.0 Content-Transfer-Encoding: quoted-printable X-Qmail-Scanner-2.11: added fake Content-Type header 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=62.154.241.196; envelope-from=nicolas.eder@lauterbach.com; helo=smtp1.lauterbach.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, SPF_HELO_PASS=-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-ZM-MESSAGEID: 1701983114179100015 Content-Type: text/plain; charset="utf-8" --- debug/mcdstub/mcdstub.c | 44 +++++++++++++++++++++++++++++++++++++++++ 1 file changed, 44 insertions(+) diff --git a/debug/mcdstub/mcdstub.c b/debug/mcdstub/mcdstub.c index 83582f7fa5..794e7d1312 100644 --- a/debug/mcdstub/mcdstub.c +++ b/debug/mcdstub/mcdstub.c @@ -1412,6 +1412,43 @@ static void handle_query_regs_c(GArray *params, void= *user_ctx) mcd_put_strbuf(); } =20 +/** + * handle_query_state() - Handler for the state query. + * + * This function collects all data stored in the + * cpu_state member of the mcdserver_state and formats and sends it to the + * library. + * @params: GArray with all TCP packet parameters. + */ +static void handle_query_state(GArray *params, void *user_ctx) +{ + /* + * TODO: multicore support + * get state info + */ + mcd_cpu_state_st state_info =3D mcdserver_state.cpu_state; + /* TODO: add event information */ + uint32_t event =3D 0; + /* send data */ + g_string_printf(mcdserver_state.str_buf, + "%s=3D%s.%s=3D%u.%s=3D%u.%s=3D%u.%s=3D%lu.%s=3D%s.%s=3D%s.", + TCP_ARGUMENT_STATE, state_info.state, + TCP_ARGUMENT_EVENT, event, TCP_ARGUMENT_THREAD, 0, + TCP_ARGUMENT_TYPE, state_info.bp_type, + TCP_ARGUMENT_ADDRESS, state_info.bp_address, + TCP_ARGUMENT_STOP_STRING, state_info.stop_str, + TCP_ARGUMENT_INFO_STRING, state_info.info_str); + mcd_put_strbuf(); + + /* reset debug info after first query */ + if (strcmp(state_info.state, CORE_STATE_DEBUG) =3D=3D 0) { + mcdserver_state.cpu_state.stop_str =3D ""; + mcdserver_state.cpu_state.info_str =3D ""; + mcdserver_state.cpu_state.bp_type =3D 0; + mcdserver_state.cpu_state.bp_address =3D 0; + } +} + /** * init_query_cmds_table() - Initializes all query functions. * @@ -1507,6 +1544,13 @@ static void init_query_cmds_table(MCDCmdParseEntry *= mcd_query_cmds_table) strcpy(query_regs_c.schema, (char[2]) { ARG_SCHEMA_QRYHANDLE, '\0' }); mcd_query_cmds_table[cmd_number] =3D query_regs_c; cmd_number++; + + MCDCmdParseEntry query_state =3D { + .handler =3D handle_query_state, + .cmd =3D QUERY_ARG_STATE, + }; + strcpy(query_state.schema, (char[2]) { ARG_SCHEMA_CORENUM, '\0' }); + mcd_query_cmds_table[cmd_number] =3D query_state; } =20 /** --=20 2.34.1