You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
crashdump: enable crashdump feature for release builds
- Improve documentation and describe how an user can create separate files for debug information
- Change the output file directory to be configurable using HYPERLIGHT_CORE_DUMP_DIR environment variable
- Change output file name to include a timestamp
Signed-off-by: Doru Blânzeanu <[email protected]>
Copy file name to clipboardExpand all lines: docs/how-to-debug-a-hyperlight-guest.md
+146Lines changed: 146 additions & 0 deletions
Original file line number
Diff line number
Diff line change
@@ -274,3 +274,149 @@ To do this in vscode, the following configuration can be used to add debug confi
274
274
press the `pause` button. This is a known issue with the `CodeLldb` extension [#1245](https://github.com/vadimcn/codelldb/issues/1245).
275
275
The `cppdbg` extension works as expected and stops at the entry point of the program.**
276
276
277
+
## Compiling guests with debug information for release builds
278
+
279
+
This section explains how to compile a guest with debugging information but still have optimized code, and how to separate the debug information from the binary.
280
+
281
+
### Creating a release build with debug information
282
+
283
+
To create a release build with debug information, you can add a custom profile to your `Cargo.toml` file:
284
+
285
+
```toml
286
+
[profile.release-with-debug]
287
+
inherits = "release"
288
+
debug = true
289
+
```
290
+
291
+
This creates a new profile called `release-with-debug` that inherits all settings from the release profile but adds debug information.
292
+
293
+
### Splitting debug information from the binary
294
+
295
+
To reduce the binary size while still having debug information available, you can split the debug information into a separate file.
296
+
This is useful for production environments where you want smaller binaries but still want to be able to debug crashes.
297
+
298
+
Here's a step-by-step guide:
299
+
300
+
1. Build your guest with the release-with-debug profile:
301
+
```bash
302
+
cargo build --profile release-with-debug
303
+
```
304
+
305
+
2. Locate your binary in the target directory:
306
+
```bash
307
+
TARGET_DIR="target"
308
+
PROFILE="release-with-debug"
309
+
ARCH="x86_64-unknown-none"# Your target architecture
310
+
BUILD_DIR="${TARGET_DIR}/${ARCH}/${PROFILE}"
311
+
BINARY=$(find "${BUILD_DIR}" -type f -executable -name "guest-binary"| head -1)
312
+
```
313
+
314
+
3. Extract debug information into a full debug file:
# This feature enables printing of debug information to stdout in debug builds
126
126
print_debug = []
127
-
crashdump = ["dep:tempfile"] # Dumps the VM state to a file on unexpected errors or crashes. The path of the file will be printed on stdout and logged. This feature can only be used in debug builds.
127
+
# Dumps the VM state to a file on unexpected errors or crashes. The path of the file will be printed on stdout and logged.
0 commit comments