Recent

Author Topic: [SOLVED] Debugging interface variables: only address shown, no members.  (Read 184 times)

Hansvb

  • Hero Member
  • *****
  • Posts: 935
Hi,

I'm increasingly using interfaces. While debugging, I often need to inspect the internal state of an object that is referenced via an interface variable. (To find my mistakes :-X). However, the debugger only shows the interface reference as an address (e.g. $0065F8A0). I cannot expand it to see the actual fields of the implementing object (like FFullName, FAddress, etc.). At least I can't find it. As a workaround I use {$IFDEF DEBUG}... {$ENDIF}, that works well but it becomes messy.

Is there a better way?

« Last Edit: August 05, 2026, 07:33:54 pm by Hansvb »

Martin_fr

  • Administrator
  • Hero Member
  • *
  • Posts: 12634
  • Debugger - SynEdit - and more
    • wiki
Re: Debugging interface variables: only address shown, no members.
« Reply #1 on: August 04, 2026, 05:01:59 pm »
Interfaces do not have members. The do have procedures and functions though. But the compiler does not provide any info on those, so they don't show.

Interfaces may or may not be implemented by an "Pascal class/object". In your case they are.

If you are using FpDebug (Linux/Windows - i386/x86) then you can use :i2o
https://wiki.freepascal.org/FpDebug-Watches-Intrinsic-Functions#I2O(interface)_{show_object_behind_an_interface}

This will give you the underlaying field. For this to work the debugger actually has to disassemble the code of one of the methods of the interface, to see where the class is.

Hansvb

  • Hero Member
  • *****
  • Posts: 935
Re: Debugging interface variables: only address shown, no members.
« Reply #2 on: August 05, 2026, 07:33:37 pm »
Ok, clear explanation, I can understand that. Thanks.

 

TinyPortal © 2005-2018