* gdbarch.sh (BREAKPOINT_FROM_PC): Return a const buffer.
[platform/upstream/binutils.git] / gdb / mem-break.c
index 99db9d2..9cf638e 100644 (file)
@@ -1,5 +1,8 @@
 /* Simulate breakpoints by patching locations in the target system, for GDB.
 /* Simulate breakpoints by patching locations in the target system, for GDB.
-   Copyright 1990, 1991, 1995 Free Software Foundation, Inc.
+
+   Copyright 1990, 1991, 1992, 1993, 1995, 1997, 1998, 1999, 2000,
+   2002 Free Software Foundation, Inc.
+
    Contributed by Cygnus Support.  Written by John Gilmore.
 
    This file is part of GDB.
    Contributed by Cygnus Support.  Written by John Gilmore.
 
    This file is part of GDB.
    and optionally adjust the pc to point to the correct memory location
    for inserting the breakpoint.  */
 
    and optionally adjust the pc to point to the correct memory location
    for inserting the breakpoint.  */
 
-unsigned char *
-memory_breakpoint_from_pc (pcptr, lenptr)
-     CORE_ADDR *pcptr;
-     int *lenptr;
+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
 {
   /* {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 == BIG_ENDIAN)
+  if (TARGET_BYTE_ORDER == BFD_ENDIAN_BIG)
     {
       static unsigned char big_break_insn[] = BIG_BREAKPOINT;
       *lenptr = sizeof (big_break_insn);
     {
       static unsigned char big_break_insn[] = BIG_BREAKPOINT;
       *lenptr = sizeof (big_break_insn);
@@ -56,7 +57,7 @@ memory_breakpoint_from_pc (pcptr, lenptr)
     }
 #endif
 #ifdef LITTLE_BREAKPOINT
     }
 #endif
 #ifdef LITTLE_BREAKPOINT
-  if (TARGET_BYTE_ORDER != BIG_ENDIAN)
+  if (TARGET_BYTE_ORDER != BFD_ENDIAN_BIG)
     {
       static unsigned char little_break_insn[] = LITTLE_BREAKPOINT;
       *lenptr = sizeof (little_break_insn);
     {
       static unsigned char little_break_insn[] = LITTLE_BREAKPOINT;
       *lenptr = sizeof (little_break_insn);
@@ -84,12 +85,10 @@ memory_breakpoint_from_pc (pcptr, lenptr)
    is accomplished via BREAKPOINT_MAX).  */
 
 int
    is accomplished via BREAKPOINT_MAX).  */
 
 int
-default_memory_insert_breakpoint (addr, contents_cache)
-     CORE_ADDR addr;
-     char *contents_cache;
+default_memory_insert_breakpoint (CORE_ADDR addr, char *contents_cache)
 {
   int val;
 {
   int val;
-  unsigned char *bp;
+  const unsigned char *bp;
   int bplen;
 
   /* Determine appropriate breakpoint contents and size for this address.  */
   int bplen;
 
   /* Determine appropriate breakpoint contents and size for this address.  */
@@ -109,11 +108,9 @@ default_memory_insert_breakpoint (addr, contents_cache)
 
 
 int
 
 
 int
-default_memory_remove_breakpoint (addr, contents_cache)
-     CORE_ADDR addr;
-     char *contents_cache;
+default_memory_remove_breakpoint (CORE_ADDR addr, char *contents_cache)
 {
 {
-  unsigned char *bp;
+  const unsigned char *bp;
   int bplen;
 
   /* Determine appropriate breakpoint contents and size for this address.  */
   int bplen;
 
   /* Determine appropriate breakpoint contents and size for this address.  */
@@ -125,26 +122,14 @@ default_memory_remove_breakpoint (addr, contents_cache)
 }
 
 
 }
 
 
-#if !defined(MEMORY_INSERT_BREAKPOINT)
-#define MEMORY_INSERT_BREAKPOINT(addr, contents_cache) \
-  default_memory_insert_breakpoint(addr, contents_cache)
-#endif
 int
 int
-memory_insert_breakpoint (addr, contents_cache)
-     CORE_ADDR addr;
-     char *contents_cache;
+memory_insert_breakpoint (CORE_ADDR addr, char *contents_cache)
 {
   return MEMORY_INSERT_BREAKPOINT(addr, contents_cache);
 }
 
 {
   return MEMORY_INSERT_BREAKPOINT(addr, contents_cache);
 }
 
-#if !defined(MEMORY_REMOVE_BREAKPOINT)
-#define MEMORY_REMOVE_BREAKPOINT(addr, contents_cache) \
-  default_memory_remove_breakpoint(addr, contents_cache)
-#endif
 int
 int
-memory_remove_breakpoint (addr, contents_cache)
-     CORE_ADDR addr;
-     char *contents_cache;
+memory_remove_breakpoint (CORE_ADDR addr, char *contents_cache)
 {
   return MEMORY_REMOVE_BREAKPOINT(addr, contents_cache);
 }
 {
   return MEMORY_REMOVE_BREAKPOINT(addr, contents_cache);
 }