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

Re: [PATCHv3] refs.c: enable large transactions

From
Jeff King <peff@peff.net>
Date
Apr 25, 2015, 05:00 UTC
Message-ID
<20150425050058.GA20256@peff.net>
In-Reply-To
<xmqqzj5w25vv.fsf@gitster.dls.corp.google.com>
On Fri, Apr 24, 2015 at 09:23:16PM -0700, Junio C Hamano wrote:
Show 6 quoted lines
> The proposals so far, including this one, assume that the bug
> reporter will first fail the operation with "normal" invocation
> of Git (e.g. without GIT_DIE_ABORT exported) and then retry the
> same operation in a different way (e.g. with GIT_DIE_ABORT) to
> give us something that would help diagnosis.  Such a user could
> just rerun Git under gdb with breakpoint set to die_builtin, no?

Good point. I was trying to automate the gathering of the backtrace so that even bug-reporters who have not used gdb could easily get us more information. But of course if a coredump only gets us halfway there and we have to script gdb to convert the core into a backtrace anyway, it is not buying us much over just scripting gdb in the first place.

A better solution to what I proposed earlier is perhaps:
  git config alias.debug '!gdb --quiet \
	    -ex "break exit" \
	    -ex "run" \
	    -ex "bt full" \
	    -ex "continue" \
	    -ex "quit" \
	    --args git \
  '
  git debug rev-parse foobar

It has the minor irritation that gdb will control the process stdio (slurping from stdin and polluting stdout, whereas we would prefer no input and output to stderr). There might be a way to convince gdb to do otherwise, or you could probably go pretty far with some shell fd redirects and using "set args" inside gdb. Or maybe something with gdbserver.

But the point is that yeah, we shouldn't try to build really good introspection inside git. Debuggers already do a way better job of this. If they're hard for people to use to obtain simple information like a backtrace, we should work on wrapping that difficulty up in a script.

It might still be useful to provide a much lesser form of introspection, if it would be available in a lot more places than gdb would. E.g., __FILE__ and __LINE__ markers on error messages might be useful. A mediocre backtrace() that is only available on glibc systems is probably not.

-Peff
Previous: Junio C HamanoNext: Jeff King
Message 11 of 12 in “[PATCHv3] refs.c: enable large transactions”
  1. Stefan BellerApr 22, 2015
  2. Junio C HamanoApr 23, 2015
  3. Stefan BellerApr 24, 2015
  4. Junio C HamanoApr 24, 2015
  5. Stefan BellerApr 24, 2015
  6. Jeff KingApr 24, 2015
  7. Jonathan NiederApr 24, 2015
  8. Stefan BellerApr 24, 2015
  9. Jeff KingApr 24, 2015
  10. Junio C HamanoApr 25, 2015
  11. Jeff KingApr 25, 2015
  12. Jeff KingApr 25, 2015

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.