X-Git-Url: http://git.efficios.com/?a=blobdiff_plain;f=gdb%2Fm32c-tdep.c;h=513da03da11e1159325866ff633053e869b1d031;hb=8a34ac3f587db129417fd57104477cd186b666c8;hp=5763d5c0676932c39210b37c3518fd5ed49f330e;hpb=f57d151a994d668d681871f04cfd6e32a1c5ac33;p=deliverable%2Fbinutils-gdb.git diff --git a/gdb/m32c-tdep.c b/gdb/m32c-tdep.c index 5763d5c067..513da03da1 100644 --- a/gdb/m32c-tdep.c +++ b/gdb/m32c-tdep.c @@ -1,12 +1,12 @@ /* Renesas M32C target-dependent code for GDB, the GNU debugger. - Copyright 2004, 2005, 2007 Free Software Foundation, Inc. + Copyright 2004, 2005, 2007, 2008 Free Software Foundation, Inc. This file is part of GDB. This program is free software; you can redistribute it and/or modify it under the terms of the GNU General Public License as published by - the Free Software Foundation; either version 2 of the License, or + the Free Software Foundation; either version 3 of the License, or (at your option) any later version. This program is distributed in the hope that it will be useful, @@ -15,9 +15,7 @@ GNU General Public License for more details. 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. */ + along with this program. If not, see . */ #include "defs.h" @@ -229,9 +227,9 @@ make_types (struct gdbarch *arch) /* Register set. */ static const char * -m32c_register_name (int num) +m32c_register_name (struct gdbarch *gdbarch, int num) { - return gdbarch_tdep (current_gdbarch)->regs[num].name; + return gdbarch_tdep (gdbarch)->regs[num].name; } @@ -243,16 +241,16 @@ m32c_register_type (struct gdbarch *arch, int reg_nr) static int -m32c_register_sim_regno (int reg_nr) +m32c_register_sim_regno (struct gdbarch *gdbarch, int reg_nr) { - return gdbarch_tdep (current_gdbarch)->regs[reg_nr].sim_num; + return gdbarch_tdep (gdbarch)->regs[reg_nr].sim_num; } static int -m32c_debug_info_reg_to_regnum (int reg_nr) +m32c_debug_info_reg_to_regnum (struct gdbarch *gdbarch, int reg_nr) { - struct gdbarch_tdep *tdep = gdbarch_tdep (current_gdbarch); + struct gdbarch_tdep *tdep = gdbarch_tdep (gdbarch); if (0 <= reg_nr && reg_nr <= M32C_MAX_DWARF_REGNUM && tdep->dwarf_regs[reg_nr]) return tdep->dwarf_regs[reg_nr]->num; @@ -267,7 +265,7 @@ int m32c_register_reggroup_p (struct gdbarch *gdbarch, int regnum, struct reggroup *group) { - struct gdbarch_tdep *tdep = gdbarch_tdep (current_gdbarch); + struct gdbarch_tdep *tdep = gdbarch_tdep (gdbarch); struct m32c_reg *reg = &tdep->regs[regnum]; /* The anonymous raw registers aren't in any groups. */ @@ -961,7 +959,6 @@ make_regs (struct gdbarch *arch) set_gdbarch_pseudo_register_write (arch, m32c_pseudo_register_write); set_gdbarch_register_sim_regno (arch, m32c_register_sim_regno); set_gdbarch_stab_reg_to_regnum (arch, m32c_debug_info_reg_to_regnum); - set_gdbarch_dwarf_reg_to_regnum (arch, m32c_debug_info_reg_to_regnum); set_gdbarch_dwarf2_reg_to_regnum (arch, m32c_debug_info_reg_to_regnum); set_gdbarch_register_reggroup_p (arch, m32c_register_reggroup_p); @@ -978,7 +975,7 @@ make_regs (struct gdbarch *arch) /* Breakpoints. */ static const unsigned char * -m32c_breakpoint_from_pc (CORE_ADDR *pc, int *len) +m32c_breakpoint_from_pc (struct gdbarch *gdbarch, CORE_ADDR *pc, int *len) { static unsigned char break_insn[] = { 0x00 }; /* brk */ @@ -1805,7 +1802,7 @@ m32c_analyze_prologue (struct gdbarch *arch, static CORE_ADDR -m32c_skip_prologue (CORE_ADDR ip) +m32c_skip_prologue (struct gdbarch *gdbarch, CORE_ADDR ip) { char *name; CORE_ADDR func_addr, func_end, sal_end; @@ -1816,7 +1813,7 @@ m32c_skip_prologue (CORE_ADDR ip) return ip; /* Find end by prologue analysis. */ - m32c_analyze_prologue (current_gdbarch, ip, func_end, &p); + m32c_analyze_prologue (gdbarch, ip, func_end, &p); /* Find end by line info. */ sal_end = skip_prologue_using_sal (ip); /* Return whichever is lower. */ @@ -2200,6 +2197,7 @@ m32c_return_by_passed_buf (struct type *type) static enum return_value_convention m32c_return_value (struct gdbarch *gdbarch, + struct type *func_type, struct type *valtype, struct regcache *regcache, gdb_byte *readbuf, @@ -2319,10 +2317,10 @@ m32c_return_value (struct gdbarch *gdbarch, their program is calling, not in some trampoline code they've never seen before.) - The SKIP_TRAMPOLINE_CODE gdbarch method tells GDB how to step + The gdbarch_skip_trampoline_code method tells GDB how to step through such trampoline functions transparently to the user. When given the address of a trampoline function's first instruction, - SKIP_TRAMPOLINE_CODE should return the address of the first + gdbarch_skip_trampoline_code should return the address of the first instruction of the function really being called. If GDB decides it wants to step into that function, it will set a breakpoint there and silently continue to it. @@ -2332,9 +2330,9 @@ m32c_return_value (struct gdbarch *gdbarch, code sequence seems more fragile. */ static CORE_ADDR -m32c_skip_trampoline_code (CORE_ADDR stop_pc) +m32c_skip_trampoline_code (struct frame_info *frame, CORE_ADDR stop_pc) { - struct gdbarch_tdep *tdep = gdbarch_tdep (current_gdbarch); + struct gdbarch_tdep *tdep = gdbarch_tdep (get_frame_arch (frame)); /* It would be nicer to simply look up the addresses of known trampolines once, and then compare stop_pc with them. However, @@ -2527,7 +2525,7 @@ m32c_m16c_pointer_to_address (struct type *type, const gdb_byte *buf) } void -m32c_virtual_frame_pointer (CORE_ADDR pc, +m32c_virtual_frame_pointer (struct gdbarch *gdbarch, CORE_ADDR pc, int *frame_regnum, LONGEST *frame_offset) { @@ -2535,29 +2533,30 @@ m32c_virtual_frame_pointer (CORE_ADDR pc, CORE_ADDR func_addr, func_end, sal_end; struct m32c_prologue p; - struct gdbarch_tdep *tdep = gdbarch_tdep (current_gdbarch); + struct regcache *regcache = get_current_regcache (); + struct gdbarch_tdep *tdep = gdbarch_tdep (gdbarch); if (!find_pc_partial_function (pc, &name, &func_addr, &func_end)) internal_error (__FILE__, __LINE__, _("No virtual frame pointer available")); - m32c_analyze_prologue (current_gdbarch, func_addr, pc, &p); + m32c_analyze_prologue (gdbarch, func_addr, pc, &p); switch (p.kind) { case prologue_with_frame_ptr: - *frame_regnum = m32c_banked_register (tdep->fb, current_regcache)->num; + *frame_regnum = m32c_banked_register (tdep->fb, regcache)->num; *frame_offset = p.frame_ptr_offset; break; case prologue_sans_frame_ptr: - *frame_regnum = m32c_banked_register (tdep->sp, current_regcache)->num; + *frame_regnum = m32c_banked_register (tdep->sp, regcache)->num; *frame_offset = p.frame_size; break; default: - *frame_regnum = m32c_banked_register (tdep->sp, current_regcache)->num; + *frame_regnum = m32c_banked_register (tdep->sp, regcache)->num; *frame_offset = 0; break; } /* Sanity check */ - if (*frame_regnum > gdbarch_num_regs (current_gdbarch)) + if (*frame_regnum > gdbarch_num_regs (gdbarch)) internal_error (__FILE__, __LINE__, _("No virtual frame pointer available")); }