public inbox for gdb@sourceware.org
 help / color / mirror / Atom feed
* Re: gdb displaying only one line of instructions when stepping
@ 2021-12-21 22:14 Andrea Monaco
  2021-12-21 22:54 ` David Blaikie
  0 siblings, 1 reply; 4+ messages in thread
From: Andrea Monaco @ 2021-12-21 22:14 UTC (permalink / raw)
  To: dblaikie; +Cc: gdb


  > Though ultimately the DWARF format itself would probably need to be
  > improved to describe source ranges (maybe even non-contiguous ones)
  > and a preferred location - then then + operation could be described
  > as the whole range of "x + y" with a specific location of '+', and
  > the assignment could be the whole range of "a = x + y" with a
  > specific location of '='.


I looked up DWARF format a bit using the dwarfdump utility.  I see that
DWARF records the line number of each new instruction.  Changing the
format would be a lot of work; but maybe some kind of heuristics might
do the job.


When single stepping, gdb could display all lines until the following
instruction, excluding it, and also excluding blank lines and (perhaps)
comments immediately before it.

As another rule, it might stop immediately (like it does now) when the
current line is, or includes, the closing bracket of a function.  (I saw
that gcc records the closing bracket as a separate instruction, even
when it is on the same line as the last instruction of the function.)


This heuristics may give reasonable results in many cases, or be a
starting point.  What do you think?



Andrea Monaco

^ permalink raw reply	[flat|nested] 4+ messages in thread
* gdb displaying only one line of instructions when stepping
@ 2021-12-21 14:15 Andrea Monaco
  2021-12-21 14:21 ` David Blaikie
  0 siblings, 1 reply; 4+ messages in thread
From: Andrea Monaco @ 2021-12-21 14:15 UTC (permalink / raw)
  To: gdb


Hello.


I noticed that, when single stepping through a program, gdb shows only
one line of instructions that take more than one.

For example, a simple

  a =
    5;


is showed as

  (gdb) next
  24        a =
  (gdb)         

As a user, I'd definitely prefer gdb to show me the full instruction I'm
about to run.


Maybe there's some way to do that, and I missed it?  Otherwise I can
work on it.



Let me know,

Andrea Monaco

^ permalink raw reply	[flat|nested] 4+ messages in thread

end of thread, other threads:[~2021-12-21 22:55 UTC | newest]

Thread overview: 4+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2021-12-21 22:14 gdb displaying only one line of instructions when stepping Andrea Monaco
2021-12-21 22:54 ` David Blaikie
  -- strict thread matches above, loose matches on Subject: below --
2021-12-21 14:15 Andrea Monaco
2021-12-21 14:21 ` David Blaikie

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).