From nobody Thu May 9 23:20:59 2024 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=quicinc.com ARC-Seal: i=1; a=rsa-sha256; t=1681993934; cv=none; d=zohomail.com; s=zohoarc; b=VyRo25Scy0qe7PrajvQ8zI77b4AEmuZRNqD3BBCeqyGmWn6FTpxM3X/m1BI0fz1C0tDy+8P1VZ4jZG6Uzs6/JgrYFLQov34jW+f9iNeSjnDwAe+qFoLJLMmvq8GyBO4Y9GU9+P7x9KDAVORMke1N+drJP2X5joGqj6jmTfAacrQ= ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=zohomail.com; s=zohoarc; t=1681993934; 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=cli39JR9znWhGRfM3LIckBq3WT2w+wWWyqimncUGvzo=; b=KdtNIEpx1MZM3US0MsW1IRVulB1WPPEBWtCPhrO5lYsbw35k3QBiW+Iw9qM4TRyTtUHWSr2W+MUEsynYN22z+hKKzB9traZteNBDk71QBYnD/bQHyIutXe51H1agrQ6tENzyf841FLJlOSLbHjUOzsNAKf+5hVYVgDp+kNU2eL8= 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 1681993934932531.8777834496899; Thu, 20 Apr 2023 05:32:14 -0700 (PDT) Received: from localhost ([::1] helo=lists1p.gnu.org) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1ppTSF-0006Wp-KV; Thu, 20 Apr 2023 08:32: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 1ppTSE-0006WX-2A for qemu-devel@nongnu.org; Thu, 20 Apr 2023 08:32:02 -0400 Received: from mx0a-0031df01.pphosted.com ([205.220.168.131]) by eggs.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.90_1) (envelope-from ) id 1ppTSB-0002pn-Nd for qemu-devel@nongnu.org; Thu, 20 Apr 2023 08:32:01 -0400 Received: from pps.filterd (m0279863.ppops.net [127.0.0.1]) by mx0a-0031df01.pphosted.com (8.17.1.19/8.17.1.19) with ESMTP id 33KAp5t9008336; Thu, 20 Apr 2023 12:31:48 GMT Received: from nalasppmta01.qualcomm.com (Global_NAT1.qualcomm.com [129.46.96.20]) by mx0a-0031df01.pphosted.com (PPS) with ESMTPS id 3q2uj3sckb-1 (version=TLSv1.2 cipher=ECDHE-RSA-AES256-GCM-SHA384 bits=256 verify=NOT); Thu, 20 Apr 2023 12:31:48 +0000 Received: from nalasex01a.na.qualcomm.com (nalasex01a.na.qualcomm.com [10.47.209.196]) by NALASPPMTA01.qualcomm.com (8.17.1.5/8.17.1.5) with ESMTPS id 33KCVlJh015300 (version=TLSv1.2 cipher=ECDHE-RSA-AES256-GCM-SHA384 bits=256 verify=NOT); Thu, 20 Apr 2023 12:31:47 GMT Received: from NASANPPMTA03.qualcomm.com (10.80.80.8) by nalasex01a.na.qualcomm.com (10.47.209.196) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.2.986.42; Thu, 20 Apr 2023 05:31:45 -0700 DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=quicinc.com; h=from : to : cc : subject : date : message-id : in-reply-to : references : mime-version : content-transfer-encoding : content-type; s=qcppdkim1; bh=cli39JR9znWhGRfM3LIckBq3WT2w+wWWyqimncUGvzo=; b=JYWr0v9+Dp/GYz5JP1Qhzszlt4KBAHCjMXr/3MHL3wyIWxiWm1108I6f8uZMNVhiX64i skbZ2NNyzbxqIGE+Xb1IwfgCCh69xbWvrJIoeednTE9g+uX6RJEMYcUDdATSi/2rFDT5 InBZ5lAsKSjBv4ERSai0MKcaXh3j+IE5nqbrkZTLzTePe7F4FiM293blcYITWSxe2xXD 7rXnTmrznag5Utiiy1F+ubLSOWE4V0ky8XWlw/dzoLZ10C7oraNP7MTzdfJYuq9iUo9x aUkB11IsD0NxfgKeN3Pt0K8OV7uQvSovHb3WImUMm5ehS1G6K+vOFgg0AYd3J+htU+pL 4w== From: Matheus Tavares Bernardino To: CC: , , , , , =?UTF-8?q?Philippe=20Mathieu-Daud=C3=A9?= Subject: [PATCH v2 RESEND 1/7] gdbstub: only send stop-reply packets when allowed to Date: Thu, 20 Apr 2023 09:31:22 -0300 Message-ID: X-Mailer: git-send-email 2.39.1 In-Reply-To: References: MIME-Version: 1.0 Content-Transfer-Encoding: quoted-printable X-Originating-IP: [10.80.80.8] X-ClientProxiedBy: nasanex01a.na.qualcomm.com (10.52.223.231) To nalasex01a.na.qualcomm.com (10.47.209.196) X-QCInternal: smtphost X-Proofpoint-Virus-Version: vendor=nai engine=6200 definitions=5800 signatures=585085 X-Proofpoint-GUID: boj9x8O90B026D2RD59suziHMho5CGW5 X-Proofpoint-ORIG-GUID: boj9x8O90B026D2RD59suziHMho5CGW5 X-Proofpoint-Virus-Version: vendor=baseguard engine=ICAP:2.0.254,Aquarius:18.0.942,Hydra:6.0.573,FMLib:17.11.170.22 definitions=2023-04-20_08,2023-04-20_01,2023-02-09_01 X-Proofpoint-Spam-Details: rule=outbound_notspam policy=outbound score=0 lowpriorityscore=0 bulkscore=0 malwarescore=0 phishscore=0 clxscore=1015 mlxlogscore=999 mlxscore=0 priorityscore=1501 adultscore=0 suspectscore=0 impostorscore=0 spamscore=0 classifier=spam adjust=0 reason=mlx scancount=1 engine=8.12.0-2303200000 definitions=main-2304200102 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=205.220.168.131; envelope-from=quic_mathbern@quicinc.com; helo=mx0a-0031df01.pphosted.com X-Spam_score_int: -27 X-Spam_score: -2.8 X-Spam_bar: -- X-Spam_report: (-2.8 / 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_LOW=-0.7, 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 @quicinc.com) X-ZM-MESSAGEID: 1681993936070100001 Content-Type: text/plain; charset="utf-8" GDB's remote serial protocol allows stop-reply messages to be sent by the stub either as a notification packet or as a reply to a GDB command (provided that the cmd accepts such a response). QEMU currently does not implement notification packets, so it should only send stop-replies synchronously and when requested. Nevertheless, it still issues unsolicited stop messages through gdb_vm_state_change(). Although this behavior doesn't seem to cause problems with GDB itself (the messages are just ignored), it can impact other debuggers that implement the GDB remote serial protocol, like hexagon-lldb. Let's change the gdbstub to send stop messages only as a response to a previous GDB command that accepts such a reply. Signed-off-by: Matheus Tavares Bernardino Acked-by: Alex Benn=C3=A9e --- gdbstub/internals.h | 5 +++++ gdbstub/gdbstub.c | 37 ++++++++++++++++++++++++++++--------- gdbstub/softmmu.c | 13 +++++++++++-- gdbstub/user.c | 17 +++++++++++------ 4 files changed, 55 insertions(+), 17 deletions(-) diff --git a/gdbstub/internals.h b/gdbstub/internals.h index 94ddff4495..33d21d6488 100644 --- a/gdbstub/internals.h +++ b/gdbstub/internals.h @@ -65,6 +65,11 @@ typedef struct GDBState { GByteArray *mem_buf; int sstep_flags; int supported_sstep_flags; + /* + * Whether we are allowed to send a stop reply packet at this moment. + * Must be set off after sending the stop reply itself. + */ + bool allow_stop_reply; } GDBState; =20 /* lives in main gdbstub.c */ diff --git a/gdbstub/gdbstub.c b/gdbstub/gdbstub.c index 0760d78685..be18568d0a 100644 --- a/gdbstub/gdbstub.c +++ b/gdbstub/gdbstub.c @@ -777,6 +777,10 @@ typedef void (*GdbCmdHandler)(GArray *params, void *us= er_ctx); /* * cmd_startswith -> cmd is compared using startswith * + * allow_stop_reply -> true iff the gdbstub can respond to this command wi= th a + * "stop reply" packet. The list of commands that accept such response is + * defined at the GDB Remote Serial Protocol documentation. see: + * https://sourceware.org/gdb/onlinedocs/gdb/Stop-Reply-Packets.html#Sto= p-Reply-Packets. * * schema definitions: * Each schema parameter entry consists of 2 chars, @@ -802,6 +806,7 @@ typedef struct GdbCmdParseEntry { const char *cmd; bool cmd_startswith; const char *schema; + bool allow_stop_reply; } GdbCmdParseEntry; =20 static inline int startswith(const char *string, const char *pattern) @@ -835,6 +840,7 @@ static int process_string_cmd(void *user_ctx, const cha= r *data, } } =20 + gdbserver_state.allow_stop_reply =3D cmd->allow_stop_reply; cmd->handler(params, user_ctx); return 0; } @@ -1283,11 +1289,14 @@ static void handle_v_attach(GArray *params, void *u= ser_ctx) gdbserver_state.g_cpu =3D cpu; gdbserver_state.c_cpu =3D cpu; =20 - g_string_printf(gdbserver_state.str_buf, "T%02xthread:", GDB_SIGNAL_TR= AP); - gdb_append_thread_id(cpu, gdbserver_state.str_buf); - g_string_append_c(gdbserver_state.str_buf, ';'); + if (gdbserver_state.allow_stop_reply) { + g_string_printf(gdbserver_state.str_buf, "T%02xthread:", GDB_SIGNA= L_TRAP); + gdb_append_thread_id(cpu, gdbserver_state.str_buf); + g_string_append_c(gdbserver_state.str_buf, ';'); + gdbserver_state.allow_stop_reply =3D false; cleanup: - gdb_put_strbuf(); + gdb_put_strbuf(); + } } =20 static void handle_v_kill(GArray *params, void *user_ctx) @@ -1310,12 +1319,14 @@ static const GdbCmdParseEntry gdb_v_commands_table[= ] =3D { .handler =3D handle_v_cont, .cmd =3D "Cont", .cmd_startswith =3D 1, + .allow_stop_reply =3D true, .schema =3D "s0" }, { .handler =3D handle_v_attach, .cmd =3D "Attach;", .cmd_startswith =3D 1, + .allow_stop_reply =3D true, .schema =3D "l0" }, { @@ -1698,10 +1709,13 @@ static void handle_gen_set(GArray *params, void *us= er_ctx) =20 static void handle_target_halt(GArray *params, void *user_ctx) { - g_string_printf(gdbserver_state.str_buf, "T%02xthread:", GDB_SIGNAL_TR= AP); - gdb_append_thread_id(gdbserver_state.c_cpu, gdbserver_state.str_buf); - g_string_append_c(gdbserver_state.str_buf, ';'); - gdb_put_strbuf(); + if (gdbserver_state.allow_stop_reply) { + g_string_printf(gdbserver_state.str_buf, "T%02xthread:", GDB_SIGNA= L_TRAP); + gdb_append_thread_id(gdbserver_state.c_cpu, gdbserver_state.str_bu= f); + g_string_append_c(gdbserver_state.str_buf, ';'); + gdb_put_strbuf(); + gdbserver_state.allow_stop_reply =3D false; + } /* * Remove all the breakpoints when this query is issued, * because gdb is doing an initial connect and the state @@ -1725,7 +1739,8 @@ static int gdb_handle_packet(const char *line_buf) static const GdbCmdParseEntry target_halted_cmd_desc =3D { .handler =3D handle_target_halt, .cmd =3D "?", - .cmd_startswith =3D 1 + .cmd_startswith =3D 1, + .allow_stop_reply =3D true, }; cmd_parser =3D &target_halted_cmd_desc; } @@ -1736,6 +1751,7 @@ static int gdb_handle_packet(const char *line_buf) .handler =3D handle_continue, .cmd =3D "c", .cmd_startswith =3D 1, + .allow_stop_reply =3D true, .schema =3D "L0" }; cmd_parser =3D &continue_cmd_desc; @@ -1747,6 +1763,7 @@ static int gdb_handle_packet(const char *line_buf) .handler =3D handle_cont_with_sig, .cmd =3D "C", .cmd_startswith =3D 1, + .allow_stop_reply =3D true, .schema =3D "l0" }; cmd_parser =3D &cont_with_sig_cmd_desc; @@ -1785,6 +1802,7 @@ static int gdb_handle_packet(const char *line_buf) .handler =3D handle_step, .cmd =3D "s", .cmd_startswith =3D 1, + .allow_stop_reply =3D true, .schema =3D "L0" }; cmd_parser =3D &step_cmd_desc; @@ -1976,6 +1994,7 @@ void gdb_read_byte(uint8_t ch) { uint8_t reply; =20 + gdbserver_state.allow_stop_reply =3D false; #ifndef CONFIG_USER_ONLY if (gdbserver_state.last_packet->len) { /* Waiting for a response to the last packet. If we see the start diff --git a/gdbstub/softmmu.c b/gdbstub/softmmu.c index 22ecd09d04..99d994e6bf 100644 --- a/gdbstub/softmmu.c +++ b/gdbstub/softmmu.c @@ -43,6 +43,7 @@ static void reset_gdbserver_state(void) g_free(gdbserver_state.processes); gdbserver_state.processes =3D NULL; gdbserver_state.process_num =3D 0; + gdbserver_state.allow_stop_reply =3D false; } =20 /* @@ -139,6 +140,10 @@ static void gdb_vm_state_change(void *opaque, bool run= ning, RunState state) return; } =20 + if (!gdbserver_state.allow_stop_reply) { + return; + } + gdb_append_thread_id(cpu, tid); =20 switch (state) { @@ -205,6 +210,7 @@ static void gdb_vm_state_change(void *opaque, bool runn= ing, RunState state) =20 send_packet: gdb_put_packet(buf->str); + gdbserver_state.allow_stop_reply =3D false; =20 /* disable single step if it was enabled */ cpu_single_step(cpu, 0); @@ -422,8 +428,11 @@ void gdb_exit(int code) =20 trace_gdbstub_op_exiting((uint8_t)code); =20 - snprintf(buf, sizeof(buf), "W%02x", (uint8_t)code); - gdb_put_packet(buf); + if (gdbserver_state.allow_stop_reply) { + snprintf(buf, sizeof(buf), "W%02x", (uint8_t)code); + gdb_put_packet(buf); + gdbserver_state.allow_stop_reply =3D false; + } =20 qemu_chr_fe_deinit(&gdbserver_system_state.chr, true); } diff --git a/gdbstub/user.c b/gdbstub/user.c index 80488b6bb9..bb03622c83 100644 --- a/gdbstub/user.c +++ b/gdbstub/user.c @@ -127,11 +127,14 @@ int gdb_handlesig(CPUState *cpu, int sig) =20 if (sig !=3D 0) { gdb_set_stop_cpu(cpu); - g_string_printf(gdbserver_state.str_buf, - "T%02xthread:", gdb_target_signal_to_gdb(sig)); - gdb_append_thread_id(cpu, gdbserver_state.str_buf); - g_string_append_c(gdbserver_state.str_buf, ';'); - gdb_put_strbuf(); + if (gdbserver_state.allow_stop_reply) { + g_string_printf(gdbserver_state.str_buf, + "T%02xthread:", gdb_target_signal_to_gdb(sig)); + gdb_append_thread_id(cpu, gdbserver_state.str_buf); + g_string_append_c(gdbserver_state.str_buf, ';'); + gdb_put_strbuf(); + gdbserver_state.allow_stop_reply =3D false; + } } /* * gdb_put_packet() might have detected that the peer terminated the @@ -174,12 +177,14 @@ void gdb_signalled(CPUArchState *env, int sig) { char buf[4]; =20 - if (!gdbserver_state.init || gdbserver_user_state.fd < 0) { + if (!gdbserver_state.init || gdbserver_user_state.fd < 0 || + !gdbserver_state.allow_stop_reply) { return; } =20 snprintf(buf, sizeof(buf), "X%02x", gdb_target_signal_to_gdb(sig)); gdb_put_packet(buf); + gdbserver_state.allow_stop_reply =3D false; } =20 static void gdb_accept_init(int fd) --=20 2.39.1 From nobody Thu May 9 23:20:59 2024 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=quicinc.com ARC-Seal: i=1; a=rsa-sha256; t=1681994148; cv=none; d=zohomail.com; s=zohoarc; b=ToLbKp+NUVBmF7VglgSxRovysRj15Sk6bj4cmYogV1QPkTYL9VSb3vwer2IccPTrhBX7urKbsKSnYI+fqxwlhkv2+nKpH1nRs22XHIw6D21gFMerPWs0tjsqBXK5pQU0rJXHdoLU4EM3RV18OB6XXQPhHDPdiWHYdoQCblZg98k= ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=zohomail.com; s=zohoarc; t=1681994148; 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=9l+W59dDDb8fNHeexhqSHDYcEIc2aqK9wXJVbckN0Os=; b=ah4USjrKIXDjVjuMR4SVgxpCzTDmPyMNKDlwbQPIax9qM0cQcmOtiIhcZYCVCFav/2DvcI/4XelGPpcjKCzLdBm9057hGPnXxJCZzIPhjwltf3BbRBFiPtr/2pVeO/tTkeKaa0tg2AYQk9HfVNxeigFDs8O8C0nSByxwFSOpsig= 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 1681994148346690.9524199673793; Thu, 20 Apr 2023 05:35:48 -0700 (PDT) Received: from localhost ([::1] helo=lists1p.gnu.org) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1ppTST-0006gL-91; Thu, 20 Apr 2023 08:32:17 -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 1ppTSQ-0006e7-PY for qemu-devel@nongnu.org; Thu, 20 Apr 2023 08:32:14 -0400 Received: from mx0b-0031df01.pphosted.com ([205.220.180.131]) by eggs.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.90_1) (envelope-from ) id 1ppTSL-0002tP-9w for qemu-devel@nongnu.org; Thu, 20 Apr 2023 08:32:14 -0400 Received: from pps.filterd (m0279871.ppops.net [127.0.0.1]) by mx0a-0031df01.pphosted.com (8.17.1.19/8.17.1.19) with ESMTP id 33KBuGHj022007; Thu, 20 Apr 2023 12:32:07 GMT Received: from nalasppmta02.qualcomm.com (Global_NAT1.qualcomm.com [129.46.96.20]) by mx0a-0031df01.pphosted.com (PPS) with ESMTPS id 3q2p7at036-1 (version=TLSv1.2 cipher=ECDHE-RSA-AES256-GCM-SHA384 bits=256 verify=NOT); Thu, 20 Apr 2023 12:32:06 +0000 Received: from nalasex01a.na.qualcomm.com (nalasex01a.na.qualcomm.com [10.47.209.196]) by NALASPPMTA02.qualcomm.com (8.17.1.5/8.17.1.5) with ESMTPS id 33KCVobc020236 (version=TLSv1.2 cipher=ECDHE-RSA-AES256-GCM-SHA384 bits=256 verify=NOT); Thu, 20 Apr 2023 12:31:50 GMT Received: from NASANPPMTA03.qualcomm.com (10.80.80.8) by nalasex01a.na.qualcomm.com (10.47.209.196) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.2.986.42; Thu, 20 Apr 2023 05:31:47 -0700 DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=quicinc.com; h=from : to : cc : subject : date : message-id : in-reply-to : references : mime-version : content-transfer-encoding : content-type; s=qcppdkim1; bh=9l+W59dDDb8fNHeexhqSHDYcEIc2aqK9wXJVbckN0Os=; b=LPm7Tm384bVCYn7zUrsbdRIdunC4dgdqwTKc2gSM5QMHad+8yZ3nQCtnyrUZnJC6aLHh x3JhGXLSGipN23TUOdj+j1kC+hfN9PBgoIUYNr+DDw/zlomXwEFf/GVNXv8/SE/2z9oU Lp32u830gSEumTFXhLXW1gegEundJwm4D/VFT2BQd7H7h0HvEGaZOy/3ohsXyQscHHMa LiqoZO6BEEm3KAwsEp+T3zw6aAvoWGkofpoZex++Xxu8G7qDSRqIKKEWFZpuEkdX8Deb sstgGnv1uQxs4uxv6duivSVxav7ZtsSv6agZPsx4jKimVpBao08FA9osxjEQDForzgsb OQ== From: Matheus Tavares Bernardino To: CC: , , , , Subject: [PATCH v2 RESEND 2/7] gdbstub: add test for untimely stop-reply packets Date: Thu, 20 Apr 2023 09:31:23 -0300 Message-ID: <135d716c2f1cdc125a3d44f5f6a0e67da13de744.1681993775.git.quic_mathbern@quicinc.com> X-Mailer: git-send-email 2.39.1 In-Reply-To: References: MIME-Version: 1.0 Content-Transfer-Encoding: quoted-printable X-Originating-IP: [10.80.80.8] X-ClientProxiedBy: nasanex01a.na.qualcomm.com (10.52.223.231) To nalasex01a.na.qualcomm.com (10.47.209.196) X-QCInternal: smtphost X-Proofpoint-Virus-Version: vendor=nai engine=6200 definitions=5800 signatures=585085 X-Proofpoint-GUID: YZvYjw-kdqssOqsBYokxW26UQ9ruH28N X-Proofpoint-ORIG-GUID: YZvYjw-kdqssOqsBYokxW26UQ9ruH28N X-Proofpoint-Virus-Version: vendor=baseguard engine=ICAP:2.0.254,Aquarius:18.0.942,Hydra:6.0.573,FMLib:17.11.170.22 definitions=2023-04-20_07,2023-04-20_01,2023-02-09_01 X-Proofpoint-Spam-Details: rule=outbound_notspam policy=outbound score=0 impostorscore=0 clxscore=1015 lowpriorityscore=0 spamscore=0 bulkscore=0 malwarescore=0 adultscore=0 phishscore=0 mlxscore=0 suspectscore=0 priorityscore=1501 mlxlogscore=999 classifier=spam adjust=0 reason=mlx scancount=1 engine=8.12.0-2303200000 definitions=main-2304200102 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=205.220.180.131; envelope-from=quic_mathbern@quicinc.com; helo=mx0b-0031df01.pphosted.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, 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 @quicinc.com) X-ZM-MESSAGEID: 1681994149325100005 Content-Type: text/plain; charset="utf-8" In the previous commit, we modified gdbstub.c to only send stop-reply packets as a response to GDB commands that accept it. Now, let's add a test for this intended behavior. Running this test before the fix from the previous commit fails as QEMU sends a stop-reply packet asynchronously, when GDB was in fact waiting an ACK. Signed-off-by: Matheus Tavares Bernardino Acked-by: Alex Benn=C3=A9e --- tests/guest-debug/run-test.py | 16 ++++++++++++---- .../tcg/multiarch/system/Makefile.softmmu-target | 16 +++++++++++++++- 2 files changed, 27 insertions(+), 5 deletions(-) diff --git a/tests/guest-debug/run-test.py b/tests/guest-debug/run-test.py index d865e46ecd..de6106a5e5 100755 --- a/tests/guest-debug/run-test.py +++ b/tests/guest-debug/run-test.py @@ -26,11 +26,12 @@ def get_args(): parser.add_argument("--qargs", help=3D"Qemu arguments for test") parser.add_argument("--binary", help=3D"Binary to debug", required=3DTrue) - parser.add_argument("--test", help=3D"GDB test script", - required=3DTrue) + parser.add_argument("--test", help=3D"GDB test script") parser.add_argument("--gdb", help=3D"The gdb binary to use", default=3DNone) + parser.add_argument("--gdb-args", help=3D"Additional gdb arguments") parser.add_argument("--output", help=3D"A file to redirect output to") + parser.add_argument("--stderr", help=3D"A file to redirect stderr to") =20 return parser.parse_args() =20 @@ -58,6 +59,10 @@ def log(output, msg): output =3D open(args.output, "w") else: output =3D None + if args.stderr: + stderr =3D open(args.stderr, "w") + else: + stderr =3D None =20 socket_dir =3D TemporaryDirectory("qemu-gdbstub") socket_name =3D os.path.join(socket_dir.name, "gdbstub.socket") @@ -77,6 +82,8 @@ def log(output, msg): =20 # Now launch gdb with our test and collect the result gdb_cmd =3D "%s %s" % (args.gdb, args.binary) + if args.gdb_args: + gdb_cmd +=3D " %s" % (args.gdb_args) # run quietly and ignore .gdbinit gdb_cmd +=3D " -q -n -batch" # disable prompts in case of crash @@ -84,13 +91,14 @@ def log(output, msg): # connect to remote gdb_cmd +=3D " -ex 'target remote %s'" % (socket_name) # finally the test script itself - gdb_cmd +=3D " -x %s" % (args.test) + if args.test: + gdb_cmd +=3D " -x %s" % (args.test) =20 =20 sleep(1) log(output, "GDB CMD: %s" % (gdb_cmd)) =20 - result =3D subprocess.call(gdb_cmd, shell=3DTrue, stdout=3Doutput) + result =3D subprocess.call(gdb_cmd, shell=3DTrue, stdout=3Doutput, std= err=3Dstderr) =20 # A result of greater than 128 indicates a fatal signal (likely a # crash due to gdb internal failure). That's a problem for GDB and diff --git a/tests/tcg/multiarch/system/Makefile.softmmu-target b/tests/tcg= /multiarch/system/Makefile.softmmu-target index 5f432c95f3..fe40195d39 100644 --- a/tests/tcg/multiarch/system/Makefile.softmmu-target +++ b/tests/tcg/multiarch/system/Makefile.softmmu-target @@ -27,6 +27,20 @@ run-gdbstub-memory: memory "-monitor none -display none -chardev file$(COMMA)path=3D$<.out$(COMMA)i= d=3Doutput $(QEMU_OPTS)" \ --bin $< --test $(MULTIARCH_SRC)/gdbstub/memory.py, \ softmmu gdbstub support) + +run-gdbstub-untimely-packet: hello + $(call run-test, $@, $(GDB_SCRIPT) \ + --gdb $(HAVE_GDB_BIN) \ + --gdb-args "-ex 'set debug remote 1'" \ + --output untimely-packet.gdb.out \ + --stderr untimely-packet.gdb.err \ + --qemu $(QEMU) \ + --bin $< --qargs \ + "-monitor none -display none -chardev file$(COMMA)path=3Duntimely-packet= .out$(COMMA)id=3Doutput $(QEMU_OPTS)", \ + "softmmu gdbstub untimely packets") + $(call quiet-command, \ + (! grep -Fq 'Packet instead of Ack, ignoring it' untimely-packet.gdb.err= ), \ + "GREP", "file untimely-packet.gdb.err") else run-gdbstub-%: $(call skip-test, "gdbstub test $*", "no guest arch support") @@ -36,4 +50,4 @@ run-gdbstub-%: $(call skip-test, "gdbstub test $*", "need working gdb") endif =20 -MULTIARCH_RUNS +=3D run-gdbstub-memory +MULTIARCH_RUNS +=3D run-gdbstub-memory run-gdbstub-untimely-packet --=20 2.39.1 From nobody Thu May 9 23:20:59 2024 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=quicinc.com ARC-Seal: i=1; a=rsa-sha256; t=1681994247; cv=none; d=zohomail.com; s=zohoarc; b=nDqazPGnLzi1XtQ4bprUhaIfZjJC8nDS6Y3d9i8lkfQOLcAjLEPkqylz5pM/Hdr9vURo5w5sA+/M/0DQ6R3l9GwDnzmLK38e/c0I6ZldyF/fjHJLnqgFY5YQ+tv8HOUm1usaq9ifSJVFtJdNDUWZ/z0G4TFd0ejc4pdQOakAkXA= ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=zohomail.com; s=zohoarc; t=1681994247; 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=yidt+xGODxX9s5IhV9MGV7XTimp8h2AQNVxtdcV7HrY=; b=Z8QJpqq6I79ycvAbkUiWE3X1dHGnHd49pzxL3+FwldmEOHe9DUOcnsR+OzY+rN1B9jplXm4E4M6xmhZEjk9U3Vrno85SgxjMs+KcFbQ4RLYZOn3fAc2izTZ1fyxlzyhUqbj1RqeWU29YQQn759TVxMKI8yJz7xgt1xKf3ffoTFM= 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 1681994247532854.6669852330648; Thu, 20 Apr 2023 05:37:27 -0700 (PDT) Received: from localhost ([::1] helo=lists1p.gnu.org) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1ppTSR-0006eu-9m; Thu, 20 Apr 2023 08:32:15 -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 1ppTSL-0006ZP-Ge for qemu-devel@nongnu.org; Thu, 20 Apr 2023 08:32:13 -0400 Received: from mx0a-0031df01.pphosted.com ([205.220.168.131]) by eggs.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.90_1) (envelope-from ) id 1ppTSH-0002ry-2k for qemu-devel@nongnu.org; Thu, 20 Apr 2023 08:32:06 -0400 Received: from pps.filterd (m0279863.ppops.net [127.0.0.1]) by mx0a-0031df01.pphosted.com (8.17.1.19/8.17.1.19) with ESMTP id 33KAoud1008092; Thu, 20 Apr 2023 12:31:55 GMT Received: from nalasppmta02.qualcomm.com (Global_NAT1.qualcomm.com [129.46.96.20]) by mx0a-0031df01.pphosted.com (PPS) with ESMTPS id 3q2uj3sckh-1 (version=TLSv1.2 cipher=ECDHE-RSA-AES256-GCM-SHA384 bits=256 verify=NOT); Thu, 20 Apr 2023 12:31:55 +0000 Received: from nalasex01a.na.qualcomm.com (nalasex01a.na.qualcomm.com [10.47.209.196]) by NALASPPMTA02.qualcomm.com (8.17.1.5/8.17.1.5) with ESMTPS id 33KCVsme020265 (version=TLSv1.2 cipher=ECDHE-RSA-AES256-GCM-SHA384 bits=256 verify=NOT); Thu, 20 Apr 2023 12:31:54 GMT Received: from NASANPPMTA03.qualcomm.com (10.80.80.8) by nalasex01a.na.qualcomm.com (10.47.209.196) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.2.986.42; Thu, 20 Apr 2023 05:31:50 -0700 DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=quicinc.com; h=from : to : cc : subject : date : message-id : in-reply-to : references : mime-version : content-transfer-encoding : content-type; s=qcppdkim1; bh=yidt+xGODxX9s5IhV9MGV7XTimp8h2AQNVxtdcV7HrY=; b=Oq+b4HhRL3rXG92poYXrKAx406QSLciXE4nnrKX1u2ptQOmY1QM+oczLqJ+XgNvVnOd1 OCW+iLwNd3AzvcPy3Xwbjn95cqRrBTmN6d7ABlncjm0KJXxmwcPegih2tBiykCIs+PJ8 bNn2+Veu51yp0BkECiqU+ZUfJUMGFEDtEcFuQ+YvpZNat8JnHqHq0nhX5O38s7PYEK8T xH1SmC3OhUE0FWJaOOT07QROAUPyE0DfSY5Dd0PF6JkEj3uP4sJ4WHqu4nhF3dhL3Ipd ijNQghK29Uk/LUhBZ25xRuSIILPRTJ+nQHm4luq6X4tptv/8/Ers/It3yV/sp2nYfhh1 yQ== From: Matheus Tavares Bernardino To: CC: , , , , , =?UTF-8?q?Philippe=20Mathieu-Daud=C3=A9?= , "Eduardo Habkost" , Marcel Apfelbaum , Yanan Wang Subject: [PATCH v2 RESEND 3/7] gdbstub: add support for the qRegisterInfo query Date: Thu, 20 Apr 2023 09:31:24 -0300 Message-ID: <6414ff4730fb53bd210cce947c201ca011135831.1681993775.git.quic_mathbern@quicinc.com> X-Mailer: git-send-email 2.39.1 In-Reply-To: References: MIME-Version: 1.0 Content-Transfer-Encoding: quoted-printable X-Originating-IP: [10.80.80.8] X-ClientProxiedBy: nasanex01a.na.qualcomm.com (10.52.223.231) To nalasex01a.na.qualcomm.com (10.47.209.196) X-QCInternal: smtphost X-Proofpoint-Virus-Version: vendor=nai engine=6200 definitions=5800 signatures=585085 X-Proofpoint-GUID: v09ez0VBRsY-fL0Ugygg933NqL7GFgy5 X-Proofpoint-ORIG-GUID: v09ez0VBRsY-fL0Ugygg933NqL7GFgy5 X-Proofpoint-Virus-Version: vendor=baseguard engine=ICAP:2.0.254,Aquarius:18.0.942,Hydra:6.0.573,FMLib:17.11.170.22 definitions=2023-04-20_08,2023-04-20_01,2023-02-09_01 X-Proofpoint-Spam-Details: rule=outbound_notspam policy=outbound score=0 lowpriorityscore=0 bulkscore=0 malwarescore=0 phishscore=0 clxscore=1015 mlxlogscore=866 mlxscore=0 priorityscore=1501 adultscore=0 suspectscore=0 impostorscore=0 spamscore=0 classifier=spam adjust=0 reason=mlx scancount=1 engine=8.12.0-2303200000 definitions=main-2304200102 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=205.220.168.131; envelope-from=quic_mathbern@quicinc.com; helo=mx0a-0031df01.pphosted.com X-Spam_score_int: -27 X-Spam_score: -2.8 X-Spam_bar: -- X-Spam_report: (-2.8 / 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_LOW=-0.7, 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 @quicinc.com) X-ZM-MESSAGEID: 1681994249834100007 Content-Type: text/plain; charset="utf-8" From: Brian Cain Signed-off-by: Brian Cain Signed-off-by: Matheus Tavares Bernardino --- include/hw/core/cpu.h | 4 ++++ gdbstub/gdbstub.c | 27 +++++++++++++++++++++++++++ 2 files changed, 31 insertions(+) diff --git a/include/hw/core/cpu.h b/include/hw/core/cpu.h index 397fd3ac68..cfdf5514d9 100644 --- a/include/hw/core/cpu.h +++ b/include/hw/core/cpu.h @@ -124,6 +124,8 @@ struct SysemuCPUOps; * its Harvard architecture split code and data. * @gdb_num_core_regs: Number of core registers accessible to GDB. * @gdb_core_xml_file: File name for core registers GDB XML description. + * @gdb_qreg_info_lines: Array of lines of registers qRegisterInfo descrip= tion. + * @gdb_qreg_info_line_count: Count of lines for @gdb_qreg_info_lines. * @gdb_stop_before_watchpoint: Indicates whether GDB expects the CPU to s= top * before the insn which triggers a watchpoint rather than after= it. * @gdb_arch_name: Optional callback that returns the architecture name kn= own @@ -159,6 +161,8 @@ struct CPUClass { vaddr (*gdb_adjust_breakpoint)(CPUState *cpu, vaddr addr); =20 const char *gdb_core_xml_file; + const char **gdb_qreg_info_lines; + int gdb_qreg_info_line_count; gchar * (*gdb_arch_name)(CPUState *cpu); const char * (*gdb_get_dynamic_xml)(CPUState *cpu, const char *xmlname= ); =20 diff --git a/gdbstub/gdbstub.c b/gdbstub/gdbstub.c index be18568d0a..f19f8c58c3 100644 --- a/gdbstub/gdbstub.c +++ b/gdbstub/gdbstub.c @@ -1409,6 +1409,27 @@ static void handle_query_curr_tid(GArray *params, vo= id *user_ctx) gdb_put_strbuf(); } =20 +static void handle_query_regs(GArray *params, void *user_ctx) +{ + if (!params->len) { + return; + } + + CPUClass *cc =3D CPU_GET_CLASS(gdbserver_state.g_cpu); + if (!cc->gdb_qreg_info_lines) { + gdb_put_packet(""); + return; + } + + int reg_num =3D get_param(params, 0)->val_ul; + if (reg_num >=3D cc->gdb_qreg_info_line_count) { + gdb_put_packet(""); + return; + } + + gdb_put_packet(cc->gdb_qreg_info_lines[reg_num]); +} + static void handle_query_threads(GArray *params, void *user_ctx) { if (!gdbserver_state.query_cpu) { @@ -1578,6 +1599,12 @@ static const GdbCmdParseEntry gdb_gen_query_table[] = =3D { .handler =3D handle_query_curr_tid, .cmd =3D "C", }, + { + .handler =3D handle_query_regs, + .cmd =3D "RegisterInfo", + .cmd_startswith =3D 1, + .schema =3D "l0" + }, { .handler =3D handle_query_threads, .cmd =3D "sThreadInfo", --=20 2.39.1 From nobody Thu May 9 23:20:59 2024 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=quicinc.com ARC-Seal: i=1; a=rsa-sha256; t=1681994149; cv=none; d=zohomail.com; s=zohoarc; b=EQde3v3lRpUjtTpVeLetxFRdUPhVzSvylDj4+66s4vDMkDsLMc+NsvjoeUCX4dfjMZsn8Hfb/6ywJ9nH7F8yeddpcrPYXBH65TFW3Lgz7819nJR02GcNKthHHWt6jY5jcTMG6Dk5DCyz5XxT7rs9YZOMuKWHJPAYA2/YXfyQyR8= ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=zohomail.com; s=zohoarc; t=1681994149; 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=Mtps1fz9KB5WjAS1S2MkhjPGT5pOYKykFU9pgzEBJI0=; b=m4iSifNgbukVKRahR9fN4F9kByeajCihivQFvoi+bLCDeDy1uj/qetwWmpTTQTw39jf+dVUU3I9AkXsJBfSSIF7AJJIzd0PSfW7agQAc10OWWFAZ9r28FgaNJSn+T3+gptU9sXvSyJTjlSj0rkNykgzoghS3VoJxJUSayDwwMa8= 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 1681994149313783.9035882769869; Thu, 20 Apr 2023 05:35:49 -0700 (PDT) Received: from localhost ([::1] helo=lists1p.gnu.org) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1ppTSP-0006ZE-7u; Thu, 20 Apr 2023 08:32:13 -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 1ppTSF-0006Wu-Mu for qemu-devel@nongnu.org; Thu, 20 Apr 2023 08:32:03 -0400 Received: from mx0b-0031df01.pphosted.com ([205.220.180.131]) by eggs.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.90_1) (envelope-from ) id 1ppTSC-0002qp-Sy for qemu-devel@nongnu.org; Thu, 20 Apr 2023 08:32:03 -0400 Received: from pps.filterd (m0279870.ppops.net [127.0.0.1]) by mx0a-0031df01.pphosted.com (8.17.1.19/8.17.1.19) with ESMTP id 33KBd7HL013872; Thu, 20 Apr 2023 12:31:58 GMT Received: from nalasppmta05.qualcomm.com (Global_NAT1.qualcomm.com [129.46.96.20]) by mx0a-0031df01.pphosted.com (PPS) with ESMTPS id 3q2p52212v-1 (version=TLSv1.2 cipher=ECDHE-RSA-AES256-GCM-SHA384 bits=256 verify=NOT); Thu, 20 Apr 2023 12:31:58 +0000 Received: from nalasex01a.na.qualcomm.com (nalasex01a.na.qualcomm.com [10.47.209.196]) by NALASPPMTA05.qualcomm.com (8.17.1.5/8.17.1.5) with ESMTPS id 33KCVv58029265 (version=TLSv1.2 cipher=ECDHE-RSA-AES256-GCM-SHA384 bits=256 verify=NOT); Thu, 20 Apr 2023 12:31:57 GMT Received: from NASANPPMTA03.qualcomm.com (10.80.80.8) by nalasex01a.na.qualcomm.com (10.47.209.196) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.2.986.42; Thu, 20 Apr 2023 05:31:54 -0700 DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=quicinc.com; h=from : to : cc : subject : date : message-id : in-reply-to : references : mime-version : content-transfer-encoding : content-type; s=qcppdkim1; bh=Mtps1fz9KB5WjAS1S2MkhjPGT5pOYKykFU9pgzEBJI0=; b=UWol5WfkIzLy04J6zXEB3XAgLfoODIGEwgaqPgZhS7xxsTDpcFuPTnGiMJJ5z2/i2YPj d56sSt5f5WA70+xq4MylvaoL8jMEDZI3EV9u6nrzCLzp90+zk2zmQ3VZWKCRIrR17MyX lZElKfAn87xoskhekJ9FPkQMMxgeaR/2hmYn355uYbpgA5YACL3Av+erkcZ+4Nyu++r8 Udk7K/Gt/K03yrzeJbq9FZ3QHK/XW6rSq+nd6cT8Ha7XL/shnxo9DHsyrj0d7X0+Mqta FjPGfKy7Uq5c05sONqu/5ldejuwkXfCVsslb5rzMQC0sxCDGBa0e1fVqLElT0J3smIi7 vw== From: Matheus Tavares Bernardino To: CC: , , , , Subject: [PATCH v2 RESEND 4/7] Hexagon: support qRegisterInfo at gdbstub Date: Thu, 20 Apr 2023 09:31:25 -0300 Message-ID: X-Mailer: git-send-email 2.39.1 In-Reply-To: References: MIME-Version: 1.0 Content-Transfer-Encoding: quoted-printable X-Originating-IP: [10.80.80.8] X-ClientProxiedBy: nasanex01a.na.qualcomm.com (10.52.223.231) To nalasex01a.na.qualcomm.com (10.47.209.196) X-QCInternal: smtphost X-Proofpoint-Virus-Version: vendor=nai engine=6200 definitions=5800 signatures=585085 X-Proofpoint-ORIG-GUID: wmvF6LnmgVgJDVXl7g_OUCyrajVE1LOu X-Proofpoint-GUID: wmvF6LnmgVgJDVXl7g_OUCyrajVE1LOu X-Proofpoint-Virus-Version: vendor=baseguard engine=ICAP:2.0.254,Aquarius:18.0.942,Hydra:6.0.573,FMLib:17.11.170.22 definitions=2023-04-20_08,2023-04-20_01,2023-02-09_01 X-Proofpoint-Spam-Details: rule=outbound_notspam policy=outbound score=0 priorityscore=1501 mlxscore=0 bulkscore=0 spamscore=0 clxscore=1015 impostorscore=0 suspectscore=0 phishscore=0 adultscore=0 mlxlogscore=826 malwarescore=0 lowpriorityscore=0 classifier=spam adjust=0 reason=mlx scancount=1 engine=8.12.0-2303200000 definitions=main-2304200102 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=205.220.180.131; envelope-from=quic_mathbern@quicinc.com; helo=mx0b-0031df01.pphosted.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, 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 @quicinc.com) X-ZM-MESSAGEID: 1681994151176100011 Content-Type: text/plain; charset="utf-8" From: Brian Cain Signed-off-by: Brian Cain Signed-off-by: Matheus Tavares Bernardino --- target/hexagon/gdb_qreginfo.h | 124 ++++++++++++++++++++++++++++++++++ target/hexagon/cpu.c | 3 + 2 files changed, 127 insertions(+) create mode 100644 target/hexagon/gdb_qreginfo.h diff --git a/target/hexagon/gdb_qreginfo.h b/target/hexagon/gdb_qreginfo.h new file mode 100644 index 0000000000..64631ddd58 --- /dev/null +++ b/target/hexagon/gdb_qreginfo.h @@ -0,0 +1,124 @@ +/* + * Copyright(c) 2023 Qualcomm Innovation Center, Inc. All Rights Reserved. + * + * This program is free software; you can redistribute it and/or modify + * it under the terms of the GNU General Public License as published by + * the Free Software Foundation; either version 2 of the License, or + * (at your option) any later version. + * + * This program is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + * GNU General Public License for more details. + * + * You should have received a copy of the GNU General Public License + * along with this program; if not, see . + */ + +#ifndef HEXAGON_GDB_QREGINFO_H +#define HEXAGON_GDB_QREGINFO_H + +const char * const hexagon_qreg_descs[] =3D { + "name:r00;alt-name:r0;bitsize:32;offset=3D0;variable-size:0;encoding:u= int;format:hex;set:Thread Registers;dwarf:0;generic:r00;", + "name:r01;alt-name:r1;bitsize:32;offset=3D4;variable-size:0;encoding:u= int;format:hex;set:Thread Registers;dwarf:1;generic:r01;", + "name:r02;alt-name:r2;bitsize:32;offset=3D8;variable-size:0;encoding:u= int;format:hex;set:Thread Registers;dwarf:2;generic:r02;", + "name:r03;alt-name:r3;bitsize:32;offset=3D12;variable-size:0;encoding:= uint;format:hex;set:Thread Registers;dwarf:3;generic:r03;", + "name:r04;alt-name:r4;bitsize:32;offset=3D16;variable-size:0;encoding:= uint;format:hex;set:Thread Registers;dwarf:4;generic:r04;", + "name:r05;alt-name:r5;bitsize:32;offset=3D20;variable-size:0;encoding:= uint;format:hex;set:Thread Registers;dwarf:5;generic:r05;", + "name:r06;alt-name:r6;bitsize:32;offset=3D24;variable-size:0;encoding:= uint;format:hex;set:Thread Registers;dwarf:6;generic:r06;", + "name:r07;alt-name:r7;bitsize:32;offset=3D28;variable-size:0;encoding:= uint;format:hex;set:Thread Registers;dwarf:7;generic:r07;", + "name:r08;alt-name:r8;bitsize:32;offset=3D32;variable-size:0;encoding:= uint;format:hex;set:Thread Registers;dwarf:8;generic:r08;", + "name:r09;alt-name:r9;bitsize:32;offset=3D36;variable-size:0;encoding:= uint;format:hex;set:Thread Registers;dwarf:9;generic:r09;", + "name:r10;alt-name:;bitsize:32;offset=3D40;variable-size:0;encoding:ui= nt;format:hex;set:Thread Registers;dwarf:10;generic:;", + "name:r11;alt-name:;bitsize:32;offset=3D44;variable-size:0;encoding:ui= nt;format:hex;set:Thread Registers;dwarf:11;generic:;", + "name:r12;alt-name:;bitsize:32;offset=3D48;variable-size:0;encoding:ui= nt;format:hex;set:Thread Registers;dwarf:12;generic:;", + "name:r13;alt-name:;bitsize:32;offset=3D52;variable-size:0;encoding:ui= nt;format:hex;set:Thread Registers;dwarf:13;generic:;", + "name:r14;alt-name:;bitsize:32;offset=3D56;variable-size:0;encoding:ui= nt;format:hex;set:Thread Registers;dwarf:14;generic:;", + "name:r15;alt-name:;bitsize:32;offset=3D60;variable-size:0;encoding:ui= nt;format:hex;set:Thread Registers;dwarf:15;generic:;", + "name:r16;alt-name:;bitsize:32;offset=3D64;variable-size:0;encoding:ui= nt;format:hex;set:Thread Registers;dwarf:16;generic:;", + "name:r17;alt-name:;bitsize:32;offset=3D68;variable-size:0;encoding:ui= nt;format:hex;set:Thread Registers;dwarf:17;generic:;", + "name:r18;alt-name:;bitsize:32;offset=3D72;variable-size:0;encoding:ui= nt;format:hex;set:Thread Registers;dwarf:18;generic:;", + "name:r19;alt-name:;bitsize:32;offset=3D76;variable-size:0;encoding:ui= nt;format:hex;set:Thread Registers;dwarf:19;generic:;", + "name:r20;alt-name:;bitsize:32;offset=3D80;variable-size:0;encoding:ui= nt;format:hex;set:Thread Registers;dwarf:20;generic:;", + "name:r21;alt-name:;bitsize:32;offset=3D84;variable-size:0;encoding:ui= nt;format:hex;set:Thread Registers;dwarf:21;generic:;", + "name:r22;alt-name:;bitsize:32;offset=3D88;variable-size:0;encoding:ui= nt;format:hex;set:Thread Registers;dwarf:22;generic:;", + "name:r23;alt-name:;bitsize:32;offset=3D92;variable-size:0;encoding:ui= nt;format:hex;set:Thread Registers;dwarf:23;generic:;", + "name:r24;alt-name:;bitsize:32;offset=3D96;variable-size:0;encoding:ui= nt;format:hex;set:Thread Registers;dwarf:24;generic:;", + "name:r25;alt-name:;bitsize:32;offset=3D100;variable-size:0;encoding:u= int;format:hex;set:Thread Registers;dwarf:25;generic:;", + "name:r26;alt-name:;bitsize:32;offset=3D104;variable-size:0;encoding:u= int;format:hex;set:Thread Registers;dwarf:26;generic:;", + "name:r27;alt-name:;bitsize:32;offset=3D108;variable-size:0;encoding:u= int;format:hex;set:Thread Registers;dwarf:27;generic:;", + "name:r28;alt-name:;bitsize:32;offset=3D112;variable-size:0;encoding:u= int;format:hex;set:Thread Registers;dwarf:28;generic:;", + "name:r29;alt-name:sp;bitsize:32;offset=3D116;variable-size:0;encoding= :uint;format:hex;set:Thread Registers;dwarf:29;generic:sp;", + "name:r30;alt-name:fp;bitsize:32;offset=3D120;variable-size:0;encoding= :uint;format:hex;set:Thread Registers;dwarf:30;generic:fp;", + "name:r31;alt-name:ra;bitsize:32;offset=3D124;variable-size:0;encoding= :uint;format:hex;set:Thread Registers;dwarf:31;generic:ra;", + "name:sa0;alt-name:;bitsize:32;offset=3D128;variable-size:0;encoding:u= int;format:hex;set:Thread Registers;dwarf:32;generic:;", + "name:lc0;alt-name:;bitsize:32;offset=3D132;variable-size:0;encoding:u= int;format:hex;set:Thread Registers;dwarf:33;generic:;", + "name:sa1;alt-name:;bitsize:32;offset=3D136;variable-size:0;encoding:u= int;format:hex;set:Thread Registers;dwarf:34;generic:;", + "name:lc1;alt-name:;bitsize:32;offset=3D140;variable-size:0;encoding:u= int;format:hex;set:Thread Registers;dwarf:35;generic:;", + "name:p3_0;alt-name:;bitsize:32;offset=3D144;variable-size:0;encoding:= uint;format:hex;set:Thread Registers;dwarf:36;generic:;", + "name:c5;alt-name:;bitsize:32;offset=3D148;variable-size:0;encoding:ui= nt;format:hex;set:Thread Registers;dwarf:37;generic:;", + "name:m0;alt-name:;bitsize:32;offset=3D152;variable-size:0;encoding:ui= nt;format:hex;set:Thread Registers;dwarf:38;generic:;", + "name:m1;alt-name:;bitsize:32;offset=3D156;variable-size:0;encoding:ui= nt;format:hex;set:Thread Registers;dwarf:39;generic:;", + "name:usr;alt-name:;bitsize:32;offset=3D160;variable-size:0;encoding:u= int;format:hex;set:Thread Registers;dwarf:40;generic:;", + "name:pc;alt-name:pc;bitsize:32;offset=3D164;variable-size:0;encoding:= uint;format:hex;set:Thread Registers;dwarf:41;generic:pc;", + "name:ugp;alt-name:;bitsize:32;offset=3D168;variable-size:0;encoding:u= int;format:hex;set:Thread Registers;dwarf:42;generic:;", + "name:gp;alt-name:;bitsize:32;offset=3D172;variable-size:0;encoding:ui= nt;format:hex;set:Thread Registers;dwarf:43;generic:;", + "name:cs0;alt-name:;bitsize:32;offset=3D176;variable-size:0;encoding:u= int;format:hex;set:Thread Registers;dwarf:44;generic:;", + "name:cs1;alt-name:;bitsize:32;offset=3D180;variable-size:0;encoding:u= int;format:hex;set:Thread Registers;dwarf:45;generic:;", + "name:upcyclelo;alt-name:;bitsize:32;offset=3D184;variable-size:0;enco= ding:uint;format:hex;set:Thread Registers;dwarf:46;generic:;", + "name:upcyclehi;alt-name:;bitsize:32;offset=3D188;variable-size:0;enco= ding:uint;format:hex;set:Thread Registers;dwarf:47;generic:;", + "name:framelimit;alt-name:;bitsize:32;offset=3D192;variable-size:0;enc= oding:uint;format:hex;set:Thread Registers;dwarf:48;generic:;", + "name:framekey;alt-name:;bitsize:32;offset=3D196;variable-size:0;encod= ing:uint;format:hex;set:Thread Registers;dwarf:49;generic:;", + "name:pktcountlo;alt-name:;bitsize:32;offset=3D200;variable-size:0;enc= oding:uint;format:hex;set:Thread Registers;dwarf:50;generic:;", + "name:pktcounthi;alt-name:;bitsize:32;offset=3D204;variable-size:0;enc= oding:uint;format:hex;set:Thread Registers;dwarf:51;generic:;", + "name:pkt_cnt;alt-name:;bitsize:32;offset=3D208;variable-size:0;encodi= ng:uint;format:hex;set:Thread Registers;dwarf:52;generic:;", + "name:insn_cnt;alt-name:;bitsize:32;offset=3D212;variable-size:0;encod= ing:uint;format:hex;set:Thread Registers;dwarf:53;generic:;", + "name:hvx_cnt;alt-name:;bitsize:32;offset=3D216;variable-size:0;encodi= ng:uint;format:hex;set:Thread Registers;dwarf:54;generic:;", + "name:c23;alt-name:;bitsize:32;offset=3D220;variable-size:0;encoding:u= int;format:hex;set:Thread Registers;dwarf:55;generic:;", + "name:c24;alt-name:;bitsize:32;offset=3D224;variable-size:0;encoding:u= int;format:hex;set:Thread Registers;dwarf:56;generic:;", + "name:c25;alt-name:;bitsize:32;offset=3D228;variable-size:0;encoding:u= int;format:hex;set:Thread Registers;dwarf:57;generic:;", + "name:c26;alt-name:;bitsize:32;offset=3D232;variable-size:0;encoding:u= int;format:hex;set:Thread Registers;dwarf:58;generic:;", + "name:c27;alt-name:;bitsize:32;offset=3D236;variable-size:0;encoding:u= int;format:hex;set:Thread Registers;dwarf:59;generic:;", + "name:c28;alt-name:;bitsize:32;offset=3D240;variable-size:0;encoding:u= int;format:hex;set:Thread Registers;dwarf:60;generic:;", + "name:c29;alt-name:;bitsize:32;offset=3D244;variable-size:0;encoding:u= int;format:hex;set:Thread Registers;dwarf:61;generic:;", + "name:utimerlo;alt-name:;bitsize:32;offset=3D248;variable-size:0;encod= ing:uint;format:hex;set:Thread Registers;dwarf:62;generic:;", + "name:utimerhi;alt-name:;bitsize:32;offset=3D252;variable-size:0;encod= ing:uint;format:hex;set:Thread Registers;dwarf:63;generic:;", + "name:v0;alt-name:;bitsize:1024;offset=3D256;variable-size:1;encoding:= vector;format:hex;set:HVX Vector Registers;dwarf:88;generic:;", + "name:v1;alt-name:;bitsize:1024;offset=3D384;variable-size:1;encoding:= vector;format:hex;set:HVX Vector Registers;dwarf:89;generic:;", + "name:v2;alt-name:;bitsize:1024;offset=3D512;variable-size:1;encoding:= vector;format:hex;set:HVX Vector Registers;dwarf:90;generic:;", + "name:v3;alt-name:;bitsize:1024;offset=3D640;variable-size:1;encoding:= vector;format:hex;set:HVX Vector Registers;dwarf:91;generic:;", + "name:v4;alt-name:;bitsize:1024;offset=3D768;variable-size:1;encoding:= vector;format:hex;set:HVX Vector Registers;dwarf:92;generic:;", + "name:v5;alt-name:;bitsize:1024;offset=3D896;variable-size:1;encoding:= vector;format:hex;set:HVX Vector Registers;dwarf:93;generic:;", + "name:v6;alt-name:;bitsize:1024;offset=3D1024;variable-size:1;encoding= :vector;format:hex;set:HVX Vector Registers;dwarf:94;generic:;", + "name:v7;alt-name:;bitsize:1024;offset=3D1152;variable-size:1;encoding= :vector;format:hex;set:HVX Vector Registers;dwarf:95;generic:;", + "name:v8;alt-name:;bitsize:1024;offset=3D1280;variable-size:1;encoding= :vector;format:hex;set:HVX Vector Registers;dwarf:96;generic:;", + "name:v9;alt-name:;bitsize:1024;offset=3D1408;variable-size:1;encoding= :vector;format:hex;set:HVX Vector Registers;dwarf:97;generic:;", + "name:v10;alt-name:;bitsize:1024;offset=3D1536;variable-size:1;encodin= g:vector;format:hex;set:HVX Vector Registers;dwarf:98;generic:;", + "name:v11;alt-name:;bitsize:1024;offset=3D1664;variable-size:1;encodin= g:vector;format:hex;set:HVX Vector Registers;dwarf:99;generic:;", + "name:v12;alt-name:;bitsize:1024;offset=3D1792;variable-size:1;encodin= g:vector;format:hex;set:HVX Vector Registers;dwarf:100;generic:;", + "name:v13;alt-name:;bitsize:1024;offset=3D1920;variable-size:1;encodin= g:vector;format:hex;set:HVX Vector Registers;dwarf:101;generic:;", + "name:v14;alt-name:;bitsize:1024;offset=3D2048;variable-size:1;encodin= g:vector;format:hex;set:HVX Vector Registers;dwarf:102;generic:;", + "name:v15;alt-name:;bitsize:1024;offset=3D2176;variable-size:1;encodin= g:vector;format:hex;set:HVX Vector Registers;dwarf:103;generic:;", + "name:v16;alt-name:;bitsize:1024;offset=3D2304;variable-size:1;encodin= g:vector;format:hex;set:HVX Vector Registers;dwarf:104;generic:;", + "name:v17;alt-name:;bitsize:1024;offset=3D2432;variable-size:1;encodin= g:vector;format:hex;set:HVX Vector Registers;dwarf:105;generic:;", + "name:v18;alt-name:;bitsize:1024;offset=3D2560;variable-size:1;encodin= g:vector;format:hex;set:HVX Vector Registers;dwarf:106;generic:;", + "name:v19;alt-name:;bitsize:1024;offset=3D2688;variable-size:1;encodin= g:vector;format:hex;set:HVX Vector Registers;dwarf:107;generic:;", + "name:v20;alt-name:;bitsize:1024;offset=3D2816;variable-size:1;encodin= g:vector;format:hex;set:HVX Vector Registers;dwarf:108;generic:;", + "name:v21;alt-name:;bitsize:1024;offset=3D2944;variable-size:1;encodin= g:vector;format:hex;set:HVX Vector Registers;dwarf:109;generic:;", + "name:v22;alt-name:;bitsize:1024;offset=3D3072;variable-size:1;encodin= g:vector;format:hex;set:HVX Vector Registers;dwarf:110;generic:;", + "name:v23;alt-name:;bitsize:1024;offset=3D3200;variable-size:1;encodin= g:vector;format:hex;set:HVX Vector Registers;dwarf:111;generic:;", + "name:v24;alt-name:;bitsize:1024;offset=3D3328;variable-size:1;encodin= g:vector;format:hex;set:HVX Vector Registers;dwarf:112;generic:;", + "name:v25;alt-name:;bitsize:1024;offset=3D3456;variable-size:1;encodin= g:vector;format:hex;set:HVX Vector Registers;dwarf:113;generic:;", + "name:v26;alt-name:;bitsize:1024;offset=3D3584;variable-size:1;encodin= g:vector;format:hex;set:HVX Vector Registers;dwarf:114;generic:;", + "name:v27;alt-name:;bitsize:1024;offset=3D3712;variable-size:1;encodin= g:vector;format:hex;set:HVX Vector Registers;dwarf:115;generic:;", + "name:v28;alt-name:;bitsize:1024;offset=3D3840;variable-size:1;encodin= g:vector;format:hex;set:HVX Vector Registers;dwarf:116;generic:;", + "name:v29;alt-name:;bitsize:1024;offset=3D3968;variable-size:1;encodin= g:vector;format:hex;set:HVX Vector Registers;dwarf:117;generic:;", + "name:v30;alt-name:;bitsize:1024;offset=3D4096;variable-size:1;encodin= g:vector;format:hex;set:HVX Vector Registers;dwarf:118;generic:;", + "name:v31;alt-name:;bitsize:1024;offset=3D4224;variable-size:1;encodin= g:vector;format:hex;set:HVX Vector Registers;dwarf:119;generic:;", + "name:q0;alt-name:;bitsize:128;offset=3D4352;variable-size:1;encoding:= vector;format:hex;set:HVX Vector Registers;dwarf:120;generic:;", + "name:q1;alt-name:;bitsize:128;offset=3D4368;variable-size:1;encoding:= vector;format:hex;set:HVX Vector Registers;dwarf:121;generic:;", + "name:q2;alt-name:;bitsize:128;offset=3D4384;variable-size:1;encoding:= vector;format:hex;set:HVX Vector Registers;dwarf:122;generic:;", + "name:q3;alt-name:;bitsize:128;offset=3D4400;variable-size:1;encoding:= vector;format:hex;set:HVX Vector Registers;dwarf:123;generic:;", +}; + +#endif /* HEXAGON_GDB_QREGINFO_H */ diff --git a/target/hexagon/cpu.c b/target/hexagon/cpu.c index ab40cfc283..aa470d9ee4 100644 --- a/target/hexagon/cpu.c +++ b/target/hexagon/cpu.c @@ -19,6 +19,7 @@ #include "qemu/qemu-print.h" #include "cpu.h" #include "internal.h" +#include "gdb_qreginfo.h" #include "exec/exec-all.h" #include "qapi/error.h" #include "hw/qdev-properties.h" @@ -358,6 +359,8 @@ static void hexagon_cpu_class_init(ObjectClass *c, void= *data) cc->get_pc =3D hexagon_cpu_get_pc; cc->gdb_read_register =3D hexagon_gdb_read_register; cc->gdb_write_register =3D hexagon_gdb_write_register; + cc->gdb_qreg_info_lines =3D (const char **)hexagon_qreg_descs; + cc->gdb_qreg_info_line_count =3D ARRAY_SIZE(hexagon_qreg_descs); cc->gdb_num_core_regs =3D TOTAL_PER_THREAD_REGS + NUM_VREGS + NUM_QREG= S; cc->gdb_stop_before_watchpoint =3D true; cc->disas_set_info =3D hexagon_cpu_disas_set_info; --=20 2.39.1 From nobody Thu May 9 23:20:59 2024 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=quicinc.com ARC-Seal: i=1; a=rsa-sha256; t=1681994289; cv=none; d=zohomail.com; s=zohoarc; b=PjbYmRxwCeEBsD2gLmrVFoj3fnoN1kxzf2QFLSacNDEONegLtyCUx/gzYcBOypdI8fRD0c+GKicvL5NnV1VcydedaK/NaHp1YzETTmfvL7rpVxgzkQ1hUnxEneDbvjl8scnMlRikfCxWkNFl3UcjSSOBPbM5TzlbxJsHFCheNCM= ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=zohomail.com; s=zohoarc; t=1681994289; 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=lDnPuVW+bt4qKT8tGkYwgTa6W5/3YdygFC4dQ7djZFM=; b=Zmvps4agpSIXE7vkr+sx7O1/VhGgLIKXrfETle9rbNlFBrUdvBcB1oDuu/lxUPv/dq9wIi2hFRwp6dOb+F/yvliFsGK2NqIq7QNu+YI8xdXpue6ncJ4mkYW+hf61PLe88lmBAVtdY/LsW9vO6Mg5eWAOvfXs/mwsj4i8BEVFvRY= 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 1681994289768853.5921383100464; Thu, 20 Apr 2023 05:38:09 -0700 (PDT) Received: from localhost ([::1] helo=lists1p.gnu.org) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1ppTSR-0006ez-ER; Thu, 20 Apr 2023 08:32:15 -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 1ppTSI-0006ZC-21 for qemu-devel@nongnu.org; Thu, 20 Apr 2023 08:32:13 -0400 Received: from mx0a-0031df01.pphosted.com ([205.220.168.131]) by eggs.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.90_1) (envelope-from ) id 1ppTSF-0002rV-BO for qemu-devel@nongnu.org; Thu, 20 Apr 2023 08:32:04 -0400 Received: from pps.filterd (m0279862.ppops.net [127.0.0.1]) by mx0a-0031df01.pphosted.com (8.17.1.19/8.17.1.19) with ESMTP id 33KAq55P010228; Thu, 20 Apr 2023 12:32:00 GMT Received: from nalasppmta01.qualcomm.com (Global_NAT1.qualcomm.com [129.46.96.20]) by mx0a-0031df01.pphosted.com (PPS) with ESMTPS id 3q2xuhs0a8-1 (version=TLSv1.2 cipher=ECDHE-RSA-AES256-GCM-SHA384 bits=256 verify=NOT); Thu, 20 Apr 2023 12:32:00 +0000 Received: from nalasex01a.na.qualcomm.com (nalasex01a.na.qualcomm.com [10.47.209.196]) by NALASPPMTA01.qualcomm.com (8.17.1.5/8.17.1.5) with ESMTPS id 33KCVxGj015420 (version=TLSv1.2 cipher=ECDHE-RSA-AES256-GCM-SHA384 bits=256 verify=NOT); Thu, 20 Apr 2023 12:31:59 GMT Received: from NASANPPMTA03.qualcomm.com (10.80.80.8) by nalasex01a.na.qualcomm.com (10.47.209.196) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.2.986.42; Thu, 20 Apr 2023 05:31:57 -0700 DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=quicinc.com; h=from : to : cc : subject : date : message-id : in-reply-to : references : mime-version : content-transfer-encoding : content-type; s=qcppdkim1; bh=lDnPuVW+bt4qKT8tGkYwgTa6W5/3YdygFC4dQ7djZFM=; b=d81IunEI+lruPX767apuVUGTWobanyP2KMh/z5N+cVXulUcIceZVrVISx8LKpMQHJLIj JhUU+o9TluqxZC9ubtv9FTFjcuqHXdABnnB9kAtshFlQorPqBEzH3g1Ux9FHeaGT8Mlu 5AquhWcSix67oGqKeYg5ITs1LHXcIlLuIvQVa0dUkLVm9/Hsmdla7EhcZrz9eduu1I0X vFi8agJP356ManTLuwlVuNCcau5lSBa6XPfbZeDlRlk+iM7Cwr9RnCUmPP8P3gc+whGW KuBuLRVO8hdCzwFRyQvwTAOAyfV2kbS90cgvJ6PHc6EowGiYBAnKLdnhsxzi6G19TKMZ 2w== From: Matheus Tavares Bernardino To: CC: , , , , , Sid Manning Subject: [PATCH v2 RESEND 5/7] Hexagon (gdbstub): fix p3:0 read and write via stub Date: Thu, 20 Apr 2023 09:31:26 -0300 Message-ID: <47bea2e5047e942a5638757849c0b9834a3a8323.1681993775.git.quic_mathbern@quicinc.com> X-Mailer: git-send-email 2.39.1 In-Reply-To: References: MIME-Version: 1.0 Content-Transfer-Encoding: quoted-printable X-Originating-IP: [10.80.80.8] X-ClientProxiedBy: nasanex01a.na.qualcomm.com (10.52.223.231) To nalasex01a.na.qualcomm.com (10.47.209.196) X-QCInternal: smtphost X-Proofpoint-Virus-Version: vendor=nai engine=6200 definitions=5800 signatures=585085 X-Proofpoint-ORIG-GUID: Opzurb29BRqNjxLW_4b6MpHyncMhnp5o X-Proofpoint-GUID: Opzurb29BRqNjxLW_4b6MpHyncMhnp5o X-Proofpoint-Virus-Version: vendor=baseguard engine=ICAP:2.0.254,Aquarius:18.0.942,Hydra:6.0.573,FMLib:17.11.170.22 definitions=2023-04-20_08,2023-04-20_01,2023-02-09_01 X-Proofpoint-Spam-Details: rule=outbound_notspam policy=outbound score=0 clxscore=1015 impostorscore=0 phishscore=0 spamscore=0 mlxscore=0 bulkscore=0 lowpriorityscore=0 malwarescore=0 suspectscore=0 adultscore=0 priorityscore=1501 mlxlogscore=675 classifier=spam adjust=0 reason=mlx scancount=1 engine=8.12.0-2303200000 definitions=main-2304200102 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=205.220.168.131; envelope-from=quic_mathbern@quicinc.com; helo=mx0a-0031df01.pphosted.com X-Spam_score_int: -27 X-Spam_score: -2.8 X-Spam_bar: -- X-Spam_report: (-2.8 / 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_LOW=-0.7, 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 @quicinc.com) X-ZM-MESSAGEID: 1681994291163100013 Content-Type: text/plain; charset="utf-8" From: Brian Cain Co-authored-by: Sid Manning Signed-off-by: Sid Manning Signed-off-by: Brian Cain Co-authored-by: Matheus Tavares Bernardino Signed-off-by: Matheus Tavares Bernardino Reviewed-by: Taylor Simpson --- target/hexagon/gdbstub.c | 16 ++++++++++++++++ 1 file changed, 16 insertions(+) diff --git a/target/hexagon/gdbstub.c b/target/hexagon/gdbstub.c index 46083da620..a06fed9f18 100644 --- a/target/hexagon/gdbstub.c +++ b/target/hexagon/gdbstub.c @@ -25,6 +25,14 @@ int hexagon_gdb_read_register(CPUState *cs, GByteArray *= mem_buf, int n) HexagonCPU *cpu =3D HEXAGON_CPU(cs); CPUHexagonState *env =3D &cpu->env; =20 + if (n =3D=3D HEX_REG_P3_0_ALIASED) { + uint32_t p3_0 =3D 0; + for (int i =3D 0; i < NUM_PREGS; i++) { + p3_0 =3D deposit32(p3_0, i * 8, 8, env->pred[i]); + } + return gdb_get_regl(mem_buf, p3_0); + } + if (n < TOTAL_PER_THREAD_REGS) { return gdb_get_regl(mem_buf, env->gpr[n]); } @@ -37,6 +45,14 @@ int hexagon_gdb_write_register(CPUState *cs, uint8_t *me= m_buf, int n) HexagonCPU *cpu =3D HEXAGON_CPU(cs); CPUHexagonState *env =3D &cpu->env; =20 + if (n =3D=3D HEX_REG_P3_0_ALIASED) { + uint32_t p3_0 =3D ldtul_p(mem_buf); + for (int i =3D 0; i < NUM_PREGS; i++) { + env->pred[i] =3D extract32(p3_0, i * 8, 8); + } + return sizeof(target_ulong); + } + if (n < TOTAL_PER_THREAD_REGS) { env->gpr[n] =3D ldtul_p(mem_buf); return sizeof(target_ulong); --=20 2.39.1 From nobody Thu May 9 23:20:59 2024 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=quicinc.com ARC-Seal: i=1; a=rsa-sha256; t=1681994148; cv=none; d=zohomail.com; s=zohoarc; b=Zh2lr5tL/XQhEBWkpPfIMqkQqJZ2xkYASSiFa7WQFAuBzOfBfe5+iWgyNQyqfnusDU1vfPBnZDRIHHTnlW4dlR+5ZEPS4DYLratcOeN9faBhWCYH1yvshlZs7FbpOgmtAoprBzjKUb/zFuuYgXtag8SMPsRXljPw1KPKDT1Hwdg= ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=zohomail.com; s=zohoarc; t=1681994148; 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=RrqJDb68COrmEDpVxeUL/BjMz3Co6Gpvkr0HbSwIGXQ=; b=K1A67OTez7RD8my7OSzamrGMbJbeb07g7S7i0dAJXJ7ESRa6dW+HBKRmF1Ke1NQn03oXfZqNpWyH7DS31ZHnESN8dNr1SHXpTFCzZdREnu4CNcE3LZ2vFeOPo808GSLhPgWgTDoBd2Kpyw+8dwWXaL/uPx8K/gjk8zqYNpHzWwE= 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 1681994148485274.1540937577008; Thu, 20 Apr 2023 05:35:48 -0700 (PDT) Received: from localhost ([::1] helo=lists1p.gnu.org) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1ppTSU-0006h2-8R; Thu, 20 Apr 2023 08:32:18 -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 1ppTSR-0006fV-Vi for qemu-devel@nongnu.org; Thu, 20 Apr 2023 08:32:16 -0400 Received: from mx0a-0031df01.pphosted.com ([205.220.168.131]) by eggs.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.90_1) (envelope-from ) id 1ppTSL-0002sJ-9h for qemu-devel@nongnu.org; Thu, 20 Apr 2023 08:32:15 -0400 Received: from pps.filterd (m0279866.ppops.net [127.0.0.1]) by mx0a-0031df01.pphosted.com (8.17.1.19/8.17.1.19) with ESMTP id 33KAorSb021679; Thu, 20 Apr 2023 12:32:03 GMT Received: from nalasppmta02.qualcomm.com (Global_NAT1.qualcomm.com [129.46.96.20]) by mx0a-0031df01.pphosted.com (PPS) with ESMTPS id 3q2uh3hc9d-1 (version=TLSv1.2 cipher=ECDHE-RSA-AES256-GCM-SHA384 bits=256 verify=NOT); Thu, 20 Apr 2023 12:32:02 +0000 Received: from nalasex01a.na.qualcomm.com (nalasex01a.na.qualcomm.com [10.47.209.196]) by NALASPPMTA02.qualcomm.com (8.17.1.5/8.17.1.5) with ESMTPS id 33KCW2lT020407 (version=TLSv1.2 cipher=ECDHE-RSA-AES256-GCM-SHA384 bits=256 verify=NOT); Thu, 20 Apr 2023 12:32:02 GMT Received: from NASANPPMTA03.qualcomm.com (10.80.80.8) by nalasex01a.na.qualcomm.com (10.47.209.196) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.2.986.42; Thu, 20 Apr 2023 05:31:59 -0700 DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=quicinc.com; h=from : to : cc : subject : date : message-id : in-reply-to : references : mime-version : content-transfer-encoding : content-type; s=qcppdkim1; bh=RrqJDb68COrmEDpVxeUL/BjMz3Co6Gpvkr0HbSwIGXQ=; b=guLlCZi6Bbim196LUGbc7aJBpAiJhIbMh4rmE37EeuxJhUsOFobpgAWuWVDN+EYspWUt YuSNlg+Pye0NfEOQNpF53ILTmYmoe9xKRtkDPupC+WK1NbrZfbwj3YQUIksDuxo6XORv sWkQ0JaCGNPXVkbAYGHs9WTYk5wgO/ciNkOVeLQvTIiGD3rF01fPy3ob8UfkrKwPcyA2 aXqR+45wvd149LijnZ9MshmFKjrzY5gufMn9fPSmmUMS+ZioAk1f3wx4biOaN2ffYu2x JHaDTgsmED/+A8Dg60X7001sO6zVaZAffWoNng323ubMIc6OTxug0g3aBCc2zeiPk0zJ Cw== From: Matheus Tavares Bernardino To: CC: , , , , Subject: [PATCH v2 RESEND 6/7] Hexagon (gdbstub): add HVX support Date: Thu, 20 Apr 2023 09:31:27 -0300 Message-ID: X-Mailer: git-send-email 2.39.1 In-Reply-To: References: MIME-Version: 1.0 Content-Transfer-Encoding: quoted-printable X-Originating-IP: [10.80.80.8] X-ClientProxiedBy: nasanex01a.na.qualcomm.com (10.52.223.231) To nalasex01a.na.qualcomm.com (10.47.209.196) X-QCInternal: smtphost X-Proofpoint-Virus-Version: vendor=nai engine=6200 definitions=5800 signatures=585085 X-Proofpoint-ORIG-GUID: _XMjuyNKsr_v-bImedEtOvY1Z06T0ncz X-Proofpoint-GUID: _XMjuyNKsr_v-bImedEtOvY1Z06T0ncz X-Proofpoint-Virus-Version: vendor=baseguard engine=ICAP:2.0.254,Aquarius:18.0.942,Hydra:6.0.573,FMLib:17.11.170.22 definitions=2023-04-20_08,2023-04-20_01,2023-02-09_01 X-Proofpoint-Spam-Details: rule=outbound_notspam policy=outbound score=0 suspectscore=0 phishscore=0 bulkscore=0 spamscore=0 mlxscore=0 malwarescore=0 clxscore=1015 impostorscore=0 lowpriorityscore=0 adultscore=0 mlxlogscore=521 priorityscore=1501 classifier=spam adjust=0 reason=mlx scancount=1 engine=8.12.0-2303200000 definitions=main-2304200102 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=205.220.168.131; envelope-from=quic_mathbern@quicinc.com; helo=mx0a-0031df01.pphosted.com X-Spam_score_int: -27 X-Spam_score: -2.8 X-Spam_bar: -- X-Spam_report: (-2.8 / 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_LOW=-0.7, 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 @quicinc.com) X-ZM-MESSAGEID: 1681994149071100001 Content-Type: text/plain; charset="utf-8" From: Taylor Simpson Co-authored-by: Brian Cain Signed-off-by: Brian Cain Signed-off-by: Taylor Simpson Co-authored-by: Matheus Tavares Bernardino Signed-off-by: Matheus Tavares Bernardino --- target/hexagon/gdbstub.c | 60 ++++++++++++++++++++++++++++++++++++++++ 1 file changed, 60 insertions(+) diff --git a/target/hexagon/gdbstub.c b/target/hexagon/gdbstub.c index a06fed9f18..6c5a15da68 100644 --- a/target/hexagon/gdbstub.c +++ b/target/hexagon/gdbstub.c @@ -20,6 +20,26 @@ #include "cpu.h" #include "internal.h" =20 +static int gdb_get_vreg(CPUHexagonState *env, GByteArray *mem_buf, int n) +{ + int total =3D 0; + int i; + for (i =3D 0; i < ARRAY_SIZE(env->VRegs[n].uw); i++) { + total +=3D gdb_get_regl(mem_buf, env->VRegs[n].uw[i]); + } + return total; +} + +static int gdb_get_qreg(CPUHexagonState *env, GByteArray *mem_buf, int n) +{ + int total =3D 0; + int i; + for (i =3D 0; i < ARRAY_SIZE(env->QRegs[n].uw); i++) { + total +=3D gdb_get_regl(mem_buf, env->QRegs[n].uw[i]); + } + return total; +} + int hexagon_gdb_read_register(CPUState *cs, GByteArray *mem_buf, int n) { HexagonCPU *cpu =3D HEXAGON_CPU(cs); @@ -36,10 +56,40 @@ int hexagon_gdb_read_register(CPUState *cs, GByteArray = *mem_buf, int n) if (n < TOTAL_PER_THREAD_REGS) { return gdb_get_regl(mem_buf, env->gpr[n]); } + n -=3D TOTAL_PER_THREAD_REGS; + + if (n < NUM_VREGS) { + return gdb_get_vreg(env, mem_buf, n); + } + n -=3D NUM_VREGS; + + if (n < NUM_QREGS) { + return gdb_get_qreg(env, mem_buf, n); + } =20 g_assert_not_reached(); } =20 +static int gdb_put_vreg(CPUHexagonState *env, uint8_t *mem_buf, int n) +{ + int i; + for (i =3D 0; i < ARRAY_SIZE(env->VRegs[n].uw); i++) { + env->VRegs[n].uw[i] =3D ldtul_p(mem_buf); + mem_buf +=3D 4; + } + return MAX_VEC_SIZE_BYTES; +} + +static int gdb_put_qreg(CPUHexagonState *env, uint8_t *mem_buf, int n) +{ + int i; + for (i =3D 0; i < ARRAY_SIZE(env->QRegs[n].uw); i++) { + env->QRegs[n].uw[i] =3D ldtul_p(mem_buf); + mem_buf +=3D 4; + } + return MAX_VEC_SIZE_BYTES / 8; +} + int hexagon_gdb_write_register(CPUState *cs, uint8_t *mem_buf, int n) { HexagonCPU *cpu =3D HEXAGON_CPU(cs); @@ -57,6 +107,16 @@ int hexagon_gdb_write_register(CPUState *cs, uint8_t *m= em_buf, int n) env->gpr[n] =3D ldtul_p(mem_buf); return sizeof(target_ulong); } + n -=3D TOTAL_PER_THREAD_REGS; + + if (n < NUM_VREGS) { + return gdb_put_vreg(env, mem_buf, n); + } + n -=3D NUM_VREGS; + + if (n < NUM_QREGS) { + return gdb_put_qreg(env, mem_buf, n); + } =20 g_assert_not_reached(); } --=20 2.39.1 From nobody Thu May 9 23:20:59 2024 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=quicinc.com ARC-Seal: i=1; a=rsa-sha256; t=1681993979; cv=none; d=zohomail.com; s=zohoarc; b=KbdXfUBBfa8L2Nx9n8N8J56CPlWmEY7XHle8YxKrAwh0FQ7SnJnHkIiDtf1TVi5E3D03R01dNIXi1/U3eGUF+BYtUVntPS6bCIOPQSNiwd9wJ2eBWNQxpQwaNcRnplyQa71Wm+JDOLriyGiOeEEMY40d7yi5rFay/J/pMXAVMSU= ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=zohomail.com; s=zohoarc; t=1681993979; 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=l+PakLmISjH8ZXiG9fvj+CGW8xYCbPmP0sFZ3X9jV8g=; b=lOaerogGY0WKFrIG9QkYKaUB/Ui6un/Kd8RFnzE5UC0zy0ja1DvYYsv8eAwu6eM990JlyvG0dU260e5+U11jSOCnV/Qg1Z70nKKUL8FCyRvw7mis9ATGyaFHXVYM7WkT1v3FvmxA3dHQHIeNJhyv4h7Lk37fITx5sAwInB4zJDc= 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 1681993979443488.7821930058319; Thu, 20 Apr 2023 05:32:59 -0700 (PDT) Received: from localhost ([::1] helo=lists1p.gnu.org) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1ppTSS-0006ff-EC; Thu, 20 Apr 2023 08:32:16 -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 1ppTSQ-0006dj-L9 for qemu-devel@nongnu.org; Thu, 20 Apr 2023 08:32:14 -0400 Received: from mx0b-0031df01.pphosted.com ([205.220.180.131]) by eggs.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.90_1) (envelope-from ) id 1ppTSL-0002tQ-Ag for qemu-devel@nongnu.org; Thu, 20 Apr 2023 08:32:14 -0400 Received: from pps.filterd (m0279873.ppops.net [127.0.0.1]) by mx0a-0031df01.pphosted.com (8.17.1.19/8.17.1.19) with ESMTP id 33KAq5nj015089; Thu, 20 Apr 2023 12:32:07 GMT Received: from nalasppmta04.qualcomm.com (Global_NAT1.qualcomm.com [129.46.96.20]) by mx0a-0031df01.pphosted.com (PPS) with ESMTPS id 3q2qv3hsr6-1 (version=TLSv1.2 cipher=ECDHE-RSA-AES256-GCM-SHA384 bits=256 verify=NOT); Thu, 20 Apr 2023 12:32:07 +0000 Received: from nalasex01a.na.qualcomm.com (nalasex01a.na.qualcomm.com [10.47.209.196]) by NALASPPMTA04.qualcomm.com (8.17.1.5/8.17.1.5) with ESMTPS id 33KCW6iu028249 (version=TLSv1.2 cipher=ECDHE-RSA-AES256-GCM-SHA384 bits=256 verify=NOT); Thu, 20 Apr 2023 12:32:06 GMT Received: from NASANPPMTA03.qualcomm.com (10.80.80.8) by nalasex01a.na.qualcomm.com (10.47.209.196) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.2.986.42; Thu, 20 Apr 2023 05:32:02 -0700 DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=quicinc.com; h=from : to : cc : subject : date : message-id : in-reply-to : references : mime-version : content-transfer-encoding : content-type; s=qcppdkim1; bh=l+PakLmISjH8ZXiG9fvj+CGW8xYCbPmP0sFZ3X9jV8g=; b=Be394gwlS3O18r+2D+UkLIPlm5mOWYp5igeYCj8rUdyfNymYHHQAmIfIq5gW/1Aqsg1f FYHDbSyzbgjSQ0groY+niOrOTxjLljqxpXKSoZdGpWuepbhtJar0Nrv6tB4621l7mV+B +3ydMeD7C5ekkNIwWCoRQpX8O46k7OrjPDgVSfgjPvc+vMFMQ2yxMkN2rr9kkQ0wOvvw qBJYBNvxHZH9RvzyD6fx0sOY7AsKadEfJShm9SrU03p8hkgtcF9ScRLBch/u7yuwC+Tp fIaM5an5Ok9wMqSTMSrBQ1LsojBA43SCty8CeCoF390Om85acPBPjkGXvgemvpFsfrPv rQ== From: Matheus Tavares Bernardino To: CC: , , , , , Laurent Vivier Subject: [PATCH v2 RESEND 7/7] Hexagon (linux-user/hexagon): handle breakpoints Date: Thu, 20 Apr 2023 09:31:28 -0300 Message-ID: <26f1f1cc2c23fe4669326cabe5615188be9afc06.1681993775.git.quic_mathbern@quicinc.com> X-Mailer: git-send-email 2.39.1 In-Reply-To: References: MIME-Version: 1.0 Content-Transfer-Encoding: quoted-printable X-Originating-IP: [10.80.80.8] X-ClientProxiedBy: nasanex01a.na.qualcomm.com (10.52.223.231) To nalasex01a.na.qualcomm.com (10.47.209.196) X-QCInternal: smtphost X-Proofpoint-Virus-Version: vendor=nai engine=6200 definitions=5800 signatures=585085 X-Proofpoint-GUID: 9N78YQlwxsHgN2ZE5AQERQTjE7SptwiF X-Proofpoint-ORIG-GUID: 9N78YQlwxsHgN2ZE5AQERQTjE7SptwiF X-Proofpoint-Virus-Version: vendor=baseguard engine=ICAP:2.0.254,Aquarius:18.0.942,Hydra:6.0.573,FMLib:17.11.170.22 definitions=2023-04-20_08,2023-04-20_01,2023-02-09_01 X-Proofpoint-Spam-Details: rule=outbound_notspam policy=outbound score=0 clxscore=1011 phishscore=0 bulkscore=0 adultscore=0 spamscore=0 lowpriorityscore=0 malwarescore=0 suspectscore=0 impostorscore=0 mlxscore=0 priorityscore=1501 mlxlogscore=724 classifier=spam adjust=0 reason=mlx scancount=1 engine=8.12.0-2303200000 definitions=main-2304200101 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=205.220.180.131; envelope-from=quic_mathbern@quicinc.com; helo=mx0b-0031df01.pphosted.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, 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 @quicinc.com) X-ZM-MESSAGEID: 1681993981116100003 Content-Type: text/plain; charset="utf-8" From: Taylor Simpson This enables LLDB to work with hexagon linux-user mode through the GDB remote protocol. Signed-off-by: Taylor Simpson Signed-off-by: Matheus Tavares Bernardino --- linux-user/hexagon/cpu_loop.c | 10 ++++++++++ 1 file changed, 10 insertions(+) diff --git a/linux-user/hexagon/cpu_loop.c b/linux-user/hexagon/cpu_loop.c index b84e25bf71..00c12bbb55 100644 --- a/linux-user/hexagon/cpu_loop.c +++ b/linux-user/hexagon/cpu_loop.c @@ -33,6 +33,7 @@ void cpu_loop(CPUHexagonState *env) target_ulong ret; =20 for (;;) { + target_siginfo_t info; cpu_exec_start(cs); trapnr =3D cpu_exec(cs); cpu_exec_end(cs); @@ -63,6 +64,15 @@ void cpu_loop(CPUHexagonState *env) case EXCP_ATOMIC: cpu_exec_step_atomic(cs); break; + case EXCP_DEBUG: + info =3D (target_siginfo_t) { + .si_signo =3D TARGET_SIGTRAP, + .si_errno =3D 0, + .si_code =3D TARGET_TRAP_BRKPT, + ._sifields._sigfault._addr =3D 0 + }; + queue_signal(env, info.si_signo, QEMU_SI_KILL, &info); + break; default: EXCP_DUMP(env, "\nqemu: unhandled CPU exception %#x - aborting= \n", trapnr); --=20 2.39.1