Dumped core
I'm trying to run netcoredbg from Neovim. I build the project successfully but when running the debugger, at some point, the program crash. In journalctl I can see :
Process 235511 (netcoredbg) of user 1000 dumped core.
Stack trace of thread 235677:
#0 0x000078bc1e8335e7 n/a (n/a + 0x0)
#1 0x000078bc1e8334eb n/a (n/a + 0x0)
#2 0x00005958e6cc920b n/a (n/a + 0x0)
#3 0x00005958e6cc65e9 n/a (n/a + 0x0)
#4 0x00005958e6cbe4d4 n/a (n/a + 0x0)
#5 0x00005958e6c630b2 n/a (n/a + 0x0)
#6 0x000078bc1d623a73 n/a (n/a + 0x0)
#7 0x000078bc1d60bc2a n/a (n/a + 0x0)
#8 0x000078bc1d616518 n/a (n/a + 0x0)
#9 0x000078bc1d616e07 n/a (n/a + 0x0)
#10 0x000078bc1d616ea9 n/a (n/a + 0x0)
#11 0x000078bc1d4261be n/a (n/a + 0x0)
#12 0x000078bc1e8a370a n/a (n/a + 0x0)
#13 0x000078bc1e927aac n/a (n/a + 0x0)
ELF object binary architecture: AMD x86-64
So, I tried to run the project from CLI dotnet bin/Debug/net8.0/MyProject.dll which seems to work properly. But using the same command with netcoredbg I got netcoredbg --interpreter=cli -- dotnet bin/Debug/net8.0/MyProject.dll that return :
library loaded: /home/user/Dev/Project/src/MyProject/bin/Debug/net8.0/Model.dll
no symbols loaded, base address: 0x784dd2ef0000, size: 122368(0x1de00)
[there is a lot of those]
netcoredbg: /usr/src/debug/netcoredbg/netcoredbg-3.1.2-1054/src/metadata/modules_sources.h:68: bool netcoredbg::method_data_t::NestedInto(const method_data_t &) const: Assertion `startLine != other.startLine || startColumn != other.startColumn' failed.
[1] 244005 IOT instruction (core dumped) netcoredbg --interpreter=cli -- dotnet
And from GDB I can see :
(gdb) bt full
#0 __GI_abort () at abort.c:91
act = {__sigaction_handler = {sa_handler = 0x0, sa_sigaction = 0x0}, sa_mask = {__val = {18446744073709551615, 0 <repeats 15 times>}}, sa_flags = 0, sa_restorer = 0x0}
#1 0x00007aac684334eb in __assert_fail_base (fmt=<optimized out>, assertion=<optimized out>, file=<optimized out>, line=68, function=<optimized out>) at assert.c:118
str = 0x7aac50080270 "\240\244\324\372\253z"
total = <optimized out>
#2 0x000063ee45a1020b in netcoredbg::method_data_t::NestedInto (this=<optimized out>, other=...) at /usr/src/debug/netcoredbg/netcoredbg-3.1.2-1054/src/metadata/modules_sources.h:68
No locals.
I'm running out of idea to debug with this problem. Do you have any idea on what's wrong?
Thank you.
I build the project successfully
Please share which OS, arch, compiler, etc. you use, and your build commands
I'm running 6.13.6-arch1-1 x86_64 GNU/Linux. I'm building my project by doing cd /home/user/Dev/Project/src/MyProject, -> dotnet build .
Assertion `startLine != other.startLine || startColumn != other.startColumn'
Not really sure why you use debug version of netcoredbg with enabled assertion and debug related blocks, but... This assertion's fail mean that some c# nested function have same start position as parrent method start position in source, that shoud not happen for sure (at least in our current logic). Could you please provide minimal c# code that could reproduce this issue for investigation?
I'm building my project by doing cd /home/user/Dev/Project/src/MyProject, -> dotnet build .
Did you build netcoredbg yourself or used binaries from releases?
I took the one from AUR repo : NET Core debugger 3.1.2-1 (801069d, None). @viewizard I'm trying to setup a repo to reproduce
Config in https://aur.archlinux.org/packages/netcoredbg seems incorrect, for example this is not right:
-DCMAKE_BUILD_TYPE=None
You can find linux build instructions at https://github.com/Samsung/netcoredbg?tab=readme-ov-file#unix, more info on build type at https://github.com/Samsung/netcoredbg?tab=readme-ov-file#selecting-between-debug-and-release-builds. Or you can also try AUR config with -DCMAKE_BUILD_TYPE=Release. Otherwise debug build (default) will be slower than release one. Anyway, please share a repro, we'll take a look.
Config in https://aur.archlinux.org/packages/netcoredbg seems incorrect, for example this is not right:
-DCMAKE_BUILD_TYPE=None
This is right per Arch packaging guidelines due to various reasons, keeping assertions is intended behavior and helps debugging (this issue is the case).
Otherwise debug build (default) will be slower than release one.
Not true. None is not Debug 😁 (it would be Debug if CMAKE_BUILD_TYPE is undefined but it is not) and Arch's makepkg defaults define optimizations flags, as described in linked article, it passes -O2 to C(XX)FLAGS and enables LTO by default.
@aikawayataro Thanks for information, I didn't know that. But please keep in mind that such build config was not expected and we do not test such builds. For example, MANAGEDPART_BUILD_TYPE is set to Release when CMAKE_BUILD_TYPE is not Debug, so you'll have O2 build with asserts for native part and Release build for managed.
Maybe managed part should also be Debug then to be consistent with what's done for dotnet runtime. According to build config (https://gitlab.archlinux.org/archlinux/packaging/packages/dotnet-core/-/blob/1fe01f76e21906c595df2141aa057077114c8003/PKGBUILD), no build mode is passed to build.sh. Native part is built in Debug (with O2 as you mentioned) then and managed part is also built in Debug.
Actually, Checked build of runtime does exactly the same (asserts + O2), e.g. --runtimeConfiguration Checked --librariesConfiguration Debug (https://github.com/dotnet/runtime/blob/main/docs/workflow/README.md, ./eng/native/configureoptimization.cmake).
In overall, it's better to add new build type in netcoredbg specifically for this, like Checked in dotnet runtime.
@gbalykov you were right, I build it from the source and now it work. Thank you.
you were right, I build it from the source and now it work. Thank you.
@NathanGallet please also try debug build of netcoredbg (https://github.com/Samsung/netcoredbg?tab=readme-ov-file#selecting-between-debug-and-release-builds) with test, on which you saw core dump. This will help us to investigate this issue further.