Debugger Stack and Frames

The list of frames displays the current call stack. A single element, i.e. a line in the screenshot, is called a “frame”. The first element is the top frame. Each frame represents an invocation of a function or a script.

List of stack frames
List of stack frames

The background color of a frame signals its type:

  • a colored background tells you that its source is located in the bashdb sources. This is outside your script.
  • a transparent background tells you that it’s your own script
List of stack frames with two frames from bashdb
List of stack frames with two frames from bashdb

Variables View

The variables view displays variable names and values.

A click on a frame updates the variables view on the right:

The variables view
The variables view

The top frame supports these elements:

  • the arguments to the function or script of the frame
  • the available variables and values

All other frames only support the list of arguments, i.e. they do not support the list variables.

Variable Type

Array and associative array
Arrays and associative arrays (aka maps) can be expanded to display the contained elements line by line.
Elements of an array and an associative array
Elements of an array and an associative array
Variables declared via declare -i or local -i are integers, values are displayed as numeric values.
All other variables are of type String, the values displayed in quotes.

How to View All Available Variables

By default, only the variables modified by your script are displayed. A snapshot of all available variables is captured before the script is executed. Variables, which still have their initial values, are hidden with the default settings.

You can configure the view to display all available variables:

  1. Click on the gear symbol on the left of the list of frames
  2. Check the option Show environment variables.
© 2020–2024 Joachim Ansorg