Closed anubhav-cs closed 4 years ago
It should be noted that the addition of --with_debug
option was a work around. Ideally, we should be able to attach gdb
when the python program is paused on a breakpoint or at the start of the program(via the "stopOnEntry": true
configuration in launch.json
). However, it was observed that attaching gdb
, while the python program was stopped in such a manner, caused issues in the symbol table loaded by gdb
.
A brief overview of how to set up a debug environment and perform debugging operations on the VS Code.
Note- In LAPKT,
.vscode/launch.json
has been configured to run python program with--wait_debug
option. The option is present inlapkt
python script and causes the program to wait for user input../install.py --cmake_build_options Debug
.vscode/launch.json
with required arguments.F5
). Because of--wait_debug
option, the program will stop for user input and also print a message "PID = <#######> ; Press a key to begin run..."(gdb) Attach
and run it. VS Code will ask for a process to attachgdb
to.gdb
has to be attached to the python program, which can searched using the PID printed by the previous step. After that, it will request for sudoer access(in a new terminal), which must be provided.cxx
files using VS Code.return
key. The program will next pause at the instruction where it encounters one of the breakpoints.A brief overview on how to use gdb from terminal to debug on any Linux OS.
./install.py --cmake_build_options Debug
lapkt
with the option--wait_debug
and other arguments as necessary. Because of--wait_debug
option, the program will stop for user input and also print a message "PID = <#######> ; Press a key to begin run..."sudo gdb --pid=<PID>
return
- the program will not move forward as it is waiting forcontinue
orcont
command from the attached gdb.cont
command. It will next stop at the one of the breakpoints. An example on how to set breakpoints -br tarski_instantiator.cxx:401
. This will cause program to pause at the instruction corresponding to line401
intarski_instantiator.cxx
.del <breakpoint number>
or justdel
, and then issuingcont
will allow the program to execute freely until termination.