none
Debugging optimized code RRS feed

  • Question

  • Hello,

    please I would like to see the the disassembly of a running native code that was output by the JITter for a specific .NET method.

    Actually I'm curious to check, whether a piece of code was inlined or not by the JITter. Inlining happens only with optimized code, which is more difficult to debug for me.

    Hope it's not rocket science? ;)
    Thanks

    Sunday, November 23, 2008 10:37 PM

Answers

  • I'm hitting my breakpoints somehow even with that option off, but not all is lost, you can always cheat :)

    dump a while(true) {}  in the function, wait for your app to hang and hit the break function in the debugger :)
    • Marked as answer by andris11 Monday, November 24, 2008 2:23 AM
    Monday, November 24, 2008 1:35 AM

All replies

  • Don't worry its not that complicated, go to your project options and hit the checkbox 'Enable unmanaged debugging' in the debug tab, set a breakpoint on the function who's code you'd like to inspect and once you hit it right click in the code windows and click 'go to disassembly'

    Monday, November 24, 2008 12:47 AM
  • Thanks, unfortunately I don't seem to set a breakpoint when "Suppress JIT optimization on module load" is disabled, which is what I need, otherwise the JIT generated code is not optimised and I'm looking for *how* it was optimised.

    Any idea?

    P.S. "Suppress JIT optimization on module load" resides in Tools->Options->General in VS2008
    Monday, November 24, 2008 1:17 AM
  • I'm hitting my breakpoints somehow even with that option off, but not all is lost, you can always cheat :)

    dump a while(true) {}  in the function, wait for your app to hang and hit the break function in the debugger :)
    • Marked as answer by andris11 Monday, November 24, 2008 2:23 AM
    Monday, November 24, 2008 1:35 AM
  • Thanks, I could manage it using a while(true){} :)

    Monday, November 24, 2008 2:23 AM