Add docs for OSDK debug and run

This commit is contained in:
fgh1999
2024-03-21 20:08:22 +00:00
committed by Tate, Hongliang Tian
parent 35604198cd
commit 45a7aba5c9
2 changed files with 63 additions and 1 deletions

View File

@ -0,0 +1,30 @@
# cargo osdk debug
## Overview
`cargo osdk debug` is used to debug a remote target via GDB.
The usage is as follows:
```bash
cargo osdk debug [OPTIONS]
```
## Options
`--remote <REMOTE>`:
Specify the address of the remote target [default: .aster-gdb-socket].
The address can be either a path for the UNIX domain socket
or a TCP port on an IP address.
## Examples
- To debug a remote target via a
[QEMU GDB stub](https://www.qemu.org/docs/master/system/gdb.html),
- connect to an unix socket, e.g., `./debug`;
```bash
cargo osdk debug --remote ./debug
```
- connect to a TCP port (`[IP]:PORT`), e.g., `localhost:1234`.
```bash
cargo osdk debug --remote localhost:1234
```

View File

@ -11,6 +11,38 @@ cargo osdk run [OPTIONS]
## Options
The options are the same as those of `cargo osdk build`.
Most options are the same as those of `cargo osdk build`.
Refer to the [documentation](build.md) of `cargo osdk build`
for more details.
Options related with debugging:
- `-G, --enable-gdb`: Enable QEMU GDB server for debugging.
- `--vsc`: Generate a '.vscode/launch.json' for debugging kernel with Visual Studio Code
(only works when QEMU GDB server is enabled, i.e., `--enable-gdb`).
Requires [CodeLLDB](https://marketplace.visualstudio.com/items?itemName=vadimcn.vscode-lldb).
- `--gdb-server-addr <ADDR>`: The network address on which the GDB server listens,
it can be either a path for the UNIX domain socket or a TCP port on an IP address.
[default: .aster-gdb-socket]
See [Debug Command](debug.md) to interact with the GDB server in terminal.
## Examples
- Launch a debug server via QEMU with an unix socket stub, e.g. `.debug`:
```bash
cargo osdk run --enable-gdb --gdb-server-addr .debug
```
- Launch a debug server via QEMU with a TCP stub, e.g., `localhost:1234`:
```bash
cargo osdk run --enable-gdb --gdb-server-addr :1234
```
- Launch a debug server via QEMU and use VSCode to interact:
```bash
cargo osdk run --enable-gdb --vsc --gdb-server-addr :1234
```