I am running a dotnet core 2.1 application on the following linux embedded system:
Linux arm 4.14.67-1.0.7+ #52 SMP PREEMPT armv7l GNU/Linux
The application hangs since a couple of days at a futex:
root@arm:/# strace -p 525
strace: Process 525 attached
futex(0x4a6f4, FUTEX_WAIT_PRIVATE, 29517, NULL
<detached ...>
I must find out which line of c# code produces the corresponding futex call without stopping the process. How can I find the way back to the line of c# code that produces the corresponding futex system call?
With /proc/525/maps
I find that the address 0x4a6f4 is part of the heap memory:
00008000-00019000 r-xp 00000000 00:10 6906 /root/dotnet/dotnet
00021000-00022000 r--p 00011000 00:10 6906 /root/dotnet/dotnet
00022000-00023000 rw-p 00012000 00:10 6906 /root/dotnet/dotnet
00023000-001c6000 rw-p 00000000 00:00 0 [heap]
a545c000-a545d000 ---p 00000000 00:00 0
...
But how can I relate this address back to a line of code? I have tried to run gdb -p 525
but I am getting the error
warning: Unable to find libthread_db matching inferior's thread library, thread debugging will not be available.
Checking the libpthread library:
root@arm:~/dotnet# ldd /root/dotnet/dotnet
libdl.so.2 => /lib/arm-linux-gnueabihf/libdl.so.2 (0xb6f16000)
libpthread.so.0 => /lib/arm-linux-gnueabihf/libpthread.so.0 (0xb6ef2000)
libstdc++.so.6 => /usr/lib/arm-linux-gnueabihf/libstdc++.so.6 (0xb6de6000)
libm.so.6 => /lib/arm-linux-gnueabihf/libm.so.6 (0xb6d6e000)
libgcc_s.so.1 => /lib/arm-linux-gnueabihf/libgcc_s.so.1 (0xb6d45000)
libc.so.6 => /lib/arm-linux-gnueabihf/libc.so.6 (0xb6c57000)
/lib/ld-linux-armhf.so.3 (0xb6f29000)
My .gdbinit file:
root@arm:~/dotnet# cat /root/.gdbinit
set auto-load safe-path /
set libthread-db-search-path /lib/arm-linux-gnueabihf
set env LD_PRELOAD /lib/arm-linux-gnueabihf/libpthread.so.0
Therefore where
or bt
does not work in gdb:
(gdb) where
#0 0xb6f56344 in pthread_getattr_default_np (out=0xfffffff0) at pthread_getattr_default_np.c:34
#1 0xb2bdf998 in ?? ()
Any ideas how to solve this? Thanks in advance!