How to get gdb tui assembly output to show instruction?
Asked Answered
G

2

8

I wanted to see the assembly output but found that in TUI, it would output function signature + offset: which is cool, except for the fact that I'm programming in C++ and the function signature is fully resolved so I get namespaces and template parameters which make the function sig 2 or more lines long. This gets truncated in the TUI of course so it doesn't even get to display the assembly instruction.

Is there any way to shorten, change the prefix (perhaps to a file/line format) or not output this prefix at all to the assembly instruction?

Glori answered 5/6, 2013 at 0:48 Comment(2)
Untested options, hence not an answer: try set print max-symbolic-offset with some value, so gdb mostly won't output the symbol name. Alternately try set print asm-demangle offOtisotitis
The print asm-demangle was already off. Though the print max-symbolic-offset is interesting as I can remove almost all function signature+offset: prefixes, it is hard to match assembly instructions with lines. Would be better with the file:line or file:line+offset prefix.Glori
G
4

Although there is no way at the moment to truncate this prefix, a work around is to set the focus to the assembly window using the focus asm command (if the asm window is not the one in focus) and then by using the right arrow key, you can scroll the window to the right which will eventually show the assembly output.

NOTE:

    This is a workaround, and still has problems as it will snap back to the first column when you step or scroll the CMD window. Also, it seems that when you do a next command, the entire prefix for the current command and it's assembly code is displayed (i.e. it is not truncated) in the ASM window, wrapping around the screen, buggering up the display. Though annoying, this can be fixed using Ctrl-L to refresh the screen.
    Also, scrolling the ASM window up and down can actually cause the debugger to crash. This is probably caused by a buffer overrun, so it is inadvisable to do this, and is possibly better to only show the assembly window only when needed and hide it when not.

Another workaround option as suggested by hasturkun is set print max-symbolic-offset N (you will have to scroll down to find it's description) which tells "gdb to only display the symbolic form of an address if the offset between the closest earlier symbol and the address is less than" N. Setting N to 1 would remove most of the prefixes, but keeps you guessing as to what instruction matches which source line.

Glori answered 5/6, 2013 at 13:53 Comment(1)
I've added a bug/feature request to bugzilla here.Glori
C
0

I don't believe there is a way.

I think this would be a reasonable feature request for bugzilla, though be warned that the TUI doesn't get much love.

Camisole answered 5/6, 2013 at 4:17 Comment(1)
I just mean that there is nobody doing regular work on it. It seems to have some users, just not developers.Camisole

© 2022 - 2024 — McMap. All rights reserved.