From patchwork Wed Feb 7 16:38:09 2024 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 8bit X-Patchwork-Submitter: =?utf-8?q?Alex_Benn=C3=A9e?= X-Patchwork-Id: 770651 Delivered-To: patch@linaro.org Received: by 2002:a5d:40c1:0:b0:33b:4db1:f5b3 with SMTP id b1csp401279wrq; Wed, 7 Feb 2024 08:40:52 -0800 (PST) X-Google-Smtp-Source: AGHT+IEUS5KQTinr14M1tFk8Phi5gl+Z+b3a0NPLEiabEz7Mt4N8KLr30lmHiyiP85DmLB45AGuE X-Received: by 2002:a81:cf04:0:b0:604:3ea:8b5a with SMTP id u4-20020a81cf04000000b0060403ea8b5amr5028406ywi.30.1707324052657; Wed, 07 Feb 2024 08:40:52 -0800 (PST) ARC-Seal: i=1; a=rsa-sha256; t=1707324052; cv=none; d=google.com; s=arc-20160816; b=Z+K4qA33g7p1ZhGDH0rqptjqvMWUZT4MHxh+ynv0845/rqd8CcXaM3JhiZqYtRzAtB Ajdsa4t+zv0TRzNHgu9yx7xQp0jNdEphdFeJv2bcq2nZfBglIlUhRZgJz0aejx9iFZud w2DGHNZqYqhPtrCdTQNEWfrLrykpCczApE5O7VMdLbhH6REMKjQ3DEes5FOJjzthuJds ev71lfJbiLMhdOwJVLyQKmjoKOaAr5CJQSI0GEYSO+WgG1WQXvSobMr20CD/VpOnCHj2 ymnp0cqRRAVwtx2X0tYYnI2rkmKYZGcP+XAFwO2hhtHJf+WNsVpJl7N5WoixC28TiE12 vfUw== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=sender:errors-to:list-subscribe:list-help:list-post:list-archive :list-unsubscribe:list-id:precedence:content-transfer-encoding :mime-version:references:in-reply-to:message-id:date:subject:cc:to :from:dkim-signature; bh=NZEnJqnRtjHTYADU54FKGw8u/qLIoqp7a6/Lc+0JhOI=; fh=d/Ofhlug2fvzbO2zBRfQ3kosLOrng0DgyFqsQ7MgEkw=; b=CDZnQ+uZ/xIvaLBVtEPkWZv0x8efQ2cbKiQ4GpazWPtYU/gm+T+NKAytK90J5hXGo5 CbA9IC2xrZuYRhG70IewXhVgESUKFSqyRprvrfl/eAb85rULygQQvPZ+vcEhV6JD9UY7 Of25hBe6UGQGyyHrfa6fcAQ/1ZGnIviApN2ndxMqFNcVP71LB+3H5C1FkqLATq6fzK9B UF2ZPLa29KPc4q/YzgPXi1t3si18ZN7MVaJl59oHiMmuRVJrcFjDCO1zxuW2PT+szQNe wxRB6m3nvUpKe4OMqZkG/MSTzCFD4Rfi4Ar96sKbeV+wx2VUVm9HXJ0AZ/5IAbk5DXZu bosg==; darn=linaro.org ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@linaro.org header.s=google header.b=gfcUw6Fd; spf=pass (google.com: domain of qemu-devel-bounces+patch=linaro.org@nongnu.org designates 209.51.188.17 as permitted sender) smtp.mailfrom="qemu-devel-bounces+patch=linaro.org@nongnu.org"; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=linaro.org X-Forwarded-Encrypted: i=1; AJvYcCUzvGUCgJcZWBWaDmVJiDBxJ/WNteeXaMY1k1bQoPXguNwCoIl09quD5mdN+JW5EUasTtaJB/ExjDtvIxewnuzS Return-Path: Received: from lists.gnu.org (lists.gnu.org. [209.51.188.17]) by mx.google.com with ESMTPS id dv3-20020a05620a1b8300b007859f9aa7b5si1065387qkb.603.2024.02.07.08.40.52 for (version=TLS1_2 cipher=ECDHE-ECDSA-CHACHA20-POLY1305 bits=256/256); Wed, 07 Feb 2024 08:40:52 -0800 (PST) Received-SPF: pass (google.com: domain of qemu-devel-bounces+patch=linaro.org@nongnu.org designates 209.51.188.17 as permitted sender) client-ip=209.51.188.17; Authentication-Results: mx.google.com; dkim=pass header.i=@linaro.org header.s=google header.b=gfcUw6Fd; spf=pass (google.com: domain of qemu-devel-bounces+patch=linaro.org@nongnu.org designates 209.51.188.17 as permitted sender) smtp.mailfrom="qemu-devel-bounces+patch=linaro.org@nongnu.org"; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=linaro.org Received: from localhost ([::1] helo=lists1p.gnu.org) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1rXkwT-00030O-F7; Wed, 07 Feb 2024 11:38:33 -0500 Received: from eggs.gnu.org ([2001:470:142:3::10]) by lists.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.90_1) (envelope-from ) id 1rXkwR-0002yg-EB for qemu-devel@nongnu.org; Wed, 07 Feb 2024 11:38:31 -0500 Received: from mail-wm1-x32b.google.com ([2a00:1450:4864:20::32b]) by eggs.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_128_GCM_SHA256:128) (Exim 4.90_1) (envelope-from ) id 1rXkwO-0006CG-Sl for qemu-devel@nongnu.org; Wed, 07 Feb 2024 11:38:31 -0500 Received: by mail-wm1-x32b.google.com with SMTP id 5b1f17b1804b1-40ff28388a6so7630565e9.1 for ; Wed, 07 Feb 2024 08:38:28 -0800 (PST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=linaro.org; s=google; t=1707323907; x=1707928707; darn=nongnu.org; h=content-transfer-encoding:mime-version:references:in-reply-to :message-id:date:subject:cc:to:from:from:to:cc:subject:date :message-id:reply-to; bh=NZEnJqnRtjHTYADU54FKGw8u/qLIoqp7a6/Lc+0JhOI=; b=gfcUw6FdsXwGE1FD/EB8khiaSdJWBLoVSCkCwzub66Pt9ORycJw6qomC4Ax0KEkTg+ 5pVXQwcuZxwr4HBP0vFIKWf02jbs/vDZ/Zslg+EyWGXoLuhpbBJKR+FfnTBc/Iy09MqB k/Vcl8lSdoG0koikOSBl1HNosyZTkED0pKCUY1qxahZoTCMCb2U/r674Y+v+ezb32kxA Wv3ZbEnZTGYFd8YxQqRerN5ELJR8so8nNUZyVAXvQme0IwOzHt/gvhgM1YSxXmJD/f3Y 4ECXlDQGaprGub9HHWStS46XBRUGsOZQxJYk/Pv+Va8NX25tYLSK3oC3y1sK9dTqk/pV 352A== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20230601; t=1707323907; x=1707928707; h=content-transfer-encoding:mime-version:references:in-reply-to :message-id:date:subject:cc:to:from:x-gm-message-state:from:to:cc :subject:date:message-id:reply-to; bh=NZEnJqnRtjHTYADU54FKGw8u/qLIoqp7a6/Lc+0JhOI=; b=Rc+oORgAvldGKjsUd/36/udxOjq32YKfCos1CV0JVccCu9m88WLCTeCgWPrasgHUXB KyvVC34gJQNFV+m+ImU1MCTxhopXHw+WM2Zal0Z0gImywsvYX44+9EyEdNL5k17VJZlv 9vV7uqfmFMxR/ehfclzQjfp4ms1E95tKVEUhLSkdS5tzCob2odJTuLn/JmpUDMVgZdOH y7WSI7xZ1JfvL+v6syNc6q11r3ofHeEY1jO6JuUYdsTzQPd9ZMSZNR4Qw9BfCzr+3AkD WWbUn5LyAlHVJyQvz+djbXLipZVPFDBJa7g2eTO4sxu96fy2GodgeOxAwVBPD+TQXtPK wo1w== X-Gm-Message-State: AOJu0Yw0FaBl7ioFoeMh8bDMECloRdFwc3Vbr9RtwwT7vHPxdZXwQRCX rEFA7dM1zkJ3B5bnM93BvJ9bENpd1vn39tOtRuqqFNur1lUMkd0kvJ/q4OHkYsY= X-Received: by 2002:a05:600c:1553:b0:410:2496:ccdd with SMTP id f19-20020a05600c155300b004102496ccddmr522761wmg.27.1707323907446; Wed, 07 Feb 2024 08:38:27 -0800 (PST) X-Forwarded-Encrypted: i=1; AJvYcCX2twQPA/imKU8TXnjh8RXEOe87TDnJV7LjaUystw7Iipdfu4tRqFIR6jmxZLiZvq8iJJbbUyUtf4zHNMB+e5LW+khol3VhtpuFOqOUoMbF+Ko03I6/r0pPjSAi88ffV7sVliFGwb/eZPufsf8tCuUYnjAh3OSskNSFkveT6EDZnMUBxAVjRlepPxNHnShJRn4PAxzXvomj4+CEuuqmNKkaZ2xJGAkNDuCj+6E2siTpTHVmlmd803nIe2OOGdGmF2q6lvmZ6r6bkk62g8fNRCw4JlH14azS1pNP8cC8mQf7FwSN9zcG4lLVKf5B9Ekhrv+o+Itxh1PI5Jro2/byTmwEGc5FRkH1Eb6B6cqzY701LO6UFFaFuh17a86Z3T8+0E8nrrxERyZ8pXL29bE8FYLrqY25Hy8kdElo/ajUHWuovys/uUIbtFVhhUtGBd/3XtAtNgPBlI0Q5X/Md9xsDm60zH/AOhMRye27qoo6Fiprj6T9WjnolNhmvELVKO+G9TFQKJKh0BCWSfjdZbNOIZLZ+4zHTshILfRU+VUcd5VWRuvow+/9w9pbyt4NFOY3hspWqanUGC0lnuDKrrSufHDhu74Xccrhvx9w9mQl0PCYa+HjGCS3rn2RouU7i28kQCH49irLXqLCiB0ewuQHIvGHN6YuNk5xk5chcipTG/0xgjy1P3t/iWKx704X1yCDuwB0yOHbmaA8twCpazeb8Kt0Fe+ReQ8FNk6t6h3dlkV91fTvdgdtSu1Po+NKixtglHHqO+TqKeueteFkLYiJwFWA1gEkgfp+hrHfo4g/YQOFp0Lp+7HiD3yqsny4W6jiFe4qAnoFonlWW4OQwdl+U+pi1MNw8g7pAT5JgiL8 Received: from draig.lan ([85.9.250.243]) by smtp.gmail.com with ESMTPSA id b15-20020a05600010cf00b0033b4e58746asm1809148wrx.69.2024.02.07.08.38.17 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Wed, 07 Feb 2024 08:38:24 -0800 (PST) Received: from draig.lan (localhost [IPv6:::1]) by draig.lan (Postfix) with ESMTP id 292D85F7B1; Wed, 7 Feb 2024 16:38:13 +0000 (GMT) From: =?utf-8?q?Alex_Benn=C3=A9e?= To: qemu-devel@nongnu.org Cc: devel@lists.libvirt.org, Jiaxun Yang , Daniel Henrique Barboza , Chris Wulff , Weiwei Li , Bin Meng , Thomas Huth , qemu-riscv@nongnu.org, Marek Vasut , Liu Zhiwei , Aleksandar Rikalo , =?utf-8?q?Marc-Andr=C3=A9?= =?utf-8?q?_Lureau?= , =?utf-8?q?Philippe_Mathi?= =?utf-8?q?eu-Daud=C3=A9?= , Alistair Francis , Warner Losh , Paolo Bonzini , Aurelien Jarno , Beraldo Leal , =?utf-8?q?Daniel_P=2E_Berrang=C3=A9?= , Max Filippov , =?utf-8?q?Alex_Benn=C3=A9e?= , Ed Maste , Palmer Dabbelt , Li-Wen Hsu , Laurent Vivier , Kyle Evans , Wainer dos Santos Moschetta , Riku Voipio , Ilya Leoshkevich Subject: [PATCH v2 11/14] gdbstub: Allow specifying a reason in stop packets Date: Wed, 7 Feb 2024 16:38:09 +0000 Message-Id: <20240207163812.3231697-12-alex.bennee@linaro.org> X-Mailer: git-send-email 2.39.2 In-Reply-To: <20240207163812.3231697-1-alex.bennee@linaro.org> References: <20240207163812.3231697-1-alex.bennee@linaro.org> MIME-Version: 1.0 Received-SPF: pass client-ip=2a00:1450:4864:20::32b; envelope-from=alex.bennee@linaro.org; helo=mail-wm1-x32b.google.com X-Spam_score_int: -20 X-Spam_score: -2.1 X-Spam_bar: -- X-Spam_report: (-2.1 / 5.0 requ) BAYES_00=-1.9, DKIM_SIGNED=0.1, DKIM_VALID=-0.1, DKIM_VALID_AU=-0.1, DKIM_VALID_EF=-0.1, RCVD_IN_DNSWL_NONE=-0.0001, SPF_HELO_NONE=0.001, SPF_PASS=-0.001, T_SCC_BODY_TEXT_LINE=-0.01 autolearn=unavailable autolearn_force=no X-Spam_action: no action X-BeenThere: qemu-devel@nongnu.org X-Mailman-Version: 2.1.29 Precedence: list List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Errors-To: qemu-devel-bounces+patch=linaro.org@nongnu.org Sender: qemu-devel-bounces+patch=linaro.org@nongnu.org From: Ilya Leoshkevich The upcoming syscall catchpoint support needs to send stop packets with an associated reason to GDB. Add an extra parameter to gdb_handlesig() for that, and rename it to gdb_handlesig_reason(). Provide a compatibility wrapper with an old name. Signed-off-by: Ilya Leoshkevich Message-Id: <20240202152506.279476-3-iii@linux.ibm.com> Signed-off-by: Alex Bennée --- include/gdbstub/user.h | 16 ++++++++++++++-- gdbstub/user.c | 5 ++++- 2 files changed, 18 insertions(+), 3 deletions(-) diff --git a/include/gdbstub/user.h b/include/gdbstub/user.h index d392e510c59..1fc43e04af5 100644 --- a/include/gdbstub/user.h +++ b/include/gdbstub/user.h @@ -10,9 +10,10 @@ #define GDBSTUB_USER_H /** - * gdb_handlesig() - yield control to gdb + * gdb_handlesig_reason() - yield control to gdb * @cpu: CPU * @sig: if non-zero, the signal number which caused us to stop + * @reason: stop reason for stop reply packet or NULL * * This function yields control to gdb, when a user-mode-only target * needs to stop execution. If @sig is non-zero, then we will send a @@ -24,7 +25,18 @@ * or 0 if no signal should be delivered, ie the signal that caused * us to stop should be ignored. */ -int gdb_handlesig(CPUState *, int); +int gdb_handlesig_reason(CPUState *, int, const char *); + +/** + * gdb_handlesig() - yield control to gdb + * @cpu CPU + * @sig: if non-zero, the signal number which caused us to stop + * @see gdb_handlesig_reason() + */ +static inline int gdb_handlesig(CPUState *cpu, int sig) +{ + return gdb_handlesig_reason(cpu, sig, NULL); +} /** * gdb_signalled() - inform remote gdb of sig exit diff --git a/gdbstub/user.c b/gdbstub/user.c index dbe1d9b8875..63edca131ab 100644 --- a/gdbstub/user.c +++ b/gdbstub/user.c @@ -121,7 +121,7 @@ void gdb_qemu_exit(int code) exit(code); } -int gdb_handlesig(CPUState *cpu, int sig) +int gdb_handlesig_reason(CPUState *cpu, int sig, const char *reason) { char buf[256]; int n; @@ -141,6 +141,9 @@ int gdb_handlesig(CPUState *cpu, int sig) "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, ';'); + if (reason) { + g_string_append(gdbserver_state.str_buf, reason); + } gdb_put_strbuf(); gdbserver_state.allow_stop_reply = false; }