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]

[patch rfc, rfa:doco] Eliminate BREAKPOINT, BIG_BREAKPOINT, LITTLE_BREAKPOINT


It's true. This eliminates the macro's
BREAKPOINT
BIG_BREAKPOINT
LITTLE_BREAKPOINT
They were all, some time ago, made redundant by BREAKPOINT_FROM_PC and the attached finishes the job.


As for *REMOTE_BREAKPOINT, that's still a mess :-/

I'll commit this in a day or so,
Andrew
Index: doc/ChangeLog
2003-05-13  Andrew Cagney  <cagney@redhat.com>

	* gdbint.texinfo (Target Architecture Definition): Delete
	references to BIG_BREAKPOINT, LITTLE_BREAKPOINT and BREAKPOINT.
	Add more references to BREAKPOINT_FROM_PC.

2003-05-14  Andrew Cagney  <cagney@redhat.com>

	* arch-utils.h (legacy_breakpoint_from_pc): Delete declaration.
	* target.h (memory_breakpoint_from_pc): Delete declaration.
	* mem-break.c (memory_breakpoint_from_pc): Delete function.
	* arch-utils.c (legacy_breakpoint_from_pc): Delete function.
	* monitor.c (monitor_insert_breakpoint): Use
	gdbarch_breakpoint_from_pc instead of memory_breakpoint_from_pc.
	* gdbarch.sh (BREAKPOINT_FROM_PC): Do not provide a default.
	* gdbarch.h, gdbarch.c: Re-generate.
	* sparc-tdep.c (sparc_breakpoint_from_pc): New function.
	(sparc_gdbarch_init): Set breakpoint_from_pc to
	sparc_breakpoint_from_pc.
	* config/sparc/tm-sparc.h (BREAKPOINT): Delete macro.
	(BREAKPOINT_FROM_PC): Define.
	(sparc_breakpoint_from_pc): Declare.
	* hppa-tdep.c (hppa_breakpoint_from_pc): New function.
	* config/pa/tm-hppa.h (hppa_breakpoint_from_pc): Declare.
	(BREAKPOINT_FROM_PC): Define.
	(BREAKPOINT): Delete macro.
	* target.h: Update comment.
	* s390-tdep.c (s390_gdbarch_init): Update comments.
	* remote.c: Update comments.
	* remote-mips.c: Update comments.
	* proc-api.c (write_with_trace): Do not check for a breakpoint.
	* mem-break.c: Update comment.
	* ia64-tdep.c (IA64_BREAKPOINT): Rename BREAKPOINT.
	(ia64_memory_insert_breakpoint): Update.
	* config/sparc/tm-sparc.h: Update comment.
	* config/pa/tm-hppa64.h: Update comment.
	* rs6000-tdep.c (BIG_BREAKPOINT, LITTLE_BREAKPOINT): Delete macro.
	(rs6000_breakpoint_from_pc): Update.
	* mips-tdep.c (BIG_BREAKPOINT, LITTLE_BREAKPOINT): Delete macro.
	(PMON_BIG_BREAKPOINT, PMON_LITTLE_BREAKPOINT): Delete macro.
	(IDT_LITTLE_BREAKPOINT, IDT_LITTLE_BREAKPOINT): Delete macro.
	(MIPS16_LITTLE_BREAKPOINT, MIPS16_BIG_BREAKPOINT): Delete macro.
	(mips_breakpoint_from_pc): Update.
	(mips_dump_tdep): Update.

Index: arch-utils.c
===================================================================
RCS file: /cvs/src/src/gdb/arch-utils.c,v
retrieving revision 1.82
diff -u -r1.82 arch-utils.c
--- arch-utils.c	7 May 2003 19:21:10 -0000	1.82
+++ arch-utils.c	14 May 2003 12:13:04 -0000
@@ -48,49 +48,6 @@
 
 #include "floatformat.h"
 
-/* Use the program counter to determine the contents and size
-   of a breakpoint instruction.  If no target-dependent macro
-   BREAKPOINT_FROM_PC has been defined to implement this function,
-   assume that the breakpoint doesn't depend on the PC, and
-   use the values of the BIG_BREAKPOINT and LITTLE_BREAKPOINT macros.
-   Return a pointer to a string of bytes that encode a breakpoint
-   instruction, stores the length of the string to *lenptr,
-   and optionally adjust the pc to point to the correct memory location
-   for inserting the breakpoint.  */
-
-const unsigned char *
-legacy_breakpoint_from_pc (CORE_ADDR * pcptr, int *lenptr)
-{
-  /* {BIG_,LITTLE_}BREAKPOINT is the sequence of bytes we insert for a
-     breakpoint.  On some machines, breakpoints are handled by the
-     target environment and we don't have to worry about them here.  */
-#ifdef BIG_BREAKPOINT
-  if (TARGET_BYTE_ORDER == BFD_ENDIAN_BIG)
-    {
-      static unsigned char big_break_insn[] = BIG_BREAKPOINT;
-      *lenptr = sizeof (big_break_insn);
-      return big_break_insn;
-    }
-#endif
-#ifdef LITTLE_BREAKPOINT
-  if (TARGET_BYTE_ORDER != BFD_ENDIAN_BIG)
-    {
-      static unsigned char little_break_insn[] = LITTLE_BREAKPOINT;
-      *lenptr = sizeof (little_break_insn);
-      return little_break_insn;
-    }
-#endif
-#ifdef BREAKPOINT
-  {
-    static unsigned char break_insn[] = BREAKPOINT;
-    *lenptr = sizeof (break_insn);
-    return break_insn;
-  }
-#endif
-  *lenptr = 0;
-  return NULL;
-}
-
 /* Implementation of extract return value that grubs around in the
    register cache.  */
 void
Index: arch-utils.h
===================================================================
RCS file: /cvs/src/src/gdb/arch-utils.h,v
retrieving revision 1.45
diff -u -r1.45 arch-utils.h
--- arch-utils.h	29 Apr 2003 01:49:46 -0000	1.45
+++ arch-utils.h	14 May 2003 12:13:05 -0000
@@ -40,11 +40,6 @@
    being passed */
 extern gdbarch_frame_num_args_ftype frame_num_args_unknown;
 
-/* Implementation of breakpoint from PC using any of the deprecated
-   macros BREAKPOINT, LITTLE_BREAKPOINT, BIG_BREAPOINT.  For legacy
-   targets that don't yet implement their own breakpoint_from_pc(). */
-extern gdbarch_breakpoint_from_pc_ftype legacy_breakpoint_from_pc;
-
 /* Implementation of extract return value that grubs around in the
    register cache.  */
 extern gdbarch_extract_return_value_ftype legacy_extract_return_value;
Index: gdbarch.sh
===================================================================
RCS file: /cvs/src/src/gdb/gdbarch.sh,v
retrieving revision 1.235
diff -u -r1.235 gdbarch.sh
--- gdbarch.sh	8 May 2003 20:52:47 -0000	1.235
+++ gdbarch.sh	14 May 2003 12:13:13 -0000
@@ -591,7 +591,7 @@
 f:2:SKIP_PROLOGUE:CORE_ADDR:skip_prologue:CORE_ADDR ip:ip::0:0
 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:2:BREAKPOINT_FROM_PC:const unsigned char *:breakpoint_from_pc:CORE_ADDR *pcptr, int *lenptr:pcptr, lenptr:::legacy_breakpoint_from_pc::0
+f::BREAKPOINT_FROM_PC:const unsigned char *:breakpoint_from_pc:CORE_ADDR *pcptr, int *lenptr:pcptr, lenptr:::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: hppa-tdep.c
===================================================================
RCS file: /cvs/src/src/gdb/hppa-tdep.c,v
retrieving revision 1.75
diff -u -r1.75 hppa-tdep.c
--- hppa-tdep.c	8 May 2003 22:33:14 -0000	1.75
+++ hppa-tdep.c	14 May 2003 12:13:23 -0000
@@ -642,6 +642,14 @@
   return NULL;
 }
 
+const char *
+hppa_breakpoint_from_pc (CORE_ADDR *pc, int *len)
+{
+  const char *breakpoint[] = {0x00, 0x01, 0x00, 0x04};
+  (*len) = sizeof (breakpoint);
+  return breakpoint;
+}
+
 /* Return the adjustment necessary to make for addresses on the stack
    as presented by hpread.c.
 
Index: ia64-tdep.c
===================================================================
RCS file: /cvs/src/src/gdb/ia64-tdep.c,v
retrieving revision 1.76
diff -u -r1.76 ia64-tdep.c
--- ia64-tdep.c	13 May 2003 19:27:28 -0000	1.76
+++ ia64-tdep.c	14 May 2003 12:13:29 -0000
@@ -543,9 +543,9 @@
    using the pattern seen below. */
 
 #if 0
-#define BREAKPOINT 0x00002000040LL
+#define IA64_BREAKPOINT 0x00002000040LL
 #endif
-#define BREAKPOINT 0x00003333300LL
+#define IA64_BREAKPOINT 0x00003333300LL
 
 static int
 ia64_memory_insert_breakpoint (CORE_ADDR addr, char *contents_cache)
@@ -573,7 +573,7 @@
 
   instr = slotN_contents (bundle, slotnum);
   memcpy(contents_cache, &instr, sizeof(instr));
-  replace_slotN_contents (bundle, BREAKPOINT, slotnum);
+  replace_slotN_contents (bundle, IA64_BREAKPOINT, slotnum);
   if (val == 0)
     target_write_memory (addr, bundle, BUNDLE_LEN);
 
Index: mem-break.c
===================================================================
RCS file: /cvs/src/src/gdb/mem-break.c,v
retrieving revision 1.6
diff -u -r1.6 mem-break.c
--- mem-break.c	18 Apr 2002 18:09:02 -0000	1.6
+++ mem-break.c	14 May 2003 12:13:29 -0000
@@ -24,56 +24,13 @@
 
 #include "defs.h"
 
-/* This file is only useful if BREAKPOINT is set.  If not, we punt.  */
+/* This file is only useful if BREAKPOINT_FROM_PC is set.  If not, we
+   punt.  */
 
 #include "symtab.h"
 #include "breakpoint.h"
 #include "inferior.h"
 #include "target.h"
-
-
-/* Use the program counter to determine the contents and size
-   of a breakpoint instruction.  If no target-dependent macro
-   BREAKPOINT_FROM_PC has been defined to implement this function,
-   assume that the breakpoint doesn't depend on the PC, and
-   use the values of the BIG_BREAKPOINT and LITTLE_BREAKPOINT macros.
-   Return a pointer to a string of bytes that encode a breakpoint
-   instruction, stores the length of the string to *lenptr,
-   and optionally adjust the pc to point to the correct memory location
-   for inserting the breakpoint.  */
-
-const unsigned char *
-memory_breakpoint_from_pc (CORE_ADDR *pcptr, int *lenptr)
-{
-  /* {BIG_,LITTLE_}BREAKPOINT is the sequence of bytes we insert for a
-     breakpoint.  On some machines, breakpoints are handled by the
-     target environment and we don't have to worry about them here.  */
-#ifdef BIG_BREAKPOINT
-  if (TARGET_BYTE_ORDER == BFD_ENDIAN_BIG)
-    {
-      static unsigned char big_break_insn[] = BIG_BREAKPOINT;
-      *lenptr = sizeof (big_break_insn);
-      return big_break_insn;
-    }
-#endif
-#ifdef LITTLE_BREAKPOINT
-  if (TARGET_BYTE_ORDER != BFD_ENDIAN_BIG)
-    {
-      static unsigned char little_break_insn[] = LITTLE_BREAKPOINT;
-      *lenptr = sizeof (little_break_insn);
-      return little_break_insn;
-    }
-#endif
-#ifdef BREAKPOINT
-  {
-    static unsigned char break_insn[] = BREAKPOINT;
-    *lenptr = sizeof (break_insn);
-    return break_insn;
-  }
-#endif
-  *lenptr = 0;
-  return NULL;
-}
 
 
 /* Insert a breakpoint on targets that don't have any better breakpoint
Index: mips-tdep.c
===================================================================
RCS file: /cvs/src/src/gdb/mips-tdep.c,v
retrieving revision 1.198
diff -u -r1.198 mips-tdep.c
--- mips-tdep.c	13 May 2003 19:27:28 -0000	1.198
+++ mips-tdep.c	14 May 2003 12:13:33 -0000
@@ -5119,19 +5119,6 @@
     return print_insn_little_mips (memaddr, info);
 }
 
-/* Old-style breakpoint macros.
-   The IDT board uses an unusual breakpoint value, and sometimes gets
-   confused when it sees the usual MIPS breakpoint instruction.  */
-
-#define BIG_BREAKPOINT {0, 0x5, 0, 0xd}
-#define LITTLE_BREAKPOINT {0xd, 0, 0x5, 0}
-#define PMON_BIG_BREAKPOINT {0, 0, 0, 0xd}
-#define PMON_LITTLE_BREAKPOINT {0xd, 0, 0, 0}
-#define IDT_BIG_BREAKPOINT {0, 0, 0x0a, 0xd}
-#define IDT_LITTLE_BREAKPOINT {0xd, 0x0a, 0, 0}
-#define MIPS16_BIG_BREAKPOINT {0xe8, 0xa5}
-#define MIPS16_LITTLE_BREAKPOINT {0xa5, 0xe8}
-
 /* This function implements the BREAKPOINT_FROM_PC macro.  It uses the program
    counter value to determine whether a 16- or 32-bit breakpoint should be
    used.  It returns a pointer to a string of bytes that encode a breakpoint
@@ -5146,17 +5133,19 @@
     {
       if (pc_is_mips16 (*pcptr))
 	{
-	  static unsigned char mips16_big_breakpoint[] =
-	    MIPS16_BIG_BREAKPOINT;
+	  static unsigned char mips16_big_breakpoint[] = {0xe8, 0xa5};
 	  *pcptr = UNMAKE_MIPS16_ADDR (*pcptr);
 	  *lenptr = sizeof (mips16_big_breakpoint);
 	  return mips16_big_breakpoint;
 	}
       else
 	{
-	  static unsigned char big_breakpoint[] = BIG_BREAKPOINT;
-	  static unsigned char pmon_big_breakpoint[] = PMON_BIG_BREAKPOINT;
-	  static unsigned char idt_big_breakpoint[] = IDT_BIG_BREAKPOINT;
+	  /* The IDT board uses an unusual breakpoint value, and
+	     sometimes gets confused when it sees the usual MIPS
+	     breakpoint instruction.  */
+	  static unsigned char big_breakpoint[] = {0, 0x5, 0, 0xd};
+	  static unsigned char pmon_big_breakpoint[] = {0, 0, 0, 0xd};
+	  static unsigned char idt_big_breakpoint[] = {0, 0, 0x0a, 0xd};
 
 	  *lenptr = sizeof (big_breakpoint);
 
@@ -5174,19 +5163,16 @@
     {
       if (pc_is_mips16 (*pcptr))
 	{
-	  static unsigned char mips16_little_breakpoint[] =
-	    MIPS16_LITTLE_BREAKPOINT;
+	  static unsigned char mips16_little_breakpoint[] = {0xa5, 0xe8};
 	  *pcptr = UNMAKE_MIPS16_ADDR (*pcptr);
 	  *lenptr = sizeof (mips16_little_breakpoint);
 	  return mips16_little_breakpoint;
 	}
       else
 	{
-	  static unsigned char little_breakpoint[] = LITTLE_BREAKPOINT;
-	  static unsigned char pmon_little_breakpoint[] =
-	    PMON_LITTLE_BREAKPOINT;
-	  static unsigned char idt_little_breakpoint[] =
-	    IDT_LITTLE_BREAKPOINT;
+	  static unsigned char little_breakpoint[] = {0xd, 0, 0x5, 0};
+	  static unsigned char pmon_little_breakpoint[] = {0xd, 0, 0, 0};
+	  static unsigned char idt_little_breakpoint[] = {0xd, 0x0a, 0, 0};
 
 	  *lenptr = sizeof (little_breakpoint);
 
@@ -6138,8 +6124,6 @@
 		      "mips_dump_tdep: BADVADDR_REGNUM = %d\n",
 		      BADVADDR_REGNUM);
   fprintf_unfiltered (file,
-		      "mips_dump_tdep: BIG_BREAKPOINT = delete?\n");
-  fprintf_unfiltered (file,
 		      "mips_dump_tdep: CAUSE_REGNUM = %d\n",
 		      CAUSE_REGNUM);
   fprintf_unfiltered (file,
@@ -6170,10 +6154,6 @@
 		      "mips_dump_tdep:  HI_REGNUM = %d\n",
 		      HI_REGNUM);
   fprintf_unfiltered (file,
-		      "mips_dump_tdep: IDT_BIG_BREAKPOINT = delete?\n");
-  fprintf_unfiltered (file,
-		      "mips_dump_tdep: IDT_LITTLE_BREAKPOINT = delete?\n");
-  fprintf_unfiltered (file,
 		      "mips_dump_tdep: IGNORE_HELPER_CALL # %s\n",
 		      XSTRING (IGNORE_HELPER_CALL (PC)));
   fprintf_unfiltered (file,
@@ -6188,8 +6168,6 @@
 		      "mips_dump_tdep: LAST_EMBED_REGNUM = %d\n",
 		      LAST_EMBED_REGNUM);
   fprintf_unfiltered (file,
-		      "mips_dump_tdep: LITTLE_BREAKPOINT = delete?\n");
-  fprintf_unfiltered (file,
 		      "mips_dump_tdep: LO_REGNUM = %d\n",
 		      LO_REGNUM);
 #ifdef MACHINE_CPROC_FP_OFFSET
@@ -6210,13 +6188,9 @@
   fprintf_unfiltered (file,
 		      "mips_dump_tdep: MAKE_MIPS16_ADDR = FIXME!\n");
   fprintf_unfiltered (file,
-		      "mips_dump_tdep: MIPS16_BIG_BREAKPOINT = delete?\n");
-  fprintf_unfiltered (file,
 		      "mips_dump_tdep: MIPS16_INSTLEN = %d\n",
 		      MIPS16_INSTLEN);
   fprintf_unfiltered (file,
-		      "mips_dump_tdep: MIPS16_LITTLE_BREAKPOINT = delete?\n");
-  fprintf_unfiltered (file,
 		      "mips_dump_tdep: MIPS_DEFAULT_ABI = FIXME!\n");
   fprintf_unfiltered (file,
 		      "mips_dump_tdep: MIPS_EFI_SYMBOL_NAME = multi-arch!!\n");
@@ -6239,10 +6213,6 @@
 		      "mips_dump_tdep: OP_LDFPR = used?\n");
   fprintf_unfiltered (file,
 		      "mips_dump_tdep: OP_LDGPR = used?\n");
-  fprintf_unfiltered (file,
-		      "mips_dump_tdep: PMON_BIG_BREAKPOINT = delete?\n");
-  fprintf_unfiltered (file,
-		      "mips_dump_tdep: PMON_LITTLE_BREAKPOINT = delete?\n");
   fprintf_unfiltered (file,
 		      "mips_dump_tdep: PRID_REGNUM = %d\n",
 		      PRID_REGNUM);
Index: monitor.c
===================================================================
RCS file: /cvs/src/src/gdb/monitor.c,v
retrieving revision 1.40
diff -u -r1.40 monitor.c
--- monitor.c	8 May 2003 22:33:14 -0000	1.40
+++ monitor.c	14 May 2003 12:13:34 -0000
@@ -2098,7 +2098,7 @@
     addr = ADDR_BITS_REMOVE (addr);
 
   /* Determine appropriate breakpoint size for this address.  */
-  bp = memory_breakpoint_from_pc (&addr, &bplen);
+  bp = gdbarch_breakpoint_from_pc (current_gdbarch, &addr, &bplen);
 
   for (i = 0; i < current_monitor->num_breakpoints; i++)
     {
Index: proc-api.c
===================================================================
RCS file: /cvs/src/src/gdb/proc-api.c,v
retrieving revision 1.16
diff -u -r1.16 proc-api.c
--- proc-api.c	7 Feb 2003 04:49:34 -0000	1.16
+++ proc-api.c	14 May 2003 12:13:36 -0000
@@ -574,16 +574,6 @@
 	break;
       default:
 	{
-#ifdef BREAKPOINT
-	  static unsigned char break_insn[] = BREAKPOINT;
-
-	  if (len == sizeof (break_insn) &&
-	      memcmp (arg, &break_insn, len) == 0)
-	    fprintf (procfs_file ? procfs_file : stdout, 
-		     "write (<breakpoint at 0x%08lx>) \n", 
-		     (unsigned long) lseek_offset);
-	  else 
-#endif
 	  if (rw_table[i].name)
 	    fprintf (procfs_file ? procfs_file : stdout, 
 		     "write (%s) %s\n", 
Index: remote-mips.c
===================================================================
RCS file: /cvs/src/src/gdb/remote-mips.c,v
retrieving revision 1.34
diff -u -r1.34 remote-mips.c
--- remote-mips.c	8 May 2003 22:33:14 -0000	1.34
+++ remote-mips.c	14 May 2003 12:13:38 -0000
@@ -2251,13 +2251,13 @@
 /* We can write a breakpoint and read the shadow contents in one
    operation.  */
 
-/* Insert a breakpoint.  On targets that don't have built-in breakpoint
-   support, we read the contents of the target location and stash it,
-   then overwrite it with a breakpoint instruction.  ADDR is the target
-   location in the target machine.  CONTENTS_CACHE is a pointer to 
-   memory allocated for saving the target contents.  It is guaranteed
-   by the caller to be long enough to save sizeof BREAKPOINT bytes (this
-   is accomplished via BREAKPOINT_MAX).  */
+/* Insert a breakpoint.  On targets that don't have built-in
+   breakpoint support, we read the contents of the target location and
+   stash it, then overwrite it with a breakpoint instruction.  ADDR is
+   the target location in the target machine.  CONTENTS_CACHE is a
+   pointer to memory allocated for saving the target contents.  It is
+   guaranteed by the caller to be long enough to save the breakpoint
+   length returned by BREAKPOINT_FROM_PC.  */
 
 static int
 mips_insert_breakpoint (CORE_ADDR addr, char *contents_cache)
Index: remote.c
===================================================================
RCS file: /cvs/src/src/gdb/remote.c,v
retrieving revision 1.98
diff -u -r1.98 remote.c
--- remote.c	8 May 2003 20:52:48 -0000	1.98
+++ remote.c	14 May 2003 12:13:50 -0000
@@ -4624,11 +4624,12 @@
 }
 
 
-/* On some machines, e.g. 68k, we may use a different breakpoint instruction
-   than other targets; in those use REMOTE_BREAKPOINT instead of just
-   BREAKPOINT.  Also, bi-endian targets may define LITTLE_REMOTE_BREAKPOINT
-   and BIG_REMOTE_BREAKPOINT.  If none of these are defined, we just call
-   the standard routines that are in mem-break.c.  */
+/* On some machines, e.g. 68k, we may use a different breakpoint
+   instruction than other targets; in those use REMOTE_BREAKPOINT
+   instead of just BREAKPOINT_FROM_PC.  Also, bi-endian targets may
+   define LITTLE_REMOTE_BREAKPOINT and BIG_REMOTE_BREAKPOINT.  If none
+   of these are defined, we just call the standard routines that are
+   in mem-break.c.  */
 
 /* FIXME, these ought to be done in a more dynamic fashion.  For instance,
    the choice of breakpoint instruction affects target program design and
@@ -4652,13 +4653,13 @@
 
 #endif /* REMOTE_BREAKPOINT */
 
-/* Insert a breakpoint on targets that don't have any better breakpoint
-   support.  We read the contents of the target location and stash it,
-   then overwrite it with a breakpoint instruction.  ADDR is the target
-   location in the target machine.  CONTENTS_CACHE is a pointer to 
-   memory allocated for saving the target contents.  It is guaranteed
-   by the caller to be long enough to save sizeof BREAKPOINT bytes (this
-   is accomplished via BREAKPOINT_MAX).  */
+/* Insert a breakpoint on targets that don't have any better
+   breakpoint support.  We read the contents of the target location
+   and stash it, then overwrite it with a breakpoint instruction.
+   ADDR is the target location in the target machine.  CONTENTS_CACHE
+   is a pointer to memory allocated for saving the target contents.
+   It is guaranteed by the caller to be long enough to save the number
+   of bytes returned by BREAKPOINT_FROM_PC.  */
 
 static int
 remote_insert_breakpoint (CORE_ADDR addr, char *contents_cache)
Index: rs6000-tdep.c
===================================================================
RCS file: /cvs/src/src/gdb/rs6000-tdep.c,v
retrieving revision 1.132
diff -u -r1.132 rs6000-tdep.c
--- rs6000-tdep.c	13 May 2003 19:27:28 -0000	1.132
+++ rs6000-tdep.c	14 May 2003 12:13:58 -0000
@@ -305,14 +305,11 @@
 
 /* Sequence of bytes for breakpoint instruction.  */
 
-#define BIG_BREAKPOINT { 0x7d, 0x82, 0x10, 0x08 }
-#define LITTLE_BREAKPOINT { 0x08, 0x10, 0x82, 0x7d }
-
 const static unsigned char *
 rs6000_breakpoint_from_pc (CORE_ADDR *bp_addr, int *bp_size)
 {
-  static unsigned char big_breakpoint[] = BIG_BREAKPOINT;
-  static unsigned char little_breakpoint[] = LITTLE_BREAKPOINT;
+  static unsigned char big_breakpoint[] = { 0x7d, 0x82, 0x10, 0x08 };
+  static unsigned char little_breakpoint[] = { 0x08, 0x10, 0x82, 0x7d };
   *bp_size = 4;
   if (TARGET_BYTE_ORDER == BFD_ENDIAN_BIG)
     return big_breakpoint;
Index: s390-tdep.c
===================================================================
RCS file: /cvs/src/src/gdb/s390-tdep.c,v
retrieving revision 1.96
diff -u -r1.96 s390-tdep.c
--- s390-tdep.c	5 May 2003 17:56:55 -0000	1.96
+++ s390-tdep.c	14 May 2003 12:14:15 -0000
@@ -1825,9 +1825,9 @@
   set_gdbarch_deprecated_store_struct_return (gdbarch, s390_store_struct_return);
   set_gdbarch_deprecated_extract_return_value (gdbarch, s390_extract_return_value);
   set_gdbarch_deprecated_store_return_value (gdbarch, s390_store_return_value);
-  /* Amount PC must be decremented by after a breakpoint.
-     This is often the number of bytes in BREAKPOINT
-     but not always.  */
+  /* Amount PC must be decremented by after a breakpoint.  This is
+     often the number of bytes returned by BREAKPOINT_FROM_PC but not
+     always.  */
   set_gdbarch_decr_pc_after_break (gdbarch, 2);
   set_gdbarch_deprecated_pop_frame (gdbarch, s390_pop_frame);
   /* Stack grows downward.  */
Index: sparc-tdep.c
===================================================================
RCS file: /cvs/src/src/gdb/sparc-tdep.c,v
retrieving revision 1.99
diff -u -r1.99 sparc-tdep.c
--- sparc-tdep.c	13 May 2003 19:27:28 -0000	1.99
+++ sparc-tdep.c	14 May 2003 12:14:18 -0000
@@ -151,6 +151,14 @@
 #endif
 
 
+const char *
+sparc_breakpoint_from_pc (CORE_ADDR *pc, int *len)
+{
+  const char *breakpoint[] = {0x91, 0xd0, 0x20, 0x01};
+  (*len) = sizeof (breakpoint);
+  return breakpoint;
+}
+
 /* Fetch a single instruction.  Even on bi-endian machines
    such as sparc86x, instructions are always big-endian.  */
 
@@ -3153,7 +3161,7 @@
 
   /* First set settings that are common for all sparc architectures.  */
   set_gdbarch_believe_pcc_promotion (gdbarch, 1);
-  set_gdbarch_breakpoint_from_pc (gdbarch, memory_breakpoint_from_pc);
+  set_gdbarch_breakpoint_from_pc (gdbarch, sparc_breakpoint_from_pc);
   set_gdbarch_decr_pc_after_break (gdbarch, 0);
   set_gdbarch_double_bit (gdbarch, 8 * TARGET_CHAR_BIT);
   set_gdbarch_deprecated_extract_struct_value_address (gdbarch, sparc_extract_struct_value_address);
Index: target.h
===================================================================
RCS file: /cvs/src/src/gdb/target.h,v
retrieving revision 1.38
diff -u -r1.38 target.h
--- target.h	21 Apr 2003 16:48:39 -0000	1.38
+++ target.h	14 May 2003 12:14:19 -0000
@@ -552,11 +552,11 @@
 #define	target_files_info()	\
      (*current_target.to_files_info) (&current_target)
 
-/* Insert a breakpoint at address ADDR in the target machine.
-   SAVE is a pointer to memory allocated for saving the
-   target contents.  It is guaranteed by the caller to be long enough
-   to save "sizeof BREAKPOINT" bytes.  Result is 0 for success, or
-   an errno value.  */
+/* Insert a breakpoint at address ADDR in the target machine.  SAVE is
+   a pointer to memory allocated for saving the target contents.  It
+   is guaranteed by the caller to be long enough to save the number of
+   breakpoint bytes indicated by BREAKPOINT_FROM_PC.  Result is 0 for
+   success, or an errno value.  */
 
 #define	target_insert_breakpoint(addr, save)	\
      (*current_target.to_insert_breakpoint) (addr, save)
@@ -1125,9 +1125,6 @@
 extern int default_memory_remove_breakpoint (CORE_ADDR, char *);
 
 extern int default_memory_insert_breakpoint (CORE_ADDR, char *);
-
-extern const unsigned char *memory_breakpoint_from_pc (CORE_ADDR *pcptr,
-						       int *lenptr);
 
 
 /* From target.c */
Index: config/pa/tm-hppa.h
===================================================================
RCS file: /cvs/src/src/gdb/config/pa/tm-hppa.h,v
retrieving revision 1.50
diff -u -r1.50 tm-hppa.h
--- config/pa/tm-hppa.h	5 May 2003 17:56:56 -0000	1.50
+++ config/pa/tm-hppa.h	14 May 2003 12:14:22 -0000
@@ -60,7 +60,8 @@
 
 /* Sequence of bytes for breakpoint instruction.  */
 
-#define BREAKPOINT {0x00, 0x01, 0x00, 0x04}
+const unsigned char *hppa_breakpoint_from_pc (CORE_ADDR *pcptr, int *lenptr);
+#define BREAKPOINT_FROM_PC(PCPTR,LENPTR) hppa_breakpoint_from_pc ((PCPTR), (LENPTR))
 #define BREAKPOINT32 0x10004
 
 extern int hppa_pc_requires_run_before_use (CORE_ADDR pc);
Index: config/pa/tm-hppa64.h
===================================================================
RCS file: /cvs/src/src/gdb/config/pa/tm-hppa64.h,v
retrieving revision 1.17
diff -u -r1.17 tm-hppa64.h
--- config/pa/tm-hppa64.h	12 May 2003 00:26:18 -0000	1.17
+++ config/pa/tm-hppa64.h	14 May 2003 12:14:22 -0000
@@ -97,9 +97,8 @@
 #define STACK_ALIGN(sp) hppa_stack_align (sp)
 #endif
 
-/* Amount PC must be decremented by after a breakpoint.
-   This is often the number of bytes in BREAKPOINT
-   but not always.
+/* Amount PC must be decremented by after a breakpoint.  This is often
+   the number of bytes returned by BREAKPOINT_FROM_PC but not always.
 
    Not on the PA-RISC */
 
Index: config/sparc/tm-sparc.h
===================================================================
RCS file: /cvs/src/src/gdb/config/sparc/tm-sparc.h,v
retrieving revision 1.48
diff -u -r1.48 tm-sparc.h
--- config/sparc/tm-sparc.h	5 May 2003 17:56:57 -0000	1.48
+++ config/sparc/tm-sparc.h	14 May 2003 12:14:23 -0000
@@ -164,9 +164,8 @@
 
 #define FUNCTION_START_OFFSET 0
 
-/* Amount PC must be decremented by after a breakpoint.
-   This is often the number of bytes in BREAKPOINT
-   but not always.  */
+/* Amount PC must be decremented by after a breakpoint.  This is often
+   the number of bytes returned by BREAKPOINT_FROM_PC but not always.  */
 
 #define DECR_PC_AFTER_BREAK 0
 
@@ -361,7 +360,8 @@
 
 /* Sequence of bytes for breakpoint instruction (ta 1). */
 
-#define BREAKPOINT {0x91, 0xd0, 0x20, 0x01}
+extern const char *sparc_breakpoint_from_pc (CORE_ADDR *pc, int *len);
+#define BREAKPOINT_FROM_PC(PC,LEN) sparc_breakpoint_from_pc ((PC), (LEN))
 
 /* Register numbers of various important registers.
    Note that some of these values are "real" register numbers,
Index: doc/gdbint.texinfo
===================================================================
RCS file: /cvs/src/src/gdb/doc/gdbint.texinfo,v
retrieving revision 1.144
diff -u -r1.144 gdbint.texinfo
--- doc/gdbint.texinfo	5 May 2003 17:56:57 -0000	1.144
+++ doc/gdbint.texinfo	14 May 2003 12:14:36 -0000
@@ -324,9 +324,9 @@
 although in practice only the ARC has failed to define such an
 instruction.
 
-@findex BREAKPOINT
-The basic definition of the software breakpoint is the macro
-@code{BREAKPOINT}.
+@findex BREAKPOINT_FROM_PC
+The basic definition of the software breakpoint is the architecture
+method @code{BREAKPOINT_FROM_PC} (@pxref{BREAKPOINT_FROM_PC}).
 
 Basic breakpoint object handling is in @file{breakpoint.c}.  However,
 much of the interesting breakpoint action is in @file{infrun.c}.
@@ -3021,52 +3021,29 @@
 endianness of the target byte order.  A value of 1 means that the bits
 are numbered in a big-endian bit order, 0 means little-endian.
 
-@item BREAKPOINT
-@findex BREAKPOINT
-This is the character array initializer for the bit pattern to put into
-memory where a breakpoint is set.  Although it's common to use a trap
-instruction for a breakpoint, it's not required; for instance, the bit
-pattern could be an invalid instruction.  The breakpoint must be no
-longer than the shortest instruction of the architecture.
-
-@code{BREAKPOINT} has been deprecated in favor of
-@code{BREAKPOINT_FROM_PC}.
-
-@item BIG_BREAKPOINT
-@itemx LITTLE_BREAKPOINT
-@findex LITTLE_BREAKPOINT
-@findex BIG_BREAKPOINT
-Similar to BREAKPOINT, but used for bi-endian targets.
-
-@code{BIG_BREAKPOINT} and @code{LITTLE_BREAKPOINT} have been deprecated in
-favor of @code{BREAKPOINT_FROM_PC}.
-
 @item REMOTE_BREAKPOINT
 @itemx LITTLE_REMOTE_BREAKPOINT
 @itemx BIG_REMOTE_BREAKPOINT
 @findex BIG_REMOTE_BREAKPOINT
 @findex LITTLE_REMOTE_BREAKPOINT
 @findex REMOTE_BREAKPOINT
-Similar to BREAKPOINT, but used for remote targets.
-
-@code{BIG_REMOTE_BREAKPOINT} and @code{LITTLE_REMOTE_BREAKPOINT} have been
-deprecated in favor of @code{BREAKPOINT_FROM_PC}.
+@code{BIG_REMOTE_BREAKPOINT} and @code{LITTLE_REMOTE_BREAKPOINT} have
+been deprecated in favor of @code{BREAKPOINT_FROM_PC}.
 
 @item BREAKPOINT_FROM_PC (@var{pcptr}, @var{lenptr})
 @findex BREAKPOINT_FROM_PC
-Use the program counter to determine the contents and size of a
-breakpoint instruction.  It returns a pointer to a string of bytes
-that encode a breakpoint instruction, stores the length of the string
-to *@var{lenptr}, and adjusts pc (if necessary) to point to the actual
-memory location where the breakpoint should be inserted.
+@anchor{BREAKPOINT_FROM_PC} Use the program counter to determine the
+contents and size of a breakpoint instruction.  It returns a pointer to
+a string of bytes that encode a breakpoint instruction, stores the
+length of the string to *@var{lenptr}, and adjusts pc (if necessary) to
+point to the actual memory location where the breakpoint should be
+inserted.
 
 Although it is common to use a trap instruction for a breakpoint, it's
 not required; for instance, the bit pattern could be an invalid
 instruction.  The breakpoint must be no longer than the shortest
 instruction of the architecture.
 
-Replaces all the other @var{BREAKPOINT} macros.
-
 @item MEMORY_INSERT_BREAKPOINT (@var{addr}, @var{contents_cache})
 @itemx MEMORY_REMOVE_BREAKPOINT (@var{addr}, @var{contents_cache})
 @findex MEMORY_REMOVE_BREAKPOINT
@@ -3159,7 +3136,8 @@
 @findex DECR_PC_AFTER_BREAK
 Define this to be the amount by which to decrement the PC after the
 program encounters a breakpoint.  This is often the number of bytes in
-@code{BREAKPOINT}, though not always.  For most targets this value will be 0.
+the target's breakpoint instruction (@pxref{BREAKPOINT_FROM_PC}), though
+not always.  For most targets this value will be 0.
 
 @item DECR_PC_AFTER_HW_BREAK
 @findex DECR_PC_AFTER_HW_BREAK

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