Skip to content

Commit

Permalink
Update debug instructions and hello world tutorial docs
Browse files Browse the repository at this point in the history
  • Loading branch information
cathylu10 authored and dayeol committed Feb 4, 2021
1 parent e448fa3 commit 7e3e348
Show file tree
Hide file tree
Showing 2 changed files with 16 additions and 7 deletions.
17 changes: 13 additions & 4 deletions docs/source/Getting-Started/How-to-Debug.md
Original file line number Diff line number Diff line change
Expand Up @@ -5,6 +5,13 @@
We use QEMU+GDB to debug the security monitor or the kernel.
QEMU is an effective way to debug them.

First compile with debugging symbols

```bash
# in your <build directory>
cmake -DCMAKE_BUILD_TYPE=Debug ..
```

From your `build` directory where you ran `make`, use:

```bash
Expand All @@ -14,19 +21,21 @@ From your `build` directory where you ran `make`, use:
All cores will immediately hang at the first instruction (i.e., bootrom), waiting for `gdb` to be attached.

Now, run a riscv `gdb` in another terminal. You can feed it with the
bbl binary or the kernel image to add debug information. (You may
want to compile them with the debugging flag `-g`)
bbl binary or the kernel image to add debug information.


For example, if you want to debug with the `bbl` symbols

```bash
riscv64-unknown-linux-gnu-gdb ./hifive-work/riscv-pk/bbl
# in your <build directory>
riscv64-unknown-linux-gnu-gdb ./riscv-pk.build/bbl
```

If you want to debug with the kernel's debug information

```bash
riscv64-unknown-linux-gnu-gdb ./riscv-linux/vmlinux
# in your <build directory>
riscv64-unknown-linux-gnu-gdb ./linux.build/vmlinux
```

Then, attach to QEMU on the port printed by the starting qemu script:
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -130,14 +130,14 @@ Next, copy the package into the buildroot overlay directory.
::

# in the build directory
cp examples/hello/hello.ke ./overlay
cp examples/hello ./overlay/root

Running ``make image`` in the top-level directory (``keystone``) will generate the buildroot disk
Running ``make image`` in your build directory will generate the buildroot disk
image containing the copied package.

::

# go to top-level keystone directory
# in your <build directory>
make image

Deploying Enclave
Expand Down

0 comments on commit 7e3e348

Please sign in to comment.