如何调试非法指令异常?

发布于 2024-08-11 06:07:39 字数 1150 浏览 7 评论 0原文

当尝试使用 mdbglib 中的 dbgeng 时,我遇到此异常:0x037ba4f4 处的第一次机会异常 (dbgeng. ASDumpAnalyzer.exe 中的 dll):0xC000001D:非法指令。我想知道如何调试这个?

它正在抛出汇编指令 vmcpuid。当我跳过该指令时,代码按预期工作。

堆栈跟踪:

dbgeng.dll!X86IsVirtualMachine()  + 0x44 bytes
dbgeng.dll!LiveUserDebugServices::GetTargetInfo()  + 0x95 bytes
dbgeng.dll!LiveUserTargetInfo::InitFromServices()  + 0x95 bytes
dbgeng.dll!LiveUserTargetInfo::WaitForEvent()  + 0x4f bytes
dbgeng.dll!WaitForAnyTarget()  + 0x5f bytes
dbgeng.dll!RawWaitForEvent()  + 0x2ae bytes
dbgeng.dll!DebugClient::WaitForEvent()  + 0xb0 bytes
[Managed to Native Transition]
mdbglib.dll!MS::Debuggers::DbgEng::DebugControl::WaitForEvent(unsigned int timeout = 0) Line 107 + 0x38 bytes   C++
mdbglib.dll!MS::Debuggers::DbgEng::Debuggee::WaitForEvent(unsigned int timeout = 0) Line 365    C++
ASDumpAnalyzer.exe!ASDumpAnalyzer.Program.WriteMemoryDump() Line 51 + 0xd bytes C#
ASDumpAnalyzer.exe!ASDumpAnalyzer.Program.Main() Line 21 + 0x5 bytes    C#
mscoree.dll!__CorExeMain@0()  + 0x34 bytes
kernel32.dll!_BaseProcessStart@4()  + 0x23 bytes

I'm getting this exception when trying to use dbgeng from mdbglib: First-chance exception at 0x037ba4f4 (dbgeng.dll) in ASDumpAnalyzer.exe: 0xC000001D: Illegal Instruction. I'm wondering how to go about debugging this?

It is throwing on the assembly instruction vmcpuid. When I step over that instruction the code works as expected.

Stack trace:

dbgeng.dll!X86IsVirtualMachine()  + 0x44 bytes
dbgeng.dll!LiveUserDebugServices::GetTargetInfo()  + 0x95 bytes
dbgeng.dll!LiveUserTargetInfo::InitFromServices()  + 0x95 bytes
dbgeng.dll!LiveUserTargetInfo::WaitForEvent()  + 0x4f bytes
dbgeng.dll!WaitForAnyTarget()  + 0x5f bytes
dbgeng.dll!RawWaitForEvent()  + 0x2ae bytes
dbgeng.dll!DebugClient::WaitForEvent()  + 0xb0 bytes
[Managed to Native Transition]
mdbglib.dll!MS::Debuggers::DbgEng::DebugControl::WaitForEvent(unsigned int timeout = 0) Line 107 + 0x38 bytes   C++
mdbglib.dll!MS::Debuggers::DbgEng::Debuggee::WaitForEvent(unsigned int timeout = 0) Line 365    C++
ASDumpAnalyzer.exe!ASDumpAnalyzer.Program.WriteMemoryDump() Line 51 + 0xd bytes C#
ASDumpAnalyzer.exe!ASDumpAnalyzer.Program.Main() Line 21 + 0x5 bytes    C#
mscoree.dll!__CorExeMain@0()  + 0x34 bytes
kernel32.dll!_BaseProcessStart@4()  + 0x23 bytes

如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。

扫码二维码加入Web技术交流群

发布评论

需要 登录 才能够评论, 你可以免费 注册 一个本站的账号。

评论(1

月竹挽风 2024-08-18 06:07:39

您是否尝试过不打破第一次机会异常?我敢打赌 X86IsVirtualMachine 在 VMCPUID 周围有一个 __try/__finally 块...因为它不是有效的指令,您可能没有在虚拟机下运行。

Have you tried not breaking on first chance exceptions? I bet that X86IsVirtualMachine has a __try/__finally block around VMCPUID... since it's not a valid instruction you're probably not running under a VM.

~没有更多了~
我们使用 Cookies 和其他技术来定制您的体验包括您的登录状态等。通过阅读我们的 隐私政策 了解更多相关信息。 单击 接受 或继续使用网站,即表示您同意使用 Cookies 和您的相关数据。
原文