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 / IDE and doesn't even require any graphical interface. You can use this on your headless setups. 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.
Because it loads 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 set a breakpoint:

(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