This is the mail archive of the gdb@sources.redhat.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]
Other format: [Raw text]

Re: long long considered harmful?


> I'd have to see exactly what you meant, but probably not.  These things
> have to be an exact size, right?  Barring wackiness like the 32-bit
> char platforms, which I shouldn't have brought into this.  So if you
> run on a host with 64-bit "int", it will be wrong.

It just has to be AT LEAST a certain size.  If I have:

typedef struct x86_cpu_registers
{
  unsigned edi, esi, ebp, exx, ebx, edx, ecx, eax;
  unsigned eip, cs, efl;
  unsigned esp, ss;
} X86_CPU_REGISTERS;

typedef union _debug_gregs
{
  ARM_CPU_REGISTERS arm;
  ...
  X86_CPU_REGISTERS x86;
  qnx_reg64 padding[1024];
} nto_gregset_t;

Then the padding guarantees a minimum size.  If I then calculate edi, esi,
etc.
using char offsets, the way the compiler creates the structure is completely
irrelevant.  The only reason for the structure is to maintain visible
compatability with our system headers.

I like your mips fix BTW.  I think that I'd rather have the test outside of
the
loop although it's probably not a huge gain.

static void regset_fetch (int endian, unsigned first, unsigned last,
qnx_reg64 *data)
{
  int off=endian ? 4 : 0;
  for (; first <= last; first++)
    {
      supply_register (first, (char *) &data[0][off]);
      data++;
    }
}

cheers,

Kris


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