public inbox for gdb-patches@sourceware.org
 help / color / mirror / Atom feed
From: Simon Marchi <simark@simark.ca>
To: Pedro Alves <pedro@palves.net>,
	Andrew Burgess <aburgess@redhat.com>,
	gdb-patches@sourceware.org
Subject: Re: [PATCHv2 1/4] gdb: more debug output for displaced stepping
Date: Tue, 21 Mar 2023 10:41:23 -0400	[thread overview]
Message-ID: <8473de37-fa6b-f7ec-e4b6-78b971324804@simark.ca> (raw)
In-Reply-To: <15ad53ba-53f0-f26e-8019-f5a543e0beea@palves.net>

On 3/21/23 08:29, Pedro Alves wrote:
> 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.

I think that given the current code base in master, Andrew's change
makes sense.  I like that we get rid of the complex condition in
resume_1 (to know when to print debug output), since the debug print is
now placed in the code path where the displaced step is actually
prepared.  But perhaps the same can be achieved by placing the prints in
displaced_step_prepare_throw, and everyone is happy?

Simon

  reply	other threads:[~2023-03-21 14:41 UTC|newest]

Thread overview: 36+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2023-02-23 15:46 [PATCH 0/3] AMD64 Displaced Stepping Fix Andrew Burgess
2023-02-23 15:46 ` [PATCH 1/3] gdb: more debug output for displaced stepping Andrew Burgess
2023-02-23 15:46 ` [PATCH 2/3] gdb: remove gdbarch_displaced_step_fixup_p Andrew Burgess
2023-02-23 15:46 ` [PATCH 3/3] gdb: fix reg corruption from displaced stepping on amd64 Andrew Burgess
2023-03-16 16:39 ` [PATCHv2 0/4] AMD64 Displaced Stepping Fix Andrew Burgess
2023-03-16 16:39   ` [PATCHv2 1/4] gdb: more debug output for displaced stepping Andrew Burgess
2023-03-21 12:29     ` Pedro Alves
2023-03-21 14:41       ` Simon Marchi [this message]
2023-03-22 21:17         ` [PATCHv2 0/2] displaced stepping debug improvements Andrew Burgess
2023-03-22 21:17           ` [PATCHv2 1/2] gdb: more debug output for displaced stepping Andrew Burgess
2023-03-22 21:17           ` [PATCHv2 2/2] gdb: move displaced_step_dump_bytes into gdbsupport (and rename) Andrew Burgess
2023-03-27 12:35           ` [PATCHv2 0/2] displaced stepping debug improvements Andrew Burgess
2023-03-21 14:45     ` [PATCHv2 1/4] gdb: more debug output for displaced stepping Simon Marchi
2023-03-16 16:39   ` [PATCHv2 2/4] gdb: remove gdbarch_displaced_step_fixup_p Andrew Burgess
2023-03-21 13:10     ` Pedro Alves
2023-03-22 21:22       ` Andrew Burgess
2023-03-16 16:39   ` [PATCHv2 3/4] gdb: fix reg corruption from displaced stepping on amd64 Andrew Burgess
2023-03-21 13:23     ` Pedro Alves
2023-03-16 16:39   ` [PATCHv2 4/4] gdb: remove redundant signal passing Andrew Burgess
2023-03-27 12:32   ` [PATCHv3 0/3] AMD64 Displaced Stepping Fix Andrew Burgess
2023-03-27 12:32     ` [PATCHv3 1/3] gdb: more debug output for displaced stepping Andrew Burgess
2023-03-28 13:05       ` Simon Marchi
2023-03-28 15:08         ` Andrew Burgess
2023-03-28 15:11           ` Simon Marchi
2023-03-29  9:42             ` Andrew Burgess
2023-03-27 12:32     ` [PATCHv3 2/3] gdb: move displaced_step_dump_bytes into gdbsupport (and rename) Andrew Burgess
2023-03-28 13:10       ` Simon Marchi
2023-03-29  9:43         ` Andrew Burgess
2023-03-27 12:32     ` [PATCHv3 3/3] gdb: fix reg corruption from displaced stepping on amd64 Andrew Burgess
2023-03-29  9:43       ` Pedro Alves
2023-03-28 12:33     ` [PATCHv3 0/3] AMD64 Displaced Stepping Fix Simon Marchi
2023-03-28 15:29       ` Andrew Burgess
2023-03-29 13:46     ` [PATCHv4] gdb: fix reg corruption from displaced stepping on amd64 Andrew Burgess
2023-04-04 13:03       ` Pedro Alves
2023-04-06 13:29         ` Andrew Burgess
2023-04-06 15:38           ` Andrew Burgess

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=8473de37-fa6b-f7ec-e4b6-78b971324804@simark.ca \
    --to=simark@simark.ca \
    --cc=aburgess@redhat.com \
    --cc=gdb-patches@sourceware.org \
    --cc=pedro@palves.net \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for read-only IMAP folder(s) and NNTP newsgroup(s).