tech-kern archive

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index][Old Index]

Re: Porting Corosync/Pacemaker - Help needed with gdb



Ok, this still explains why the instruction leads to a SIGSEGV. What I don´t understand is why gdb finds a valid pointer to pthread_mutex_t:

----8<-----
Core was generated by `corosync'.
Program terminated with signal 11, Segmentation fault.
#0  0x00007f7ff68078e9 in pthread_mutex_lock () from /usr/lib/libpthread.so.1
(gdb) bt
#0  0x00007f7ff68078e9 in pthread_mutex_lock () from /usr/lib/libpthread.so.1
#1  0x00007f7ff7002e14 in ipc_thread_active (conn=0x7f7ff7391000) at coroipcs.c:466
#2  pthread_ipc_consumer (conn=0x7f7ff7391000) at coroipcs.c:675
#3  0x00007f7ff6809d75 in ?? () from /usr/lib/libpthread.so.1
#4  0x00007f7ff60759f0 in ___lwp_park50 () from /usr/lib/libc.so.12
#5  0x00007f7feb400000 in ?? ()
#6  0x00007f7ff7ec0540 in ?? ()
#7  0x0000000111110001 in ?? ()
#8  0x0000000033330003 in ?? ()
#9  0x0000000000000000 in ?? ()
(gdb) frame 1
#1  0x00007f7ff7002e14 in ipc_thread_active (conn=0x7f7ff7391000) at coroipcs.c:466
466             pthread_mutex_lock (&conn_info->mutex);
(gdb) print &conn_info->mutex
$1 = (pthread_mutex_t *) 0x7f7ff7391050
(gdb) p *$
$2 = {ptm_magic = 858980355, ptm_errorcheck = 0 '\000', ptm_pad1 = "\000\000", ptm_interlock = 0 '\000', ptm_pad2 = "\000\000", ptm_owner = 0x0,
  ptm_waiters = 0x0, ptm_recursed = 0, ptm_spare2 = 0x0}

--------------------
The disassemly of the pthread_mutex_lock function (till the instruction that causes the crash) is this:

--------8<--------
(gdb) x/2i 0x00007f7ff68078e0
   0x7f7ff68078e0 <pthread_mutex_lock>: mov    %fs:0x0,%rax
=> 0x7f7ff68078e9 <pthread_mutex_lock+9>:       mov    0x10(%rax),%rdx


---------------

I´m not sure what these instructions are supposed to do - i guess they should work on the parameter.

Any idea how I can track this down?






2012/12/5 Manuel Bouyer <bouyer%antioche.eu.org@localhost>
On Wed, Dec 05, 2012 at 02:21:51PM +0100, Stephan wrote:
> Hi Manuel,
>
> thanks, that makes sense. The failing instruction is this one
>
> => 0x7f7ff68078e9 <pthread_mutex_lock+9>:       mov    0x10(%rax),%rdx
>
> with rax containing a pointer to 0x7f7ffffffffe
>
> I wonder how many bytes will be written to memory - my imagination is 8
> bytes as this is a 64bit processor.

No, with mov this will be 4 bytes (an int). For a movl would do a 8 bytes
write.

--
Manuel Bouyer <bouyer%antioche.eu.org@localhost>
     NetBSD: 26 ans d'experience feront toujours la difference
--



Home | Main Index | Thread Index | Old Index