diff options
author | Ulrich Weigand <uweigand@de.ibm.com> | 2007-05-07 18:20:21 +0000 |
---|---|---|
committer | Ulrich Weigand <uweigand@de.ibm.com> | 2007-05-07 18:20:21 +0000 |
commit | 6d350bb576b5a3495c99f1f6e6bc5e199851d36e (patch) | |
tree | 13cf98eaca8a6edb0dda64a68ce09b0208b13935 | |
parent | 3b95049e0a52a4b831c5338aa844d97df5e05df4 (diff) | |
download | gdb-6d350bb576b5a3495c99f1f6e6bc5e199851d36e.zip gdb-6d350bb576b5a3495c99f1f6e6bc5e199851d36e.tar.gz gdb-6d350bb576b5a3495c99f1f6e6bc5e199851d36e.tar.bz2 |
* gdbarch.sh: Add skip_permanent_breakpoint callback.
* gdbarch.h, gdbarch.c: Regenerate.
* infrun.c (SKIP_PERMANENT_BREAKPOINT): Remove default definition.
(resume): Call gdbarch_skip_permanent_breakpoint instead of
SKIP_PERMANENT_BREAKPOINT. Inline default case.
* hppa-hpux-tdep.c (hppa_skip_permanent_breakpoint): Make static.
Add REGCACHE argument. Use it instead of read/write_register.
(hppa_hpux_init_abi): Install hppa_skip_permanent_breakpoint.
* config/pa/tm-hppah.h: Delete file.
* config/pa/hppa64.mt (DEPRECATED_TM_FILE): Set to tm-hppa.h.
* config/pa/hppahpux.mt (DEPRECATED_TM_FILE): Likewise.
-rw-r--r-- | gdb/ChangeLog | 17 | ||||
-rw-r--r-- | gdb/config/pa/hppa64.mt | 2 | ||||
-rw-r--r-- | gdb/config/pa/hppahpux.mt | 2 | ||||
-rw-r--r-- | gdb/config/pa/tm-hppah.h | 37 | ||||
-rw-r--r-- | gdb/gdbarch.c | 33 | ||||
-rw-r--r-- | gdb/gdbarch.h | 8 | ||||
-rwxr-xr-x | gdb/gdbarch.sh | 3 | ||||
-rw-r--r-- | gdb/hppa-hpux-tdep.c | 17 | ||||
-rw-r--r-- | gdb/infrun.c | 27 |
9 files changed, 84 insertions, 62 deletions
diff --git a/gdb/ChangeLog b/gdb/ChangeLog index d059e46..2984e42 100644 --- a/gdb/ChangeLog +++ b/gdb/ChangeLog @@ -1,3 +1,20 @@ +2007-05-07 Ulrich Weigand <uweigand@de.ibm.com> + + * gdbarch.sh: Add skip_permanent_breakpoint callback. + * gdbarch.h, gdbarch.c: Regenerate. + + * infrun.c (SKIP_PERMANENT_BREAKPOINT): Remove default definition. + (resume): Call gdbarch_skip_permanent_breakpoint instead of + SKIP_PERMANENT_BREAKPOINT. Inline default case. + + * hppa-hpux-tdep.c (hppa_skip_permanent_breakpoint): Make static. + Add REGCACHE argument. Use it instead of read/write_register. + (hppa_hpux_init_abi): Install hppa_skip_permanent_breakpoint. + + * config/pa/tm-hppah.h: Delete file. + * config/pa/hppa64.mt (DEPRECATED_TM_FILE): Set to tm-hppa.h. + * config/pa/hppahpux.mt (DEPRECATED_TM_FILE): Likewise. + 2007-05-07 Daniel Jacobowitz <dan@codesourcery.com> * Makefile.in (c-lang.o, gnu-v3-abi.o): Update. diff --git a/gdb/config/pa/hppa64.mt b/gdb/config/pa/hppa64.mt index 051ca0f..85a64b1 100644 --- a/gdb/config/pa/hppa64.mt +++ b/gdb/config/pa/hppa64.mt @@ -1,3 +1,3 @@ # Target: HP PA-RISC 2.0 running HPUX 11.00 in wide mode TDEPFILES= hppa-tdep.o hppa-hpux-tdep.o solib-som.o solib-pa64.o somread.o solib.o -DEPRECATED_TM_FILE= tm-hppah.h +DEPRECATED_TM_FILE= tm-hppa.h diff --git a/gdb/config/pa/hppahpux.mt b/gdb/config/pa/hppahpux.mt index 691cbac..fc9d2d7e 100644 --- a/gdb/config/pa/hppahpux.mt +++ b/gdb/config/pa/hppahpux.mt @@ -1,4 +1,4 @@ # Target: HP PA-RISC running hpux MT_CFLAGS = -DPA_SOM_ONLY=1 TDEPFILES= hppa-tdep.o hppa-hpux-tdep.o corelow.o somread.o solib-som.o solib-pa64.o solib.o -DEPRECATED_TM_FILE= tm-hppah.h +DEPRECATED_TM_FILE= tm-hppa.h diff --git a/gdb/config/pa/tm-hppah.h b/gdb/config/pa/tm-hppah.h deleted file mode 100644 index d1f726f..0000000 --- a/gdb/config/pa/tm-hppah.h +++ /dev/null @@ -1,37 +0,0 @@ -/* Parameters for execution on an HP PA-RISC machine, running HPUX, for GDB. - Copyright 1991, 1992, 1995, 1998, 2002, 2003, 2004, 2007 - Free Software Foundation, Inc. - - Contributed by the Center for Software Science at the - University of Utah (pa-gdb-bugs@cs.utah.edu). - - 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 - (at your option) any later version. - - This program is distributed in the hope that it will be useful, - but WITHOUT ANY WARRANTY; without even the implied warranty of - MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the - 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. */ - -struct frame_info; - -/* For HP-UX on PA-RISC we have an implementation - for the exception handling target op (in hppa-tdep.c) */ -#define CHILD_ENABLE_EXCEPTION_CALLBACK -#define CHILD_GET_CURRENT_EXCEPTION_EVENT - -/* Here's how to step off a permanent breakpoint. */ -#define SKIP_PERMANENT_BREAKPOINT (hppa_skip_permanent_breakpoint) -extern void hppa_skip_permanent_breakpoint (void); - -/* Mostly it's common to all HPPA's. */ -#include "pa/tm-hppa.h" diff --git a/gdb/gdbarch.c b/gdb/gdbarch.c index 96d9b8f..457f655 100644 --- a/gdb/gdbarch.c +++ b/gdb/gdbarch.c @@ -237,6 +237,7 @@ struct gdbarch gdbarch_regset_from_core_section_ftype *regset_from_core_section; int vtable_function_descriptors; int vbit_in_delta; + gdbarch_skip_permanent_breakpoint_ftype *skip_permanent_breakpoint; }; @@ -364,6 +365,7 @@ struct gdbarch startup_gdbarch = 0, /* regset_from_core_section */ 0, /* vtable_function_descriptors */ 0, /* vbit_in_delta */ + 0, /* skip_permanent_breakpoint */ /* startup_gdbarch() */ }; @@ -618,6 +620,7 @@ verify_gdbarch (struct gdbarch *current_gdbarch) /* Skip verify of regset_from_core_section, has predicate */ /* Skip verify of vtable_function_descriptors, invalid_p == 0 */ /* Skip verify of vbit_in_delta, invalid_p == 0 */ + /* Skip verify of skip_permanent_breakpoint, has predicate */ buf = ui_file_xstrdup (log, &dummy); make_cleanup (xfree, buf); if (strlen (buf) > 0) @@ -1458,6 +1461,12 @@ gdbarch_dump (struct gdbarch *current_gdbarch, struct ui_file *file) fprintf_unfiltered (file, "gdbarch_dump: single_step_through_delay = <0x%lx>\n", (long) current_gdbarch->single_step_through_delay); + fprintf_unfiltered (file, + "gdbarch_dump: gdbarch_skip_permanent_breakpoint_p() = %d\n", + gdbarch_skip_permanent_breakpoint_p (current_gdbarch)); + fprintf_unfiltered (file, + "gdbarch_dump: skip_permanent_breakpoint = <0x%lx>\n", + (long) current_gdbarch->skip_permanent_breakpoint); #ifdef SKIP_PROLOGUE fprintf_unfiltered (file, "gdbarch_dump: %s # %s\n", @@ -3641,6 +3650,30 @@ set_gdbarch_vbit_in_delta (struct gdbarch *gdbarch, gdbarch->vbit_in_delta = vbit_in_delta; } +int +gdbarch_skip_permanent_breakpoint_p (struct gdbarch *gdbarch) +{ + gdb_assert (gdbarch != NULL); + return gdbarch->skip_permanent_breakpoint != NULL; +} + +void +gdbarch_skip_permanent_breakpoint (struct gdbarch *gdbarch, struct regcache *regcache) +{ + gdb_assert (gdbarch != NULL); + gdb_assert (gdbarch->skip_permanent_breakpoint != NULL); + if (gdbarch_debug >= 2) + fprintf_unfiltered (gdb_stdlog, "gdbarch_skip_permanent_breakpoint called\n"); + gdbarch->skip_permanent_breakpoint (regcache); +} + +void +set_gdbarch_skip_permanent_breakpoint (struct gdbarch *gdbarch, + gdbarch_skip_permanent_breakpoint_ftype skip_permanent_breakpoint) +{ + gdbarch->skip_permanent_breakpoint = skip_permanent_breakpoint; +} + /* Keep a registry of per-architecture data-pointers required by GDB modules. */ diff --git a/gdb/gdbarch.h b/gdb/gdbarch.h index e696340..95c0951 100644 --- a/gdb/gdbarch.h +++ b/gdb/gdbarch.h @@ -1368,6 +1368,14 @@ extern void set_gdbarch_vtable_function_descriptors (struct gdbarch *gdbarch, in extern int gdbarch_vbit_in_delta (struct gdbarch *gdbarch); extern void set_gdbarch_vbit_in_delta (struct gdbarch *gdbarch, int vbit_in_delta); +/* Advance PC to next instruction in order to skip a permanent breakpoint. */ + +extern int gdbarch_skip_permanent_breakpoint_p (struct gdbarch *gdbarch); + +typedef void (gdbarch_skip_permanent_breakpoint_ftype) (struct regcache *regcache); +extern void gdbarch_skip_permanent_breakpoint (struct gdbarch *gdbarch, struct regcache *regcache); +extern void set_gdbarch_skip_permanent_breakpoint (struct gdbarch *gdbarch, gdbarch_skip_permanent_breakpoint_ftype *skip_permanent_breakpoint); + extern struct gdbarch_tdep *gdbarch_tdep (struct gdbarch *gdbarch); diff --git a/gdb/gdbarch.sh b/gdb/gdbarch.sh index aa46ceb..efe0200 100755 --- a/gdb/gdbarch.sh +++ b/gdb/gdbarch.sh @@ -682,6 +682,9 @@ v::int:vtable_function_descriptors:::0:0::0 # Set if the least significant bit of the delta is used instead of the least # significant bit of the pfn for pointers to virtual member functions. v::int:vbit_in_delta:::0:0::0 + +# Advance PC to next instruction in order to skip a permanent breakpoint. +F::void:skip_permanent_breakpoint:struct regcache *regcache:regcache EOF } diff --git a/gdb/hppa-hpux-tdep.c b/gdb/hppa-hpux-tdep.c index b5a9bd6..ea4319e 100644 --- a/gdb/hppa-hpux-tdep.c +++ b/gdb/hppa-hpux-tdep.c @@ -548,8 +548,8 @@ hppa_hpux_skip_trampoline_code (CORE_ADDR pc) } } -void -hppa_skip_permanent_breakpoint (void) +static void +hppa_skip_permanent_breakpoint (struct regcache *regcache) { /* To step over a breakpoint instruction on the PA takes some fiddling with the instruction address queue. @@ -565,10 +565,15 @@ hppa_skip_permanent_breakpoint (void) front to the back. But what do we put in the back? What instruction comes after that one? Because of the branch delay slot, the next insn is always at the back + 4. */ - write_register (HPPA_PCOQ_HEAD_REGNUM, read_register (HPPA_PCOQ_TAIL_REGNUM)); - write_register (HPPA_PCSQ_HEAD_REGNUM, read_register (HPPA_PCSQ_TAIL_REGNUM)); - write_register (HPPA_PCOQ_TAIL_REGNUM, read_register (HPPA_PCOQ_TAIL_REGNUM) + 4); + ULONGEST pcoq_tail, pcsq_tail; + regcache_cooked_read_unsigned (regcache, HPPA_PCOQ_TAIL_REGNUM, &pcoq_tail); + regcache_cooked_read_unsigned (regcache, HPPA_PCSQ_TAIL_REGNUM, &pcsq_tail); + + regcache_cooked_write_unsigned (regcache, HPPA_PCOQ_HEAD_REGNUM, pcoq_tail); + regcache_cooked_write_unsigned (regcache, HPPA_PCSQ_HEAD_REGNUM, pcsq_tail); + + regcache_cooked_write_unsigned (regcache, HPPA_PCOQ_TAIL_REGNUM, pcoq_tail + 4); /* We can leave the tail's space the same, since there's no jump. */ } @@ -2037,6 +2042,8 @@ hppa_hpux_init_abi (struct gdbarch_info info, struct gdbarch *gdbarch) set_gdbarch_read_pc (gdbarch, hppa_hpux_read_pc); set_gdbarch_write_pc (gdbarch, hppa_hpux_write_pc); set_gdbarch_unwind_pc (gdbarch, hppa_hpux_unwind_pc); + set_gdbarch_skip_permanent_breakpoint + (gdbarch, hppa_skip_permanent_breakpoint); set_gdbarch_regset_from_core_section (gdbarch, hppa_hpux_regset_from_core_section); diff --git a/gdb/infrun.c b/gdb/infrun.c index b846903..dccd9ec 100644 --- a/gdb/infrun.c +++ b/gdb/infrun.c @@ -176,23 +176,6 @@ show_debug_infrun (struct ui_file *file, int from_tty, #define SOLIB_IN_DYNAMIC_LINKER(pid,pc) 0 #endif -/* We can't step off a permanent breakpoint in the ordinary way, because we - can't remove it. Instead, we have to advance the PC to the next - instruction. This macro should expand to a pointer to a function that - does that, or zero if we have no such function. If we don't have a - definition for it, we have to report an error. */ -#ifndef SKIP_PERMANENT_BREAKPOINT -#define SKIP_PERMANENT_BREAKPOINT (default_skip_permanent_breakpoint) -static void -default_skip_permanent_breakpoint (void) -{ - error (_("\ -The program is stopped at a permanent breakpoint, but GDB does not know\n\ -how to step past a permanent breakpoint on this architecture. Try using\n\ -a command like `return' or `jump' to continue execution.")); -} -#endif - /* Convert the #defines into values. This is temporary until wfi control flow is completely sorted out. */ @@ -543,7 +526,15 @@ resume (int step, enum target_signal sig) at a permanent breakpoint; we need to step over it, but permanent breakpoints can't be removed. So we have to test for it here. */ if (breakpoint_here_p (read_pc ()) == permanent_breakpoint_here) - SKIP_PERMANENT_BREAKPOINT (); + { + if (gdbarch_skip_permanent_breakpoint_p (current_gdbarch)) + gdbarch_skip_permanent_breakpoint (current_gdbarch, current_regcache); + else + error (_("\ +The program is stopped at a permanent breakpoint, but GDB does not know\n\ +how to step past a permanent breakpoint on this architecture. Try using\n\ +a command like `return' or `jump' to continue execution.")); + } if (SOFTWARE_SINGLE_STEP_P () && step) { |