From patchwork Tue Mar 7 21:21:21 2023 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: 659849 Delivered-To: patch@linaro.org Received: by 2002:adf:a3c6:0:0:0:0:0 with SMTP id m6csp2606014wrb; Tue, 7 Mar 2023 13:23:37 -0800 (PST) X-Google-Smtp-Source: AK7set+uD3V3R/1yPMggVnMqlUjI9FG5jDuHi1B8FSnXlWs799h2DKaFwPlHLQzYvUx773lic8hy X-Received: by 2002:a05:6214:19e4:b0:56e:b273:fb53 with SMTP id q4-20020a05621419e400b0056eb273fb53mr29849218qvc.49.1678224217461; Tue, 07 Mar 2023 13:23:37 -0800 (PST) ARC-Seal: i=1; a=rsa-sha256; t=1678224217; cv=none; d=google.com; s=arc-20160816; b=mxqi5m4pOGWQSIqTUHB6QX8JSm9c4IJ6dHBfRIH6o13gPg3JCOaj8JZ7Vf7tb2OGLj YA6vbINXXSrnbDh4BWMGGo9WIkjcyCj8+7uyd6+o12y5nAFvConix80H4w6+tousw98l 11jt/W4hnoTOkGuM037jv8krWGfIvZHR0rVjF6dRQoD6U060AXxy3QHvHDGapsszhJzl auZi1aGw87iaC4NcRN/iVk5pNrwPiTCGOCk0QIoJ3w5CRA71tS7eQtwLg4/ej4ciPHeC O/yvbXCF95p7KFR+q6c5OYvZ4QQoINhCAOn4zIQ70RWKLyb1BeC9zrFnyEhYbxeV3hZt R3xw== 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=TtnWHpJ0J82CiL6/W6Fvz5ov3Sls8L97cDEKSKbgjPo=; b=JEZ8QK86NiUl5tOCTBknd/QtDgdLcYnIHZhvd0eOJYe4VPfVnLXUAsu384n2YpOeaT VpJnvXJ5MBeKpi+wU0qpTzj1GsIy+a+hVviEmtHdAUH10nEJIPUB/uMCOy4On7Aq6G6O a9MN2tsBUkskwKUe0sAHIwUMN5mMlb+y6IYLO3/54TatElRbhVO+0DquMBBPnLKce0Ps w3DUwnMU5nAiJP4pNpNUJfq+3ya/DgLXW7xuLkQvezFBajVKR143HAoE4CSkstZG9jsp aVM6Iryt8XpFcbillXMqKfq88NUKIc3B/F2j53N+Laodp4sdsltunlmQ2ZV4YS5IBmic hDJQ== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@linaro.org header.s=google header.b=RUMI539T; 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 Return-Path: Received: from lists.gnu.org (lists.gnu.org. [209.51.188.17]) by mx.google.com with ESMTPS id r2-20020a0cb282000000b0056eab1c52e9si10429534qve.12.2023.03.07.13.23.37 for (version=TLS1_2 cipher=ECDHE-ECDSA-CHACHA20-POLY1305 bits=256/256); Tue, 07 Mar 2023 13:23:37 -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=RUMI539T; 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 1pZekw-0001st-T2; Tue, 07 Mar 2023 16:21:58 -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 1pZekm-0001fx-S4 for qemu-devel@nongnu.org; Tue, 07 Mar 2023 16:21:49 -0500 Received: from mail-wr1-x42d.google.com ([2a00:1450:4864:20::42d]) by eggs.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_128_GCM_SHA256:128) (Exim 4.90_1) (envelope-from ) id 1pZekk-00082p-Jv for qemu-devel@nongnu.org; Tue, 07 Mar 2023 16:21:48 -0500 Received: by mail-wr1-x42d.google.com with SMTP id l25so13529193wrb.3 for ; Tue, 07 Mar 2023 13:21:46 -0800 (PST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=linaro.org; s=google; t=1678224105; 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=TtnWHpJ0J82CiL6/W6Fvz5ov3Sls8L97cDEKSKbgjPo=; b=RUMI539T0AsnmggJxzLoN+dLSN9VSKgg/JIhuvUyCOPCpBYHuBwGT6xA/K6Kx5Ifax YMLAuVWCEw+W6DpZHxhZOz+4uS3fSBjBkc3YPipP+PKhmvhVF95e9i1QsN704biX+ylL SZyUoqsEuL8EATR39kTiKSEsUxzETtyqllUUSWXoM8n3gGQHLYPVZKG+elnvb0HLSekT qcb+C+0+qUEWQEcbiCB5YrsTZ6m4uiPHdRLoHFlvf4MPgKsG7F4VTZnaKdTeHo2wPmvx Y1tPb0Y3le/zoSFeaqKiuwmLpczqNXHPo8UNQtRkTP1jbfRNLiiKaQY7L+9uaX/DSA5L cBzg== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20210112; t=1678224105; 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=TtnWHpJ0J82CiL6/W6Fvz5ov3Sls8L97cDEKSKbgjPo=; b=sGILtB2Oh4yHZTAsxrU19ARoqSIDDZm41E2q5As7LOb3tVMrxgK0AfcLsY4NMnifRf 0smGatvv7lehllWNV8/viiCBNrB12YqZugOsro2u7RFLR0Xd9+Vf4+0k11XzvNzBqrtM 7MdjfhjDQ/C5GEyNNJ7hS6sTkBuqEv86oOhNPkZGbZSbLYTt8uD7yro0MbnZ52fruvgJ 5XAH723sBreMTiptZBGcKKQC34GdsZrgVwuBo0sqnErQO436bstJq4cdFfCSWiSMhIVy QjwiOFzPVvNCLOEgVGxZhqmYaKhzKhQNzPJX771Fphz0IrsOHbhNdSXAXUcZL6j/W02R xa/Q== X-Gm-Message-State: AO0yUKUm0sAWY3PFKL979UHAMLH2JoPo0iLNL2rh1+iyl8CHlZo8NlOw xp4v3H5F9Rop64AFkuP2TnQL9g== X-Received: by 2002:adf:f445:0:b0:2c3:db9e:4b06 with SMTP id f5-20020adff445000000b002c3db9e4b06mr10947532wrp.45.1678224104987; Tue, 07 Mar 2023 13:21:44 -0800 (PST) Received: from zen.linaroharston ([85.9.250.243]) by smtp.gmail.com with ESMTPSA id i11-20020adffdcb000000b002c573cff730sm13588153wrs.68.2023.03.07.13.21.41 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Tue, 07 Mar 2023 13:21:44 -0800 (PST) Received: from zen.lan (localhost [127.0.0.1]) by zen.linaroharston (Postfix) with ESMTP id C4CF01FFC1; Tue, 7 Mar 2023 21:21:40 +0000 (GMT) From: =?utf-8?q?Alex_Benn=C3=A9e?= To: qemu-devel@nongnu.org Cc: peter.maydell@linaro.org, =?utf-8?q?Alex_Benn=C3=A9e?= , Richard Henderson , =?utf-8?q?Philippe_Mathie?= =?utf-8?q?u-Daud=C3=A9?= Subject: [PULL 12/30] gdbstub: rationalise signal mapping in softmmu Date: Tue, 7 Mar 2023 21:21:21 +0000 Message-Id: <20230307212139.883112-13-alex.bennee@linaro.org> X-Mailer: git-send-email 2.39.2 In-Reply-To: <20230307212139.883112-1-alex.bennee@linaro.org> References: <20230307212139.883112-1-alex.bennee@linaro.org> MIME-Version: 1.0 Received-SPF: pass client-ip=2a00:1450:4864:20::42d; envelope-from=alex.bennee@linaro.org; helo=mail-wr1-x42d.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: 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 We don't really need a table for mapping two symbols. Reviewed-by: Richard Henderson Signed-off-by: Alex Bennée Message-Id: <20230302190846.2593720-13-alex.bennee@linaro.org> Message-Id: <20230303025805.625589-13-richard.henderson@linaro.org> diff --git a/gdbstub/softmmu.c b/gdbstub/softmmu.c index a6c196ade6..6796761fd9 100644 --- a/gdbstub/softmmu.c +++ b/gdbstub/softmmu.c @@ -506,20 +506,14 @@ enum { TARGET_SIGTRAP = 5 }; -static int gdb_signal_table[] = { - -1, - -1, - TARGET_SIGINT, - -1, - -1, - TARGET_SIGTRAP -}; - int gdb_signal_to_target(int sig) { - if (sig < ARRAY_SIZE(gdb_signal_table)) { - return gdb_signal_table[sig]; - } else { + switch (sig) { + case 2: + return TARGET_SIGINT; + case 5: + return TARGET_SIGTRAP; + default: return -1; } }