diff options
author | Tom Tromey <tom@tromey.com> | 2023-12-12 19:22:07 -0700 |
---|---|---|
committer | Tom Tromey <tom@tromey.com> | 2024-03-11 16:27:26 -0600 |
commit | 0a909fdd47b94e2d2fd9c0387fb644a98cb35d3b (patch) | |
tree | 1d0ff21d200755fde75cd1547bc18cf129f7082a /gdb/source.c | |
parent | 0824937af0c0822e629a7076c3f5dd39df3b16be (diff) | |
download | binutils-0a909fdd47b94e2d2fd9c0387fb644a98cb35d3b.zip binutils-0a909fdd47b94e2d2fd9c0387fb644a98cb35d3b.tar.gz binutils-0a909fdd47b94e2d2fd9c0387fb644a98cb35d3b.tar.bz2 |
Remove tui-out.[ch]
The other day on irc, we were discussing the "m_line" hack in
tui-out.c, and I mentioned that it would be nice to replace this with
a new ui_out_flag.
Later, I looked at ui_out_flag and found:
ui_source_list = (1 << 0),
... and sure enough, this is tested already.
This patch removes tui-out.[ch] and changes the TUI to use an ordinary
cli-out object without this flag set.
As far as I can tell, this doesn't affect behavior at all -- the TUI
tests all pass, and interactively I tried switching stack frames,
"list", etc, and it all seems to work.
New in v2: fixed the problem pointed out by Keith, and added a test
case for that scenario.
Reviewed-By: Andrew Burgess <aburgess@redhat.com>
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"); |