OpenCores
URL https://opencores.org/ocsvn/openrisc_2011-10-31/openrisc_2011-10-31/trunk

Subversion Repositories openrisc_2011-10-31

[/] [openrisc/] [trunk/] [gnu-src/] [gdb-7.2/] [gdb/] [or32-tdep.c] - Diff between revs 330 and 522

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

Rev 330 Rev 522
Line 22... Line 22...
   You should have received a copy of the GNU General Public License along
   You should have received a copy of the GNU General Public License along
   with this program.  If not, see <http://www.gnu.org/licenses/>.  */
   with this program.  If not, see <http://www.gnu.org/licenses/>.  */
 
 
/*-----------------------------------------------------------------------------
/*-----------------------------------------------------------------------------
   This version for the OpenRISC 1000 architecture is a rewrite by Jeremy
   This version for the OpenRISC 1000 architecture is a rewrite by Jeremy
   Bennett of the old GDB 5.3 interface to make use of gdbarch for GDB 6.8.
   Bennett of the old GDB 5.3 interface to make use of gdbarch for GDB 6.8. It
 
   has since been updated for GDB 7.2.
 
 
   The code tries to follow the GDB coding style.
   The code tries to follow the GDB coding style.
 
 
   Commenting is Doxygen compatible.
   Commenting is Doxygen compatible.
 
 
 
   Notes on the GDB 7.2 version
 
   ============================
 
 
 
   The primary change is to support the new GCC 4.5.1 compiler, which no
 
   longer adds preceding underscores to global values and uses DWARF2 as its
 
   default debug format.
 
 
 
   This version now supports Or1ksim integrated as a simulator library, so
 
   "target sim" will work. It does require Or1ksim to be available as a
 
   library at configuration time, with the Or1ksim installation directory
 
   specified by the argument --with-or1ksim.
 
 
 
   The ad-hoc prologue analysis, which was always a weak point has been
 
   stripped out and replaced with code based on the generic approach in
 
   prologue-value.c and prologue-value.h.
 
 
 
   The objective with this version is to get reasonable results on regression
 
   testing. Something the older versions never achieved.
 
 
 
   Notes on the GDB 6.8 version
 
   ============================
 
 
   Much has been stripped out in the interests of getting a basic working
   Much has been stripped out in the interests of getting a basic working
   system. This is described as the OpenRISC 1000 target architecture, so
   system. This is described as the OpenRISC 1000 target architecture, so
   should work with 16, 32 and 64 bit versions of that architecture and should
   should work with 32 and 64 bit versions of that architecture and should
   work whether or not they have floating point and/or vector registers.
   work whether or not they have floating point and/or vector registers,
 
   although to date it has only been tested with the 32-bit integer
   There was never a capability to run simulator commands (no remote target
   archtiecture.
   implemented the required function), so that has been removed.
 
 
 
   The info trace command has been removed. The meaning of this is not clear -
   The info trace command has been removed. The meaning of this is not clear -
   it relies on a value in register 255 of the debug group, which is
   it relies on a value in register 255 of the debug group, which is
   undocumented.
   undocumented.
 
 
Line 576... Line 598...
                    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 */
      "r0",  "r1",  "r2",  "r3",  "r4",  "r5",  "r6",  "r7",
      "r0",  "sp",  "fp",  "r3",  "r4",  "r5",  "r6",  "r7",
      "r8",  "r9",  "r10", "r11", "r12", "r13", "r14", "r15",
      "r8",  "lr",  "r10", "r11", "r12", "r13", "r14", "r15",
      "r16", "r17", "r18", "r19", "r20", "r21", "r22", "r23",
      "r16", "r17", "r18", "r19", "r20", "r21", "r22", "r23",
      "r24", "r25", "r26", "r27", "r28", "r29", "r30", "r31",
      "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",   "pc",   "sr"
 
 
      /* Floating point and vector registers may appear as pseudo registers in
      /* Floating point and vector registers may appear as pseudo registers in
         the future. */
         the future. */
    };
    };
 
 
Line 949... Line 971...
or32_unwind_pc (struct gdbarch    *gdbarch,
or32_unwind_pc (struct gdbarch    *gdbarch,
                struct frame_info *next_frame)
                struct frame_info *next_frame)
{
{
  CORE_ADDR pc = frame_unwind_register_unsigned (next_frame, OR32_NPC_REGNUM);
  CORE_ADDR pc = frame_unwind_register_unsigned (next_frame, OR32_NPC_REGNUM);
 
 
 
  if (frame_debug)
 
    {
 
      fprintf_unfiltered (gdb_stdlog,
 
                          "or32_unwind_pc, next_frame = 0x%p, pc = 0x%p\n",
 
                          next_frame, (void *) pc);
 
    }
 
 
  return pc;
  return pc;
 
 
}       /* or32_unwind_pc() */
}       /* or32_unwind_pc() */
 
 
 
 
Line 971... Line 1000...
or32_unwind_sp (struct gdbarch    *gdbarch,
or32_unwind_sp (struct gdbarch    *gdbarch,
                struct frame_info *next_frame)
                struct frame_info *next_frame)
{
{
  CORE_ADDR sp = frame_unwind_register_unsigned (next_frame, OR32_SP_REGNUM);
  CORE_ADDR sp = frame_unwind_register_unsigned (next_frame, OR32_SP_REGNUM);
 
 
 
  if (frame_debug)
 
    {
 
      fprintf_unfiltered (gdb_stdlog,
 
                          "or32_unwind_sp, next_frame = 0x%p, sp = 0x%p\n",
 
                          next_frame, (void *) sp);
 
    }
 
 
  return sp;
  return sp;
 
 
}       /* or32_unwind_sp() */
}       /* or32_unwind_sp() */
 
 
 
 
Line 1291... Line 1327...
  int                      frame_size = 0;
  int                      frame_size = 0;
 
 
  CORE_ADDR                start_addr;
  CORE_ADDR                start_addr;
  CORE_ADDR                end_addr;
  CORE_ADDR                end_addr;
 
 
 
  if (frame_debug)
 
    {
 
      fprintf_unfiltered (gdb_stdlog,
 
                          "or32_frame_cache, prologue_cache = 0x%p\n",
 
                          *prologue_cache);
 
    }
 
 
  /* Nothing to do if we already have this info */
  /* Nothing to do if we already have this info */
  if (NULL != *prologue_cache)
  if (NULL != *prologue_cache)
    {
    {
      return *prologue_cache;
      return *prologue_cache;
    }
    }
Line 1309... Line 1352...
  find_pc_partial_function (this_pc, NULL, &start_addr, NULL);
  find_pc_partial_function (this_pc, NULL, &start_addr, NULL);
 
 
  /* Return early if GDB couldn't find the function.  */
  /* Return early if GDB couldn't find the function.  */
  if (start_addr == 0)
  if (start_addr == 0)
    {
    {
 
      if (frame_debug)
 
        {
 
          fprintf_unfiltered (gdb_stdlog, "  couldn't find function\n");
 
        }
 
 
      return  info;
      return  info;
    }
    }
 
 
  /* Get the stack pointer if we have one (if there's no process executing yet
  /* Get the stack pointer if we have one (if there's no process executing yet
     we won't have a frame. */
     we won't have a frame. */
Line 1471... Line 1519...
    }
    }
 
 
  /* Build the frame ID */
  /* Build the frame ID */
  trad_frame_set_id (info, frame_id_build (this_sp_for_id, start_addr));
  trad_frame_set_id (info, frame_id_build (this_sp_for_id, start_addr));
 
 
 
  if (frame_debug)
 
    {
 
      fprintf_unfiltered (gdb_stdlog, "  this_sp_for_id = 0x%p\n",
 
                          (void *) this_sp_for_id);
 
      fprintf_unfiltered (gdb_stdlog, "  start_addr     = 0x%p\n",
 
                          (void *) start_addr);
 
    }
 
 
  return info;
  return info;
 
 
}       /* or32_frame_cache() */
}       /* or32_frame_cache() */
 
 
 
 
Line 1558... Line 1614...
  .dealloc_cache = NULL,
  .dealloc_cache = NULL,
  .prev_arch     = NULL
  .prev_arch     = NULL
};
};
 
 
 
 
 
#if 0
/*----------------------------------------------------------------------------*/
/*----------------------------------------------------------------------------*/
/*!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.
Line 1606... Line 1663...
    };
    };
 
 
  return &or32_frame_base;
  return &or32_frame_base;
 
 
}       /* or32_frame_base_sniffer () */
}       /* or32_frame_base_sniffer () */
 
#endif
 
 
 
 
/* -------------------------------------------------------------------------- */
/* -------------------------------------------------------------------------- */
/*!Architecture initialization for OpenRISC 1000
/*!Architecture initialization for OpenRISC 1000
 
 
Line 1714... Line 1772...
 
 
  /* Functions handling dummy frames */
  /* Functions handling dummy frames */
  set_gdbarch_push_dummy_call       (gdbarch, or32_push_dummy_call);
  set_gdbarch_push_dummy_call       (gdbarch, or32_push_dummy_call);
  set_gdbarch_dummy_id              (gdbarch, or32_dummy_id);
  set_gdbarch_dummy_id              (gdbarch, or32_dummy_id);
 
 
 
#if 0
  /* Set up sniffers for the frame base. Use DWARF debug info if available,
  /* Set up sniffers for the frame base. Use DWARF debug info if available,
     otherwise use our own sniffer. */
     otherwise use our own sniffer. */
  frame_base_append_sniffer (gdbarch, dwarf2_frame_base_sniffer);
  frame_base_append_sniffer (gdbarch, dwarf2_frame_base_sniffer);
  frame_base_append_sniffer (gdbarch, or32_frame_base_sniffer);
  frame_base_append_sniffer (gdbarch, or32_frame_base_sniffer);
 
#endif
 
 
  /* Frame unwinders. Use DWARF debug info if available, otherwise use our
  /* Frame unwinders. Use DWARF debug info if available, otherwise use our
     own unwinder. */
     own unwinder. */
  dwarf2_append_unwinders (gdbarch);
  dwarf2_append_unwinders (gdbarch);
  frame_unwind_append_unwinder (gdbarch, &or32_frame_unwind);
  frame_unwind_append_unwinder (gdbarch, &or32_frame_unwind);

powered by: WebSVN 2.1.0

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