简体   繁体   中英

What's the best way to view accurate disassembly in VC++ 2010 while in Win32 Release mode?

I am writing assembly-level optimized code, and I need to make sure that the C++ compiler is working with it correctly in Release-Mode.

I used to be able to get Release-Mode programs to break on breakpoints in VS 2002 (and display the raw disassembly as I stepped through it), but I can't remember how I got that to work. Does VS 2010 have any options that might allow this to happen?

用于发布版本(/ Zi)的构建符号[编辑:并与/ DEBUG链接],您将能够设置断点。

如果要使用调试器查看反汇编,则可以在要查看的代码之前放置一个__debugbreak()内部调用。

If you're writing straight assembly, you can just use INT 3 . When you place a breakpoint using the debugger, it actually changes the code to that (0xCC in binary) so the debugger will get called when it's executed.

You can also call one of the functions that do that for you like zr suggested. The Windows one is DbgBreakPoint() . If you disassemble it, you could easily see it's nothing but INT 3 .

These used to be methods of causing breakponts:

_asm
{
  int 3
}

or

_asm
{
  _emit 0xcc
}

or was it

_emit 0xcc

I'm not sure of the syntax (it's been a while) but hopefully something can be made of it.

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM