When debugging C/C++ function that with many arguments, and each arguments may still call some functions, people have to repeated typing step
and finish
, then reach where this function's body part.
e.g. I'm using OpenCV's solvePnP()
function, it requires many arguments:
solvePnP(v_point_3d,v_point_2d,K,D,R,T);
Among which, each argument will be converted from cv::Mat
to cv::InputArray
, thus calling a init()
function.
What I expected is, directly go to where solvePnP()
implemented, and I'm not interested in each argument type conversion.
Luckily, there is advance
command in gdb. Official document is here, writes:
advance location
Continue running the program up to the given location. An argument is required, which should be of one of the forms described in Specify Location. Execution will also stop upon exit from the current stack frame. This command is similar to until, but advance will not skip over recursive function calls, and the target location doesn’t have to be in the same frame as the current one.
This gdb advance
command really helps. And what's the equivalent command in LLDB?
I've search in lldb official's gdb => lldb command mapping web page, https://lldb.llvm.org/use/map.html , but not found.
Edit: I forgot to mention, the gdb usage for me is
(gdb) b main
(gdb) r
(gdb) advance solvePnP
Checkout the sif
command for lldb. sif
means **Step Into Function
Reference: How to step-into outermost function call in the line with LLDB?
To get all the supported commands of LLDB, one should first go into lldb command, then type help
, then there will be the explanations for sif
:
sif -- Step through the current block, stopping if you step directly into a function whose name matches the TargetFunctionName.