git@vger.kernel.org mailing list mirror (one of many)
 help / color / mirror / code / Atom feed
From: Stefan Beller <sbeller@google.com>
To: 小川恭史 <aiueogawa217@gmail.com>
Cc: "git@vger.kernel.org" <git@vger.kernel.org>
Subject: Re: How can I debug git source code interactively with debugger like gdb?
Date: Wed, 18 Oct 2017 12:57:41 -0700	[thread overview]
Message-ID: <CAGZ79kZD4gCBcttU8aTAyb0susP3j1BqnF_ad=EfVXbh+ymbgA@mail.gmail.com> (raw)
In-Reply-To: <CAC2JkrLR=RUN01AeYGd1YpOPMv=kArm9LWGtMvJ7DS5sz7c3nw@mail.gmail.com>

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

      parent reply	other threads:[~2017-10-18 19:57 UTC|newest]

Thread overview: 3+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
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 message]

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

  List information: http://vger.kernel.org/majordomo-info.html

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to='CAGZ79kZD4gCBcttU8aTAyb0susP3j1BqnF_ad=EfVXbh+ymbgA@mail.gmail.com' \
    --to=sbeller@google.com \
    --cc=aiueogawa217@gmail.com \
    --cc=git@vger.kernel.org \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
Code repositories for project(s) associated with this public inbox

	https://80x24.org/mirrors/git.git

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 read-only IMAP folder(s) and NNTP newsgroup(s).