From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: from mail-wr1-f51.google.com (mail-wr1-f51.google.com [209.85.221.51]) by sourceware.org (Postfix) with ESMTPS id 5352A3858D37 for ; Tue, 21 Mar 2023 12:29:46 +0000 (GMT) DMARC-Filter: OpenDMARC Filter v1.4.2 sourceware.org 5352A3858D37 Authentication-Results: sourceware.org; dmarc=none (p=none dis=none) header.from=palves.net Authentication-Results: sourceware.org; spf=pass smtp.mailfrom=gmail.com Received: by mail-wr1-f51.google.com with SMTP id i9so13482640wrp.3 for ; Tue, 21 Mar 2023 05:29:46 -0700 (PDT) X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20210112; t=1679401785; h=content-transfer-encoding:content-language:in-reply-to:mime-version :user-agent:date:message-id:from:references:to:subject :x-gm-message-state:from:to:cc:subject:date:message-id:reply-to; bh=+Vi++aWoIyXBYNFxSqtUHebG2L9FVAYtTvQP1xWXJh0=; b=pYdDyy2kTAg4jMsPHYPc4gkfnEZT2396bM0zrINZ1Zy7IA3amOe+RPGMBmXQDK4rYX JA7cfeMGAtO6ZpfwT8FeB8RC5F2LdjkJgimOibLWyUoIHE9LT2fRag2KaePp+Lprm36j PibJM9SajJ1S1XGfhalFI5JtybCcemljhm8OAhqsr6yJEPZSLdssCmf7Msb51/CaQk3F hMEb4aXLFZcFSGNBRVkZCXZVt7MBmCXop7BzKoDvjnBbOhA87MNWkLz769yN7oqF67kN SBLaTD4vep+itlwbxVKHWTGmznkCSbLGSUNpxeUndxYdoKYDi0YEgWB5ZOgc7Q/P7itH vlvg== X-Gm-Message-State: AO0yUKXszRagGTWDF+DvL584MJhPQ2hCVRwhh8yF822sX5t8rdsoYUuW G6NyrXP4UM9eiVUtMR4+j1o= X-Google-Smtp-Source: AK7set+5JM/0vw//Ikf+jnMl9GUu2dHnbo7cstpudfmoon8XPlpiCSVVPa3IoeBPAuQoQu9haixTwA== X-Received: by 2002:a5d:4992:0:b0:2d4:896:a204 with SMTP id r18-20020a5d4992000000b002d40896a204mr1861563wrq.60.1679401784927; Tue, 21 Mar 2023 05:29:44 -0700 (PDT) Received: from ?IPv6:2001:8a0:f93c:5900::1fe? ([2001:8a0:f93c:5900::1fe]) by smtp.gmail.com with ESMTPSA id e24-20020a05600c219800b003ed1f111fdesm13238475wme.20.2023.03.21.05.29.44 (version=TLS1_3 cipher=TLS_AES_128_GCM_SHA256 bits=128/128); Tue, 21 Mar 2023 05:29:44 -0700 (PDT) Subject: Re: [PATCHv2 1/4] gdb: more debug output for displaced stepping To: Andrew Burgess , gdb-patches@sourceware.org, Simon Marchi References: <09efdbfc7f9f0bf0402c222237c85f837b011082.1678984664.git.aburgess@redhat.com> From: Pedro Alves Message-ID: <15ad53ba-53f0-f26e-8019-f5a543e0beea@palves.net> Date: Tue, 21 Mar 2023 12:29:50 +0000 User-Agent: Mozilla/5.0 (X11; Linux x86_64; rv:78.0) Gecko/20100101 Thunderbird/78.10.1 MIME-Version: 1.0 In-Reply-To: <09efdbfc7f9f0bf0402c222237c85f837b011082.1678984664.git.aburgess@redhat.com> Content-Type: text/plain; charset=utf-8 Content-Language: en-US Content-Transfer-Encoding: 7bit X-Spam-Status: No, score=-4.4 required=5.0 tests=BAYES_00,FREEMAIL_FORGED_FROMDOMAIN,FREEMAIL_FROM,HEADER_FROM_DIFFERENT_DOMAINS,KAM_DMARC_STATUS,NICE_REPLY_A,RCVD_IN_DNSWL_NONE,RCVD_IN_MSPIKE_H2,SPF_HELO_NONE,SPF_PASS,TXREP autolearn=no autolearn_force=no version=3.4.6 X-Spam-Checker-Version: SpamAssassin 3.4.6 (2021-04-09) on server2.sourceware.org List-Id: On 2023-03-16 4:39 p.m., Andrew Burgess via Gdb-patches wrote: > While investigating a displaced stepping issue I wanted an easy way to > see what GDB thought the original instruction was, and what > instruction GDB replaced that with when performing the displaced step. > > We do print out the address that is being stepped, so I can track down > the original instruction. > > And we do print out the bytes of the new instruction, so I can figure > out what the replacement instruction was, but it's not really easy. > > In this commit, within displaced_step_buffers::prepare, I add new > debug output which disassembles both the original instruction, and the > replacement instruction, and prints both these instructions, along > with the bytes that make these instructions, to the debug output. > > This new debug improved on some debug that was already present in > infrun.c, however, the old infrun.c debug (a) didn't actually > disassemble the instruction, it just printed the bytes, and (b) there > was an assumption that all instructions are 4-bytes long, which > clearly isn't correct. > > I think it makes more sense to have all this debug in the > displaced-stepping.c file, so I've removed the infrun.c code, and > added my new debug in displaced-stepping.c. A downside of that move is that AMD GPUs (amd-dbgapi-target.c) actually support displaced stepping (though that part of the port hasn't been upstreamed yet), but we don't use displaced_step_buffers there. So we'll be losing the debug output in that target. Adding Simon who may want to look into that. Pedro Alves