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?


> Was that really so hard?  And it's a lot clearer.

Well, it's not really that hard.  I'm just being grumpy because it's snowing
outside and I really want to get this stuff committed one of these days.
I'd already done that to our i386 stuff both to remove the dependency on the
structure and to account for our weird ordering of registers.  See snippet
below:

Kris

/* Why 13?  Look in our debug.h header at the x86_cpu_registers structure
   and you'll see an 'exx' junk register that is just filler.  Don't ask
   me, ask the kernel guys.  */
#define NUM_GPREGS 13

/* Map a GDB register number to an offset in the reg structure.  */
static int regmap[] = {
  (7 * 4),   /* %eax */
  (6 * 4),   /* %ecx */
  (5 * 4),   /* %edx */
  (4 * 4),   /* %ebx */
  (11 * 4),   /* %esp */
  (2 * 4),   /* %epb */
  (1 * 4),   /* %esi */
  (0 * 4),   /* %edi */
  (8 * 4),   /* %eip */
  (10 * 4),   /* %eflags */
  (9 * 4),   /* %cs */
  (12 * 4),   /* %ss */
  (-1 * 4)   /* filler */
};

/* Perform mapping of gdb registers onto Neutrino registers.
   Actually works in reverse too which is why we make sure to
   return -1 if we're out of range.  */
int
gdb_to_os (int regno)
{
  return (regno >= 0 && regno < NUM_GPREGS) ? regmap[regno] >> 2 : -1;
}

void
nto_supply_gregset (char *gpregs)
{
  unsigned regno;

  for (regno = 0; regno < NUM_GPREGS - 1; regno++)
    {
      supply_register (regno, gpregs + regmap[regno]);
    }
}



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