Welcome to mirror list, hosted at ThFree Co, Russian Federation.

git.kernel.org/pub/scm/git/git.git - Unnamed repository; edit this file 'description' to name the repository.
summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorJohannes Schindelin <johannes.schindelin@gmx.de>2020-02-14 00:49:53 +0300
committerJunio C Hamano <gitster@pobox.com>2020-02-14 21:02:07 +0300
commit08809c09aa1351b603e9c55734105cd2e3c24c41 (patch)
tree8484465b2e13ac0d8a71dce4a128b7d824d84971 /compat/mingw.h
parentb6d4d82bd5a49197d5d2f4f81c08da0d461cfcf1 (diff)
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>
Diffstat (limited to 'compat/mingw.h')
-rw-r--r--compat/mingw.h10
1 files changed, 10 insertions, 0 deletions
diff --git a/compat/mingw.h b/compat/mingw.h
index 04ca731a6b..88c07c4520 100644
--- a/compat/mingw.h
+++ b/compat/mingw.h
@@ -592,6 +592,16 @@ 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
*/
int err_win_to_posix(DWORD winerr);