Mirror of the gdb-patches mailing list
 help / color / mirror / Atom feed
From: Paul Pluzhnikov <ppluzhnikov@google.com>
To: Joel Brobecker <brobecker@adacore.com>
Cc: gdb-patches@sourceware.org
Subject: Re: [RFC][patch] Allow to disassemble line.
Date: Fri, 02 Oct 2009 18:31:00 -0000	[thread overview]
Message-ID: <8ac60eac0910021131j71b1f79t5d908195652dc7e1@mail.gmail.com> (raw)
In-Reply-To: <20091002065226.GW10338@adacore.com>

On Thu, Oct 1, 2009 at 11:52 PM, Joel Brobecker <brobecker@adacore.com> wrote:

>> Attached patch makes it so 'disas/l' will disassemble current line, and
>> 'disas/l foo.c:22' will disassemble line 22 of foo.c
>
> Without looking at the implementation itself for now, I have to say that
> I have been missing this feature very badly.
>
> Questions:
>
>   1. What should we do if there are more than one match for the given SAL?

I only ever needed this feature while single-stepping through the code
(i.e. this line crashes, but why?).

Perhaps it is reasonable to get rid of the parameter, and just say that
'disas/l' always disassembles current line, thus eliminating the ambiguity.

Alternatively, if there are two code segments matching 'foo.c:22', but
one of them is inlined into the current function and the other is inlined
somewhere else, then clearly the user is interested in the "current" one
(same for templates).

>   2. A little trickier: How do we want to handle the case where a line
>       of code is split in more than one block of instructions.   This happens
>       really often when debugging optimized code.
>
>       Right now, the easy solution is to only disassemble the first
>       block.   It'd be nice to have them all, though. Perhaps printing
>       the instructions for each block one after the other, with something
>       like a little sign in between indicating the next instruction is
>       part of another block?
>
>       0x... <fun_name+nn>      bla bla bla
>       0x... <fun_name+mm>      bla bla bla
>       [...]
>       0x... <fun_name+oo>      bla bla bla

Some alternatives:

A) determine min(low), max(high) core address for all SALs, then disassemble
   that entire range, but there are discontinuous source lines turn on
   DISASSEMBLY_SOURCE automatically, so it becomes clear which instructions
   come from which line(s).

   The trouble with this approach is that the two blocks could be quite
   far apart. I haven't see GCC do that, but under MSVC I've seen wildly
   discontinuous blocks of code. I think GCC may soon start doing hot/cold
   code splitting as well, especially with FDO.

B) disassemble only the SAL which "covers" current $pc (as that's likely
   what the user is looking for). This would be consistent with proposed
   elimination of parameter, so 'disas/l' always implies 'current $pc'.

-- 
Paul Pluzhnikov


  reply	other threads:[~2009-10-02 18:31 UTC|newest]

Thread overview: 39+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2009-10-02  0:50 Paul Pluzhnikov
2009-10-02  6:52 ` Joel Brobecker
2009-10-02 18:31   ` Paul Pluzhnikov [this message]
2009-10-02 18:49     ` Joel Brobecker
2009-10-02 15:17 ` Tom Tromey
2009-10-08 16:16 ` Paul Pluzhnikov
2009-10-08 16:23   ` Daniel Jacobowitz
2009-10-08 16:25     ` Joel Brobecker
2009-10-08 16:52     ` Paul Pluzhnikov
2009-10-08 17:29       ` Daniel Jacobowitz
2009-10-08 17:33         ` Joel Brobecker
2009-10-16 23:07       ` Paul Pluzhnikov
2009-10-16 23:11         ` Paul Pluzhnikov
2009-10-17  8:33           ` Eli Zaretskii
2009-10-17 15:50             ` Paul Pluzhnikov
2009-10-17 16:49               ` Eli Zaretskii
2009-10-17 17:08                 ` Paul Pluzhnikov
2009-10-17 19:55                   ` Eli Zaretskii
2009-10-19 17:47         ` Tom Tromey
2009-10-19 18:09           ` Paul Pluzhnikov
2009-10-19 18:20             ` Paul Pluzhnikov
2009-10-19 18:30             ` Tom Tromey
2009-10-21  0:22               ` Paul Pluzhnikov
2009-10-21  4:07                 ` Eli Zaretskii
2009-10-21 18:06                   ` Paul Pluzhnikov
2009-10-21 18:16                     ` Eli Zaretskii
2009-10-21 17:24                 ` Tom Tromey
2009-10-19 18:49             ` Daniel Jacobowitz
2009-10-19 19:40               ` Eli Zaretskii
2009-10-19 19:55                 ` Daniel Jacobowitz
2009-10-19 19:40               ` Joel Brobecker
2009-10-19 19:56                 ` Daniel Jacobowitz
2009-10-19 20:03                   ` Tom Tromey
2009-10-19 20:10                     ` Joel Brobecker
2009-10-19 20:23                       ` Paul Pluzhnikov
2009-10-19 20:47                         ` Daniel Jacobowitz
2009-10-20 16:04               ` Tom Tromey
2009-10-08 16:24   ` Joel Brobecker
2009-10-08 17:16     ` Eli Zaretskii

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=8ac60eac0910021131j71b1f79t5d908195652dc7e1@mail.gmail.com \
    --to=ppluzhnikov@google.com \
    --cc=brobecker@adacore.com \
    --cc=gdb-patches@sourceware.org \
    /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