Avoid crash in language_info

language_info calls:

  show_language_command (NULL, 1, NULL, NULL);

... "knowing" that show_language_command does not use its ui_file
parameter.  However, this was changed in commit 7514a661
("Consistently Use ui_file parameter to show callbacks").

This patch changes language_info to pass a ui_file.

It took a while to write the test -- this function is only called when
'verbose' is on and when switching the "expected" language in auto
mode.
This commit is contained in:
Tom Tromey 2022-01-05 10:42:25 -07:00
parent d8504344d4
commit 5220f61a22
2 changed files with 10 additions and 1 deletions

View file

@ -384,7 +384,7 @@ language_info ()
expected_language = current_language; expected_language = current_language;
printf_filtered (_("Current language: %s\n"), language); printf_filtered (_("Current language: %s\n"), language);
show_language_command (NULL, 1, NULL, NULL); show_language_command (gdb_stdout, 1, NULL, NULL);
} }
/* This page contains functions for the printing out of /* This page contains functions for the printing out of

View file

@ -117,6 +117,15 @@ if [runto csub] then {
gdb_test "print x" \ gdb_test "print x" \
"expression parsing not implemented for language .Unknown." \ "expression parsing not implemented for language .Unknown." \
"expression parsing does not crash for unknown" "expression parsing does not crash for unknown"
gdb_test_no_output "set lang auto" \
"set lang back to auto for verbose test"
gdb_test_no_output "set verbose on"
if { !$isfixed } { set lang c\\+\\+; set ext cxx }
if {!$gcc_compiled} then { setup_xfail "rs6000-*-*" }
gdb_test "up" \
".* in (foo|$foo_func).* at .*langs2\\.$ext.*return csub \\(.*Current language: auto.*" \
"up to foo in langs.exp when verbose"
} }
set timeout $oldtimeout set timeout $oldtimeout