dotnet / diagnostics

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

Failed to find runtime module (libcoreclr.so), 0x80070057 #1462

Closed mrj001 closed 4 years ago

mrj001 commented 4 years ago

I've created a Hello World self contained app.

$ lldb HelloWorld
Added Microsoft public symbol server
(lldb) target create "HelloWorld"
Current executable set to '/Users/mj/Documents/develop/runtime.issues/SelfContained/HelloWorld/bin/Debug/net5.0/osx-x64/HelloWorld' (x86_64).
(lldb) process launch -s
Process 44203 stopped
* thread #1, stop reason = signal SIGSTOP
    frame #0: 0x0000000100019000 dyld`_dyld_start
dyld`_dyld_start:
->  0x100019000 <+0>: popq   %rdi
    0x100019001 <+1>: pushq  $0x0
    0x100019003 <+3>: movq   %rsp, %rbp
    0x100019006 <+6>: andq   $-0x10, %rsp
Target 0: (HelloWorld) stopped.
Process 44203 launched: '/Users/mj/Documents/develop/runtime.issues/SelfContained/HelloWorld/bin/Debug/net5.0/osx-x64/HelloWorld' (x86_64)
(lldb) sos DumpAssembly
Failed to find runtime module (libcoreclr.dylib), 0x80070057
Extension commands need it in order to have something to do.
For more information see https://go.microsoft.com/fwlink/?linkid=2135652
DumpAssembly  failed
(lldb) target modules list
[  0] 1F0D413F-0759-31D3-93B8-E49CC2125AEA 0x0000000100000000 /Users/mj/Documents/develop/runtime.issues/SelfContained/HelloWorld/bin/Debug/net5.0/osx-x64/HelloWorld 
[  1] F9D4DEDC-8296-3E3F-B517-9C8B89A4C094 0x0000000100018000 /usr/lib/dyld 
(lldb) quit
Quitting LLDB will kill one or more processes. Do you really want to proceed: [Y/n] Y
$ ll libcoreclr.dylib
-rwxr--r--  1 mj  staff  6791092 15 Jul 06:29 libcoreclr.dylib

As shown by the ll at the end, the lib coreclr.dylib is present in the folder alongside the target, but not loaded.

$ dotnet --info
.NET SDK (reflecting any global.json):
 Version:   5.0.100-preview.8.20362.3
 Commit:    a5c8f426c2

Runtime Environment:
 OS Name:     Mac OS X
 OS Version:  10.15
 OS Platform: Darwin
 RID:         osx.10.15-x64
 Base Path:   /Users/mj/Documents/develop/runtime/.dotnet/sdk/5.0.100-preview.8.20362.3/

Host (useful for support):
  Version: 5.0.0-preview.8.20361.2
  Commit:  f37dd6fc85

.NET SDKs installed:
  5.0.100-preview.8.20362.3 [/Users/mj/Documents/develop/runtime/.dotnet/sdk]

.NET runtimes installed:
  Microsoft.AspNetCore.App 5.0.0-preview.8.20360.11 [/Users/mj/Documents/develop/runtime/.dotnet/shared/Microsoft.AspNetCore.App]
  Microsoft.NETCore.App 5.0.0-preview.8.20361.2 [/Users/mj/Documents/develop/runtime/.dotnet/shared/Microsoft.NETCore.App]

To install additional .NET runtimes or SDKs:
  https://aka.ms/dotnet-download
mikem8361 commented 4 years ago

libcoreclr.so needs to be loaded before any SOS commands will work.

mrj001 commented 4 years ago

@mikem8361, yes. The problem is that it did not load for a self-contained app, despite being present alongside the self-contained app. When the app is not self-contained, it loads automatically, and SOS commands work.

mikem8361 commented 4 years ago

The problem is that "process launch -s" stops before any other modules are loaded other than HelloWorld.

mikem8361 commented 4 years ago

Setting a managed bp with "bpmd" on Main is the best way to get to a place where SOS works but I see from issue #1464 that isn't working for you. I'll investigate that, but where you stop in this issue isn't supported.

mrj001 commented 4 years ago

@mikaelm12 Thanks. I was just going to ask how to get SOS loaded. Closing this issue due to "not supported".