Skip to content
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

linux: clrthreads fails for AOT app #5364

Open
am11 opened this issue Mar 22, 2025 · 3 comments
Open

linux: clrthreads fails for AOT app #5364

am11 opened this issue Mar 22, 2025 · 3 comments
Assignees
Labels
bug Something isn't working dotnet-debugger-extensions
Milestone

Comments

@am11
Copy link
Member

am11 commented Mar 22, 2025

Description

# alpine arm64
$ dotnet --version
9.0.202

$ dotnet-sos --version
9.0.607501+a651406e39038aef1dbc7c8097b52953284dba27

$ dotnet new console -n testsos
$ cd testsos
$ echo 'throw new Exception("doodlebug");' >> Program.cs
$ dotnet publish -p:PublishAot=true -o dist

$ lldb dist/testsos
Current symbol store settings:
-> Cache: /root/.dotnet/symbolcache
-> Server: https://msdl.microsoft.com/download/symbols/ Timeout: 4 RetryCount: 0
(lldb) target create "dist/testsos"
Current executable set to '/testsos/dist/testsos' (aarch64).

(lldb) r
Process 2592 launched: '/testsos/dist/testsos' (aarch64)
Hello, World!
Unhandled exception. System.Exception: doodlebug
   at Program.<Main>$(String[] args) + 0x3c
Process 2592 stopped
* thread #1, name = 'testsos', stop reason = signal SIGABRT
    frame #0: 0x0000fffff7f8eef0 ld-musl-aarch64.so.1`__restore_sigs(set=0x0000fffffffff240) at block.c:44:1

(lldb) clrthreads
Failed to find runtime module (libcoreclr.so), 0x80004002
Extension commands need it in order to have something to do.
For more information see https://go.microsoft.com/fwlink/?linkid=2135652
Threads  failed

(lldb) expression DotNetRuntimeDebugHeader
(DotNetRuntimeDebugHeader) $0 = {
  Cookie = "DNDH"
  MajorVersion = 4
  MinorVersion = 0
  Flags = 1
  ReservedPadding1 = 0
  DebugTypeEntries = 0x0000aaaaaac0bb80
  GlobalEntries = 0x0000aaaaaac0bb00
}

(lldb) expression *(DebugTypeEntry*)DotNetRuntimeDebugHeader.DebugTypeEntries
(DebugTypeEntry) $1 = (TypeName = "GcDacVars", FieldName = "SIZEOF", FieldOffset = 320, ResevedPadding = 0)

(lldb) expression *(DebugTypeEntry*)DotNetRuntimeDebugHeader.GlobalEntries
(DebugTypeEntry) $0 = (TypeName = "g_CrashInfoBuffer", FieldName = "{\"version\":\"1.0.0\",\"runtime_base\":\"0xAAAAAAAA0000\",\"runtime_type\":\"4\",\"runtime_version\":\"9.0.3\",\"reason\":\"1\",\"thread\":\"0xA99\",\"message\":\"Unhandled exception: a managed exception was not handled before reaching unmanaged code\",\"exception\":{\"address\":\"0xFFBFFA80AAC8\",\"hr\":\"0x80131500\",\"message\":\"doodlebug\",\"type\":\"System.Exception\",\"stack\":[{\"ip\":\"0xAAAAAAB5E3EC\",\"module\":\"0xAAAAAAAA0000\",\"offset\":\"0x3C\",\"name\":\"Program.<Main>$(String[] args)\"},{\"ip\":\"0xAAAAAAB70AC0\",\"module\":\"0xAAAAAAAA0000\",\"offset\":\"0xD0\"}]}}", FieldOffset = 2864448864, ResevedPadding = 43690)

Not sure how it is supposed to work, per docs: https://learn.microsoft.com/dotnet/core/diagnostics/debugger-extensions

Threads (clrthreads) [-live] [-special] 	Displays all managed threads in the process.
...
Supported for Native AOT applications.

Basically none of the "support for Native AOT" commands are working.

@am11 am11 added the bug Something isn't working label Mar 22, 2025
@tommcdon
Copy link
Member

@mikem8361

@hoyosjs
Copy link
Member

hoyosjs commented Mar 24, 2025

@am11 - can you please try https://www.nuget.org/packages/dotnet-debugger-extensions/9.0.607601? dotnet-sos doesn't have a lot of the nativeaot support.

@am11
Copy link
Member Author

am11 commented Mar 24, 2025

@hoyosjs, ah, I missed that dotnet-sos is replaced by dotnet-debugger-extensions, thanks for the info.

It is also fail the same way (one additional line Special diagnostics info read failed):

(lldb) clrthreads 
Special diagnostics info read failed
Failed to find runtime module (libcoreclr.so), 0x80004002
Extension commands need it in order to have something to do.
For more information see https://go.microsoft.com/fwlink/?linkid=2135652
Threads  failed

(lldb) expr DotNetRuntimeDebugHeader
(DotNetRuntimeDebugHeader) $0 = {
  Cookie = "DNDH"
  MajorVersion = 4
  MinorVersion = 0
  Flags = 1
  ReservedPadding1 = 0
  DebugTypeEntries = 0x0000aaaaaac0bb80
  GlobalEntries = 0x0000aaaaaac0bb00
}

(lldb) expr *(DebugTypeEntry*)DotNetRuntimeDebugHeader.DebugTypeEntries
(DebugTypeEntry) $1 = (TypeName = "GcDacVars", FieldName = "SIZEOF", FieldOffset = 320, ResevedPadding = 0)

(lldb) expr *(DebugTypeEntry*)DotNetRuntimeDebugHeader.GlobalEntries
(DebugTypeEntry) $2 = (TypeName = "g_CrashInfoBuffer", FieldName = "{\"version\":\"1.0.0\",\"runtime_base\":\"0xAAAAAAAA0000\",\"runtime_type\":\"4\",\"runtime_version\":\"9.0.3\",\"reason\":\"1\",\"thread\":\"0x19D9\",\"message\":\"Unhandled exception: a managed exception was not handled before reaching unmanaged code\",\"exception\":{\"address\":\"0xFFBFFA80AAC8\",\"hr\":\"0x80131500\",\"message\":\"doodlebug\",\"type\":\"System.Exception\",\"stack\":[{\"ip\":\"0xAAAAAAB5E3EC\",\"module\":\"0xAAAAAAAA0000\",\"offset\":\"0x3C\",\"name\":\"Program.<Main>$(String[] args)\"},{\"ip\":\"0xAAAAAAB70AC0\",\"module\":\"0xAAAAAAAA0000\",\"offset\":\"0xD0\"}]}}", FieldOffset = 2864448864, ResevedPadding = 43690)

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
bug Something isn't working dotnet-debugger-extensions
Projects
None yet
Development

No branches or pull requests

4 participants