aboutsummaryrefslogtreecommitdiff
path: root/gdb
diff options
context:
space:
mode:
authorJan Kratochvil <jan.kratochvil@redhat.com>2013-03-14 14:42:48 +0000
committerJan Kratochvil <jan.kratochvil@redhat.com>2013-03-14 14:42:48 +0000
commit8f1b8b820d2bf24961b5624c01ebcdc11de2dbb3 (patch)
tree612386853552bab738dbfe777766779d36ea97d5 /gdb
parent23eb71e428cfd7fb7bb92e1edd4ad9ec5cbcc8fa (diff)
downloadfsf-binutils-gdb-8f1b8b820d2bf24961b5624c01ebcdc11de2dbb3.zip
fsf-binutils-gdb-8f1b8b820d2bf24961b5624c01ebcdc11de2dbb3.tar.gz
fsf-binutils-gdb-8f1b8b820d2bf24961b5624c01ebcdc11de2dbb3.tar.bz2
gdb/
* source.c (print_source_lines_base): Make a local copy of symtab_to_fullname.
Diffstat (limited to 'gdb')
-rw-r--r--gdb/ChangeLog5
-rw-r--r--gdb/source.c17
2 files changed, 17 insertions, 5 deletions
diff --git a/gdb/ChangeLog b/gdb/ChangeLog
index 6bb1f44..01a25cd 100644
--- a/gdb/ChangeLog
+++ b/gdb/ChangeLog
@@ -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>
diff --git a/gdb/source.c b/gdb/source.c
index b154dfe..2d9410e 100644
--- a/gdb/source.c
+++ b/gdb/source.c
@@ -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");
}