public inbox for gdb-patches@sourceware.org
 help / color / mirror / Atom feed
* [pushed 0/2] Fix a regression / crash in language_info
@ 2022-01-06 14:53 Tom Tromey
  2022-01-06 14:53 ` [pushed 1/2] Fix some failures in langs.exp Tom Tromey
  2022-01-06 14:53 ` [pushed 2/2] Avoid crash in language_info Tom Tromey
  0 siblings, 2 replies; 3+ messages in thread
From: Tom Tromey @ 2022-01-06 14:53 UTC (permalink / raw)
  To: gdb-patches

An earlier patch introduced a new crash in language_info.  This series
fixes it.  Originally I was just going to push the fix, but when
writing a test case I realized that another patch was needed to fix
some pre-existing fails in langs.exp.

I'm checking this in.

Tom



^ permalink raw reply	[flat|nested] 3+ messages in thread

* [pushed 1/2] Fix some failures in langs.exp
  2022-01-06 14:53 [pushed 0/2] Fix a regression / crash in language_info Tom Tromey
@ 2022-01-06 14:53 ` Tom Tromey
  2022-01-06 14:53 ` [pushed 2/2] Avoid crash in language_info Tom Tromey
  1 sibling, 0 replies; 3+ messages in thread
From: Tom Tromey @ 2022-01-06 14:53 UTC (permalink / raw)
  To: gdb-patches; +Cc: Tom Tromey

langs.exp currently has some fails for me because the stack trace
includes full paths to the source files.

    FAIL: gdb.base/langs.exp: up to foo in langs.exp
    FAIL: gdb.base/langs.exp: up to cppsub_ in langs.exp
    FAIL: gdb.base/langs.exp: up to fsub in langs.exp

This fixes the failures by making the filename regexps a bit more lax.
---
 gdb/testsuite/gdb.base/langs.exp | 6 +++---
 1 file changed, 3 insertions(+), 3 deletions(-)

diff --git a/gdb/testsuite/gdb.base/langs.exp b/gdb/testsuite/gdb.base/langs.exp
index 7d93875edf9..134cde1f6b5 100644
--- a/gdb/testsuite/gdb.base/langs.exp
+++ b/gdb/testsuite/gdb.base/langs.exp
@@ -64,20 +64,20 @@ if [runto csub] then {
 
     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 \\(.*" \
+    gdb_test "up" ".* in (foo|$foo_func).* at .*langs2\\.$ext.*return csub \\(.*" \
 	"up to foo in langs.exp"
     gdb_test "show language" "currently $lang.*" \
 	"show language at foo in langs.exp"
 
     if {!$gcc_compiled} then { setup_xfail "rs6000-*-*" }
-    gdb_test "up" ".* in cppsub_ .* at langs2\\.$ext.*return foo \\(.*" \
+    gdb_test "up" ".* in cppsub_ .* at .*langs2\\.$ext.*return foo \\(.*" \
 	"up to cppsub_ in langs.exp"
     gdb_test "show language" "currently $lang.*" \
 	"show language at cppsub_ in langs.exp"
 
     if { !$isfixed } { set lang fortran }
     if {!$gcc_compiled} then { setup_xfail "rs6000-*-*" }
-    gdb_test "up" ".* in fsub.* at langs1\\.f.*" \
+    gdb_test "up" ".* in fsub.* at .*langs1\\.f.*" \
 	"up to fsub in langs.exp"
     gdb_test "show language" "currently $lang.*" \
 	"show language at fsub in langs.exp"
-- 
2.31.1


^ permalink raw reply	[flat|nested] 3+ messages in thread

* [pushed 2/2] Avoid crash in language_info
  2022-01-06 14:53 [pushed 0/2] Fix a regression / crash in language_info Tom Tromey
  2022-01-06 14:53 ` [pushed 1/2] Fix some failures in langs.exp Tom Tromey
@ 2022-01-06 14:53 ` Tom Tromey
  1 sibling, 0 replies; 3+ messages in thread
From: Tom Tromey @ 2022-01-06 14:53 UTC (permalink / raw)
  To: gdb-patches; +Cc: Tom Tromey

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.
---
 gdb/language.c                   | 2 +-
 gdb/testsuite/gdb.base/langs.exp | 9 +++++++++
 2 files changed, 10 insertions(+), 1 deletion(-)

diff --git a/gdb/language.c b/gdb/language.c
index 0e6a1a4bcdb..0846b3e5eeb 100644
--- a/gdb/language.c
+++ b/gdb/language.c
@@ -384,7 +384,7 @@ language_info ()
 
   expected_language = current_language;
   printf_filtered (_("Current language:  %s\n"), language);
-  show_language_command (NULL, 1, NULL, NULL);
+  show_language_command (gdb_stdout, 1, NULL, NULL);
 }
 \f
 /* This page contains functions for the printing out of
diff --git a/gdb/testsuite/gdb.base/langs.exp b/gdb/testsuite/gdb.base/langs.exp
index 134cde1f6b5..9c78a8a4397 100644
--- a/gdb/testsuite/gdb.base/langs.exp
+++ b/gdb/testsuite/gdb.base/langs.exp
@@ -117,6 +117,15 @@ if [runto csub] then {
     gdb_test "print x" \
 	"expression parsing not implemented for language .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
-- 
2.31.1


^ permalink raw reply	[flat|nested] 3+ messages in thread

end of thread, other threads:[~2022-01-06 14:53 UTC | newest]

Thread overview: 3+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2022-01-06 14:53 [pushed 0/2] Fix a regression / crash in language_info Tom Tromey
2022-01-06 14:53 ` [pushed 1/2] Fix some failures in langs.exp Tom Tromey
2022-01-06 14:53 ` [pushed 2/2] Avoid crash in language_info Tom Tromey

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for read-only IMAP folder(s) and NNTP newsgroup(s).