From nobody Mon Feb 9 21:17:15 2026 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=1680809456; cv=none; d=zohomail.com; s=zohoarc; b=OjGF6YHvyFKSXAXl2rkYxk9qgCVBItk5InnYSPBapz0c9mDbcHWppWzZe8m9G5TXE1RgvlU3XPZ2XTW/smTCuI/Fmv/qOh6XVUK5CgOT3kWhXoLp3FVGHOOjEZz8e7eHvyK2pd0kKwG4i0kAhz9IDIh4SPBGtlUrHwj23Ta3JvU= ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=zohomail.com; s=zohoarc; t=1680809456; 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=h66j6eZ+I80USXh0GrYgRS1QgD8Txh3yUiMfM2aguDc=; b=ZSdkIL0DtcFfBvqap98/y+IKO8z0kNtRIHqPprUM0/t48MnbCLX2wmVxnnidC5U15ZxDrZfUc7zu233cpcyu3Z5WaBgjMXv/rvggRPSuQP4IfmwtoRv7Twp84bNj0thrTgkCVjrjAyuFFxv6mktYSAtycEbj72JJVHAIkznHhFg= 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 1680809456713726.1254240889176; Thu, 6 Apr 2023 12:30:56 -0700 (PDT) Received: from localhost ([::1] helo=lists1p.gnu.org) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1pkVJi-00089d-Qz; Thu, 06 Apr 2023 15:30:42 -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 1pkVJh-00087h-3B for qemu-devel@nongnu.org; Thu, 06 Apr 2023 15:30:41 -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 1pkVJc-0002HW-SZ for qemu-devel@nongnu.org; Thu, 06 Apr 2023 15:30:38 -0400 Received: from pps.filterd (m0279864.ppops.net [127.0.0.1]) by mx0a-0031df01.pphosted.com (8.17.1.19/8.17.1.19) with ESMTP id 336IxolA026564; Thu, 6 Apr 2023 19:30:32 GMT Received: from nalasppmta04.qualcomm.com (Global_NAT1.qualcomm.com [129.46.96.20]) by mx0a-0031df01.pphosted.com (PPS) with ESMTPS id 3psmyx2750-1 (version=TLSv1.2 cipher=ECDHE-RSA-AES256-GCM-SHA384 bits=256 verify=NOT); Thu, 06 Apr 2023 19:30:32 +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 336JUVcM018594 (version=TLSv1.2 cipher=ECDHE-RSA-AES256-GCM-SHA384 bits=256 verify=NOT); Thu, 6 Apr 2023 19:30:31 GMT Received: from NASANPPMTA02.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, 6 Apr 2023 12:30:29 -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=h66j6eZ+I80USXh0GrYgRS1QgD8Txh3yUiMfM2aguDc=; b=k3NaIIZ9XnEJQ9mD5jqhq/sFGpdtKHFt/hfxOA8VezHSmniOhujCYVr4OqZOk5497Dml +fkfSROqONQpUK6cdL+3ROlrqE5mwBYUNS8vw7jP9u1GOrbSNZlkYTLSw1g7HYZO05f0 7z1T5iz7iP57gzEHPLb48XK3JKJPyFB6+OzlJr7eD5eFPEkxfXnI7im3mBmQZKNQYywb FLXqNu2HKm6hru4gyJLdM55LQ0fjGvgA34rjFv47WFQP+vyUe4ICOOXKJuikiabbOWll O+++OM8CM96fZlN754GZQWCHOpMJyLFkCkZK+VFv6cddJpYM5S9LosG3gaNkdmxK8J4G FA== From: Matheus Tavares Bernardino To: CC: , , , , , =?UTF-8?q?Philippe=20Mathieu-Daud=C3=A9?= Subject: [PATCH 1/7] gdbstub: only send stop-reply packets when allowed to Date: Thu, 6 Apr 2023 16:29:43 -0300 Message-ID: <48bce1b417f9701be26d737b596ccbd3dc2db573.1680808943.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: nasanex01b.na.qualcomm.com (10.46.141.250) 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: -axWKKILaxyytaEu9zX2d3ENeQVceC1d X-Proofpoint-ORIG-GUID: -axWKKILaxyytaEu9zX2d3ENeQVceC1d 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-06_11,2023-04-06_03,2023-02-09_01 X-Proofpoint-Spam-Details: rule=outbound_notspam policy=outbound score=0 priorityscore=1501 phishscore=0 impostorscore=0 adultscore=0 clxscore=1011 mlxlogscore=999 bulkscore=0 mlxscore=0 lowpriorityscore=0 spamscore=0 suspectscore=0 malwarescore=0 classifier=spam adjust=0 reason=mlx scancount=1 engine=8.12.0-2303200000 definitions=main-2304060172 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 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: 1680809457983100003 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 --- 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 2a66371aa5..9d326a1d2d 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 Mon Feb 9 21:17:15 2026 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=1680809458; cv=none; d=zohomail.com; s=zohoarc; b=hNEyV3LFGBUloMQNPadT+m8MgrO6HvAFFu7KFU43jJc7KLftWYms4z7L8Qyxf73jAvWLjDJyF6yTKCDv/e2wseSbsavbxKRFah1h9vxCn5Ec8e802q+amrHRlX7EYMoyHfiYmYj7eW3YRGzguC5r5sCGRvLdS0vukIf20XoLTnU= ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=zohomail.com; s=zohoarc; t=1680809458; 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=Kt5RSeraTBEBAWHwonhTD37zdCyPqdoQsKKAZYyrZqV/zm0zbzRuSlzgzhCRXh5rYClOFdVR46Yp5/cw+74pTpyI9jJfcr/prE2E4rDeYP5FvVT+t0Y9ZbIMBKdoOHOJe0uBdoztHuQlMXOCNQpJXUOxx+Vq8aRhfitcGsUqBCs= 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 1680809458807380.97021219241935; Thu, 6 Apr 2023 12:30:58 -0700 (PDT) Received: from localhost ([::1] helo=lists1p.gnu.org) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1pkVJk-0008AZ-Oo; Thu, 06 Apr 2023 15:30:44 -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 1pkVJi-00089g-Vn for qemu-devel@nongnu.org; Thu, 06 Apr 2023 15:30:42 -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 1pkVJf-0002I3-Tt for qemu-devel@nongnu.org; Thu, 06 Apr 2023 15:30:42 -0400 Received: from pps.filterd (m0279865.ppops.net [127.0.0.1]) by mx0a-0031df01.pphosted.com (8.17.1.19/8.17.1.19) with ESMTP id 3368LIQU013218; Thu, 6 Apr 2023 19:30:35 GMT Received: from nalasppmta02.qualcomm.com (Global_NAT1.qualcomm.com [129.46.96.20]) by mx0a-0031df01.pphosted.com (PPS) with ESMTPS id 3psr261tw5-1 (version=TLSv1.2 cipher=ECDHE-RSA-AES256-GCM-SHA384 bits=256 verify=NOT); Thu, 06 Apr 2023 19:30:34 +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 336JUYFM007212 (version=TLSv1.2 cipher=ECDHE-RSA-AES256-GCM-SHA384 bits=256 verify=NOT); Thu, 6 Apr 2023 19:30:34 GMT Received: from NASANPPMTA02.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, 6 Apr 2023 12:30:32 -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=biasyct8fogSzWj5xfeFECEMoRW9w+7SzrQ214eSzdHVLkXDZMRbaRyKjhLEIf/MHPch NLtI3q3ynJNMqRuXnljXwKRhXX2RpHb42H1lxiX7EPlVXSGmh4c71t542DROr1IC5LGO OYhuj8wQFVTypsfBlXPsQDUJ83uFNBGqzfoY5OYQ8cdwDbUkP6wK46KORWaoYdJju6Pa smDlBZ8q96pAPtMQE+fHErd8dHU7Q5NJQZtRaiBtAdIm+ibCH7txIzELeo6XVljkXmZY foIsKlFCn1zYbOUzDHUXDscqoI9e3qRfAM0r3yJVvCVM0jRIyDrdgqvTsrsJzkjqiUkQ 9g== From: Matheus Tavares Bernardino To: CC: , , , , Subject: [PATCH 2/7] gdbstub: add test for untimely stop-reply packets Date: Thu, 6 Apr 2023 16:29:44 -0300 Message-ID: <873070efd7d1e7b13fcee9c4fed5f1e813cf5a43.1680808943.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: nasanex01b.na.qualcomm.com (10.46.141.250) 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: lG-KKtXIkxCS3SepG3JmMymWPoa-8J4X X-Proofpoint-ORIG-GUID: lG-KKtXIkxCS3SepG3JmMymWPoa-8J4X 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-06_11,2023-04-06_03,2023-02-09_01 X-Proofpoint-Spam-Details: rule=outbound_notspam policy=outbound score=0 suspectscore=0 impostorscore=0 mlxscore=0 priorityscore=1501 mlxlogscore=999 malwarescore=0 bulkscore=0 phishscore=0 lowpriorityscore=0 clxscore=1015 spamscore=0 adultscore=0 classifier=spam adjust=0 reason=mlx scancount=1 engine=8.12.0-2303200000 definitions=main-2304060172 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 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: 1680809460261100002 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 --- 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 Mon Feb 9 21:17:15 2026 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=1680809475; cv=none; d=zohomail.com; s=zohoarc; b=kNI7vNLal9zGm3DHX5zWqpJkcPfzMUbKbqjycmTM3e7A52GLWLVy+FWp7Q2hurHZLF7VGld7h+E5YXD3jE1BuVm8hGGXWVNgbtmiND0wrbWWcO57hHDAEnyhTCrtstB/ro8yrG3yMoHV8TcJ+ewmCsul4b+KymGFO7sx8goCpM4= ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=zohomail.com; s=zohoarc; t=1680809475; 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=3vsVkznEep5VIpHeowV6gclHsICpwOfAno179LDrwGs=; b=Gygj3OgFr/ndIArofJ6mJafhiI+0JhikVY5GAsIeHm8GS/vOeQXIRbmO2pqfGKH5yECu3lJ17M+kEQ/an94nEgfi31M38l/xR9VZu63SOUkkAjWqCi/yeUXF+vGzUhd+X08QJmMXMiFDj+g+iOmD6fzka1jVazthfX/HqxVkUwE= 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 1680809475148389.6862812379469; Thu, 6 Apr 2023 12:31:15 -0700 (PDT) Received: from localhost ([::1] helo=lists1p.gnu.org) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1pkVK1-0008Mh-Eb; Thu, 06 Apr 2023 15:31: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 1pkVJo-0008EF-07 for qemu-devel@nongnu.org; Thu, 06 Apr 2023 15:30:51 -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 1pkVJm-0002K9-5v for qemu-devel@nongnu.org; Thu, 06 Apr 2023 15:30:47 -0400 Received: from pps.filterd (m0279872.ppops.net [127.0.0.1]) by mx0a-0031df01.pphosted.com (8.17.1.19/8.17.1.19) with ESMTP id 336HQecu006001; Thu, 6 Apr 2023 19:30:39 GMT Received: from nalasppmta02.qualcomm.com (Global_NAT1.qualcomm.com [129.46.96.20]) by mx0a-0031df01.pphosted.com (PPS) with ESMTPS id 3psuj7sbyn-1 (version=TLSv1.2 cipher=ECDHE-RSA-AES256-GCM-SHA384 bits=256 verify=NOT); Thu, 06 Apr 2023 19:30:39 +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 336JUbag007233 (version=TLSv1.2 cipher=ECDHE-RSA-AES256-GCM-SHA384 bits=256 verify=NOT); Thu, 6 Apr 2023 19:30:37 GMT Received: from NASANPPMTA02.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, 6 Apr 2023 12:30:34 -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=3vsVkznEep5VIpHeowV6gclHsICpwOfAno179LDrwGs=; b=bTT5ynWgkyN79Dm3R0pNards7caRp0UXbPjleI9cSwuJpPionXzXHY2SQUFUjRfc+tAB AfKu64J4CSX97TP55fsesKrixeSYiBmQ/iVa1OEbtQJR/U2cKkS5++ZcGaOmK+kSErQq RBOWcp7bfV9jLYq1tKKMetrzNd+Zidl/ACiFzESivHf540Z5HI5UyV1ur5lFC73geRjA juDn4bcodw9SRmMYyUF/WHpqEoOyssffGmrHAeacmxRGDTQTsr1J8irh8huN8bjQ7ps4 s0leb/fAhXX1A7APUd/nmkSQUiQIvnkVDCeNBscJD/D8H1SKAVnqpBeyDfPQIi9uCJD4 zA== From: Matheus Tavares Bernardino To: CC: , , , , , =?UTF-8?q?Philippe=20Mathieu-Daud=C3=A9?= , "Eduardo Habkost" , Marcel Apfelbaum , Yanan Wang Subject: [PATCH 3/7] gdbstub: add support for the qRegisterInfo query Date: Thu, 6 Apr 2023 16:29:45 -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: nasanex01b.na.qualcomm.com (10.46.141.250) 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: cOa0ior71S19itFbMtxvJzu1aGBkcP6E X-Proofpoint-GUID: cOa0ior71S19itFbMtxvJzu1aGBkcP6E 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-06_11,2023-04-06_03,2023-02-09_01 X-Proofpoint-Spam-Details: rule=outbound_notspam policy=outbound score=0 impostorscore=0 mlxscore=0 phishscore=0 lowpriorityscore=0 malwarescore=0 priorityscore=1501 bulkscore=0 adultscore=0 suspectscore=0 clxscore=1011 spamscore=0 mlxlogscore=874 classifier=spam adjust=0 reason=mlx scancount=1 engine=8.12.0-2303200000 definitions=main-2304060171 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 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: 1680809475580100001 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 821e937020..b16b4e0de5 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 9d326a1d2d..2edd7d6d88 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 Mon Feb 9 21:17:15 2026 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=1680809513; cv=none; d=zohomail.com; s=zohoarc; b=VoFYR3V5slddAWB/PNVKbXgwxb7ztggbA/PrscDbdqA9lM9e070E1jRVnGjvng5BrZenNigE0gcHQfUZKHUpsOZgghnnEO4XctbNkxjZixTpehfNHfdcvzIs+PbdrpR+W1tWsE5G4NCXVSTOib0tYMkT5TQwgM+VosNm2/vECYU= ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=zohomail.com; s=zohoarc; t=1680809513; 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=Jx0RxlVb9NBaw4ui4T2L+WCFXuUv0MS3a/Z8JBtw0QT7wMCQ7Y2pua1zhMhKe8pAEcCyqvM/v21TZqYTz/bqifabj7TIWlPTmiF8EEwo8sJtNhdonG69ocK0AYvaL2GZxCs33Mt+uxOozZPorHdfQCCYIWrhvK4lcOafIdcOjGM= 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 1680809513017956.9590930861522; Thu, 6 Apr 2023 12:31:53 -0700 (PDT) Received: from localhost ([::1] helo=lists1p.gnu.org) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1pkVKM-0001KG-CQ; Thu, 06 Apr 2023 15:31:22 -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 1pkVKK-00018c-Qd for qemu-devel@nongnu.org; Thu, 06 Apr 2023 15:31:20 -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 1pkVKH-0002WQ-Qe for qemu-devel@nongnu.org; Thu, 06 Apr 2023 15:31:20 -0400 Received: from pps.filterd (m0279868.ppops.net [127.0.0.1]) by mx0a-0031df01.pphosted.com (8.17.1.19/8.17.1.19) with ESMTP id 336C0562004077; Thu, 6 Apr 2023 19:31:15 GMT Received: from nalasppmta01.qualcomm.com (Global_NAT1.qualcomm.com [129.46.96.20]) by mx0a-0031df01.pphosted.com (PPS) with ESMTPS id 3pss7e9nd7-1 (version=TLSv1.2 cipher=ECDHE-RSA-AES256-GCM-SHA384 bits=256 verify=NOT); Thu, 06 Apr 2023 19:31:15 +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 336JUeQI026160 (version=TLSv1.2 cipher=ECDHE-RSA-AES256-GCM-SHA384 bits=256 verify=NOT); Thu, 6 Apr 2023 19:30:40 GMT Received: from NASANPPMTA02.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, 6 Apr 2023 12:30:37 -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=FzSRBEWsFjX1Oum2rVrJTALDjDXXuPAyTvW5G0WCVVMJ62HJD0VPQS0i/1byW4o5uaeR YA2qwzW8eFceuIQBbfjHfPZRlOT77eCBc/3mUGBLCr1hlgcp2DuNvWgdVpN2l2pEASqZ ZgoRBX97p5C0MBALsFQRUOjqhbTd16n81DUluFwzm+Q103WAWCuOnhDXtmplN4uUgRkK 13ANoGyqrMrMoBUpk66kyvyYfQ2WHw5Kv2NkrEiYnUsjSBDdTUI47eTXO/KaiQ1YKY8h xGD1LX7OfHWUWzymTlsfgMQAO5lnoAsJBNovChBZx+vvLYKvQ63IbcCuZbcHUuWNEIdN +A== From: Matheus Tavares Bernardino To: CC: , , , , Subject: [PATCH 4/7] Hexagon: support qRegisterInfo at gdbstub Date: Thu, 6 Apr 2023 16:29:46 -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: nasanex01b.na.qualcomm.com (10.46.141.250) 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: EDFFQXg_RAqPO3zY_eypeuj-ZMjjzm-q X-Proofpoint-ORIG-GUID: EDFFQXg_RAqPO3zY_eypeuj-ZMjjzm-q 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-06_11,2023-04-06_03,2023-02-09_01 X-Proofpoint-Spam-Details: rule=outbound_notspam policy=outbound score=0 impostorscore=0 spamscore=0 clxscore=1015 priorityscore=1501 suspectscore=0 mlxlogscore=839 adultscore=0 mlxscore=0 bulkscore=0 phishscore=0 malwarescore=0 lowpriorityscore=0 classifier=spam adjust=0 reason=mlx scancount=1 engine=8.12.0-2303200000 definitions=main-2304060172 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 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: 1680809514268100001 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 Mon Feb 9 21:17:15 2026 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=1680809494; cv=none; d=zohomail.com; s=zohoarc; b=WouPr/EUCGTH7OSeQqgZJYwaP+PLOLol2ZaPZD8hEuv9uxyO9++JiVtCxybzqX8b/FfpPJTBoDkDr2Yr6Y5qe+OIUPmT0B683Bi4bjjVmwFhLNvUKbbACCOKT+1HxOtL2Z34Vdht8123kCfuxOmdQBFQn8oxQA0BUCnvpvqr2Ew= ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=zohomail.com; s=zohoarc; t=1680809494; 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=hEfqexmGOCBPDiChjWLJ/94Ej8FabRepKjvVwNuAL0k=; b=DfA14tccL6oqp0RkWFKoNWK5yXnHD4EgXpelpLLpP0qGQqAMSa/GnkRL46cF7AVlijO/qmj+p+14Kztckv1RnubtuTXROFPbVUpAq0XZuGUZT6LDNWf/poO9+HXZX2J3J6xQ8jo1XvHrVhSqc9Gq2bGhZIj2GjpMSETPhPZHw2U= 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 1680809494114765.7497017721469; Thu, 6 Apr 2023 12:31:34 -0700 (PDT) Received: from localhost ([::1] helo=lists1p.gnu.org) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1pkVKE-0000Vu-62; Thu, 06 Apr 2023 15:31:14 -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 1pkVJp-0008EL-SP for qemu-devel@nongnu.org; Thu, 06 Apr 2023 15:30:51 -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 1pkVJn-0002KS-3f for qemu-devel@nongnu.org; Thu, 06 Apr 2023 15:30:49 -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 336HjAA8020277; Thu, 6 Apr 2023 19:30:43 GMT Received: from nalasppmta04.qualcomm.com (Global_NAT1.qualcomm.com [129.46.96.20]) by mx0a-0031df01.pphosted.com (PPS) with ESMTPS id 3psnmj26cw-1 (version=TLSv1.2 cipher=ECDHE-RSA-AES256-GCM-SHA384 bits=256 verify=NOT); Thu, 06 Apr 2023 19:30:43 +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 336JUgFR019070 (version=TLSv1.2 cipher=ECDHE-RSA-AES256-GCM-SHA384 bits=256 verify=NOT); Thu, 6 Apr 2023 19:30:42 GMT Received: from NASANPPMTA02.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, 6 Apr 2023 12:30:40 -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=hEfqexmGOCBPDiChjWLJ/94Ej8FabRepKjvVwNuAL0k=; b=lEMVC/Z/1WDLcXDLLRnx/ko/B9HhhOxi8APBD/17i9YAfNEbzdl/nJ5LwfOF5d2+uFze y3rxypOGWxFard37M02xixxxcgnbZiHqInACTQz3i3o+ab6hkIqGb1U2gXeH8QfWv76x kN5PzxWZTfl1ls7SGaB5ICZ/huJ50AJzsrwJagbvzP/wKIooJNWfvBHAT81xJeNpuNFN oClDkDmz6wC+UuS5H4fkIsfInzsHoTrCQfX7JpjIIOo3Fo1nDxFAX6tINyXlutj6wxf7 dWq3lpblORbTiMNw/T4VA9cdaeAX+qTQ0ydA4e36PrMkCHjrAxLNEHn145nb2Drlw0j6 rw== From: Matheus Tavares Bernardino To: CC: , , , , , Sid Manning Subject: [PATCH 5/7] Hexagon (gdbstub): fix p3:0 read and write via stub Date: Thu, 6 Apr 2023 16:29:47 -0300 Message-ID: <7ea9a493960213e35b61906f86001bb9aade2b99.1680808943.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: nasanex01b.na.qualcomm.com (10.46.141.250) 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: 2KU5T9sNKiqA7Sdx2XGYGcNubQGKpNVA X-Proofpoint-ORIG-GUID: 2KU5T9sNKiqA7Sdx2XGYGcNubQGKpNVA 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-06_11,2023-04-06_03,2023-02-09_01 X-Proofpoint-Spam-Details: rule=outbound_notspam policy=outbound score=0 mlxscore=0 lowpriorityscore=0 suspectscore=0 mlxlogscore=633 adultscore=0 malwarescore=0 spamscore=0 bulkscore=0 phishscore=0 clxscore=1015 priorityscore=1501 impostorscore=0 classifier=spam adjust=0 reason=mlx scancount=1 engine=8.12.0-2303200000 definitions=main-2304060172 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 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: 1680809494416100001 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 Mon Feb 9 21:17:15 2026 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=1680809498; cv=none; d=zohomail.com; s=zohoarc; b=VBTJwvWe8cZLfZF++v1MCwiBxGfmmwnDMA04rIhBevA1VkEJLb1zzw+gUBNM0M59e4/pUVGs2m7bzJQVmtVAcyn5HgLq3cdA0OZGN/sRJDaAYC72SMHRuI/NbiZUYVkdene6tHlHzMGZn1RMkFSEzPk9xnsM8DaH8YOOkfR24z8= ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=zohomail.com; s=zohoarc; t=1680809498; 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=OIwfZ1ILSrcSuYzkPzJqcrSrSvZb+4WjeIWNk10EQ02jxjRFKyt9bj177Ibf9AEt4AdlqRqdR36IxDXkHSxrhJ2ku+D342i1EepW22+H2fQVP5hD/J9FOaoI11AsNQex5tW2jmmE5wXhr0J46X1s0D8Zc/uOXGElHf3K8UCalvc= 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 16808094985881015.9799159899012; Thu, 6 Apr 2023 12:31:38 -0700 (PDT) Received: from localhost ([::1] helo=lists1p.gnu.org) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1pkVKC-0000NT-KR; Thu, 06 Apr 2023 15:31:12 -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 1pkVJr-0008Fh-E5 for qemu-devel@nongnu.org; Thu, 06 Apr 2023 15:30:51 -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 1pkVJp-0002L8-Ci for qemu-devel@nongnu.org; Thu, 06 Apr 2023 15:30:51 -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 336IN2VP023851; Thu, 6 Apr 2023 19:30:45 GMT Received: from nalasppmta04.qualcomm.com (Global_NAT1.qualcomm.com [129.46.96.20]) by mx0a-0031df01.pphosted.com (PPS) with ESMTPS id 3psnmj26d1-1 (version=TLSv1.2 cipher=ECDHE-RSA-AES256-GCM-SHA384 bits=256 verify=NOT); Thu, 06 Apr 2023 19:30:45 +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 336JUjYR019087 (version=TLSv1.2 cipher=ECDHE-RSA-AES256-GCM-SHA384 bits=256 verify=NOT); Thu, 6 Apr 2023 19:30:45 GMT Received: from NASANPPMTA02.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, 6 Apr 2023 12:30:42 -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=D0kV8y4/WZq0nU+eywHxxOAXubOmoo6ogTPCjUEJM1/qFej8tx7+EuuH9TEsH65aujkB mIZwFmwnzT6njS6QUsfuVcoroIdpUrOGQvxhWsB2nFCa+s/wbl782MahviR2ioM14XmZ i1EzePx3O3ntAIDrp2p7554/FqQzD5vvv2f+soKJU8Lr0scWvgjn3Dg3Yubvmly2UzIU ffrBG74SzYFkggPT5aJnutM9UMgT0qWADVgnyRGu30/dg8umdPJxK4nfeCDf2xucKgLB GOApYBW/HWReNfrpVQUVaCcTxO24x1FrnDaV6fFfYBMR+EYETX/kyd9C+40ZWv8G9xNo aQ== From: Matheus Tavares Bernardino To: CC: , , , , Subject: [PATCH 6/7] Hexagon (gdbstub): add HVX support Date: Thu, 6 Apr 2023 16:29:48 -0300 Message-ID: <993c65e6b8c5625243dc185cfdb1c941e9e6e511.1680808943.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: nasanex01b.na.qualcomm.com (10.46.141.250) 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: UIcMMlpXPf9A9l9CqEr0MCWOu8_GX_s_ X-Proofpoint-ORIG-GUID: UIcMMlpXPf9A9l9CqEr0MCWOu8_GX_s_ 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-06_11,2023-04-06_03,2023-02-09_01 X-Proofpoint-Spam-Details: rule=outbound_notspam policy=outbound score=0 mlxscore=0 lowpriorityscore=0 suspectscore=0 mlxlogscore=521 adultscore=0 malwarescore=0 spamscore=0 bulkscore=0 phishscore=0 clxscore=1015 priorityscore=1501 impostorscore=0 classifier=spam adjust=0 reason=mlx scancount=1 engine=8.12.0-2303200000 definitions=main-2304060172 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 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: 1680809500234100001 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 Mon Feb 9 21:17:15 2026 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=1680809506; cv=none; d=zohomail.com; s=zohoarc; b=aRWlKQxI5zQotNAAiJxlJHBaRkWo7W6p3KnEavRXmZ3Z6nIJWZOgkvMubJTt3BxiSUb0oTUxDlX39kf+cWM6EreCqhYPy+VduvIAxNcMVYpyAUAhcABEnT+axuo2Bl20jWCZKf1QpDoRc27cAO7KCyNV6ryOqMOhLVo8egY2OyY= ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=zohomail.com; s=zohoarc; t=1680809506; 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=LTviZb6na0G/o2w/USvRvftn8G4CmyxKlwa4Umlyhjzs83n7WnHsh2LJ8Mun4u97Vbo4kly2wgx06eh7xLgckrVA01W/wv1cyE/rgUteAQUasdXbivTBZwD4BdgYBJxmOtT6IlqmrGoK0I9Ug4PM1h584Jexlsx8s9wWgiAfKAk= 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 1680809506665333.03804299316346; Thu, 6 Apr 2023 12:31:46 -0700 (PDT) Received: from localhost ([::1] helo=lists1p.gnu.org) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1pkVKC-0000Fo-LM; Thu, 06 Apr 2023 15:31:12 -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 1pkVJt-0008MM-SU for qemu-devel@nongnu.org; Thu, 06 Apr 2023 15:30:54 -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 1pkVJr-0002M4-P8 for qemu-devel@nongnu.org; Thu, 06 Apr 2023 15:30:53 -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 336J0M5A022182; Thu, 6 Apr 2023 19:30:48 GMT Received: from nalasppmta03.qualcomm.com (Global_NAT1.qualcomm.com [129.46.96.20]) by mx0a-0031df01.pphosted.com (PPS) with ESMTPS id 3pss0rsrdn-1 (version=TLSv1.2 cipher=ECDHE-RSA-AES256-GCM-SHA384 bits=256 verify=NOT); Thu, 06 Apr 2023 19:30:48 +0000 Received: from nalasex01a.na.qualcomm.com (nalasex01a.na.qualcomm.com [10.47.209.196]) by NALASPPMTA03.qualcomm.com (8.17.1.5/8.17.1.5) with ESMTPS id 336JUmGN002888 (version=TLSv1.2 cipher=ECDHE-RSA-AES256-GCM-SHA384 bits=256 verify=NOT); Thu, 6 Apr 2023 19:30:48 GMT Received: from NASANPPMTA02.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, 6 Apr 2023 12:30: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=l+PakLmISjH8ZXiG9fvj+CGW8xYCbPmP0sFZ3X9jV8g=; b=ZT1SHeJ5SWmhjuZaaN9ixDuCKDUlW8UXLsfARxs5NbWOnJuUyIX6XtCBzuWO4wtouN+P ioxnXkP9Df4SorFAZe1F4WDKzN+sh+9VBr/MDTSaMnyPmpoMMCPg9Mv2b1me+jwNA5sr /YargEddKPgbT36ojVkJHLGERBUxC7QDt8F3KRua6WQgIlD+0gMrJ8o8CZMdOVYb8t19 ROn9ZWh5nBT+5FszWWvWyVcTeED9Io1KJDU9nK8llexjrSzPv44+8crCa+d98uEvCOEb kew9kUiU47LJaVCiENwni8p9lGwahE+3/E9B4wjsFbuygOGFmiWJHKDKeQv82oUHkOpH qw== From: Matheus Tavares Bernardino To: CC: , , , , , Laurent Vivier Subject: [PATCH 7/7] Hexagon (linux-user/hexagon): handle breakpoints Date: Thu, 6 Apr 2023 16:29:49 -0300 Message-ID: <88959c36398b9685ad6602ef5d149f7cb5bdfc6f.1680808943.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: nasanex01b.na.qualcomm.com (10.46.141.250) 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: nY0TJeOku4k2SmriDy0h0LaCL5SIZXnK X-Proofpoint-ORIG-GUID: nY0TJeOku4k2SmriDy0h0LaCL5SIZXnK 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-06_11,2023-04-06_03,2023-02-09_01 X-Proofpoint-Spam-Details: rule=outbound_notspam policy=outbound score=0 adultscore=0 mlxlogscore=721 clxscore=1011 phishscore=0 suspectscore=0 lowpriorityscore=0 impostorscore=0 spamscore=0 mlxscore=0 priorityscore=1501 bulkscore=0 malwarescore=0 classifier=spam adjust=0 reason=mlx scancount=1 engine=8.12.0-2303200000 definitions=main-2304060172 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 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: 1680809507739100003 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