ntdll: Move the process breakpoint to the CPU backends.
This commit is contained in:
parent
9b02ac6d42
commit
1414adfa46
8 changed files with 91 additions and 38 deletions
|
@ -4076,30 +4076,6 @@ PIMAGE_NT_HEADERS WINAPI RtlImageNtHeader(HMODULE hModule)
|
||||||
return ret;
|
return ret;
|
||||||
}
|
}
|
||||||
|
|
||||||
/***********************************************************************
|
|
||||||
* process_breakpoint
|
|
||||||
*
|
|
||||||
* Trigger a debug breakpoint if the process is being debugged.
|
|
||||||
*/
|
|
||||||
static void process_breakpoint(void)
|
|
||||||
{
|
|
||||||
DWORD_PTR port = 0;
|
|
||||||
|
|
||||||
NtQueryInformationProcess( GetCurrentProcess(), ProcessDebugPort, &port, sizeof(port), NULL );
|
|
||||||
if (!port) return;
|
|
||||||
|
|
||||||
__TRY
|
|
||||||
{
|
|
||||||
DbgBreakPoint();
|
|
||||||
}
|
|
||||||
__EXCEPT_ALL
|
|
||||||
{
|
|
||||||
/* do nothing */
|
|
||||||
}
|
|
||||||
__ENDTRY
|
|
||||||
}
|
|
||||||
|
|
||||||
|
|
||||||
/***********************************************************************
|
/***********************************************************************
|
||||||
* load_global_options
|
* load_global_options
|
||||||
*/
|
*/
|
||||||
|
@ -4270,7 +4246,7 @@ void loader_init( CONTEXT *context, void **entry )
|
||||||
{
|
{
|
||||||
static int attach_done;
|
static int attach_done;
|
||||||
NTSTATUS status;
|
NTSTATUS status;
|
||||||
ULONG_PTR cookie;
|
ULONG_PTR cookie, port = 0;
|
||||||
WINE_MODREF *wm;
|
WINE_MODREF *wm;
|
||||||
|
|
||||||
if (process_detaching) NtTerminateThread( GetCurrentThread(), 0 );
|
if (process_detaching) NtTerminateThread( GetCurrentThread(), 0 );
|
||||||
|
@ -4380,7 +4356,9 @@ void loader_init( CONTEXT *context, void **entry )
|
||||||
release_address_space();
|
release_address_space();
|
||||||
if (wm->ldr.TlsIndex == -1) call_tls_callbacks( wm->ldr.DllBase, DLL_PROCESS_ATTACH );
|
if (wm->ldr.TlsIndex == -1) call_tls_callbacks( wm->ldr.DllBase, DLL_PROCESS_ATTACH );
|
||||||
if (wm->ldr.ActivationContext) RtlDeactivateActivationContext( 0, cookie );
|
if (wm->ldr.ActivationContext) RtlDeactivateActivationContext( 0, cookie );
|
||||||
process_breakpoint();
|
|
||||||
|
NtQueryInformationProcess( GetCurrentProcess(), ProcessDebugPort, &port, sizeof(port), NULL );
|
||||||
|
if (port) process_breakpoint();
|
||||||
}
|
}
|
||||||
else
|
else
|
||||||
{
|
{
|
||||||
|
|
|
@ -54,6 +54,7 @@ extern EXCEPTION_DISPOSITION WINAPI user_callback_handler( EXCEPTION_RECORD *rec
|
||||||
CONTEXT *context, void *dispatch );
|
CONTEXT *context, void *dispatch );
|
||||||
extern void DECLSPEC_NORETURN raise_status( NTSTATUS status, EXCEPTION_RECORD *rec );
|
extern void DECLSPEC_NORETURN raise_status( NTSTATUS status, EXCEPTION_RECORD *rec );
|
||||||
extern LONG WINAPI call_unhandled_exception_filter( PEXCEPTION_POINTERS eptr );
|
extern LONG WINAPI call_unhandled_exception_filter( PEXCEPTION_POINTERS eptr );
|
||||||
|
extern void WINAPI process_breakpoint(void);
|
||||||
|
|
||||||
extern void WINAPI LdrInitializeThunk(CONTEXT*,ULONG_PTR,ULONG_PTR,ULONG_PTR);
|
extern void WINAPI LdrInitializeThunk(CONTEXT*,ULONG_PTR,ULONG_PTR,ULONG_PTR);
|
||||||
extern NTSTATUS WINAPI KiUserExceptionDispatcher(EXCEPTION_RECORD*,CONTEXT*);
|
extern NTSTATUS WINAPI KiUserExceptionDispatcher(EXCEPTION_RECORD*,CONTEXT*);
|
||||||
|
|
|
@ -708,18 +708,7 @@ NTSTATUS WINAPI DbgUiConvertStateChangeStructure( DBGUI_WAIT_STATE_CHANGE *state
|
||||||
void WINAPI DbgUiRemoteBreakin( void *arg )
|
void WINAPI DbgUiRemoteBreakin( void *arg )
|
||||||
{
|
{
|
||||||
TRACE( "\n" );
|
TRACE( "\n" );
|
||||||
if (NtCurrentTeb()->Peb->BeingDebugged)
|
if (NtCurrentTeb()->Peb->BeingDebugged) process_breakpoint();
|
||||||
{
|
|
||||||
__TRY
|
|
||||||
{
|
|
||||||
DbgBreakPoint();
|
|
||||||
}
|
|
||||||
__EXCEPT_ALL
|
|
||||||
{
|
|
||||||
/* do nothing */
|
|
||||||
}
|
|
||||||
__ENDTRY
|
|
||||||
}
|
|
||||||
RtlExitUserThread( STATUS_SUCCESS );
|
RtlExitUserThread( STATUS_SUCCESS );
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
@ -1616,6 +1616,22 @@ void WINAPI LdrInitializeThunk( CONTEXT *context, ULONG_PTR unk2, ULONG_PTR unk3
|
||||||
NtContinue( context, TRUE );
|
NtContinue( context, TRUE );
|
||||||
}
|
}
|
||||||
|
|
||||||
|
/***********************************************************************
|
||||||
|
* process_breakpoint
|
||||||
|
*/
|
||||||
|
void WINAPI process_breakpoint(void)
|
||||||
|
{
|
||||||
|
__TRY
|
||||||
|
{
|
||||||
|
DbgBreakPoint();
|
||||||
|
}
|
||||||
|
__EXCEPT_ALL
|
||||||
|
{
|
||||||
|
/* do nothing */
|
||||||
|
}
|
||||||
|
__ENDTRY
|
||||||
|
}
|
||||||
|
|
||||||
/**********************************************************************
|
/**********************************************************************
|
||||||
* DbgBreakPoint (NTDLL.@)
|
* DbgBreakPoint (NTDLL.@)
|
||||||
*/
|
*/
|
||||||
|
|
|
@ -1585,6 +1585,24 @@ void WINAPI LdrInitializeThunk( CONTEXT *context, ULONG_PTR unk2, ULONG_PTR unk3
|
||||||
NtContinue( context, TRUE );
|
NtContinue( context, TRUE );
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
|
/***********************************************************************
|
||||||
|
* process_breakpoint
|
||||||
|
*/
|
||||||
|
void WINAPI process_breakpoint(void)
|
||||||
|
{
|
||||||
|
__TRY
|
||||||
|
{
|
||||||
|
DbgBreakPoint();
|
||||||
|
}
|
||||||
|
__EXCEPT_ALL
|
||||||
|
{
|
||||||
|
/* do nothing */
|
||||||
|
}
|
||||||
|
__ENDTRY
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
/**********************************************************************
|
/**********************************************************************
|
||||||
* DbgBreakPoint (NTDLL.@)
|
* DbgBreakPoint (NTDLL.@)
|
||||||
*/
|
*/
|
||||||
|
|
|
@ -2001,6 +2001,23 @@ void WINAPI LdrInitializeThunk( CONTEXT *arm_context, ULONG_PTR unk2, ULONG_PTR
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
|
/***********************************************************************
|
||||||
|
* process_breakpoint
|
||||||
|
*/
|
||||||
|
void WINAPI process_breakpoint(void)
|
||||||
|
{
|
||||||
|
__TRY
|
||||||
|
{
|
||||||
|
DbgBreakPoint();
|
||||||
|
}
|
||||||
|
__EXCEPT_ALL
|
||||||
|
{
|
||||||
|
/* do nothing */
|
||||||
|
}
|
||||||
|
__ENDTRY
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
/**********************************************************************
|
/**********************************************************************
|
||||||
* DbgBreakPoint (NTDLL.@)
|
* DbgBreakPoint (NTDLL.@)
|
||||||
*/
|
*/
|
||||||
|
|
|
@ -629,6 +629,23 @@ void WINAPI LdrInitializeThunk( CONTEXT *context, ULONG_PTR unk2, ULONG_PTR unk3
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
|
/***********************************************************************
|
||||||
|
* process_breakpoint
|
||||||
|
*/
|
||||||
|
void WINAPI process_breakpoint(void)
|
||||||
|
{
|
||||||
|
__TRY
|
||||||
|
{
|
||||||
|
DbgBreakPoint();
|
||||||
|
}
|
||||||
|
__EXCEPT_ALL
|
||||||
|
{
|
||||||
|
/* do nothing */
|
||||||
|
}
|
||||||
|
__ENDTRY
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
/**********************************************************************
|
/**********************************************************************
|
||||||
* DbgBreakPoint (NTDLL.@)
|
* DbgBreakPoint (NTDLL.@)
|
||||||
*/
|
*/
|
||||||
|
|
|
@ -1725,6 +1725,23 @@ void WINAPI LdrInitializeThunk( CONTEXT *context, ULONG_PTR unk2, ULONG_PTR unk3
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
|
/***********************************************************************
|
||||||
|
* process_breakpoint
|
||||||
|
*/
|
||||||
|
void WINAPI process_breakpoint(void)
|
||||||
|
{
|
||||||
|
__TRY
|
||||||
|
{
|
||||||
|
DbgBreakPoint();
|
||||||
|
}
|
||||||
|
__EXCEPT_ALL
|
||||||
|
{
|
||||||
|
/* do nothing */
|
||||||
|
}
|
||||||
|
__ENDTRY
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
/**********************************************************************
|
/**********************************************************************
|
||||||
* DbgBreakPoint (NTDLL.@)
|
* DbgBreakPoint (NTDLL.@)
|
||||||
*/
|
*/
|
||||||
|
|
Loading…
Add table
Reference in a new issue