Re: How can I debug git source code interactively with debugger like gdb?
To
小川恭史
Cc
git@vger.kernel.org
From
Brandon Williams
See Also
Prev
Date
2017-10-18 19:56:02 UTC
On 10/19, 小川恭史 wrote:
> I wanna learn how daily git command works when I run specific git command.
> 
> I wanna know which function is actually called then, how variables
> changes its value, and how some object is stored into database.
> 
> How can I debug git source code interactively with debugger like gdb?

I have had to do this in the past when trying to track down particularly
nasty bugs.  If you build git from source (you may need to turn on
debugging info) you'll be able to find a script '/bin-wrappers/git'
which you can use by making sure the environment variable 'GIT_TEST_GDB'
is set.  This will launch it under gdb.  For example:

  GIT_TEST_GDB=1 ./bin-wrappers/git status

-- 
Brandon Williams