-
Notifications
You must be signed in to change notification settings - Fork 6.1k
Update diagnostics docs for dotnet-trace collect-linux #52273
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
base: main
Are you sure you want to change the base?
Changes from all commits
File filter
Filter by extension
Conversations
Jump to
Diff view
Diff view
There are no files selected for viewing
| Original file line number | Diff line number | Diff line change | ||||||||||||||||||
|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|
|
|
@@ -699,6 +699,30 @@ However, when you want to gain a finer control over the lifetime of the app bein | |||||||||||||||||||
|
|
||||||||||||||||||||
| ## (Linux-only) Collect a machine-wide trace using dotnet-trace | ||||||||||||||||||||
|
|
||||||||||||||||||||
| ### Get symbols for native runtime frames | ||||||||||||||||||||
|
Member
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. I thought Beau told us earlier that acquiring debug binaries was unnecessary and has no bearing on the collect-linux stackwalking results? Did that prove to be untrue?
Member
Author
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. I'll need to investigate that, I might still be hitting the non-deterministic symbol resolution issue. |
||||||||||||||||||||
|
|
||||||||||||||||||||
| `collect-linux` captures native frames in callstacks. To resolve native method names for runtime libraries (such as `libcoreclr.so`), place the corresponding debug symbol files on disk beside the libraries. Without these symbols, native frames appear as unresolved addresses in the trace. | ||||||||||||||||||||
|
|
||||||||||||||||||||
| Unlike [`perfcollect`](./trace-perfcollect-lttng.md), `collect-linux` doesn't require you to set environment variables like `DOTNET_PerfMapEnabled` or `DOTNET_EnableEventLog` before starting your application. `collect-linux` dynamically enables perfmap generation for JIT-compiled code when the trace begins, so you don't need to restart any .NET processes. | ||||||||||||||||||||
|
||||||||||||||||||||
|
|
||||||||||||||||||||
| To download native runtime symbols, use [dotnet-symbol](./dotnet-symbol.md): | ||||||||||||||||||||
|
|
||||||||||||||||||||
| 1. Install `dotnet-symbol`: | ||||||||||||||||||||
|
|
||||||||||||||||||||
| ```bash | ||||||||||||||||||||
| dotnet tool install -g dotnet-symbol | ||||||||||||||||||||
| ``` | ||||||||||||||||||||
|
|
||||||||||||||||||||
| 1. Download the debug symbols for your runtime version. For example, if your runtime is installed at `/usr/share/dotnet/shared/Microsoft.NETCore.App/10.0.0`: | ||||||||||||||||||||
|
|
||||||||||||||||||||
| ```bash | ||||||||||||||||||||
|
Comment on lines
+712
to
+718
|
||||||||||||||||||||
| ```bash | |
| dotnet tool install -g dotnet-symbol | |
| ``` | |
| 1. Download the debug symbols for your runtime version. For example, if your runtime is installed at `/usr/share/dotnet/shared/Microsoft.NETCore.App/10.0.0`: | |
| ```bash | |
| ```dotnetcli | |
| dotnet tool install -g dotnet-symbol |
-
Download the debug symbols for your runtime version. For example, if your runtime is installed at
/usr/share/dotnet/shared/Microsoft.NETCore.App/10.0.0:
Copilot
AI
Mar 11, 2026
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
The sentence about needing to run dotnet-symbol from the runtime directory is misleading. By default, dotnet-symbol writes next to the input file (or you can use -o/--output), and placing .so.dbg files under /usr/share/dotnet/... typically requires elevated permissions. Consider rewording to describe the default output behavior and mention using sudo or --output + copy if needed.
| 1. Place the downloaded `.so.dbg` files beside the runtime libraries they correspond to (for example, `libcoreclr.so.dbg` next to `libcoreclr.so`). If you run `dotnet-symbol` from the runtime directory, it places the symbols there automatically. | |
| 1. Place the downloaded `.so.dbg` files beside the runtime libraries they correspond to (for example, `libcoreclr.so.dbg` next to `libcoreclr.so`). By default, `dotnet-symbol` writes symbol files next to each input file. If your runtime libraries live under a protected path such as `/usr/share/dotnet/...`, run `dotnet-symbol` with elevated permissions (for example, by using `sudo`), or use the `-o`/`--output` option to write to a writable directory, then copy the `.so.dbg` files beside the runtime libraries. |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
| After you place the symbols, `collect-linux` resolves native method names when it processes the trace. | |
| After you place the symbols, `collect-linux` resolves native method names when it collects the trace. |
| Original file line number | Diff line number | Diff line change | ||||
|---|---|---|---|---|---|---|
|
|
@@ -25,18 +25,20 @@ To learn more about the NetTrace format, see the [NetTrace format documentation] | |||||
|
|
||||||
| EventPipe is part of the .NET runtime and is designed to work the same way across all the platforms .NET Core supports. This allows tracing tools based on EventPipe, such as `dotnet-counters`, `dotnet-gcdump`, and `dotnet-trace`, to work seamlessly across platforms. | ||||||
|
|
||||||
| However, because EventPipe is a runtime built-in component, its scope is limited to managed code and the runtime itself. EventPipe events include stacktraces with managed code frame information only. If you want events generated from other unmanaged user-mode libraries, CPU sampling for native code, or kernel events you should use OS-specific tracing tools such as ETW or perf_events. On Linux the [perfcollect tool](./trace-perfcollect-lttng.md) helps automate using perf_events and [LTTng](https://en.wikipedia.org/wiki/LTTng). | ||||||
| However, because EventPipe is a runtime built-in component, its scope is limited to managed code and the runtime itself. Without other tracing tools, EventPipe events include stacktraces with managed code frame information only. To get events from other unmanaged user-mode libraries, CPU sampling for native code, or kernel events, use OS-specific tracing tools such as ETW or perf_events. On Linux, the [perfcollect tool](./trace-perfcollect-lttng.md) helps automate using perf_events and [LTTng](https://en.wikipedia.org/wiki/LTTng). | ||||||
|
||||||
| However, because EventPipe is a runtime built-in component, its scope is limited to managed code and the runtime itself. Without other tracing tools, EventPipe events include stacktraces with managed code frame information only. To get events from other unmanaged user-mode libraries, CPU sampling for native code, or kernel events, use OS-specific tracing tools such as ETW or perf_events. On Linux, the [perfcollect tool](./trace-perfcollect-lttng.md) helps automate using perf_events and [LTTng](https://en.wikipedia.org/wiki/LTTng). | |
| However, because EventPipe is a runtime built-in component, its scope is limited to managed code and the runtime itself. Without other tracing tools, EventPipe events include stack traces with managed code frame information only. To get events from other unmanaged user-mode libraries, CPU sampling for native code, or kernel events, use OS-specific tracing tools such as ETW or perf_events. On Linux, the [perfcollect tool](./trace-perfcollect-lttng.md) helps automate using perf_events and [LTTng](https://en.wikipedia.org/wiki/LTTng). |
Copilot
AI
Mar 11, 2026
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
The privilege requirement paragraph now reads like EventPipe never requires admin/root, but the new user_events mode does. Consider clarifying that the "same user" rule applies to the default EventPipe session, while EventPipe (user_events) requires admin/root.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
| |Cross-platform|Yes|No (Linux only)|No (only on Windows)|No (only on supported Linux distros)| | |
| |Cross-platform|Yes|No (only on supported Linux distros)|No (only on Windows)|No (only on supported Linux distros)| |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I would say that dotnet-trace collect is often sufficient for managed code investigations within a single process. But often not knowing what native runtime frames are on the stack makes the investigations difficult. I would recommend dotnet-trace collect-linux on Linux for any .NET 10+ investigations. The set of tools is the same, so it seems ideal to bias towards a higher fidelity trace.
Uh oh!
There was an error while loading. Please reload this page.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Fully agree on the recommendation. In terms of how we phrase it in this doc I'd suggest we keep the initial blurb above very simple, just mentioning that 'dotnet-trace collect' is a cross-platform option and that depending on OS and .NET version improved capabilities may be available. Then in the tabs below we can give more refined guidance that is Windows or Linux specific.
In order to make the doc self-consistent if we mention dotnet-trace collect-linux as a recommended option then we need to provide a guide that tells people how to use it. Right now the section below only tells users about 'perf'.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Agree with your feedback here @noahfalk.