From fc97373f6202c8fef8d070f8b3cc5671baa6b6c0 Mon Sep 17 00:00:00 2001 From: Alexandre Julliard Date: Tue, 13 Aug 2019 15:41:55 +0200 Subject: [PATCH] ntdll: Fix support for breakpoint exceptions on ARM64. Signed-off-by: Alexandre Julliard --- dlls/ntdll/signal_arm64.c | 23 ++++++++++++++--------- 1 file changed, 14 insertions(+), 9 deletions(-) diff --git a/dlls/ntdll/signal_arm64.c b/dlls/ntdll/signal_arm64.c index 4ebccd2fe69..e405c90c2e8 100644 --- a/dlls/ntdll/signal_arm64.c +++ b/dlls/ntdll/signal_arm64.c @@ -505,6 +505,17 @@ done: set_cpu_context( context ); } +/********************************************************************** + * raise_trap_exception + */ +static void WINAPI raise_trap_exception( EXCEPTION_RECORD *rec, CONTEXT *context ) +{ + NTSTATUS status; + if (rec->ExceptionCode == EXCEPTION_BREAKPOINT) context->Pc += 4; + status = NtRaiseException( rec, context, TRUE ); + raise_status( status, rec ); +} + /********************************************************************** * raise_generic_exception */ @@ -704,7 +715,7 @@ static void segv_handler( int signal, siginfo_t *info, void *ucontext ) static void trap_handler( int signal, siginfo_t *info, void *ucontext ) { ucontext_t *context = ucontext; - EXCEPTION_RECORD *rec = setup_exception( context, raise_generic_exception ); + EXCEPTION_RECORD *rec = setup_exception( context, raise_trap_exception ); switch (info->si_code) { @@ -1208,18 +1219,12 @@ void signal_exit_process( int status ) /********************************************************************** * DbgBreakPoint (NTDLL.@) */ -void WINAPI DbgBreakPoint(void) -{ - kill(getpid(), SIGTRAP); -} +__ASM_STDCALL_FUNC( DbgBreakPoint, 0, "brk #0; ret") /********************************************************************** * DbgUserBreakPoint (NTDLL.@) */ -void WINAPI DbgUserBreakPoint(void) -{ - kill(getpid(), SIGTRAP); -} +__ASM_STDCALL_FUNC( DbgUserBreakPoint, 0, "brk #0; ret") /********************************************************************** * NtCurrentTeb (NTDLL.@)