README.md
1# GDB helper functions for debugging tlib
2
3`tlib_helper` is a collection of helper functions that give the user a better context of the whole Renode simulation while debugging the translated guest code execution in [tlib](https://github.com/antmicro/tlib).
4
5## Features
6
7* Create breakpoint on next guest instruction,
8* Disassemble current instruction,
9* Disassemble current Translation Block,
10* Read bytes from the system bus,
11* Support for multiple CPUs through the `$_cpu(index)` convenience function,
12* Access to current guest PC through the `$guest_pc` variable.
13
14## Usage
15
16All functionality is self-contained in the single `gdbscript.py`, therefore it is enough to just source the script in GDB using the `source` command. For example, to attach GDB to already running dotnet-built Renode instance the following command can be used:
17
18```sh
19$ gdb -ex 'source tools/tlib_helper/gdbscript.py' \
20 -ex 'handle SIGXCPU SIG33 SIG34 SIG35 SIG36 SIG37 SIGPWR nostop noprint' \
21 -p $(pgrep --full 'dotnet.*Renode.dll')"
22```
23
24Additional information about commands can be accessed through `help renode` GDB command.
25