OSDK GDB server args with QEMU-style options

This commit is contained in:
Zhang Junyang
2024-09-30 13:37:05 +08:00
committed by Tate, Hongliang Tian
parent 43e3f8cf6b
commit ab8b6afee5
7 changed files with 135 additions and 131 deletions

View File

@ -15,16 +15,15 @@ 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:
Additionally, when running the kernel using QEMU, we can setup the QEMU as a
debug server using option `--gdb-server`. This option supports an additional
comma separated configuration list:
- `--gdb-server`: Enable QEMU GDB server for debugging.
- `--gdb-wait-client`: Let the QEMU GDB server wait for the client connection before execution.
- `--gdb-vsc`: Generate a '.vscode/launch.json' for debugging kernel with Visual Studio Code
(only works when QEMU GDB server is enabled, i.e., `--gdb-server`).
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: `.osdk-gdb-socket`(a local UNIX socket)]
- `addr=ADDR`: the network or unix socket address on which the GDB server listens
(default: `.osdk-gdb-socket`, a local UNIX socket);
- `wait-client`: let the GDB server wait for the GDB client before execution;
- `vscode`: generate a '.vscode/launch.json' for debugging with Visual Studio Code
(Requires [CodeLLDB](https://marketplace.visualstudio.com/items?itemName=vadimcn.vscode-lldb)).
See [Debug Command](debug.md) to interact with the GDB server in terminal.
@ -33,17 +32,17 @@ See [Debug Command](debug.md) to interact with the GDB server in terminal.
Launch a debug server via QEMU with an unix socket stub, e.g. `.debug`:
```bash
cargo osdk run --gdb-server --gdb-server-addr .debug
cargo osdk run --gdb-server addr=.debug
```
Launch a debug server via QEMU with a TCP stub, e.g., `localhost:1234`:
```bash
cargo osdk run --gdb-server --gdb-server-addr :1234
cargo osdk run --gdb-server addr=:1234
```
Launch a debug server via QEMU and use VSCode to interact:
Launch a debug server via QEMU and use VSCode to interact with:
```bash
cargo osdk run --gdb-server --gdb-vsc --gdb-server-addr :1234
cargo osdk run --gdb-server wait-client,vscode,addr=:1234
```