转自https://gpac.wp.mines-telecom.fr/2015/06/11/using-gdb-in-visual-studio/
Dear followers,
One of the target platform for GPAC is Windows. Developing for Windows in a comfortable manner requires Visual Studio, in particular for debugging. Microsoft recently announced great changes that will make Visual Studio users (including the GPAC developers) happy:
- Visual Studio Community Edition replaces the Express Edition. It is very complete for development.
- 6 weeks ago, Microsoft open-sourced their GDB/LLDB front-end for Visual Studio 2015. It means that we can now debug gcc-built programs with the Visual Studio debugguer interface.
Setup for local debugging
Install software:
- Install Visual Studio 2015. Install the “Tools for Visual C++ Mobile Development” in a sub-menu (disabled by default).
- Install gdb/gdbserver. Use MinGW-w64 binaries and put them in your PATH (you can rely on the excellent MSYS2 for a full development environment).
/!\ Legacy MinGW and Cygwin gdb binaries are known to fail /!\
Build:
- Use your usual build system and gcc or clang compiler. Don’t forget to enable debugging!
Debugging:
- In your command-line, launch:
- In Visual Studio:
- Open the “command window” (either press CTRL+ALT+A or click: View menu -> Other Windows -> Command Window)
- Launch:
That’s all! Once Debug.GDBLaunch is attached your program will run. Breakpoints are effective. And you can enjoy the Visual Studio debugging experience:
Setup for remote debugging
This is an extension of the gdbserver we used above. It allows to debug mobile (android/iOS) or any platform (linux, …) executables from a remote
For specific remote parameters, see: