Skip to content

Commit a1b0e4e

Browse files
author
Mike McLaughlin
authored
Update core dump debugging work flow (#587)
Update the Linux core dump debugging work flow
1 parent 8b7c251 commit a1b0e4e

File tree

1 file changed

+21
-4
lines changed

1 file changed

+21
-4
lines changed

documentation/debugging-coredump.md

Lines changed: 21 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -7,20 +7,31 @@ Dumps created with gdb or gcore do not have all the managed state so various SOS
77

88
### Getting symbols ###
99

10-
Because SOS now has symbol download support, this step can be skipped if the matching version of the "host" program is available on the machine loading the dump. Usually the host program is "dotnet" but each .NET Core SDK has a different version.
10+
Because SOS now has symbol download support (both managed PDBs and native symbols via `loadsymbols`) all that lldb requires is the host program. The host is usually `dotnet` but for self-contained applications it the .NET Core `apphost` renamed to the program/project name. These steps will handle either case and download the host lldb needs to properly diagnose a core dump.
1111

12-
First install the dotnet CLI symbol tool. This only needs to be down once. See this [link](https://github.com/dotnet/symstore/tree/master/src/dotnet-symbol#install) for more details.
12+
First install or update the dotnet CLI symbol tool. This only needs to be done once. See this [link](https://github.com/dotnet/symstore/tree/master/src/dotnet-symbol#install) for more details. We need version 1.0.52901 or greater of dotnet-symbol installed.
1313

1414
~$ dotnet tool install -g dotnet-symbol
15+
You can invoke the tool using the following command: dotnet-symbol
16+
Tool 'dotnet-symbol' (version '1.0.52901') was successfully installed.
17+
18+
Or update if already installed:
19+
20+
~$ dotnet tool update -g dotnet-symbol
21+
Tool 'dotnet-symbol' was successfully updated from version '1.0.51501' to version '1.0.52901'.
1522

1623
Copy the core dump to a tmp directory.
1724

1825
~$ mkdir /tmp/dump
1926
~$ cp ~/coredump.32232 /tmp/dump
2027

21-
Download the modules and symbols for the core dump:
28+
Download the host program for the core dump:
29+
30+
~$ dotnet-symbol --host-only /tmp/dump/coredump.32232
31+
32+
If the `--host-only` option is not found, update dotnet-symbol to the latest with the above step.
2233

23-
~$ dotnet-symbol /tmp/dump/coredump.32232
34+
If your project/program binaries are not on the machine the core dump is being loaded on, copy them to a temporary directory. You can use the lldb/SOS command `setsymbolserver -directory <temp-dir>` to add this directory to the search path.
2435

2536
### Install lldb ###
2637

@@ -44,13 +55,19 @@ Add the directory with the core dump and symbols to the symbol search path:
4455
Added symbol directory path: /tmp/dump
4556
(lldb)
4657

58+
Optionally load the native symbols. The managed PDBs will be loaded on demand when needed:
59+
60+
(lldb) loadsymbols
61+
4762
Even if the core dump was not generated on this machine, the native and managed .NET Core symbols should be available along with all the SOS commands.
4863

4964
### Launch lldb under MacOS ###
5065

5166
~$ lldb --core /cores/core.32232 <host-program>
5267
(lldb)
5368

69+
Follow the rest of the above Linux steps to set the symbol server and load native symbols.
70+
5471
The MacOS lldb has a bug that prevents SOS clrstack from properly working. Because of this bug SOS can't properly match the lldb native with with the managed thread OSID displayed by `clrthreads`. The `setsostid` command is a work around for this lldb bug. This command maps the OSID from this command:
5572

5673
```

0 commit comments

Comments
 (0)