Mirror of the gdb-patches mailing list
 help / color / mirror / Atom feed
From: Pedro Alves <palves@redhat.com>
To: Toshihito Kikuchi <k.toshihito@yahoo.de>,
	       "gdb-patches@sourceware.org" <gdb-patches@sourceware.org>
Subject: Re: [PATCH] Add a new format letter to dump instructions backward
Date: Mon, 25 Jan 2016 11:41:00 -0000	[thread overview]
Message-ID: <56A609E7.6050903@redhat.com> (raw)
In-Reply-To: <1827952218.466587.1453670934999.JavaMail.yahoo@mail.yahoo.com>

On 01/24/2016 09:28 PM, Toshihito Kikuchi wrote:
> Hi all,
> 

Hi there.

> With the attached patch, I'd like to add a new format letter "j" to
> the "x" command to dump instructions in backward direction.

Thanks.

What's the rationale for making this a format letter though?
It seems orthogonal to the other format letters to me.

Example, say I dump raw opcodes in hex, with:

 (gdb) x /4x main
 0x400766 <main>:        0x55    0x48    0x89    0xe5
 (gdb) x /4x
 0x40076a <main+4>:      0x48    0x83    0xec    0x30
 (gdb) x
 0x40076e <main+8>:      0x48
 (gdb)
 0x40076f <main+9>:      0xc7

but then I can't go backwards in hex, as /j overrides it,
and always prints like /i:

 (gdb) x /4xj
    0x400766 <main>:     push   %rbp
    0x400767 <main+1>:   mov    %rsp,%rbp
    0x40076a <main+4>:   sub    $0x30,%rsp
 => 0x40076e <main+8>:   movq   $0x0,-0x8(%rbp)


Seems to me that some other UI would be better.  E.g.,:

 #1 - a different switch, like "x -back /i " ?

 #2 - a different command, like "bx" ?

 #3 - negative repeat counts ?

   (gdb) x /4i    // next 4 instructions
   (gdb) x /-4i   // previous 4 instructions

   (gdb) x /4bx    // next 4 bytes, in hex
   (gdb) x /-4bx   // previous 4 bytes, in hex


Added #1 just for completeness, I don't find it very convenient.

#3 feels natural to me.  What do you (and others) think?

Adding some tests would be great.  Also, the documentation
will need to be updated.

If you haven't yet, please take a look at:
 https://sourceware.org/gdb/wiki/ContributionChecklist

Thanks,
Pedro Alves


  reply	other threads:[~2016-01-25 11:41 UTC|newest]

Thread overview: 16+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
     [not found] <1827952218.466587.1453670934999.JavaMail.yahoo.ref@mail.yahoo.com>
2016-01-24 21:31 ` Toshihito Kikuchi
2016-01-25 11:41   ` Pedro Alves [this message]
2016-01-25 18:10     ` John Baldwin
2016-01-25 18:22       ` Paul_Koning
2016-01-25 18:27         ` Pedro Alves
2016-01-25 20:11           ` Paul_Koning
2016-01-26  5:39             ` Toshihito Kikuchi
2016-01-27 16:04               ` Andrew Burgess
2016-01-27 20:09                 ` Paul_Koning
2016-01-28 11:53                   ` Pedro Alves
2016-02-07 23:19                     ` [PATCH] Negative repeat count for 'x' command Toshihito Kikuchi
2016-02-17 11:38                       ` Pedro Alves
2016-03-23  0:27                         ` Toshihito Kikuchi
2016-04-11 12:17                       ` Pedro Alves
2016-04-15  0:30                         ` Toshihito Kikuchi
     [not found]                           ` <5714DE73.5010104@redhat.com>
2016-04-28 18:06                             ` Toshihito Kikuchi

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=56A609E7.6050903@redhat.com \
    --to=palves@redhat.com \
    --cc=gdb-patches@sourceware.org \
    --cc=k.toshihito@yahoo.de \
    /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