From nobody Tue Feb 10 18:54:48 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=linaro.org ARC-Seal: i=1; a=rsa-sha256; t=1770401208; cv=none; d=zohomail.com; s=zohoarc; b=VPUT+OoodqpDfYj4njJA/4fLDrn5vO1v0IwMEFctx/f5/ovGdmgCAh56f9kYq5y/BHLJ78zdhubI+3dWtf+SD6vctEWbIOl+xiteME5gdZP8IJ3OKJPhbVkyll8D9NcJ4izV3OrYZGGjr9R7ATRHHWx3/JFIzOwOgmGm7v3QhUI= ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=zohomail.com; s=zohoarc; t=1770401208; h=Content-Type:Content-Transfer-Encoding:Cc:Cc:Date:Date:From:From:In-Reply-To:List-Subscribe:List-Post:List-Id:List-Archive:List-Help:List-Unsubscribe:MIME-Version:Message-ID:References:Sender:Subject:Subject:To:To:Message-Id:Reply-To; bh=8GQHCXcw7F2TcL9IvvM3htlqgvvrWvp6j+kXPyYlQag=; b=oG6uD+RyZJ0cOnmbPx5sHxB/QSjOv0qs+BmtdOS2pA2tJs1Ml68DAGG4Zt1H2kDlc+IAhNshEFLv7oPRukU39G+zX29/FnWleAKARG1o1eZWggytPPbfLa8HWp86q4rc1svtEcouvJ2Pe6JlHAZnCBZrCAd4TKlW876F++T97qI= 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 1770401208082352.6747194923689; Fri, 6 Feb 2026 10:06:48 -0800 (PST) Received: from localhost ([::1] helo=lists1p.gnu.org) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1voQDC-0008En-Ua; Fri, 06 Feb 2026 13:05:47 -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 1voQCu-0007zq-Cz for qemu-devel@nongnu.org; Fri, 06 Feb 2026 13:05:29 -0500 Received: from mail-ed1-x52d.google.com ([2a00:1450:4864:20::52d]) by eggs.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_128_GCM_SHA256:128) (Exim 4.90_1) (envelope-from ) id 1voQCs-0001SZ-Ux for qemu-devel@nongnu.org; Fri, 06 Feb 2026 13:05:28 -0500 Received: by mail-ed1-x52d.google.com with SMTP id 4fb4d7f45d1cf-6505cac9879so3093217a12.1 for ; Fri, 06 Feb 2026 10:05:26 -0800 (PST) Received: from draig.lan ([185.124.0.126]) by smtp.gmail.com with ESMTPSA id 4fb4d7f45d1cf-65983ec70fdsm678004a12.15.2026.02.06.10.05.19 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Fri, 06 Feb 2026 10:05:21 -0800 (PST) Received: from draig.lan (localhost [IPv6:::1]) by draig.lan (Postfix) with ESMTP id 390C3607C3; Fri, 06 Feb 2026 18:05:18 +0000 (GMT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=linaro.org; s=google; t=1770401125; x=1771005925; 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=8GQHCXcw7F2TcL9IvvM3htlqgvvrWvp6j+kXPyYlQag=; b=FtIi1ZakrIirSbQps3CpnZN5Vx7zZRmdCXRnKmNfX5hHOye6bt48R746aq5+M7igjd dhgW4737kg6w6P5RXhg2GUFSarJCvdYrae+aghOj6aqu0JM2FVOf3HSuKgC0Ip5ONS79 5SCFl1d+I5Z5Ng2b1FJvkv88Zq+sTdOcWc8MpRmT75Oj07kl1YsosOQDoW5stUQ1oc+/ u2R83XrtsyWGCAJk0LYVMyXcrL2Uzl0dSZaoIEjq8z8kb6htvFPN88j99/4uWMg2uyRs qV/0jEsj3nT7kFGLDY8yrZmSBHuZiXLgLGikqUqu3KBPVL1M+eo60vbldOMFS27mj9x1 lO0w== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20230601; t=1770401125; x=1771005925; h=content-transfer-encoding:mime-version:references:in-reply-to :message-id:date:subject:cc:to:from:x-gm-gg:x-gm-message-state:from :to:cc:subject:date:message-id:reply-to; bh=8GQHCXcw7F2TcL9IvvM3htlqgvvrWvp6j+kXPyYlQag=; b=m6iDUk3rOhl7npoQOUCjXSwvk1BOCmKytjbERj4GDibnvOrlBCtYvYczkfDXIsN3bP UnKjISbSkmPR4GPfKKUaFnIEah0COFnSRrq/BlB9eJrnJf2aIM5uV21hmyP+BJvXHASC nwzvX11JsASf4KPRzMBAz4NCggqtWH2Bb4ZO0ufzdEX9+aeVBTgKtz1hhc3gy2b0YcX7 79/ujkgjw9+F53ioACNTpkOF00xhB9+wSq9FL+v+T7Cpy4Ylf7YsWb1sVkKwy985ixIS vFwXHibOBUIanIXIJo2FcSqpK2PzX5787bnRWMu5snmlzImf4ve+Nfg5hkqAiKouMx03 0LmA== X-Gm-Message-State: AOJu0YxnfHV0j26OUrazmDuSW9Htq0MtxVNOu33W+/iwDkYV6aETFISo ml7DzERrUohH2VaZA4f+qPjCZxmaTeda82bnHUoIgiP65eyQDwybn2zXRB9pyUt/JetopjCDY/r nWybp6Ao= X-Gm-Gg: AZuq6aL7TIhdHNmjxriVqQwX1DXrOjt3T/rIXabfdoAqnhokBaa7xIHSIiMGwz0A5Uc W+wWITFw0eUIoM1bFv84rnV7+fk2JkhrAJleeL4C2/Qxz7TFrGlN8/x0NbCwKtB8ellWpmo4UlG Qlfz9g79ZiMgDSgioEG6d3Lh6js/GbIfVONLkDCGfjEer+dyMOEU8l1BF/rwbvkQ7cK5YvySqwm EWDp8GivoPv893dh6+TULFWvE1Dx6VJ+PcAmE96oApyxu01i+SF7Hbeg9lnstteobOoE9ZPskgs m0Mzl9xlOa8MI1yX2KZ3xoh9hZ7pPSyaPuWRAY/Yyv4oe71vCx/Z2oUfRLSjtgjP4jPOTenkA6Y kl9tIt0Th5SJpEUBt12W/u6wAuoj/9fU2jiklfBLvulzvYCKDaT67VhtUZoZtgBi2roaBC1wV0X 1CeiTPoreCJaM= X-Received: by 2002:a05:6402:5201:b0:659:38ea:c4e3 with SMTP id 4fb4d7f45d1cf-65984184879mr1798226a12.25.1770401125321; Fri, 06 Feb 2026 10:05:25 -0800 (PST) From: =?UTF-8?q?Alex=20Benn=C3=A9e?= To: qemu-devel@nongnu.org Cc: =?UTF-8?q?Alex=20Benn=C3=A9e?= , Richard Henderson , =?UTF-8?q?Philippe=20Mathieu-Daud=C3=A9?= Subject: [PULL 05/10] gdbstub/user: localise variables for reading gdb socket Date: Fri, 6 Feb 2026 18:05:12 +0000 Message-ID: <20260206180517.1335861-6-alex.bennee@linaro.org> X-Mailer: git-send-email 2.47.3 In-Reply-To: <20260206180517.1335861-1-alex.bennee@linaro.org> References: <20260206180517.1335861-1-alex.bennee@linaro.org> MIME-Version: 1.0 Content-Type: text/plain; charset="utf-8" Content-Transfer-Encoding: quoted-printable 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=2a00:1450:4864:20::52d; envelope-from=alex.bennee@linaro.org; helo=mail-ed1-x52d.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 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: qemu development 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 @linaro.org) X-ZM-MESSAGEID: 1770401209215158500 Keep things tidy by moving the declarations to the block where they are used. Reviewed-by: Richard Henderson Message-ID: <20260203115201.2387721-6-alex.bennee@linaro.org> Signed-off-by: Alex Benn=C3=A9e diff --git a/gdbstub/user.c b/gdbstub/user.c index 14369b9ce5e..a16f37616b1 100644 --- a/gdbstub/user.c +++ b/gdbstub/user.c @@ -198,9 +198,6 @@ void gdb_qemu_exit(int code) int gdb_handlesig(CPUState *cpu, int sig, const char *reason, void *siginf= o, int siginfo_len) { - char buf[256]; - int n; - if (!gdbserver_state.init || gdbserver_user_state.fd < 0) { return sig; } @@ -246,11 +243,10 @@ int gdb_handlesig(CPUState *cpu, int sig, const char = *reason, void *siginfo, gdbserver_state.state =3D RS_IDLE; gdbserver_user_state.running_state =3D 0; while (gdbserver_user_state.running_state =3D=3D 0) { - n =3D read(gdbserver_user_state.fd, buf, 256); + char buf[256]; + int n =3D read(gdbserver_user_state.fd, buf, 256); if (n > 0) { - int i; - - for (i =3D 0; i < n; i++) { + for (int i =3D 0; i < n; i++) { gdb_read_byte(buf[i]); } } else { --=20 2.47.3