I’m attempting to debug 1.9.2 in vscode using jmavsim (or gazebo) in OS X Catalina. I’m using the default targets and am getting an issue where it never seems to fully start the px4 process. Specifically, I see “PAUSED ON EXCEPTION” in the call stack and no matter how many times I continue the debug session it keeps stopping. I’ve also tried running the lldb session manually and get:
Process 2603 launched: 'firmware/build/px4_sitl_default/bin/px4' (x86_64)
INFO [px4] Creating symlink firmware/ROMFS/px4fmu_common -> firmware/build/px4_sitl_default/tmp/rootfs/etc
______ __ __ ___
| ___ \ \ \ / / / |
| |_/ / \ V / / /| |
| __/ / \ / /_| |
| | / /^\ \ \___ |
\_| \/ \/ |_/
px4 starting.
INFO [px4] Calling startup script: /bin/sh etc/init.d-posix/rcS 0
INFO [dataman] Unknown restart, data manager file './dataman' size is 11798680 bytes
INFO [simulator] Waiting for simulator to connect on TCP port 4560
INFO [simulator] Simulator connected on TCP port 4560.
Init MAVLink
Process 2603 stopped
* thread #2, name = 'hpwork', stop reason = signal SIGCONT
frame #0: 0x00007fff721a18f6 libsystem_kernel.dylib`__psynch_cvwait + 10
libsystem_kernel.dylib`__psynch_cvwait:
-> 0x7fff721a18f6 <+10>: jae 0x7fff721a1900 ; <+20>
0x7fff721a18f8 <+12>: movq %rax, %rdi
0x7fff721a18fb <+15>: jmp 0x7fff7219e397 ; cerror_nocancel
0x7fff721a1900 <+20>: retq
Target 0: (px4) stopped.
Has anyone been able to debug 1.9.2 in OS X Catalina?
Thanks very much for your help with this. Unfortunately the pro hand -p true -s false SIGCONT doesn’t seem to make a difference, and actually doesn’t do much because I need to kill the process to instantiate it, which appears to break the px4<->gazebo/jmavsim connection.
RE lldb: I didn’t do anything special; in fact I’ve now started with a clean install of Catalina, followed the developer guide (https://dev.px4.io/v1.9.0/en/setup/dev_env_mac.html) and lldb is already there.
I should mention I actually saw this same problem on Mojave.
Are you able to run the debugger (in VSCode or otherwise) with gazebo/jmavsim successfully in Mojave at all?
A quick follow-up: I was able to get process handle SIGCONT -p true -s false -n false to fix the issue, but it took a bit of work, namely I had to:
1.) run the sim in debug mode (make px4_sitl jmavsim___lldb)
2.) set a breakpoint at the entrypoint of main() (b main.cpp:123 worked for me)
3.) set the signal handling flags (process handle SIGCONT -p true -s false -n false)
4.) continue (c)
From then on it appears to work properly. I’m trying to figure out how to have this happen on all runs of lldb but setting it in the ~/.lldbinit doesn’t seem to work. Additionally it seems like this is something that should be set in the fimrware repo so it doesn’t affect debugging other code.
EDIT: After a bit more searching, it looks like someone else already ran into this and put this in the launch.json:
Hi @JulianOes@rroche@dagar, any insight into this? I am able to run the debugger manually (see above) but its quite cumbersome to work with. Any suggestions to get vscode/lldb debugging working (or suggested alternatives) would be extremely helpful.
Hey, I have this issue when working in a mac I was follow the track to change the miDebuggerPath to really point to the lldb-mi library but I didn’t have the time to really make it work , by now I’m working in and old and trusty(bionic, this line worked better with 14.14) ubuntu.
@almatthew I usually work on Linux, so I’m not too experienced with macOS and lldb. It would be awesome if someone from the community who is using macOS day by day could figure it out.
I actually tried that, but it doesn’t break in that main() method like it does if I invoke lldb from the command line, so I’m unable to set the SIGCONT handler