From 24b9c178ed316b39236e62dd655c85f3405e147a Mon Sep 17 00:00:00 2001 From: David Liu Date: Mon, 13 Feb 2023 18:03:58 +0800 Subject: [PATCH] fix build error on Windows ARM64 by add new define fix build error on Windows ARM64 by add new define --- src/assert.cpp | 17 +++++++++++------ 1 file changed, 11 insertions(+), 6 deletions(-) diff --git a/src/assert.cpp b/src/assert.cpp index d623605b5..482345451 100644 --- a/src/assert.cpp +++ b/src/assert.cpp @@ -190,16 +190,21 @@ TORRENT_EXPORT void print_backtrace(char* out, int len, int max_depth std::array stack; STACKFRAME64 stack_frame = {}; -#if defined(_WIN64) - int const 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; -#else +#if defined(_M_IX86) int const machine_type = IMAGE_FILE_MACHINE_I386; stack_frame.AddrPC.Offset = context_record.Eip; stack_frame.AddrFrame.Offset = context_record.Ebp; stack_frame.AddrStack.Offset = context_record.Esp; +#elif defined(_M_X64) + int const 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; +#elif defined(_M_ARM64) + int const 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; #endif stack_frame.AddrPC.Mode = AddrModeFlat; stack_frame.AddrFrame.Mode = AddrModeFlat; -- 2.39.1.windows.1