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


On Sat, Jun 09, 2007 at 01:16:12AM +0200, Ulrich Weigand wrote:
> Hello,
> 
> the builtin_type structure does not contain the builtin types that
> are supposedly independent of the gdbarch.  However, as already
> noted in comments in gdbtypes.c, this isn't really true: those types
> contain pointer_type and reference_type fields caching pointer and
> reference types to those base types -- and those will always be
> platform-dependent.  Thus the base types must be treated as
> platform-dependent as well.
> 
> This patch adds all those missing types to the builtin_type structure.

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 *.

-- 
Daniel Jacobowitz
CodeSourcery


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