Skip to content

Commit e575fb6

Browse files
committed
修正x86编译失败的问题
1 parent 4629207 commit e575fb6

File tree

1 file changed

+11
-5
lines changed

1 file changed

+11
-5
lines changed

TrafficMonitor/crashtool.cpp

Lines changed: 11 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -87,16 +87,22 @@ class CCrashReport
8787
// 初始化堆栈帧
8888
#if defined _M_IX86
8989
DWORD machineType = IMAGE_FILE_MACHINE_I386;
90-
#elif defined _M_ARM64EC
91-
DWORD machineType = IMAGE_FILE_MACHINE_ARM64;
90+
stackFrame.AddrPC.Offset = context.Eip; // x86 使用 EIP
91+
stackFrame.AddrFrame.Offset = context.Ebp; // x86 使用 EBP
92+
stackFrame.AddrStack.Offset = context.Esp; // x86 使用 ESP
93+
//#elif defined _M_ARM64EC
94+
// DWORD machineType = IMAGE_FILE_MACHINE_ARM64;
95+
// stackFrame.AddrPC.Offset = context.Pc; // ARM64 使用 PC
96+
// stackFrame.AddrFrame.Offset = context.Fp; // ARM64 使用 FP
97+
// stackFrame.AddrStack.Offset = context.Sp; // ARM64 使用 SP
9298
#else
9399
DWORD machineType = IMAGE_FILE_MACHINE_AMD64;
100+
stackFrame.AddrPC.Offset = context.Rip; // x64 使用 RIP
101+
stackFrame.AddrFrame.Offset = context.Rbp; // x64 使用 RBP
102+
stackFrame.AddrStack.Offset = context.Rsp; // x64 使用 RSP
94103
#endif
95-
stackFrame.AddrPC.Offset = context.Rip;
96104
stackFrame.AddrPC.Mode = AddrModeFlat;
97-
stackFrame.AddrFrame.Offset = context.Rbp;
98105
stackFrame.AddrFrame.Mode = AddrModeFlat;
99-
stackFrame.AddrStack.Offset = context.Rsp;
100106
stackFrame.AddrStack.Mode = AddrModeFlat;
101107

102108
// 遍历堆栈帧

0 commit comments

Comments
 (0)