OpenCores
URL https://opencores.org/ocsvn/openrisc_me/openrisc_me/trunk

Subversion Repositories openrisc_me

[/] [openrisc/] [trunk/] [gnu-src/] [gdb-7.1/] [gdb/] [or32-tdep.c] - Diff between revs 227 and 244

Go to most recent revision | Show entire file | Details | Blame | View Log

Rev 227 Rev 244
Line 576... Line 576...
                    int             regnum)
                    int             regnum)
{
{
  static char *or32_gdb_reg_names[OR32_TOTAL_NUM_REGS] =
  static char *or32_gdb_reg_names[OR32_TOTAL_NUM_REGS] =
    {
    {
      /* general purpose registers */
      /* general purpose registers */
      "gpr0",  "gpr1",  "gpr2",  "gpr3",  "gpr4",  "gpr5",  "gpr6",  "gpr7",
      "r0",  "r1",  "r2",  "r3",  "r4",  "r5",  "r6",  "r7",
      "gpr8",  "gpr9",  "gpr10", "gpr11", "gpr12", "gpr13", "gpr14", "gpr15",
      "r8",  "r9",  "r10", "r11", "r12", "r13", "r14", "r15",
      "gpr16", "gpr17", "gpr18", "gpr19", "gpr20", "gpr21", "gpr22", "gpr23",
      "r16", "r17", "r18", "r19", "r20", "r21", "r22", "r23",
      "gpr24", "gpr25", "gpr26", "gpr27", "gpr28", "gpr29", "gpr30", "gpr31",
      "r24", "r25", "r26", "r27", "r28", "r29", "r30", "r31",
 
 
      /* previous program counter, next program counter and status register */
      /* previous program counter, next program counter and status register */
      "ppc",   "npc",   "sr"
      "ppc",   "npc",   "sr"
 
 
      /* Floating point and vector registers may appear as pseudo registers in
      /* Floating point and vector registers may appear as pseudo registers in
Line 756... Line 756...
 
 
}       /* or32_register_reggroup_p() */
}       /* or32_register_reggroup_p() */
 
 
 
 
/*----------------------------------------------------------------------------*/
/*----------------------------------------------------------------------------*/
 
/*!Is this one of the registers used for passing arguments?
 
 
 
   These are r3-r8 in the API.
 
 
 
   @param[in] regnum  The register to consider
 
 
 
   @return  Non-zero (TRUE) if it is an argument register, zero (FALSE)
 
            otherwise.                                                        */
 
/*----------------------------------------------------------------------------*/
 
static int
 
or32_is_arg_reg (unsigned int  regnum)
 
{
 
  return (OR32_FIRST_ARG_REGNUM <= regnum) && (regnum <= OR32_LAST_ARG_REGNUM);
 
 
 
}       /* or32_is_arg_reg () */
 
 
 
 
 
/*----------------------------------------------------------------------------*/
 
/*!Is this a callee saved register?
 
 
 
   These are r10, r12, r14, r16, r18, r20, r22, r24, r26, r28 and r30 in the
 
   API.
 
 
 
   @param[in] regnum  The register to consider
 
 
 
   @return  Non-zero (TRUE) if it is a callee saved register, zero (FALSE)
 
            otherwise.                                                        */
 
/*----------------------------------------------------------------------------*/
 
static int
 
or32_is_callee_saved_reg (unsigned int  regnum)
 
{
 
  return (OR32_FIRST_SAVED_REGNUM <= regnum) && (0 == regnum % 2);
 
 
 
}       /* or32_is_callee_saved_reg () */
 
 
 
 
 
/*----------------------------------------------------------------------------*/
/*!Skip a function prolog
/*!Skip a function prolog
 
 
   If the input address, PC, is in a function prologue, return the address of
   If the input address, PC, is in a function prologue, return the address of
   the end of the prologue, otherwise return the input  address.
   the end of the prologue, otherwise return the input  address.
 
 
   @see For details of the stack frame, see the function
   @see For details of the stack frame, see the function
   or32_frame_cache().
   or32_frame_cache().
 
 
 
   @note The old version of this function used to use skip_prologue_using_sal
 
         to skip the prologue without checking if it had actually worked. It
 
         doesn't for STABS, so we had better check for a valid result.
 
 
   This function reuses the helper functions from or32_frame_cache() to
   This function reuses the helper functions from or32_frame_cache() to
   locate the various parts of the prolog, any or all of which may be missing.
   locate the various parts of the prolog, any or all of which may be missing.
 
 
   @param[in] gdbarch  The GDB architecture being used
   @param[in] gdbarch  The GDB architecture being used
   @param[in] pc       Current program counter
   @param[in] pc       Current program counter
 
 
   @return  The address of the end of the prolog if the PC is in a function
   @return  The address of the end of the prolog if the PC is in a function
            prologue, otherwise the input  address.                           */
            prologue, otherwise the input  address.                           */
/*----------------------------------------------------------------------------*/
/*----------------------------------------------------------------------------*/
 
 
static CORE_ADDR
static CORE_ADDR
or32_skip_prologue (struct gdbarch *gdbarch,
or32_skip_prologue (struct gdbarch *gdbarch,
                    CORE_ADDR       pc)
                    CORE_ADDR       pc)
{
{
  CORE_ADDR     addr;
  CORE_ADDR     addr;
Line 787... Line 827...
  int           simm;
  int           simm;
 
 
  int           frame_size = 0;
  int           frame_size = 0;
 
 
  /* Try using SAL first if we have symbolic information available. */
  /* Try using SAL first if we have symbolic information available. */
  if (find_pc_partial_function (pc, NULL, NULL, NULL))
  /* if (find_pc_partial_function (pc, NULL, NULL, NULL)) */
    {
  /*   { */
      CORE_ADDR  prologue_end = skip_prologue_using_sal( gdbarch, pc );
  /*     CORE_ADDR  prologue_end = skip_prologue_using_sal( gdbarch, pc ); */
 
 
      return  (prologue_end > pc) ? prologue_end : pc;
  /*     if (0 != prologue_end) */
    }
  /*    { */
 
  /*      return  (prologue_end > pc) ? prologue_end : pc; */
 
  /*    } */
 
  /*   } */
 
 
  /* Look to see if we can find any of the standard prologue sequence. All
  /* Look to see if we can find any of the standard prologue sequence. All
     quite difficult, since any or all of it may be missing. So this is just a
     quite difficult, since any or all of it may be missing. So this is just a
     best guess! */
     best guess! */
  addr = pc;                            /* Where we have got to */
  addr = pc;                            /* Where we have got to */
Line 835... Line 878...
    {
    {
      addr += OR32_INSTLEN;
      addr += OR32_INSTLEN;
      inst  = or32_fetch_instruction (gdbarch, addr);
      inst  = or32_fetch_instruction (gdbarch, addr);
    }
    }
 
 
  /* Look for callee-saved register being saved. The register must be one
  /* Look for arguments or callee-saved register being saved. The register
     of the 10 callee saved registers (r10, r12, r14, r16, r18, r20, r22,
     must be one of the arguments (r3-r8) or the 10 callee saved registers
     r24, r26, r28, r30).*/
     (r10, r12, r14, r16, r18, r20, r22, r24, r26, r28, r30). The base
 
     register must be the FP (for the args) or the SP (for the callee_saved
 
     registers). */
  while (1)
  while (1)
    {
    {
      if (or32_analyse_l_sw (inst, &simm, &ra, &rb) &&
      if (or32_analyse_l_sw (inst, &simm, &ra, &rb) &&
          (OR32_SP_REGNUM == ra) && (rb >= OR32_FIRST_SAVED_REGNUM) &&
          (((OR32_FP_REGNUM == ra) && or32_is_arg_reg (rb)) ||
          (0 == rb % 2) && (simm >= 0) && (0 == (simm % 4)))
           ((OR32_SP_REGNUM == ra) && or32_is_callee_saved_reg (rb))) &&
 
          (0 == (simm % 4)))
        {
        {
          addr += OR32_INSTLEN;
          addr += OR32_INSTLEN;
          inst  = or32_fetch_instruction (gdbarch, addr);
          inst  = or32_fetch_instruction (gdbarch, addr);
        }
        }
      else
      else
Line 1246... Line 1292...
     we won't have a frame. */
     we won't have a frame. */
  this_sp = (NULL == this_frame) ? 0 :
  this_sp = (NULL == this_frame) ? 0 :
                                   get_frame_register_unsigned (this_frame,
                                   get_frame_register_unsigned (this_frame,
                                                                OR32_SP_REGNUM);
                                                                OR32_SP_REGNUM);
 
 
  /* The frame base of THIS frame is its stack pointer. This is the same
  /* The frame base of THIS frame (for ID purposes only - frame base is an
     whether we are frameless or not. */
     overloaded term) is its stack pointer. This is the same whether we are
 
     frameless or not. */
  trad_frame_set_this_base (info, this_sp);
  trad_frame_set_this_base (info, this_sp);
 
 
  /* The default is to find the PC of the PREVIOUS frame in the link register
  /* The default is to find the PC of the PREVIOUS frame in the link register
     of this frame. This may be changed if we find the link register was saved
     of this frame. This may be changed if we find the link register was saved
     on the stack. */
     on the stack. */
Line 1344... Line 1391...
             previous information about finding the PC in the link
             previous information about finding the PC in the link
             register. */
             register. */
          trad_frame_set_reg_addr (info, OR32_NPC_REGNUM, this_sp + simm);
          trad_frame_set_reg_addr (info, OR32_NPC_REGNUM, this_sp + simm);
        }
        }
 
 
      /* Look for callee-saved register being save. The register must be one
      /* Look for arguments or callee-saved register being saved. The register
         of the 10 callee saved registers (r10, r12, r14, r16, r18, r20, r22,
         must be one of the arguments (r3-r8) or the 10 callee saved registers
         r24, r26, r28, r30).*/
         (r10, r12, r14, r16, r18, r20, r22, r24, r26, r28, r30). The base
 
         register must be the FP (for the args) or the SP (for the
 
         callee_saved registers). */
      while (addr < end_addr)
      while (addr < end_addr)
        {
        {
          if (or32_analyse_l_sw (inst, &simm, &ra, &rb) &&
          if (or32_analyse_l_sw (inst, &simm, &ra, &rb) &&
              (OR32_SP_REGNUM == ra) && (rb >= OR32_FIRST_SAVED_REGNUM) &&
              (((OR32_FP_REGNUM == ra) && or32_is_arg_reg (rb)) ||
              (0 == rb % 2) && (simm >= 0) && (0 == (simm % 4)))
               ((OR32_SP_REGNUM == ra) && or32_is_callee_saved_reg (rb))) &&
 
              (0 == (simm % 4)))
            {
            {
              addr += OR32_INSTLEN;
              addr += OR32_INSTLEN;
              inst  = or32_fetch_instruction (gdbarch, addr);
              inst  = or32_fetch_instruction (gdbarch, addr);
 
 
              /* The register in the PREVIOUS frame can be found at this
              /* The register in the PREVIOUS frame can be found at this
Line 1463... Line 1513...
/*!Return the base address of the frame
/*!Return the base address of the frame
 
 
   The implementations has changed since GDB 6.8, since we are now provided
   The implementations has changed since GDB 6.8, since we are now provided
   with the address of THIS frame, rather than the NEXT frame.
   with the address of THIS frame, rather than the NEXT frame.
 
 
   For the OR32, the base address is defined to be the stack pointer.
   For the OR32, the base address is the frame pointer
 
 
   @param[in] this_frame      The current stack frame.
   @param[in] this_frame      The current stack frame.
   @param[in] prologue_cache  Any cached prologue for THIS function.
   @param[in] prologue_cache  Any cached prologue for THIS function.
 
 
   @return  The frame base address */
   @return  The frame base address */
Line 1475... Line 1525...
 
 
static CORE_ADDR
static CORE_ADDR
or32_frame_base_address (struct frame_info  *this_frame,
or32_frame_base_address (struct frame_info  *this_frame,
                         void              **prologue_cache)
                         void              **prologue_cache)
{
{
  return  (CORE_ADDR) get_frame_register_unsigned (this_frame, OR32_SP_REGNUM);
  return  (CORE_ADDR) get_frame_register_unsigned (this_frame, OR32_FP_REGNUM);
 
 
}       /* or32_frame_base_address() */
}       /* or32_frame_base_address() */
 
 
 
 
/* -------------------------------------------------------------------------- */
/* -------------------------------------------------------------------------- */

powered by: WebSVN 2.1.0

© copyright 1999-2024 OpenCores.org, equivalent to Oliscience, all rights reserved. OpenCores®, registered trademark.