Skip to content

Commit c58fd14

Browse files
Add note about how to preserve debug symbols in Rust (#21347)
* Add note about how to preserve debug symbols in Rust * Update src/content/docs/workers/observability/dev-tools/cpu-usage.mdx Co-authored-by: ToriLindsay <[email protected]> --------- Co-authored-by: ToriLindsay <[email protected]>
1 parent c91e114 commit c58fd14

File tree

1 file changed

+18
-0
lines changed

1 file changed

+18
-0
lines changed

src/content/docs/workers/observability/dev-tools/cpu-usage.mdx

Lines changed: 18 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -32,6 +32,24 @@ To generate a CPU profile:
3232

3333
You now have a CPU profile.
3434

35+
:::note
36+
37+
For Rust Workers, add the following to your `Cargo.toml` to preserve [DWARF](https://dwarfstd.org/) debug symbols (from [this comment](https://github.com/rustwasm/wasm-pack/issues/1351#issuecomment-2100231587)):
38+
39+
```toml title="wrangler.toml"
40+
[package.metadata.wasm-pack.profile.dev.wasm-bindgen]
41+
dwarf-debug-info = true
42+
```
43+
44+
Then, update your `wrangler.toml` to configure wasm-pack (via worker-build) to use the `dev` [profile](https://rustwasm.github.io/docs/wasm-pack/commands/build.html#profile) to preserve debug symbols.
45+
46+
```toml title="Cargo.toml"
47+
[build]
48+
command = "cargo install -q worker-build && worker-build --dev"
49+
```
50+
51+
:::
52+
3553
## An Example Profile
3654

3755
Let's look at an example to learn how to read a CPU profile. Imagine you have the following Worker:

0 commit comments

Comments
 (0)