gdb/
authorJan Kratochvil <jan.kratochvil@redhat.com>
Thu, 14 Mar 2013 14:42:48 +0000 (14:42 +0000)
committerJan Kratochvil <jan.kratochvil@redhat.com>
Thu, 14 Mar 2013 14:42:48 +0000 (14:42 +0000)
* source.c (print_source_lines_base): Make a local copy of
symtab_to_fullname.

gdb/ChangeLog
gdb/source.c

index 6bb1f44ff9c4907526ec20aec58a78bb13de4d38..01a25cdddbc4cfb1fd0573d6e043f2df7eb21e98 100644 (file)
@@ -1,3 +1,8 @@
+2013-03-14  Jan Kratochvil  <jan.kratochvil@redhat.com>
+
+       * source.c (print_source_lines_base): Make a local copy of
+       symtab_to_fullname.
+
 2013-03-14  Hui Zhu  <hui_zhu@mentor.com>
            Jan Kratochvil  <jan.kratochvil@redhat.com>
 
index b154dfe61779a9d3543b13eb45e93b8fc5cf9163..2d9410ecc37ed9cfbcf2823901d40623dd29ee53 100644 (file)
@@ -1355,11 +1355,18 @@ print_source_lines_base (struct symtab *s, int line, int stopline,
                                 symtab_to_filename_for_display (s));
          if (ui_out_is_mi_like_p (uiout)
              || !ui_out_test_flags (uiout, ui_source_list))
-           {
-             const char *fullname = symtab_to_fullname (s);
-
-             ui_out_field_string (uiout, "fullname", fullname);
-           }
+           {
+             const char *s_fullname = symtab_to_fullname (s);
+             char *local_fullname;
+
+             /* ui_out_field_string may free S_FULLNAME by calling
+                open_source_file for it again.  See e.g.,
+                tui_field_string->tui_show_source.  */
+             local_fullname = alloca (strlen (s_fullname) + 1);
+             strcpy (local_fullname, s_fullname);
+
+             ui_out_field_string (uiout, "fullname", local_fullname);
+           }
 
          ui_out_text (uiout, "\n");
        }
This page took 0.027241 seconds and 4 git commands to generate.