GDB TUI: Scroll assembly view above current instruction

assemblygdb

I've only just started using GDB recently, but I'm super impressed by it. No wonder it's the de-facto debugger for many users. One minor annoyance that I've found, though, is that I find myself unable to scroll above the current instruction in the TUI assembly view. I can scroll up and down just fine so long as display buffer is underneath the current instruction.

Other than something like x/20i [address] (which kind of defeats the purpose of a scrollable window) or altering the memory with a jump and setting a subsequent breakpoint, is there any way to tell the TUI assembly view to look at another location that might be above (lower memory than) the current instruction?

Edit: This only seems to happen when attached to an already running process, not when using gdb to launch the process. Sometimes I can scroll up until the current instruction, other times I can't scroll up t all.

Best Answer

There seems to be some kind of issue with scrolling assembly in gdb tui like you explain, but a simple workaround exists.

So, first enable tui and disassembly view by pressing ctrl+x ctrl+a. Then show disassembly view by entering layout asm or something similar.

Now that windows should let you scroll with keys or mouse, but if it stops (which for me sometimes happens at beginning of some function) enter the usual disassemble command and disassembly view will update to that location.

Example:

disass main
disass 0x1234

Related Topic