diagnostics: libsosplugin cannot be loaded into lldb (macos arm64)

Description

I try to install dotnet-sos to get an ability to debug dotnet programs on mac, but after installing it according to this manual, lldb shows error on startup:

$ lldb
error: this file does not represent a loadable dylib
error: 'setsymbolserver' is not a valid command.
(lldb) 

Futher context:

$ cat .lldbinit 
#START - ADDED BY SOS INSTALLER
plugin load /Users/yuraaka/.dotnet/sos/libsosplugin.dylib
setsymbolserver -ms
#END - ADDED BY SOS INSTALLER

Also, I tried to build libsosplugin from source, but got the same result. What do I do wrong?

Reproduction Steps

  1. Install dotnet-sos
  2. Run lldb
  3. Get an error

Expected behavior

No error is appeared

Actual behavior

Error “this file does not represent a loadable dylib”.

Regression?

No response

Known Workarounds

No response

Configuration

  • Apple M2 Max
  • macOS Ventura 13.5.2
$ lldb -v
lldb-1403.0.17.67
Apple Swift version 5.8.1 (swiftlang-5.8.0.124.5 clang-1403.0.22.11.100)

$ dotnet-sos --version
7.0.442301+6245a3eeff5a12218eb5b615788d776027133e91

Other information

No response

About this issue

  • Original URL
  • State: open
  • Created 9 months ago
  • Comments: 15 (11 by maintainers)

Most upvoted comments

Apologies - I should have updated the forum thread after our discussion with Apple. They very promptly solved the issue in their codebase. It’s just now becoming available with Xcode 15 (although things seem to have some issues there right now that need some investigation cc @mikem8361 )

dotnet sos has a command line parameter to install an extension for specific architecture.

I workoarounded the initial issue on my Apple M2 machine by compiling LLDB from sources

Yes, I’ve repro’ed the Error: Fail to initialize coreclr 80070008 error on our M1. Initializing the managed hosting layer is failing for some reason which means managed commands like dumpheap and eeheap won’t work. We will continue to investigate but Apple has made debugging this scenario difficult (can not attach to lldb to debug SOS).

are any of the different problems issues we should investigate, and if so would you mind opening new issues to track it?

I am not sure. I will file separate issue if necessary. With some Xcode 15 beta I was getting the following error on lldb startup: Error: Fail to initialize coreclr 80070008.

I tracked down the Discord thread where we discussed it. Apparently it was broken in Xcode 14.3.1 and worked in Xcode 15 (which has different problems, so beware). A more detailed description was also cross posted to Apple forum.