Search code examples
delphidebuggingwatchwin64stack-frame

Delphi 64 bit debugging using runtime libs has wrong stack frame active


I ran into a Win64 debugging problem where it looks like we are "missing" debug info. So I did some research and re-created all my .dproj files for our flagship product. This helped, as I got my "missing" blue balls back.

But now I run into a new problem: the (top) stack frame displayed in the stack display window appears to be wrong, which results in local variables not being displayed in the local variables pane, and also not when hovering the mouse above some variable. But when I select the stack frame which I think is correct, the local variables window is not empty anymore. Hovering the mouse still shows nothing.

Also check the linked screenshots, which should clarify things a lot more.

Relevant compiler options

  • Debug info: Debug information
  • Local Symbols: True
  • Stack Frames: True
  • Symbol reference info: reference info
  • Use debug dcus: False
  • Use imported data references: True
  • Linker debug info: True
  • Include remote debug symbols: False

Version info:

  • RAD studio Enterprise 10.2.3 tokyo, build 25.0.29899.2631
  • DDevExtension installed, IDEFixPack Installed (Uninstalling makes no difference)
  • JCLDebug installed (uninstalling makes no Difference)

I have played around with many combinations of debug settings, but the problem persists on my system.

My colleagues computer has exactly the same issue in the same code, so at least it is reproducible with confidence. When trying to reproduce this using a small project with runtime bpl's the problem appears not to occur, or I am unable to reproduce it. Hence I have no source to release for this.

And off course here's a (are) question(s):

  • Has anyone else experienced this?
  • found a solution? - please share!
  • Not found a solution? -> please add comment/vote for this issue

I would love to add some pictures to clarify, but unfortunately my reputation isn't high enough yet. So I can only add links to the pictures, sorry for that.

  • Breakpoint in source code view
  • Breakpoint in Full CPU view
  • Select sub-top stackframe
  • Going even one lvl deeper, unexpected stack top
  • The previous instruction caused the stack display to get mangled

Solution

  • As it turns out there is something completely different going on here. The missing local symbols appear to be caused by the debugger not loading ALL debug information. I have created a unit test the loads the runtime BPL's. When I run my form (check screenshots in question) from within the unit test, stackframes and local symbols are displayed correctly When I run the form from within my rather large application, then exactly the same binary bpl does NOT show the local symbols and stack info. Strangely enough other units in the same BPL actually do show correct stack and local variables info, eg the unit that creates the form in the first place is OK upto where the constructor of the form is created.

    So I guessed there is something going on with loading the symbol table. And when I change the debug settings to as displayed in the screenshot (Load All SYmbols=off, and onoy load debug info for the main bpl), voila my stack and local variables are displayed correctly. In the same binary. When I turn ON "load symbols for unspecified modules" I get back to the old situation with the missing stack and local symbols.

    So I suspect there is a limit to how much debug info the debugger can handle (really? in 64bit mode?), which I seem to remember from long ago Delphi 2..7 debugging.

    Off course, when doing so I lack the debug info for all the other units, so while it is an answer, it is NOT a final solution. I will put up another question and issue in the embarcadero site.

    enter image description here