This is the mail archive of the gdb-patches@sourceware.cygnus.com 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]

Re: Test for 32/64 bit object file?


Ian Lance Taylor wrote:
> 
>    Date: Wed, 17 Nov 1999 07:20:16 +1100
>    From: Andrew Cagney <ac131313@cygnus.com>
> 
>    Is there a way of determining if an object file is 32 or 64 bit?  (eg
>    elf32/elf64, aout32 vs aout64).
> 
> Why do you want to know?  I don't mean to be snide; it's just that
> that distinction usually isn't interesting.

never a silly question :-)

>    Perhaphs bfd_arch_bits_per_address(ABFD) is correct?
> 
> That will tell you whether the CPU uses 32 bits in an address or 64
> bits in an address.  It's not the same as elf32 vs. elf64, but it may
> be what you need to know.

GDB encounters situtations (c.f. assorted mips targets) where the object
file contains 32 bit addresses but the target has a 64 bit address
space.  The 32 address values being implicitly zero or sign extended to
64 bits.  GDB needs to know what the object file format assumed (or
didn't in some case) is doing so that it can correctly do things like
compares.

I also suspect that the sprintf_vma() et.al. macro's should format the
address according to the BFD object file address size rather than BFD64.

	enjoy,
		Andrew

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