From f3f21aa9f90ccbcf73779b167aaee0fb6bbd3f4d Mon Sep 17 00:00:00 2001 From: Tom de Vries Date: Tue, 24 Sep 2024 13:55:50 +0200 Subject: [PATCH] [gdb] Eliminate catch(...) in target_wait Remove duplicate code in target_wait using SCOPE_EXIT. Tested on aarch64-linux. Approved-By: Tom Tromey --- gdb/target.c | 18 ++++++------------ 1 file changed, 6 insertions(+), 12 deletions(-) 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. */ -- 2.39.5