/* Target-dependent code for the MDEBUG MIPS architecture, for GDB,
the GNU Debugger.
- Copyright 1988, 1989, 1990, 1991, 1992, 1993, 1994, 1995, 1996,
- 1997, 1998, 1999, 2000, 2001, 2002, 2003, 2004 Free Software
- Foundation, Inc.
+ Copyright (C) 1988, 1989, 1990, 1991, 1992, 1993, 1994, 1995, 1996, 1997,
+ 1998, 1999, 2000, 2001, 2002, 2003, 2004, 2006, 2007
+ Free Software Foundation, Inc.
This file is part of GDB.
You should have received a copy of the GNU General Public License
along with this program; if not, write to the Free Software
- Foundation, Inc., 59 Temple Place - Suite 330,
- Boston, MA 02111-1307, USA. */
+ Foundation, Inc., 51 Franklin Street, Fifth Floor,
+ Boston, MA 02110-1301, USA. */
#include "defs.h"
#include "frame.h"
#include "frame-unwind.h"
#include "frame-base.h"
#include "mips-mdebug-tdep.h"
+#include "mdebugread.h"
#define PROC_LOW_ADDR(proc) ((proc)->pdr.adr) /* least address */
#define PROC_FRAME_OFFSET(proc) ((proc)->pdr.frameoffset)
static int
compare_pdr_entries (const void *a, const void *b)
{
- CORE_ADDR lhs = bfd_get_32 (the_bfd, (bfd_byte *) a);
- CORE_ADDR rhs = bfd_get_32 (the_bfd, (bfd_byte *) b);
+ CORE_ADDR lhs = bfd_get_signed_32 (the_bfd, (bfd_byte *) a);
+ CORE_ADDR rhs = bfd_get_signed_32 (the_bfd, (bfd_byte *) b);
if (lhs < rhs)
return -1;
static const struct objfile_data *mips_pdr_data;
-static mips_extra_func_info_t
+static struct mdebug_extra_func_info *
non_heuristic_proc_desc (CORE_ADDR pc, CORE_ADDR *addrptr)
{
CORE_ADDR startaddr;
- mips_extra_func_info_t proc_desc;
+ struct mdebug_extra_func_info *proc_desc;
struct block *b = block_for_pc (pc);
struct symbol *sym;
struct obj_section *sec;
*addrptr = pdr_pc;
/* Fill in what we need of the proc_desc. */
- proc_desc = (mips_extra_func_info_t)
+ proc_desc = (struct mdebug_extra_func_info *)
obstack_alloc (&sec->objfile->objfile_obstack,
- sizeof (struct mips_extra_func_info));
+ sizeof (struct mdebug_extra_func_info));
PROC_LOW_ADDR (proc_desc) = pdr_pc;
PROC_FRAME_OFFSET (proc_desc)
- = bfd_get_32 (sec->objfile->obfd, ptr + 20);
+ = bfd_get_signed_32 (sec->objfile->obfd, ptr + 20);
PROC_FRAME_REG (proc_desc) = bfd_get_32 (sec->objfile->obfd,
ptr + 24);
PROC_REG_MASK (proc_desc) = bfd_get_32 (sec->objfile->obfd,
ptr + 4);
PROC_FREG_MASK (proc_desc) = bfd_get_32 (sec->objfile->obfd,
ptr + 12);
- PROC_REG_OFFSET (proc_desc) = bfd_get_32 (sec->objfile->obfd,
- ptr + 8);
+ PROC_REG_OFFSET (proc_desc)
+ = bfd_get_signed_32 (sec->objfile->obfd, ptr + 8);
PROC_FREG_OFFSET (proc_desc)
- = bfd_get_32 (sec->objfile->obfd, ptr + 16);
+ = bfd_get_signed_32 (sec->objfile->obfd, ptr + 16);
PROC_PC_REG (proc_desc) = bfd_get_32 (sec->objfile->obfd,
ptr + 28);
proc_desc->pdr.isym = (long) sym;
return NULL;
}
- sym = lookup_symbol (MIPS_EFI_SYMBOL_NAME, b, LABEL_DOMAIN, 0, NULL);
+ sym = lookup_symbol (MDEBUG_EFI_SYMBOL_NAME, b, LABEL_DOMAIN, 0, NULL);
/* If we never found a PDR for this function in symbol reading, then
examine prologues to find the information. */
if (sym)
{
- proc_desc = (mips_extra_func_info_t) SYMBOL_VALUE (sym);
+ proc_desc = (struct mdebug_extra_func_info *) SYMBOL_VALUE (sym);
if (PROC_FRAME_REG (proc_desc) == -1)
return NULL;
else
mips_mdebug_frame_cache (struct frame_info *next_frame, void **this_cache)
{
CORE_ADDR startaddr = 0;
- mips_extra_func_info_t proc_desc;
+ struct mdebug_extra_func_info *proc_desc;
struct mips_frame_cache *cache;
struct gdbarch *gdbarch = get_frame_arch (next_frame);
struct gdbarch_tdep *tdep = gdbarch_tdep (gdbarch);
{
struct mips_frame_cache *info = mips_mdebug_frame_cache (next_frame,
this_cache);
- (*this_id) = frame_id_build (info->base, frame_func_unwind (next_frame));
+ (*this_id) = frame_id_build (info->base,
+ frame_func_unwind (next_frame, NORMAL_FRAME));
}
static void
void **this_cache,
int regnum, int *optimizedp,
enum lval_type *lvalp, CORE_ADDR *addrp,
- int *realnump, void *valuep)
+ int *realnump, gdb_byte *valuep)
{
struct mips_frame_cache *info = mips_mdebug_frame_cache (next_frame,
this_cache);
static const struct frame_unwind *
mips_mdebug_frame_sniffer (struct frame_info *next_frame)
{
- CORE_ADDR pc = frame_pc_unwind (next_frame);
+ CORE_ADDR pc = frame_unwind_address_in_block (next_frame, NORMAL_FRAME);
CORE_ADDR startaddr = 0;
- mips_extra_func_info_t proc_desc;
+ struct mdebug_extra_func_info *proc_desc;
int kernel_trap;
/* Don't use this on MIPS16. */