This is the mail archive of the
libc-alpha@sources.redhat.com
mailing list for the glibc project.
Re: ptrace for mips n32 and n64
On Fri, Mar 14, 2003 at 12:39:29PM -0300, Alexandre Oliva wrote:
> On Mar 14, 2003, Daniel Jacobowitz <drow at mvista dot com> wrote:
>
> > On Fri, Mar 14, 2003 at 11:35:42AM -0300, Alexandre Oliva wrote:
> >> Yay. Lots of code duplication. I'm sure Uli will love this patch.
> >> :-/ Ok? (the point being that ptrace must take as argument and return
> >> 64-bit values on n32)
>
> > Why must it?
>
> Because that's the ABI defined by the kernel, as much as I dislike
> it. Of course, glibc could adapt the interface and return longs even
> though the kernel gives it a long long, and pass a long long where it
> gets just a long. I don't know much about the interface of ptrace,
> anyway. I just did what Kevin told me he needed for his debugging
> code to work.
Kevin, mind enlightening me? I don't see how this works, either in
principle or with the mips64-linux port as contributed to GDB.
> > I can't think of any reason for it to take 64-bit
> > values. It'll also be a tremendous headache, since you'll have to cast
> > any pointers passed to ptrace.
>
> If you pass a pointer to ptrace, it will be sign-extended to 64 bits,
> just as it should. No hassle.
Eh? No it won't. ptrace is exported as a varargs function. Think
about what happens when you pass a 32-bit pointer to a varargs function
that pops a long long argument. It'll die flaming death. GDB's been
full of this kind of bug historically.
--
Daniel Jacobowitz
MontaVista Software Debian GNU/Linux Developer