Debugger: Threads and Traces

In general, a thread refers to a unit of concurrent execution within a target. Typically, each thread carries its own execution context, so this window provides a means of navigating those contexts. Furthermore, this window provides a means of navigating and managing open traces, much like the static listing provides a means of navigating open programs. The window also provides a timeline showing thread lifespans, and displays a caret which can be used to navigate the current point in time. This window, the Stack window, and the Dynamic Listing window provide a complete trace navigation system.

Trace Tabs

The trace tab bar is displayed when at least one trace is open. It displays the name of each open trace in a button, where the "current" or "focused" trace is selected. Clicking a tab will select its trace and focus the tool onto it. A trace associated with a live target has a red "recording" icon at its left. If that icon is not present, or has disappeared, the trace is dead or terminated. A "dead" trace can still be manipulated and marked up, but it will (obviously) not record any new information from the (dead) target.

In most cases, a trace is ephemeral, but occasionally, interesting behavior is observed that is difficult to store as program mark-up. When a trace is no longer needed, it can be closed by right-clicking the tab and selecting "Close Trace." Warning: closing a trace that has not been saved cannot be undone. If you have gathered a collection of unwanted traces, use the "Close Others," "Close Dead," or "Close All" action from the pop-up menu.

Navigating Threads

Selecting a thread in the timeline or the table will navigate to (or "activate" or "focus") that thread. Many windows which are sensitive to the current thread will update. Notably, the Registers window will display the new thread's register values. Listing windows with configured location tracking will re-compute that location with the new thread's context and navigate to it. The thread timeline displays all recorded threads in a timeline. Threads which are alive will appear to extend "to the end of time." The threads table displays more detailed information, in the following columns:

Navigating Time

The user can navigate through time within the current trace by using the caret above the threads timeline. There are also actions for "stepping the trace" forward and backward. See the Time window for a way to display and navigate to specific events in the trace's timeline.

Step Track Backward

This action is available when there exists a point in time previous to the current. It steps the trace backward once, causing most windows to display the recorded data from the new point in time. Note that stepping backward does not affect the target, and many windows that would ordinarily interact with a live target, may no longer do so, until the user steps back to the present. Note also that any component or script that does interact with the target and record things "into the present" will not cause updates in windows that are not displaying the present.

Step Trace Forward

This action is available when there exists a point in time ahead of the current. It steps the trace forward once, causing most windows to display the recorded data from the new point in time. If the new point in time represents "the present" for a live trace, then many windows will resume interacting with the target. Note that stepping the trace does not affect the target; however, stepping back to the present may cause some windows to query the target.

Seek Trace to Present

This toggle is always available and is enabled by default. When first enabled, if the current trace is live, it immediately steps the trace to the present. Furthermore, as long as it is enabled and the current trace is live, whenever the recorder steps forward, the tool steps with it. In most cases, this option should remain on, otherwise stepping the target will not cause any windows to update to the new machine state. Toggling it off then on is a quick way to return to the present after browsing the past.

Actions

There are additional actions for managing focus and traces.

Synchronize Trace and Target Focus

This toggle is always available and is enabled by default. While enabled, any changes in navigation coordinates are translated, to the extent possible, and sent to the connected debugger. This may, for example, issue thread and/or frame commands to GDB so that commands typed into its CLI will refer to the same thread and frame as is focused in Ghidra. Conversely, any debugger events which indicate a change in focus are translated, to the extent possible, into navigation coordinates and activated in Ghidra. For example, if the user issues a frame command to the CLI of a GDB connection, then Ghidra will navigate to that same frame.