Call Stack

Frozen Content

The following content has been imported from Legacy Help systems and is in the process of being checked for accuracy.

Function

The Call Stack panel provides information about which line of source code the debugger is next going to execute and which function that line of code resides in. If a sequence of function calls have been made to reach the current line of code, these calls will be displayed as a call stack.

Content and Use

As you step-debug your source code, the panel will show the current function you are in, the name of the active source document and the line of source code that the debugger has reached (i.e. the next line of executable code).
When a call to another function is encountered, the panel will show that function, along with the values of any parameters passed into it and the next executable line of code within that function. As the function is called from within a function, the original function is still displayed, showing the line of code that will be executed when program execution passes back into it.

A 'call stack' is effectively set up, showing the relationship between descendant function calls. The original function appears at the bottom of the stack, with each subsequently called function above it, right up to the currently entered function on the top of the stack. The current function is distinguished by a red arrow to its immediate left.
The image below takes this underlying example one step further, whereby another function, display_char_at_line(), is called from within the function display_bar():

As can be seen, this additional function call is placed on top of the call stack, with entries for the preceding function calls containing the lines of code that will be executed when program execution passes back into them:

  • Line 27 when execution passes back into the display_bar() function
  • Line 59 when execution passes back into the main() function.

As program execution drops out of a sub-function and passes back into the calling function, the former will be removed from the stack and the calling function will become the top of the stack. This continues until execution passes back into the original function (typically main()).
Double-clicking on an entry in the panel will jump to the indicated line of code in the associated source document. If the entry is not the top of the stack (i.e. not the currently entered function), a green arrow will be displayed so that you can see which function in the stack the text cursor has jumped to.

This can also be a quick way of defining the next point that you wish to run code execution to, using the Run To Cursor command available from the Debug menu or toolbar (shortcut: CTRL + F9).

Notes

  • Direct filtering is available, allowing you to quickly jump to an entry by directly typing within the panel.

To use this feature, click within the panel and type the first letter of the entry you wish to jump to. The first entry in the panel starting with the letter you type will become selected and the letter will be highlighted to show that filtering of the panel content is based upon it, as illustrated in the example below:

If the panel contains multiple function entries starting with the same letter, narrow your search by typing additional letters as required.
To clear the current filtering, allowing you to enter a different starting letter, press ESC. Use the BACKSPACE key to clear the previously entered filter characters, in sequence.

  • The keyboard shortcuts Up Arrow (or Left Arrow), HOME, END and Down Arrow (or Right Arrow), can be used to select the previous, first, last and next entry in the stack, respectively.

See Also

You are reporting an issue with the following selected text and/or image within the active document: