dotnet / diagnostics

This repository contains the source code for various .NET Core runtime diagnostic tools and documents.
MIT License
1.17k stars 350 forks source link

dotnet-dump analyze does not work on M3 macOS #4779

Open wfurt opened 2 weeks ago

wfurt commented 2 weeks ago

Description

I collected dump from runtime test run on my MacBook and I failed to analyze it on the same machine

Configuration

I have MacBook with M3 CPU

image

Regression

It did work on my old Intel Mac.

Other information

lenoch:tmp furt$ dotnet-dump  collect -p 56833

Writing full to /private/tmp/core_20240709_103409
Complete
lenoch:tmp furt$ dotnet-dump analyze /private/tmp/core_20240709_103409
Loading core dump: /private/tmp/core_20240709_103409 ...
Ready to process analysis commands. Type 'help' to list available commands or 'help [command]' to get detailed help on a command.
Type 'quit' or 'exit' to exit the session.
> clrstack
SOS does not support the current target architecture 'arm64' (0xaa64). A 32 bit target may require a 32 bit debugger or vice versa. In general, try to use the same bitness for the debugger and target process.
> quit
mikem8361 commented 2 weeks ago

Can you enable logging with logging enable? Do commands like runtimes, sosstatus or dumpheap -stat work? It is almost like x64 version of libsos.dylib is being loaded (the one under osx-x64 instead of osx-arm64). The only way I could see that happening is if the SDK/runtime installed is x64 instead of arm64. Can you make sure the right runtime architecture is installed? dotnet --info should display that. You might have to reinstall the SDK and then dotnet-dump.

wfurt commented 2 weeks ago

You were right. I did have x64 sdk installed for whatever reason. I deleted everything and it is better.

> clrstack
OS Thread Id: 0x27437 (0)
        Child SP               IP Call Site
GetFrameContext failed: 80070057
GetFrameContext failed: 80070057
GetFrameContext failed: 80070057
GetFrameContext failed: 80070057
GetFrameContext failed: 80070057
GetFrameContext failed: 80070057
GetFrameContext failed: 80070057
lenoch:tmp furt$ dotnet --info
.NET SDK:
 Version:           8.0.303
 Commit:            29ab8e3268
 Workload version:  8.0.300-manifests.c915c39d
 MSBuild version:   17.10.4+10fbfbf2e

Runtime Environment:
 OS Name:     Mac OS X
 OS Version:  14.5
 OS Platform: Darwin
 RID:         osx-arm64
 Base Path:   /usr/local/share/dotnet/sdk/8.0.303/

.NET workloads installed:
There are no installed workloads to display.

Host:
  Version:      8.0.7
  Architecture: arm64
  Commit:       2aade6beb0

.NET SDKs installed:
  8.0.303 [/usr/local/share/dotnet/sdk]

.NET runtimes installed:
  Microsoft.AspNetCore.App 8.0.7 [/usr/local/share/dotnet/shared/Microsoft.AspNetCore.App]
  Microsoft.NETCore.App 8.0.7 [/usr/local/share/dotnet/shared/Microsoft.NETCore.App]
wfurt commented 2 weeks ago

Any thoughts on the GetFrameContext failed: 80070057 @mikem8361 ? It would be really nice to get stack and dump objects.

hoyosjs commented 2 weeks ago

That's probably https://github.com/dotnet/runtime/issues/104816 - a relatively recent regression under investigation that was caused by https://github.com/dotnet/runtime/commit/9528c1544e180652162ed73ef1f3f71faca9c070

mikem8361 commented 2 weeks ago

Sorry, I didn't actually look at the clrstack output. I saw that you said everything was ok and stopped reading.

mikem8361 commented 2 days ago

I think we need a M3 to repro this.