diff options
Diffstat (limited to 'gdb/gdbserver')
-rw-r--r-- | gdb/gdbserver/ChangeLog | 6 | ||||
-rw-r--r-- | gdb/gdbserver/gdbreplay.c | 5 | ||||
-rw-r--r-- | gdb/gdbserver/linux-low.c | 10 | ||||
-rw-r--r-- | gdb/gdbserver/server.c | 30 |
4 files changed, 24 insertions, 27 deletions
diff --git a/gdb/gdbserver/ChangeLog b/gdb/gdbserver/ChangeLog index f0923a6..00312e6 100644 --- a/gdb/gdbserver/ChangeLog +++ b/gdb/gdbserver/ChangeLog @@ -1,5 +1,11 @@ 2019-04-08 Tom Tromey <tom@tromey.com> + * server.c: Use C++ exception handling. + * linux-low.c: Use C++ exception handling. + * gdbreplay.c: Use C++ exception handling. + +2019-04-08 Tom Tromey <tom@tromey.com> + * server.c (handle_btrace_general_set, handle_qxfer_btrace) (handle_qxfer_btrace_conf, detach_or_kill_for_exit_cleanup) (captured_main, main): Update. diff --git a/gdb/gdbserver/gdbreplay.c b/gdb/gdbserver/gdbreplay.c index 1acd24b..bf566ab 100644 --- a/gdb/gdbserver/gdbreplay.c +++ b/gdb/gdbserver/gdbreplay.c @@ -528,11 +528,11 @@ captured_main (int argc, char *argv[]) int main (int argc, char *argv[]) { - TRY + try { captured_main (argc, argv); } - CATCH (exception, RETURN_MASK_ALL) + catch (const gdb_exception_RETURN_MASK_ALL &exception) { if (exception.reason == RETURN_ERROR) { @@ -542,7 +542,6 @@ main (int argc, char *argv[]) exit (1); } - END_CATCH gdb_assert_not_reached ("captured_main should never return"); } diff --git a/gdb/gdbserver/linux-low.c b/gdb/gdbserver/linux-low.c index 65919c3..6ca79d5 100644 --- a/gdb/gdbserver/linux-low.c +++ b/gdb/gdbserver/linux-low.c @@ -1531,7 +1531,7 @@ linux_detach_one_lwp (struct lwp_info *lwp) /* Preparing to resume may try to write registers, and fail if the lwp is zombie. If that happens, ignore the error. We'll handle it below, when detach fails with ESRCH. */ - TRY + try { /* Flush any pending changes to the process's registers. */ regcache_invalidate_thread (thread); @@ -1540,12 +1540,11 @@ linux_detach_one_lwp (struct lwp_info *lwp) if (the_low_target.prepare_to_resume != NULL) the_low_target.prepare_to_resume (lwp); } - CATCH (ex, RETURN_MASK_ERROR) + catch (const gdb_exception_RETURN_MASK_ERROR &ex) { if (!check_ptrace_stopped_lwp_gone (lwp)) throw_exception (ex); } - END_CATCH lwpid = lwpid_of (thread); if (ptrace (PTRACE_DETACH, lwpid, (PTRACE_TYPE_ARG3) 0, @@ -4508,16 +4507,15 @@ static void linux_resume_one_lwp (struct lwp_info *lwp, int step, int signal, siginfo_t *info) { - TRY + try { linux_resume_one_lwp_throw (lwp, step, signal, info); } - CATCH (ex, RETURN_MASK_ERROR) + catch (const gdb_exception_RETURN_MASK_ERROR &ex) { if (!check_ptrace_stopped_lwp_gone (lwp)) throw_exception (ex); } - END_CATCH } /* This function is called once per thread via for_each_thread. diff --git a/gdb/gdbserver/server.c b/gdb/gdbserver/server.c index 0f4341c..99ce21e 100644 --- a/gdb/gdbserver/server.c +++ b/gdb/gdbserver/server.c @@ -459,7 +459,7 @@ handle_btrace_general_set (char *own_buf) return -1; } - TRY + try { if (strcmp (op, "bts") == 0) handle_btrace_enable_bts (thread); @@ -472,11 +472,10 @@ handle_btrace_general_set (char *own_buf) write_ok (own_buf); } - CATCH (exception, RETURN_MASK_ERROR) + catch (const gdb_exception_RETURN_MASK_ERROR &exception) { sprintf (own_buf, "E.%s", exception.what ()); } - END_CATCH return 1; } @@ -1876,18 +1875,17 @@ handle_qxfer_btrace (const char *annex, { buffer_free (&cache); - TRY + try { result = target_read_btrace (thread->btrace, &cache, type); if (result != 0) memcpy (cs.own_buf, cache.buffer, cache.used_size); } - CATCH (exception, RETURN_MASK_ERROR) + catch (const gdb_exception_RETURN_MASK_ERROR &exception) { sprintf (cs.own_buf, "E.%s", exception.what ()); result = -1; } - END_CATCH if (result != 0) return -3; @@ -1948,18 +1946,17 @@ handle_qxfer_btrace_conf (const char *annex, { buffer_free (&cache); - TRY + try { result = target_read_btrace_conf (thread->btrace, &cache); if (result != 0) memcpy (cs.own_buf, cache.buffer, cache.used_size); } - CATCH (exception, RETURN_MASK_ERROR) + catch (const gdb_exception_RETURN_MASK_ERROR &exception) { sprintf (cs.own_buf, "E.%s", exception.what ()); result = -1; } - END_CATCH if (result != 0) return -3; @@ -3552,18 +3549,17 @@ static int exit_code; static void detach_or_kill_for_exit_cleanup () { - TRY + try { detach_or_kill_for_exit (); } - CATCH (exception, RETURN_MASK_ALL) + catch (const gdb_exception_RETURN_MASK_ALL &exception) { fflush (stdout); fprintf (stderr, "Detach or kill failed: %s\n", exception.what ()); exit_code = 1; } - END_CATCH } /* Main function. This is called by the real "main" function, @@ -3866,7 +3862,7 @@ captured_main (int argc, char *argv[]) remote_open (port); - TRY + try { /* Wait for events. This will return when all event sources are removed from the event loop. */ @@ -3931,7 +3927,7 @@ captured_main (int argc, char *argv[]) } } } - CATCH (exception, RETURN_MASK_ERROR) + catch (const gdb_exception_RETURN_MASK_ERROR &exception) { fflush (stdout); fprintf (stderr, "gdbserver: %s\n", exception.what ()); @@ -3945,7 +3941,6 @@ captured_main (int argc, char *argv[]) if (run_once) throw_quit ("Quit"); } - END_CATCH } } @@ -3955,11 +3950,11 @@ int main (int argc, char *argv[]) { - TRY + try { captured_main (argc, argv); } - CATCH (exception, RETURN_MASK_ALL) + catch (const gdb_exception_RETURN_MASK_ALL &exception) { if (exception.reason == RETURN_ERROR) { @@ -3971,7 +3966,6 @@ main (int argc, char *argv[]) exit (exit_code); } - END_CATCH gdb_assert_not_reached ("captured_main should never return"); } |