patch 8.1.0091: MS-Windows: Cannot interrupt gdb when program is running
Problem: MS-Windows: Cannot interrupt gdb when program is running.
Solution: Add debugbreak() and use it in the terminal debugger.
Respect 'modified' in a prompt buffer.
diff --git a/src/evalfunc.c b/src/evalfunc.c
index 3cb66f3..24c3194 100644
--- a/src/evalfunc.c
+++ b/src/evalfunc.c
@@ -123,6 +123,9 @@
static void f_count(typval_T *argvars, typval_T *rettv);
static void f_cscope_connection(typval_T *argvars, typval_T *rettv);
static void f_cursor(typval_T *argsvars, typval_T *rettv);
+#ifdef WIN3264
+static void f_debugbreak(typval_T *argvars, typval_T *rettv);
+#endif
static void f_deepcopy(typval_T *argvars, typval_T *rettv);
static void f_delete(typval_T *argvars, typval_T *rettv);
static void f_deletebufline(typval_T *argvars, typval_T *rettv);
@@ -577,6 +580,9 @@
{"count", 2, 4, f_count},
{"cscope_connection",0,3, f_cscope_connection},
{"cursor", 1, 3, f_cursor},
+#ifdef WIN3264
+ {"debugbreak", 1, 1, f_debugbreak},
+#endif
{"deepcopy", 1, 2, f_deepcopy},
{"delete", 1, 2, f_delete},
{"deletebufline", 2, 3, f_deletebufline},
@@ -2761,6 +2767,33 @@
rettv->vval.v_number = 0;
}
+#ifdef WIN3264
+/*
+ * "debugbreak()" function
+ */
+ static void
+f_debugbreak(typval_T *argvars, typval_T *rettv)
+{
+ int pid;
+
+ rettv->vval.v_number = FAIL;
+ pid = (int)get_tv_number(&argvars[0]);
+ if (pid == 0)
+ EMSG(_(e_invarg));
+ else
+ {
+ HANDLE hProcess = OpenProcess(PROCESS_ALL_ACCESS, 0, pid);
+
+ if (hProcess != NULL)
+ {
+ DebugBreakProcess(hProcess);
+ CloseHandle(hProcess);
+ rettv->vval.v_number = OK;
+ }
+ }
+}
+#endif
+
/*
* "deepcopy()" function
*/
diff --git a/src/undo.c b/src/undo.c
index 6e3381f..117321e 100644
--- a/src/undo.c
+++ b/src/undo.c
@@ -3539,7 +3539,9 @@
int
bufIsChangedNotTerm(buf_T *buf)
{
- return !bt_dontwrite(buf)
+ // In a "prompt" buffer we do respect 'modified', so that we can control
+ // closing the window by setting or resetting that option.
+ return (!bt_dontwrite(buf) || bt_prompt(buf))
&& (buf->b_changed || file_ff_differs(buf, TRUE));
}
diff --git a/src/version.c b/src/version.c
index 1cc6012..3fcdb73 100644
--- a/src/version.c
+++ b/src/version.c
@@ -762,6 +762,8 @@
static int included_patches[] =
{ /* Add new patch number below this line */
/**/
+ 91,
+/**/
90,
/**/
89,