mirror of
https://github.com/bminor/binutils-gdb.git
synced 2025-11-16 12:34:43 +00:00
[gdb] Handle ^C in ~scoped_remote_fd
While reviewing "catch (...)" uses I came across:
...
try
{
fileio_error remote_errno;
m_remote->remote_hostio_close (m_fd, &remote_errno);
}
catch (...)
{
/* Swallow exception before it escapes the dtor. If
something goes wrong, likely the connection is gone,
and there's nothing else that can be done. */
}
...
This also swallows gdb_exception_quit and gdb_exception_forced_quit. I don't
know whether these can actually happen here, but if not it's better to
accommodate for the possibility anyway.
Fix this by handling gdb_exception_quit and gdb_exception_forced_quit
explicitly.
It could be that "catch (...)" should be replaced by
"catch (const gdb_exception &)" but that depends on what kind of exception
remote_hostio_close is expected to throw, and I don't know that, so I'm
leaving it as is.
Tested on aarch64-linux.
Approved-By: Tom Tromey <tom@tromey.com>
This commit is contained in:
12
gdb/remote.c
12
gdb/remote.c
@@ -13242,6 +13242,18 @@ public:
|
||||
fileio_error remote_errno;
|
||||
m_remote->remote_hostio_close (m_fd, &remote_errno);
|
||||
}
|
||||
catch (const gdb_exception_quit &ex)
|
||||
{
|
||||
/* We can't throw from a destructor, so re-set the quit flag
|
||||
for later QUIT checking. */
|
||||
set_quit_flag ();
|
||||
}
|
||||
catch (const gdb_exception_forced_quit &ex)
|
||||
{
|
||||
/* Like above, but (eventually) cause GDB to terminate by
|
||||
setting sync_quit_force_run. */
|
||||
set_force_quit_flag ();
|
||||
}
|
||||
catch (...)
|
||||
{
|
||||
/* Swallow exception before it escapes the dtor. If
|
||||
|
||||
Reference in New Issue
Block a user