From ca4e40600ba06c0155eabd3904fc48ba749a8df1 Mon Sep 17 00:00:00 2001 From: adriandole Date: Mon, 2 Dec 2024 17:43:50 -0800 Subject: [PATCH] arm64 test support --- src/libmongoc/CMakeLists.txt | 2 +- src/libmongoc/tests/test-libmongoc.c | 17 ++++++++++++----- 2 files changed, 13 insertions(+), 6 deletions(-) diff --git a/src/libmongoc/CMakeLists.txt b/src/libmongoc/CMakeLists.txt index fed07d5188..8ba6e0202c 100644 --- a/src/libmongoc/CMakeLists.txt +++ b/src/libmongoc/CMakeLists.txt @@ -1222,7 +1222,7 @@ if (ENABLE_TESTS) target_link_libraries (${test} PUBLIC - $<$:DbgHelp.dll> + $<$:DbgHelp.lib> mongoc_static ) # We have tests that test our deprecated api. diff --git a/src/libmongoc/tests/test-libmongoc.c b/src/libmongoc/tests/test-libmongoc.c index 0ba5bdc70f..cdd5e0b21d 100644 --- a/src/libmongoc/tests/test-libmongoc.c +++ b/src/libmongoc/tests/test-libmongoc.c @@ -2476,10 +2476,17 @@ windows_exception_handler (EXCEPTION_POINTERS *pExceptionInfo) STACKFRAME64 stack_frame; memset (&stack_frame, 0, sizeof (stack_frame)); #if defined(_WIN64) - int machine_type = IMAGE_FILE_MACHINE_AMD64; - stack_frame.AddrPC.Offset = context_record.Rip; - stack_frame.AddrFrame.Offset = context_record.Rbp; - stack_frame.AddrStack.Offset = context_record.Rsp; + #if defined(_M_ARM64) + int machine_type = IMAGE_FILE_MACHINE_ARM64; + stack_frame.AddrPC.Offset = context_record.Pc; + stack_frame.AddrFrame.Offset = context_record.Fp; + stack_frame.AddrStack.Offset = context_record.Sp; + #else + int machine_type = IMAGE_FILE_MACHINE_AMD64; + stack_frame.AddrPC.Offset = context_record.Rip; + stack_frame.AddrFrame.Offset = context_record.Rbp; + stack_frame.AddrStack.Offset = context_record.Rsp; + #endif #else int machine_type = IMAGE_FILE_MACHINE_I386; stack_frame.AddrPC.Offset = context_record.Eip; @@ -2522,7 +2529,7 @@ windows_exception_handler (EXCEPTION_POINTERS *pExceptionInfo) line.SizeOfStruct = sizeof (IMAGEHLP_LINE); DWORD offset_ln = 0; - if (SymGetLineFromAddr (process, (DWORD64) stack_frame.AddrPC.Offset, &offset_ln, &line)) { + if (SymGetLineFromAddr64 (process, (DWORD64) stack_frame.AddrPC.Offset, &offset_ln, &line)) { fprintf (stderr, " %s:%d ", line.FileName, line.LineNumber); }