Debugging Pixhawk with BMP2.1

Hello,
I’m trying to debug the PX4 on Pixhawk2 with Blackmagic probe.
I’m able to start gdb, load symbols and run, but when i stop, i see only the Idle thread.
In NSH console i see many threads running.
How can i see and debug all available threads ?
Did i missed some gdb command ?

On Pixhawk there are not threads. It’s only tasks which all run on one core.

What command are you using? What instructions are you following?

Not exactly, Nuttx is a Posix based, so formally it has Task/Processes and the threads.
The semantics here is less important, i just would like to see in gdb something more then 1 Task/Process/Thread, the same list that i see when i run top on the nsh.

The gdb init sequence i tried is taken from here and the
here
There is no any reference how to use it to debug OS tasks/threads on the embedded platform.
There is a command info threads that just show one task, which is the Idle task.

You’re right, I just read through these NuttX docs.

So I think you often end up in the idle thread because it runs around 50% of the time depending on your CPU load. If you do continue and then Ctrl+C again, chances are you land somewhere else.

Unfortunately, I agree that gdb doesn’t seem to understand the NuttX processes, and only shows one thread.

However, I think you should still be able to debug whichever task you want by placing a breakpoint there and that way “land” there and can look around.

Sounds reasonable.
If i translate your idea, if i manage to work with an IDE, which can track the source code and the binary, i’ll be able to set breakpoint anywhere in the project, and the gdb should be able to stop inside the required thread.
I’ll try.

Right, although you don’t need to use an IDE for that.

You can do e.g.:

(gdb) break src/modules/mc_att_control/mc_att_control_main.cpp:841
Breakpoint 1 at 0x80af722: file ../../src/modules/mc_att_control/mc_att_control_main.cpp, line 841.

(gdb) continue
Continuing.
Note: automatically using hardware breakpoints for read-only addresses.

Breakpoint 1, MulticopterAttitudeControl::run (this=0x2001aa50) at ../../src/modules/mc_att_control/mc_att_control_main.cpp:841
841			int pret = px4_poll(&poll_fds, 1, 100);

(gdb) info locals
pret = <optimized out>
poll_fds = {fd = 12, ptr = 0x0, sem = 0x0, events = 1 '\001', revents = 1 '\001', priv = 0x20019f14}
task_start = 2520318
last_run = <optimized out>
dt_accumulator = <optimized out>
loop_counter = <optimized out>
reset_yaw_sp = <optimized out>
attitude_dt = <optimized out>