
Ada source level debugging with Lauterbach Trace32
Even when using Ada or SPARK, debugging is still important for embedded systems, especially when you are working on logic close to the hardware. Hardware debuggers add a lot of power to the developer's toolbox, debugging is less intrusive to real-time behavior, and can add more capabilities, such as real-time tracing of execution as well as non-intrusive code coverage.
This demonstration shows how to add Lauterbach Trace32 to an Ada project in VS Code desktop, using Alire to build on the desktop and in a GitLab CI/CD pipeline.
With the support for Ada now available in the Lauterbach debugger, developers can step through their Ada and SPARK source code while controlling the target through the debugger.
Key points in this demonstration:
- Create a .vscode/tasks.json to automate tasks
- .gitlab-ci.yml to automate build and test in the pipeline
- run.cmm for the Lauterbach debugger to set a breakpoint and grab a stack trace
The important content in the run.cmm looks like:
Var.Break.Set _ada_main\failed_tests /Write /CMD "GOSUB dump_and_exit"
; … additional content as needed
Go
WAIT !STATE.RUN()
; Exit cleanly in case there was no breakpoint
QUIT
RETURN
dump_and_exit:
WinPrint.Frame /Caller /Locals
OS.Command "sync"
QUIT 5
RETURNReach out to your AdaCore technical representative if you would like a live demo of this capability.





