• Home
  • History
  • Annotate
Name Date Size #Lines LOC

..--

README.mdD04-Apr-20251.7 KiB5744

gdbscript.pyD04-Apr-202514.2 KiB469314

seL4Extensions.csD04-Apr-202524.4 KiB652509

README.md

1# seL4 extensions for GDB
2
3Convenience script for GDB, adding additional facilities for
4debugging seL4 applications.
5
6## Features
7
8* Creating and removing breakpoints on address in specific thread,
9* Creating and removing breakpoint on context-switches between kernel and userspace,
10* Auto-loading symbols for CAmkES project
11* Investigating current thread
12
13## Usage
14
15Firstly, `seL4Extensions.cs` and kernel symbols have to be loaded in Renode. This can be accomplished by adding following lines to `.resc` file:
16```
17include @path/to/seL4Extensions.cs
18sysbus LoadSymbolsFrom @path/to/kernel.elf
19```
20Before simulation is started (using `start` command in Renode), the seL4 extensions have to be loaded on
21correct CPU, which can be done using `cpu CreateSeL4` command in Renode. Lastly, the Renode-GDB glue has to be sourced in GDB. All those steps can be done in single command:
22
23```
24$ gdb-multiarch -ex 'target remote :3333' -ex 'monitor cpu CreateSeL4' \
25                -ex 'source path/to/gdbscript.py' -ex 'monitor start'
26```
27
28`start` at the end is optional.
29In GDB information about commands can be accessed using `info sel4` command.
30
31## Example
32
33### Create breakpoint on main function in rootserver thread
34
35```
36(gdb) # Wait until rootserver thread is known to seL4 extensions
37(gdb) sel4 wait-for-thread rootserver
38(gdb) # Switch symbols to rootserver's
39(gdb) sel4 switch-symbols rootserver
40(gdb) # Create temporary breakpoint on main function in rootserver thread
41(gdb) sel4 tbreak rootserver main
42(gdb) continue
43(gdb) # We can confirm, that we are indeed in rootserver thread
44(gdb) sel4 thread
45rootserver
46```
47
48### Return from userspace to kernel
49
50```
51(gdb) # Create temporary breakpoint on context-switch to kernel
52(gdb) sel4 tbreak kernel
53(gdb) continue
54(gdb) sel4 thread
55kernel
56```
57