* 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.
This commit is contained in:
Ulrich Weigand 2007-05-07 18:20:21 +00:00
parent 3b95049e0a
commit 6d350bb576
9 changed files with 84 additions and 62 deletions

View 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> 2007-05-07 Daniel Jacobowitz <dan@codesourcery.com>
* Makefile.in (c-lang.o, gnu-v3-abi.o): Update. * Makefile.in (c-lang.o, gnu-v3-abi.o): Update.

View File

@ -1,3 +1,3 @@
# Target: HP PA-RISC 2.0 running HPUX 11.00 in wide mode # 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 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

View File

@ -1,4 +1,4 @@
# Target: HP PA-RISC running hpux # Target: HP PA-RISC running hpux
MT_CFLAGS = -DPA_SOM_ONLY=1 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 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

View File

@ -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"

View File

@ -237,6 +237,7 @@ struct gdbarch
gdbarch_regset_from_core_section_ftype *regset_from_core_section; gdbarch_regset_from_core_section_ftype *regset_from_core_section;
int vtable_function_descriptors; int vtable_function_descriptors;
int vbit_in_delta; 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, /* regset_from_core_section */
0, /* vtable_function_descriptors */ 0, /* vtable_function_descriptors */
0, /* vbit_in_delta */ 0, /* vbit_in_delta */
0, /* skip_permanent_breakpoint */
/* startup_gdbarch() */ /* startup_gdbarch() */
}; };
@ -618,6 +620,7 @@ verify_gdbarch (struct gdbarch *current_gdbarch)
/* Skip verify of regset_from_core_section, has predicate */ /* Skip verify of regset_from_core_section, has predicate */
/* Skip verify of vtable_function_descriptors, invalid_p == 0 */ /* Skip verify of vtable_function_descriptors, invalid_p == 0 */
/* Skip verify of vbit_in_delta, 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); buf = ui_file_xstrdup (log, &dummy);
make_cleanup (xfree, buf); make_cleanup (xfree, buf);
if (strlen (buf) > 0) if (strlen (buf) > 0)
@ -1458,6 +1461,12 @@ gdbarch_dump (struct gdbarch *current_gdbarch, struct ui_file *file)
fprintf_unfiltered (file, fprintf_unfiltered (file,
"gdbarch_dump: single_step_through_delay = <0x%lx>\n", "gdbarch_dump: single_step_through_delay = <0x%lx>\n",
(long) current_gdbarch->single_step_through_delay); (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 #ifdef SKIP_PROLOGUE
fprintf_unfiltered (file, fprintf_unfiltered (file,
"gdbarch_dump: %s # %s\n", "gdbarch_dump: %s # %s\n",
@ -3641,6 +3650,30 @@ set_gdbarch_vbit_in_delta (struct gdbarch *gdbarch,
gdbarch->vbit_in_delta = vbit_in_delta; 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 /* Keep a registry of per-architecture data-pointers required by GDB
modules. */ modules. */

View 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 int gdbarch_vbit_in_delta (struct gdbarch *gdbarch);
extern void set_gdbarch_vbit_in_delta (struct gdbarch *gdbarch, int vbit_in_delta); 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); extern struct gdbarch_tdep *gdbarch_tdep (struct gdbarch *gdbarch);

View File

@ -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 # 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. # significant bit of the pfn for pointers to virtual member functions.
v::int:vbit_in_delta:::0:0::0 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 EOF
} }

View File

@ -548,8 +548,8 @@ hppa_hpux_skip_trampoline_code (CORE_ADDR pc)
} }
} }
void static void
hppa_skip_permanent_breakpoint (void) hppa_skip_permanent_breakpoint (struct regcache *regcache)
{ {
/* To step over a breakpoint instruction on the PA takes some /* To step over a breakpoint instruction on the PA takes some
fiddling with the instruction address queue. 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 front to the back. But what do we put in the back? What
instruction comes after that one? Because of the branch delay instruction comes after that one? Because of the branch delay
slot, the next insn is always at the back + 4. */ 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. */ /* 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_read_pc (gdbarch, hppa_hpux_read_pc);
set_gdbarch_write_pc (gdbarch, hppa_hpux_write_pc); set_gdbarch_write_pc (gdbarch, hppa_hpux_write_pc);
set_gdbarch_unwind_pc (gdbarch, hppa_hpux_unwind_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 set_gdbarch_regset_from_core_section
(gdbarch, hppa_hpux_regset_from_core_section); (gdbarch, hppa_hpux_regset_from_core_section);

View File

@ -176,23 +176,6 @@ show_debug_infrun (struct ui_file *file, int from_tty,
#define SOLIB_IN_DYNAMIC_LINKER(pid,pc) 0 #define SOLIB_IN_DYNAMIC_LINKER(pid,pc) 0
#endif #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 /* Convert the #defines into values. This is temporary until wfi control
flow is completely sorted out. */ 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 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. */ breakpoints can't be removed. So we have to test for it here. */
if (breakpoint_here_p (read_pc ()) == permanent_breakpoint_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) if (SOFTWARE_SINGLE_STEP_P () && step)
{ {