mingw: add a helper function to attach GDB to the current process
When debugging Git, the criss-cross spawning of processes can make things quite a bit difficult, especially when a Unix shell script is thrown in the mix that calls a `git.exe` that then segfaults. To help debugging such things, we introduce the `open_in_gdb()` function which can be called at a code location where the segfault happens (or as close as one can get); This will open a new MinTTY window with a GDB that already attached to the current process. Inspired by Derrick Stolee. Signed-off-by: Johannes Schindelin <johannes.schindelin@gmx.de> Signed-off-by: Junio C Hamano <gitster@pobox.com>
This commit is contained in:

committed by
Junio C Hamano

parent
b6d4d82bd5
commit
08809c09aa
@ -591,6 +591,16 @@ extern CRITICAL_SECTION pinfo_cs;
|
||||
int wmain(int argc, const wchar_t **w_argv);
|
||||
int main(int argc, const char **argv);
|
||||
|
||||
/*
|
||||
* For debugging: if a problem occurs, say, in a Git process that is spawned
|
||||
* from another Git process which in turn is spawned from yet another Git
|
||||
* process, it can be quite daunting to figure out what is going on.
|
||||
*
|
||||
* Call this function to open a new MinTTY (this assumes you are in Git for
|
||||
* Windows' SDK) with a GDB that attaches to the current process right away.
|
||||
*/
|
||||
extern void open_in_gdb(void);
|
||||
|
||||
/*
|
||||
* Used by Pthread API implementation for Windows
|
||||
*/
|
||||
|
Reference in New Issue
Block a user