diff options
author | Tom de Vries <tdevries@suse.de> | 2024-09-24 13:50:19 +0200 |
---|---|---|
committer | Tom de Vries <tdevries@suse.de> | 2024-09-24 13:50:19 +0200 |
commit | 7fd46e6b2ac5a30ecb33b4b290d824247cb68a20 (patch) | |
tree | 42fe205e04be1bd76c5c59782ae7c9d70237fe0c | |
parent | 6078478a9075a3ad3d1370dc540e11425948074c (diff) | |
download | binutils-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.c | 14 |
1 files changed, 2 insertions, 12 deletions
@@ -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. */ |