diff options
author | Tom Tromey <tromey@adacore.com> | 2021-07-15 10:13:18 -0600 |
---|---|---|
committer | Tom Tromey <tromey@adacore.com> | 2021-07-15 10:13:18 -0600 |
commit | dcd482c1b756d9da2130552a6eb58b852d6efb97 (patch) | |
tree | 757748b8395a0cfbc2b163fe1bba6e3d09372a95 /gdb/testsuite/gdb.base/langs.exp | |
parent | 3a849a3454a53684ca3d679697adb1bfb56596cc (diff) | |
download | gdb-dcd482c1b756d9da2130552a6eb58b852d6efb97.zip gdb-dcd482c1b756d9da2130552a6eb58b852d6efb97.tar.gz gdb-dcd482c1b756d9da2130552a6eb58b852d6efb97.tar.bz2 |
Avoid expression parsing crash with unknown language
PR gdb/28093 points out that gdb crashes when language is set to
"unknown" and expression parsing is attempted. At first I thought
this was a regression due to the expression rewrite, but it turns out
that older versions crash as well.
This patch avoids the crash by changing the default expression parser
to throw an exception. I think this is preferable -- the current
behavior of silently doing nothing does not really make sense.
Bug: https://sourceware.org/bugzilla/show_bug.cgi?id=28093
Diffstat (limited to 'gdb/testsuite/gdb.base/langs.exp')
-rw-r--r-- | gdb/testsuite/gdb.base/langs.exp | 6 |
1 files changed, 6 insertions, 0 deletions
diff --git a/gdb/testsuite/gdb.base/langs.exp b/gdb/testsuite/gdb.base/langs.exp index 15908b0..631401a 100644 --- a/gdb/testsuite/gdb.base/langs.exp +++ b/gdb/testsuite/gdb.base/langs.exp @@ -111,6 +111,12 @@ if [runto csub] then { "set lang to minimal" gdb_test "print x" " = 5000" "print parameter value" + + # Ensure this at least does not crash. + gdb_test_no_output "set language unknown" + gdb_test "print x" \ + "expression parsing not implemented for language .Unknown." \ + "expression parsing does not crash for unknown" } set timeout $oldtimeout |