Skip to content
Browse files

Merge pull request #1915 from dscho/open-in-gdb

Add a helper function to start GDB that was already attached to the current process
  • Loading branch information...
dscho committed Nov 7, 2018
2 parents 5af6eeb + 45f8845 commit 2c704875d0085aa794b18a70d9027acee3906bee
Showing with 23 additions and 0 deletions.
  1. +13 −0 compat/mingw.c
  2. +10 −0 compat/mingw.h
@@ -14,6 +14,19 @@

#define HCAST(type, handle) ((type)(intptr_t)handle)

void open_in_gdb(void)
static struct child_process cp = CHILD_PROCESS_INIT;
extern char *_pgmptr;

argv_array_pushl(&cp.args, "mintty", "gdb", NULL);
argv_array_pushf(&cp.args, "--pid=%d", getpid());
cp.clean_on_exit = 1;
if (start_command(&cp) < 0)
die_errno("Could not start gdb");

int err_win_to_posix(DWORD winerr)
int error = ENOSYS;
@@ -733,6 +733,16 @@ static int mingw_main(c,v)


* 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

0 comments on commit 2c70487

Please sign in to comment.
You can’t perform that action at this time.