dotnet / dotnet/diagnostics

linux: `clrthreads` fails for AOT app

Open
#5,364 12 comments 0 reactions 0 assignees View on GitHub
bug dotnet-debugger-extensions
Dominant language
C++
Stars
1.3k
Forks
404
Avg merge
2d 5h
Merged PRs (30d)
35

Description

### Description

```sh
# 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
```
```gdb
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.$(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.$(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.

Contributor guide

No contributing guide indexed for this repository

Assessment

This issue has not been assessed yet.

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.