]> Git Repo - binutils.git/blobdiff - gdb/breakpoint.c
* breakpoint.c (bpstat_stop_status): Call inferior_has_forked,
[binutils.git] / gdb / breakpoint.c
index c52b4ba00322c2cac37f51b99b72d4478de6bf97..9fc7bdb0c2056d104af11f1310f3b9fcb654c1e7 100644 (file)
@@ -41,6 +41,7 @@
 #include "annotate.h"
 #include "symfile.h"
 #include "objfiles.h"
+#include "source.h"
 #include "linespec.h"
 #include "completer.h"
 #include "gdb.h"
@@ -717,15 +718,13 @@ insert_breakpoints (void)
   int val = 0;
   int disabled_breaks = 0;
   int hw_breakpoint_error = 0;
+#ifdef ONE_PROCESS_WRITETEXT
   int process_warning = 0;
+#endif
 
   static char message1[] = "Error inserting catchpoint %d:\n";
   static char message[sizeof (message1) + 30];
 
-#ifdef ONE_PROCESS_WRITETEXT
-  process_warning = 1;
-#endif
-
   struct ui_file *tmp_error_stream = mem_fileopen ();
   make_cleanup_ui_file_delete (tmp_error_stream);
 
@@ -738,7 +737,19 @@ insert_breakpoints (void)
     if (b->enable_state == bp_permanent)
       /* Permanent breakpoints cannot be inserted or removed.  */
       continue;
-    else if (b->type != bp_watchpoint
+    if ((b->type == bp_watchpoint
+        || b->type == bp_hardware_watchpoint
+        || b->type == bp_read_watchpoint
+        || b->type == bp_access_watchpoint) && (!b->val))
+      {
+       struct value *val;
+       val = evaluate_expression (b->exp);
+       release_value (val);
+       if (VALUE_LAZY (val))
+         value_fetch_lazy (val);
+       b->val = val;
+      } 
+    if (b->type != bp_watchpoint
        && b->type != bp_hardware_watchpoint
        && b->type != bp_read_watchpoint
        && b->type != bp_access_watchpoint
@@ -825,17 +836,21 @@ insert_breakpoints (void)
                if (!disabled_breaks)
                  {
                    fprintf_unfiltered (tmp_error_stream, 
-                                       "Cannot insert breakpoint %d.\n", b->number);
+                                       "Cannot insert breakpoint %d.\n", 
+                                       b->number);
                    fprintf_unfiltered (tmp_error_stream, 
                                        "Temporarily disabling shared library breakpoints:\n");
                  }
                disabled_breaks = 1;
-               fprintf_unfiltered (tmp_error_stream, "breakpoint #%d\n", b->number);
+               fprintf_unfiltered (tmp_error_stream, 
+                                   "breakpoint #%d\n", b->number);
              }
            else
 #endif
              {
+#ifdef ONE_PROCESS_WRITETEXT
                process_warning = 1;
+#endif
                if (b->type == bp_hardware_breakpoint)
                  {
                    hw_breakpoint_error = 1;
@@ -845,8 +860,11 @@ insert_breakpoints (void)
                  }
                else
                  {
-                   fprintf_unfiltered (tmp_error_stream, "Cannot insert breakpoint %d.\n", b->number);
-                   fprintf_filtered (tmp_error_stream, "Error accessing memory address ");
+                   fprintf_unfiltered (tmp_error_stream, 
+                                       "Cannot insert breakpoint %d.\n", 
+                                       b->number);
+                   fprintf_filtered (tmp_error_stream, 
+                                     "Error accessing memory address ");
                    print_address_numeric (b->address, 1, tmp_error_stream);
                    fprintf_filtered (tmp_error_stream, ": %s.\n",
                                      safe_strerror (val));
@@ -881,7 +899,8 @@ insert_breakpoints (void)
            fprintf_unfiltered (tmp_error_stream, 
                                "Cannot insert catchpoint %d; disabling it.\n",
                                b->number);
-           fprintf_filtered (tmp_error_stream, "Error accessing memory address ");
+           fprintf_filtered (tmp_error_stream, 
+                             "Error accessing memory address ");
            print_address_numeric (b->address, 1, tmp_error_stream);
            fprintf_filtered (tmp_error_stream, ": %s.\n",
                              safe_strerror (val));
@@ -1010,11 +1029,11 @@ insert_breakpoints (void)
               value chain brings us here.  */
            if (!b->inserted)
              {
-               process_warning = 1;
                remove_breakpoint (b, mark_uninserted);
                hw_breakpoint_error = 1;
                fprintf_unfiltered (tmp_error_stream,
-                                   "Cannot insert hardware watchpoint %d.\n", b->number);
+                                   "Could not insert hardware watchpoint %d.\n", 
+                                   b->number);
                val = -1;
              }               
          }
@@ -1061,7 +1080,8 @@ insert_breakpoints (void)
          }
        if (val < 0)
          {
-           fprintf_unfiltered (tmp_error_stream, "Cannot insert catchpoint %d.", b->number);
+           fprintf_unfiltered (tmp_error_stream, 
+                               "Cannot insert catchpoint %d.", b->number);
          }
        else
          b->inserted = 1;
@@ -1077,13 +1097,15 @@ insert_breakpoints (void)
          message about possibly exhausted resources.  */
       if (hw_breakpoint_error)  
        {
-         fprintf_unfiltered (tmp_error_stream, "Could not insert hardware breakpoints:\n" 
-                             "You may have requested too many hardware breakpoints/watchpoints.\n");
+         fprintf_unfiltered (tmp_error_stream, 
+                             "Could not insert hardware breakpoints:\n\
+You may have requested too many hardware breakpoints/watchpoints.\n");
        }
-
+#ifdef ONE_PROCESS_WRITETEXT
       if (process_warning)
-       fprintf_unfiltered (tmp_error_stream,"The same program may be running in another process.");
-
+       fprintf_unfiltered (tmp_error_stream,
+                           "The same program may be running in another process.");
+#endif
       target_terminal_ours_for_output ();
       error_stream (tmp_error_stream);
     }
@@ -1566,6 +1588,14 @@ breakpoint_init_inferior (enum inf_context context)
        /* Likewise for watchpoints on local expressions.  */
        if (b->exp_valid_block != NULL)
          delete_breakpoint (b);
+       if (context == inf_starting) 
+         {
+           /* Reset val field to force reread of starting value
+              in insert_breakpoints.  */
+           if (b->val)
+             value_free (b->val);
+           b->val = NULL;
+         }
        break;
       default:
        /* Likewise for exception catchpoints in dynamic-linked
@@ -1658,7 +1688,7 @@ breakpoint_inserted_here_p (CORE_ADDR pc)
    bp_call_dummy breakpoint.  */
 
 int
-frame_in_dummy (struct frame_info *frame)
+deprecated_frame_in_dummy (struct frame_info *frame)
 {
   struct breakpoint *b;
 
@@ -2540,17 +2570,17 @@ bpstat_stop_status (CORE_ADDR *pc, int not_a_sw_breakpoint)
       continue;
 
     if ((b->type == bp_catch_fork)
-       && !target_has_forked (PIDGET (inferior_ptid),
-                              &b->forked_inferior_pid))
+       && !inferior_has_forked (PIDGET (inferior_ptid),
+                                &b->forked_inferior_pid))
       continue;
 
     if ((b->type == bp_catch_vfork)
-       && !target_has_vforked (PIDGET (inferior_ptid),
-                               &b->forked_inferior_pid))
+       && !inferior_has_vforked (PIDGET (inferior_ptid),
+                                 &b->forked_inferior_pid))
       continue;
 
     if ((b->type == bp_catch_exec)
-       && !target_has_execd (PIDGET (inferior_ptid), &b->exec_pathname))
+       && !inferior_has_execd (PIDGET (inferior_ptid), &b->exec_pathname))
       continue;
 
     if (ep_is_exception_catchpoint (b) &&
@@ -3854,7 +3884,7 @@ create_internal_breakpoint (CORE_ADDR address, enum bptype type)
   struct symtab_and_line sal;
   struct breakpoint *b;
 
-  INIT_SAL (&sal);             /* initialize to zeroes */
+  init_sal (&sal);             /* initialize to zeroes */
 
   sal.pc = address;
   sal.section = find_pc_overlay (sal.pc);
@@ -4174,7 +4204,7 @@ create_fork_vfork_event_catchpoint (int tempflag, char *cond_string,
   struct breakpoint *b;
   int thread = -1;             /* All threads. */
 
-  INIT_SAL (&sal);
+  init_sal (&sal);
   sal.pc = 0;
   sal.symtab = NULL;
   sal.line = 0;
@@ -4213,7 +4243,7 @@ create_exec_event_catchpoint (int tempflag, char *cond_string)
   struct breakpoint *b;
   int thread = -1;             /* All threads. */
 
-  INIT_SAL (&sal);
+  init_sal (&sal);
   sal.pc = 0;
   sal.symtab = NULL;
   sal.line = 0;
@@ -4570,7 +4600,7 @@ parse_breakpoint_sals (char **address,
       if (default_breakpoint_valid)
        {
          struct symtab_and_line sal;
-         INIT_SAL (&sal);              /* initialize to zeroes */
+         init_sal (&sal);              /* initialize to zeroes */
          sals->sals = (struct symtab_and_line *)
            xmalloc (sizeof (struct symtab_and_line));
          sal.pc = default_breakpoint_address;
@@ -4588,10 +4618,16 @@ parse_breakpoint_sals (char **address,
       /* Force almost all breakpoints to be in terms of the
          current_source_symtab (which is decode_line_1's default).  This
          should produce the results we want almost all of the time while
-         leaving default_breakpoint_* alone.  */
+         leaving default_breakpoint_* alone.  
+         ObjC: However, don't match an Objective-C method name which
+         may have a '+' or '-' succeeded by a '[' */
+        
+      struct symtab_and_line cursal = get_current_source_symtab_and_line ();
+                       
       if (default_breakpoint_valid
-         && (!current_source_symtab
-             || (strchr ("+-", (*address)[0]) != NULL)))
+         && (!cursal.symtab
+             || ((strchr ("+-", (*address)[0]) != NULL)
+                 && ((*address)[1] != '['))))
        *sals = decode_line_1 (address, 1, default_breakpoint_symtab,
                               default_breakpoint_line, addr_string);
       else
@@ -5260,7 +5296,7 @@ watch_command_1 (char *arg, int accessflag, int from_tty)
   enum bptype bp_type;
   int mem_cnt = 0;
 
-  INIT_SAL (&sal);             /* initialize to zeroes */
+  init_sal (&sal);             /* initialize to zeroes */
 
   /* Parse arguments.  */
   innermost_block = NULL;
@@ -6226,7 +6262,7 @@ handle_gnu_4_16_catch_command (char *arg, int tempflag, int from_tty)
   char *save_arg;
   int i;
 
-  INIT_SAL (&sal);             /* initialize to zeroes */
+  init_sal (&sal);             /* initialize to zeroes */
 
   /* If no arg given, or if first arg is 'if ', all active catch clauses
      are breakpointed. */
@@ -6497,7 +6533,7 @@ clear_command (char *arg, int from_tty)
       sals.sals = (struct symtab_and_line *)
        xmalloc (sizeof (struct symtab_and_line));
       make_cleanup (xfree, sals.sals);
-      INIT_SAL (&sal);         /* initialize to zeroes */
+      init_sal (&sal);         /* initialize to zeroes */
       sal.line = default_breakpoint_line;
       sal.symtab = default_breakpoint_symtab;
       sal.pc = default_breakpoint_address;
This page took 0.036064 seconds and 4 git commands to generate.