1

In the Delphi debugAPI there are a couple of references to a FrameIndex e.g. in:

 unit DebugAPI;
 interface
 type

  IOTADebugger = interface(IInterface)
    function CanToggleBreakpointOnFrame(FrameIndex: Integer): Boolean;
    function GetSupportedRunParametersCommands: TRunParametersCommands;
    function CanSetNextStatement(const Filename: string;
      LineNumber: Integer): Boolean;
    procedure ProcessDebugEvents;
    function FrameHasDebugInfo(FrameIndex: Integer): Boolean;
    function GetDisplayableDebuggerName: string;
    function GetFrameBreakpoint(FrameIndex: Integer): IOTABreakpoint;
    procedure ToggleBreakpointOnFrame(FrameIndex: Integer);
    .....

Several methods accept a FrameIndex parameter, but, what is a FrameIndex? and where I can aquire a FrameIndex?

Johan
  • 74,508
  • 24
  • 191
  • 319

1 Answers1

4

This refers to the call stack frame. It's a little known feature that you can set break points on items in the call stack.

Then when you run, the debugger will break when you return to that function. The debugger implements this feature by setting a breakpoint at the return address for that entry in the call stack.

For instance, here is a simple call stack where I have placed a break point on an item in the call stack:

enter image description here

The icons in the gutter of the call stack window indicate whether or not debug information is available, whether break points are set, etc. Full details can be found in the documentation: Call Stack Window.

David Heffernan
  • 601,492
  • 42
  • 1,072
  • 1,490
  • So what does the `FrameIndex` refer to? is 0 the topmost (MRU) item in the Callstack and item 1 the previous? – Johan May 30 '17 at 15:29
  • @Johan I think so, I've never actually used the interface myself, but the functions clearly map onto the functionality of the call stack window, which is why I am prepared to make this educated leap. In fact, I can't find that interface in my ToolsAPI. Which version are you working with? – David Heffernan May 30 '17 at 15:31
  • 1
    The code is a copy-paste from `DebugAPI.pas`. Note that this file does not actually exist, but you can get the interface code by declaring a class like above and then pressing ctrl+space and selecting all the methods that pop up and pressing enter. The IDE will fill them in for you. – Johan May 30 '17 at 15:42