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

Re: gdbserver for arm-linux


Mark,

My only comment regarding your gdbserver patches for arm-linux is that
it's rather disconcerting to see two versions of fetch_inferior_registers()
and store_inferior_registers().  (One which is arm specifc and the other
which is generic.)

I wonder if it'd be possible to make the arm versions of these functions
more generic so that they'd be useful by other architectures for
fetching/storing registers that need to use to use ptrace facilities
other than PTRACE_PEEKUSER/PTRACE_POKEUSER?

E.g, maybe something like this:

fetch_inferior_registers (int regno)
{
  int rlimit;
  int init_state = 1;

  if (regno == -1 || regno == 0)
    {
	regno  = 0;
	rlimit = NUM_REGS;
    }
  else
    rlimit = regno+1;

  while (regno < rlimit)
    {
      if (!arch_fetch_register (&init_state, regno))
	fetch_register (regno);
      regno++;
    }
}

Then for ARM, you could define the following:

int
arch_fetch_register (int *initstate, int regno)
{
  static int gotfp;

  if (*initstate)
    {
      gotfp = 0;
      *initstate = 0;
    }

  if ((regno >= F0_REGNUM) || (regno <= FPS_REGNUM))
    {
      if (!gotfp)
	{
	  fetch_fpregs ();
	  gotfp = 1;
	}
      return 1;
    }

  return 0;
}

The other architectures which don't have special needs could then
simply define:

int
arch_fetch_register (int *initstate, int regno)
{
  return 0;
}

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