[asterisk-dev] Asterisk trunk on Mac OS/X 10.5

Vadim Lebedev vadim at mbdsys.com
Sat Mar 14 13:40:09 CDT 2009


Le 14 mars 09 à 16:19, Vadim Lebedev a écrit :

>
> Le 14 mars 09 à 10:14, Russell Bryant a écrit :
>
>>
>> On Mar 13, 2009, at 6:13 PM, Vadim Lebedev wrote:
>>
>>>
>>> Le 11 mars 09 à 02:01, Russell Bryant a écrit :
>>>>
>>>
>>>> This is a known issue.  It appears to be a bug with poll() /  
>>>> select()
>>>> on OSX.  See the following bug report for details:
>>>>
>>>> http://bugs.digium.com/view.php?id=13404
>>>>
>>>
>>> I did some more debugging and see extremely strange stuff:
>>>
>>> main/poll.c is built and linked with the application,
>>> but when asterisk calls poll it goes straight to the original
>>> syscall...
>>
>> How did you go about determining that this was happening?  Did you  
>> add
>> some logging into the internal poll() or something?  It seems quite
>> strange that it would behave this way, indeed!
>>
>
>
>
> Well,   first of all i've tried set a breakpoint at poll.
> The breakpoint was installde but NEVER hit.
>
> So i've did following:
> (gdb) disass
> Dump of assembler code for function ast_el_read_char:
> 0x0001a43c <ast_el_read_char+0>:	push   %ebp
> 0x0001a43d <ast_el_read_char+1>:	mov    %esp,%ebp
> 0x0001a43f <ast_el_read_char+3>:	push   %edi
> 0x0001a440 <ast_el_read_char+4>:	push   %esi
> 0x0001a441 <ast_el_read_char+5>:	push   %ebx
> 0x0001a442 <ast_el_read_char+6>:	sub    $0x23c,%esp
> 0x0001a448 <ast_el_read_char+12>:	call   0x1a44d <ast_el_read_char+17>
> 0x0001a44d <ast_el_read_char+17>:	pop    %ebx
> 0x0001a44e <ast_el_read_char+18>:	movl   $0x0,-0x230(%ebp)
> 0x0001a458 <ast_el_read_char+28>:	mov    0x11b10f(%ebx),%edx
> 0x0001a45e <ast_el_read_char+34>:	lea    -0x28(%ebp),%eax
> 0x0001a461 <ast_el_read_char+37>:	mov    %eax,-0x238(%ebp)
> 0x0001a467 <ast_el_read_char+43>:	lea    -0x228(%ebp),%eax
> 0x0001a46d <ast_el_read_char+49>:	mov    %eax,-0x23c(%ebp)
> 0x0001a473 <ast_el_read_char+55>:	nop
> 0x0001a474 <ast_el_read_char+56>:	mov    0x11c53b(%ebx),%eax
> 0x0001a47a <ast_el_read_char+62>:	mov    %eax,-0x28(%ebp)
> 0x0001a47d <ast_el_read_char+65>:	movw   $0x1,-0x24(%ebp)
> 0x0001a483 <ast_el_read_char+71>:	test   %dl,%dl
> 0x0001a485 <ast_el_read_char+73>:	jns    0x1a5cc <ast_el_read_char 
> +400>
> 0x0001a48b <ast_el_read_char+79>:	mov    $0x1,%eax
> 0x0001a490 <ast_el_read_char+84>:	push   %esi
> 0x0001a491 <ast_el_read_char+85>:	push   $0xffffffff
> 0x0001a493 <ast_el_read_char+87>:	push   %eax
> 0x0001a494 <ast_el_read_char+88>:	pushl  -0x238(%ebp)
> 0x0001a49a <ast_el_read_char+94>:	call   0x15452b <dyld_stub_poll 
> $UNIX2003>
> 0x0001a49f <ast_el_read_char+99>:	add    $0x10,%esp
> 0x0001a4a2 <ast_el_read_char+102>:	test   %eax,%eax
> 0x0001a4a4 <ast_el_read_char+104>:	js     0x1a5f8 <ast_el_read_char 
> +444>
> 0x0001a4aa <ast_el_read_char+110>:	mov    0x11b10f(%ebx),%edx
> 0x0001a4b0 <ast_el_read_char+116>:	test   %dl,%dl
> 0x0001a4b2 <ast_el_read_char+118>:	js     0x1a4bf <ast_el_read_char 
> +131>
> 0x0001a4b4 <ast_el_read_char+120>:	cmpw   $0x0,-0x1a(%ebp)
> 0x0001a4b9 <ast_el_read_char+125>:	jne    0x1a7e0 <ast_el_read_char 
> +932>
> 0x0001a4bf <ast_el_read_char+131>:	cmpw   $0x0,-0x22(%ebp)
> 0x0001a4c4 <ast_el_read_char+136>:	je     0x1a474 <ast_el_read_char 
> +56>
> 0x0001a4c6 <ast_el_read_char+138>:	push   %esi
> 0x0001a4c7 <ast_el_read_char+139>:	push   $0x1ff
> 0x0001a4cc <ast_el_read_char+144>:	pushl  -0x23c(%ebp)
> 0x000
>
>

This quick and dirty patch seems to solve the issue...
Another  way to do it may be to compile main/poll.c as  shared lib    
and use DYLD_INSERT_LIBRARIES  mechanism (equivalent of LD_PRELOAD)


Thanks
Vadim

-------------- next part --------------
An HTML attachment was scrubbed...
URL: http://lists.digium.com/pipermail/asterisk-dev/attachments/20090314/ae6bdbde/attachment.htm 


More information about the asterisk-dev mailing list