-
-
Notifications
You must be signed in to change notification settings - Fork 1
Debugging userspace apps
Leandro Zungri edited this page Apr 4, 2020
·
1 revision
laritOS comes with the tools/gdb/debug.py utility designed to help with the process of debugging an application running under laritOS (under QEMU).
There are two simple steps you need to follow in order to debug your app:
- Launch laritOS in debug mode
- Start the debugger
Run the launch.py
script with the -d
option as in:
$LARITOS/tools/qemu/launch.py -d
You should immediately see the following message:
Launching laritOS in debugging mode (listening on :1234)
Then, the launcher will wait until the debugger is connected.
Open a new terminal and run:
$LARITOS/tools/gdb/debug.py
Let's say you want to debug the shell app (with pid=3). Once the debugger is running, do the following (in order):
In the debugger terminal | In the OS terminal |
---|---|
Type continue then enter |
|
. | Type bd debugpid 3 and take note of the instructions |
Interrupt debugger with ctrl-c | |
Type add-symbol-file <path_to_elf> <address> , e.g. add-symbol-file ~/dev/src/laritos-apps/shell/bin/arm/shell.elf 0x40027EF4
|
|
Setup breakpoints, watchpoints, etc, then type continue |
Where:
-
<path_to_elf>
: Is the path to the ELF binary of the application you want to debug -
<address>
: Is the memory address printed by thebd debugpid <pid>
command