Avoid expression parsing crash with unknown language
authorTom Tromey <tromey@adacore.com>
Thu, 15 Jul 2021 16:13:18 +0000 (10:13 -0600)
committerTom Tromey <tromey@adacore.com>
Mon, 19 Jul 2021 17:01:47 +0000 (11:01 -0600)
commite22715ce300957aabdf908a76fb1bf8bc17bba21
treea2f6e2a3aff7c39287d86c4d179e948c42191135
parent51799bd45fc2037df2ebea4f266a3b3f16a9ecee
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
(cherry picked from commit dcd482c1b756d9da2130552a6eb58b852d6efb97)

gdb/ChangeLog
2021-07-19  Tom Tromey  <tromey@adacore.com>

PR gdb/28093
* language.c (auto_or_unknown_language::parser): Call error.

gdb/testsuite/ChangeLog
2021-07-19  Tom Tromey  <tromey@adacore.com>

PR gdb/28093
* gdb.base/langs.exp: Add tests.
gdb/ChangeLog
gdb/language.c
gdb/testsuite/ChangeLog
gdb/testsuite/gdb.base/langs.exp
This page took 0.032824 seconds and 4 git commands to generate.