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: [5/10] Add "explicit size" types to builtin_type


Daniel Jacobowitz wrote:

> This one may be a problem.  From tdesc_named_type:
> 
>   /* Next try some predefined types.  Note that none of these types
>      depend on the current architecture; some of the builtin_type_foo
>      variables are swapped based on the architecture.  */
>   if (strcmp (id, "int8") == 0)
>     return builtin_type_int8;
> 
> This function is returning types for register values, before we have
> constructed the corresponding gdbarch.  We'll now grab them from some
> other random gdbarch (of course, we were sort of doing that before,
> but it worked - in practice these types are never used anywhere that
> their address can be taken).
> 
> I wonder if we could fix this by moving the pointer and reference type
> caches out of the types themselves, and into per-architecture data?
> Or perhaps use tables based only on the pointer size and other
> attributes; they do not really need to be per-architecture, just
> cached.  An i386 and i686 can use the same void *.

Hmmm.  One thing I liked about the approach in my patch was that
it in effect made *all* types gdbarch-specific.  This would have
allowed in the end to implement something like a get_type_arch ()
routine, which could be quite useful to push references to
current_gdbarch out of the symbol parts of the debugger (where
we often do not have a local gdbarch / frame / regcache argument,
but where we typically operate on types or values).

If we have genuinely architecture-independent types, a routine
like lookup_pointer_type cannot be implemented without reference
to a global current_gdbarch (unless it receives an explicit
gdbarch argument and all callers are modified) ...

Bye,
Ulrich

-- 
  Dr. Ulrich Weigand
  GNU Toolchain for Linux on System z and Cell BE
  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]