Debugging Code You can only see the next line. It is annoying to use list every time and you do not know the context of the current Code.
Http://beej.us/guide/bggdb/#compiling
Simply put, you can add a-tui option at the beginning of GDB. Some versions already have the gdbtui OptionProgramNow
It is displayed normally on the Linux terminal, but in securecrt, the edge may be garbled due to encoding issues, but it does not affect the use (If your program has incorrect output, this will disrupt the entire interface. Therefore, it is recommended to add 2>/dev/null during debugging. This is basically available)
After GDB is started, the above is the SRC window, and the following is the CMD window. By default, the focus is in the SRC window. In this case, the up and down keys and Pagedown and Pageup are all moving and displaying code, the upstream and downstream Debugging commands are not displayed. switch the focus at this time. For more information, see
(GDB)Info win view current focusSRC (36 lines) FS next switch focusFocus set to cmd window. (GDB)Info winSRC (36 lines) cmd (18 lines) Fs src switch specifies focusFocus set to SRC window. (GDB)
(Window names are case in-sensitive .)
To start in neato and highly-recommended GUI Mode, Start the debuggerGDB-tui. (For details of the examples, below, I show the outputGDB'S dumb terminal mode, but in real life I use Tui mode exclusively .)
And here is a screenshot of what you'll see, approximately: