forked from git/git
-
Notifications
You must be signed in to change notification settings - Fork 2.7k
Debugging Git
Johannes Schindelin edited this page Feb 16, 2016
·
16 revisions
First of all, Git's .exe files should be rebuilt with debugging information, and without optimization (because gdb has serious troubles single-stepping code compiled using -O2 for some reason). To this end:
- install the Git for Windows SDK
- edit
/usr/src/git/Makefileto remove the-O2from theCFLAGS = -g -O2 -Wallline, - edit
/usr/src/git/config.mak.unameto remove the lineBASIC_LDFLAGS += -Wl,--dynamicbase, and then - run
makein/usr/src/git/.
After that, you can run Git's executables in GDB like so:
gdb --args ./git.exe --exec-path=/usr/src/git rev-parse HEADSometimes it is useful to ask the debugger to pause the program when the code path is entered that outputs an error message. The functions in Git that output error messages are error_builtin() and die_builtin(). So you can set the breakpoints
b error_builtin
b die_builtin
before calling run in gdb to stop execution at the appropriate time.
This wiki page has been retired. All it did was to point to Git for Windows' governance model.