c++debuggingffmpegmakefilegdb

Debugging FFMPEG Code (libavformat files breakpoint)


I tried setting up ffmpeg for debugging, a partial success. Been able to setup debug points in top level code but not inside libavformat code files. Any idea how to compile to be able to do so.

Setup:

./configure --enable-debug=3 --disable-optimizations --disable-decoder=vp9 --disable-decoder=hevc --enable-nvenc --enable-nvdec --enable-cuda --enable-cuvid --enable-nonfree --enable-gpl --extra-cflags="-I/usr/local/cuda/include" --extra-ldflags="-L/usr/local/cuda/lib64" --enable-shared --enable-libx264 --enable-gpl --disable-stripping

make clean

make -j8

VS CODE SETUP

 {
            "name": "(gdb) Launch",
            "type": "cppdbg",
            "request": "launch",
            "program": "${workspaceFolder}/ffmpeg_master/FFmpeg/ffmpeg_g",
            "args": ["-loglevel","trace","-i", "/home/ubuntu/ffmpeg_test/testfiles/LiveOff.HEIC" ,"-map", "0","out%d.png"],
            "stopAtEntry": false,
            "cwd": "${workspaceFolder}/ffmpeg_master/FFmpeg",
            "environment": [],
            "externalConsole": false,
            "MIMode": "gdb",
            "setupCommands": [
                {
                    "description": "Enable pretty-printing for gdb",
                    "text": "-enable-pretty-printing",
                    "ignoreFailures": true
                },
                {
                    "description": "Set Disassembly Flavor to Intel",
                    "text": "-gdb-set disassembly-flavor intel",
                    "ignoreFailures": true
                }
            ]
        } {
            "name": "(gdb) Launch",
            "type": "cppdbg",
            "request": "launch",
            "program": "${workspaceFolder}/ffmpeg_master/FFmpeg/ffmpeg_g",
            "args": ["-loglevel","trace","-i", "/home/ubuntu/ffmpeg_test/testfiles/LiveOff.HEIC" ,"-map", "0","out%d.png"],
            "stopAtEntry": false,
            "cwd": "${workspaceFolder}/ffmpeg_master/FFmpeg",
            "environment": [],
            "externalConsole": false,
            "MIMode": "gdb",
            "setupCommands": [
                {
                    "description": "Enable pretty-printing for gdb",
                    "text": "-enable-pretty-printing",
                    "ignoreFailures": true
                },
                {
                    "description": "Set Disassembly Flavor to Intel",
                    "text": "-gdb-set disassembly-flavor intel",
                    "ignoreFailures": true
                }
            ]
        }

Solution

  • ./configure --enable-debug=3 --disable-optimizations --disable-decoder=vp9 --disable-decoder=hevc  --enable-nvenc --enable-nvdec --enable-cuda --enable-cuvid --enable-nonfree --enable-gpl --extra-cflags="-I/usr/local/cuda/include" --extra-ldflags="-L/usr/local/cuda/lib64"  --enable-static --disable-shared  --enable-libx264 --enable-gpl --disable-stripping --pkg-config-flags="--static"   --extra-cflags="-I$HOME/ffmpeg_build/include"   --extra-ldflags="-L$HOME/ffmpeg_build/lib" 
    

    disabled shared libraries made it work