Skip to content

Update debug dump template after runfo update to include dumps #49183

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

Merged
merged 3 commits into from
Mar 6, 2021
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
17 changes: 9 additions & 8 deletions eng/testing/debug-dump-template.md
Original file line number Diff line number Diff line change
@@ -1,10 +1,6 @@
# Get the dump

Click the link to the dump on the `Helix Test Logs` tab in Azure DevOps. This is the same place you got these instructions from.

# Get the Helix payload

[Runfo](https://github.com/jaredpar/runfo/tree/master/runfo#runfo) helps get information about helix test runs and azure devops builds. We will use it to download the payload and symbols:
[Runfo](https://github.com/jaredpar/runfo/tree/master/runfo#runfo) helps get information about helix test runs and azure devops builds. We will use it to download the payload and symbols (recommended version 0.6.4 or later):
```sh
dotnet tool install --global runfo
dotnet tool update --global runfo
Expand All @@ -19,6 +15,8 @@ runfo get-helix-payload -j %JOBID% -w %WORKITEM% -o %WOUTDIR%
runfo get-helix-payload -j %JOBID% -w %WORKITEM% -o %LOUTDIR%
```

Any dump files published by helix will be downloaded.

> NOTE: if the helix job is an internal job, you need to pass down a [helix authentication token](https://helix.dot.net/Account/Tokens) using the `--helix-token` argument.

Now extract the files:
Expand Down Expand Up @@ -55,6 +53,9 @@ dotnet sos install --architecture x64
Install or update WinDbg if necessary ([external](https://docs.microsoft.com/en-us/windows-hardware/drivers/debugger/debugger-download-tools), [internal](https://osgwiki.com/wiki/Installing_WinDbg)). If you don't have a recent WinDbg you may have to do `.update sos`.

Open WinDbg and open the dump with `File>Open Dump`.
```
<win-path-to-dump>
```

```
!setclrpath %WOUTDIR%\shared\Microsoft.NETCore.App\6.0.0
Expand All @@ -76,7 +77,7 @@ dotnet tool update --global dotnet-dump
```
If prompted, open a new command prompt to pick up the updated PATH.
```sh
dotnet-dump analyze <path-to-dump>
dotnet-dump analyze <win-path-to-dump>
```
Within dotnet-dump:
```sh
Expand Down Expand Up @@ -106,7 +107,7 @@ Install or update LLDB if necessary ([instructions here](https://github.com/dotn

Load the dump:
```sh
lldb --core <path-to-dmp> %LOUTDIR%/shared/Microsoft.NETCore.App/6.0.0/dotnet
lldb --core <lin-path-to-dump> %LOUTDIR%/shared/Microsoft.NETCore.App/6.0.0/dotnet
```

Within lldb:
Expand All @@ -129,7 +130,7 @@ dotnet tool update --global dotnet-dump
```
If prompted, open a new command prompt to pick up the updated PATH.
```sh
dotnet-dump analyze <path-to-dump>
dotnet-dump analyze <lin-path-to-dump>
```
Within dotnet-dump:
```sh
Expand Down
24 changes: 19 additions & 5 deletions eng/testing/gen-debug-dump-docs.py
Original file line number Diff line number Diff line change
Expand Up @@ -61,14 +61,13 @@
dump_dir = sys.argv[idx]
idx += 1

found_dumps = False
dump_names = []
if dump_dir != '':
for filename in os.listdir(dump_dir):
if filename.endswith('.dmp') or 'core.' in filename:
found_dumps = True
break
dump_names.append(filename)

if not found_dumps:
if len(dump_names) == 0:
print("Did not find dumps, skipping dump docs generation.")
exit(0)

Expand Down Expand Up @@ -103,6 +102,21 @@
output_file = out_dir + dir_separator + 'how-to-debug-dump.md'
with open(output_file, 'w+') as output:
print('writing output file: ' + output_file)
write_file = output.write(replace_string)

lines = replace_string.split(os.linesep)
lin_dump_dir= workitem + "/workitems/" + workitem + "/"
win_dump_dir= workitem + "\\workitems\\" + workitem + "\\"
for line in lines:
# write dump debugging commands for each dump found.
if "<lin-path-to-dump>" in line:
for dump_name in dump_names:
output.write(line.replace("<lin-path-to-dump>", unix_user_folder + lin_dump_dir + dump_name))
output.write(os.linesep)
elif "<win-path-to-dump>" in line:
for dump_name in dump_names:
output.write(line.replace("<win-path-to-dump>", windows_user_folder + win_dump_dir + dump_name))
output.write(os.linesep)
else:
output.write(line + os.linesep)

print('done writing debug dump information')
4 changes: 2 additions & 2 deletions src/libraries/sendtohelixhelp.proj
Original file line number Diff line number Diff line change
Expand Up @@ -229,11 +229,11 @@
<PropertyGroup Condition="'$(RuntimeFlavor)' == 'CoreCLR' and '$(BUILD_BUILDID)' != ''">
<HelixPostCommands Condition="'$(TargetsWindows)' == 'true'">
$(HelixPostCommands);
%HELIX_PYTHONPATH% %HELIX_CORRELATION_PAYLOAD%\gen-debug-dump-docs.py -buildid $(BUILD_BUILDID) -workitem %HELIX_WORKITEM_ID% -jobid %HELIX_CORRELATION_ID% -outdir %HELIX_WORKITEM_UPLOAD_ROOT% -templatedir %HELIX_CORRELATION_PAYLOAD% -dumpdir %HELIX_DUMP_FOLDER%
%HELIX_PYTHONPATH% %HELIX_CORRELATION_PAYLOAD%\gen-debug-dump-docs.py -buildid $(BUILD_BUILDID) -workitem %HELIX_WORKITEM_FRIENDLYNAME% -jobid %HELIX_CORRELATION_ID% -outdir %HELIX_WORKITEM_UPLOAD_ROOT% -templatedir %HELIX_CORRELATION_PAYLOAD% -dumpdir %HELIX_DUMP_FOLDER%
</HelixPostCommands>
<HelixPostCommands Condition="'$(TargetsWindows)' != 'true'">
$(HelixPostCommands);
$HELIX_PYTHONPATH $HELIX_CORRELATION_PAYLOAD/gen-debug-dump-docs.py -buildid $(BUILD_BUILDID) -workitem $HELIX_WORKITEM_ID -jobid $HELIX_CORRELATION_ID -outdir $HELIX_WORKITEM_UPLOAD_ROOT -templatedir $HELIX_CORRELATION_PAYLOAD -dumpdir $HELIX_DUMP_FOLDER
$HELIX_PYTHONPATH $HELIX_CORRELATION_PAYLOAD/gen-debug-dump-docs.py -buildid $(BUILD_BUILDID) -workitem $HELIX_WORKITEM_FRIENDLYNAME -jobid $HELIX_CORRELATION_ID -outdir $HELIX_WORKITEM_UPLOAD_ROOT -templatedir $HELIX_CORRELATION_PAYLOAD -dumpdir $HELIX_DUMP_FOLDER
</HelixPostCommands>
</PropertyGroup>

Expand Down