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: Two minor issues


On Wed, 2008-08-27 at 08:55 -0300, Dr. Rolf Jansen wrote:
> Is there a global way to find out at compile-time at the build or host  
> system the ptr-size and the long-size of the configured target  
> machine, something like size_attarget_of()?

It's not enough to do that at compile time, since some targets support
running both 32-bit and 64-bit programs (e.g., ppc64-linux). You can
check at runtime, if you have a struct gdbarch nearby:

  struct gdbarch_tdep *tdep = gdbarch_tdep (gdbarch);

  if (tdep->wordsize == 4)
    {
      ...
    }

 if (tdep->wordsize == 8)
    {
      ...
    }

-- 
[]'s
Thiago Jung Bauermann
IBM Linux Technology Center


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