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: [PATCH 8/8] [PowerPC] Recognize isa205 in linux core files


Pedro Franco de Carvalho wrote:

> Now I'm confused as to which target should be passed to
> target_auxv_search. It uses the target parameter for reading the auxv
> data but then it calls target_auxv_parse through the global
> target_stack.

Right, this is all a bit confused right now and really ought
to be cleaned up ...  That's something for the future, though.

> Should ppc-linux-tdep also also pass target_stack in
> core_read_description, for consistency?
> 
> Or should ppc-linux-nat be changed to pass "this"? I can do this either
> by moving ppc_linux_get_hwcap to ppc-linux-tdep.c and adding a target
> parameter, and then change all the call sites in ppc-linux-nat.c, or I
> can make ppc_linux_get_hwcap a private method of ppc_linux_nat_target
> and pass "this" inside it (which wouldn't require changing the call
> sites), and leave the bare call to target_auxv_search in
> ppc-linux-tdep.c.

The latter makes more sense to me.  Sooner or later, we want to
eliminate most uses of target_stack anyway, so if we are already
within target code, that target should be passed to subroutine
calls wherever appropriate.

> I haven't changed this in v2 yet. I did change how an error is checked
> and handled to make it more explicit.

Yes, that looks fine for now.

> And it turns out that target_auxv_search already caches the whole auxv
> for each inferior. This part could still be improved because
> ppc_linux_nat_target::auxv_parse calls ppc_linux_target_wordsize (which
> issues a ptrace call) a second time, and at the point were it is
> called the wordsize is already known, but it's not clear how to pass the
> wordsize to auxv_parse in read_description.

Probably the best solution longer term would be to cache the parameters
describing the auxv vector (size of the key, size of the data, byte order)
in struct auxv_data, have them determined once per inferior and then
re-used.  This would also allow removing most of the near-duplicate
auxv_parse overloads ...

Bye,
Ulrich

-- 
  Dr. Ulrich Weigand
  GNU/Linux compilers and toolchain
  Ulrich.Weigand@de.ibm.com


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