This is the mail archive of the gdb@sourceware.org mailing list for the GDB project.


Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]
Other format: [Raw text]

Unwinder API


Hi,
 I have some questions regarding the use of the unwinder API added with
7.10. I am attempting to use gdb to debug a program that is a mix of
regular C and JITted code. The JIT when moving between managed and
unmanaged code does some unconventional things with the stack which
prevents gdb from using its regular heuristics successfully.

Here is a backtrace without the use of my stacktrace.py program:

#0  pthread_cond_timedwait@@GLIBC_2.3.2 () at
../sysdeps/unix/sysv/linux/x86_64/pthread_cond_timedwait.S:238
#1  0x000000000062db67 in mono_cond_timedwait_ms (cond=cond@entry=0x971f00
<sleep_cond>, 
    mutex=mutex@entry=0x971f40 <sleep_mutex>,
timeout_ms=timeout_ms@entry=5000) at mono-mutex.c:181
#2  0x0000000000635d89 in sleep_interruptable (alerted=0x7ffed1525d1c,
ms=5000) at mono-threads.c:1195
#3  mono_thread_info_sleep (ms=ms@entry=5000,
alerted=alerted@entry=0x7ffed1525d1c) at mono-threads.c:1227
#4  0x000000000058ef46 in ves_icall_System_Threading_Thread_Sleep_internal
(ms=5000) at threads.c:1183
#5  0x0000000041ec4f42 in ?? ()
#6  0x00007ffed1526180 in ?? ()
#7  0x00000000029303d0 in ?? ()
#8  0x0000000000000000 in ?? ()


After invoking my stack trace program I am able to detect the stack of the
JIT and provide the unwind information back to gdb. However, it does not
replace the frame that the heuristics of gdb has determined so I get a mix
of the frames that I have unwound intermingled with those of gdb. I call
create_unwind_info() using the original SP and IP as they were provided
when the method is invoked.

#0  0x00007fa205b05149 in pthread_cond_timedwait@@GLIBC_2.3.2 ()
    at ../sysdeps/unix/sysv/linux/x86_64/pthread_cond_timedwait.S:238
#1  0x000000000062db67 in mono_cond_timedwait_ms (cond=cond@entry=0x971f00
<sleep_cond>, mutex=mutex@entry=0x971f40 <sleep_mutex>,
timeout_ms=timeout_ms@entry=5000) at mono-mutex.c:181
#2  0x0000000000635d89 in sleep_interruptable (alerted=0x7ffed1525d1c,
ms=5000) at mono-threads.c:1195
#3  0x0000000000635d89 in mono_thread_info_sleep (ms=ms@entry=5000,
alerted=alerted@entry=0x7ffed1525d1c)
    at mono-threads.c:1227
#4  0x000000000058ef46 in ves_icall_System_Threading_Thread_Sleep_internal
(ms=5000) at threads.c:1183
#5  0x0000000041ec4f42 in [wrapper -
managed-to-native]:System.Threading.Thread.SleepInternal(int) ()
#6  0x00007fa202898517 in System_Threading_Thread_Sleep_int
(millisecondsTimeout=5000)
    at 
/root/mono/external/referencesource/mscorlib/system/threading/thread.cs:738
#7  0x0000000041ec2f3d in Class1.Inner6() ()
#8  0x00007ffed1525e90 in Symbol not defined to Mono ()
#9  0x0000000041ec2eec in Class1.Inner5() ()
#10 0x00007ffed1525e90 in Symbol not defined to Mono ()
#11 0x0000000041ec2ecc in Class1.Inner4() ()
#12 0x00007ffed1525e90 in Symbol not defined to Mono ()
#13 0x0000000041ec2eac in Class1.Inner3() ()
#14 0x00007ffed1525e90 in Symbol not defined to Mono ()
#15 0x0000000041ec2e8c in Class1.Inner2() ()
#16 0x00007ffed1525e90 in Symbol not defined to Mono ()
#17 0x0000000041ec2e6c in Class1.Inner1() ()
#18 0x00007ffed1525e90 in Symbol not defined to Mono ()
#19 0x0000000041ec2d5c in Class1.Main() ()
#20 0x00000000028ca088 in Symbol not defined to Mono ()
#21 0x0000000041ec2e2b in [wrapper -
runtime-invoke]:System.Object.runtime_invoke_void(object, long, long,
long) ()
#22 0x0000000000007fa2 in Undefined - low-core ()
Python Exception <class 'gdb.MemoryError'> Cannot access memory at address
0x647df500000000: 
#23 0x00647df500000000 in #24 0x0000000000000000 in Undefined - low-core ()


Am I able to delete/replace the frame as determined by gdb when I detect
one of the JIT? Is it a case of calling create_unwind_info with different
parameters?

TIA, Neale


Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]