Skip to content
This repository was archived by the owner on Jun 10, 2024. It is now read-only.

VPF debugging

Roman Arzumanyan edited this page Nov 2, 2021 · 13 revisions

Basic idea

VPF is a collection of C++ libraries which are exported as Python module with the help of pybind11 project.
You can debug VPF just as any another C++ application or library. There are many ways to do that both under Windows and Linux.

Prepare in advance

Please make sure you have Debug VPF build .
Build type is set with CMake at configure stage. It's defined by variable CMAKE_BUILD_TYPE. Typical values for that are: Debug, Release, RelWithDebInfo.

GDB / CGDB

This requires the least amount of tools: no IDE needed and even no GUI required. You can use this on your headless setups just as well.
For the sake of brevity, assuming you have built and installed VPF to ~/Git/VideoProcessingFramework/install/bin.

Run cgdb org gdb --tui and select your Python interpreter as target application, pass path to your script and it's arguments.
Because Python interpreter will load PyNvCodec and PytorchNvCodec modules as shared libraries, you can put a breakpoint there and debug the C++ code.

cgdb --args python3 ./SampleDemuxDecode.py 0 ~/Videos/bbb_sunflower_1080p_30fps_normal.mp4 ./out.yuv

Now within the cgdb debugger, let's put a breakpoint.
GDB will complain that function is not defined, that happens because TC shared library isn't loaded yet.
That's not an issue, the breakpoint will become active as soon as TC library is loaded by your Python interpreter.

(gdb) b FFmpegDemuxer::Demux
Function "FFmpegDemuxer::Demux" not defined.
Make breakpoint pending on future shared library load? (y or [n]) y
Breakpoint 1 (FFmpegDemuxer::Demux) pending.

And run our application:

(gdb) run

Soon the breakpoint will be hit and you will have a chance to debug C++ part of VPF step by step: Debugging VPF with cgdb

Clone this wiki locally