Skip to content

Store entry assembly path for easy access for diagnostics #95027

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
Nov 21, 2023

Conversation

elinor-fung
Copy link
Member

  • Add g_EntryAssemblyPath global variable holding the full path to the entry assembly
    • Set right before loading the entry assembly (so also before startup hooks are run) - NULL if there is no entry assembly
  • Ensure value is included dumps
    • For triage dumps, the dumped value is updated to only be the assembly file name instead of the full path

Example:

0:000> ||
.  0 User mini triage dump: C:\repos\helloworld\triage.dmp
0:000> x coreclr!g_EntryAssemblyPath
00007ffb`14f7dd58 coreclr!g_EntryAssemblyPath = 0x00000211`88016eb0 "helloworld.dll"

0:000> ||
.  0 User mini dump: C:\repos\helloworld\mini.dmp
0:000> x coreclr!g_EntryAssemblyPath
00007ffb`14f7dd58 coreclr!g_EntryAssemblyPath = 0x00000211`88016eb0 "C:\repos\helloworld\bin\Debug\net8.0\helloworld.dll"

Fixes #94474

@leculver
@dotnet/dotnet-diag

@ghost
Copy link

ghost commented Nov 20, 2023

Tagging subscribers to this area: @vitek-karas, @agocke, @VSadov
See info in area-owners.md if you want to be subscribed.

Issue Details
  • Add g_EntryAssemblyPath global variable holding the full path to the entry assembly
    • Set right before loading the entry assembly (so also before startup hooks are run) - NULL if there is no entry assembly
  • Ensure value is included dumps
    • For triage dumps, the dumped value is updated to only be the assembly file name instead of the full path

Example:

0:000> ||
.  0 User mini triage dump: C:\repos\helloworld\triage.dmp
0:000> x coreclr!g_EntryAssemblyPath
00007ffb`14f7dd58 coreclr!g_EntryAssemblyPath = 0x00000211`88016eb0 "helloworld.dll"

0:000> ||
.  0 User mini dump: C:\repos\helloworld\mini.dmp
0:000> x coreclr!g_EntryAssemblyPath
00007ffb`14f7dd58 coreclr!g_EntryAssemblyPath = 0x00000211`88016eb0 "C:\repos\helloworld\bin\Debug\net8.0\helloworld.dll"

Fixes #94474

@leculver
@dotnet/dotnet-diag

Author: elinor-fung
Assignees: -
Labels:

area-AssemblyLoader-coreclr

Milestone: -

@ghost ghost assigned elinor-fung Nov 20, 2023
Co-authored-by: Aaron Robinson <arobins@microsoft.com>
@AaronRobinsonMSFT

This comment was marked as outdated.

@elinor-fung elinor-fung merged commit 7d87095 into dotnet:main Nov 21, 2023
@elinor-fung
Copy link
Member Author

/backport to release/8.0-staging

@elinor-fung
Copy link
Member Author

/backport to release/7.0-staging

Copy link
Contributor

Started backporting to release/8.0-staging: https://github.com/dotnet/runtime/actions/runs/6937553925

Copy link
Contributor

Started backporting to release/7.0-staging: https://github.com/dotnet/runtime/actions/runs/6937554937

@elinor-fung elinor-fung deleted the storeEntryAssemblyPath branch November 21, 2023 00:34
Copy link
Contributor

@elinor-fung backporting to release/8.0-staging failed, the patch most likely resulted in conflicts:

$ git am --3way --ignore-whitespace --keep-non-patch changes.patch

Applying: Store entry assembly path for easy access for diagnostics (dumps)
Using index info to reconstruct a base tree...
M	src/coreclr/inc/dacvars.h
M	src/coreclr/vm/vars.cpp
M	src/coreclr/vm/vars.hpp
Falling back to patching base and 3-way merge...
Auto-merging src/coreclr/vm/vars.hpp
CONFLICT (content): Merge conflict in src/coreclr/vm/vars.hpp
Auto-merging src/coreclr/vm/vars.cpp
CONFLICT (content): Merge conflict in src/coreclr/vm/vars.cpp
Auto-merging src/coreclr/inc/dacvars.h
error: Failed to merge in the changes.
hint: Use 'git am --show-current-patch=diff' to see the failed patch
Patch failed at 0001 Store entry assembly path for easy access for diagnostics (dumps)
When you have resolved this problem, run "git am --continue".
If you prefer to skip this patch, run "git am --skip" instead.
To restore the original branch and stop patching, run "git am --abort".
Error: The process '/usr/bin/git' failed with exit code 128

Please backport manually!

Copy link
Contributor

@elinor-fung an error occurred while backporting to release/8.0-staging, please check the run log for details!

Error: git am failed, most likely due to a merge conflict.

Copy link
Contributor

@elinor-fung backporting to release/7.0-staging failed, the patch most likely resulted in conflicts:

$ git am --3way --ignore-whitespace --keep-non-patch changes.patch

Applying: Store entry assembly path for easy access for diagnostics (dumps)
Using index info to reconstruct a base tree...
M	src/coreclr/debug/daccess/enummem.cpp
M	src/coreclr/inc/daccess.h
M	src/coreclr/inc/dacvars.h
M	src/coreclr/vm/corhost.cpp
M	src/coreclr/vm/vars.cpp
M	src/coreclr/vm/vars.hpp
Falling back to patching base and 3-way merge...
Auto-merging src/coreclr/vm/vars.hpp
CONFLICT (content): Merge conflict in src/coreclr/vm/vars.hpp
Auto-merging src/coreclr/vm/vars.cpp
CONFLICT (content): Merge conflict in src/coreclr/vm/vars.cpp
Auto-merging src/coreclr/vm/corhost.cpp
Auto-merging src/coreclr/inc/dacvars.h
Auto-merging src/coreclr/inc/daccess.h
Auto-merging src/coreclr/debug/daccess/enummem.cpp
error: Failed to merge in the changes.
hint: Use 'git am --show-current-patch=diff' to see the failed patch
Patch failed at 0001 Store entry assembly path for easy access for diagnostics (dumps)
When you have resolved this problem, run "git am --continue".
If you prefer to skip this patch, run "git am --skip" instead.
To restore the original branch and stop patching, run "git am --abort".
Error: The process '/usr/bin/git' failed with exit code 128

Please backport manually!

Copy link
Contributor

@elinor-fung an error occurred while backporting to release/7.0-staging, please check the run log for details!

Error: git am failed, most likely due to a merge conflict.

@mikem8361
Copy link
Contributor

How is this supposed to be used? It looks like a DAC'ized global variable was added (g_EntryAssemblyPath) but that is only accessible by the DAC and there is no DAC API exposed to query it.

@elinor-fung
Copy link
Member Author

It is simply accessed as a global variable rather than via a DAC API.

@mikem8361
Copy link
Contributor

The problem is that to access the global the tooling needs the symbol file. It is was an export, then tools like createdump or dotnet-dump, etc. could use it. I know that !analyze/Watson was it's intended usage so requiring a native debugger and symbols.

Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Projects
None yet
Development

Successfully merging this pull request may close these issues.

Make it easy to determine entry assembly path when debugging CoreCLR
5 participants