git/list[1] front-page[2] threads[3] people[4] search[5] about
 

Re: How can I debug git source code interactively with debugger like gdb?

From
BWBrandon Williams <bmwill@google.com>
Date
Oct 18, 2017, 19:56 UTC
Message-ID
<20171018195602.GB155019@google.com>
In-Reply-To
<CAC2JkrLR=RUN01AeYGd1YpOPMv=kArm9LWGtMvJ7DS5sz7c3nw@mail.gmail.com>
On 10/19, 小川恭史 wrote:
Show 6 quoted lines
> 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
Previous: 小川恭史Next: Stefan Beller
Message 2 of 3 in “How can I debug git source code interactively with debugger like gdb?”
  1. 小川恭史Oct 18, 2017
  2. Brandon WilliamsOct 18, 2017
  3. Stefan BellerOct 18, 2017

Read the whole thread, see it on lore, or plain text.

$ cat FOOTERMessages come from the public archive at lore.kernel.org/git, fetched every hour. The front page is chosen and written each morning by an AI editor and can be wrong; the threads themselves are the record. About and API. For agents: an MCP server at https://gitlist.dev/mcp, and any thread, story or person page as Markdown by adding .md to its URL (or sending Accept: text/markdown). Details in /llms.txt.