vim-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.
4551c0a9fc
This commit is contained in:
erw7
2019-05-25 11:14:35 +09:00
parent b015c4741c
commit aec3d7915c
6 changed files with 51 additions and 11 deletions

View File

@@ -1408,9 +1408,31 @@ static void f_cursor(typval_T *argvars, typval_T *rettv, FunPtr fptr)
rettv->vval.v_number = 0;
}
/*
* "deepcopy()" function
*/
// "debugbreak()" function
static void f_debugbreak(typval_T *argvars, typval_T *rettv, FunPtr fptr)
{
int pid;
rettv->vval.v_number = FAIL;
pid = (int)tv_get_number(&argvars[0]);
if (pid == 0) {
EMSG(_(e_invarg));
} else {
#ifdef WIN32
HANDLE hProcess = OpenProcess(PROCESS_ALL_ACCESS, 0, pid);
if (hProcess != NULL) {
DebugBreakProcess(hProcess);
CloseHandle(hProcess);
rettv->vval.v_number = OK;
}
#else
uv_kill(pid, SIGINT);
#endif
}
}
// "deepcopy()" function
static void f_deepcopy(typval_T *argvars, typval_T *rettv, FunPtr fptr)
{
int noref = 0;