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



It seems that the parameter (adress of conn_info->mutex) is passed
through the %rdi register (though I thought that arguments are passed
via stack):

---------8<-----------------
(gdb) frame 1
#1  0x00007f7ff7002e14 in ipc_thread_active (conn=0x7f7ff7391000) at
coroipcs.c:465
465             pthread_mutex_lock (&conn_info->mutex);
(gdb) print &conn_info->mutex
$1 = (pthread_mutex_t *) 0x7f7ff7391050
(gdb) info registers
rax            0x7f7ffffffffe   140187732541438
rbx            0x7f7ff7391000   140187585286144
rcx            0x7f7ff603962a   140187565004330
rdx            0x0      0
rsi            0x7f7feffffd80   140187464105344
rdi            0x7f7ff7391050   140187585286224
rbp            0x7f7ff73910c0   0x7f7ff73910c0
rsp            0x7f7feffffcc0   0x7f7feffffcc0
r8             0x7f7fefc02000   140187459919872
r9             0x3fe000 4186112
r10            0x7f7ff60390ca   140187565002954
r11            0x246    582
r12            0x7f7feffffd60   140187464105312
r13            0x7f7ff7391008   140187585286152
r14            0x7f7ff7391050   140187585286224
r15            0x0      0
rip            0x7f7ff7002e14   0x7f7ff7002e14 <pthread_ipc_consumer+228>
eflags         0x10213  [ CF AF IF RF ]
cs             0x1f     31
ss             0x17     23
ds             0x17     23
es             0x17     23
fs             0x0      0
gs             0x0      0

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

The lock instruction in __libc_mutex_trylock() works on %rdi:

------8<----------
0000000000007920 <__libc_mutex_trylock>:
    7920:       64 48 8b 04 25 00 00    mov    %fs:0x0,%rax
    7927:       00 00
    7929:       48 8b 48 10             mov    0x10(%rax),%rcx
    792d:       31 d2                   xor    %edx,%edx
    792f:       48 89 d0                mov    %rdx,%rax
    7932:       f0 48 0f b1 4f 10       lock cmpxchg %rcx,0x10(%rdi)
------------------

The question is what the first 2 mov instructions are supposed to do.
What is %rax supposed to point to?

I think either %rax is corrupted or there is an issue with the stack limit.





2012/12/7 Masao Uebayashi <uebayasi%gmail.com@localhost>:
> I wonder if &conn_info->mutex is *really* passed to pthread_mutex_lock()?
> I'd disassemble ipc_thread_active() and see if &conn_info->mutex is *really*
> set to %rax when pthread_mutex_lock() is called.


Home | Main Index | Thread Index | Old Index