CCExtractor / rusty_ffmpeg

FFI bindings for FFmpeg inner libraries.
https://crates.io/crates/rusty_ffmpeg
MIT License
164 stars 26 forks source link

When I'm trying to debug the C code of FFmpeg, I can perform breakpoint debugging, but I'm unable to obtain the list and values of symbolic variables. #120

Open vaptu opened 1 month ago

vaptu commented 1 month ago

platform: macos 14.0 compiler: Apple clang version 15.0.0 (clang-1500.0.40.1) ffmpeg: 4.4.1 (--enable-debug)

My breakpoints in the Rust code are correct, but once it enters the C code block, although the breakpoint behavior is still fine, it cannot display all the variable lists and variable values in the C code.

I saw this log in the LLVM output: 'warning: test-f3214074073240dc was compiled with optimization - stepping may behave oddly; variables may not be available.'

However, I don't know how to resolve it and seek your help.

ldm0 commented 1 month ago

The debuginfo of your FFmpeg libs might have been stripped.

It's highly recommended to build FFmpeg yourself. You can follow the official compilation guide or use the utils/mac_ffmpeg.rs provided in rsmpeg as a shortcut.

After FFmpeg building, set FFMPEG_PKG_CONFIG_PATH to the pkgconfig directory, then recompile your project, and everything should be fine.

vaptu commented 1 month ago

Thank you very much. I'm using a self-compiled version of FFmpeg(4.4.1), and when I tried to debug using C++, I didn't find that the aforementioned situation could be normally supported for debugging.

Below are my build options. Can you see any anomalies?

./configure --enable-static --enable-gpl --enable-libx264 --enable-nonfree --disable-coreimage \
--enable-libopus --enable-libfreetype --enable-libass --disable-doc --disable-avdevice --enable-debug \
--enable-openssl --enable-libfreetype --enable-libmp3lame --enable-libx265 --enable-libsrt --enable-decoder=png \
--enable-zlib --enable-pthreads --disable-autodetect --enable-libfontconfig --prefix=/opt/local/ --enable-sdl2 \
--enable-ffplay --enable-videotoolbox
ldm0 commented 1 month ago

Below are my build options. Can you see any anomalies?

Nope, it's legit.

Did you compile your Rust project in release mode? https://github.com/rust-lang/cargo/pull/13257

vaptu commented 1 month ago

I've double-checked, and I can confirm that I am indeed using debug mode.

This situation is quite strange. It can correctly jump to the line information in the C source code, but it seems unable to obtain variable information through LLVM.

Thank you for your patient reply. I think I can try to see if I encounter this problem in a Linux environment to rule out LLVM-related issues.