diff options
Diffstat (limited to 'gdb/source.c')
-rw-r--r-- | gdb/source.c | 27 |
1 files changed, 9 insertions, 18 deletions
diff --git a/gdb/source.c b/gdb/source.c index 2c465a1..bbeb415 100644 --- a/gdb/source.c +++ b/gdb/source.c @@ -1341,30 +1341,21 @@ print_source_lines_base (struct symtab *s, int line, int stopline, styled_string (file_name_style.style (), filename), safe_strerror (errcode)); } - else + else if (uiout->is_mi_like_p () || uiout->test_flags (ui_source_list)) { + /* CLI expects only the "file" field. MI expects both + fields. ui_source_list is set only for CLI, not for + TUI. */ + uiout->field_signed ("line", line); uiout->text ("\tin "); - /* CLI expects only the "file" field. TUI expects only the - "fullname" field (and TUI does break if "file" is printed). - MI expects both fields. ui_source_list is set only for CLI, - not for TUI. */ - if (uiout->is_mi_like_p () || uiout->test_flags (ui_source_list)) - uiout->field_string ("file", symtab_to_filename_for_display (s), - file_name_style.style ()); - if (uiout->is_mi_like_p () || !uiout->test_flags (ui_source_list)) + uiout->field_string ("file", symtab_to_filename_for_display (s), + file_name_style.style ()); + if (uiout->is_mi_like_p ()) { 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 = (char *) alloca (strlen (s_fullname) + 1); - strcpy (local_fullname, s_fullname); - - uiout->field_string ("fullname", local_fullname); + uiout->field_string ("fullname", s_fullname); } uiout->text ("\n"); |