From patchwork Fri Jun 7 09:05:00 2019 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 8bit X-Patchwork-Submitter: =?utf-8?q?Alex_Benn=C3=A9e?= X-Patchwork-Id: 166084 Delivered-To: patch@linaro.org Received: by 2002:a92:9e1a:0:0:0:0:0 with SMTP id q26csp385363ili; Fri, 7 Jun 2019 02:14:18 -0700 (PDT) X-Google-Smtp-Source: APXvYqw+5QMrENEnpMvbHJ1/ZwpVUlb0bJ10zde22N0AYOh3T9k1Np86Q6P24Aq0OrNQKjnDGhzd X-Received: by 2002:aed:21f0:: with SMTP id m45mr31668199qtc.391.1559898857999; Fri, 07 Jun 2019 02:14:17 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1559898857; cv=none; d=google.com; s=arc-20160816; b=RwhH4L1PHOtVV6b5Unjy/OqU2oac+Zz3aiwwCsaofpWoeJMAs70vVZKb7raknfR5Qj 67LW/64kui9e0cQTrlK6oM+fFUrTIO1HtQZIHr3wk94Bwdl2VCriyB0wtc4a/h6ox1Av WIgMl9X7CSvtwlYmKZTZ8LJT58xS+jDm1YS1+UTQidEvmPl/er/zTum7X5ZGZAwUUm32 vAjSIKAX4vsnyiVwuTA/VGYrJFJZ2MwSeSozT6EJF1qET/kpFwheoQbW/tjDS8IzJdtx Ocmw5FWHfpLh6ikWdManByQrMSiJuxGcWbZK0ND1ohhsTs/MpojdxHtVe6cPYOzWKFky m5cg== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=sender:errors-to:cc:list-subscribe:list-help:list-post:list-archive :list-unsubscribe:list-id:precedence:subject :content-transfer-encoding:mime-version:references:in-reply-to :message-id:date:to:from:dkim-signature; bh=ngCYt07rD9S6NfmUGM8XQw4uLZvtIN9Vg7GKA5tvoZU=; b=qqDdbsqo7AG4BdY8MXN0CcIlX+mzXii/fa+Sb42nmiVdC2njRHUkmMhjkjkd4NzxCR 51xKJ6XC1sg5eNwIWhufVOH5G4MnPzGQQI9QFOgbEcLwMTFV4E0PybJSqmBYTikMwjMz VrGplZnYZm6PsnNCfF/iwejjsbswb0Re8r4XJRhJdlyqf0X1k2NHB5a7dOzlkeTFqEWq nUnDuBqn2VS06G5VsNAg0L6VeYDs7u44e61+1Q+fFaOAkvBFfovX+Zk0Y4dk/rBvwP0s M2hl519v6966OCANeG63gemzKT3BCMya0l28f+o7k4w7kEPtpRnXEVk3jIInk9CUt8Lh +w6A== ARC-Authentication-Results: i=1; mx.google.com; dkim=fail header.i=@linaro.org header.s=google header.b="Q8/wb5mW"; spf=pass (google.com: domain of qemu-devel-bounces+patch=linaro.org@nongnu.org designates 209.51.188.47 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.47]) by mx.google.com with ESMTPS id i8si857450qkm.147.2019.06.07.02.14.17 for (version=TLS1_2 cipher=ECDHE-RSA-CHACHA20-POLY1305 bits=256/256); Fri, 07 Jun 2019 02:14:17 -0700 (PDT) Received-SPF: pass (google.com: domain of qemu-devel-bounces+patch=linaro.org@nongnu.org designates 209.51.188.47 as permitted sender) client-ip=209.51.188.47; Authentication-Results: mx.google.com; dkim=fail header.i=@linaro.org header.s=google header.b="Q8/wb5mW"; spf=pass (google.com: domain of qemu-devel-bounces+patch=linaro.org@nongnu.org designates 209.51.188.47 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]:47314 helo=lists.gnu.org) by lists.gnu.org with esmtp (Exim 4.86_2) (envelope-from ) id 1hZAwz-0002pQ-IJ for patch@linaro.org; Fri, 07 Jun 2019 05:14:17 -0400 Received: from eggs.gnu.org ([2001:470:142:3::10]:39330) by lists.gnu.org with esmtp (Exim 4.86_2) (envelope-from ) id 1hZAoz-00047K-Qw for qemu-devel@nongnu.org; Fri, 07 Jun 2019 05:06:03 -0400 Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71) (envelope-from ) id 1hZAox-0004Fy-7x for qemu-devel@nongnu.org; Fri, 07 Jun 2019 05:06:01 -0400 Received: from mail-wm1-x332.google.com ([2a00:1450:4864:20::332]:38220) by eggs.gnu.org with esmtps (TLS1.0:RSA_AES_128_CBC_SHA1:16) (Exim 4.71) (envelope-from ) id 1hZAou-0003sj-0d for qemu-devel@nongnu.org; Fri, 07 Jun 2019 05:05:58 -0400 Received: by mail-wm1-x332.google.com with SMTP id t5so1133586wmh.3 for ; Fri, 07 Jun 2019 02:05:54 -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=ngCYt07rD9S6NfmUGM8XQw4uLZvtIN9Vg7GKA5tvoZU=; b=Q8/wb5mWbbg9YxQUW1002d9yliCB1GtRry9dHyWhIdUjJJ7Vgk3twD3KFbhHlrIgth DOz5EGgaTDm6rxzc78rUL7zSI6mba/ocLSz/31tIm8oElVbcnQA/gt6WC5Slms1nWc5r bDK/cXa6DAfbgTDDOu0sF1tBski+OkF+gQcnhnl+T1/omCTzpREQjt8u0P3FLobZtSUb UgVPfbbRpDbvUfg2133r7rAkf3ne0VPPHaTjipPUhRSRjI23uB2SNci3k6RQtlmDHIjL bD8PolZRRycr57MzmIyC/J8RvLZwSeRa1dbR/0zjwPoo0c+qmvJKzd38C9ZYoWzTlBUo HXlA== 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=ngCYt07rD9S6NfmUGM8XQw4uLZvtIN9Vg7GKA5tvoZU=; b=EHX8HxACOaCT8VGOZmQFqXIXbud+mi3Nl6oRCITKc+x46+D0hQoqhra5ssa+jZcdGj ibeatbytuICDEurD+SzOzubRqhirLKh+5XvXlil2Soa5CuNDOgRzqwGB1FjVTgDExkbS 2kAkGBBwHcQguG6L8MNgH5ZeQ1bgiT+o97zYszBXU4qQsmbezPO5mGqLLUoTpgrObNRl rc10Wv3je0gBUb2phOX11nwdDvn5I/0IIjEiEqv37F1AZ1N8xq1lsUWg17drhSiutFno rZuN6pvW7Wdul+h4oX4cY4as6V9Mz3FOiVP0zhd1xVn8eqCQdfJ2Q8dAT5I1iUx8qToq mEag== X-Gm-Message-State: APjAAAXT0ZK6Yed8/HB5YKGHX4KJRbCNakxWgiSSIQj9kNUBwN8IQfmo LpIgM+F0Wqmkf3So7ryRKFUe1w== X-Received: by 2002:a1c:2e09:: with SMTP id u9mr2869870wmu.137.1559898353495; Fri, 07 Jun 2019 02:05:53 -0700 (PDT) Received: from zen.linaroharston ([81.128.185.34]) by smtp.gmail.com with ESMTPSA id k10sm1244766wmj.37.2019.06.07.02.05.52 (version=TLS1_3 cipher=AEAD-AES256-GCM-SHA384 bits=256/256); Fri, 07 Jun 2019 02:05:52 -0700 (PDT) Received: from zen.linaroharston. (localhost [127.0.0.1]) by zen.linaroharston (Postfix) with ESMTP id 1D9B71FF8C; Fri, 7 Jun 2019 10:05:52 +0100 (BST) From: =?utf-8?q?Alex_Benn=C3=A9e?= To: peter.maydell@linaro.org Date: Fri, 7 Jun 2019 10:05:00 +0100 Message-Id: <20190607090552.12434-2-alex.bennee@linaro.org> X-Mailer: git-send-email 2.20.1 In-Reply-To: <20190607090552.12434-1-alex.bennee@linaro.org> References: <20190607090552.12434-1-alex.bennee@linaro.org> MIME-Version: 1.0 X-detected-operating-system: by eggs.gnu.org: Genre and OS details not recognized. X-Received-From: 2a00:1450:4864:20::332 Subject: [Qemu-devel] [PULL 01/52] editorconfig: add setting for shell scripts 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?Alex_Benn?= =?utf-8?b?w6ll?= , qemu-devel@nongnu.org Errors-To: qemu-devel-bounces+patch=linaro.org@nongnu.org Sender: "Qemu-devel" Signed-off-by: Alex Bennée Reviewed-by: Richard Henderson -- 2.20.1 diff --git a/.editorconfig b/.editorconfig index df6db65531..a001f340bd 100644 --- a/.editorconfig +++ b/.editorconfig @@ -26,6 +26,10 @@ file_type_emacs = makefile indent_style = space indent_size = 4 +[*.sh] +indent_style = space +indent_size = 4 + [*.{s,S}] indent_style = tab indent_size = 8 From patchwork Fri Jun 7 09:05:01 2019 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 8bit X-Patchwork-Submitter: =?utf-8?q?Alex_Benn=C3=A9e?= X-Patchwork-Id: 166082 Delivered-To: patch@linaro.org Received: by 2002:a92:9e1a:0:0:0:0:0 with SMTP id q26csp383216ili; Fri, 7 Jun 2019 02:12:12 -0700 (PDT) X-Google-Smtp-Source: APXvYqwmhZvFupkzplBnVEleWXZDEHSFTjENobMkpmcd6z/e1M/zkyCDeprHWX12Vra9ew04x2p+ X-Received: by 2002:a0c:96aa:: with SMTP id a39mr43687567qvd.230.1559898732110; Fri, 07 Jun 2019 02:12:12 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1559898732; cv=none; d=google.com; s=arc-20160816; b=xcy5sNtzsU4zEGieMyInWuqYj39OD2orDoKpNSw0fUlVHykhwhvxCQOTj+2NLax08v NOkaQ7G0N/4zvXbXH2tduBCKwsTuCg5IOgvYlZ0o49su2Jvc0YrY6b6251T45MU4n5mQ YsnEt+WNuV6tNYquX2FUZhMY0sUT4FVNJO/R3V6hm8wEPSSeK46Cu92DSZ7Gc2xqbML6 pZ4lqjeAMFAWEea3n8yEQjjN0sBlycFAwcGww5z9rLZY2M0lheF2THJVD28HocUC4EkY nR+JI3QenPwJmO9rir/O1HKbK4f2X97eKjb1pDPnVPXkpNsCYbRVqb2nlDmGJ/qTw4ML WCcA== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=sender:errors-to:cc:list-subscribe:list-help:list-post:list-archive :list-unsubscribe:list-id:precedence:subject :content-transfer-encoding:mime-version:references:in-reply-to :message-id:date:to:from:dkim-signature; bh=cQ0tfgve/Y4PUSaOnIOLkGNDESD+hZVEqLt68K3UEOk=; b=oWWpEnp5r+g/SzBbIJuMY40gjzS2pYiPvbtPBaxrKS/aVbNrNe/HDYc0AaMZDMR9ga 1RohkfD796dvvjiJOHXOsNXa3q6V4JFPuC+i5Wyn6UZ89tYZrEUDFF2CqEZ5T4QWpPDJ wPgpeSK0a0v1MtP1tYr7XZG0C+DPy9MRSBxNpFVcbpVU+GHU16ajERWxyZYa4xXo3rEu GLgC9O8++cPemTX69tJaEVd/H6FD1JwvGxqf4ipS4zLk1KXabJfNTX/aTtP3m8rw6hnW jQ377nkRJES/+vl2xEOhCAgtiUOS96vzU1yX6bCM4ybQnDL8+SNm/iM3e2prEzNT76ZS 3C/A== ARC-Authentication-Results: i=1; mx.google.com; dkim=fail header.i=@linaro.org header.s=google header.b=G81clC+6; spf=pass (google.com: domain of qemu-devel-bounces+patch=linaro.org@nongnu.org designates 209.51.188.47 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.47]) by mx.google.com with ESMTPS id i15si985426qte.365.2019.06.07.02.12.12 for (version=TLS1_2 cipher=ECDHE-RSA-CHACHA20-POLY1305 bits=256/256); Fri, 07 Jun 2019 02:12:12 -0700 (PDT) Received-SPF: pass (google.com: domain of qemu-devel-bounces+patch=linaro.org@nongnu.org designates 209.51.188.47 as permitted sender) client-ip=209.51.188.47; Authentication-Results: mx.google.com; dkim=fail header.i=@linaro.org header.s=google header.b=G81clC+6; spf=pass (google.com: domain of qemu-devel-bounces+patch=linaro.org@nongnu.org designates 209.51.188.47 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]:47192 helo=lists.gnu.org) by lists.gnu.org with esmtp (Exim 4.86_2) (envelope-from ) id 1hZAux-0001T3-LI for patch@linaro.org; Fri, 07 Jun 2019 05:12:11 -0400 Received: from eggs.gnu.org ([2001:470:142:3::10]:39332) by lists.gnu.org with esmtp (Exim 4.86_2) (envelope-from ) id 1hZAoz-00047M-RG for qemu-devel@nongnu.org; Fri, 07 Jun 2019 05:06:04 -0400 Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71) (envelope-from ) id 1hZAox-0004GA-9N for qemu-devel@nongnu.org; Fri, 07 Jun 2019 05:06:01 -0400 Received: from mail-wm1-x336.google.com ([2a00:1450:4864:20::336]:40205) by eggs.gnu.org with esmtps (TLS1.0:RSA_AES_128_CBC_SHA1:16) (Exim 4.71) (envelope-from ) id 1hZAot-0003x4-WA for qemu-devel@nongnu.org; Fri, 07 Jun 2019 05:05:58 -0400 Received: by mail-wm1-x336.google.com with SMTP id v19so1129291wmj.5 for ; Fri, 07 Jun 2019 02:05:55 -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=cQ0tfgve/Y4PUSaOnIOLkGNDESD+hZVEqLt68K3UEOk=; b=G81clC+6/P6GAgE93dcnmL4e5LVMKsjrJrY4MBsEWmB01u7eYsJW7EtsHx8fzhVbm6 /qUB7f3Ppwh6JuWvf1NXnEJgP8KhdFLymDEmQGH77I/NdjUf6jFgu+V293Eh9VYu5cLs djjxsFxqVOHZPD5OUC8RssqPsMSVpCXOlaJBQ3CecndxUQRf95F7Q8MoJ4AM3BRc9JPv Z7mLpwCcSXP4xfQFhjXDeHaSNdPMVlvPFRUAp76yxRz91S1dICDMYTUL2BTtFd5gQ4YI /lwBqTr8vZ9NNkli82z1uOwWsrnJrXkgBFgSD74Hn1zTO1EyQuf3w8zL1EjrgZxEBJft XvAA== 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=cQ0tfgve/Y4PUSaOnIOLkGNDESD+hZVEqLt68K3UEOk=; b=juUy2Zncm+pNe2WuLwhtoUYNwTmKjBcOyu7gyDEDcTSHkCwm6HwMFse5CKs1ocD6uF UzArbuxftmnx9PF/vKCN1XY3TkimnQnMIKqJiwkavjp2wkWjG8Bc7M5z5d3LaCJziXuH Eqx2xfWqbh2aIXcuvmbIgPp9pTptmn5Kk1MXoVeFcUL/wNcMXb0PGSxIId+oAz5PJR0Z CJ0n4WmWSSh5w+f4YhsjQ3VxXGU/Df8bZNHzzOwD9uabKH0GjANqvR89fcKF9cX7UjH2 1Fog0xTQqKo84Z6DBY9rSrnLKdGGJbbzZw08d99EpaBBOQn/igxS1ZuoKRU78htQ0CFF zc2w== X-Gm-Message-State: APjAAAWis6lTZ5rZlI2J2aYg5bYVwaULAkLu2sZVLyz84W9SuVpBS0kJ 3bfp6xYuQ6S4OkVJYZHfIN7JoQ== X-Received: by 2002:a1c:cb43:: with SMTP id b64mr2753473wmg.135.1559898354536; Fri, 07 Jun 2019 02:05:54 -0700 (PDT) Received: from zen.linaroharston ([81.128.185.34]) by smtp.gmail.com with ESMTPSA id x16sm1209094wmj.4.2019.06.07.02.05.52 (version=TLS1_3 cipher=AEAD-AES256-GCM-SHA384 bits=256/256); Fri, 07 Jun 2019 02:05:53 -0700 (PDT) Received: from zen.linaroharston. (localhost [127.0.0.1]) by zen.linaroharston (Postfix) with ESMTP id 31A421FF8F; Fri, 7 Jun 2019 10:05:52 +0100 (BST) From: =?utf-8?q?Alex_Benn=C3=A9e?= To: peter.maydell@linaro.org Date: Fri, 7 Jun 2019 10:05:01 +0100 Message-Id: <20190607090552.12434-3-alex.bennee@linaro.org> X-Mailer: git-send-email 2.20.1 In-Reply-To: <20190607090552.12434-1-alex.bennee@linaro.org> References: <20190607090552.12434-1-alex.bennee@linaro.org> MIME-Version: 1.0 X-detected-operating-system: by eggs.gnu.org: Genre and OS details not recognized. X-Received-From: 2a00:1450:4864:20::336 Subject: [Qemu-devel] [PULL 02/52] qemu-io-cmds: use clock_gettime for benchmarking 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: Kevin Wolf , =?utf-8?q?Alex_Benn=C3=A9e?= , qemu-devel@nongnu.org, "open list:Block layer core" , Max Reitz Errors-To: qemu-devel-bounces+patch=linaro.org@nongnu.org Sender: "Qemu-devel" The previous use of gettimeofday() ran into undefined behaviour when we ended up doing a div 0 for a very short operation. This is because gettimeofday only works at the microsecond level as well as being prone to discontinuous jumps in system time. Using clock_gettime with CLOCK_MONOTONIC gives greater precision and alleviates some of the potential problems with time jumping around. We could use CLOCK_MONOTONIC_RAW to avoid being tripped up by NTP and adjtime but that is Linux specific so I decided it would do for now. Signed-off-by: Alex Bennée -- 2.20.1 diff --git a/qemu-io-cmds.c b/qemu-io-cmds.c index 30a7d9a13b..8904733961 100644 --- a/qemu-io-cmds.c +++ b/qemu-io-cmds.c @@ -248,20 +248,21 @@ static void cvtstr(double value, char *str, size_t size) -static struct timeval tsub(struct timeval t1, struct timeval t2) +static struct timespec tsub(struct timespec t1, struct timespec t2) { - t1.tv_usec -= t2.tv_usec; - if (t1.tv_usec < 0) { - t1.tv_usec += 1000000; + t1.tv_nsec -= t2.tv_nsec; + if (t1.tv_nsec < 0) { + t1.tv_nsec += NANOSECONDS_PER_SECOND; t1.tv_sec--; } t1.tv_sec -= t2.tv_sec; return t1; } -static double tdiv(double value, struct timeval tv) +static double tdiv(double value, struct timespec tv) { - return value / ((double)tv.tv_sec + ((double)tv.tv_usec / 1000000.0)); + double seconds = tv.tv_sec + (tv.tv_nsec / 1e9); + return value / seconds; } #define HOURS(sec) ((sec) / (60 * 60)) @@ -274,29 +275,27 @@ enum { VERBOSE_FIXED_TIME = 0x2, }; -static void timestr(struct timeval *tv, char *ts, size_t size, int format) +static void timestr(struct timespec *tv, char *ts, size_t size, int format) { - double usec = (double)tv->tv_usec / 1000000.0; + double frac_sec = tv->tv_nsec / 1e9; if (format & TERSE_FIXED_TIME) { if (!HOURS(tv->tv_sec)) { - snprintf(ts, size, "%u:%02u.%02u", - (unsigned int) MINUTES(tv->tv_sec), - (unsigned int) SECONDS(tv->tv_sec), - (unsigned int) (usec * 100)); + snprintf(ts, size, "%u:%05.2f", + (unsigned int) MINUTES(tv->tv_sec), + SECONDS(tv->tv_sec) + frac_sec); return; } format |= VERBOSE_FIXED_TIME; /* fallback if hours needed */ } if ((format & VERBOSE_FIXED_TIME) || tv->tv_sec) { - snprintf(ts, size, "%u:%02u:%02u.%02u", + snprintf(ts, size, "%u:%02u:%05.2f", (unsigned int) HOURS(tv->tv_sec), (unsigned int) MINUTES(tv->tv_sec), - (unsigned int) SECONDS(tv->tv_sec), - (unsigned int) (usec * 100)); + SECONDS(tv->tv_sec) + frac_sec); } else { - snprintf(ts, size, "0.%04u sec", (unsigned int) (usec * 10000)); + snprintf(ts, size, "%05.2f sec", frac_sec); } } @@ -376,7 +375,7 @@ static void dump_buffer(const void *buffer, int64_t offset, int64_t len) } } -static void print_report(const char *op, struct timeval *t, int64_t offset, +static void print_report(const char *op, struct timespec *t, int64_t offset, int64_t count, int64_t total, int cnt, bool Cflag) { char s1[64], s2[64], ts[64]; @@ -649,7 +648,7 @@ static const cmdinfo_t read_cmd = { static int read_f(BlockBackend *blk, int argc, char **argv) { - struct timeval t1, t2; + struct timespec t1, t2; bool Cflag = false, qflag = false, vflag = false; bool Pflag = false, sflag = false, lflag = false, bflag = false; int c, cnt, ret; @@ -758,13 +757,13 @@ static int read_f(BlockBackend *blk, int argc, char **argv) buf = qemu_io_alloc(blk, count, 0xab); - gettimeofday(&t1, NULL); + clock_gettime(CLOCK_MONOTONIC, &t1); if (bflag) { ret = do_load_vmstate(blk, buf, offset, count, &total); } else { ret = do_pread(blk, buf, offset, count, &total); } - gettimeofday(&t2, NULL); + clock_gettime(CLOCK_MONOTONIC, &t2); if (ret < 0) { printf("read failed: %s\n", strerror(-ret)); @@ -836,7 +835,7 @@ static const cmdinfo_t readv_cmd = { static int readv_f(BlockBackend *blk, int argc, char **argv) { - struct timeval t1, t2; + struct timespec t1, t2; bool Cflag = false, qflag = false, vflag = false; int c, cnt, ret; char *buf; @@ -891,9 +890,9 @@ static int readv_f(BlockBackend *blk, int argc, char **argv) return -EINVAL; } - gettimeofday(&t1, NULL); + clock_gettime(CLOCK_MONOTONIC, &t1); ret = do_aio_readv(blk, &qiov, offset, &total); - gettimeofday(&t2, NULL); + clock_gettime(CLOCK_MONOTONIC, &t2); if (ret < 0) { printf("readv failed: %s\n", strerror(-ret)); @@ -972,7 +971,7 @@ static const cmdinfo_t write_cmd = { static int write_f(BlockBackend *blk, int argc, char **argv) { - struct timeval t1, t2; + struct timespec t1, t2; bool Cflag = false, qflag = false, bflag = false; bool Pflag = false, zflag = false, cflag = false; int flags = 0; @@ -1091,7 +1090,7 @@ static int write_f(BlockBackend *blk, int argc, char **argv) buf = qemu_io_alloc(blk, count, pattern); } - gettimeofday(&t1, NULL); + clock_gettime(CLOCK_MONOTONIC, &t1); if (bflag) { ret = do_save_vmstate(blk, buf, offset, count, &total); } else if (zflag) { @@ -1101,7 +1100,7 @@ static int write_f(BlockBackend *blk, int argc, char **argv) } else { ret = do_pwrite(blk, buf, offset, count, flags, &total); } - gettimeofday(&t2, NULL); + clock_gettime(CLOCK_MONOTONIC, &t2); if (ret < 0) { printf("write failed: %s\n", strerror(-ret)); @@ -1160,7 +1159,7 @@ static const cmdinfo_t writev_cmd = { static int writev_f(BlockBackend *blk, int argc, char **argv) { - struct timeval t1, t2; + struct timespec t1, t2; bool Cflag = false, qflag = false; int flags = 0; int c, cnt, ret; @@ -1213,9 +1212,9 @@ static int writev_f(BlockBackend *blk, int argc, char **argv) return -EINVAL; } - gettimeofday(&t1, NULL); + clock_gettime(CLOCK_MONOTONIC, &t1); ret = do_aio_writev(blk, &qiov, offset, flags, &total); - gettimeofday(&t2, NULL); + clock_gettime(CLOCK_MONOTONIC, &t2); if (ret < 0) { printf("writev failed: %s\n", strerror(-ret)); @@ -1250,15 +1249,15 @@ struct aio_ctx { bool zflag; BlockAcctCookie acct; int pattern; - struct timeval t1; + struct timespec t1; }; static void aio_write_done(void *opaque, int ret) { struct aio_ctx *ctx = opaque; - struct timeval t2; + struct timespec t2; - gettimeofday(&t2, NULL); + clock_gettime(CLOCK_MONOTONIC, &t2); if (ret < 0) { @@ -1288,9 +1287,9 @@ out: static void aio_read_done(void *opaque, int ret) { struct aio_ctx *ctx = opaque; - struct timeval t2; + struct timespec t2; - gettimeofday(&t2, NULL); + clock_gettime(CLOCK_MONOTONIC, &t2); if (ret < 0) { printf("readv failed: %s\n", strerror(-ret)); @@ -1425,7 +1424,7 @@ static int aio_read_f(BlockBackend *blk, int argc, char **argv) return -EINVAL; } - gettimeofday(&ctx->t1, NULL); + clock_gettime(CLOCK_MONOTONIC, &ctx->t1); block_acct_start(blk_get_stats(blk), &ctx->acct, ctx->qiov.size, BLOCK_ACCT_READ); blk_aio_preadv(blk, ctx->offset, &ctx->qiov, 0, aio_read_done, ctx); @@ -1570,7 +1569,7 @@ static int aio_write_f(BlockBackend *blk, int argc, char **argv) return -EINVAL; } - gettimeofday(&ctx->t1, NULL); + clock_gettime(CLOCK_MONOTONIC, &ctx->t1); block_acct_start(blk_get_stats(blk), &ctx->acct, ctx->qiov.size, BLOCK_ACCT_WRITE); @@ -1746,7 +1745,7 @@ static const cmdinfo_t discard_cmd = { static int discard_f(BlockBackend *blk, int argc, char **argv) { - struct timeval t1, t2; + struct timespec t1, t2; bool Cflag = false, qflag = false; int c, ret; int64_t offset, bytes; @@ -1787,9 +1786,9 @@ static int discard_f(BlockBackend *blk, int argc, char **argv) return -EINVAL; } - gettimeofday(&t1, NULL); + clock_gettime(CLOCK_MONOTONIC, &t1); ret = blk_pdiscard(blk, offset, bytes); - gettimeofday(&t2, NULL); + clock_gettime(CLOCK_MONOTONIC, &t2); if (ret < 0) { printf("discard failed: %s\n", strerror(-ret)); From patchwork Fri Jun 7 09:05:02 2019 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 8bit X-Patchwork-Submitter: =?utf-8?q?Alex_Benn=C3=A9e?= X-Patchwork-Id: 166079 Delivered-To: patch@linaro.org Received: by 2002:a92:9e1a:0:0:0:0:0 with SMTP id q26csp380107ili; Fri, 7 Jun 2019 02:09:01 -0700 (PDT) X-Google-Smtp-Source: APXvYqyBqty6dMUjN/JXtzyldNLkB8mOwSvnYlIzl4zcfArWWY4oR6uKuD0XYIr7QU66mENO9a1+ X-Received: by 2002:a37:a247:: with SMTP id l68mr41480534qke.89.1559898541433; Fri, 07 Jun 2019 02:09:01 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1559898541; cv=none; d=google.com; s=arc-20160816; b=TMl4WdayXjXMXZzZdnZUZfy+ByJ74aJgaOhAs1FKB0c3mG4HeGWLfgebvbBBNSGYt7 7tsSs5nkcL8sMNJufhZZrL4ehSsDkT9a/2uQSeREG3kTqo5zOrz7qYZ9grWngYYCSHwK zXqIVO4VYUbELxcYMwuFBNSn/CJPsVnZnccwv2hdVhXe3Gd8+zJXYjA72Wwgb9TVdDgE Ffy9BTIJJ6rbYPbNSr7u8us/HbGXg1G9dY10TUmcLKAXJJz82RqwTs7hlgYjNureTd87 r8yab74XnJPkv6e1u9iiiAdTjQ6Xrq3sGhlLpUM/TMe0sM0AO+GjMoBfbX7EfAvO9lmi wv+w== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=sender:errors-to:cc:list-subscribe:list-help:list-post:list-archive :list-unsubscribe:list-id:precedence:subject :content-transfer-encoding:mime-version:references:in-reply-to :message-id:date:to:from:dkim-signature; bh=qCnUPR9lwJDCVN+3iAAkawz91A004gE5+vwI6CE6U4k=; b=V9UVvmtIvXhMpNzLQmZ936nhBAFk6UYDorZYJpfvyvReYMwAUV56jTgG18rJkpZ65B cU8aBW5WcjLgMqmUhUPALk+7C7UUuCIbiQBaAABnjm9T8+RGKtj8936B5AcAdcqvY/is 6iTzCWtQUzM2uS9WCpIJkzSbc3mHycT3a2/fK9XBRn7v/PZYsxWx8CnEF2znFEqowfDF o14n1H9qBIWwyTj9SCE5T4MqAd22nIvAfqbw726CBtw/XbchLy7HbbTyMYm7vF0pq0cT nXdYjONHuNw59ymwMZEri6WFfiRRZpR1rDjk3CPxGzJ4ikHRPEhNNmh42cy9tsO6ouGF 1uXQ== ARC-Authentication-Results: i=1; mx.google.com; dkim=fail header.i=@linaro.org header.s=google header.b=C1xkaCfP; spf=pass (google.com: domain of qemu-devel-bounces+patch=linaro.org@nongnu.org designates 209.51.188.47 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.47]) by mx.google.com with ESMTPS id z141si230410qka.70.2019.06.07.02.09.01 for (version=TLS1_2 cipher=ECDHE-RSA-CHACHA20-POLY1305 bits=256/256); Fri, 07 Jun 2019 02:09:01 -0700 (PDT) Received-SPF: pass (google.com: domain of qemu-devel-bounces+patch=linaro.org@nongnu.org designates 209.51.188.47 as permitted sender) client-ip=209.51.188.47; Authentication-Results: mx.google.com; dkim=fail header.i=@linaro.org header.s=google header.b=C1xkaCfP; spf=pass (google.com: domain of qemu-devel-bounces+patch=linaro.org@nongnu.org designates 209.51.188.47 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]:47138 helo=lists.gnu.org) by lists.gnu.org with esmtp (Exim 4.86_2) (envelope-from ) id 1hZArs-0007bj-IU for patch@linaro.org; Fri, 07 Jun 2019 05:09:00 -0400 Received: from eggs.gnu.org ([2001:470:142:3::10]:39328) by lists.gnu.org with esmtp (Exim 4.86_2) (envelope-from ) id 1hZAoz-00047I-Qr for qemu-devel@nongnu.org; Fri, 07 Jun 2019 05:06:03 -0400 Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71) (envelope-from ) id 1hZAox-0004G8-9Y for qemu-devel@nongnu.org; Fri, 07 Jun 2019 05:06:01 -0400 Received: from mail-wr1-x436.google.com ([2a00:1450:4864:20::436]:41279) by eggs.gnu.org with esmtps (TLS1.0:RSA_AES_128_CBC_SHA1:16) (Exim 4.71) (envelope-from ) id 1hZAou-0003yc-1U for qemu-devel@nongnu.org; Fri, 07 Jun 2019 05:05:58 -0400 Received: by mail-wr1-x436.google.com with SMTP id c2so1337965wrm.8 for ; Fri, 07 Jun 2019 02:05:55 -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=qCnUPR9lwJDCVN+3iAAkawz91A004gE5+vwI6CE6U4k=; b=C1xkaCfPyiVd7QKIq+Jx8gMCa0vNYwcNBA7ZrqE7ZgsLK7JMkxqnA5jF2C3Vniyp8d ryqpI9fQrhCYF3H5/6HQnOzLhUotjJKPhHaqZ2oAJHFNtFekKM52EOveiO203X6t7Mdr aRrB00uqa2/EjDB3C0BHWTFvxCF9/EPilAmexy1ixJHDd8gFVTuxgvVH+bhxOY648sxR wbnxFbEeyTyPwIWCg8kuaaORXl+RJ0VogkU5dySS3x106k9c31GnleOjc+EPXn2OK4m5 DDUtL30zXHlYkmzLkVfRgHLJbPEfUa+Tn4U6OC1y91Tv1RSRFYNH3kANFw7NOxmUHMkc M59g== 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=qCnUPR9lwJDCVN+3iAAkawz91A004gE5+vwI6CE6U4k=; b=n+pA9xHT1JyDQ5JpFfVOglztH856VSAxP1m2t3H7VQ05g6gf0fxGXSVU+GfVqlBX/q TeMCNO8Pbv5olJECX6RRhEM/bPkaeq7w0SCULYkJcTr8EoXWy3jNO7CLCmVuqmcJtzl8 oKWFkWwfRrG7XJPLbLKad4OUWjHtyAOhz5bVvNw+8vFm2rOrx14YrEMPl0mDJJIFsIR3 ogtKiMN+8oXZMLzjGf0Zc517Bw1ZTqSv0KEL2fVHncLG4kUgP/XchTuDb05MtifLujjw PSDloAIgtvlffc/rSpRhnY+jev+qn1QHw/V69eW7dwTiCR+klYH3jABpCNcMo94sOAWz /Ndw== X-Gm-Message-State: APjAAAXtR61z7G03pS+sQSt+7FpylGc/HPj0w6E7meZ40UQz6H0AAuWx KIC+qG51YdWFlecFdhUcZhtoGw== X-Received: by 2002:adf:de8b:: with SMTP id w11mr8791262wrl.134.1559898355024; Fri, 07 Jun 2019 02:05:55 -0700 (PDT) Received: from zen.linaroharston ([81.128.185.34]) by smtp.gmail.com with ESMTPSA id f10sm1685621wrg.24.2019.06.07.02.05.52 (version=TLS1_3 cipher=AEAD-AES256-GCM-SHA384 bits=256/256); Fri, 07 Jun 2019 02:05:53 -0700 (PDT) Received: from zen.linaroharston. (localhost [127.0.0.1]) by zen.linaroharston (Postfix) with ESMTP id 4444C1FF90; Fri, 7 Jun 2019 10:05:52 +0100 (BST) From: =?utf-8?q?Alex_Benn=C3=A9e?= To: peter.maydell@linaro.org Date: Fri, 7 Jun 2019 10:05:02 +0100 Message-Id: <20190607090552.12434-4-alex.bennee@linaro.org> X-Mailer: git-send-email 2.20.1 In-Reply-To: <20190607090552.12434-1-alex.bennee@linaro.org> References: <20190607090552.12434-1-alex.bennee@linaro.org> MIME-Version: 1.0 X-detected-operating-system: by eggs.gnu.org: Genre and OS details not recognized. X-Received-From: 2a00:1450:4864:20::436 Subject: [Qemu-devel] [PULL 03/52] tests/docker: Update the Fedora image to Fedora 30 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: Fam Zheng , =?utf-8?q?Philippe_Mathieu-Daud=C3=A9?= , qemu-devel@nongnu.org, =?utf-8?q?Marc-Andr=C3=A9_Lureau?= , =?utf-8?q?Alex_Benn=C3=A9e?= , Stefano Garzarella Errors-To: qemu-devel-bounces+patch=linaro.org@nongnu.org Sender: "Qemu-devel" From: Philippe Mathieu-Daudé Fedora 30 got released: https://fedoramagazine.org/announcing-fedora-30/ Signed-off-by: Philippe Mathieu-Daudé Signed-off-by: Marc-André Lureau Tested-by: Stefano Garzarella Reviewed-by: Stefano Garzarella Message-Id: <20190528153304.27157-1-philmd@redhat.com> Signed-off-by: Alex Bennée -- 2.20.1 diff --git a/tests/docker/dockerfiles/fedora.docker b/tests/docker/dockerfiles/fedora.docker index afbba29ada..12c460597e 100644 --- a/tests/docker/dockerfiles/fedora.docker +++ b/tests/docker/dockerfiles/fedora.docker @@ -1,4 +1,4 @@ -FROM fedora:29 +FROM fedora:30 ENV PACKAGES \ bc \ bison \ From patchwork Fri Jun 7 09:05:03 2019 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 8bit X-Patchwork-Submitter: =?utf-8?q?Alex_Benn=C3=A9e?= X-Patchwork-Id: 166077 Delivered-To: patch@linaro.org Received: by 2002:a92:9e1a:0:0:0:0:0 with SMTP id q26csp377486ili; Fri, 7 Jun 2019 02:06:20 -0700 (PDT) X-Google-Smtp-Source: APXvYqxc8TQMu9MgnokKQgq657WdGji89ASdqvaWc0r53lVnmU/HSWJdG3iUP/qrrg73+48ZZLHr X-Received: by 2002:ac8:3636:: with SMTP id m51mr44621697qtb.102.1559898380379; Fri, 07 Jun 2019 02:06:20 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1559898380; cv=none; d=google.com; s=arc-20160816; b=zl5RVL9bg0sFH3Aqrsc7+XfMQs065qdkaLZ3lyVG45TuanamL/IM+SydeRney79kQy DirIO0tdVbOhccwWyatJuI/tecQvYZ+Ud8tRi3fdz5ldXcnsVnXaP5HKMea6RieN0txR Ujd+npTwVgsvDQTOOC8lPrl2UA/ato0Qyzr8Kq6P+w6ko6bzW0BvMLXIkoM+HlNWIN+A C/35ps1qVvwCryijJBtQhvSG5P/Ljt/REQdjSr7uVeO5pURQPSQHYj5/TdBwF18jdXe4 3fYUmBJOTArEKh/8XA2JJPTTQHNO5P0fP8EW4lmmZJQdnxzu5P4JW1jobAYZUtS3pjFu bVoA== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=sender:errors-to:cc:list-subscribe:list-help:list-post:list-archive :list-unsubscribe:list-id:precedence:subject :content-transfer-encoding:mime-version:references:in-reply-to :message-id:date:to:from:dkim-signature; bh=Iq7Nm46aUE7quvi6VDpmkC4n6wLldVq8o82duiGCIro=; b=zObCmyWBs/Pqo/0oJQ8QzRdOHmH90EfYsxRJBH+v3a+z7NGAxV7ojqvIDBd+Qbkpuu VqQ3eJS93T1hifh1wVKYxee1IBVTZPlJJLydMQups22Z94rdhUpONzC5ZSFftjGDZ5s6 dzW0siA1CEcEeZgn3y9kRGGQ6UG3AZvsvkZLubbvwwLcv6hI9GqQafXhfW15nZMQjD2U mZzJmAdUegJffJ21wRIqpWNvqGupusrDfcdtbrAma4DNlmp+b1sCBvi7kiJCquCfUETP xgZJgziEgn+ZBtkH/FzxWLdr0KNgyWRI72rPZEQee7pNb52smAd5mcONTLDwMNvNkZa2 DaHw== ARC-Authentication-Results: i=1; mx.google.com; dkim=fail header.i=@linaro.org header.s=google header.b="q/+e+lio"; spf=pass (google.com: domain of qemu-devel-bounces+patch=linaro.org@nongnu.org designates 209.51.188.47 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.47]) by mx.google.com with ESMTPS id i16si1008464qtc.52.2019.06.07.02.06.20 for (version=TLS1_2 cipher=ECDHE-RSA-CHACHA20-POLY1305 bits=256/256); Fri, 07 Jun 2019 02:06:20 -0700 (PDT) Received-SPF: pass (google.com: domain of qemu-devel-bounces+patch=linaro.org@nongnu.org designates 209.51.188.47 as permitted sender) client-ip=209.51.188.47; Authentication-Results: mx.google.com; dkim=fail header.i=@linaro.org header.s=google header.b="q/+e+lio"; spf=pass (google.com: domain of qemu-devel-bounces+patch=linaro.org@nongnu.org designates 209.51.188.47 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]:47114 helo=lists.gnu.org) by lists.gnu.org with esmtp (Exim 4.86_2) (envelope-from ) id 1hZApH-00048U-TJ for patch@linaro.org; Fri, 07 Jun 2019 05:06:19 -0400 Received: from eggs.gnu.org ([2001:470:142:3::10]:39280) by lists.gnu.org with esmtp (Exim 4.86_2) (envelope-from ) id 1hZAox-000460-9e for qemu-devel@nongnu.org; Fri, 07 Jun 2019 05:06:00 -0400 Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71) (envelope-from ) id 1hZAow-00048s-22 for qemu-devel@nongnu.org; Fri, 07 Jun 2019 05:05:59 -0400 Received: from mail-wr1-x441.google.com ([2a00:1450:4864:20::441]:38580) by eggs.gnu.org with esmtps (TLS1.0:RSA_AES_128_CBC_SHA1:16) (Exim 4.71) (envelope-from ) id 1hZAov-00043s-Ql for qemu-devel@nongnu.org; Fri, 07 Jun 2019 05:05:57 -0400 Received: by mail-wr1-x441.google.com with SMTP id d18so1354939wrs.5 for ; Fri, 07 Jun 2019 02:05:56 -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=Iq7Nm46aUE7quvi6VDpmkC4n6wLldVq8o82duiGCIro=; b=q/+e+lioLf77XuvFKi5Ka2COkU5xft+YJvhYyOK6UFRK2pVrQCjd0ehgnnwxsw0yq5 R6to5Z4b7a0sdAd2lPB6nLMveQrZNK8nHopVKh7ZNuNzfMVZWvMZOlOuBwUrT7c3+8Ra jtX0jZuA6zmd1X/PDkrW453Pdn9mZ1QwBl2Xsokbp1YAl7AIKjBDtxCv2vBCZO3qTegf vIL/EKWG21cKusOTPeupgftxhjfDzC8GxSynuKm0MCG9ZgHP6lQsquwU8FCjb5dYwRYd nm80QoatvQHD2bBEvEGRxS3Z9dBKbbmD3Y5m/oKnm5+aFYTiuon0PbQulfGabxtzoaaP 22Sg== 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=Iq7Nm46aUE7quvi6VDpmkC4n6wLldVq8o82duiGCIro=; b=RQzszi+MaJBBsLCpI9WXXKwPyJJmyEvWrK+vRH/WSjUR0xMasq+zzw6Jlz3B8GcaQ7 D7KT/jp67Bye6HEZOdwEefbCDfNK0Q0WED6EoJHCOVzcxxowtlqbIaD6mYe4hraJHtic qAYEN52LkfdetuiV3/bcCLd2UFq3bbgA7lq+KvEgcVrCmGy7O1U66XKFFIPmtz+MpCjl tPuI06MwcOPP0iNbX2B6XqpJ0RcobyyH6n/EdY1lhmoT6/6SAw9P/23MXL1zKGIlo1St SonqyHh3ka3g2EDrRXjRgUhEcimJ4RySy0oW4tjlEyBYliXDb6ySY4bfOT9yKBZjUzgS 2e3Q== X-Gm-Message-State: APjAAAXN6dx8p0VGEvZedA07X/U46LpTV501b93LuNQtgdtmlRJ3ITHH lhZjipHxsIiWXcHOl8RU/2SO5A== X-Received: by 2002:adf:f2c8:: with SMTP id d8mr6262931wrp.221.1559898355776; Fri, 07 Jun 2019 02:05:55 -0700 (PDT) Received: from zen.linaroharston ([81.128.185.34]) by smtp.gmail.com with ESMTPSA id j7sm1819350wru.54.2019.06.07.02.05.52 (version=TLS1_3 cipher=AEAD-AES256-GCM-SHA384 bits=256/256); Fri, 07 Jun 2019 02:05:53 -0700 (PDT) Received: from zen.linaroharston. (localhost [127.0.0.1]) by zen.linaroharston (Postfix) with ESMTP id 584A01FF91; Fri, 7 Jun 2019 10:05:52 +0100 (BST) From: =?utf-8?q?Alex_Benn=C3=A9e?= To: peter.maydell@linaro.org Date: Fri, 7 Jun 2019 10:05:03 +0100 Message-Id: <20190607090552.12434-5-alex.bennee@linaro.org> X-Mailer: git-send-email 2.20.1 In-Reply-To: <20190607090552.12434-1-alex.bennee@linaro.org> References: <20190607090552.12434-1-alex.bennee@linaro.org> MIME-Version: 1.0 X-detected-operating-system: by eggs.gnu.org: Genre and OS details not recognized. X-Received-From: 2a00:1450:4864:20::441 Subject: [Qemu-devel] [PULL 04/52] tests/docker: Update the Fedora cross compile images to 30 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: Fam Zheng , Richard Henderson , =?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" While at it remove the bogus :latest tag for cris cross compiler. It tends to break caching and cause confusion. Signed-off-by: Alex Bennée Reviewed-by: Richard Henderson Reviewed-by: Philippe Mathieu-Daudé Tested-by: Philippe Mathieu-Daudé -- 2.20.1 diff --git a/tests/docker/dockerfiles/fedora-cris-cross.docker b/tests/docker/dockerfiles/fedora-cris-cross.docker index b168ada615..09e7e449f9 100644 --- a/tests/docker/dockerfiles/fedora-cris-cross.docker +++ b/tests/docker/dockerfiles/fedora-cris-cross.docker @@ -2,7 +2,7 @@ # Cross compiler for cris system tests # -FROM fedora:latest +FROM fedora:30 ENV PACKAGES gcc-cris-linux-gnu RUN dnf install -y $PACKAGES RUN rpm -q $PACKAGES | sort > /packages.txt diff --git a/tests/docker/dockerfiles/fedora-i386-cross.docker b/tests/docker/dockerfiles/fedora-i386-cross.docker index eb8108d118..9106cf9ebe 100644 --- a/tests/docker/dockerfiles/fedora-i386-cross.docker +++ b/tests/docker/dockerfiles/fedora-i386-cross.docker @@ -1,4 +1,4 @@ -FROM fedora:29 +FROM fedora:30 ENV PACKAGES \ gcc \ glib2-devel.i686 \ From patchwork Fri Jun 7 09:05:04 2019 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 8bit X-Patchwork-Submitter: =?utf-8?q?Alex_Benn=C3=A9e?= X-Patchwork-Id: 166078 Delivered-To: patch@linaro.org Received: by 2002:a92:9e1a:0:0:0:0:0 with SMTP id q26csp377510ili; Fri, 7 Jun 2019 02:06:21 -0700 (PDT) X-Google-Smtp-Source: APXvYqxQbfdyBM7FupWBy0ARnXUfEL0/8XG20UngVLXigFGNEbRxb0XHFfXeFCtqx0ckkYyJOGnR X-Received: by 2002:ad4:536b:: with SMTP id e11mr41659418qvv.163.1559898381199; Fri, 07 Jun 2019 02:06:21 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1559898381; cv=none; d=google.com; s=arc-20160816; b=FGNy3BRdaf6xWJbSjhzFxYtHutevFhuDWIkiv2RTW7yGga7/XMiZyOL5nLMmlprdA8 qTIKDu4OM6Ny7bmn9RlDhXZ8uL0/w7L6AkHOLDQeYIShvBBFb81GYN/LeKItOXHU4ayJ JyEgaNWtK96h8FoWtewgQAGxnocgvucIBDwreGxRHIVbxN2z7NvN+s0TuZlD35ro0jJ3 6YqHQFfGSl97qgG6gC0W0m3en3wu8oPN/xmkQA+eYT2apDOei7gk8Ow4ITOZ1QnCFQyB xgWZsyzhHXZKT3x+r6whTaOXLLwdwsyUeCCMOEn5u2YBfT7/LIR9b3cg69RYflJa6du+ gnzA== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=sender:errors-to:cc:list-subscribe:list-help:list-post:list-archive :list-unsubscribe:list-id:precedence:subject :content-transfer-encoding:mime-version:references:in-reply-to :message-id:date:to:from:dkim-signature; bh=Rd5+Go34lR5r032gcxkrHBNwDzwFUaH0wsbx46lnxds=; b=NYNP2S9NffRKAL4WYqxP8KgkGlpuZwwXjg7A2p3FksYAcjkQiTquw6miCzk33fTIkv lcoJKehWCnFmuSrFpEits4Su5OHKp1CgHgUTJfm1huJYQnQYXs1XsJLAPNiHmhoXM40L K2n9D26PFnHAf3LkNrUEYCc2glNlf6ZvLVjjwXZcaU0p+KH2LhPbmTfaBknDUWNEfUay NF83ttV78c/dk1VnLNpUKkgSRX4Exp1MFzmi6giVcsum37q7EzJhk/mECvH6qPEIC8qZ VWh7+MACj+zvgVWMWvUgEHvS8/EOFltdjMa21QeP5+C0aEowpFQKyCjthqp1/EQ82nbh J5/Q== ARC-Authentication-Results: i=1; mx.google.com; dkim=fail header.i=@linaro.org header.s=google header.b=KtzQfhuH; spf=pass (google.com: domain of qemu-devel-bounces+patch=linaro.org@nongnu.org designates 209.51.188.47 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.47]) by mx.google.com with ESMTPS id s72si853858qke.96.2019.06.07.02.06.21 for (version=TLS1_2 cipher=ECDHE-RSA-CHACHA20-POLY1305 bits=256/256); Fri, 07 Jun 2019 02:06:21 -0700 (PDT) Received-SPF: pass (google.com: domain of qemu-devel-bounces+patch=linaro.org@nongnu.org designates 209.51.188.47 as permitted sender) client-ip=209.51.188.47; Authentication-Results: mx.google.com; dkim=fail header.i=@linaro.org header.s=google header.b=KtzQfhuH; spf=pass (google.com: domain of qemu-devel-bounces+patch=linaro.org@nongnu.org designates 209.51.188.47 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]:47118 helo=lists.gnu.org) by lists.gnu.org with esmtp (Exim 4.86_2) (envelope-from ) id 1hZApI-0004AX-Oi for patch@linaro.org; Fri, 07 Jun 2019 05:06:20 -0400 Received: from eggs.gnu.org ([2001:470:142:3::10]:39334) by lists.gnu.org with esmtp (Exim 4.86_2) (envelope-from ) id 1hZAoz-00047O-RI for qemu-devel@nongnu.org; Fri, 07 Jun 2019 05:06:03 -0400 Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71) (envelope-from ) id 1hZAox-0004Fk-6q for qemu-devel@nongnu.org; Fri, 07 Jun 2019 05:06:01 -0400 Received: from mail-wr1-x42c.google.com ([2a00:1450:4864:20::42c]:41270) by eggs.gnu.org with esmtps (TLS1.0:RSA_AES_128_CBC_SHA1:16) (Exim 4.71) (envelope-from ) id 1hZAov-00045a-R7 for qemu-devel@nongnu.org; Fri, 07 Jun 2019 05:05:58 -0400 Received: by mail-wr1-x42c.google.com with SMTP id c2so1338018wrm.8 for ; Fri, 07 Jun 2019 02:05:57 -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=Rd5+Go34lR5r032gcxkrHBNwDzwFUaH0wsbx46lnxds=; b=KtzQfhuHaLrRhn0hNES7YtosF42tXuzszpjKOXitI2MRSzfro0ec2jJunY0V0Io+2x rBOB+eyYQboGLbfn5Gl6O1EtaOupLR2n5GgEj/5gQcJW/XCTOVUJkgz860SOgA8rOTn2 YVV2viExmPNU4An4LZlx7MI3M2mFGIPloUpylBuH2tVTKPBxXO2VCQVBd44y8sSnro+9 uMMYmsWZ3mqVYP46Hog0rnIpfVxET5C2GHlpr08msI5zPz02pTYaWW+6aDXMnbDq0CLo Eh3af5khAIJVujIAchnB7xnOoSmOS78VEJoonI9S01zc6IAyYCbR0RVE6Y1xy9+iIwrz B4Mw== 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=Rd5+Go34lR5r032gcxkrHBNwDzwFUaH0wsbx46lnxds=; b=gP+l3Zmn9Bppr1h8JgBntSC4HEjZEhecknrjhiBfiQrCvwKFZa9p5MyWaArtz82e3I L6cKln7dcgjNFhur+b8BvchKANWF4+3RR5AEZ/WPjrBBAlh96W2fVw+vqpQJZLELTx8/ lO+TyzTPoy3AY7IZ37lGv6DmXpcwvf4ldN0ysrvcVxv8q6KueaEvsyfU3cEB1eiio4f4 5jvIqccSbHwrqZYhFwgjfDLgsDPvbxkOEkAkr8B0/DLv5e6pxzD0xj4/sE6e9INk1ANw 9cJfu8vXCREDAHQklkVbXleFhXyR9iBPlbQorHp51cFjtoHC8jin4CVMEBshaLzk2z4a H+YA== X-Gm-Message-State: APjAAAVQez0e3w092QHyi4ID/CbIjU4tAvImcE6BaGGpmje8LN7iYg/8 JpMw9ff02Q+a2EKCuaH2DqdOyg== X-Received: by 2002:adf:f8cf:: with SMTP id f15mr18792478wrq.333.1559898356437; Fri, 07 Jun 2019 02:05:56 -0700 (PDT) Received: from zen.linaroharston ([81.128.185.34]) by smtp.gmail.com with ESMTPSA id y2sm1331087wra.58.2019.06.07.02.05.53 (version=TLS1_3 cipher=AEAD-AES256-GCM-SHA384 bits=256/256); Fri, 07 Jun 2019 02:05:53 -0700 (PDT) Received: from zen.linaroharston. (localhost [127.0.0.1]) by zen.linaroharston (Postfix) with ESMTP id 6B5811FF92; Fri, 7 Jun 2019 10:05:52 +0100 (BST) From: =?utf-8?q?Alex_Benn=C3=A9e?= To: peter.maydell@linaro.org Date: Fri, 7 Jun 2019 10:05:04 +0100 Message-Id: <20190607090552.12434-6-alex.bennee@linaro.org> X-Mailer: git-send-email 2.20.1 In-Reply-To: <20190607090552.12434-1-alex.bennee@linaro.org> References: <20190607090552.12434-1-alex.bennee@linaro.org> MIME-Version: 1.0 X-detected-operating-system: by eggs.gnu.org: Genre and OS details not recognized. X-Received-From: 2a00:1450:4864:20::42c Subject: [Qemu-devel] [PULL 05/52] tests/docker: Update the Ubuntu image to 19.04 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: Fam Zheng , Richard Henderson , =?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" This has aged a little and we have a separate LTS image for testing on the older distros. Update it to a more recent release like its Fedora cousin. Besides it is useful to have something with gcc-9 on it for squashing those stringop truncation errors. Signed-off-by: Alex Bennée Reviewed-by: Richard Henderson -- 2.20.1 diff --git a/tests/docker/dockerfiles/ubuntu.docker b/tests/docker/dockerfiles/ubuntu.docker index 36e2b17de5..8d256961f0 100644 --- a/tests/docker/dockerfiles/ubuntu.docker +++ b/tests/docker/dockerfiles/ubuntu.docker @@ -1,6 +1,15 @@ -FROM ubuntu:16.04 -RUN echo "deb http://archive.ubuntu.com/ubuntu/ trusty universe multiverse" >> \ - /etc/apt/sources.list +# +# Latest Ubuntu Release +# +# Useful for testing against relatively bleeding edge libraries and +# compilers. We also have seperate recipe for the most recent LTS +# release. +# +# When updating use the full tag not :latest otherwise the build +# system won't pick up that it has changed. +# + +FROM ubuntu:19.04 ENV PACKAGES flex bison \ ccache \ clang \ @@ -21,7 +30,7 @@ ENV PACKAGES flex bison \ libepoxy-dev \ libfdt-dev \ libgbm-dev \ - libgnutls-dev \ + libgnutls28-dev \ libgtk-3-dev \ libibverbs-dev \ libiscsi-dev \ @@ -34,7 +43,7 @@ ENV PACKAGES flex bison \ libnss3-dev \ libnuma-dev \ libpixman-1-dev \ - libpng12-dev \ + libpng-dev \ librados-dev \ librbd-dev \ librdmacm-dev \ From patchwork Fri Jun 7 09:05:05 2019 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 8bit X-Patchwork-Submitter: =?utf-8?q?Alex_Benn=C3=A9e?= X-Patchwork-Id: 166091 Delivered-To: patch@linaro.org Received: by 2002:a92:9e1a:0:0:0:0:0 with SMTP id q26csp393622ili; Fri, 7 Jun 2019 02:23:52 -0700 (PDT) X-Google-Smtp-Source: APXvYqwQQIIWK8Gn8OvNMheFJN1cqC680lT7MGl1LXOmXUU6SeL54M5hKLT2zA2Z1e3dm5EtFNLT X-Received: by 2002:ac8:2c6a:: with SMTP id e39mr46150861qta.179.1559899432319; Fri, 07 Jun 2019 02:23:52 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1559899432; cv=none; d=google.com; s=arc-20160816; b=lRDmG1BTBubEC3y7T/4yqeyKhXrtx3MBK/4AMSIxlPnxPqLEKmVbp5YWhdPX2DHSDh rVUjXk2mwHosYHTf9HIOGQJfO476sFcP0AWoxV0QINOBFSEZSbe79b7H5BsNoTZhfFM1 8PcAghFti4e7SKh/1T8mS5XPIHtCNWQhhJHqK425MaKJ8PmhQyGMAvZW0GI69vnZcRjF 4dJjns17XNqVynta/INOy6BUsHR1FeFoAM6bFML4WdBQaEIzIx27Os0uMEPu4yVsZmFa SxHmUw+CZnOh1FmE2pcvpU85JWn5rDRxYjpETCnQfQqYg803vdsS5Pzky2zChUMMqH7b nusw== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=sender:errors-to:cc:list-subscribe:list-help:list-post:list-archive :list-unsubscribe:list-id:precedence:subject :content-transfer-encoding:mime-version:references:in-reply-to :message-id:date:to:from:dkim-signature; bh=HdpVihLUIZVvKpgG2IEu5C8IS7kClin1bLgeQxnhXsA=; b=MW7aYp4PYVtlelxSyTL9VVgrnPcHMXfwD69A61fbloVzzNesTlT9Joh2SHrkeyxG3a LMmp2NasvhEwtUZUZ+9Q4csBslSNYjj8/JRR15kUiReGGtMSBo8u8Lf3UUNSJeKa0VfM k7lg3Gi2B4PrRVkctm0h/pvmk4Hlaa965r09Y4VCd8dYG+Q17i19s5R3S8flpKL1cewG O6iUF6miB6+JCzpus39DqaHJ9Z07qx/tA4BoivtZuJkoEd5uqt/kardsOop3rryyGyeb PVtFCuwR57T4XTFePS38gu5ecYGRyyOOAyLuClLh3XMr83/H+WnBNEbtcYMKwPS0EZ0P tExA== ARC-Authentication-Results: i=1; mx.google.com; dkim=fail header.i=@linaro.org header.s=google header.b="cusWhEk/"; spf=pass (google.com: domain of qemu-devel-bounces+patch=linaro.org@nongnu.org designates 209.51.188.47 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.47]) by mx.google.com with ESMTPS id r45si928651qtr.349.2019.06.07.02.23.52 for (version=TLS1_2 cipher=ECDHE-RSA-CHACHA20-POLY1305 bits=256/256); Fri, 07 Jun 2019 02:23:52 -0700 (PDT) Received-SPF: pass (google.com: domain of qemu-devel-bounces+patch=linaro.org@nongnu.org designates 209.51.188.47 as permitted sender) client-ip=209.51.188.47; Authentication-Results: mx.google.com; dkim=fail header.i=@linaro.org header.s=google header.b="cusWhEk/"; spf=pass (google.com: domain of qemu-devel-bounces+patch=linaro.org@nongnu.org designates 209.51.188.47 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]:47444 helo=lists.gnu.org) by lists.gnu.org with esmtp (Exim 4.86_2) (envelope-from ) id 1hZB6F-0001W7-TE for patch@linaro.org; Fri, 07 Jun 2019 05:23:51 -0400 Received: from eggs.gnu.org ([2001:470:142:3::10]:39333) by lists.gnu.org with esmtp (Exim 4.86_2) (envelope-from ) id 1hZAoz-00047N-RE for qemu-devel@nongnu.org; Fri, 07 Jun 2019 05:06:03 -0400 Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71) (envelope-from ) id 1hZAox-0004IL-S6 for qemu-devel@nongnu.org; Fri, 07 Jun 2019 05:06:01 -0400 Received: from mail-wm1-x342.google.com ([2a00:1450:4864:20::342]:51071) by eggs.gnu.org with esmtps (TLS1.0:RSA_AES_128_CBC_SHA1:16) (Exim 4.71) (envelope-from ) id 1hZAox-00045z-77 for qemu-devel@nongnu.org; Fri, 07 Jun 2019 05:05:59 -0400 Received: by mail-wm1-x342.google.com with SMTP id c66so1224020wmf.0 for ; Fri, 07 Jun 2019 02:05:58 -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=HdpVihLUIZVvKpgG2IEu5C8IS7kClin1bLgeQxnhXsA=; b=cusWhEk/JWErEovXuSD115Z7CQzBd2TT8ChezGFYSnZTBpAUKPAIHYO8GR5ReYBc4B rAck8troJ7G3+PM8mENsgH16jXhHMdeFQDP0blm/mfUcbKMpbUcZn8U0qzXXC6vKQvyb biN0yoGNj/0KIZXlGMxSHlLmFgOa6orbv075sVmYY5iZejWe2ODuUDnVEngKCBUUxLb/ /wDeseLRvvsKSK0i/1Wwf7D1hrlurY78SsW0FdSPOHQKMn3otCJW+WGpzO18wy3kTGjw R6gAdCFZbA+enBBGLH2Evj2eFbEY/ALNg7pINgcg9Tw2nA5SZm0/SUzZbTtA13ug+pdo YVcg== 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=HdpVihLUIZVvKpgG2IEu5C8IS7kClin1bLgeQxnhXsA=; b=hXfB3K/t5VadABYZytvE2FyjoxPr9Mbxf1YaHOG4VIzlfoie9ck/cz4xqkqjA+dzVW sS0FkUs7TwpbI37ool6JSfr0y9WRMUoJJkqSuhn+YcZCMAcFv2jOQ7HFO6YVmDzZhWz0 Q/0bGV9xLDPsZAHPV4q7qIGwTuT2hmfQQV7oLvKLCMhWltOfaSh5luR03qPTFI9hhtZf /pyVQh0XK9po4FBN1+XkLI39i5azXA7m1WQWUcpjVorysFSdNELj91yuy5vTJ7lYRQDv FIsoEPSLZgxrIYCTXqcIqRw4fZdTwciZ0iI4EoYfnPg7lCG/ZuXFBpS3UcIP+/oLbSKW yoDw== X-Gm-Message-State: APjAAAXRdwlz3xH8r0phlsff/jmTR5ZbL8thSuEmTNESVdibWjT6DTxJ Og6AmNrczT6y3eTKsJfwoZhacA== X-Received: by 2002:a1c:2bc7:: with SMTP id r190mr2776726wmr.174.1559898357213; Fri, 07 Jun 2019 02:05:57 -0700 (PDT) Received: from zen.linaroharston ([81.128.185.34]) by smtp.gmail.com with ESMTPSA id p16sm2135625wrg.49.2019.06.07.02.05.53 (version=TLS1_3 cipher=AEAD-AES256-GCM-SHA384 bits=256/256); Fri, 07 Jun 2019 02:05:53 -0700 (PDT) Received: from zen.linaroharston. (localhost [127.0.0.1]) by zen.linaroharston (Postfix) with ESMTP id 7DA8D1FF93; Fri, 7 Jun 2019 10:05:52 +0100 (BST) From: =?utf-8?q?Alex_Benn=C3=A9e?= To: peter.maydell@linaro.org Date: Fri, 7 Jun 2019 10:05:05 +0100 Message-Id: <20190607090552.12434-7-alex.bennee@linaro.org> X-Mailer: git-send-email 2.20.1 In-Reply-To: <20190607090552.12434-1-alex.bennee@linaro.org> References: <20190607090552.12434-1-alex.bennee@linaro.org> MIME-Version: 1.0 X-detected-operating-system: by eggs.gnu.org: Genre and OS details not recognized. X-Received-From: 2a00:1450:4864:20::342 Subject: [Qemu-devel] [PULL 06/52] .travis.yml: bump gcc sanitiser job to gcc-9 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: Fam Zheng , =?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" The toolchain PPA has it so we might as well use it. We currently have to add: -Wno-error=stringop-truncation as there are still strncpy operations in the tree operating on things that haven't been annotated with QEMU_NONSTRING. Signed-off-by: Alex Bennée -- 2.20.1 diff --git a/.travis.yml b/.travis.yml index b053a836a3..f0aa37f2d1 100644 --- a/.travis.yml +++ b/.travis.yml @@ -240,8 +240,8 @@ matrix: - ubuntu-toolchain-r-test packages: # Extra toolchains - - gcc-7 - - g++-7 + - gcc-9 + - g++-9 # Build dependencies - libaio-dev - libattr1-dev @@ -270,11 +270,11 @@ matrix: language: generic compiler: none env: - - COMPILER_NAME=gcc CXX=g++-7 CC=gcc-7 - - CONFIG="--cc=gcc-7 --cxx=g++-7 --disable-pie --disable-linux-user" + - COMPILER_NAME=gcc CXX=g++-9 CC=gcc-9 + - CONFIG="--cc=gcc-9 --cxx=g++-9 --disable-pie --disable-linux-user" - TEST_CMD="" before_script: - - ./configure ${CONFIG} --extra-cflags="-g3 -O0 -fsanitize=thread -fuse-ld=gold" || { cat config.log && exit 1; } + - ./configure ${CONFIG} --extra-cflags="-g3 -O0 -Wno-error=stringop-truncation -fsanitize=thread -fuse-ld=gold" || { cat config.log && exit 1; } # Run check-tcg against linux-user From patchwork Fri Jun 7 09:05:06 2019 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 8bit X-Patchwork-Submitter: =?utf-8?q?Alex_Benn=C3=A9e?= X-Patchwork-Id: 166083 Delivered-To: patch@linaro.org Received: by 2002:a92:9e1a:0:0:0:0:0 with SMTP id q26csp384581ili; Fri, 7 Jun 2019 02:13:33 -0700 (PDT) X-Google-Smtp-Source: APXvYqzGyWn79h4BuZ/YBsvd5F7GZJbtgMjsiugf6yw17Vnv/fGf13tWGAdTuJaZPibolfQ2t278 X-Received: by 2002:a05:620a:12ef:: with SMTP id f15mr24272044qkl.340.1559898813231; Fri, 07 Jun 2019 02:13:33 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1559898813; cv=none; d=google.com; s=arc-20160816; b=Y3WVABZd5upUHk/Mgp82dSjVd1KTDfO+xPhkcNifcc77qXzRZ+Bkmmm4Q++P8zdNkS uLMynl2HxWg1p5yc2PXn7VTP+U8tIPZvASbCil0PwkKr61LXt8Qmt4zX83NLz0PHg4Pa w0PMceqnP9OtCiSYKzCndUMZx2bpvwq066svsBm0gYODIwfOOPHWbXXef8+CUzbsYmm9 k58uwtmmdJbYuUSglaBHepWO7jfZ4JHzBeeIgxYnDhXkb5kPDTqj4UnQBjVtNeNnzysy 3pr7ezUJtFtcTDccQRphDsAy0DWhGQIGGHui7HQoOeU8PUX2HkjvdC4/6kxO7ySNpopU y74g== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=sender:errors-to:cc:list-subscribe:list-help:list-post:list-archive :list-unsubscribe:list-id:precedence:subject :content-transfer-encoding:mime-version:references:in-reply-to :message-id:date:to:from:dkim-signature; bh=WAruCVUMvVUZGKjuxI8Kw2Q2uX+I+acKmrGoMuG66f8=; b=jcDBgoqWNJ82hkKVXD6ls7rOtYX+trCr0vBG/V+SvAIi5Sbps3yE26x/aUobd/O9zW z2lPQMgfuwZ7D9Uexa6Bj//YPmkzP89LDBdWhK89fjOZsKwXGZaCstGfovK+gzM7wrCC vkno+/nSOd1auZHWpRZ16nusvSpenAM04qZfUw0jmHXPNS6qhR47L2coPmCyrZqHC+kw REFBHVb6pY0jfgXfYF3Z0jxJrd+JVNZl0cDzrxIDXzzA0LQkaBx7rH+QAoyGu4yTOp5B g9he77l5Cx3N2Pb4+b7SDvndSrd1AWv5sKwEbKdNKXYdOIplWZwQcUivSJIq8uubCr6A GjRA== ARC-Authentication-Results: i=1; mx.google.com; dkim=fail header.i=@linaro.org header.s=google header.b=yACQQXAm; spf=pass (google.com: domain of qemu-devel-bounces+patch=linaro.org@nongnu.org designates 209.51.188.47 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.47]) by mx.google.com with ESMTPS id q20si905749qtn.300.2019.06.07.02.13.33 for (version=TLS1_2 cipher=ECDHE-RSA-CHACHA20-POLY1305 bits=256/256); Fri, 07 Jun 2019 02:13:33 -0700 (PDT) Received-SPF: pass (google.com: domain of qemu-devel-bounces+patch=linaro.org@nongnu.org designates 209.51.188.47 as permitted sender) client-ip=209.51.188.47; Authentication-Results: mx.google.com; dkim=fail header.i=@linaro.org header.s=google header.b=yACQQXAm; spf=pass (google.com: domain of qemu-devel-bounces+patch=linaro.org@nongnu.org designates 209.51.188.47 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]:47308 helo=lists.gnu.org) by lists.gnu.org with esmtp (Exim 4.86_2) (envelope-from ) id 1hZAwG-0002kH-Qw for patch@linaro.org; Fri, 07 Jun 2019 05:13:32 -0400 Received: from eggs.gnu.org ([2001:470:142:3::10]:39388) by lists.gnu.org with esmtp (Exim 4.86_2) (envelope-from ) id 1hZAp1-00047Z-Fg for qemu-devel@nongnu.org; Fri, 07 Jun 2019 05:06:04 -0400 Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71) (envelope-from ) id 1hZAoy-0004Ii-1T for qemu-devel@nongnu.org; Fri, 07 Jun 2019 05:06:03 -0400 Received: from mail-wr1-x432.google.com ([2a00:1450:4864:20::432]:41276) by eggs.gnu.org with esmtps (TLS1.0:RSA_AES_128_CBC_SHA1:16) (Exim 4.71) (envelope-from ) id 1hZAox-0004Ct-Ra for qemu-devel@nongnu.org; Fri, 07 Jun 2019 05:05:59 -0400 Received: by mail-wr1-x432.google.com with SMTP id c2so1338120wrm.8 for ; Fri, 07 Jun 2019 02:05:59 -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=WAruCVUMvVUZGKjuxI8Kw2Q2uX+I+acKmrGoMuG66f8=; b=yACQQXAmEShz7T8rno6cKs8EZgrltB2s2aGEYSUgVT01Xx5M4SmxLwEbPMdxLvs7jI Wfm4H2sYxkd1XyaeH+JaiN6TaUYmvboJ1ankaxsvTWzmbw1vHHNDpg0mYBVxOAHoIxtI 8y7/XK4dj/mEm8hZWaBtSR+oVPT8rzk3KtARNtURrIavMRjRETGFeeUGc0zuUmF3TaGF 5iPApuy2SxNBHq+zJFGGCyM0FX/m/tBb3Sj8RYIFRgmi1T32DBIAO34ci40UZ9ifySsF 1hnj76vC9TurrDlu5sz9fRkbEWyAZaAndBrpFKTXL7hFnQKVRYNESOPEymKKiIyY+sNV jHlg== 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=WAruCVUMvVUZGKjuxI8Kw2Q2uX+I+acKmrGoMuG66f8=; b=jOXT1WIaBGPagKvBqpGXEOBaEo6lFwwqki1HocwgL4/IGFmxo+bvhIHT1DvH7E4wPh 0OM1rFFnvwqg0j01Xn/jSgfEv2kXnzpD5z+3wL5Ls+8XZDg54Uuz4D+Ecm35YPXXwnzI 8niqtLvD2ges5Rzs79AiPDnc18TN1T/a8e2gZoirqGG33v7RpEX6HGhkDFtVLb0WF8Tq 4kwE+oRHoYvRE3tr9WeqKacZ5+5yq+3Se+9iDP9QI0qcvmDaSSju7Ero5/3ODWPvz3Pf ztC/8F4+EcHj+RxIPgpqsV/hcAklDfzCug4mdNOm20p4aF9NSIIie7lGtvUkU2v0wWDQ Y3DA== X-Gm-Message-State: APjAAAXsBusOdqlFjFo+BNIG6DsRAfkkLg3XGMQtW2vY1nv0meD2BWRe WtY9PqV+I8FDotpHYOuf8qciDA== X-Received: by 2002:adf:e4d2:: with SMTP id v18mr5887019wrm.189.1559898358300; Fri, 07 Jun 2019 02:05:58 -0700 (PDT) Received: from zen.linaroharston ([81.128.185.34]) by smtp.gmail.com with ESMTPSA id k10sm1645351wmk.14.2019.06.07.02.05.53 (version=TLS1_3 cipher=AEAD-AES256-GCM-SHA384 bits=256/256); Fri, 07 Jun 2019 02:05:56 -0700 (PDT) Received: from zen.linaroharston. (localhost [127.0.0.1]) by zen.linaroharston (Postfix) with ESMTP id 902DB1FF96; Fri, 7 Jun 2019 10:05:52 +0100 (BST) From: =?utf-8?q?Alex_Benn=C3=A9e?= To: peter.maydell@linaro.org Date: Fri, 7 Jun 2019 10:05:06 +0100 Message-Id: <20190607090552.12434-8-alex.bennee@linaro.org> X-Mailer: git-send-email 2.20.1 In-Reply-To: <20190607090552.12434-1-alex.bennee@linaro.org> References: <20190607090552.12434-1-alex.bennee@linaro.org> MIME-Version: 1.0 X-detected-operating-system: by eggs.gnu.org: Genre and OS details not recognized. X-Received-From: 2a00:1450:4864:20::432 Subject: [Qemu-devel] [PULL 07/52] .travis.yml: add clang ubsan job 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: Fam Zheng , =?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" We document this on our wiki and we might as well catch it in our CI rather than waiting for it to be picked up on merge: https://wiki.qemu.org/Testing#clang_UBSan Signed-off-by: Alex Bennée Reviewed-by: Philippe Mathieu-Daudé Tested-by: Philippe Mathieu-Daudé -- 2.20.1 diff --git a/.travis.yml b/.travis.yml index f0aa37f2d1..2f1658602e 100644 --- a/.travis.yml +++ b/.travis.yml @@ -152,6 +152,13 @@ matrix: compiler: clang + - env: + - CONFIG="--target-list=${MAIN_SOFTMMU_TARGETS} " + compiler: clang + before_script: + - ./configure ${CONFIG} --extra-cflags="-fsanitize=undefined -Werror" || { cat config.log && exit 1; } + + - env: - CONFIG="--disable-user --target-list-exclude=${MAIN_SOFTMMU_TARGETS}" compiler: clang From patchwork Fri Jun 7 09:05:07 2019 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 8bit X-Patchwork-Submitter: =?utf-8?q?Alex_Benn=C3=A9e?= X-Patchwork-Id: 166092 Delivered-To: patch@linaro.org Received: by 2002:a92:9e1a:0:0:0:0:0 with SMTP id q26csp394278ili; Fri, 7 Jun 2019 02:24:38 -0700 (PDT) X-Google-Smtp-Source: APXvYqzXkOAalIDx8EbQ+56PIifhYgkvfoCKYC6bGw5Kn5+Zljj3oO3F/tq4CvGvdNxCcnWQ+/1i X-Received: by 2002:ac8:38a8:: with SMTP id f37mr44625793qtc.150.1559899478280; Fri, 07 Jun 2019 02:24:38 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1559899478; cv=none; d=google.com; s=arc-20160816; b=iWYhqOpDqwSPbrx64ypz+QKG3iADBIUczBlwpv8qm+1VkNTL9gGbbIdcd4lMQcPEs2 xrZKaR1RgXxj61oaSe2s/tCorJjxWb92KGGufbDAdIWzT9bmJLSY5idAJhzWdWKv3kLv 830/DSDm64gToWTCBlY9ifNkbzYs5ew7k9XLy4vGoOPIlbQz3uOkAzF7yVRqjvJ82gzU t2VXTY7aq5EUyese6TgwNKSrvCfOLE8AeelbiOjSHnnpH+NBgEXCoqf2fDM217scz2hI x4VNlhsNOrZihDnQc0Qp+5kPAlg7hIJkMQ5W6Dobijq+0BM7ogzsYLCOMXcYUOcezb36 nxvA== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=sender:errors-to:cc:list-subscribe:list-help:list-post:list-archive :list-unsubscribe:list-id:precedence:subject :content-transfer-encoding:mime-version:references:in-reply-to :message-id:date:to:from:dkim-signature; bh=+SKipxqDiHRib8HzDeti6YzGOBFsaSaAYfMEIKsinVY=; b=hZC2tfrwRUXogIb9hzoOTDv/W/2AoGbJMj6sRefxtyNogLaN8V+b40DFpXLc85HCHa Jg5l82GaSBrsk6ezABDhTLoX0/FEp9sp1jNPD49NejDk3vZrAnorGnlKf+zcuGeGDIn+ THUDDi0eL1rZMt608AvQqD+iOjtwAQrbqGPh0qOiGgbWEC6+bNJRe5OKmfVnuZ4i3QAY wze+0fCMz/kqdZRv22LcQgt28qfslJW9CWJiy33cnxn35XFJWScU8nE/2oAlq6VH+IqN qBG9kZlRV0B3ui9qsk0eUqqPFO7OQMNHpIWmtF9nwG+SaLewo4tqYZL3QjhsNDkV661d 7Hng== ARC-Authentication-Results: i=1; mx.google.com; dkim=fail header.i=@linaro.org header.s=google header.b=lMYxmG3R; spf=pass (google.com: domain of qemu-devel-bounces+patch=linaro.org@nongnu.org designates 209.51.188.47 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.47]) by mx.google.com with ESMTPS id y51si830715qvc.189.2019.06.07.02.24.38 for (version=TLS1_2 cipher=ECDHE-RSA-CHACHA20-POLY1305 bits=256/256); Fri, 07 Jun 2019 02:24:38 -0700 (PDT) Received-SPF: pass (google.com: domain of qemu-devel-bounces+patch=linaro.org@nongnu.org designates 209.51.188.47 as permitted sender) client-ip=209.51.188.47; Authentication-Results: mx.google.com; dkim=fail header.i=@linaro.org header.s=google header.b=lMYxmG3R; spf=pass (google.com: domain of qemu-devel-bounces+patch=linaro.org@nongnu.org designates 209.51.188.47 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]:47448 helo=lists.gnu.org) by lists.gnu.org with esmtp (Exim 4.86_2) (envelope-from ) id 1hZB6z-0001eg-Sf for patch@linaro.org; Fri, 07 Jun 2019 05:24:37 -0400 Received: from eggs.gnu.org ([2001:470:142:3::10]:39402) by lists.gnu.org with esmtp (Exim 4.86_2) (envelope-from ) id 1hZAp1-00048R-TL for qemu-devel@nongnu.org; Fri, 07 Jun 2019 05:06:05 -0400 Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71) (envelope-from ) id 1hZAp0-0004R1-7Y for qemu-devel@nongnu.org; Fri, 07 Jun 2019 05:06:03 -0400 Received: from mail-wr1-x42b.google.com ([2a00:1450:4864:20::42b]:40130) by eggs.gnu.org with esmtps (TLS1.0:RSA_AES_128_CBC_SHA1:16) (Exim 4.71) (envelope-from ) id 1hZAoz-0004ML-W8 for qemu-devel@nongnu.org; Fri, 07 Jun 2019 05:06:02 -0400 Received: by mail-wr1-x42b.google.com with SMTP id p11so1344871wre.7 for ; Fri, 07 Jun 2019 02:06:01 -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=+SKipxqDiHRib8HzDeti6YzGOBFsaSaAYfMEIKsinVY=; b=lMYxmG3RToTynruFovsfKYuH3FC/2j3/M00lxPrleLwTPEf/zix0ZGiEQEEUQugjFR DCZWpIF0t4z75WrONvGED/EgGZaaR8+E+ASD19Fkoz1JmB25YLCgA/iCXmA9SKLaCHqH nlo2L8D7Vr2Otp/b7rj0xaXRvcx5fLCig4/gNBqiQhhM5kSrJwxQi0xxRjvlwEwMTlZk 7doSWfbu8RoZvY66xMbWqIuHP4AkHQKO7APVIUfiIISDWuTiExGJdR5ubdBLK+y0RagA duMkWQ0OXY4+SAJSN0eRQsUnVzJUqhteWh8/k8WKGOfpIRSQ97biCNPO0c84vXXcdrAQ q+0Q== 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=+SKipxqDiHRib8HzDeti6YzGOBFsaSaAYfMEIKsinVY=; b=PweT0xPopbUG1ZnyPVUaW/5Ip2dHiGScki1lTCTlMDnuaOIQ3E9LOMiIZEKPlsTNyT nokwe1Jja29Cj1yR2El/myjXXjQlAbSBqovJKv7lisZ9L4+FNdT4XoxcIfvTUG0W5S7a 5efPRYhZjXe+YdmQi7I7cXWYmIxq742vm75A9C5+smd4StT82Um6lo/Y3HhxUtuM+bTu CnmYeszV65Szo/gzxfoeqQ7Xwe6EKtgxE7AodV13CZd8wgSwrMddMmvxET48tfrdmY+n 3rSh+1+VKYKS6KsQ43rdceSaw+xl8ADAiH4a7NCmE7EdW8agrWjdVAAUVR9vZXDryIg/ 16YQ== X-Gm-Message-State: APjAAAVYhGd7qQnDUqi4Nuoj+Krd1TTkGEIkR3spDTGX9WPQl6O80hwa cwki1ZKPlmFWjc4cHAkEINh7yw== X-Received: by 2002:adf:8183:: with SMTP id 3mr19050280wra.181.1559898360433; Fri, 07 Jun 2019 02:06:00 -0700 (PDT) Received: from zen.linaroharston ([81.128.185.34]) by smtp.gmail.com with ESMTPSA id z12sm1046080wrl.37.2019.06.07.02.05.53 (version=TLS1_3 cipher=AEAD-AES256-GCM-SHA384 bits=256/256); Fri, 07 Jun 2019 02:05:57 -0700 (PDT) Received: from zen.linaroharston. (localhost [127.0.0.1]) by zen.linaroharston (Postfix) with ESMTP id A2D501FF98; Fri, 7 Jun 2019 10:05:52 +0100 (BST) From: =?utf-8?q?Alex_Benn=C3=A9e?= To: peter.maydell@linaro.org Date: Fri, 7 Jun 2019 10:05:07 +0100 Message-Id: <20190607090552.12434-9-alex.bennee@linaro.org> X-Mailer: git-send-email 2.20.1 In-Reply-To: <20190607090552.12434-1-alex.bennee@linaro.org> References: <20190607090552.12434-1-alex.bennee@linaro.org> MIME-Version: 1.0 X-detected-operating-system: by eggs.gnu.org: Genre and OS details not recognized. X-Received-From: 2a00:1450:4864:20::42b Subject: [Qemu-devel] [PULL 08/52] tests/vm: Use python configured on build 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: Fam Zheng , =?utf-8?q?Philippe_Mathieu-Daud=C3=A9?= , =?utf-8?q?Alex_Benn=C3=A9e?= , qemu-devel@nongnu.org, Wainer dos Santos Moschetta Errors-To: qemu-devel-bounces+patch=linaro.org@nongnu.org Sender: "Qemu-devel" From: Wainer dos Santos Moschetta Changed the vm-test makefile to execute python scripts with the interpreter configured on build. This allows to run vm-test targets properly in Linux distros with Python 3 only support. Signed-off-by: Wainer dos Santos Moschetta Message-Id: <20190329210804.22121-2-wainersm@redhat.com> Signed-off-by: Alex Bennée Reviewed-by: Philippe Mathieu-Daudé Tested-by: Philippe Mathieu-Daudé -- 2.20.1 diff --git a/tests/vm/Makefile.include b/tests/vm/Makefile.include index 992d823f6b..6f82676306 100644 --- a/tests/vm/Makefile.include +++ b/tests/vm/Makefile.include @@ -35,7 +35,7 @@ $(IMAGES_DIR)/%.img: $(SRC_PATH)/tests/vm/% \ $(SRC_PATH)/tests/vm/Makefile.include @mkdir -p $(IMAGES_DIR) $(call quiet-command, \ - $< \ + $(PYTHON) $< \ $(if $(V)$(DEBUG), --debug) \ --image "$@" \ --force \ @@ -46,7 +46,7 @@ $(IMAGES_DIR)/%.img: $(SRC_PATH)/tests/vm/% \ # Build in VM $(IMAGE) vm-build-%: $(IMAGES_DIR)/%.img $(call quiet-command, \ - $(SRC_PATH)/tests/vm/$* \ + $(PYTHON) $(SRC_PATH)/tests/vm/$* \ $(if $(V)$(DEBUG), --debug) \ $(if $(DEBUG), --interactive) \ $(if $(J),--jobs $(J)) \ From patchwork Fri Jun 7 09:05:08 2019 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 8bit X-Patchwork-Submitter: =?utf-8?q?Alex_Benn=C3=A9e?= X-Patchwork-Id: 166081 Delivered-To: patch@linaro.org Received: by 2002:a92:9e1a:0:0:0:0:0 with SMTP id q26csp380784ili; Fri, 7 Jun 2019 02:09:38 -0700 (PDT) X-Google-Smtp-Source: APXvYqxbsMWVPxqrgVZNhezaGoqvUMOIP/O2n0Dt/RtUc+DAH6BkiXeTTE5X8XiL+onzKcxDNUn8 X-Received: by 2002:a37:8306:: with SMTP id f6mr42124419qkd.19.1559898578881; Fri, 07 Jun 2019 02:09:38 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1559898578; cv=none; d=google.com; s=arc-20160816; b=kS3Gzo4RVAEatOmpo5mreg36Csf1Sy2t5aFzmDlSJdLg7L3ASmuOsgiGjNsBuFLVFc xngR0rZltRIhq3BBcjbqDrUoe/C8EOrV9KLZ5jf7buGBerHCMifmiPVR04ZtE9ewUWlF /I4WeyNBTxGvViCUqJGCKDDuHPPdTFR8zkZRXPBDCSTNNBJ3hN/JB/7/zXo/hnwkbxgp USiukj4XImNRsBWlXBBQmCoxyDE0E9TbYE+wYf2yJL49OJR5ITiRKEBJdW3UpNExBiVX g9vjn9FavsIhM7EBusSGMdbK1xfn33sRBs1aonrLbkclz1RaoOQK2ZOpM+wSS44UUB9x PjLg== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=sender:errors-to:cc:list-subscribe:list-help:list-post:list-archive :list-unsubscribe:list-id:precedence:subject :content-transfer-encoding:mime-version:references:in-reply-to :message-id:date:to:from:dkim-signature; bh=gEge0ZwKN/zoSSUTfhu4Nam9XSCwRb2HyAYOFmNXZHE=; b=IoqhB8I97aBL1TrbQF7JHdf+OYT3X6SyGn33ia3JX3dQwQR6gFN4uHiLh8W6F2EcOm XUq6rBKe6SL3MOEKQ8ywg4/P5ylAPs3vH6xOu/38Vvnh5HGb4stXk6+8t6OlO+F1BgY5 NxJgLV8e/nSSy/cCy8Zw+AIRBdnKQWk4blxgYLKFfMuVPniXJ4sZUCHo0FYLfntFZIUs F6Gm62fOUCUtl9JurVRMsjhf9twN1nEf3XjFn1ScKqS2VhRRRet58TYUwmY+4gwnER92 1G/zq1JsMb8tq2qGZPkt/ysHUZbUUjigmTBcdLHjCzYISA67jJTHTeBB0I9r88oAtkt6 IDXg== ARC-Authentication-Results: i=1; mx.google.com; dkim=fail header.i=@linaro.org header.s=google header.b=Jrjz6t7i; spf=pass (google.com: domain of qemu-devel-bounces+patch=linaro.org@nongnu.org designates 209.51.188.47 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.47]) by mx.google.com with ESMTPS id a128si147345qkc.7.2019.06.07.02.09.38 for (version=TLS1_2 cipher=ECDHE-RSA-CHACHA20-POLY1305 bits=256/256); Fri, 07 Jun 2019 02:09:38 -0700 (PDT) Received-SPF: pass (google.com: domain of qemu-devel-bounces+patch=linaro.org@nongnu.org designates 209.51.188.47 as permitted sender) client-ip=209.51.188.47; Authentication-Results: mx.google.com; dkim=fail header.i=@linaro.org header.s=google header.b=Jrjz6t7i; spf=pass (google.com: domain of qemu-devel-bounces+patch=linaro.org@nongnu.org designates 209.51.188.47 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]:47142 helo=lists.gnu.org) by lists.gnu.org with esmtp (Exim 4.86_2) (envelope-from ) id 1hZAsU-0007jh-GS for patch@linaro.org; Fri, 07 Jun 2019 05:09:38 -0400 Received: from eggs.gnu.org ([2001:470:142:3::10]:39433) by lists.gnu.org with esmtp (Exim 4.86_2) (envelope-from ) id 1hZAp3-00049I-LO for qemu-devel@nongnu.org; Fri, 07 Jun 2019 05:06:07 -0400 Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71) (envelope-from ) id 1hZAp1-0004Yk-Uf for qemu-devel@nongnu.org; Fri, 07 Jun 2019 05:06:05 -0400 Received: from mail-wm1-x32f.google.com ([2a00:1450:4864:20::32f]:52972) by eggs.gnu.org with esmtps (TLS1.0:RSA_AES_128_CBC_SHA1:16) (Exim 4.71) (envelope-from ) id 1hZAp1-0004Og-DP for qemu-devel@nongnu.org; Fri, 07 Jun 2019 05:06:03 -0400 Received: by mail-wm1-x32f.google.com with SMTP id s3so1214914wms.2 for ; Fri, 07 Jun 2019 02:06:02 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=linaro.org; s=google; h=from:to:cc:subject:date:message-id:in-reply-to:references :mime-version:content-transfer-encoding; bh=gEge0ZwKN/zoSSUTfhu4Nam9XSCwRb2HyAYOFmNXZHE=; b=Jrjz6t7ihJQGYki1ve73MhmpkWG8s2o/OEF56FwMl5+iJRn/Xt1XT9hbj7aYWi7l/1 UZxFYIpP23xfa5g0opH03aKtMD+A3aCL2mW5SOUkrsGj4YeaYwx+wHirupLBFOuNJl8f VAshmcxpS8jmcmmTCOlhijPuzv4jUwm4VwRFNVbeAdyVTSU985g4YaGw4cokGclbKJ/T iWpUG9N718ggNYG1SWOQDChZV1ZuqfDPMw0zPn6R1315fP8rY++ibZLdK6IR5Nng8PE5 q4pi5G9gTiBQfZt4VJgmQhDlDNPKRy17b5sJQYxGA8psvc0YSWDI9AAqCj16uJNqkHGq 8vhA== 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=gEge0ZwKN/zoSSUTfhu4Nam9XSCwRb2HyAYOFmNXZHE=; b=PF2acfCXT6JJCHCHd3r11xPNbpyiSLrXyfZDgKeWfQF/8Tlw472/tcJXINW9ICLZax LLg/udN5ke362tFQ0XQgKa2m/6Eq/87j69RNSih3N8xjNP+K3dTt5IOdNetLJN7Lrpm1 mmCOOjBs57pGZuYg7utLG2zfo/N+4mxFbiHPA3PyMu9gR9JJ93MKfAIM8c/JUxnLf333 SisY2oFjl2hX1zL28Rx0fa9K+8jTu9iCYS/va7COAr+n4zLumaE6OxkcvRpZ4DFhONe+ dPCdYJcGtHQgx5V6iWHbLVFjcZuHL817lsR1Q7gOIHKc2XIBA4zsWaLjXLjkGC5iA87V 0A1w== X-Gm-Message-State: APjAAAWraZD108u90eZ1eSc3BslB1/C3XgxzjK75ctRcyGEVkxFMMGHU jd1BDxTVqhPUYKl9N5QEScSAUA== X-Received: by 2002:a1c:9e92:: with SMTP id h140mr2710828wme.82.1559898361131; Fri, 07 Jun 2019 02:06:01 -0700 (PDT) Received: from zen.linaroharston ([81.128.185.34]) by smtp.gmail.com with ESMTPSA id k2sm1256475wrx.84.2019.06.07.02.05.54 (version=TLS1_3 cipher=AEAD-AES256-GCM-SHA384 bits=256/256); Fri, 07 Jun 2019 02:05:57 -0700 (PDT) Received: from zen.linaroharston. (localhost [127.0.0.1]) by zen.linaroharston (Postfix) with ESMTP id B5D781FF99; Fri, 7 Jun 2019 10:05:52 +0100 (BST) From: =?utf-8?q?Alex_Benn=C3=A9e?= To: peter.maydell@linaro.org Date: Fri, 7 Jun 2019 10:05:08 +0100 Message-Id: <20190607090552.12434-10-alex.bennee@linaro.org> X-Mailer: git-send-email 2.20.1 In-Reply-To: <20190607090552.12434-1-alex.bennee@linaro.org> References: <20190607090552.12434-1-alex.bennee@linaro.org> MIME-Version: 1.0 X-detected-operating-system: by eggs.gnu.org: Genre and OS details not recognized. X-Received-From: 2a00:1450:4864:20::32f Subject: [Qemu-devel] [PULL 09/52] tests/vm: Port basevm to Python 3 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: Fam Zheng , =?utf-8?q?Alex_Benn=C3=A9e?= , =?utf-8?q?Philippe_Mathieu-Daud=C3=A9?= , qemu-devel@nongnu.org, Wainer dos Santos Moschetta Errors-To: qemu-devel-bounces+patch=linaro.org@nongnu.org Sender: "Qemu-devel" From: Wainer dos Santos Moschetta Fixed tests/vm/basevm.py to run with Python 3: - hashlib.sha1() requires an binary encoded object. - uses floor division ("//") (PEP 238). - decode bytes to unicode when needed. Signed-off-by: Wainer dos Santos Moschetta Reviewed-by: Philippe Mathieu-Daudé Message-Id: <20190329210804.22121-3-wainersm@redhat.com> Signed-off-by: Alex Bennée Tested-by: Philippe Mathieu-Daudé -- 2.20.1 diff --git a/tests/vm/basevm.py b/tests/vm/basevm.py index 0556bdcf9e..083befce9f 100755 --- a/tests/vm/basevm.py +++ b/tests/vm/basevm.py @@ -85,12 +85,12 @@ class BaseVM(object): if not sha256sum: return True checksum = subprocess.check_output(["sha256sum", fname]).split()[0] - return sha256sum == checksum + return sha256sum == checksum.decode() cache_dir = os.path.expanduser("~/.cache/qemu-vm/download") if not os.path.exists(cache_dir): os.makedirs(cache_dir) - fname = os.path.join(cache_dir, hashlib.sha1(url).hexdigest()) + fname = os.path.join(cache_dir, hashlib.sha1(url.encode()).hexdigest()) if os.path.exists(fname) and check_sha256sum(fname): return fname logging.debug("Downloading %s to %s...", url, fname) @@ -134,7 +134,7 @@ class BaseVM(object): raise NotImplementedError def add_source_dir(self, src_dir): - name = "data-" + hashlib.sha1(src_dir).hexdigest()[:5] + name = "data-" + hashlib.sha1(src_dir.encode()).hexdigest()[:5] tarfile = os.path.join(self._tmpdir, name + ".tar") logging.debug("Creating archive %s for src_dir dir: %s", tarfile, src_dir) subprocess.check_call(["./scripts/archive-source.sh", tarfile], @@ -204,7 +204,7 @@ def parse_args(vmcls): def get_default_jobs(): if kvm_available(vmcls.arch): - return multiprocessing.cpu_count() / 2 + return multiprocessing.cpu_count() // 2 else: return 1 From patchwork Fri Jun 7 09:05:09 2019 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 8bit X-Patchwork-Submitter: =?utf-8?q?Alex_Benn=C3=A9e?= X-Patchwork-Id: 166085 Delivered-To: patch@linaro.org Received: by 2002:a92:9e1a:0:0:0:0:0 with SMTP id q26csp387777ili; Fri, 7 Jun 2019 02:16:48 -0700 (PDT) X-Google-Smtp-Source: APXvYqx6gSFHkfSHKyjqki1YiSI3vUZenZYSfI7bQCdtpoKeUjxg+bG3+TBWnOKs/xjMMRMkQmwp X-Received: by 2002:ac8:2544:: with SMTP id 4mr43754685qtn.211.1559899008496; Fri, 07 Jun 2019 02:16:48 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1559899008; cv=none; d=google.com; s=arc-20160816; b=ltyB+VYTeFogbmTwA75Wr/eCnxJwO6fvH5vH0SBo2Z50pSDkGvhfdliA6mWUkQRRnR JwAO2pwy36AbEMT8wM0oqjaMzL+fPiBInw7Xm6F7o3FSx4DVaSdL2ZlCejsxBKgxaNJC 8CHrzAADeWrzQwvOqMaZY9sNhIpS/oZa7RyBlRSBpDqxq9jv+koj2vL0XWwc7phvW4mh iNw/g+q8XK5Im40fog9fu5UJq8hKKqyol0/LXQsB7NixQ7k8vGq3XUa7I+vtLG3kGDuk zok1JcP9JyVL2rA3mFFuSSJQQ/gf5XjnqlpZv/Q/LcR3xIPHAQB5zUFu6DYss3ve+SlH Hypg== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=sender:errors-to:cc:list-subscribe:list-help:list-post:list-archive :list-unsubscribe:list-id:precedence:subject :content-transfer-encoding:mime-version:references:in-reply-to :message-id:date:to:from:dkim-signature; bh=jMI2SGNeZLWPMTiphBl8d5qoJBryaOiVTeyWEFf0GRk=; b=opy3i8jszAO66nB7s1Osgd4s9NAUwzzgPZfNZ+T0crkKEfYLOnZzEGBoiAkRTIhJ6r zf7x7cK6WKWP/TiJy9WFJ8lwy6CswaSES0xaMTEzXBvtcrJJ7jGP3bPuNAfmIuI0uRE4 hWrZ8XI+uERHJSXWlzAzGfOUiAgI0SlLDh9Hn72UTYL85k01m2ei2mW4zgKOeNQFwfek ATD6qHsz6r7qNx9c/V53Jt2zvwCVbe2+3c6w0sCBc59T0AeZEAk34gxE2eGNg4Yq3e6L /36yHdJCNpB4ENKkV+VFSLc8TM/AmnzcBQxKQDIytoXMik/nG1Me7oJHzIq75NK1Q/zQ 5Feg== ARC-Authentication-Results: i=1; mx.google.com; dkim=fail header.i=@linaro.org header.s=google header.b=IjChq4jl; spf=pass (google.com: domain of qemu-devel-bounces+patch=linaro.org@nongnu.org designates 209.51.188.47 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.47]) by mx.google.com with ESMTPS id n25si773906qkg.264.2019.06.07.02.16.48 for (version=TLS1_2 cipher=ECDHE-RSA-CHACHA20-POLY1305 bits=256/256); Fri, 07 Jun 2019 02:16:48 -0700 (PDT) Received-SPF: pass (google.com: domain of qemu-devel-bounces+patch=linaro.org@nongnu.org designates 209.51.188.47 as permitted sender) client-ip=209.51.188.47; Authentication-Results: mx.google.com; dkim=fail header.i=@linaro.org header.s=google header.b=IjChq4jl; spf=pass (google.com: domain of qemu-devel-bounces+patch=linaro.org@nongnu.org designates 209.51.188.47 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]:47390 helo=lists.gnu.org) by lists.gnu.org with esmtp (Exim 4.86_2) (envelope-from ) id 1hZAzQ-00057E-2e for patch@linaro.org; Fri, 07 Jun 2019 05:16:48 -0400 Received: from eggs.gnu.org ([2001:470:142:3::10]:39400) by lists.gnu.org with esmtp (Exim 4.86_2) (envelope-from ) id 1hZAp1-00048Q-T0 for qemu-devel@nongnu.org; Fri, 07 Jun 2019 05:06:05 -0400 Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71) (envelope-from ) id 1hZAp0-0004Qj-37 for qemu-devel@nongnu.org; Fri, 07 Jun 2019 05:06:03 -0400 Received: from mail-wr1-x435.google.com ([2a00:1450:4864:20::435]:37434) by eggs.gnu.org with esmtps (TLS1.0:RSA_AES_128_CBC_SHA1:16) (Exim 4.71) (envelope-from ) id 1hZAoz-0004KG-Nk for qemu-devel@nongnu.org; Fri, 07 Jun 2019 05:06:01 -0400 Received: by mail-wr1-x435.google.com with SMTP id v14so1350003wrr.4 for ; Fri, 07 Jun 2019 02:06:01 -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=jMI2SGNeZLWPMTiphBl8d5qoJBryaOiVTeyWEFf0GRk=; b=IjChq4jlAKRwvAQredZdjoabtSchtttqVsl0Qj+mYjguYu7xjuiJoGUZe7O2rmqcmZ EyYwlQOTOMy+JWg7QZ6piVE1sQLBnS9Fj9QtO4Ryfzp1ApwnsaUVHWEZVFv2rgnYA5/I X/eaN5a6L3BqG5FBNJ3SFyXS3LkjyjlKAq77LGNeEakaFiYmqJjM+j0bcC519NopcBeg NcX+WhAEpZW/Rdwj03qADNsKFenNohWSNnw7rncP/UTgjQnUsMyjBRZXkTtLUoQJ3HCD /J160FpaWI5hSvQB+WBEc0lW+DX1R7fGn4NHEtrd5PEb9Kf1bOAP1+8IvS+hOUiAT+z4 qBJQ== 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=jMI2SGNeZLWPMTiphBl8d5qoJBryaOiVTeyWEFf0GRk=; b=ZtU6KcCWiMdJyRAE1vTVQsxojkjw9WzuI6G15gb6oqMSc0hqzfqGbtAxhuORUXP7Pj dXNFlBV6tpTvVvmNN2L3yygIqnAtbRnyvBvZJsR+LOAKq1AYviBuO604JyNjaYSrCiS3 XIucAYRBbuVfc4IltCDPrbg1XrJyT9yKT3aNYIXnKths4Lncpe1GCiV+jR6kV+zw+yYs bQq8Cc7Tx1LRfcfYOLTF/JuPbW+pcfXjZvoEk3M9T+4xcVG0Z5pawarRpq2TG3sbbfS/ 3waKVkxl9kzH9Orknv34Y3+Jl4UuDRsXzZP0rZPhzCLWPa8gnUT0WD4HG+XqIl5i/gvX +Skg== X-Gm-Message-State: APjAAAVozcKnPzltewOByyYIZHmeaLlf3RIV1+XkEX7hkjbduuQ6fAlI v/ltYuUR2DvrtCIEnJoesc9LIg== X-Received: by 2002:a05:6000:cf:: with SMTP id q15mr1677853wrx.52.1559898359991; Fri, 07 Jun 2019 02:05:59 -0700 (PDT) Received: from zen.linaroharston ([81.128.185.34]) by smtp.gmail.com with ESMTPSA id u5sm1515236wmc.32.2019.06.07.02.05.54 (version=TLS1_3 cipher=AEAD-AES256-GCM-SHA384 bits=256/256); Fri, 07 Jun 2019 02:05:57 -0700 (PDT) Received: from zen.linaroharston. (localhost [127.0.0.1]) by zen.linaroharston (Postfix) with ESMTP id C8D5C1FF9A; Fri, 7 Jun 2019 10:05:52 +0100 (BST) From: =?utf-8?q?Alex_Benn=C3=A9e?= To: peter.maydell@linaro.org Date: Fri, 7 Jun 2019 10:05:09 +0100 Message-Id: <20190607090552.12434-11-alex.bennee@linaro.org> X-Mailer: git-send-email 2.20.1 In-Reply-To: <20190607090552.12434-1-alex.bennee@linaro.org> References: <20190607090552.12434-1-alex.bennee@linaro.org> MIME-Version: 1.0 X-detected-operating-system: by eggs.gnu.org: Genre and OS details not recognized. X-Received-From: 2a00:1450:4864:20::435 Subject: [Qemu-devel] [PULL 10/52] tests/vm: Fix build-centos docker-based tests run 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: Fam Zheng , =?utf-8?q?Philippe_Mathieu-Daud=C3=A9?= , =?utf-8?q?Alex_Benn=C3=A9e?= , qemu-devel@nongnu.org, Wainer dos Santos Moschetta Errors-To: qemu-devel-bounces+patch=linaro.org@nongnu.org Sender: "Qemu-devel" From: Wainer dos Santos Moschetta `make vm-build-centos` run docker-based tests on CentOS. The created containers should have network otherwise some tests fail. Also fixed the BUILD_SCRIPT template to correctly evaluate "V=1" for verbose output. Signed-off-by: Wainer dos Santos Moschetta Message-Id: <20190329210804.22121-5-wainersm@redhat.com> Signed-off-by: Alex Bennée -- 2.20.1 diff --git a/tests/vm/centos b/tests/vm/centos index ba133ea429..7417b50af4 100755 --- a/tests/vm/centos +++ b/tests/vm/centos @@ -26,9 +26,9 @@ class CentosVM(basevm.BaseVM): export SRC_ARCHIVE=/dev/vdb; sudo chmod a+r $SRC_ARCHIVE; tar -xf $SRC_ARCHIVE; - make docker-test-block@centos7 V={verbose} J={jobs}; - make docker-test-quick@centos7 V={verbose} J={jobs}; - make docker-test-mingw@fedora V={verbose} J={jobs}; + make docker-test-block@centos7 {verbose} J={jobs} NETWORK=1; + make docker-test-quick@centos7 {verbose} J={jobs} NETWORK=1; + make docker-test-mingw@fedora {verbose} J={jobs} NETWORK=1; """ def _gen_cloud_init_iso(self): From patchwork Fri Jun 7 09:05:10 2019 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 8bit X-Patchwork-Submitter: =?utf-8?q?Alex_Benn=C3=A9e?= X-Patchwork-Id: 166087 Delivered-To: patch@linaro.org Received: by 2002:a92:9e1a:0:0:0:0:0 with SMTP id q26csp389506ili; Fri, 7 Jun 2019 02:18:53 -0700 (PDT) X-Google-Smtp-Source: APXvYqxma8YzZTeOnorFv4a7s/zpby04+t2HEoxqor2K2+KGzV6KgEJJczMjK1D9pqCF1NzQDmM6 X-Received: by 2002:a0c:8b6f:: with SMTP id d47mr42206416qvc.32.1559899133105; Fri, 07 Jun 2019 02:18:53 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1559899133; cv=none; d=google.com; s=arc-20160816; b=0aL5e0DKiuDu19znUbHiwyWuo7pIChB57LXY/lTF/EnNlBzeoMxun6k4A16+c9kRFB XFNJWJEG3UtEsKqYh4Pc6D2SNHZ6kHnP9xfZ0amEsD7WhsO/IaAa/UjBgfZshLbdwWGU v/1SRjhXWmqy96gAIH2+nskaTbyesjjLKnu0XSQsthsBeRGx8cg0r70uhDKlA5DeAT+U vg9/FP7m2l6dlG4Sd5TVFQOpCiBwxQic+NOpF3PrWv4I7MS0COlmEFT7n//NTjC7rWe3 9oVURw2hJtP1JP6eQSpuDXhuF9h4oDomsYdgVRNkl+q7CDU+j3/AltDkgAajvx/16KOz FoOg== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=sender:errors-to:cc:list-subscribe:list-help:list-post:list-archive :list-unsubscribe:list-id:precedence:subject :content-transfer-encoding:mime-version:references:in-reply-to :message-id:date:to:from:dkim-signature; bh=7WvYOUS4wxrAh1bmzV9VJwvouE7jKXGGzDv4QIMUl7o=; b=ARjY1oBTdD7yzOOHrVykNSumKCfgyPjDGvEXCOnFgv3wF5Txrm+Ww4TK2Gy4DZAU00 xKheLkxNoJG/t7Yrk21mYANHbOGeoR+HNvA51asMOFCAQCyVn+YR+nvO99TUdjIgqBbz Wx2AUcSn+6E8tkFS7vVWzyHEbq2LskqDmgRNmSH0CO8e1MNhbBqAYn8IkAI0siVRY8Wt CKGuIEQcx01um/B8RaAz7zCp6Gc7N+fFpoacuCL8rynymp5fFE+z31PwECN2nNK84fv5 +XfRTyJXGPidiggI5NY3JkXM4zbcPB+aZZsX5erhS112WXxpJ2sY4o4kZul12FF0cgQj N/4g== ARC-Authentication-Results: i=1; mx.google.com; dkim=fail header.i=@linaro.org header.s=google header.b=AuZhySan; spf=pass (google.com: domain of qemu-devel-bounces+patch=linaro.org@nongnu.org designates 209.51.188.47 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.47]) by mx.google.com with ESMTPS id l12si594675qtl.231.2019.06.07.02.18.53 for (version=TLS1_2 cipher=ECDHE-RSA-CHACHA20-POLY1305 bits=256/256); Fri, 07 Jun 2019 02:18:53 -0700 (PDT) Received-SPF: pass (google.com: domain of qemu-devel-bounces+patch=linaro.org@nongnu.org designates 209.51.188.47 as permitted sender) client-ip=209.51.188.47; Authentication-Results: mx.google.com; dkim=fail header.i=@linaro.org header.s=google header.b=AuZhySan; spf=pass (google.com: domain of qemu-devel-bounces+patch=linaro.org@nongnu.org designates 209.51.188.47 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]:47406 helo=lists.gnu.org) by lists.gnu.org with esmtp (Exim 4.86_2) (envelope-from ) id 1hZB1Q-0006Nk-M2 for patch@linaro.org; Fri, 07 Jun 2019 05:18:52 -0400 Received: from eggs.gnu.org ([2001:470:142:3::10]:39451) by lists.gnu.org with esmtp (Exim 4.86_2) (envelope-from ) id 1hZAp5-00049Q-Bj for qemu-devel@nongnu.org; Fri, 07 Jun 2019 05:06:08 -0400 Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71) (envelope-from ) id 1hZAp2-0004ZE-1x for qemu-devel@nongnu.org; Fri, 07 Jun 2019 05:06:05 -0400 Received: from mail-wr1-x42e.google.com ([2a00:1450:4864:20::42e]:45939) by eggs.gnu.org with esmtps (TLS1.0:RSA_AES_128_CBC_SHA1:16) (Exim 4.71) (envelope-from ) id 1hZAp1-0004QR-MT for qemu-devel@nongnu.org; Fri, 07 Jun 2019 05:06:03 -0400 Received: by mail-wr1-x42e.google.com with SMTP id f9so1329429wre.12 for ; Fri, 07 Jun 2019 02:06:02 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=linaro.org; s=google; h=from:to:cc:subject:date:message-id:in-reply-to:references :mime-version:content-transfer-encoding; bh=7WvYOUS4wxrAh1bmzV9VJwvouE7jKXGGzDv4QIMUl7o=; b=AuZhySanN0DuKNNoWuawG1yC3v+/0sU9fq0vp/OpGHXyXCylI8xUBGQPI+xc78c07e wxXmh5AmId+sCBXrAkOWFzkCYXs10VrVCZbn7rkK3LCN0dOn3Q5fvDyN1Bs1+n0wbIEE jURxIa6jxKmqaufRV2VcRLJ3E8MQDgwva5ynEGtKY2LUFae4El0ckpgRQufPi1HCMcfY 87AApnXe/qXnGdRoLYZVOTd9uowuUSjzOAXTDGlPtCspRcJfWEL6DDuwGLfu9lw8HjqS O2FMhML6ycNwJIz6/jjEh5WAitjP+o33LHIZlYu23O3yQHVJtpvr0gykhWCSvtUByCjo lslg== 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=7WvYOUS4wxrAh1bmzV9VJwvouE7jKXGGzDv4QIMUl7o=; b=YDLG1kcLctB9DLBvF8UZ+9Ftyu1z5LU6ciVmP83rd0ZJDspetJUhfFZq461pLisvad WapsRUo7lvBS9BmyodrgCsoovrzQ5HTjDQ0lOnPjXZLnO1w4t8XHdBdm+//ftLHS9XJx cTZ1HBZ6m4xUCez7FWz7Maf/MNZ32J7MKsTMwr8/JJLnod7vnz2CclWilmmzlinldsiu BfD7CrjQe2a710wgnCMlmEtmCEtYjpGL2Ln1Iw+NfomDADFb0a0DGf/vdSR6Pf2/wzsL r77brKglJQK2McTp81jsjnZLxVeBaJuK08fKI8CwOzVY6PVp+CIhMBrPEKlquWBJhe5j Jelg== X-Gm-Message-State: APjAAAWaIzke28D7cMALxgN3efagHWymbm300Q/Pp4MAXPeeERbvn4M2 McXQTIX3Q8LYy8t2kAY/Q5nS136B6bE= X-Received: by 2002:adf:e309:: with SMTP id b9mr729345wrj.135.1559898361592; Fri, 07 Jun 2019 02:06:01 -0700 (PDT) Received: from zen.linaroharston ([81.128.185.34]) by smtp.gmail.com with ESMTPSA id m17sm1328261wrx.12.2019.06.07.02.05.55 (version=TLS1_3 cipher=AEAD-AES256-GCM-SHA384 bits=256/256); Fri, 07 Jun 2019 02:05:57 -0700 (PDT) Received: from zen.linaroharston. (localhost [127.0.0.1]) by zen.linaroharston (Postfix) with ESMTP id DBAB91FF9B; Fri, 7 Jun 2019 10:05:52 +0100 (BST) From: =?utf-8?q?Alex_Benn=C3=A9e?= To: peter.maydell@linaro.org Date: Fri, 7 Jun 2019 10:05:10 +0100 Message-Id: <20190607090552.12434-12-alex.bennee@linaro.org> X-Mailer: git-send-email 2.20.1 In-Reply-To: <20190607090552.12434-1-alex.bennee@linaro.org> References: <20190607090552.12434-1-alex.bennee@linaro.org> MIME-Version: 1.0 X-detected-operating-system: by eggs.gnu.org: Genre and OS details not recognized. X-Received-From: 2a00:1450:4864:20::42e Subject: [Qemu-devel] [PULL 11/52] tests/vm: Add missing variables on help 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: Fam Zheng , =?utf-8?q?Philippe_Mathieu-Daud=C3=A9?= , =?utf-8?q?Alex_Benn=C3=A9e?= , qemu-devel@nongnu.org, Wainer dos Santos Moschetta Errors-To: qemu-devel-bounces+patch=linaro.org@nongnu.org Sender: "Qemu-devel" From: Wainer dos Santos Moschetta Added description of variables missing on vm-test help. Signed-off-by: Wainer dos Santos Moschetta Message-Id: <20190329210804.22121-6-wainersm@redhat.com> Signed-off-by: Alex Bennée Reviewed-by: Philippe Mathieu-Daudé Tested-by: Philippe Mathieu-Daudé -- 2.20.1 diff --git a/tests/vm/Makefile.include b/tests/vm/Makefile.include index 6f82676306..c59411bee0 100644 --- a/tests/vm/Makefile.include +++ b/tests/vm/Makefile.include @@ -21,9 +21,13 @@ vm-test: @echo " vm-clean-all - Clean up VM images" @echo @echo "Special variables:" - @echo " BUILD_TARGET=foo - override the build target" - @echo " TARGET_LIST=a,b,c - Override target list in builds." + @echo " BUILD_TARGET=foo - Override the build target" + @echo " TARGET_LIST=a,b,c - Override target list in builds" @echo ' EXTRA_CONFIGURE_OPTS="..."' + @echo " J=[0..9]* - Override the -jN parameter for make commands" + @echo " DEBUG=1 - Enable verbose output on host and interactive debugging" + @echo " V=1 - Enable verbose ouput on host and guest commands" + @echo " QEMU=/path/to/qemu - Change path to QEMU binary" vm-build-all: $(addprefix vm-build-, $(IMAGES)) From patchwork Fri Jun 7 09:05:11 2019 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 8bit X-Patchwork-Submitter: =?utf-8?q?Alex_Benn=C3=A9e?= X-Patchwork-Id: 166142 Delivered-To: patch@linaro.org Received: by 2002:a92:9e1a:0:0:0:0:0 with SMTP id q26csp475028ili; Fri, 7 Jun 2019 03:52:30 -0700 (PDT) X-Google-Smtp-Source: APXvYqzXNorRa9+2u9ON8s1rtz3EpMJXevCBt7MKRXc8oEA7tyBpVSZiq57KFmraoJxyQpv6f2Hr X-Received: by 2002:a05:620a:12f8:: with SMTP id f24mr23543587qkl.202.1559904750053; Fri, 07 Jun 2019 03:52:30 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1559904750; cv=none; d=google.com; s=arc-20160816; b=MHy015E6qQiF2tSQ1DKOXLwc3KkGeru8A+J1lf6h5zh9/zU+/gYV8Br2q9emzGB2Rl t+229r93vOA9YZ8ft6gjqUAx8v5ivGdVznQAod3UC3ANjlsb1mtzPke7drLiuN1j966K 0UvfaNcsg9BFpcE8OgrFKnnJM4OMyHolVkumOXD4cgrtZiJzj/UOJbTaWTRgAZ8OZVFG RF+wuywRHv/0cSv6l1DWLWau4klMY4XaKpogz5qNyFZncIVgQInSb2J/5j/GoNG78JAn yKH5Taygu7BT35JbWvuxsYAgmo0EljsH0unugle6w27cHBT6Zr8MwwkMovKCohQdKPvF f4XA== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=sender:errors-to:cc:list-subscribe:list-help:list-post:list-archive :list-unsubscribe:list-id:precedence:subject :content-transfer-encoding:mime-version:references:in-reply-to :message-id:date:to:from:dkim-signature; bh=oJrbPHU6QMM17Z/P//VMEjEn9UEe0UK4q9allOg3/go=; b=drUObn2SxQSKskpyOR/reADEjr54NIwUJG2PQUbjwZQy9euaOq4e1MjgYpcXvjK1Uu GH/n09i6+lXLzRnGvgNTR/rdHdFwfnjOH+yVvRuH1MdJnKdevlIAYZPqhbkPtfaANNZA QZf1MV9a5OaNjtixJEUb6ECUm3OCBMviZ8L8v6WFT8zIgFLOHcmtGOwz7F6OzgSQ4Lz5 fwURHCFZ2yho7LoIKi0oXQv2hDKW25CZOJOqy33vOQjZ4wNwhgYghePK1qn70VKpE8Y5 VtgUetlOyq0JS2b49EPSqWY3bl3/BOHh0RXxzUO4VIw/P0LJxRmM2ZVmShsWQjsaGrPA WDrQ== ARC-Authentication-Results: i=1; mx.google.com; dkim=fail header.i=@linaro.org header.s=google header.b=aEuG+GzN; spf=pass (google.com: domain of qemu-devel-bounces+patch=linaro.org@nongnu.org designates 209.51.188.47 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.47]) by mx.google.com with ESMTPS id g17si1001272qto.189.2019.06.07.03.52.29 for (version=TLS1_2 cipher=ECDHE-RSA-CHACHA20-POLY1305 bits=256/256); Fri, 07 Jun 2019 03:52:30 -0700 (PDT) Received-SPF: pass (google.com: domain of qemu-devel-bounces+patch=linaro.org@nongnu.org designates 209.51.188.47 as permitted sender) client-ip=209.51.188.47; Authentication-Results: mx.google.com; dkim=fail header.i=@linaro.org header.s=google header.b=aEuG+GzN; spf=pass (google.com: domain of qemu-devel-bounces+patch=linaro.org@nongnu.org designates 209.51.188.47 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]:48272 helo=lists.gnu.org) by lists.gnu.org with esmtp (Exim 4.86_2) (envelope-from ) id 1hZCU1-0006To-KV for patch@linaro.org; Fri, 07 Jun 2019 06:52:29 -0400 Received: from eggs.gnu.org ([2001:470:142:3::10]:50991) by lists.gnu.org with esmtp (Exim 4.86_2) (envelope-from ) id 1hZBOM-0007e4-Ai for qemu-devel@nongnu.org; Fri, 07 Jun 2019 05:42:35 -0400 Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71) (envelope-from ) id 1hZBOK-0000pO-G7 for qemu-devel@nongnu.org; Fri, 07 Jun 2019 05:42:34 -0400 Received: from mail-wr1-x42c.google.com ([2a00:1450:4864:20::42c]:36569) by eggs.gnu.org with esmtps (TLS1.0:RSA_AES_128_CBC_SHA1:16) (Exim 4.71) (envelope-from ) id 1hZBOK-0000lE-8j for qemu-devel@nongnu.org; Fri, 07 Jun 2019 05:42:32 -0400 Received: by mail-wr1-x42c.google.com with SMTP id n4so1476650wrs.3 for ; Fri, 07 Jun 2019 02:42:30 -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=oJrbPHU6QMM17Z/P//VMEjEn9UEe0UK4q9allOg3/go=; b=aEuG+GzNMS4QTFB6KF60Z6oNGIGC5YokL7OlScAPDZ1vFIpphysthLUMfyt3CUp9ha 72G3QpoEfhmjpxwxyvGU8zkZNOpBscbf4yI5vAHBXE8CgKPhJlGAh0e1MNV3nNYvVhR9 jfNMmTwf3QRKLyDWaSWWEbSjFIEF6zmKSZq8nkikJLCwURHbiPTHX+8JYfvFL8thLwE3 MmyAwbcLwWl8iRQEt1t57BC5eB/eKgkCSAoSDqU+EKHcqf5I2p1H7ZYmMyFhLIcXQbM1 jn7HNakEdNSu2RMABuJxvR+ydO00izMXZ5r1613ALvYMacptQbXX4H9GbmpS/lFOAxxc qiTA== 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=oJrbPHU6QMM17Z/P//VMEjEn9UEe0UK4q9allOg3/go=; b=iC15ZwkUY6kwL5WY2RmmfsAVcM6x47v7y02lAIHZEx8CTLevPIMwPdqp6/ZK3mOz/l 4Wc7xcaSfr7RIGuVQVbjTdvmT6Qv3ZmbTdu395TrjdmZt+W8N03Uanzel099WO1CrDfd MxMkIAT2n76MDQbt/TyCxFEVbkd/Vzj7Hg8676b1vFmOMicCUBP3K+zPaSyYa9a/z/e5 4xGP8AAUr9vpP3Nfw7guGzPUlULSPHIz8fKMiHoP2elUDspPnmLYH1MKccMMrvZRdXUg eJTcKv54ekIbhF/TY9j+1kX0zhwsFHbj0N5vEAed5fleoI0Ty19ycr+XqIIiy8ZTfscC QovQ== X-Gm-Message-State: APjAAAUK/xj98VNQYyptqKw7V9uF0NZmv9J5PI9cDwUGGluDNMxunjlE 4PbTjySXuD2+Cd2sUKt25rzzvA== X-Received: by 2002:a5d:6583:: with SMTP id q3mr35571326wru.184.1559900549537; Fri, 07 Jun 2019 02:42:29 -0700 (PDT) Received: from zen.linaroharston ([81.128.185.34]) by smtp.gmail.com with ESMTPSA id k184sm2078868wmk.0.2019.06.07.02.42.28 (version=TLS1_3 cipher=AEAD-AES256-GCM-SHA384 bits=256/256); Fri, 07 Jun 2019 02:42:28 -0700 (PDT) Received: from zen.linaroharston. (localhost [127.0.0.1]) by zen.linaroharston (Postfix) with ESMTP id EEA631FF9C; Fri, 7 Jun 2019 10:05:52 +0100 (BST) From: =?utf-8?q?Alex_Benn=C3=A9e?= To: peter.maydell@linaro.org Date: Fri, 7 Jun 2019 10:05:11 +0100 Message-Id: <20190607090552.12434-13-alex.bennee@linaro.org> X-Mailer: git-send-email 2.20.1 In-Reply-To: <20190607090552.12434-1-alex.bennee@linaro.org> References: <20190607090552.12434-1-alex.bennee@linaro.org> MIME-Version: 1.0 X-detected-operating-system: by eggs.gnu.org: Genre and OS details not recognized. X-Received-From: 2a00:1450:4864:20::42c Subject: [Qemu-devel] [PULL 12/52] scripts: use git archive in archive-source 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: Fam Zheng , Thomas Huth , =?utf-8?q?Philippe_Mathieu-Daud=C3=A9?= , qemu-devel@nongnu.org, Gerd Hoffmann , =?utf-8?q?Alex_Benn=C3=A9e?= Errors-To: qemu-devel-bounces+patch=linaro.org@nongnu.org Sender: "Qemu-devel" From: Gerd Hoffmann Use git archive to create tarballs of qemu and submodules instead of cloning the repository and the submodules. This is a order of magnitude faster because it doesn't fetch the submodules from the internet each time the script runs. Signed-off-by: Gerd Hoffmann Tested-by: Thomas Huth Tested-by: Philippe Mathieu-Daudé Message-Id: <20190520124716.30472-2-kraxel@redhat.com> [AJB: fixed up tabs] Signed-off-by: Alex Bennée -- 2.20.1 diff --git a/scripts/archive-source.sh b/scripts/archive-source.sh index 8b89948260..ca94e49978 100755 --- a/scripts/archive-source.sh +++ b/scripts/archive-source.sh @@ -19,16 +19,25 @@ if test $# -lt 1; then fi tar_file=$(realpath "$1") -list_file="${tar_file}.list" -vroot_dir="${tar_file}.vroot" +sub_tdir=$(mktemp -d "${tar_file%.tar}.sub.XXXXXXXX") +sub_file="${sub_tdir}/submodule.tar" # We want a predictable list of submodules for builds, that is # independent of what the developer currently has initialized # in their checkout, because the build environment is completely # different to the host OS. submodules="dtc slirp ui/keycodemapdb tests/fp/berkeley-softfloat-3 tests/fp/berkeley-testfloat-3" +sub_deinit="" -trap "status=$?; rm -rf \"$list_file\" \"$vroot_dir\"; exit \$status" 0 1 2 3 15 +function cleanup() { + local status=$? + rm -rf "$sub_tdir" + if test "$sub_deinit" != ""; then + git submodule deinit $sub_deinit + fi + exit $status +} +trap "cleanup" 0 1 2 3 15 if git diff-index --quiet HEAD -- &>/dev/null then @@ -36,45 +45,26 @@ then else HEAD=$(git stash create) fi -git clone --shared . "$vroot_dir" -test $? -ne 0 && error "failed to clone into '$vroot_dir'" -for sm in $submodules; do - if test -d "$sm/.git" - then - git clone --shared "$sm" "$vroot_dir/$sm" - test $? -ne 0 && error "failed to clone submodule $sm" - fi -done - -cd "$vroot_dir" -test $? -ne 0 && error "failed to change into '$vroot_dir'" - -git checkout $HEAD -test $? -ne 0 && error "failed to checkout $HEAD revision" +git archive --format tar $HEAD > "$tar_file" +test $? -ne 0 && error "failed to archive qemu" for sm in $submodules; do - git submodule update --init $sm - test $? -ne 0 && error "failed to init submodule $sm" + status="$(git submodule status "$sm")" + smhash="${status#[ +-]}" + smhash="${smhash%% *}" + case "$status" in + -*) + sub_deinit="$sub_deinit $sm" + git submodule update --init "$sm" + test $? -ne 0 && error "failed to update submodule $sm" + ;; + +*) + echo "WARNING: submodule $sm is out of sync" + ;; + esac + (cd $sm; git archive --format tar --prefix "$sm/" $smhash) > "$sub_file" + test $? -ne 0 && error "failed to archive submodule $sm ($smhash)" + tar --concatenate --file "$tar_file" "$sub_file" + test $? -ne 0 && error "failed append submodule $sm to $tar_file" done - -if test -n "$submodules"; then - { - git ls-files || error "git ls-files failed" - for sm in $submodules; do - (cd $sm; git ls-files) | sed "s:^:$sm/:" - if test "${PIPESTATUS[*]}" != "0 0"; then - error "git ls-files in submodule $sm failed" - fi - done - } | grep -x -v $(for sm in $submodules; do echo "-e $sm"; done) > "$list_file" -else - git ls-files > "$list_file" -fi - -if test $? -ne 0; then - error "failed to generate list file" -fi - -tar -cf "$tar_file" -T "$list_file" || error "failed to create tar file" - exit 0 From patchwork Fri Jun 7 09:05:12 2019 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 8bit X-Patchwork-Submitter: =?utf-8?q?Alex_Benn=C3=A9e?= X-Patchwork-Id: 166111 Delivered-To: patch@linaro.org Received: by 2002:a92:9e1a:0:0:0:0:0 with SMTP id q26csp423206ili; Fri, 7 Jun 2019 02:59:26 -0700 (PDT) X-Google-Smtp-Source: APXvYqzIHe/H2t68RAAK8rgMGaFuID2Emzi4ay1dQM1YJHO6rhwmXRKncASgGV4MAgmFtrLpOMS0 X-Received: by 2002:a0c:984a:: with SMTP id e10mr23847859qvd.57.1559901566104; Fri, 07 Jun 2019 02:59:26 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1559901566; cv=none; d=google.com; s=arc-20160816; b=jwdELjIRuHmoqhJRMKgyuyZ/5LfsvQjnKpZblTxzDuCl94Ugv2UHeslPdkSr0eMZyL UgaAORxC+7kyMRjp7xuzhDNLmBueA7vvAD4MYZE2SvIPyD7utOpnrjlpfVUdiubRuQD2 FEgcP1QuPs6r0402qp3m/4aDKnmNLjzsd76HvXIsbfSdEixbt2ryHbwD7uD9R80o5sQE huSA5qBJRjcUINR4tWlTM76sBRYxMaJnwYTW4nhaCL12epnzTM+U6PThOC/j7MFXRfds xilSdbuRV/KLF/7yu68elLnlfUHtnyvs7a7AWan3aDyyTwFQ9r9K2l/+VIlL30wLyb1o fBEA== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=sender:errors-to:cc:list-subscribe:list-help:list-post:list-archive :list-unsubscribe:list-id:precedence:subject :content-transfer-encoding:mime-version:references:in-reply-to :message-id:date:to:from:dkim-signature; bh=OhQM4ORyyZtDRv68wtOcg3+xNW2e7yr94fMwCAempbk=; b=BjbNPruabnE+GU8zCH0Pl2i5PqmIEJl5/7+4HEfWhw861TqfhDTYRia+7H6JvFIpu7 yy7w0+MlMMUpocfxfzPAmwkSpYT5xS1GPHMjI2Sg2F0Vh6e0UR90sgxzO2zZepW/uoo4 fHNc2ilsiwly3TNfToZXqe+CJs2v3vJS6eFCHN7hrGR/CFEJI3f4MU60Gx+xQKMbwz3b 6NOrYODUYJ11OzO6XTvqZ0bDvTgxaV3xQz914+F7p6w0BXaTtgC7uRstC0iwQVtIsNgg L0Q79jYpLClZJw4YBFo2JLYRRqN5FIdyFgxpfPfAdaK3LE56H2/U7miJcNjIl23XPT+l qoeg== ARC-Authentication-Results: i=1; mx.google.com; dkim=fail header.i=@linaro.org header.s=google header.b=UMd1PW81; spf=pass (google.com: domain of qemu-devel-bounces+patch=linaro.org@nongnu.org designates 209.51.188.47 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.47]) by mx.google.com with ESMTPS id z35si999536qth.335.2019.06.07.02.59.26 for (version=TLS1_2 cipher=ECDHE-RSA-CHACHA20-POLY1305 bits=256/256); Fri, 07 Jun 2019 02:59:26 -0700 (PDT) Received-SPF: pass (google.com: domain of qemu-devel-bounces+patch=linaro.org@nongnu.org designates 209.51.188.47 as permitted sender) client-ip=209.51.188.47; Authentication-Results: mx.google.com; dkim=fail header.i=@linaro.org header.s=google header.b=UMd1PW81; spf=pass (google.com: domain of qemu-devel-bounces+patch=linaro.org@nongnu.org designates 209.51.188.47 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]:47706 helo=lists.gnu.org) by lists.gnu.org with esmtp (Exim 4.86_2) (envelope-from ) id 1hZBef-0007d9-K5 for patch@linaro.org; Fri, 07 Jun 2019 05:59:25 -0400 Received: from eggs.gnu.org ([2001:470:142:3::10]:42203) by lists.gnu.org with esmtp (Exim 4.86_2) (envelope-from ) id 1hZAvT-0002FZ-Ak for qemu-devel@nongnu.org; Fri, 07 Jun 2019 05:12:45 -0400 Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71) (envelope-from ) id 1hZAvQ-0004z0-P7 for qemu-devel@nongnu.org; Fri, 07 Jun 2019 05:12:43 -0400 Received: from mail-wm1-x342.google.com ([2a00:1450:4864:20::342]:36633) by eggs.gnu.org with esmtps (TLS1.0:RSA_AES_128_CBC_SHA1:16) (Exim 4.71) (envelope-from ) id 1hZAvQ-0004py-Dg for qemu-devel@nongnu.org; Fri, 07 Jun 2019 05:12:40 -0400 Received: by mail-wm1-x342.google.com with SMTP id u8so1159985wmm.1 for ; Fri, 07 Jun 2019 02:12:37 -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=OhQM4ORyyZtDRv68wtOcg3+xNW2e7yr94fMwCAempbk=; b=UMd1PW81Nj/a3TRplm/lgKp2JXzvoHSJjTtZll+c7phGlQWKWg5mwWODsWvI8+kmDL IVHMaE9yVLb3cnlOZODLztG3EBldrEDme4wzEaQ6RetdQB3ATrDs8fiX4V74uRIHRQE0 xeDWyFzu8EUy+3VUQlgO19fHB25paTllhKVcUW0B7Gy9n9RMHMb3ExApVE/s9Pi84O/k eiSEk/o+oYhx9bGWDgw6+7R9+FJ25/mbhs0umEPjRB/hJGn6/nZprASBU9zzmmgMLNxf nBrwr1IBKPLeXIGEs3irxDU/JD2l3JZcbEpl5BX4xsuWbHXHZJBlNhAL1asmwwq91I5f Cucg== 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=OhQM4ORyyZtDRv68wtOcg3+xNW2e7yr94fMwCAempbk=; b=DA3MzbaPsaMlAFZI+5j6xevFJ5uOu90sRUB4KMdfZ74Tmy+0xDx6Ty2cVAwn9zcqPk A+6zgfeV3FZ3Cy1wkVFYHdqGw4kbym2dOP9cYhqr3HKG8/RicouxdobG6OBnaxy9NFCw 3mEN7NQDbBHkrzK/BtBnIjrBpeh621lChGMVZEo6W5qFtXDQb+Uee2utX9WlNqifOO5W I0JwRmuAilA5zGxAmR309UunXoVSj9bSl1Dqil+SzxXBW8AYkXbO+E1bdjq9HSR9hN7d qwK9cDOaga1SxNIfLD0xK/r/AZYVvjMTud+aNXTb22RvT1g7m2SXlgjvX4VpLMXdNdCr hh0Q== X-Gm-Message-State: APjAAAWqUVjfrEuv6SoyUvw2AKwLgkFBhjoHzm0lPR8k3xqhpDB4w5lX cMSVKh7PAEdYuh8JGj0Ro8LZAA== X-Received: by 2002:a1c:5412:: with SMTP id i18mr2798141wmb.11.1559898756112; Fri, 07 Jun 2019 02:12:36 -0700 (PDT) Received: from zen.linaroharston ([81.128.185.34]) by smtp.gmail.com with ESMTPSA id k13sm1066954wmj.10.2019.06.07.02.12.30 (version=TLS1_3 cipher=AEAD-AES256-GCM-SHA384 bits=256/256); Fri, 07 Jun 2019 02:12:32 -0700 (PDT) Received: from zen.linaroharston. (localhost [127.0.0.1]) by zen.linaroharston (Postfix) with ESMTP id 0E0901FF87; Fri, 7 Jun 2019 10:05:53 +0100 (BST) From: =?utf-8?q?Alex_Benn=C3=A9e?= To: peter.maydell@linaro.org Date: Fri, 7 Jun 2019 10:05:12 +0100 Message-Id: <20190607090552.12434-14-alex.bennee@linaro.org> X-Mailer: git-send-email 2.20.1 In-Reply-To: <20190607090552.12434-1-alex.bennee@linaro.org> References: <20190607090552.12434-1-alex.bennee@linaro.org> MIME-Version: 1.0 X-detected-operating-system: by eggs.gnu.org: Genre and OS details not recognized. X-Received-From: 2a00:1450:4864:20::342 Subject: [Qemu-devel] [PULL 13/52] tests/vm: python3 fixes 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: Fam Zheng , =?utf-8?q?Alex_Benn=C3=A9e?= , =?utf-8?q?Philippe_Mathieu-Daud=C3=A9?= , qemu-devel@nongnu.org, Gerd Hoffmann Errors-To: qemu-devel-bounces+patch=linaro.org@nongnu.org Sender: "Qemu-devel" From: Gerd Hoffmann Add proper unicode handling when processing strings. Also need to explicitly say we want int not float. Signed-off-by: Gerd Hoffmann Reviewed-by: Philippe Mathieu-Daudé Tested-by: Philippe Mathieu-Daudé Message-Id: <20190520124716.30472-3-kraxel@redhat.com> [AJB: fix conflicts with tests/vm: Port basevm to Python 3] Signed-off-by: Alex Bennée -- 2.20.1 diff --git a/tests/vm/basevm.py b/tests/vm/basevm.py index 083befce9f..4847549592 100755 --- a/tests/vm/basevm.py +++ b/tests/vm/basevm.py @@ -73,7 +73,7 @@ class BaseVM(object): "-vnc", "127.0.0.1:0,to=20", "-serial", "file:%s" % os.path.join(self._tmpdir, "serial.out")] if vcpus and vcpus > 1: - self._args += ["-smp", str(vcpus)] + self._args += ["-smp", "%d" % vcpus] if kvm_available(self.arch): self._args += ["-enable-kvm"] else: @@ -85,12 +85,13 @@ class BaseVM(object): if not sha256sum: return True checksum = subprocess.check_output(["sha256sum", fname]).split()[0] - return sha256sum == checksum.decode() + return sha256sum == checksum.decode("utf-8") cache_dir = os.path.expanduser("~/.cache/qemu-vm/download") if not os.path.exists(cache_dir): os.makedirs(cache_dir) - fname = os.path.join(cache_dir, hashlib.sha1(url.encode()).hexdigest()) + fname = os.path.join(cache_dir, + hashlib.sha1(url.encode("utf-8")).hexdigest()) if os.path.exists(fname) and check_sha256sum(fname): return fname logging.debug("Downloading %s to %s...", url, fname) @@ -134,7 +135,7 @@ class BaseVM(object): raise NotImplementedError def add_source_dir(self, src_dir): - name = "data-" + hashlib.sha1(src_dir.encode()).hexdigest()[:5] + name = "data-" + hashlib.sha1(src_dir.encode("utf-8")).hexdigest()[:5] tarfile = os.path.join(self._tmpdir, name + ".tar") logging.debug("Creating archive %s for src_dir dir: %s", tarfile, src_dir) subprocess.check_call(["./scripts/archive-source.sh", tarfile], @@ -256,7 +257,7 @@ def main(vmcls): vm.add_source_dir(args.build_qemu) cmd = [vm.BUILD_SCRIPT.format( configure_opts = " ".join(argv), - jobs=args.jobs, + jobs=int(args.jobs), target=args.build_target, verbose = "V=1" if args.verbose else "")] else: From patchwork Fri Jun 7 09:05:13 2019 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 8bit X-Patchwork-Submitter: =?utf-8?q?Alex_Benn=C3=A9e?= X-Patchwork-Id: 166140 Delivered-To: patch@linaro.org Received: by 2002:a92:9e1a:0:0:0:0:0 with SMTP id q26csp465437ili; Fri, 7 Jun 2019 03:40:44 -0700 (PDT) X-Google-Smtp-Source: APXvYqy84xLLuXo3+uCMOSuNI+89Q8UgIYi9Uc4AjZ58Brf+7TZZEMUQs9o8dMUZtF/KKpY6gM4W X-Received: by 2002:ac8:e0c:: with SMTP id a12mr1493028qti.132.1559904044224; Fri, 07 Jun 2019 03:40:44 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1559904044; cv=none; d=google.com; s=arc-20160816; b=FNZaAoZHlAF2/PD/gtmQH2fGUrFlz+JzPGQBOaI7tGhtzI1mLin8zZ1Xes+a6OW6Q1 qjuEOLOlk/cvzIt2uxFT54VZPX4oFNopozyfhV9ZS1e/EspjkawMQ8p7+eNmx/xM7mTn 1pwtRUv10d81r85Iq8mKAS5OuF2S3MomSuvqN50p6QVBMecZQJ3OyEr4TbRJFG0Uhosn Xm2/r/+OC9roT//a2ezxU652nbhlZIDxevXxlfhtSVPPYxpcpkjtAuxu0M9aOz+fqdYJ oT++Xf9sAHGTZeSOJmBu7BD5/thCRrTE3YmALN41ffZtAz70d68X5vI12hZQdBpd8rmH g13Q== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=sender:errors-to:cc:list-subscribe:list-help:list-post:list-archive :list-unsubscribe:list-id:precedence:subject :content-transfer-encoding:mime-version:references:in-reply-to :message-id:date:to:from:dkim-signature; bh=K60puiqqk977DMRGqqyet05oJzMhJ6Klb8DUPo/1Vlw=; b=QRrQYOixPiQAGRhfilAPU9z5duzfMpp6YFDUVSxoTtnYf4eecR8yJkSYQUHzCwWzlJ EjzNv+ny60xj58Kv5vLl4Lc3njiB+V12gCuZjAPUtI+ozXTcL0PI/hPRcmoDlRCKM2+H tgm5j4MrIGs7+I2awW55CsT3BjsiMg6O4DbN8Fc4xKKj2h/P2fGxzuUxw5btHZTmPE7W yzVpT8MwhRmZhELZjXsuOFu4ci2B8qxYpyrxNU4F8CFuosz/p8QB8Rv5SxGwEewZCHzZ XBPq2gYMJzouzkvg9s6hLKQGx7rtSm9deg7BT/TE2Uab/FKx3JzRwYnaC9rFU/5jP9MM p0uA== ARC-Authentication-Results: i=1; mx.google.com; dkim=fail header.i=@linaro.org header.s=google header.b=GbiJ4Txk; spf=pass (google.com: domain of qemu-devel-bounces+patch=linaro.org@nongnu.org designates 209.51.188.47 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.47]) by mx.google.com with ESMTPS id r45si1021051qtr.349.2019.06.07.03.40.44 for (version=TLS1_2 cipher=ECDHE-RSA-CHACHA20-POLY1305 bits=256/256); Fri, 07 Jun 2019 03:40:44 -0700 (PDT) Received-SPF: pass (google.com: domain of qemu-devel-bounces+patch=linaro.org@nongnu.org designates 209.51.188.47 as permitted sender) client-ip=209.51.188.47; Authentication-Results: mx.google.com; dkim=fail header.i=@linaro.org header.s=google header.b=GbiJ4Txk; spf=pass (google.com: domain of qemu-devel-bounces+patch=linaro.org@nongnu.org designates 209.51.188.47 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]:48162 helo=lists.gnu.org) by lists.gnu.org with esmtp (Exim 4.86_2) (envelope-from ) id 1hZCId-00045x-Ql for patch@linaro.org; Fri, 07 Jun 2019 06:40:43 -0400 Received: from eggs.gnu.org ([2001:470:142:3::10]:45085) by lists.gnu.org with esmtp (Exim 4.86_2) (envelope-from ) id 1hZB55-0008MV-6M for qemu-devel@nongnu.org; Fri, 07 Jun 2019 05:22:40 -0400 Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71) (envelope-from ) id 1hZB54-0005xj-3M for qemu-devel@nongnu.org; Fri, 07 Jun 2019 05:22:39 -0400 Received: from mail-wm1-x344.google.com ([2a00:1450:4864:20::344]:54297) by eggs.gnu.org with esmtps (TLS1.0:RSA_AES_128_CBC_SHA1:16) (Exim 4.71) (envelope-from ) id 1hZB53-0005wn-SU for qemu-devel@nongnu.org; Fri, 07 Jun 2019 05:22:38 -0400 Received: by mail-wm1-x344.google.com with SMTP id g135so1270028wme.4 for ; Fri, 07 Jun 2019 02:22:37 -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=K60puiqqk977DMRGqqyet05oJzMhJ6Klb8DUPo/1Vlw=; b=GbiJ4TxkuDOA1cloaOY2UICFfE7xXXjk1cGMBJlz9lpbopmmJ5brGwZtMEpj1+E3RW RNn9dTHlY/10bq/wMimwjAnlbhD765sdE1Tbr65ta8xL6wFMmT5VWYqDNlYQVCzh9dQq wVNZ6Tm/Aze1m1rOh2hmx01OKCRFi8ZsZSc7o+CnttIIEjCRixZlDSQAc+RKbSShVqdC sxo3/weY9ncDjfP4blP+2n7r9uLVULKJqDYKBhOdJneCguPYh/LrbxAbUkC0EZKAPs94 diw0ewizv1XIRfytlerX9aD1eWm5bixaVTP4r4sD/OdZMcMa3wfPy5vgyyOeHV+M+jNU 06RA== 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=K60puiqqk977DMRGqqyet05oJzMhJ6Klb8DUPo/1Vlw=; b=s+QaDsT1sRIsP9zsnNi/rpqsDuQOesN6Kx5Oeucc0Qx3xWnIt1IWuNLgyTz0njRb7y fTEUyyB8IddhmbKiekYl+/apwFw18CRg5SDPxfH6TPHN1Lw+o9GiA+tWK+OpLRq1Z81e OQBT6SVS1ZnlWLmrX1RC92/dQzbvf9++bcFB8wI5aDTtJVL97blXyEgzO4HKS7AG40n6 /5hJ7liE/jhBS+DAfsqUjo+JSfF/QKNNdrL4ElV2UEP5KK1V4NzzJaMW7asBotjMSUga BQDOwny7EzT/2WowQH44LeXJSEtHVMMFv6M/8z8861GdlDcG0OlSlWrWtGa0p2mTOu/z Gd3Q== X-Gm-Message-State: APjAAAXQQmsSMTiFyLID02NNN62SzfZUeVpocjV7H9P+IWef2RP2fRqb 6v2ni6i3Jo0GLeCm0wqH0AfY3A== X-Received: by 2002:a1c:b189:: with SMTP id a131mr3040412wmf.7.1559899356679; Fri, 07 Jun 2019 02:22:36 -0700 (PDT) Received: from zen.linaroharston ([81.128.185.34]) by smtp.gmail.com with ESMTPSA id a17sm1159492wrr.80.2019.06.07.02.22.30 (version=TLS1_3 cipher=AEAD-AES256-GCM-SHA384 bits=256/256); Fri, 07 Jun 2019 02:22:35 -0700 (PDT) Received: from zen.linaroharston. (localhost [127.0.0.1]) by zen.linaroharston (Postfix) with ESMTP id 217081FF9D; Fri, 7 Jun 2019 10:05:53 +0100 (BST) From: =?utf-8?q?Alex_Benn=C3=A9e?= To: peter.maydell@linaro.org Date: Fri, 7 Jun 2019 10:05:13 +0100 Message-Id: <20190607090552.12434-15-alex.bennee@linaro.org> X-Mailer: git-send-email 2.20.1 In-Reply-To: <20190607090552.12434-1-alex.bennee@linaro.org> References: <20190607090552.12434-1-alex.bennee@linaro.org> MIME-Version: 1.0 X-detected-operating-system: by eggs.gnu.org: Genre and OS details not recognized. X-Received-From: 2a00:1450:4864:20::344 Subject: [Qemu-devel] [PULL 14/52] tests/vm: send proxy environment variables over ssh 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: Fam Zheng , Thomas Huth , =?utf-8?q?Philippe_Mathieu-Daud=C3=A9?= , qemu-devel@nongnu.org, Gerd Hoffmann , =?utf-8?q?Alex_Benn=C3=A9e?= Errors-To: qemu-devel-bounces+patch=linaro.org@nongnu.org Sender: "Qemu-devel" From: Gerd Hoffmann Packages are fetched via proxy that way, if configured on the host. That might be required to pass firewalls, and it allows to route package downloads through a caching proxy server. Needs AcceptEnv setup in sshd_config on the guest side to work. Signed-off-by: Gerd Hoffmann Reviewed-by: Philippe Mathieu-Daudé Tested-by: Thomas Huth Message-Id: <20190520124716.30472-4-kraxel@redhat.com> Signed-off-by: Alex Bennée -- 2.20.1 diff --git a/tests/vm/basevm.py b/tests/vm/basevm.py index 4847549592..5e30bac661 100755 --- a/tests/vm/basevm.py +++ b/tests/vm/basevm.py @@ -38,6 +38,13 @@ class BaseVM(object): GUEST_PASS = "qemupass" ROOT_PASS = "qemupass" + envvars = [ + "https_proxy", + "http_proxy", + "ftp_proxy", + "no_proxy", + ] + # The script to run in the guest that builds QEMU BUILD_SCRIPT = "" # The guest name, to be overridden by subclasses @@ -106,6 +113,8 @@ class BaseVM(object): "-o", "UserKnownHostsFile=" + os.devnull, "-o", "ConnectTimeout=1", "-p", self.ssh_port, "-i", self._ssh_key_file] + for var in self.envvars: + ssh_cmd += ['-o', "SendEnv=%s" % var ] if interactive: ssh_cmd += ['-t'] assert not isinstance(cmd, str) From patchwork Fri Jun 7 09:05:14 2019 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 8bit X-Patchwork-Submitter: =?utf-8?q?Alex_Benn=C3=A9e?= X-Patchwork-Id: 166103 Delivered-To: patch@linaro.org Received: by 2002:a92:9e1a:0:0:0:0:0 with SMTP id q26csp415099ili; Fri, 7 Jun 2019 02:49:15 -0700 (PDT) X-Google-Smtp-Source: APXvYqxpJfxt58tyTaeEksWnoWoFC/rl6WT9I6HCcwcWewt5rHXL1+wzRqiE6GHkUBtiTlefAAby X-Received: by 2002:a37:a854:: with SMTP id r81mr42813461qke.53.1559900955452; Fri, 07 Jun 2019 02:49:15 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1559900955; cv=none; d=google.com; s=arc-20160816; b=ILITGmfWzp7cA3rn3J26Azg05WaPkDb66nKeLXMv656dMUXOzd7wgQ89Cs7kfc4D7u C1QnT3YmTNcxjhLBKOSeIeQUWkPE+LoD0jVBNmdLrqJQYlelAZ/yaLHu9oaraDGgpPaK uXOO470WWeaXLwj+edpqykgUBl/2JFylkFuXIRrjHE8LBJaTUsPjA0kCZG9jbj8Yu4// iDQbau/xyicqB6Q4yOPaofeNxybLulF+K0OcuBC3klhWcExk8qK5ddnqbd2ETNaN8OMi jEla07UFluWiSfXjdUN4lcjuH8RZkyuf5yPDjIJxm94F7Els9up14QOAj5Mmy+8X9OwQ MMuQ== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=sender:errors-to:cc:list-subscribe:list-help:list-post:list-archive :list-unsubscribe:list-id:precedence:subject :content-transfer-encoding:mime-version:references:in-reply-to :message-id:date:to:from:dkim-signature; bh=/mgOWUVQfFqS8c2PmAMUGsA0PAuyGOHp1Inf8fc96Sk=; b=onw6OSxl3jVHEbR0hTVoRC+11IZVGF+oholPpOHw7LNfkv2TDW6hl37nmVaS3aVWWz wGqF+bXnrtbvp7vbpnWgluYVlXFNnybk8l2D8fydXyHBJncLrbTkxyDrw42MVXkOWYvv xrOxJ0i/w5AW2KlFDlF1ik+qwRhHVrLonvZqK1F/el2LWjZ2TH6/vZ6fwGrHSM6/X91W m4hUMzJ+b9OwTi0wC2QK/aLsVvywlXyNxDy5EUEeLOECDcz5KQX0r1mAp18xdN5LMTa0 RRP4rvVhyx3802H8dvB7WwsMl4TYbK5YKpPNZfQnl+mcEcig+DaL1FINvoqwNwFOUYrr amGg== ARC-Authentication-Results: i=1; mx.google.com; dkim=fail header.i=@linaro.org header.s=google header.b=j1d2RMPM; spf=pass (google.com: domain of qemu-devel-bounces+patch=linaro.org@nongnu.org designates 209.51.188.47 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.47]) by mx.google.com with ESMTPS id t62si871779qka.228.2019.06.07.02.49.15 for (version=TLS1_2 cipher=ECDHE-RSA-CHACHA20-POLY1305 bits=256/256); Fri, 07 Jun 2019 02:49:15 -0700 (PDT) Received-SPF: pass (google.com: domain of qemu-devel-bounces+patch=linaro.org@nongnu.org designates 209.51.188.47 as permitted sender) client-ip=209.51.188.47; Authentication-Results: mx.google.com; dkim=fail header.i=@linaro.org header.s=google header.b=j1d2RMPM; spf=pass (google.com: domain of qemu-devel-bounces+patch=linaro.org@nongnu.org designates 209.51.188.47 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]:47626 helo=lists.gnu.org) by lists.gnu.org with esmtp (Exim 4.86_2) (envelope-from ) id 1hZBUp-0005U3-2Y for patch@linaro.org; Fri, 07 Jun 2019 05:49:15 -0400 Received: from eggs.gnu.org ([2001:470:142:3::10]:42217) by lists.gnu.org with esmtp (Exim 4.86_2) (envelope-from ) id 1hZAvT-0002Ft-Ct for qemu-devel@nongnu.org; Fri, 07 Jun 2019 05:12:45 -0400 Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71) (envelope-from ) id 1hZAvR-00050K-1d for qemu-devel@nongnu.org; Fri, 07 Jun 2019 05:12:43 -0400 Received: from mail-wr1-x432.google.com ([2a00:1450:4864:20::432]:43592) by eggs.gnu.org with esmtps (TLS1.0:RSA_AES_128_CBC_SHA1:16) (Exim 4.71) (envelope-from ) id 1hZAvQ-0004mk-M5 for qemu-devel@nongnu.org; Fri, 07 Jun 2019 05:12:40 -0400 Received: by mail-wr1-x432.google.com with SMTP id r18so1351590wrm.10 for ; Fri, 07 Jun 2019 02:12:35 -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=/mgOWUVQfFqS8c2PmAMUGsA0PAuyGOHp1Inf8fc96Sk=; b=j1d2RMPMtwyfSlpxp7P3wjBaDONJs3e34kgogE6dwdbGCbef3q4rAfnvRSmVj69BMI +e6GxvTwpqSoWRyin6zvftQoPFfwHs4k3ahAI0LkbuwIpkDLuSTixDt2ZNw8TTUWj16e k8PMbxHuxMq4ppH5Qq45R0v/8KGYO7p2gl3bZ/kJqvyDNgefLE9tja5AgrAQ2SrDtPq8 TGhgmQ0Lqyk6dI5zJG0THE4M2jyE/e6XB4IAG8v4y9fdhiIbOLMg6lcg31kqSt8dga2t y+M8GRdhbIBa3z+3DU9BGUO9skOcgJMrn9oj0KkT4Q46oXmiU8RhZs5EX5jYLBnR8k0T yXgg== 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=/mgOWUVQfFqS8c2PmAMUGsA0PAuyGOHp1Inf8fc96Sk=; b=txelfEcLP0m0O95/S72VMLFhyrLr4jtB1WR1FuvpeWb00e9NIy5/0TT5ZoEU39jg8I sTeGvdOOzbEn8gDDuUL2xR3FXCwGtfctyS1c3ON9li9l0p+I6mlNNuOMIt0cGdwfpluc os/cR6sNisilSmc8hZRuXi60ltK0SwAXbakBcU2JGxovxICJb105e9YUizgaX/neIOIz EYTp66fO16wur44lJpvmvwh4ILocm/iNcDC4h5DFq+BYoNTEvjfIEZpl6S5WGeJ16jxn exMBuPdZ2XNMZHqpvxHOiM5egKb9hS1XD7lEhzMLISJjTHVSFUDG93migDsx0gxUMdBG JD7A== X-Gm-Message-State: APjAAAWyhRE7owf9aZ+FWhxAIxVX9Sok+tQEcQDBZ5QSeA0hM62M9ewX 6JqRL/Oqn1wWMk1pDnUhyLYH7Q== X-Received: by 2002:adf:9267:: with SMTP id 94mr10741052wrj.338.1559898754163; Fri, 07 Jun 2019 02:12:34 -0700 (PDT) Received: from zen.linaroharston ([81.128.185.34]) by smtp.gmail.com with ESMTPSA id x3sm1654450wrp.78.2019.06.07.02.12.28 (version=TLS1_3 cipher=AEAD-AES256-GCM-SHA384 bits=256/256); Fri, 07 Jun 2019 02:12:30 -0700 (PDT) Received: from zen.linaroharston. (localhost [127.0.0.1]) by zen.linaroharston (Postfix) with ESMTP id 34CA01FF9E; Fri, 7 Jun 2019 10:05:53 +0100 (BST) From: =?utf-8?q?Alex_Benn=C3=A9e?= To: peter.maydell@linaro.org Date: Fri, 7 Jun 2019 10:05:14 +0100 Message-Id: <20190607090552.12434-16-alex.bennee@linaro.org> X-Mailer: git-send-email 2.20.1 In-Reply-To: <20190607090552.12434-1-alex.bennee@linaro.org> References: <20190607090552.12434-1-alex.bennee@linaro.org> MIME-Version: 1.0 X-detected-operating-system: by eggs.gnu.org: Genre and OS details not recognized. X-Received-From: 2a00:1450:4864:20::432 Subject: [Qemu-devel] [PULL 15/52] tests/vm: use ssh with pty unconditionally 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: Fam Zheng , Thomas Huth , =?utf-8?q?Philippe_Mathieu-Daud=C3=A9?= , qemu-devel@nongnu.org, Gerd Hoffmann , =?utf-8?q?Alex_Benn=C3=A9e?= Errors-To: qemu-devel-bounces+patch=linaro.org@nongnu.org Sender: "Qemu-devel" From: Gerd Hoffmann Allways ask ssh to run with a pseudo terminal. Not having a terminal causes problems now and then. Signed-off-by: Gerd Hoffmann Tested-by: Thomas Huth Reviewed-by: Philippe Mathieu-Daudé Tested-by: Philippe Mathieu-Daudé Message-Id: <20190520124716.30472-5-kraxel@redhat.com> Signed-off-by: Alex Bennée -- 2.20.1 diff --git a/tests/vm/basevm.py b/tests/vm/basevm.py index 5e30bac661..395eefaec9 100755 --- a/tests/vm/basevm.py +++ b/tests/vm/basevm.py @@ -107,16 +107,14 @@ class BaseVM(object): os.rename(fname + ".download", fname) return fname - def _ssh_do(self, user, cmd, check, interactive=False): - ssh_cmd = ["ssh", "-q", + def _ssh_do(self, user, cmd, check): + ssh_cmd = ["ssh", "-q", "-t", "-o", "StrictHostKeyChecking=no", "-o", "UserKnownHostsFile=" + os.devnull, "-o", "ConnectTimeout=1", "-p", self.ssh_port, "-i", self._ssh_key_file] for var in self.envvars: ssh_cmd += ['-o', "SendEnv=%s" % var ] - if interactive: - ssh_cmd += ['-t'] assert not isinstance(cmd, str) ssh_cmd += ["%s@127.0.0.1" % user] + list(cmd) logging.debug("ssh_cmd: %s", " ".join(ssh_cmd)) @@ -128,9 +126,6 @@ class BaseVM(object): def ssh(self, *cmd): return self._ssh_do(self.GUEST_USER, cmd, False) - def ssh_interactive(self, *cmd): - return self._ssh_do(self.GUEST_USER, cmd, False, True) - def ssh_root(self, *cmd): return self._ssh_do("root", cmd, False) @@ -284,9 +279,9 @@ def main(vmcls): return 2 if args.interactive: - if vm.ssh_interactive(*cmd) == 0: + if vm.ssh(*cmd) == 0: return 0 - vm.ssh_interactive() + vm.ssh() return 3 else: if vm.ssh(*cmd) != 0: From patchwork Fri Jun 7 09:05:15 2019 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 8bit X-Patchwork-Submitter: =?utf-8?q?Alex_Benn=C3=A9e?= X-Patchwork-Id: 166118 Delivered-To: patch@linaro.org Received: by 2002:a92:9e1a:0:0:0:0:0 with SMTP id q26csp438123ili; Fri, 7 Jun 2019 03:12:28 -0700 (PDT) X-Google-Smtp-Source: APXvYqxGP/zZt1v2qr/gldsuIwpF2UCT3kYcEAYq5ban9/ut/Az+M7cIvBcB9oSlrW5ofvbLb9rY X-Received: by 2002:a05:620a:14a1:: with SMTP id x1mr43190083qkj.164.1559902348167; Fri, 07 Jun 2019 03:12:28 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1559902348; cv=none; d=google.com; s=arc-20160816; b=Y5kvXZ/K6a5T3OhxV3OTuGoK3jpZ9gBtTaEAk+uTyVfUg0XACJSiQX7Qn/IsGJDsVl yiT12UFZGsY3FLehhkBrAZcqYjXFF4ie6syKFJfGOuTFqRx4Wp7oR/iHJwBr78uTBkSL bM2G8BUyt+M+JttWzgGI0HqN7A+sab6UvlXEXD7kJp3oDIICJUJPB0LWnLHInlg4+q0w B6PNSnGz2YezbL7gPF5GnbtOz6OWmy9U6mRkONAX1L3WRrTpZHWcpw+fmP6scpAOdNy1 snVqNzRLUw/IzMxkVJGac50Ik5r2fA6Jpys2CKqM05WvId7GjUMOSfl+C4IfWrieUMmb r5dA== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=sender:errors-to:cc:list-subscribe:list-help:list-post:list-archive :list-unsubscribe:list-id:precedence:subject :content-transfer-encoding:mime-version:references:in-reply-to :message-id:date:to:from:dkim-signature; bh=RWdjGRz2IFIKsx2DAAA/Umb0YtSGfkHMorsWs9va5Qs=; b=dyyDIVOBhwGDm9WGc8pK6Da7j4zLQYVa2UTtyPyMV1Y7aPiWQpCGEwfMgT4NIXicqb /9lZG//+7pcsegJk7LPUmIRoUKYLTuIfDln7eTKA8KM+QHAEg7vIBXth8+PnJK80pdmp 2BQh+69m20a0U4McNepc93t4Dy/E0DoWE4Qc64/MRakbQ1VO7YlV+WQwwXWMOcChu6Mz M/DBaGGOSbwkQiDJC6LY2fgCRg9NRURskT1/r8mrT6ZWx+eTt6tsKaSMZeVZosaFbhX2 VQqEt6eJxhO/JEhQ2DYZNjgKoZb2xCKQl5yF4WSkaE659FFkqD9tLZvTUb6dA4lL0yth IxHg== ARC-Authentication-Results: i=1; mx.google.com; dkim=fail header.i=@linaro.org header.s=google header.b=DeU2pisL; spf=pass (google.com: domain of qemu-devel-bounces+patch=linaro.org@nongnu.org designates 209.51.188.47 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.47]) by mx.google.com with ESMTPS id h15si1015550qta.206.2019.06.07.03.12.28 for (version=TLS1_2 cipher=ECDHE-RSA-CHACHA20-POLY1305 bits=256/256); Fri, 07 Jun 2019 03:12:28 -0700 (PDT) Received-SPF: pass (google.com: domain of qemu-devel-bounces+patch=linaro.org@nongnu.org designates 209.51.188.47 as permitted sender) client-ip=209.51.188.47; Authentication-Results: mx.google.com; dkim=fail header.i=@linaro.org header.s=google header.b=DeU2pisL; spf=pass (google.com: domain of qemu-devel-bounces+patch=linaro.org@nongnu.org designates 209.51.188.47 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]:47896 helo=lists.gnu.org) by lists.gnu.org with esmtp (Exim 4.86_2) (envelope-from ) id 1hZBrH-000125-MO for patch@linaro.org; Fri, 07 Jun 2019 06:12:27 -0400 Received: from eggs.gnu.org ([2001:470:142:3::10]:45043) by lists.gnu.org with esmtp (Exim 4.86_2) (envelope-from ) id 1hZB53-0008Fj-Ar for qemu-devel@nongnu.org; Fri, 07 Jun 2019 05:22:38 -0400 Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71) (envelope-from ) id 1hZB4y-0005oZ-5L for qemu-devel@nongnu.org; Fri, 07 Jun 2019 05:22:37 -0400 Received: from mail-wm1-x329.google.com ([2a00:1450:4864:20::329]:55429) by eggs.gnu.org with esmtps (TLS1.0:RSA_AES_128_CBC_SHA1:16) (Exim 4.71) (envelope-from ) id 1hZB4w-0005jC-69 for qemu-devel@nongnu.org; Fri, 07 Jun 2019 05:22:31 -0400 Received: by mail-wm1-x329.google.com with SMTP id a15so1265163wmj.5 for ; Fri, 07 Jun 2019 02:22:29 -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=RWdjGRz2IFIKsx2DAAA/Umb0YtSGfkHMorsWs9va5Qs=; b=DeU2pisLAHpKCQTrWMuQukqIVvwYUA7fg1PfI5Nq2L1WDAZUf4w29Lv1uyySkFjoId H1uhokx5DM7zbJC9WU3CPnmJ2cGhrlrHYFyHBF652Wem4XkRcFSNPtVB55DRheDoV7sR u33ARvo8CsPyhgedtCVO22zmNQLkF0oHJmZ2Z8HSn7nU3y4mPmDpLWt5095Fwgts6iuX eWAYChQSLu8N4+1I4KRY3TPDK7UiFW5VFNu2Jzl9M7LQz+f//z67r6peCI5EgMeR7pn2 I1DimVMPGXhiY3MCmG/masM6sdFz6KKtUuN/KdP0kNXPaFI6LRBLncCpSRoVONbCJhEz 67Wg== 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=RWdjGRz2IFIKsx2DAAA/Umb0YtSGfkHMorsWs9va5Qs=; b=qlIvIDkkaCY8QfV6ye+VesfVsp3e2c3VI3UVUTPn9MjpnYFlGWhRpUYYrqsoRfIlyD yA7mo9znyvc/cXpDLCn62SY/IbDbocjYAC/9W+v3AStOSzbJSwPDEV+/5a5bLDewNLfw dcN8nQj2xUrGR8WDmh3P5RgVyiV/4Vpp03UVBIflS2WSOxETBm/nJy90MOVAgLBEY5I1 zTzTiL9r3s6adjeXCkK1jOZAvI+KdKdi2/wY93Dd8qYWpSM6l/MgJ8oFlXSvaHKSaIMu c+OQtyQVyYVpJ9w6lK06JSArkCVNcdpUtUj5ld1QWsMlUleOhxF2O0whGcFdzWt7I8Kl /PvA== X-Gm-Message-State: APjAAAVQK0uOeH9pgp7gOphoGLMVKcnVuWU+8ApwGcfE8FrEM4Hy+TRv 88rpe8aH2geqE0eYUaccmNSHww== X-Received: by 2002:a1c:7e08:: with SMTP id z8mr2745087wmc.36.1559899348675; Fri, 07 Jun 2019 02:22:28 -0700 (PDT) Received: from zen.linaroharston ([81.128.185.34]) by smtp.gmail.com with ESMTPSA id c14sm1218869wrt.45.2019.06.07.02.22.26 (version=TLS1_3 cipher=AEAD-AES256-GCM-SHA384 bits=256/256); Fri, 07 Jun 2019 02:22:27 -0700 (PDT) Received: from zen.linaroharston. (localhost [127.0.0.1]) by zen.linaroharston (Postfix) with ESMTP id 48ADB1FF9F; Fri, 7 Jun 2019 10:05:53 +0100 (BST) From: =?utf-8?q?Alex_Benn=C3=A9e?= To: peter.maydell@linaro.org Date: Fri, 7 Jun 2019 10:05:15 +0100 Message-Id: <20190607090552.12434-17-alex.bennee@linaro.org> X-Mailer: git-send-email 2.20.1 In-Reply-To: <20190607090552.12434-1-alex.bennee@linaro.org> References: <20190607090552.12434-1-alex.bennee@linaro.org> MIME-Version: 1.0 X-detected-operating-system: by eggs.gnu.org: Genre and OS details not recognized. X-Received-From: 2a00:1450:4864:20::329 Subject: [Qemu-devel] [PULL 16/52] tests/vm: run test builds on snapshot 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: Fam Zheng , Thomas Huth , Ed Maste , =?utf-8?q?Philippe_Mathieu-Daud=C3=A9?= , qemu-devel@nongnu.org, Gerd Hoffmann , =?utf-8?q?Alex_Benn=C3=A9e?= Errors-To: qemu-devel-bounces+patch=linaro.org@nongnu.org Sender: "Qemu-devel" From: Gerd Hoffmann The build script doesn't shutdown the guest VMs properly, which results in filesystem corruption and guest boot failures sooner or later. Use the --snapshot to run builds on a snapshot, That way killing the VM doesn't corrupt the base image. Signed-off-by: Gerd Hoffmann Tested-by: Thomas Huth Reviewed-by: Philippe Mathieu-Daudé Tested-by: Philippe Mathieu-Daudé Acked-by: Ed Maste Message-Id: <20190520124716.30472-6-kraxel@redhat.com> Signed-off-by: Alex Bennée -- 2.20.1 diff --git a/tests/vm/Makefile.include b/tests/vm/Makefile.include index c59411bee0..276b870216 100644 --- a/tests/vm/Makefile.include +++ b/tests/vm/Makefile.include @@ -57,6 +57,7 @@ vm-build-%: $(IMAGES_DIR)/%.img $(if $(V),--verbose) \ --image "$<" \ $(if $(BUILD_TARGET),--build-target $(BUILD_TARGET)) \ + --snapshot \ --build-qemu $(SRC_PATH) -- \ $(if $(TARGET_LIST),--target-list=$(TARGET_LIST)) \ $(if $(EXTRA_CONFIGURE_OPTS),$(EXTRA_CONFIGURE_OPTS)), \ From patchwork Fri Jun 7 09:05:16 2019 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 8bit X-Patchwork-Submitter: =?utf-8?q?Alex_Benn=C3=A9e?= X-Patchwork-Id: 166088 Delivered-To: patch@linaro.org Received: by 2002:a92:9e1a:0:0:0:0:0 with SMTP id q26csp390004ili; Fri, 7 Jun 2019 02:19:25 -0700 (PDT) X-Google-Smtp-Source: APXvYqzn/XANRwanGOZlgHnXwkgg6BeWif8y2nRrbImAI4BxPVphl+oVJmSxM1zdqkbZZx6vE/13 X-Received: by 2002:ac8:e05:: with SMTP id a5mr9930449qti.53.1559899165229; Fri, 07 Jun 2019 02:19:25 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1559899165; cv=none; d=google.com; s=arc-20160816; b=a9hHOKjX2v96GyxEnYco3d9R36nhzkUyyfcjvKq4COnfrpBAB7s144wF6dej64nFgJ FTGS3NQwLly1P7Ocv1bHPSxWdDEGVn7NHNX9f4/ugz04IT+roTxsLktvoQWtfLrTAnhD SrWRkR60eUSKa3bKXPnH9S2m1tU6hxz1C8OPK9omEPrvHb5rjSpAbxk1VCbWf8CAguHk y5CKTIrecrlBhfALyEZpyA9FuBSu2T+BAIwtzqqsRfs+oyjri1TiSmRtmPU1rUgJ5bJj AzUqbSeROtN6X8bSFJJRmfy4lkdoq11XXWqNcMcIIo7r60kolu7KruzUTBUhQJ0jpZfL JC7A== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=sender:errors-to:cc:list-subscribe:list-help:list-post:list-archive :list-unsubscribe:list-id:precedence:subject :content-transfer-encoding:mime-version:references:in-reply-to :message-id:date:to:from:dkim-signature; bh=1dKkut+uCfwlAn3zScZi3hqAXXCijPCSIcimV4mZPU4=; b=mKEIOFKN+7rO7kdy9x+Z+VE//DqLSQQcWoDRZaWUFT+XW93bF/yC4+6TwAlp1StGJ2 keL6DfwyeRD4dWwjV4aG+TKh2yUwFHi+7HTt4dre221MSRExlEn28FO+1NmErLuCaTPH lyqECKEErSGn56xUyo38wkRUbaWElIRkg65gPGwkgvtlf+iaE1Afs9C+VPdXolnQZfQ+ f2zM2oh1LS9dEw0KCjExC+yz9rbsC5d6A0LqVLAwamQjQ94l226GTEWHx1MC/zM9GO7e 2/M9oV7vZcYPSxSfpGod/J2bTKDhZX3KEdxdh8K5D7yhxbNaJIM5dUQHjKjEd1Wxi/7U jNGg== ARC-Authentication-Results: i=1; mx.google.com; dkim=fail header.i=@linaro.org header.s=google header.b=fQ21quUU; spf=pass (google.com: domain of qemu-devel-bounces+patch=linaro.org@nongnu.org designates 209.51.188.47 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.47]) by mx.google.com with ESMTPS id r42si933335qtj.42.2019.06.07.02.19.25 for (version=TLS1_2 cipher=ECDHE-RSA-CHACHA20-POLY1305 bits=256/256); Fri, 07 Jun 2019 02:19:25 -0700 (PDT) Received-SPF: pass (google.com: domain of qemu-devel-bounces+patch=linaro.org@nongnu.org designates 209.51.188.47 as permitted sender) client-ip=209.51.188.47; Authentication-Results: mx.google.com; dkim=fail header.i=@linaro.org header.s=google header.b=fQ21quUU; spf=pass (google.com: domain of qemu-devel-bounces+patch=linaro.org@nongnu.org designates 209.51.188.47 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]:47410 helo=lists.gnu.org) by lists.gnu.org with esmtp (Exim 4.86_2) (envelope-from ) id 1hZB1v-0006Vs-0l for patch@linaro.org; Fri, 07 Jun 2019 05:19:23 -0400 Received: from eggs.gnu.org ([2001:470:142:3::10]:39454) by lists.gnu.org with esmtp (Exim 4.86_2) (envelope-from ) id 1hZAp5-00049e-I7 for qemu-devel@nongnu.org; Fri, 07 Jun 2019 05:06:08 -0400 Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71) (envelope-from ) id 1hZAp3-0004bE-I9 for qemu-devel@nongnu.org; Fri, 07 Jun 2019 05:06:07 -0400 Received: from mail-wm1-x332.google.com ([2a00:1450:4864:20::332]:39164) by eggs.gnu.org with esmtps (TLS1.0:RSA_AES_128_CBC_SHA1:16) (Exim 4.71) (envelope-from ) id 1hZAp1-0004Tt-N9 for qemu-devel@nongnu.org; Fri, 07 Jun 2019 05:06:04 -0400 Received: by mail-wm1-x332.google.com with SMTP id z23so1125750wma.4 for ; Fri, 07 Jun 2019 02:06:03 -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=1dKkut+uCfwlAn3zScZi3hqAXXCijPCSIcimV4mZPU4=; b=fQ21quUUtSkH6czkTNF2HL8KksSz6YYwc8GIMCDUXjCPgqAFUiwFbZ9BICRDH1YB6J D1bjOB1iTrT5ntEM7XD/9K9zwWWqhVV+ND7ZwlQsVRK5KQqEbNQrZWIW/K86+OdK5XgF m8+WxuwXN0F+8lOxvPEoylggxPpqEafv/DkeesFSoGw+lLOK6W43olCYe0uSUGTUCDt4 LbZs+2UYdroMh5etp9WeQBCAh8g/1f2KQfzDQFHikggKnuF8v46OxoMAHoA+BTcW7nJK Etl4lwAFZN5SyaYN/EhgcKxznf88TItc4pUXBD2KgL5A/Xv5aMEY/kDq23pwEKCanN/T Z43g== 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=1dKkut+uCfwlAn3zScZi3hqAXXCijPCSIcimV4mZPU4=; b=e73fM+3pZKy+c+uYIrXiGp9s3sz0oNQu7gi1V2dYHUPZJEvdU8DKImDVrhdgDQt/Jn bppl29qEH4dJwgFgnAaKEztePIATqF0TZREP5EJCpwU/07JbuHOFZe/cBPBEvyDMiStX WLT0XrSvScdyZxxLtFidVGzXJt3nXjbK2oDJk0QBUv0Diu6M0os83PHQnUVnI3Vp1KKZ QHeW3RYVUbi5LvB6ea7WOC484aCJCcoSEZFuxb3hbmUtD3UyrFWE7b73m3P5M9ZpOypT 65s/6+P9wd4oUhAFuHA8gyZxVd2pxQDcT5Kmsy5Rk+y0UHJu9ihUmRt3mf3KvBSjBMfb YJhQ== X-Gm-Message-State: APjAAAV4KOcsyKOlti1sVk7hPu5PGvGzB05F07HwFgTPzjp8/O66nYf2 mZ1jY4TmyTBSaJciLIJnQ7RWdA== X-Received: by 2002:a7b:c144:: with SMTP id z4mr3028525wmi.50.1559898362395; Fri, 07 Jun 2019 02:06:02 -0700 (PDT) Received: from zen.linaroharston ([81.128.185.34]) by smtp.gmail.com with ESMTPSA id o14sm1312338wrp.77.2019.06.07.02.05.56 (version=TLS1_3 cipher=AEAD-AES256-GCM-SHA384 bits=256/256); Fri, 07 Jun 2019 02:05:58 -0700 (PDT) Received: from zen.linaroharston. (localhost [127.0.0.1]) by zen.linaroharston (Postfix) with ESMTP id 5C0FC1FFA3; Fri, 7 Jun 2019 10:05:53 +0100 (BST) From: =?utf-8?q?Alex_Benn=C3=A9e?= To: peter.maydell@linaro.org Date: Fri, 7 Jun 2019 10:05:16 +0100 Message-Id: <20190607090552.12434-18-alex.bennee@linaro.org> X-Mailer: git-send-email 2.20.1 In-Reply-To: <20190607090552.12434-1-alex.bennee@linaro.org> References: <20190607090552.12434-1-alex.bennee@linaro.org> MIME-Version: 1.0 X-detected-operating-system: by eggs.gnu.org: Genre and OS details not recognized. X-Received-From: 2a00:1450:4864:20::332 Subject: [Qemu-devel] [PULL 17/52] tests/vm: proper guest shutdown 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: Fam Zheng , Thomas Huth , =?utf-8?q?Philippe_Mathieu-Daud=C3=A9?= , qemu-devel@nongnu.org, Gerd Hoffmann , =?utf-8?q?Alex_Benn=C3=A9e?= Errors-To: qemu-devel-bounces+patch=linaro.org@nongnu.org Sender: "Qemu-devel" From: Gerd Hoffmann When not running in snapshot mode ask the guest to poweroff and wait for this to finish instead of simply quitting qemu, so the guest can flush pending updates to disk. Signed-off-by: Gerd Hoffmann Tested-by: Thomas Huth Reviewed-by: Philippe Mathieu-Daudé Tested-by: Philippe Mathieu-Daudé Message-Id: <20190520124716.30472-7-kraxel@redhat.com> Signed-off-by: Alex Bennée -- 2.20.1 diff --git a/tests/vm/basevm.py b/tests/vm/basevm.py index 395eefaec9..f27178f3c7 100755 --- a/tests/vm/basevm.py +++ b/tests/vm/basevm.py @@ -51,6 +51,8 @@ class BaseVM(object): name = "#base" # The guest architecture, to be overridden by subclasses arch = "#arch" + # command to halt the guest, can be overridden by subclasses + poweroff = "poweroff" def __init__(self, debug=False, vcpus=None): self._guest = None self._tmpdir = os.path.realpath(tempfile.mkdtemp(prefix="vm-test-", @@ -202,6 +204,10 @@ class BaseVM(object): def wait(self): self._guest.wait() + def graceful_shutdown(self): + self.ssh_root(self.poweroff) + self._guest.wait() + def qmp(self, *args, **kwargs): return self._guest.qmp(*args, **kwargs) @@ -278,11 +284,13 @@ def main(vmcls): traceback.print_exc() return 2 - if args.interactive: - if vm.ssh(*cmd) == 0: - return 0 + exitcode = 0 + if vm.ssh(*cmd) != 0: + exitcode = 3 + if exitcode != 0 and args.interactive: vm.ssh() - return 3 - else: - if vm.ssh(*cmd) != 0: - return 3 + + if not args.snapshot: + vm.graceful_shutdown() + + return exitcode From patchwork Fri Jun 7 09:05:17 2019 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 8bit X-Patchwork-Submitter: =?utf-8?q?Alex_Benn=C3=A9e?= X-Patchwork-Id: 166127 Delivered-To: patch@linaro.org Received: by 2002:a92:9e1a:0:0:0:0:0 with SMTP id q26csp447064ili; Fri, 7 Jun 2019 03:21:02 -0700 (PDT) X-Google-Smtp-Source: APXvYqwY+o3AxclYYBD7I+IELJpg/TZwt7qpACG9E29nk4o7vKAQCBjC0rwI5hCQBm25sGz8owf9 X-Received: by 2002:ac8:25d9:: with SMTP id f25mr44511363qtf.256.1559902861887; Fri, 07 Jun 2019 03:21:01 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1559902861; cv=none; d=google.com; s=arc-20160816; b=FBUQbjEpL4FpJg7H0NTfTYzqw3I5oFpTiFgsiHmd4l7MWa+jvd4l5CAq8lHNvkySgQ 7QSFvDRArZEYLN8NUyu4vOFbhD2rNSQLvzogjKbi7IO9LnYjYDn8ZYYEpL0C7hYDsn0E ELS/Kk/mgYO9MSAQH5AHsjfAx1De8e7/OEFN3FGprT4Rf+6IRs2huIeW7NjIJ1Cn+yQu roEWIIqVMElnDeSm2skELJBxtKSoxz1gMSjLCcYTLYwf3dd9x1wyghL/ZiGIQNvUCXk+ Sb11G4Ao0o3TAplyQsosV5dS8fWWUpU522xjQ9ml3jNpa6Hk498Np7rCbiDplDqyG+MK 7diQ== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=sender:errors-to:cc:list-subscribe:list-help:list-post:list-archive :list-unsubscribe:list-id:precedence:subject :content-transfer-encoding:mime-version:references:in-reply-to :message-id:date:to:from:dkim-signature; bh=l3qvsmebNFZ5O5OwW5sp1A169mo8OEERmO3Igp6r4L0=; b=tfmY/t5vgxp9b+0y4SQ4IxqKWGN8ABbo/1ZRSxXXx1a64teU+Id0e2uJ5wk8wIHki+ N1j3urAkG91Ud+DrJg9F57H1zcEgqlI4uLdH9J1f3/gBdbWjV8X77+uGJ0SNTREAFxb8 ++0cZpE+qJps29vB9C2YzrxUqbmEy+RyFIyZgtBbhqXKYn6FXDaxkg1ULbYLTio1hNgS hJsei0ZgyTPyG5PeaaJfGTXpU9FYHYNWEceU+OKogtSnNiTOhtU890EKGOisWvToYI1Z 4c69LaldIvL8bVlQ5XHC58Nih9qAkmliD7gIvxCbR8+sKfYHye4ccXP/VPiKZh4QRZbT g+Xw== ARC-Authentication-Results: i=1; mx.google.com; dkim=fail header.i=@linaro.org header.s=google header.b=lMUN8FsR; spf=pass (google.com: domain of qemu-devel-bounces+patch=linaro.org@nongnu.org designates 209.51.188.47 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.47]) by mx.google.com with ESMTPS id u7si903546qkc.254.2019.06.07.03.21.01 for (version=TLS1_2 cipher=ECDHE-RSA-CHACHA20-POLY1305 bits=256/256); Fri, 07 Jun 2019 03:21:01 -0700 (PDT) Received-SPF: pass (google.com: domain of qemu-devel-bounces+patch=linaro.org@nongnu.org designates 209.51.188.47 as permitted sender) client-ip=209.51.188.47; Authentication-Results: mx.google.com; dkim=fail header.i=@linaro.org header.s=google header.b=lMUN8FsR; spf=pass (google.com: domain of qemu-devel-bounces+patch=linaro.org@nongnu.org designates 209.51.188.47 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]:47950 helo=lists.gnu.org) by lists.gnu.org with esmtp (Exim 4.86_2) (envelope-from ) id 1hZBzY-0007Ee-VY for patch@linaro.org; Fri, 07 Jun 2019 06:21:00 -0400 Received: from eggs.gnu.org ([2001:470:142:3::10]:42216) by lists.gnu.org with esmtp (Exim 4.86_2) (envelope-from ) id 1hZAvT-0002Fo-CG for qemu-devel@nongnu.org; Fri, 07 Jun 2019 05:12:45 -0400 Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71) (envelope-from ) id 1hZAvQ-0004zE-Rj for qemu-devel@nongnu.org; Fri, 07 Jun 2019 05:12:43 -0400 Received: from mail-wr1-x42b.google.com ([2a00:1450:4864:20::42b]:46952) by eggs.gnu.org with esmtps (TLS1.0:RSA_AES_128_CBC_SHA1:16) (Exim 4.71) (envelope-from ) id 1hZAvQ-0004h3-Ez for qemu-devel@nongnu.org; Fri, 07 Jun 2019 05:12:40 -0400 Received: by mail-wr1-x42b.google.com with SMTP id n4so1339732wrw.13 for ; Fri, 07 Jun 2019 02:12:32 -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=l3qvsmebNFZ5O5OwW5sp1A169mo8OEERmO3Igp6r4L0=; b=lMUN8FsR0cqZW/CU4/NbtsCLcBR8lJnXtHyTldqgblkNKAnHQK2Qty+ilzAsmIvRii itp+rMKzSh8P3cq5hQUkj47H6JdSGbG8OCq4V8aBzqNm0TYQuRiHK0WZiE9vfNqLM9is Zx7E1hFB5isz0bO1hFi/8Fq6mlR14VurwnJe//aP9z/oWbHWzU5MocnriDBDeMwBZwFz W4X9Yi8WLO3In0d8gVQuoP8RjGtOxJJ2y4zuqYRUDi1oQ4+7+fwJNV7mT1w5SK3Eh0GJ dB5Gd6eu0khJ4r3zAjCaXmbc1RGRiGeaAwqtbhnGcU6vQUieAvcnawtzB6v4G883ucq4 Jx7g== 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=l3qvsmebNFZ5O5OwW5sp1A169mo8OEERmO3Igp6r4L0=; b=sn2hNQONdnZGEFK1AoPkKQnFOXZWeN6PDWd8Vxglu+bak0iyob82IRgOtGfIhSjAEn R0mo6aEGYZda86pN7DOmWKjCav8Mrgs/tnoFUYZSoYp269bIzcAKYGQREs/ZHMB2ohVU 3IKj5wn68LRk5cKL4/oCQttuAZZt/+DpnoBUK8eMe8cyGJDJlhQg21RLqGi0pUKUDO0O debEVEhhe6B+MXDzOWm7L00WHWxjPATGDVHuJCkHjvwE40ylhcszXa/Ol9sen66ZTmb1 mNBOohUKdQgMAJKpvZxWgO/gmlAjo2drP2gki9YS7NSUhWdgtEWqweYeRKu7gBwc2VU3 dKxA== X-Gm-Message-State: APjAAAWNYRm7F9ybf3DkqF4v/vMQZh1bfvUYiPv6jsX7XHrdmKrDgkBn 3flAPIwWFR0NqDZ4tsDdNM3F/g== X-Received: by 2002:adf:d847:: with SMTP id k7mr2611647wrl.144.1559898751374; Fri, 07 Jun 2019 02:12:31 -0700 (PDT) Received: from zen.linaroharston ([81.128.185.34]) by smtp.gmail.com with ESMTPSA id f2sm1244110wru.31.2019.06.07.02.12.27 (version=TLS1_3 cipher=AEAD-AES256-GCM-SHA384 bits=256/256); Fri, 07 Jun 2019 02:12:29 -0700 (PDT) Received: from zen.linaroharston. (localhost [127.0.0.1]) by zen.linaroharston (Postfix) with ESMTP id 6F82F1FFA5; Fri, 7 Jun 2019 10:05:53 +0100 (BST) From: =?utf-8?q?Alex_Benn=C3=A9e?= To: peter.maydell@linaro.org Date: Fri, 7 Jun 2019 10:05:17 +0100 Message-Id: <20190607090552.12434-19-alex.bennee@linaro.org> X-Mailer: git-send-email 2.20.1 In-Reply-To: <20190607090552.12434-1-alex.bennee@linaro.org> References: <20190607090552.12434-1-alex.bennee@linaro.org> MIME-Version: 1.0 X-detected-operating-system: by eggs.gnu.org: Genre and OS details not recognized. X-Received-From: 2a00:1450:4864:20::42b Subject: [Qemu-devel] [PULL 18/52] tests/vm: add vm-boot-{ssh, serial}- targets 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: Fam Zheng , Thomas Huth , =?utf-8?q?Philippe_Mathieu-Daud=C3=A9?= , qemu-devel@nongnu.org, Gerd Hoffmann , =?utf-8?q?Alex_Benn=C3=A9e?= Errors-To: qemu-devel-bounces+patch=linaro.org@nongnu.org Sender: "Qemu-devel" From: Gerd Hoffmann For testing/troubleshooting convinience. make vm-boot-serial- Boot guest, with the serial console on stdio. make vm-boot-ssh- Boot guest, login via ssh. Signed-off-by: Gerd Hoffmann Tested-by: Thomas Huth Reviewed-by: Philippe Mathieu-Daudé Tested-by: Philippe Mathieu-Daudé Message-Id: <20190520124716.30472-8-kraxel@redhat.com> Signed-off-by: Alex Bennée -- 2.20.1 diff --git a/tests/vm/Makefile.include b/tests/vm/Makefile.include index 276b870216..e329129bd6 100644 --- a/tests/vm/Makefile.include +++ b/tests/vm/Makefile.include @@ -20,6 +20,10 @@ vm-test: @echo " vm-build-all - Build QEMU in all VMs" @echo " vm-clean-all - Clean up VM images" @echo + @echo "For trouble-shooting:" + @echo " vm-boot-serial- - Boot guest, serial console on stdio" + @echo " vm-boot-ssh- - Boot guest and login via ssh" + @echo @echo "Special variables:" @echo " BUILD_TARGET=foo - Override the build target" @echo " TARGET_LIST=a,b,c - Override target list in builds" @@ -63,3 +67,18 @@ vm-build-%: $(IMAGES_DIR)/%.img $(if $(EXTRA_CONFIGURE_OPTS),$(EXTRA_CONFIGURE_OPTS)), \ " VM-BUILD $*") +vm-boot-serial-%: $(IMAGES_DIR)/%.img + qemu-system-x86_64 -enable-kvm -m 4G -smp 2 -nographic \ + -drive if=none,id=vblk,cache=writeback,file="$<" \ + -netdev user,id=vnet \ + -device virtio-blk-pci,drive=vblk \ + -device virtio-net-pci,netdev=vnet \ + || true + +vm-boot-ssh-%: $(IMAGES_DIR)/%.img + $(call quiet-command, \ + $(SRC_PATH)/tests/vm/$* \ + --image "$<" \ + --interactive \ + false, \ + " VM-BOOT-SSH $*") From patchwork Fri Jun 7 09:05:18 2019 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 8bit X-Patchwork-Submitter: =?utf-8?q?Alex_Benn=C3=A9e?= X-Patchwork-Id: 166124 Delivered-To: patch@linaro.org Received: by 2002:a92:9e1a:0:0:0:0:0 with SMTP id q26csp441980ili; Fri, 7 Jun 2019 03:16:02 -0700 (PDT) X-Google-Smtp-Source: APXvYqybS3TB5OgcTmtb/CF06p1ozM8hIVrRz7n1h1uWS2So2O/7O4cxm3PfSCbGRLVOKIEsti36 X-Received: by 2002:a05:620a:10bb:: with SMTP id h27mr42251798qkk.147.1559902562689; Fri, 07 Jun 2019 03:16:02 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1559902562; cv=none; d=google.com; s=arc-20160816; b=Hh5CAWnTeD/3jj06snsZofjVLm9xHQpzkUSnUGxCEgJhvv0PK6tWKc/npxfGG0dgcq lBOCn7lIEUjv8HEpFgi9VWA+kfYn1w9ZV1gQkhjUcyylW/Gwq3aPAzqAZawR/uI0vonD 77vQ1TB6eNevqJzcOG7bPNjszGy7FHoHpmewTUe8cQeikzJ95YZlOXv/v0D+gC/7ejYY oyBneNlFvkcCs0wy31UJXYhcseZm6ZxmswzbV4nmRajhHJC7OThk53W3nIA9XdtxumE5 MFFUHR1fARdUtN9Msdfl8Q1tF9mUKyekbd+eTQgmXw8nkC+zVVyVz0DcckFzqnR2wNoB XQAw== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=sender:errors-to:cc:list-subscribe:list-help:list-post:list-archive :list-unsubscribe:list-id:precedence:subject :content-transfer-encoding:mime-version:references:in-reply-to :message-id:date:to:from:dkim-signature; bh=+ZfldLb9B7VeRUSVpRgzD28NkUAhkqFAzhazcc+u144=; b=KY0oYSqXs6F8nDPlR81SNkyo0M1mMa8fa5MoKMQN8inYUQJPqCSSmCzBJ9FBUiAcq8 4eWrVxjEpDtqo5lRBVlwTRX3Jn09/cnpuksz7j3aXe97qkHMtmq4xKL1dvkUDhsMu7le uzc9FSypnYFtEFqyi6sF9x1Iet7vAYdBo7+p3FbUv5N+cAB2Yv+Ee+rQG/RwE9O9N/WE NX7fd4xxvS8S0B2IJN6J7GM5Rgn22uZbGGY29F8XIUzEBoPV4eNn2TD29s/LJeF7ZzNz P1j0q11Yd6ENopACi2pSU8yA8NPw9arZO8M8vZMyLjX8b/hnzCDsvJ4zWtV6GVup3wzw XXLA== ARC-Authentication-Results: i=1; mx.google.com; dkim=fail header.i=@linaro.org header.s=google header.b=cmDTJKEt; spf=pass (google.com: domain of qemu-devel-bounces+patch=linaro.org@nongnu.org designates 209.51.188.47 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.47]) by mx.google.com with ESMTPS id t23si890694qve.79.2019.06.07.03.16.02 for (version=TLS1_2 cipher=ECDHE-RSA-CHACHA20-POLY1305 bits=256/256); Fri, 07 Jun 2019 03:16:02 -0700 (PDT) Received-SPF: pass (google.com: domain of qemu-devel-bounces+patch=linaro.org@nongnu.org designates 209.51.188.47 as permitted sender) client-ip=209.51.188.47; Authentication-Results: mx.google.com; dkim=fail header.i=@linaro.org header.s=google header.b=cmDTJKEt; spf=pass (google.com: domain of qemu-devel-bounces+patch=linaro.org@nongnu.org designates 209.51.188.47 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]:47932 helo=lists.gnu.org) by lists.gnu.org with esmtp (Exim 4.86_2) (envelope-from ) id 1hZBuk-0004UR-23 for patch@linaro.org; Fri, 07 Jun 2019 06:16:02 -0400 Received: from eggs.gnu.org ([2001:470:142:3::10]:45096) by lists.gnu.org with esmtp (Exim 4.86_2) (envelope-from ) id 1hZB55-0008Ns-J7 for qemu-devel@nongnu.org; Fri, 07 Jun 2019 05:22:40 -0400 Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71) (envelope-from ) id 1hZB54-0005ye-LE for qemu-devel@nongnu.org; Fri, 07 Jun 2019 05:22:39 -0400 Received: from mail-wr1-x42b.google.com ([2a00:1450:4864:20::42b]:43671) by eggs.gnu.org with esmtps (TLS1.0:RSA_AES_128_CBC_SHA1:16) (Exim 4.71) (envelope-from ) id 1hZB54-0005xM-Ec for qemu-devel@nongnu.org; Fri, 07 Jun 2019 05:22:38 -0400 Received: by mail-wr1-x42b.google.com with SMTP id r18so1383933wrm.10 for ; Fri, 07 Jun 2019 02:22:38 -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=+ZfldLb9B7VeRUSVpRgzD28NkUAhkqFAzhazcc+u144=; b=cmDTJKEtkMzcr6psA3LNpNyRnkhVyJKJ0w9cn2DW2WpQ8eGs94sCcn54vZ+YUuzKbN kPvRiV1ZVUB1ajzcWuYMr0ui24lzQPm6aa42LOEYZr+RBtLeE3mHRM07Ivi6cgJDCoda 3Ev4rKWnwolD2drdnnTvQUIkcxMWp3wrFWFyJfxnmmp9laDFGr8Qc9ynIQWaTNR+f4UO AD+QuGWUmyirmwG52cSmLFfI9yrdJzmB50dIEHXM89C3uK0l6Gv7ZUkZzipzvS3lFdZR ikwo99G/qvY4Q6HTdP+C1o6buLZqqBidXMky+kqpZQZpT9J5r5RqSHWDh+akIvKNQsZY uplQ== 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=+ZfldLb9B7VeRUSVpRgzD28NkUAhkqFAzhazcc+u144=; b=mLZvspwwkZ3Evn5kpToRbRkHJS+ruBzsWH0DVTYIvlcLXzxoCmJYx4qYJG31XvL/Df cfmSSn0b3wRy045BJnSZkvdbVzvUZJtgzKXsGNgFKn0408zV43YgVVIs+ykTIIuQEvgX UQMkq7YY216MCwqO1qgdAUOV32xltbX+RuagHeHwNpm3pjKsZqYIANKGERyXhdUdLw+P hOfjcopZpqJGRXobxVGXfgW2iMlzJ+jufkQVS1agijKgu/ozn+j9NojgERgNO4GHzIpe 9QZO94wIfAwV3rXSiPOUxpFFuP+6jyIb9U81eP7rtvScs44VucHZx/tgmubxWGNev/cq b8KQ== X-Gm-Message-State: APjAAAXU2EC4egS53IiyYjdSjB+bmsBJCUbvAJKOe3pU/H7L8CRysv0X PhEme/k1tixUewHdznzwwNyP2w== X-Received: by 2002:a5d:4f8b:: with SMTP id d11mr16183565wru.264.1559899357141; Fri, 07 Jun 2019 02:22:37 -0700 (PDT) Received: from zen.linaroharston ([81.128.185.34]) by smtp.gmail.com with ESMTPSA id b136sm1669984wme.30.2019.06.07.02.22.30 (version=TLS1_3 cipher=AEAD-AES256-GCM-SHA384 bits=256/256); Fri, 07 Jun 2019 02:22:35 -0700 (PDT) Received: from zen.linaroharston. (localhost [127.0.0.1]) by zen.linaroharston (Postfix) with ESMTP id 834181FF8C; Fri, 7 Jun 2019 10:05:53 +0100 (BST) From: =?utf-8?q?Alex_Benn=C3=A9e?= To: peter.maydell@linaro.org Date: Fri, 7 Jun 2019 10:05:18 +0100 Message-Id: <20190607090552.12434-20-alex.bennee@linaro.org> X-Mailer: git-send-email 2.20.1 In-Reply-To: <20190607090552.12434-1-alex.bennee@linaro.org> References: <20190607090552.12434-1-alex.bennee@linaro.org> MIME-Version: 1.0 X-detected-operating-system: by eggs.gnu.org: Genre and OS details not recognized. X-Received-From: 2a00:1450:4864:20::42b Subject: [Qemu-devel] [PULL 19/52] tests/vm: add DEBUG=1 to help text 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: Fam Zheng , Thomas Huth , =?utf-8?q?Philippe_Mathieu-Daud=C3=A9?= , qemu-devel@nongnu.org, Gerd Hoffmann , =?utf-8?q?Alex_Benn=C3=A9e?= Errors-To: qemu-devel-bounces+patch=linaro.org@nongnu.org Sender: "Qemu-devel" From: Gerd Hoffmann Signed-off-by: Gerd Hoffmann Reviewed-by: Philippe Mathieu-Daudé Tested-by: Thomas Huth Message-Id: <20190520124716.30472-9-kraxel@redhat.com> [AJB: fix minor conflict] Signed-off-by: Alex Bennée -- 2.20.1 diff --git a/tests/vm/Makefile.include b/tests/vm/Makefile.include index e329129bd6..628eecade7 100644 --- a/tests/vm/Makefile.include +++ b/tests/vm/Makefile.include @@ -25,6 +25,8 @@ vm-test: @echo " vm-boot-ssh- - Boot guest and login via ssh" @echo @echo "Special variables:" + @echo " DEBUG=1 - be verbose, also start interactive" + @echo " shell on build failures" @echo " BUILD_TARGET=foo - Override the build target" @echo " TARGET_LIST=a,b,c - Override target list in builds" @echo ' EXTRA_CONFIGURE_OPTS="..."' From patchwork Fri Jun 7 09:05:19 2019 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 8bit X-Patchwork-Submitter: =?utf-8?q?Alex_Benn=C3=A9e?= X-Patchwork-Id: 166116 Delivered-To: patch@linaro.org Received: by 2002:a92:9e1a:0:0:0:0:0 with SMTP id q26csp437214ili; Fri, 7 Jun 2019 03:11:36 -0700 (PDT) X-Google-Smtp-Source: APXvYqwD+ZNEl0Z+Ib0wNpOxABnk6JmK025f2tgwhzoAnrOD7I7e5aymz8Y3E8hin2srM1+pCmJZ X-Received: by 2002:ad4:53c2:: with SMTP id k2mr41605710qvv.15.1559902296246; Fri, 07 Jun 2019 03:11:36 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1559902296; cv=none; d=google.com; s=arc-20160816; b=MvqtPoar0pR4qVu06LJv2XxNXAFXXI353zgqi8+OWEpiMb5h8Vrf1Qq2VUG//DEsL3 B3d8Etk4jOHAkX9o4McBnKa8fFu4sb5BxAyFIJMIcOJd0rLHdggw8fS+disAjQdAapqL rLpkg8JvzFUAf2HCEBNbwLLt1IFDcvGvnNztT9NnvqaM8ut2o5Fqq/RWRKns3BSR+cVk 9MWEpchu+gIFZSdbWK3JnAG8xXEarZD9nte4beVQgFVBqFkpf55eYTZJCcDCelhGxK/U Z7qcFRIfTgZSIGBewH4OXnyy/1v1++bJA7pVE9NKb2l9a4+EQ2+4CvU7jJgZMYmY5PuH H3kA== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=sender:errors-to:cc:list-subscribe:list-help:list-post:list-archive :list-unsubscribe:list-id:precedence:subject :content-transfer-encoding:mime-version:references:in-reply-to :message-id:date:to:from:dkim-signature; bh=Kc3izJ/caZQgeBSPPI6ZRLJkm9nYRjlGJEG7EHnIId4=; b=XlNBTth7Wemq0IOK3JH2Q8WABiYcUpCN/pyZFT65xJ3zQrmOlHXlkvnH5PO0A/Du40 bcqXYGP6bIR4anNtJTxxflMkGWIa5EvXTCSI9SD6NCQtFnaEVHzyZW/fDl+AzykI8HLm 8s0+FlJaV4buLQdy429jV5yJk4Qg6xUSponnWu9A6XN44a/Nzs2McZBbbiTM9gbcbgtq N74lVHv0T+/Rlf6xXg02neFaa0CTRkurIelICM8SFlkq38oPTwlEHVQGRZPXedAhCvag +Tt33Vz1YdJsYXLt10QwJvRUS7V0Ay+L3RicQfi+JQVLwgEe3t01q6iEiFGxLusC8AIR IOlg== ARC-Authentication-Results: i=1; mx.google.com; dkim=fail header.i=@linaro.org header.s=google header.b=jJc79QIP; spf=pass (google.com: domain of qemu-devel-bounces+patch=linaro.org@nongnu.org designates 209.51.188.47 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.47]) by mx.google.com with ESMTPS id n13si1039752qtn.125.2019.06.07.03.11.36 for (version=TLS1_2 cipher=ECDHE-RSA-CHACHA20-POLY1305 bits=256/256); Fri, 07 Jun 2019 03:11:36 -0700 (PDT) Received-SPF: pass (google.com: domain of qemu-devel-bounces+patch=linaro.org@nongnu.org designates 209.51.188.47 as permitted sender) client-ip=209.51.188.47; Authentication-Results: mx.google.com; dkim=fail header.i=@linaro.org header.s=google header.b=jJc79QIP; spf=pass (google.com: domain of qemu-devel-bounces+patch=linaro.org@nongnu.org designates 209.51.188.47 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]:47882 helo=lists.gnu.org) by lists.gnu.org with esmtp (Exim 4.86_2) (envelope-from ) id 1hZBqR-0000AO-RP for patch@linaro.org; Fri, 07 Jun 2019 06:11:35 -0400 Received: from eggs.gnu.org ([2001:470:142:3::10]:42071) by lists.gnu.org with esmtp (Exim 4.86_2) (envelope-from ) id 1hZAvK-00029C-9n for qemu-devel@nongnu.org; Fri, 07 Jun 2019 05:12:36 -0400 Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71) (envelope-from ) id 1hZAvI-0004iY-B0 for qemu-devel@nongnu.org; Fri, 07 Jun 2019 05:12:34 -0400 Received: from mail-wm1-x331.google.com ([2a00:1450:4864:20::331]:51455) by eggs.gnu.org with esmtps (TLS1.0:RSA_AES_128_CBC_SHA1:16) (Exim 4.71) (envelope-from ) id 1hZAvG-0004cS-9I for qemu-devel@nongnu.org; Fri, 07 Jun 2019 05:12:32 -0400 Received: by mail-wm1-x331.google.com with SMTP id f10so1243589wmb.1 for ; Fri, 07 Jun 2019 02:12:28 -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=Kc3izJ/caZQgeBSPPI6ZRLJkm9nYRjlGJEG7EHnIId4=; b=jJc79QIPZTrHM+bOGn7gTtdrGaDWYdKKWhSSXjBk45e+POj9mZwUfqpsvWDC0nDprA kgvmXfgF9EKa5Y+o17DW+kHg1yrPDlOFcDphyMgVxuoyRuy4C/bqgtvK4kqMT9xxfqKm 9yZmEELhDJ70LU7zi6FhQVZTOvAnoy5OhI2RGt4+qBo+50lPoSySh/RDBx+Cvsjxvx6w I1PU+5L/jN56YBG+LY4yYe36v1natCkoo4huFxTS+oJ3Kg75qxKNNQm5SKTHaZOm87nq tt8HrYstX0BrP93cbQKPHp3UkJvKEphDdjgOMBMG+PIWMN+9vkeEZ83LRxq972ruz2Je gXHw== 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=Kc3izJ/caZQgeBSPPI6ZRLJkm9nYRjlGJEG7EHnIId4=; b=YKLodf45iFGEm5CziyjTUWsA8d3Ua5hA1clRje1Osxsfy2BotXNieKEUJAdYYYyofA MAZmujh2TtJ2ckdsaOgMqg/bPe5PYFRREg1SRRRvh5QNbPE8lhx1D9tfpTnxqlXkceh5 3yicmcseD3F2b4s3J5nR8yyzjrxPCTLSnObrOefZLHOaeaHFVD4wbs7WWamjRztvRLrc uYFJmmjTwAhVMriy5srnDFdUE+cJhDKqDYm9hkE9lBApOhwaA2jao7Dd4nbrTxTXrgC8 y0riJdXBmwyCksf1GYOTDLHyan5w67OqWCmZQWQ3yRsU+qn9KMrpEr+h2AOfgO9c8Vqz K/XQ== X-Gm-Message-State: APjAAAXGgky/watNmnfLnsj6vUVQ/gm6m6DpStZd5+WWgVcBEQsUDSw9 7pC3UjuJgqXc6xxTGd34AoUsgA== X-Received: by 2002:a7b:cc81:: with SMTP id p1mr2720909wma.107.1559898747664; Fri, 07 Jun 2019 02:12:27 -0700 (PDT) Received: from zen.linaroharston ([81.128.185.34]) by smtp.gmail.com with ESMTPSA id s10sm459370wmf.8.2019.06.07.02.12.26 (version=TLS1_3 cipher=AEAD-AES256-GCM-SHA384 bits=256/256); Fri, 07 Jun 2019 02:12:26 -0700 (PDT) Received: from zen.linaroharston. (localhost [127.0.0.1]) by zen.linaroharston (Postfix) with ESMTP id 968991FFA6; Fri, 7 Jun 2019 10:05:53 +0100 (BST) From: =?utf-8?q?Alex_Benn=C3=A9e?= To: peter.maydell@linaro.org Date: Fri, 7 Jun 2019 10:05:19 +0100 Message-Id: <20190607090552.12434-21-alex.bennee@linaro.org> X-Mailer: git-send-email 2.20.1 In-Reply-To: <20190607090552.12434-1-alex.bennee@linaro.org> References: <20190607090552.12434-1-alex.bennee@linaro.org> MIME-Version: 1.0 X-detected-operating-system: by eggs.gnu.org: Genre and OS details not recognized. X-Received-From: 2a00:1450:4864:20::331 Subject: [Qemu-devel] [PULL 20/52] tests/vm: serial console support helpers 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: Fam Zheng , Thomas Huth , =?utf-8?q?Philippe_Mathieu-Daud=C3=A9?= , qemu-devel@nongnu.org, Gerd Hoffmann , =?utf-8?q?Alex_Benn=C3=A9e?= Errors-To: qemu-devel-bounces+patch=linaro.org@nongnu.org Sender: "Qemu-devel" From: Gerd Hoffmann Add a bunch of helpers to talk to the guest using the serial console. Also drop the hard-coded -serial parameter for the vm so QEMUMachine.set_console() actually works. Signed-off-by: Gerd Hoffmann Tested-by: Thomas Huth Reviewed-by: Philippe Mathieu-Daudé Tested-by: Philippe Mathieu-Daudé Message-Id: <20190520124716.30472-10-kraxel@redhat.com> Signed-off-by: Alex Bennée -- 2.20.1 diff --git a/tests/vm/basevm.py b/tests/vm/basevm.py index f27178f3c7..8894267f07 100755 --- a/tests/vm/basevm.py +++ b/tests/vm/basevm.py @@ -2,10 +2,11 @@ # # VM testing base class # -# Copyright 2017 Red Hat Inc. +# Copyright 2017-2019 Red Hat Inc. # # Authors: # Fam Zheng +# Gerd Hoffmann # # This code is licensed under the GPL version 2 or later. See # the COPYING file in the top-level directory. @@ -13,7 +14,9 @@ from __future__ import print_function import os +import re import sys +import socket import logging import time import datetime @@ -79,8 +82,7 @@ class BaseVM(object): "-cpu", "max", "-netdev", "user,id=vnet,hostfwd=:127.0.0.1:0-:22", "-device", "virtio-net-pci,netdev=vnet", - "-vnc", "127.0.0.1:0,to=20", - "-serial", "file:%s" % os.path.join(self._tmpdir, "serial.out")] + "-vnc", "127.0.0.1:0,to=20"] if vcpus and vcpus > 1: self._args += ["-smp", "%d" % vcpus] if kvm_available(self.arch): @@ -162,6 +164,8 @@ class BaseVM(object): logging.debug("QEMU args: %s", " ".join(args)) qemu_bin = os.environ.get("QEMU", "qemu-system-" + self.arch) guest = QEMUMachine(binary=qemu_bin, args=args) + guest.set_machine('pc') + guest.set_console() try: guest.launch() except: @@ -184,6 +188,81 @@ class BaseVM(object): raise Exception("Cannot find ssh port from 'info usernet':\n%s" % \ usernet_info) + def console_init(self, timeout = 120): + vm = self._guest + vm.console_socket.settimeout(timeout) + + def console_log(self, text): + for line in re.split("[\r\n]", text): + # filter out terminal escape sequences + line = re.sub("\x1b\[[0-9;?]*[a-zA-Z]", "", line) + line = re.sub("\x1b\([0-9;?]*[a-zA-Z]", "", line) + # replace unprintable chars + line = re.sub("\x1b", "", line) + line = re.sub("[\x00-\x1f]", ".", line) + if line == "": + continue + # log console line + sys.stderr.write("con recv: %s\n" % line) + + def console_wait(self, expect): + vm = self._guest + output = "" + while True: + try: + chars = vm.console_socket.recv(1024) + except socket.timeout: + sys.stderr.write("console: *** read timeout ***\n") + sys.stderr.write("console: waiting for: '%s'\n" % expect) + sys.stderr.write("console: line buffer:\n") + sys.stderr.write("\n") + self.console_log(output.rstrip()) + sys.stderr.write("\n") + raise + output += chars.decode("latin1") + if expect in output: + break + if "\r" in output or "\n" in output: + lines = re.split("[\r\n]", output) + output = lines.pop() + if self.debug: + self.console_log("\n".join(lines)) + if self.debug: + self.console_log(output) + + def console_send(self, command): + vm = self._guest + if self.debug: + logline = re.sub("\n", "", command) + logline = re.sub("[\x00-\x1f]", ".", logline) + sys.stderr.write("con send: %s\n" % logline) + for char in list(command): + vm.console_socket.send(char.encode("utf-8")) + time.sleep(0.01) + + def console_wait_send(self, wait, command): + self.console_wait(wait) + self.console_send(command) + + def console_ssh_init(self, prompt, user, pw): + sshkey_cmd = "echo '%s' > .ssh/authorized_keys\n" % SSH_PUB_KEY.rstrip() + self.console_wait_send("login:", "%s\n" % user) + self.console_wait_send("Password:", "%s\n" % pw) + self.console_wait_send(prompt, "mkdir .ssh\n") + self.console_wait_send(prompt, sshkey_cmd) + self.console_wait_send(prompt, "chmod 755 .ssh\n") + self.console_wait_send(prompt, "chmod 644 .ssh/authorized_keys\n") + + def console_sshd_config(self, prompt): + self.console_wait(prompt) + self.console_send("echo 'PermitRootLogin yes' >> /etc/ssh/sshd_config\n") + for var in self.envvars: + self.console_wait(prompt) + self.console_send("echo 'AcceptEnv %s' >> /etc/ssh/sshd_config\n" % var) + + def print_step(self, text): + sys.stderr.write("### %s ...\n" % text) + def wait_ssh(self, seconds=300): starttime = datetime.datetime.now() endtime = starttime + datetime.timedelta(seconds=seconds) From patchwork Fri Jun 7 09:05:20 2019 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 8bit X-Patchwork-Submitter: =?utf-8?q?Alex_Benn=C3=A9e?= X-Patchwork-Id: 166136 Delivered-To: patch@linaro.org Received: by 2002:a92:9e1a:0:0:0:0:0 with SMTP id q26csp458200ili; Fri, 7 Jun 2019 03:32:55 -0700 (PDT) X-Google-Smtp-Source: APXvYqzfU25/Eu9NDMnw5xJXJFwTP5eY9uo3VHNaf+WQqC0ERQRJtTgaBEz2tS/K1kQTxGAiRYAL X-Received: by 2002:aed:3a45:: with SMTP id n63mr44780378qte.109.1559903575912; Fri, 07 Jun 2019 03:32:55 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1559903575; cv=none; d=google.com; s=arc-20160816; b=C633OA+w1rSSbMY6+IMLGHTLFyDVANxzuhQZJWxP+9raVtvYvzmYr8ZYxyGC8VwMUb phKOcbVlQxNFvoeq/nOdjC9J3b/FG82CSWXK/F3A6w/bdYhlRwpFD3n8RdgDTVfxinM0 Fq2sdggTiDJ4/iaudyEVM4Wmd+4uD3kTHk0Ej+FkODo3SJ/o0+8h9CBs8rJdgwaskg25 5rkHQNAYCEFids9ie6LMb40Qi+N9P6gcuojMZ3DbSIGbhKkd4+hIH5wAG3ujE42JObJB 1rm7pEW22I+AFAHvVZ7/P97YIkha+ciSlvn3asV6i/Nt/5PLUQ1/pc1QqgDNi1SJDdRv M4wQ== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=sender:errors-to:cc:list-subscribe:list-help:list-post:list-archive :list-unsubscribe:list-id:precedence:subject :content-transfer-encoding:mime-version:references:in-reply-to :message-id:date:to:from:dkim-signature; bh=+eu+J+AReHOJ91tEV+4Y0qnnta+u3KP6te0Wm8mtIjs=; b=ZZC/jsNuoRRJK3UEnSHlalOvjhDl8vEycwcYXKA+L2+3iXOSNeh5gFhwG/o6WTCEZA ABOAvZTkAOLaiuidIxCBZu2lwzsxxQuRj0eWW23zA90z7kgUW9lwqR6g3Ke6oS1x/ORi yvYRuQkD3VI0pT7rzYfgbgIPvSJrazE6b1yliKphdlm0UGtE4a9PHs0pjXs44k0bcpiU AoEXekS5evTyvkGx55NWHeO/yMpLM8CPIjopy9BeWmiASrOjvQYhsMIseI2GPTtvHs34 CtgqLvVjkZEg6bXKYMHxAkt6OR7J31bmTKA8deuR4jnMaJLDmZcJnP0bBqxdGcerNC11 pdYA== ARC-Authentication-Results: i=1; mx.google.com; dkim=fail header.i=@linaro.org header.s=google header.b=kvkb8v3n; spf=pass (google.com: domain of qemu-devel-bounces+patch=linaro.org@nongnu.org designates 209.51.188.47 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.47]) by mx.google.com with ESMTPS id m125si296636qkd.251.2019.06.07.03.32.55 for (version=TLS1_2 cipher=ECDHE-RSA-CHACHA20-POLY1305 bits=256/256); Fri, 07 Jun 2019 03:32:55 -0700 (PDT) Received-SPF: pass (google.com: domain of qemu-devel-bounces+patch=linaro.org@nongnu.org designates 209.51.188.47 as permitted sender) client-ip=209.51.188.47; Authentication-Results: mx.google.com; dkim=fail header.i=@linaro.org header.s=google header.b=kvkb8v3n; spf=pass (google.com: domain of qemu-devel-bounces+patch=linaro.org@nongnu.org designates 209.51.188.47 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]:48058 helo=lists.gnu.org) by lists.gnu.org with esmtp (Exim 4.86_2) (envelope-from ) id 1hZCB5-0006hL-Cl for patch@linaro.org; Fri, 07 Jun 2019 06:32:55 -0400 Received: from eggs.gnu.org ([2001:470:142:3::10]:45061) by lists.gnu.org with esmtp (Exim 4.86_2) (envelope-from ) id 1hZB54-0008IM-2e for qemu-devel@nongnu.org; Fri, 07 Jun 2019 05:22:39 -0400 Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71) (envelope-from ) id 1hZB52-0005vn-5x for qemu-devel@nongnu.org; Fri, 07 Jun 2019 05:22:38 -0400 Received: from mail-wm1-x330.google.com ([2a00:1450:4864:20::330]:35367) by eggs.gnu.org with esmtps (TLS1.0:RSA_AES_128_CBC_SHA1:16) (Exim 4.71) (envelope-from ) id 1hZB51-0005ud-Th for qemu-devel@nongnu.org; Fri, 07 Jun 2019 05:22:36 -0400 Received: by mail-wm1-x330.google.com with SMTP id c6so1192313wml.0 for ; Fri, 07 Jun 2019 02:22:35 -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=+eu+J+AReHOJ91tEV+4Y0qnnta+u3KP6te0Wm8mtIjs=; b=kvkb8v3n1wMTsnt8/p2c2ie+j35xWYiKp5s+i4TltGuiugslWamLojffr9Av5iHs5y HbpweHyAPQu4LkKM0wgG1FOmcBglebJp3xDvLGuzjRLS5lYyB/QHT9LEFvHebVA1KzR+ QDHh8rJmXPAHv1Bz4r+YDk5IlLzi3IJ9hQCSbOMlFRyeg1+fsAG1mDgn9A5sxAQKKhKt m5Wl3VQx3nlyMrcxhOpqbs3+M4a7mATLvr4yL6x6HYbtxgn844uNk5M2SrkwSqBR6O3N a1gfCI9V/PpW3gbLPiIodsWQGuizkIX+aBBJp5HO78As6Z4hzU0OcgmCPuCEgLmmRlow qpYA== 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=+eu+J+AReHOJ91tEV+4Y0qnnta+u3KP6te0Wm8mtIjs=; b=BDLkqQx6EcqdF51L31Vy6vv7+gs0bFSZRQRHkIjnAZUMC1hjo5xAjV3f1UiKePC8Ix X74rs/Vm6RC1EGvfvAt0EczrDetsha9icaApfu+1D/v8zqiOSjVBk8MrexNqHrYV8s8m bDxrzC/Ei0dvHjxZVHoxpTH+A62gNjkVhUarcXUlGvsk8RebmC0mgXoQJPz3Kt+PmhTZ l6HarZBnoqRj7a4icwRNjiMyxQdhiNzFpfI2VaaB2TFX3SJQF8AC3j3QQZ+/SYY5Oos1 bOhidRxVXYXyFu4jTU6gym5HTPJoN3IvEIAqfdcLkm1BfS/D9rk4VXJnE02RFHKMA3hq UDYQ== X-Gm-Message-State: APjAAAX8RoNa6OWYIzHB+eKRc8l7DWMXnweb0uE8BoJFpnGcssIdf8p2 7MTchC95FfwLfRX5Vz52qz5yig== X-Received: by 2002:a1c:480a:: with SMTP id v10mr2899790wma.120.1559899354889; Fri, 07 Jun 2019 02:22:34 -0700 (PDT) Received: from zen.linaroharston ([81.128.185.34]) by smtp.gmail.com with ESMTPSA id y133sm2528618wmg.5.2019.06.07.02.22.28 (version=TLS1_3 cipher=AEAD-AES256-GCM-SHA384 bits=256/256); Fri, 07 Jun 2019 02:22:30 -0700 (PDT) Received: from zen.linaroharston. (localhost [127.0.0.1]) by zen.linaroharston (Postfix) with ESMTP id AA4AB1FFA9; Fri, 7 Jun 2019 10:05:53 +0100 (BST) From: =?utf-8?q?Alex_Benn=C3=A9e?= To: peter.maydell@linaro.org Date: Fri, 7 Jun 2019 10:05:20 +0100 Message-Id: <20190607090552.12434-22-alex.bennee@linaro.org> X-Mailer: git-send-email 2.20.1 In-Reply-To: <20190607090552.12434-1-alex.bennee@linaro.org> References: <20190607090552.12434-1-alex.bennee@linaro.org> MIME-Version: 1.0 X-detected-operating-system: by eggs.gnu.org: Genre and OS details not recognized. X-Received-From: 2a00:1450:4864:20::330 Subject: [Qemu-devel] [PULL 21/52] tests/vm: openbsd autoinstall, using serial console 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: Fam Zheng , =?utf-8?q?Philippe_Mathieu-Daud=C3=A9?= , qemu-devel@nongnu.org, Gerd Hoffmann , =?utf-8?q?Alex_Benn=C3=A9e?= , Brad Smith Errors-To: qemu-devel-bounces+patch=linaro.org@nongnu.org Sender: "Qemu-devel" From: Gerd Hoffmann Instead of fetching the prebuilt image from patchew download the install iso and prepare the image locally. Install to disk, using the serial console. Create qemu user, configure ssh login. Install packages needed for qemu builds. Signed-off-by: Gerd Hoffmann Reviewed-by: Philippe Mathieu-Daudé Tested-by: Philippe Mathieu-Daudé Message-Id: <20190520124716.30472-11-kraxel@redhat.com> Signed-off-by: Alex Bennée -- 2.20.1 diff --git a/tests/vm/openbsd b/tests/vm/openbsd index 2105c01a26..c5f0a15218 100755 --- a/tests/vm/openbsd +++ b/tests/vm/openbsd @@ -2,10 +2,11 @@ # # OpenBSD VM image # -# Copyright 2017 Red Hat Inc. +# Copyright 2017-2019 Red Hat Inc. # # Authors: # Fam Zheng +# Gerd Hoffmann # # This code is licensed under the GPL version 2 or later. See # the COPYING file in the top-level directory. @@ -13,34 +14,165 @@ import os import sys +import socket import subprocess import basevm class OpenBSDVM(basevm.BaseVM): name = "openbsd" arch = "x86_64" + + link = "https://cdn.openbsd.org/pub/OpenBSD/6.5/amd64/install65.iso" + csum = "38d1f8cadd502f1c27bf05c5abde6cc505dd28f3f34f8a941048ff9a54f9f608" + size = "20G" + pkgs = [ + # tools + "git", + "pkgconf", + "bzip2", "xz", + + # gnu tools + "bash", + "gmake", + "gsed", + "bison", + + # libs: usb + "libusb1", + + # libs: crypto + "gnutls", + + # libs: images + "jpeg", + "png", + + # libs: ui + "sdl2", + "gtk+3", + "libxkbcommon", + ] + BUILD_SCRIPT = """ set -e; - rm -rf /var/tmp/qemu-test.* - cd $(mktemp -d /var/tmp/qemu-test.XXXXXX); + rm -rf /home/qemu/qemu-test.* + cd $(mktemp -d /home/qemu/qemu-test.XXXXXX); + mkdir src build; cd src; tar -xf /dev/rsd1c; - ./configure --cc=x86_64-unknown-openbsd6.1-gcc-4.9.4 --python=python2.7 {configure_opts}; - gmake --output-sync -j{jobs} {verbose}; - # XXX: "gmake check" seems to always hang or fail - #gmake --output-sync -j{jobs} check {verbose}; + cd ../build + ../src/configure --cc=cc --python=python3 {configure_opts}; + gmake --output-sync -j{jobs} {target} {verbose}; """ + poweroff = "halt -p" def build_image(self, img): - cimg = self._download_with_cache("http://download.patchew.org/openbsd-6.1-amd64.img.xz", - sha256sum='8c6cedc483e602cfee5e04f0406c64eb99138495e8ca580bc0293bcf0640c1bf') - img_tmp_xz = img + ".tmp.xz" + self.print_step("Downloading install iso") + cimg = self._download_with_cache(self.link, sha256sum=self.csum) img_tmp = img + ".tmp" - sys.stderr.write("Extracting the image...\n") - subprocess.check_call(["cp", "-f", cimg, img_tmp_xz]) - subprocess.check_call(["xz", "-dvf", img_tmp_xz]) + iso = img + ".install.iso" + + self.print_step("Preparing iso and disk image") + subprocess.check_call(["cp", "-f", cimg, iso]) + subprocess.check_call(["qemu-img", "create", "-f", "qcow2", + img_tmp, self.size]) + + self.print_step("Booting installer") + self.boot(img_tmp, extra_args = [ + "-machine", "graphics=off", + "-cdrom", iso + ]) + self.console_init() + self.console_wait_send("boot>", "set tty com0\n") + self.console_wait_send("boot>", "\n") + + # pre-install configuration + self.console_wait_send("(I)nstall", "i\n") + self.console_wait_send("Terminal type", "xterm\n") + self.console_wait_send("System hostname", "openbsd\n") + self.console_wait_send("Which network interface", "vio0\n") + self.console_wait_send("IPv4 address", "dhcp\n") + self.console_wait_send("IPv6 address", "none\n") + self.console_wait_send("Which network interface", "done\n") + self.console_wait_send("DNS domain name", "localnet\n") + self.console_wait("Password for root account") + self.console_send("%s\n" % self.ROOT_PASS) + self.console_wait("Password for root account") + self.console_send("%s\n" % self.ROOT_PASS) + self.console_wait_send("Start sshd(8)", "yes\n") + self.console_wait_send("X Window System", "\n") + self.console_wait_send("xenodm", "\n") + self.console_wait_send("console to com0", "\n") + self.console_wait_send("Which speed", "\n") + + self.console_wait("Setup a user") + self.console_send("%s\n" % self.GUEST_USER) + self.console_wait("Full name") + self.console_send("%s\n" % self.GUEST_USER) + self.console_wait("Password") + self.console_send("%s\n" % self.GUEST_PASS) + self.console_wait("Password") + self.console_send("%s\n" % self.GUEST_PASS) + + self.console_wait_send("Allow root ssh login", "yes\n") + self.console_wait_send("timezone", "UTC\n") + self.console_wait_send("root disk", "\n") + self.console_wait_send("(W)hole disk", "\n") + self.console_wait_send("(A)uto layout", "\n") + self.console_wait_send("Location of sets", "cd0\n") + self.console_wait_send("Pathname to the sets", "\n") + self.console_wait_send("Set name(s)", "\n") + self.console_wait_send("without verification", "yes\n") + + self.print_step("Installation started now, this will take a while") + self.console_wait_send("Location of sets", "done\n") + + self.console_wait("successfully completed") + self.print_step("Installation finished, rebooting") + self.console_wait_send("(R)eboot", "reboot\n") + + # setup qemu user + prompt = "$" + self.console_ssh_init(prompt, self.GUEST_USER, self.GUEST_PASS) + self.console_wait_send(prompt, "exit\n") + + # setup root user + prompt = "openbsd#" + self.console_ssh_init(prompt, "root", self.ROOT_PASS) + self.console_sshd_config(prompt) + + # setup virtio-blk #1 (tarfile) + self.console_wait(prompt) + self.console_send("echo 'chmod 666 /dev/rsd1c' >> /etc/rc.local\n") + + # enable w+x for /home + self.console_wait(prompt) + self.console_send("sed -i -e '/home/s/rw,/rw,wxallowed,/' /etc/fstab\n") + + # tweak datasize limit + self.console_wait(prompt) + self.console_send("sed -i -e 's/\\(datasize[^=]*\\)=[^:]*/\\1=infinity/' /etc/login.conf\n") + + # use http (be proxy cache friendly) + self.console_wait(prompt) + self.console_send("sed -i -e 's/https/http/' /etc/installurl\n") + + self.print_step("Configuration finished, rebooting") + self.console_wait_send(prompt, "reboot\n") + self.console_wait("login:") + self.wait_ssh() + + self.print_step("Installing packages") + self.ssh_root_check("pkg_add %s\n" % " ".join(self.pkgs)) + + # shutdown + self.ssh_root(self.poweroff) + self.wait() + if os.path.exists(img): os.remove(img) os.rename(img_tmp, img) + os.remove(iso) + self.print_step("All done") if __name__ == "__main__": sys.exit(basevm.main(OpenBSDVM)) From patchwork Fri Jun 7 09:05:21 2019 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 8bit X-Patchwork-Submitter: =?utf-8?q?Alex_Benn=C3=A9e?= X-Patchwork-Id: 166135 Delivered-To: patch@linaro.org Received: by 2002:a92:9e1a:0:0:0:0:0 with SMTP id q26csp457293ili; Fri, 7 Jun 2019 03:32:06 -0700 (PDT) X-Google-Smtp-Source: APXvYqxfCx2T5/EFObEJINsJBDo0DuAXrhrrkQrmHeu2yGqqeolagx5PUHlYBRluQLIRAzJkqo7h X-Received: by 2002:ad4:43e3:: with SMTP id f3mr208194qvu.108.1559903526400; Fri, 07 Jun 2019 03:32:06 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1559903526; cv=none; d=google.com; s=arc-20160816; b=hfYNyTTLH0Fn0erKp4DzKIcTmrWjov6E2gn8d5+vZGgClmzIFQBzQOfcgt8U7HL7vn RAoy7+zh9V/z1homQtLl7rPbOamPCBi+ul8wQ4zbS4Z+jKUExI1bHpaY2+uKbMamJ/uu +FwxSSYZ5cjQSBl6GKYw2FOe3GNHZbZWpd2oOWEV44r6cmFOf5rHSVTVrjXXTzA8Vnva vYFBK7C4kDDriFAGHeHSku34GY6tDBeGV903BscYIkJmKtazdhcD9zcYHbh3QMUW+xgV ZRc2i38Mp5x5RuUJvA2LnFZCDJuPk0TPSILMC5fFPCXkCtdo58jrJ9uqS4eZgO/EZL8n 2B9w== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=sender:errors-to:cc:list-subscribe:list-help:list-post:list-archive :list-unsubscribe:list-id:precedence:subject :content-transfer-encoding:mime-version:references:in-reply-to :message-id:date:to:from:dkim-signature; bh=cPFW/NQCTD1YuEWUMaj2AKLzeFOOtVT+5XvLwXo1SAo=; b=sNvjR+PHQ3CnM+lkFTQFwxHjG9Xwk632imOv9G51hhUc7y2Jx0zfKF04SaFwUbIKGJ eLWbVzvpdvosqoqvx9lbK81RIttB3znSgdySuzOp4jZAjhUql4TPJRzo5nePbyUL91UM axQrSHfQ2x2uFTYr4MvMhMT0pWP0xa1UWIsnrJn5We3i/tDQ6L34R+PoKmCLU4H2MZTk oS3dELqHOD3kedCC/qemd5FyDtANbgyubzpeA0rdVw2sbKwd2/gH411zETxUtSq6opK/ KbM7Qyh9pSznTRN5VYSrC2VP4ksij55oe7NLF3meHMBowkDiN/LME3qShzoNFTzz5alE DHXQ== ARC-Authentication-Results: i=1; mx.google.com; dkim=fail header.i=@linaro.org header.s=google header.b=z42f2zZG; spf=pass (google.com: domain of qemu-devel-bounces+patch=linaro.org@nongnu.org designates 209.51.188.47 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.47]) by mx.google.com with ESMTPS id f204si942042qke.8.2019.06.07.03.32.06 for (version=TLS1_2 cipher=ECDHE-RSA-CHACHA20-POLY1305 bits=256/256); Fri, 07 Jun 2019 03:32:06 -0700 (PDT) Received-SPF: pass (google.com: domain of qemu-devel-bounces+patch=linaro.org@nongnu.org designates 209.51.188.47 as permitted sender) client-ip=209.51.188.47; Authentication-Results: mx.google.com; dkim=fail header.i=@linaro.org header.s=google header.b=z42f2zZG; spf=pass (google.com: domain of qemu-devel-bounces+patch=linaro.org@nongnu.org designates 209.51.188.47 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]:48056 helo=lists.gnu.org) by lists.gnu.org with esmtp (Exim 4.86_2) (envelope-from ) id 1hZCAH-0006WY-WC for patch@linaro.org; Fri, 07 Jun 2019 06:32:06 -0400 Received: from eggs.gnu.org ([2001:470:142:3::10]:45047) by lists.gnu.org with esmtp (Exim 4.86_2) (envelope-from ) id 1hZB53-0008GQ-HY for qemu-devel@nongnu.org; Fri, 07 Jun 2019 05:22:39 -0400 Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71) (envelope-from ) id 1hZB51-0005uu-Li for qemu-devel@nongnu.org; Fri, 07 Jun 2019 05:22:37 -0400 Received: from mail-wm1-x335.google.com ([2a00:1450:4864:20::335]:39299) by eggs.gnu.org with esmtps (TLS1.0:RSA_AES_128_CBC_SHA1:16) (Exim 4.71) (envelope-from ) id 1hZB51-0005te-De for qemu-devel@nongnu.org; Fri, 07 Jun 2019 05:22:35 -0400 Received: by mail-wm1-x335.google.com with SMTP id z23so1177080wma.4 for ; Fri, 07 Jun 2019 02:22:35 -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=cPFW/NQCTD1YuEWUMaj2AKLzeFOOtVT+5XvLwXo1SAo=; b=z42f2zZG7+J1Td+/0hAcxWML9WeGqhHM790kp0lQP1EmrDG2NhMT/0gGdDrchSbbf5 cz8VyKvaQqJdK94Vep7OO3kzfc2TU/52vbi7F+3Rdg/DC2ICioHM8Fjjx7zW4rQfRd/A zZo+5HiksV0i9BMhNWMLu7Zov6jgE48PffcS7aBlIKr3sEQJlcIA8iAcoSPXb94LAV67 Avl6gZfGJG/2hBkiazYQ7dXltaao5M4zEzBmfQwiJv/jABM3vgR0j8wQtVrA4/Y79fWR eHxbJKmuEXhKCUfFqL73+1zAec7IquM/rbSvhgEzzNcxa0OFsrBlHKk4JQ24YdzzeSnt XoeQ== 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=cPFW/NQCTD1YuEWUMaj2AKLzeFOOtVT+5XvLwXo1SAo=; b=Hf4hJws+jhLDa2O8Z/o1ZfiyyknAEnM1OLvtU7Ys3uXTvZrBh2kDLetQkISUovUNpq PB5MEkXOMvij0NgzZvGWbNXsIno9k4yzxGvSCj1UW4IajnH4pUTW5T8sFHanuORJGonH KFztt9h9Zif8JF3tDT9YX8qXEM5eV9jZhfoEz2u2ryc9H+9hl3pyys/8U8itJw6y1TRM uxrNPgWlglb7uzi5bY2pOOsAYjBhuxyiBZdQrVStRIadc7BbqmnCJEuIW2FQsMt48vLF FgOOn8rLoUqJ1XmFAyEhiB96rbzvdxoBxXNWqClscXkEPPFI7M8oaJUciZE188bkcxba 1+Qw== X-Gm-Message-State: APjAAAVPuVHmIcqZblu7J+8rr63QMrdLjQ/ukKwDkU4nT42g1zfSYJ+m HuMbxBGXHUczrOoWdCFJxim9AA== X-Received: by 2002:a1c:f20c:: with SMTP id s12mr3109561wmc.151.1559899354197; Fri, 07 Jun 2019 02:22:34 -0700 (PDT) Received: from zen.linaroharston ([81.128.185.34]) by smtp.gmail.com with ESMTPSA id e7sm1250790wmd.0.2019.06.07.02.22.28 (version=TLS1_3 cipher=AEAD-AES256-GCM-SHA384 bits=256/256); Fri, 07 Jun 2019 02:22:30 -0700 (PDT) Received: from zen.linaroharston. (localhost [127.0.0.1]) by zen.linaroharston (Postfix) with ESMTP id BDFA71FFAA; Fri, 7 Jun 2019 10:05:53 +0100 (BST) From: =?utf-8?q?Alex_Benn=C3=A9e?= To: peter.maydell@linaro.org Date: Fri, 7 Jun 2019 10:05:21 +0100 Message-Id: <20190607090552.12434-23-alex.bennee@linaro.org> X-Mailer: git-send-email 2.20.1 In-Reply-To: <20190607090552.12434-1-alex.bennee@linaro.org> References: <20190607090552.12434-1-alex.bennee@linaro.org> MIME-Version: 1.0 X-detected-operating-system: by eggs.gnu.org: Genre and OS details not recognized. X-Received-From: 2a00:1450:4864:20::335 Subject: [Qemu-devel] [PULL 22/52] tests/vm: freebsd autoinstall, using serial console 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: Fam Zheng , Thomas Huth , =?utf-8?q?Philippe_Mathieu-Daud=C3=A9?= , qemu-devel@nongnu.org, Gerd Hoffmann , =?utf-8?q?Alex_Benn=C3=A9e?= Errors-To: qemu-devel-bounces+patch=linaro.org@nongnu.org Sender: "Qemu-devel" From: Gerd Hoffmann Instead of fetching the prebuilt image from patchew download the install iso and prepare the image locally. Install to disk, using the serial console. Create qemu user, configure ssh login. Install packages needed for qemu builds. Note that freebsd package downloads are delivered as non-cachable content, so I had to configure squid with "ignore-no-store ignore-private ignore-reload" for pkgmir.geo.freebsd.org to make the caching actually work. Signed-off-by: Gerd Hoffmann Reviewed-by: Philippe Mathieu-Daudé Tested-by: Philippe Mathieu-Daudé Tested-by: Thomas Huth Message-Id: <20190520124716.30472-12-kraxel@redhat.com> Signed-off-by: Alex Bennée -- 2.20.1 diff --git a/tests/vm/freebsd b/tests/vm/freebsd index b0066017a6..eb029bdfed 100755 --- a/tests/vm/freebsd +++ b/tests/vm/freebsd @@ -2,43 +2,202 @@ # # FreeBSD VM image # -# Copyright 2017 Red Hat Inc. +# Copyright 2017-2019 Red Hat Inc. # # Authors: # Fam Zheng +# Gerd Hoffmann # # This code is licensed under the GPL version 2 or later. See # the COPYING file in the top-level directory. # import os +import re import sys +import time +import socket import subprocess import basevm class FreeBSDVM(basevm.BaseVM): name = "freebsd" arch = "x86_64" + + link = "https://download.freebsd.org/ftp/releases/ISO-IMAGES/12.0/FreeBSD-12.0-RELEASE-amd64-disc1.iso.xz" + csum = "1d40015bea89d05b8bd13e2ed80c40b522a9ec1abd8e7c8b80954fb485fb99db" + size = "20G" + pkgs = [ + # build tools + "git", + "pkgconf", + "bzip2", + + # gnu tools + "bash", + "gmake", + "gsed", + "flex", "bison", + + # libs: crypto + "gnutls", + + # libs: images + "jpeg-turbo", + "png", + + # libs: ui + "sdl2", + "gtk3", + "libxkbcommon", + + # libs: opengl + "libepoxy", + "mesa-libs", + ] + BUILD_SCRIPT = """ set -e; - rm -rf /var/tmp/qemu-test.* - cd $(mktemp -d /var/tmp/qemu-test.XXXXXX); + rm -rf /home/qemu/qemu-test.* + cd $(mktemp -d /home/qemu/qemu-test.XXXXXX); + mkdir src build; cd src; tar -xf /dev/vtbd1; - ./configure {configure_opts}; + cd ../build + ../src/configure --python=python3.6 {configure_opts}; gmake --output-sync -j{jobs} {target} {verbose}; """ + def console_boot_serial(self): + self.console_wait_send("Autoboot", "3") + self.console_wait_send("OK", "set console=comconsole\n") + self.console_wait_send("OK", "boot\n") + def build_image(self, img): - cimg = self._download_with_cache("http://download.patchew.org/freebsd-11.1-amd64.img.xz", - sha256sum='adcb771549b37bc63826c501f05121a206ed3d9f55f49145908f7e1432d65891') - img_tmp_xz = img + ".tmp.xz" + self.print_step("Downloading install iso") + cimg = self._download_with_cache(self.link, sha256sum=self.csum) img_tmp = img + ".tmp" - sys.stderr.write("Extracting the image...\n") - subprocess.check_call(["cp", "-f", cimg, img_tmp_xz]) - subprocess.check_call(["xz", "-dvf", img_tmp_xz]) + iso = img + ".install.iso" + iso_xz = iso + ".xz" + + self.print_step("Preparing iso and disk image") + subprocess.check_call(["cp", "-f", cimg, iso_xz]) + subprocess.check_call(["xz", "-dvf", iso_xz]) + subprocess.check_call(["qemu-img", "create", "-f", "qcow2", + img_tmp, self.size]) + + self.print_step("Booting installer") + self.boot(img_tmp, extra_args = [ + "-machine", "graphics=off", + "-cdrom", iso + ]) + self.console_init() + self.console_boot_serial() + self.console_wait_send("Console type", "xterm\n") + + # pre-install configuration + self.console_wait_send("Welcome", "\n") + self.console_wait_send("Keymap Selection", "\n") + self.console_wait_send("Set Hostname", "freebsd\n") + self.console_wait_send("Distribution Select", "\n") + self.console_wait_send("Partitioning", "\n") + self.console_wait_send("Partition", "\n") + self.console_wait_send("Scheme", "\n") + self.console_wait_send("Editor", "f") + self.console_wait_send("Confirmation", "c") + + self.print_step("Installation started now, this will take a while") + + # post-install configuration + self.console_wait("New Password:") + self.console_send("%s\n" % self.ROOT_PASS) + self.console_wait("Retype New Password:") + self.console_send("%s\n" % self.ROOT_PASS) + + self.console_wait_send("Network Configuration", "\n") + self.console_wait_send("IPv4", "y") + self.console_wait_send("DHCP", "y") + self.console_wait_send("IPv6", "n") + self.console_wait_send("Resolver", "\n") + + self.console_wait_send("Time Zone Selector", "a\n") + self.console_wait_send("Confirmation", "y") + self.console_wait_send("Time & Date", "\n") + self.console_wait_send("Time & Date", "\n") + + self.console_wait_send("System Configuration", "\n") + self.console_wait_send("System Hardening", "\n") + + # qemu user + self.console_wait_send("Add User Accounts", "y") + self.console_wait("Username") + self.console_send("%s\n" % self.GUEST_USER) + self.console_wait("Full name") + self.console_send("%s\n" % self.GUEST_USER) + self.console_wait_send("Uid", "\n") + self.console_wait_send("Login group", "\n") + self.console_wait_send("Login group", "\n") + self.console_wait_send("Login class", "\n") + self.console_wait_send("Shell", "\n") + self.console_wait_send("Home directory", "\n") + self.console_wait_send("Home directory perm", "\n") + self.console_wait_send("Use password", "\n") + self.console_wait_send("Use an empty password", "\n") + self.console_wait_send("Use a random password", "\n") + self.console_wait("Enter password:") + self.console_send("%s\n" % self.GUEST_PASS) + self.console_wait("Enter password again:") + self.console_send("%s\n" % self.GUEST_PASS) + self.console_wait_send("Lock out", "\n") + self.console_wait_send("OK", "yes\n") + self.console_wait_send("Add another user", "no\n") + + self.console_wait_send("Final Configuration", "\n") + self.console_wait_send("Manual Configuration", "\n") + self.console_wait_send("Complete", "\n") + + self.print_step("Installation finished, rebooting") + self.console_boot_serial() + + # setup qemu user + prompt = "$" + self.console_ssh_init(prompt, self.GUEST_USER, self.GUEST_PASS) + self.console_wait_send(prompt, "exit\n") + + # setup root user + prompt = "root@freebsd:~ #" + self.console_ssh_init(prompt, "root", self.ROOT_PASS) + self.console_sshd_config(prompt) + + # setup serial console + self.console_wait(prompt) + self.console_send("echo 'console=comconsole' >> /boot/loader.conf\n") + + # setup boot delay + self.console_wait(prompt) + self.console_send("echo 'autoboot_delay=1' >> /boot/loader.conf\n") + + # setup virtio-blk #1 (tarfile) + self.console_wait(prompt) + self.console_send("echo 'chmod 666 /dev/vtbd1' >> /etc/rc.local\n") + + self.print_step("Configuration finished, rebooting") + self.console_wait_send(prompt, "reboot\n") + self.console_wait("login:") + self.wait_ssh() + + self.print_step("Installing packages") + self.ssh_root_check("pkg install -y %s\n" % " ".join(self.pkgs)) + + # shutdown + self.ssh_root(self.poweroff) + self.console_wait("Uptime:") + self.wait() + if os.path.exists(img): os.remove(img) os.rename(img_tmp, img) + os.remove(iso) + self.print_step("All done") if __name__ == "__main__": sys.exit(basevm.main(FreeBSDVM)) From patchwork Fri Jun 7 09:05:22 2019 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 8bit X-Patchwork-Submitter: =?utf-8?q?Alex_Benn=C3=A9e?= X-Patchwork-Id: 166119 Delivered-To: patch@linaro.org Received: by 2002:a92:9e1a:0:0:0:0:0 with SMTP id q26csp438537ili; Fri, 7 Jun 2019 03:12:53 -0700 (PDT) X-Google-Smtp-Source: APXvYqxyR6cve0sdkdrJ8jVI1FMzIKdz42voPvJjmETZPcCultXLdtTszb0/e3goMjYl4t6BMeZJ X-Received: by 2002:ac8:23e4:: with SMTP id r33mr44472509qtr.162.1559902373328; Fri, 07 Jun 2019 03:12:53 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1559902373; cv=none; d=google.com; s=arc-20160816; b=mR6DtaKNtPK9g6y/VpfyLB64eNznjUhf74j3DBGRFq3iPt+AeT78z0/bwZPQYMDQVt uWPIboxtsaGmiHTeA4auHL62R8+JKeRi8m8cSbwHQ6fm0g+LMaHm6lWBSvnAeB6HUfRl Lei1+AwXB9LcIx0LVgErLz0/6XUHVxDS9q4uosxhRJzTlCgKnJS5O/XxAy8Qa3gdvCEV w1otnP9UNHVJYlT8AzYXL5MYFlpd7Vg8FNDm5Zt6/UZ5R2rAG85ybUAUv/aAXkpFnGm8 roVZo3JvWSGbZskeuDiE+Oavm0ASe3LZvhhtcMcGF3btcak/4lq9CNm2LgEh+b9kZOgF hdYQ== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=sender:errors-to:cc:list-subscribe:list-help:list-post:list-archive :list-unsubscribe:list-id:precedence:subject :content-transfer-encoding:mime-version:references:in-reply-to :message-id:date:to:from:dkim-signature; bh=FsH9fIoqslU5eUblZQD4hWHct1S0ABTNMLOgnPxlbLE=; b=o79Q/mECadRLAI/SGrIcFRBM7T75rIUS7Enm0r7unzcYbSEV1ldSHGpdcy7E8KB/i9 HZCbtGc/CTyeXQFToZ62G4oTRuVf3sYX0Fp6gG+Um2qUzxrO3NW8B5WYXVd+YPNMKjv+ QwA3erQePy1sf2pb8KS4cqIOSumY1gNX2mdBsspITNkHcvLC0XdFnIWJBEgharpUldFc EMfQH6kiba1Pdht8OMXGn+KSuUdeict9xrAzYuKJJFim6oTWWRIV57eVatjmwkP4GGuB Si/bOdqoRIjqXdq1LSvXRxK6seuJNYrtTk0RxI3DDcfi5AUyJtSID3TAtyDQZwEYgmcy SRBw== ARC-Authentication-Results: i=1; mx.google.com; dkim=fail header.i=@linaro.org header.s=google header.b=aWXmPjGB; spf=pass (google.com: domain of qemu-devel-bounces+patch=linaro.org@nongnu.org designates 209.51.188.47 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.47]) by mx.google.com with ESMTPS id x22si1020983qth.74.2019.06.07.03.12.53 for (version=TLS1_2 cipher=ECDHE-RSA-CHACHA20-POLY1305 bits=256/256); Fri, 07 Jun 2019 03:12:53 -0700 (PDT) Received-SPF: pass (google.com: domain of qemu-devel-bounces+patch=linaro.org@nongnu.org designates 209.51.188.47 as permitted sender) client-ip=209.51.188.47; Authentication-Results: mx.google.com; dkim=fail header.i=@linaro.org header.s=google header.b=aWXmPjGB; spf=pass (google.com: domain of qemu-devel-bounces+patch=linaro.org@nongnu.org designates 209.51.188.47 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]:47902 helo=lists.gnu.org) by lists.gnu.org with esmtp (Exim 4.86_2) (envelope-from ) id 1hZBrg-0001Ot-Tp for patch@linaro.org; Fri, 07 Jun 2019 06:12:52 -0400 Received: from eggs.gnu.org ([2001:470:142:3::10]:42226) by lists.gnu.org with esmtp (Exim 4.86_2) (envelope-from ) id 1hZAvT-0002H6-QI for qemu-devel@nongnu.org; Fri, 07 Jun 2019 05:12:46 -0400 Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71) (envelope-from ) id 1hZAvQ-0004zn-Un for qemu-devel@nongnu.org; Fri, 07 Jun 2019 05:12:43 -0400 Received: from mail-wr1-x435.google.com ([2a00:1450:4864:20::435]:35408) by eggs.gnu.org with esmtps (TLS1.0:RSA_AES_128_CBC_SHA1:16) (Exim 4.71) (envelope-from ) id 1hZAvQ-0004qw-Hz for qemu-devel@nongnu.org; Fri, 07 Jun 2019 05:12:40 -0400 Received: by mail-wr1-x435.google.com with SMTP id m3so1390662wrv.2 for ; Fri, 07 Jun 2019 02:12:38 -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=FsH9fIoqslU5eUblZQD4hWHct1S0ABTNMLOgnPxlbLE=; b=aWXmPjGBy4Ril9qJecr8mYSOCksXK4aMrQUZ+rnS+4GKeMJdTyJdYGI0FcDR4KnwHG KM5v7XB+1zWm5xtiObxyl8iAob0s1Vu9Qak8sdT1E/DyJMxXGcDEKv/Js4oNDr+G97kB 95wfTfCsLv+vP0Vsk0QWe32KPzaUQLtBlQdk0HF36N7S+K3zTsLmyoc8lfMwXcGCFHQM e3wS9Xttzez9iQJiYYpcMdmFfBjFiVBemzUS3rqcjGxOrxFjuRsF4SFRV738fKePRu66 tP6KalD9v3I1Yylm/3Y+YZGM8KTAgLEtvcT1nul4g7wnKES06n5js1gQjgUi8ZBfFg2v iCHw== 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=FsH9fIoqslU5eUblZQD4hWHct1S0ABTNMLOgnPxlbLE=; b=qTl6wWLA5pokSU/9P2UWPrM4a2nCEWtBvy6jab2uYSpGD0wQoyI0TnfSxirJttIFvU rJnLKXK3rxBVDfnJhNtu1SU8579FYkfBqlbn1bjVGyiDosog5aLLJ/PZu7sptNDwPXl1 TzElLjvUcPvbGAhh9DbHd2+fwul6T942XvPkydlfIzziZD+qsnoJdvj9rWlcVQ8XsBC4 pYCM0I4pbtHc1TY0x3oPDa39kgPCqBLhRHwhIQt8BG3UdaqMIXkCzB2BxWDcQSo2ZOm4 V18yULHWZqE73nkFcLM3ETQOoCIz28RWILrX8fbvzRK74Z8gVF6V3/sNrxAG/1Fv6qiu /rYw== X-Gm-Message-State: APjAAAX42ZibPA16XGYhDPbkRz7390+6pd4JsHSZou6PvfLUespy92ns tHzZgJ981uRfQhwA59GCvhjmOw== X-Received: by 2002:a5d:6748:: with SMTP id l8mr7693721wrw.199.1559898756884; Fri, 07 Jun 2019 02:12:36 -0700 (PDT) Received: from zen.linaroharston ([81.128.185.34]) by smtp.gmail.com with ESMTPSA id s8sm2078626wra.55.2019.06.07.02.12.31 (version=TLS1_3 cipher=AEAD-AES256-GCM-SHA384 bits=256/256); Fri, 07 Jun 2019 02:12:34 -0700 (PDT) Received: from zen.linaroharston. (localhost [127.0.0.1]) by zen.linaroharston (Postfix) with ESMTP id D208C1FFAB; Fri, 7 Jun 2019 10:05:53 +0100 (BST) From: =?utf-8?q?Alex_Benn=C3=A9e?= To: peter.maydell@linaro.org Date: Fri, 7 Jun 2019 10:05:22 +0100 Message-Id: <20190607090552.12434-24-alex.bennee@linaro.org> X-Mailer: git-send-email 2.20.1 In-Reply-To: <20190607090552.12434-1-alex.bennee@linaro.org> References: <20190607090552.12434-1-alex.bennee@linaro.org> MIME-Version: 1.0 X-detected-operating-system: by eggs.gnu.org: Genre and OS details not recognized. X-Received-From: 2a00:1450:4864:20::435 Subject: [Qemu-devel] [PULL 23/52] tests/vm: netbsd autoinstall, using serial console 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: Fam Zheng , Thomas Huth , =?utf-8?q?Philippe_Mathieu-Daud=C3=A9?= , qemu-devel@nongnu.org, Kamil Rytarowski , Gerd Hoffmann , Kamil Rytarowski , =?utf-8?q?Alex_Benn=C3=A9e?= Errors-To: qemu-devel-bounces+patch=linaro.org@nongnu.org Sender: "Qemu-devel" From: Gerd Hoffmann Instead of fetching the prebuilt image from patchew download the install iso and prepare the image locally. Install to disk, using the serial console. Create qemu user, configure ssh login. Install packages needed for qemu builds. Signed-off-by: Gerd Hoffmann Reviewed-by: Kamil Rytarowski Tested-by: Thomas Huth Reviewed-by: Philippe Mathieu-Daudé Tested-by: Philippe Mathieu-Daudé Message-Id: <20190520124716.30472-13-kraxel@redhat.com> Signed-off-by: Alex Bennée -- 2.20.1 diff --git a/tests/vm/netbsd b/tests/vm/netbsd index 4c6624ea5e..6dbfc1b0fb 100755 --- a/tests/vm/netbsd +++ b/tests/vm/netbsd @@ -2,10 +2,11 @@ # # NetBSD VM image # -# Copyright 2017 Red Hat Inc. +# Copyright 2017-2019 Red Hat Inc. # # Authors: # Fam Zheng +# Gerd Hoffmann # # This code is licensed under the GPL version 2 or later. See # the COPYING file in the top-level directory. @@ -13,32 +14,198 @@ import os import sys +import time import subprocess import basevm class NetBSDVM(basevm.BaseVM): name = "netbsd" arch = "x86_64" + + link = "https://cdn.netbsd.org/pub/NetBSD/NetBSD-8.0/images/NetBSD-8.0-amd64.iso" + size = "20G" + pkgs = [ + # tools + "git-base", + "pkgconf", + "xz", + "python37", + + # gnu tools + "bash", + "gmake", + "gsed", + "flex", "bison", + + # libs: crypto + "gnutls", + + # libs: images + "jpeg", + "png", + + # libs: ui + "SDL2", + "gtk3+", + "libxkbcommon", + ] + BUILD_SCRIPT = """ set -e; - rm -rf /var/tmp/qemu-test.* - cd $(mktemp -d /var/tmp/qemu-test.XXXXXX); + rm -rf /home/qemu/qemu-test.* + cd $(mktemp -d /home/qemu/qemu-test.XXXXXX); + mkdir src build; cd src; tar -xf /dev/rld1a; - ./configure --python=python2.7 {configure_opts}; + cd ../build + ../src/configure --python=python3.7 --disable-opengl {configure_opts}; gmake --output-sync -j{jobs} {target} {verbose}; """ + poweroff = "/sbin/poweroff" def build_image(self, img): - cimg = self._download_with_cache("http://download.patchew.org/netbsd-7.1-amd64.img.xz", - sha256sum='b633d565b0eac3d02015cd0c81440bd8a7a8df8512615ac1ee05d318be015732') - img_tmp_xz = img + ".tmp.xz" + cimg = self._download_with_cache(self.link) img_tmp = img + ".tmp" - sys.stderr.write("Extracting the image...\n") - subprocess.check_call(["cp", "-f", cimg, img_tmp_xz]) - subprocess.check_call(["xz", "-dvf", img_tmp_xz]) + iso = img + ".install.iso" + + self.print_step("Preparing iso and disk image") + subprocess.check_call(["cp", "-f", cimg, iso]) + subprocess.check_call(["qemu-img", "create", "-f", "qcow2", + img_tmp, self.size]) + + self.print_step("Booting installer") + self.boot(img_tmp, extra_args = [ + "-device", "VGA", + "-machine", "graphics=off", + "-cdrom", iso + ]) + self.console_init() + self.console_wait("Primary Bootstrap") + + # serial console boot menu output doesn't work for some + # reason, so we have to fly blind ... + for char in list("5consdev com0\n"): + time.sleep(0.2) + self.console_send(char) + self.console_wait("") + self.console_wait_send("> ", "boot\n") + + self.console_wait_send("Terminal type", "xterm\n") + self.console_wait_send("a: Installation messages", "a\n") + self.console_wait_send("b: US-English", "b\n") + self.console_wait_send("a: Install NetBSD", "a\n") + self.console_wait("Shall we continue?") + self.console_wait_send("b: Yes", "b\n") + + self.console_wait_send("a: ld0", "a\n") + self.console_wait_send("a: This is the correct", "a\n") + self.console_wait_send("b: Use the entire disk", "b\n") + self.console_wait("NetBSD bootcode") + self.console_wait_send("a: Yes", "a\n") + self.console_wait_send("b: Use existing part", "b\n") + self.console_wait_send("x: Partition sizes ok", "x\n") + self.console_wait_send("for your NetBSD disk", "\n") + self.console_wait("Shall we continue?") + self.console_wait_send("b: Yes", "b\n") + + self.console_wait_send("b: Use serial port com0", "b\n") + self.console_wait_send("f: Set serial baud rate", "f\n") + self.console_wait_send("a: 9600", "a\n") + self.console_wait_send("x: Exit", "x\n") + + self.console_wait_send("a: Full installation", "a\n") + self.console_wait_send("a: CD-ROM", "a\n") + + self.print_step("Installation started now, this will take a while") + self.console_wait_send("Hit enter to continue", "\n") + + self.console_wait_send("d: Change root password", "d\n") + self.console_wait_send("a: Yes", "a\n") + self.console_wait("New password:") + self.console_send("%s\n" % self.ROOT_PASS) + self.console_wait("New password:") + self.console_send("%s\n" % self.ROOT_PASS) + self.console_wait("Retype new password:") + self.console_send("%s\n" % self.ROOT_PASS) + + self.console_wait_send("o: Add a user", "o\n") + self.console_wait("username") + self.console_send("%s\n" % self.GUEST_USER) + self.console_wait("to group wheel") + self.console_wait_send("a: Yes", "a\n") + self.console_wait_send("a: /bin/sh", "a\n") + self.console_wait("New password:") + self.console_send("%s\n" % self.GUEST_PASS) + self.console_wait("New password:") + self.console_send("%s\n" % self.GUEST_PASS) + self.console_wait("Retype new password:") + self.console_send("%s\n" % self.GUEST_PASS) + + self.console_wait_send("a: Configure network", "a\n") + self.console_wait_send("a: vioif0", "a\n") + self.console_wait_send("Network media type", "\n") + self.console_wait("autoconfiguration") + self.console_wait_send("a: Yes", "a\n") + self.console_wait_send("DNS domain", "localnet\n") + self.console_wait("Are they OK?") + self.console_wait_send("a: Yes", "a\n") + self.console_wait("installed in /etc") + self.console_wait_send("a: Yes", "a\n") + + self.console_wait_send("e: Enable install", "e\n") + proxy = os.environ.get("http_proxy") + if not proxy is None: + self.console_wait_send("f: Proxy", "f\n") + self.console_wait("Proxy") + self.console_send("%s\n" % proxy) + self.console_wait_send("x: Install pkgin", "x\n") + self.console_init(1200) + self.console_wait_send("Hit enter to continue", "\n") + self.console_init() + + self.console_wait_send("g: Enable sshd", "g\n") + self.console_wait_send("x: Finished conf", "x\n") + self.console_wait_send("Hit enter to continue", "\n") + + self.print_step("Installation finished, rebooting") + self.console_wait_send("d: Reboot the computer", "d\n") + + # setup qemu user + prompt = "localhost$" + self.console_ssh_init(prompt, self.GUEST_USER, self.GUEST_PASS) + self.console_wait_send(prompt, "exit\n") + + # setup root user + prompt = "localhost#" + self.console_ssh_init(prompt, "root", self.ROOT_PASS) + self.console_sshd_config(prompt) + + # setup virtio-blk #1 (tarfile) + self.console_wait(prompt) + self.console_send("echo 'chmod 666 /dev/rld1a' >> /etc/rc.local\n") + + # turn off mprotect (conflicts with tcg) + self.console_wait(prompt) + self.console_send("echo security.pax.mprotect.enabled=0 >> /etc/sysctl.conf\n") + + self.print_step("Configuration finished, rebooting") + self.console_wait_send(prompt, "reboot\n") + self.console_wait("login:") + self.wait_ssh() + + self.print_step("Installing packages") + self.ssh_root_check("pkgin update\n") + self.ssh_root_check("pkgin -y install %s\n" % " ".join(self.pkgs)) + + # shutdown + self.ssh_root(self.poweroff) + self.console_wait("entering state S5") + self.wait() + if os.path.exists(img): os.remove(img) os.rename(img_tmp, img) + os.remove(iso) + self.print_step("All done") if __name__ == "__main__": sys.exit(basevm.main(NetBSDVM)) From patchwork Fri Jun 7 09:05:23 2019 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 8bit X-Patchwork-Submitter: =?utf-8?q?Alex_Benn=C3=A9e?= X-Patchwork-Id: 166134 Delivered-To: patch@linaro.org Received: by 2002:a92:9e1a:0:0:0:0:0 with SMTP id q26csp456127ili; Fri, 7 Jun 2019 03:31:03 -0700 (PDT) X-Google-Smtp-Source: APXvYqyJIOso7bgw8OEeCeceksf2CCrEyWZ2jsC4lAamjbSGbgioV12U5PXAD9gOkqkTBwjNqDzS X-Received: by 2002:a0c:d4a2:: with SMTP id u31mr23912585qvh.218.1559903463004; Fri, 07 Jun 2019 03:31:03 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1559903463; cv=none; d=google.com; s=arc-20160816; b=YOpT1PWM8re7mLamhvbr2uTCuMm0XYuGhIODsKl/CbF6tVUG567o3B7qClL81pQ0Vm xewu9P/0jyKmiOAi0zVE0gtelsScjm/exbJXT0f4KkhHU8A2cFlK3F8NOyOCS3XN7/h8 nIFr9cUnl89NsRlfKY4YXpdsJN8hc5lWhTEPgnZ+ZICfSx6DE1YFLYhPH2FN0cbYIAvD u1MGwlBhO5pHT2wFi72ovc5Z8NxmVcPJf5GkHgb0/egv27aJUq8k17GIvPZa4hwuQ/Fu 3PBqB6kJbffqYQRkfrZ0LexuThhWRq6oC8Bzh6iMvhH/aLvrXGq1L0BeAUR2KGw7dmwp OnXw== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=sender:errors-to:cc:list-subscribe:list-help:list-post:list-archive :list-unsubscribe:list-id:precedence:subject :content-transfer-encoding:mime-version:references:in-reply-to :message-id:date:to:from:dkim-signature; bh=JVOhgXHIaUVn4T5e9DUcXx7y+91ycN1+/uDKCNbCA8U=; b=LPGTJRdVlKSn9YZcJEqhIuxsArqvkaYYw4UAMmPhYtQ3ixTj25M89Non+AmGnd3zNX 31056od5drMBRpjhN2kmomVDGCywgtN90tpwJOlGN8OUXXUBJzEhu62kc6nWOj0p62eM wKMSzCPXxPdtGCNn5f9hr2Cb8Um449xY7FlKCOoaVcAzjMIta5qs6lNh+4l87W3u7AXF rRKykCO9BG8tZTSEADVihH1xuGgy+P+uQNhlKAZXUnkXGw+zhEHNf/mRrgMk19B3lDVe QJ1q/V7z2pWDnwuNbeP4grl1tAeF+VLPvs56bqvwYGLa9PaNEIav7dsqyfqe+07EtzKP Wjsw== ARC-Authentication-Results: i=1; mx.google.com; dkim=fail header.i=@linaro.org header.s=google header.b=wdgeANDO; spf=pass (google.com: domain of qemu-devel-bounces+patch=linaro.org@nongnu.org designates 209.51.188.47 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.47]) by mx.google.com with ESMTPS id d4si960921qkc.67.2019.06.07.03.31.02 for (version=TLS1_2 cipher=ECDHE-RSA-CHACHA20-POLY1305 bits=256/256); Fri, 07 Jun 2019 03:31:02 -0700 (PDT) Received-SPF: pass (google.com: domain of qemu-devel-bounces+patch=linaro.org@nongnu.org designates 209.51.188.47 as permitted sender) client-ip=209.51.188.47; Authentication-Results: mx.google.com; dkim=fail header.i=@linaro.org header.s=google header.b=wdgeANDO; spf=pass (google.com: domain of qemu-devel-bounces+patch=linaro.org@nongnu.org designates 209.51.188.47 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]:48046 helo=lists.gnu.org) by lists.gnu.org with esmtp (Exim 4.86_2) (envelope-from ) id 1hZC9E-0005R9-74 for patch@linaro.org; Fri, 07 Jun 2019 06:31:02 -0400 Received: from eggs.gnu.org ([2001:470:142:3::10]:51017) by lists.gnu.org with esmtp (Exim 4.86_2) (envelope-from ) id 1hZBOO-0007eh-56 for qemu-devel@nongnu.org; Fri, 07 Jun 2019 05:42:38 -0400 Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71) (envelope-from ) id 1hZBOK-0000pE-EC for qemu-devel@nongnu.org; Fri, 07 Jun 2019 05:42:35 -0400 Received: from mail-wr1-x429.google.com ([2a00:1450:4864:20::429]:40436) by eggs.gnu.org with esmtps (TLS1.0:RSA_AES_128_CBC_SHA1:16) (Exim 4.71) (envelope-from ) id 1hZBOK-0000n0-2x for qemu-devel@nongnu.org; Fri, 07 Jun 2019 05:42:32 -0400 Received: by mail-wr1-x429.google.com with SMTP id p11so1460354wre.7 for ; Fri, 07 Jun 2019 02:42:31 -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=JVOhgXHIaUVn4T5e9DUcXx7y+91ycN1+/uDKCNbCA8U=; b=wdgeANDOPJEhycZxsQ1NwHZaIVLNMsWJnBc8qeQCNl1DZmreul7xYDZdu6cjvRX+IH G0bXJo8yQrQVbYDDiMRppMd39Hl2Dx3uWWmpy+vgXy83+YUuTadrV3j5DbXGK2Gm4sv+ oifnyXy09LYTJFOBf/SZeC+yapghwFQPmx8kQ7uRfVtEMOLDccM/e7k4chO8Cu9isQP2 GYB9+PI8kGOY9jJhlzHjkchrJRAMNe2E5Nog96t2FFdv8cqK/ihST+hbq2c4FET5CODI tshV/LCRkYltMywvO/oRPLqneuU4XmV8RqeJP9C95yG/CB5iLXLTfOYhaqKgpeCDCejM 2Jbw== 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=JVOhgXHIaUVn4T5e9DUcXx7y+91ycN1+/uDKCNbCA8U=; b=eLzSCj6TjAozpcmvCITg6uYiB0FIxZS0FjMrFUoRj4bptkePzsUEbbk/3cwRLPXvCI xy8rF0H/EH5SzbEmL26T/1as8MfgLZB9s3yWqloSIC+fh/O7ZSXTsTG+CcKAuG6dvUPa HRUM2MZxNfqTRLbMRtxzFh0/jiizbuiG2aKkuifjPAbHgElvgiOcAudiU2IhegvlwesV 1ADPSRqslfIPp3rQZgQ+WBdQARAoX+e49rnEaUI9QZCMTPMrNOovGNxCT0WBl6m+5/gI u2xAOW0WzFzIjGtG2TCangV2KODW6o4JvQUtQQD0ndqsF2K34i/TX8rdHaWRSOmXw44U LZUg== X-Gm-Message-State: APjAAAUU9mYCOiRSJK2F9d7zrVL0mugs1ShgJnn0EyRA/VeS4AOpldf7 XOXsVgtiN0r7V2WAM4g+tocMgQ== X-Received: by 2002:adf:8183:: with SMTP id 3mr19181524wra.181.1559900550214; Fri, 07 Jun 2019 02:42:30 -0700 (PDT) Received: from zen.linaroharston ([81.128.185.34]) by smtp.gmail.com with ESMTPSA id h1sm1444762wrt.20.2019.06.07.02.42.28 (version=TLS1_3 cipher=AEAD-AES256-GCM-SHA384 bits=256/256); Fri, 07 Jun 2019 02:42:28 -0700 (PDT) Received: from zen.linaroharston. (localhost [127.0.0.1]) by zen.linaroharston (Postfix) with ESMTP id E8BB21FFAC; Fri, 7 Jun 2019 10:05:53 +0100 (BST) From: =?utf-8?q?Alex_Benn=C3=A9e?= To: peter.maydell@linaro.org Date: Fri, 7 Jun 2019 10:05:23 +0100 Message-Id: <20190607090552.12434-25-alex.bennee@linaro.org> X-Mailer: git-send-email 2.20.1 In-Reply-To: <20190607090552.12434-1-alex.bennee@linaro.org> References: <20190607090552.12434-1-alex.bennee@linaro.org> MIME-Version: 1.0 X-detected-operating-system: by eggs.gnu.org: Genre and OS details not recognized. X-Received-From: 2a00:1450:4864:20::429 Subject: [Qemu-devel] [PULL 24/52] tests/vm: fedora autoinstall, using serial console 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: Fam Zheng , Thomas Huth , =?utf-8?q?Philippe_Mathieu-Daud=C3=A9?= , qemu-devel@nongnu.org, Gerd Hoffmann , =?utf-8?q?Alex_Benn=C3=A9e?= Errors-To: qemu-devel-bounces+patch=linaro.org@nongnu.org Sender: "Qemu-devel" From: Gerd Hoffmann Download the install iso and prepare the image locally. Install to disk, using the serial console. Create qemu user, configure ssh login. Install packages needed for qemu builds. Yes, we have docker images for fedora. But for trouble-shooting it might be helpful to have a vm too. When vm builds fail you can use it to figure whenever the vm setup or the guest os is the problem. Signed-off-by: Gerd Hoffmann Tested-by: Thomas Huth Reviewed-by: Philippe Mathieu-Daudé Tested-by: Philippe Mathieu-Daudé Message-Id: <20190520124716.30472-14-kraxel@redhat.com> Signed-off-by: Alex Bennée -- 2.20.1 diff --git a/tests/vm/Makefile.include b/tests/vm/Makefile.include index 628eecade7..5e37063d32 100644 --- a/tests/vm/Makefile.include +++ b/tests/vm/Makefile.include @@ -2,7 +2,7 @@ .PHONY: vm-build-all vm-clean-all -IMAGES := ubuntu.i386 freebsd netbsd openbsd centos +IMAGES := ubuntu.i386 freebsd netbsd openbsd centos fedora IMAGES_DIR := $(HOME)/.cache/qemu-vm/images IMAGE_FILES := $(patsubst %, $(IMAGES_DIR)/%.img, $(IMAGES)) @@ -16,6 +16,7 @@ vm-test: @echo " vm-build-netbsd - Build QEMU in NetBSD VM" @echo " vm-build-openbsd - Build QEMU in OpenBSD VM" @echo " vm-build-centos - Build QEMU in CentOS VM, with Docker" + @echo " vm-build-fedora - Build QEMU in Fedora VM" @echo "" @echo " vm-build-all - Build QEMU in all VMs" @echo " vm-clean-all - Clean up VM images" diff --git a/tests/vm/basevm.py b/tests/vm/basevm.py index 8894267f07..d4b816be14 100755 --- a/tests/vm/basevm.py +++ b/tests/vm/basevm.py @@ -205,7 +205,7 @@ class BaseVM(object): # log console line sys.stderr.write("con recv: %s\n" % line) - def console_wait(self, expect): + def console_wait(self, expect, expectalt = None): vm = self._guest output = "" while True: @@ -214,6 +214,8 @@ class BaseVM(object): except socket.timeout: sys.stderr.write("console: *** read timeout ***\n") sys.stderr.write("console: waiting for: '%s'\n" % expect) + if not expectalt is None: + sys.stderr.write("console: waiting for: '%s' (alt)\n" % expectalt) sys.stderr.write("console: line buffer:\n") sys.stderr.write("\n") self.console_log(output.rstrip()) @@ -222,6 +224,8 @@ class BaseVM(object): output += chars.decode("latin1") if expect in output: break + if not expectalt is None and expectalt in output: + break if "\r" in output or "\n" in output: lines = re.split("[\r\n]", output) output = lines.pop() @@ -229,6 +233,9 @@ class BaseVM(object): self.console_log("\n".join(lines)) if self.debug: self.console_log(output) + if not expectalt is None and expectalt in output: + return False + return True def console_send(self, command): vm = self._guest diff --git a/tests/vm/fedora b/tests/vm/fedora new file mode 100755 index 0000000000..c5621d0832 --- /dev/null +++ b/tests/vm/fedora @@ -0,0 +1,187 @@ +#!/usr/bin/env python +# +# Fedora VM image +# +# Copyright 2019 Red Hat Inc. +# +# Authors: +# Gerd Hoffmann +# +# This code is licensed under the GPL version 2 or later. See +# the COPYING file in the top-level directory. +# + +import os +import re +import sys +import time +import socket +import subprocess +import basevm + +class FedoraVM(basevm.BaseVM): + name = "fedora" + arch = "x86_64" + + base = "http://dl.fedoraproject.org/pub/fedora/linux/releases/30/" + link = base + "Server/x86_64/iso/Fedora-Server-netinst-x86_64-30-1.2.iso" + repo = base + "Server/x86_64/os/" + full = base + "Everything/x86_64/os/" + csum = "5e4eac4566d8c572bfb3bcf54b7d6c82006ec3c6c882a2c9235c6d3494d7b100" + size = "20G" + pkgs = [ + # tools + 'git-core', + 'flex', 'bison', + 'gcc', 'binutils', 'make', + + # perl + 'perl-Test-Harness', + + # libs: usb + '"pkgconfig(libusb-1.0)"', + '"pkgconfig(libusbredirparser-0.5)"', + + # libs: crypto + '"pkgconfig(gnutls)"', + + # libs: ui + '"pkgconfig(sdl2)"', + '"pkgconfig(gtk+-3.0)"', + '"pkgconfig(ncursesw)"', + + # libs: audio + '"pkgconfig(libpulse)"', + '"pkgconfig(alsa)"', + ] + + BUILD_SCRIPT = """ + set -e; + rm -rf /home/qemu/qemu-test.* + cd $(mktemp -d /home/qemu/qemu-test.XXXXXX); + mkdir src build; cd src; + tar -xf /dev/vdb; + cd ../build + ../src/configure --python=python3 {configure_opts}; + gmake --output-sync -j{jobs} {target} {verbose}; + """ + + def build_image(self, img): + self.print_step("Downloading install iso") + cimg = self._download_with_cache(self.link, sha256sum=self.csum) + img_tmp = img + ".tmp" + iso = img + ".install.iso" + + self.print_step("Preparing iso and disk image") + subprocess.check_call(["cp", "-f", cimg, iso]) + subprocess.check_call(["qemu-img", "create", "-f", "qcow2", + img_tmp, self.size]) + + self.print_step("Booting installer") + self.boot(img_tmp, extra_args = [ + "-machine", "graphics=off", + "-cdrom", iso + ]) + self.console_init(300) + self.console_wait("installation process.") + time.sleep(0.3) + self.console_send("\t") + time.sleep(0.3) + self.console_send(" console=ttyS0") + proxy = os.environ.get("http_proxy") + if not proxy is None: + self.console_send(" proxy=%s" % proxy) + self.console_send(" inst.repo=%s" % self.repo) + self.console_send("\n") + + self.console_wait_send("2) Use text mode", "2\n") + + self.console_wait_send("5) [!] Installation Dest", "5\n") + self.console_wait_send("1) [x]", "c\n") + self.console_wait_send("2) [ ] Use All Space", "2\n") + self.console_wait_send("2) [x] Use All Space", "c\n") + self.console_wait_send("1) [ ] Standard Part", "1\n") + self.console_wait_send("1) [x] Standard Part", "c\n") + + self.console_wait_send("7) [!] Root password", "7\n") + self.console_wait("Password:") + self.console_send("%s\n" % self.ROOT_PASS) + self.console_wait("Password (confirm):") + self.console_send("%s\n" % self.ROOT_PASS) + + self.console_wait_send("8) [ ] User creation", "8\n") + self.console_wait_send("1) [ ] Create user", "1\n") + self.console_wait_send("3) User name", "3\n") + self.console_wait_send("ENTER:", "%s\n" % self.GUEST_USER) + self.console_wait_send("4) [ ] Use password", "4\n") + self.console_wait_send("5) Password", "5\n") + self.console_wait("Password:") + self.console_send("%s\n" % self.GUEST_PASS) + self.console_wait("Password (confirm):") + self.console_send("%s\n" % self.GUEST_PASS) + self.console_wait_send("7) Groups", "c\n") + + while True: + good = self.console_wait("3) [x] Installation", + "3) [!] Installation") + self.console_send("r\n") + if good: + break + time.sleep(10) + + while True: + good = self.console_wait("4) [x] Software", + "4) [!] Software") + self.console_send("r\n") + if good: + break + time.sleep(10) + self.console_send("r\n" % self.GUEST_PASS) + + self.console_wait_send("'b' to begin install", "b\n") + + self.print_step("Installation started now, this will take a while") + + self.console_wait_send("Installation complete", "\n") + self.print_step("Installation finished, rebooting") + + # setup qemu user + prompt = " ~]$" + self.console_ssh_init(prompt, self.GUEST_USER, self.GUEST_PASS) + self.console_wait_send(prompt, "exit\n") + + # setup root user + prompt = " ~]#" + self.console_ssh_init(prompt, "root", self.ROOT_PASS) + self.console_sshd_config(prompt) + + # setup virtio-blk #1 (tarfile) + self.console_wait(prompt) + self.console_send("echo 'KERNEL==\"vdb\" MODE=\"666\"' >> %s\n" % + "/etc/udev/rules.d/99-qemu.rules") + + self.print_step("Configuration finished, rebooting") + self.console_wait_send(prompt, "reboot\n") + self.console_wait("login:") + self.wait_ssh() + + self.print_step("Installing packages") + self.ssh_root_check("rm -vf /etc/yum.repos.d/fedora*.repo\n") + self.ssh_root_check("echo '[fedora]' >> /etc/yum.repos.d/qemu.repo\n") + self.ssh_root_check("echo 'baseurl=%s' >> /etc/yum.repos.d/qemu.repo\n" % self.full) + self.ssh_root_check("echo 'gpgcheck=0' >> /etc/yum.repos.d/qemu.repo\n") + self.ssh_root_check("dnf install -y %s\n" % " ".join(self.pkgs)) + + # shutdown + self.ssh_root(self.poweroff) + self.console_wait("sleep state S5") + self.wait() + + if os.path.exists(img): + os.remove(img) + os.rename(img_tmp, img) + os.remove(iso) + self.print_step("All done") + +if __name__ == "__main__": + sys.exit(basevm.main(FedoraVM)) From patchwork Fri Jun 7 09:05:24 2019 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 8bit X-Patchwork-Submitter: =?utf-8?q?Alex_Benn=C3=A9e?= X-Patchwork-Id: 166113 Delivered-To: patch@linaro.org Received: by 2002:a92:9e1a:0:0:0:0:0 with SMTP id q26csp428561ili; Fri, 7 Jun 2019 03:03:54 -0700 (PDT) X-Google-Smtp-Source: APXvYqyzdJ47sCCvCcfBhCP+PQJCwRBkqMlf7TDRUJw6T1vMB5pNb4kaFkyxAiM5uItnf5re+dJD X-Received: by 2002:aed:33e6:: with SMTP id v93mr45656167qtd.157.1559901834251; Fri, 07 Jun 2019 03:03:54 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1559901834; cv=none; d=google.com; s=arc-20160816; b=b5qhhrW5j3b85VI8oiV0udrBQ99mfcDJYCSqzkAb6gJ6zUd1IOFqsFOGn3L+/pOAMc r1AMZoDqu5VW8/WseS8wjrkjssKN8JgJrCjgYGBEWW5xmBDg56EY2Bn1oR86UEQ0SFEu 4npMHUTXK7yfsYp/rYeTZ4U+6XGzijLLEpUqhZgGdiHQ2HvNiwKcTCia9GU/SviDib4c l26pdgAxeYxn0kP76hcqU/qjLki7Q9AU/CuXyyucuPX6U0chKd7Bav3JKx6DJQT/7mWB aqj1nDUKa4o57dV9wknyZY0X/x1Paifc2dkhsWEN4bhZfJon4uvjP9cOcpMkCoWYs9+C 3G5g== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=sender:errors-to:cc:list-subscribe:list-help:list-post:list-archive :list-unsubscribe:list-id:precedence:subject :content-transfer-encoding:mime-version:references:in-reply-to :message-id:date:to:from:dkim-signature; bh=gTWlFdlFGB1B/zOTecn3xrnI8T6l9Vt1Y4CtKuUhYu8=; b=f7dQmqjU1FE532pwZS98vFul5JWEDrLvhxt90Shl2ZSxpw2NTQK0MnwuOlNi6rLSsJ oC2nGq6hOd7x0vVZ67ZZJlkweKFCmgJ6hNa6JyP5o+NcA9pDfsifXD8bUXt6XKaqi9Bq uZPv/OfxTGIVItC71lKIPhdHtGsbhgRw7xB/oBhVlgxeOhQQq6TW5qT5XAdzu0ZAo63W DAhCsRlCpvmmvCFat0h03jhxhUYIM/SXU1K4GO40ogU6+WyVqYAYJ6oTXKeG06zlPeNZ T+OQNVX0jbH5zbIo4NVUyvQQz/BjtWnZLSNPMLxWcfOlTBc3GRqiFCOACwjELLSf8wvc 5LXA== ARC-Authentication-Results: i=1; mx.google.com; dkim=fail header.i=@linaro.org header.s=google header.b=SjBnzlGN; spf=pass (google.com: domain of qemu-devel-bounces+patch=linaro.org@nongnu.org designates 209.51.188.47 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.47]) by mx.google.com with ESMTPS id v1si853536qkf.183.2019.06.07.03.03.54 for (version=TLS1_2 cipher=ECDHE-RSA-CHACHA20-POLY1305 bits=256/256); Fri, 07 Jun 2019 03:03:54 -0700 (PDT) Received-SPF: pass (google.com: domain of qemu-devel-bounces+patch=linaro.org@nongnu.org designates 209.51.188.47 as permitted sender) client-ip=209.51.188.47; Authentication-Results: mx.google.com; dkim=fail header.i=@linaro.org header.s=google header.b=SjBnzlGN; spf=pass (google.com: domain of qemu-devel-bounces+patch=linaro.org@nongnu.org designates 209.51.188.47 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]:47742 helo=lists.gnu.org) by lists.gnu.org with esmtp (Exim 4.86_2) (envelope-from ) id 1hZBiz-0002cA-PG for patch@linaro.org; Fri, 07 Jun 2019 06:03:53 -0400 Received: from eggs.gnu.org ([2001:470:142:3::10]:42205) by lists.gnu.org with esmtp (Exim 4.86_2) (envelope-from ) id 1hZAvT-0002Fc-BF for qemu-devel@nongnu.org; Fri, 07 Jun 2019 05:12:45 -0400 Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71) (envelope-from ) id 1hZAvQ-0004zZ-Ta for qemu-devel@nongnu.org; Fri, 07 Jun 2019 05:12:43 -0400 Received: from mail-wm1-x32a.google.com ([2a00:1450:4864:20::32a]:54772) by eggs.gnu.org with esmtps (TLS1.0:RSA_AES_128_CBC_SHA1:16) (Exim 4.71) (envelope-from ) id 1hZAvQ-0004sg-I6 for qemu-devel@nongnu.org; Fri, 07 Jun 2019 05:12:40 -0400 Received: by mail-wm1-x32a.google.com with SMTP id g135so1234190wme.4 for ; Fri, 07 Jun 2019 02:12:38 -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=gTWlFdlFGB1B/zOTecn3xrnI8T6l9Vt1Y4CtKuUhYu8=; b=SjBnzlGNuYbKNmdtwI+EtCHS2epNn9/bnTSOYbbiJrXuZ4r6YGWsjr3NiHIpSX9X+s 48+I3GTWU5lGNXW+fix8xHX917GJBe3DMRrKc/robCQLklm8B6dIy431i+f2TcwLU5GX KdurOgOybaHxPZYpzXu1kCKjSFdKa4Ui8Tx4DvAce3+sTNnOFvTT4V4yh3iwEubskUR3 elecGW7JGDH8+ZX4ECBwDLbmpCBkj3111TsC6nm7UnCSikm29OCLyox8jVfI/4gd7CLh rp5b4gPaAkJMVVmqWRj8D/YeaczqwxiqP1I+BvjbhYhRoFtofZZPivlP36L5W++uAgid zajA== 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=gTWlFdlFGB1B/zOTecn3xrnI8T6l9Vt1Y4CtKuUhYu8=; b=GGFuy1RYy7FzKi9R/mVp9L1nmSyplKH61AnWonURQxDBR1PZ4fYwVSMDEK7HA6s5dg spTyvEO5qgR1nmWQzPlswBCYVwV6Sq5kl9CTU69GHOtdf2hRmi2PkDMz/7yDXfGocVr7 Y2rrWWgvj/iu+Nfj3Vq77DlYRU5cyboETOAvAG7gN5zi4wboPjaGny5CKprLbCkF4uQl OLDMHuWdpXbnrWiInIYAsWP9Ac8jb8MOoob5FRSiOHcwFMV+ZvQ561aMvoygkvpPFRyG OVOAzSz4CRYe+0OQB5U3DZNZ8cLPoyEEmSU2HnhQSeV17kcaBwXCosedU0RWBVr4M9/+ pG2A== X-Gm-Message-State: APjAAAV0vW4NUisY4T7xvZfPHcOYg7DKw9D69jCKSYeEFW43RBNGssee qxsKNSwvZbxx8+9K/vIf/PFgmw== X-Received: by 2002:a1c:2bc7:: with SMTP id r190mr2801993wmr.174.1559898757664; Fri, 07 Jun 2019 02:12:37 -0700 (PDT) Received: from zen.linaroharston ([81.128.185.34]) by smtp.gmail.com with ESMTPSA id a3sm1198915wmb.35.2019.06.07.02.12.30 (version=TLS1_3 cipher=AEAD-AES256-GCM-SHA384 bits=256/256); Fri, 07 Jun 2019 02:12:34 -0700 (PDT) Received: from zen.linaroharston. (localhost [127.0.0.1]) by zen.linaroharston (Postfix) with ESMTP id 07ADF1FFAE; Fri, 7 Jun 2019 10:05:54 +0100 (BST) From: =?utf-8?q?Alex_Benn=C3=A9e?= To: peter.maydell@linaro.org Date: Fri, 7 Jun 2019 10:05:24 +0100 Message-Id: <20190607090552.12434-26-alex.bennee@linaro.org> X-Mailer: git-send-email 2.20.1 In-Reply-To: <20190607090552.12434-1-alex.bennee@linaro.org> References: <20190607090552.12434-1-alex.bennee@linaro.org> MIME-Version: 1.0 X-detected-operating-system: by eggs.gnu.org: Genre and OS details not recognized. X-Received-From: 2a00:1450:4864:20::32a Subject: [Qemu-devel] [PULL 25/52] tests/vm: ubuntu.i386: apt proxy setup 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: Fam Zheng , =?utf-8?q?Alex_Benn=C3=A9e?= , =?utf-8?q?Philippe_Mathieu-Daud=C3=A9?= , qemu-devel@nongnu.org, Gerd Hoffmann Errors-To: qemu-devel-bounces+patch=linaro.org@nongnu.org Sender: "Qemu-devel" From: Gerd Hoffmann Configure apt proxy so package downloads can be cached and can pass firewalls. Signed-off-by: Gerd Hoffmann Reviewed-by: Philippe Mathieu-Daudé Message-Id: <20190520124716.30472-15-kraxel@redhat.com> Signed-off-by: Alex Bennée -- 2.20.1 diff --git a/tests/vm/ubuntu.i386 b/tests/vm/ubuntu.i386 index a22d137e76..b869afd212 100755 --- a/tests/vm/ubuntu.i386 +++ b/tests/vm/ubuntu.i386 @@ -51,6 +51,10 @@ class UbuntuX86VM(basevm.BaseVM): " ssh-authorized-keys:\n", " - %s\n" % basevm.SSH_PUB_KEY, "locale: en_US.UTF-8\n"]) + proxy = os.environ.get("http_proxy") + if not proxy is None: + udata.writelines(["apt:\n", + " proxy: %s" % proxy]) udata.close() subprocess.check_call(["genisoimage", "-output", "cloud-init.iso", "-volid", "cidata", "-joliet", "-rock", From patchwork Fri Jun 7 09:05:25 2019 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 8bit X-Patchwork-Submitter: =?utf-8?q?Alex_Benn=C3=A9e?= X-Patchwork-Id: 166110 Delivered-To: patch@linaro.org Received: by 2002:a92:9e1a:0:0:0:0:0 with SMTP id q26csp420999ili; Fri, 7 Jun 2019 02:56:38 -0700 (PDT) X-Google-Smtp-Source: APXvYqyb0migFTauVRoEYt9N8ru2xEhJE3C10HGTJeyqwlc7+t2dsNEBiAytO5U4LiRgmsWP+ENA X-Received: by 2002:a37:e30b:: with SMTP id y11mr24381345qki.100.1559901398082; Fri, 07 Jun 2019 02:56:38 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1559901398; cv=none; d=google.com; s=arc-20160816; b=RCbcDSRfWJPFRS34OMr/22DGWVxcjNeNRZYuqJpIvxzSi26qIQwbuvC2XMsre5135B /b7Efjk5Txy6CEbFyt9i2ezdz5PxjNi/V8fVTHV5tpnb3fHUnYJEkZZJ59vo9Gf5KGnH QYl6RTriKOWxBuSdx/4DoOgbRu9c5CnqeJfAZ5jN+2W7ySWINNwtt1XIRLmcjOfwAKA9 GOqotUffOhluhwM0YC0ttsJ5BRqVCatWoe3jacN3Xr+B30iq0YEoMkXHYNduaZa+ReY7 vDHZv6GY8BRBtYU8OrRaA2gUaIDMC6MO9fSPeLvmA7XSTq3jZ24hwBZWv2FF9I3Qufiw k6gg== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=sender:errors-to:cc:list-subscribe:list-help:list-post:list-archive :list-unsubscribe:list-id:precedence:subject :content-transfer-encoding:mime-version:references:in-reply-to :message-id:date:to:from:dkim-signature; bh=R7hQv/k6BU4/ZnGK1cbG5kk+E/CvNF37llrzUvfKDoc=; b=ACaWJujAZ8SuyxUmCUuJRPpwKPkponK1U3OaOhDc9mM6vXLuaSVH08D5GebgclKY+V 3h97guq41Any7liPVbYvv1lm0p4/ZAYWZqOOeYMWVgV8thwhTdXgn36yp2BLJPTn2awX 2MYLXL/DWcqAFWlg43NTMcMu81aHzamWCPDxyLZQVKE5j4lu3vb6iur04u80ZQ3PQk7a 5MVkh8YzPX0GiQSIsSXqNz9cBjVAu0wKjA0VjYBimsd/lVJy2OrLDDkGCAYeCrBwbIHM Sh6JGDUUmK+ehUP3aUoBeAlS0kTxIRWnIefmc2BpaeDyKvLpB6nAGLSgr/Ww5gK/fxW9 lu/Q== ARC-Authentication-Results: i=1; mx.google.com; dkim=fail header.i=@linaro.org header.s=google header.b=XbG7yfs0; spf=pass (google.com: domain of qemu-devel-bounces+patch=linaro.org@nongnu.org designates 209.51.188.47 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.47]) by mx.google.com with ESMTPS id c10si299501qte.165.2019.06.07.02.56.37 for (version=TLS1_2 cipher=ECDHE-RSA-CHACHA20-POLY1305 bits=256/256); Fri, 07 Jun 2019 02:56:38 -0700 (PDT) Received-SPF: pass (google.com: domain of qemu-devel-bounces+patch=linaro.org@nongnu.org designates 209.51.188.47 as permitted sender) client-ip=209.51.188.47; Authentication-Results: mx.google.com; dkim=fail header.i=@linaro.org header.s=google header.b=XbG7yfs0; spf=pass (google.com: domain of qemu-devel-bounces+patch=linaro.org@nongnu.org designates 209.51.188.47 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]:47692 helo=lists.gnu.org) by lists.gnu.org with esmtp (Exim 4.86_2) (envelope-from ) id 1hZBbx-0004hO-Ld for patch@linaro.org; Fri, 07 Jun 2019 05:56:37 -0400 Received: from eggs.gnu.org ([2001:470:142:3::10]:42286) by lists.gnu.org with esmtp (Exim 4.86_2) (envelope-from ) id 1hZAvV-0002HY-Pn for qemu-devel@nongnu.org; Fri, 07 Jun 2019 05:12:47 -0400 Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71) (envelope-from ) id 1hZAvQ-0004zz-WD for qemu-devel@nongnu.org; Fri, 07 Jun 2019 05:12:45 -0400 Received: from mail-wr1-x442.google.com ([2a00:1450:4864:20::442]:43837) by eggs.gnu.org with esmtps (TLS1.0:RSA_AES_128_CBC_SHA1:16) (Exim 4.71) (envelope-from ) id 1hZAvQ-0004lF-Lt for qemu-devel@nongnu.org; Fri, 07 Jun 2019 05:12:40 -0400 Received: by mail-wr1-x442.google.com with SMTP id r18so1351564wrm.10 for ; Fri, 07 Jun 2019 02:12: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=R7hQv/k6BU4/ZnGK1cbG5kk+E/CvNF37llrzUvfKDoc=; b=XbG7yfs0OkAkZF/+fRCikzBlFe1VRQRbKYo/xU+YesBY5mjZ+F5kS/AhoAKAQEUHr7 Sk9WfUbnXZpw0nYSruYTH+gtHuQs/3AwRxakncQY17Wat2GGtry6DFJnY9wfa55JlyDb BdGi2E4TQICaEH/4mdzjoiRMLRXuEb7ZmLolAJhKIfzuSWEowkY/rRoq0VfmeSiblyP3 jS3jVvzQfTEqybNstzARnTAwkUjaqwAN67nmlsV7LVt0lOBfwIuKSBS/wSWIzYEs6zCd G+HNU0xjhwGP8ucLHAWiTuWfTrryGP6PAqOl1dxaQwMuOgsg6FIYo7WJzP2nj4kzjKUh aEXg== 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=R7hQv/k6BU4/ZnGK1cbG5kk+E/CvNF37llrzUvfKDoc=; b=bL1etqZMgE58MwjV9X4IQP+3UpuHVpwBAiOKAqUmbBzgwTQY2T4+k/dJRwwiIAHJIR Z5/sP8KJMAp+tGkfsHccRaRMhbiH2hlY7lqkV9XTk4cl7Imq9zu1O6R+3e5y+6Osgzai Dp3jdNnZ3SqUd5wUQ2AVyjMoCDPJUQqoW9WDP9bjH5YJUGCUv/RgfUhKyK5ET8KFYj8Y nfmCjUMJIfiFFms+FK6jYMIVnYaBoLwhbx/LKbwt2GkUdO7ZghjWc2oWT6xhpki+HgU7 djQ3lbUuIF5gcPwACqaL7PUV1meQ4IWMs+4OP38l1BbdxbFZ27ORuwc8hEewmirplXG/ wenw== X-Gm-Message-State: APjAAAW0isrZUUmast92Ur4hn39ilRZBBSULbV1r4d0rcX4zLT36kLii 6+EkusbTS/YX5vruKqJtFfTXbw== X-Received: by 2002:a5d:5283:: with SMTP id c3mr3506792wrv.268.1559898753629; Fri, 07 Jun 2019 02:12:33 -0700 (PDT) Received: from zen.linaroharston ([81.128.185.34]) by smtp.gmail.com with ESMTPSA id b2sm1567719wrp.72.2019.06.07.02.12.28 (version=TLS1_3 cipher=AEAD-AES256-GCM-SHA384 bits=256/256); Fri, 07 Jun 2019 02:12:30 -0700 (PDT) Received: from zen.linaroharston. (localhost [127.0.0.1]) by zen.linaroharston (Postfix) with ESMTP id 1EC991FFAF; Fri, 7 Jun 2019 10:05:54 +0100 (BST) From: =?utf-8?q?Alex_Benn=C3=A9e?= To: peter.maydell@linaro.org Date: Fri, 7 Jun 2019 10:05:25 +0100 Message-Id: <20190607090552.12434-27-alex.bennee@linaro.org> X-Mailer: git-send-email 2.20.1 In-Reply-To: <20190607090552.12434-1-alex.bennee@linaro.org> References: <20190607090552.12434-1-alex.bennee@linaro.org> MIME-Version: 1.0 X-detected-operating-system: by eggs.gnu.org: Genre and OS details not recognized. X-Received-From: 2a00:1450:4864:20::442 Subject: [Qemu-devel] [PULL 26/52] semihosting: split console_out into string and char versions 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: Riku Voipio , =?utf-8?q?Alex_Benn=C3=A9e?= , qemu-devel@nongnu.org, "open list:ARM" , Laurent Vivier Errors-To: qemu-devel-bounces+patch=linaro.org@nongnu.org Sender: "Qemu-devel" This is ostensibly to avoid the weirdness of len looking like it might come from a guest and sometimes being used. While we are at it fix up the error checking for the arm-linux-user implementation of the API which got flagged up by Coverity (CID 1401700). Signed-off-by: Alex Bennée -- 2.20.1 diff --git a/hw/semihosting/console.c b/hw/semihosting/console.c index 466ea6dade..4a5758972d 100644 --- a/hw/semihosting/console.c +++ b/hw/semihosting/console.c @@ -36,26 +36,24 @@ int qemu_semihosting_log_out(const char *s, int len) /* * A re-implementation of lock_user_string that we can use locally * instead of relying on softmmu-semi. Hopefully we can deprecate that - * in time. We either copy len bytes if specified or until we find a NULL. + * in time. Copy string until we find a 0 or address error. */ -static GString *copy_user_string(CPUArchState *env, target_ulong addr, int len) +static GString *copy_user_string(CPUArchState *env, target_ulong addr) { CPUState *cpu = ENV_GET_CPU(env); - GString *s = g_string_sized_new(len ? len : 128); + GString *s = g_string_sized_new(128); uint8_t c; - bool done; do { if (cpu_memory_rw_debug(cpu, addr++, &c, 1, 0) == 0) { s = g_string_append_c(s, c); - done = len ? s->len == len : c == 0; } else { qemu_log_mask(LOG_GUEST_ERROR, "%s: passed inaccessible address " TARGET_FMT_lx, __func__, addr); - done = true; + break; } - } while (!done); + } while (c!=0); return s; } @@ -68,9 +66,9 @@ static void semihosting_cb(CPUState *cs, target_ulong ret, target_ulong err) } } -int qemu_semihosting_console_out(CPUArchState *env, target_ulong addr, int len) +int qemu_semihosting_console_outs(CPUArchState *env, target_ulong addr) { - GString *s = copy_user_string(env, addr, len); + GString *s = copy_user_string(env, addr); int out = s->len; if (use_gdb_syscalls()) { @@ -82,3 +80,21 @@ int qemu_semihosting_console_out(CPUArchState *env, target_ulong addr, int len) g_string_free(s, true); return out; } + +void qemu_semihosting_console_outc(CPUArchState *env, target_ulong addr) +{ + CPUState *cpu = ENV_GET_CPU(env); + uint8_t c; + + if (cpu_memory_rw_debug(cpu, addr, &c, 1, 0) == 0) { + if (use_gdb_syscalls()) { + gdb_do_syscall(semihosting_cb, "write,2,%x,%x", addr, 1); + } else { + qemu_semihosting_log_out((const char *) &c, 1); + } + } else { + qemu_log_mask(LOG_GUEST_ERROR, + "%s: passed inaccessible address " TARGET_FMT_lx, + __func__, addr); + } +} diff --git a/include/hw/semihosting/console.h b/include/hw/semihosting/console.h index 30e66ae20a..3a4fba7590 100644 --- a/include/hw/semihosting/console.h +++ b/include/hw/semihosting/console.h @@ -10,17 +10,30 @@ #define _SEMIHOST_CONSOLE_H_ /** - * qemu_semihosting_console_out: + * qemu_semihosting_console_outs: * @env: CPUArchState - * @s: host address of guest string - * @len: length of string or 0 (string is null terminated) + * @s: host address of null terminated guest string * - * Send a guest string to the debug console. This may be the remote - * gdb session if a softmmu guest is currently being debugged. + * Send a null terminated guest string to the debug console. This may + * be the remote gdb session if a softmmu guest is currently being + * debugged. * * Returns: number of bytes written. */ -int qemu_semihosting_console_out(CPUArchState *env, target_ulong s, int len); +int qemu_semihosting_console_outs(CPUArchState *env, target_ulong s); + +/** + * qemu_semihosting_console_outc: + * @env: CPUArchState + * @s: host address of null terminated guest string + * + * Send single character from guest memory to the debug console. This + * may be the remote gdb session if a softmmu guest is currently being + * debugged. + * + * Returns: nothing + */ +void qemu_semihosting_console_outc(CPUArchState *env, target_ulong c); /** * qemu_semihosting_log_out: diff --git a/linux-user/arm/semihost.c b/linux-user/arm/semihost.c index 9554102a85..a16b525eec 100644 --- a/linux-user/arm/semihost.c +++ b/linux-user/arm/semihost.c @@ -15,10 +15,35 @@ #include "hw/semihosting/console.h" #include "qemu.h" -int qemu_semihosting_console_out(CPUArchState *env, target_ulong addr, int len) +int qemu_semihosting_console_outs(CPUArchState *env, target_ulong addr) { - void *s = lock_user_string(addr); - len = write(STDERR_FILENO, s, len ? len : strlen(s)); + int len = target_strlen(addr); + void *s; + if (len < 0){ + qemu_log_mask(LOG_GUEST_ERROR, + "%s: passed inaccessible address " TARGET_FMT_lx, + __func__, addr); + return 0; + } + s = lock_user(VERIFY_READ, addr, (long)(len + 1), 1); + g_assert(s); /* target_strlen has already verified this will work */ + len = write(STDERR_FILENO, s, len); unlock_user(s, addr, 0); return len; } + +void qemu_semihosting_console_outc(CPUArchState *env, target_ulong addr) +{ + char c; + + if (get_user_u8(c, addr)) { + qemu_log_mask(LOG_GUEST_ERROR, + "%s: passed inaccessible address " TARGET_FMT_lx, + __func__, addr); + } else { + if (write(STDERR_FILENO, &c, 1) != 1) { + qemu_log_mask(LOG_UNIMP, "%s: unexpected write to stdout failure", + __func__); + } + } +} diff --git a/target/arm/arm-semi.c b/target/arm/arm-semi.c index 53e807ab72..8844da8da3 100644 --- a/target/arm/arm-semi.c +++ b/target/arm/arm-semi.c @@ -315,10 +315,10 @@ target_ulong do_arm_semihosting(CPUARMState *env) return set_swi_errno(ts, close(arg0)); } case TARGET_SYS_WRITEC: - qemu_semihosting_console_out(env, args, 1); + qemu_semihosting_console_outc(env, args); return 0xdeadbeef; case TARGET_SYS_WRITE0: - return qemu_semihosting_console_out(env, args, 0); + return qemu_semihosting_console_outs(env, args); case TARGET_SYS_WRITE: GET_ARG(0); GET_ARG(1); From patchwork Fri Jun 7 09:05:26 2019 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 8bit X-Patchwork-Submitter: =?utf-8?q?Alex_Benn=C3=A9e?= X-Patchwork-Id: 166112 Delivered-To: patch@linaro.org Received: by 2002:a92:9e1a:0:0:0:0:0 with SMTP id q26csp423786ili; Fri, 7 Jun 2019 03:00:06 -0700 (PDT) X-Google-Smtp-Source: APXvYqyJPj6Pvugi10EA2Guvh8anXRtmUtbCK+itq9dgYYDEgYx04w2Mg9Aeo6ElwIQySKTurT2r X-Received: by 2002:ac8:38cf:: with SMTP id g15mr38375656qtc.268.1559901606641; Fri, 07 Jun 2019 03:00:06 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1559901606; cv=none; d=google.com; s=arc-20160816; b=ye0ITGdEaY+YsJl4955aBOKQlZNUKnA/3BTPB1L+PsMLa6C+LBKKyhZ3b4mxxOGAFG t6o1RoyIGKguytNzqym0bhocERTyfD0GN10TxLEgNY6PBkDxHV+hP4c2vrkrCEZnDO5z g7bXiAlrw6Bsh9Awsl3C375kar0cUC+468hzgGSIsus4hwAhwsY7BgQOqzdAdMSE+TtV o6z/NPjuYcbGu9ERtSGrz9ZUY9yZ2I5Opf/3jaDcqdZkoVHvzQ5AWhYfHps2WpzK9nxd 1yRG8u5W3ZQ/p7ypO0d5fmo9BOJWGkSIFP2/c1RXUGLiIPtnyRHPNZAVTNIEjowYgy1Y ZOYw== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=sender:errors-to:cc:list-subscribe:list-help:list-post:list-archive :list-unsubscribe:list-id:precedence:subject :content-transfer-encoding:mime-version:references:in-reply-to :message-id:date:to:from:dkim-signature; bh=99Dn3AIAE6bUMupx6Zxv5Z+hFUdE7BsSiaYvbx/TT8U=; b=PY7I3tDtIuybSfQzDsxU1SyIWjV9KipKUgocXzsVpqAhvwyedFZ6UHW3jfX7KagGwv nT7c32eNwUMDngp2DNA3oTMxPEziBvDaj1FfBd5/cQ2zPhTSctnVe/DsJxgx7fmm+4pI ke2PhM0vCSFo0J53FC2flFEOwoLHlfi5Weu8vwf0JFU2aGsL2x1jce0Pj6yJvMkUFeEU a0f6nJzWr8Egt04OSTauy8gIaqGCg+E37jp+gghlDg+N0gNJBLpQO0Ftw3Pix67Z+fGG dUs+Nf3R8HYInHp41NzIEuhJ3gZBBDlSgsrHSBrhFC/7JBD42BInHIZ+koveFjuHjBx2 6FRA== ARC-Authentication-Results: i=1; mx.google.com; dkim=fail header.i=@linaro.org header.s=google header.b=Cet4zqGw; spf=pass (google.com: domain of qemu-devel-bounces+patch=linaro.org@nongnu.org designates 209.51.188.47 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.47]) by mx.google.com with ESMTPS id c65si886772qkf.51.2019.06.07.03.00.06 for (version=TLS1_2 cipher=ECDHE-RSA-CHACHA20-POLY1305 bits=256/256); Fri, 07 Jun 2019 03:00:06 -0700 (PDT) Received-SPF: pass (google.com: domain of qemu-devel-bounces+patch=linaro.org@nongnu.org designates 209.51.188.47 as permitted sender) client-ip=209.51.188.47; Authentication-Results: mx.google.com; dkim=fail header.i=@linaro.org header.s=google header.b=Cet4zqGw; spf=pass (google.com: domain of qemu-devel-bounces+patch=linaro.org@nongnu.org designates 209.51.188.47 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]:47722 helo=lists.gnu.org) by lists.gnu.org with esmtp (Exim 4.86_2) (envelope-from ) id 1hZBfK-0008IV-4H for patch@linaro.org; Fri, 07 Jun 2019 06:00:06 -0400 Received: from eggs.gnu.org ([2001:470:142:3::10]:42201) by lists.gnu.org with esmtp (Exim 4.86_2) (envelope-from ) id 1hZAvT-0002FX-AY for qemu-devel@nongnu.org; Fri, 07 Jun 2019 05:12:45 -0400 Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71) (envelope-from ) id 1hZAvQ-0004yE-He for qemu-devel@nongnu.org; Fri, 07 Jun 2019 05:12:43 -0400 Received: from mail-wm1-x331.google.com ([2a00:1450:4864:20::331]:51456) by eggs.gnu.org with esmtps (TLS1.0:RSA_AES_128_CBC_SHA1:16) (Exim 4.71) (envelope-from ) id 1hZAvQ-0004kQ-8j for qemu-devel@nongnu.org; Fri, 07 Jun 2019 05:12:40 -0400 Received: by mail-wm1-x331.google.com with SMTP id f10so1243927wmb.1 for ; Fri, 07 Jun 2019 02:12: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=99Dn3AIAE6bUMupx6Zxv5Z+hFUdE7BsSiaYvbx/TT8U=; b=Cet4zqGwxmOsg9wlvbgbB0jSgfw143kcG3Mv7oMA9DzOl4GxtUwDEb6PX6Sg3z5M+z JZf0Uwnz9fxzhft81kDZx9UdVtyRB83w1uBvVm8KnaDrwGEKBSndUQxp/f7w1SPnFAYL iBe3UjrzbHBwmqh9CKW5/gXpDVPh+EIoGyvi4z7H/uMd2pZWvi5RmGOeDZApH59+4iGG 7CnkqWmuehmD4BBuiEHEBnKkpy3bt6tcruNrZLMQtzOE4ISLtIG39GLFX4/GNF18JOel pOtFQRlNDAJTH/gvTMceJX1vXnM9EyXIzGWh0YnPLUH1X50mKbMWgdE9h8EOaeIVqRXB VlBw== 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=99Dn3AIAE6bUMupx6Zxv5Z+hFUdE7BsSiaYvbx/TT8U=; b=H2Er5Ci16YzhMU02tGQX0S9BJDM4hI/7yuxM75aoBW5q3KPg7XqX6LqXknBpUadlcV X3tVgh2Ahj8Puj4zP9Bo80PXhr6/K8OpMIRNstRwApbyTbVx+oL6sxMZjcj09F339ruD 1h1hKargy23Ub8uOmiYN1muoW2Lc8MGECDp13I+QstUzBxk+osox/wa24ERCJFWNIPTn Tu3c1cYT62iHa7fwWLWyIQNiO/+vnRpkwahzLOUQ1QppSGK75Baea2Jg1SOmRpPLrvF+ 2SL/Gbrc2YrtDd2za04Y7EHrRb+yWb/sJME/PouCURHUCzFSnU4yv4kLSOvUstGJmwgl vv2Q== X-Gm-Message-State: APjAAAVWn9uoJnQJSzLTzIGNHONBo19fLqcp7YkQmbs8hwucHvjqyhVW VgrH5q/eLElYinsZsiCBQs2/rw== X-Received: by 2002:a05:600c:20c3:: with SMTP id y3mr3008049wmm.3.1559898753112; Fri, 07 Jun 2019 02:12:33 -0700 (PDT) Received: from zen.linaroharston ([81.128.185.34]) by smtp.gmail.com with ESMTPSA id j82sm1303398wmj.40.2019.06.07.02.12.28 (version=TLS1_3 cipher=AEAD-AES256-GCM-SHA384 bits=256/256); Fri, 07 Jun 2019 02:12:30 -0700 (PDT) Received: from zen.linaroharston. (localhost [127.0.0.1]) by zen.linaroharston (Postfix) with ESMTP id 31EC21FFB1; Fri, 7 Jun 2019 10:05:54 +0100 (BST) From: =?utf-8?q?Alex_Benn=C3=A9e?= To: peter.maydell@linaro.org Date: Fri, 7 Jun 2019 10:05:26 +0100 Message-Id: <20190607090552.12434-28-alex.bennee@linaro.org> X-Mailer: git-send-email 2.20.1 In-Reply-To: <20190607090552.12434-1-alex.bennee@linaro.org> References: <20190607090552.12434-1-alex.bennee@linaro.org> MIME-Version: 1.0 X-detected-operating-system: by eggs.gnu.org: Genre and OS details not recognized. X-Received-From: 2a00:1450:4864:20::331 Subject: [Qemu-devel] [PULL 27/52] cputlb: use uint64_t for interim values for unaligned load 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 , qemu-devel@nongnu.org, Laszlo Ersek , Paolo Bonzini , Igor Mammedov , =?utf-8?q?Philippe_Mathieu-Daud=C3=A9?= , Richard Henderson Errors-To: qemu-devel-bounces+patch=linaro.org@nongnu.org Sender: "Qemu-devel" When running on 32 bit TCG backends a wide unaligned load ends up truncating data before returning to the guest. We specifically have the return type as uint64_t to avoid any premature truncation so we should use the same for the interim types. Fixes: https://bugs.launchpad.net/qemu/+bug/1830872 Fixes: eed5664238e Signed-off-by: Alex Bennée Reviewed-by: Philippe Mathieu-Daudé Reviewed-by: Richard Henderson Tested-by: Laszlo Ersek Tested-by: Igor Mammedov -- 2.20.1 diff --git a/accel/tcg/cputlb.c b/accel/tcg/cputlb.c index cdcc377102..b796ab1cbe 100644 --- a/accel/tcg/cputlb.c +++ b/accel/tcg/cputlb.c @@ -1303,7 +1303,7 @@ load_helper(CPUArchState *env, target_ulong addr, TCGMemOpIdx oi, && unlikely((addr & ~TARGET_PAGE_MASK) + size - 1 >= TARGET_PAGE_SIZE)) { target_ulong addr1, addr2; - tcg_target_ulong r1, r2; + uint64_t r1, r2; unsigned shift; do_unaligned_access: addr1 = addr & ~(size - 1); From patchwork Fri Jun 7 09:05:27 2019 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 8bit X-Patchwork-Submitter: =?utf-8?q?Alex_Benn=C3=A9e?= X-Patchwork-Id: 166121 Delivered-To: patch@linaro.org Received: by 2002:a92:9e1a:0:0:0:0:0 with SMTP id q26csp440827ili; Fri, 7 Jun 2019 03:15:02 -0700 (PDT) X-Google-Smtp-Source: APXvYqyNub5izMGB9Oa5btfpMlLWuJKUigLP83Qzcfb/MfZKia7PJIqN7Z8UEwy2o7GqLhCkm2ge X-Received: by 2002:a37:4793:: with SMTP id u141mr17431288qka.355.1559902502414; Fri, 07 Jun 2019 03:15:02 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1559902502; cv=none; d=google.com; s=arc-20160816; b=rPPTrVhhCdvLF7F+ACQSgaeiH94D+1XS9jDotbdb/M4KCDImxWfP94F9lzihJtviS3 JR0kKcFjACzj2ElDroTx0qqOUCEHGE+bh/O4X+DOllAZrVfjrEZldoIpumukdzyez0xJ BujRN6JxZf0dWLnO+WT4R0ZS2p0NleJ3GLXQkDR+w4QGPv7miDS3zVKKcnvL2fcVnUKw ilyu8zJ2BxS38ATmEZ++waS6AkfbdzdPfqLPq+qzQoU9mr28XOa3b1WTeNzqaktGYGr8 G4QlhWKJGJ2QPcsFt/PW81pEpKM9d0+z/3sGA7LKiqF9RRsyq1KonkJuuj0nSSylPKJr AO+w== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=sender:errors-to:cc:list-subscribe:list-help:list-post:list-archive :list-unsubscribe:list-id:precedence:subject :content-transfer-encoding:mime-version:references:in-reply-to :message-id:date:to:from:dkim-signature; bh=PLY1Kb/j4Fld5ce4nXx3RXm9FLwwfldPCHeqmdO//6E=; b=idvMhBQT8RWmK4FPlb/gXBxyxg1odJ1orRhFE7ZWY2Bq1YHIYwV6pdJwa2dWQ2DlPo YzuWbxhfotsdogAxCm/ErritFIgcAtN/Wwn1R39LuxJxPjM1cCHpqz/tLaQMqZj6gSLU Y66zistKx38sVRNnO3zy3XycyPn41VD6ZCHH3/+X/B5l8h4W3EuYWOL0C0WSfV29rYI8 x7v4KFiARV/PkGopbUwOJxmF8HYwZr9Xf2Oj1sguw4ar91Tosu5vUIETerE7fjeAIbfw 1YFsrKKpu75pnXJKcOIlQj89joZJjZQt0TO0Y32scr/VKRA62ZnWmRm8G/131Who/ov5 08vw== ARC-Authentication-Results: i=1; mx.google.com; dkim=fail header.i=@linaro.org header.s=google header.b="YNkOmvB/"; spf=pass (google.com: domain of qemu-devel-bounces+patch=linaro.org@nongnu.org designates 209.51.188.47 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.47]) by mx.google.com with ESMTPS id f189si893305qkb.246.2019.06.07.03.15.02 for (version=TLS1_2 cipher=ECDHE-RSA-CHACHA20-POLY1305 bits=256/256); Fri, 07 Jun 2019 03:15:02 -0700 (PDT) Received-SPF: pass (google.com: domain of qemu-devel-bounces+patch=linaro.org@nongnu.org designates 209.51.188.47 as permitted sender) client-ip=209.51.188.47; Authentication-Results: mx.google.com; dkim=fail header.i=@linaro.org header.s=google header.b="YNkOmvB/"; spf=pass (google.com: domain of qemu-devel-bounces+patch=linaro.org@nongnu.org designates 209.51.188.47 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]:47918 helo=lists.gnu.org) by lists.gnu.org with esmtp (Exim 4.86_2) (envelope-from ) id 1hZBtl-0003Dw-RA for patch@linaro.org; Fri, 07 Jun 2019 06:15:01 -0400 Received: from eggs.gnu.org ([2001:470:142:3::10]:44959) by lists.gnu.org with esmtp (Exim 4.86_2) (envelope-from ) id 1hZB4z-00085p-Lh for qemu-devel@nongnu.org; Fri, 07 Jun 2019 05:22:34 -0400 Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71) (envelope-from ) id 1hZB4y-0005ot-8Z for qemu-devel@nongnu.org; Fri, 07 Jun 2019 05:22:33 -0400 Received: from mail-wr1-x42d.google.com ([2a00:1450:4864:20::42d]:39822) by eggs.gnu.org with esmtps (TLS1.0:RSA_AES_128_CBC_SHA1:16) (Exim 4.71) (envelope-from ) id 1hZB4x-0005kB-VX for qemu-devel@nongnu.org; Fri, 07 Jun 2019 05:22:32 -0400 Received: by mail-wr1-x42d.google.com with SMTP id x4so1399585wrt.6 for ; Fri, 07 Jun 2019 02:22:30 -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=PLY1Kb/j4Fld5ce4nXx3RXm9FLwwfldPCHeqmdO//6E=; b=YNkOmvB/xTWtFw4rkS42jDSIJrlEJbuOKbgNlADuND7RbCtN3IBk2ejtX6F/WFImwF gXQxFh71mFN0d4HoUt4/OTsG4AvGHZSIVTZmneqMQTwUubqeyaH/QuW8IdRE575f9sMN jU3IG0CKaz9U7Zr+sfbon1mz4P+lZY7F1QB7rBc7IG+RJFOXVpXzyHn9tW37yk94tE8f gH1NAqujc1Dp9LvuR+skU3MBbw1HZkdQs601CEciZXQY3l4cZOAANoLxcS3FPv4f33HM Hb6abWdPr8wsM7dEy1T3jgxxm7JdhOPHVqIDVr4tJ8EA1YP9AiEfDFmY5zaYqy/LnGvp nPBg== 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=PLY1Kb/j4Fld5ce4nXx3RXm9FLwwfldPCHeqmdO//6E=; b=JUcrPMzxUw9yuODjGanG+QvHuXl3WhNLART23IP8d2v3IZQfcxxqfu+bVlxk+cLAxm SMPulgCm8BELZ0OAqXF7I4sKwX4eJ0Vmp3jMNlCVt1PZpfOl8f7fOyUCh4/WRhW3jCyB Ii0xFw5hHS4pmHdeDgMA5G5b4/FSv5ZWCAPSSTisQRvC3OEb6tjs/XrxErzEuXuo5XY0 MLW9vEfLQiiHubJjCqJUjpcZVfAjtMZfHBl+C0HEbAnAptlRBl9bI/TdSyJLP1u9IasW b4N+MG7nx6lyXXftKmfoYlnyd0BNK6IXt1k+XjzrsOgYLwJoxfjsPs0/ebFyw4qmSKOl +OKg== X-Gm-Message-State: APjAAAW88jVQYz6roOSWMaI2sdaOU0ZaZ+F94ZrcUog3hfth23Mww+cc hfvvtkuFqn5NxF06ww7Y2DEqNg== X-Received: by 2002:adf:f246:: with SMTP id b6mr8433212wrp.92.1559899349200; Fri, 07 Jun 2019 02:22:29 -0700 (PDT) Received: from zen.linaroharston ([81.128.185.34]) by smtp.gmail.com with ESMTPSA id x83sm1379571wmb.42.2019.06.07.02.22.26 (version=TLS1_3 cipher=AEAD-AES256-GCM-SHA384 bits=256/256); Fri, 07 Jun 2019 02:22:27 -0700 (PDT) Received: from zen.linaroharston. (localhost [127.0.0.1]) by zen.linaroharston (Postfix) with ESMTP id 454781FFB3; Fri, 7 Jun 2019 10:05:54 +0100 (BST) From: =?utf-8?q?Alex_Benn=C3=A9e?= To: peter.maydell@linaro.org Date: Fri, 7 Jun 2019 10:05:27 +0100 Message-Id: <20190607090552.12434-29-alex.bennee@linaro.org> X-Mailer: git-send-email 2.20.1 In-Reply-To: <20190607090552.12434-1-alex.bennee@linaro.org> References: <20190607090552.12434-1-alex.bennee@linaro.org> MIME-Version: 1.0 X-detected-operating-system: by eggs.gnu.org: Genre and OS details not recognized. X-Received-From: 2a00:1450:4864:20::42d Subject: [Qemu-devel] [PULL 28/52] tests/tcg: better detect truncated reads 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?= , qemu-devel@nongnu.org Errors-To: qemu-devel-bounces+patch=linaro.org@nongnu.org Sender: "Qemu-devel" If we've truncated a wider read we can detect the condition earlier by looking at the number of zeros we've read. So we don't trip up on cases where we have written zeros to the start of the buffer we also ensure we only start each offset read from the right address. Signed-off-by: Alex Bennée -- 2.20.1 diff --git a/tests/tcg/multiarch/system/memory.c b/tests/tcg/multiarch/system/memory.c index dc1d8a98ff..d124502d73 100644 --- a/tests/tcg/multiarch/system/memory.c +++ b/tests/tcg/multiarch/system/memory.c @@ -208,6 +208,7 @@ static bool read_test_data_u32(int offset) for (i = 0; i < max; i++) { uint8_t b1, b2, b3, b4; + int zeros = 0; word = *ptr++; b1 = word >> 24 & 0xff; @@ -215,6 +216,16 @@ static bool read_test_data_u32(int offset) b3 = word >> 8 & 0xff; b4 = word & 0xff; + zeros += (b1 == 0 ? 1 : 0); + zeros += (b2 == 0 ? 1 : 0); + zeros += (b3 == 0 ? 1 : 0); + zeros += (b4 == 0 ? 1 : 0); + if (zeros > 1) { + ml_printf("Error @ %p, more zeros than expected: %d, %d, %d, %d", + ptr - 1, b1, b2, b3, b4); + return false; + } + if ((b1 < b2 && b1 != 0) || (b2 < b3 && b2 != 0) || (b3 < b4 && b3 != 0)) { @@ -238,6 +249,7 @@ static bool read_test_data_u64(int offset) for (i = 0; i < max; i++) { uint8_t b1, b2, b3, b4, b5, b6, b7, b8; + int zeros = 0; word = *ptr++; b1 = ((uint64_t) (word >> 56)) & 0xff; @@ -249,6 +261,20 @@ static bool read_test_data_u64(int offset) b7 = (word >> 8) & 0xff; b8 = (word >> 0) & 0xff; + zeros += (b1 == 0 ? 1 : 0); + zeros += (b2 == 0 ? 1 : 0); + zeros += (b3 == 0 ? 1 : 0); + zeros += (b4 == 0 ? 1 : 0); + zeros += (b5 == 0 ? 1 : 0); + zeros += (b6 == 0 ? 1 : 0); + zeros += (b7 == 0 ? 1 : 0); + zeros += (b8 == 0 ? 1 : 0); + if (zeros > 1) { + ml_printf("Error @ %p, more zeros than expected: %d, %d, %d, %d, %d, %d, %d, %d", + ptr - 1, b1, b2, b3, b4, b5, b6, b7, b8); + return false; + } + if ((b1 < b2 && b1 != 0) || (b2 < b3 && b2 != 0) || (b3 < b4 && b3 != 0) || @@ -272,7 +298,7 @@ read_ufn read_ufns[] = { read_test_data_u16, read_test_data_u32, read_test_data_u64 }; -bool do_unsigned_reads(void) +bool do_unsigned_reads(int start_off) { int i; bool ok = true; @@ -280,11 +306,11 @@ bool do_unsigned_reads(void) for (i = 0; i < ARRAY_SIZE(read_ufns) && ok; i++) { #if CHECK_UNALIGNED int off; - for (off = 0; off < 8 && ok; off++) { + for (off = start_off; off < 8 && ok; off++) { ok = read_ufns[i](off); } #else - ok = read_ufns[i](0); + ok = read_ufns[i](start_off); #endif } @@ -298,11 +324,11 @@ static bool do_unsigned_test(init_ufn fn) int i; for (i = 0; i < 8 && ok; i++) { fn(i); - ok = do_unsigned_reads(); + ok = do_unsigned_reads(i); } #else fn(0); - return do_unsigned_reads(); + return do_unsigned_reads(0); #endif } From patchwork Fri Jun 7 09:05:28 2019 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 8bit X-Patchwork-Submitter: =?utf-8?q?Alex_Benn=C3=A9e?= X-Patchwork-Id: 166104 Delivered-To: patch@linaro.org Received: by 2002:a92:9e1a:0:0:0:0:0 with SMTP id q26csp415177ili; Fri, 7 Jun 2019 02:49:22 -0700 (PDT) X-Google-Smtp-Source: APXvYqxtEq6S9Fl9NFnEoWEfhVh6umTI5j8SH50m+RhgZ16tK41hVBhnhhmstSIKNQPmHulVurXo X-Received: by 2002:ac8:2c6a:: with SMTP id e39mr46235743qta.179.1559900962862; Fri, 07 Jun 2019 02:49:22 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1559900962; cv=none; d=google.com; s=arc-20160816; b=QxpXpW9sb47NOvDo/eNwlUZcOWKeYeKAa1hJr9mhdjk0Tqb8P7HZrV0GCcr5bwmZwp aQVRD+dnASFQYHh0dxPUTaPRBeE3U9ZXb0wkHa9Z+mfwamdlEM3w67pok+nL21ARPoqh lvB/VknkZ4VypG14hPRWmWkzwyVCvMrhqw0ofvaaEKY/omvy4G09I0nhtaY5oi8nYbO2 Tqs+1LpXeIvByGfC5X36xUTAgrPb7LVnLcP438CTC7CH+S+V2tyKLi0Fh6U0Dh0QqiY9 sepe2hvzQMogrCh34PdjCESbIExAgOfqrUNCFz8WxY8DsEHzQo55rbp1ShaBzYUKM81G qkcw== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=sender:errors-to:cc:list-subscribe:list-help:list-post:list-archive :list-unsubscribe:list-id:precedence:subject :content-transfer-encoding:mime-version:references:in-reply-to :message-id:date:to:from:dkim-signature; bh=2ORtsrdcOtlazSV007+SAu/zrWhHGlOaKswTJZUeVrI=; b=tA0Ez3sgzS1GmLJfOLuNFC5LpFXdeqD6X68rgQHHWo+IHLr1ij591yYotXrdNwhdtp 6oFK5ZBcpE0YMpyEl1NyGL1ogJn2a3O2qZE3IjxDH15kBr3bIyqHawojXhGZwsAQe1jZ Fzx27Irpvb9kOppymEPMt1qlHTqYVYHndDkJ8WYXgaMjB8Nz5QGCM0PFyrrqpxePmkfD GYdnatj6LrLJ+LlnkFQund+eEeNhpAowoCehe83GErp3g+WthKJxv9Sky8P0U+uMf8io cIhcjusdk/FEwaLpgboQYOzmK18iES0vLFYcnQ/XDDfDbLLwFoaMtjzpZhlL3M882IYq 98CQ== ARC-Authentication-Results: i=1; mx.google.com; dkim=fail header.i=@linaro.org header.s=google header.b=pME6FuNH; spf=pass (google.com: domain of qemu-devel-bounces+patch=linaro.org@nongnu.org designates 209.51.188.47 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.47]) by mx.google.com with ESMTPS id m13si869831qkk.222.2019.06.07.02.49.22 for (version=TLS1_2 cipher=ECDHE-RSA-CHACHA20-POLY1305 bits=256/256); Fri, 07 Jun 2019 02:49:22 -0700 (PDT) Received-SPF: pass (google.com: domain of qemu-devel-bounces+patch=linaro.org@nongnu.org designates 209.51.188.47 as permitted sender) client-ip=209.51.188.47; Authentication-Results: mx.google.com; dkim=fail header.i=@linaro.org header.s=google header.b=pME6FuNH; spf=pass (google.com: domain of qemu-devel-bounces+patch=linaro.org@nongnu.org designates 209.51.188.47 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]:47636 helo=lists.gnu.org) by lists.gnu.org with esmtp (Exim 4.86_2) (envelope-from ) id 1hZBUw-0005pu-El for patch@linaro.org; Fri, 07 Jun 2019 05:49:22 -0400 Received: from eggs.gnu.org ([2001:470:142:3::10]:42101) by lists.gnu.org with esmtp (Exim 4.86_2) (envelope-from ) id 1hZAvQ-0002Bt-7S for qemu-devel@nongnu.org; Fri, 07 Jun 2019 05:12:43 -0400 Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71) (envelope-from ) id 1hZAvK-0004lL-6K for qemu-devel@nongnu.org; Fri, 07 Jun 2019 05:12:37 -0400 Received: from mail-wr1-x441.google.com ([2a00:1450:4864:20::441]:43834) by eggs.gnu.org with esmtps (TLS1.0:RSA_AES_128_CBC_SHA1:16) (Exim 4.71) (envelope-from ) id 1hZAvI-0004ef-3m for qemu-devel@nongnu.org; Fri, 07 Jun 2019 05:12:32 -0400 Received: by mail-wr1-x441.google.com with SMTP id r18so1351378wrm.10 for ; Fri, 07 Jun 2019 02:12:30 -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=2ORtsrdcOtlazSV007+SAu/zrWhHGlOaKswTJZUeVrI=; b=pME6FuNHoGE2J2PTCtiwuV1NhW5fxi1kNlW/LBAi2EuD5xjL1kvNapVP738Cmx1Jqr k90bEBqlKktqp35L7KhxZX/kH+QwgubJK9ZUovIDnzJ4w4PHcPjCGENE3eaNXMC7B6rt jr9aDyjMCXfa7NyLBiQN333Et0uyLjmVtnMOMOju5pBiqHVmfLnR+LKxZIOh6TFnaXSc kY0SJhRTl/FamMUOQuHTNArILU/znaClY4yUqNkpxofoFm4/Bm4jaWuKuzQ9CEVDNGKS +UYQmNxal+J1srgTYlRXprygl23dtosZso8lNcHbIW7iSooLDPwlE/K4WLljACzj7LAT +MYA== 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=2ORtsrdcOtlazSV007+SAu/zrWhHGlOaKswTJZUeVrI=; b=YLwWqsgoHAAG0shDpPfBwHfDRNsbyXp8/kQFNq8sGkZWRSJ0cZ+EMmpDfcuTymiL5N R63gFO4Jo3V9AI5psMy6oehmDafIWIJuxgh4PeE5wmUIMtNNuR+Z/t/XsWIGtXNLRTJn OJc5I9gkKhkWzC4Ol6vblKqC+VSL9skydrCO0AUlxLPrsBlMNXAjHDtK8grXjuG/QgoZ 4uVKkkA47lizmoH+rpQt4PTnGGI10EgGT9QZYizZtPz84m1PVRUoG3bUJAQkHEID5+0e sEvHngQvEhSPh6WalkREEQBCbgiIZOkWXkzRF48GjFkANNXG58/48rxfmmp5zGybVSMd 9zEw== X-Gm-Message-State: APjAAAXNQQFJ/ExbeBobhnZiLJy71VWpr0x6ZKZOIQcIwikcCSxKBmeS o/KmVvj0Evog9L4h+wdmNpoi4g== X-Received: by 2002:a5d:4a0b:: with SMTP id m11mr23256095wrq.251.1559898749728; Fri, 07 Jun 2019 02:12:29 -0700 (PDT) Received: from zen.linaroharston ([81.128.185.34]) by smtp.gmail.com with ESMTPSA id g5sm1694727wrp.29.2019.06.07.02.12.26 (version=TLS1_3 cipher=AEAD-AES256-GCM-SHA384 bits=256/256); Fri, 07 Jun 2019 02:12:27 -0700 (PDT) Received: from zen.linaroharston. (localhost [127.0.0.1]) by zen.linaroharston (Postfix) with ESMTP id 57ACB1FFB4; Fri, 7 Jun 2019 10:05:54 +0100 (BST) From: =?utf-8?q?Alex_Benn=C3=A9e?= To: peter.maydell@linaro.org Date: Fri, 7 Jun 2019 10:05:28 +0100 Message-Id: <20190607090552.12434-30-alex.bennee@linaro.org> X-Mailer: git-send-email 2.20.1 In-Reply-To: <20190607090552.12434-1-alex.bennee@linaro.org> References: <20190607090552.12434-1-alex.bennee@linaro.org> MIME-Version: 1.0 X-detected-operating-system: by eggs.gnu.org: Genre and OS details not recognized. X-Received-From: 2a00:1450:4864:20::441 Subject: [Qemu-devel] [PULL 29/52] tests/tcg: clean-up VPATH/TESTS for i386 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: Paolo Bonzini , =?utf-8?q?Alex_Benn=C3=A9e?= , qemu-devel@nongnu.org, Eduardo Habkost , Richard Henderson Errors-To: qemu-devel-bounces+patch=linaro.org@nongnu.org Sender: "Qemu-devel" Since we only run build the multiarch tests and we use a fully resolved path for the crt object we don't need the wildcard or VPATH messing about. Signed-off-by: Alex Bennée -- 2.20.1 diff --git a/tests/tcg/i386/Makefile.softmmu-target b/tests/tcg/i386/Makefile.softmmu-target index e1f98177aa..e1d880f9b5 100644 --- a/tests/tcg/i386/Makefile.softmmu-target +++ b/tests/tcg/i386/Makefile.softmmu-target @@ -8,15 +8,10 @@ I386_SYSTEM_SRC=$(SRC_PATH)/tests/tcg/i386/system X64_SYSTEM_SRC=$(SRC_PATH)/tests/tcg/x86_64/system -# Set search path for all sources -VPATH+=$(I386_SYSTEM_SRC) # These objects provide the basic boot code and helper functions for all tests CRT_OBJS=boot.o -X86_TEST_SRCS=$(wildcard $(I386_SYSTEM_SRC)/*.c) -X86_TESTS = $(patsubst $(I386_SYSTEM_SRC)/%.c, %, $(X86_TEST_SRCS)) - ifeq ($(TARGET_X86_64), y) CRT_PATH=$(X64_SYSTEM_SRC) LINK_SCRIPT=$(X64_SYSTEM_SRC)/kernel.ld @@ -26,12 +21,12 @@ CRT_PATH=$(I386_SYSTEM_SRC) CFLAGS+=-m32 LINK_SCRIPT=$(I386_SYSTEM_SRC)/kernel.ld LDFLAGS=-Wl,-T$(LINK_SCRIPT) -Wl,-melf_i386 -# FIXME: move to common once x86_64 is bootstrapped -TESTS+=$(X86_TESTS) $(MULTIARCH_TESTS) endif CFLAGS+=-nostdlib -ggdb -O0 $(MINILIB_INC) LDFLAGS+=-static -nostdlib $(CRT_OBJS) $(MINILIB_OBJS) -lgcc +TESTS+=$(MULTIARCH_TESTS) + # building head blobs .PRECIOUS: $(CRT_OBJS) From patchwork Fri Jun 7 09:05:29 2019 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 8bit X-Patchwork-Submitter: =?utf-8?q?Alex_Benn=C3=A9e?= X-Patchwork-Id: 166108 Delivered-To: patch@linaro.org Received: by 2002:a92:9e1a:0:0:0:0:0 with SMTP id q26csp417871ili; Fri, 7 Jun 2019 02:52:43 -0700 (PDT) X-Google-Smtp-Source: APXvYqzSiR2FNoRFs70Uz+iwg6N8hybUSgW50HsqtRTx791nAzup3w++nygUZgHWvBLMg/oh2nHN X-Received: by 2002:ac8:21b7:: with SMTP id 52mr27323297qty.59.1559901163735; Fri, 07 Jun 2019 02:52:43 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1559901163; cv=none; d=google.com; s=arc-20160816; b=i+xzu8wVkCsZwolwjLRmYrZGr4F0BPE1AYxNpeVhVZkg4FHK3Q7vet1cHrmTESJj6E 0e9+Hl4wDe/tEjkvkCDZTaUo7ByZ5QNKf+B2pgPfvazWXArwWvpY7ugIg7x2N6yvbxWH ePaQDWRULAa2O3CC4aWInxnki3wOHO+XeVx1uXO4B3StDZakvA31882cAcGDSu7VvxsE n2ay8JkrYyUPgzrzTA8cFn5smQef4WsAbbQc/hNsLF1Fv4OpkEWrDGpnmlDEswj34CXU ZgR1fyDkIS35acbHK2X/ckqNN7DbJIbE4dF+glkbYRD8RgSI6doxQrguk+vphaYcaiMg 2ChQ== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=sender:errors-to:cc:list-subscribe:list-help:list-post:list-archive :list-unsubscribe:list-id:precedence:subject :content-transfer-encoding:mime-version:references:in-reply-to :message-id:date:to:from:dkim-signature; bh=GG8+B2YKZAzbtPtKRtN7JHzNyOJ/PV6z6R/XdCaBQE8=; b=PPMClYCINT/6KSupAvMVaKYnZC9GQh+J9crgDo7GYQ83PaPhmgdDTje7G2MsXNGaN5 8KJahHodskJQ9r72L9dyt8yyuVBXMCaunhEMXZ+ifHJSlde+obvdkOE9Imx14R9lR6zE 6OaGt9YNbYLj0MDGkEwcfsaTWVqqHhV/jTWAZf84N4VY08qFzthGoAOCY+8Ewos9+Wvh 2WoxTOWswIvhhdl1ODi9GprwjNMBBrN/t/40w6ZZ5X8DAk7IRzn8FxS9ZgfkReVFELNp 03SpmYwg7fKh2Xfk/J0ANZN24Mp3SyRsQQsfuIvMilYi5Hw70L+IfQtWu1oeS3wreQHD 2nAQ== ARC-Authentication-Results: i=1; mx.google.com; dkim=fail header.i=@linaro.org header.s=google header.b=BY8nIR4+; spf=pass (google.com: domain of qemu-devel-bounces+patch=linaro.org@nongnu.org designates 209.51.188.47 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.47]) by mx.google.com with ESMTPS id e58si986783qta.320.2019.06.07.02.52.43 for (version=TLS1_2 cipher=ECDHE-RSA-CHACHA20-POLY1305 bits=256/256); Fri, 07 Jun 2019 02:52:43 -0700 (PDT) Received-SPF: pass (google.com: domain of qemu-devel-bounces+patch=linaro.org@nongnu.org designates 209.51.188.47 as permitted sender) client-ip=209.51.188.47; Authentication-Results: mx.google.com; dkim=fail header.i=@linaro.org header.s=google header.b=BY8nIR4+; spf=pass (google.com: domain of qemu-devel-bounces+patch=linaro.org@nongnu.org designates 209.51.188.47 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]:47668 helo=lists.gnu.org) by lists.gnu.org with esmtp (Exim 4.86_2) (envelope-from ) id 1hZBYB-0000qn-9r for patch@linaro.org; Fri, 07 Jun 2019 05:52:43 -0400 Received: from eggs.gnu.org ([2001:470:142:3::10]:42206) by lists.gnu.org with esmtp (Exim 4.86_2) (envelope-from ) id 1hZAvT-0002Fd-BK for qemu-devel@nongnu.org; Fri, 07 Jun 2019 05:12:45 -0400 Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71) (envelope-from ) id 1hZAvQ-0004xS-6K for qemu-devel@nongnu.org; Fri, 07 Jun 2019 05:12:43 -0400 Received: from mail-wr1-x444.google.com ([2a00:1450:4864:20::444]:43837) by eggs.gnu.org with esmtps (TLS1.0:RSA_AES_128_CBC_SHA1:16) (Exim 4.71) (envelope-from ) id 1hZAvJ-0004gb-WB for qemu-devel@nongnu.org; Fri, 07 Jun 2019 05:12:34 -0400 Received: by mail-wr1-x444.google.com with SMTP id r18so1351444wrm.10 for ; Fri, 07 Jun 2019 02:12:32 -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=GG8+B2YKZAzbtPtKRtN7JHzNyOJ/PV6z6R/XdCaBQE8=; b=BY8nIR4+QZBm0/gUj4RmkMPIBhyFVidI/CbukYfiBG8OF8bJu7oL9lqII8cG4jz0ZN pd7zKMh8ib10Ws6kO4504O+Fk20BzOGma8JRe8sNvRD6afoYMtkQeZkQJEj6omIBVwKp sq9jIezfX9jDnN4aJnZL83Mhb8pDQIoQeXhC5tFfbYkMBEyegqjMX4/dns/Jr4mwOD+0 TzdsB2rpgr4WrgzFIurusYtM02FlnkU00lZiUmJkQXojG4HEw3EZJLZOkrSR0dvOcJEx jFplvSGzO/k8db+Yf4Ul6HZ6YEgjimrpv1HsjLu6c5SonVZ4I6Z7qlMqAfOea+QkjMHu auqA== 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=GG8+B2YKZAzbtPtKRtN7JHzNyOJ/PV6z6R/XdCaBQE8=; b=iYvNLGFzp6+R3/eVGlxZC2XoWChDX7Ved4kYspeLq7aWW9KQTSNi4zGJ1e8mouMJ0F Gve9/ildtt+xUWfOrbrUY74RjYoGx2S73O+zgvr3NxorOY3/vUzFHIthZC6FnR0oM0mG PDSTYeiP5f+q75rn/L10ohQGsV/9rIKxODMarZcJtd62fSa8Aig9z+kBIknhgkliBbJ4 cQkP0lntMMJC/z23r6X2rYraVH2p3BMT1PEY9JaD7jJvC41dkLuv4a2ajkVDfOazX8yL D27pj0W9J0/btRHFq2RuvzQ6r7DC2S3sgNSWZ8NyCgxZgZYm+b1Pz0s6NlJ7dRTqB8iM 5iQA== X-Gm-Message-State: APjAAAXNhp4zKOZhoHc501LDUNow9mFNGw6JFHetN/N1AU5sHBrZ9OXw OUE6FlEdVsy3XJUc4qzDGKVk/A== X-Received: by 2002:a5d:4a46:: with SMTP id v6mr32615252wrs.105.1559898750930; Fri, 07 Jun 2019 02:12:30 -0700 (PDT) Received: from zen.linaroharston ([81.128.185.34]) by smtp.gmail.com with ESMTPSA id 74sm1180468wma.7.2019.06.07.02.12.27 (version=TLS1_3 cipher=AEAD-AES256-GCM-SHA384 bits=256/256); Fri, 07 Jun 2019 02:12:29 -0700 (PDT) Received: from zen.linaroharston. (localhost [127.0.0.1]) by zen.linaroharston (Postfix) with ESMTP id 6E0C21FFB5; Fri, 7 Jun 2019 10:05:54 +0100 (BST) From: =?utf-8?q?Alex_Benn=C3=A9e?= To: peter.maydell@linaro.org Date: Fri, 7 Jun 2019 10:05:29 +0100 Message-Id: <20190607090552.12434-31-alex.bennee@linaro.org> X-Mailer: git-send-email 2.20.1 In-Reply-To: <20190607090552.12434-1-alex.bennee@linaro.org> References: <20190607090552.12434-1-alex.bennee@linaro.org> MIME-Version: 1.0 X-detected-operating-system: by eggs.gnu.org: Genre and OS details not recognized. X-Received-From: 2a00:1450:4864:20::444 Subject: [Qemu-devel] [PULL 30/52] tests/tcg/x86_64: add a PVH crt.o for x86_64 system tests 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: Paolo Bonzini , =?utf-8?q?Alex_Benn=C3=A9e?= , qemu-devel@nongnu.org, Eduardo Habkost , Richard Henderson Errors-To: qemu-devel-bounces+patch=linaro.org@nongnu.org Sender: "Qemu-devel" Instead of doing the full real to 64 bit dance we are attempting to leverage Xen's PVH boot spec to go from 32 bit to 64 bit. Signed-off-by: Alex Bennée -- 2.20.1 diff --git a/tests/tcg/i386/Makefile.softmmu-target b/tests/tcg/i386/Makefile.softmmu-target index e1d880f9b5..0a4364868c 100644 --- a/tests/tcg/i386/Makefile.softmmu-target +++ b/tests/tcg/i386/Makefile.softmmu-target @@ -14,6 +14,7 @@ CRT_OBJS=boot.o ifeq ($(TARGET_X86_64), y) CRT_PATH=$(X64_SYSTEM_SRC) +CFLAGS=-march=x86-64 LINK_SCRIPT=$(X64_SYSTEM_SRC)/kernel.ld LDFLAGS=-Wl,-T$(LINK_SCRIPT) -Wl,-melf_x86_64 else diff --git a/tests/tcg/x86_64/system/boot.S b/tests/tcg/x86_64/system/boot.S new file mode 100644 index 0000000000..205cfbd398 --- /dev/null +++ b/tests/tcg/x86_64/system/boot.S @@ -0,0 +1,277 @@ +/* + * x86_64 boot and support code + * + * Copyright 2019 Linaro + * + * This work is licensed under the terms of the GNU GPL, version 3 or later. + * See the COPYING file in the top-level directory. + * + * Unlike the i386 version we instead use Xen's PVHVM booting header + * which should drop us automatically into 32 bit mode ready to go. I've + * nabbed bits of the Linux kernel setup to achieve this. + * + * SPDX-License-Identifier: GPL-3.0-or-later + */ + + .section .head + +#define ELFNOTE_START(name, type, flags) \ +.pushsection .note.name, flags,@note ; \ + .balign 4 ; \ + .long 2f - 1f /* namesz */ ; \ + .long 4484f - 3f /* descsz */ ; \ + .long type ; \ +1:.asciz #name ; \ +2:.balign 4 ; \ +3: + +#define ELFNOTE_END \ +4484:.balign 4 ; \ +.popsection ; + +#define ELFNOTE(name, type, desc) \ + ELFNOTE_START(name, type, "") \ + desc ; \ + ELFNOTE_END + +#define XEN_ELFNOTE_ENTRY 1 +#define XEN_ELFNOTE_HYPERCALL_PAGE 2 +#define XEN_ELFNOTE_VIRT_BASE 3 +#define XEN_ELFNOTE_PADDR_OFFSET 4 +#define XEN_ELFNOTE_PHYS32_ENTRY 18 + +#define __ASM_FORM(x) x +#define __ASM_FORM_RAW(x) x +#define __ASM_FORM_COMMA(x) x, +#define __ASM_SEL(a,b) __ASM_FORM(b) +#define __ASM_SEL_RAW(a,b) __ASM_FORM_RAW(b) +#define _ASM_PTR __ASM_SEL(.long, .quad) + + ELFNOTE(Xen, XEN_ELFNOTE_VIRT_BASE, _ASM_PTR 0x100000) + ELFNOTE(Xen, XEN_ELFNOTE_ENTRY, _ASM_PTR _start) + ELFNOTE(Xen, XEN_ELFNOTE_PHYS32_ENTRY, _ASM_PTR _start) /* entry == virtbase */ + ELFNOTE(Xen, XEN_ELFNOTE_PADDR_OFFSET, _ASM_PTR 0) + + /* + * Entry point for PVH guests. + * + * Xen ABI specifies the following register state when we come here: + * + * - `ebx`: contains the physical memory address where the loader has placed + * the boot start info structure. + * - `cr0`: bit 0 (PE) must be set. All the other writeable bits are cleared. + * - `cr4`: all bits are cleared. + * - `cs `: must be a 32-bit read/execute code segment with a base of ‘0’ + * and a limit of ‘0xFFFFFFFF’. The selector value is unspecified. + * - `ds`, `es`: must be a 32-bit read/write data segment with a base of + * ‘0’ and a limit of ‘0xFFFFFFFF’. The selector values are all + * unspecified. + * - `tr`: must be a 32-bit TSS (active) with a base of '0' and a limit + * of '0x67'. + * - `eflags`: bit 17 (VM) must be cleared. Bit 9 (IF) must be cleared. + * Bit 8 (TF) must be cleared. Other bits are all unspecified. + * + * All other processor registers and flag bits are unspecified. The OS is in + * charge of setting up it's own stack, GDT and IDT. + */ + .code32 + .section .text + +.global _start +_start: + cld + lgdt gdtr + + ljmp $0x8,$.Lloadcs +.Lloadcs: + mov $0x10,%eax + mov %eax,%ds + mov %eax,%es + mov %eax,%fs + mov %eax,%gs + mov %eax,%ss + + /* Enable PAE mode (bit 5). */ + mov %cr4, %eax + btsl $5, %eax + mov %eax, %cr4 + +#define MSR_EFER 0xc0000080 /* extended feature register */ + + /* Enable Long mode. */ + mov $MSR_EFER, %ecx + rdmsr + btsl $8, %eax + wrmsr + + /* Enable paging */ + mov $.Lpml4, %ecx + mov %ecx, %cr3 + + mov %cr0, %eax + btsl $31, %eax + mov %eax, %cr0 + + /* Jump to 64-bit mode. */ + lgdt gdtr64 + ljmp $0x8,$.Lenter64 + + .code64 + .section .text +.Lenter64: + + + // Setup stack ASAP + movq $stack_end,%rsp + + /* don't worry about stack frame, assume everthing is garbage when we return */ + call main + + /* output any non-zero result in eax to isa-debug-exit device */ + test %al, %al + jz 1f + out %ax, $0xf4 + +1: /* QEMU ACPI poweroff */ + mov $0x604,%edx + mov $0x2000,%eax + out %ax,%dx + hlt + jmp 1b + + /* + * Helper Functions + * + * x86_64 calling convention is rdi, rsi, rdx, rcx, r8, r9 + */ + + /* Output a single character to serial port */ + .global __sys_outc +__sys_outc: + pushq %rax + mov %rax, %rdx + out %al,$0xE9 + popq %rax + ret + + /* Interrupt Descriptor Table */ + + .section .data + .align 16 + +idt_00: .int 0, 0 +idt_01: .int 0, 0 +idt_02: .int 0, 0 +idt_03: .int 0, 0 +idt_04: .int 0, 0 +idt_05: .int 0, 0 +idt_06: .int 0, 0 /* intr_6_opcode, Invalid Opcode */ +idt_07: .int 0, 0 +idt_08: .int 0, 0 +idt_09: .int 0, 0 +idt_0A: .int 0, 0 +idt_0B: .int 0, 0 +idt_0C: .int 0, 0 +idt_0D: .int 0, 0 +idt_0E: .int 0, 0 +idt_0F: .int 0, 0 +idt_10: .int 0, 0 +idt_11: .int 0, 0 +idt_12: .int 0, 0 +idt_13: .int 0, 0 +idt_14: .int 0, 0 +idt_15: .int 0, 0 +idt_16: .int 0, 0 +idt_17: .int 0, 0 +idt_18: .int 0, 0 +idt_19: .int 0, 0 +idt_1A: .int 0, 0 +idt_1B: .int 0, 0 +idt_1C: .int 0, 0 +idt_1D: .int 0, 0 +idt_1E: .int 0, 0 +idt_1F: .int 0, 0 + + + /* + * Global Descriptor Table (GDT) + * + * This describes various memory areas (segments) through + * segment descriptors. In 32 bit mode each segment each + * segement is associated with segment registers which are + * implicitly (or explicitly) referenced depending on the + * instruction. However in 64 bit mode selectors are flat and + * segmented addressing isn't used. + */ +gdt: + .short 0 +gdtr: + .short gdt_en - gdt - 1 + .int gdt + + // Code cs: + .short 0xFFFF + .short 0 + .byte 0 + .byte 0x9b + .byte 0xCF + .byte 0 + + // Data ds:, ss:, es:, fs:, and gs: + .short 0xFFFF + .short 0 + .byte 0 + .byte 0x93 + .byte 0xCF + .byte 0 +gdt_en: + +gdt64: + .short 0 +gdtr64: + .short gdt64_en - gdt64 - 1 + .int gdt64 + + // Code + .short 0xFFFF + .short 0 + .byte 0 + .byte 0x9b + .byte 0xAF + .byte 0 + + // Data + .short 0xFFFF + .short 0 + .byte 0 + .byte 0x93 + .byte 0xCF + .byte 0 +gdt64_en: + + .section .bss + .align 16 + +stack: .space 65536 +stack_end: + + .section .data + +.align 4096 +.Lpd: +i = 0 + .rept 512 * 4 + .quad 0x1e7 | (i << 21) + i = i + 1 + .endr + +.align 4096 +.Lpdp: + .quad .Lpd + 7 + 0 * 4096 /* 0-1 GB */ + .quad .Lpd + 7 + 1 * 4096 /* 1-2 GB */ + .quad .Lpd + 7 + 2 * 4096 /* 2-3 GB */ + .quad .Lpd + 7 + 3 * 4096 /* 3-4 GB */ + +.align 4096 +.Lpml4: + .quad .Lpdp + 7 /* 0-512 GB */ diff --git a/tests/tcg/x86_64/system/kernel.ld b/tests/tcg/x86_64/system/kernel.ld new file mode 100644 index 0000000000..49c12b04ae --- /dev/null +++ b/tests/tcg/x86_64/system/kernel.ld @@ -0,0 +1,33 @@ +PHDRS { + text PT_LOAD FLAGS(5); /* R_E */ + note PT_NOTE FLAGS(0); /* ___ */ +} + +SECTIONS { + . = 0x100000; + + .text : { + __load_st = .; + *(.head) + *(.text) + } :text + + .rodata : { + *(.rodata) + } :text + + /* Keep build ID and PVH notes in same section */ + .notes : { + *(.note.*) + } :note + + .data : { + *(.data) + __load_en = .; + } :text + + .bss : { + *(.bss) + __bss_en = .; + } +} From patchwork Fri Jun 7 09:05:30 2019 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 8bit X-Patchwork-Submitter: =?utf-8?q?Alex_Benn=C3=A9e?= X-Patchwork-Id: 166128 Delivered-To: patch@linaro.org Received: by 2002:a92:9e1a:0:0:0:0:0 with SMTP id q26csp448149ili; Fri, 7 Jun 2019 03:22:11 -0700 (PDT) X-Google-Smtp-Source: APXvYqyrPnlga2msle/J04DrfVSmPWuM0TWA4XVNMzm0OXOd2WJAoKPCTHTdoKG/fNVKCDxLvhA7 X-Received: by 2002:a05:6214:248:: with SMTP id k8mr10584792qvt.200.1559902931367; Fri, 07 Jun 2019 03:22:11 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1559902931; cv=none; d=google.com; s=arc-20160816; b=v+IjX7vDnaWTxUDRKfNiA8hgTk6K2TsxUF9dvKONN63abqUSWhk7XZeuAF7h/eoyaE KEAsqi6ZJs0mZ3n5I71BUWQByiav2rSuLrcp0zYNcjKymtDVuZ02S9pyft7h2GV069vz Yd2spGlzXwnuM2OhSvziXIOhkzqR5GeoVhnrdcBwIhHyaKEpT4mOTZeWzx7sAfU1hSzy ZJRgJDkZcOEcjJl1iHFwTDmaUI4N+Itj7/GvugeBbpD9Rwlx1rs3uJTwWfgH4w8+rE4/ mVj9KE01l7ev1BsZNq8NLneXwYhVjt3mLIy+PdcFPvdrQbHaqyip5pVR2y8MY7yDlyYM twOg== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=sender:errors-to:cc:list-subscribe:list-help:list-post:list-archive :list-unsubscribe:list-id:precedence:subject :content-transfer-encoding:mime-version:references:in-reply-to :message-id:date:to:from:dkim-signature; bh=JC3AVXNsquFwiFLInZAwShppokQkGXpbpXxA7+1lbo4=; b=gY1E8GUq4fiV6+JIyYeJ435e0aiwXG55fK5bfAkEt22nZhaeCqDbgAQVLQ1+QE0228 hxR+g2kVeB13ZCih2ZeNvDR4TEvbajIZ9Uxx+sMYcoS/t5655/HwfAfwGCV4pjb9Fyo5 h/QE5qRf0PU8a50PuboGTApZ/sktGOMOADUnlGq44lVWcoUsUqHiZTxNXCOUsz5C/sK4 nfOix+70Big33It1bUDEMvv362ISSqim4021yqoZdl+kzKp4j8tSyO6aQH3DxVSs1naW ZAYe2j8ehw9ZcR8kwDMkeNllP2hYJxrjFI+46eB3/3cHXFHU1J9bubwgX3IUVAvq4fOo B2hQ== ARC-Authentication-Results: i=1; mx.google.com; dkim=fail header.i=@linaro.org header.s=google header.b=rclwMiRx; spf=pass (google.com: domain of qemu-devel-bounces+patch=linaro.org@nongnu.org designates 209.51.188.47 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.47]) by mx.google.com with ESMTPS id i5si946850qkd.202.2019.06.07.03.22.11 for (version=TLS1_2 cipher=ECDHE-RSA-CHACHA20-POLY1305 bits=256/256); Fri, 07 Jun 2019 03:22:11 -0700 (PDT) Received-SPF: pass (google.com: domain of qemu-devel-bounces+patch=linaro.org@nongnu.org designates 209.51.188.47 as permitted sender) client-ip=209.51.188.47; Authentication-Results: mx.google.com; dkim=fail header.i=@linaro.org header.s=google header.b=rclwMiRx; spf=pass (google.com: domain of qemu-devel-bounces+patch=linaro.org@nongnu.org designates 209.51.188.47 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]:47968 helo=lists.gnu.org) by lists.gnu.org with esmtp (Exim 4.86_2) (envelope-from ) id 1hZC0g-00084w-Lk for patch@linaro.org; Fri, 07 Jun 2019 06:22:10 -0400 Received: from eggs.gnu.org ([2001:470:142:3::10]:45107) by lists.gnu.org with esmtp (Exim 4.86_2) (envelope-from ) id 1hZB56-0008PH-33 for qemu-devel@nongnu.org; Fri, 07 Jun 2019 05:22:41 -0400 Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71) (envelope-from ) id 1hZB55-0005z6-4n for qemu-devel@nongnu.org; Fri, 07 Jun 2019 05:22:40 -0400 Received: from mail-wm1-x32c.google.com ([2a00:1450:4864:20::32c]:33019) by eggs.gnu.org with esmtps (TLS1.0:RSA_AES_128_CBC_SHA1:16) (Exim 4.71) (envelope-from ) id 1hZB54-0005y0-UY for qemu-devel@nongnu.org; Fri, 07 Jun 2019 05:22:39 -0400 Received: by mail-wm1-x32c.google.com with SMTP id h19so3634800wme.0 for ; Fri, 07 Jun 2019 02:22:38 -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=JC3AVXNsquFwiFLInZAwShppokQkGXpbpXxA7+1lbo4=; b=rclwMiRx1mNavkQcbhavQ1UQSYy55qEHbjX3lW0OxhsU0ZE0jf8IzXxdNfcZB8zc+1 b+w9fCDt+a5fGw5uFQDyoT3bQAfv3hPwMhlblUbbndxIuOO3Wpo/r0z/FrRVBZint4/P 9hHlUWMB6RWhjHZTVzWWF61B0+ozOpSNobksTH7UG79OU0gCxjDaDeA9On0XBiTHIsem BmqwNuon8BgeMPQ3pGPb2r5eVwANa40uw8FKkccVrfHIv39LtHKKj90CESM42K5Q5lpg 0YXuwh/mxb5juWxcoFWcEYPtWLXztXWyJ1pty1UBJF5VcxfJLhcqXG9mCS7wQzqE37Ho 2GXw== 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=JC3AVXNsquFwiFLInZAwShppokQkGXpbpXxA7+1lbo4=; b=G5lRGG9UDiqA2wWDFsI1gfHvs9ah2mOr8dlYTSvHtN0C2ZYppscszfp3WchZVt6rGX M1zZZV89sfxiJwGub+bWWdXti3TAgcGdAg/hn/fEDYdlWt/WL7SkZ5PVOt78XAdVj1It fUXgG6REYP8RZ9Fl7WLU+eZcgGcnkzz7raRkHGE5Z4AtqlqKmHY6ZMg5okh4NwiL/wgv n16CUPYt4sE+8UWDKfroHXdzTjm01H2c7DPCsmDAZXfwnTKkpNy7Da+sOHFJWeJrz649 bgpjEtHwhZTE6OvLEy+qbQUIg5Vys0f2eU4SHsvcz8WNQ+3UHN8Tm8xL24Lq4c9eXxn1 jbig== X-Gm-Message-State: APjAAAUUSav6NmQ/YCgbHaaScK8mw0L1i/8KD39w0J1EikHPvAtri624 ppVa+DKkmsH0RWmMfDilzNlfga6CZ3E= X-Received: by 2002:a05:600c:291:: with SMTP id 17mr2858052wmk.32.1559899357794; Fri, 07 Jun 2019 02:22:37 -0700 (PDT) Received: from zen.linaroharston ([81.128.185.34]) by smtp.gmail.com with ESMTPSA id 88sm1876360wrl.68.2019.06.07.02.22.30 (version=TLS1_3 cipher=AEAD-AES256-GCM-SHA384 bits=256/256); Fri, 07 Jun 2019 02:22:35 -0700 (PDT) Received: from zen.linaroharston. (localhost [127.0.0.1]) by zen.linaroharston (Postfix) with ESMTP id 802B31FFB7; Fri, 7 Jun 2019 10:05:54 +0100 (BST) From: =?utf-8?q?Alex_Benn=C3=A9e?= To: peter.maydell@linaro.org Date: Fri, 7 Jun 2019 10:05:30 +0100 Message-Id: <20190607090552.12434-32-alex.bennee@linaro.org> X-Mailer: git-send-email 2.20.1 In-Reply-To: <20190607090552.12434-1-alex.bennee@linaro.org> References: <20190607090552.12434-1-alex.bennee@linaro.org> MIME-Version: 1.0 X-detected-operating-system: by eggs.gnu.org: Genre and OS details not recognized. X-Received-From: 2a00:1450:4864:20::32c Subject: [Qemu-devel] [PULL 31/52] MAINTAINERS: put myself forward for gdbstub 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?Alex_Benn?= =?utf-8?b?w6ll?= , qemu-devel@nongnu.org, =?utf-8?q?Philippe_Ma?= =?utf-8?q?thieu-Daud=C3=A9?= Errors-To: qemu-devel-bounces+patch=linaro.org@nongnu.org Sender: "Qemu-devel" As I've been reviewing a lot of this recently and I'm going to put together a pull request I'd better keep an eye on it. Philippe has also volunteered to be a reviewer. Signed-off-by: Alex Bennée Reviewed-by: Richard Henderson Reviewed-by: Peter Maydell Reviewed-by: Philippe Mathieu-Daudé -- 2.20.1 diff --git a/MAINTAINERS b/MAINTAINERS index a96829ea83..9fd93d9c6a 100644 --- a/MAINTAINERS +++ b/MAINTAINERS @@ -1872,7 +1872,9 @@ F: util/error.c F: util/qemu-error.c GDB stub -S: Orphan +M: Alex Bennée +R: Philippe Mathieu-Daudé +S: Maintained F: gdbstub* F: gdb-xml/ From patchwork Fri Jun 7 09:05:31 2019 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 8bit X-Patchwork-Submitter: =?utf-8?q?Alex_Benn=C3=A9e?= X-Patchwork-Id: 166106 Delivered-To: patch@linaro.org Received: by 2002:a92:9e1a:0:0:0:0:0 with SMTP id q26csp417409ili; Fri, 7 Jun 2019 02:52:11 -0700 (PDT) X-Google-Smtp-Source: APXvYqzA4ZbGWuQYVgTsfw32TWHlMCY4IANBJ9Z5LIv8KVQYOHU3f1IhiX6ohit9waCZBAOTV3fw X-Received: by 2002:a0c:b084:: with SMTP id o4mr16720621qvc.227.1559901131111; Fri, 07 Jun 2019 02:52:11 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1559901131; cv=none; d=google.com; s=arc-20160816; b=s6RrKg8URFiJOo0mt8/LqbxvVJk6PM94x84YMFXg0h6zU9G89pM6KUhH4v7mNDvVGq LGJTZgGXy+Fv7VdANj5lWL9FD0vwbEEt3ubDhERUbBWvEnoDJV1/NN6pqid4hUaORvfs loxK+7y0rFS+StVBFYCvLEGSddby6oVV03XnZgz/RTy5P7hIYLeKcO11t6N1dj+cIba5 1d1r42CaHblEc75e+tvMGxGU0MRVMZXl9nevQZGxp8rTUqmETrCYA93v6WkZv0VEkDES YPktkImhAF6FRvY3R/AfpAjxjJR9gimIMjiVFiw1eCofiJXshll2/d86b+OFYa/odaHt evUA== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=sender:errors-to:cc:list-subscribe:list-help:list-post:list-archive :list-unsubscribe:list-id:precedence:subject :content-transfer-encoding:mime-version:references:in-reply-to :message-id:date:to:from:dkim-signature; bh=s5wS2YCmNrWOpRGICG3GBDDb7iKA90ngEqstlnBtJU0=; b=Ui0QQ7lyKCIuXdG41zwDqmVp4NqFZ9fU+66nvmObmRnEu6L2eY639mvK37fr3OZ2Ov /8qB1rNW5oq12D9p1fDVS1po2b7igJFpZTyVZMTaOe566C8tQhWpkJnGgodhI+hHa7lp VhO7Xk/TQqSasz/wWHgGdyj529SK3F7GYKNpAlgJHRk21fIpvrdqExfjriGX+G5iim8+ L4p742H/jPf3DWvJ6UbcXBIyQ4hOSeP9Ofcr9NelGej1jWhoa49vb7G6NWkA1GrfR07R +qtDIJ8FBKNkmHQxmyDCGwTD2ERzto0qCxUuu+a573lpG+F4wW+K2NTKvdz8WnJD8Skr OYRw== ARC-Authentication-Results: i=1; mx.google.com; dkim=fail header.i=@linaro.org header.s=google header.b=cxnAAiEm; spf=pass (google.com: domain of qemu-devel-bounces+patch=linaro.org@nongnu.org designates 209.51.188.47 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.47]) by mx.google.com with ESMTPS id k127si887926qkd.39.2019.06.07.02.52.11 for (version=TLS1_2 cipher=ECDHE-RSA-CHACHA20-POLY1305 bits=256/256); Fri, 07 Jun 2019 02:52:11 -0700 (PDT) Received-SPF: pass (google.com: domain of qemu-devel-bounces+patch=linaro.org@nongnu.org designates 209.51.188.47 as permitted sender) client-ip=209.51.188.47; Authentication-Results: mx.google.com; dkim=fail header.i=@linaro.org header.s=google header.b=cxnAAiEm; spf=pass (google.com: domain of qemu-devel-bounces+patch=linaro.org@nongnu.org designates 209.51.188.47 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]:47660 helo=lists.gnu.org) by lists.gnu.org with esmtp (Exim 4.86_2) (envelope-from ) id 1hZBXe-0000cz-N7 for patch@linaro.org; Fri, 07 Jun 2019 05:52:10 -0400 Received: from eggs.gnu.org ([2001:470:142:3::10]:42065) by lists.gnu.org with esmtp (Exim 4.86_2) (envelope-from ) id 1hZAvK-000292-8p for qemu-devel@nongnu.org; Fri, 07 Jun 2019 05:12:36 -0400 Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71) (envelope-from ) id 1hZAvI-0004iI-8n for qemu-devel@nongnu.org; Fri, 07 Jun 2019 05:12:34 -0400 Received: from mail-wr1-x433.google.com ([2a00:1450:4864:20::433]:46959) by eggs.gnu.org with esmtps (TLS1.0:RSA_AES_128_CBC_SHA1:16) (Exim 4.71) (envelope-from ) id 1hZAvG-0004ag-8v for qemu-devel@nongnu.org; Fri, 07 Jun 2019 05:12:32 -0400 Received: by mail-wr1-x433.google.com with SMTP id n4so1339528wrw.13 for ; Fri, 07 Jun 2019 02:12:28 -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=s5wS2YCmNrWOpRGICG3GBDDb7iKA90ngEqstlnBtJU0=; b=cxnAAiEmIBVJHy3IBBaqTIJXzpehox8BHAdbLUseNY2SHCywMO9iIrziTu0Dg6AvY3 Wo6h1RlO7zmqB2sXZ2+ALwUPUIEJATIIAV+RaO3zhNkCkvTynVVkC+Il2GR+YwloRB3W hPig/QDMKJCH7k94pYk6Tl/3dQJ3Y9ID7ufwxCwHeKFZWq9c2GZLXHoYLRfZY0S7oJ2p /hkkTz4Zv9ir+y/fyKnRv1wrLH6kyxbOLo2k+biq/nIj/i711G+1jHd2nPac8CofQ4kD s3gD/h8klzAOwZtv60oLUWWmb2PS7oWlWWxIZrRfXyPly+yHHywznPvB1yMH8ax9Mqb1 CMMg== 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=s5wS2YCmNrWOpRGICG3GBDDb7iKA90ngEqstlnBtJU0=; b=d8ACLAvPMQK4Ms691PrTXEG+jKbiQctFoyXxWAKdbSHfgJepMFymmLaWoOg2rd2/al 9rQPDe37k+M3se8+AZHmS476Z8WvCUu4A5TmcCpdAhsfOBQ6R5BXyT8AJpnug5cQg4+M 9kYjP3wCZcggGD6r1X9cki/ex5pIoAr2T0SLg6d6tON3u2mCcBQG9fqjrQr1aOAk9ldd i7A5G4gX1/hnXsCB7wV6ohnNLX8J+7f1+ovB+XGT32exY6UR2MGm+T56FxeLInedv3Ha gJzeCYhRMsKLLznW+M9fy8LaLBpn4GNewVXgHlPPUivdTQ+KlULLOyG4x2kUC516QPLY kKNQ== X-Gm-Message-State: APjAAAW7bEMrLkplgryLcFRq4EBwugktgaV9Qc+hzGGjYKCAp89SF76x 3DZdu4Oh+AfqwNztnPTZBl2JDw== X-Received: by 2002:a5d:43d0:: with SMTP id v16mr31413845wrr.252.1559898747207; Fri, 07 Jun 2019 02:12:27 -0700 (PDT) Received: from zen.linaroharston ([81.128.185.34]) by smtp.gmail.com with ESMTPSA id t6sm1552335wmb.29.2019.06.07.02.12.26 (version=TLS1_3 cipher=AEAD-AES256-GCM-SHA384 bits=256/256); Fri, 07 Jun 2019 02:12:26 -0700 (PDT) Received: from zen.linaroharston. (localhost [127.0.0.1]) by zen.linaroharston (Postfix) with ESMTP id 939E21FF8F; Fri, 7 Jun 2019 10:05:54 +0100 (BST) From: =?utf-8?q?Alex_Benn=C3=A9e?= To: peter.maydell@linaro.org Date: Fri, 7 Jun 2019 10:05:31 +0100 Message-Id: <20190607090552.12434-33-alex.bennee@linaro.org> X-Mailer: git-send-email 2.20.1 In-Reply-To: <20190607090552.12434-1-alex.bennee@linaro.org> References: <20190607090552.12434-1-alex.bennee@linaro.org> MIME-Version: 1.0 X-detected-operating-system: by eggs.gnu.org: Genre and OS details not recognized. X-Received-From: 2a00:1450:4864:20::433 Subject: [Qemu-devel] [PULL 32/52] cputlb: cast size_t to target_ulong before using for address masks 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 , qemu-devel@nongnu.org, Paolo Bonzini , =?utf-8?q?Philippe_Mathieu-Daud=C3=A9?= , Andrew Randrianasulu , Richard Henderson Errors-To: qemu-devel-bounces+patch=linaro.org@nongnu.org Sender: "Qemu-devel" While size_t is defined to happily access the biggest host object this isn't the case when generating masks for 64 bit guests on 32 bit hosts. Otherwise we end up truncating the address when we fall back to our unaligned helper. Fixes: https://bugs.launchpad.net/qemu/+bug/1831545 Signed-off-by: Alex Bennée Reviewed-by: Richard Henderson Tested-by: Andrew Randrianasulu Reviewed-by: Philippe Mathieu-Daudé -- 2.20.1 diff --git a/accel/tcg/cputlb.c b/accel/tcg/cputlb.c index b796ab1cbe..8f814a1a2c 100644 --- a/accel/tcg/cputlb.c +++ b/accel/tcg/cputlb.c @@ -1306,7 +1306,7 @@ load_helper(CPUArchState *env, target_ulong addr, TCGMemOpIdx oi, uint64_t r1, r2; unsigned shift; do_unaligned_access: - addr1 = addr & ~(size - 1); + addr1 = addr & ~((target_ulong)size - 1); addr2 = addr1 + size; r1 = full_load(env, addr1, oi, retaddr); r2 = full_load(env, addr2, oi, retaddr); From patchwork Fri Jun 7 09:05:32 2019 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 8bit X-Patchwork-Submitter: =?utf-8?q?Alex_Benn=C3=A9e?= X-Patchwork-Id: 166122 Delivered-To: patch@linaro.org Received: by 2002:a92:9e1a:0:0:0:0:0 with SMTP id q26csp441728ili; Fri, 7 Jun 2019 03:15:49 -0700 (PDT) X-Google-Smtp-Source: APXvYqxeIQ4zcspewjOnPihctQuN2wQqGaFmsGdGue6kM3C4wDJHCbEGWAwfn7dM0r984vPIp5BD X-Received: by 2002:ac8:3811:: with SMTP id q17mr17089853qtb.315.1559902549117; Fri, 07 Jun 2019 03:15:49 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1559902549; cv=none; d=google.com; s=arc-20160816; b=SmPrZGzVG3mveHifTJUdqFIzL4ArU1Qpzg7MG6jO1v+E0l7nAHUpYxqKvtru3Tncqq wEZrNdvcNDilQRCyVhOThcWKHn/ljprg7R9/uyHyLce3zIO4TDTKsKS4A5Ethc2Zm2wx 0JeCN4+4nOhDF/ARKGkosXarfb3Xowduigw8F0Cm1FolABIlHmLY3C4miaceSFTSqsIs BedEI/Wr2Gl1nW+JUuOJI7BoqJg6BjN+uDfoaAtXhnwFRF/UwMLt24G3QB6QQH+7q0nl OtW/m8Brf9a/TEMM01YKJGLyab8fOs3E+6tsOEU6VkSFSAMuls6Eg9IPGmCIDNerAjOR MJ1g== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=sender:errors-to:cc:list-subscribe:list-help:list-post:list-archive :list-unsubscribe:list-id:precedence:subject :content-transfer-encoding:mime-version:references:in-reply-to :message-id:date:to:from:dkim-signature; bh=c76UPtcUyW2+y+2t3rM60+D/f7quHWsTGj5ldY4x42E=; b=hZcbUB+B8HGvx74O7wTdOoUmPc0k0G8Kb1h7dTwn0Klxfz0KsqW3FRUqwzEVWyBU38 ZrrnumAExbLQUmkAZV6vwlVGff/zf838SuVge5Pg1t9SfoCwnmWkxIRX2PGXeXFMshle 4B+nviOSU4QFwU9GMOaVes5gPPY3/m9fXb002BGWyMv8vMfuqklelkAUM1CEzBK31E2H KUGTQwFo2Vcq9XJNmeNJ/T0T3Z/IthwHNfWrz/f8SYpPgNM3h5nrEZBUVXO1huR8O5nD c60xh3PCO+5oCsSRZV6kToQ1hE5kxDQGbuJ+ejjVcIc/Xkpp7JDAEFvsCCwmCIB2OMIE epJA== ARC-Authentication-Results: i=1; mx.google.com; dkim=fail header.i=@linaro.org header.s=google header.b=b8u1zWcE; spf=pass (google.com: domain of qemu-devel-bounces+patch=linaro.org@nongnu.org designates 209.51.188.47 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.47]) by mx.google.com with ESMTPS id n25si840588qkg.264.2019.06.07.03.15.49 for (version=TLS1_2 cipher=ECDHE-RSA-CHACHA20-POLY1305 bits=256/256); Fri, 07 Jun 2019 03:15:49 -0700 (PDT) Received-SPF: pass (google.com: domain of qemu-devel-bounces+patch=linaro.org@nongnu.org designates 209.51.188.47 as permitted sender) client-ip=209.51.188.47; Authentication-Results: mx.google.com; dkim=fail header.i=@linaro.org header.s=google header.b=b8u1zWcE; spf=pass (google.com: domain of qemu-devel-bounces+patch=linaro.org@nongnu.org designates 209.51.188.47 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]:47930 helo=lists.gnu.org) by lists.gnu.org with esmtp (Exim 4.86_2) (envelope-from ) id 1hZBuW-0004TZ-Na for patch@linaro.org; Fri, 07 Jun 2019 06:15:48 -0400 Received: from eggs.gnu.org ([2001:470:142:3::10]:44992) by lists.gnu.org with esmtp (Exim 4.86_2) (envelope-from ) id 1hZB50-00088b-LP for qemu-devel@nongnu.org; Fri, 07 Jun 2019 05:22:36 -0400 Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71) (envelope-from ) id 1hZB4z-0005qW-1k for qemu-devel@nongnu.org; Fri, 07 Jun 2019 05:22:34 -0400 Received: from mail-wm1-x343.google.com ([2a00:1450:4864:20::343]:50305) by eggs.gnu.org with esmtps (TLS1.0:RSA_AES_128_CBC_SHA1:16) (Exim 4.71) (envelope-from ) id 1hZB4y-0005of-QU for qemu-devel@nongnu.org; Fri, 07 Jun 2019 05:22:32 -0400 Received: by mail-wm1-x343.google.com with SMTP id c66so1283121wmf.0 for ; Fri, 07 Jun 2019 02:22:32 -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=c76UPtcUyW2+y+2t3rM60+D/f7quHWsTGj5ldY4x42E=; b=b8u1zWcEiK+85KmLg3wHJQct7+7iQkVgwXQYu6+2iwEVJuNIm5aoW9HyMoYMQO1LQE Vy/k1NnQPzj5OoxYAKTL+dFA+lU6CpLqpJ28PIXBKM+zaJteHosQuFGk/pvGLqrjqYAS RLWfkmBfdC7g41j7Ddne28SZ4JCy1jOvtTFnq+gOrU/eHYUuwHBdfukYlpHOIONS7HYQ 061gQkxH1bh7WXRq8j+NpqqaIFDeiEa6/iCP6FgLgRMMdGYUrSp/b0PESSMwsAvGi4lj 0H1vbUUbd/lVWvwkh2B9PVnrKD6nGAh7xxCaS1P6RLPrtp+WfjJTOkEqh6agAk7jc5et lYAw== 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=c76UPtcUyW2+y+2t3rM60+D/f7quHWsTGj5ldY4x42E=; b=TP2P+/irmnM9FFU2xkerX5jPy0oqMm0gnI9f4DrHjo9wVwyV5kxiFl9Gozo4ufsjQN zRZj8GJBLPCP1m/1WLU7G2sua8M5/aU3xYFxBO1q/1xv3VoF5yhatcOM7H11faDRMt0A D69u0e70uKDh2ClDJ2K9RYma1TOgRQRmhBKaxoH2+eLBWbQuD6TCqOrWM7BxYEui5DFx MoleSLWIqgdMXpagQEl3RGzC/OA89A4k9LLgEWKcxrRum862/zVCVTsV72PDPQZaB28G /w/JT3eaHTLXT/N947ciETENmHxg981acR8wxemgC6I8eNc1KM5milLDcBdiWoinUstR kyog== X-Gm-Message-State: APjAAAW2cxkhgPrZ8pK74jEDrMZKLXRftFpyo8qskjCd844HmB41fN7N u1KOSdzgds20JFrUjEaQDWsmXQ== X-Received: by 2002:a1c:238e:: with SMTP id j136mr2722100wmj.4.1559899351642; Fri, 07 Jun 2019 02:22:31 -0700 (PDT) Received: from zen.linaroharston ([81.128.185.34]) by smtp.gmail.com with ESMTPSA id c16sm1465080wrr.53.2019.06.07.02.22.27 (version=TLS1_3 cipher=AEAD-AES256-GCM-SHA384 bits=256/256); Fri, 07 Jun 2019 02:22:30 -0700 (PDT) Received: from zen.linaroharston. (localhost [127.0.0.1]) by zen.linaroharston (Postfix) with ESMTP id A741D1FFB8; Fri, 7 Jun 2019 10:05:54 +0100 (BST) From: =?utf-8?q?Alex_Benn=C3=A9e?= To: peter.maydell@linaro.org Date: Fri, 7 Jun 2019 10:05:32 +0100 Message-Id: <20190607090552.12434-34-alex.bennee@linaro.org> X-Mailer: git-send-email 2.20.1 In-Reply-To: <20190607090552.12434-1-alex.bennee@linaro.org> References: <20190607090552.12434-1-alex.bennee@linaro.org> MIME-Version: 1.0 X-detected-operating-system: by eggs.gnu.org: Genre and OS details not recognized. X-Received-From: 2a00:1450:4864:20::343 Subject: [Qemu-devel] [PULL 33/52] gdbstub: Add infrastructure to parse cmd packets 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, Jon Doron Errors-To: qemu-devel-bounces+patch=linaro.org@nongnu.org Sender: "Qemu-devel" From: Jon Doron Signed-off-by: Jon Doron Reviewed-by: Alex Bennée Message-Id: <20190529064148.19856-2-arilou@gmail.com> Signed-off-by: Alex Bennée -- 2.20.1 diff --git a/gdbstub.c b/gdbstub.c index 462f89edfe..09fe5a4b99 100644 --- a/gdbstub.c +++ b/gdbstub.c @@ -1268,6 +1268,201 @@ out: return res; } +typedef union GdbCmdVariant { + const char *data; + uint8_t opcode; + unsigned long val_ul; + unsigned long long val_ull; + struct { + GDBThreadIdKind kind; + uint32_t pid; + uint32_t tid; + } thread_id; +} GdbCmdVariant; + +static const char *cmd_next_param(const char *param, const char delimiter) +{ + static const char all_delimiters[] = ",;:="; + char curr_delimiters[2] = {0}; + const char *delimiters; + + if (delimiter == '?') { + delimiters = all_delimiters; + } else if (delimiter == '0') { + return strchr(param, '\0'); + } else if (delimiter == '.' && *param) { + return param + 1; + } else { + curr_delimiters[0] = delimiter; + delimiters = curr_delimiters; + } + + param += strcspn(param, delimiters); + if (*param) { + param++; + } + return param; +} + +static int cmd_parse_params(const char *data, const char *schema, + GdbCmdVariant *params, int *num_params) +{ + int curr_param; + const char *curr_schema, *curr_data; + + *num_params = 0; + + if (!schema) { + return 0; + } + + curr_schema = schema; + curr_param = 0; + curr_data = data; + while (curr_schema[0] && curr_schema[1] && *curr_data) { + switch (curr_schema[0]) { + case 'l': + if (qemu_strtoul(curr_data, &curr_data, 16, + ¶ms[curr_param].val_ul)) { + return -EINVAL; + } + curr_param++; + curr_data = cmd_next_param(curr_data, curr_schema[1]); + break; + case 'L': + if (qemu_strtou64(curr_data, &curr_data, 16, + (uint64_t *)¶ms[curr_param].val_ull)) { + return -EINVAL; + } + curr_param++; + curr_data = cmd_next_param(curr_data, curr_schema[1]); + break; + case 's': + params[curr_param].data = curr_data; + curr_param++; + curr_data = cmd_next_param(curr_data, curr_schema[1]); + break; + case 'o': + params[curr_param].opcode = *(uint8_t *)curr_data; + curr_param++; + curr_data = cmd_next_param(curr_data, curr_schema[1]); + break; + case 't': + params[curr_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++; + curr_data = cmd_next_param(curr_data, curr_schema[1]); + break; + case '?': + curr_data = cmd_next_param(curr_data, curr_schema[1]); + break; + default: + return -EINVAL; + } + curr_schema += 2; + } + + *num_params = curr_param; + return 0; +} + +typedef struct GdbCmdContext { + GDBState *s; + GdbCmdVariant *params; + int num_params; + uint8_t mem_buf[MAX_PACKET_LENGTH]; + char str_buf[MAX_PACKET_LENGTH + 1]; +} GdbCmdContext; + +typedef void (*GdbCmdHandler)(GdbCmdContext *gdb_ctx, void *user_ctx); + +/* + * cmd_startswith -> cmd is compared using startswith + * + * + * schema definitions: + * Each schema parameter entry consists of 2 chars, + * the first char represents the parameter type handling + * the second char represents the delimiter for the next parameter + * + * Currently supported schema types: + * 'l' -> unsigned long (stored in .val_ul) + * 'L' -> unsigned long long (stored in .val_ull) + * 's' -> string (stored in .data) + * 'o' -> single char (stored in .opcode) + * 't' -> thread id (stored in .thread_id) + * '?' -> skip according to delimiter + * + * Currently supported delimiters: + * '?' -> Stop at any delimiter (",;:=\0") + * '0' -> Stop at "\0" + * '.' -> Skip 1 char unless reached "\0" + * Any other value is treated as the delimiter value itself + */ +typedef struct GdbCmdParseEntry { + GdbCmdHandler handler; + const char *cmd; + bool cmd_startswith; + const char *schema; +} GdbCmdParseEntry; + +static inline int startswith(const char *string, const char *pattern) +{ + return !strncmp(string, pattern, strlen(pattern)); +} + +static int process_string_cmd( + GDBState *s, void *user_ctx, const char *data, + const GdbCmdParseEntry *cmds, int num_cmds) + __attribute__((unused)); + +static int process_string_cmd(GDBState *s, void *user_ctx, const char *data, + const GdbCmdParseEntry *cmds, int num_cmds) +{ + int i, schema_len, max_num_params = 0; + GdbCmdContext gdb_ctx; + + if (!cmds) { + return -1; + } + + for (i = 0; i < num_cmds; i++) { + const GdbCmdParseEntry *cmd = &cmds[i]; + g_assert(cmd->handler && cmd->cmd); + + if ((cmd->cmd_startswith && !startswith(data, cmd->cmd)) || + (!cmd->cmd_startswith && strcmp(cmd->cmd, data))) { + continue; + } + + if (cmd->schema) { + schema_len = strlen(cmd->schema); + if (schema_len % 2) { + return -2; + } + + 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; + } + + gdb_ctx.s = s; + cmd->handler(&gdb_ctx, user_ctx); + return 0; + } + + return -1; +} + static int gdb_handle_packet(GDBState *s, const char *line_buf) { CPUState *cpu; From patchwork Fri Jun 7 09:05:33 2019 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 8bit X-Patchwork-Submitter: =?utf-8?q?Alex_Benn=C3=A9e?= X-Patchwork-Id: 166138 Delivered-To: patch@linaro.org Received: by 2002:a92:9e1a:0:0:0:0:0 with SMTP id q26csp460531ili; Fri, 7 Jun 2019 03:35:17 -0700 (PDT) X-Google-Smtp-Source: APXvYqwB150ZBWFLc45TPOyZK0bzMtG8VOHGptElk+9isqXlUjrFVDywKyixrZpB8nXSUt1zaca0 X-Received: by 2002:aed:2667:: with SMTP id z94mr46403304qtc.2.1559903717903; Fri, 07 Jun 2019 03:35:17 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1559903717; cv=none; d=google.com; s=arc-20160816; b=Y+nFg8XQBme6oxa0onArqbK1fGj9LIBJaKPjc5krgKfwT2JvjSAsA65Yn3tBH2SROL MnzZNZ0FAZliMtYyZcZZewKPc+2PvcrnVHDXeKA4RdPWr3VUEHnBkt7rlFHRomu4sCFh jPLOTVJRtlAHqDxw8FDMDKzvPfPO7JXILMiXtnx210lDtXY0fwMyVRI6ZoEdh7BxOi2J jrE59K/OcDFnbAhqUI9x5xymAQnOxgK38i/NpTmqKcZRMKmnqIqJQq7/7cccR5fepH23 60/zbX9FXANrFoi7fQYLJtr0Rwn6oLGUlk+VY5+FEEia8qy4oynKHjL/souEdm6+haKn E6Hw== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=sender:errors-to:cc:list-subscribe:list-help:list-post:list-archive :list-unsubscribe:list-id:precedence:subject :content-transfer-encoding:mime-version:references:in-reply-to :message-id:date:to:from:dkim-signature; bh=eS4ups5iSOxsrkjwkIPBvVdVBQzJoB39R+u5rhoVXoE=; b=cUWPJiKMAyD+xL9br31WxPaD81XbeU3gEMAUEW4KyoiuLJsbFawrE8N1RLCY2nVGt/ GNnqZeSFjvRdyGhdwWcGtColUuT9220E+pZ2qSvUutsB/B5LI4bu918hYIn58CMqvfV4 Fu7T0Ue9b0EhyY1p1mtwSN8kR+qCXBAD77lFh0WIHR5Sz81ZYUW0b0a1a093ZAl8NxLD n0JL3/1MgwIA03psj2dbUuaH9Ag0vdu7iboIHy7NIssYaIc7TRPWOYZeyEfoApTKa+OR +mWXB824GbqYZ1CrURZWL6Sc6WUOtZLZQS7IpChsQlWBybhc3v+PuK5oZdW+RRjEvR+B AN9A== ARC-Authentication-Results: i=1; mx.google.com; dkim=fail header.i=@linaro.org header.s=google header.b=NBfYhjEe; spf=pass (google.com: domain of qemu-devel-bounces+patch=linaro.org@nongnu.org designates 209.51.188.47 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.47]) by mx.google.com with ESMTPS id n32si910620qvd.214.2019.06.07.03.35.17 for (version=TLS1_2 cipher=ECDHE-RSA-CHACHA20-POLY1305 bits=256/256); Fri, 07 Jun 2019 03:35:17 -0700 (PDT) Received-SPF: pass (google.com: domain of qemu-devel-bounces+patch=linaro.org@nongnu.org designates 209.51.188.47 as permitted sender) client-ip=209.51.188.47; Authentication-Results: mx.google.com; dkim=fail header.i=@linaro.org header.s=google header.b=NBfYhjEe; spf=pass (google.com: domain of qemu-devel-bounces+patch=linaro.org@nongnu.org designates 209.51.188.47 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]:48076 helo=lists.gnu.org) by lists.gnu.org with esmtp (Exim 4.86_2) (envelope-from ) id 1hZCDN-0000Ql-Hk for patch@linaro.org; Fri, 07 Jun 2019 06:35:17 -0400 Received: from eggs.gnu.org ([2001:470:142:3::10]:45065) by lists.gnu.org with esmtp (Exim 4.86_2) (envelope-from ) id 1hZB54-0008Il-7P for qemu-devel@nongnu.org; Fri, 07 Jun 2019 05:22:39 -0400 Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71) (envelope-from ) id 1hZB52-0005wa-Rc for qemu-devel@nongnu.org; Fri, 07 Jun 2019 05:22:38 -0400 Received: from mail-wm1-x332.google.com ([2a00:1450:4864:20::332]:50984) by eggs.gnu.org with esmtps (TLS1.0:RSA_AES_128_CBC_SHA1:16) (Exim 4.71) (envelope-from ) id 1hZB52-0005vD-L5 for qemu-devel@nongnu.org; Fri, 07 Jun 2019 05:22:36 -0400 Received: by mail-wm1-x332.google.com with SMTP id c66so1283302wmf.0 for ; Fri, 07 Jun 2019 02:22: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=eS4ups5iSOxsrkjwkIPBvVdVBQzJoB39R+u5rhoVXoE=; b=NBfYhjEeUJfiDur2FFm6EDzUu5k9zDTNrQJ6FpxY6Nd/rI4pv+zbhCJCLBX8hF2wCe 39IKy50tnzNg7Hs5yDM6BiWRYcFNqSd86jxZTRDnH70G9HismS/7ZJQxImnnhHolAnJP JC3kiUMJXQojcQlXYMnv6qOd58ekELKshmQjuvPmLLlesO3ugG3jw5FkHJ/o+YbuvhbK 2379wgUdSw1PXnlhbiw+hreF1z+bTcu3xrfhDx76xObY4sBZe/3rDgBg1zIjFIdAHUHu pRD5uRnO7Cg1vPwL7L8GzPFaEcbwPo7FQiQBeJP0jiDo4iYQdXvCBygyFgUJXT+j4zC1 whlQ== 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=eS4ups5iSOxsrkjwkIPBvVdVBQzJoB39R+u5rhoVXoE=; b=HIj+TwG/KKmOEkltH9A5ShxTAjyhsy5bYfy7ZHtPMpFXl7rokMMQnAr9I0PmEa819S MNdj9GSABXuu9b6KJyXWaYfWIT+y1Et89t1eEtCdKglmc1IuYKfReXPN0o+Gad9M5ZYN AvybXW6ayjLAJkJNo/IEkZoOhfzpFavcMap4ZehXOcBrFbT+GWxj3oZtqqQl4vRwDTxH CYrSHryUI82/VeVXk+arTPUU8eHKDC3vh00Bpd16yt/sqrZujRo3ObhYLIp0NpSj5vub ZZkKCIHx5BQ+JISOIm/F8Rc4rwxUgiRYqcWfRHqi3jtiSTsSeu4d8XaiqW7SXQkVCTke YYQg== X-Gm-Message-State: APjAAAXfF/NikmNn/2aBJKdDeipP6p4h7mvR98BPFadAZJWm7UjUH2zr xsqf3fXZXGbQQ2RGfZT70S2NuA== X-Received: by 2002:a7b:cae9:: with SMTP id t9mr2900174wml.126.1559899355465; Fri, 07 Jun 2019 02:22:35 -0700 (PDT) Received: from zen.linaroharston ([81.128.185.34]) by smtp.gmail.com with ESMTPSA id w185sm1405942wma.39.2019.06.07.02.22.28 (version=TLS1_3 cipher=AEAD-AES256-GCM-SHA384 bits=256/256); Fri, 07 Jun 2019 02:22:30 -0700 (PDT) Received: from zen.linaroharston. (localhost [127.0.0.1]) by zen.linaroharston (Postfix) with ESMTP id BA75C1FFBA; Fri, 7 Jun 2019 10:05:54 +0100 (BST) From: =?utf-8?q?Alex_Benn=C3=A9e?= To: peter.maydell@linaro.org Date: Fri, 7 Jun 2019 10:05:33 +0100 Message-Id: <20190607090552.12434-35-alex.bennee@linaro.org> X-Mailer: git-send-email 2.20.1 In-Reply-To: <20190607090552.12434-1-alex.bennee@linaro.org> References: <20190607090552.12434-1-alex.bennee@linaro.org> MIME-Version: 1.0 X-detected-operating-system: by eggs.gnu.org: Genre and OS details not recognized. X-Received-From: 2a00:1450:4864:20::332 Subject: [Qemu-devel] [PULL 34/52] gdbstub: Implement deatch (D pkt) with new infra 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, Jon Doron Errors-To: qemu-devel-bounces+patch=linaro.org@nongnu.org Sender: "Qemu-devel" From: Jon Doron Signed-off-by: Jon Doron Message-Id: <20190529064148.19856-3-arilou@gmail.com> Reviewed-by: Alex Bennée Signed-off-by: Alex Bennée -- 2.20.1 diff --git a/gdbstub.c b/gdbstub.c index 09fe5a4b99..120e52f5d2 100644 --- a/gdbstub.c +++ b/gdbstub.c @@ -1413,11 +1413,6 @@ static inline int startswith(const char *string, const char *pattern) return !strncmp(string, pattern, strlen(pattern)); } -static int process_string_cmd( - GDBState *s, void *user_ctx, const char *data, - const GdbCmdParseEntry *cmds, int num_cmds) - __attribute__((unused)); - static int process_string_cmd(GDBState *s, void *user_ctx, const char *data, const GdbCmdParseEntry *cmds, int num_cmds) { @@ -1463,6 +1458,55 @@ static int process_string_cmd(GDBState *s, void *user_ctx, const char *data, return -1; } +static void run_cmd_parser(GDBState *s, const char *data, + const GdbCmdParseEntry *cmd) +{ + if (!data) { + return; + } + + /* In case there was an error during the command parsing we must + * send a NULL packet to indicate the command is not supported */ + if (process_string_cmd(s, NULL, data, cmd, 1)) { + put_packet(s, ""); + } +} + +static void handle_detach(GdbCmdContext *gdb_ctx, void *user_ctx) +{ + GDBProcess *process; + GDBState *s = gdb_ctx->s; + uint32_t pid = 1; + + if (s->multiprocess) { + if (!gdb_ctx->num_params) { + put_packet(s, "E22"); + return; + } + + pid = gdb_ctx->params[0].val_ul; + } + + process = gdb_get_process(s, pid); + gdb_process_breakpoint_remove_all(s, process); + process->attached = false; + + if (pid == gdb_get_cpu_pid(s, s->c_cpu)) { + s->c_cpu = gdb_first_attached_cpu(s); + } + + if (pid == gdb_get_cpu_pid(s, s->g_cpu)) { + s->g_cpu = gdb_first_attached_cpu(s); + } + + if (!s->c_cpu) { + /* No more process attached */ + gdb_syscall_mode = GDB_SYS_DISABLED; + gdb_continue(s); + } + put_packet(s, "OK"); +} + static int gdb_handle_packet(GDBState *s, const char *line_buf) { CPUState *cpu; @@ -1477,6 +1521,7 @@ static int gdb_handle_packet(GDBState *s, const char *line_buf) uint8_t *registers; target_ulong addr, len; GDBThreadIdKind thread_kind; + const GdbCmdParseEntry *cmd_parser = NULL; trace_gdbstub_io_command(line_buf); @@ -1577,42 +1622,15 @@ static int gdb_handle_packet(GDBState *s, const char *line_buf) error_report("QEMU: Terminated via GDBstub"); exit(0); case 'D': - /* Detach packet */ - pid = 1; - - if (s->multiprocess) { - unsigned long lpid; - if (*p != ';') { - put_packet(s, "E22"); - break; - } - - if (qemu_strtoul(p + 1, &p, 16, &lpid)) { - put_packet(s, "E22"); - break; - } - - pid = lpid; - } - - process = gdb_get_process(s, pid); - gdb_process_breakpoint_remove_all(s, process); - process->attached = false; - - if (pid == gdb_get_cpu_pid(s, s->c_cpu)) { - s->c_cpu = gdb_first_attached_cpu(s); - } - - if (pid == gdb_get_cpu_pid(s, s->g_cpu)) { - s->g_cpu = gdb_first_attached_cpu(s); - } - - if (s->c_cpu == NULL) { - /* No more process attached */ - gdb_syscall_mode = GDB_SYS_DISABLED; - gdb_continue(s); + { + static const GdbCmdParseEntry detach_cmd_desc = { + .handler = handle_detach, + .cmd = "D", + .cmd_startswith = 1, + .schema = "?.l0" + }; + cmd_parser = &detach_cmd_desc; } - put_packet(s, "OK"); break; case 's': if (*p != '\0') { @@ -1985,6 +2003,9 @@ static int gdb_handle_packet(GDBState *s, const char *line_buf) put_packet(s, buf); break; } + + run_cmd_parser(s, line_buf, cmd_parser); + return RS_IDLE; } From patchwork Fri Jun 7 09:05:34 2019 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 8bit X-Patchwork-Submitter: =?utf-8?q?Alex_Benn=C3=A9e?= X-Patchwork-Id: 166137 Delivered-To: patch@linaro.org Received: by 2002:a92:9e1a:0:0:0:0:0 with SMTP id q26csp459790ili; Fri, 7 Jun 2019 03:34:32 -0700 (PDT) X-Google-Smtp-Source: APXvYqzN6HLtyNNjnCy73IN/wCJCqHC8Lr4ZmNwL0tPANlJO/hrSHZgDkyemMLPjYH2y563hyKNB X-Received: by 2002:ac8:1a9d:: with SMTP id x29mr45747411qtj.128.1559903672590; Fri, 07 Jun 2019 03:34:32 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1559903672; cv=none; d=google.com; s=arc-20160816; b=Esxu7d3PunaaOWjYRO/bQx7wE6orxLyV/yT0WUQZ5ZznoMiJFSDJZWUu703naM5uI6 mfXtiSw5A/IMHxJTMVz5xv8UHRQkqiD2h7I0Z21vwgJLNbH11YImDsLAAMaUZPX13ke9 FvHZH3S0bhP6Avt+ESwhGyE3Qvay8KnbeVErKBhYzid4MDkyvjNUxft6KyywNHooNref QR4IDT5Uzo7JcH26WdRNQo1Z+lQ6IEBxpqiFfjsl9GLiUSUAvCm4ZjodAPy/wvOCJg5q qduZLTNRhO3xC2uk9S1AVzCPdl/SIxKenJOtE9nN1moBMAMGcWhjuRb/Av0trU3N1733 0URQ== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=sender:errors-to:cc:list-subscribe:list-help:list-post:list-archive :list-unsubscribe:list-id:precedence:subject :content-transfer-encoding:mime-version:references:in-reply-to :message-id:date:to:from:dkim-signature; bh=rQDbySq2CCG8eAtAG40D7sD3kPayEKRs8iIxX2EaaA8=; b=PaU+pSNzfK3NKs9pTkCXeCut29tmx02X+QOmPOh+dl6Y4CwCF+td/7K2aeuITwRAoN FCzsfhjLJH3UVlxlyrk0W0HXedyL+MdPqwvsuLud6JF+0Rrv3TKNgHz85p0n4zaH1rcU DIJs5ki3UZLwy1yNpOW25xZx8idhUwu+ruNw8g+ymbzA3QL69Tuq56nM6vRIZxdYyjyn lVh8LO4cRJ6TkQLBjluz+LaUTB3YTW5t4R8deeCA7zaFtBzznwRNgo2ONX7lQgAhyG6W XXA4H2vz4vxYhkgfD11nhRMg1fHk86jARXG2qk4sB4TxZkR3k+PI5D3vBjW2jFTlWiZa UKcw== ARC-Authentication-Results: i=1; mx.google.com; dkim=fail header.i=@linaro.org header.s=google header.b=bWZ2Qkib; spf=pass (google.com: domain of qemu-devel-bounces+patch=linaro.org@nongnu.org designates 209.51.188.47 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.47]) by mx.google.com with ESMTPS id b35si1084221qte.394.2019.06.07.03.34.32 for (version=TLS1_2 cipher=ECDHE-RSA-CHACHA20-POLY1305 bits=256/256); Fri, 07 Jun 2019 03:34:32 -0700 (PDT) Received-SPF: pass (google.com: domain of qemu-devel-bounces+patch=linaro.org@nongnu.org designates 209.51.188.47 as permitted sender) client-ip=209.51.188.47; Authentication-Results: mx.google.com; dkim=fail header.i=@linaro.org header.s=google header.b=bWZ2Qkib; spf=pass (google.com: domain of qemu-devel-bounces+patch=linaro.org@nongnu.org designates 209.51.188.47 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]:48070 helo=lists.gnu.org) by lists.gnu.org with esmtp (Exim 4.86_2) (envelope-from ) id 1hZCCe-0000IN-7i for patch@linaro.org; Fri, 07 Jun 2019 06:34:32 -0400 Received: from eggs.gnu.org ([2001:470:142:3::10]:45011) by lists.gnu.org with esmtp (Exim 4.86_2) (envelope-from ) id 1hZB51-0008BK-L0 for qemu-devel@nongnu.org; Fri, 07 Jun 2019 05:22:36 -0400 Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71) (envelope-from ) id 1hZB50-0005tM-JO for qemu-devel@nongnu.org; Fri, 07 Jun 2019 05:22:35 -0400 Received: from mail-wr1-x42d.google.com ([2a00:1450:4864:20::42d]:44857) by eggs.gnu.org with esmtps (TLS1.0:RSA_AES_128_CBC_SHA1:16) (Exim 4.71) (envelope-from ) id 1hZB50-0005sG-BZ for qemu-devel@nongnu.org; Fri, 07 Jun 2019 05:22:34 -0400 Received: by mail-wr1-x42d.google.com with SMTP id b17so1381957wrq.11 for ; Fri, 07 Jun 2019 02:22: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=rQDbySq2CCG8eAtAG40D7sD3kPayEKRs8iIxX2EaaA8=; b=bWZ2QkibamH6BQ7pb0DJez2s+LOFU1h++u+GAK2JCBKNEI0foUOlCzAFXxiKm/UPaY DfXtliZZymioa5+BM9VpP/k9o/rFLFnHqFV+EViHKdyuPgqKfNCIAUM87SYanmMSL3hr 8QOFamcIqPmFbCLZRV85JBxLOT69Nu37sOOUXDWggy/RuKdL3EWBDCRP3c1Ll+tfa8ci WKI1PDfGE9t2PvUCvcdB9wVkA0ZwOI2euZdoKtNDVM0h/9iUSSznr7MWXw2hJb6S9kRi oobXZCxIsQkW4ST1jvUubiXxqzJoB7P+9Iw4n5kmPCFN5h3ONBIfTXLJ80YfHAOtGnld F7Tw== 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=rQDbySq2CCG8eAtAG40D7sD3kPayEKRs8iIxX2EaaA8=; b=HvEPm9pIZJUVW1osOuJVxvhM78SI8Yk41ICNDmWgMOF+JfP7XKqga9jw3mmjmU74+f 4cedh93ERKTX/HK92OYbAmVmqk1n2WXULZMxK1MNlohFKxuKm0Oy6IFRf9SMbqvuNtRp pkA88/jaKf0JzoH9mKNKXWrlgVUHK+u3AYUL7c9Q7jx61DcffN9HW0U7x2mLf50LqHf6 MPHC0T/fV5O7qNS+F+O35ZBWma/NcZYb6PX29OIL1OzXtIerhKp+EFQMa+MN4y3GivYd Kqz5MsQM2wll2bccrYDOCy6DriCjdtBrqcfcZMs90ZdYZI8hAsHDlARS+U2PuX/sE7mB UkIg== X-Gm-Message-State: APjAAAU6IZCYIADKfneZODzIbRMKIpJmeJjNTw6fS/t0zkmYGYfUmQUB lTT84IRUCSrQnyA+o9Yzg1jcDw== X-Received: by 2002:a5d:6583:: with SMTP id q3mr35496275wru.184.1559899353421; Fri, 07 Jun 2019 02:22:33 -0700 (PDT) Received: from zen.linaroharston ([81.128.185.34]) by smtp.gmail.com with ESMTPSA id h84sm1575073wmf.43.2019.06.07.02.22.29 (version=TLS1_3 cipher=AEAD-AES256-GCM-SHA384 bits=256/256); Fri, 07 Jun 2019 02:22:30 -0700 (PDT) Received: from zen.linaroharston. (localhost [127.0.0.1]) by zen.linaroharston (Postfix) with ESMTP id CD1B51FFBB; Fri, 7 Jun 2019 10:05:54 +0100 (BST) From: =?utf-8?q?Alex_Benn=C3=A9e?= To: peter.maydell@linaro.org Date: Fri, 7 Jun 2019 10:05:34 +0100 Message-Id: <20190607090552.12434-36-alex.bennee@linaro.org> X-Mailer: git-send-email 2.20.1 In-Reply-To: <20190607090552.12434-1-alex.bennee@linaro.org> References: <20190607090552.12434-1-alex.bennee@linaro.org> MIME-Version: 1.0 X-detected-operating-system: by eggs.gnu.org: Genre and OS details not recognized. X-Received-From: 2a00:1450:4864:20::42d Subject: [Qemu-devel] [PULL 35/52] gdbstub: Implement thread_alive (T pkt) with new infra 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, Jon Doron Errors-To: qemu-devel-bounces+patch=linaro.org@nongnu.org Sender: "Qemu-devel" From: Jon Doron Signed-off-by: Jon Doron Reviewed-by: Alex Bennée Message-Id: <20190529064148.19856-4-arilou@gmail.com> Signed-off-by: Alex Bennée -- 2.20.1 diff --git a/gdbstub.c b/gdbstub.c index 120e52f5d2..ad00f223f2 100644 --- a/gdbstub.c +++ b/gdbstub.c @@ -1507,6 +1507,30 @@ static void handle_detach(GdbCmdContext *gdb_ctx, void *user_ctx) put_packet(s, "OK"); } +static void handle_thread_alive(GdbCmdContext *gdb_ctx, void *user_ctx) +{ + CPUState *cpu; + + if (!gdb_ctx->num_params) { + put_packet(gdb_ctx->s, "E22"); + return; + } + + if (gdb_ctx->params[0].thread_id.kind == GDB_READ_THREAD_ERR) { + put_packet(gdb_ctx->s, "E22"); + return; + } + + cpu = gdb_get_cpu(gdb_ctx->s, gdb_ctx->params[0].thread_id.pid, + gdb_ctx->params[0].thread_id.tid); + if (!cpu) { + put_packet(gdb_ctx->s, "E22"); + return; + } + + put_packet(gdb_ctx->s, "OK"); +} + static int gdb_handle_packet(GDBState *s, const char *line_buf) { CPUState *cpu; @@ -1807,17 +1831,14 @@ static int gdb_handle_packet(GDBState *s, const char *line_buf) } break; case 'T': - thread_kind = read_thread_id(p, &p, &pid, &tid); - if (thread_kind == GDB_READ_THREAD_ERR) { - put_packet(s, "E22"); - break; - } - cpu = gdb_get_cpu(s, pid, tid); - - if (cpu != NULL) { - put_packet(s, "OK"); - } else { - put_packet(s, "E22"); + { + static const GdbCmdParseEntry thread_alive_cmd_desc = { + .handler = handle_thread_alive, + .cmd = "T", + .cmd_startswith = 1, + .schema = "t0" + }; + cmd_parser = &thread_alive_cmd_desc; } break; case 'q': From patchwork Fri Jun 7 09:05:35 2019 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 8bit X-Patchwork-Submitter: =?utf-8?q?Alex_Benn=C3=A9e?= X-Patchwork-Id: 166086 Delivered-To: patch@linaro.org Received: by 2002:a92:9e1a:0:0:0:0:0 with SMTP id q26csp388983ili; Fri, 7 Jun 2019 02:18:15 -0700 (PDT) X-Google-Smtp-Source: APXvYqzWq4X0T2HxRt9ptttrE0By2RNRsOSMlilBLIzAVBSFYezRnbI1sCqmmvTZhq0v2d4N9sYb X-Received: by 2002:a37:6b07:: with SMTP id g7mr42504332qkc.217.1559899095341; Fri, 07 Jun 2019 02:18:15 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1559899095; cv=none; d=google.com; s=arc-20160816; b=s3Kku7T8eZBZ4Y6sXbieiIlvEsGSPhP3dVuyLJKY0S05qEiwysBOBE0tt0VFlL/pHt 0Ew0QDUfEaWyLYx7PH+ZAj7EpA6q2tKs3N7Ytt3KR/iM2vFMtoNrx8e+8dcIJCg6BS6H J/giOwIqhoq5LkoWvyXyvYp6RyquNvkKBjLqHmCPvsyC0K4xmflDOnlgS48vgqkn43tm zvn4dzmePMTt24RHLbXoxpuXDmwM8d2kvmUKKG5r0vcZUoXXePp6ZXzlynNVYXeR6vfb I9+Q4klC7Pz1aKoyPaT6TYYRghxw4PtEucmFSgZJH4ervoRsML9oGkrIod484s2nHnTL ogBw== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=sender:errors-to:cc:list-subscribe:list-help:list-post:list-archive :list-unsubscribe:list-id:precedence:subject :content-transfer-encoding:mime-version:references:in-reply-to :message-id:date:to:from:dkim-signature; bh=AyGciPWCZWMMprrVh/RGj7LAohHD1vSZk+l1Mlrp9Kw=; b=aFfScda6f0RhAYVZEN4etlXqCUZAzgzU2WKS0sjxIhimm24h941hFlltjrAfxHYNra dER00ArYGWfcHWkic4kS41zzZIgl72CnunrCpG5kuwiy9X1C1nfTRNHjMmOWjBH0zS+Q pS/T9rtt+YF1o9B3J4WqxgW4OwRZiq91WsDbaTZo6VyYEylRo7YyiGzKSjR7e293tVdG vlq7HdmdWQm+rVm6yF6Fr2+39hsT3RBstPwoc9BKqYZDpHKo+d04Z9sbqGfgl7LndEKZ g73dV7Hy8DuG+irtGsnAevEFobu2F5eljdxRgXTSYGj+cJjkjkJrIrwIaUgudvgltb5h FTjw== ARC-Authentication-Results: i=1; mx.google.com; dkim=fail header.i=@linaro.org header.s=google header.b=tFPY1x1J; spf=pass (google.com: domain of qemu-devel-bounces+patch=linaro.org@nongnu.org designates 209.51.188.47 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.47]) by mx.google.com with ESMTPS id h17si852954qkj.77.2019.06.07.02.18.15 for (version=TLS1_2 cipher=ECDHE-RSA-CHACHA20-POLY1305 bits=256/256); Fri, 07 Jun 2019 02:18:15 -0700 (PDT) Received-SPF: pass (google.com: domain of qemu-devel-bounces+patch=linaro.org@nongnu.org designates 209.51.188.47 as permitted sender) client-ip=209.51.188.47; Authentication-Results: mx.google.com; dkim=fail header.i=@linaro.org header.s=google header.b=tFPY1x1J; spf=pass (google.com: domain of qemu-devel-bounces+patch=linaro.org@nongnu.org designates 209.51.188.47 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]:47398 helo=lists.gnu.org) by lists.gnu.org with esmtp (Exim 4.86_2) (envelope-from ) id 1hZB0j-0005HT-B7 for patch@linaro.org; Fri, 07 Jun 2019 05:18:14 -0400 Received: from eggs.gnu.org ([2001:470:142:3::10]:39487) by lists.gnu.org with esmtp (Exim 4.86_2) (envelope-from ) id 1hZAp8-0004CI-79 for qemu-devel@nongnu.org; Fri, 07 Jun 2019 05:06:11 -0400 Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71) (envelope-from ) id 1hZAp5-0004jg-Oz for qemu-devel@nongnu.org; Fri, 07 Jun 2019 05:06:09 -0400 Received: from mail-wm1-x329.google.com ([2a00:1450:4864:20::329]:39156) by eggs.gnu.org with esmtps (TLS1.0:RSA_AES_128_CBC_SHA1:16) (Exim 4.71) (envelope-from ) id 1hZAp5-0004Yu-Hq for qemu-devel@nongnu.org; Fri, 07 Jun 2019 05:06:07 -0400 Received: by mail-wm1-x329.google.com with SMTP id z23so1125808wma.4 for ; Fri, 07 Jun 2019 02:06:04 -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=AyGciPWCZWMMprrVh/RGj7LAohHD1vSZk+l1Mlrp9Kw=; b=tFPY1x1JxMmCh30bEtwkP31PhjjlT9UsOl3sHffiKTuVf5HfuE69++inwzaWs7YRa8 DV7Xp1O9gsC6rLNtb4a2wF69pt4BN/s8gTMzQngKksgt96hSdwEtVu8iFwhY6cxD5aw6 lifuuYZWMzWE6s3LmMM5mRYRQiagPM4SSahkNz/eA6LFdahB2L1dCRqk5/hEOCBtpyYG X/neHW5OBgtFwiH5TM/l+qVhR0bSzAZE9TORLBo7ahqavIMWJ3NQ6nlorBEew+r+lhRf qY5ozHcids5OWSVXHXjKy6XFXBSe1TNlrToEHRHTyawhaolBE8rVu2RDWC3IqIHtGRmt ReSQ== 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=AyGciPWCZWMMprrVh/RGj7LAohHD1vSZk+l1Mlrp9Kw=; b=JJ9fh3x8AprmxW5dsnhhfKc9vyT7/ml+giBGj07Ez9Qkx1/TwPuhvj6dhg2nw0zynx DsSDTu+M8UbfMRMzcnM2Yl+o+8AFFgFurLXrjbuT1ggtuqAgVqoY0uJb6HKULcdLZUVN MIP7fbplBLNqjrOq2QjGhtVd2HOke/m4F0xDpj4M1WlE9LbpHxS9AlHfXWai/ZHZFy3z oHhN24kmVq0mSAZSmS8lE9lHMu/Cl+oUmUiy9JTOVXLmtwy+xfyl/doQRHmPHCNpUm0F DDLaUkZYBLcff6K2pNzj0l6CxIxe9P4rkKPqCQ1f/zhMEP1YsIWEcY25fglHK799093s +21g== X-Gm-Message-State: APjAAAUsXwSTssSg4zI8Jha2Ycx4m7Se3yyb4aCHVUuOWVQD+HWgGItS WnUp2QoH/wdEt1gxwHIHhH5RFA== X-Received: by 2002:a1c:9d86:: with SMTP id g128mr3118884wme.51.1559898363552; Fri, 07 Jun 2019 02:06:03 -0700 (PDT) Received: from zen.linaroharston ([81.128.185.34]) by smtp.gmail.com with ESMTPSA id b2sm1549046wrp.72.2019.06.07.02.05.57 (version=TLS1_3 cipher=AEAD-AES256-GCM-SHA384 bits=256/256); Fri, 07 Jun 2019 02:06:01 -0700 (PDT) Received: from zen.linaroharston. (localhost [127.0.0.1]) by zen.linaroharston (Postfix) with ESMTP id DFF0B1FFBC; Fri, 7 Jun 2019 10:05:54 +0100 (BST) From: =?utf-8?q?Alex_Benn=C3=A9e?= To: peter.maydell@linaro.org Date: Fri, 7 Jun 2019 10:05:35 +0100 Message-Id: <20190607090552.12434-37-alex.bennee@linaro.org> X-Mailer: git-send-email 2.20.1 In-Reply-To: <20190607090552.12434-1-alex.bennee@linaro.org> References: <20190607090552.12434-1-alex.bennee@linaro.org> MIME-Version: 1.0 X-detected-operating-system: by eggs.gnu.org: Genre and OS details not recognized. X-Received-From: 2a00:1450:4864:20::329 Subject: [Qemu-devel] [PULL 36/52] gdbstub: Implement continue (c pkt) with new infra 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, Jon Doron Errors-To: qemu-devel-bounces+patch=linaro.org@nongnu.org Sender: "Qemu-devel" From: Jon Doron Signed-off-by: Jon Doron Reviewed-by: Alex Bennée Message-Id: <20190529064148.19856-5-arilou@gmail.com> Signed-off-by: Alex Bennée -- 2.20.1 diff --git a/gdbstub.c b/gdbstub.c index ad00f223f2..c3089a6b5a 100644 --- a/gdbstub.c +++ b/gdbstub.c @@ -1531,6 +1531,16 @@ static void handle_thread_alive(GdbCmdContext *gdb_ctx, void *user_ctx) put_packet(gdb_ctx->s, "OK"); } +static void handle_continue(GdbCmdContext *gdb_ctx, void *user_ctx) +{ + if (gdb_ctx->num_params) { + gdb_set_cpu_pc(gdb_ctx->s, gdb_ctx->params[0].val_ull); + } + + gdb_ctx->s->signal = 0; + gdb_continue(gdb_ctx->s); +} + static int gdb_handle_packet(GDBState *s, const char *line_buf) { CPUState *cpu; @@ -1567,13 +1577,16 @@ static int gdb_handle_packet(GDBState *s, const char *line_buf) gdb_breakpoint_remove_all(); break; case 'c': - if (*p != '\0') { - addr = strtoull(p, (char **)&p, 16); - gdb_set_cpu_pc(s, addr); + { + static const GdbCmdParseEntry continue_cmd_desc = { + .handler = handle_continue, + .cmd = "c", + .cmd_startswith = 1, + .schema = "L0" + }; + cmd_parser = &continue_cmd_desc; } - s->signal = 0; - gdb_continue(s); - return RS_IDLE; + break; case 'C': s->signal = gdb_signal_to_target (strtoul(p, (char **)&p, 16)); if (s->signal == -1) From patchwork Fri Jun 7 09:05:36 2019 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 8bit X-Patchwork-Submitter: =?utf-8?q?Alex_Benn=C3=A9e?= X-Patchwork-Id: 166126 Delivered-To: patch@linaro.org Received: by 2002:a92:9e1a:0:0:0:0:0 with SMTP id q26csp445794ili; Fri, 7 Jun 2019 03:19:44 -0700 (PDT) X-Google-Smtp-Source: APXvYqyY22nX39KTrHg7xHV6yccclnj1sHkpCwlDxcMHZBGbKIjk7/lG9+JL0cjWTPgPRef6UTrN X-Received: by 2002:ac8:2646:: with SMTP id v6mr25800181qtv.205.1559902784618; Fri, 07 Jun 2019 03:19:44 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1559902784; cv=none; d=google.com; s=arc-20160816; b=xxTvMxlu/o4rV1hMErAsageeE2gi2RkTDeZA8tP7gY/JPSbaWOlr5ZhFTzkQFrmebO Wp12onDSDWdDvA72meQfR+2BnaQS1OIscNvAHaUHhHn/saB8fCkDJPAQ169eY7xNJtE9 zcPPZXEXjbJDBa5ATG+HmLGSw5Iu9jx8aLA/bT6QDgwhKKg8ZGv9to2FJ7nMcJShGwkU XV2hQCTSLypDYqRp6G1JF24IGzpw/1Gt4HJYWlp75BvHCeWdKQMsJMIns6V3Dwt8Whx9 hd6QKe1dmjPN4sp0DASnxtK61Nf5aQwlPTBhW3jI9ure5bHMQqrd9RLReSYtoH01O0fq Ru6g== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=sender:errors-to:cc:list-subscribe:list-help:list-post:list-archive :list-unsubscribe:list-id:precedence:subject :content-transfer-encoding:mime-version:references:in-reply-to :message-id:date:to:from:dkim-signature; bh=EGXlq8sYJb23DS1OyTu+2jMnILwAaOcvzkQgAo0cZYs=; b=pG0ExyXormxBQAvLRUbBKIktcz3o5UwxXnIhFxMxflR/fkR72qW5R+vg/+Pr7RcOAR yhKM925gEXQhqsqumc6n1ekBMp9PjOtbX26ZfHYaxzdw4j2AxClEE7teWaPaTCgvuwW1 JEP4XiJY/Rh5xnBLjTnbEv+RNLjl3E6KmEynkn2PLXsw7FVjA+2HrAdQGm/FaG4wDZ5y NLVSZrltYSqHC3aAgC5YoD64Cu73yJx8YkjE0ElLgRiAoEndvYAx+Aq5v8BMuw4iDu0K kgnE0LzrXu0zLU8KgiywoWiOkMvlphDB1oLhxzdp/4QWRzct+8FBBu+5/AZLhll9Y2DG TD/A== ARC-Authentication-Results: i=1; mx.google.com; dkim=fail header.i=@linaro.org header.s=google header.b=XWzJofJL; spf=pass (google.com: domain of qemu-devel-bounces+patch=linaro.org@nongnu.org designates 209.51.188.47 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.47]) by mx.google.com with ESMTPS id a10si893942qkn.151.2019.06.07.03.19.44 for (version=TLS1_2 cipher=ECDHE-RSA-CHACHA20-POLY1305 bits=256/256); Fri, 07 Jun 2019 03:19:44 -0700 (PDT) Received-SPF: pass (google.com: domain of qemu-devel-bounces+patch=linaro.org@nongnu.org designates 209.51.188.47 as permitted sender) client-ip=209.51.188.47; Authentication-Results: mx.google.com; dkim=fail header.i=@linaro.org header.s=google header.b=XWzJofJL; spf=pass (google.com: domain of qemu-devel-bounces+patch=linaro.org@nongnu.org designates 209.51.188.47 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]:47942 helo=lists.gnu.org) by lists.gnu.org with esmtp (Exim 4.86_2) (envelope-from ) id 1hZByK-0005xy-5E for patch@linaro.org; Fri, 07 Jun 2019 06:19:44 -0400 Received: from eggs.gnu.org ([2001:470:142:3::10]:45040) by lists.gnu.org with esmtp (Exim 4.86_2) (envelope-from ) id 1hZB53-0008FW-91 for qemu-devel@nongnu.org; Fri, 07 Jun 2019 05:22:38 -0400 Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71) (envelope-from ) id 1hZB4y-0005oG-1Q for qemu-devel@nongnu.org; Fri, 07 Jun 2019 05:22:37 -0400 Received: from mail-wm1-x329.google.com ([2a00:1450:4864:20::329]:38349) by eggs.gnu.org with esmtps (TLS1.0:RSA_AES_128_CBC_SHA1:16) (Exim 4.71) (envelope-from ) id 1hZB4w-0005iY-2Y for qemu-devel@nongnu.org; Fri, 07 Jun 2019 05:22:30 -0400 Received: by mail-wm1-x329.google.com with SMTP id t5so1185482wmh.3 for ; Fri, 07 Jun 2019 02:22:29 -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=EGXlq8sYJb23DS1OyTu+2jMnILwAaOcvzkQgAo0cZYs=; b=XWzJofJLXnCEgbUUrFCam5HYaNJxWOO/HBzfYzerV0Vx0IOq/UQjEDZ9fOHBQ72LZP sFvv5MjQgvYEDrbfow77xk+vkf7WnRGyP3kzoR2YahFocgMYYikSC17DNhzaznl7I+zw vGALIU8Mue+F7yYWKO/L+o6Lk/2bPtFiOYWXljfOzPA9Ix6X8TbGnWqAoWZ3U4wu+hU9 8K9GWq+6AYxYZeIEFYcR7X9Jh7RBO/+plAEfNwBrjtprob9gM/tKaVf61phGYgBNMG9U iTrSZdMlzKip7P9UkdyRmseooy+veUHkIU7wkxoMkAik8JUIFm0YE0t6lrLt/8JhcVg+ VBOA== 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=EGXlq8sYJb23DS1OyTu+2jMnILwAaOcvzkQgAo0cZYs=; b=OIwvJG2bIlI0frhAy43TyvhZhtekrxkB3MsbmkBzQPqCsryrMql05Ddr9ei9X1G2WB BaUFSD8G1VOutRO2fQpgiYw3iORojTKLH/HX6S1esgMtxg9+qjW3lPsv/RgBfol5ub7i iwAWYLe3tNOs9WCtI8KLJrOCZ3XEkQ6yp6NTDLPasGnXe5NAhfFlrnFFaTHvDrP23KHT lCEiccQT8t4XTCnMIF6BdyL1adDsYz1gFsgAyD4HB/Vjn61tLEN9pPHk5dJbga8xH6XY x4WQxCnuuD8uh2GBXoowuFuEI/XCkI8RU1RuWfNsHdB7DtnsKUxF2SUrCHqQP4k+K6yC 93cw== X-Gm-Message-State: APjAAAVp2dauSixSYUvW1xjqr9H4YsuYVs9VALBC6JZ4sq9sYzEGBSeO NQ7qofEhx9MyEvyZ4Klm3osf+g== X-Received: by 2002:a1c:968c:: with SMTP id y134mr2712946wmd.122.1559899347983; Fri, 07 Jun 2019 02:22:27 -0700 (PDT) Received: from zen.linaroharston ([81.128.185.34]) by smtp.gmail.com with ESMTPSA id g5sm1720611wrp.29.2019.06.07.02.22.26 (version=TLS1_3 cipher=AEAD-AES256-GCM-SHA384 bits=256/256); Fri, 07 Jun 2019 02:22:27 -0700 (PDT) Received: from zen.linaroharston. (localhost [127.0.0.1]) by zen.linaroharston (Postfix) with ESMTP id F39971FFBD; Fri, 7 Jun 2019 10:05:54 +0100 (BST) From: =?utf-8?q?Alex_Benn=C3=A9e?= To: peter.maydell@linaro.org Date: Fri, 7 Jun 2019 10:05:36 +0100 Message-Id: <20190607090552.12434-38-alex.bennee@linaro.org> X-Mailer: git-send-email 2.20.1 In-Reply-To: <20190607090552.12434-1-alex.bennee@linaro.org> References: <20190607090552.12434-1-alex.bennee@linaro.org> MIME-Version: 1.0 X-detected-operating-system: by eggs.gnu.org: Genre and OS details not recognized. X-Received-From: 2a00:1450:4864:20::329 Subject: [Qemu-devel] [PULL 37/52] gdbstub: Implement continue with signal (C pkt) with new infra 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, Jon Doron Errors-To: qemu-devel-bounces+patch=linaro.org@nongnu.org Sender: "Qemu-devel" From: Jon Doron Signed-off-by: Jon Doron Reviewed-by: Alex Bennée Message-Id: <20190529064148.19856-6-arilou@gmail.com> Signed-off-by: Alex Bennée -- 2.20.1 diff --git a/gdbstub.c b/gdbstub.c index c3089a6b5a..3425f0674d 100644 --- a/gdbstub.c +++ b/gdbstub.c @@ -1541,6 +1541,25 @@ static void handle_continue(GdbCmdContext *gdb_ctx, void *user_ctx) gdb_continue(gdb_ctx->s); } +static void handle_cont_with_sig(GdbCmdContext *gdb_ctx, void *user_ctx) +{ + unsigned long signal = 0; + + /* + * 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; + } + + gdb_ctx->s->signal = gdb_signal_to_target(signal); + if (gdb_ctx->s->signal == -1) { + gdb_ctx->s->signal = 0; + } + gdb_continue(gdb_ctx->s); +} + static int gdb_handle_packet(GDBState *s, const char *line_buf) { CPUState *cpu; @@ -1588,11 +1607,16 @@ static int gdb_handle_packet(GDBState *s, const char *line_buf) } break; case 'C': - s->signal = gdb_signal_to_target (strtoul(p, (char **)&p, 16)); - if (s->signal == -1) - s->signal = 0; - gdb_continue(s); - return RS_IDLE; + { + static const GdbCmdParseEntry cont_with_sig_cmd_desc = { + .handler = handle_cont_with_sig, + .cmd = "C", + .cmd_startswith = 1, + .schema = "l0" + }; + cmd_parser = &cont_with_sig_cmd_desc; + } + break; case 'v': if (strncmp(p, "Cont", 4) == 0) { p += 4; From patchwork Fri Jun 7 09:05:37 2019 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 8bit X-Patchwork-Submitter: =?utf-8?q?Alex_Benn=C3=A9e?= X-Patchwork-Id: 166097 Delivered-To: patch@linaro.org Received: by 2002:a92:9e1a:0:0:0:0:0 with SMTP id q26csp402153ili; Fri, 7 Jun 2019 02:33:22 -0700 (PDT) X-Google-Smtp-Source: APXvYqz+p7/dcQUh/4rt6NC2JlKI+naDMt0BC0cSeIMzhrSp2mEd2f1igql7FkizVU56S44eBHR7 X-Received: by 2002:ac8:5297:: with SMTP id s23mr7087900qtn.230.1559900002223; Fri, 07 Jun 2019 02:33:22 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1559900002; cv=none; d=google.com; s=arc-20160816; b=jXYYC0Yl3mLb/YbVCCIpN1A4Uo1A8Qgf4US2EYtb28TG7H8rmHRIl25slpqZs6N1cm Ga1cb1+ApE6ao8f+GXuEGbOmkFzi9/AUzHptKvHTiEuf0E/ONJM8/5eP/jeV5P0VRTve fv0RHsrIOoTdiKgJmmbDjbOzftKL1vF4hKJwi0WCQjLg3eOxqmuJsA8YXEAzntA+oWMf foAX4kT812PA7nc9ad0eAYCDl1gn75WW9XLABgDacmQFHvvGW4v0NDG5wbMoETC60gDD OJNjxbTjaLmXqkQqJKEZLOF3qxKvQQntPOPM/+eiS5X74RpFY+LLLXZziZh7WxKqj08z 1C3A== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=sender:errors-to:cc:list-subscribe:list-help:list-post:list-archive :list-unsubscribe:list-id:precedence:subject :content-transfer-encoding:mime-version:references:in-reply-to :message-id:date:to:from:dkim-signature; bh=Ugqvq5hjETyvltT2YWuWOJiTLDqqAsBqsH4ZO7PK4SQ=; b=kr1odPjQcASVFionpnklkEY6QcTip93/Lkr9WzM+1T0Vp3eAV17WpIw3ARCeYPpoq7 Vldfoq5sPCJZjpr7OjFjhR+ngKiTAO5FjmVxbu+m+fw5F2GnO/vnQNXiw7zWxZI+BQaa TAlnh5dQy3lTg0xZKIxcuEylO0/sWwBKUcxbqWvydvl0hbCxlmg+17dchNLLXURUYK5s 8EDD6zospKxCSo6HBWBudstyPzR4dmVn82s92WtS02bQ2LQAwJN3Wd+IW8eaCm+vLPyv 881cY0ixFAuuk45PhGcNglysDZ1T7+00TQrfZwx0b4uLaGCB9MGmr3p9eHZuxeLAucCb oczg== ARC-Authentication-Results: i=1; mx.google.com; dkim=fail header.i=@linaro.org header.s=google header.b=yNe2eiwu; spf=pass (google.com: domain of qemu-devel-bounces+patch=linaro.org@nongnu.org designates 209.51.188.47 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.47]) by mx.google.com with ESMTPS id p133si861393qke.24.2019.06.07.02.33.22 for (version=TLS1_2 cipher=ECDHE-RSA-CHACHA20-POLY1305 bits=256/256); Fri, 07 Jun 2019 02:33:22 -0700 (PDT) Received-SPF: pass (google.com: domain of qemu-devel-bounces+patch=linaro.org@nongnu.org designates 209.51.188.47 as permitted sender) client-ip=209.51.188.47; Authentication-Results: mx.google.com; dkim=fail header.i=@linaro.org header.s=google header.b=yNe2eiwu; spf=pass (google.com: domain of qemu-devel-bounces+patch=linaro.org@nongnu.org designates 209.51.188.47 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]:47502 helo=lists.gnu.org) by lists.gnu.org with esmtp (Exim 4.86_2) (envelope-from ) id 1hZBFQ-0000EW-Qj for patch@linaro.org; Fri, 07 Jun 2019 05:33:21 -0400 Received: from eggs.gnu.org ([2001:470:142:3::10]:39489) by lists.gnu.org with esmtp (Exim 4.86_2) (envelope-from ) id 1hZAp8-0004CJ-9c for qemu-devel@nongnu.org; Fri, 07 Jun 2019 05:06:11 -0400 Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71) (envelope-from ) id 1hZAp5-0004jb-OI for qemu-devel@nongnu.org; Fri, 07 Jun 2019 05:06:10 -0400 Received: from mail-wr1-x42c.google.com ([2a00:1450:4864:20::42c]:36269) by eggs.gnu.org with esmtps (TLS1.0:RSA_AES_128_CBC_SHA1:16) (Exim 4.71) (envelope-from ) id 1hZAp5-0004aA-H3 for qemu-devel@nongnu.org; Fri, 07 Jun 2019 05:06:07 -0400 Received: by mail-wr1-x42c.google.com with SMTP id n4so1360614wrs.3 for ; Fri, 07 Jun 2019 02:06:04 -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=Ugqvq5hjETyvltT2YWuWOJiTLDqqAsBqsH4ZO7PK4SQ=; b=yNe2eiwuWZwdjdrXOzN+vDRKbzkIyJRZBMgJCFoyI5loICauyVZ+q92+WM2L/NMn/n 8EfnyVHoHnPBUVB/lzt+kmrgqBaK7rh3NWL3BJ4xr2QAu2kdg7vSLmHlpo2PyAghXTNi YGf16aRjGzCJNqDmeZXfS6SWwav/XqSeR0yhGv5H3l7JSidubmQ8c87eyeZa+DZwjS0t xhOirQkGOBQrG756ajz2Ow+wbUmvZJOhqmHZ4pEBKzB4iWOFv4mSBDGzjFn4QnbBlI0t Unm2okZmgNh0iRhP5V/3wnGlVvTXIWOZQZ+h5PxXABKg8QtVFCE+QGj8QB5zGwyFfKst 3Y5g== 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=Ugqvq5hjETyvltT2YWuWOJiTLDqqAsBqsH4ZO7PK4SQ=; b=NYCpdkTDDA4JxM39UBGmX7Bw3BJU/hBrRkTTHRelBZGRE68158M7bTbJGQ5OXbFK9o JxWTgnzY6Mhcvy+XWwZdJrlWDBrRjyzA84/Ba0XlFjtp8pg2pmy+yy5tZRnBWrWKl/jN XGZfNQNAlClBWp9DNtZS/HtdQStKyJ+R3qAiVl49LTGHzef9Pk0Rh1ZjBkZIZdhhkwIs EYMWrA7PdAnkTOywWlVz61+cSvGJPnbaNPegSubfgASfvjIWii/Bqxyb/dDNzdvKLHyO jK9M9WJ/d4gFjpn3sSzrBmFyVi1O2ZC9eYDIeL33qvVOesgvfGRbxUm8P6fL+3qPuREd ONBg== X-Gm-Message-State: APjAAAUpRx5CAxY+EV0e4lUBGgiPxaES3SgY65b0BQSP7EDU5epRfcDb AulmAKfzCOugOSqXB3uU239iqg== X-Received: by 2002:a5d:43d0:: with SMTP id v16mr31389680wrr.252.1559898364026; Fri, 07 Jun 2019 02:06:04 -0700 (PDT) Received: from zen.linaroharston ([81.128.185.34]) by smtp.gmail.com with ESMTPSA id z17sm1115720wru.21.2019.06.07.02.05.57 (version=TLS1_3 cipher=AEAD-AES256-GCM-SHA384 bits=256/256); Fri, 07 Jun 2019 02:06:01 -0700 (PDT) Received: from zen.linaroharston. (localhost [127.0.0.1]) by zen.linaroharston (Postfix) with ESMTP id 130EF1FF90; Fri, 7 Jun 2019 10:05:55 +0100 (BST) From: =?utf-8?q?Alex_Benn=C3=A9e?= To: peter.maydell@linaro.org Date: Fri, 7 Jun 2019 10:05:37 +0100 Message-Id: <20190607090552.12434-39-alex.bennee@linaro.org> X-Mailer: git-send-email 2.20.1 In-Reply-To: <20190607090552.12434-1-alex.bennee@linaro.org> References: <20190607090552.12434-1-alex.bennee@linaro.org> MIME-Version: 1.0 X-detected-operating-system: by eggs.gnu.org: Genre and OS details not recognized. X-Received-From: 2a00:1450:4864:20::42c Subject: [Qemu-devel] [PULL 38/52] gdbstub: Implement set_thread (H pkt) with new infra 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, Jon Doron Errors-To: qemu-devel-bounces+patch=linaro.org@nongnu.org Sender: "Qemu-devel" From: Jon Doron Signed-off-by: Jon Doron Reviewed-by: Alex Bennée Message-Id: <20190529064148.19856-7-arilou@gmail.com> Signed-off-by: Alex Bennée -- 2.20.1 diff --git a/gdbstub.c b/gdbstub.c index 3425f0674d..7735c244b3 100644 --- a/gdbstub.c +++ b/gdbstub.c @@ -1560,6 +1560,51 @@ static void handle_cont_with_sig(GdbCmdContext *gdb_ctx, void *user_ctx) gdb_continue(gdb_ctx->s); } +static void handle_set_thread(GdbCmdContext *gdb_ctx, void *user_ctx) +{ + CPUState *cpu; + + if (gdb_ctx->num_params != 2) { + put_packet(gdb_ctx->s, "E22"); + return; + } + + if (gdb_ctx->params[1].thread_id.kind == GDB_READ_THREAD_ERR) { + put_packet(gdb_ctx->s, "E22"); + return; + } + + if (gdb_ctx->params[1].thread_id.kind != GDB_ONE_THREAD) { + put_packet(gdb_ctx->s, "OK"); + return; + } + + cpu = gdb_get_cpu(gdb_ctx->s, gdb_ctx->params[1].thread_id.pid, + gdb_ctx->params[1].thread_id.tid); + if (!cpu) { + put_packet(gdb_ctx->s, "E22"); + return; + } + + /* + * Note: This command is deprecated and modern gdb's will be using the + * vCont command instead. + */ + switch (gdb_ctx->params[0].opcode) { + case 'c': + gdb_ctx->s->c_cpu = cpu; + put_packet(gdb_ctx->s, "OK"); + break; + case 'g': + gdb_ctx->s->g_cpu = cpu; + put_packet(gdb_ctx->s, "OK"); + break; + default: + put_packet(gdb_ctx->s, "E22"); + break; + } +} + static int gdb_handle_packet(GDBState *s, const char *line_buf) { CPUState *cpu; @@ -1573,7 +1618,6 @@ static int gdb_handle_packet(GDBState *s, const char *line_buf) char thread_id[16]; uint8_t *registers; target_ulong addr, len; - GDBThreadIdKind thread_kind; const GdbCmdParseEntry *cmd_parser = NULL; trace_gdbstub_io_command(line_buf); @@ -1836,35 +1880,14 @@ static int gdb_handle_packet(GDBState *s, const char *line_buf) put_packet(s, "E22"); break; case 'H': - type = *p++; - - thread_kind = read_thread_id(p, &p, &pid, &tid); - if (thread_kind == GDB_READ_THREAD_ERR) { - put_packet(s, "E22"); - break; - } - - if (thread_kind != GDB_ONE_THREAD) { - put_packet(s, "OK"); - break; - } - cpu = gdb_get_cpu(s, pid, tid); - if (cpu == NULL) { - put_packet(s, "E22"); - break; - } - switch (type) { - case 'c': - s->c_cpu = cpu; - put_packet(s, "OK"); - break; - case 'g': - s->g_cpu = cpu; - put_packet(s, "OK"); - break; - default: - put_packet(s, "E22"); - break; + { + static const GdbCmdParseEntry set_thread_cmd_desc = { + .handler = handle_set_thread, + .cmd = "H", + .cmd_startswith = 1, + .schema = "o.t0" + }; + cmd_parser = &set_thread_cmd_desc; } break; case 'T': From patchwork Fri Jun 7 09:05:38 2019 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 8bit X-Patchwork-Submitter: =?utf-8?q?Alex_Benn=C3=A9e?= X-Patchwork-Id: 166130 Delivered-To: patch@linaro.org Received: by 2002:a92:9e1a:0:0:0:0:0 with SMTP id q26csp448927ili; Fri, 7 Jun 2019 03:23:02 -0700 (PDT) X-Google-Smtp-Source: APXvYqysXjYkGJotJh+EKC57sRGwJ6mRkkNJLib/dv903W3s0SmmPJ2wC/Uot36zG7zjsxxlaMlU X-Received: by 2002:a37:b87:: with SMTP id 129mr24989058qkl.132.1559902982345; Fri, 07 Jun 2019 03:23:02 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1559902982; cv=none; d=google.com; s=arc-20160816; b=vcBtGtrC7EcniHqqiuu9ECHYd4H/cJOAlHKAYuA137jnO+Y8RyLiR4KROzS1IIA3gW eRzCD8YeEopkBXRy6qEXjwGW+LTnYLYVWVKcSkgjWeI8EFeXODgufQYl2+NosnxkcN6d t/Qn5VZrTS8ber0zkcPgpcOLRdjaHxOG9R/AZ+fiEYsC0okuSIQEBPafkEZm2DuaPuPK Jn4XV23LtjPsvpvLGGVwnmJR6hTLpsFAYABDPIv4TPtFU40A+x8mULcB8Z85Yz+xzN6B bk5zV3umlSTOy8PZavrKR5RhFQEySkucbYdahtZxsCfOVofWJa48uIspnTMpOtlStpl5 beAg== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=sender:errors-to:cc:list-subscribe:list-help:list-post:list-archive :list-unsubscribe:list-id:precedence:subject :content-transfer-encoding:mime-version:references:in-reply-to :message-id:date:to:from:dkim-signature; bh=cMrj3E5Bd95PqGJENY32z7PQs37HAPouZyZmhNIb23k=; b=Shaw0A8syPBizciLAp2AqXiixDaVw3MoHXeeTGYC368JyLLKLWFoBGvt7tM/dpQ5ac kUlS4zhl3eDl6lkhNLz3lln3X1aLCoqcosEaPNDVQvLmqNNmP8LpLycdNhc/iTLA6aMp qReahI2se5bOHsT7DTQCbxEI6rfKv+9JYimNiF8qyV5FcCreH6ePx5MkBB4b9vJBQaPW eSVx1iiyLM9TZAyRQ9t41R2uD3NJvYxH4IkXT2sDsapPeRcZJF0P7KdqEiFPiY+tBiOB m5JDygkN3kozlXqpIROr4SGv0joWKVxkXZvPF2ouyPk42XEwx2ZoXq4DRHEnXqSRNdrO qynA== ARC-Authentication-Results: i=1; mx.google.com; dkim=fail header.i=@linaro.org header.s=google header.b=tIcOGZZ8; spf=pass (google.com: domain of qemu-devel-bounces+patch=linaro.org@nongnu.org designates 209.51.188.47 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.47]) by mx.google.com with ESMTPS id k127si927766qkd.39.2019.06.07.03.23.02 for (version=TLS1_2 cipher=ECDHE-RSA-CHACHA20-POLY1305 bits=256/256); Fri, 07 Jun 2019 03:23:02 -0700 (PDT) Received-SPF: pass (google.com: domain of qemu-devel-bounces+patch=linaro.org@nongnu.org designates 209.51.188.47 as permitted sender) client-ip=209.51.188.47; Authentication-Results: mx.google.com; dkim=fail header.i=@linaro.org header.s=google header.b=tIcOGZZ8; spf=pass (google.com: domain of qemu-devel-bounces+patch=linaro.org@nongnu.org designates 209.51.188.47 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]:47970 helo=lists.gnu.org) by lists.gnu.org with esmtp (Exim 4.86_2) (envelope-from ) id 1hZC1V-0008Dt-Vw for patch@linaro.org; Fri, 07 Jun 2019 06:23:01 -0400 Received: from eggs.gnu.org ([2001:470:142:3::10]:45129) by lists.gnu.org with esmtp (Exim 4.86_2) (envelope-from ) id 1hZB56-0008RI-Qz for qemu-devel@nongnu.org; Fri, 07 Jun 2019 05:22:42 -0400 Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71) (envelope-from ) id 1hZB55-0005zq-NQ for qemu-devel@nongnu.org; Fri, 07 Jun 2019 05:22:40 -0400 Received: from mail-wr1-x431.google.com ([2a00:1450:4864:20::431]:40277) by eggs.gnu.org with esmtps (TLS1.0:RSA_AES_128_CBC_SHA1:16) (Exim 4.71) (envelope-from ) id 1hZB55-0005yv-Gh for qemu-devel@nongnu.org; Fri, 07 Jun 2019 05:22:39 -0400 Received: by mail-wr1-x431.google.com with SMTP id p11so1397318wre.7 for ; Fri, 07 Jun 2019 02:22: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=cMrj3E5Bd95PqGJENY32z7PQs37HAPouZyZmhNIb23k=; b=tIcOGZZ8/013NtHbCCUeLcIfcab86vNwBY9Ku2yiozOl7Zmo8ObkRNm+umUC0wB4sq mo0Y/lTSlCUDyyWANdrwVGvWnOic1VnJLAgxVL+/cRlpAmp5JvZCxa3QTXJ9qyu4HGZS pLYqcC3D6MgrxVD3Y5+IXqHiI+EZDxInvn7901FErXujILsNhTAHMdaPafyXrJWcD8V+ a+gNbYjpdpuG/kAGLvGu9dRZuZDw0Yu3WVqCq7m4SVyrwGYV6QMYhdclFJ9VF1c/q4sS K/L0nGPZN5I6tiUMW+HO5oS0qsXU/hmyt34OCm5d8o9g0lCQo1CzXy79eE8bN751Pu4H k0qg== 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=cMrj3E5Bd95PqGJENY32z7PQs37HAPouZyZmhNIb23k=; b=K09Qjmx/hLkZ2OfsuDnmAaNCte1Muh67OMSx5It/x4zjNva/pzouRrnRuMXGfnJNlk OOVDvyeDRxcRBDTzI2Bi6UHPQ6+xi+33H/8ddJZVWIbac6plqYg9nwsCtpr2TB4j73Db pc7gkf4OKnnfsuQdG68avhrkiv6vfgRkp/Ec3+cl/k+yCmfnWKZ3CroCwewQGo7PQYXX rytGlS2RQTwwdk5FlH2LyFe3VsPKJGAexQ9c2PxYhzvnYzOO5rQubqxEeFwvHjL4LMJc JDQgl5Hg8YPEM/r6fTwLwrTUJvUCrp5Qkd/hW2Q9MQUf6XYuc6a61pBxjSqWkZB1rACM uizQ== X-Gm-Message-State: APjAAAUJxkNbgvbXx/abh7GZXw/qZBIDsWOFCcwxY8+Bh5pxHObKNv3e vyi9XwCZ6vkB6w41/5DbfIU5yg== X-Received: by 2002:a5d:554b:: with SMTP id g11mr18362010wrw.10.1559899358447; Fri, 07 Jun 2019 02:22:38 -0700 (PDT) Received: from zen.linaroharston ([81.128.185.34]) by smtp.gmail.com with ESMTPSA id p2sm1583377wrx.90.2019.06.07.02.22.30 (version=TLS1_3 cipher=AEAD-AES256-GCM-SHA384 bits=256/256); Fri, 07 Jun 2019 02:22:35 -0700 (PDT) Received: from zen.linaroharston. (localhost [127.0.0.1]) by zen.linaroharston (Postfix) with ESMTP id 263A91FFBE; Fri, 7 Jun 2019 10:05:55 +0100 (BST) From: =?utf-8?q?Alex_Benn=C3=A9e?= To: peter.maydell@linaro.org Date: Fri, 7 Jun 2019 10:05:38 +0100 Message-Id: <20190607090552.12434-40-alex.bennee@linaro.org> X-Mailer: git-send-email 2.20.1 In-Reply-To: <20190607090552.12434-1-alex.bennee@linaro.org> References: <20190607090552.12434-1-alex.bennee@linaro.org> MIME-Version: 1.0 X-detected-operating-system: by eggs.gnu.org: Genre and OS details not recognized. X-Received-From: 2a00:1450:4864:20::431 Subject: [Qemu-devel] [PULL 39/52] gdbstub: Implement breakpoint commands (Z/z pkt) with new infra 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, Jon Doron Errors-To: qemu-devel-bounces+patch=linaro.org@nongnu.org Sender: "Qemu-devel" From: Jon Doron Signed-off-by: Jon Doron Message-Id: <20190529064148.19856-8-arilou@gmail.com> Signed-off-by: Alex Bennée -- 2.20.1 diff --git a/gdbstub.c b/gdbstub.c index 7735c244b3..8416f4c13f 100644 --- a/gdbstub.c +++ b/gdbstub.c @@ -950,7 +950,7 @@ static inline int xlat_gdb_type(CPUState *cpu, int gdbtype) } #endif -static int gdb_breakpoint_insert(target_ulong addr, target_ulong len, int type) +static int gdb_breakpoint_insert(int type, target_ulong addr, target_ulong len) { CPUState *cpu; int err = 0; @@ -987,7 +987,7 @@ static int gdb_breakpoint_insert(target_ulong addr, target_ulong len, int type) } } -static int gdb_breakpoint_remove(target_ulong addr, target_ulong len, int type) +static int gdb_breakpoint_remove(int type, target_ulong addr, target_ulong len) { CPUState *cpu; int err = 0; @@ -1605,6 +1605,52 @@ static void handle_set_thread(GdbCmdContext *gdb_ctx, void *user_ctx) } } +static void handle_insert_bp(GdbCmdContext *gdb_ctx, void *user_ctx) +{ + int res; + + if (gdb_ctx->num_params != 3) { + put_packet(gdb_ctx->s, "E22"); + return; + } + + res = gdb_breakpoint_insert(gdb_ctx->params[0].val_ul, + gdb_ctx->params[1].val_ull, + gdb_ctx->params[2].val_ull); + if (res >= 0) { + put_packet(gdb_ctx->s, "OK"); + return; + } else if (res == -ENOSYS) { + put_packet(gdb_ctx->s, ""); + return; + } + + put_packet(gdb_ctx->s, "E22"); +} + +static void handle_remove_bp(GdbCmdContext *gdb_ctx, void *user_ctx) +{ + int res; + + if (gdb_ctx->num_params != 3) { + put_packet(gdb_ctx->s, "E22"); + return; + } + + res = gdb_breakpoint_remove(gdb_ctx->params[0].val_ul, + gdb_ctx->params[1].val_ull, + gdb_ctx->params[2].val_ull); + if (res >= 0) { + put_packet(gdb_ctx->s, "OK"); + return; + } else if (res == -ENOSYS) { + put_packet(gdb_ctx->s, ""); + return; + } + + put_packet(gdb_ctx->s, "E22"); +} + static int gdb_handle_packet(GDBState *s, const char *line_buf) { CPUState *cpu; @@ -1860,24 +1906,26 @@ static int gdb_handle_packet(GDBState *s, const char *line_buf) put_packet(s, "OK"); break; case 'Z': + { + static const GdbCmdParseEntry insert_bp_cmd_desc = { + .handler = handle_insert_bp, + .cmd = "Z", + .cmd_startswith = 1, + .schema = "l?L?L0" + }; + cmd_parser = &insert_bp_cmd_desc; + } + break; case 'z': - type = strtoul(p, (char **)&p, 16); - if (*p == ',') - p++; - addr = strtoull(p, (char **)&p, 16); - if (*p == ',') - p++; - len = strtoull(p, (char **)&p, 16); - if (ch == 'Z') - res = gdb_breakpoint_insert(addr, len, type); - else - res = gdb_breakpoint_remove(addr, len, type); - if (res >= 0) - put_packet(s, "OK"); - else if (res == -ENOSYS) - put_packet(s, ""); - else - put_packet(s, "E22"); + { + static const GdbCmdParseEntry remove_bp_cmd_desc = { + .handler = handle_remove_bp, + .cmd = "z", + .cmd_startswith = 1, + .schema = "l?L?L0" + }; + cmd_parser = &remove_bp_cmd_desc; + } break; case 'H': { From patchwork Fri Jun 7 09:05:39 2019 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 8bit X-Patchwork-Submitter: =?utf-8?q?Alex_Benn=C3=A9e?= X-Patchwork-Id: 166120 Delivered-To: patch@linaro.org Received: by 2002:a92:9e1a:0:0:0:0:0 with SMTP id q26csp440825ili; Fri, 7 Jun 2019 03:15:02 -0700 (PDT) X-Google-Smtp-Source: APXvYqzbxnnkwWYNWQqSmCIJ8xC9D8NUE+T1Oj1LVrTc6ZjRDHI3B+/JBW640kFBCi/sNIcza07B X-Received: by 2002:ac8:6c59:: with SMTP id z25mr46874956qtu.43.1559902502372; Fri, 07 Jun 2019 03:15:02 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1559902502; cv=none; d=google.com; s=arc-20160816; b=lKB4K6xMmjLRUuMyIVj7Mcy3XXt7A15Zv2bDrTvlGMu+VmnNe+1H1grazWr1NfOcJl XGiAt7V6/D4hSLI7jZFok0fRWOpemNs3krXy1pqo86zi4+J8cqY7gUlCs3z+0D2cloBk bfAUHnIE6EwZjnx4UbZOffHhgF0XIR3NdryeGzK6nRF9050pwmqsPfOgLYX5hEfRhtLB y8qYOTpdQaw3bmJvWK8GE6+Vvs59v4xq6qGaoAsxV4Tstm0oF2p0JPX/dMGyJxdQ3X/C R9+WPLNG3AeDCEQ4Vt+efpG7g5i8jLWCDVuYNUpFuxnknAyw7XWN9unjYnaBqyMx1kpe OJOQ== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=sender:errors-to:cc:list-subscribe:list-help:list-post:list-archive :list-unsubscribe:list-id:precedence:subject :content-transfer-encoding:mime-version:references:in-reply-to :message-id:date:to:from:dkim-signature; bh=Kno1JHe4Nw5DNpZGIjJXu5QHXO+/4yvTRz2xZM/0txY=; b=yYKQN/wsTpbsVuP0w9KYwDsXEJqzWyajwXT/N9AQmmmXqmXq3tbWkUa53R7ejwdbP+ 2HhtQ8yWmt9iZVVvutNZpGfI7uXUf8fO3F7hipkhifpmgJKyoxV7em6efP4//ftT6ggn rr1YPES/lG68n08A6uBIap9Oae1+Im58l9kHJLeibxBWHGmNOVdNFidbFpC3F8hGfpf0 XFte9fftwrtKUi+PXTzpQaATNBefTNgML4JEL1YUIWauY9azYBLSbUMmiFak2G1brLZJ zr8EvFaWuao+9Val2mX33+YEldNXQtnG/1Sgu31aRNGi0Hz2y0yZANKe/+dwypLJo3qX t9+g== ARC-Authentication-Results: i=1; mx.google.com; dkim=fail header.i=@linaro.org header.s=google header.b=fPLuKuwc; spf=pass (google.com: domain of qemu-devel-bounces+patch=linaro.org@nongnu.org designates 209.51.188.47 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.47]) by mx.google.com with ESMTPS id j7si343460qth.112.2019.06.07.03.15.02 for (version=TLS1_2 cipher=ECDHE-RSA-CHACHA20-POLY1305 bits=256/256); Fri, 07 Jun 2019 03:15:02 -0700 (PDT) Received-SPF: pass (google.com: domain of qemu-devel-bounces+patch=linaro.org@nongnu.org designates 209.51.188.47 as permitted sender) client-ip=209.51.188.47; Authentication-Results: mx.google.com; dkim=fail header.i=@linaro.org header.s=google header.b=fPLuKuwc; spf=pass (google.com: domain of qemu-devel-bounces+patch=linaro.org@nongnu.org designates 209.51.188.47 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]:47920 helo=lists.gnu.org) by lists.gnu.org with esmtp (Exim 4.86_2) (envelope-from ) id 1hZBtl-0003cn-P9 for patch@linaro.org; Fri, 07 Jun 2019 06:15:01 -0400 Received: from eggs.gnu.org ([2001:470:142:3::10]:42202) by lists.gnu.org with esmtp (Exim 4.86_2) (envelope-from ) id 1hZAvT-0002FY-AQ for qemu-devel@nongnu.org; Fri, 07 Jun 2019 05:12:45 -0400 Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71) (envelope-from ) id 1hZAvQ-0004z4-PA for qemu-devel@nongnu.org; Fri, 07 Jun 2019 05:12:43 -0400 Received: from mail-wm1-x332.google.com ([2a00:1450:4864:20::332]:54778) by eggs.gnu.org with esmtps (TLS1.0:RSA_AES_128_CBC_SHA1:16) (Exim 4.71) (envelope-from ) id 1hZAvQ-0004k3-E7 for qemu-devel@nongnu.org; Fri, 07 Jun 2019 05:12:40 -0400 Received: by mail-wm1-x332.google.com with SMTP id g135so1233880wme.4 for ; Fri, 07 Jun 2019 02:12:33 -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=Kno1JHe4Nw5DNpZGIjJXu5QHXO+/4yvTRz2xZM/0txY=; b=fPLuKuwcdE23w8v3w974LXwbmBDbFl9vHRaFOyhB64LpZrwmbgiotLN8rzpwei/E7X 3PGMPiACY9nRuC4TQPl6xwXT9KQNsgyVPdpy1MlsU3MQASr/dx+RxsjFVE/uU30ZAhUZ Ub22ZuVqilQLspgqCtiF1gmDzpEe5zl8zLf4ra003OYL5p2Jmu7tndvgeLG2ore4eUOi kliwv2pqeIzdMtgCdwJjdFNfekbMyVSJNTN+8nQSCsJx0q1BXaYiMCuHWCaoHhKjIUml +MUsy9Xxnq71CJRxbJycVWXpJg93eb3eyszEB6rHD511ekLYXmzC26VzNI+6eRJZ6RdH T4wg== 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=Kno1JHe4Nw5DNpZGIjJXu5QHXO+/4yvTRz2xZM/0txY=; b=uVDcE5kmJoyLsN0tFkT4pdXw+gfITumk1vwsTKVFyGIUSNY8O36M9ocg41gpl8tbw6 /X2unlqcpR+yoZotST+i4dZ1uh+w1c3CEnRPTSJmUIzux5HLbU65JoDrQPLTYTduZ1+I AfXJ7Ar9R4mbs0nsBNToTXemsWj0WEVrgQGjOnUpt9HIoqEoyFz7DbskX5hHHXCUKWmR 0vD3rY6EHawp7ogqVzZaq7tzwaLyuS6TSvst6RjEGuDLStww177PgyVWtrMN+SdXlEdF kvbeaeryfTOfPuuUeGDb5Kk+wO6cAR9m/syeYglt4ozUylbGn5OWVDnCC59/YND0yN+e GeoA== X-Gm-Message-State: APjAAAXV4ov3aGCzqgFVUsNH08aDRz3mOt3Nmf8RynNirGB56k1GWksu k3Q4HJgy6SpNCetNFR2YyNj//Q== X-Received: by 2002:a1c:c305:: with SMTP id t5mr2790706wmf.163.1559898752590; Fri, 07 Jun 2019 02:12:32 -0700 (PDT) Received: from zen.linaroharston ([81.128.185.34]) by smtp.gmail.com with ESMTPSA id q24sm1211067wmc.43.2019.06.07.02.12.27 (version=TLS1_3 cipher=AEAD-AES256-GCM-SHA384 bits=256/256); Fri, 07 Jun 2019 02:12:30 -0700 (PDT) Received: from zen.linaroharston. (localhost [127.0.0.1]) by zen.linaroharston (Postfix) with ESMTP id 39A9D1FFBF; Fri, 7 Jun 2019 10:05:55 +0100 (BST) From: =?utf-8?q?Alex_Benn=C3=A9e?= To: peter.maydell@linaro.org Date: Fri, 7 Jun 2019 10:05:39 +0100 Message-Id: <20190607090552.12434-41-alex.bennee@linaro.org> X-Mailer: git-send-email 2.20.1 In-Reply-To: <20190607090552.12434-1-alex.bennee@linaro.org> References: <20190607090552.12434-1-alex.bennee@linaro.org> MIME-Version: 1.0 X-detected-operating-system: by eggs.gnu.org: Genre and OS details not recognized. X-Received-From: 2a00:1450:4864:20::332 Subject: [Qemu-devel] [PULL 40/52] gdbstub: Implement set register (P pkt) with new infra 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, Jon Doron Errors-To: qemu-devel-bounces+patch=linaro.org@nongnu.org Sender: "Qemu-devel" From: Jon Doron Signed-off-by: Jon Doron Message-Id: <20190529064148.19856-9-arilou@gmail.com> Signed-off-by: Alex Bennée -- 2.20.1 diff --git a/gdbstub.c b/gdbstub.c index 8416f4c13f..630f931765 100644 --- a/gdbstub.c +++ b/gdbstub.c @@ -1651,6 +1651,27 @@ static void handle_remove_bp(GdbCmdContext *gdb_ctx, void *user_ctx) put_packet(gdb_ctx->s, "E22"); } +static void handle_set_reg(GdbCmdContext *gdb_ctx, void *user_ctx) +{ + int reg_size; + + if (!gdb_has_xml) { + put_packet(gdb_ctx->s, "E00"); + return; + } + + if (gdb_ctx->num_params != 2) { + put_packet(gdb_ctx->s, "E22"); + return; + } + + reg_size = strlen(gdb_ctx->params[1].data) / 2; + hextomem(gdb_ctx->mem_buf, gdb_ctx->params[1].data, reg_size); + gdb_write_register(gdb_ctx->s->g_cpu, gdb_ctx->mem_buf, + gdb_ctx->params[0].val_ull); + put_packet(gdb_ctx->s, "OK"); +} + static int gdb_handle_packet(GDBState *s, const char *line_buf) { CPUState *cpu; @@ -1895,15 +1916,15 @@ static int gdb_handle_packet(GDBState *s, const char *line_buf) } break; case 'P': - if (!gdb_has_xml) - goto unknown_command; - addr = strtoull(p, (char **)&p, 16); - if (*p == '=') - p++; - reg_size = strlen(p) / 2; - hextomem(mem_buf, p, reg_size); - gdb_write_register(s->g_cpu, mem_buf, addr); - put_packet(s, "OK"); + { + static const GdbCmdParseEntry set_reg_cmd_desc = { + .handler = handle_set_reg, + .cmd = "P", + .cmd_startswith = 1, + .schema = "L?s0" + }; + cmd_parser = &set_reg_cmd_desc; + } break; case 'Z': { From patchwork Fri Jun 7 09:05:40 2019 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 8bit X-Patchwork-Submitter: =?utf-8?q?Alex_Benn=C3=A9e?= X-Patchwork-Id: 166117 Delivered-To: patch@linaro.org Received: by 2002:a92:9e1a:0:0:0:0:0 with SMTP id q26csp438111ili; Fri, 7 Jun 2019 03:12:27 -0700 (PDT) X-Google-Smtp-Source: APXvYqxBMciXiftSWFxJ84ag7cnBRgMl9DtvolNZJmnyow7hCjzHlX5NvZwD/fdYT676wQCZvPGk X-Received: by 2002:ac8:1b64:: with SMTP id p33mr46200024qtk.62.1559902347393; Fri, 07 Jun 2019 03:12:27 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1559902347; cv=none; d=google.com; s=arc-20160816; b=ODLLjAl2jF0TUDgWYtUCwgxnrPLB0lKQdl+S2c5k8+5NTF5bwKSSNz2aQQN7PI8KrQ NrmPTcyK0LUtUC3zcgP6I0MTcU5coIf4i76BXl0CJ++vB9vVfaugmrkSfj7Ej5jFT9YF u2kOEMkgWYZL8Uuafrqob7fmjTxopJLhZPp9MtRy2LNZjBx6/7FH1ydI41UKQjuMYQDQ oSH5xMRJkb7JCJATImK+oB1ftDX/XwQbHwaZfpaT1vV0caPOyA91ch1Xq5X8IPB07Ixx 9oztF7Sx63J838MHxmn06mbtzEagQ/JK5NBsQhddqyUK3bQ8UJ9HBtn0UssJhoXC/aY7 mpSQ== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=sender:errors-to:cc:list-subscribe:list-help:list-post:list-archive :list-unsubscribe:list-id:precedence:subject :content-transfer-encoding:mime-version:references:in-reply-to :message-id:date:to:from:dkim-signature; bh=6ItlL8HIelf+krBS9v4fi6BpYYbdu3JhklvwiNP6ff4=; b=fuE/KOoVNLr1MsJmLeZLeAbx2bY9dn0/JZfGrdtBN+kxIuVO8KItpUvbRm2CNjMX8T CO7szsAZ3R/XR5jfvnItAVsfKD73uCG4vfi9YBQCYL0KMXHSjhSfxmzYl5qW4yS68t+y Vf3BcftQCF/vzb3yNvg1a5BBCU0yzZbQaQyfsWAotkVUeidbFw61jMSRo1Sfqx18tUQu B4NYCc5L2BPMb6HX3e7wMfj0YESY0W2FPS2lHj/u68VKZT5KWt6fvDTJbs4GxjQwA4ZT IHvsxoA3tsakKunVZxpAVDD+ajcWcnTR/1nlmBVuImeCYWsshxm9S3YMvLRKfibsIQm7 bxLQ== ARC-Authentication-Results: i=1; mx.google.com; dkim=fail header.i=@linaro.org header.s=google header.b=x+6+TyO8; spf=pass (google.com: domain of qemu-devel-bounces+patch=linaro.org@nongnu.org designates 209.51.188.47 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.47]) by mx.google.com with ESMTPS id x1si1016791qtj.159.2019.06.07.03.12.27 for (version=TLS1_2 cipher=ECDHE-RSA-CHACHA20-POLY1305 bits=256/256); Fri, 07 Jun 2019 03:12:27 -0700 (PDT) Received-SPF: pass (google.com: domain of qemu-devel-bounces+patch=linaro.org@nongnu.org designates 209.51.188.47 as permitted sender) client-ip=209.51.188.47; Authentication-Results: mx.google.com; dkim=fail header.i=@linaro.org header.s=google header.b=x+6+TyO8; spf=pass (google.com: domain of qemu-devel-bounces+patch=linaro.org@nongnu.org designates 209.51.188.47 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]:47894 helo=lists.gnu.org) by lists.gnu.org with esmtp (Exim 4.86_2) (envelope-from ) id 1hZBrG-00011Q-Vi for patch@linaro.org; Fri, 07 Jun 2019 06:12:27 -0400 Received: from eggs.gnu.org ([2001:470:142:3::10]:44957) by lists.gnu.org with esmtp (Exim 4.86_2) (envelope-from ) id 1hZB4z-00085k-LQ for qemu-devel@nongnu.org; Fri, 07 Jun 2019 05:22:34 -0400 Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71) (envelope-from ) id 1hZB4y-0005p9-Au for qemu-devel@nongnu.org; Fri, 07 Jun 2019 05:22:33 -0400 Received: from mail-wr1-x435.google.com ([2a00:1450:4864:20::435]:47043) by eggs.gnu.org with esmtps (TLS1.0:RSA_AES_128_CBC_SHA1:16) (Exim 4.71) (envelope-from ) id 1hZB4y-0005mA-1u for qemu-devel@nongnu.org; Fri, 07 Jun 2019 05:22:32 -0400 Received: by mail-wr1-x435.google.com with SMTP id n4so1372140wrw.13 for ; Fri, 07 Jun 2019 02:22:31 -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=6ItlL8HIelf+krBS9v4fi6BpYYbdu3JhklvwiNP6ff4=; b=x+6+TyO88zsLJFCXpdRp1Rjin74r2YvB1iOoyZDly6fqezu/e4E7kbHna2yv+Vrf5s sgg20+w1NSUWgo0ULRwusjZpQ1QoeWgXy0x2Nu2VzM09rfJc8YKKJjFLvIdyuNrLqDMt qeSrlstyvAzaw8Hwq68Nk/oBy9lvLSUBJaih+omjbGTYEsu+tY/Pmvi6KlVrhEXq+Zk6 7EHdURlGF5hiyfXqPv8HwhyUo3F6Ssl4CabFL245heL7rykmEMkIDTxuQbmuVrBa4DLC CZsdouEAgeUKyp80m9xlOFxL7sahcrFtqOVf8DCTFLkajS9yP23oof0zGz41RkMR20p6 4Wog== 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=6ItlL8HIelf+krBS9v4fi6BpYYbdu3JhklvwiNP6ff4=; b=ngpCxVTiHbnyop6F4VE8qLkzxl/szjoIpbPdi9gFZO7M4SeQTkMJ8aOk4ld+26fCHO CWhoURYqhPl6hEKYhSqZw0WVHpGHtVS6Kjy78cF8qfOSiM6JKHjpyH6hzE9oA1fqvLCm DocX0vFAVPt0b/ZjyXXcFB45ax8zs8pARyOUdhqh+pOMYol8Ki+M16bYRNVRest3XYt6 Edx9isZiHfUmuZRfVdIm1jGVoHiU4gQsu3hQxjRfnUZZUOh7Kar0lIJoE9bZtVkvZ9PN nirk36DgANci9BnT7y/tfqpXVmz/DTbGCw0t8FC4YlCjqPAnlaqkN9wn7rzK/dqm5EaW Iy7Q== X-Gm-Message-State: APjAAAVbUYHDQcD9+7h4qXwNAIk7biPvOsdTpxfl7qYm905/mT5zL+HA YSAVscFu7GhsD1mRKy6MwZgWdQ== X-Received: by 2002:a5d:4949:: with SMTP id r9mr16425976wrs.289.1559899350160; Fri, 07 Jun 2019 02:22:30 -0700 (PDT) Received: from zen.linaroharston ([81.128.185.34]) by smtp.gmail.com with ESMTPSA id p190sm1254631wmp.48.2019.06.07.02.22.26 (version=TLS1_3 cipher=AEAD-AES256-GCM-SHA384 bits=256/256); Fri, 07 Jun 2019 02:22:27 -0700 (PDT) Received: from zen.linaroharston. (localhost [127.0.0.1]) by zen.linaroharston (Postfix) with ESMTP id 4C1BA1FFC0; Fri, 7 Jun 2019 10:05:55 +0100 (BST) From: =?utf-8?q?Alex_Benn=C3=A9e?= To: peter.maydell@linaro.org Date: Fri, 7 Jun 2019 10:05:40 +0100 Message-Id: <20190607090552.12434-42-alex.bennee@linaro.org> X-Mailer: git-send-email 2.20.1 In-Reply-To: <20190607090552.12434-1-alex.bennee@linaro.org> References: <20190607090552.12434-1-alex.bennee@linaro.org> MIME-Version: 1.0 X-detected-operating-system: by eggs.gnu.org: Genre and OS details not recognized. X-Received-From: 2a00:1450:4864:20::435 Subject: [Qemu-devel] [PULL 41/52] gdbstub: Implement get register (p pkt) with new infra 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, Jon Doron Errors-To: qemu-devel-bounces+patch=linaro.org@nongnu.org Sender: "Qemu-devel" From: Jon Doron Signed-off-by: Jon Doron Message-Id: <20190529064148.19856-10-arilou@gmail.com> Signed-off-by: Alex Bennée -- 2.20.1 diff --git a/gdbstub.c b/gdbstub.c index 630f931765..63809b2ab9 100644 --- a/gdbstub.c +++ b/gdbstub.c @@ -1672,6 +1672,36 @@ static void handle_set_reg(GdbCmdContext *gdb_ctx, void *user_ctx) put_packet(gdb_ctx->s, "OK"); } +static void handle_get_reg(GdbCmdContext *gdb_ctx, void *user_ctx) +{ + int reg_size; + + /* + * Older gdb are really dumb, and don't use 'g' if 'p' is avaialable. + * This works, but can be very slow. Anything new enough to + * understand XML also knows how to use this properly. + */ + if (!gdb_has_xml) { + put_packet(gdb_ctx->s, ""); + return; + } + + if (!gdb_ctx->num_params) { + put_packet(gdb_ctx->s, "E14"); + return; + } + + reg_size = gdb_read_register(gdb_ctx->s->g_cpu, gdb_ctx->mem_buf, + gdb_ctx->params[0].val_ull); + if (!reg_size) { + put_packet(gdb_ctx->s, "E14"); + return; + } + + memtohex(gdb_ctx->str_buf, gdb_ctx->mem_buf, reg_size); + put_packet(gdb_ctx->s, gdb_ctx->str_buf); +} + static int gdb_handle_packet(GDBState *s, const char *line_buf) { CPUState *cpu; @@ -1901,18 +1931,14 @@ static int gdb_handle_packet(GDBState *s, const char *line_buf) } break; case 'p': - /* Older gdb are really dumb, and don't use 'g' if 'p' is avaialable. - This works, but can be very slow. Anything new enough to - understand XML also knows how to use this properly. */ - if (!gdb_has_xml) - goto unknown_command; - addr = strtoull(p, (char **)&p, 16); - reg_size = gdb_read_register(s->g_cpu, mem_buf, addr); - if (reg_size) { - memtohex(buf, mem_buf, reg_size); - put_packet(s, buf); - } else { - put_packet(s, "E14"); + { + static const GdbCmdParseEntry get_reg_cmd_desc = { + .handler = handle_get_reg, + .cmd = "p", + .cmd_startswith = 1, + .schema = "L0" + }; + cmd_parser = &get_reg_cmd_desc; } break; case 'P': From patchwork Fri Jun 7 09:05:41 2019 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 8bit X-Patchwork-Submitter: =?utf-8?q?Alex_Benn=C3=A9e?= X-Patchwork-Id: 166102 Delivered-To: patch@linaro.org Received: by 2002:a92:9e1a:0:0:0:0:0 with SMTP id q26csp414576ili; Fri, 7 Jun 2019 02:48:35 -0700 (PDT) X-Google-Smtp-Source: APXvYqxJrdXtbvPR8YAyj1C3WYZMxGX1mQ9Qhm9noxV767QehM1UhCnGayCiH6Nkx5vlYrqWlROk X-Received: by 2002:ac8:34c5:: with SMTP id x5mr35915162qtb.91.1559900915027; Fri, 07 Jun 2019 02:48:35 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1559900915; cv=none; d=google.com; s=arc-20160816; b=Jqk4qtyM97yTDaNF7iqb6Th28QYSbHi9ayRxQtuvFgqnlg+RD9ShrkWtc7tX/BQzZj /cuwgn3CBE3pHdg9mHZ10eTFZ0ajsAYkpmop1fv7cws6n7fK/YrIIyCBk5RCJBsctK3R tdEdsvTZaZk48Ayfw+BS5n7gJIyOxdnMgBKRWXRCiI7oJFvdFDk81cfxCJg5/fJpD/m9 deOgao1EiSZYDa7yztTRUn4j5+eO7y3FQgl9KLHLnYrsvWyl1hwvnF2E0j53EI5wJx4N qasK2OTpREfuBpslKrxIgBhY+KJoQQqxnAfnmAFA9V1qwD0MEhxDQLX2qTDeEfsjYGn1 kOHA== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=sender:errors-to:cc:list-subscribe:list-help:list-post:list-archive :list-unsubscribe:list-id:precedence:subject :content-transfer-encoding:mime-version:references:in-reply-to :message-id:date:to:from:dkim-signature; bh=8wBpPG2QSWocir6/2nFFz+iLLwOYsMTxKGDZ5nY+8mc=; b=WF4ZgAckipYXAfTCxCBZ9lpFUi3DqSnJZMYzrXdSzXtibVKGAmipj+Z4olekicQAzL jPt3U/Z4pDhFbEYs8Olxdp6Ou6nwx7xS2gDvg1yr1mYC7VrgATG/zkIwIU6P/WMbdSZL Q1rq54jJkJ+BDyhBaVbrg4fM5+EZry1/K03pBzQxxByuyZutoRcmxcAuxpBE7j/AqghZ oqDOWIW5mgIsMxJ03G2RwxMhHvqSwVSsjxrYV+rWxt2t/UM05mgZObe0DbHOscpGTup7 vP8fHjwGVGEINTXPzlfh6AkjvZKKmRvZZDXc4ix7zHKwx5GlSjTfF+NtpFWaYv9NN5tm KPgA== ARC-Authentication-Results: i=1; mx.google.com; dkim=fail header.i=@linaro.org header.s=google header.b=D0YkxFpd; spf=pass (google.com: domain of qemu-devel-bounces+patch=linaro.org@nongnu.org designates 209.51.188.47 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.47]) by mx.google.com with ESMTPS id k12si842069qvt.161.2019.06.07.02.48.34 for (version=TLS1_2 cipher=ECDHE-RSA-CHACHA20-POLY1305 bits=256/256); Fri, 07 Jun 2019 02:48:35 -0700 (PDT) Received-SPF: pass (google.com: domain of qemu-devel-bounces+patch=linaro.org@nongnu.org designates 209.51.188.47 as permitted sender) client-ip=209.51.188.47; Authentication-Results: mx.google.com; dkim=fail header.i=@linaro.org header.s=google header.b=D0YkxFpd; spf=pass (google.com: domain of qemu-devel-bounces+patch=linaro.org@nongnu.org designates 209.51.188.47 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]:47624 helo=lists.gnu.org) by lists.gnu.org with esmtp (Exim 4.86_2) (envelope-from ) id 1hZBUA-0005LH-GP for patch@linaro.org; Fri, 07 Jun 2019 05:48:34 -0400 Received: from eggs.gnu.org ([2001:470:142:3::10]:42102) by lists.gnu.org with esmtp (Exim 4.86_2) (envelope-from ) id 1hZAvQ-0002Bu-80 for qemu-devel@nongnu.org; Fri, 07 Jun 2019 05:12:43 -0400 Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71) (envelope-from ) id 1hZAvL-0004oH-VU for qemu-devel@nongnu.org; Fri, 07 Jun 2019 05:12:38 -0400 Received: from mail-wm1-x330.google.com ([2a00:1450:4864:20::330]:54139) by eggs.gnu.org with esmtps (TLS1.0:RSA_AES_128_CBC_SHA1:16) (Exim 4.71) (envelope-from ) id 1hZAvI-0004fx-7i for qemu-devel@nongnu.org; Fri, 07 Jun 2019 05:12:34 -0400 Received: by mail-wm1-x330.google.com with SMTP id x15so1233607wmj.3 for ; Fri, 07 Jun 2019 02:12:31 -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=8wBpPG2QSWocir6/2nFFz+iLLwOYsMTxKGDZ5nY+8mc=; b=D0YkxFpd9q8z8zKYTs9lUfAWsuyEf5AM0XbBfwROaurTBdkulw3LIkk1TnYT8nBFLO fZOmtrBYUpAoJHO23ODzUtSaHUky3bGY7wcIwIRRoRcRvyNJJW6x69W0OukndpZYjh9u Qipn1zIyOCz7X0V/goZgt0cyQODV4oBWOEywboz65JaLBuqFWA4ZtQgFQu1XqVHH8o4u PLALjz1JEuiqXPQO2irjvmmcSMDVF050A/yZK4kYKq2US/5HYJ0LbhgIVfZivfaSzRcm wTtsU35ll0AUlMpvsjxUMEdmPD2I0uTusr7iOwX5PRxI69UC9uSFh+jDKYxBd0XOdxE7 HBAQ== 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=8wBpPG2QSWocir6/2nFFz+iLLwOYsMTxKGDZ5nY+8mc=; b=LS1rCU8jAbU+EdZa584gHjkC4vBe78zatb6Pi1Yyi8Fkw75KbPbtJVWsCD2sLyRmEK 3yAUjm1w3Qdl6Ne5PJ0Ltu2NYNavOU6exUsdGCqn+hSuwq5C08itJQSPYYhlVgB5+UZv Ozl5jChlGsmpRPMWS8iUKhg4AmLFut5MQGyvsTTQn4a+Rn2Fr5gHfN60Rq+9MzV4IjSn XNR/0xHcrGxJu8Nl7kILpPmRK9vGkdfYg5QunXUWTmLRDzCUOYXqJHFdr3F/7Ev/21Xt XODb7PgU9LoUkkzaC1q+WTB9nE/q+9+Vh4L6/sBYwR7KILomsKO6kD6/PHk3hdWnyRRn PCDQ== X-Gm-Message-State: APjAAAVdwm7CGoOkMhOYX0kMT+/xqNysEMyymlRKsT/lwUHRxPzQs2IN KA5BGvzMEr/zyrXfvY+HGmpWVA== X-Received: by 2002:a1c:9e92:: with SMTP id h140mr2735211wme.82.1559898750189; Fri, 07 Jun 2019 02:12:30 -0700 (PDT) Received: from zen.linaroharston ([81.128.185.34]) by smtp.gmail.com with ESMTPSA id 34sm1732729wre.32.2019.06.07.02.12.26 (version=TLS1_3 cipher=AEAD-AES256-GCM-SHA384 bits=256/256); Fri, 07 Jun 2019 02:12:27 -0700 (PDT) Received: from zen.linaroharston. (localhost [127.0.0.1]) by zen.linaroharston (Postfix) with ESMTP id 5EA021FFC1; Fri, 7 Jun 2019 10:05:55 +0100 (BST) From: =?utf-8?q?Alex_Benn=C3=A9e?= To: peter.maydell@linaro.org Date: Fri, 7 Jun 2019 10:05:41 +0100 Message-Id: <20190607090552.12434-43-alex.bennee@linaro.org> X-Mailer: git-send-email 2.20.1 In-Reply-To: <20190607090552.12434-1-alex.bennee@linaro.org> References: <20190607090552.12434-1-alex.bennee@linaro.org> MIME-Version: 1.0 X-detected-operating-system: by eggs.gnu.org: Genre and OS details not recognized. X-Received-From: 2a00:1450:4864:20::330 Subject: [Qemu-devel] [PULL 42/52] gdbstub: Implement write memory (M pkt) with new infra 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, Jon Doron Errors-To: qemu-devel-bounces+patch=linaro.org@nongnu.org Sender: "Qemu-devel" From: Jon Doron Signed-off-by: Jon Doron Reviewed-by: Alex Bennée Message-Id: <20190529064148.19856-11-arilou@gmail.com> Signed-off-by: Alex Bennée -- 2.20.1 diff --git a/gdbstub.c b/gdbstub.c index 63809b2ab9..681a0c8550 100644 --- a/gdbstub.c +++ b/gdbstub.c @@ -1702,6 +1702,31 @@ static void handle_get_reg(GdbCmdContext *gdb_ctx, void *user_ctx) put_packet(gdb_ctx->s, gdb_ctx->str_buf); } +static void handle_write_mem(GdbCmdContext *gdb_ctx, void *user_ctx) +{ + if (gdb_ctx->num_params != 3) { + put_packet(gdb_ctx->s, "E22"); + return; + } + + /* hextomem() reads 2*len bytes */ + if (gdb_ctx->params[1].val_ull > strlen(gdb_ctx->params[2].data) / 2) { + put_packet(gdb_ctx->s, "E22"); + return; + } + + hextomem(gdb_ctx->mem_buf, gdb_ctx->params[2].data, + gdb_ctx->params[1].val_ull); + if (target_memory_rw_debug(gdb_ctx->s->g_cpu, gdb_ctx->params[0].val_ull, + gdb_ctx->mem_buf, + gdb_ctx->params[1].val_ull, true)) { + put_packet(gdb_ctx->s, "E14"); + return; + } + + put_packet(gdb_ctx->s, "OK"); +} + static int gdb_handle_packet(GDBState *s, const char *line_buf) { CPUState *cpu; @@ -1910,24 +1935,14 @@ static int gdb_handle_packet(GDBState *s, const char *line_buf) } break; case 'M': - addr = strtoull(p, (char **)&p, 16); - if (*p == ',') - p++; - len = strtoull(p, (char **)&p, 16); - if (*p == ':') - p++; - - /* hextomem() reads 2*len bytes */ - if (len > strlen(p) / 2) { - put_packet (s, "E22"); - break; - } - hextomem(mem_buf, p, len); - if (target_memory_rw_debug(s->g_cpu, addr, mem_buf, len, - true) != 0) { - put_packet(s, "E14"); - } else { - put_packet(s, "OK"); + { + static const GdbCmdParseEntry write_mem_cmd_desc = { + .handler = handle_write_mem, + .cmd = "M", + .cmd_startswith = 1, + .schema = "L,L:s0" + }; + cmd_parser = &write_mem_cmd_desc; } break; case 'p': From patchwork Fri Jun 7 09:05:42 2019 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 8bit X-Patchwork-Submitter: =?utf-8?q?Alex_Benn=C3=A9e?= X-Patchwork-Id: 166107 Delivered-To: patch@linaro.org Received: by 2002:a92:9e1a:0:0:0:0:0 with SMTP id q26csp417531ili; Fri, 7 Jun 2019 02:52:18 -0700 (PDT) X-Google-Smtp-Source: APXvYqyDblvnp5KNZDWN4I/EtHqoT+LXe5u6rrd8LRtZqq4o+gfs9pAail7erln/+oz8jmRfeJIq X-Received: by 2002:a0c:b659:: with SMTP id q25mr41429032qvf.29.1559901138919; Fri, 07 Jun 2019 02:52:18 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1559901138; cv=none; d=google.com; s=arc-20160816; b=F498MThJkMVn8mOga1MgV0cNZGRWkJRz7LdgGCZxTC7EZWK5FFGnqMFGxChISo/LZ2 pzWlkrTronQ2sp96pa9rlYD1Y3oyICM85uKL0jpi4eWeSnlcKO1Dmhg7abtPC8BeDpLg WNH+5+47zvw7VncVqPJYIesqp5C09mofZj7ZGZhLwn93t6O5G3GhtqsYSRGbVsxNdMwE LmzzlMxYE1fHJeFjC6IrfS/FUOxBwFFdRZrIU8CykjHMrVZQM5RzsfvFyK7IpfOCaMyw GZ7af1lszakBUrO25tcCoGJ43qu0Pgwhh6qPNQ+z2H+sm6kelj/rk+c0J3/K4oUX4q2D OzyA== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=sender:errors-to:cc:list-subscribe:list-help:list-post:list-archive :list-unsubscribe:list-id:precedence:subject :content-transfer-encoding:mime-version:references:in-reply-to :message-id:date:to:from:dkim-signature; bh=HpSzE7CRb/eTzWpNX5jhhMANtC+sz7VcxjFAzL6p7RU=; b=QRqOfdTBDQcW4YVn2/UCDT6LCh2IgV/am0IcLt2HnvxE3XYW4uQyM+dD4ej10vtRmx M8Y9oywbvS5sz2aA45mr4fDcZ2PloarpEvo8gOrfD6jUBMTaSY0lTGx0GGKaNdhsnLDn zldNsvWewcX9PcovN4NqLrf87BfmPB1pHNniiEbUhiLFmRu2pYTkjR4rwkbZ93NM7vMO po2CAqgAiEmmpOok2mfBJHl/wQAgYtAua9Ho3b70UHnKEqk9wuvnuf4YEyax+0cC8oAc uXsts+nkF/xFzw57tPgBO4AVWRcAgY3ff4c0FkKYTFHEYEFqaB37txVl8t5UyCB9h5tb CSeA== ARC-Authentication-Results: i=1; mx.google.com; dkim=fail header.i=@linaro.org header.s=google header.b=EMXahHkm; spf=pass (google.com: domain of qemu-devel-bounces+patch=linaro.org@nongnu.org designates 209.51.188.47 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.47]) by mx.google.com with ESMTPS id k14si827276qkg.36.2019.06.07.02.52.18 for (version=TLS1_2 cipher=ECDHE-RSA-CHACHA20-POLY1305 bits=256/256); Fri, 07 Jun 2019 02:52:18 -0700 (PDT) Received-SPF: pass (google.com: domain of qemu-devel-bounces+patch=linaro.org@nongnu.org designates 209.51.188.47 as permitted sender) client-ip=209.51.188.47; Authentication-Results: mx.google.com; dkim=fail header.i=@linaro.org header.s=google header.b=EMXahHkm; spf=pass (google.com: domain of qemu-devel-bounces+patch=linaro.org@nongnu.org designates 209.51.188.47 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]:47658 helo=lists.gnu.org) by lists.gnu.org with esmtp (Exim 4.86_2) (envelope-from ) id 1hZBXm-0000Xb-GP for patch@linaro.org; Fri, 07 Jun 2019 05:52:18 -0400 Received: from eggs.gnu.org ([2001:470:142:3::10]:42213) by lists.gnu.org with esmtp (Exim 4.86_2) (envelope-from ) id 1hZAvT-0002Fj-CU for qemu-devel@nongnu.org; Fri, 07 Jun 2019 05:12:45 -0400 Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71) (envelope-from ) id 1hZAvQ-0004yK-H9 for qemu-devel@nongnu.org; Fri, 07 Jun 2019 05:12:43 -0400 Received: from mail-wr1-x42a.google.com ([2a00:1450:4864:20::42a]:37478) by eggs.gnu.org with esmtps (TLS1.0:RSA_AES_128_CBC_SHA1:16) (Exim 4.71) (envelope-from ) id 1hZAvQ-0004u1-8R for qemu-devel@nongnu.org; Fri, 07 Jun 2019 05:12:40 -0400 Received: by mail-wr1-x42a.google.com with SMTP id v14so1370430wrr.4 for ; Fri, 07 Jun 2019 02:12: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=HpSzE7CRb/eTzWpNX5jhhMANtC+sz7VcxjFAzL6p7RU=; b=EMXahHkm/lYzmnDZ4m+7jNA0Wckplr5O2W/TMPEy5U9x5UeyTxZKGMW6jCQvjD6syn u26n19W82p+tMxMG1xljUy2xVzJNkb5/8HVwwHgmCbgviJ7n3SjUxvYYeMGZYGsvIxAH Caxdcrs9ycDtl14FPmU7pV4pzne9/Hv36XkDnp0djuebva7rPuxOs0B2bsAgqP4i+pjU 6HYAA+Fook6yGgfgccufNBEBMaaqyGipXAhcCEtKIMsHbdGVEphCMi5Vw4GtdkjjafvY n1LrC2cIjVx6MeRzOlqd2nD50Tx+JDiI3fmreDCCaLDH8eiFWH3L0nH4s3b8p7jW4ozn 2Erw== 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=HpSzE7CRb/eTzWpNX5jhhMANtC+sz7VcxjFAzL6p7RU=; b=hJHFkH3w/mWPSkejfg8rFCs3i59qCGIyVYL0g5r11Plt+7GNPKnVpkdHcpiMNqJ/6b u8OIpcHXLYzYAl94ksPacTs7abl+aHxVG9nK03ydrHAk7+VQGE0+yKZJWKsMboQBI2kS pOjb04wsxReOwqDTIv2AEg1ZQ07Ak90RrChQzAnrYVZcrsRNxz3Xp14bIjIWN8yyDRYN hI87mYY/gvJDpW6jmT17lhL5tuhbP7wFVMnP5OFXKGCzB4ONlipbqGwUvCR1HxQPXuDl W4lLqkryccA2jggx1346ELiUcP8mdMitISm3hWaHY0F+g29jVq8nN59ZkrtRXgZXolNg TxIA== X-Gm-Message-State: APjAAAVwtZx1Ky3GXUsCC8E6rdwfyACnRb2RslNPpO6tnAExabCem2Qk Tch1h6bph3j5pHMIlvdVZv0/xQ== X-Received: by 2002:a5d:638e:: with SMTP id p14mr3203837wru.238.1559898758476; Fri, 07 Jun 2019 02:12:38 -0700 (PDT) Received: from zen.linaroharston ([81.128.185.34]) by smtp.gmail.com with ESMTPSA id u205sm1279667wmu.47.2019.06.07.02.12.32 (version=TLS1_3 cipher=AEAD-AES256-GCM-SHA384 bits=256/256); Fri, 07 Jun 2019 02:12:36 -0700 (PDT) Received: from zen.linaroharston. (localhost [127.0.0.1]) by zen.linaroharston (Postfix) with ESMTP id 713591FFC2; Fri, 7 Jun 2019 10:05:55 +0100 (BST) From: =?utf-8?q?Alex_Benn=C3=A9e?= To: peter.maydell@linaro.org Date: Fri, 7 Jun 2019 10:05:42 +0100 Message-Id: <20190607090552.12434-44-alex.bennee@linaro.org> X-Mailer: git-send-email 2.20.1 In-Reply-To: <20190607090552.12434-1-alex.bennee@linaro.org> References: <20190607090552.12434-1-alex.bennee@linaro.org> MIME-Version: 1.0 X-detected-operating-system: by eggs.gnu.org: Genre and OS details not recognized. X-Received-From: 2a00:1450:4864:20::42a Subject: [Qemu-devel] [PULL 43/52] gdbstub: Implement read memory (m pkt) with new infra 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, Jon Doron Errors-To: qemu-devel-bounces+patch=linaro.org@nongnu.org Sender: "Qemu-devel" From: Jon Doron Signed-off-by: Jon Doron Reviewed-by: Alex Bennée Message-Id: <20190529064148.19856-12-arilou@gmail.com> Signed-off-by: Alex Bennée -- 2.20.1 diff --git a/gdbstub.c b/gdbstub.c index 681a0c8550..ceaa47d184 100644 --- a/gdbstub.c +++ b/gdbstub.c @@ -1727,6 +1727,30 @@ static void handle_write_mem(GdbCmdContext *gdb_ctx, void *user_ctx) put_packet(gdb_ctx->s, "OK"); } +static void handle_read_mem(GdbCmdContext *gdb_ctx, void *user_ctx) +{ + if (gdb_ctx->num_params != 2) { + put_packet(gdb_ctx->s, "E22"); + return; + } + + /* memtohex() doubles the required space */ + if (gdb_ctx->params[1].val_ull > MAX_PACKET_LENGTH / 2) { + put_packet(gdb_ctx->s, "E22"); + return; + } + + if (target_memory_rw_debug(gdb_ctx->s->g_cpu, gdb_ctx->params[0].val_ull, + gdb_ctx->mem_buf, + gdb_ctx->params[1].val_ull, false)) { + put_packet(gdb_ctx->s, "E14"); + return; + } + + memtohex(gdb_ctx->str_buf, gdb_ctx->mem_buf, gdb_ctx->params[1].val_ull); + put_packet(gdb_ctx->s, gdb_ctx->str_buf); +} + static int gdb_handle_packet(GDBState *s, const char *line_buf) { CPUState *cpu; @@ -1916,22 +1940,14 @@ static int gdb_handle_packet(GDBState *s, const char *line_buf) put_packet(s, "OK"); break; case 'm': - addr = strtoull(p, (char **)&p, 16); - if (*p == ',') - p++; - len = strtoull(p, NULL, 16); - - /* memtohex() doubles the required space */ - if (len > MAX_PACKET_LENGTH / 2) { - put_packet (s, "E22"); - break; - } - - if (target_memory_rw_debug(s->g_cpu, addr, mem_buf, len, false) != 0) { - put_packet (s, "E14"); - } else { - memtohex(buf, mem_buf, len); - put_packet(s, buf); + { + static const GdbCmdParseEntry read_mem_cmd_desc = { + .handler = handle_read_mem, + .cmd = "m", + .cmd_startswith = 1, + .schema = "L,L0" + }; + cmd_parser = &read_mem_cmd_desc; } break; case 'M': From patchwork Fri Jun 7 09:05:43 2019 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 8bit X-Patchwork-Submitter: =?utf-8?q?Alex_Benn=C3=A9e?= X-Patchwork-Id: 166114 Delivered-To: patch@linaro.org Received: by 2002:a92:9e1a:0:0:0:0:0 with SMTP id q26csp429632ili; Fri, 7 Jun 2019 03:04:54 -0700 (PDT) X-Google-Smtp-Source: APXvYqzE1dybvjONL+SrzjfSsq3UpE3rjdiRu1JEwGHGsjk20qpzAPMRFFWhC/01xx9cIlbQbyeF X-Received: by 2002:a0c:d91b:: with SMTP id p27mr27015501qvj.236.1559901894180; Fri, 07 Jun 2019 03:04:54 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1559901894; cv=none; d=google.com; s=arc-20160816; b=WkXeunU0y/QaMsyFEOQSikYqHKEF3ZyhrZ0uI3osKwaV+UrEbjlaaxiWn5BIOPL2jF 76XZcyw2nwA8l5SyoMQnsE8Ge7U+IuEVCTDHpodLQ76p+re8WmQmcEOnD/FKjZ1PD59g SGFU9SQci2M7Vmc0ya10YFMFkOSNA2aGE6+RTY/Y4a0faOoGAIuryssPiBBYEKVDGsHc e5BSx1OU9pucy2OLeZMa5Qd/iVI4PMZY6BBXZ+Rj5QWRkjV0UdDaKK0xCV5nmswKOeXN UZeaeNhy40fM2PsQOf0GM1sFqtDOyDg6vfTk0sqwuQzzSbs7E/Ns5lI4SO73NCNVFDx/ oFJA== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=sender:errors-to:cc:list-subscribe:list-help:list-post:list-archive :list-unsubscribe:list-id:precedence:subject :content-transfer-encoding:mime-version:references:in-reply-to :message-id:date:to:from:dkim-signature; bh=IdumfQ3u3Nl836FqdxSsx6BT98OtMa92VXr8v3RCJYs=; b=Ov1JNPp0cwi9KoFdVTgNAbP/KneasPJeftNQx5WtrgqohO7T9oG+2KzjZbla3uC8jF pi8qaEK+0r/cZWEYzB6PKvCpQmztYfbyyBqoYwB9SB2wAWtlBLSo4PCc229fFQg2o6Jc 6GvhNqXLwztPq9GIOBDkif3auE3X1YV+4Ukn8+7ZrT3JhqCkpLhsP7ee5178886X5Nu4 OvMxGdMSTdQ8s8CFqs9Xoe4yhl08wd/3+VwVDGG120kXnrlqSRDCWBaogDu8oW1jlFct 4HcJlYEd87ZQXF2H3t++hdUhFtdpPIPYuXAi2YWadWXVxiSZo79kQl7mBxakHoAtKuRT mwAg== ARC-Authentication-Results: i=1; mx.google.com; dkim=fail header.i=@linaro.org header.s=google header.b=ST2Qu6Gn; spf=pass (google.com: domain of qemu-devel-bounces+patch=linaro.org@nongnu.org designates 209.51.188.47 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.47]) by mx.google.com with ESMTPS id e68si141585qkd.4.2019.06.07.03.04.53 for (version=TLS1_2 cipher=ECDHE-RSA-CHACHA20-POLY1305 bits=256/256); Fri, 07 Jun 2019 03:04:54 -0700 (PDT) Received-SPF: pass (google.com: domain of qemu-devel-bounces+patch=linaro.org@nongnu.org designates 209.51.188.47 as permitted sender) client-ip=209.51.188.47; Authentication-Results: mx.google.com; dkim=fail header.i=@linaro.org header.s=google header.b=ST2Qu6Gn; spf=pass (google.com: domain of qemu-devel-bounces+patch=linaro.org@nongnu.org designates 209.51.188.47 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]:47744 helo=lists.gnu.org) by lists.gnu.org with esmtp (Exim 4.86_2) (envelope-from ) id 1hZBjn-0002kk-VS for patch@linaro.org; Fri, 07 Jun 2019 06:04:50 -0400 Received: from eggs.gnu.org ([2001:470:142:3::10]:42204) by lists.gnu.org with esmtp (Exim 4.86_2) (envelope-from ) id 1hZAvT-0002Fb-Ad for qemu-devel@nongnu.org; Fri, 07 Jun 2019 05:12:45 -0400 Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71) (envelope-from ) id 1hZAvQ-0004zq-Us for qemu-devel@nongnu.org; Fri, 07 Jun 2019 05:12:43 -0400 Received: from mail-wr1-x436.google.com ([2a00:1450:4864:20::436]:42789) by eggs.gnu.org with esmtps (TLS1.0:RSA_AES_128_CBC_SHA1:16) (Exim 4.71) (envelope-from ) id 1hZAvQ-0004wN-LI for qemu-devel@nongnu.org; Fri, 07 Jun 2019 05:12:40 -0400 Received: by mail-wr1-x436.google.com with SMTP id x17so1355992wrl.9 for ; Fri, 07 Jun 2019 02:12: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=IdumfQ3u3Nl836FqdxSsx6BT98OtMa92VXr8v3RCJYs=; b=ST2Qu6Gn1Zt7sndEgUQGFFHhqh44jHqtPgmMJxkDS+tOMLAF+XkdboI9FiUq3eq7hq TmguoDZm0FZ37IORFjPILFWWVt+XuoITMLeckLJ2mhcfv6ZEPMizMEfw5rCqltIci5OL nsfE3ZhrhxAXvNVqkZVH1zK0vbLv3ULliBHPVfbQe9F9ABf7Fvu4ifr3h2X1yK5WMJAW f7rsujrXqX0d+ie4YpNblGoD2OSbSOOw5IbNfVyshtZXHFbq5qi9OuH4kHUDiYvDbX/N NkznSFTniT4THZTqjHYgATglcMN11UXC2qXfm/1gY3VIU5EZQU3hDsh0K2qfa35DUo1o MBdw== 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=IdumfQ3u3Nl836FqdxSsx6BT98OtMa92VXr8v3RCJYs=; b=kILc4BjO2yvbNy2sBhXCcvaQd/X/zVyZJzgullkW5Bm+si71d4DL+B6zpgnmYMMBoa DrU79hyZoYfdp+RcUYOc93Ul/alhFe2YZ+e+Iyv+PXQzkIGjGZ6Pa/sn6al7wrcLvBX8 jl3m9OAoLDBRIkxQ8SLabVnLLJ59PQ0LQn13vVb4s4onVMRw8QVc61ODY+3U2ujxoN73 2qf6cyijgFryNKBkSLTbcbgq/Q7U7NT7tBfHfI+T7udbIpxaYzyWjfU/vO2GSxDWqWND fs4BaW2Z+OuG7gtOUq4b4a2DYuoYqClYt3aoXsGnXdberXPSESBYZCZumgiDGcR2Co+8 N2fQ== X-Gm-Message-State: APjAAAXdDW7dezfMw1zjf5pZHMNMUB2pQmVQW037JggERP43cUKkUlcs pX/MPE4EYvISsLvgxGPxTo6wvA== X-Received: by 2002:adf:eb43:: with SMTP id u3mr19026914wrn.342.1559898759161; Fri, 07 Jun 2019 02:12:39 -0700 (PDT) Received: from zen.linaroharston ([81.128.185.34]) by smtp.gmail.com with ESMTPSA id f2sm2048681wrq.48.2019.06.07.02.12.32 (version=TLS1_3 cipher=AEAD-AES256-GCM-SHA384 bits=256/256); Fri, 07 Jun 2019 02:12:36 -0700 (PDT) Received: from zen.linaroharston. (localhost [127.0.0.1]) by zen.linaroharston (Postfix) with ESMTP id 83CDE1FFC3; Fri, 7 Jun 2019 10:05:55 +0100 (BST) From: =?utf-8?q?Alex_Benn=C3=A9e?= To: peter.maydell@linaro.org Date: Fri, 7 Jun 2019 10:05:43 +0100 Message-Id: <20190607090552.12434-45-alex.bennee@linaro.org> X-Mailer: git-send-email 2.20.1 In-Reply-To: <20190607090552.12434-1-alex.bennee@linaro.org> References: <20190607090552.12434-1-alex.bennee@linaro.org> MIME-Version: 1.0 X-detected-operating-system: by eggs.gnu.org: Genre and OS details not recognized. X-Received-From: 2a00:1450:4864:20::436 Subject: [Qemu-devel] [PULL 44/52] gdbstub: Implement write all registers (G pkt) with new infra 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, Jon Doron Errors-To: qemu-devel-bounces+patch=linaro.org@nongnu.org Sender: "Qemu-devel" From: Jon Doron Signed-off-by: Jon Doron Reviewed-by: Alex Bennée Message-Id: <20190529064148.19856-13-arilou@gmail.com> Signed-off-by: Alex Bennée -- 2.20.1 diff --git a/gdbstub.c b/gdbstub.c index ceaa47d184..880bbb469a 100644 --- a/gdbstub.c +++ b/gdbstub.c @@ -1751,6 +1751,29 @@ static void handle_read_mem(GdbCmdContext *gdb_ctx, void *user_ctx) put_packet(gdb_ctx->s, gdb_ctx->str_buf); } +static void handle_write_all_regs(GdbCmdContext *gdb_ctx, void *user_ctx) +{ + target_ulong addr, len; + uint8_t *registers; + int reg_size; + + if (!gdb_ctx->num_params) { + return; + } + + cpu_synchronize_state(gdb_ctx->s->g_cpu); + registers = gdb_ctx->mem_buf; + len = strlen(gdb_ctx->params[0].data) / 2; + hextomem(registers, gdb_ctx->params[0].data, len); + for (addr = 0; addr < gdb_ctx->s->g_cpu->gdb_num_g_regs && len > 0; + addr++) { + reg_size = gdb_write_register(gdb_ctx->s->g_cpu, registers, addr); + len -= reg_size; + registers += reg_size; + } + put_packet(gdb_ctx->s, "OK"); +} + static int gdb_handle_packet(GDBState *s, const char *line_buf) { CPUState *cpu; @@ -1762,7 +1785,6 @@ static int gdb_handle_packet(GDBState *s, const char *line_buf) uint8_t mem_buf[MAX_PACKET_LENGTH]; char buf[sizeof(mem_buf) + 1 /* trailing NUL */]; char thread_id[16]; - uint8_t *registers; target_ulong addr, len; const GdbCmdParseEntry *cmd_parser = NULL; @@ -1928,16 +1950,15 @@ static int gdb_handle_packet(GDBState *s, const char *line_buf) put_packet(s, buf); break; case 'G': - cpu_synchronize_state(s->g_cpu); - registers = mem_buf; - len = strlen(p) / 2; - hextomem((uint8_t *)registers, p, len); - for (addr = 0; addr < s->g_cpu->gdb_num_g_regs && len > 0; addr++) { - reg_size = gdb_write_register(s->g_cpu, registers, addr); - len -= reg_size; - registers += reg_size; + { + static const GdbCmdParseEntry write_all_regs_cmd_desc = { + .handler = handle_write_all_regs, + .cmd = "G", + .cmd_startswith = 1, + .schema = "s0" + }; + cmd_parser = &write_all_regs_cmd_desc; } - put_packet(s, "OK"); break; case 'm': { From patchwork Fri Jun 7 09:05:44 2019 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 8bit X-Patchwork-Submitter: =?utf-8?q?Alex_Benn=C3=A9e?= X-Patchwork-Id: 166109 Delivered-To: patch@linaro.org Received: by 2002:a92:9e1a:0:0:0:0:0 with SMTP id q26csp420633ili; Fri, 7 Jun 2019 02:56:11 -0700 (PDT) X-Google-Smtp-Source: APXvYqxsaF9TdIA4MqxllQ3mnFAo6h8K4BVTrwwmBHWgpFXYyPzYNdHlJIue9AcACirvVIG7vybm X-Received: by 2002:a0c:9d0e:: with SMTP id m14mr42252221qvf.121.1559901371732; Fri, 07 Jun 2019 02:56:11 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1559901371; cv=none; d=google.com; s=arc-20160816; b=SNhzleZRHVyvOgOlUyqLGBmO4t28ePfOGu2enqikIRHXHLq1C+gw9qPaK9yRdidoVl KUV+C1evachxY9DvxHNs/FzCP3zlTOI81UlswVK5Yi5RUr5MxxiX+j5Qo4AgxZLMxRVZ x2OkI9lyRqd+GRMCatqVXbFF5op3zx5RDAf+YbPAs/ELEO+EaZmTAIuxwfWOsNg44FMM 4K7dTkCtaE8c04M6WSMyDCDOtxjfPhG772SAZl7KmrnTRplh1gGsB5RFvmX5kpSTzjSM ahk3xoXFV/QPCaeFnKdvyUh21gGnPead7Gee+zH6gMxTeRUzjGTlYFSM4yqPZd6rbMbP jPTg== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=sender:errors-to:cc:list-subscribe:list-help:list-post:list-archive :list-unsubscribe:list-id:precedence:subject :content-transfer-encoding:mime-version:references:in-reply-to :message-id:date:to:from:dkim-signature; bh=mKQZU6ogd55Zge5HtRJs79TkvuWBYPKwIchB5EdBCmo=; b=ESE3GlI6hhy0Z6jZoHpABeZNpTRp22aKDneuUDzGk8VBSLIxc1L5E2qePYooBUVrRm 5bCgrIHijtv0gtnAaPbxy4/Fsp5baWfLvkS5st3r69Tn2wG/eDbvgzqiIj/7JaR4Zauu Jv5c9Wrs4U1uE87YkSHj/Jdt0X7uG7X+GuJzoiLlmP7C5WOLBGKmfHugG2+3AAgVzTFT LStNYyKDnFOiD302suCYpFVvrwD5yGBsRs7RbEo+90B6aBKNqXSfNozJbHGAU3gyW9j9 ZkHxPWOIqlvOOsiCwmjqPhPsvkbKBTJP7xlCbeHluQ7pEGe9w6LZ4f9694W96YfzgRqH 3etQ== ARC-Authentication-Results: i=1; mx.google.com; dkim=fail header.i=@linaro.org header.s=google header.b=Qggzb5Od; spf=pass (google.com: domain of qemu-devel-bounces+patch=linaro.org@nongnu.org designates 209.51.188.47 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.47]) by mx.google.com with ESMTPS id y18si898975qtn.379.2019.06.07.02.56.11 for (version=TLS1_2 cipher=ECDHE-RSA-CHACHA20-POLY1305 bits=256/256); Fri, 07 Jun 2019 02:56:11 -0700 (PDT) Received-SPF: pass (google.com: domain of qemu-devel-bounces+patch=linaro.org@nongnu.org designates 209.51.188.47 as permitted sender) client-ip=209.51.188.47; Authentication-Results: mx.google.com; dkim=fail header.i=@linaro.org header.s=google header.b=Qggzb5Od; spf=pass (google.com: domain of qemu-devel-bounces+patch=linaro.org@nongnu.org designates 209.51.188.47 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]:47684 helo=lists.gnu.org) by lists.gnu.org with esmtp (Exim 4.86_2) (envelope-from ) id 1hZBbX-0004S7-AS for patch@linaro.org; Fri, 07 Jun 2019 05:56:11 -0400 Received: from eggs.gnu.org ([2001:470:142:3::10]:42067) by lists.gnu.org with esmtp (Exim 4.86_2) (envelope-from ) id 1hZAvK-000299-97 for qemu-devel@nongnu.org; Fri, 07 Jun 2019 05:12:36 -0400 Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71) (envelope-from ) id 1hZAvI-0004iS-AJ for qemu-devel@nongnu.org; Fri, 07 Jun 2019 05:12:34 -0400 Received: from mail-wm1-x32d.google.com ([2a00:1450:4864:20::32d]:54136) by eggs.gnu.org with esmtps (TLS1.0:RSA_AES_128_CBC_SHA1:16) (Exim 4.71) (envelope-from ) id 1hZAvG-0004d1-95 for qemu-devel@nongnu.org; Fri, 07 Jun 2019 05:12:32 -0400 Received: by mail-wm1-x32d.google.com with SMTP id x15so1233511wmj.3 for ; Fri, 07 Jun 2019 02:12:29 -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=mKQZU6ogd55Zge5HtRJs79TkvuWBYPKwIchB5EdBCmo=; b=Qggzb5Od3/dWyGwkOoAh+qFgw4boIabzrgi9tfJPj66CYfhxl06rxENpdMtso65NC7 4U1xufQH6hwR7vvZ0l7q01PAgdeNS6enF5kxDgvxO2+fYDn9ofvxMu35L7JREP1FNpO2 RAokO4pYNoF3003yCqNVnbLTelpOWqDISmuIbKG4uSda9vUU9kM+io3WQcNrU9CS+T61 r6xdsCMRtEullg+OsBTcbNA0ZhLo72rJzY4mEM9ZLF8D1Y/JkOWRsmkftCn80WFf47dj 1GxAsNTfJKMil9GWVy7MNlG8dH3yYTUoWhi/cJ3xjUMoppsZ18qVtfrT1t9UGIE4OvLE 9kYw== 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=mKQZU6ogd55Zge5HtRJs79TkvuWBYPKwIchB5EdBCmo=; b=K7czF6djdFPvjBg8BMSbEsd3haSK5ITDkcyWEUOkcLU3XNRpzrIx+KUl721mJsqEpq D4tXjqoMNYnY0zCtV4cVAKg/tcAWgTxM7KGB8zKOXGXcCte1b/GMZYoYv/6dh25QXgBM D3LTS8QlIrP2Qot4mlaE1/1P/vPFXETDaPKFP5+KbEJ5lJVA32ll9LQbMlCGpTfzxwD7 NB2SyEAuMQD0LwzUOQLy6/d7yQ6/qvxRbwwlvNZoJMs9PPPL5UeIPRygKIl+4syNviex AiYqy0fFYsCoY3KizIxsnSPQ1HIPj/tp+Qyt25JIvB8bPAd8Lzaopg/1iMWLKDx13cEE YC4A== X-Gm-Message-State: APjAAAV3oiPhW9nrEC2bAfxNT313xkpPUru9gZORD85uwKxlPSzdPkD1 SqkZaXzP6w7mictRH9JgggfRaw== X-Received: by 2002:a7b:cbcb:: with SMTP id n11mr2788771wmi.146.1559898748529; Fri, 07 Jun 2019 02:12:28 -0700 (PDT) Received: from zen.linaroharston ([81.128.185.34]) by smtp.gmail.com with ESMTPSA id x8sm1348899wmc.5.2019.06.07.02.12.26 (version=TLS1_3 cipher=AEAD-AES256-GCM-SHA384 bits=256/256); Fri, 07 Jun 2019 02:12:27 -0700 (PDT) Received: from zen.linaroharston. (localhost [127.0.0.1]) by zen.linaroharston (Postfix) with ESMTP id 964161FFC4; Fri, 7 Jun 2019 10:05:55 +0100 (BST) From: =?utf-8?q?Alex_Benn=C3=A9e?= To: peter.maydell@linaro.org Date: Fri, 7 Jun 2019 10:05:44 +0100 Message-Id: <20190607090552.12434-46-alex.bennee@linaro.org> X-Mailer: git-send-email 2.20.1 In-Reply-To: <20190607090552.12434-1-alex.bennee@linaro.org> References: <20190607090552.12434-1-alex.bennee@linaro.org> MIME-Version: 1.0 X-detected-operating-system: by eggs.gnu.org: Genre and OS details not recognized. X-Received-From: 2a00:1450:4864:20::32d Subject: [Qemu-devel] [PULL 45/52] gdbstub: Implement read all registers (g pkt) with new infra 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, Jon Doron Errors-To: qemu-devel-bounces+patch=linaro.org@nongnu.org Sender: "Qemu-devel" From: Jon Doron Signed-off-by: Jon Doron Reviewed-by: Alex Bennée Message-Id: <20190529064148.19856-14-arilou@gmail.com> Signed-off-by: Alex Bennée -- 2.20.1 diff --git a/gdbstub.c b/gdbstub.c index 880bbb469a..b3c5ced80d 100644 --- a/gdbstub.c +++ b/gdbstub.c @@ -1774,6 +1774,21 @@ static void handle_write_all_regs(GdbCmdContext *gdb_ctx, void *user_ctx) put_packet(gdb_ctx->s, "OK"); } +static void handle_read_all_regs(GdbCmdContext *gdb_ctx, void *user_ctx) +{ + target_ulong addr, len; + + cpu_synchronize_state(gdb_ctx->s->g_cpu); + len = 0; + for (addr = 0; addr < gdb_ctx->s->g_cpu->gdb_num_g_regs; addr++) { + len += gdb_read_register(gdb_ctx->s->g_cpu, gdb_ctx->mem_buf + len, + addr); + } + + memtohex(gdb_ctx->str_buf, gdb_ctx->mem_buf, len); + put_packet(gdb_ctx->s, gdb_ctx->str_buf); +} + static int gdb_handle_packet(GDBState *s, const char *line_buf) { CPUState *cpu; @@ -1781,7 +1796,7 @@ static int gdb_handle_packet(GDBState *s, const char *line_buf) CPUClass *cc; const char *p; uint32_t pid, tid; - int ch, reg_size, type, res; + int ch, type, res; uint8_t mem_buf[MAX_PACKET_LENGTH]; char buf[sizeof(mem_buf) + 1 /* trailing NUL */]; char thread_id[16]; @@ -1940,14 +1955,14 @@ static int gdb_handle_packet(GDBState *s, const char *line_buf) } break; case 'g': - cpu_synchronize_state(s->g_cpu); - len = 0; - for (addr = 0; addr < s->g_cpu->gdb_num_g_regs; addr++) { - reg_size = gdb_read_register(s->g_cpu, mem_buf + len, addr); - len += reg_size; + { + static const GdbCmdParseEntry read_all_regs_cmd_desc = { + .handler = handle_read_all_regs, + .cmd = "g", + .cmd_startswith = 1 + }; + cmd_parser = &read_all_regs_cmd_desc; } - memtohex(buf, mem_buf, len); - put_packet(s, buf); break; case 'G': { From patchwork Fri Jun 7 09:05:45 2019 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 8bit X-Patchwork-Submitter: =?utf-8?q?Alex_Benn=C3=A9e?= X-Patchwork-Id: 166131 Delivered-To: patch@linaro.org Received: by 2002:a92:9e1a:0:0:0:0:0 with SMTP id q26csp449886ili; Fri, 7 Jun 2019 03:24:08 -0700 (PDT) X-Google-Smtp-Source: APXvYqyz1KSOSerAWgjq9d0L7lQrt0BOVODOLX3uUKJXVzOBAb/3O/z/T+JW3tM/wO5Ikks2Rf+a X-Received: by 2002:a37:6652:: with SMTP id a79mr24302813qkc.60.1559903048807; Fri, 07 Jun 2019 03:24:08 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1559903048; cv=none; d=google.com; s=arc-20160816; b=r88zfLxxZ/kuf1hC0JChDzi7fdhxUr5IIQ5DdnVGrXewcWH22+ThDs+4XYA09EvruP 75N/xWZyv5bToVpRee6aDbblp3EpZYYAAlxgI4Rnvf+Yky57rfXhbluy4hAizZS8Cc0i wZts1rQHIndLFndrxS1VIFI/580BEodSlXjZ/LLfG0jSNq153KlbASFLAspjb9v7YQFo gdCuKmxvobWAFNDT9sdL8JzmYYOYKGb40Ngws0CpSo4/95gnDmgpqzpsZeNAXV84fSa6 iIW2iK4OBDbA+bmhjVUz5PIO2mTyUCMBFMM05MO4Bnkb/93N3Wcwaqrmb3eYK0lOZfjv NE3Q== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=sender:errors-to:cc:list-subscribe:list-help:list-post:list-archive :list-unsubscribe:list-id:precedence:subject :content-transfer-encoding:mime-version:references:in-reply-to :message-id:date:to:from:dkim-signature; bh=Gr42vRKrUtGXl0PC7wlu1Mzbd+6iYUnnF6QdAndqlX8=; b=Qq7brN1QtILr9YW5KT2wPJqYSUc9mrqaifmFAEfONsTBdAfrlZs9mme2Ig7KwPf28U TnJl7daKRB9eG5P42DYLZMGHzNnc2vAa4NOKe7hk0xHdAtZrVx2T8oRH5QtHry5kYQ0n nUVfIix9tjfgQMrNToVV0dDjJqkwXL6byEl03DJuSLexr9nxtN9RRYsdbDhRR7kbCJo1 g/XH/MLsTn80Ko8mNaaOZyhaNc6U5WdEGJK54BoV733KUx1BiWbUy1oeq114+WN295AR Umyy5+8jeNi0ImTiZEk2f3dpwOAk0uhvD9mz3SdnbahSVdLIZ+Q8citF0w8r+Tx8a5vl VHrg== ARC-Authentication-Results: i=1; mx.google.com; dkim=fail header.i=@linaro.org header.s=google header.b=d5DsfHhz; spf=pass (google.com: domain of qemu-devel-bounces+patch=linaro.org@nongnu.org designates 209.51.188.47 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.47]) by mx.google.com with ESMTPS id o67si925722qkc.224.2019.06.07.03.24.08 for (version=TLS1_2 cipher=ECDHE-RSA-CHACHA20-POLY1305 bits=256/256); Fri, 07 Jun 2019 03:24:08 -0700 (PDT) Received-SPF: pass (google.com: domain of qemu-devel-bounces+patch=linaro.org@nongnu.org designates 209.51.188.47 as permitted sender) client-ip=209.51.188.47; Authentication-Results: mx.google.com; dkim=fail header.i=@linaro.org header.s=google header.b=d5DsfHhz; spf=pass (google.com: domain of qemu-devel-bounces+patch=linaro.org@nongnu.org designates 209.51.188.47 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]:47984 helo=lists.gnu.org) by lists.gnu.org with esmtp (Exim 4.86_2) (envelope-from ) id 1hZC2a-0001hK-EF for patch@linaro.org; Fri, 07 Jun 2019 06:24:08 -0400 Received: from eggs.gnu.org ([2001:470:142:3::10]:44993) by lists.gnu.org with esmtp (Exim 4.86_2) (envelope-from ) id 1hZB50-00088e-LP for qemu-devel@nongnu.org; Fri, 07 Jun 2019 05:22:35 -0400 Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71) (envelope-from ) id 1hZB4z-0005rQ-E6 for qemu-devel@nongnu.org; Fri, 07 Jun 2019 05:22:34 -0400 Received: from mail-wm1-x330.google.com ([2a00:1450:4864:20::330]:54227) by eggs.gnu.org with esmtps (TLS1.0:RSA_AES_128_CBC_SHA1:16) (Exim 4.71) (envelope-from ) id 1hZB4z-0005pc-7z for qemu-devel@nongnu.org; Fri, 07 Jun 2019 05:22:33 -0400 Received: by mail-wm1-x330.google.com with SMTP id x15so1269377wmj.3 for ; Fri, 07 Jun 2019 02:22:33 -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=Gr42vRKrUtGXl0PC7wlu1Mzbd+6iYUnnF6QdAndqlX8=; b=d5DsfHhzjtaYyKNtHVkGf4bnxjwVq0P5yRswjrck/XRMWVAYDPbbLpQBkQpYdRLH7k QH2U1DVVNtsEG11zrz6foyBSgOPhsWBqSHoAIZTjSzWFyGXAgIKGGtkymKSnPDBro/Zj fMFOKrO5lJPFMkfscpfnlfBzFVakQVpLRXIeArUUVC4poiht+owWAjTP1oSqknpNERpc ZW6EKhqJy7XS3zdhYNPr/p9+fXX2BTWM8eg70gmwYS6ghXWrtsrcbdDeFEO2qNhQMRc5 Xji7OxADG7OORLOCYhQ3Dp6SYMqg1PMz/zQ1vDCB7FwuoFsjn6ftTMeIV3d4P9Wl9Tiz vg1Q== 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=Gr42vRKrUtGXl0PC7wlu1Mzbd+6iYUnnF6QdAndqlX8=; b=PeAE3+r8x8LduxKAI0Pe8w0CCl65Jt2up/nepHOzgynMu5+Yyld7srLreDPvqCFy1v L52rYbFicD5C3skHAaDzgGNZQts7GxzzfLSVun+z234UBq39OtphiEK8+n2V+TDHyBgd mymIflxnDs39/k3YZrUSFCsz/c2oBvXdTv/x2rGmm0ZwVr9MXcBd8sTzfj8U0/qZZklL 4QCKqag8dCtcsnayRlhQpf+RBceY22v5SbsjchkJ2SoLjtFtoWYgNo8rMQeDgSL8XwpN iWFYwcZb2QYutyt9Ec0GkroHTiyixVPmuwbZKatcCZDkLeYs8oz1s6xZRbX6p2xBRM6P yhIA== X-Gm-Message-State: APjAAAVK7Kb4312w5lh0vN9OJvvSWGgD8oG3qWC7xnFOIMFe93/5m/Y9 KKisLvOmMsAjVVgzwNyOiZ8zwA== X-Received: by 2002:a7b:c5cd:: with SMTP id n13mr3085392wmk.67.1559899352168; Fri, 07 Jun 2019 02:22:32 -0700 (PDT) Received: from zen.linaroharston ([81.128.185.34]) by smtp.gmail.com with ESMTPSA id c12sm1223966wmb.1.2019.06.07.02.22.27 (version=TLS1_3 cipher=AEAD-AES256-GCM-SHA384 bits=256/256); Fri, 07 Jun 2019 02:22:30 -0700 (PDT) Received: from zen.linaroharston. (localhost [127.0.0.1]) by zen.linaroharston (Postfix) with ESMTP id A886A1FFC5; Fri, 7 Jun 2019 10:05:55 +0100 (BST) From: =?utf-8?q?Alex_Benn=C3=A9e?= To: peter.maydell@linaro.org Date: Fri, 7 Jun 2019 10:05:45 +0100 Message-Id: <20190607090552.12434-47-alex.bennee@linaro.org> X-Mailer: git-send-email 2.20.1 In-Reply-To: <20190607090552.12434-1-alex.bennee@linaro.org> References: <20190607090552.12434-1-alex.bennee@linaro.org> MIME-Version: 1.0 X-detected-operating-system: by eggs.gnu.org: Genre and OS details not recognized. X-Received-From: 2a00:1450:4864:20::330 Subject: [Qemu-devel] [PULL 46/52] gdbstub: Implement file io (F pkt) with new infra 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, Jon Doron Errors-To: qemu-devel-bounces+patch=linaro.org@nongnu.org Sender: "Qemu-devel" From: Jon Doron Signed-off-by: Jon Doron Message-Id: <20190529064148.19856-15-arilou@gmail.com> Signed-off-by: Alex Bennée -- 2.20.1 diff --git a/gdbstub.c b/gdbstub.c index b3c5ced80d..1871077cd7 100644 --- a/gdbstub.c +++ b/gdbstub.c @@ -1789,6 +1789,25 @@ static void handle_read_all_regs(GdbCmdContext *gdb_ctx, void *user_ctx) put_packet(gdb_ctx->s, gdb_ctx->str_buf); } +static void handle_file_io(GdbCmdContext *gdb_ctx, void *user_ctx) +{ + if (gdb_ctx->num_params >= 2 && gdb_ctx->s->current_syscall_cb) { + target_ulong ret, err; + + ret = (target_ulong)gdb_ctx->params[0].val_ull; + err = (target_ulong)gdb_ctx->params[1].val_ull; + gdb_ctx->s->current_syscall_cb(gdb_ctx->s->c_cpu, ret, err); + gdb_ctx->s->current_syscall_cb = NULL; + } + + if (gdb_ctx->num_params >= 3 && gdb_ctx->params[2].opcode == (uint8_t)'C') { + put_packet(gdb_ctx->s, "T02"); + return; + } + + gdb_continue(gdb_ctx->s); +} + static int gdb_handle_packet(GDBState *s, const char *line_buf) { CPUState *cpu; @@ -1930,28 +1949,13 @@ static int gdb_handle_packet(GDBState *s, const char *line_buf) return RS_IDLE; case 'F': { - target_ulong ret; - target_ulong err; - - ret = strtoull(p, (char **)&p, 16); - if (*p == ',') { - p++; - err = strtoull(p, (char **)&p, 16); - } else { - err = 0; - } - if (*p == ',') - p++; - type = *p; - if (s->current_syscall_cb) { - s->current_syscall_cb(s->c_cpu, ret, err); - s->current_syscall_cb = NULL; - } - if (type == 'C') { - put_packet(s, "T02"); - } else { - gdb_continue(s); - } + static const GdbCmdParseEntry file_io_cmd_desc = { + .handler = handle_file_io, + .cmd = "F", + .cmd_startswith = 1, + .schema = "L,L,o0" + }; + cmd_parser = &file_io_cmd_desc; } break; case 'g': From patchwork Fri Jun 7 09:05:46 2019 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 8bit X-Patchwork-Submitter: =?utf-8?q?Alex_Benn=C3=A9e?= X-Patchwork-Id: 166132 Delivered-To: patch@linaro.org Received: by 2002:a92:9e1a:0:0:0:0:0 with SMTP id q26csp450435ili; Fri, 7 Jun 2019 03:24:47 -0700 (PDT) X-Google-Smtp-Source: APXvYqwkjavEIpzWAIzwS6AUTwBOoQxyL75/J4XlAmQOgWjq6QCWeRHpx3Uv8ifhHQwTSLpJqpae X-Received: by 2002:ac8:4601:: with SMTP id p1mr45392263qtn.181.1559903087028; Fri, 07 Jun 2019 03:24:47 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1559903087; cv=none; d=google.com; s=arc-20160816; b=mT8YOklxJQGfRDz5RtPLsxm6qxgfm87QyNYVp7m9t7HJu66dQLeEKyTMEowXkL41Du 4oNZYhT25I6Dc3rFLkM2fzaRjcR9ueHAsluo4LLVfnPeD8ZHmtJdaCjWFx6GAGs/PYOq iQdK5BuS2rvzpAC4rdVosToYE9ByzYrLzhBsvUfHXz4avcRJVKS0D276gqsXgrHVt/wX 9Y6Z8sdBFFaq9ydr/erXTwFrDQyyFdgh2Jqx6e1vOUiyXeNEVQTrogQ6T/nJyEZd1leV fGJhm3EHXTWAe/5vFHvcmXUdslsBL+IquuAoZeMOXY6mYw1W1TGW1z7AVL7NlU8Sj6Dw oiqg== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=sender:errors-to:cc:list-subscribe:list-help:list-post:list-archive :list-unsubscribe:list-id:precedence:subject :content-transfer-encoding:mime-version:references:in-reply-to :message-id:date:to:from:dkim-signature; bh=s9ykN90cdyqM5hfEHGBlKQoeXXY56iNyeD+K4udZ73Y=; b=fntGZl8GxcJXBogZmEgwqXSiW+7Xh8nySVrBE+1rYcI/kGWvOryVCjqXB2ju1nYnNX U4BGhs8E/PZ2pJDM5D+/ccwabVNMSgkN6eY8ofmnxxQ5AgTMPPSgl/mgiswaEbEji1uw UpXA3EIRVZbYEjlb5ya85bZXdWsqRKKEtCcSpU2We9LACzDJtsY2783YY+i40wr+BbgO o7x7qF2jGayuo0A96daQxiBngU7W5D7oSLz3QoCSoYtiz8YUIRtlxP48jOy5O8pwu6Nk Se6P1Rx37ah/k49rkbmp1c8R4mzz+nZQXfJ8BTXnxCSuooDNDLX4HaiISshaPVCXZ3s0 fLSQ== ARC-Authentication-Results: i=1; mx.google.com; dkim=fail header.i=@linaro.org header.s=google header.b=vj2US+qP; spf=pass (google.com: domain of qemu-devel-bounces+patch=linaro.org@nongnu.org designates 209.51.188.47 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.47]) by mx.google.com with ESMTPS id l15si949951qkk.72.2019.06.07.03.24.46 for (version=TLS1_2 cipher=ECDHE-RSA-CHACHA20-POLY1305 bits=256/256); Fri, 07 Jun 2019 03:24:47 -0700 (PDT) Received-SPF: pass (google.com: domain of qemu-devel-bounces+patch=linaro.org@nongnu.org designates 209.51.188.47 as permitted sender) client-ip=209.51.188.47; Authentication-Results: mx.google.com; dkim=fail header.i=@linaro.org header.s=google header.b=vj2US+qP; spf=pass (google.com: domain of qemu-devel-bounces+patch=linaro.org@nongnu.org designates 209.51.188.47 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]:47990 helo=lists.gnu.org) by lists.gnu.org with esmtp (Exim 4.86_2) (envelope-from ) id 1hZC3C-0001pY-Jx for patch@linaro.org; Fri, 07 Jun 2019 06:24:46 -0400 Received: from eggs.gnu.org ([2001:470:142:3::10]:45000) by lists.gnu.org with esmtp (Exim 4.86_2) (envelope-from ) id 1hZB51-0008AF-6a for qemu-devel@nongnu.org; Fri, 07 Jun 2019 05:22:36 -0400 Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71) (envelope-from ) id 1hZB50-0005sX-1O for qemu-devel@nongnu.org; Fri, 07 Jun 2019 05:22:35 -0400 Received: from mail-wm1-x329.google.com ([2a00:1450:4864:20::329]:35360) by eggs.gnu.org with esmtps (TLS1.0:RSA_AES_128_CBC_SHA1:16) (Exim 4.71) (envelope-from ) id 1hZB4z-0005qj-PR for qemu-devel@nongnu.org; Fri, 07 Jun 2019 05:22:33 -0400 Received: by mail-wm1-x329.google.com with SMTP id c6so1192218wml.0 for ; Fri, 07 Jun 2019 02:22:33 -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=s9ykN90cdyqM5hfEHGBlKQoeXXY56iNyeD+K4udZ73Y=; b=vj2US+qPlr/1a88Hkvj1ieEJKJI9eddVak3pwQR7q3BR53iXEv+sKGuzgN+aaPus1E qsE4KSi4C29159YPVRjSp99hoyXU93wXCHoSv1qHOdj5O3m10VXhYfMYmjrfLyOzNTPV 8aWwIp8RU0e5spGoTms1RAb2kr3R3ETJx5k+MaAENiWDQ7tWJkjD31LbPm52moHy3ii1 WUI/z93TrSawfxphGXzlF1rp9xjoIQhGcXZRz1tnAdtMsA0fy02OoIyK/0Cxi5K35JVs 7bjF+iWptPJcngEWmpvpOimgdekQXwM3ptvpozzOZ5bS5aKbJr41USbA5pDhnl7doEko J7BA== 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=s9ykN90cdyqM5hfEHGBlKQoeXXY56iNyeD+K4udZ73Y=; b=JlDYFFJZlDeItjgNSM3Np2381BxKktbO0x88UFPj40dvwULhnbeUe0aCf9QvjRhlBS 6LhNogoRBUyRTUeOt3jFX4wk+dNZymUMAp9NsBs7TfP/UY5FNqffBBw90ggymaWcEhn7 SocFQzVDsxHhyQ01IeuOO0omi5GWGaiejzVE+yMbDC3yNupkco9H69AWWj5dRnO74uXT toqxoM91geSiTatXcF42IIlp3V62EJCbeFWdd7aktgNSHbkKZpOc/FPXw11u9a0t5B19 CM+6Qy6qFEcYQfdIFDu5Oz6BLIXkxhAaZ80UqKZDINIlMmm+MO2PQBKimKc+ubEH8gyh Y9rA== X-Gm-Message-State: APjAAAWp6T2ixGfvdWnXIKY7haKYZEzMJItjCjAKDv5kcAHSZKzZPC+b 7i2VXhvPpbzlX3KNeNBGvS7ijA== X-Received: by 2002:a7b:cc0a:: with SMTP id f10mr3064252wmh.81.1559899352706; Fri, 07 Jun 2019 02:22:32 -0700 (PDT) Received: from zen.linaroharston ([81.128.185.34]) by smtp.gmail.com with ESMTPSA id n5sm1298995wrj.27.2019.06.07.02.22.28 (version=TLS1_3 cipher=AEAD-AES256-GCM-SHA384 bits=256/256); Fri, 07 Jun 2019 02:22:30 -0700 (PDT) Received: from zen.linaroharston. (localhost [127.0.0.1]) by zen.linaroharston (Postfix) with ESMTP id BC2901FFC7; Fri, 7 Jun 2019 10:05:55 +0100 (BST) From: =?utf-8?q?Alex_Benn=C3=A9e?= To: peter.maydell@linaro.org Date: Fri, 7 Jun 2019 10:05:46 +0100 Message-Id: <20190607090552.12434-48-alex.bennee@linaro.org> X-Mailer: git-send-email 2.20.1 In-Reply-To: <20190607090552.12434-1-alex.bennee@linaro.org> References: <20190607090552.12434-1-alex.bennee@linaro.org> MIME-Version: 1.0 X-detected-operating-system: by eggs.gnu.org: Genre and OS details not recognized. X-Received-From: 2a00:1450:4864:20::329 Subject: [Qemu-devel] [PULL 47/52] gdbstub: Implement step (s pkt) with new infra 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, Jon Doron Errors-To: qemu-devel-bounces+patch=linaro.org@nongnu.org Sender: "Qemu-devel" From: Jon Doron Signed-off-by: Jon Doron Reviewed-by: Alex Bennée Message-Id: <20190529064148.19856-16-arilou@gmail.com> Signed-off-by: Alex Bennée -- 2.20.1 diff --git a/gdbstub.c b/gdbstub.c index 1871077cd7..6fd276892a 100644 --- a/gdbstub.c +++ b/gdbstub.c @@ -1808,6 +1808,16 @@ static void handle_file_io(GdbCmdContext *gdb_ctx, void *user_ctx) gdb_continue(gdb_ctx->s); } +static void handle_step(GdbCmdContext *gdb_ctx, void *user_ctx) +{ + if (gdb_ctx->num_params) { + gdb_set_cpu_pc(gdb_ctx->s, (target_ulong)gdb_ctx->params[0].val_ull); + } + + cpu_single_step(gdb_ctx->s->c_cpu, sstep_flags); + gdb_continue(gdb_ctx->s); +} + static int gdb_handle_packet(GDBState *s, const char *line_buf) { CPUState *cpu; @@ -1940,13 +1950,16 @@ static int gdb_handle_packet(GDBState *s, const char *line_buf) } break; case 's': - if (*p != '\0') { - addr = strtoull(p, (char **)&p, 16); - gdb_set_cpu_pc(s, addr); + { + static const GdbCmdParseEntry step_cmd_desc = { + .handler = handle_step, + .cmd = "s", + .cmd_startswith = 1, + .schema = "L0" + }; + cmd_parser = &step_cmd_desc; } - cpu_single_step(s->c_cpu, sstep_flags); - gdb_continue(s); - return RS_IDLE; + break; case 'F': { static const GdbCmdParseEntry file_io_cmd_desc = { From patchwork Fri Jun 7 09:05:47 2019 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 8bit X-Patchwork-Submitter: =?utf-8?q?Alex_Benn=C3=A9e?= X-Patchwork-Id: 166133 Delivered-To: patch@linaro.org Received: by 2002:a92:9e1a:0:0:0:0:0 with SMTP id q26csp455103ili; Fri, 7 Jun 2019 03:30:05 -0700 (PDT) X-Google-Smtp-Source: APXvYqyAebPUfxIwLCLqkpQVXdzjcRLQ2KLmHjQ6MxpXv/g4EorKf/BcB3RDD1GV0x6tc6KJqVWU X-Received: by 2002:aed:33e6:: with SMTP id v93mr45762623qtd.157.1559903405374; Fri, 07 Jun 2019 03:30:05 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1559903405; cv=none; d=google.com; s=arc-20160816; b=k1MbqUKPw+IIKFx5qm/0sr8Fui8lsAlQbzwpj5n9jddEB8YRVZvyRju1CUiJ/bi+Ix +eDki3oTsCwy/lpAMUvnDNJ9MlA9Z/EEjidl4O/kcOEi8TEiGTNj7wmtk6/G7eeqF6nN B+xeaxXv9loC8uJnhW3tnWZhGncxiUCfOLc4RyZpaHnau7JSW0jKWfx38DgxHwRI8WNj Jrnh0tZ9aKW7yjhJ0GV/4zhNv+/ImDdkhdyjVHOzFd4MctHEjqOWrn7gwQrM4JVB/trg PH5fHbveA8l/HtVYlqXTyJTJuaioflxlIL5QHacbf/oc9aX+cbDLnWSCYFe5EDk7eI5P yb4A== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=sender:errors-to:cc:list-subscribe:list-help:list-post:list-archive :list-unsubscribe:list-id:precedence:subject :content-transfer-encoding:mime-version:references:in-reply-to :message-id:date:to:from:dkim-signature; bh=M703OVi/yb72s+8BEvwBG9PpAye08L3/Z+ktwqLhEVo=; b=BF5yV3Qa/RE14BLum3aagh0HWTQMfJNh5OVCHBYq06A8alnFj64hesYCg8iYcmf1oQ S+5kCbZKZXkVKAYsDg45FJmDDIWTIQAbP3W3QAoKEcZpUJUPDpWE6aPPj8UyttBJYx0p EXFo1i7Guf5wvrnWwZj1HzEPHZZU5bwmk1cthx0FFOOoPV/oTOZw38+TidrU5T5Fdobk jPgv1FbZ9Bdku1CLauovjtUoNVNlIoJ0lUIYBl9LTm4ARXucJ2m6OjDUYJWA98u83QpL RPoWAmiEFr52uIKhz68MZov36zGGlnd2LI3I9C1Ke+tGaK0MujwoNMfk/gpkSueRAW3v ZoEg== ARC-Authentication-Results: i=1; mx.google.com; dkim=fail header.i=@linaro.org header.s=google header.b=wNKSW70y; spf=pass (google.com: domain of qemu-devel-bounces+patch=linaro.org@nongnu.org designates 209.51.188.47 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.47]) by mx.google.com with ESMTPS id q1si323287qkd.157.2019.06.07.03.30.05 for (version=TLS1_2 cipher=ECDHE-RSA-CHACHA20-POLY1305 bits=256/256); Fri, 07 Jun 2019 03:30:05 -0700 (PDT) Received-SPF: pass (google.com: domain of qemu-devel-bounces+patch=linaro.org@nongnu.org designates 209.51.188.47 as permitted sender) client-ip=209.51.188.47; Authentication-Results: mx.google.com; dkim=fail header.i=@linaro.org header.s=google header.b=wNKSW70y; spf=pass (google.com: domain of qemu-devel-bounces+patch=linaro.org@nongnu.org designates 209.51.188.47 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]:48042 helo=lists.gnu.org) by lists.gnu.org with esmtp (Exim 4.86_2) (envelope-from ) id 1hZC8L-0005Ih-0N for patch@linaro.org; Fri, 07 Jun 2019 06:30:05 -0400 Received: from eggs.gnu.org ([2001:470:142:3::10]:50992) by lists.gnu.org with esmtp (Exim 4.86_2) (envelope-from ) id 1hZBOM-0007e6-Ai for qemu-devel@nongnu.org; Fri, 07 Jun 2019 05:42:36 -0400 Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71) (envelope-from ) id 1hZBOK-0000p1-Ca for qemu-devel@nongnu.org; Fri, 07 Jun 2019 05:42:34 -0400 Received: from mail-wr1-x432.google.com ([2a00:1450:4864:20::432]:34618) by eggs.gnu.org with esmtps (TLS1.0:RSA_AES_128_CBC_SHA1:16) (Exim 4.71) (envelope-from ) id 1hZBOI-0000kf-U0 for qemu-devel@nongnu.org; Fri, 07 Jun 2019 05:42:32 -0400 Received: by mail-wr1-x432.google.com with SMTP id e16so1492158wrn.1 for ; Fri, 07 Jun 2019 02:42:30 -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=M703OVi/yb72s+8BEvwBG9PpAye08L3/Z+ktwqLhEVo=; b=wNKSW70yJe2qVnKuyi4yJa7cNgHDjmUiT7ihS42NXa/jcBMGZF9RNsn3LyGd02XuDH g6qyiQKRHbYaR1ya/1oPISQdEyQ3K/vvMrYTIE6eaBNSnsJ/97r/rOfhJdoijiwvVtcf vMbXAGlywIsQklNmpsgZunHpIJWsIRg9SWwYdJKihCtr59+6AKbH8Ct8fKWlZyybn6eQ gN0hZ8VXPxSiwmTFu94rD37h26li9k4/uWgwq5G8/qPBH1J8U9STlHOc4A7DksannE8j B6HBBDIrA9GEbbCA4ZObTzMhN4da56scBbdmFIWp5FgZ3nONaSTWWaM4LBCpyxT4gXzm f1mA== 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=M703OVi/yb72s+8BEvwBG9PpAye08L3/Z+ktwqLhEVo=; b=W0nQQbNvkukUlKEK1eTAVEXq39OaTCmnimJFZB9DrRPnpkOuNs/kzLMSjzRTJ/+9Nf TY5d4MByXqE7GLCt9dxxA8ARRBnB7U92A7V8E/lebWJj/lZW38OQa02d1Q3x0wa7cuAC xaQ6a4KIqlkO73WbJOOGKA66WuuG7zwH8SvUF7n9DqzrXjyey2kYxQ5TpS3/SeWjyFXF upF4qfDlsjF1+oPqfAAWtzQ83CfAvHFdAIDBmffb/x+SLbRgSw/GcyzWi9Q+rBLOeQ82 1JO7cYC1G6YKxfOfQSN6TiV38dLZdvqDWgy9cwDCcVnMoOddiYclwL3cVr5r6pQ2ny1A FVjw== X-Gm-Message-State: APjAAAXBoL0aKCGi1CgFxl7jY0/18zm30mQ+JV9TQs6vtRZ/5PGA1QG2 Rdlk8CemrRhwcEN75uQuTI5W7A== X-Received: by 2002:a5d:4acf:: with SMTP id y15mr19334842wrs.32.1559900549019; Fri, 07 Jun 2019 02:42:29 -0700 (PDT) Received: from zen.linaroharston ([81.128.185.34]) by smtp.gmail.com with ESMTPSA id o14sm1409185wrp.77.2019.06.07.02.42.28 (version=TLS1_3 cipher=AEAD-AES256-GCM-SHA384 bits=256/256); Fri, 07 Jun 2019 02:42:28 -0700 (PDT) Received: from zen.linaroharston. (localhost [127.0.0.1]) by zen.linaroharston (Postfix) with ESMTP id CF4C41FF91; Fri, 7 Jun 2019 10:05:55 +0100 (BST) From: =?utf-8?q?Alex_Benn=C3=A9e?= To: peter.maydell@linaro.org Date: Fri, 7 Jun 2019 10:05:47 +0100 Message-Id: <20190607090552.12434-49-alex.bennee@linaro.org> X-Mailer: git-send-email 2.20.1 In-Reply-To: <20190607090552.12434-1-alex.bennee@linaro.org> References: <20190607090552.12434-1-alex.bennee@linaro.org> MIME-Version: 1.0 X-detected-operating-system: by eggs.gnu.org: Genre and OS details not recognized. X-Received-From: 2a00:1450:4864:20::432 Subject: [Qemu-devel] [PULL 48/52] gdbstub: Implement v commands with new infra 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, Jon Doron Errors-To: qemu-devel-bounces+patch=linaro.org@nongnu.org Sender: "Qemu-devel" From: Jon Doron Signed-off-by: Jon Doron Message-Id: <20190529064148.19856-17-arilou@gmail.com> Signed-off-by: Alex Bennée -- 2.20.1 diff --git a/gdbstub.c b/gdbstub.c index 6fd276892a..5a4d10f1c0 100644 --- a/gdbstub.c +++ b/gdbstub.c @@ -1818,6 +1818,106 @@ static void handle_step(GdbCmdContext *gdb_ctx, void *user_ctx) gdb_continue(gdb_ctx->s); } +static void handle_v_cont_query(GdbCmdContext *gdb_ctx, void *user_ctx) +{ + put_packet(gdb_ctx->s, "vCont;c;C;s;S"); +} + +static void handle_v_cont(GdbCmdContext *gdb_ctx, void *user_ctx) +{ + int res; + + if (!gdb_ctx->num_params) { + return; + } + + res = gdb_handle_vcont(gdb_ctx->s, gdb_ctx->params[0].data); + if ((res == -EINVAL) || (res == -ERANGE)) { + put_packet(gdb_ctx->s, "E22"); + } else if (res) { + put_packet(gdb_ctx->s, ""); + } +} + +static void handle_v_attach(GdbCmdContext *gdb_ctx, void *user_ctx) +{ + GDBProcess *process; + CPUState *cpu; + char thread_id[16]; + + pstrcpy(gdb_ctx->str_buf, sizeof(gdb_ctx->str_buf), "E22"); + if (!gdb_ctx->num_params) { + goto cleanup; + } + + process = gdb_get_process(gdb_ctx->s, gdb_ctx->params[0].val_ul); + if (!process) { + goto cleanup; + } + + cpu = get_first_cpu_in_process(gdb_ctx->s, process); + if (!cpu) { + goto cleanup; + } + + process->attached = true; + gdb_ctx->s->g_cpu = cpu; + gdb_ctx->s->c_cpu = cpu; + + gdb_fmt_thread_id(gdb_ctx->s, cpu, thread_id, sizeof(thread_id)); + snprintf(gdb_ctx->str_buf, sizeof(gdb_ctx->str_buf), "T%02xthread:%s;", + GDB_SIGNAL_TRAP, thread_id); +cleanup: + put_packet(gdb_ctx->s, gdb_ctx->str_buf); +} + +static void handle_v_kill(GdbCmdContext *gdb_ctx, void *user_ctx) +{ + /* Kill the target */ + put_packet(gdb_ctx->s, "OK"); + error_report("QEMU: Terminated via GDBstub"); + exit(0); +} + +static GdbCmdParseEntry gdb_v_commands_table[] = { + /* Order is important if has same prefix */ + { + .handler = handle_v_cont_query, + .cmd = "Cont?", + .cmd_startswith = 1 + }, + { + .handler = handle_v_cont, + .cmd = "Cont", + .cmd_startswith = 1, + .schema = "s0" + }, + { + .handler = handle_v_attach, + .cmd = "Attach;", + .cmd_startswith = 1, + .schema = "l0" + }, + { + .handler = handle_v_kill, + .cmd = "Kill;", + .cmd_startswith = 1 + }, +}; + +static void handle_v_commands(GdbCmdContext *gdb_ctx, void *user_ctx) +{ + if (!gdb_ctx->num_params) { + return; + } + + if (process_string_cmd(gdb_ctx->s, NULL, gdb_ctx->params[0].data, + gdb_v_commands_table, + ARRAY_SIZE(gdb_v_commands_table))) { + put_packet(gdb_ctx->s, ""); + } +} + static int gdb_handle_packet(GDBState *s, const char *line_buf) { CPUState *cpu; @@ -1825,7 +1925,7 @@ static int gdb_handle_packet(GDBState *s, const char *line_buf) CPUClass *cc; const char *p; uint32_t pid, tid; - int ch, type, res; + int ch, type; uint8_t mem_buf[MAX_PACKET_LENGTH]; char buf[sizeof(mem_buf) + 1 /* trailing NUL */]; char thread_id[16]; @@ -1874,66 +1974,16 @@ static int gdb_handle_packet(GDBState *s, const char *line_buf) } break; case 'v': - if (strncmp(p, "Cont", 4) == 0) { - p += 4; - if (*p == '?') { - put_packet(s, "vCont;c;C;s;S"); - break; - } - - res = gdb_handle_vcont(s, p); - - if (res) { - if ((res == -EINVAL) || (res == -ERANGE)) { - put_packet(s, "E22"); - break; - } - goto unknown_command; - } - break; - } else if (strncmp(p, "Attach;", 7) == 0) { - unsigned long pid; - - p += 7; - - if (qemu_strtoul(p, &p, 16, &pid)) { - put_packet(s, "E22"); - break; - } - - process = gdb_get_process(s, pid); - - if (process == NULL) { - put_packet(s, "E22"); - break; - } - - cpu = get_first_cpu_in_process(s, process); - - if (cpu == NULL) { - /* Refuse to attach an empty process */ - put_packet(s, "E22"); - break; - } - - process->attached = true; - - s->g_cpu = cpu; - s->c_cpu = cpu; - - snprintf(buf, sizeof(buf), "T%02xthread:%s;", GDB_SIGNAL_TRAP, - gdb_fmt_thread_id(s, cpu, thread_id, sizeof(thread_id))); - - put_packet(s, buf); - break; - } else if (strncmp(p, "Kill;", 5) == 0) { - /* Kill the target */ - put_packet(s, "OK"); - error_report("QEMU: Terminated via GDBstub"); - exit(0); - } else { - goto unknown_command; + { + static const GdbCmdParseEntry v_cmd_desc = { + .handler = handle_v_commands, + .cmd = "v", + .cmd_startswith = 1, + .schema = "s0" + }; + cmd_parser = &v_cmd_desc; } + break; case 'k': /* Kill the target */ error_report("QEMU: Terminated via GDBstub"); From patchwork Fri Jun 7 09:05:48 2019 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 8bit X-Patchwork-Submitter: =?utf-8?q?Alex_Benn=C3=A9e?= X-Patchwork-Id: 166139 Delivered-To: patch@linaro.org Received: by 2002:a92:9e1a:0:0:0:0:0 with SMTP id q26csp462334ili; Fri, 7 Jun 2019 03:37:09 -0700 (PDT) X-Google-Smtp-Source: APXvYqwdHHZ4HXsBmvJ8c/8qO7HrjidATQYrQ7gTmXo63yD7JeJ8fDYvDQ4Lxp+0fnasgdOzHxk8 X-Received: by 2002:ae9:e608:: with SMTP id z8mr34531066qkf.182.1559903829822; Fri, 07 Jun 2019 03:37:09 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1559903829; cv=none; d=google.com; s=arc-20160816; b=p+MretUmPSU5OeX1276pfgTMg7cs43zXzJqwaspfIYZ++yndSuVWczU7EKG2MZKw1D OaHUqS7kDAXk2ZmKK2SqEioZwyFMCtoTmKh86DdZt37xV3lV9Rgt03bJLqFwrf+dfKQI 6477Yvmxbg6nfMYpK8Q6TvM8GPbOOijwMZbXe0dQzdwffaH0SqNZCMzpEikGkHEfUU8p j2R3501rFzhF0qhVr3T5CsTxwPlEsIX2wN1aHvhCpMfj7jvYB1XrH+jkD79LETZ3jpJd px4Kc1KzDT/4s2RKr6b3+wBF3XACMnb7Kj28z0GhzsREP0VZuwC3RfjXE8Y44n8uSl89 pdrA== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=sender:errors-to:cc:list-subscribe:list-help:list-post:list-archive :list-unsubscribe:list-id:precedence:subject :content-transfer-encoding:mime-version:references:in-reply-to :message-id:date:to:from:dkim-signature; bh=/9nbsuRkicfwbawcEcqgdKjR4DdRt7A9xCx1lrYlQew=; b=tNVjNjiV//d53OkIdPDYNse656ogbvIE7OVcgLBlu8MU+t7Ry1xUQnmyrkadE7/1BP EYO9Wol22IbvgK7y9LZ8PNBB0hQmpqhMZyqAIPLrB6PrjoANFTDi73nhc0yichDR9m1M Q36Rp01dB/6oVd5NnT68V1rnqqxH3h2uAHryrX1tAm0AE1+H1tQG4A3UkGVtYOTcm/xK 7FUQv5boSnHLHtvTqfQ362M4F1+PGaiatoUHlX1Ap+HF8cHcmTnYozhLcf4F+Q0AbsMR Z1Q4Mya1PiCpFSyDEXiZvKVfr0NhPwTn6cRsLdoo60ocKdZCItfi3xmbjcNgD7jtueZe 7Jtw== ARC-Authentication-Results: i=1; mx.google.com; dkim=fail header.i=@linaro.org header.s=google header.b=RVsHSBrZ; spf=pass (google.com: domain of qemu-devel-bounces+patch=linaro.org@nongnu.org designates 209.51.188.47 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.47]) by mx.google.com with ESMTPS id d26si1078250qte.239.2019.06.07.03.37.09 for (version=TLS1_2 cipher=ECDHE-RSA-CHACHA20-POLY1305 bits=256/256); Fri, 07 Jun 2019 03:37:09 -0700 (PDT) Received-SPF: pass (google.com: domain of qemu-devel-bounces+patch=linaro.org@nongnu.org designates 209.51.188.47 as permitted sender) client-ip=209.51.188.47; Authentication-Results: mx.google.com; dkim=fail header.i=@linaro.org header.s=google header.b=RVsHSBrZ; spf=pass (google.com: domain of qemu-devel-bounces+patch=linaro.org@nongnu.org designates 209.51.188.47 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]:48122 helo=lists.gnu.org) by lists.gnu.org with esmtp (Exim 4.86_2) (envelope-from ) id 1hZCFB-00024e-Cr for patch@linaro.org; Fri, 07 Jun 2019 06:37:09 -0400 Received: from eggs.gnu.org ([2001:470:142:3::10]:51016) by lists.gnu.org with esmtp (Exim 4.86_2) (envelope-from ) id 1hZBOO-0007eg-57 for qemu-devel@nongnu.org; Fri, 07 Jun 2019 05:42:39 -0400 Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71) (envelope-from ) id 1hZBOK-0000pb-KS for qemu-devel@nongnu.org; Fri, 07 Jun 2019 05:42:35 -0400 Received: from mail-wr1-x42b.google.com ([2a00:1450:4864:20::42b]:40438) by eggs.gnu.org with esmtps (TLS1.0:RSA_AES_128_CBC_SHA1:16) (Exim 4.71) (envelope-from ) id 1hZBOK-0000nO-81 for qemu-devel@nongnu.org; Fri, 07 Jun 2019 05:42:32 -0400 Received: by mail-wr1-x42b.google.com with SMTP id p11so1460382wre.7 for ; Fri, 07 Jun 2019 02:42:31 -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=/9nbsuRkicfwbawcEcqgdKjR4DdRt7A9xCx1lrYlQew=; b=RVsHSBrZBrST3uK1flZZvG3ufJeKhkPFgtvF+i0oq0VDB6YgJFhhkfZDyAGBi5z3uE c3mI1Tfbd2+lwCbEhHpj8lcHEyq/lMSaDS94Zs6Kv2vEB2By214u2u4DXmtNYD0vmgfq ymz2AA0+nPPtxsMafpKwu36FHLbmhIZ97rC1gDpoPjUbJf4OH+84ZA19JmQ4kkiYcDgT xwR6ITXtxJXowRg4DjBpLK0ttFBN7AIosPB2VMzWXgnrEPOEOnsQD+m+4SMVbcQvK5jf LE7v/KTK9zXI5x7dutwIPx5pSpv/TvDpE5qTlGSz7uoUTW3fkOYHjkvPxzqRI9TygyyO FUrg== 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=/9nbsuRkicfwbawcEcqgdKjR4DdRt7A9xCx1lrYlQew=; b=RLcoVUV5E85Ag67W5/nWOTfoBpt75D8TdzoSuZbil0DylPp/3fuaWs3QBtAdZLJlUi 8LN9i4u4P8ZlDhlY1JSXR1QbaGgI5GehL05jKA33DewuiI/ISQXcJl/R2tQmONxMr0A3 EtpPTm7vTC7w2Uid1Oskveh7GkfwXkbkC+tshgx1BvlJWdnnQNEU5fl1QphvinK7WKlj kzZ1ksoEGsZIhtSV0/SirGV/obBm42OB/yE1CN4ZhPS9MCglN8j9lDCIsQb4P8UQe0Xf eXyDVVwRV+oJvKfmixqkr1yfU7hLAS0Zgszkj+ByAJLrI0VqbOKOY8jLXA4S8RDOMJXY JTiQ== X-Gm-Message-State: APjAAAU8mC5GnLlJECp+rKEY6CBIYNKX3UMZyCr05qlXHS/Jq9+8TvPT vqjbSpUVcn3OP0i8ycz6uUOZyw== X-Received: by 2002:adf:e301:: with SMTP id b1mr34318784wrj.304.1559900550729; Fri, 07 Jun 2019 02:42:30 -0700 (PDT) Received: from zen.linaroharston ([81.128.185.34]) by smtp.gmail.com with ESMTPSA id u25sm1434120wmc.3.2019.06.07.02.42.28 (version=TLS1_3 cipher=AEAD-AES256-GCM-SHA384 bits=256/256); Fri, 07 Jun 2019 02:42:28 -0700 (PDT) Received: from zen.linaroharston. (localhost [127.0.0.1]) by zen.linaroharston (Postfix) with ESMTP id E40B61FFC8; Fri, 7 Jun 2019 10:05:55 +0100 (BST) From: =?utf-8?q?Alex_Benn=C3=A9e?= To: peter.maydell@linaro.org Date: Fri, 7 Jun 2019 10:05:48 +0100 Message-Id: <20190607090552.12434-50-alex.bennee@linaro.org> X-Mailer: git-send-email 2.20.1 In-Reply-To: <20190607090552.12434-1-alex.bennee@linaro.org> References: <20190607090552.12434-1-alex.bennee@linaro.org> MIME-Version: 1.0 X-detected-operating-system: by eggs.gnu.org: Genre and OS details not recognized. X-Received-From: 2a00:1450:4864:20::42b Subject: [Qemu-devel] [PULL 49/52] gdbstub: Implement generic set/query (Q/q pkt) with new infra 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, Jon Doron Errors-To: qemu-devel-bounces+patch=linaro.org@nongnu.org Sender: "Qemu-devel" From: Jon Doron The generic set/query packets contains implementation for varioius sub-commands which are required for GDB and also additional commands which are QEMU specific. To see which QEMU specific commands are available use the command gdb> maintenance packet qqemu.Supported Currently the only implemented QEMU specific command is the command that sets the single step behavior. gdb> maintenance packet qqemu.sstepbits Will display the MASK bits used to control the single stepping. gdb> maintenance packet qqemu.sstep Will display the current value of the mask used when single stepping. gdb> maintenance packet Qqemu.sstep:HEX_VALUE Will change the single step mask. Signed-off-by: Jon Doron Message-Id: <20190529064148.19856-18-arilou@gmail.com> Signed-off-by: Alex Bennée -- 2.20.1 diff --git a/gdbstub.c b/gdbstub.c index 5a4d10f1c0..c45cefd721 100644 --- a/gdbstub.c +++ b/gdbstub.c @@ -1130,14 +1130,6 @@ static GDBThreadIdKind read_thread_id(const char *buf, const char **end_buf, return GDB_ONE_THREAD; } -static int is_query_packet(const char *p, const char *query, char separator) -{ - unsigned int query_len = strlen(query); - - return strncmp(p, query, query_len) == 0 && - (p[query_len] == '\0' || p[query_len] == separator); -} - /** * gdb_handle_vcont - Parses and handles a vCont packet. * returns -ENOTSUP if a command is unsupported, -EINVAL or -ERANGE if there is @@ -1918,18 +1910,368 @@ static void handle_v_commands(GdbCmdContext *gdb_ctx, void *user_ctx) } } -static int gdb_handle_packet(GDBState *s, const char *line_buf) +static void handle_query_qemu_sstepbits(GdbCmdContext *gdb_ctx, void *user_ctx) +{ + snprintf(gdb_ctx->str_buf, sizeof(gdb_ctx->str_buf), + "ENABLE=%x,NOIRQ=%x,NOTIMER=%x", SSTEP_ENABLE, + SSTEP_NOIRQ, SSTEP_NOTIMER); + put_packet(gdb_ctx->s, gdb_ctx->str_buf); +} + +static void handle_set_qemu_sstep(GdbCmdContext *gdb_ctx, void *user_ctx) +{ + if (!gdb_ctx->num_params) { + return; + } + + sstep_flags = gdb_ctx->params[0].val_ul; + put_packet(gdb_ctx->s, "OK"); +} + +static void handle_query_qemu_sstep(GdbCmdContext *gdb_ctx, void *user_ctx) +{ + snprintf(gdb_ctx->str_buf, sizeof(gdb_ctx->str_buf), "0x%x", sstep_flags); + put_packet(gdb_ctx->s, gdb_ctx->str_buf); +} + +static void handle_query_curr_tid(GdbCmdContext *gdb_ctx, void *user_ctx) { CPUState *cpu; GDBProcess *process; + char thread_id[16]; + + /* + * "Current thread" remains vague in the spec, so always return + * the first thread of the current process (gdb returns the + * first thread). + */ + process = gdb_get_cpu_process(gdb_ctx->s, gdb_ctx->s->g_cpu); + cpu = get_first_cpu_in_process(gdb_ctx->s, process); + gdb_fmt_thread_id(gdb_ctx->s, cpu, thread_id, sizeof(thread_id)); + snprintf(gdb_ctx->str_buf, sizeof(gdb_ctx->str_buf), "QC%s", thread_id); + put_packet(gdb_ctx->s, gdb_ctx->str_buf); +} + +static void handle_query_threads(GdbCmdContext *gdb_ctx, void *user_ctx) +{ + char thread_id[16]; + + if (!gdb_ctx->s->query_cpu) { + put_packet(gdb_ctx->s, "l"); + return; + } + + gdb_fmt_thread_id(gdb_ctx->s, gdb_ctx->s->query_cpu, thread_id, + sizeof(thread_id)); + snprintf(gdb_ctx->str_buf, sizeof(gdb_ctx->str_buf), "m%s", thread_id); + put_packet(gdb_ctx->s, gdb_ctx->str_buf); + gdb_ctx->s->query_cpu = + gdb_next_attached_cpu(gdb_ctx->s, gdb_ctx->s->query_cpu); +} + +static void handle_query_first_threads(GdbCmdContext *gdb_ctx, void *user_ctx) +{ + gdb_ctx->s->query_cpu = gdb_first_attached_cpu(gdb_ctx->s); + handle_query_threads(gdb_ctx, user_ctx); +} + +static void handle_query_thread_extra(GdbCmdContext *gdb_ctx, void *user_ctx) +{ + CPUState *cpu; + int len; + + if (!gdb_ctx->num_params || + gdb_ctx->params[0].thread_id.kind == GDB_READ_THREAD_ERR) { + put_packet(gdb_ctx->s, "E22"); + return; + } + + cpu = gdb_get_cpu(gdb_ctx->s, gdb_ctx->params[0].thread_id.pid, + gdb_ctx->params[0].thread_id.tid); + if (!cpu) { + return; + } + + cpu_synchronize_state(cpu); + + if (gdb_ctx->s->multiprocess && (gdb_ctx->s->process_num > 1)) { + /* Print the CPU model and name in multiprocess mode */ + ObjectClass *oc = object_get_class(OBJECT(cpu)); + const char *cpu_model = object_class_get_name(oc); + char *cpu_name = object_get_canonical_path_component(OBJECT(cpu)); + len = snprintf((char *)gdb_ctx->mem_buf, sizeof(gdb_ctx->str_buf) / 2, + "%s %s [%s]", cpu_model, cpu_name, + cpu->halted ? "halted " : "running"); + g_free(cpu_name); + } else { + /* memtohex() doubles the required space */ + len = snprintf((char *)gdb_ctx->mem_buf, sizeof(gdb_ctx->str_buf) / 2, + "CPU#%d [%s]", cpu->cpu_index, + cpu->halted ? "halted " : "running"); + } + trace_gdbstub_op_extra_info((char *)gdb_ctx->mem_buf); + memtohex(gdb_ctx->str_buf, gdb_ctx->mem_buf, len); + put_packet(gdb_ctx->s, gdb_ctx->str_buf); +} + +#ifdef CONFIG_USER_ONLY +static void handle_query_offsets(GdbCmdContext *gdb_ctx, void *user_ctx) +{ + TaskState *ts; + + ts = gdb_ctx->s->c_cpu->opaque; + snprintf(gdb_ctx->str_buf, sizeof(gdb_ctx->str_buf), + "Text=" TARGET_ABI_FMT_lx ";Data=" TARGET_ABI_FMT_lx + ";Bss=" TARGET_ABI_FMT_lx, + ts->info->code_offset, + ts->info->data_offset, + ts->info->data_offset); + put_packet(gdb_ctx->s, gdb_ctx->str_buf); +} +#else +static void handle_query_rcmd(GdbCmdContext *gdb_ctx, void *user_ctx) +{ + int len; + + if (!gdb_ctx->num_params) { + put_packet(gdb_ctx->s, "E22"); + return; + } + + len = strlen(gdb_ctx->params[0].data); + if (len % 2) { + put_packet(gdb_ctx->s, "E01"); + return; + } + + len = len / 2; + hextomem(gdb_ctx->mem_buf, gdb_ctx->params[0].data, len); + gdb_ctx->mem_buf[len++] = 0; + qemu_chr_be_write(gdb_ctx->s->mon_chr, gdb_ctx->mem_buf, len); + put_packet(gdb_ctx->s, "OK"); + +} +#endif + +static void handle_query_supported(GdbCmdContext *gdb_ctx, void *user_ctx) +{ CPUClass *cc; + + snprintf(gdb_ctx->str_buf, sizeof(gdb_ctx->str_buf), "PacketSize=%x", + MAX_PACKET_LENGTH); + cc = CPU_GET_CLASS(first_cpu); + if (cc->gdb_core_xml_file) { + pstrcat(gdb_ctx->str_buf, sizeof(gdb_ctx->str_buf), + ";qXfer:features:read+"); + } + + if (gdb_ctx->num_params && + strstr(gdb_ctx->params[0].data, "multiprocess+")) { + gdb_ctx->s->multiprocess = true; + } + + pstrcat(gdb_ctx->str_buf, sizeof(gdb_ctx->str_buf), ";multiprocess+"); + put_packet(gdb_ctx->s, gdb_ctx->str_buf); +} + +static void handle_query_xfer_features(GdbCmdContext *gdb_ctx, void *user_ctx) +{ + GDBProcess *process; + CPUClass *cc; + unsigned long len, total_len, addr; + const char *xml; const char *p; - uint32_t pid, tid; - int ch, type; + + if (gdb_ctx->num_params < 3) { + put_packet(gdb_ctx->s, "E22"); + return; + } + + process = gdb_get_cpu_process(gdb_ctx->s, gdb_ctx->s->g_cpu); + cc = CPU_GET_CLASS(gdb_ctx->s->g_cpu); + if (!cc->gdb_core_xml_file) { + put_packet(gdb_ctx->s, ""); + return; + } + + gdb_has_xml = true; + p = gdb_ctx->params[0].data; + xml = get_feature_xml(gdb_ctx->s, p, &p, process); + if (!xml) { + put_packet(gdb_ctx->s, "E00"); + return; + } + + addr = gdb_ctx->params[1].val_ul; + len = gdb_ctx->params[2].val_ul; + total_len = strlen(xml); + if (addr > total_len) { + put_packet(gdb_ctx->s, "E00"); + return; + } + + if (len > (MAX_PACKET_LENGTH - 5) / 2) { + len = (MAX_PACKET_LENGTH - 5) / 2; + } + + if (len < total_len - addr) { + gdb_ctx->str_buf[0] = 'm'; + len = memtox(gdb_ctx->str_buf + 1, xml + addr, len); + } else { + gdb_ctx->str_buf[0] = 'l'; + len = memtox(gdb_ctx->str_buf + 1, xml + addr, total_len - addr); + } + + put_packet_binary(gdb_ctx->s, gdb_ctx->str_buf, len + 1, true); +} + +static void handle_query_attached(GdbCmdContext *gdb_ctx, void *user_ctx) +{ + put_packet(gdb_ctx->s, GDB_ATTACHED); +} + +static void handle_query_qemu_supported(GdbCmdContext *gdb_ctx, void *user_ctx) +{ + put_packet(gdb_ctx->s, "sstepbits;sstep"); +} + +static GdbCmdParseEntry gdb_gen_query_set_common_table[] = { + /* Order is important if has same prefix */ + { + .handler = handle_query_qemu_sstepbits, + .cmd = "qemu.sstepbits", + }, + { + .handler = handle_query_qemu_sstep, + .cmd = "qemu.sstep", + }, + { + .handler = handle_set_qemu_sstep, + .cmd = "qemu.sstep=", + .cmd_startswith = 1, + .schema = "l0" + }, +}; + +static GdbCmdParseEntry gdb_gen_query_table[] = { + { + .handler = handle_query_curr_tid, + .cmd = "C", + }, + { + .handler = handle_query_threads, + .cmd = "sThreadInfo", + }, + { + .handler = handle_query_first_threads, + .cmd = "fThreadInfo", + }, + { + .handler = handle_query_thread_extra, + .cmd = "ThreadExtraInfo,", + .cmd_startswith = 1, + .schema = "t0" + }, +#ifdef CONFIG_USER_ONLY + { + .handler = handle_query_offsets, + .cmd = "Offsets", + }, +#else + { + .handler = handle_query_rcmd, + .cmd = "Rcmd,", + .cmd_startswith = 1, + .schema = "s0" + }, +#endif + { + .handler = handle_query_supported, + .cmd = "Supported:", + .cmd_startswith = 1, + .schema = "s0" + }, + { + .handler = handle_query_supported, + .cmd = "Supported", + .schema = "s0" + }, + { + .handler = handle_query_xfer_features, + .cmd = "Xfer:features:read:", + .cmd_startswith = 1, + .schema = "s:l,l0" + }, + { + .handler = handle_query_attached, + .cmd = "Attached:", + .cmd_startswith = 1 + }, + { + .handler = handle_query_attached, + .cmd = "Attached", + }, + { + .handler = handle_query_qemu_supported, + .cmd = "qemu.Supported", + }, +}; + +static GdbCmdParseEntry gdb_gen_set_table[] = { + /* Order is important if has same prefix */ + { + .handler = handle_set_qemu_sstep, + .cmd = "qemu.sstep:", + .cmd_startswith = 1, + .schema = "l0" + }, +}; + +static void handle_gen_query(GdbCmdContext *gdb_ctx, void *user_ctx) +{ + if (!gdb_ctx->num_params) { + return; + } + + if (!process_string_cmd(gdb_ctx->s, NULL, gdb_ctx->params[0].data, + gdb_gen_query_set_common_table, + ARRAY_SIZE(gdb_gen_query_set_common_table))) { + return; + } + + if (process_string_cmd(gdb_ctx->s, NULL, gdb_ctx->params[0].data, + gdb_gen_query_table, + ARRAY_SIZE(gdb_gen_query_table))) { + put_packet(gdb_ctx->s, ""); + } +} + +static void handle_gen_set(GdbCmdContext *gdb_ctx, void *user_ctx) +{ + if (!gdb_ctx->num_params) { + return; + } + + if (!process_string_cmd(gdb_ctx->s, NULL, gdb_ctx->params[0].data, + gdb_gen_query_set_common_table, + ARRAY_SIZE(gdb_gen_query_set_common_table))) { + return; + } + + if (process_string_cmd(gdb_ctx->s, NULL, gdb_ctx->params[0].data, + gdb_gen_set_table, + ARRAY_SIZE(gdb_gen_set_table))) { + put_packet(gdb_ctx->s, ""); + } +} + +static int gdb_handle_packet(GDBState *s, const char *line_buf) +{ + const char *p; + int ch; uint8_t mem_buf[MAX_PACKET_LENGTH]; char buf[sizeof(mem_buf) + 1 /* trailing NUL */]; char thread_id[16]; - target_ulong addr, len; const GdbCmdParseEntry *cmd_parser = NULL; trace_gdbstub_io_command(line_buf); @@ -2131,183 +2473,28 @@ static int gdb_handle_packet(GDBState *s, const char *line_buf) } break; case 'q': - case 'Q': - /* parse any 'q' packets here */ - if (!strcmp(p,"qemu.sstepbits")) { - /* Query Breakpoint bit definitions */ - snprintf(buf, sizeof(buf), "ENABLE=%x,NOIRQ=%x,NOTIMER=%x", - SSTEP_ENABLE, - SSTEP_NOIRQ, - SSTEP_NOTIMER); - put_packet(s, buf); - break; - } else if (is_query_packet(p, "qemu.sstep", '=')) { - /* Display or change the sstep_flags */ - p += 10; - if (*p != '=') { - /* Display current setting */ - snprintf(buf, sizeof(buf), "0x%x", sstep_flags); - put_packet(s, buf); - break; - } - p++; - type = strtoul(p, (char **)&p, 16); - sstep_flags = type; - put_packet(s, "OK"); - break; - } else if (strcmp(p,"C") == 0) { - /* - * "Current thread" remains vague in the spec, so always return - * the first thread of the current process (gdb returns the - * first thread). - */ - cpu = get_first_cpu_in_process(s, gdb_get_cpu_process(s, s->g_cpu)); - snprintf(buf, sizeof(buf), "QC%s", - gdb_fmt_thread_id(s, cpu, thread_id, sizeof(thread_id))); - put_packet(s, buf); - break; - } else if (strcmp(p,"fThreadInfo") == 0) { - s->query_cpu = gdb_first_attached_cpu(s); - goto report_cpuinfo; - } else if (strcmp(p,"sThreadInfo") == 0) { - report_cpuinfo: - if (s->query_cpu) { - snprintf(buf, sizeof(buf), "m%s", - gdb_fmt_thread_id(s, s->query_cpu, - thread_id, sizeof(thread_id))); - put_packet(s, buf); - s->query_cpu = gdb_next_attached_cpu(s, s->query_cpu); - } else - put_packet(s, "l"); - break; - } else if (strncmp(p,"ThreadExtraInfo,", 16) == 0) { - if (read_thread_id(p + 16, &p, &pid, &tid) == GDB_READ_THREAD_ERR) { - put_packet(s, "E22"); - break; - } - cpu = gdb_get_cpu(s, pid, tid); - if (cpu != NULL) { - cpu_synchronize_state(cpu); - - if (s->multiprocess && (s->process_num > 1)) { - /* Print the CPU model and name in multiprocess mode */ - ObjectClass *oc = object_get_class(OBJECT(cpu)); - const char *cpu_model = object_class_get_name(oc); - char *cpu_name = - object_get_canonical_path_component(OBJECT(cpu)); - len = snprintf((char *)mem_buf, sizeof(buf) / 2, - "%s %s [%s]", cpu_model, cpu_name, - cpu->halted ? "halted " : "running"); - g_free(cpu_name); - } else { - /* memtohex() doubles the required space */ - len = snprintf((char *)mem_buf, sizeof(buf) / 2, - "CPU#%d [%s]", cpu->cpu_index, - cpu->halted ? "halted " : "running"); - } - trace_gdbstub_op_extra_info((char *)mem_buf); - memtohex(buf, mem_buf, len); - put_packet(s, buf); - } - break; - } -#ifdef CONFIG_USER_ONLY - else if (strcmp(p, "Offsets") == 0) { - TaskState *ts = s->c_cpu->opaque; - - snprintf(buf, sizeof(buf), - "Text=" TARGET_ABI_FMT_lx ";Data=" TARGET_ABI_FMT_lx - ";Bss=" TARGET_ABI_FMT_lx, - ts->info->code_offset, - ts->info->data_offset, - ts->info->data_offset); - put_packet(s, buf); - break; - } -#else /* !CONFIG_USER_ONLY */ - else if (strncmp(p, "Rcmd,", 5) == 0) { - int len = strlen(p + 5); - - if ((len % 2) != 0) { - put_packet(s, "E01"); - break; - } - len = len / 2; - hextomem(mem_buf, p + 5, len); - mem_buf[len++] = 0; - qemu_chr_be_write(s->mon_chr, mem_buf, len); - put_packet(s, "OK"); - break; - } -#endif /* !CONFIG_USER_ONLY */ - if (is_query_packet(p, "Supported", ':')) { - snprintf(buf, sizeof(buf), "PacketSize=%x", MAX_PACKET_LENGTH); - cc = CPU_GET_CLASS(first_cpu); - if (cc->gdb_core_xml_file != NULL) { - pstrcat(buf, sizeof(buf), ";qXfer:features:read+"); - } - - if (strstr(p, "multiprocess+")) { - s->multiprocess = true; - } - pstrcat(buf, sizeof(buf), ";multiprocess+"); - - put_packet(s, buf); - break; - } - if (strncmp(p, "Xfer:features:read:", 19) == 0) { - const char *xml; - target_ulong total_len; - - process = gdb_get_cpu_process(s, s->g_cpu); - cc = CPU_GET_CLASS(s->g_cpu); - if (cc->gdb_core_xml_file == NULL) { - goto unknown_command; - } - - gdb_has_xml = true; - p += 19; - xml = get_feature_xml(s, p, &p, process); - if (!xml) { - snprintf(buf, sizeof(buf), "E00"); - put_packet(s, buf); - break; - } - - if (*p == ':') - p++; - addr = strtoul(p, (char **)&p, 16); - if (*p == ',') - p++; - len = strtoul(p, (char **)&p, 16); - - total_len = strlen(xml); - if (addr > total_len) { - snprintf(buf, sizeof(buf), "E00"); - put_packet(s, buf); - break; - } - if (len > (MAX_PACKET_LENGTH - 5) / 2) - len = (MAX_PACKET_LENGTH - 5) / 2; - if (len < total_len - addr) { - buf[0] = 'm'; - len = memtox(buf + 1, xml + addr, len); - } else { - buf[0] = 'l'; - len = memtox(buf + 1, xml + addr, total_len - addr); - } - put_packet_binary(s, buf, len + 1, true); - break; + { + static const GdbCmdParseEntry gen_query_cmd_desc = { + .handler = handle_gen_query, + .cmd = "q", + .cmd_startswith = 1, + .schema = "s0" + }; + cmd_parser = &gen_query_cmd_desc; } - if (is_query_packet(p, "Attached", ':')) { - put_packet(s, GDB_ATTACHED); - break; + break; + case 'Q': + { + static const GdbCmdParseEntry gen_set_cmd_desc = { + .handler = handle_gen_set, + .cmd = "Q", + .cmd_startswith = 1, + .schema = "s0" + }; + cmd_parser = &gen_set_cmd_desc; } - /* Unrecognised 'q' command. */ - goto unknown_command; - + break; default: - unknown_command: /* put empty packet */ buf[0] = '\0'; put_packet(s, buf); From patchwork Fri Jun 7 09:05:49 2019 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 8bit X-Patchwork-Submitter: =?utf-8?q?Alex_Benn=C3=A9e?= X-Patchwork-Id: 166129 Delivered-To: patch@linaro.org Received: by 2002:a92:9e1a:0:0:0:0:0 with SMTP id q26csp448684ili; Fri, 7 Jun 2019 03:22:45 -0700 (PDT) X-Google-Smtp-Source: APXvYqw+/BzCL6H5yMzZfuNv0NaS5OidjXgqhLbUN9FYGT/Ep/sUR0YN6JbSzOhufuSDvcNheIYG X-Received: by 2002:ac8:124c:: with SMTP id g12mr16375703qtj.57.1559902965319; Fri, 07 Jun 2019 03:22:45 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1559902965; cv=none; d=google.com; s=arc-20160816; b=YQrszI7eUN8ZGf2JoP6LsQreLI60Tp7+7ZlZlo1X84RV9VLwnGNnb4nZQdMaZTicDV dEJE0z2iqfk6tG5iCULrV6ukXj15SGQLKNjafZsaIEwEzzuYg1rWP27B97DE2tQaYl1G gAzLQOqfDUWej46+prpaF4AAFGRgaC6AZdVzw6siVTU5KqsDvvUFjVryaCMAnxP/G49F rWZn91ntWnHdk55Oc+DpulxrokJqcWqRp0Dtcf6HbLAQpbsTM+vpbQ5dcz5X9mFt4xxO dpDozAkbJJdYOunqzIZLQt8VCKgACPtLsg8CjKNoa8YLOAmSoSo8eE0yNDDcFnoXChhM CYVQ== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=sender:errors-to:cc:list-subscribe:list-help:list-post:list-archive :list-unsubscribe:list-id:precedence:subject :content-transfer-encoding:mime-version:references:in-reply-to :message-id:date:to:from:dkim-signature; bh=6p4AOuc6tSqUtkly1124rR3i8VzgPPw2QQg37+GiwQw=; b=rQb++TAgU5/4ih8Y5vsMrGDM16Q3w6+GcL140jnEMyAEFkyXBK1e8xeTGbmZw2zCjm EXWJ8QDL8ypvuZXm/uL7A06lEQ/aW6pa/cJ7xDxe1mPCnY2GUdhLo4nMHaT8ANR1XUOE O/IAm8TKTOfbirjL2NHZXXsCmVFdEEdaJCncXW/U0fV35F8Lx7pVnwBoNFbnp1RExOK8 6mJlW/tOo5EM4FsKTv6k+PH7eItw6XBC/9IjATgGucc9ecsed6IYzyfiF+Rpnq2t87Ky TgFP+GcmTMey1iq32RAm4IOm2RBseQBNLT5BE7XE1FH25KxJO8dwxAErY+FA+671Eo7q MnAQ== ARC-Authentication-Results: i=1; mx.google.com; dkim=fail header.i=@linaro.org header.s=google header.b=LGGWbPMP; spf=pass (google.com: domain of qemu-devel-bounces+patch=linaro.org@nongnu.org designates 209.51.188.47 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.47]) by mx.google.com with ESMTPS id f17si877908qkm.270.2019.06.07.03.22.45 for (version=TLS1_2 cipher=ECDHE-RSA-CHACHA20-POLY1305 bits=256/256); Fri, 07 Jun 2019 03:22:45 -0700 (PDT) Received-SPF: pass (google.com: domain of qemu-devel-bounces+patch=linaro.org@nongnu.org designates 209.51.188.47 as permitted sender) client-ip=209.51.188.47; Authentication-Results: mx.google.com; dkim=fail header.i=@linaro.org header.s=google header.b=LGGWbPMP; spf=pass (google.com: domain of qemu-devel-bounces+patch=linaro.org@nongnu.org designates 209.51.188.47 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]:47966 helo=lists.gnu.org) by lists.gnu.org with esmtp (Exim 4.86_2) (envelope-from ) id 1hZC1E-00084Z-79 for patch@linaro.org; Fri, 07 Jun 2019 06:22:44 -0400 Received: from eggs.gnu.org ([2001:470:142:3::10]:44947) by lists.gnu.org with esmtp (Exim 4.86_2) (envelope-from ) id 1hZB4z-00084G-76 for qemu-devel@nongnu.org; Fri, 07 Jun 2019 05:22:34 -0400 Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71) (envelope-from ) id 1hZB4y-0005oO-2c for qemu-devel@nongnu.org; Fri, 07 Jun 2019 05:22:33 -0400 Received: from mail-wr1-x442.google.com ([2a00:1450:4864:20::442]:34825) by eggs.gnu.org with esmtps (TLS1.0:RSA_AES_128_CBC_SHA1:16) (Exim 4.71) (envelope-from ) id 1hZB4w-0005hl-3g for qemu-devel@nongnu.org; Fri, 07 Jun 2019 05:22:30 -0400 Received: by mail-wr1-x442.google.com with SMTP id m3so1422062wrv.2 for ; Fri, 07 Jun 2019 02:22:29 -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=6p4AOuc6tSqUtkly1124rR3i8VzgPPw2QQg37+GiwQw=; b=LGGWbPMPy8kvNxxFhLdei3Ebzjt4NHqzX2b2XzS7za1J/oD6Tk4l+OzLzOQsiguEpG JOwErwhTsNXNb2C1PjsdqZ1/+4Y6FULvLUuXS4uIZ5JLtS1azzUfxedKJ4Sk0CMPaTr3 8DQHLLpI2CY/6ssbU3Rk3UPJ/agK5pi3hWS5dEvHnMZMDvm/DQB7wtTqFGJgPsk7K9Rj ZyUwGLf0vfBzOj5JRljOVGnraSjHGQoAhBSk0BIdV9cEf6Oy/CCIwAIC97V4D/wFoGed zYPUyCbZGFQM85si4qZg0HTP8dLtnySezCHjHO6CE5Fh933s8btVADuPircn7aIlKBSw W5Xw== 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=6p4AOuc6tSqUtkly1124rR3i8VzgPPw2QQg37+GiwQw=; b=HTBvGzcT1fwczs3qyzGn8YywKf15Tpalyxht/AvK4oyccvzY587H8HB2R/u2vd8m5O lGU9/CKStkWErepgFpxx6586kh7gsgiraoLuFbKcmgQRQ0xof243dIi6OUoAlZC3Br3t hyRpXIwZHLaXsfo7nb9BZ205ZTU5SfhgPaxWfcbp2JjXOpHrbMHF07EikkUYukUa9DDi lUBKdawKyII1f+2hDNLQY1A8FDrhinNBuzCBwHaZxSk4iJp3/JPBW5z+P07SEWaS6UgK EDzS83jLWZ0XgcdqH9Tqrscj5tbNOP2BA6RDMleF0QKNlNz0AC9RoYtB9ZHcp7Tlxo1N //Dg== X-Gm-Message-State: APjAAAVkIAQPMkSAOcEQaYW/xWqS2HizJFTFv3XAqnBzcG4JIqj+rq0i SuyNVEG+UGd4mKYSfdeje1IBDA== X-Received: by 2002:adf:dc43:: with SMTP id m3mr15729283wrj.279.1559899347429; Fri, 07 Jun 2019 02:22:27 -0700 (PDT) Received: from zen.linaroharston ([81.128.185.34]) by smtp.gmail.com with ESMTPSA id q20sm4023504wra.36.2019.06.07.02.22.26 (version=TLS1_3 cipher=AEAD-AES256-GCM-SHA384 bits=256/256); Fri, 07 Jun 2019 02:22:26 -0700 (PDT) Received: from zen.linaroharston. (localhost [127.0.0.1]) by zen.linaroharston (Postfix) with ESMTP id 02AF11FFC9; Fri, 7 Jun 2019 10:05:56 +0100 (BST) From: =?utf-8?q?Alex_Benn=C3=A9e?= To: peter.maydell@linaro.org Date: Fri, 7 Jun 2019 10:05:49 +0100 Message-Id: <20190607090552.12434-51-alex.bennee@linaro.org> X-Mailer: git-send-email 2.20.1 In-Reply-To: <20190607090552.12434-1-alex.bennee@linaro.org> References: <20190607090552.12434-1-alex.bennee@linaro.org> MIME-Version: 1.0 X-detected-operating-system: by eggs.gnu.org: Genre and OS details not recognized. X-Received-From: 2a00:1450:4864:20::442 Subject: [Qemu-devel] [PULL 50/52] gdbstub: Implement target halted (? pkt) with new infra 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, Jon Doron Errors-To: qemu-devel-bounces+patch=linaro.org@nongnu.org Sender: "Qemu-devel" From: Jon Doron Note: The user-mode thread-id has been correctly reported since bd88c780e6 Signed-off-by: Jon Doron Message-Id: <20190529064148.19856-19-arilou@gmail.com> Signed-off-by: Alex Bennée -- 2.20.1 diff --git a/gdbstub.c b/gdbstub.c index c45cefd721..26c0c30682 100644 --- a/gdbstub.c +++ b/gdbstub.c @@ -2265,13 +2265,29 @@ static void handle_gen_set(GdbCmdContext *gdb_ctx, void *user_ctx) } } +static void handle_target_halt(GdbCmdContext *gdb_ctx, void *user_ctx) +{ + char thread_id[16]; + + gdb_fmt_thread_id(gdb_ctx->s, gdb_ctx->s->c_cpu, thread_id, + sizeof(thread_id)); + snprintf(gdb_ctx->str_buf, sizeof(gdb_ctx->str_buf), "T%02xthread:%s;", + GDB_SIGNAL_TRAP, thread_id); + put_packet(gdb_ctx->s, gdb_ctx->str_buf); + /* + * Remove all the breakpoints when this query is issued, + * because gdb is doing an initial connect and the state + * should be cleaned up. + */ + gdb_breakpoint_remove_all(); +} + static int gdb_handle_packet(GDBState *s, const char *line_buf) { const char *p; int ch; uint8_t mem_buf[MAX_PACKET_LENGTH]; char buf[sizeof(mem_buf) + 1 /* trailing NUL */]; - char thread_id[16]; const GdbCmdParseEntry *cmd_parser = NULL; trace_gdbstub_io_command(line_buf); @@ -2283,15 +2299,14 @@ static int gdb_handle_packet(GDBState *s, const char *line_buf) put_packet(s, "OK"); break; case '?': - /* TODO: Make this return the correct value for user-mode. */ - snprintf(buf, sizeof(buf), "T%02xthread:%s;", GDB_SIGNAL_TRAP, - gdb_fmt_thread_id(s, s->c_cpu, thread_id, sizeof(thread_id))); - put_packet(s, buf); - /* Remove all the breakpoints when this query is issued, - * because gdb is doing and initial connect and the state - * should be cleaned up. - */ - gdb_breakpoint_remove_all(); + { + static const GdbCmdParseEntry target_halted_cmd_desc = { + .handler = handle_target_halt, + .cmd = "?", + .cmd_startswith = 1 + }; + cmd_parser = &target_halted_cmd_desc; + } break; case 'c': { From patchwork Fri Jun 7 09:05:50 2019 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 8bit X-Patchwork-Submitter: =?utf-8?q?Alex_Benn=C3=A9e?= X-Patchwork-Id: 166115 Delivered-To: patch@linaro.org Received: by 2002:a92:9e1a:0:0:0:0:0 with SMTP id q26csp429798ili; Fri, 7 Jun 2019 03:05:04 -0700 (PDT) X-Google-Smtp-Source: APXvYqzzU5WsSc9wQImROZWX4pmV6PW7nT3oBNUYi422bpfGNujkYgiALeyjaCkgIggYFh8h4bx0 X-Received: by 2002:ac8:34c5:: with SMTP id x5mr35970390qtb.91.1559901904057; Fri, 07 Jun 2019 03:05:04 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1559901904; cv=none; d=google.com; s=arc-20160816; b=wTTYuLrIP2IE7SvaglPC9HseoX3NYC7ib52m0CJTGIRq0MLVor/59V5X8cpaNr0JVo U8NEiPDgsIVUH8SnIs4hKtYNV3M0NbKOcSD5wMn9Ct0hNTkaiT1Y52nsevX+7SM5T34M 9pYO94MVLrxVgy28aqUGra7WPgCmPHG2lkRfbqbaUjrbeaLFGq4yxIadXWgsSHNlmbiv ad3AohS2UouZmoECU3I2UtIqfe9CC4pwR9p85b0FIXvgrP288hk8m3Os2oHr/SQsBTvp KapZqU8Uyn6hdjZkIQx/CQktuHrg2IByEdY6fJtIhP1F+0TcRCSVGZAXCdaFX5xO7J8H SWgg== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=sender:errors-to:cc:list-subscribe:list-help:list-post:list-archive :list-unsubscribe:list-id:precedence:subject :content-transfer-encoding:mime-version:references:in-reply-to :message-id:date:to:from:dkim-signature; bh=nMFCZfwkMlDoG7F9uNweZDiNnzGq2iNoqNGA+iU0AVQ=; b=LkhYbujY4QXUefO2i05DV0rQenLPg8ZNZ2xqdQn/D8Yu4q5ii2aYzO5JM/z0m43EzU ZOnVqwgfZ0khHvfK0UT0QnlV20ds0nUxL7CeI/UVVJDvf2NgZJE8lrILdFONwk0b/b9D y/nCjCyHbbhMfJwmW2TZjkVw+0W6unQw6gG/Ey9U4GalF20YfG5xPQcs+aBHfFUu3gzi HYrQsqaqN1yjdWyvQ4RvMHLSwzcNW3c+TkH5KpZaX/Evt6Kj34yNWJDyouI+RGH1Ikvn JPYZh9jtPJNxOgjQsyyg86U7YO6pjutnxRYg5kDyTG7x/nrtPa5qakfQOkhZam/+JIVk /+IA== ARC-Authentication-Results: i=1; mx.google.com; dkim=fail header.i=@linaro.org header.s=google header.b=OclLWVAt; spf=pass (google.com: domain of qemu-devel-bounces+patch=linaro.org@nongnu.org designates 209.51.188.47 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.47]) by mx.google.com with ESMTPS id n43si375542qvg.83.2019.06.07.03.05.03 for (version=TLS1_2 cipher=ECDHE-RSA-CHACHA20-POLY1305 bits=256/256); Fri, 07 Jun 2019 03:05:04 -0700 (PDT) Received-SPF: pass (google.com: domain of qemu-devel-bounces+patch=linaro.org@nongnu.org designates 209.51.188.47 as permitted sender) client-ip=209.51.188.47; Authentication-Results: mx.google.com; dkim=fail header.i=@linaro.org header.s=google header.b=OclLWVAt; spf=pass (google.com: domain of qemu-devel-bounces+patch=linaro.org@nongnu.org designates 209.51.188.47 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]:47748 helo=lists.gnu.org) by lists.gnu.org with esmtp (Exim 4.86_2) (envelope-from ) id 1hZBk7-0003LK-JF for patch@linaro.org; Fri, 07 Jun 2019 06:05:03 -0400 Received: from eggs.gnu.org ([2001:470:142:3::10]:42199) by lists.gnu.org with esmtp (Exim 4.86_2) (envelope-from ) id 1hZAvT-0002FK-A0 for qemu-devel@nongnu.org; Fri, 07 Jun 2019 05:12:45 -0400 Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71) (envelope-from ) id 1hZAvQ-0004yo-Nd for qemu-devel@nongnu.org; Fri, 07 Jun 2019 05:12:43 -0400 Received: from mail-wm1-x330.google.com ([2a00:1450:4864:20::330]:35286) by eggs.gnu.org with esmtps (TLS1.0:RSA_AES_128_CBC_SHA1:16) (Exim 4.71) (envelope-from ) id 1hZAvQ-0004oP-CM for qemu-devel@nongnu.org; Fri, 07 Jun 2019 05:12:40 -0400 Received: by mail-wm1-x330.google.com with SMTP id c6so1161751wml.0 for ; Fri, 07 Jun 2019 02:12: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=nMFCZfwkMlDoG7F9uNweZDiNnzGq2iNoqNGA+iU0AVQ=; b=OclLWVAtK+ADY39NWGpm9RLDld2yzN2AgU9shKcm6B/5ibkaTGyxl45lqCZQdxWImG PROEd8OsxTfmUQ99KUqhIGdYoZfwsjSvHA5hcxnoqORP7aE6l/tSWqgNYf0yWbn+ghdw jv2m6p+lGlbmBg3EG7TiJU390nTVHRgBBeXdEnYDGRDruZMlX/zYHq6xU2iBYC7PMOIS ZmQ7Ehi8avrySxFxWNOhGIb3Hqpztw85225mbMw9UMS5asTj0DTrSeuEqwtSVybpEgvw A8dYTrImri1rVl8gKoSViMmpMs97pt7pYqtbeOq6H7PDD1240Qyyn2YD6EGGxinFRv5k OrmA== 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=nMFCZfwkMlDoG7F9uNweZDiNnzGq2iNoqNGA+iU0AVQ=; b=gY8MceA7xXltdJdbW9IjteO+17Sp6H40bKKR6/S24wxAPYZCubN+NTdK+69BX3Bz+E RXTTALFKz3ZegjHuM2TlLI04c3zWcannWhahSp0EIrFqzIsoFyUIT+o5pU/j4wkBxVGl UHErbKh8mxpm2vgMl3EL2s0Iw7l5wsuhyPxxO1sS9qNLoFREr8HelXIpgWPFRlCslSEK e0dDSYN3MjVAmzVDTrtg0rpxSvD7b1k9+kdlP7/F79ciS7iula/YIIMHjG4FRBPdSGYd R0z4ecokWK5V+sj1CmCwT6+QC+dib52cn4hWb/uaPwaVqpNm//1TJ8HJxIjyloJW8LDz sb3g== X-Gm-Message-State: APjAAAXGRpIs2vWYU/iOBbRMxlaMztOiot1u2zfTGqPg5yzDowvOA/4v zQ9hrW1Ty/rSgnUN+lGShnwwk5Lyio0= X-Received: by 2002:a7b:c144:: with SMTP id z4mr3054998wmi.50.1559898755657; Fri, 07 Jun 2019 02:12:35 -0700 (PDT) Received: from zen.linaroharston ([81.128.185.34]) by smtp.gmail.com with ESMTPSA id l1sm1523446wmg.13.2019.06.07.02.12.30 (version=TLS1_3 cipher=AEAD-AES256-GCM-SHA384 bits=256/256); Fri, 07 Jun 2019 02:12:32 -0700 (PDT) Received: from zen.linaroharston. (localhost [127.0.0.1]) by zen.linaroharston (Postfix) with ESMTP id 1543F1FFCA; Fri, 7 Jun 2019 10:05:56 +0100 (BST) From: =?utf-8?q?Alex_Benn=C3=A9e?= To: peter.maydell@linaro.org Date: Fri, 7 Jun 2019 10:05:50 +0100 Message-Id: <20190607090552.12434-52-alex.bennee@linaro.org> X-Mailer: git-send-email 2.20.1 In-Reply-To: <20190607090552.12434-1-alex.bennee@linaro.org> References: <20190607090552.12434-1-alex.bennee@linaro.org> MIME-Version: 1.0 X-detected-operating-system: by eggs.gnu.org: Genre and OS details not recognized. X-Received-From: 2a00:1450:4864:20::330 Subject: [Qemu-devel] [PULL 51/52] gdbstub: Clear unused variables in gdb_handle_packet 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, Jon Doron Errors-To: qemu-devel-bounces+patch=linaro.org@nongnu.org Sender: "Qemu-devel" From: Jon Doron Signed-off-by: Jon Doron Reviewed-by: Alex Bennée Message-Id: <20190529064148.19856-20-arilou@gmail.com> Signed-off-by: Alex Bennée -- 2.20.1 diff --git a/gdbstub.c b/gdbstub.c index 26c0c30682..12671e6e11 100644 --- a/gdbstub.c +++ b/gdbstub.c @@ -2284,17 +2284,11 @@ static void handle_target_halt(GdbCmdContext *gdb_ctx, void *user_ctx) static int gdb_handle_packet(GDBState *s, const char *line_buf) { - const char *p; - int ch; - uint8_t mem_buf[MAX_PACKET_LENGTH]; - char buf[sizeof(mem_buf) + 1 /* trailing NUL */]; const GdbCmdParseEntry *cmd_parser = NULL; trace_gdbstub_io_command(line_buf); - p = line_buf; - ch = *p++; - switch(ch) { + switch (line_buf[0]) { case '!': put_packet(s, "OK"); break; @@ -2511,8 +2505,7 @@ static int gdb_handle_packet(GDBState *s, const char *line_buf) break; default: /* put empty packet */ - buf[0] = '\0'; - put_packet(s, buf); + put_packet(s, ""); break; } From patchwork Fri Jun 7 09:05:51 2019 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 8bit X-Patchwork-Submitter: =?utf-8?q?Alex_Benn=C3=A9e?= X-Patchwork-Id: 166141 Delivered-To: patch@linaro.org Received: by 2002:a92:9e1a:0:0:0:0:0 with SMTP id q26csp468041ili; Fri, 7 Jun 2019 03:43:48 -0700 (PDT) X-Google-Smtp-Source: APXvYqwwGKQ/lFSwrFlk1UvSmE0lKkCq+M71TGeIgaDMQDsefRXm4uoA4ZwUOwFRZqIK2De8QzPD X-Received: by 2002:ad4:5426:: with SMTP id g6mr21052167qvt.132.1559904228342; Fri, 07 Jun 2019 03:43:48 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1559904228; cv=none; d=google.com; s=arc-20160816; b=cNy2k3rx9WPGCJyHtHWxnHEVA1k1isMPK9uK1Klzh+J6sbrFX47Z4N9Y/IHSKo8SHi hT89DgnYochab6VYMw5z9bMDuIb057ifoqX7/HdhXOfp7ZxKLfRTLizB/TZ8ljzZhWKX 4RmbMlYXsySYQUFKRnuW8TY3OF3jqsrjIBPU3pAyy49FLI6mZ1xLIP63zbi1gEhmE3pL lROqsr0XZ2rBXQIB3w7ofv21aOoj4I9IDg49cWYpETufddw9cUQkoLQojvqWH/yLMyFF voxdWsyD6T5WgRK/i2yOezrIeBOaIcOt4jLk4RwS91WtHQurV2UcmLXlqOLxSjlWiLBk D/AA== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=sender:errors-to:cc:list-subscribe:list-help:list-post:list-archive :list-unsubscribe:list-id:precedence:subject :content-transfer-encoding:mime-version:references:in-reply-to :message-id:date:to:from:dkim-signature; bh=nOqWwiE90nOP0TqVRDm/szto9/dNBu2y2hfwpJ0rtGA=; b=k1HjZSrFSN7R1A/5ceHZ+5NAogqDazjm43tY7YFXA5xsPoSp1OwLeTrrjY/RIwXHs4 duzjmzTAfOCJm6BngxMY2ox0fiQxpQJu2T/QgrvOLo05ej0op3PsOWtFARDZtLA8M5+s qnoELUzFnwmM1SuE/am9dzDF235Gl7d98C3KFdRLisWeGwnS1vM4RviDcL92qRKTEhUD ftYd7dHa73ru9hsyzLd/gay/o7iT1a1waJzyVrljcwkN8Uev6ps2IkUJzaLbozaS411s NWK8OhK6neYEjznvdyWRkufJiNwBBe5ImXgRervr4bs4ZAUTjmKBXSioFFeGxhum133e FVIA== ARC-Authentication-Results: i=1; mx.google.com; dkim=fail header.i=@linaro.org header.s=google header.b=i2LxqWcZ; spf=pass (google.com: domain of qemu-devel-bounces+patch=linaro.org@nongnu.org designates 209.51.188.47 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.47]) by mx.google.com with ESMTPS id x5si930705qkf.99.2019.06.07.03.43.48 for (version=TLS1_2 cipher=ECDHE-RSA-CHACHA20-POLY1305 bits=256/256); Fri, 07 Jun 2019 03:43:48 -0700 (PDT) Received-SPF: pass (google.com: domain of qemu-devel-bounces+patch=linaro.org@nongnu.org designates 209.51.188.47 as permitted sender) client-ip=209.51.188.47; Authentication-Results: mx.google.com; dkim=fail header.i=@linaro.org header.s=google header.b=i2LxqWcZ; spf=pass (google.com: domain of qemu-devel-bounces+patch=linaro.org@nongnu.org designates 209.51.188.47 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]:48188 helo=lists.gnu.org) by lists.gnu.org with esmtp (Exim 4.86_2) (envelope-from ) id 1hZCLb-0007dt-Uf for patch@linaro.org; Fri, 07 Jun 2019 06:43:47 -0400 Received: from eggs.gnu.org ([2001:470:142:3::10]:45145) by lists.gnu.org with esmtp (Exim 4.86_2) (envelope-from ) id 1hZB57-0008Sl-HN for qemu-devel@nongnu.org; Fri, 07 Jun 2019 05:22:42 -0400 Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71) (envelope-from ) id 1hZB56-00060X-Am for qemu-devel@nongnu.org; Fri, 07 Jun 2019 05:22:41 -0400 Received: from mail-wm1-x336.google.com ([2a00:1450:4864:20::336]:50988) by eggs.gnu.org with esmtps (TLS1.0:RSA_AES_128_CBC_SHA1:16) (Exim 4.71) (envelope-from ) id 1hZB56-0005zW-3w for qemu-devel@nongnu.org; Fri, 07 Jun 2019 05:22:40 -0400 Received: by mail-wm1-x336.google.com with SMTP id c66so1283495wmf.0 for ; Fri, 07 Jun 2019 02:22: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=nOqWwiE90nOP0TqVRDm/szto9/dNBu2y2hfwpJ0rtGA=; b=i2LxqWcZ7DwLaQImdxxzvQ28zftWMViFa8EQUTDemYH6FXhhiitHW6BUSTJB/DC80l /e6bhOy9L8nSLPXfnZJL9JTUPPTHLXbzyEBLNOArHrhSfHC+lhAf9VVH/g7C/GhAuqum zTWTO0kV3mcuub+w0d9b/WUR65oinfwxyUZ+LhQwPxpQJ48bjF87dD1t3p8XkrydxH23 HpxlXpfwCHuRpROg8lKaoHTiV0VjvHZAkjIp9RPGjhiWs3RxAyIWiwouUYIk8NmNeYxQ F5cO5ThlzCHBrD0d+gJOkz7wgV080FaaIqCW2k7FEyCO+I8RAUC22w1d5eCA2wgqx/B8 Sb3Q== 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=nOqWwiE90nOP0TqVRDm/szto9/dNBu2y2hfwpJ0rtGA=; b=g3+gx7sEKmhg1fGUuOlHnaP17AM4Nuo9ih9EqOvxSpstRc7H+oFi2RNbZWd7KCk7R7 GcEM6aD/D5T6V6qG3r+SqXIQXGRVKpFZBGlgFhld0LTEyJ0XB5oZiF03tzC9tiCGrIpT SdKLRo1PwNW4bG/xn6OfB3YjyWACXz2KlCFoJ1dWkJha1yB4QoL1nxR3QlzrzNAS5RKb Cl1IfrIhpB+nH60ETELyQYh9NJ4GbFVwX3FgT79n42exFk3+r90w5d+1Z3qgwHg/yhkv crPnTlU0+Wy54CgwPUsJcxQbD23K+ZGkVhduYeaFPl40EPfdfdrTgV1C9+EEK77f365E lGFA== X-Gm-Message-State: APjAAAXRZ6jtyf3ELtMmMsPIPjA97Mlny6C4elQ4pmCh3MkxhxeyJRNc f7vJL6GB5wIxbcnFUvXRhapwEQ== X-Received: by 2002:a1c:b757:: with SMTP id h84mr3064686wmf.127.1559899358974; Fri, 07 Jun 2019 02:22:38 -0700 (PDT) Received: from zen.linaroharston ([81.128.185.34]) by smtp.gmail.com with ESMTPSA id a19sm1282324wmm.46.2019.06.07.02.22.30 (version=TLS1_3 cipher=AEAD-AES256-GCM-SHA384 bits=256/256); Fri, 07 Jun 2019 02:22:35 -0700 (PDT) Received: from zen.linaroharston. (localhost [127.0.0.1]) by zen.linaroharston (Postfix) with ESMTP id 280DC1FFCB; Fri, 7 Jun 2019 10:05:56 +0100 (BST) From: =?utf-8?q?Alex_Benn=C3=A9e?= To: peter.maydell@linaro.org Date: Fri, 7 Jun 2019 10:05:51 +0100 Message-Id: <20190607090552.12434-53-alex.bennee@linaro.org> X-Mailer: git-send-email 2.20.1 In-Reply-To: <20190607090552.12434-1-alex.bennee@linaro.org> References: <20190607090552.12434-1-alex.bennee@linaro.org> MIME-Version: 1.0 X-detected-operating-system: by eggs.gnu.org: Genre and OS details not recognized. X-Received-From: 2a00:1450:4864:20::336 Subject: [Qemu-devel] [PULL 52/52] gdbstub: Implement qemu physical memory mode 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, Jon Doron Errors-To: qemu-devel-bounces+patch=linaro.org@nongnu.org Sender: "Qemu-devel" From: Jon Doron Add a new query/set which changes the memory GDB sees to physical memory only. gdb> maint packet qqemu.PhyMemMode will reply the current phy_mem_mode state (1 for enabled, 0 for disabled) gdb> maint packet Qqemu.PhyMemMode:1 Will make GDB read/write only to physical memory, set to 0 to disable Signed-off-by: Jon Doron Message-Id: <20190529064148.19856-21-arilou@gmail.com> Signed-off-by: Alex Bennée -- 2.20.1 diff --git a/gdbstub.c b/gdbstub.c index 12671e6e11..14a9c22f5a 100644 --- a/gdbstub.c +++ b/gdbstub.c @@ -46,11 +46,27 @@ #define GDB_ATTACHED "1" #endif +#ifndef CONFIG_USER_ONLY +static int phy_memory_mode; +#endif + static inline int target_memory_rw_debug(CPUState *cpu, target_ulong addr, uint8_t *buf, int len, bool is_write) { - CPUClass *cc = CPU_GET_CLASS(cpu); + CPUClass *cc; +#ifndef CONFIG_USER_ONLY + if (phy_memory_mode) { + if (is_write) { + cpu_physical_memory_write(addr, buf, len); + } else { + cpu_physical_memory_read(addr, buf, len); + } + return 0; + } +#endif + + cc = CPU_GET_CLASS(cpu); if (cc->memory_rw_debug) { return cc->memory_rw_debug(cpu, addr, buf, len, is_write); } @@ -2132,8 +2148,36 @@ static void handle_query_attached(GdbCmdContext *gdb_ctx, void *user_ctx) static void handle_query_qemu_supported(GdbCmdContext *gdb_ctx, void *user_ctx) { - put_packet(gdb_ctx->s, "sstepbits;sstep"); + snprintf(gdb_ctx->str_buf, sizeof(gdb_ctx->str_buf), "sstepbits;sstep"); +#ifndef CONFIG_USER_ONLY + pstrcat(gdb_ctx->str_buf, sizeof(gdb_ctx->str_buf), ";PhyMemMode"); +#endif + put_packet(gdb_ctx->s, gdb_ctx->str_buf); +} + +#ifndef CONFIG_USER_ONLY +static void handle_query_qemu_phy_mem_mode(GdbCmdContext *gdb_ctx, + void *user_ctx) +{ + snprintf(gdb_ctx->str_buf, sizeof(gdb_ctx->str_buf), "%d", phy_memory_mode); + put_packet(gdb_ctx->s, gdb_ctx->str_buf); +} + +static void handle_set_qemu_phy_mem_mode(GdbCmdContext *gdb_ctx, void *user_ctx) +{ + if (!gdb_ctx->num_params) { + put_packet(gdb_ctx->s, "E22"); + return; + } + + if (!gdb_ctx->params[0].val_ul) { + phy_memory_mode = 0; + } else { + phy_memory_mode = 1; + } + put_packet(gdb_ctx->s, "OK"); } +#endif static GdbCmdParseEntry gdb_gen_query_set_common_table[] = { /* Order is important if has same prefix */ @@ -2215,6 +2259,12 @@ static GdbCmdParseEntry gdb_gen_query_table[] = { .handler = handle_query_qemu_supported, .cmd = "qemu.Supported", }, +#ifndef CONFIG_USER_ONLY + { + .handler = handle_query_qemu_phy_mem_mode, + .cmd = "qemu.PhyMemMode", + }, +#endif }; static GdbCmdParseEntry gdb_gen_set_table[] = { @@ -2225,6 +2275,14 @@ static GdbCmdParseEntry gdb_gen_set_table[] = { .cmd_startswith = 1, .schema = "l0" }, +#ifndef CONFIG_USER_ONLY + { + .handler = handle_set_qemu_phy_mem_mode, + .cmd = "qemu.PhyMemMode:", + .cmd_startswith = 1, + .schema = "l0" + }, +#endif }; static void handle_gen_query(GdbCmdContext *gdb_ctx, void *user_ctx)