From: Tom de Vries Date: Tue, 24 Sep 2024 11:55:50 +0000 (+0200) Subject: [gdb] Eliminate catch(...) in target_wait X-Git-Tag: gdb-16-branchpoint~829 X-Git-Url: http://git.ipfire.org/?a=commitdiff_plain;h=f3f21aa9f90ccbcf73779b167aaee0fb6bbd3f4d;p=thirdparty%2Fbinutils-gdb.git [gdb] Eliminate catch(...) in target_wait Remove duplicate code in target_wait using SCOPE_EXIT. Tested on aarch64-linux. Approved-By: Tom Tromey --- diff --git a/gdb/target.c b/gdb/target.c index 47f09f506dc..962996fb3cb 100644 --- a/gdb/target.c +++ b/gdb/target.c @@ -2575,18 +2575,12 @@ target_wait (ptid_t ptid, struct target_waitstatus *status, if (!target_can_async_p (target)) gdb_assert ((options & TARGET_WNOHANG) == 0); - try - { - gdb::observers::target_pre_wait.notify (ptid); - ptid_t event_ptid = target->wait (ptid, status, options); - gdb::observers::target_post_wait.notify (event_ptid); - return event_ptid; - } - catch (...) - { - gdb::observers::target_post_wait.notify (null_ptid); - throw; - } + ptid_t event_ptid = null_ptid; + SCOPE_EXIT { gdb::observers::target_post_wait.notify (event_ptid); }; + gdb::observers::target_pre_wait.notify (ptid); + event_ptid = target->wait (ptid, status, options); + + return event_ptid; } /* See target.h. */