aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorTom de Vries <tdevries@suse.de>2024-09-24 13:50:19 +0200
committerTom de Vries <tdevries@suse.de>2024-09-24 13:50:19 +0200
commit7fd46e6b2ac5a30ecb33b4b290d824247cb68a20 (patch)
tree42fe205e04be1bd76c5c59782ae7c9d70237fe0c
parent6078478a9075a3ad3d1370dc540e11425948074c (diff)
downloadbinutils-7fd46e6b2ac5a30ecb33b4b290d824247cb68a20.zip
binutils-7fd46e6b2ac5a30ecb33b4b290d824247cb68a20.tar.gz
binutils-7fd46e6b2ac5a30ecb33b4b290d824247cb68a20.tar.bz2
[gdb] Eliminate catch(...) in execute_fn_to_string
Remove duplicate code in execute_fn_to_string using SCOPE_EXIT. Tested on aarch64-linux. Approved-By: Tom Tromey <tom@tromey.com>
-rw-r--r--gdb/top.c14
1 files changed, 2 insertions, 12 deletions
diff --git a/gdb/top.c b/gdb/top.c
index d6bf1d4..eae54aa 100644
--- a/gdb/top.c
+++ b/gdb/top.c
@@ -632,19 +632,9 @@ execute_fn_to_string (std::string &res, std::function<void(void)> fn,
{
string_file str_file (term_out);
- try
- {
- execute_fn_to_ui_file (&str_file, fn);
- }
- catch (...)
- {
- /* Finally. */
- res = str_file.release ();
- throw;
- }
+ SCOPE_EXIT { res = str_file.release (); };
- /* And finally. */
- res = str_file.release ();
+ execute_fn_to_ui_file (&str_file, fn);
}
/* See top.h. */