How to Dump a .NET Core Application on Linux

后端 未结 4 1665
余生分开走
余生分开走 2021-01-07 19:12

I have a .NET application that I have ported to .NET Core. I am testing it on Ubuntu 14.04.

I am trying to figure out how to get a .dmp file or the Linux equivalent

4条回答
  •  爱一瞬间的悲伤
    2021-01-07 19:39

    The generation of linux coredumps is defined by what's in /proc/sys/kernel/core_pattern. If certain signals (e.g. SIGSEGV or SIGQUIT) cause a process to terminate, an image of the process's memory is basically written into that file. If it starts with a pipe-symbol |, it can be streamed into an application which does dump analysis. It's documented here: http://man7.org/linux/man-pages/man5/core.5.html

    If you configure it like that:

       echo coredump > /proc/sys/kernel/core_pattern
    

    it will write a file named coredump into the current directory.

    If you configure it like that:

       echo "/tmp/cores/core.%e.%p.%h.%t" > /proc/sys/kernel/core_pattern
    

    It will create a file like /tmp/cores/core.bash.8539.drehbahn-mbp.1236975953 (see https://sigquit.wordpress.com/2009/03/13/the-core-pattern/)

    As others suggested, also set ulimit -S -c unlimited to allow coredumps of any size.

    Here is a blog-post which shows how to create and analyze .NET Core coredumps under linux: http://blogs.microsoft.co.il/sasha/2017/02/26/analyzing-a-net-core-core-dump-on-linux/

提交回复
热议问题