Re: gdb displaying only one line of instructions when stepping

Andrea Monaco via Gdb <[email protected]>
Newsgroups gmane.comp.gdb.devel
Message-ID <[email protected]>
  > 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
lmpx.com only provides a reader for public news (NNTP) servers. It is not affiliated with the servers or forums shown here and is not responsible for the content of articles, which is written by their respective authors.