* config/i386/nm-nbsd.h (FLOAT_INFO): Comment out.
[deliverable/binutils-gdb.git] / gdb / breakpoint.c
index 45c3df3774cabad57a3e9b7927bae2282262867a..2a2842a51c9885bdde8b58306e7b58b3cf9b04a3 100644 (file)
@@ -1,5 +1,5 @@
 /* Everything about breakpoints, for GDB.
-   Copyright 1986, 1987, 1989, 1990, 1991, 1992, 1993, 1994
+   Copyright 1986, 1987, 1989, 1990, 1991, 1992, 1993, 1994, 1995, 1996
              Free Software Foundation, Inc.
 
 This file is part of GDB.
@@ -16,7 +16,7 @@ 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., 675 Mass Ave, Cambridge, MA 02139, USA.  */
+Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA.  */
 
 #include "defs.h"
 #include <ctype.h>
@@ -28,13 +28,12 @@ Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA.  */
 #include "gdbcore.h"
 #include "gdbcmd.h"
 #include "value.h"
-#include "ctype.h"
 #include "command.h"
 #include "inferior.h"
 #include "thread.h"
 #include "target.h"
 #include "language.h"
-#include <string.h>
+#include "gdb_string.h"
 #include "demangle.h"
 #include "annotate.h"
 
@@ -58,15 +57,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 *)));
 
@@ -158,29 +151,13 @@ static int executing_breakpoint_commands;
             b? (tmp=b->next, 1): 0;    \
             b = tmp)
 
-/* By default no support for hardware watchpoints is assumed.  */
-#ifndef TARGET_CAN_USE_HARDWARE_WATCHPOINT
-#define TARGET_CAN_USE_HARDWARE_WATCHPOINT(TYPE,CNT,OTHERTYPE) 0
-#define target_remove_watchpoint(ADDR,LEN,TYPE) -1
-#define target_insert_watchpoint(ADDR,LEN,TYPE) -1
-#endif
-
-#ifndef target_insert_hw_breakpoint
-#define target_remove_hw_breakpoint(ADDR,SHADOW) -1
-#define target_insert_hw_breakpoint(ADDR,SHADOW) -1
-#endif
-
-#ifndef target_stopped_data_address
-#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.  */
 
@@ -527,7 +504,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;
@@ -542,10 +519,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)
@@ -674,8 +652,8 @@ remove_breakpoint (b)
        }
       /* Failure to remove any of the hardware watchpoints comes here.  */
       if (b->inserted)
-       error ("Hardware watchpoint %d: Could not remove watchpoint\n",
-              b->number);
+       warning ("Hardware watchpoint %d: Could not remove watchpoint\n",
+                b->number);
       
       /* Free the saved value chain.  We will construct a new one
         the next time the watchpoint is inserted.  */
@@ -754,7 +732,7 @@ breakpoint_here_p (pc)
 
 int
 frame_in_dummy (frame)
-     FRAME frame;
+     struct frame_info *frame;
 {
   struct breakpoint *b;
 
@@ -934,6 +912,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);
@@ -944,18 +923,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;
@@ -1093,6 +1074,9 @@ 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
@@ -1101,13 +1085,8 @@ watchpoint_check (p)
 {
   bpstat bs = (bpstat) p;
   struct breakpoint *b;
-  FRAME 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;
+  struct frame_info *fr;
+  int within_current_scope;
 
   b = bs->breakpoint_at;
 
@@ -1115,6 +1094,10 @@ watchpoint_check (p)
     within_current_scope = 1;
   else
     {
+      /* 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)
@@ -1140,7 +1123,6 @@ watchpoint_check (p)
          bs->old_val = b->val;
          b->val = new_val;
          /* We will stop here */
-         select_frame (saved_frame, saved_level);
          return WP_VALUE_CHANGED;
        }
       else
@@ -1148,7 +1130,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;
        }
     }
@@ -1169,7 +1150,6 @@ which its expression is valid.\n", bs->breakpoint_at->number);
        delete_breakpoint (b->related_breakpoint);
       delete_breakpoint (b);
 
-      select_frame (saved_frame, saved_level);
       return WP_DELETED;
     }
 }
@@ -1193,7 +1173,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).  */
@@ -1226,7 +1206,7 @@ bpstat_stop_status (pc, 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[] =
@@ -1249,9 +1229,6 @@ bpstat_stop_status (pc, not_a_breakpoint)
          && b->address != bp_addr)
        continue;
 
-#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;
@@ -1357,7 +1334,7 @@ bpstat_stop_status (pc, not_a_breakpoint)
        real_breakpoint = 1;
 #endif
 
-      if (b->frame && b->frame != FRAME_FP (get_current_frame ()))
+      if (b->frame && b->frame != (get_current_frame ())->frame)
        bs->stop = 0;
       else
        {
@@ -1471,6 +1448,9 @@ bpstat_what (bs)
     /* We hit the through_sigtramp breakpoint.  */
     through_sig,
 
+    /* We hit the shared library event breakpoint.  */
+    shlib_event,
+
     /* This is just used to count how many enums there are.  */
     class_last
     };
@@ -1478,15 +1458,16 @@ bpstat_what (bs)
   /* Here is the table which drives this routine.  So that we can
      format it pretty, we define some abbreviations for the
      enum bpstat_what codes.  */
-#define keep_c BPSTAT_WHAT_KEEP_CHECKING
-#define stop_s BPSTAT_WHAT_STOP_SILENT
-#define stop_n BPSTAT_WHAT_STOP_NOISY
-#define single BPSTAT_WHAT_SINGLE
-#define setlr BPSTAT_WHAT_SET_LONGJMP_RESUME
-#define clrlr BPSTAT_WHAT_CLEAR_LONGJMP_RESUME
-#define clrlrs BPSTAT_WHAT_CLEAR_LONGJMP_RESUME_SINGLE
+#define kc BPSTAT_WHAT_KEEP_CHECKING
+#define ss BPSTAT_WHAT_STOP_SILENT
+#define sn BPSTAT_WHAT_STOP_NOISY
+#define sgl BPSTAT_WHAT_SINGLE
+#define slr BPSTAT_WHAT_SET_LONGJMP_RESUME
+#define clr BPSTAT_WHAT_CLEAR_LONGJMP_RESUME
+#define clrs BPSTAT_WHAT_CLEAR_LONGJMP_RESUME_SINGLE
 #define sr BPSTAT_WHAT_STEP_RESUME
 #define ts BPSTAT_WHAT_THROUGH_SIGTRAMP
+#define shl BPSTAT_WHAT_CHECK_SHLIBS
 
 /* "Can't happen."  Might want to print an error message.
    abort() is not out of the question, but chances are GDB is just
@@ -1511,29 +1492,31 @@ bpstat_what (bs)
     table[(int)class_last][(int)BPSTAT_WHAT_LAST] =
       {
        /*                              old action */
-       /*       keep_c stop_s stop_n single  setlr   clrlr   clrlrs  sr  ts
+       /*       kc   ss   sn   sgl   slr  clr   clrs  sr   ts  shl
         */
-/*no_effect*/  {keep_c,stop_s,stop_n,single, setlr , clrlr , clrlrs, sr, ts},
-/*wp_silent*/  {stop_s,stop_s,stop_n,stop_s, stop_s, stop_s, stop_s, sr, ts},
-/*wp_noisy*/    {stop_n,stop_n,stop_n,stop_n, stop_n, stop_n, stop_n, sr, ts},
-/*bp_nostop*/  {single,stop_s,stop_n,single, setlr , clrlrs, clrlrs, sr, ts},
-/*bp_silent*/  {stop_s,stop_s,stop_n,stop_s, stop_s, stop_s, stop_s, sr, ts},
-/*bp_noisy*/    {stop_n,stop_n,stop_n,stop_n, stop_n, stop_n, stop_n, sr, ts},
-/*long_jump*/  {setlr ,stop_s,stop_n,setlr , err   , err   , err   , sr, ts},
-/*long_resume*/        {clrlr ,stop_s,stop_n,clrlrs, err   , err   , err   , sr, ts},
-/*step_resume*/        {sr    ,sr    ,sr    ,sr    , sr    , sr    , sr    , sr, ts},
-/*through_sig*/ {ts    ,ts    ,ts    ,ts    , ts    , ts    , ts    , ts, ts}
+/*no_effect*/  {kc,  ss,  sn,  sgl,  slr, clr,  clrs, sr,  ts, shl},
+/*wp_silent*/  {ss,  ss,  sn,  ss,   ss,  ss,   ss,   sr,  ts, shl},
+/*wp_noisy*/    {sn,  sn,  sn,  sn,   sn,  sn,   sn,   sr,  ts, shl},
+/*bp_nostop*/  {sgl, ss,  sn,  sgl,  slr, clrs, clrs, sr,  ts, shl},
+/*bp_silent*/  {ss,  ss,  sn,  ss,   ss,  ss,   ss,   sr,  ts, shl},
+/*bp_noisy*/    {sn,  sn,  sn,  sn,   sn,  sn,   sn,   sr,  ts, shl},
+/*long_jump*/  {slr, ss,  sn,  slr,  err, err,  err,  sr,  ts, shl},
+/*long_resume*/        {clr, ss,  sn,  clrs, err, err,  err,  sr,  ts, shl},
+/*step_resume*/        {sr,  sr,  sr,  sr,   sr,  sr,   sr,   sr,  ts, shl},
+/*through_sig*/ {ts,  ts,  ts,  ts,   ts,  ts,   ts,   ts,  ts, shl},
+/*shlib*/       {shl, shl, shl, shl,  shl, shl,  shl,  shl, ts, shl}
              };
-#undef keep_c
-#undef stop_s
-#undef stop_n
-#undef single
-#undef setlr
-#undef clrlr
-#undef clrlrs
+#undef kc
+#undef ss
+#undef sn
+#undef sgl
+#undef slr
+#undef clr
+#undef clrs
 #undef err
 #undef sr
 #undef ts
+#undef shl
   enum bpstat_what_main_action current_action = BPSTAT_WHAT_KEEP_CHECKING;
   struct bpstat_what retval;
 
@@ -1598,7 +1581,9 @@ bpstat_what (bs)
        case bp_watchpoint_scope:
          bs_class = bp_nostop;
          break;
-
+       case bp_shlib_event:
+         bs_class = shlib_event;
+         break;
        case bp_call_dummy:
          /* Make sure the action is stop (silent or noisy), so infrun.c
             pops the dummy frame.  */
@@ -1645,7 +1630,9 @@ breakpoint_1 (bnum, allflag)
                              "hw watchpoint", "read watchpoint",
                              "acc watchpoint", "longjmp",
                              "longjmp resume", "step resume",
-                             "watchpoint scope", "call dummy" };
+                             "sigtramp",
+                             "watchpoint scope", "call dummy",
+                             "shlib events" };
   static char *bpdisps[] = {"del", "dis", "keep"};
   static char bpenables[] = "ny";
   char wrap_indent[80];
@@ -1723,6 +1710,7 @@ breakpoint_1 (bnum, allflag)
          case bp_through_sigtramp:
          case bp_watchpoint_scope:
          case bp_call_dummy:
+         case bp_shlib_event:
            if (addressprint)
              {
                annotate_field (4);
@@ -1796,9 +1784,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;
              }
          }
@@ -1945,6 +1931,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;
@@ -1974,19 +1962,20 @@ set_raw_breakpoint (sal)
   return b;
 }
 
+static int internal_breakpoint_number = -1;
+
 static void
-create_longjmp_breakpoint(func_name)
+create_longjmp_breakpoint (func_name)
      char *func_name;
 {
   struct symtab_and_line sal;
   struct breakpoint *b;
-  static int internal_breakpoint_number = -1;
 
   if (func_name != NULL)
     {
       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
@@ -1998,7 +1987,7 @@ create_longjmp_breakpoint(func_name)
   sal.symtab = NULL;
   sal.line = 0;
 
-  b = set_raw_breakpoint(sal);
+  b = set_raw_breakpoint (sal);
   if (!b) return;
 
   b->type = func_name != NULL ? bp_longjmp : bp_longjmp_resume;
@@ -2041,6 +2030,34 @@ disable_longjmp_breakpoint()
       }
 }
 
+#ifdef SOLIB_ADD
+void
+remove_solib_event_breakpoints ()
+{
+  register struct breakpoint *b;
+
+  ALL_BREAKPOINTS (b)
+    if (b->type == bp_shlib_event)
+      delete_breakpoint (b);
+}
+
+void
+create_solib_event_breakpoint (address)
+     CORE_ADDR address;
+{
+  struct breakpoint *b;
+  struct symtab_and_line sal;
+
+  sal.pc = address;
+  sal.symtab = NULL;
+  sal.line = 0;
+  b = set_raw_breakpoint (sal);
+  b->number = internal_breakpoint_number--;
+  b->disposition = donttouch;
+  b->type = bp_shlib_event;
+}
+#endif
+
 int
 hw_breakpoint_used_count()
 {
@@ -2090,7 +2107,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;
 
@@ -2100,7 +2117,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);
@@ -2115,7 +2132,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;
@@ -2123,7 +2140,14 @@ 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);
+
+  /* If we're debugging a multi-threaded program, then we
+     want momentary breakpoints to be active in only a 
+     single thread of control.  */
+  if (in_thread_list (inferior_pid))
+    b->thread = pid_to_thread_id (inferior_pid);
+
   return b;
 }
 
@@ -2273,8 +2297,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;
@@ -2425,7 +2449,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);
     }
@@ -2456,8 +2480,6 @@ resolve_sal_pc (sal)
     }
 }
 
-#define BP_TEMPFLAG 1
-#define BP_HARDWAREFLAG 2
 void
 break_command (arg, from_tty)
      char *arg;
@@ -2504,7 +2526,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;
@@ -2586,7 +2608,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;
@@ -2618,7 +2640,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;
@@ -2687,10 +2709,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)
@@ -2699,7 +2720,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;
 
@@ -2733,11 +2754,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);
     }
@@ -2848,7 +2866,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;
@@ -2859,8 +2876,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;
@@ -3028,7 +3044,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);
     }
@@ -3041,6 +3057,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.  */
@@ -3175,7 +3207,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);
 }
@@ -3262,7 +3294,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)
@@ -3303,6 +3335,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++)
@@ -3399,6 +3433,11 @@ breakpoint_re_set_one (bint)
     case bp_call_dummy:
       delete_breakpoint (b);
       break;
+
+    /* This breakpoint is special, it's set up when the inferior
+       starts and we really don't want to touch it.  */
+    case bp_shlib_event:
+      break;
     }
 
   return 0;
@@ -3409,23 +3448,31 @@ 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");
-  create_longjmp_breakpoint("siglongjmp");
-  create_longjmp_breakpoint(NULL);
+#ifdef GET_LONGJMP_TARGET
+  create_longjmp_breakpoint ("longjmp");
+  create_longjmp_breakpoint ("_longjmp");
+  create_longjmp_breakpoint ("siglongjmp");
+  create_longjmp_breakpoint (NULL);
+#endif
 
 #if 0
-  /* Took this out (temporaliy at least), since it produces an extra 
+  /* Took this out (temporarily at least), since it produces an extra 
      blank line at startup. This messes up the gdbtests. -PB */
   /* Blank line to finish off all those mention() messages we just printed.  */
   printf_filtered ("\n");
@@ -3539,18 +3586,15 @@ 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;
   
-  if (enable_breakpoint_hook)
-    enable_breakpoint_hook (bpt);
-
   if (bpt->type == bp_hardware_breakpoint)
     {
       int i;
@@ -3570,7 +3614,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 ("\
@@ -3618,6 +3663,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 */
@@ -3645,7 +3693,7 @@ enable_command (args, from_tty)
     map_breakpoint_numbers (args, enable_breakpoint);
 }
 
-static void
+void
 disable_breakpoint (bpt)
      struct breakpoint *bpt;
 {
@@ -3655,12 +3703,12 @@ disable_breakpoint (bpt)
   if (bpt->type == bp_watchpoint_scope)
     return;
 
-  if (disable_breakpoint_hook)
-    disable_breakpoint_hook (bpt);
-
   bpt->enable = disabled;
 
   check_duplicates (bpt->address);
+
+  if (modify_breakpoint_hook)
+    modify_breakpoint_hook (bpt);
 }
 
 /* ARGSUSED */
@@ -3692,7 +3740,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;
@@ -3719,7 +3767,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 ("\
@@ -3781,7 +3830,7 @@ enable_delete_breakpoint (bpt)
      struct breakpoint *bpt;
 {
   bpt->enable = enabled;
-  bpt->disposition = delete;
+  bpt->disposition = del;
 
   check_duplicates (bpt->address);
   breakpoints_changed ();
@@ -3796,9 +3845,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;
@@ -3931,66 +3979,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 */
@@ -4026,39 +4074,3 @@ an expression is either read or written.");
            "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.036135 seconds and 4 git commands to generate.