Skip to content

Commit cc965dc

Browse files
committed
Add note about how to preserve debug symbols in Rust
1 parent 2c8944a commit cc965dc

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

+18
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:
38+
39+
```toml title="wrangler.toml"
40+
[package.metadata.wasm-pack.profile.dev.wasm-bindgen]
41+
dwarf-debug-info = true
42+
```
43+
44+
And update `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)