public inbox for gdb-cvs@sourceware.org
help / color / mirror / Atom feed
* [binutils-gdb] gdb/ui-out.h: Fix exception handling in do_with_buffered_output
@ 2024-01-19 17:19 Aaron Merey
  0 siblings, 0 replies; only message in thread
From: Aaron Merey @ 2024-01-19 17:19 UTC (permalink / raw)
  To: gdb-cvs

https://sourceware.org/git/gitweb.cgi?p=binutils-gdb.git;h=9323e42f586b753bf0e4e0dfc267ca00b948f448

commit 9323e42f586b753bf0e4e0dfc267ca00b948f448
Author: Aaron Merey <amerey@redhat.com>
Date:   Fri Jan 19 11:20:19 2024 -0500

    gdb/ui-out.h: Fix exception handling in do_with_buffered_output
    
    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.

Diff:
---
 gdb/ui-out.h | 4 ++--
 1 file changed, 2 insertions(+), 2 deletions(-)

diff --git a/gdb/ui-out.h b/gdb/ui-out.h
index 71add908a84..5b6ddd55063 100644
--- a/gdb/ui-out.h
+++ b/gdb/ui-out.h
@@ -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.  */

^ permalink raw reply	[flat|nested] only message in thread

only message in thread, other threads:[~2024-01-19 17:19 UTC | newest]

Thread overview: (only message) (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2024-01-19 17:19 [binutils-gdb] gdb/ui-out.h: Fix exception handling in do_with_buffered_output Aaron Merey

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).