* breakpoint.c (create_thread_event_breakpoint): Use xasprintf.
authorDaniel Jacobowitz <drow@false.org>
Wed, 4 Dec 2002 04:53:13 +0000 (04:53 +0000)
committerDaniel Jacobowitz <drow@false.org>
Wed, 4 Dec 2002 04:53:13 +0000 (04:53 +0000)
(create_breakpoints): Make sure the addr_string field is not
NULL.

gdb/ChangeLog
gdb/breakpoint.c

index 12d6a0f76ba5978bff0a3e4355d47e1802716136..01296116041bc3215196d21d10387844122858b8 100644 (file)
@@ -1,3 +1,9 @@
+2002-12-03  H.J. Lu  (hjl@gnu.org)
+
+       * breakpoint.c (create_thread_event_breakpoint): Use xasprintf.
+       (create_breakpoints): Make sure the addr_string field is not
+       NULL.
+
 2002-12-03  Andrew Cagney  <ac131313@redhat.com>
 
        * sparc-nat.c (fetch_inferior_registers)
index 7418c414843ec48ab52de9fbcace1ecfafd20fc3..cf3da5edae32fbe5c106d79e6ca286a4b272e02b 100644 (file)
@@ -4010,14 +4010,12 @@ struct breakpoint *
 create_thread_event_breakpoint (CORE_ADDR address)
 {
   struct breakpoint *b;
-  char addr_string[80];                /* Surely an addr can't be longer than that. */
 
   b = create_internal_breakpoint (address, bp_thread_event);
   
   b->enable_state = bp_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 = xstrdup (addr_string);
+  xasprintf (&b->addr_string, "*0x%s", paddr (b->address));
 
   return b;
 }
@@ -4573,7 +4571,12 @@ create_breakpoints (struct symtabs_and_lines sals, char **addr_string,
        b->number = breakpoint_count;
        b->cond = cond[i];
        b->thread = thread;
-       b->addr_string = addr_string[i];
+       if (addr_string[i])
+         b->addr_string = addr_string[i];
+       else
+         /* addr_string has to be used or breakpoint_re_set will delete
+            me.  */
+         xasprintf (&b->addr_string, "*0x%s", paddr (b->address));
        b->cond_string = cond_string[i];
        b->ignore_count = ignore_count;
        b->enable_state = bp_enabled;