]> git.ipfire.org Git - thirdparty/binutils-gdb.git/commitdiff
gdb/ui-out.h: Fix exception handling in do_with_buffered_output
authorAaron Merey <amerey@redhat.com>
Fri, 19 Jan 2024 16:20:19 +0000 (11:20 -0500)
committerAaron Merey <amerey@redhat.com>
Fri, 19 Jan 2024 17:18:58 +0000 (12:18 -0500)
Replace throw with throw_exeception in do_with_buffered_output.

This patch fixes regressions in gdb.dwarf2/dw2-dir-file-name.exp
caused by commit 519d63439.

do_with_buffered_output needs to use throw_exception instead of
throw to ensure that exceptions of the correct type are thrown.
If using throw, gdb_exception_error may be wrongly converted into
gdb_exception during print_frame_info.  This prevents the exception
from being caught in print_stack_frame.

gdb/ui-out.h

index 71add908a84c1bbff646685bd00600bfab84612a..5b6ddd55063bd8817a70d741c599c5a4c0a88692 100644 (file)
@@ -543,7 +543,7 @@ do_with_buffered_output (F func, ui_out *uiout, Arg... args)
     {
       func (uiout, std::forward<Arg> (args)...);
     }
-  catch (const gdb_exception &ex)
+  catch (gdb_exception &ex)
     {
       /* Ideally flush would be called in the destructor of buffer_group,
         however flushing might cause an exception to be thrown.  Catch it
@@ -556,7 +556,7 @@ do_with_buffered_output (F func, ui_out *uiout, Arg... args)
        {
        }
 
-      throw (std::move (ex));
+      throw_exception (std::move (ex));
     }
 
   /* Try was successful.  Let any further exceptions propagate.  */