diff options
author | Andrew Burgess <aburgess@redhat.com> | 2021-11-11 15:17:27 +0000 |
---|---|---|
committer | Andrew Burgess <aburgess@redhat.com> | 2021-12-23 11:42:31 +0000 |
commit | 391c90eea53478a5e96ec88cd713e11909555911 (patch) | |
tree | ac5b19be7b4485ebd87279dcdcc2ea57e4a0b72b /zlib/compress.c | |
parent | 7898f55ba03f2e0d9f59159c900c273da98a9c94 (diff) | |
download | gdb-391c90eea53478a5e96ec88cd713e11909555911.zip gdb-391c90eea53478a5e96ec88cd713e11909555911.tar.gz gdb-391c90eea53478a5e96ec88cd713e11909555911.tar.bz2 |
gdb: make use of SCOPE_EXIT to manage thread executing state
While working on another patch relating to how GDB manages threads
executing and resumed state, I spotted the following code in
record-btrace.c:
executing = tp->executing ();
set_executing (proc_target, inferior_ptid, false);
id = null_frame_id;
try
{
id = get_frame_id (get_current_frame ());
}
catch (const gdb_exception &except)
{
/* Restore the previous execution state. */
set_executing (proc_target, inferior_ptid, executing);
throw;
}
/* Restore the previous execution state. */
set_executing (proc_target, inferior_ptid, executing);
return id;
I notice that we only catch the exception so we can call
set_executing, and this is the same call to set_executing that we need
to perform in the non-exception return path.
This would be much cleaner if we could use SCOPE_EXIT to avoid the
try/catch, so lets do that.
While cleaning this up, I also applied a similar patch to
record-full.c, though there's no try/catch in that case, but using
SCOPE_EXIT makes the code safe if, in the future, we do start throwing
exceptions.
There should be no user visible changes after this commit.
Diffstat (limited to 'zlib/compress.c')
0 files changed, 0 insertions, 0 deletions