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: [Patch, microblaze]: Port of Linux gdbserver


On 09/16/2014 07:41 AM, Ajit Kumar Agarwal wrote:
>>> >>This is identical to microblaze-with-stack-protect.c.  Both specify tdesc_create_feature (result, "org.gnu.gdb.microblaze.core");
>>> >>Why is this needed?
> This is needed as gdbserver code expects the register pc as "pc" instead of "rpc" for baremetel. The microblaze-linux-core.xml is changed from "rpc" to "pc" for gdbserver code to work.

This doesn't make much sense to me.  Can you expand please?  Why would
you want the register to be named differently on Linux?  We've
defined the org.gnu.gdb.microblaze.core with "rpc", presumably because
that's what the architecture calls that core register.

Not reporting all the registers with the exact names GDB reports
should be making GDB consider the description invalid.  Aren't you
seeing that happen?

/me looks at code

Oh, microblaze_gdbarch_init is incomplete...

  /* Check any target description for validity.  */
  if (tdesc_has_registers (tdesc))
    {
      const struct tdesc_feature *feature;
      int valid_p;
      int i;

      feature = tdesc_find_feature (tdesc,
                                    "org.gnu.gdb.microblaze.core");
      if (feature == NULL)
        return NULL;
      tdesc_data = tdesc_data_alloc ();

      valid_p = 1;
      for (i = 0; i < MICROBLAZE_NUM_CORE_REGS; i++)
        valid_p &= tdesc_numbered_register (feature, tdesc_data, i,
                                            microblaze_register_names[i]);
      feature = tdesc_find_feature (tdesc,
                                    "org.gnu.gdb.microblaze.stack-protect");
      if (feature != NULL)
        {
          valid_p = 1;
          valid_p &= tdesc_numbered_register (feature, tdesc_data,
                                              MICROBLAZE_SLR_REGNUM,
                                              "rslr");
          valid_p &= tdesc_numbered_register (feature, tdesc_data,
                                              MICROBLAZE_SHR_REGNUM,
                                              "rshr");
        }
     }

Note nothing is done with valid_p.  It's write-only.  Compare with
other ports, like arm-tdep.c or mips-tdep.c.

Thanks,
Pedro Alves


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