Re: [m68k] res_init segfault, need help debugging
On Sun, Jan 30, 2011 at 08:31:44PM +0000, Thorsten Glaser wrote:
> Dixi quod…
>
> >ara2:~# cat >x.c
> >#include <netinet/in.h>
> >#include <arpa/nameser.h>
> >#include <resolv.h>
> >
> >int
> >main(void)
> >{
> > return (res_init());
> >}
> >ara2:~# gcc x.c
> >ara2:~# ./a.out
> >Segmentation fault
>
> >Basically, the segfault is on accessing _res.retrans
> >in line 67 (first access of _res)
>
> Now, _res is at 0xc014ce58 and the code in question is:
>
> 0xc00f1eb4 <__res_init>: linkw %fp,#0
> 0xc00f1eb8 <__res_init+4>: moveml %d2-%d5/%a2/%a5,%sp@-
> 0xc00f1ebc <__res_init+8>: lea %pc@(0xc0148000),%a5
> 0xc00f1ec4 <__res_init+16>: movel %a5,%d5
> 0xc00f1ec6 <__res_init+18>: addil #9916,%d5
> 0xc00f1ecc <__res_init+24>: movel %d5,%sp@-
> 0xc00f1ece <__res_init+26>: movel %d5,%sp@
> 0xc00f1ed0 <__res_init+28>: bsrl 0xc0040aa0 <__tls_get_addr@plt>
> 0xc00f1ed6 <__res_init+34>: addql #4,%sp
> => 0xc00f1ed8 <__res_init+36>: moveal %a0@,%a2
a0 is the plt addre returned by bsrl 0xc0040aa0 and obviously does not
point to a valid address.
> If I read that right, it’s the equivalent of: mov a2,dword ptr [a0]
a0=tls_get_addr@plt(...)
a2=*(a0)
in c-like pseudocode, but I do not know enough to make sense of the args to
tls_get_addr@plt.
Richard
---
Name and OpenPGP keys available from pgp key servers
Reply to: