From patchwork Wed Mar 6 14:40:38 2024 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: 778319 Delivered-To: patch@linaro.org Received: by 2002:a05:6000:47:b0:33e:474f:8c56 with SMTP id k7csp328253wrx; Wed, 6 Mar 2024 06:50:17 -0800 (PST) X-Forwarded-Encrypted: i=2; AJvYcCVbKb5MzROPbjusrggg3O2O/NiwbD+rGepbsyaJsr+MmQex4GXG6Ls010odnRu0CQUDG6xnEIXfwgE5b8BnWYFu X-Google-Smtp-Source: AGHT+IETCUTBpXbWDwkVOeDhPrEYQQdx1Nw8xZRmi/CACOVvOL9JIIkMSFWfI9uwy1/eZXWHQ3FL X-Received: by 2002:a05:622a:8f:b0:42e:dfd4:61be with SMTP id o15-20020a05622a008f00b0042edfd461bemr5642227qtw.0.1709736617547; Wed, 06 Mar 2024 06:50:17 -0800 (PST) ARC-Seal: i=1; a=rsa-sha256; t=1709736617; cv=none; d=google.com; s=arc-20160816; b=h0pQ5VbP/0FqdF+cWZmmcr7SU7UlA3Y2BGbwygyvH7VLr7iRAiGA42K4q3IQJ0Mu4r YlVoplDmCPIQD7BZ/YGVWGAS+sKohWUSMsPldRht2GCJ+AGRm4BSDxH76BU8u8yTbPha POtT+yw9moSWw8MRknO4YJ+gKLswfggKVo0m9fpCfX3Fq4aAYInVDGRQ9M1leR9WMN5x JJOQFgKqF2hf5bjlt3elek0ZyQYo0g5IIIA8TJF/3paOBSFZVAQj5E3OH4T7qalewHmH JlIW4rTVMN3Fl+TodGkNveGvaNYL6Add7dRGB2opOTQ0pTj2JGRTTypsbAp+oVcejDkx jNew== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=sender:errors-to:list-subscribe:list-help:list-post:list-archive :list-unsubscribe:list-id:precedence:content-transfer-encoding :mime-version:references:in-reply-to:message-id:date:subject:cc:to :from:dkim-signature; bh=jSaTEw7HdvNrh+oHFXPMzlQIiNjmc7BE8/LanxovJAc=; fh=OMMbDy/vaHhJu0vH6+b4Kpb+BOXgoDYkxnV/deXBpmU=; b=1Jw5ZpJO6QFeZNIx2pSBnSQWYlKq9MYAOGcHpDgQjlvLyqhT12yIF3S1Pj4WWU+fz7 RVy7QrhIj5iuNrabLQyT7AzDkOR7rmikHgsFjWOxEag+UBWRM9+qnUsFl3D3ZUuV7m2v WG4VKm45whzUWxzwn74SlnKyN5L5uqaHRLct+bqGn6uQccv60DfDDBdJ8tNLV1Ixn28d 77m2pnk9gYa9D67z0s/rY1N1Fa2wIDlw6vSQvZuiD0S66ukP00OLgeqN4N83sYWqlBhJ sIbDVIjwKljREljefnGgmMuuMXv50yc1gxbXqveyRih+OKKTddFCQHmahUquCrU401Vl TAhw==; dara=google.com ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@linaro.org header.s=google header.b=cFTWRlYH; spf=pass (google.com: domain of qemu-devel-bounces+patch=linaro.org@nongnu.org designates 209.51.188.17 as permitted sender) smtp.mailfrom="qemu-devel-bounces+patch=linaro.org@nongnu.org"; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=linaro.org Return-Path: Received: from lists.gnu.org (lists.gnu.org. [209.51.188.17]) by mx.google.com with ESMTPS id o1-20020a05622a008100b0042f12ed694bsi999127qtw.641.2024.03.06.06.50.17 for (version=TLS1_2 cipher=ECDHE-ECDSA-CHACHA20-POLY1305 bits=256/256); Wed, 06 Mar 2024 06:50:17 -0800 (PST) Received-SPF: pass (google.com: domain of qemu-devel-bounces+patch=linaro.org@nongnu.org designates 209.51.188.17 as permitted sender) client-ip=209.51.188.17; Authentication-Results: mx.google.com; dkim=pass header.i=@linaro.org header.s=google header.b=cFTWRlYH; spf=pass (google.com: domain of qemu-devel-bounces+patch=linaro.org@nongnu.org designates 209.51.188.17 as permitted sender) smtp.mailfrom="qemu-devel-bounces+patch=linaro.org@nongnu.org"; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=linaro.org Received: from localhost ([::1] helo=lists1p.gnu.org) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1rhsa3-0006kc-2s; Wed, 06 Mar 2024 09:49:15 -0500 Received: from eggs.gnu.org ([2001:470:142:3::10]) by lists.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.90_1) (envelope-from ) id 1rhsZy-0006h9-Nu for qemu-devel@nongnu.org; Wed, 06 Mar 2024 09:49:10 -0500 Received: from mail-wr1-x42b.google.com ([2a00:1450:4864:20::42b]) by eggs.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_128_GCM_SHA256:128) (Exim 4.90_1) (envelope-from ) id 1rhsZp-0004Mf-WA for qemu-devel@nongnu.org; Wed, 06 Mar 2024 09:49:10 -0500 Received: by mail-wr1-x42b.google.com with SMTP id ffacd0b85a97d-33d90dfe73cso621532f8f.0 for ; Wed, 06 Mar 2024 06:49:01 -0800 (PST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=linaro.org; s=google; t=1709736540; x=1710341340; darn=nongnu.org; h=content-transfer-encoding:mime-version:references:in-reply-to :message-id:date:subject:cc:to:from:from:to:cc:subject:date :message-id:reply-to; bh=jSaTEw7HdvNrh+oHFXPMzlQIiNjmc7BE8/LanxovJAc=; b=cFTWRlYHDd4S6pg8OOc3wIiZK70ccK+ru75QlQPg8eW4jvzHivzuJEbHzlGlFfNaNm 9CRrBFp2kP31RRWJ2fTTgZ2PEC0BO/t6QMGT9U5JVfCcqx966ognDKeo3vjyruMgnRtQ rvRnzieB2vqmBaKbUqyQiH5gZlPm1kssDmhfWK8YUdeiCJWK2Qz+iu72mD0eJ7QphM0f KBM6pWa61oO4vxw6tFMxPsULiL/1v98aQ7oZnPUADUVAMzf3nTZ+zlQvUSWdMjwegR+1 3BEtCKhhKTlUhXaiuDTtphF4YQE7w0COoo2dvzGSY1fa4U2dfSN9XLFO6I3+dws2u3u4 2+pg== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20230601; t=1709736540; x=1710341340; h=content-transfer-encoding:mime-version:references:in-reply-to :message-id:date:subject:cc:to:from:x-gm-message-state:from:to:cc :subject:date:message-id:reply-to; bh=jSaTEw7HdvNrh+oHFXPMzlQIiNjmc7BE8/LanxovJAc=; b=RXTXJP6FPDot2ilLF6lkElf2wFyUv/hAiylgK0omzj3Letlf+Fw2N6Cp1Id4Uiruyz k5/aL633SSi704MCiYu9KI9cYs3/sSrl1vO8nUdZkEUlpfDf/JuQuYsPBdqZFEIVAiG+ sce7JbtRvPBB9QuS50wNYqoRsLVybZFI4mHcauG0aurP4Gn9lZPdE++5JJjFLcG+lT2q KIXnxOVzIrnsGmnuw/tu+yD/M9VpLvo3ompOI51jaY2Efpe0zH0sNslALTELwTYgJfwL uYUwRYyRQI0JeSs6H9geEEI6B8TlXFd1GQJe0iBxP1rbd7Nk8hQXPlcNqljZ4gfJb0XH Zdmg== X-Gm-Message-State: AOJu0YyAD+QGlmWdtU3KTAertAcPN5ymnuSc84LVlfF45xYR8SgB1cLm uiks7zIZNb9vk4VbHKpF5SlzObFh/rhB9mn585LE4ySWHoY5tZRdOJVz/S7Hbc+E37R9mkQydQe K X-Received: by 2002:a5d:4212:0:b0:33e:835:668b with SMTP id n18-20020a5d4212000000b0033e0835668bmr5030839wrq.22.1709736540304; Wed, 06 Mar 2024 06:49:00 -0800 (PST) Received: from draig.lan ([85.9.250.243]) by smtp.gmail.com with ESMTPSA id cr11-20020a05600004eb00b0033dd2c3131fsm17580691wrb.65.2024.03.06.06.48.57 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Wed, 06 Mar 2024 06:49:00 -0800 (PST) Received: from draig.lan (localhost [IPv6:::1]) by draig.lan (Postfix) with ESMTP id E358C5F9F3; Wed, 6 Mar 2024 14:40:43 +0000 (GMT) From: =?utf-8?q?Alex_Benn=C3=A9e?= To: qemu-devel@nongnu.org Cc: =?utf-8?q?Alex_Benn=C3=A9e?= , Richard Henderson Subject: [PULL 26/29] disas: introduce show_opcodes Date: Wed, 6 Mar 2024 14:40:38 +0000 Message-Id: <20240306144041.3787188-27-alex.bennee@linaro.org> X-Mailer: git-send-email 2.39.2 In-Reply-To: <20240306144041.3787188-1-alex.bennee@linaro.org> References: <20240306144041.3787188-1-alex.bennee@linaro.org> MIME-Version: 1.0 Received-SPF: pass client-ip=2a00:1450:4864:20::42b; envelope-from=alex.bennee@linaro.org; helo=mail-wr1-x42b.google.com X-Spam_score_int: -20 X-Spam_score: -2.1 X-Spam_bar: -- X-Spam_report: (-2.1 / 5.0 requ) BAYES_00=-1.9, DKIM_SIGNED=0.1, DKIM_VALID=-0.1, DKIM_VALID_AU=-0.1, DKIM_VALID_EF=-0.1, RCVD_IN_DNSWL_NONE=-0.0001, SPF_HELO_NONE=0.001, SPF_PASS=-0.001, T_SCC_BODY_TEXT_LINE=-0.01 autolearn=ham autolearn_force=no X-Spam_action: no action X-BeenThere: qemu-devel@nongnu.org X-Mailman-Version: 2.1.29 Precedence: list List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Errors-To: qemu-devel-bounces+patch=linaro.org@nongnu.org Sender: qemu-devel-bounces+patch=linaro.org@nongnu.org For plugins we don't expect the raw opcodes in the disassembly. We already deal with this by hand crafting our capstone call but for other diassemblers we need a flag. Introduce show_opcodes which defaults to off. Reviewed-by: Richard Henderson Signed-off-by: Alex Bennée Message-Id: <20240305121005.3528075-27-alex.bennee@linaro.org> diff --git a/include/disas/dis-asm.h b/include/disas/dis-asm.h index 2324f6b1a46..b26867b6417 100644 --- a/include/disas/dis-asm.h +++ b/include/disas/dis-asm.h @@ -396,6 +396,14 @@ typedef struct disassemble_info { /* Command line options specific to the target disassembler. */ char * disassembler_options; + /* + * When true instruct the disassembler it may preface the + * disassembly with the opcodes values if it wants to. This is + * mainly for the benefit of the plugin interface which doesn't want + * that. + */ + bool show_opcodes; + /* Field intended to be used by targets in any way they deem suitable. */ void *target_info; diff --git a/disas/disas.c b/disas/disas.c index 0d2d06c2ecc..17170d291ec 100644 --- a/disas/disas.c +++ b/disas/disas.c @@ -299,6 +299,7 @@ void disas(FILE *out, const void *code, size_t size) s.info.buffer = code; s.info.buffer_vma = (uintptr_t)code; s.info.buffer_length = size; + s.info.show_opcodes = true; if (s.info.cap_arch >= 0 && cap_disas_host(&s.info, code, size)) { return;