如何调试非法指令异常?

时间:2009-11-09 04:37:33

标签: debugging dbgeng

尝试使用mdbglib中的dbgeng时出现此异常:ASDumpAnalyzer.exe中0x037ba4f4(dbgeng.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

1 个答案:

答案 0 :(得分:1)

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