What is the best way to debugging ardupilot

I want to confirm the value, state of each variables, classes when the ardupilot running…
especially when the pixhawk running with other equip (ex. lidar)…

how to debug and check the value from running ardupilot?

May you can use mavproxy.py and send the variables to the console, this in land, and conected by USB.

I am using Pixhawk cube orange and I want to debug. I bought a black magic probe card for this, but I could not debug using this card.

How did you debug? Can you help me?