From patchwork Fri Jul 5 13:29:54 2019 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: 168537 Delivered-To: patch@linaro.org Received: by 2002:a92:4782:0:0:0:0:0 with SMTP id e2csp3590749ilk; Fri, 5 Jul 2019 06:30:26 -0700 (PDT) X-Google-Smtp-Source: APXvYqydoNp99WHwpj9fxa6VM/CoYhoDIzD5ZpNTa9Sh46/VRlK4nV7wHwvBbg0BOrGMHGpQMbRM X-Received: by 2002:a17:906:5806:: with SMTP id m6mr3605694ejq.80.1562333426773; Fri, 05 Jul 2019 06:30:26 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1562333426; cv=none; d=google.com; s=arc-20160816; b=TatazKKxSKlG62eTgGe6ZA9Lns/4/3/6dUpaEY/kL3O9gNcS4utXY3bF7rOYswaOhJ 56a2xNAsSd82Xr/xDbRRGof6a0H/9wWPU1/McSrsp6idN4bF/EX2+mVLbodIArJSLWur dnuHKsQve6jJBXi9+7DJn596/aPbacBdmPZFSSd+B7DxgzC0P0Wury/zL3XkQvm5LZut KgBTIeD45ZUrkztneHsUCsDYA4dR/qBsE6G9IzSfsC0hysweGGSbZOUgYMCVjUE90nQq H+JSwFHmK2sUNkkOM+mojrxk0afcmYOpNbEoxW2oxQ9k/TY5eNdRSocfcMy3Gt2Rr6z+ 6UMg== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=sender:errors-to:cc:list-subscribe:list-help:list-post:list-archive :list-unsubscribe:list-id:precedence:subject :content-transfer-encoding:mime-version:message-id:date:to:from :dkim-signature; bh=PebQMvSZ92TFluRNO4o+ZkgjsCXPtsulLqJ0GRfAHk0=; b=HsRf2EJxWwzmoHLmjBVYIZNQx/uQ0Jf7VUoQ6VpSP88Kav+wRLkcB3S0x5Dlw3hhWD vrJS8RGMLQEDaRaCgMVeoNpu218OSIyUWtCs/xXXcxrlPJxDKH/QauZLYN34kYY46duf nZFX5LyWUGZ/aTynNLPseKd9OBvAfjGuMkL28YkMGFdRqBGPMyHz1070g5VGfPRQxgpD bkpntXZbcHi+AxuDqVJHYbTZiT2Lb69ENAwTxSirc6ZUp1AEJEIXphkQIQLCPTcyPYu9 QbXNNCNw0fqI2oWH6boGxyGAzxyuiOEr/AWNKPTtUjvIIZ/ls9jx23UgMhZ+DRKluyPd jl+A== ARC-Authentication-Results: i=1; mx.google.com; dkim=fail header.i=@linaro.org header.s=google header.b=Oa42g3Um; 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=fail (p=NONE sp=NONE dis=NONE) header.from=linaro.org Return-Path: Received: from lists.gnu.org (lists.gnu.org. [209.51.188.17]) by mx.google.com with ESMTPS id v4si5793919eja.49.2019.07.05.06.30.26 for (version=TLS1_2 cipher=ECDHE-RSA-CHACHA20-POLY1305 bits=256/256); Fri, 05 Jul 2019 06:30:26 -0700 (PDT) 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=fail header.i=@linaro.org header.s=google header.b=Oa42g3Um; 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=fail (p=NONE sp=NONE dis=NONE) header.from=linaro.org Received: from localhost ([::1]:53178 helo=lists1p.gnu.org) by lists.gnu.org with esmtp (Exim 4.86_2) (envelope-from ) id 1hjOI9-0008VN-LP for patch@linaro.org; Fri, 05 Jul 2019 09:30:21 -0400 Received: from eggs.gnu.org ([2001:470:142:3::10]:37874) by lists.gnu.org with esmtp (Exim 4.86_2) (envelope-from ) id 1hjOI1-0008UJ-If for qemu-devel@nongnu.org; Fri, 05 Jul 2019 09:30:14 -0400 Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71) (envelope-from ) id 1hjOHw-0001EJ-GZ for qemu-devel@nongnu.org; Fri, 05 Jul 2019 09:30:10 -0400 Received: from mail-wr1-x442.google.com ([2a00:1450:4864:20::442]:39342) by eggs.gnu.org with esmtps (TLS1.0:RSA_AES_128_CBC_SHA1:16) (Exim 4.71) (envelope-from ) id 1hjOHs-0000fB-VE for qemu-devel@nongnu.org; Fri, 05 Jul 2019 09:30:08 -0400 Received: by mail-wr1-x442.google.com with SMTP id x4so9941221wrt.6 for ; Fri, 05 Jul 2019 06:30:02 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=linaro.org; s=google; h=from:to:cc:subject:date:message-id:mime-version :content-transfer-encoding; bh=PebQMvSZ92TFluRNO4o+ZkgjsCXPtsulLqJ0GRfAHk0=; b=Oa42g3Umrxns9EyJgqiuMhdbbM/WSIgE3WzsPle0pxK0HFg4mrsPrNat4lAqLqhYmu Nn51HmeNVFxKei4huEtS2tsZHGiB14iiNOGlVnpjzkmoLQsSPkRknkHreH0JsmtYOh6e 5xpvbIKAd/Z6e+UCDYjoEXtsj0SiNqTdUG1OakP/gkjuyGBKMvOehZ3USoKISPHt62dG RXLND5n6hd3ybK3XASRbql046x0dqtbFOULhyeciey7cgxJErP8gixwZhKtjd4ABFDGf QKeGrgSTdv5/ViJCHvWNGb9yS3asV8+C7olijGB+2iWELY8Sar0g0ScTieBCRqiSijgH 8s3g== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20161025; h=x-gm-message-state:from:to:cc:subject:date:message-id:mime-version :content-transfer-encoding; bh=PebQMvSZ92TFluRNO4o+ZkgjsCXPtsulLqJ0GRfAHk0=; b=IsqiW2hbQDCG7wmrDHRXhDQJ2KYEHROLXgqVmIVixwGOHOIJHwGvZz4pjsq1DFJAbO D+EICK1H9FcE6147eqlSpxhf/SIPcn30nAGVHIAq5jwGQl+3atLwgi64ifNbwh61cRMc fCQlnga4QNq+4atCl8i2u4jEOSif1MaypSQ20sV1ZffZ49Jsmlu/bCsOEAfc0WCHPO6Z lhiAyy/sJEJPO8n8UrXNa7KQh3ql/ODDwIu4pev+8j3t/KtLwS1+ULYZ/dl+DxBfT5wD 5BoVCYkBnw6DOr4BF6zUx9TGu7z9CT6yladmDTFmA89MrEmSHE1SK2J94P0sguf2HfMa /wHQ== X-Gm-Message-State: APjAAAV0csIm+NluVmOh1kuirVSF2pwVxLzuc9kLQCDIAVraeGfbNc8A Azc6OyAztkasVBLl7+szYpAfSQ== X-Received: by 2002:adf:fd03:: with SMTP id e3mr4186283wrr.338.1562333400997; Fri, 05 Jul 2019 06:30:00 -0700 (PDT) Received: from zen.linaroharston ([81.128.185.34]) by smtp.gmail.com with ESMTPSA id g131sm5730407wmf.37.2019.07.05.06.30.00 (version=TLS1_3 cipher=AEAD-AES256-GCM-SHA384 bits=256/256); Fri, 05 Jul 2019 06:30:00 -0700 (PDT) Received: from zen.linaroharston. (localhost [127.0.0.1]) by zen.linaroharston (Postfix) with ESMTP id 20E631FF87; Fri, 5 Jul 2019 14:30:00 +0100 (BST) From: =?utf-8?q?Alex_Benn=C3=A9e?= To: qemu-devel@nongnu.org Date: Fri, 5 Jul 2019 14:29:54 +0100 Message-Id: <20190705132954.19500-1-alex.bennee@linaro.org> X-Mailer: git-send-email 2.20.1 MIME-Version: 1.0 X-detected-operating-system: by eggs.gnu.org: Genre and OS details not recognized. X-Received-From: 2a00:1450:4864:20::442 Subject: [Qemu-devel] [PATCH for 4.1] gdbstub: revert to previous set_reg behaviour X-BeenThere: qemu-devel@nongnu.org X-Mailman-Version: 2.1.23 Precedence: list List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Cc: Mark Cave-Ayland , =?utf-8?q?Alex_Benn?= =?utf-8?b?w6ll?= , Jon Doron , =?utf-8?q?Philippe_Mathieu-Daud=C3=A9?= Errors-To: qemu-devel-bounces+patch=linaro.org@nongnu.org Sender: "Qemu-devel" The refactoring of handle_set_reg missed the fact we previously had responded with an empty packet when we were not using XML based protocols. This broke the fallback behaviour for architectures that don't have registers defined in QEMU's gdb-xml directory. Revert to the previous behaviour and clean up the commentary for what is going on. Fixes: 62b3320bddd Signed-off-by: Alex Bennée Cc: Jon Doron Cc: Mark Cave-Ayland --- gdbstub.c | 18 ++++++++++++------ 1 file changed, 12 insertions(+), 6 deletions(-) -- 2.20.1 Reviewed-by: Philippe Mathieu-Daudé Tested-by: Mark Cave-Ayland diff --git a/gdbstub.c b/gdbstub.c index ea3349d1aa..b6df7ee25a 100644 --- a/gdbstub.c +++ b/gdbstub.c @@ -1669,12 +1669,23 @@ static void handle_remove_bp(GdbCmdContext *gdb_ctx, void *user_ctx) put_packet(gdb_ctx->s, "E22"); } +/* + * handle_set/get_reg + * + * Older gdb are really dumb, and don't use 'G/g' if 'P/p' is available. + * This works, but can be very slow. Anything new enough to understand + * XML also knows how to use this properly. However to use this we + * need to define a local XML file as well as be talking to a + * reasonably modern gdb. Responding with an empty packet will cause + * the remote gdb to fallback to older methods. + */ + static void handle_set_reg(GdbCmdContext *gdb_ctx, void *user_ctx) { int reg_size; if (!gdb_has_xml) { - put_packet(gdb_ctx->s, "E00"); + put_packet(gdb_ctx->s, ""); return; } @@ -1694,11 +1705,6 @@ static void handle_get_reg(GdbCmdContext *gdb_ctx, void *user_ctx) { int reg_size; - /* - * Older gdb are really dumb, and don't use 'g' if 'p' is avaialable. - * This works, but can be very slow. Anything new enough to - * understand XML also knows how to use this properly. - */ if (!gdb_has_xml) { put_packet(gdb_ctx->s, ""); return;