* ada-lang.c (extract_string): Delete.
authorJoel Brobecker <brobecker@gnat.com>
Thu, 16 Apr 2009 17:16:18 +0000 (17:16 +0000)
committerJoel Brobecker <brobecker@gnat.com>
Thu, 16 Apr 2009 17:16:18 +0000 (17:16 +0000)
        (ada_main_name): Reimplement using target_read_string instead of
        extract_string.

gdb/ChangeLog
gdb/ada-lang.c

index f723145caafb913622470508c82d5319e70f1dfe..ccbdfea4f8fd64b49c5920a2cb7a28ec50574f76 100644 (file)
@@ -1,3 +1,9 @@
+2009-04-16  Joel Brobecker  <brobecker@adacore.com>
+
+       * ada-lang.c (extract_string): Delete.
+       (ada_main_name): Reimplement using target_read_string instead of
+       extract_string.
+
 2009-04-16  Andreas Schwab  <schwab@linux-m68k.org>
 
        * m68klinux-nat.c: Remove obsolete comment.
index 54f2590e4d21bf0890da505e01736f2b9508e07f..814a793e33cf0f7fac4d6e6618c56f464776a6a3 100644 (file)
@@ -679,8 +679,7 @@ char *
 ada_main_name (void)
 {
   struct minimal_symbol *msym;
-  CORE_ADDR main_program_name_addr;
-  static char main_program_name[1024];
+  static char *main_program_name = NULL;
 
   /* For Ada, the name of the main procedure is stored in a specific
      string constant, generated by the binder.  Look for that symbol,
@@ -691,11 +690,19 @@ ada_main_name (void)
 
   if (msym != NULL)
     {
+      CORE_ADDR main_program_name_addr;
+      int err_code;
+
       main_program_name_addr = SYMBOL_VALUE_ADDRESS (msym);
       if (main_program_name_addr == 0)
         error (_("Invalid address for Ada main program name."));
 
-      extract_string (main_program_name_addr, main_program_name);
+      xfree (main_program_name);
+      target_read_string (main_program_name_addr, &main_program_name,
+                          1024, &err_code);
+
+      if (err_code != 0)
+        return NULL;
       return main_program_name;
     }