This is the mail archive of the gdb-patches@sourceware.org mailing list for the GDB project.


Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]
Other format: [Raw text]

Re: [RFA/commit/ia64-linux] Allow libunwind to fetch register 0


On Tuesday 25 October 2011 21:40:52, Joel Brobecker wrote:
> Hi again Pedro,
> 
> I will make the small changes you suggested at the beginning of
> the patch. I just wanted to confirm something:
> 
> > > +      gdb_assert (sizeof (r0_value) == register_size (gdbarch, regnum));
> > > +      regcache_raw_supply (regcache, regnum, r0_value);
> > > +      return;
> > > +    }
> > > +
> > 
> > I don't speak ia64, but this is the right direction.
> > I think we should make ia64_cannot_fetch_register return true for
> > gr0 too though.
> 
> I assume that you mean that ia64_cannot_fetch_register should return
> False as well (meaning that we can in fact fetch the register - don't
> you love double negatives?). 

Bleh. :-)  Yes, I meant return false.

> I had originally interpreted the name
> of that function very strictly, meaning that, no, the kernel does
> not provide that register value, so we cannot fetch it.  But at the
> same time, I think I see you point of having the fetch_register
> routine saying we can get the value, while at the same time the
> cannot_fetch_register function says we can't.

Hmm, yeah, I looking at it from the perspective that the gdbarch
hook can be used outside the ia64 target/arch dependent code, and at
that point, it shouldn't matter if we're talking to ptrace or to
a core or to something else.  The core code calling the hook would
only be interested in knowing whether the value can be fetched or
not.  But that looks moot, as this is used to mean "ptrace can fetch
the register".

 alpha-nat.c:      if (gdbarch_cannot_fetch_register (gdbarch, regno))
 hppa-linux-nat.c:  if (gdbarch_cannot_fetch_register (gdbarch, regno))
 inf-ptrace.c:      || gdbarch_cannot_fetch_register (gdbarch, regnum))

These are all legacy, and all look broken by design to me.  I mean, what
ptrace can or not return is a target-y thing, not gdbarch thing, and
certainly the corresponding struct target can override the register
fetching hook to do the same thing.

I thought there were more uses of the hook...  where have they gone
to? :-D

Given that, I don't see reason to change the hook on ia64-linux.  In
fact, I don't think there's any need for the hook to be installed
on ia64-linux.  Oh, wait, it _isn't_ installed as a gdbarch hook,
is it?  Eh.  I'm tempted to go
s/gdbarch_cannot_fetch_register/deprecated_gdbarch_cannot_fetch_register/g. :-)

-- 
Pedro Alves


Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]