1

If I have to perform debugging via WinDbg, are there are pro or cons or having release vs debug builds? I am just wondering if there are any limitations of doing debugging with the release build

imak
  • 6,489
  • 7
  • 50
  • 73

2 Answers2

2

First of all you need debug information (.pdb) which you can have in both. Then release builds are usually optimized:

  • some variables are mapped to registers (and no longer occupy memory),
  • some functions are inlined (and you can't put a breakpoint onto them)
  • some code is reordered

and this makes it much harder to understand what's going on at the moment.

So in general release builds will be notable faster, but often harder to debug. Other than that you shouldn't see any serious difference.

sharptooth
  • 167,383
  • 100
  • 513
  • 979
  • Note that the next version of the PDB file format is going to have improved support for debugging optimized code. Pretty neat stuff, here's an interesting post about it: http://blogs.microsoft.co.il/blogs/sasha/archive/2011/10/12/debugging-optimized-code-in-visual-studio-11.aspx – snoone Oct 27 '11 at 14:57
  • When you say release will be harder to debug, can you give some more specific examples of how it will be easier with debug build? – Silverlight Student Oct 27 '11 at 17:00
  • @Silverlight Student: Well, imagine you want to set a breakpoint onto an opening brace of some function so that it is hit whenever the function is called. If that function is inlined you can't do that - there will be no calls to that function, so you will have to deduce where its call sites are and which code exactly corresponds to that function inlined code. – sharptooth Oct 28 '11 at 06:01
1

Go through this URL, there is a nice discussion related to this

Separate 'debug' and 'release' builds?

Community
  • 1
  • 1
Siva Charan
  • 17,940
  • 9
  • 60
  • 95