1
0
Fork 0
mirror of synced 2025-03-07 03:53:26 +01:00

ntdll: Move the process breakpoint to the CPU backends.

This commit is contained in:
Alexandre Julliard 2024-01-23 15:53:58 +01:00
parent 9b02ac6d42
commit 1414adfa46
8 changed files with 91 additions and 38 deletions

View file

@ -4076,30 +4076,6 @@ PIMAGE_NT_HEADERS WINAPI RtlImageNtHeader(HMODULE hModule)
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
*/
@ -4270,7 +4246,7 @@ void loader_init( CONTEXT *context, void **entry )
{
static int attach_done;
NTSTATUS status;
ULONG_PTR cookie;
ULONG_PTR cookie, port = 0;
WINE_MODREF *wm;
if (process_detaching) NtTerminateThread( GetCurrentThread(), 0 );
@ -4380,7 +4356,9 @@ void loader_init( CONTEXT *context, void **entry )
release_address_space();
if (wm->ldr.TlsIndex == -1) call_tls_callbacks( wm->ldr.DllBase, DLL_PROCESS_ATTACH );
if (wm->ldr.ActivationContext) RtlDeactivateActivationContext( 0, cookie );
process_breakpoint();
NtQueryInformationProcess( GetCurrentProcess(), ProcessDebugPort, &port, sizeof(port), NULL );
if (port) process_breakpoint();
}
else
{

View file

@ -54,6 +54,7 @@ extern EXCEPTION_DISPOSITION WINAPI user_callback_handler( EXCEPTION_RECORD *rec
CONTEXT *context, void *dispatch );
extern void DECLSPEC_NORETURN raise_status( NTSTATUS status, EXCEPTION_RECORD *rec );
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 NTSTATUS WINAPI KiUserExceptionDispatcher(EXCEPTION_RECORD*,CONTEXT*);

View file

@ -708,18 +708,7 @@ NTSTATUS WINAPI DbgUiConvertStateChangeStructure( DBGUI_WAIT_STATE_CHANGE *state
void WINAPI DbgUiRemoteBreakin( void *arg )
{
TRACE( "\n" );
if (NtCurrentTeb()->Peb->BeingDebugged)
{
__TRY
{
DbgBreakPoint();
}
__EXCEPT_ALL
{
/* do nothing */
}
__ENDTRY
}
if (NtCurrentTeb()->Peb->BeingDebugged) process_breakpoint();
RtlExitUserThread( STATUS_SUCCESS );
}

View file

@ -1616,6 +1616,22 @@ void WINAPI LdrInitializeThunk( CONTEXT *context, ULONG_PTR unk2, ULONG_PTR unk3
NtContinue( context, TRUE );
}
/***********************************************************************
* process_breakpoint
*/
void WINAPI process_breakpoint(void)
{
__TRY
{
DbgBreakPoint();
}
__EXCEPT_ALL
{
/* do nothing */
}
__ENDTRY
}
/**********************************************************************
* DbgBreakPoint (NTDLL.@)
*/

View file

@ -1585,6 +1585,24 @@ void WINAPI LdrInitializeThunk( CONTEXT *context, ULONG_PTR unk2, ULONG_PTR unk3
NtContinue( context, TRUE );
}
/***********************************************************************
* process_breakpoint
*/
void WINAPI process_breakpoint(void)
{
__TRY
{
DbgBreakPoint();
}
__EXCEPT_ALL
{
/* do nothing */
}
__ENDTRY
}
/**********************************************************************
* DbgBreakPoint (NTDLL.@)
*/

View file

@ -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.@)
*/

View file

@ -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.@)
*/

View file

@ -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.@)
*/