tags:

views:

132

answers:

2

GDB, at least as it's configured by default on my Ubuntu 9.04 box, doesn't handle multi-line statements well. When I'm stepping through code, GDB only displays the last line of the current statement, even if that statement spans multiple lines.

I'm aware that I could use DDD or emacs as a frontend for GDB, but I'd prefer to solve this problem within GDB, if that's possible.

Does anyone know if there's a way to get GDB to do the right thing here?

+2  A: 

How about running GDB with the text user interface?

gdb -tui

It makes a world of difference to the ease of use of GDB.

therefromhere
That's helpful, but I'd prefer just to use the normal interface, because my program's console output gets in the way of the tui. Of course, I could redirect the text to another tty, but...I really just want GDB to do Do The Right Thing.
Justin L.
+1  A: 

I'm afraid the answer is "no, there is no way to get gdb to do what you want". The line info in the symbol tables associates each code instruction with a single source line (not a source statement). gdb has no way of knowing that several source lines are associated with the same source statement.

Michael Snyder