Re: gdb displaying only one line of instructions when stepping
David Blaikie via Gdb <[email protected]>
| Newsgroups | gmane.comp.gdb.devel |
|---|---|
| Message-ID | <CAENS6EudpGD+52w4GF=DdUQ9MbDy7-u=BRnqkhx1ox1i6Y0=iQ@mail.gmail.com> |
The actual underlying DWARF information that gdb is using to render source only describes a single line of source - and gdb probably doesn't try to parse or interpret the source code at all. I'm not sure about GCC's generated DWARF, but Clang's generated DWARF will use its AST's "preferred location" as the location of a given instruction. This is the same location as would be highlighted with a "^" in a Clang warning or other diagnostic. eg: a = x + y; The store to 'a' should be attributed to '=' and the add instruction should be attributed to '+'. If GCC rendered the column info from the line table, it might make it more clear? (maybe there's an option to make it do that) 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 '='. On Tue, Dec 21, 2021 at 9:16 AM Andrea Monaco via Gdb <[email protected]> wrote: > > 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 >