* How can I debug git source code interactively with debugger like gdb?
@ 2017-10-18 19:42 小川恭史
2017-10-18 19:56 ` Brandon Williams
2017-10-18 19:57 ` Stefan Beller
0 siblings, 2 replies; 3+ messages in thread
From: 小川恭史 @ 2017-10-18 19:42 UTC (permalink / raw)
To: git
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?
^ permalink raw reply [flat|nested] 3+ messages in thread
* Re: How can I debug git source code interactively with debugger like gdb?
2017-10-18 19:42 How can I debug git source code interactively with debugger like gdb? 小川恭史
@ 2017-10-18 19:56 ` Brandon Williams
2017-10-18 19:57 ` Stefan Beller
1 sibling, 0 replies; 3+ messages in thread
From: Brandon Williams @ 2017-10-18 19:56 UTC (permalink / raw)
To: 小川恭史; +Cc: git
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
^ permalink raw reply [flat|nested] 3+ messages in thread
* Re: How can I debug git source code interactively with debugger like gdb?
2017-10-18 19:42 How can I debug git source code interactively with debugger like gdb? 小川恭史
2017-10-18 19:56 ` Brandon Williams
@ 2017-10-18 19:57 ` Stefan Beller
1 sibling, 0 replies; 3+ messages in thread
From: Stefan Beller @ 2017-10-18 19:57 UTC (permalink / raw)
To: 小川恭史; +Cc: git@vger.kernel.org
On Wed, Oct 18, 2017 at 12:42 PM, 小川恭史 <aiueogawa217@gmail.com> wrote:
> I wanna learn how daily git command works when I run specific git command.
1. Obtain the sources and compile Git yourself
(git clone https://kernel.googlesource.com/pub/scm/git/git
cd git && make && make install).
Documentation/* and the Makefile are pretty verbose if you want
to compile for some non-mainstream hardware or OS.
2. "gdb git" and debug away.
Note, that some Git commands call other git commands,
So running the command with "GIT_TRACE=1 git <cmd>"
first may be helpful for diagnosis as well.
(See the general git man page that has a couple of env vars
that aid in debugging)
> I wanna know which function is actually called then, how variables
> changes its value, and how some object is stored into database.
For understanding Gits model, it may be easier to read a book, such
as "git from the bottom up" as that conveys the concepts better.
The source code is riddled with handling corner cases, error handling
and other implementation details that are usually not interesting but
rather tedious.
> How can I debug git source code interactively with debugger like gdb?
Also checkout ddd, a graphical frontend of gdb.
Cheers,
Stefan
^ permalink raw reply [flat|nested] 3+ messages in thread
end of thread, other threads:[~2017-10-18 19:57 UTC | newest]
Thread overview: 3+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2017-10-18 19:42 How can I debug git source code interactively with debugger like gdb? 小川恭史
2017-10-18 19:56 ` Brandon Williams
2017-10-18 19:57 ` Stefan Beller
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).