Phase 1 of the ptid_t changes.
[deliverable/binutils-gdb.git] / gdb / breakpoint.c
index 489aad2ee9d3bb4790d56a146981486db98d0e3f..805079f2ee78b8d6551d27accc9d79e2b46c5a49 100644 (file)
@@ -1,6 +1,6 @@
 /* Everything about breakpoints, for GDB.
-   Copyright 1986, 87, 89, 90, 91, 92, 93, 94, 95, 96, 97, 98, 1999, 2000
-   Free Software Foundation, Inc.
+   Copyright 1986, 1987, 1988, 1989, 1990, 1991, 1992, 1993, 1994, 1995,
+   1996, 1997, 1998, 1999, 2000, 2001 Free Software Foundation, Inc.
 
    This file is part of GDB.
 
@@ -39,6 +39,7 @@
 #include "annotate.h"
 #include "symfile.h"
 #include "objfiles.h"
+#include "linespec.h"
 #ifdef UI_OUT
 #include "ui-out.h"
 #endif
@@ -84,8 +85,6 @@ static int can_use_hardware_watchpoint (struct value *);
 static void break_at_finish_command (char *, int);
 static void break_at_finish_at_depth_command (char *, int);
 
-void tbreak_command (char *, int);
-
 static void tbreak_at_finish_command (char *, int);
 
 static void break_command_1 (char *, int, int);
@@ -196,12 +195,12 @@ static char *ep_parse_optional_filename (char **arg);
 static void catch_exec_command_1 (char *arg, int tempflag, int from_tty);
 #endif
 
-static void create_exception_catchpoint
-  (int tempflag, char *cond_string,
-   enum exception_event_kind ex_event, struct symtab_and_line *sal);
+static void create_exception_catchpoint (int tempflag, char *cond_string,
+                                        enum exception_event_kind ex_event,
+                                        struct symtab_and_line *sal);
 
-static void catch_exception_command_1
-  (enum exception_event_kind ex_event, char *arg, int tempflag, int from_tty);
+static void catch_exception_command_1 (enum exception_event_kind ex_event, 
+                                      char *arg, int tempflag, int from_tty);
 
 static void tcatch_command (char *arg, int from_tty);
 
@@ -209,18 +208,12 @@ static void ep_skip_leading_whitespace (char **s);
 
 /* Prototypes for exported functions. */
 
-static void awatch_command (char *, int);
-
-static void do_enable_breakpoint (struct breakpoint *, enum bpdisp);
-
 /* If FALSE, gdb will not use hardware support for watchpoints, even
    if such is available. */
 static int can_use_hw_watchpoints;
 
 void _initialize_breakpoint (void);
 
-void set_breakpoint_count (int);
-
 extern int addressprint;       /* Print machine addresses? */
 
 static int internal_breakpoint_number = -1;
@@ -537,11 +530,11 @@ condition_command (char *arg, int from_tty)
     {
       if (b->cond)
        {
-         free ((PTR) b->cond);
+         xfree (b->cond);
          b->cond = 0;
        }
       if (b->cond_string != NULL)
-       free ((PTR) b->cond_string);
+       xfree (b->cond_string);
 
       if (*p == 0)
        {
@@ -695,10 +688,9 @@ read_memory_nobpt (CORE_ADDR memaddr, char *myaddr, unsigned len)
       if (bp_addr + bp_size < memaddr + len)
        {
          /* Copy the section of memory after the breakpoint.  */
-         status = read_memory_nobpt
-           (bp_addr + bp_size,
-            myaddr + bp_addr + bp_size - memaddr,
-            memaddr + len - (bp_addr + bp_size));
+         status = read_memory_nobpt (bp_addr + bp_size,
+                                     myaddr + bp_addr + bp_size - memaddr,
+                                     memaddr + len - (bp_addr + bp_size));
          if (status != 0)
            return status;
        }
@@ -996,13 +988,13 @@ insert_breakpoints (void)
        switch (b->type)
          {
          case bp_catch_fork:
-           val = target_insert_fork_catchpoint (inferior_pid);
+           val = target_insert_fork_catchpoint (PIDGET (inferior_ptid));
            break;
          case bp_catch_vfork:
-           val = target_insert_vfork_catchpoint (inferior_pid);
+           val = target_insert_vfork_catchpoint (PIDGET (inferior_ptid));
            break;
          case bp_catch_exec:
-           val = target_insert_exec_catchpoint (inferior_pid);
+           val = target_insert_exec_catchpoint (PIDGET (inferior_ptid));
            break;
          default:
            warning ("Internal error, %s line %d.", __FILE__, __LINE__);
@@ -1069,10 +1061,10 @@ reattach_breakpoints (int pid)
 {
   register struct breakpoint *b;
   int val;
-  int saved_inferior_pid = inferior_pid;
+  ptid_t saved_inferior_ptid = inferior_ptid;
 
-  /* FIXME: use a cleanup, to insure that inferior_pid gets replaced! */
-  inferior_pid = pid;  /* Because remove_breakpoint will use this global. */
+  /* FIXME: use a cleanup, to insure that inferior_ptid gets replaced! */
+  inferior_ptid = pid_to_ptid (pid);   /* Because remove_breakpoint will use this global. */
   ALL_BREAKPOINTS (b)
   {
     if (b->inserted)
@@ -1084,12 +1076,12 @@ reattach_breakpoints (int pid)
          val = target_insert_breakpoint (b->address, b->shadow_contents);
        if (val != 0)
          {
-           inferior_pid = saved_inferior_pid;
+           inferior_ptid = saved_inferior_ptid;
            return val;
          }
       }
   }
-  inferior_pid = saved_inferior_pid;
+  inferior_ptid = saved_inferior_ptid;
   return 0;
 }
 
@@ -1213,13 +1205,13 @@ detach_breakpoints (int pid)
 {
   register struct breakpoint *b;
   int val;
-  int saved_inferior_pid = inferior_pid;
+  ptid_t saved_inferior_ptid = inferior_ptid;
 
-  if (pid == inferior_pid)
-    error ("Cannot detach breakpoints of inferior_pid");
+  if (pid == PIDGET (inferior_ptid))
+    error ("Cannot detach breakpoints of inferior_ptid");
 
-  /* FIXME: use a cleanup, to insure that inferior_pid gets replaced! */
-  inferior_pid = pid;  /* Because remove_breakpoint will use this global. */
+  /* FIXME: use a cleanup, to insure that inferior_ptid gets replaced! */
+  inferior_ptid = pid_to_ptid (pid);   /* Because remove_breakpoint will use this global. */
   ALL_BREAKPOINTS (b)
   {
     if (b->inserted)
@@ -1227,12 +1219,12 @@ detach_breakpoints (int pid)
        val = remove_breakpoint (b, mark_inserted);
        if (val != 0)
          {
-           inferior_pid = saved_inferior_pid;
+           inferior_ptid = saved_inferior_ptid;
            return val;
          }
       }
   }
-  inferior_pid = saved_inferior_pid;
+  inferior_ptid = saved_inferior_ptid;
   return 0;
 }
 
@@ -1266,7 +1258,7 @@ remove_breakpoint (struct breakpoint *b, insertion_state_t is)
          /* Check to see if breakpoint is in an overlay section;
             if so, we should remove the breakpoint at the LMA address.
             If that is not equal to the raw address, then we should 
-            presumable remove the breakpoint there as well.  */
+            presumably remove the breakpoint there as well.  */
          if (overlay_debugging && b->section &&
              section_is_overlay (b->section))
            {
@@ -1355,13 +1347,13 @@ remove_breakpoint (struct breakpoint *b, insertion_state_t is)
       switch (b->type)
        {
        case bp_catch_fork:
-         val = target_remove_fork_catchpoint (inferior_pid);
+         val = target_remove_fork_catchpoint (PIDGET (inferior_ptid));
          break;
        case bp_catch_vfork:
-         val = target_remove_vfork_catchpoint (inferior_pid);
+         val = target_remove_vfork_catchpoint (PIDGET (inferior_ptid));
          break;
        case bp_catch_exec:
-         val = target_remove_exec_catchpoint (inferior_pid);
+         val = target_remove_exec_catchpoint (PIDGET (inferior_ptid));
          break;
        default:
          warning ("Internal error, %s line %d.", __FILE__, __LINE__);
@@ -1573,12 +1565,12 @@ frame_in_dummy (struct frame_info *frame)
    PC is valid for process/thread PID.  */
 
 int
-breakpoint_thread_match (CORE_ADDR pc, int pid)
+breakpoint_thread_match (CORE_ADDR pc, ptid_t ptid)
 {
   struct breakpoint *b;
   int thread;
 
-  thread = pid_to_thread_id (pid);
+  thread = pid_to_thread_id (ptid);
 
   ALL_BREAKPOINTS (b)
     if (b->enable != disabled
@@ -1612,11 +1604,9 @@ ep_is_catchpoint (struct breakpoint *ep)
     || (ep->type == bp_catch_vfork)
     || (ep->type == bp_catch_exec)
     || (ep->type == bp_catch_catch)
-    || (ep->type == bp_catch_throw)
-
+    || (ep->type == bp_catch_throw);
 
   /* ??rehrauer: Add more kinds here, as are implemented... */
-    ;
 }
 
 int
@@ -1624,8 +1614,7 @@ ep_is_shlib_catchpoint (struct breakpoint *ep)
 {
   return
     (ep->type == bp_catch_load)
-    || (ep->type == bp_catch_unload)
-    ;
+    || (ep->type == bp_catch_unload);
 }
 
 int
@@ -1633,8 +1622,7 @@ ep_is_exception_catchpoint (struct breakpoint *ep)
 {
   return
     (ep->type == bp_catch_catch)
-    || (ep->type == bp_catch_throw)
-    ;
+    || (ep->type == bp_catch_throw);
 }
 
 /* Clear a bpstat so that it says we are not at any breakpoint.
@@ -1654,7 +1642,7 @@ bpstat_clear (bpstat *bsp)
       q = p->next;
       if (p->old_val != NULL)
        value_free (p->old_val);
-      free ((PTR) p);
+      xfree (p);
       p = q;
     }
   *bsp = NULL;
@@ -2092,8 +2080,8 @@ print_it_typical (bpstat bs)
        {
          mention (bs->breakpoint_at);
          if (interpreter_p && strcmp (interpreter_p, "mi") == 0)
-           ui_out_list_begin (uiout, "value");
-         ui_out_field_string (uiout, "reason", "access-watchpoint-trigger");
+           ui_out_field_string (uiout, "reason", "access-watchpoint-trigger");
+         ui_out_list_begin (uiout, "value");
          ui_out_text (uiout, "\nValue = ");
        }
       value_print (bs->breakpoint_at->val, stb->stream, 0,Val_pretty_default);
@@ -2181,7 +2169,8 @@ print_bp_stop_message (bpstat bs)
       return print_it_typical (bs);
       break;
     default:
-      internal_error ("print_bp_stop_message: unrecognized enum value");
+      internal_error (__FILE__, __LINE__,
+                     "print_bp_stop_message: unrecognized enum value");
       break;
     }
 }
@@ -2398,7 +2387,7 @@ bpstat_stop_status (CORE_ADDR *pc, int not_a_breakpoint)
   char message[sizeof (message1) + 30 /* slop */ ];
 
   /* Get the address where the breakpoint would have been.  */
-  bp_addr = *pc - (not_a_breakpoint && !SOFTWARE_SINGLE_STEP_P ? 
+  bp_addr = *pc - (not_a_breakpoint && !SOFTWARE_SINGLE_STEP_P () 
                    0 : DECR_PC_AFTER_BREAK);
 
   ALL_BREAKPOINTS_SAFE (b, temp)
@@ -2433,10 +2422,11 @@ bpstat_stop_status (CORE_ADDR *pc, int not_a_breakpoint)
        ignore it. */
     if ((b->type == bp_catch_load)
 #if defined(SOLIB_HAVE_LOAD_EVENT)
-       && (!SOLIB_HAVE_LOAD_EVENT (inferior_pid)
+       && (!SOLIB_HAVE_LOAD_EVENT (PIDGET (inferior_ptid))
            || ((b->dll_pathname != NULL)
                && (strcmp (b->dll_pathname, 
-                           SOLIB_LOADED_LIBRARY_PATHNAME (inferior_pid)) 
+                           SOLIB_LOADED_LIBRARY_PATHNAME (
+                             PIDGET (inferior_ptid)))
                    != 0)))
 #endif
       )
@@ -2444,25 +2434,28 @@ bpstat_stop_status (CORE_ADDR *pc, int not_a_breakpoint)
 
     if ((b->type == bp_catch_unload)
 #if defined(SOLIB_HAVE_UNLOAD_EVENT)
-       && (!SOLIB_HAVE_UNLOAD_EVENT (inferior_pid)
+       && (!SOLIB_HAVE_UNLOAD_EVENT (PIDGET (inferior_ptid))
            || ((b->dll_pathname != NULL)
                && (strcmp (b->dll_pathname, 
-                           SOLIB_UNLOADED_LIBRARY_PATHNAME (inferior_pid)) 
+                           SOLIB_UNLOADED_LIBRARY_PATHNAME (
+                             PIDGET (inferior_ptid)))
                    != 0)))
 #endif
       )
       continue;
 
     if ((b->type == bp_catch_fork)
-       && !target_has_forked (inferior_pid, &b->forked_inferior_pid))
+       && !target_has_forked (PIDGET (inferior_ptid),
+                              &b->forked_inferior_pid))
       continue;
 
     if ((b->type == bp_catch_vfork)
-       && !target_has_vforked (inferior_pid, &b->forked_inferior_pid))
+       && !target_has_vforked (PIDGET (inferior_ptid),
+                               &b->forked_inferior_pid))
       continue;
 
     if ((b->type == bp_catch_exec)
-       && !target_has_execd (inferior_pid, &b->exec_pathname))
+       && !target_has_execd (PIDGET (inferior_ptid), &b->exec_pathname))
       continue;
 
     if (ep_is_exception_catchpoint (b) &&
@@ -2780,7 +2773,7 @@ bpstat_what (bpstat bs)
      back and decide something of a lower priority is better.  The
      ordering is:
 
-     kc   < clr sgl shl slr sn sr ss ts
+     kc   < clr sgl shl shlr slr sn sr ss ts
      sgl  < clrs shl shlr slr sn sr ss ts
      slr  < err shl shlr sn sr ss ts
      clr  < clrs err shl shlr sn sr ss ts
@@ -2983,7 +2976,7 @@ bpstat_should_step (void)
   struct breakpoint *b;
   ALL_BREAKPOINTS (b)
     if (b->enable == enabled && b->type == bp_watchpoint)
-    return 1;
+      return 1;
   return 0;
 }
 
@@ -2998,7 +2991,7 @@ bpstat_have_active_hw_watchpoints (void)
        ((b->type == bp_hardware_watchpoint) ||
         (b->type == bp_read_watchpoint) ||
         (b->type == bp_access_watchpoint)))
-    return 1;
+      return 1;
   return 0;
 }
 \f
@@ -3043,11 +3036,13 @@ bpstat_get_triggered_catchpoints (bpstat ep_list, bpstat *cp_list)
          catchpoint triggers.  Clients who may wish to know the name
          later must get it from the catchpoint itself.) */
       if (ep->triggered_dll_pathname != NULL)
-       free (ep->triggered_dll_pathname);
+       xfree (ep->triggered_dll_pathname);
       if (ep->type == bp_catch_load)
-       dll_pathname = SOLIB_LOADED_LIBRARY_PATHNAME (inferior_pid);
+       dll_pathname = SOLIB_LOADED_LIBRARY_PATHNAME (
+                        PIDGET (inferior_ptid));
       else
-       dll_pathname = SOLIB_UNLOADED_LIBRARY_PATHNAME (inferior_pid);
+       dll_pathname = SOLIB_UNLOADED_LIBRARY_PATHNAME (
+                        PIDGET (inferior_ptid));
 #else
       dll_pathname = NULL;
 #endif
@@ -3130,7 +3125,8 @@ print_one_breakpoint (struct breakpoint *b,
   annotate_field (1);
   if (((int) b->type > (sizeof (bptypes) / sizeof (bptypes[0])))
       || ((int) b->type != bptypes[(int) b->type].type))
-    internal_error ("bptypes table does not describe type #%d.",
+    internal_error (__FILE__, __LINE__,
+                   "bptypes table does not describe type #%d.",
                    (int) b->type);
 #ifdef UI_OUT
   ui_out_field_string (uiout, "type", bptypes[(int) b->type].description);
@@ -3158,11 +3154,17 @@ print_one_breakpoint (struct breakpoint *b,
   /* 5 and 6 */
   strcpy (wrap_indent, "                           ");
   if (addressprint)
-    strcat (wrap_indent, "           ");
+    {
+      if (TARGET_ADDR_BIT <= 32)
+       strcat (wrap_indent, "           ");
+      else
+       strcat (wrap_indent, "                   ");
+    }
   switch (b->type)
     {
     case bp_none:
-      internal_error ("print_one_breakpoint: bp_none encountered\n");
+      internal_error (__FILE__, __LINE__,
+                     "print_one_breakpoint: bp_none encountered\n");
       break;
 
     case bp_watchpoint:
@@ -3331,13 +3333,18 @@ print_one_breakpoint (struct breakpoint *b,
 #else
       if (addressprint)
        {
+         char *tmp;
+
          annotate_field (4);
-         /* FIXME-32x64: need a print_address_numeric with
-            field width */
-         printf_filtered
-           ("%s ",
-            local_hex_string_custom
-            ((unsigned long) b->address, "08l"));
+
+         if (TARGET_ADDR_BIT <= 32)
+           tmp = longest_local_hex_string_custom (b->address
+                                                  & (CORE_ADDR) 0xffffffff, 
+                                                  "08l");
+         else
+           tmp = longest_local_hex_string_custom (b->address, "016l");
+
+         printf_filtered ("%s ", tmp);
        }
       annotate_field (5);
       *last_addr = b->address;
@@ -3572,7 +3579,10 @@ breakpoint_1 (int bnum, int allflag)
            if (addressprint)
              {
                annotate_field (4);
-               ui_out_table_header (uiout, 10, ui_left, "Address");    /* 5 */
+               if (TARGET_ADDR_BIT <= 32)
+                 ui_out_table_header (uiout, 10, ui_left, "Address");  /* 5 */
+               else
+                 ui_out_table_header (uiout, 18, ui_left, "Address");  /* 5 */
              }
            annotate_field (5);
            ui_out_table_header (uiout, 40, ui_noalign, "What");        /* 6 */
@@ -3589,7 +3599,10 @@ breakpoint_1 (int bnum, int allflag)
            if (addressprint)
              {
                annotate_field (4);
-               printf_filtered ("Address    ");
+               if (TARGET_ADDR_BIT <= 32)
+                 printf_filtered ("Address    ");
+               else
+                 printf_filtered ("Address            ");
              }
            annotate_field (5);
            printf_filtered ("What\n");
@@ -3638,7 +3651,7 @@ breakpoints_info (char *bnum_exp, int from_tty)
   int bnum = -1;
 
   if (bnum_exp)
-    bnum = parse_and_eval_address (bnum_exp);
+    bnum = parse_and_eval_long (bnum_exp);
 
   breakpoint_1 (bnum, 0);
 }
@@ -3650,7 +3663,7 @@ maintenance_info_breakpoints (char *bnum_exp, int from_tty)
   int bnum = -1;
 
   if (bnum_exp)
-    bnum = parse_and_eval_address (bnum_exp);
+    bnum = parse_and_eval_long (bnum_exp);
 
   breakpoint_1 (bnum, 1);
 }
@@ -3677,15 +3690,15 @@ describe_other_breakpoints (CORE_ADDR pc, asection *section)
            b->section == section)
          {
            others--;
-           printf_filtered
-             ("%d%s%s ",
-              b->number,
-              ((b->enable == disabled || 
-                b->enable == shlib_disabled || 
-                b->enable == call_disabled) ? " (disabled)" 
-               : b->enable == permanent ? " (permanent)"
-               : ""),
-              (others > 1) ? "," : ((others == 1) ? " and" : ""));
+           printf_filtered ("%d%s%s ",
+                            b->number,
+                            ((b->enable == disabled || 
+                              b->enable == shlib_disabled || 
+                              b->enable == call_disabled) ? " (disabled)" 
+                             : b->enable == permanent ? " (permanent)"
+                             : ""),
+                            (others > 1) ? "," 
+                            : ((others == 1) ? " and" : ""));
          }
       printf_filtered ("also set at pc ");
       print_address_numeric (pc, 1, gdb_stdout);
@@ -3749,14 +3762,16 @@ check_duplicates (CORE_ADDR address, asection *section)
 
       /* Permanent breakpoint should always be inserted.  */
       if (! perm_bp->inserted)
-       internal_error ("allegedly permanent breakpoint is not "
+       internal_error (__FILE__, __LINE__,
+                       "allegedly permanent breakpoint is not "
                        "actually inserted");
 
       ALL_BREAKPOINTS (b)
        if (b != perm_bp)
          {
            if (b->inserted)
-             internal_error ("another breakpoint was inserted on top of "
+             internal_error (__FILE__, __LINE__,
+                             "another breakpoint was inserted on top of "
                              "a permanent breakpoint");
 
            if (b->enable != disabled
@@ -3870,7 +3885,7 @@ create_longjmp_breakpoint (char *func_name)
   b->enable = disabled;
   b->silent = 1;
   if (func_name)
-    b->addr_string = strsave (func_name);
+    b->addr_string = xstrdup (func_name);
   b->number = internal_breakpoint_number--;
 }
 
@@ -3927,7 +3942,7 @@ create_thread_event_breakpoint (CORE_ADDR address)
   b->enable = enabled;
   /* addr_string has to be used or breakpoint_re_set will delete me.  */
   sprintf (addr_string, "*0x%s", paddr (b->address));
-  b->addr_string = strsave (addr_string);
+  b->addr_string = xstrdup (addr_string);
 
   return b;
 }
@@ -3950,7 +3965,7 @@ remove_solib_event_breakpoints (void)
 
   ALL_BREAKPOINTS_SAFE (b, temp)
     if (b->type == bp_shlib_event)
-    delete_breakpoint (b);
+      delete_breakpoint (b);
 }
 
 struct breakpoint *
@@ -4058,13 +4073,13 @@ solib_load_unload_1 (char *hookname, int tempflag, char *dll_pathname,
 
   /* Make sure that all storage allocated in decode_line_1 gets freed
      in case the following errors out.  */
-  old_chain = make_cleanup (free, sals.sals);
+  old_chain = make_cleanup (xfree, sals.sals);
   if (canonical != (char **) NULL)
     {
-      make_cleanup (free, canonical);
+      make_cleanup (xfree, canonical);
       canonical_strings_chain = make_cleanup (null_cleanup, 0);
       if (canonical[0] != NULL)
-       make_cleanup (free, canonical[0]);
+       make_cleanup (xfree, canonical[0]);
     }
 
   resolve_sal_pc (&sals.sals[0]);
@@ -4310,8 +4325,8 @@ set_momentary_breakpoint (struct symtab_and_line sal, struct frame_info *frame,
   /* 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);
+  if (in_thread_list (inferior_ptid))
+    b->thread = pid_to_thread_id (inferior_ptid);
 
   return b;
 }
@@ -4677,18 +4692,18 @@ break_command_1 (char *arg, int flag, int from_tty)
   old_chain = make_cleanup (null_cleanup, 0);
 
   /* Make sure that all storage allocated to SALS gets freed.  */
-  make_cleanup (free, sals.sals);
+  make_cleanup (xfree, sals.sals);
 
   /* Cleanup the addr_string array but not its contents. */
-  make_cleanup (free, addr_string);
+  make_cleanup (xfree, addr_string);
 
   /* Allocate space for all the cond expressions. */
   cond = xcalloc (sals.nelts, sizeof (struct expression *));
-  make_cleanup (free, cond);
+  make_cleanup (xfree, cond);
 
   /* Allocate space for all the cond strings. */
   cond_string = xcalloc (sals.nelts, sizeof (char **));
-  make_cleanup (free, cond_string);
+  make_cleanup (xfree, cond_string);
 
   /* ----------------------------- SNIP -----------------------------
      Anything added to the cleanup chain beyond this point is assumed
@@ -4702,7 +4717,7 @@ break_command_1 (char *arg, int flag, int from_tty)
   for (i = 0; i < sals.nelts; i++)
     {
       if (addr_string[i] != NULL)
-       make_cleanup (free, addr_string[i]);
+       make_cleanup (xfree, addr_string[i]);
     }
 
   /* Resolve all line numbers to PC's and verify that the addresses
@@ -4736,10 +4751,10 @@ break_command_1 (char *arg, int flag, int from_tty)
            {
              tok = cond_start = end_tok + 1;
              cond[i] = parse_exp_1 (&tok, block_for_pc (sals.sals[i].pc), 0);
-             make_cleanup (free, cond[i]);
+             make_cleanup (xfree, cond[i]);
              cond_end = tok;
              cond_string[i] = savestring (cond_start, cond_end - cond_start);
-             make_cleanup (free, cond_string[i]);
+             make_cleanup (xfree, cond_string[i]);
            }
          else if (toklen >= 1 && strncmp (tok, "thread", toklen) == 0)
            {
@@ -4818,18 +4833,18 @@ do_captured_breakpoint (void *data)
   old_chain = make_cleanup (null_cleanup, 0);
 
   /* Always have a addr_string array, even if it is empty. */
-  make_cleanup (free, addr_string);
+  make_cleanup (xfree, addr_string);
 
   /* Make sure that all storage allocated to SALS gets freed.  */
-  make_cleanup (free, sals.sals);
+  make_cleanup (xfree, sals.sals);
 
   /* Allocate space for all the cond expressions. */
   cond = xcalloc (sals.nelts, sizeof (struct expression *));
-  make_cleanup (free, cond);
+  make_cleanup (xfree, cond);
 
   /* Allocate space for all the cond strings. */
   cond_string = xcalloc (sals.nelts, sizeof (char **));
-  make_cleanup (free, cond_string);
+  make_cleanup (xfree, cond_string);
 
   /* ----------------------------- SNIP -----------------------------
      Anything added to the cleanup chain beyond this point is assumed
@@ -4843,7 +4858,7 @@ do_captured_breakpoint (void *data)
   for (i = 0; i < sals.nelts; i++)
     {
       if (addr_string[i] != NULL)
-       make_cleanup (free, addr_string[i]);
+       make_cleanup (xfree, addr_string[i]);
     }
 
   /* Wait until now before checking for garbage at the end of the
@@ -4865,7 +4880,7 @@ do_captured_breakpoint (void *data)
          cond[i] = parse_exp_1 (&tok, block_for_pc (sals.sals[i].pc), 0);
          if (*tok != '\0')
            error ("Garbage %s follows condition", tok);
-         make_cleanup (free, cond[i]);
+         make_cleanup (xfree, cond[i]);
          cond_string[i] = xstrdup (args->condition);
        }
     }
@@ -4905,7 +4920,9 @@ break_at_finish_at_depth_command_1 (char *arg, int flag, int from_tty)
 {
   struct frame_info *frame;
   CORE_ADDR low, high, selected_pc = 0;
-  char *extra_args, *level_arg, *addr_string;
+  char *extra_args = NULL;
+  char *level_arg;
+  char *addr_string;
   int extra_args_len = 0, if_arg = 0;
 
   if (!arg ||
@@ -4965,7 +4982,7 @@ break_at_finish_at_depth_command_1 (char *arg, int flag, int from_tty)
          else
            sprintf (addr_string, "*0x%s", paddr_nz (high));
          break_command_1 (addr_string, flag, from_tty);
-         free (addr_string);
+         xfree (addr_string);
        }
       else
        error ("No function contains the specified address");
@@ -4983,7 +5000,7 @@ break_at_finish_command_1 (char *arg, int flag, int from_tty)
   struct symtabs_and_lines sals;
   struct symtab_and_line sal;
   struct cleanup *old_chain;
-  char *extra_args;
+  char *extra_args = NULL;
   int extra_args_len = 0;
   int i, if_arg = 0;
 
@@ -5034,8 +5051,8 @@ break_at_finish_command_1 (char *arg, int flag, int from_tty)
   sals = decode_line_1 (&addr_string, 1, (struct symtab *) NULL, 0,
                        (char ***) NULL);
 
-  free (beg_addr_string);
-  old_chain = make_cleanup (free, sals.sals);
+  xfree (beg_addr_string);
+  old_chain = make_cleanup (xfree, sals.sals);
   for (i = 0; (i < sals.nelts); i++)
     {
       sal = sals.sals[i];
@@ -5047,7 +5064,7 @@ break_at_finish_command_1 (char *arg, int flag, int from_tty)
          else
            sprintf (break_string, "*0x%s", paddr_nz (high));
          break_command_1 (break_string, flag, from_tty);
-         free (break_string);
+         xfree (break_string);
        }
       else
        error ("No function contains the specified address");
@@ -5313,7 +5330,7 @@ watch_command_1 (char *arg, int accessflag, int from_tty)
      startup sequence by the dynamic linker.
 
      However, I tried avoiding that by having HP-UX's implementation of
-     TARGET_CAN_USE_HW_WATCHPOINT return FALSE if there was no inferior_pid
+     TARGET_CAN_USE_HW_WATCHPOINT return FALSE if there was no inferior_ptid
      yet, which forced slow watches before a "run" or "attach", and it
      still fails somewhere in the startup code.
 
@@ -5406,7 +5423,7 @@ watch_command_1 (char *arg, int accessflag, int from_tty)
 
 #if !defined(TARGET_REGION_OK_FOR_HW_WATCHPOINT)
 #define TARGET_REGION_OK_FOR_HW_WATCHPOINT(ADDR,LEN) \
-     TARGET_REGION_SIZE_OK_FOR_HW_WATCHPOINT(LEN)
+     (TARGET_REGION_SIZE_OK_FOR_HW_WATCHPOINT(LEN))
 #endif
 
 static int
@@ -5565,7 +5582,7 @@ until_break_command (char *arg, int from_tty)
     error ("Couldn't get information on specified line.");
 
   sal = sals.sals[0];
-  free ((PTR) sals.sals);      /* malloc'd, so freed */
+  xfree (sals.sals);   /* malloc'd, so freed */
 
   if (*arg)
     error ("Junk at end of arguments.");
@@ -6045,7 +6062,7 @@ catch_load_command_1 (char *arg, int tempflag, int from_tty)
   /* Create a load breakpoint that only triggers when a load of
      the specified dll (or any dll, if no pathname was specified)
      occurs. */
-  SOLIB_CREATE_CATCH_LOAD_HOOK (inferior_pid, tempflag, 
+  SOLIB_CREATE_CATCH_LOAD_HOOK (PIDGET (inferior_ptid), tempflag, 
                                dll_pathname, cond_string);
 }
 
@@ -6087,7 +6104,7 @@ catch_unload_command_1 (char *arg, int tempflag, int from_tty)
   /* Create an unload breakpoint that only triggers when an unload of
      the specified dll (or any dll, if no pathname was specified)
      occurs. */
-  SOLIB_CREATE_CATCH_UNLOAD_HOOK (inferior_pid, tempflag, 
+  SOLIB_CREATE_CATCH_UNLOAD_HOOK (PIDGET (inferior_ptid), tempflag, 
                                  dll_pathname, cond_string);
 }
 #endif /* SOLIB_ADD */
@@ -6306,7 +6323,7 @@ handle_gnu_4_16_catch_command (char *arg, int tempflag, int from_tty)
       warning ("Multiple breakpoints were set.");
       warning ("Use the \"delete\" command to delete unwanted breakpoints.");
     }
-  free ((PTR) sals.sals);
+  xfree (sals.sals);
 }
 
 #if 0
@@ -6641,7 +6658,7 @@ clear_command (char *arg, int from_tty)
       if (from_tty)
        putchar_unfiltered ('\n');
     }
-  free ((PTR) sals.sals);
+  xfree (sals.sals);
 }
 \f
 /* Delete breakpoint in BS if they are `delete' breakpoints and
@@ -6779,7 +6796,8 @@ delete_breakpoint (struct breakpoint *bpt)
             If there is a permanent breakpoint somewhere, it should
             always be the only one inserted.  */
          if (b->enable == permanent)
-           internal_error ("another breakpoint was inserted on top of "
+           internal_error (__FILE__, __LINE__,
+                           "another breakpoint was inserted on top of "
                            "a permanent breakpoint");
 
          if (b->type == bp_hardware_breakpoint)
@@ -6800,25 +6818,25 @@ delete_breakpoint (struct breakpoint *bpt)
 
   free_command_lines (&bpt->commands);
   if (bpt->cond)
-    free (bpt->cond);
+    xfree (bpt->cond);
   if (bpt->cond_string != NULL)
-    free (bpt->cond_string);
+    xfree (bpt->cond_string);
   if (bpt->addr_string != NULL)
-    free (bpt->addr_string);
+    xfree (bpt->addr_string);
   if (bpt->exp != NULL)
-    free (bpt->exp);
+    xfree (bpt->exp);
   if (bpt->exp_string != NULL)
-    free (bpt->exp_string);
+    xfree (bpt->exp_string);
   if (bpt->val != NULL)
     value_free (bpt->val);
   if (bpt->source_file != NULL)
-    free (bpt->source_file);
+    xfree (bpt->source_file);
   if (bpt->dll_pathname != NULL)
-    free (bpt->dll_pathname);
+    xfree (bpt->dll_pathname);
   if (bpt->triggered_dll_pathname != NULL)
-    free (bpt->triggered_dll_pathname);
+    xfree (bpt->triggered_dll_pathname);
   if (bpt->exec_pathname != NULL)
-    free (bpt->exec_pathname);
+    xfree (bpt->exec_pathname);
 
   /* Be sure no bpstat's are pointing at it after it's been freed.  */
   /* FIXME, how can we find all bpstat's?
@@ -6840,7 +6858,7 @@ delete_breakpoint (struct breakpoint *bpt)
      bp, we mark it as deleted before freeing its storage. */
   bpt->type = bp_none;
 
-  free ((PTR) bpt);
+  xfree (bpt);
 }
 
 static void
@@ -6950,7 +6968,7 @@ breakpoint_re_set_one (PTR bint)
            {
              s = b->cond_string;
              if (b->cond)
-               free ((PTR) b->cond);
+               xfree (b->cond);
              b->cond = parse_exp_1 (&s, block_for_pc (sals.sals[i].pc), 0);
            }
 
@@ -6969,7 +6987,7 @@ breakpoint_re_set_one (PTR bint)
            )
            {
              if (b->source_file != NULL)
-               free (b->source_file);
+               xfree (b->source_file);
              if (sals.sals[i].symtab == NULL)
                b->source_file = NULL;
              else
@@ -6998,7 +7016,7 @@ breakpoint_re_set_one (PTR bint)
          check_duplicates (b->address, b->section);
 
        }
-      free ((PTR) sals.sals);
+      xfree (sals.sals);
       break;
 
     case bp_watchpoint:
@@ -7016,7 +7034,7 @@ breakpoint_re_set_one (PTR bint)
 
       /* So for now, just use a global context.  */
       if (b->exp)
-       free ((PTR) b->exp);
+       xfree (b->exp);
       b->exp = parse_expression (b->exp_string);
       b->exp_valid_block = innermost_block;
       mark = value_mark ();
@@ -7031,7 +7049,7 @@ breakpoint_re_set_one (PTR bint)
        {
          s = b->cond_string;
          if (b->cond)
-           free ((PTR) b->cond);
+           xfree (b->cond);
          b->cond = parse_exp_1 (&s, (struct block *) 0, 0);
        }
       if (b->enable == enabled)
@@ -7126,14 +7144,14 @@ breakpoint_re_set (void)
 /* Reset the thread number of this breakpoint:
 
    - If the breakpoint is for all threads, leave it as-is.
-   - Else, reset it to the current thread for inferior_pid. */
+   - Else, reset it to the current thread for inferior_ptid. */
 void
 breakpoint_re_set_thread (struct breakpoint *b)
 {
   if (b->thread != -1)
     {
-      if (in_thread_list (inferior_pid))
-       b->thread = pid_to_thread_id (inferior_pid);
+      if (in_thread_list (inferior_ptid))
+       b->thread = pid_to_thread_id (inferior_ptid);
     }
 }
 
This page took 0.039153 seconds and 4 git commands to generate.