-
Notifications
You must be signed in to change notification settings - Fork 3
Debugging Vision
Even though the Vision system runs native code inside a Java process, it is possible to attach a GDB debugger to the process through IDEs like CLion. It's also possible to use GDB from the terminal. Here are rough notes for attaching CLion to a running VisionComponentImpl process.
TODO
Start the VisionComponent: e.g., ./gradlew launch -Pmain=edu.tufts.hrilab.vision.VisionComponent --args="-capture openni2.xml"
In CLion, Run -> Attach to Process. Then select vision process.
The debugger will likely stop repeatedly in the Java (disassembly) code. The reason is that gdb automatically stops an app when the segfault occurs. This makes sense for some applications but not for Java apps. JDK uses different tools that may produce segfaults (speculative memory load, NullPointerException, etc.). JDK handles SIGSEGV internally, but gdb has no idea about this. This is why we need to force gdb to ignore them.
One way is in the CLion Debugger pane, in the GDB tab. Just enter "handle SIGSEGV nostop noprint pass". The downside is that you'll have to do this every time you attach to a process. You can make this persistent by creating a ~/.gdbinit file.