1999-05-23 21:57:42 +02:00
|
|
|
/*
|
|
|
|
* Win32 debugger functions
|
|
|
|
*
|
|
|
|
* Copyright (C) 1999 Alexandre Julliard
|
2002-03-10 00:29:33 +01:00
|
|
|
*
|
|
|
|
* This library is free software; you can redistribute it and/or
|
|
|
|
* modify it under the terms of the GNU Lesser General Public
|
|
|
|
* License as published by the Free Software Foundation; either
|
|
|
|
* version 2.1 of the License, or (at your option) any later version.
|
|
|
|
*
|
|
|
|
* This library is distributed in the hope that it will be useful,
|
|
|
|
* but WITHOUT ANY WARRANTY; without even the implied warranty of
|
|
|
|
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
|
|
|
|
* Lesser General Public License for more details.
|
|
|
|
*
|
|
|
|
* You should have received a copy of the GNU Lesser General Public
|
|
|
|
* License along with this library; if not, write to the Free Software
|
2006-05-18 14:49:52 +02:00
|
|
|
* Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301, USA
|
1999-05-23 21:57:42 +02:00
|
|
|
*/
|
|
|
|
|
2011-06-15 20:04:27 +02:00
|
|
|
#include "config.h"
|
2000-11-26 23:39:50 +01:00
|
|
|
#include <stdio.h>
|
1999-07-31 19:36:48 +02:00
|
|
|
#include <string.h>
|
|
|
|
|
2010-03-14 21:53:28 +01:00
|
|
|
#include "ntstatus.h"
|
|
|
|
#define WIN32_NO_STATUS
|
2000-03-08 13:01:30 +01:00
|
|
|
#include "winerror.h"
|
2001-07-19 02:39:09 +02:00
|
|
|
#include "wine/server.h"
|
2005-05-16 16:45:18 +02:00
|
|
|
#include "kernel_private.h"
|
2019-05-14 12:30:46 +02:00
|
|
|
#include "wine/asm.h"
|
2002-03-10 00:29:33 +01:00
|
|
|
#include "wine/debug.h"
|
2014-06-14 09:39:24 +02:00
|
|
|
#include "wine/exception.h"
|
1999-05-23 21:57:42 +02:00
|
|
|
|
2002-03-10 00:29:33 +01:00
|
|
|
WINE_DEFAULT_DEBUG_CHANNEL(debugstr);
|
1999-05-23 21:57:42 +02:00
|
|
|
|
2002-02-27 02:28:30 +01:00
|
|
|
/***********************************************************************
|
|
|
|
* DebugBreakProcess (KERNEL32.@)
|
|
|
|
*
|
|
|
|
* Raises an exception so that a debugger (if attached)
|
|
|
|
* can take some action. Same as DebugBreak, but applies to any process.
|
2004-08-26 20:22:17 +02:00
|
|
|
*
|
|
|
|
* PARAMS
|
|
|
|
* hProc [I] Process to break into.
|
|
|
|
*
|
|
|
|
* RETURNS
|
|
|
|
*
|
|
|
|
* True if successful.
|
2002-02-27 02:28:30 +01:00
|
|
|
*/
|
2019-07-05 13:21:37 +02:00
|
|
|
BOOL WINAPI DebugBreakProcess(HANDLE process)
|
2002-02-27 02:28:30 +01:00
|
|
|
{
|
2019-07-05 13:21:37 +02:00
|
|
|
NTSTATUS status;
|
2002-02-27 02:28:30 +01:00
|
|
|
|
2019-07-05 13:21:37 +02:00
|
|
|
TRACE("(%p)\n", process);
|
2002-02-27 02:28:30 +01:00
|
|
|
|
2019-07-05 13:21:37 +02:00
|
|
|
status = DbgUiIssueRemoteBreakin(process);
|
|
|
|
if (status) SetLastError(RtlNtStatusToDosError(status));
|
|
|
|
return !status;
|
2002-02-27 02:28:30 +01:00
|
|
|
}
|
|
|
|
|
2000-03-08 17:41:37 +01:00
|
|
|
|
2002-02-27 02:28:30 +01:00
|
|
|
/***********************************************************************
|
2002-03-11 02:17:26 +01:00
|
|
|
* DebugSetProcessKillOnExit (KERNEL32.@)
|
2002-02-27 02:28:30 +01:00
|
|
|
*
|
2004-01-16 22:26:08 +01:00
|
|
|
* Let a debugger decide whether a debuggee will be killed upon debugger
|
2004-08-26 20:22:17 +02:00
|
|
|
* termination.
|
|
|
|
*
|
|
|
|
* PARAMS
|
|
|
|
* kill [I] If set to true then kill the process on exit.
|
|
|
|
*
|
|
|
|
* RETURNS
|
|
|
|
* True if successful, false otherwise.
|
2002-02-27 02:28:30 +01:00
|
|
|
*/
|
|
|
|
BOOL WINAPI DebugSetProcessKillOnExit(BOOL kill)
|
|
|
|
{
|
|
|
|
BOOL ret = FALSE;
|
|
|
|
|
|
|
|
SERVER_START_REQ( set_debugger_kill_on_exit )
|
|
|
|
{
|
|
|
|
req->kill_on_exit = kill;
|
|
|
|
ret = !wine_server_call_err( req );
|
|
|
|
}
|
|
|
|
SERVER_END_REQ;
|
|
|
|
return ret;
|
|
|
|
}
|