EpicGamesExt / raddebugger

A native, user-mode, multi-process, graphical debugger.
MIT License
3.34k stars 169 forks source link

Bug: Not able to step over/into when compiled with O2 or Ox #277

Closed GloriousPtr closed 2 months ago

GloriousPtr commented 3 months ago

I was doing casey's 8086 decoder exercise and found this bug:

https://github.com/EpicGamesExt/raddebugger/assets/29519295/e2a68d37-8ad2-483b-bb76-2e5ffdbefc1e

Repro Project: https://1drv.ms/u/s!ApjsIRdEL5T4kxrYLQeifJF54ygw?e=id2WBX

GloriousPtr commented 3 months ago

Compiled with: cl /Ox /Zi Main.cpp Issue is observed with Ox and O2 both as stated in the title

ryanfleury commented 3 months ago

Ah, this must be related to stepping inside the inline frames. Thanks for the report, will look into this.

ryanfleury commented 2 months ago

This exact case is pretty aggressively inlined, so step-into won't really do what you'd expect with debug code (e.g. go directly to the first line of Execute), but the bugs have been fixed as of e80dc54aa7b6339d5b078d11f5655a71d40c3f8e. Stepping will now actually still work & make progress, it is just that e.g. the Execute function in this case has more-or-less been mangled with surrounding code entirely, so when you step-into, you'll go into an internal helper that it calls. That is pretty much par-for-the-course with optimized code, and since the bugs have been resolved, I'll close this one now.

GloriousPtr commented 2 months ago

Got it! Thanks for the explanation :)