* inftarg.c (child_thread_alive): New function to see if a
[deliverable/binutils-gdb.git] / gdb / breakpoint.c
index c2abcd03f4b5a444eb592b7ccadbd01ff0db3745..94e1dd5e4faf5720f82bb0eae69dfd089939b01b 100644 (file)
@@ -1,5 +1,6 @@
 /* Everything about breakpoints, for GDB.
-   Copyright 1986, 1987, 1989, 1990, 1991, 1992 Free Software Foundation, Inc.
+   Copyright 1986, 1987, 1989, 1990, 1991, 1992, 1993, 1994, 1995
+             Free Software Foundation, Inc.
 
 This file is part of GDB.
 
@@ -35,6 +36,7 @@ Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA.  */
 #include "language.h"
 #include <string.h>
 #include "demangle.h"
+#include "annotate.h"
 
 /* local function prototypes */
 
@@ -56,15 +58,9 @@ enable_once_breakpoint PARAMS ((struct breakpoint *));
 static void
 disable_command PARAMS ((char *, int));
 
-static void
-disable_breakpoint PARAMS ((struct breakpoint *));
-
 static void
 enable_command PARAMS ((char *, int));
 
-static void
-enable_breakpoint PARAMS ((struct breakpoint *));
-
 static void
 map_breakpoint_numbers PARAMS ((char *,        void (*)(struct breakpoint *)));
 
@@ -141,7 +137,6 @@ static int
 remove_breakpoint PARAMS ((struct breakpoint *));
 
 extern int addressprint;               /* Print machine addresses? */
-extern int demangle;                   /* Print de-mangled symbol names? */
 
 /* Are we executing breakpoint commands?  */
 static int executing_breakpoint_commands;
@@ -157,9 +152,21 @@ static int executing_breakpoint_commands;
             b? (tmp=b->next, 1): 0;    \
             b = tmp)
 
-/* By default no support for hardware watchpoints is assumed.  */
+/* Provide defaults for systems that don't support hardware watchpoints. */
+
 #ifndef TARGET_CAN_USE_HARDWARE_WATCHPOINT
+
+/* Returns non-zero if we can set a hardware watchpoint of type TYPE.  TYPE is
+   one of bp_hardware_watchpoint, bp_read_watchpoint, bp_write_watchpoint, or
+   bp_hardware_breakpoint.  CNT is the number of such watchpoints used so far
+   (including this one?).  OTHERTYPE is who knows what...  */
+
 #define TARGET_CAN_USE_HARDWARE_WATCHPOINT(TYPE,CNT,OTHERTYPE) 0
+
+/* Set/clear a hardware watchpoint starting at ADDR, for LEN bytes.  TYPE is 1
+   for read and 2 for read/write accesses.  Returns 0 for success, non-zero for
+   failure.  */
+
 #define target_remove_watchpoint(ADDR,LEN,TYPE) -1
 #define target_insert_watchpoint(ADDR,LEN,TYPE) -1
 #endif
@@ -173,15 +180,20 @@ static int executing_breakpoint_commands;
 #define target_stopped_data_address() 0
 #endif
 
+/* True if breakpoint hit counts should be displayed in breakpoint info.  */
+
+int show_breakpoint_hit_counts = 1;
+
 /* Chain of all breakpoints defined.  */
 
-static struct breakpoint *breakpoint_chain;
+struct breakpoint *breakpoint_chain;
 
 /* Number of last breakpoint made.  */
 
 static int breakpoint_count;
 
 /* Set breakpoint count to NUM.  */
+
 static void
 set_breakpoint_count (num)
      int num;
@@ -191,6 +203,17 @@ set_breakpoint_count (num)
                   value_from_longest (builtin_type_int, (LONGEST) num));
 }
 
+/* Used in run_command to zero the hit count when a new run starts. */
+
+void
+clear_breakpoint_hit_counts ()
+{
+  struct breakpoint *b;
+
+  ALL_BREAKPOINTS (b)
+    b->hit_count = 0;
+}
+
 /* Default address, symtab and line to put a breakpoint at
    for "break" command with no arg.
    if default_breakpoint_valid is zero, the other three are
@@ -303,6 +326,7 @@ condition_command (arg, from_tty)
            if (*arg)
              error ("Junk at end of expression");
          }
+       breakpoints_changed ();
        return;
       }
 
@@ -509,7 +533,7 @@ insert_breakpoints ()
             && ! b->inserted
             && ! b->duplicate)
       {
-       FRAME saved_frame;
+       struct frame_info *saved_frame;
        int saved_level, within_current_scope;
        value_ptr mark = value_mark ();
        value_ptr v;
@@ -524,10 +548,11 @@ insert_breakpoints ()
          within_current_scope = 1;
        else
          {
-           FRAME fr = find_frame_addr_in_frame_chain (b->watchpoint_frame);
-           within_current_scope = (fr != NULL);
+           struct frame_info *fi =
+             find_frame_addr_in_frame_chain (b->watchpoint_frame);
+           within_current_scope = (fi != NULL);
            if (within_current_scope)
-             select_frame (fr, -1);
+             select_frame (fi, -1);
          }
        
        if (within_current_scope)
@@ -736,7 +761,7 @@ breakpoint_here_p (pc)
 
 int
 frame_in_dummy (frame)
-     FRAME frame;
+     struct frame_info *frame;
 {
   struct breakpoint *b;
 
@@ -916,6 +941,7 @@ bpstat_do_actions (bsp)
 {
   bpstat bs;
   struct cleanup *old_chain;
+  struct command_line *cmd;
 
   executing_breakpoint_commands = 1;
   old_chain = make_cleanup (cleanup_executing_breakpoints, 0);
@@ -926,18 +952,20 @@ top:
   breakpoint_proceeded = 0;
   for (; bs != NULL; bs = bs->next)
     {
-      while (bs->commands)
+      cmd = bs->commands;
+      while (cmd != NULL)
        {
-         char *line = bs->commands->line;
-         bs->commands = bs->commands->next;
-         execute_command (line, 0);
-         /* If the inferior is proceeded by the command, bomb out now.
-            The bpstat chain has been blown away by wait_for_inferior.
-            But since execution has stopped again, there is a new bpstat
-            to look at, so start over.  */
-         if (breakpoint_proceeded)
-           goto top;
+         execute_control_command (cmd);
+         cmd = cmd->next;
        }
+      if (breakpoint_proceeded)
+       /* The inferior is proceeded by the command; bomb out now.
+          The bpstat chain has been blown away by wait_for_inferior.
+          But since execution has stopped again, there is a new bpstat
+          to look at, so start over.  */
+       goto top;
+      else
+       bs->commands = NULL;
     }
 
   executing_breakpoint_commands = 0;
@@ -1066,8 +1094,6 @@ bpstat_alloc (b, cbs)
   return bs;
 }
 \f
-
-
 /* Possible return values for watchpoint_check (this can't be an enum
    because of check_errors).  */
 /* The watchpoint has been deleted.  */
@@ -1077,26 +1103,31 @@ bpstat_alloc (b, cbs)
 /* The value has not changed.  */
 #define WP_VALUE_NOT_CHANGED 3
 
+#define BP_TEMPFLAG 1
+#define BP_HARDWAREFLAG 2
+
 /* Check watchpoint condition.  */
+
 static int
 watchpoint_check (p)
      char *p;
 {
   bpstat bs = (bpstat) p;
   struct breakpoint *b;
-  FRAME saved_frame, fr;
+  struct frame_info *saved_frame, *fr;
   int within_current_scope, saved_level;
 
-  /* Save the current frame and level so we can restore it after
-     evaluating the watchpoint expression on its own frame.  */
-  saved_frame = selected_frame;
-  saved_level = selected_frame_level;
+  b = bs->breakpoint_at;
 
-  if (bs->breakpoint_at->exp_valid_block == NULL)
+  if (b->exp_valid_block == NULL)
     within_current_scope = 1;
   else
     {
-      fr = find_frame_addr_in_frame_chain (bs->breakpoint_at->watchpoint_frame);
+      /* There is no current frame at this moment.  If we're going to have
+        any chance of handling watchpoints on local variables, we'll need
+        the frame chain (so we can determine if we're in scope).  */
+      reinit_frame_cache();
+      fr = find_frame_addr_in_frame_chain (b->watchpoint_frame);
       within_current_scope = (fr != NULL);
       if (within_current_scope)
        /* If we end up stopping, the current frame will get selected
@@ -1114,14 +1145,13 @@ watchpoint_check (p)
 
       value_ptr mark = value_mark ();
       value_ptr new_val = evaluate_expression (bs->breakpoint_at->exp);
-      if (!value_equal (bs->breakpoint_at->val, new_val))
+      if (!value_equal (b->val, new_val))
        {
          release_value (new_val);
          value_free_to_mark (mark);
-         bs->old_val = bs->breakpoint_at->val;
-         bs->breakpoint_at->val = new_val;
+         bs->old_val = b->val;
+         b->val = new_val;
          /* We will stop here */
-         select_frame (saved_frame, saved_level);
          return WP_VALUE_CHANGED;
        }
       else
@@ -1129,7 +1159,6 @@ watchpoint_check (p)
          /* Nothing changed, don't do anything.  */
          value_free_to_mark (mark);
          /* We won't stop here */
-         select_frame (saved_frame, saved_level);
          return WP_VALUE_NOT_CHANGED;
        }
     }
@@ -1146,11 +1175,10 @@ watchpoint_check (p)
       printf_filtered ("\
 Watchpoint %d deleted because the program has left the block in\n\
 which its expression is valid.\n", bs->breakpoint_at->number);
-      if (bs->breakpoint_at->related_breakpoint)
-       delete_breakpoint (bs->breakpoint_at->related_breakpoint);
-      delete_breakpoint (bs->breakpoint_at);
+      if (b->related_breakpoint)
+       delete_breakpoint (b->related_breakpoint);
+      delete_breakpoint (b);
 
-      select_frame (saved_frame, saved_level);
       return WP_DELETED;
     }
 }
@@ -1174,7 +1202,7 @@ print_it_noop (bs)
 }
 
 /* Get a bpstat associated with having just stopped at address *PC
-   and frame address FRAME_ADDRESS.  Update *PC to point at the
+   and frame address CORE_ADDRESS.  Update *PC to point at the
    breakpoint (if we hit a breakpoint).  NOT_A_BREAKPOINT is nonzero
    if this is known to not be a real breakpoint (it could still be a
    watchpoint, though).  */
@@ -1196,9 +1224,8 @@ print_it_noop (bs)
  */
 
 bpstat
-bpstat_stop_status (pc, frame_address, not_a_breakpoint)
+bpstat_stop_status (pc, not_a_breakpoint)
      CORE_ADDR *pc;
-     FRAME_ADDR frame_address;
      int not_a_breakpoint;
 {
   register struct breakpoint *b;
@@ -1208,7 +1235,7 @@ bpstat_stop_status (pc, frame_address, not_a_breakpoint)
   int real_breakpoint = 0;
 #endif
   /* Root of the chain of bpstat's */
-  struct bpstat root_bs[1];
+  struct bpstats root_bs[1];
   /* Pointer to the last thing in the chain currently.  */
   bpstat bs = root_bs;
   static char message1[] =
@@ -1231,9 +1258,14 @@ bpstat_stop_status (pc, frame_address, not_a_breakpoint)
          && b->address != bp_addr)
        continue;
 
+/* If defined, then we need to decr pc by this much after a hardware break-
+   point.  Presumably should override DECR_PC_AFTER_BREAK, though it doesn't
+   now...  */
+
 #ifndef DECR_PC_AFTER_HW_BREAK
 #define DECR_PC_AFTER_HW_BREAK 0
 #endif
+
       if (b->type == bp_hardware_breakpoint
          && b->address != (bp_addr - DECR_PC_AFTER_HW_BREAK))
        continue;
@@ -1247,6 +1279,8 @@ bpstat_stop_status (pc, frame_address, not_a_breakpoint)
 
       /* Come here if it's a watchpoint, or if the break address matches */
 
+      ++(b->hit_count);
+
       bs = bpstat_alloc (b, bs);       /* Alloc a bpstat to explain stop */
 
       bs->stop = 1;
@@ -1337,7 +1371,7 @@ bpstat_stop_status (pc, frame_address, not_a_breakpoint)
        real_breakpoint = 1;
 #endif
 
-      if (b->frame && b->frame != frame_address)
+      if (b->frame && b->frame != (get_current_frame ())->frame)
        bs->stop = 0;
       else
        {
@@ -1689,8 +1723,7 @@ breakpoint_1 (bnum, allflag)
            /* Field 4, the address, is omitted (which makes the columns
               not line up too nicely with the headers, but the effect
               is relatively readable).  */
-           if (annotation_level > 1)
-             printf_filtered ("\n\032\032field 5\n");
+           annotate_field (5);
            print_expression (b->exp, gdb_stdout);
            break;
 
@@ -1756,6 +1789,14 @@ breakpoint_1 (bnum, allflag)
            printf_filtered ("\n");
          }
 
+        if (show_breakpoint_hit_counts && b->hit_count)
+         {
+           /* FIXME should make an annotation for this */
+
+           printf_filtered ("\tbreakpoint already hit %d time%s\n",
+                            b->hit_count, (b->hit_count == 1 ? "" : "s"));
+         }
+
        if (b->ignore_count)
          {
             annotate_field (8);
@@ -1769,9 +1810,7 @@ breakpoint_1 (bnum, allflag)
 
            while (l)
              {
-               fputs_filtered ("\t", gdb_stdout);
-               fputs_filtered (l->line, gdb_stdout);
-               fputs_filtered ("\n", gdb_stdout);
+               print_command_line (l, 4);
                l = l->next;
              }
          }
@@ -1918,6 +1957,8 @@ set_raw_breakpoint (sal)
   else
     b->source_file = savestring (sal.symtab->filename,
                                 strlen (sal.symtab->filename));
+  b->language = current_language->la_language;
+  b->input_radix = input_radix;
   b->thread = -1;
   b->line_number = sal.line;
   b->enable = enabled;
@@ -1959,7 +2000,7 @@ create_longjmp_breakpoint(func_name)
     {
       struct minimal_symbol *m;
 
-      m = lookup_minimal_symbol(func_name, (struct objfile *)NULL);
+      m = lookup_minimal_symbol_text (func_name, NULL, (struct objfile *)NULL);
       if (m)
        sal.pc = SYMBOL_VALUE_ADDRESS (m);
       else
@@ -2063,7 +2104,7 @@ hw_watchpoint_used_count(type, other_type_used)
 void
 set_longjmp_resume_breakpoint(pc, frame)
      CORE_ADDR pc;
-     FRAME frame;
+     struct frame_info *frame;
 {
   register struct breakpoint *b;
 
@@ -2073,7 +2114,7 @@ set_longjmp_resume_breakpoint(pc, frame)
        b->address = pc;
        b->enable = enabled;
        if (frame != NULL)
-         b->frame = FRAME_FP(frame);
+         b->frame = frame->frame;
        else
          b->frame = 0;
        check_duplicates (b->address);
@@ -2088,7 +2129,7 @@ set_longjmp_resume_breakpoint(pc, frame)
 struct breakpoint *
 set_momentary_breakpoint (sal, frame, type)
      struct symtab_and_line sal;
-     FRAME frame;
+     struct frame_info *frame;
      enum bptype type;
 {
   register struct breakpoint *b;
@@ -2096,7 +2137,7 @@ set_momentary_breakpoint (sal, frame, type)
   b->type = type;
   b->enable = enabled;
   b->disposition = donttouch;
-  b->frame = (frame ? FRAME_FP (frame) : 0);
+  b->frame = (frame ? frame->frame : 0);
   return b;
 }
 
@@ -2115,10 +2156,21 @@ clear_momentary_breakpoints ()
 #endif
 \f
 /* Tell the user we have just set a breakpoint B.  */
+
 static void
 mention (b)
      struct breakpoint *b;
 {
+  int say_where = 0;
+
+  /* FIXME: This is misplaced; mention() is called by things (like hitting a
+     watchpoint) other than breakpoint creation.  It should be possible to
+     clean this up and at the same time replace the random calls to
+     breakpoint_changed with this hook, as has already been done for
+     delete_breakpoint_hook and so on.  */
+  if (create_breakpoint_hook)
+    create_breakpoint_hook (b);
+
   switch (b->type)
     {
     case bp_watchpoint:
@@ -2138,18 +2190,12 @@ mention (b)
       print_expression (b->exp, gdb_stdout);
       break;
     case bp_breakpoint:
-      printf_filtered ("Breakpoint %d at ", b->number);
-      print_address_numeric (b->address, 1, gdb_stdout);
-      if (b->source_file)
-       printf_filtered (": file %s, line %d.",
-                        b->source_file, b->line_number);
+      printf_filtered ("Breakpoint %d", b->number);
+      say_where = 1;
       break;
     case bp_hardware_breakpoint:
-      printf_filtered ("Hardware assisted breakpoint %d at ", b->number);
-      print_address_numeric (b->address, 1, gdb_stdout);
-      if (b->source_file)
-       printf_filtered (": file %s, line %d.",
-                        b->source_file, b->line_number);
+      printf_filtered ("Hardware assisted breakpoint %d", b->number);
+      say_where = 1;
       break;
     case bp_until:
     case bp_finish:
@@ -2161,6 +2207,17 @@ mention (b)
     case bp_watchpoint_scope:
       break;
     }
+  if (say_where)
+    {
+      if (addressprint || b->source_file == NULL)
+       {
+         printf_filtered (" at ");
+         print_address_numeric (b->address, 1, gdb_stdout);
+       }
+      if (b->source_file)
+       printf_filtered (": file %s, line %d.",
+                        b->source_file, b->line_number);
+    }
   printf_filtered ("\n");
 }
 
@@ -2230,8 +2287,8 @@ break_command_1 (arg, flag, from_tty)
   int i;
   int thread;
 
-  hardwareflag = flag & 2;
-  tempflag = flag & 1;
+  hardwareflag = flag & BP_HARDWAREFLAG;
+  tempflag = flag & BP_TEMPFLAG;
 
   sals.sals = NULL;
   sals.nelts = 0;
@@ -2342,10 +2399,11 @@ break_command_1 (arg, flag, from_tty)
     }
   if (hardwareflag)
     {
-      int i, other_type_used, target_resources_ok;
-      i = hw_breakpoint_used_count();  
-      target_resources_ok = TARGET_CAN_USE_HARDWARE_WATCHPOINT(
-               bp_hardware_breakpoint, i+sals.nelts, 0);
+      int i, target_resources_ok;
+
+      i = hw_breakpoint_used_count ();  
+      target_resources_ok = TARGET_CAN_USE_HARDWARE_WATCHPOINT (
+               bp_hardware_breakpoint, i + sals.nelts, 0);
       if (target_resources_ok == 0)
        error ("No hardware breakpoint support in the target.");
       else if (target_resources_ok < 0)
@@ -2381,7 +2439,7 @@ break_command_1 (arg, flag, from_tty)
        b->cond_string = savestring (cond_start, cond_end - cond_start);
                                     
       b->enable = enabled;
-      b->disposition = tempflag ? delete : donttouch;
+      b->disposition = tempflag ? del : donttouch;
 
       mention (b);
     }
@@ -2412,8 +2470,6 @@ resolve_sal_pc (sal)
     }
 }
 
-#define BP_TEMPFLAG 1
-#define BP_HARDWAREFLAG 2
 void
 break_command (arg, from_tty)
      char *arg;
@@ -2460,7 +2516,7 @@ watch_command_1 (arg, accessflag, from_tty)
   struct expression *exp;
   struct block *exp_valid_block;
   struct value *val, *mark;
-  FRAME frame, prev_frame;
+  struct frame_info *frame, *prev_frame;
   char *exp_start = NULL;
   char *exp_end = NULL;
   char *tok, *end_tok;
@@ -2542,7 +2598,7 @@ watch_command_1 (arg, accessflag, from_tty)
   if (frame)
     {
       prev_frame = get_prev_frame (frame);
-      b->watchpoint_frame = FRAME_FP (frame);
+      b->watchpoint_frame = frame->frame;
     }
   else
     b->watchpoint_frame = (CORE_ADDR)0;
@@ -2574,7 +2630,7 @@ watch_command_1 (arg, accessflag, from_tty)
          scope_breakpoint->enable = enabled;
 
          /* Automatically delete the breakpoint when it hits.  */
-         scope_breakpoint->disposition = delete;
+         scope_breakpoint->disposition = del;
 
          /* Only break in the proper frame (help with recursion).  */
          scope_breakpoint->frame = prev_frame->frame;
@@ -2643,10 +2699,9 @@ static void awatch_command (arg, from_tty)
 }
 
 \f
-/*
- * Helper routine for the until_command routine in infcmd.c.  Here
- * because it uses the mechanisms of breakpoints.
- */
+/* Helper routine for the until_command routine in infcmd.c.  Here
+   because it uses the mechanisms of breakpoints.  */
+
 /* ARGSUSED */
 void
 until_break_command (arg, from_tty)
@@ -2655,7 +2710,7 @@ until_break_command (arg, from_tty)
 {
   struct symtabs_and_lines sals;
   struct symtab_and_line sal;
-  FRAME prev_frame = get_prev_frame (selected_frame);
+  struct frame_info *prev_frame = get_prev_frame (selected_frame);
   struct breakpoint *breakpoint;
   struct cleanup *old_chain;
 
@@ -2689,11 +2744,8 @@ until_break_command (arg, from_tty)
   
   if (prev_frame)
     {
-      struct frame_info *fi;
-      
-      fi = get_frame_info (prev_frame);
-      sal = find_pc_line (fi->pc, 0);
-      sal.pc = fi->pc;
+      sal = find_pc_line (prev_frame->pc, 0);
+      sal.pc = prev_frame->pc;
       breakpoint = set_momentary_breakpoint (sal, prev_frame, bp_until);
       make_cleanup(delete_breakpoint, breakpoint);
     }
@@ -2804,7 +2856,6 @@ get_catch_sals (this_level_only)
   register struct blockvector *bl;
   register struct block *block;
   int index, have_default = 0;
-  struct frame_info *fi;
   CORE_ADDR pc;
   struct symtabs_and_lines sals;
   struct sal_chain *sal_chain = 0;
@@ -2815,8 +2866,7 @@ get_catch_sals (this_level_only)
   if (selected_frame == NULL)
     error ("No selected frame.");
   block = get_frame_block (selected_frame);
-  fi = get_frame_info (selected_frame);
-  pc = fi->pc;
+  pc = selected_frame->pc;
 
   sals.nelts = 0;
   sals.sals = NULL;
@@ -2984,7 +3034,7 @@ catch_command_1 (arg, tempflag, from_tty)
       b->type = bp_breakpoint;
       b->cond = cond;
       b->enable = enabled;
-      b->disposition = tempflag ? delete : donttouch;
+      b->disposition = tempflag ? del : donttouch;
 
       mention (b);
     }
@@ -2997,6 +3047,22 @@ catch_command_1 (arg, tempflag, from_tty)
   free ((PTR)sals.sals);
 }
 
+/* Used by the gui, could be made a worker for other things. */
+
+struct breakpoint *
+set_breakpoint_sal (sal)
+struct symtab_and_line sal;
+{
+  struct breakpoint *b;
+  b = set_raw_breakpoint (sal);
+  set_breakpoint_count (breakpoint_count + 1);
+  b->number = breakpoint_count;
+  b->type = bp_breakpoint;
+  b->cond = 0;
+  b->thread = -1;
+  return b;
+}
+
 #if 0
 /* These aren't used; I don't know what they were for.  */
 /* Disable breakpoints on all catch clauses described in ARGS.  */
@@ -3131,7 +3197,7 @@ breakpoint_auto_delete (bs)
      bpstat bs;
 {
   for (; bs; bs = bs->next)
-    if (bs->breakpoint_at && bs->breakpoint_at->disposition == delete
+    if (bs->breakpoint_at && bs->breakpoint_at->disposition == del 
        && bs->stop)
       delete_breakpoint (bs->breakpoint_at);
 }
@@ -3145,6 +3211,9 @@ delete_breakpoint (bpt)
   register struct breakpoint *b;
   register bpstat bs;
 
+  if (delete_breakpoint_hook)
+    delete_breakpoint_hook (bpt);
+
   if (bpt->inserted)
     remove_breakpoint (bpt);
       
@@ -3196,8 +3265,6 @@ delete_breakpoint (bpt)
   if (bpt->source_file != NULL)
     free (bpt->source_file);
 
-  breakpoints_changed ();
-
   /* Be sure no bpstat's are pointing at it after it's been freed.  */
   /* FIXME, how can we find all bpstat's?
      We just check stop_bpstat for now.  */
@@ -3217,7 +3284,7 @@ delete_command (arg, from_tty)
     {
       /* Ask user only if there are some breakpoints to delete.  */
       if (!from_tty
-         || (breakpoint_chain && query ("Delete all breakpoints? ", 0, 0)))
+         || (breakpoint_chain && query ("Delete all breakpoints? ")))
        {
          /* No arg; clear all breakpoints.  */
          while (breakpoint_chain)
@@ -3258,6 +3325,8 @@ breakpoint_re_set_one (bint)
       save_enable = b->enable;
       b->enable = disabled;
 
+      set_language (b->language);
+      input_radix = b->input_radix;
       s = b->addr_string;
       sals = decode_line_1 (&s, 1, (struct symtab *)NULL, 0, (char ***)NULL);
       for (i = 0; i < sals.nelts; i++)
@@ -3364,15 +3433,21 @@ void
 breakpoint_re_set ()
 {
   struct breakpoint *b, *temp;
+  enum language save_language;
+  int save_input_radix;
   static char message1[] = "Error in re-setting breakpoint %d:\n";
   char message[sizeof (message1) + 30 /* slop */];
   
+  save_language = current_language->la_language;
+  save_input_radix = input_radix;
   ALL_BREAKPOINTS_SAFE (b, temp)
     {
       sprintf (message, message1, b->number);  /* Format possible error msg */
       catch_errors (breakpoint_re_set_one, (char *) b, message,
                    RETURN_MASK_ALL);
     }
+  set_language (save_language);
+  input_radix = save_input_radix;
 
   create_longjmp_breakpoint("longjmp");
   create_longjmp_breakpoint("_longjmp");
@@ -3494,11 +3569,11 @@ map_breakpoint_numbers (args, function)
     }
 }
 
-static void
+void
 enable_breakpoint (bpt)
      struct breakpoint *bpt;
 {
-  FRAME save_selected_frame = NULL;
+  struct frame_info *save_selected_frame = NULL;
   int save_selected_frame_level = -1;
   int target_resources_ok, other_type_used;
   struct value *mark;
@@ -3515,7 +3590,6 @@ enable_breakpoint (bpt)
         error ("Hardware breakpoints used exceeds limit.");
     }
   bpt->enable = enabled;
-  breakpoints_changed ();
   check_duplicates (bpt->address);
 
   if (bpt->type == bp_watchpoint || bpt->type == bp_hardware_watchpoint ||
@@ -3523,7 +3597,8 @@ enable_breakpoint (bpt)
     {
       if (bpt->exp_valid_block != NULL)
        {
-         FRAME fr = find_frame_addr_in_frame_chain (bpt->watchpoint_frame);
+         struct frame_info *fr =
+           find_frame_addr_in_frame_chain (bpt->watchpoint_frame);
          if (fr == NULL)
            {
              printf_filtered ("\
@@ -3550,9 +3625,10 @@ is valid is not currently in scope.\n", bpt->number);
            bpt->type == bp_access_watchpoint)
       {
         int i = hw_watchpoint_used_count (bpt->type, &other_type_used);
-        int mem_cnt = can_use_hardware_watchpoint(bpt->val);
+        int mem_cnt = can_use_hardware_watchpoint (bpt->val);
+
         target_resources_ok = TARGET_CAN_USE_HARDWARE_WATCHPOINT(
-                bpt->type, i+mem_cnt, other_type_used);
+                bpt->type, i + mem_cnt, other_type_used);
         /* we can consider of type is bp_hardware_watchpoint, convert to 
           bp_watchpoint in the following condition */
         if (target_resources_ok < 0)
@@ -3570,6 +3646,9 @@ have been allocated for other watchpoints.\n", bpt->number);
        select_frame (save_selected_frame, save_selected_frame_level);
       value_free_to_mark (mark);
     }
+
+  if (modify_breakpoint_hook)
+    modify_breakpoint_hook (bpt);
 }
 
 /* ARGSUSED */
@@ -3597,7 +3676,7 @@ enable_command (args, from_tty)
     map_breakpoint_numbers (args, enable_breakpoint);
 }
 
-static void
+void
 disable_breakpoint (bpt)
      struct breakpoint *bpt;
 {
@@ -3609,9 +3688,10 @@ disable_breakpoint (bpt)
 
   bpt->enable = disabled;
 
-  breakpoints_changed ();
-
   check_duplicates (bpt->address);
+
+  if (modify_breakpoint_hook)
+    modify_breakpoint_hook (bpt);
 }
 
 /* ARGSUSED */
@@ -3643,7 +3723,7 @@ static void
 enable_once_breakpoint (bpt)
      struct breakpoint *bpt;
 {
-  FRAME save_selected_frame = NULL;
+  struct frame_info *save_selected_frame = NULL;
   int save_selected_frame_level = -1;
   int target_resources_ok, other_type_used;
   struct value *mark;
@@ -3670,7 +3750,8 @@ enable_once_breakpoint (bpt)
     {
       if (bpt->exp_valid_block != NULL)
        {
-         FRAME fr = find_frame_addr_in_frame_chain (bpt->watchpoint_frame);
+         struct frame_info *fr =
+           find_frame_addr_in_frame_chain (bpt->watchpoint_frame);
          if (fr == NULL)
            {
              printf_filtered ("\
@@ -3732,7 +3813,7 @@ enable_delete_breakpoint (bpt)
      struct breakpoint *bpt;
 {
   bpt->enable = enabled;
-  bpt->disposition = delete;
+  bpt->disposition = del;
 
   check_duplicates (bpt->address);
   breakpoints_changed ();
@@ -3747,9 +3828,8 @@ enable_delete_command (args, from_tty)
   map_breakpoint_numbers (args, enable_delete_breakpoint);
 }
 \f
-/*
- * Use default_breakpoint_'s, or nothing if they aren't valid.
- */
+/* Use default_breakpoint_'s, or nothing if they aren't valid.  */
+
 struct symtabs_and_lines
 decode_line_spec_1 (string, funfirstline)
      char *string;
@@ -3779,7 +3859,8 @@ _initialize_breakpoint ()
   breakpoint_count = 0;
 
   add_com ("ignore", class_breakpoint, ignore_command,
-          "Set ignore-count of breakpoint number N to COUNT.");
+          "Set ignore-count of breakpoint number N to COUNT.\n\
+Usage is `ignore N COUNT'.");
 
   add_com ("commands", class_breakpoint, commands_command,
           "Set commands to be executed when a breakpoint is hit.\n\
@@ -3792,8 +3873,8 @@ then no output is printed when it is hit, except what the commands print.");
 
   add_com ("condition", class_breakpoint, condition_command,
           "Specify breakpoint number N to break only if COND is true.\n\
-N is an integer; COND is an expression to be evaluated whenever\n\
-breakpoint N is reached.  ");
+Usage is `condition N COND', where N is an integer and COND is an\n\
+expression to be evaluated whenever breakpoint N is reached.  ");
 
   add_com ("tbreak", class_breakpoint, tbreak_command,
           "Set a temporary breakpoint.  Args like \"break\" command.\n\
@@ -3881,66 +3962,66 @@ This command may be abbreviated \"delete\".",
           &deletelist);
 
   add_com ("clear", class_breakpoint, clear_command,
-          "Clear breakpoint at specified line or function.\n\
+          concat ("Clear breakpoint at specified line or function.\n\
 Argument may be line number, function name, or \"*\" and an address.\n\
 If line number is specified, all breakpoints in that line are cleared.\n\
 If function is specified, breakpoints at beginning of function are cleared.\n\
-If an address is specified, breakpoints at that address are cleared.\n\n\
-With no argument, clears all breakpoints in the line that the selected frame\n\
+If an address is specified, breakpoints at that address are cleared.\n\n",
+"With no argument, clears all breakpoints in the line that the selected frame\n\
 is executing in.\n\
 \n\
-See also the \"delete\" command which clears breakpoints by number.");
+See also the \"delete\" command which clears breakpoints by number.", NULL));
 
   add_com ("break", class_breakpoint, break_command,
-          "Set breakpoint at specified line or function.\n\
+          concat ("Set breakpoint at specified line or function.\n\
 Argument may be line number, function name, or \"*\" and an address.\n\
 If line number is specified, break at start of code for that line.\n\
 If function is specified, break at start of code for that function.\n\
-If an address is specified, break at that exact address.\n\
-With no arg, uses current execution address of selected stack frame.\n\
+If an address is specified, break at that exact address.\n",
+"With no arg, uses current execution address of selected stack frame.\n\
 This is useful for breaking on return to a stack frame.\n\
 \n\
 Multiple breakpoints at one place are permitted, and useful if conditional.\n\
 \n\
-Do \"help breakpoints\" for info on other commands dealing with breakpoints.");
+Do \"help breakpoints\" for info on other commands dealing with breakpoints.", NULL));
   add_com_alias ("b", "break", class_run, 1);
   add_com_alias ("br", "break", class_run, 1);
   add_com_alias ("bre", "break", class_run, 1);
   add_com_alias ("brea", "break", class_run, 1);
 
   add_info ("breakpoints", breakpoints_info,
-           "Status of user-settable breakpoints, or breakpoint number NUMBER.\n\
+           concat ("Status of user-settable breakpoints, or breakpoint number NUMBER.\n\
 The \"Type\" column indicates one of:\n\
 \tbreakpoint     - normal breakpoint\n\
 \twatchpoint     - watchpoint\n\
 The \"Disp\" column contains one of \"keep\", \"del\", or \"dis\" to indicate\n\
 the disposition of the breakpoint after it gets hit.  \"dis\" means that the\n\
 breakpoint will be disabled.  The \"Address\" and \"What\" columns indicate the\n\
-address and file/line number respectively.\n\n\
-Convenience variable \"$_\" and default examine address for \"x\"\n\
+address and file/line number respectively.\n\n",
+"Convenience variable \"$_\" and default examine address for \"x\"\n\
 are set to the address of the last breakpoint listed.\n\n\
 Convenience variable \"$bpnum\" contains the number of the last\n\
-breakpoint set.");
+breakpoint set.", NULL));
 
 #if MAINTENANCE_CMDS
 
   add_cmd ("breakpoints", class_maintenance, maintenance_info_breakpoints,
-           "Status of all breakpoints, or breakpoint number NUMBER.\n\
+           concat ("Status of all breakpoints, or breakpoint number NUMBER.\n\
 The \"Type\" column indicates one of:\n\
 \tbreakpoint     - normal breakpoint\n\
 \twatchpoint     - watchpoint\n\
 \tlongjmp        - internal breakpoint used to step through longjmp()\n\
 \tlongjmp resume - internal breakpoint at the target of longjmp()\n\
 \tuntil          - internal breakpoint used by the \"until\" command\n\
-\tfinish         - internal breakpoint used by the \"finish\" command\n\
-The \"Disp\" column contains one of \"keep\", \"del\", or \"dis\" to indicate\n\
+\tfinish         - internal breakpoint used by the \"finish\" command\n",
+"The \"Disp\" column contains one of \"keep\", \"del\", or \"dis\" to indicate\n\
 the disposition of the breakpoint after it gets hit.  \"dis\" means that the\n\
 breakpoint will be disabled.  The \"Address\" and \"What\" columns indicate the\n\
-address and file/line number respectively.\n\n\
-Convenience variable \"$_\" and default examine address for \"x\"\n\
+address and file/line number respectively.\n\n",
+"Convenience variable \"$_\" and default examine address for \"x\"\n\
 are set to the address of the last breakpoint listed.\n\n\
 Convenience variable \"$bpnum\" contains the number of the last\n\
-breakpoint set.",
+breakpoint set.", NULL),
           &maintenanceinfolist);
 
 #endif /* MAINTENANCE_CMDS */
@@ -3974,40 +4055,5 @@ an expression is either read or written.");
 
   add_info ("watchpoints", breakpoints_info,
            "Synonym for ``info breakpoints''.");
-}
-
-/* OK, when we call objfile_relocate, we need to relocate breakpoints
-   too.  breakpoint_re_set is not a good choice--for example, if
-   addr_string contains just a line number without a file name the
-   breakpoint might get set in a different file.  In general, there is
-   no need to go all the way back to the user's string (though this might
-   work if some effort were made to canonicalize it), since symtabs and
-   everything except addresses are still valid.
-
-   Probably the best way to solve this is to have each breakpoint save
-   the objfile and the section number that was used to set it (if set
-   by "*addr", probably it is best to use find_pc_line to get a symtab
-   and use the objfile and block_line_section for that symtab).  Then
-   objfile_relocate can call fixup_breakpoints with the objfile and
-   the new_offsets, and it can relocate only the appropriate breakpoints.  */
 
-#ifdef IBM6000_TARGET
-/* But for now, just kludge it based on the concept that before an
-   objfile is relocated the breakpoint is below 0x10000000, and afterwards
-   it is higher, so that way we only relocate each breakpoint once.  */
-
-void
-fixup_breakpoints (low, high, delta)
-  CORE_ADDR low;
-  CORE_ADDR high;
-  CORE_ADDR delta;
-{
-  struct breakpoint *b;
-
-  ALL_BREAKPOINTS (b)
-    {
-     if (b->address >= low && b->address <= high)
-       b->address += delta;
-    }
 }
-#endif
This page took 0.036561 seconds and 4 git commands to generate.