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.
When in GDB mode, the user is in command mode or scroll mode. When in command mode, the user is typing in commands to interact with GDB. When in scroll mode, the user can scroll through the GDB output. You can enter scroll mode by typing page up and quit scroll mode by typing q , i or enter .
From within gdb press Ctrl x 2 and the screen will split into 3 parts. First part will show you the normal code in high level language. Second will show you the assembly equivalent and corresponding instruction Pointer .
Text you type always goes into the command window, so normally you only need to change focus for scrolling around in registers, asm, or source. You can use command history while the focus is on the asm window by using control-p and control-n, like emacs.
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
I've found a small hack. If you're in layout asm
mode and you can't scroll to the current instruction you can execute command layout split
and then layout asm
and the first line will be the current one.
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With