diff options
author | Tom Tromey <tromey@adacore.com> | 2019-02-05 02:57:21 -0700 |
---|---|---|
committer | Tom Tromey <tromey@adacore.com> | 2019-02-15 13:53:42 -0700 |
commit | 5b6ea500d554b173e63e1f8f0344d568ad347463 (patch) | |
tree | a45c5aa5d4d73cef9093a37468ab37957c5f5615 /gdb | |
parent | e397fd39c62c70900306fa206ebcae1a4853db8b (diff) | |
download | gdb-5b6ea500d554b173e63e1f8f0344d568ad347463.zip gdb-5b6ea500d554b173e63e1f8f0344d568ad347463.tar.gz gdb-5b6ea500d554b173e63e1f8f0344d568ad347463.tar.bz2 |
Exception safety in ravenscar-thread.c
This changes some code in ravenscar-thread.c to use scoped_restore. I
am not sure if it matters in practice, but this makes these methods
exception-safe in case the methods lower in the target stack can
throw.
gdb/ChangeLog
2019-02-15 Tom Tromey <tromey@adacore.com>
* ravenscar-thread.c (ravenscar_thread_target::stopped_by_sw_breakpoint)
(ravenscar_thread_target::stopped_by_hw_breakpoint)
(ravenscar_thread_target::stopped_by_watchpoint)
(ravenscar_thread_target::stopped_data_address)
(ravenscar_thread_target::core_of_thread): Use scoped_restore.
Diffstat (limited to 'gdb')
-rw-r--r-- | gdb/ChangeLog | 8 | ||||
-rw-r--r-- | gdb/ravenscar-thread.c | 50 |
2 files changed, 23 insertions, 35 deletions
diff --git a/gdb/ChangeLog b/gdb/ChangeLog index 6929494..ce4eab4 100644 --- a/gdb/ChangeLog +++ b/gdb/ChangeLog @@ -1,5 +1,13 @@ 2019-02-15 Tom Tromey <tromey@adacore.com> + * ravenscar-thread.c (ravenscar_thread_target::stopped_by_sw_breakpoint) + (ravenscar_thread_target::stopped_by_hw_breakpoint) + (ravenscar_thread_target::stopped_by_watchpoint) + (ravenscar_thread_target::stopped_data_address) + (ravenscar_thread_target::core_of_thread): Use scoped_restore. + +2019-02-15 Tom Tromey <tromey@adacore.com> + * ravenscar-thread.c: Fix some typos. 2019-02-15 Philippe Waroquiers <philippe.waroquiers@skynet.be> diff --git a/gdb/ravenscar-thread.c b/gdb/ravenscar-thread.c index 32a4aa8..9d708fd 100644 --- a/gdb/ravenscar-thread.c +++ b/gdb/ravenscar-thread.c @@ -464,13 +464,9 @@ ravenscar_thread_target::prepare_to_store (struct regcache *regcache) bool ravenscar_thread_target::stopped_by_sw_breakpoint () { - ptid_t saved_ptid = inferior_ptid; - bool result; - - inferior_ptid = get_base_thread_from_ravenscar_task (saved_ptid); - result = beneath ()->stopped_by_sw_breakpoint (); - inferior_ptid = saved_ptid; - return result; + scoped_restore save_ptid = make_scoped_restore (&inferior_ptid); + inferior_ptid = get_base_thread_from_ravenscar_task (inferior_ptid); + return beneath ()->stopped_by_sw_breakpoint (); } /* Implement the to_stopped_by_hw_breakpoint target_ops "method". */ @@ -478,13 +474,9 @@ ravenscar_thread_target::stopped_by_sw_breakpoint () bool ravenscar_thread_target::stopped_by_hw_breakpoint () { - ptid_t saved_ptid = inferior_ptid; - bool result; - - inferior_ptid = get_base_thread_from_ravenscar_task (saved_ptid); - result = beneath ()->stopped_by_hw_breakpoint (); - inferior_ptid = saved_ptid; - return result; + scoped_restore save_ptid = make_scoped_restore (&inferior_ptid); + inferior_ptid = get_base_thread_from_ravenscar_task (inferior_ptid); + return beneath ()->stopped_by_hw_breakpoint (); } /* Implement the to_stopped_by_watchpoint target_ops "method". */ @@ -492,13 +484,9 @@ ravenscar_thread_target::stopped_by_hw_breakpoint () bool ravenscar_thread_target::stopped_by_watchpoint () { - ptid_t saved_ptid = inferior_ptid; - bool result; - - inferior_ptid = get_base_thread_from_ravenscar_task (saved_ptid); - result = beneath ()->stopped_by_watchpoint (); - inferior_ptid = saved_ptid; - return result; + scoped_restore save_ptid = make_scoped_restore (&inferior_ptid); + inferior_ptid = get_base_thread_from_ravenscar_task (inferior_ptid); + return beneath ()->stopped_by_watchpoint (); } /* Implement the to_stopped_data_address target_ops "method". */ @@ -506,13 +494,9 @@ ravenscar_thread_target::stopped_by_watchpoint () bool ravenscar_thread_target::stopped_data_address (CORE_ADDR *addr_p) { - ptid_t saved_ptid = inferior_ptid; - bool result; - - inferior_ptid = get_base_thread_from_ravenscar_task (saved_ptid); - result = beneath ()->stopped_data_address (addr_p); - inferior_ptid = saved_ptid; - return result; + scoped_restore save_ptid = make_scoped_restore (&inferior_ptid); + inferior_ptid = get_base_thread_from_ravenscar_task (inferior_ptid); + return beneath ()->stopped_data_address (addr_p); } void @@ -528,13 +512,9 @@ ravenscar_thread_target::mourn_inferior () int ravenscar_thread_target::core_of_thread (ptid_t ptid) { - ptid_t saved_ptid = inferior_ptid; - int result; - - inferior_ptid = get_base_thread_from_ravenscar_task (saved_ptid); - result = beneath ()->core_of_thread (inferior_ptid); - inferior_ptid = saved_ptid; - return result; + scoped_restore save_ptid = make_scoped_restore (&inferior_ptid); + inferior_ptid = get_base_thread_from_ravenscar_task (inferior_ptid); + return beneath ()->core_of_thread (inferior_ptid); } /* Observer on inferior_created: push ravenscar thread stratum if needed. */ |