When I'm GDB TUI can I load arbitrary source file for browsing without jumping into it using breakpoint?
Thanks.
The GDB Text User Interface, TUI in short, is a terminal interface which uses the curses library to show the source file, the assembly output, the program registers and GDB commands in separate text windows. The TUI is enabled by invoking GDB using either `gdbtui' or `gdb -tui' .
Setting breakpoints A breakpoint is like a stop sign in your code -- whenever gdb gets to a breakpoint it halts execution of your program and allows you to examine it. To set breakpoints, type "break [filename]:[linenumber]". For example, if you wanted to set a breakpoint at line 55 of main.
The usual way to examine data in your program is with the print command (abbreviated p ), or its synonym inspect . It evaluates and prints the value of an expression of the language your program is written in (see section Using GDB with Different Languages).
You can't list any arbitrary file, but if it's part of your program, you can try something like
list sourcefile.c:1
That :1 at the end says to list from line number 1, and lets gdb know that it's file, not a function.
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