]> git.ipfire.org Git - thirdparty/binutils-gdb.git/commitdiff
[gdb] Eliminate catch(...) in target_wait
authorTom de Vries <tdevries@suse.de>
Tue, 24 Sep 2024 11:55:50 +0000 (13:55 +0200)
committerTom de Vries <tdevries@suse.de>
Tue, 24 Sep 2024 11:55:50 +0000 (13:55 +0200)
Remove duplicate code in target_wait using SCOPE_EXIT.

Tested on aarch64-linux.

Approved-By: Tom Tromey <tom@tromey.com>
gdb/target.c

index 47f09f506dcc0529b2d41316f3ccb8876f69fccc..962996fb3cb81bf38cb0532065246f0603c484b0 100644 (file)
@@ -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.  */