]> git.ipfire.org Git - thirdparty/binutils-gdb.git/commitdiff
2003-08-10 Andrew Cagney <cagney@redhat.com>
authorAndrew Cagney <cagney@redhat.com>
Sun, 10 Aug 2003 17:19:23 +0000 (17:19 +0000)
committerAndrew Cagney <cagney@redhat.com>
Sun, 10 Aug 2003 17:19:23 +0000 (17:19 +0000)
* infcall.c (call_function_by_hand): Use xstrprintf instead of
sprintf.  Make "name" constant.

gdb/ChangeLog
gdb/infcall.c

index 481ec599cfbb18b09c478b2ea1d081f08afa5ca5..0364294f8429d6baa2a05dabdfec12f85dc8ded1 100644 (file)
@@ -1,3 +1,8 @@
+2003-08-10  Andrew Cagney  <cagney@redhat.com>
+
+       * infcall.c (call_function_by_hand): Use xstrprintf instead of
+       sprintf.  Make "name" constant.
+
 2003-08-10  Mark Kettenis  <kettenis@gnu.org>
 
        * i387-tdep.c (i387_register_to_value): Use get_frame_register
index a4a6ac10608649ebdc4ec27580f658c24a293a39..8df1114e106f12b83b9d6fc7f331adcdddac07b9 100644 (file)
@@ -937,7 +937,7 @@ You must use a pointer to function type variable. Command ignored.", arg_name);
   if (stopped_by_random_signal || !stop_stack_dummy)
     {
       /* Find the name of the function we're about to complain about.  */
-      char *name = NULL;
+      const char *name = NULL;
       {
        struct symbol *symbol = find_pc_function (funaddr);
        if (symbol)
@@ -949,17 +949,17 @@ You must use a pointer to function type variable. Command ignored.", arg_name);
            if (msymbol)
              name = SYMBOL_PRINT_NAME (msymbol);
          }
+       if (name == NULL)
+         {
+           /* Can't use a cleanup here.  It is discarded, instead use
+               an alloca.  */
+           char *tmp = xstrprintf ("at %s", local_hex_string (funaddr));
+           char *a = alloca (strlen (tmp) + 1);
+           strcpy (a, tmp);
+           xfree (tmp);
+           name = a;
+         }
       }
-      if (name == NULL)
-       {
-         /* NOTE: cagney/2003-04-23: Don't blame me.  This code dates
-             back to 1993-07-08, I simply moved it.  */
-         char format[80];
-         sprintf (format, "at %s", local_hex_format ());
-         name = alloca (80);
-         /* FIXME-32x64: assumes funaddr fits in a long.  */
-         sprintf (name, format, (unsigned long) funaddr);
-       }
       if (stopped_by_random_signal)
        {
          /* We stopped inside the FUNCTION because of a random