summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
-rw-r--r--gdb/ChangeLog6
-rw-r--r--gdb/event-top.c6
2 files changed, 11 insertions, 1 deletions
diff --git a/gdb/ChangeLog b/gdb/ChangeLog
index 3e28e77cb73..17e10e869b8 100644
--- a/gdb/ChangeLog
+++ b/gdb/ChangeLog
@@ -1,5 +1,11 @@
2019-04-25 Tom Tromey <tromey@adacore.com>
+ PR gdb/24475:
+ * event-top.c (gdb_rl_callback_handler): Make "gdb_rl_expt"
+ static.
+
+2019-04-25 Tom Tromey <tromey@adacore.com>
+
* xml-support.c (struct gdb_xml_parser) <set_error>: Take an
rvalue reference.
(gdb_xml_start_element_wrapper, gdb_xml_end_element_wrapper)
diff --git a/gdb/event-top.c b/gdb/event-top.c
index 9fa46c8ad44..3ccf136ff12 100644
--- a/gdb/event-top.c
+++ b/gdb/event-top.c
@@ -205,11 +205,15 @@ gdb_rl_callback_read_char_wrapper (gdb_client_data client_data)
static void
gdb_rl_callback_handler (char *rl) noexcept
{
- struct gdb_exception gdb_rl_expt;
+ /* This is static to avoid undefined behavior when calling longjmp
+ -- gdb_exception has a destructor with side effects. */
+ static struct gdb_exception gdb_rl_expt;
struct ui *ui = current_ui;
try
{
+ /* Ensure the exception is reset on each call. */
+ gdb_rl_expt = {};
ui->input_handler (gdb::unique_xmalloc_ptr<char> (rl));
}
catch (gdb_exception &ex)