From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: from simark.ca by simark.ca with LMTP id 0BrsKOh2qV/vbwAAWB0awg (envelope-from ) for ; Mon, 09 Nov 2020 12:05:44 -0500 Received: by simark.ca (Postfix, from userid 112) id 318E11F08D; Mon, 9 Nov 2020 12:05:43 -0500 (EST) X-Spam-Checker-Version: SpamAssassin 3.4.2 (2018-09-13) on simark.ca X-Spam-Level: X-Spam-Status: No, score=-1.1 required=5.0 tests=DKIM_SIGNED,DKIM_VALID, DKIM_VALID_AU,MAILING_LIST_MULTI,URIBL_BLOCKED autolearn=ham autolearn_force=no version=3.4.2 Received: from sourceware.org (server2.sourceware.org [8.43.85.97]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) key-exchange X25519 server-signature RSA-PSS (2048 bits) server-digest SHA256) (No client certificate requested) by simark.ca (Postfix) with ESMTPS id 2B0421E552 for ; Mon, 9 Nov 2020 12:05:36 -0500 (EST) Received: from server2.sourceware.org (localhost [IPv6:::1]) by sourceware.org (Postfix) with ESMTP id 3B7C43973016; Mon, 9 Nov 2020 17:05:35 +0000 (GMT) DKIM-Filter: OpenDKIM Filter v2.11.0 sourceware.org 3B7C43973016 DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=sourceware.org; s=default; t=1604941535; bh=cEKKN0WvlZWSK+aIrRvBsBdnGKl4xQZ1+QUqbuLKsRM=; h=To:Subject:Date:In-Reply-To:References:List-Id:List-Unsubscribe: List-Archive:List-Post:List-Help:List-Subscribe:From:Reply-To:Cc: From; b=N1zdK65Q2gUvI4U4uY/mOQU3EVzattUrvvuXyzJvHU0kmsmPFZY5ZetlflV7kaOCj NN8d35vVzJDbu93KS6SH5PcqRd5VDBvCn1gHifRx8aY6dpK3ojl5V/UAkLjuItlemb EpFeH/Pm3GqbRGzaYlopidskSCoOF0qdIRPgnSyY= Received: from mail-qt1-x843.google.com (mail-qt1-x843.google.com [IPv6:2607:f8b0:4864:20::843]) by sourceware.org (Postfix) with ESMTPS id 0C741397280B for ; Mon, 9 Nov 2020 17:05:32 +0000 (GMT) DMARC-Filter: OpenDMARC Filter v1.3.2 sourceware.org 0C741397280B Received: by mail-qt1-x843.google.com with SMTP id v11so6083421qtq.12 for ; Mon, 09 Nov 2020 09:05:32 -0800 (PST) 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; bh=cEKKN0WvlZWSK+aIrRvBsBdnGKl4xQZ1+QUqbuLKsRM=; b=cZ+eNIdPpQmBDgj2kHL9L5s40e5DVWGGQaGBq41Nd7y+b/w0kc0zNYKBnBiOMkovsw MjWPxTG0Zi8vnjsOfWi9EyGggXzbnuXhaxUWWzFFDzFKMLc6iiLAPVFD1PAISonbevZP f6/JmPVL8Q9qHjdM57z6A2QlY2y0AhPIpIaFujH+LvvKkiSfkbvspzIA4kX/N8ui4lYJ o1M21mYNIIgFrt4IFPQkDSnBRzc/Z0upYdIZNAAJtCrU6DtTCO0rC6wRRWlskSfbV4in OLRI5lEt5kqJO3bo/El2eB/SJj3UQ7dP/vH7nPNwdAnfbFSY2oNBqyAinhC06xU82rxS ZqAg== X-Gm-Message-State: AOAM532pxV+2D/n1ZSYesPRaI+vEbBsSzGLkieflBPK3OTofK5Gw2xc1 kFaCNILGZlofh65+2Y2mEuI0Zz28pWkkaA== X-Google-Smtp-Source: ABdhPJybD0TmwT+9ydv73KwN1y5JD1QOTBrzdTE+uBjR2HWfqXk53LhCpj51+zNYpxx+EIZVuDSR3g== X-Received: by 2002:ac8:4d5b:: with SMTP id x27mr13972021qtv.135.1604941530245; Mon, 09 Nov 2020 09:05:30 -0800 (PST) Received: from localhost.localdomain ([2804:7f0:8284:1487:5c3b:b268:ad95:5f37]) by smtp.gmail.com with ESMTPSA id s2sm5948358qtw.44.2020.11.09.09.05.28 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Mon, 09 Nov 2020 09:05:29 -0800 (PST) To: gdb-patches@sourceware.org Subject: [PATCH v3 22/24] Document new "x" and "print" memory tagging extensions Date: Mon, 9 Nov 2020 14:04:33 -0300 Message-Id: <20201109170435.15766-23-luis.machado@linaro.org> X-Mailer: git-send-email 2.17.1 In-Reply-To: <20201109170435.15766-1-luis.machado@linaro.org> References: <20201109170435.15766-1-luis.machado@linaro.org> X-BeenThere: gdb-patches@sourceware.org X-Mailman-Version: 2.1.29 Precedence: list List-Id: Gdb-patches mailing list List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , From: Luis Machado via Gdb-patches Reply-To: Luis Machado Cc: david.spickett@linaro.org Errors-To: gdb-patches-bounces@sourceware.org Sender: "Gdb-patches" Document the changes to the "print" and "x" commands to support memory tagging. gdb/doc/ChangeLog: YYYY-MM-DD Luis Machado * gdb.texinfo (Data): Document memory tagging changes to the "print" command. (Examining Memory): Document memory tagging changes to the "x" command. (Memory Tagging): Update with more information on changes to the "x" and "print" commands. --- gdb/doc/gdb.texinfo | 28 +++++++++++++++++++++++++--- 1 file changed, 25 insertions(+), 3 deletions(-) diff --git a/gdb/doc/gdb.texinfo b/gdb/doc/gdb.texinfo index e826775755..37d35316e0 100644 --- a/gdb/doc/gdb.texinfo +++ b/gdb/doc/gdb.texinfo @@ -10019,6 +10019,10 @@ If you omit @var{expr}, @value{GDBN} displays the last value again (from the conveniently inspect the same value in an alternative format. @end table +If the architecture supports memory tagging, the @code{print} command will +display pointer/memory tag mismatches if what is being printed is a pointer +or reference type. @xref{Memory Tagging}. + A more low-level way of examining data is with the @code{x} command. It examines data in memory at a specified address and prints it in a specified format. @xref{Memory, ,Examining Memory}. @@ -10786,7 +10790,8 @@ number is specified, memory is examined backward from @var{addr}. @item @var{f}, the display format The display format is one of the formats used by @code{print} (@samp{x}, @samp{d}, @samp{u}, @samp{o}, @samp{t}, @samp{a}, @samp{c}, -@samp{f}, @samp{s}), and in addition @samp{i} (for machine instructions). +@samp{f}, @samp{s}), @samp{i} (for machine instructions) and +@samp{m} (for displaying memory tags). The default is @samp{x} (hexadecimal) initially. The default changes each time you use either @code{x} or @code{print}. @@ -10881,6 +10886,22 @@ counter is shown with a @code{=>} marker. For example: 0x804838c : call 0x80482d4 @end smallexample +If the architecture supports memory tagging, the tags can be displayed by +using @samp{m}. @xref{Memory Tagging}. + +The information will be displayed once per granule size +(the amount of bytes a particular memory tag covers). For example, AArch64 +has a granule size of 16 bytes, so it will display a tag every 16 bytes. + +Due to the way @value{GDBN} prints information with the @code{x} command (not +aligned to a particular boundary), the tag information will refer to the +initial address displayed on a particular line. If a memory tag boundary +is crossed in the middle of a line displayed by the @code{x} command, it +will be displayed on the next line. + +The @samp{m} format doesn't affect any other specified formats that were +passed to the @code{x} command. + @cindex @code{$_}, @code{$__}, and value history The addresses and contents printed by the @code{x} command are not saved in the value history because there is often too much of them and they @@ -10958,8 +10979,9 @@ If the underlying architecture supports memory tagging, like AArch64 MTE or SPARC ADI do, @value{GDBN} can make use of it to validate addresses and pointers against memory allocation tags. -A command prefix of @code{mtag} gives access to the various memory tagging -commands. +The @code{print} (@pxref{Data}) and @code{x} (@pxref{Memory}) commands will +display tag information when appropriate, and a command prefix of @code{mtag} +gives access to the various memory tagging commands. The @code{mtag} commands are the following: -- 2.17.1