0
0
mirror of https://github.com/vim/vim.git synced 2025-10-13 06:54:15 -04:00

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.
This commit is contained in:
Bram Moolenaar
2018-06-20 22:38:21 +02:00
parent 9b0c5c23bd
commit 4551c0a9fc
5 changed files with 77 additions and 12 deletions

View File

@@ -123,6 +123,9 @@ static void f_cosh(typval_T *argvars, typval_T *rettv);
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 @@ static struct fst
{"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 @@ f_cursor(typval_T *argvars, typval_T *rettv)
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
*/