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

ntdll: Use a .seh handler for DbgUiRemoteBreakin().

This commit is contained in:
Alexandre Julliard 2024-01-30 15:51:01 +01:00
parent d0e02b67eb
commit 08f4705e44
3 changed files with 48 additions and 17 deletions

View file

@ -1688,6 +1688,21 @@ void WINAPI process_breakpoint(void)
/***********************************************************************
* DbgUiRemoteBreakin (NTDLL.@)
*/
#ifdef __WINE_PE_BUILD
__ASM_GLOBAL_FUNC( DbgUiRemoteBreakin,
".seh_endprologue\n\t"
".seh_handler DbgUiRemoteBreakin_handler, %except\n\t"
"mrc p15, 0, r0, c13, c0, 2\n\t" /* NtCurrentTeb() */
"ldr r0, [r0, #0x30]\n\t" /* NtCurrentTeb()->Peb */
"ldrb r0, [r0, 0x02]\n\t" /* peb->BeingDebugged */
"cbz r0, 1f\n\t"
"bl " __ASM_NAME("DbgBreakPoint") "\n"
"1:\tmov r0, #0\n\t"
"bl " __ASM_NAME("RtlExitUserThread") "\n"
"DbgUiRemoteBreakin_handler:\n\t"
"mov sp, r1\n\t" /* frame */
"b 1b" )
#else
void WINAPI DbgUiRemoteBreakin( void *arg )
{
if (NtCurrentTeb()->Peb->BeingDebugged)
@ -1704,6 +1719,7 @@ void WINAPI DbgUiRemoteBreakin( void *arg )
}
RtlExitUserThread( STATUS_SUCCESS );
}
#endif
/**********************************************************************
* DbgBreakPoint (NTDLL.@)

View file

@ -1585,22 +1585,20 @@ __ASM_GLOBAL_FUNC( process_breakpoint,
/***********************************************************************
* DbgUiRemoteBreakin (NTDLL.@)
*/
void WINAPI DbgUiRemoteBreakin( void *arg )
{
if (NtCurrentTeb()->Peb->BeingDebugged)
{
__TRY
{
DbgBreakPoint();
}
__EXCEPT_ALL
{
/* do nothing */
}
__ENDTRY
}
RtlExitUserThread( STATUS_SUCCESS );
}
__ASM_GLOBAL_FUNC( DbgUiRemoteBreakin,
"stp x29, x30, [sp, #-16]!\n\t"
".seh_save_fplr_x 16\n\t"
".seh_endprologue\n\t"
".seh_handler DbgUiRemoteBreakin_handler, @except\n\t"
"ldr x0, [x18, #0x60]\n\t" /* NtCurrentTeb()->Peb */
"ldrb w0, [x0, 0x02]\n\t" /* peb->BeingDebugged */
"cbz w0, 1f\n\t"
"bl " __ASM_NAME("DbgBreakPoint") "\n"
"1:\tmov w0, #0\n\t"
"bl " __ASM_NAME("RtlExitUserThread") "\n"
"DbgUiRemoteBreakin_handler:\n\t"
"mov sp, x1\n\t" /* frame */
"b 1b" )
/**********************************************************************
* DbgBreakPoint (NTDLL.@)

View file

@ -1748,6 +1748,23 @@ void WINAPI process_breakpoint(void)
/***********************************************************************
* DbgUiRemoteBreakin (NTDLL.@)
*/
#ifdef __WINE_PE_BUILD
__ASM_GLOBAL_FUNC( DbgUiRemoteBreakin,
"subq $0x28,%rsp\n\t"
".seh_stackalloc 0x28\n\t"
".seh_endprologue\n\t"
".seh_handler DbgUiRemoteBreakin_handler, @except\n\t"
"mov %gs:0x30,%rax\n\t"
"mov 0x60(%rax),%rax\n\t"
"cmpb $0,2(%rax)\n\t"
"je 1f\n\t"
"call " __ASM_NAME("DbgBreakPoint") "\n"
"1:\txorl %ecx,%ecx\n\t"
"call " __ASM_NAME("RtlExitUserThread") "\n"
"DbgUiRemoteBreakin_handler:\n\t"
"movq %rdx,%rsp\n\t" /* frame */
"jmp 1b" )
#else
void WINAPI DbgUiRemoteBreakin( void *arg )
{
if (NtCurrentTeb()->Peb->BeingDebugged)
@ -1764,7 +1781,7 @@ void WINAPI DbgUiRemoteBreakin( void *arg )
}
RtlExitUserThread( STATUS_SUCCESS );
}
#endif
/**********************************************************************
* DbgBreakPoint (NTDLL.@)