gdb-automatic-deadlock-detector icon indicating copy to clipboard operation
gdb-automatic-deadlock-detector copied to clipboard

Got Error : No symbol "mutex" in current context

Open PRDinesh opened this issue 8 years ago • 2 comments

When I tried using this script I got the following error


Displaying blocking threads using 'blocked' command Python Exception <class 'gdb.error'> No symbol "mutex" in current context.: Error occurred in Python command: No symbol "mutex" in current context.

Is this because of my pthread library? do we have any solution for the same?

PRDinesh avatar Apr 27 '17 17:04 PRDinesh

Hard to say. Could you paste output of thread apply all bt command here? Also don't you see any errors if you invoke those python commands?

python 
import gdbDisplayLockedThreads
end 

DamZiobro avatar Apr 27 '17 19:04 DamZiobro

(gdb) thread apply all bt

Thread 3 (Thread 0x7fc513d65700 (LWP 32036)): #0 0x00007fc51414254d in __lll_lock_wait () from /lib64/libpthread.so.0 #1 0x00007fc51413de9b in _L_lock_883 () from /lib64/libpthread.so.0 #2 0x00007fc51413dd68 in pthread_mutex_lock () from /lib64/libpthread.so.0 #3 0x0000000000400927 in writeTest (temp=0x0) at deadlockExample.c:15 #4 0x00007fc51413bea5 in start_thread () from /lib64/libpthread.so.0 #5 0x00007fc513e649fd in clone () from /lib64/libc.so.6

Thread 2 (Thread 0x7fc513564700 (LWP 32037)): #0 0x00007fc51414254d in __lll_lock_wait () from /lib64/libpthread.so.0 #1 0x00007fc51413de9b in _L_lock_883 () from /lib64/libpthread.so.0 #2 0x00007fc51413dd68 in pthread_mutex_lock () from /lib64/libpthread.so.0 #3 0x00000000004009d5 in readTest (temp=0x0) at deadlockExample.c:35 #4 0x00007fc51413bea5 in start_thread () from /lib64/libpthread.so.0 #5 0x00007fc513e649fd in clone () from /lib64/libc.so.6

Thread 1 (Thread 0x7fc514563740 (LWP 32035)): #0 0x00007fc51413d017 in pthread_join () from /lib64/libpthread.so.0 #1 0x0000000000400abc in main () at deadlockExample.c:60

(gdb) f 3 #3 0x00000000004009d5 in readTest (temp=0x0) at deadlockExample.c:35 35 pthread_mutex_lock(&write_mutex);

(gdb) t 3 [Switching to thread 3 (Thread 0x7fc513d65700 (LWP 32036))] #0 0x00007fc51414254d in __lll_lock_wait () from /lib64/libpthread.so.0 (gdb) f 3 #3 0x0000000000400927 in writeTest (temp=0x0) at deadlockExample.c:15 15 pthread_mutex_lock(&read_mutex);

(gdb) print mutex No symbol "mutex" in current context.

(gdb) print read_mutex $10 = {__data = {__lock = 2, __count = 0, __owner = 32037, __nusers = 1, __kind = 0, __spins = 0, __elision = 0, __list = {__prev = 0x0, __next = 0x0}}, __size = "\002\000\000\000\000\000\000\000%}\000\000\001", '\000' <repeats 26 times>, __align = 2}

gdb.execute("print mutex.__data.__owner", to_string=True).split()[2])

Is there any way to match the two mutex?

kevinbin avatar Oct 22 '21 09:10 kevinbin