All of lore.kernel.org
 help / color / mirror / Atom feed
From: "Randall S. Becker" <rsbecker@nexbridge.com>
To: "'Matheus Tavares Bernardino'" <matheus.bernardino@usp.br>,
	"'Giuseppe Crino''" <giuscri@gmail.com>
Cc: "'git'" <git@vger.kernel.org>
Subject: RE: How to build to debug with gdb?
Date: Tue, 27 Aug 2019 14:07:57 -0400	[thread overview]
Message-ID: <018f01d55d02$5e89e1f0$1b9da5d0$@nexbridge.com> (raw)
In-Reply-To: <CAHd-oW6MtoYAwv36_Jsx5qQzvLguXdvrA6NRA+D3ayHGmfVSqw@mail.gmail.com>

On August 27, 2019 1:56 PM, Matheus Tavares Bernardino wrote:
> On Tue, Aug 27, 2019 at 1:27 PM Giuseppe Crino' <giuscri@gmail.com>
> wrote:
> > Hello, to debug some issues I built and installed git via
> >
> > $ make prefix=/usr/local DEVELOPER=1 CFLAGS="-O0 -g"
> > $ sudo make install
> > $ git --version # git version 2.23.0.40.g4d8aada92f
> 
> Hmm, could it be perhaps that CFLAGS is being overwritten? To debug Git
> with GDB I always add this to my config.mak file:
> 
> CFLAGS += -g3 -O0
> LDFLAGS += -g3 -O0
> 
> And then just compile with `make`. Maybe give it a try?
> 
> > But it seems there's still some optimization going on that prevents gdb
> from working correctly.
> >
> > For example
> >
> > (gdb) b builtin/config.c:752
> > Breakpoint 1 at 0x43942: file builtin/config.c, line 752.
> > (gdb) r config --global --edit
> > Starting program: /usr/local/bin/git config --global --edit [Thread
> > debugging using libthread_db enabled] Using host libthread_db library
> > "/lib/x86_64-linux-gnu/libth read_db.so.1".
> >
> > Breakpoint 1, cmd_config (argc=0, argv=<optimized out>,
> >     prefix=<optimized out>) at builtin/config.c:753
> >     753                             if (fd >= 0) {
> >     (gdb) p fd
> >     $1 = <optimized out>
> >
> >  What am I missing?

Given that you are 40 commits in from 2.23.0, is it possible that you have compiled a few objects, like main, using the old CFLAGS? Gdb is notorious for not showing symbols if main does not have it. Have you done a git clean -dxf before building with the new CFLAGS?

Just a thought.

Randall


  reply	other threads:[~2019-08-27 18:08 UTC|newest]

Thread overview: 9+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2019-08-27 16:27 How to build to debug with gdb? Giuseppe Crino'
2019-08-27 17:55 ` Matheus Tavares Bernardino
2019-08-27 18:07   ` Randall S. Becker [this message]
2019-08-27 18:34 ` Johannes Sixt
2019-08-27 18:36 ` SZEDER Gábor
2019-08-28  8:15   ` Giuseppe Crino'
2019-08-28 10:32     ` SZEDER Gábor
2019-08-28 11:00       ` Giuseppe Crino'
2019-08-28 12:43         ` Giuseppe Crino'

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

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

  git send-email \
    --in-reply-to='018f01d55d02$5e89e1f0$1b9da5d0$@nexbridge.com' \
    --to=rsbecker@nexbridge.com \
    --cc=git@vger.kernel.org \
    --cc=giuscri@gmail.com \
    --cc=matheus.bernardino@usp.br \
    /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.
This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.