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
@@ -275,3 +275,149 @@ To do this in vscode, the following configuration can be used to add debug confi
275
275
press the `pause` button. This is a known issue with the `CodeLldb` extension [#1245](https://github.com/vadimcn/codelldb/issues/1245).
276
276
The `cppdbg` extension works as expected and stops at the entry point of the program.**
277
277
278
+
## Compiling guests with debug information for release builds
279
+
280
+
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.
281
+
282
+
### Creating a release build with debug information
283
+
284
+
To create a release build with debug information, you can add a custom profile to your `Cargo.toml` file:
285
+
286
+
```toml
287
+
[profile.release-with-debug]
288
+
inherits = "release"
289
+
debug = true
290
+
```
291
+
292
+
This creates a new profile called `release-with-debug` that inherits all settings from the release profile but adds debug information.
293
+
294
+
### Splitting debug information from the binary
295
+
296
+
To reduce the binary size while still having debug information available, you can split the debug information into a separate file.
297
+
This is useful for production environments where you want smaller binaries but still want to be able to debug crashes.
298
+
299
+
Here's a step-by-step guide:
300
+
301
+
1. Build your guest with the release-with-debug profile:
302
+
```bash
303
+
cargo build --profile release-with-debug
304
+
```
305
+
306
+
2. Locate your binary in the target directory:
307
+
```bash
308
+
TARGET_DIR="target"
309
+
PROFILE="release-with-debug"
310
+
ARCH="x86_64-unknown-none"# Your target architecture
311
+
BUILD_DIR="${TARGET_DIR}/${ARCH}/${PROFILE}"
312
+
BINARY=$(find "${BUILD_DIR}" -type f -executable -name "guest-binary"| head -1)
313
+
```
314
+
315
+
3. Extract debug information into a full debug file:
# This feature enables printing of debug information to stdout in debug builds
125
125
print_debug = []
126
-
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.
126
+
# 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