GDB All-Stop and Non-Stop Mode with LinkServer
Learn more about the GDB support for All-Stop and Non-Stop modes with LinkServer
Join the DZone community and get the full member experience.
Join For FreeGDB supports a mode that allows the GDB debug client to read memory while the target is running. This allows features like ‘live variables.' That way, I can see the variables refreshed and changing over time without halting the target. Another functionality that comes with this feature is to check stopped threads or to see all threads in the system.
multiple FreeRTOS threads in debug view
Debugging i.MX RT1064 with NXP LPC-Link2 using LinkSever
When creating the MCUXpresso IDE, a new launch configuration for LinkServer, I have the opportunity to select the mode I want to use:
connect to target
Depending on Non-Stop or All-Stop, different features are available with the LinkServer to debug the connection.
Non-Stop Mode
This is the default mode. The default can be changed in the workspace preferences:
enable non-stop mode in workspace preferences
If in the Non-Stop mode, this can be verified in the Console with the messages produced by the LinkServer:
gdb non-stop mode
All-Stop Mode
In the All-Stop mode, this can be verified in the Console with the messages produced by the LinkServer:
all-stop mode
Comparison All-Stop and Non-Stop Mode
The following gives an overview of what is supported in each mode:
Non-Stop (Default):
Non-Stop mode is the ability to access variables while the target is running (Live Variables View) and plot them over time (see this article).
Plot Variables over Time
Only the currently active FreeRTOS thread is shown in the Debug view:
debug threads in non-stop mode
All-Stop:
The All-Stop mode cannot access variables while the target is running— No Live Variables View.
All FreeRTOS threads are shown in the debug view:
multiple FreeRTOS threads in debug view in all-stop mode
Obviously, for debugging FreeRTOS applications, I prefer the All-Stop mode. But then, I don’t have the Live Variables view available with LinkServer.
Eclipse Launch Configurations: Switching Between All-Stop and Non-Stop Mode
One simple way is to delete any existing LinkServer launch configuration. Next time, it will do a probe scan and give me the opportunity to select which mode I want to use.
linkserver launch configuration
Another way is to change the launch configuration setting. For this, I double-click on the launch configuration to open it. I have to change two settings.
One setting is in the Debugger > Main tab:
non-stop mode setting in launch configuration
For the ‘non-stop’ mode, you need to have that checkbox checked.
The other setting is under Target configuration > Edit Scripts. Press that button:
target configuration edit scripts
This gives a dialog to edit the scripts:
edit scripts dialog
Below are the Init commands for all-stop mode:
set remotetimeout 60000
##target_extended_remote##
set mem inaccessible-by-default ${mem.access}
mon ondisconnect ${ondisconnect}
set arm force-mode thumb
${load}
And here are the ones for non-stop:
set non-stop on
set pagination off
set mi-async
set remotetimeout 60000
##target_extended_remote##
set mem inaccessible-by-default ${mem.access}
mon ondisconnect ${ondisconnect}
set arm force-mode thumb
${load}
So, the difference is that the three commands are marked in red. So what I do is comment/uncomment these commands in that dialog:
commented for a full stop
Summary
GDB offers Non-Stop and All-Stop mode. Non-Stop allows us to read variables while the target is running, and the All-Stop mode is required for the LinkServer connection to show all FreeRTOS threads. I can select the mode at Eclipse launch configuration creation or later with two settings in the launch configuration itself.
Happy Stopping!
Additional Links
- GDB All-Stop Mode
- GDB Non-Stop Mode
- MCUXpresso IDE 10.3.0 release: New NXP MCUXpresso IDE V10.3.0 Release
Published at DZone with permission of Erich Styger, DZone MVB. See the original article here.
Opinions expressed by DZone contributors are their own.
Comments