2024-01-20 04:17:42 +00:00
|
|
|
# cargo osdk run
|
2024-02-29 08:31:08 +00:00
|
|
|
|
|
|
|
|
## Overview
|
|
|
|
|
|
2024-03-01 03:23:47 +00:00
|
|
|
`cargo osdk run` is used to run the kernel with QEMU.
|
|
|
|
|
The usage is as follows:
|
2024-02-29 08:31:08 +00:00
|
|
|
|
|
|
|
|
```bash
|
|
|
|
|
cargo osdk run [OPTIONS]
|
|
|
|
|
```
|
|
|
|
|
|
|
|
|
|
## Options
|
|
|
|
|
|
2024-03-21 20:08:22 +00:00
|
|
|
Most options are the same as those of `cargo osdk build`.
|
2024-03-01 03:23:47 +00:00
|
|
|
Refer to the [documentation](build.md) of `cargo osdk build`
|
|
|
|
|
for more details.
|
2024-03-21 20:08:22 +00:00
|
|
|
|
2024-09-30 05:37:05 +00:00
|
|
|
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:
|
2024-03-21 20:08:22 +00:00
|
|
|
|
2024-09-30 05:37:05 +00:00
|
|
|
- `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)).
|
2024-03-21 20:08:22 +00:00
|
|
|
|
|
|
|
|
See [Debug Command](debug.md) to interact with the GDB server in terminal.
|
|
|
|
|
|
|
|
|
|
## Examples
|
|
|
|
|
|
2024-09-21 14:31:03 +00:00
|
|
|
Launch a debug server via QEMU with an unix socket stub, e.g. `.debug`:
|
2024-03-21 20:08:22 +00:00
|
|
|
|
|
|
|
|
```bash
|
2024-09-30 05:37:05 +00:00
|
|
|
cargo osdk run --gdb-server addr=.debug
|
2024-09-30 22:08:25 +00:00
|
|
|
|
|
|
|
|
```bash
|
|
|
|
|
cargo osdk run --gdb-server --gdb-server-addr .debug
|
2024-03-21 20:08:22 +00:00
|
|
|
```
|
|
|
|
|
|
2024-09-21 14:31:03 +00:00
|
|
|
Launch a debug server via QEMU with a TCP stub, e.g., `localhost:1234`:
|
2024-03-21 20:08:22 +00:00
|
|
|
|
|
|
|
|
```bash
|
2024-09-30 05:37:05 +00:00
|
|
|
cargo osdk run --gdb-server addr=:1234
|
2024-03-21 20:08:22 +00:00
|
|
|
```
|
|
|
|
|
|
2024-09-30 05:37:05 +00:00
|
|
|
Launch a debug server via QEMU and use VSCode to interact with:
|
2024-03-21 20:08:22 +00:00
|
|
|
|
|
|
|
|
```bash
|
2024-09-30 05:37:05 +00:00
|
|
|
cargo osdk run --gdb-server wait-client,vscode,addr=:1234
|
2024-03-21 20:08:22 +00:00
|
|
|
```
|
2024-09-30 22:08:25 +00:00
|
|
|
|
|
|
|
|
Launch a debug server via QEMU and use VSCode to interact with:
|
|
|
|
|
|
|
|
|
|
```bash
|
|
|
|
|
cargo osdk run --gdb-server --gdb-vsc --gdb-server-addr :1234
|
|
|
|
|
```
|