Docker image for netcore coredump debugging
2.5K
Docker image with lldb debugger and SOS plugin, compiled from sources with lldb headers. By default loads process coredump from /tmp/coredump, loads SOS plugin and prints current exception, leaving lldb shell open. Image tag matches dotnet runtime version.
docker run --rm -it -v /stripe/upload/coredump:/tmp/coredump 6opuc/lldb-netcore
docker cp 79686a7aff63:/app /tmp
ls /tmp/app/core.*
example output:
/tmp/app/core.26939
docker run --rm -it -v /tmp/app/core.26939:/tmp/coredump 6opuc/lldb-netcore
example output:
(lldb) target create "/usr/bin/dotnet" --core "/tmp/coredump"
Core file '/tmp/coredump' (x86_64) was loaded.
(lldb) plugin load /coreclr/libsosplugin.so
(lldb) sos PrintException
Exception object: 00007f3fb001ce08
Exception type: System.NullReferenceException
Message: Object reference not set to an instance of an object.
InnerException: <none>
StackTrace (generated):
SP IP Function
00007FFCE0A312F0 00007F3FD7940481 test.dll!test.Program.Main(System.String[])+0x1
StackTraceString: <none>
HResult: 80004003
(lldb)
help
Get id of docker container(docker ps) you need to analyze. In this example it is "b5063ef5787c"
Run container with createdump utility(it needs sys_admin and sys_ptrace privileges. If your running container already has these privileges you can attach to running container and run createdump utility from there):
docker run --rm -it --cap-add sys_admin --cap-add sys_ptrace --net=container:b5063ef5787c --pid=container:b5063ef5787c -v /tmp:/tmp 6opuc/lldb-netcore /bin/bash
ps aux
In this example PID is "7"
createdump -u -f /tmp/coredump 7
exit
docker run --rm -it -v /tmp/coredump:/tmp/coredump 6opuc/lldb-netcore
example output:
(lldb) target create "/usr/bin/dotnet" --core "/tmp/coredump"
Core file '/tmp/coredump' (x86_64) was loaded.
(lldb) plugin load /coreclr/libsosplugin.so
(lldb) sos PrintException
There is no current managed exception on this thread
(lldb)
help
docker build \
--tag 6opuc/lldb-netcore:2.2.3 \
--build-arg BASE_IMAGE=mcr.microsoft.com/dotnet/core/sdk:2.2.105 \
--build-arg CORECLR_BRANCH=v2.2.3 \
.
docker build \
--tag 6opuc/lldb-netcore:2.2.2 \
--build-arg BASE_IMAGE=mcr.microsoft.com/dotnet/core/sdk:2.2.104 \
--build-arg CORECLR_BRANCH=v2.2.2 \
.
docker build \
--tag 6opuc/lldb-netcore:2.1.8 \
--build-arg BASE_IMAGE=mcr.microsoft.com/dotnet/core/sdk:2.1.504 \
--build-arg CORECLR_BRANCH=v2.1.8 \
.
docker build \
--tag 6opuc/lldb-netcore:2.0.3 \
--build-arg BASE_IMAGE=microsoft/dotnet:2.0.3-sdk \
--build-arg CORECLR_BRANCH=v2.0.3 \
.
Content type
Image
Digest
Size
776.8 MB
Last updated
over 6 years ago
docker pull 6opuc/lldb-netcore