From patchwork Tue May 25 11:24:25 2021 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: 447170 Delivered-To: patch@linaro.org Received: by 2002:a02:7a1b:0:0:0:0:0 with SMTP id a27csp4176009jac; Tue, 25 May 2021 04:26:02 -0700 (PDT) X-Google-Smtp-Source: ABdhPJx2XSESefM3NOucifIX7dnc53cBtlPLTOOWknalTlreB7c0uGepBHa9Pon+XpYbHV9+/ksL X-Received: by 2002:a92:6804:: with SMTP id d4mr21279786ilc.5.1621941962522; Tue, 25 May 2021 04:26:02 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1621941962; cv=none; d=google.com; s=arc-20160816; b=qyHbeEKsQDvSph6GCqsLhaVOVlwqv3YKhxpJ/xmH+UL4fMuAMRAYVVbDNSvqbK25JP 6FvTvYD+YOJOOpMTobWcvyjgjnV48blfykZE5rCM6ZJrrXessor8xKSdtFNT3bzujENA BlR/TBE/AVkbrkK3hGP1ER0sMJxl0Rgk7owjZM+sO7RW5ZST9TJxz7ubTrbWmzvpWChu HOOe5vSDGN1YghlsM/7NIuTlmvqP3YGvbf1C4TTeNQcJEPqIbBODw87UlVdfUiGy+CqI 2imIDSgRuGhVki2JP6DLFOpMlJKymeGWTCmBaRx96v+v1BlZm+jXItO57svJiNQG/bD3 UKJQ== 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:content-transfer-encoding :mime-version:references:in-reply-to:message-id:date:subject:to:from :dkim-signature; bh=bsqE2FsjJYdyQ62Ky7HDOh/DIGl1NSSD56vnVxy3+Bk=; b=09Q294rPWV4ACuaWatV6HuDX+61mfyXK3nnW2RolIBgu+z04s+fowhPt/rKV+R0Wiv H1xyjSIVBNV2bCkwx1RSJzoznVPujLEY8hHlZF4WRbgi9keIhQLPBdTPY3uvQta+QBPV eUVb+PGhDYRd85j2yxJEJQ0mGUvAq/hDrQPlPRN+S0ukb9kglUoKwhKkZ29/797k79Ch aoJ59N+Ewbna6mxk61FCiSDU4X2Y1tOY7hGEbjc8YuZt3a6pkcBI6ywrWHJ4nxEWUL/0 EuLAdVa5QrSGoMkRr8wa8TByIk2fcIuLbcV7lGCChIoIAoMilmEMBIPhS9/WV26RTI3S O5KA== ARC-Authentication-Results: i=1; mx.google.com; dkim=fail header.i=@linaro.org header.s=google header.b=Xmk2cEf0; 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 h3si16173836jal.79.2021.05.25.04.26.02 for (version=TLS1_2 cipher=ECDHE-ECDSA-CHACHA20-POLY1305 bits=256/256); Tue, 25 May 2021 04:26:02 -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=Xmk2cEf0; 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]:43756 helo=lists1p.gnu.org) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1llVCC-0002DC-GP for patch@linaro.org; Tue, 25 May 2021 07:26:00 -0400 Received: from eggs.gnu.org ([2001:470:142:3::10]:59570) by lists.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.90_1) (envelope-from ) id 1llVAt-0002B2-Gt for qemu-devel@nongnu.org; Tue, 25 May 2021 07:24:39 -0400 Received: from mail-wr1-x430.google.com ([2a00:1450:4864:20::430]:44828) by eggs.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_128_GCM_SHA256:128) (Exim 4.90_1) (envelope-from ) id 1llVAo-0002rU-Sn for qemu-devel@nongnu.org; Tue, 25 May 2021 07:24:39 -0400 Received: by mail-wr1-x430.google.com with SMTP id i17so31799240wrq.11 for ; Tue, 25 May 2021 04:24:34 -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:in-reply-to:references :mime-version:content-transfer-encoding; bh=bsqE2FsjJYdyQ62Ky7HDOh/DIGl1NSSD56vnVxy3+Bk=; b=Xmk2cEf0gPdp9jDXKQUXGb9Sxam9fXxKHrHiOfCZaxAewxGtABY8pS2mee1k2HGred R89g3cUY1Vd8vWOu4rp3Qupes8xb+VwS3GZzHsau8kJnxFGqA4XJ+qyxjYO9T2ejddJH 7pwUpvoZIsOn6qfUmbwfNHjupvW3lkcad4uSD0RJT7e2gN8bHUSZ9qjEo5Wnx21B0gNk w4BZqxSPjRkI0bO2ThGW4hrTj9fZOPIlLmHiq5eNyiK6XoxYvW7K2cX/4GOkljKZ1vdD HLMcHU9zyJ+oScaM0W+DunXne3cIKBEzfVqmkgDtFy/Juzr0nnbtJGFy/OVsbzKN7Omg oYvA== 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:in-reply-to :references:mime-version:content-transfer-encoding; bh=bsqE2FsjJYdyQ62Ky7HDOh/DIGl1NSSD56vnVxy3+Bk=; b=Wg0cxExvtW22SqDp66XcImghId/tPq1ebtumq+acrgJOkO4EiitaTNcT+9VQUQrxGG oouHywPQETxYy0YDxF7SumOPQulobF+784BhF4WUA189cQmfNXQbOpaCoDuSk0/na8fu gdjw34qy2rxG3jGdch2vsLRckc3WJqjSUXEENofiXeKt7hBe/LqKXCag/jFCVzGyCgdA ZjRkh8XzAQbfsZGA8w/sAubmfNjUsZg/6PIow8JVzpJzPPN7d4RkOfzj2gQ081huMkAu wDkv8267Y7dRtWfYABJKYo2Au8aThqcX4dq48TdwVuvyEUHSMbrcx93qg/cyUfF7C2z1 QYMQ== X-Gm-Message-State: AOAM533q4BFsr7aFGgQvVUemsuUf9FGlqN6Kotx3Dt5yCbXZkLv892Hm JtR5KVKUxLorq3ZNeflifdYhGg== X-Received: by 2002:a5d:534f:: with SMTP id t15mr26056131wrv.206.1621941873290; Tue, 25 May 2021 04:24:33 -0700 (PDT) Received: from zen.linaroharston ([51.148.130.216]) by smtp.gmail.com with ESMTPSA id r1sm15349286wrt.67.2021.05.25.04.24.32 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Tue, 25 May 2021 04:24:32 -0700 (PDT) Received: from zen.lan (localhost [127.0.0.1]) by zen.linaroharston (Postfix) with ESMTP id C95A91FF87; Tue, 25 May 2021 12:24:31 +0100 (BST) From: =?utf-8?q?Alex_Benn=C3=A9e?= To: peter.maydell@linaro.org Subject: [PULL 1/7] gitlab: explicitly reference the upstream registry Date: Tue, 25 May 2021 12:24:25 +0100 Message-Id: <20210525112431.22005-2-alex.bennee@linaro.org> X-Mailer: git-send-email 2.20.1 In-Reply-To: <20210525112431.22005-1-alex.bennee@linaro.org> References: <20210525112431.22005-1-alex.bennee@linaro.org> MIME-Version: 1.0 Received-SPF: pass client-ip=2a00:1450:4864:20::430; envelope-from=alex.bennee@linaro.org; helo=mail-wr1-x430.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.23 Precedence: list List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Cc: Thomas Huth , qemu-devel@nongnu.org, Wainer dos Santos Moschetta , =?utf-8?q?Philippe_Mathieu-Daud?= =?utf-8?b?w6k=?= , Willian Rampazzo , =?utf-8?q?Alex_Benn=C3=A9e?= Errors-To: qemu-devel-bounces+patch=linaro.org@nongnu.org Sender: "Qemu-devel" Since c8e6793903 ("containers.yml: build with docker.py tooling") we don't need to manually pull stuff from the upstream repository. Just set the -r field to explicitly use that rather than the current registry. Signed-off-by: Alex Bennée Tested-by: Philippe Mathieu-Daudé Reviewed-by: Willian Rampazzo Reviewed-by: Philippe Mathieu-Daudé Message-Id: <20210520174303.12310-3-alex.bennee@linaro.org> -- 2.20.1 diff --git a/.gitlab-ci.d/containers.yml b/.gitlab-ci.d/containers.yml index 765408ae27..3fb3c14f06 100644 --- a/.gitlab-ci.d/containers.yml +++ b/.gitlab-ci.d/containers.yml @@ -12,10 +12,9 @@ script: - echo "TAG:$TAG" - echo "COMMON_TAG:$COMMON_TAG" - - docker pull "$TAG" || docker pull "$COMMON_TAG" || true - ./tests/docker/docker.py --engine docker build -t "qemu/$NAME" -f "tests/docker/dockerfiles/$NAME.docker" - -r $CI_REGISTRY_IMAGE + -r $CI_REGISTRY/qemu-project/qemu - docker tag "qemu/$NAME" "$TAG" - docker push "$TAG" after_script: From patchwork Tue May 25 11:24:26 2021 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: 447172 Delivered-To: patch@linaro.org Received: by 2002:a02:7a1b:0:0:0:0:0 with SMTP id a27csp4176194jac; Tue, 25 May 2021 04:26:17 -0700 (PDT) X-Google-Smtp-Source: ABdhPJzV4L5TZMRiKWGBHI3TqXQO8NqLcAVhKvzDGu3EbFV+Sn2tss6uzskTiQbXtD6rbzHfz7kG X-Received: by 2002:a92:c245:: with SMTP id k5mr22877962ilo.29.1621941977742; Tue, 25 May 2021 04:26:17 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1621941977; cv=none; d=google.com; s=arc-20160816; b=XtkkjRkhlnVhjqLkMNp0G0dzWKvJ/QUdivd14C+7RxVDuLKfj67DWWq4tpMFUY9Ro+ aIYi+l2VmrYd/crY4JgoV3pDpATHgJv3ZYAtrVaOZjvBC07w3YhqE6vx8Ej+HEGc+kKT 1BtvOspkiX05ETifVlt89Lg13riamq09VALPnOQxouXagp3ITXLnyHUIsRXrMU58MovE vo5Wf14xdGV42LSjvzxQKIKmEpyoahSz4slTBA1e+NYt40zwosAqc6Kp+vDgrEsRHym9 /GIQaphYv+AKrJGbp2wHn7XbtkimqMsTXBNj/xNJBnZCC1VH1+bKpDpVXRWt7AUoeo8/ PRlA== 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:content-transfer-encoding :mime-version:references:in-reply-to:message-id:date:subject:to:from :dkim-signature; bh=YNRWlOTKhEnGOgpqh6El3wBoWwIX33IcIZ0zip4g6YI=; b=wuTVPa8fi0pJIT7gbxmJ6NY7RAPkHbebFTI5Ih/KUZl12wXagXEqG2Y6jWhyCz6iyC AJDiBr2jxVOJZi8kddwPCWA4wNfhO/CHGQqIF2uFwyXJ+hrU3Hod8+ua8HsyRXv0w5E1 b2v7KKvojbWcfzxGuam1oQU7iMBYnjv6rqw/vNs/Hs0aiMDiWeNJfPBzLiXtFZ4uh9Rz 2g1v8uTZnvSYzaPEB8eoVITUC2z7gfBTdDX5xaBnSQ1Rsz1ThLvvM/dImU92/o5pJlqc jUP3FLIYmd20d13d21p2TIOH9sY6sREOVIlBCpcILuX4Wurlt+Ja9ofBdP7wnk7Sc1Gs 3Ejg== ARC-Authentication-Results: i=1; mx.google.com; dkim=fail header.i=@linaro.org header.s=google header.b="leVT+p/k"; 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 k5si19570940ilv.81.2021.05.25.04.26.17 for (version=TLS1_2 cipher=ECDHE-ECDSA-CHACHA20-POLY1305 bits=256/256); Tue, 25 May 2021 04:26:17 -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="leVT+p/k"; 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]:43916 helo=lists1p.gnu.org) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1llVCS-0002LV-Bb for patch@linaro.org; Tue, 25 May 2021 07:26:17 -0400 Received: from eggs.gnu.org ([2001:470:142:3::10]:59626) by lists.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.90_1) (envelope-from ) id 1llVAx-0002H2-2z for qemu-devel@nongnu.org; Tue, 25 May 2021 07:24:43 -0400 Received: from mail-wm1-x32a.google.com ([2a00:1450:4864:20::32a]:55117) by eggs.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_128_GCM_SHA256:128) (Exim 4.90_1) (envelope-from ) id 1llVAr-0002tn-9j for qemu-devel@nongnu.org; Tue, 25 May 2021 07:24:42 -0400 Received: by mail-wm1-x32a.google.com with SMTP id o127so16535904wmo.4 for ; Tue, 25 May 2021 04:24:36 -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:in-reply-to:references :mime-version:content-transfer-encoding; bh=YNRWlOTKhEnGOgpqh6El3wBoWwIX33IcIZ0zip4g6YI=; b=leVT+p/k9iQO6TsGXykNlqnjyM4tJpcd9Nc+yYa8zRM27bJkKub59c8Tg6mnc75s29 AZSUkNkZMb24+kPEgn4enr5Bp3aQ6pLezHB0UQ3FWqEsYArM27xxDkVvnGjfD383eHtF 2jiTW1EMZ1OCeUHVJ97A/VgiN0ix6sSb1gc6WQaFooyRncGtGy8CWKfvAMP/J+MNZxcO CmdeFGB+99xWvmgHBR+ZOUw77AiBQACKFYmj4O2FDvezA8p/iOnhb997a0hAOYtLilbo ANyVU+62cjRzKx8vgJt32UgE2lhK5Ve/PVvoy9EPXf0pQmh/Ximy6FJJV9RlRRpon9gm isxQ== 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:in-reply-to :references:mime-version:content-transfer-encoding; bh=YNRWlOTKhEnGOgpqh6El3wBoWwIX33IcIZ0zip4g6YI=; b=D20kgspeWB5ntTyqpvPilyD8DTM10fv6hwwS4koMkrYtx6tbnpaL8NvL2IAiJJqFby bQufVwFiWJbNkygdE/UCsq6NiR3mllK4EXVCpDIKWSvmnSGUe+pSIqkWzgVzT9IRamF4 TfKnGqjpl/8ZuiY2klDft8+BtmMtMJP3sXatLgtlV86V8oy/pE1jGsglNlR0ceHmPbuh KJ8gyjLW1C2Pa7S89KbafZIOvMUMa/52xknPU7cLssNNa1kk+wjxdWEbZKhMQysnRCp5 nOqDmAiUoftyPpDyOunJyHxj3DkR5EgMBh6abrMd6vVLL6xN9PwgawUfIeLJtByQravB nwRg== X-Gm-Message-State: AOAM530wbHu7UvqU/6m8p3x+GlvUhYbCwfXph1WVm6TObPu1SDDupd+G bCToXGjg/ZP0KqrlvGVG0SJSQQ== X-Received: by 2002:a1c:e484:: with SMTP id b126mr3316243wmh.35.1621941875783; Tue, 25 May 2021 04:24:35 -0700 (PDT) Received: from zen.linaroharston ([51.148.130.216]) by smtp.gmail.com with ESMTPSA id r5sm12650787wmh.23.2021.05.25.04.24.32 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Tue, 25 May 2021 04:24:32 -0700 (PDT) Received: from zen.lan (localhost [127.0.0.1]) by zen.linaroharston (Postfix) with ESMTP id E3FD51FF8C; Tue, 25 May 2021 12:24:31 +0100 (BST) From: =?utf-8?q?Alex_Benn=C3=A9e?= To: peter.maydell@linaro.org Subject: [PULL 2/7] gitlab: add special rule for the hexagon container Date: Tue, 25 May 2021 12:24:26 +0100 Message-Id: <20210525112431.22005-3-alex.bennee@linaro.org> X-Mailer: git-send-email 2.20.1 In-Reply-To: <20210525112431.22005-1-alex.bennee@linaro.org> References: <20210525112431.22005-1-alex.bennee@linaro.org> MIME-Version: 1.0 Received-SPF: pass client-ip=2a00:1450:4864:20::32a; envelope-from=alex.bennee@linaro.org; helo=mail-wm1-x32a.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.23 Precedence: list List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Cc: Thomas Huth , Cornelia Huck , qemu-devel@nongnu.org, Wainer dos Santos Moschetta , =?utf-8?q?Philippe?= =?utf-8?q?_Mathieu-Daud=C3=A9?= , Willian Rampazzo , =?utf-8?q?Alex_Benn=C3=A9e?= Errors-To: qemu-devel-bounces+patch=linaro.org@nongnu.org Sender: "Qemu-devel" The hexagon container is always manually built but of course not everyone will be building it themselves and pushing to their registries. We still need to create a "local" registry copy for the actual gitlab tests to run. We don't build it in this case, just pull it across from the upstream registry. We disable this rule from running on the qemu-project itself so it doesn't accidentally wipe out our master copy. Fixes: 910c40ee94 ("gitlab: add build-user-hexagon test") Signed-off-by: Alex Bennée Tested-by: Cornelia Huck Reviewed-by: Willian Rampazzo Reviewed-by: Philippe Mathieu-Daudé Cc: Cornelia Huck Message-Id: <20210520174303.12310-4-alex.bennee@linaro.org> -- 2.20.1 diff --git a/.gitlab-ci.d/containers.yml b/.gitlab-ci.d/containers.yml index 3fb3c14f06..088c7e68c3 100644 --- a/.gitlab-ci.d/containers.yml +++ b/.gitlab-ci.d/containers.yml @@ -101,6 +101,33 @@ armhf-debian-cross-container: variables: NAME: debian-armhf-cross +# We never want to build hexagon in the CI system and by default we +# always want to refer to the master registry where it lives. +hexagon-cross-container: + image: docker:stable + stage: containers + except: + variables: + - $CI_PROJECT_NAMESPACE == 'qemu-project' + variables: + NAME: debian-hexagon-cross + GIT_DEPTH: 1 + services: + - docker:dind + before_script: + - export TAG="$CI_REGISTRY_IMAGE/qemu/$NAME:latest" + - export COMMON_TAG="$CI_REGISTRY/qemu-project/qemu/qemu/$NAME:latest" + - docker info + - docker login $CI_REGISTRY -u "$CI_REGISTRY_USER" -p "$CI_REGISTRY_PASSWORD" + script: + - echo "TAG:$TAG" + - echo "COMMON_TAG:$COMMON_TAG" + - docker pull $COMMON_TAG + - docker tag $COMMON_TAG $TAG + - docker push "$TAG" + after_script: + - docker logout + hppa-debian-cross-container: extends: .container_job_template stage: containers-layer2 diff --git a/.gitlab-ci.yml b/.gitlab-ci.yml index f718b61fa7..b2f929c758 100644 --- a/.gitlab-ci.yml +++ b/.gitlab-ci.yml @@ -421,6 +421,8 @@ build-user-static: # declared. The image is manually uploaded. build-user-hexagon: extends: .native_build_job_template + needs: + job: hexagon-cross-container variables: IMAGE: debian-hexagon-cross TARGETS: hexagon-linux-user From patchwork Tue May 25 11:24:27 2021 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: 447175 Delivered-To: patch@linaro.org Received: by 2002:a02:7a1b:0:0:0:0:0 with SMTP id a27csp4177347jac; Tue, 25 May 2021 04:28:00 -0700 (PDT) X-Google-Smtp-Source: ABdhPJwv/GmFfGrmQ7M2Y50ZPhq/NBRvjBkv/hAEGuEmeRUBZZAK2o9GdPNwfDit+n1UPPVK7JGQ X-Received: by 2002:a02:cc37:: with SMTP id o23mr29824269jap.35.1621942080227; Tue, 25 May 2021 04:28:00 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1621942080; cv=none; d=google.com; s=arc-20160816; b=hqMYFrRgA/EXhAPxgBAuXSnMH0pOgxXzCJmS/TaZ5+OcKSPXQvWFLU2mzXGElETi70 GbqsWc7LKTHl17trFwm67yF4fB2PTBcKGTmVtRw1eRbAcj2UN4IjDm9QRK8Uv8f9+SMO jq35wREUwzd40PRlXSWgjYHIrF0SsH5PJQlAeSYmiOmkY0R8hOSxu57CkxE6EqCG4q3j Oto7+CwbT4bZghg6IU0/8Qj24oEQVHOzYbuaXcTQFb1dv8gwmRJDMDmc3u5y/VbGWKOv Bk67jISvCuAhhPMXvZDX5tNCWurFEzUuljo4+z1NRvPjU+Km2KVPuSc66Y0iniVlG9CG Xu9Q== 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:content-transfer-encoding :mime-version:references:in-reply-to:message-id:date:subject:to:from :dkim-signature; bh=RZapSc4OUiaXGNAz1GT+1De7yOIQCE53gQRLaCIox2s=; b=xWcz7rU7dLcAsBm26K2tNS1UzQKGRUCuUBzMfOoSD+ZWblL3p0kHtYNmLMW3x0VLfj 79yd4NyEOQSN+96gw5AOben3Ko0QxxF2aSZkDD1Ke98aFUnf/ES94suGpmJb/wsVPbwF mNzZgh9aGNItm2Vya8/ZZq71a9Wrwp0Y2bX+w7hlrDGilztvfdXk4N6uz303z/wUAo+m l5BXuNd9TvkHm/SOwYUOrtcGBvmJtoBU4CCG5IO6IvbBTpo5NJjLmOJqIbWKCOJUWic5 UiEwxaHg0RRsq3e36UBWszKEjN2G/u0SJjLm7VMwfvxpjzHbcQdAIVPn+c1LdIvxUAy5 qYoA== ARC-Authentication-Results: i=1; mx.google.com; dkim=fail header.i=@linaro.org header.s=google header.b=pZV65ycu; 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 n5si20480481ilj.6.2021.05.25.04.28.00 for (version=TLS1_2 cipher=ECDHE-ECDSA-CHACHA20-POLY1305 bits=256/256); Tue, 25 May 2021 04:28:00 -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=pZV65ycu; 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]:52096 helo=lists1p.gnu.org) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1llVE7-0007qf-Kr for patch@linaro.org; Tue, 25 May 2021 07:27:59 -0400 Received: from eggs.gnu.org ([2001:470:142:3::10]:59654) by lists.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.90_1) (envelope-from ) id 1llVAy-0002Lq-IB for qemu-devel@nongnu.org; Tue, 25 May 2021 07:24:44 -0400 Received: from mail-wr1-x42a.google.com ([2a00:1450:4864:20::42a]:36452) by eggs.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_128_GCM_SHA256:128) (Exim 4.90_1) (envelope-from ) id 1llVAu-0002wn-Ge for qemu-devel@nongnu.org; Tue, 25 May 2021 07:24:44 -0400 Received: by mail-wr1-x42a.google.com with SMTP id n4so5889605wrw.3 for ; Tue, 25 May 2021 04:24:39 -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:in-reply-to:references :mime-version:content-transfer-encoding; bh=RZapSc4OUiaXGNAz1GT+1De7yOIQCE53gQRLaCIox2s=; b=pZV65ycuIphfk3II1tfPbyrcCR/J/s1ui3dDGMAa5avCxcHy5R72g8l1Kk/viXprBW BCe12lJHP8lhpzdtiH3nCjPeZVzTHK+KglQ6zW6wvzlxY9gyFAg1rOLoNG1meuSmKbEA e/1rp/otMa4CtiIBEngGJ57uk9ce5zXc+4KEDACmOmb+6jtwE6Ob/jASs5t2goP5BuM+ 34rNokYvjCcGWyQAh1RKh1GbJmK4hKovRNn0aFBRhVZ+ilgKFvgguz0NhikxGSwsLujH efU9zvfEQUxV5wtx8jxiLPCMHclBMZNXynyDCB8M0T2OAgGzKqh3VU03xhGVSFqk/H1Z KTCg== 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:in-reply-to :references:mime-version:content-transfer-encoding; bh=RZapSc4OUiaXGNAz1GT+1De7yOIQCE53gQRLaCIox2s=; b=Hn7U3o8tw/UtwCUsAqwbyxG/i0A7wR+YNpcEyVxzMLohgtIbeJfuf6V8B6d5izwMk0 2IRcrCc6SswKachb14NyaLmXGykoIW59deq52Me3ZDixe+BaB3tPOpI593j/m+kHKf3K AmtcT9azkwOJNMauc5DtASpCu4rSw1mkYCPzWDBanDS9SMTbMA/3Kc4Rfqb8VSGcs7Bk KLDu1hr9KQ9GPy92mNwV7N3Yx6hvVEwPZyl8IQnax9N8EwtcmbH7LZDXt6kUJpCpex0A Y9m2OtE+Odeh0Snp7ECSgHLUa24Ui6WDPo4YujLlJad8Wd2QFnTE7cCYSJ8hCD6hwGMt mkLQ== X-Gm-Message-State: AOAM532kw5Tfgrhs70YpzoEqxoZtekHG5J0eRZKWnNrv6mf2kYWfI2V0 TNZeCRfc4562PgvBln+Skeb5lHl7KRnCcA== X-Received: by 2002:adf:d1e1:: with SMTP id g1mr27256837wrd.401.1621941878292; Tue, 25 May 2021 04:24:38 -0700 (PDT) Received: from zen.linaroharston ([51.148.130.216]) by smtp.gmail.com with ESMTPSA id n13sm16270734wrg.75.2021.05.25.04.24.32 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Tue, 25 May 2021 04:24:35 -0700 (PDT) Received: from zen.lan (localhost [127.0.0.1]) by zen.linaroharston (Postfix) with ESMTP id 079F21FF8F; Tue, 25 May 2021 12:24:32 +0100 (BST) From: =?utf-8?q?Alex_Benn=C3=A9e?= To: peter.maydell@linaro.org Subject: [PULL 3/7] gdbstub: Constify GdbCmdParseEntry Date: Tue, 25 May 2021 12:24:27 +0100 Message-Id: <20210525112431.22005-4-alex.bennee@linaro.org> X-Mailer: git-send-email 2.20.1 In-Reply-To: <20210525112431.22005-1-alex.bennee@linaro.org> References: <20210525112431.22005-1-alex.bennee@linaro.org> MIME-Version: 1.0 Received-SPF: pass client-ip=2a00:1450:4864:20::42a; envelope-from=alex.bennee@linaro.org; helo=mail-wr1-x42a.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.23 Precedence: list List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Cc: =?utf-8?q?Alex_Benn=C3=A9e?= , Richard Henderson , =?utf-8?q?Philippe_Mathieu-Daud=C3=A9?= , qemu-devel@nongnu.org Errors-To: qemu-devel-bounces+patch=linaro.org@nongnu.org Sender: "Qemu-devel" From: Philippe Mathieu-Daudé Signed-off-by: Philippe Mathieu-Daudé Signed-off-by: Alex Bennée Reviewed-by: Richard Henderson Message-Id: <20210505170055.1415360-3-philmd@redhat.com> Message-Id: <20210520174303.12310-5-alex.bennee@linaro.org> -- 2.20.1 diff --git a/gdbstub.c b/gdbstub.c index 9103ffc902..83d47c6732 100644 --- a/gdbstub.c +++ b/gdbstub.c @@ -1981,7 +1981,7 @@ static void handle_v_kill(GdbCmdContext *gdb_ctx, void *user_ctx) exit(0); } -static GdbCmdParseEntry gdb_v_commands_table[] = { +static const GdbCmdParseEntry gdb_v_commands_table[] = { /* Order is important if has same prefix */ { .handler = handle_v_cont_query, @@ -2324,7 +2324,7 @@ static void handle_set_qemu_phy_mem_mode(GdbCmdContext *gdb_ctx, void *user_ctx) } #endif -static GdbCmdParseEntry gdb_gen_query_set_common_table[] = { +static const GdbCmdParseEntry gdb_gen_query_set_common_table[] = { /* Order is important if has same prefix */ { .handler = handle_query_qemu_sstepbits, @@ -2342,7 +2342,7 @@ static GdbCmdParseEntry gdb_gen_query_set_common_table[] = { }, }; -static GdbCmdParseEntry gdb_gen_query_table[] = { +static const GdbCmdParseEntry gdb_gen_query_table[] = { { .handler = handle_query_curr_tid, .cmd = "C", @@ -2420,7 +2420,7 @@ static GdbCmdParseEntry gdb_gen_query_table[] = { #endif }; -static GdbCmdParseEntry gdb_gen_set_table[] = { +static const GdbCmdParseEntry gdb_gen_set_table[] = { /* Order is important if has same prefix */ { .handler = handle_set_qemu_sstep, From patchwork Tue May 25 11:24:28 2021 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: 447173 Delivered-To: patch@linaro.org Received: by 2002:a02:7a1b:0:0:0:0:0 with SMTP id a27csp4176242jac; Tue, 25 May 2021 04:26:22 -0700 (PDT) X-Google-Smtp-Source: ABdhPJyO7vts6lrAi47NbK9bGRwhskYoh/2oobuGD9N0jdcxjzmczu3tQjwXjgKvd9ei/JKGZa1p X-Received: by 2002:a02:ca0d:: with SMTP id i13mr29653395jak.98.1621941982440; Tue, 25 May 2021 04:26:22 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1621941982; cv=none; d=google.com; s=arc-20160816; b=Ymv5l5IFug21in8LOrVE/G1zss//Bsc9DQkZf2Kg/ZpbLEyWdqhZTjlvSHkWvjMKUI UI7nRdpUv2UC4Y+KPcLNeIOCGHy6nBml7RR4HuffH6RvBsGBe71k7DdyDg8FvxcSUrEr 2McNpPgFtA+pqTaxz95UUy9rNqJcjzzdguC8OvyT+j3X9elg9LlbUmHfRfn5qsZVaUK5 jxpTSLxxIsCx9KNpXTy0wcFRyvqm4Bb4afSbVvECHYraj2NanbfghL7ztvqdm1zPTYBg H867evlxkaVJVewk3Xk8hwq0l9KD9GYvbhgbq/+o/dy1hRjEvVehGnba4g2TNYfZuAEk wInA== 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:content-transfer-encoding :mime-version:references:in-reply-to:message-id:date:subject:to:from :dkim-signature; bh=y314722+yRf9K7NmUyFafeR1Qqap6N+fxdsQoLxFQa8=; b=y31UQZ9JbqE3qQvJBVi+PBqZxixssZgVdLhyI1cGO4nrhfkKRZ20Wnej6WhnbxOKgG gj9fJPxx8ZsvHt/dA6rdDIYI3XR0wLOc1IHtExfntgfAtSEkzFn0ZA9fZRVjFvjUwWOL Ua052268vFPgbpit1WDffVnItcHoYo0DLj+m0zksCgRrjsncgj49obx/yb6qd8OWEijL 0RoPc7bFjOwZAlVbQ3GLXgbRpotBL3wYAoEj88absm1W/J+2IvK8209eR1sZgBE/iMw0 BiTvyP7hBvrVlWL2lGtd13vommpnMjpCwrvds6/fuqc3dMn6u/VmlPUKsQ1+mT8BRM+H 403A== ARC-Authentication-Results: i=1; mx.google.com; dkim=fail header.i=@linaro.org header.s=google header.b=mHbmAJX+; 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 k17si16692204ion.39.2021.05.25.04.26.22 for (version=TLS1_2 cipher=ECDHE-ECDSA-CHACHA20-POLY1305 bits=256/256); Tue, 25 May 2021 04:26:22 -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=mHbmAJX+; 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]:44320 helo=lists1p.gnu.org) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1llVCX-0002bH-QU for patch@linaro.org; Tue, 25 May 2021 07:26:21 -0400 Received: from eggs.gnu.org ([2001:470:142:3::10]:59702) by lists.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.90_1) (envelope-from ) id 1llVB0-0002Uv-Mz for qemu-devel@nongnu.org; Tue, 25 May 2021 07:24:46 -0400 Received: from mail-wr1-x42e.google.com ([2a00:1450:4864:20::42e]:42542) by eggs.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_128_GCM_SHA256:128) (Exim 4.90_1) (envelope-from ) id 1llVAu-0002yB-Gn for qemu-devel@nongnu.org; Tue, 25 May 2021 07:24:46 -0400 Received: by mail-wr1-x42e.google.com with SMTP id x8so31804221wrq.9 for ; Tue, 25 May 2021 04:24:40 -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:in-reply-to:references :mime-version:content-transfer-encoding; bh=y314722+yRf9K7NmUyFafeR1Qqap6N+fxdsQoLxFQa8=; b=mHbmAJX+MksQLhiyJ40mLqW5Oyr6hhwmDc65PAgc+K7s2YUjW6TjI8JB1gACKdnhqZ d7YtrErfX37pwPb+IRxLab+kuSvM6pEx0/0SjRyiTgnRfEujr+buKQakGzDGeRaXmU2P J0aLKrPTa9wU84xLCc/c/Y6RQG9RacQfrqaGUmrvJrWxmH0RaMJmVK+vSuOM005wuCW5 tMf3y6ve/PpDxGOp7gHnc0LpC240XM7t6hmW9CtY3I7S4gfZ6aBXlAY7sTdJxTa9GYhQ iRevzrmcJ+zjhIYk9gh1k5LriqT1FS3yd12OhK4LloiKk4yy42O9pAnzyCunbpqydhy9 FCsA== 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:in-reply-to :references:mime-version:content-transfer-encoding; bh=y314722+yRf9K7NmUyFafeR1Qqap6N+fxdsQoLxFQa8=; b=eIsh7KGeeLJyzbsqdqjPpCQZrOw+uY6oVU8R4Mb0Cg3vBKl0lzVxv4oKjvfxwEfFc8 4AlbdDZORyvJdOYYs7ng4kJxt4c7Lx+JtW/8SZlXTWpwTFZVRe9U2uD6W702sCg57jby p3My3vb2/VqpNTZ2JWOUyoNl1055+0wylBxWWnMT3heoMVscjGc+d5B0/tiYC6dZgwoE r/G2ep1HtlTmvOtj1v1FbL42bzeME57BEJXyvOrUNdpy9mutNLdcczzgxD5gj466g51M N/BWIfM48cB6nT7e9DpZcYQ4XzKmdavegTu8mnKfKNqQx2uSTz1i4H3yFZH0kKziqa7h kNLg== X-Gm-Message-State: AOAM530oORI3OLEEFfaD5Gh2WoMxToMFRvYsa1N+zPnKe9uwj8Noyn2f WBuobMkjo1CuIjb2Ezs5JIu61Q== X-Received: by 2002:a5d:650c:: with SMTP id x12mr11506207wru.116.1621941878978; Tue, 25 May 2021 04:24:38 -0700 (PDT) Received: from zen.linaroharston ([51.148.130.216]) by smtp.gmail.com with ESMTPSA id b10sm18472067wrr.27.2021.05.25.04.24.32 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Tue, 25 May 2021 04:24:35 -0700 (PDT) Received: from zen.lan (localhost [127.0.0.1]) by zen.linaroharston (Postfix) with ESMTP id 23C6E1FF90; Tue, 25 May 2021 12:24:32 +0100 (BST) From: =?utf-8?q?Alex_Benn=C3=A9e?= To: peter.maydell@linaro.org Subject: [PULL 4/7] gdbstub: Replace GdbCmdContext with plain g_array() Date: Tue, 25 May 2021 12:24:28 +0100 Message-Id: <20210525112431.22005-5-alex.bennee@linaro.org> X-Mailer: git-send-email 2.20.1 In-Reply-To: <20210525112431.22005-1-alex.bennee@linaro.org> References: <20210525112431.22005-1-alex.bennee@linaro.org> MIME-Version: 1.0 Received-SPF: pass client-ip=2a00:1450:4864:20::42e; envelope-from=alex.bennee@linaro.org; helo=mail-wr1-x42e.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.23 Precedence: list List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Cc: =?utf-8?q?Philippe_Mathieu-Daud=C3=A9?= , =?utf-8?q?Alex_Benn=C3=A9e?= , qemu-devel@nongnu.org Errors-To: qemu-devel-bounces+patch=linaro.org@nongnu.org Sender: "Qemu-devel" Instead of jumping through hoops let glib deal with both tracking the number of elements and auto freeing the memory once we are done. This allows is to drop the usage of ALLOCA(3) which the man-page mentions its "use is discouraged". Signed-off-by: Alex Bennée Message-Id: <20210520174303.12310-6-alex.bennee@linaro.org> -- 2.20.1 diff --git a/gdbstub.c b/gdbstub.c index 83d47c6732..84ce770a04 100644 --- a/gdbstub.c +++ b/gdbstub.c @@ -1338,6 +1338,8 @@ typedef union GdbCmdVariant { } thread_id; } GdbCmdVariant; +#define get_param(p, i) (&g_array_index(p, GdbCmdVariant, i)) + static const char *cmd_next_param(const char *param, const char delimiter) { static const char all_delimiters[] = ",;:="; @@ -1363,55 +1365,52 @@ static const char *cmd_next_param(const char *param, const char delimiter) } static int cmd_parse_params(const char *data, const char *schema, - GdbCmdVariant *params, int *num_params) + GArray *params) { - int curr_param; const char *curr_schema, *curr_data; - *num_params = 0; - - if (!schema) { - return 0; - } + g_assert(schema); + g_assert(params->len == 0); curr_schema = schema; - curr_param = 0; curr_data = data; while (curr_schema[0] && curr_schema[1] && *curr_data) { + GdbCmdVariant this_param; + switch (curr_schema[0]) { case 'l': if (qemu_strtoul(curr_data, &curr_data, 16, - ¶ms[curr_param].val_ul)) { + &this_param.val_ul)) { return -EINVAL; } - curr_param++; curr_data = cmd_next_param(curr_data, curr_schema[1]); + g_array_append_val(params, this_param); break; case 'L': if (qemu_strtou64(curr_data, &curr_data, 16, - (uint64_t *)¶ms[curr_param].val_ull)) { + (uint64_t *)&this_param.val_ull)) { return -EINVAL; } - curr_param++; curr_data = cmd_next_param(curr_data, curr_schema[1]); + g_array_append_val(params, this_param); break; case 's': - params[curr_param].data = curr_data; - curr_param++; + this_param.data = curr_data; curr_data = cmd_next_param(curr_data, curr_schema[1]); + g_array_append_val(params, this_param); break; case 'o': - params[curr_param].opcode = *(uint8_t *)curr_data; - curr_param++; + this_param.opcode = *(uint8_t *)curr_data; curr_data = cmd_next_param(curr_data, curr_schema[1]); + g_array_append_val(params, this_param); break; case 't': - params[curr_param].thread_id.kind = + this_param.thread_id.kind = read_thread_id(curr_data, &curr_data, - ¶ms[curr_param].thread_id.pid, - ¶ms[curr_param].thread_id.tid); - curr_param++; + &this_param.thread_id.pid, + &this_param.thread_id.tid); curr_data = cmd_next_param(curr_data, curr_schema[1]); + g_array_append_val(params, this_param); break; case '?': curr_data = cmd_next_param(curr_data, curr_schema[1]); @@ -1422,16 +1421,10 @@ static int cmd_parse_params(const char *data, const char *schema, curr_schema += 2; } - *num_params = curr_param; return 0; } -typedef struct GdbCmdContext { - GdbCmdVariant *params; - int num_params; -} GdbCmdContext; - -typedef void (*GdbCmdHandler)(GdbCmdContext *gdb_ctx, void *user_ctx); +typedef void (*GdbCmdHandler)(GArray *params, void *user_ctx); /* * cmd_startswith -> cmd is compared using startswith @@ -1471,8 +1464,8 @@ static inline int startswith(const char *string, const char *pattern) static int process_string_cmd(void *user_ctx, const char *data, const GdbCmdParseEntry *cmds, int num_cmds) { - int i, schema_len, max_num_params = 0; - GdbCmdContext gdb_ctx; + int i; + g_autoptr(GArray) params = g_array_new(false, true, sizeof(GdbCmdVariant)); if (!cmds) { return -1; @@ -1488,24 +1481,13 @@ static int process_string_cmd(void *user_ctx, const char *data, } if (cmd->schema) { - schema_len = strlen(cmd->schema); - if (schema_len % 2) { - return -2; + if (cmd_parse_params(&data[strlen(cmd->cmd)], + cmd->schema, params)) { + return -1; } - - max_num_params = schema_len / 2; - } - - gdb_ctx.params = - (GdbCmdVariant *)alloca(sizeof(*gdb_ctx.params) * max_num_params); - memset(gdb_ctx.params, 0, sizeof(*gdb_ctx.params) * max_num_params); - - if (cmd_parse_params(&data[strlen(cmd->cmd)], cmd->schema, - gdb_ctx.params, &gdb_ctx.num_params)) { - return -1; } - cmd->handler(&gdb_ctx, user_ctx); + cmd->handler(params, user_ctx); return 0; } @@ -1528,18 +1510,18 @@ static void run_cmd_parser(const char *data, const GdbCmdParseEntry *cmd) } } -static void handle_detach(GdbCmdContext *gdb_ctx, void *user_ctx) +static void handle_detach(GArray *params, void *user_ctx) { GDBProcess *process; uint32_t pid = 1; if (gdbserver_state.multiprocess) { - if (!gdb_ctx->num_params) { + if (!params->len) { put_packet("E22"); return; } - pid = gdb_ctx->params[0].val_ul; + pid = get_param(params, 0)->val_ul; } process = gdb_get_process(pid); @@ -1562,22 +1544,22 @@ static void handle_detach(GdbCmdContext *gdb_ctx, void *user_ctx) put_packet("OK"); } -static void handle_thread_alive(GdbCmdContext *gdb_ctx, void *user_ctx) +static void handle_thread_alive(GArray *params, void *user_ctx) { CPUState *cpu; - if (!gdb_ctx->num_params) { + if (!params->len) { put_packet("E22"); return; } - if (gdb_ctx->params[0].thread_id.kind == GDB_READ_THREAD_ERR) { + if (get_param(params, 0)->thread_id.kind == GDB_READ_THREAD_ERR) { put_packet("E22"); return; } - cpu = gdb_get_cpu(gdb_ctx->params[0].thread_id.pid, - gdb_ctx->params[0].thread_id.tid); + cpu = gdb_get_cpu(get_param(params, 0)->thread_id.pid, + get_param(params, 0)->thread_id.tid); if (!cpu) { put_packet("E22"); return; @@ -1586,17 +1568,17 @@ static void handle_thread_alive(GdbCmdContext *gdb_ctx, void *user_ctx) put_packet("OK"); } -static void handle_continue(GdbCmdContext *gdb_ctx, void *user_ctx) +static void handle_continue(GArray *params, void *user_ctx) { - if (gdb_ctx->num_params) { - gdb_set_cpu_pc(gdb_ctx->params[0].val_ull); + if (params->len) { + gdb_set_cpu_pc(get_param(params, 0)->val_ull); } gdbserver_state.signal = 0; gdb_continue(); } -static void handle_cont_with_sig(GdbCmdContext *gdb_ctx, void *user_ctx) +static void handle_cont_with_sig(GArray *params, void *user_ctx) { unsigned long signal = 0; @@ -1604,8 +1586,8 @@ static void handle_cont_with_sig(GdbCmdContext *gdb_ctx, void *user_ctx) * Note: C sig;[addr] is currently unsupported and we simply * omit the addr parameter */ - if (gdb_ctx->num_params) { - signal = gdb_ctx->params[0].val_ul; + if (params->len) { + signal = get_param(params, 0)->val_ul; } gdbserver_state.signal = gdb_signal_to_target(signal); @@ -1615,27 +1597,27 @@ static void handle_cont_with_sig(GdbCmdContext *gdb_ctx, void *user_ctx) gdb_continue(); } -static void handle_set_thread(GdbCmdContext *gdb_ctx, void *user_ctx) +static void handle_set_thread(GArray *params, void *user_ctx) { CPUState *cpu; - if (gdb_ctx->num_params != 2) { + if (params->len != 2) { put_packet("E22"); return; } - if (gdb_ctx->params[1].thread_id.kind == GDB_READ_THREAD_ERR) { + if (get_param(params, 1)->thread_id.kind == GDB_READ_THREAD_ERR) { put_packet("E22"); return; } - if (gdb_ctx->params[1].thread_id.kind != GDB_ONE_THREAD) { + if (get_param(params, 1)->thread_id.kind != GDB_ONE_THREAD) { put_packet("OK"); return; } - cpu = gdb_get_cpu(gdb_ctx->params[1].thread_id.pid, - gdb_ctx->params[1].thread_id.tid); + cpu = gdb_get_cpu(get_param(params, 1)->thread_id.pid, + get_param(params, 1)->thread_id.tid); if (!cpu) { put_packet("E22"); return; @@ -1645,7 +1627,7 @@ static void handle_set_thread(GdbCmdContext *gdb_ctx, void *user_ctx) * Note: This command is deprecated and modern gdb's will be using the * vCont command instead. */ - switch (gdb_ctx->params[0].opcode) { + switch (get_param(params, 0)->opcode) { case 'c': gdbserver_state.c_cpu = cpu; put_packet("OK"); @@ -1660,18 +1642,18 @@ static void handle_set_thread(GdbCmdContext *gdb_ctx, void *user_ctx) } } -static void handle_insert_bp(GdbCmdContext *gdb_ctx, void *user_ctx) +static void handle_insert_bp(GArray *params, void *user_ctx) { int res; - if (gdb_ctx->num_params != 3) { + if (params->len != 3) { put_packet("E22"); return; } - res = gdb_breakpoint_insert(gdb_ctx->params[0].val_ul, - gdb_ctx->params[1].val_ull, - gdb_ctx->params[2].val_ull); + res = gdb_breakpoint_insert(get_param(params, 0)->val_ul, + get_param(params, 1)->val_ull, + get_param(params, 2)->val_ull); if (res >= 0) { put_packet("OK"); return; @@ -1683,18 +1665,18 @@ static void handle_insert_bp(GdbCmdContext *gdb_ctx, void *user_ctx) put_packet("E22"); } -static void handle_remove_bp(GdbCmdContext *gdb_ctx, void *user_ctx) +static void handle_remove_bp(GArray *params, void *user_ctx) { int res; - if (gdb_ctx->num_params != 3) { + if (params->len != 3) { put_packet("E22"); return; } - res = gdb_breakpoint_remove(gdb_ctx->params[0].val_ul, - gdb_ctx->params[1].val_ull, - gdb_ctx->params[2].val_ull); + res = gdb_breakpoint_remove(get_param(params, 0)->val_ul, + get_param(params, 1)->val_ull, + get_param(params, 2)->val_ull); if (res >= 0) { put_packet("OK"); return; @@ -1717,7 +1699,7 @@ static void handle_remove_bp(GdbCmdContext *gdb_ctx, void *user_ctx) * the remote gdb to fallback to older methods. */ -static void handle_set_reg(GdbCmdContext *gdb_ctx, void *user_ctx) +static void handle_set_reg(GArray *params, void *user_ctx) { int reg_size; @@ -1726,19 +1708,19 @@ static void handle_set_reg(GdbCmdContext *gdb_ctx, void *user_ctx) return; } - if (gdb_ctx->num_params != 2) { + if (params->len != 2) { put_packet("E22"); return; } - reg_size = strlen(gdb_ctx->params[1].data) / 2; - hextomem(gdbserver_state.mem_buf, gdb_ctx->params[1].data, reg_size); + reg_size = strlen(get_param(params, 1)->data) / 2; + hextomem(gdbserver_state.mem_buf, get_param(params, 1)->data, reg_size); gdb_write_register(gdbserver_state.g_cpu, gdbserver_state.mem_buf->data, - gdb_ctx->params[0].val_ull); + get_param(params, 0)->val_ull); put_packet("OK"); } -static void handle_get_reg(GdbCmdContext *gdb_ctx, void *user_ctx) +static void handle_get_reg(GArray *params, void *user_ctx) { int reg_size; @@ -1747,14 +1729,14 @@ static void handle_get_reg(GdbCmdContext *gdb_ctx, void *user_ctx) return; } - if (!gdb_ctx->num_params) { + if (!params->len) { put_packet("E14"); return; } reg_size = gdb_read_register(gdbserver_state.g_cpu, gdbserver_state.mem_buf, - gdb_ctx->params[0].val_ull); + get_param(params, 0)->val_ull); if (!reg_size) { put_packet("E14"); return; @@ -1766,22 +1748,24 @@ static void handle_get_reg(GdbCmdContext *gdb_ctx, void *user_ctx) put_strbuf(); } -static void handle_write_mem(GdbCmdContext *gdb_ctx, void *user_ctx) +static void handle_write_mem(GArray *params, void *user_ctx) { - if (gdb_ctx->num_params != 3) { + if (params->len != 3) { put_packet("E22"); return; } /* hextomem() reads 2*len bytes */ - if (gdb_ctx->params[1].val_ull > strlen(gdb_ctx->params[2].data) / 2) { + if (get_param(params, 1)->val_ull > + strlen(get_param(params, 2)->data) / 2) { put_packet("E22"); return; } - hextomem(gdbserver_state.mem_buf, gdb_ctx->params[2].data, - gdb_ctx->params[1].val_ull); - if (target_memory_rw_debug(gdbserver_state.g_cpu, gdb_ctx->params[0].val_ull, + hextomem(gdbserver_state.mem_buf, get_param(params, 2)->data, + get_param(params, 1)->val_ull); + if (target_memory_rw_debug(gdbserver_state.g_cpu, + get_param(params, 0)->val_ull, gdbserver_state.mem_buf->data, gdbserver_state.mem_buf->len, true)) { put_packet("E14"); @@ -1791,22 +1775,24 @@ static void handle_write_mem(GdbCmdContext *gdb_ctx, void *user_ctx) put_packet("OK"); } -static void handle_read_mem(GdbCmdContext *gdb_ctx, void *user_ctx) +static void handle_read_mem(GArray *params, void *user_ctx) { - if (gdb_ctx->num_params != 2) { + if (params->len != 2) { put_packet("E22"); return; } /* memtohex() doubles the required space */ - if (gdb_ctx->params[1].val_ull > MAX_PACKET_LENGTH / 2) { + if (get_param(params, 1)->val_ull > MAX_PACKET_LENGTH / 2) { put_packet("E22"); return; } - g_byte_array_set_size(gdbserver_state.mem_buf, gdb_ctx->params[1].val_ull); + g_byte_array_set_size(gdbserver_state.mem_buf, + get_param(params, 1)->val_ull); - if (target_memory_rw_debug(gdbserver_state.g_cpu, gdb_ctx->params[0].val_ull, + if (target_memory_rw_debug(gdbserver_state.g_cpu, + get_param(params, 0)->val_ull, gdbserver_state.mem_buf->data, gdbserver_state.mem_buf->len, false)) { put_packet("E14"); @@ -1818,19 +1804,19 @@ static void handle_read_mem(GdbCmdContext *gdb_ctx, void *user_ctx) put_strbuf(); } -static void handle_write_all_regs(GdbCmdContext *gdb_ctx, void *user_ctx) +static void handle_write_all_regs(GArray *params, void *user_ctx) { target_ulong addr, len; uint8_t *registers; int reg_size; - if (!gdb_ctx->num_params) { + if (!params->len) { return; } cpu_synchronize_state(gdbserver_state.g_cpu); - len = strlen(gdb_ctx->params[0].data) / 2; - hextomem(gdbserver_state.mem_buf, gdb_ctx->params[0].data, len); + len = strlen(get_param(params, 0)->data) / 2; + hextomem(gdbserver_state.mem_buf, get_param(params, 0)->data, len); registers = gdbserver_state.mem_buf->data; for (addr = 0; addr < gdbserver_state.g_cpu->gdb_num_g_regs && len > 0; addr++) { @@ -1841,7 +1827,7 @@ static void handle_write_all_regs(GdbCmdContext *gdb_ctx, void *user_ctx) put_packet("OK"); } -static void handle_read_all_regs(GdbCmdContext *gdb_ctx, void *user_ctx) +static void handle_read_all_regs(GArray *params, void *user_ctx) { target_ulong addr, len; @@ -1859,14 +1845,14 @@ static void handle_read_all_regs(GdbCmdContext *gdb_ctx, void *user_ctx) put_strbuf(); } -static void handle_file_io(GdbCmdContext *gdb_ctx, void *user_ctx) +static void handle_file_io(GArray *params, void *user_ctx) { - if (gdb_ctx->num_params >= 1 && gdbserver_state.current_syscall_cb) { + if (params->len >= 1 && gdbserver_state.current_syscall_cb) { target_ulong ret, err; - ret = (target_ulong)gdb_ctx->params[0].val_ull; - if (gdb_ctx->num_params >= 2) { - err = (target_ulong)gdb_ctx->params[1].val_ull; + ret = (target_ulong)get_param(params, 0)->val_ull; + if (params->len >= 2) { + err = (target_ulong)get_param(params, 1)->val_ull; } else { err = 0; } @@ -1874,7 +1860,7 @@ static void handle_file_io(GdbCmdContext *gdb_ctx, void *user_ctx) gdbserver_state.current_syscall_cb = NULL; } - if (gdb_ctx->num_params >= 3 && gdb_ctx->params[2].opcode == (uint8_t)'C') { + if (params->len >= 3 && get_param(params, 2)->opcode == (uint8_t)'C') { put_packet("T02"); return; } @@ -1882,23 +1868,23 @@ static void handle_file_io(GdbCmdContext *gdb_ctx, void *user_ctx) gdb_continue(); } -static void handle_step(GdbCmdContext *gdb_ctx, void *user_ctx) +static void handle_step(GArray *params, void *user_ctx) { - if (gdb_ctx->num_params) { - gdb_set_cpu_pc((target_ulong)gdb_ctx->params[0].val_ull); + if (params->len) { + gdb_set_cpu_pc((target_ulong)get_param(params, 0)->val_ull); } cpu_single_step(gdbserver_state.c_cpu, get_sstep_flags()); gdb_continue(); } -static void handle_backward(GdbCmdContext *gdb_ctx, void *user_ctx) +static void handle_backward(GArray *params, void *user_ctx) { if (replay_mode != REPLAY_MODE_PLAY) { put_packet("E22"); } - if (gdb_ctx->num_params == 1) { - switch (gdb_ctx->params[0].opcode) { + if (params->len == 1) { + switch (get_param(params, 0)->opcode) { case 's': if (replay_reverse_step()) { gdb_continue(); @@ -1920,20 +1906,20 @@ static void handle_backward(GdbCmdContext *gdb_ctx, void *user_ctx) put_packet(""); } -static void handle_v_cont_query(GdbCmdContext *gdb_ctx, void *user_ctx) +static void handle_v_cont_query(GArray *params, void *user_ctx) { put_packet("vCont;c;C;s;S"); } -static void handle_v_cont(GdbCmdContext *gdb_ctx, void *user_ctx) +static void handle_v_cont(GArray *params, void *user_ctx) { int res; - if (!gdb_ctx->num_params) { + if (!params->len) { return; } - res = gdb_handle_vcont(gdb_ctx->params[0].data); + res = gdb_handle_vcont(get_param(params, 0)->data); if ((res == -EINVAL) || (res == -ERANGE)) { put_packet("E22"); } else if (res) { @@ -1941,17 +1927,17 @@ static void handle_v_cont(GdbCmdContext *gdb_ctx, void *user_ctx) } } -static void handle_v_attach(GdbCmdContext *gdb_ctx, void *user_ctx) +static void handle_v_attach(GArray *params, void *user_ctx) { GDBProcess *process; CPUState *cpu; g_string_assign(gdbserver_state.str_buf, "E22"); - if (!gdb_ctx->num_params) { + if (!params->len) { goto cleanup; } - process = gdb_get_process(gdb_ctx->params[0].val_ul); + process = gdb_get_process(get_param(params, 0)->val_ul); if (!process) { goto cleanup; } @@ -1972,7 +1958,7 @@ cleanup: put_strbuf(); } -static void handle_v_kill(GdbCmdContext *gdb_ctx, void *user_ctx) +static void handle_v_kill(GArray *params, void *user_ctx) { /* Kill the target */ put_packet("OK"); @@ -2007,43 +1993,43 @@ static const GdbCmdParseEntry gdb_v_commands_table[] = { }, }; -static void handle_v_commands(GdbCmdContext *gdb_ctx, void *user_ctx) +static void handle_v_commands(GArray *params, void *user_ctx) { - if (!gdb_ctx->num_params) { + if (!params->len) { return; } - if (process_string_cmd(NULL, gdb_ctx->params[0].data, + if (process_string_cmd(NULL, get_param(params, 0)->data, gdb_v_commands_table, ARRAY_SIZE(gdb_v_commands_table))) { put_packet(""); } } -static void handle_query_qemu_sstepbits(GdbCmdContext *gdb_ctx, void *user_ctx) +static void handle_query_qemu_sstepbits(GArray *params, void *user_ctx) { g_string_printf(gdbserver_state.str_buf, "ENABLE=%x,NOIRQ=%x,NOTIMER=%x", SSTEP_ENABLE, SSTEP_NOIRQ, SSTEP_NOTIMER); put_strbuf(); } -static void handle_set_qemu_sstep(GdbCmdContext *gdb_ctx, void *user_ctx) +static void handle_set_qemu_sstep(GArray *params, void *user_ctx) { - if (!gdb_ctx->num_params) { + if (!params->len) { return; } - sstep_flags = gdb_ctx->params[0].val_ul; + sstep_flags = get_param(params, 0)->val_ul; put_packet("OK"); } -static void handle_query_qemu_sstep(GdbCmdContext *gdb_ctx, void *user_ctx) +static void handle_query_qemu_sstep(GArray *params, void *user_ctx) { g_string_printf(gdbserver_state.str_buf, "0x%x", sstep_flags); put_strbuf(); } -static void handle_query_curr_tid(GdbCmdContext *gdb_ctx, void *user_ctx) +static void handle_query_curr_tid(GArray *params, void *user_ctx) { CPUState *cpu; GDBProcess *process; @@ -2060,7 +2046,7 @@ static void handle_query_curr_tid(GdbCmdContext *gdb_ctx, void *user_ctx) put_strbuf(); } -static void handle_query_threads(GdbCmdContext *gdb_ctx, void *user_ctx) +static void handle_query_threads(GArray *params, void *user_ctx) { if (!gdbserver_state.query_cpu) { put_packet("l"); @@ -2073,25 +2059,25 @@ static void handle_query_threads(GdbCmdContext *gdb_ctx, void *user_ctx) gdbserver_state.query_cpu = gdb_next_attached_cpu(gdbserver_state.query_cpu); } -static void handle_query_first_threads(GdbCmdContext *gdb_ctx, void *user_ctx) +static void handle_query_first_threads(GArray *params, void *user_ctx) { gdbserver_state.query_cpu = gdb_first_attached_cpu(); - handle_query_threads(gdb_ctx, user_ctx); + handle_query_threads(params, user_ctx); } -static void handle_query_thread_extra(GdbCmdContext *gdb_ctx, void *user_ctx) +static void handle_query_thread_extra(GArray *params, void *user_ctx) { g_autoptr(GString) rs = g_string_new(NULL); CPUState *cpu; - if (!gdb_ctx->num_params || - gdb_ctx->params[0].thread_id.kind == GDB_READ_THREAD_ERR) { + if (!params->len || + get_param(params, 0)->thread_id.kind == GDB_READ_THREAD_ERR) { put_packet("E22"); return; } - cpu = gdb_get_cpu(gdb_ctx->params[0].thread_id.pid, - gdb_ctx->params[0].thread_id.tid); + cpu = gdb_get_cpu(get_param(params, 0)->thread_id.pid, + get_param(params, 0)->thread_id.tid); if (!cpu) { return; } @@ -2116,7 +2102,7 @@ static void handle_query_thread_extra(GdbCmdContext *gdb_ctx, void *user_ctx) } #ifdef CONFIG_USER_ONLY -static void handle_query_offsets(GdbCmdContext *gdb_ctx, void *user_ctx) +static void handle_query_offsets(GArray *params, void *user_ctx) { TaskState *ts; @@ -2131,17 +2117,17 @@ static void handle_query_offsets(GdbCmdContext *gdb_ctx, void *user_ctx) put_strbuf(); } #else -static void handle_query_rcmd(GdbCmdContext *gdb_ctx, void *user_ctx) +static void handle_query_rcmd(GArray *params, void *user_ctx) { const guint8 zero = 0; int len; - if (!gdb_ctx->num_params) { + if (!params->len) { put_packet("E22"); return; } - len = strlen(gdb_ctx->params[0].data); + len = strlen(get_param(params, 0)->data); if (len % 2) { put_packet("E01"); return; @@ -2149,7 +2135,7 @@ static void handle_query_rcmd(GdbCmdContext *gdb_ctx, void *user_ctx) g_assert(gdbserver_state.mem_buf->len == 0); len = len / 2; - hextomem(gdbserver_state.mem_buf, gdb_ctx->params[0].data, len); + hextomem(gdbserver_state.mem_buf, get_param(params, 0)->data, len); g_byte_array_append(gdbserver_state.mem_buf, &zero, 1); qemu_chr_be_write(gdbserver_state.mon_chr, gdbserver_state.mem_buf->data, gdbserver_state.mem_buf->len); @@ -2157,7 +2143,7 @@ static void handle_query_rcmd(GdbCmdContext *gdb_ctx, void *user_ctx) } #endif -static void handle_query_supported(GdbCmdContext *gdb_ctx, void *user_ctx) +static void handle_query_supported(GArray *params, void *user_ctx) { CPUClass *cc; @@ -2178,8 +2164,8 @@ static void handle_query_supported(GdbCmdContext *gdb_ctx, void *user_ctx) } #endif - if (gdb_ctx->num_params && - strstr(gdb_ctx->params[0].data, "multiprocess+")) { + if (params->len && + strstr(get_param(params, 0)->data, "multiprocess+")) { gdbserver_state.multiprocess = true; } @@ -2187,7 +2173,7 @@ static void handle_query_supported(GdbCmdContext *gdb_ctx, void *user_ctx) put_strbuf(); } -static void handle_query_xfer_features(GdbCmdContext *gdb_ctx, void *user_ctx) +static void handle_query_xfer_features(GArray *params, void *user_ctx) { GDBProcess *process; CPUClass *cc; @@ -2195,7 +2181,7 @@ static void handle_query_xfer_features(GdbCmdContext *gdb_ctx, void *user_ctx) const char *xml; const char *p; - if (gdb_ctx->num_params < 3) { + if (params->len < 3) { put_packet("E22"); return; } @@ -2208,15 +2194,15 @@ static void handle_query_xfer_features(GdbCmdContext *gdb_ctx, void *user_ctx) } gdb_has_xml = true; - p = gdb_ctx->params[0].data; + p = get_param(params, 0)->data; xml = get_feature_xml(p, &p, process); if (!xml) { put_packet("E00"); return; } - addr = gdb_ctx->params[1].val_ul; - len = gdb_ctx->params[2].val_ul; + addr = get_param(params, 1)->val_ul; + len = get_param(params, 2)->val_ul; total_len = strlen(xml); if (addr > total_len) { put_packet("E00"); @@ -2240,18 +2226,18 @@ static void handle_query_xfer_features(GdbCmdContext *gdb_ctx, void *user_ctx) } #if defined(CONFIG_USER_ONLY) && defined(CONFIG_LINUX_USER) -static void handle_query_xfer_auxv(GdbCmdContext *gdb_ctx, void *user_ctx) +static void handle_query_xfer_auxv(GArray *params, void *user_ctx) { TaskState *ts; unsigned long offset, len, saved_auxv, auxv_len; - if (gdb_ctx->num_params < 2) { + if (params->len < 2) { put_packet("E22"); return; } - offset = gdb_ctx->params[0].val_ul; - len = gdb_ctx->params[1].val_ul; + offset = get_param(params, 0)->val_ul; + len = get_param(params, 1)->val_ul; ts = gdbserver_state.c_cpu->opaque; saved_auxv = ts->info->saved_auxv; auxv_len = ts->info->auxv_len; @@ -2286,12 +2272,12 @@ static void handle_query_xfer_auxv(GdbCmdContext *gdb_ctx, void *user_ctx) } #endif -static void handle_query_attached(GdbCmdContext *gdb_ctx, void *user_ctx) +static void handle_query_attached(GArray *params, void *user_ctx) { put_packet(GDB_ATTACHED); } -static void handle_query_qemu_supported(GdbCmdContext *gdb_ctx, void *user_ctx) +static void handle_query_qemu_supported(GArray *params, void *user_ctx) { g_string_printf(gdbserver_state.str_buf, "sstepbits;sstep"); #ifndef CONFIG_USER_ONLY @@ -2301,21 +2287,21 @@ static void handle_query_qemu_supported(GdbCmdContext *gdb_ctx, void *user_ctx) } #ifndef CONFIG_USER_ONLY -static void handle_query_qemu_phy_mem_mode(GdbCmdContext *gdb_ctx, +static void handle_query_qemu_phy_mem_mode(GArray *params, void *user_ctx) { g_string_printf(gdbserver_state.str_buf, "%d", phy_memory_mode); put_strbuf(); } -static void handle_set_qemu_phy_mem_mode(GdbCmdContext *gdb_ctx, void *user_ctx) +static void handle_set_qemu_phy_mem_mode(GArray *params, void *user_ctx) { - if (!gdb_ctx->num_params) { + if (!params->len) { put_packet("E22"); return; } - if (!gdb_ctx->params[0].val_ul) { + if (!get_param(params, 0)->val_ul) { phy_memory_mode = 0; } else { phy_memory_mode = 1; @@ -2438,45 +2424,45 @@ static const GdbCmdParseEntry gdb_gen_set_table[] = { #endif }; -static void handle_gen_query(GdbCmdContext *gdb_ctx, void *user_ctx) +static void handle_gen_query(GArray *params, void *user_ctx) { - if (!gdb_ctx->num_params) { + if (!params->len) { return; } - if (!process_string_cmd(NULL, gdb_ctx->params[0].data, + if (!process_string_cmd(NULL, get_param(params, 0)->data, gdb_gen_query_set_common_table, ARRAY_SIZE(gdb_gen_query_set_common_table))) { return; } - if (process_string_cmd(NULL, gdb_ctx->params[0].data, + if (process_string_cmd(NULL, get_param(params, 0)->data, gdb_gen_query_table, ARRAY_SIZE(gdb_gen_query_table))) { put_packet(""); } } -static void handle_gen_set(GdbCmdContext *gdb_ctx, void *user_ctx) +static void handle_gen_set(GArray *params, void *user_ctx) { - if (!gdb_ctx->num_params) { + if (!params->len) { return; } - if (!process_string_cmd(NULL, gdb_ctx->params[0].data, + if (!process_string_cmd(NULL, get_param(params, 0)->data, gdb_gen_query_set_common_table, ARRAY_SIZE(gdb_gen_query_set_common_table))) { return; } - if (process_string_cmd(NULL, gdb_ctx->params[0].data, + if (process_string_cmd(NULL, get_param(params, 0)->data, gdb_gen_set_table, ARRAY_SIZE(gdb_gen_set_table))) { put_packet(""); } } -static void handle_target_halt(GdbCmdContext *gdb_ctx, void *user_ctx) +static void handle_target_halt(GArray *params, void *user_ctx) { g_string_printf(gdbserver_state.str_buf, "T%02xthread:", GDB_SIGNAL_TRAP); gdb_append_thread_id(gdbserver_state.c_cpu, gdbserver_state.str_buf); From patchwork Tue May 25 11:24:29 2021 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: 447176 Delivered-To: patch@linaro.org Received: by 2002:a02:7a1b:0:0:0:0:0 with SMTP id a27csp4177360jac; Tue, 25 May 2021 04:28:01 -0700 (PDT) X-Google-Smtp-Source: ABdhPJzD24ZntfzJ3Xfr2O7ud+3B2T0u6n+MBUQ3wUXs+MqShaLuY+fD3tXEL1WDh7PB0MaDkBV8 X-Received: by 2002:a92:b30b:: with SMTP id p11mr555511ilh.114.1621942081426; Tue, 25 May 2021 04:28:01 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1621942081; cv=none; d=google.com; s=arc-20160816; b=VFBEVncX7jdkBUi6e2xeBPV+wUbVev2awJWuMPttB+vQfdMRcybSUvlJ4ELK9/KkMA SDOvQSIIHBeBA8PpAPqchIYetW8Mqwm9ZHaCOF+VvWYOwpVMx6PDncFlhm8fqiQKuJV3 fbuppmpMoUgQAoTzQq3lx96yfLgCvDhNEjCx/81ZkySI/sE+O96mrueNhuaUZ7ROGejS k+UOJirt9u5SngiAkuUAcANb0oAcmXmmeTgUZ/SSjwZNpJ0ahkqFwox6nivNgNNsHnAw gESyNxiv9fAHFyRSY0NoCXaZQvkm+x4naNVm7wHK4loHTmJKRu6UCWEO9nivkN9AgcOd Xfwg== 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:content-transfer-encoding :mime-version:references:in-reply-to:message-id:date:subject:to:from :dkim-signature; bh=LEpF42VO968NzP26solMD9dIdhFaTBHy/3N+y7M6kL8=; b=X1q3cMYqJc2FHqLk/JfMBB07Qyg0K8djM1T6N8GxLFyg9/rK/jCSVC+NnF1VCKz3xX xYSxyrKBH3YTzMXYCkJfWom69ZilBfp/SZ+niqih0rxkp7jVFwMcjavRnoear+hpXe7Q T5TNpyb2noMBPgmbqnDkPIVAU9QarhjTLKFXACLhR0giuZQt0DrodRWGWXb3K7BIh8IK zoxiFMfomJ+mryZ2IMeoga+4Qn5rGvDG5PDVK1y56AQ8A8E5V3vxrp1TvDBhmWIDDmg8 c29Kb39g9SW0fhwRNKPwFDtXF916Vgta4B4999HrmmRkeOaTM1P8IK0TuG/Jh21DrtcA hB9w== ARC-Authentication-Results: i=1; mx.google.com; dkim=fail header.i=@linaro.org header.s=google header.b="B4pnHbk/"; 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 r20si15400777ioj.88.2021.05.25.04.28.01 for (version=TLS1_2 cipher=ECDHE-ECDSA-CHACHA20-POLY1305 bits=256/256); Tue, 25 May 2021 04:28:01 -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="B4pnHbk/"; 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]:52136 helo=lists1p.gnu.org) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1llVE8-0007rt-Th for patch@linaro.org; Tue, 25 May 2021 07:28:00 -0400 Received: from eggs.gnu.org ([2001:470:142:3::10]:59692) by lists.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.90_1) (envelope-from ) id 1llVB0-0002SS-2H for qemu-devel@nongnu.org; Tue, 25 May 2021 07:24:46 -0400 Received: from mail-wr1-x42c.google.com ([2a00:1450:4864:20::42c]:41739) by eggs.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_128_GCM_SHA256:128) (Exim 4.90_1) (envelope-from ) id 1llVAw-0002yN-Ec for qemu-devel@nongnu.org; Tue, 25 May 2021 07:24:45 -0400 Received: by mail-wr1-x42c.google.com with SMTP id d11so31794338wrw.8 for ; Tue, 25 May 2021 04:24:41 -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:in-reply-to:references :mime-version:content-transfer-encoding; bh=LEpF42VO968NzP26solMD9dIdhFaTBHy/3N+y7M6kL8=; b=B4pnHbk/rGUxEo/+UYkZEJpaVHoyVCOfU3OLRor1EP/pSaCYVYgSugmNDO8jcDQBBO Pl4RBHr0iapFFPTqSGcLj7jt4nl8sp1ViJa3kpkqsuvbiNH4Ig7KC+yb1n43Tp+DbKF7 8MU7jI/DCl3Ch7nlLKanQ81PiTK4N4Ub8lCH84yHhRe7VGRrTBsoCjJbi8d8j9zkOlQm ZNthcz0ZZnvazTJ//PELrr/5p+8KJZ6EuYGlFD8HNIgBHAP6Bu4EuT7TVydQkrtPXS1f mmux6wIGelYzKEwaml1gF9m7bouAD51vcaCX2VvrgD269FwxnCzMpC2RN36hRTujkL6v FMCw== 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:in-reply-to :references:mime-version:content-transfer-encoding; bh=LEpF42VO968NzP26solMD9dIdhFaTBHy/3N+y7M6kL8=; b=r+/2lPLrqUZaOxD2UgMWcXN6+OtvZBOprXLyXuyXXaD1+JIA+FYQ/XMTBa4vT/X9rt wgwOv5YDqbr+t9bQe3G/7qog2DwadL9ZZhvaKcA7yYrYh7FXIstp0I9KuIeTnAMFH7W5 K2Xy5EKiNtRnMsh9ccFHfeqp8rk5TSk1+5eyo3EKlmAVEcrj8nOeOUclKhGVdvv64Q5z 1l6d/bzZPaouUSdvQnVytIj/zjCgHzkW5P+ade3v5Mt6HudV1GeXzecmRwYkjBokMi7Q 0gfuC9u5qGH+yc1zdVfIYHCCzdMcjMDWJXyRxMXsauhjT+lxePZQXtmD6/QDUMj5rURb nGsw== X-Gm-Message-State: AOAM530ntxr32Bb+PQpc5YOtaV16HL8KOJyQGGz5KkRq8Xllp6SpKyLw HFlj+ARkIuaElH05odmiunM2yju01abI0Q== X-Received: by 2002:a5d:6d04:: with SMTP id e4mr26198830wrq.344.1621941880363; Tue, 25 May 2021 04:24:40 -0700 (PDT) Received: from zen.linaroharston ([51.148.130.216]) by smtp.gmail.com with ESMTPSA id z131sm2530099wmb.30.2021.05.25.04.24.33 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Tue, 25 May 2021 04:24:37 -0700 (PDT) Received: from zen.lan (localhost [127.0.0.1]) by zen.linaroharston (Postfix) with ESMTP id 3A1E61FF91; Tue, 25 May 2021 12:24:32 +0100 (BST) From: =?utf-8?q?Alex_Benn=C3=A9e?= To: peter.maydell@linaro.org Subject: [PULL 5/7] hmp-commands: expand type of icount to "l" in replay commands Date: Tue, 25 May 2021 12:24:29 +0100 Message-Id: <20210525112431.22005-6-alex.bennee@linaro.org> X-Mailer: git-send-email 2.20.1 In-Reply-To: <20210525112431.22005-1-alex.bennee@linaro.org> References: <20210525112431.22005-1-alex.bennee@linaro.org> MIME-Version: 1.0 Received-SPF: pass client-ip=2a00:1450:4864:20::42c; envelope-from=alex.bennee@linaro.org; helo=mail-wr1-x42c.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.23 Precedence: list List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Cc: Pavel Dovgalyuk , =?utf-8?q?Alex_Benn=C3=A9?= =?utf-8?q?e?= , qemu-devel@nongnu.org, "Dr. David Alan Gilbert" , =?utf-8?q?Philippe_Mathieu-Daud=C3=A9?= Errors-To: qemu-devel-bounces+patch=linaro.org@nongnu.org Sender: "Qemu-devel" This is not a 32 bit number, it can (and most likely will) be quite a big one. Signed-off-by: Alex Bennée Reviewed-by: Pavel Dovgalyuk Reviewed-by: Philippe Mathieu-Daudé Message-Id: <20210520174303.12310-7-alex.bennee@linaro.org> -- 2.20.1 diff --git a/hmp-commands.hx b/hmp-commands.hx index 435c591a1c..5ee9cfd520 100644 --- a/hmp-commands.hx +++ b/hmp-commands.hx @@ -1667,7 +1667,7 @@ ERST { .name = "replay_break", - .args_type = "icount:i", + .args_type = "icount:l", .params = "icount", .help = "set breakpoint at the specified instruction count", .cmd = hmp_replay_break, @@ -1699,7 +1699,7 @@ ERST { .name = "replay_seek", - .args_type = "icount:i", + .args_type = "icount:l", .params = "icount", .help = "replay execution to the specified instruction count", .cmd = hmp_replay_seek, From patchwork Tue May 25 11:24:30 2021 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: 447174 Delivered-To: patch@linaro.org Received: by 2002:a02:7a1b:0:0:0:0:0 with SMTP id a27csp4177027jac; Tue, 25 May 2021 04:27:36 -0700 (PDT) X-Google-Smtp-Source: ABdhPJytx16jnAc2EYKPt2+MaHFC5pChsfIfwxNQpYjgpdByn4Me2GgA5qXHWQb7EM9SLeXYVLV3 X-Received: by 2002:a5d:960b:: with SMTP id w11mr13011279iol.138.1621942056209; Tue, 25 May 2021 04:27:36 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1621942056; cv=none; d=google.com; s=arc-20160816; b=GIqV0gX1OsJ+iw5F7NMNmro6c1jcL6I3zImABDXMlORp1HRYzcgr6+6rr0WG8tmlGM woLeQY0VkQf+csYJIg79KWn/GuXAAWJvFNQcrK4JjgL985+QUIT8eEDpj1ns4gVS1CaA iOd3CSvJwBM+QDocK0Y0aPi/ZbtZyeGEbzBYi3veduef0LQD6kyfP2mF1w0As0mFsT4+ X7hdIOTXN9bHAOXKXFu82R2i15gX9fHf2cFJtE9umB+aJJLUCTCJYsKpF6DV1/M0Wz0i IQUjBlU3jkFPdgiGf7Joa0ivZfXG0ZsPperifJax85Z/4jgUDlc95FQ8LgGZQO6+1cs6 pxNw== 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:content-transfer-encoding :mime-version:references:in-reply-to:message-id:date:subject:to:from :dkim-signature; bh=4q5N6WoamWwCZ9NCTtf7vTo0CQZJFAXL5GXjETh6BsU=; b=nkW9FkmMHlcJTM8EGAQY3FwNGcAHVx1eDu9sTfdZ4CUVoXgARVBh9zO7UUdu/bKz7Y LJm5bbw1I8BEh2bbMmxwCsLJYP3CMXj0XcHCvyFQFzT1OYdTDC73XFGnHlyhA3/fQcCe RoXbV9npUj9jEXPxzuBXyfPcdYXIM5MVF5AGbF7pNnwMXUP5bB9EgBG74Jb5RnaBDY/b BYoclCFqQ82cfYguKNr5DPpDiLQIaWkqL9hIXLvz7hzHwB3TBzROHvfI35v7bzawdOrx UYG5SWZ3fBAgUhnR4PK92JYZ4q5GlVNHsjn+uUQqZujc/r5b75JY5EUi7VJ/1Whvrw5w l9dQ== ARC-Authentication-Results: i=1; mx.google.com; dkim=fail header.i=@linaro.org header.s=google header.b=nmQfk1Hs; 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 h10si21066445ili.90.2021.05.25.04.27.36 for (version=TLS1_2 cipher=ECDHE-ECDSA-CHACHA20-POLY1305 bits=256/256); Tue, 25 May 2021 04:27:36 -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=nmQfk1Hs; 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]:53236 helo=lists1p.gnu.org) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1llVDj-000097-Kp for patch@linaro.org; Tue, 25 May 2021 07:27:35 -0400 Received: from eggs.gnu.org ([2001:470:142:3::10]:59704) by lists.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.90_1) (envelope-from ) id 1llVB0-0002V8-QP for qemu-devel@nongnu.org; Tue, 25 May 2021 07:24:46 -0400 Received: from mail-wm1-x335.google.com ([2a00:1450:4864:20::335]:51936) by eggs.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_128_GCM_SHA256:128) (Exim 4.90_1) (envelope-from ) id 1llVAx-00030E-G0 for qemu-devel@nongnu.org; Tue, 25 May 2021 07:24:46 -0400 Received: by mail-wm1-x335.google.com with SMTP id u133so16523420wmg.1 for ; Tue, 25 May 2021 04:24:43 -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:in-reply-to:references :mime-version:content-transfer-encoding; bh=4q5N6WoamWwCZ9NCTtf7vTo0CQZJFAXL5GXjETh6BsU=; b=nmQfk1HsyGK4u9cOWfOtYKcT27GxUorCyvFmQyV7CHvhdCzZNOGtyHqX0RyF3M8ymx 0WnK2j0mDFQ1k3+6ZOATkeu1TvJ8bNGE7nj2yRi2/ijpT5tRKWwALrhGGj4lopCXCSRD PryVfVZp4LAnR2ZEkAvQimZGYbctfoofUupBkN3EKd8BXpV+Kgc3B6Sp7t7VJjJFKqpi jayAhc2V5nC7c8lMQaWxLBSN6Y0ALQbIF0JxFdKLQ0IT/FHS8N6SnGGZrBV+uXc1oVq1 7wn9yhgkrJpHL6fuusBl/oVtkxHobSJz4w86ZtC/2ds0LV297RiOswW4vXs3FU84fAnN +9+A== 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:in-reply-to :references:mime-version:content-transfer-encoding; bh=4q5N6WoamWwCZ9NCTtf7vTo0CQZJFAXL5GXjETh6BsU=; b=jfKkqQyRnTb0/Xe+fU6XSRzdOfr4bT8lV30h4bEbEhF43enK99NT3YR6i6vjvnB9b8 Pk6YZaZZvJ5DP4WRJoxk5Os7vNuHNlrpTlZ9IOfQ5k6+lchM0rPZiza9yYMCtmAjQUBY KFfp+TCa/PNtjY0321t2UCIQ0Is578DfAwQdSxIvU511mBWRIItrKp5dk+CG0fRCuNc+ UPuIW0kkVQGqxnGMCo1Fx/hVNQfe98VuLFWHDHLGTRXxgdmZwBnsxr8PfOdErIVDJUaM Q+O3VAiwwJZWyLVxYrUVcRaLKXslQakIREdgO234zUo9629+52N58eIzOnegDePdlclk 89VQ== X-Gm-Message-State: AOAM530wAYyOR9ue3x8HPPdDsIWZw7D94nP4ZhJYEndx3E2B5R/x9n3O +r4/ELoAkigOHPCgvN9MnIlbSQ== X-Received: by 2002:a05:600c:4ec9:: with SMTP id g9mr22571908wmq.173.1621941881994; Tue, 25 May 2021 04:24:41 -0700 (PDT) Received: from zen.linaroharston ([51.148.130.216]) by smtp.gmail.com with ESMTPSA id i12sm15176387wrn.94.2021.05.25.04.24.33 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Tue, 25 May 2021 04:24:37 -0700 (PDT) Received: from zen.lan (localhost [127.0.0.1]) by zen.linaroharston (Postfix) with ESMTP id 4F8AA1FF92; Tue, 25 May 2021 12:24:32 +0100 (BST) From: =?utf-8?q?Alex_Benn=C3=A9e?= To: peter.maydell@linaro.org Subject: [PULL 6/7] gdbstub: tidy away reverse debugging check into function Date: Tue, 25 May 2021 12:24:30 +0100 Message-Id: <20210525112431.22005-7-alex.bennee@linaro.org> X-Mailer: git-send-email 2.20.1 In-Reply-To: <20210525112431.22005-1-alex.bennee@linaro.org> References: <20210525112431.22005-1-alex.bennee@linaro.org> MIME-Version: 1.0 Received-SPF: pass client-ip=2a00:1450:4864:20::335; envelope-from=alex.bennee@linaro.org; helo=mail-wm1-x335.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.23 Precedence: list List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Cc: Richard Henderson , =?utf-8?q?Philippe_M?= =?utf-8?q?athieu-Daud=C3=A9?= , =?utf-8?q?Alex_Benn=C3=A9e?= , qemu-devel@nongnu.org, =?utf-8?q?Philippe_Mathieu-Daud=C3=A9?= Errors-To: qemu-devel-bounces+patch=linaro.org@nongnu.org Sender: "Qemu-devel" In theory we don't need an actual record/replay to enact reverse debugging on a purely deterministic system (i.e one with no external inputs running under icount). Tidy away the logic into a little function. Signed-off-by: Alex Bennée Reviewed-by: Richard Henderson Reviewed-by: Philippe Mathieu-Daudé Message-Id: <20210520174303.12310-8-alex.bennee@linaro.org> -- 2.20.1 diff --git a/gdbstub.c b/gdbstub.c index 84ce770a04..52bde5bdc9 100644 --- a/gdbstub.c +++ b/gdbstub.c @@ -465,6 +465,15 @@ int use_gdb_syscalls(void) return gdb_syscall_mode == GDB_SYS_ENABLED; } +static bool stub_can_reverse(void) +{ +#ifdef CONFIG_USER_ONLY + return false; +#else + return replay_mode == REPLAY_MODE_PLAY; +#endif +} + /* Resume execution. */ static inline void gdb_continue(void) { @@ -1880,7 +1889,7 @@ static void handle_step(GArray *params, void *user_ctx) static void handle_backward(GArray *params, void *user_ctx) { - if (replay_mode != REPLAY_MODE_PLAY) { + if (!stub_can_reverse()) { put_packet("E22"); } if (params->len == 1) { @@ -2153,7 +2162,7 @@ static void handle_query_supported(GArray *params, void *user_ctx) g_string_append(gdbserver_state.str_buf, ";qXfer:features:read+"); } - if (replay_mode == REPLAY_MODE_PLAY) { + if (stub_can_reverse()) { g_string_append(gdbserver_state.str_buf, ";ReverseStep+;ReverseContinue+"); } From patchwork Tue May 25 11:24:31 2021 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: 447177 Delivered-To: patch@linaro.org Received: by 2002:a02:7a1b:0:0:0:0:0 with SMTP id a27csp4177527jac; Tue, 25 May 2021 04:28:18 -0700 (PDT) X-Google-Smtp-Source: ABdhPJwdeu4LI8ZIm0zRQgswCX3szyWXu4OOTbEQJibgQNDlm0g4PwW7XecAGx90tx8T49iTL1rA X-Received: by 2002:a25:3f47:: with SMTP id m68mr40272657yba.228.1621942098213; Tue, 25 May 2021 04:28:18 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1621942098; cv=none; d=google.com; s=arc-20160816; b=gfqM/L63CfdaN7aM6sBCyQURrG2dwJdEUVO724JaH+G9jqTSVF7f3kkgqPqFV5cTE5 hvhwrNytga5BSMZOCE6AVWGphftSFAzS4rp1SU8j32OWSGuwVOaTHE8803ZRH2nbxbd/ eR4BPZV2IA86eATrsN5dZ3E48hyIber8pWpC4ufxPvpWi7JH4ASRJzqrOF9YW3bRZvqq 7lsoIfVpuNCqp7fRMeV0xh0MCiQUvBAe+5U6c3xKBnmbVg2pMdnjMlIfxHfxRSkfw0GG SBC+un+Ji9hBIEoAibo7Qet5yuMveXDX2qLG0gwK8xRunq0XjUxHUl7i80aTlwDTbDf4 4sLQ== 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:content-transfer-encoding :mime-version:references:in-reply-to:message-id:date:subject:to:from :dkim-signature; bh=B4E52WDV0HW4Iobfoi2xYeceYAjvoonRNwFWdGg8quo=; b=INhkuA140EKBHNlN9qIIJjVUW+IIbdZfiwpPEYDOD92R5wr34T+a3zPYqb8s+ctYAV CxIVhV8lteEAXbDfGBh8wh0V6vvpWOXhEycZitIRAv6NvuwpPYUgzpb2AjoyRmE/QA3g xryDRmCSGsZLhLjq4Qix+tz5dJgujYdXiJxsr1NS58JsjSUPTIqM5NlYF2CDAWmpvvQC YXh+VBTMRu7Gf3mCFJoM+dch/+0RRcbWt3oa34e0Uw6hqVVTnzDxa3xMIhvU7z8NKdl4 FVxrpoec2LZfVPvvfu00eaX6Rwp3f6lkO3EroE1384mGJe7AD1NcnM/IQWfaze+IAGJ5 NRIg== ARC-Authentication-Results: i=1; mx.google.com; dkim=fail header.i=@linaro.org header.s=google header.b=HHHBgodq; 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 3si10228811ybh.406.2021.05.25.04.28.18 for (version=TLS1_2 cipher=ECDHE-ECDSA-CHACHA20-POLY1305 bits=256/256); Tue, 25 May 2021 04:28:18 -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=HHHBgodq; 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]:52496 helo=lists1p.gnu.org) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1llVEP-00086b-KK for patch@linaro.org; Tue, 25 May 2021 07:28:17 -0400 Received: from eggs.gnu.org ([2001:470:142:3::10]:59726) by lists.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.90_1) (envelope-from ) id 1llVB1-0002ZN-P6 for qemu-devel@nongnu.org; Tue, 25 May 2021 07:24:47 -0400 Received: from mail-wm1-x330.google.com ([2a00:1450:4864:20::330]:54006) by eggs.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_128_GCM_SHA256:128) (Exim 4.90_1) (envelope-from ) id 1llVAy-00030S-2M for qemu-devel@nongnu.org; Tue, 25 May 2021 07:24:47 -0400 Received: by mail-wm1-x330.google.com with SMTP id h3so3780627wmq.3 for ; Tue, 25 May 2021 04:24:43 -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:in-reply-to:references :mime-version:content-transfer-encoding; bh=B4E52WDV0HW4Iobfoi2xYeceYAjvoonRNwFWdGg8quo=; b=HHHBgodqQKorGQoxF7p67opM8ah/Ku5a+lArwA/oxHddUaA0/LfRgWjhHTHIittwfg aSfQM29m2fZfxhisFSKXCewSCCK4NpO2z5zJSV+Ax12KQHRQqg1suiWt2rwLxo1gd3Dq 4Dt5PYM+QTh+B3K4kBoc34f0r7KRPjl7WFurfvVLrlhnq+yws3s1J2YpRc8zpnTxT54O D4eGa15di9uWWpJUpAUBTyKTkYlsjma6Bdb8Are4tab+TC4nAL33Ntk8whp3fNvOUWMH FU/Cy3mU2cnLI6WxWMM/VDzTUB+7GVsK6g/puR0BhnfY01XXpISm6ypMHOik+Yjo8IsR +DRw== 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:in-reply-to :references:mime-version:content-transfer-encoding; bh=B4E52WDV0HW4Iobfoi2xYeceYAjvoonRNwFWdGg8quo=; b=PxhbY36bf2j+9EBfSWAFXOG5/cKyH50fCQZPADa1Ss83COYmX3TlLT8TFm8B8LhdOp wcMZwHAnpfjlz0YgtHbd/xciutTxCb9NYgGa4xaOw839dxAfcEFYA7YbfWOZfb5CXqhR XjAl0uH//uL7XNjHVFlLEB4CKCFuFb88fObYQA/fiw2ItJH7uqRe8oTSxUTZFDCdKQhW evgtn3zcg6vDtKeKZMIIa04ej5MYoNyaq17WRvClUVToUXzr0mOAMcTXyEtFLIkI37eO uig435TSq6lGD7yZHWXT4PvP9MSLywOny7H/mj0Q+kinm5wjwuYX06j38XWcF/3FeGgv ThWQ== X-Gm-Message-State: AOAM532ggksJ9pKOAmEpp0aQyxkougAgg4CGFBRTANY5SYFmT6Noobyb LjujX9dm9WbVdht9y1b5sj4xQg== X-Received: by 2002:a1c:f016:: with SMTP id a22mr6044499wmb.65.1621941882682; Tue, 25 May 2021 04:24:42 -0700 (PDT) Received: from zen.linaroharston ([51.148.130.216]) by smtp.gmail.com with ESMTPSA id f12sm15723616wre.88.2021.05.25.04.24.34 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Tue, 25 May 2021 04:24:37 -0700 (PDT) Received: from zen.lan (localhost [127.0.0.1]) by zen.linaroharston (Postfix) with ESMTP id 653621FF93; Tue, 25 May 2021 12:24:32 +0100 (BST) From: =?utf-8?q?Alex_Benn=C3=A9e?= To: peter.maydell@linaro.org Subject: [PULL 7/7] plugins/syscall: Added a table-like summary output Date: Tue, 25 May 2021 12:24:31 +0100 Message-Id: <20210525112431.22005-8-alex.bennee@linaro.org> X-Mailer: git-send-email 2.20.1 In-Reply-To: <20210525112431.22005-1-alex.bennee@linaro.org> References: <20210525112431.22005-1-alex.bennee@linaro.org> MIME-Version: 1.0 Received-SPF: pass client-ip=2a00:1450:4864:20::330; envelope-from=alex.bennee@linaro.org; helo=mail-wm1-x330.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.23 Precedence: list List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Cc: Mahmoud Mandour , =?utf-8?q?Alex_Benn=C3=A9e?= , qemu-devel@nongnu.org Errors-To: qemu-devel-bounces+patch=linaro.org@nongnu.org Sender: "Qemu-devel" From: Mahmoud Mandour Added a table-like output which contains the total number of calls for each used syscall along with the number of errors that occurred. Per-call tracing is still available through supplying the argument ``print`` to the plugin. Signed-off-by: Mahmoud Mandour Signed-off-by: Alex Bennée Message-Id: <20210519032409.3041-1-ma.mandourr@gmail.com> Message-Id: <20210520174303.12310-9-alex.bennee@linaro.org> -- 2.20.1 diff --git a/tests/plugin/syscall.c b/tests/plugin/syscall.c index 53ee2ab6c4..6dd71092e1 100644 --- a/tests/plugin/syscall.c +++ b/tests/plugin/syscall.c @@ -16,32 +16,120 @@ QEMU_PLUGIN_EXPORT int qemu_plugin_version = QEMU_PLUGIN_VERSION; +typedef struct { + int64_t num; + int64_t calls; + int64_t errors; +} SyscallStats; + +static GMutex lock; +static GHashTable *statistics; + +static SyscallStats *get_or_create_entry(int64_t num) +{ + SyscallStats *entry = + (SyscallStats *) g_hash_table_lookup(statistics, GINT_TO_POINTER(num)); + + if (!entry) { + entry = g_new0(SyscallStats, 1); + entry->num = num; + g_hash_table_insert(statistics, GINT_TO_POINTER(num), (gpointer) entry); + } + + return entry; +} + static void vcpu_syscall(qemu_plugin_id_t id, unsigned int vcpu_index, int64_t num, uint64_t a1, uint64_t a2, uint64_t a3, uint64_t a4, uint64_t a5, uint64_t a6, uint64_t a7, uint64_t a8) { - g_autofree gchar *out = g_strdup_printf("syscall #%" PRIi64 "\n", num); - qemu_plugin_outs(out); + if (statistics) { + SyscallStats *entry; + g_mutex_lock(&lock); + entry = get_or_create_entry(num); + entry->calls++; + g_mutex_unlock(&lock); + } else { + g_autofree gchar *out = g_strdup_printf("syscall #%" PRIi64 "\n", num); + qemu_plugin_outs(out); + } } static void vcpu_syscall_ret(qemu_plugin_id_t id, unsigned int vcpu_idx, int64_t num, int64_t ret) +{ + if (statistics) { + SyscallStats *entry; + + g_mutex_lock(&lock); + /* Should always return an existent entry. */ + entry = get_or_create_entry(num); + if (ret < 0) { + entry->errors++; + } + g_mutex_unlock(&lock); + } else { + g_autofree gchar *out; + out = g_strdup_printf("syscall #%" PRIi64 " returned -> %" PRIi64 "\n", + num, ret); + qemu_plugin_outs(out); + } +} + +static void print_entry(gpointer val, gpointer user_data) { g_autofree gchar *out; - out = g_strdup_printf("syscall #%" PRIi64 " returned -> %" PRIi64 "\n", - num, ret); + SyscallStats *entry = (SyscallStats *) val; + int64_t syscall_num = entry->num; + out = g_strdup_printf( + "%-13" PRIi64 "%-6" PRIi64 " %" PRIi64 "\n", + syscall_num, entry->calls, entry->errors); qemu_plugin_outs(out); } +static gint comp_func(gconstpointer ea, gconstpointer eb) +{ + SyscallStats *ent_a = (SyscallStats *) ea; + SyscallStats *ent_b = (SyscallStats *) eb; + + return ent_a->calls > ent_b->calls ? -1 : 1; +} + /* ************************************************************************* */ +static void plugin_exit(qemu_plugin_id_t id, void *p) +{ + if (!statistics) { + return; + } + + g_mutex_lock(&lock); + GList *entries = g_hash_table_get_values(statistics); + entries = g_list_sort(entries, comp_func); + qemu_plugin_outs("syscall no. calls errors\n"); -static void plugin_exit(qemu_plugin_id_t id, void *p) {} + g_list_foreach(entries, print_entry, NULL); + + g_list_free(entries); + g_hash_table_destroy(statistics); + g_mutex_unlock(&lock); +} QEMU_PLUGIN_EXPORT int qemu_plugin_install(qemu_plugin_id_t id, const qemu_info_t *info, int argc, char **argv) { + if (argc == 0) { + statistics = g_hash_table_new_full(NULL, g_direct_equal, NULL, g_free); + } else { + for (int i = 0; i < argc; i++) { + if (g_strcmp0(argv[i], "print") != 0) { + fprintf(stderr, "unsupported argument: %s\n", argv[i]); + return -1; + } + } + } + qemu_plugin_register_vcpu_syscall_cb(id, vcpu_syscall); qemu_plugin_register_vcpu_syscall_ret_cb(id, vcpu_syscall_ret); qemu_plugin_register_atexit_cb(id, plugin_exit, NULL);