]> git.ipfire.org Git - thirdparty/binutils-gdb.git/commitdiff
* gdbarch.sh: Add skip_permanent_breakpoint callback.
authorUlrich Weigand <uweigand@de.ibm.com>
Mon, 7 May 2007 18:20:21 +0000 (18:20 +0000)
committerUlrich Weigand <uweigand@de.ibm.com>
Mon, 7 May 2007 18:20:21 +0000 (18:20 +0000)
* 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.

gdb/ChangeLog
gdb/config/pa/hppa64.mt
gdb/config/pa/hppahpux.mt
gdb/config/pa/tm-hppah.h [deleted file]
gdb/gdbarch.c
gdb/gdbarch.h
gdb/gdbarch.sh
gdb/hppa-hpux-tdep.c
gdb/infrun.c

index d059e46a8877eb5370897f0329d2dd54ac071c9e..2984e421bf5770626a1e8efc42717ec9ad929348 100644 (file)
@@ -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.
index 051ca0f2ebe072a0b3b125bfbcb8805b7afc96cf..85a64b1894ec348efc41a40327991e9e7ca3c0d0 100644 (file)
@@ -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
index 691cbac41c3b6008e96d6692ad63330641de1f9d..fc9d2d7e7e923c4356a996f937665fb399e0b3d4 100644 (file)
@@ -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 (file)
index d1f726f..0000000
+++ /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"
index 96d9b8fc908bfb3a8d24136e906c999c879c7570..457f65507a9dca0736442378e2cf329226c634bb 100644 (file)
@@ -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. */
index e696340bf1c6eb1a7f1157c06811c8f8e47fbff9..95c09511cf34068ec2d5faf9db7f156b78161924 100644 (file)
@@ -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);
 
 
index aa46ceb97c83138dda5b422a2d0b7d2ea56f5a18..efe02007b5940b781d543bc056c6e2feca47a451 100755 (executable)
@@ -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
 }
 
index b5a9bd6d55bb30d923f7fa2a4954fabe6ce38422..ea4319e4375af6b43327f3df05a60e8554e6a942 100644 (file)
@@ -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);
index b846903a6a3129a0bddca70aea8b33bd0c8e3be1..dccd9ec07315c23839a85ac7cd76811179c3b777 100644 (file)
@@ -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)
     {