简体   繁体   中英

Breakpoints and debug in release mode

This is the first time that I use the release mode in VS, I always used the debug mode and I'm really impressed by how the code can be optimized in release configuration!

But anyway I was surprised that I could still use the "Local Windows Debugger" even in the release configuration, especially because it seems that debug in release mode is not obvious (while in my case I didn't change any option). So my questions are:

  1. Is that normal that the "Debug Information Format" in release mode is set to /ZI ? I noticed that if I disable this information no breakpoints work anymore, so maybe I changed it unintentionally.

  2. The code execution in Local Windows Debugger (F5) in release mode is slower is slower "Start without debugging" (CTRL+F5)?

1) Without any debug information, breakpoints just can't work as there is no way to associate a specific code line with an address in the binary.

(Actually, placing a break point on a specific instruction in the binary will still work, only mapping it back to the source code won't.)

If you lower the debug information format from /ZI to /Zi , further optimizations will be enabled, but in return certain debug features like live editing variable contents already become unavailable. See also https://msdn.microsoft.com/en-us/library/958x11bc.aspx for more details.

2) No, just spawning the debugger usually has no impact on performance.

This is unless actually using break- and trace points, in which at most the first 4 breakpoints are handled in hardware, and all following ones bring an overhead.

Tracing and profiling always causes overhead.

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