This is the mail archive of the gdb-patches@sources.redhat.com mailing list for the GDB project.


Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]
Other format: [Raw text]

[RFC] TARGET_ADJUST_BREAKPOINT_ADDRESS - patch 1 of 4


I've recently revisited a patch that I submitted a long time ago. Here
are the relevant links to the original TARGET_ADJUST_BREAKPOINT_ADDRESS
patch submission and discussion:

     http://sources.redhat.com/ml/gdb-patches/2000-06/msg00257.html
 (+) http://sources.redhat.com/ml/gdb-patches/2000-06/msg00260.html
     http://sources.redhat.com/ml/gdb-patches/2000-06/msg00270.html
 (+) http://sources.redhat.com/ml/gdb-patches/2000-06/msg00274.html
 (*) http://sources.redhat.com/ml/gdb-patches/2000-09/msg00156.html
     http://sources.redhat.com/ml/gdb-patches/2000-09/msg00158.html

The link marked with (*) is Andrew's approval so long as Eli's
concerns marked with (+) are addressed.

The patch below should be non-controversial.  It merely adds the
TARGET_ADJUST_BREAKPOINT_ADDRESS method.  Code which uses it (the
possibly controversial bit) will come in patch #3.  Documentation will
be in the next patch, #2.  Finally, target specific code which
requires TARGET_ADJUST_BREAKPOINT_ADDRESS will be posted in patch #4.

Kevin

	* arch-utils.h (default_target_adjust_breakpoint_address): New
	function declaration.
	* arch-utils.c (default_target_adjust_breakpoint_address): New
	function.
	* gdbarch.sh (TARGET_ADJUST_BREAKPOINT_ADDRESS): New method.
	* gdbarch.h, gdbarch.c: Regenerate.

Index: arch-utils.c
===================================================================
RCS file: /cvs/src/src/gdb/arch-utils.c,v
retrieving revision 1.97
diff -u -p -r1.97 arch-utils.c
--- arch-utils.c	30 Sep 2003 13:29:43 -0000	1.97
+++ arch-utils.c	3 Oct 2003 23:38:23 -0000
@@ -82,6 +82,21 @@ legacy_register_sim_regno (int regnum)
     return LEGACY_SIM_REGNO_IGNORE;
 }
 
+/* Some architectures have constraints about where a breakpoint may be
+   placed.  TARGET_ADJUST_BREAKPOINT_ADDRESS is given an address that is
+   adjusted (and returned) to conform to the constraints imposed by
+   the architecture.
+   
+   Targets which have no architectural constraints on breakpoint placement
+   should use default_target_adjust_breakpoint_address which merely returns
+   the breakpoint address unadjusted */
+
+CORE_ADDR
+default_target_adjust_breakpoint_address (CORE_ADDR bpaddr)
+{
+  return bpaddr;
+}
+
 int
 generic_frameless_function_invocation_not (struct frame_info *fi)
 {
Index: arch-utils.h
===================================================================
RCS file: /cvs/src/src/gdb/arch-utils.h,v
retrieving revision 1.57
diff -u -p -r1.57 arch-utils.h
--- arch-utils.h	27 Sep 2003 15:51:02 -0000	1.57
+++ arch-utils.h	3 Oct 2003 23:38:23 -0000
@@ -47,6 +47,11 @@ extern gdbarch_store_return_value_ftype 
    address passed as an invisible first argument to the function.  */
 extern gdbarch_use_struct_convention_ftype always_use_struct_convention;
 
+/* Identity function for targets which don't have architectural constraints
+   on placement of breakpoints. */
+extern gdbarch_target_adjust_breakpoint_address_ftype
+  default_target_adjust_breakpoint_address;
+
 /* Frameless functions not identifable. */
 extern gdbarch_frameless_function_invocation_ftype generic_frameless_function_invocation_not;
 
Index: gdbarch.sh
===================================================================
RCS file: /cvs/src/src/gdb/gdbarch.sh,v
retrieving revision 1.275
diff -u -p -r1.275 gdbarch.sh
--- gdbarch.sh	2 Oct 2003 20:28:29 -0000	1.275
+++ gdbarch.sh	3 Oct 2003 23:38:27 -0000
@@ -614,6 +614,7 @@ f:2:SKIP_PROLOGUE:CORE_ADDR:skip_prologu
 f:2:PROLOGUE_FRAMELESS_P:int:prologue_frameless_p:CORE_ADDR ip:ip::0:generic_prologue_frameless_p::0
 f:2:INNER_THAN:int:inner_than:CORE_ADDR lhs, CORE_ADDR rhs:lhs, rhs::0:0
 f::BREAKPOINT_FROM_PC:const unsigned char *:breakpoint_from_pc:CORE_ADDR *pcptr, int *lenptr:pcptr, lenptr:::0:
+f:2:TARGET_ADJUST_BREAKPOINT_ADDRESS:CORE_ADDR:target_adjust_breakpoint_address:CORE_ADDR bpaddr:bpaddr:::default_target_adjust_breakpoint_address::0
 f:2:MEMORY_INSERT_BREAKPOINT:int:memory_insert_breakpoint:CORE_ADDR addr, char *contents_cache:addr, contents_cache::0:default_memory_insert_breakpoint::0
 f:2:MEMORY_REMOVE_BREAKPOINT:int:memory_remove_breakpoint:CORE_ADDR addr, char *contents_cache:addr, contents_cache::0:default_memory_remove_breakpoint::0
 v:2:DECR_PC_AFTER_BREAK:CORE_ADDR:decr_pc_after_break::::0:-1


Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]