[PATCH 6/7] [gdb] Handle ^C in ~scoped_remote_fd

Tom de Vries tdevries@suse.de
Tue Sep 24 13:19:26 GMT 2024


On 9/23/24 19:53, Tom Tromey wrote:
>>>>>> "Tom" == Tom de Vries <tdevries@suse.de> writes:
> 
> Tom> This also swallows gdb_exception_quit and gdb_exception_forced_quit.  I don't
> Tom> know whether these can actually happen here, but if not it's better to
> Tom> accommodate for the possibility anyway.
> 
> Yeah, it's generally hard to know without digging pretty depp.
> 
> Tom> Fix this by handling gdb_exception explicitly, and setting the quit flag if
> Tom> necessary.
> 
> Tom> It could be that "catch (...)" should be replaced by
> Tom> "catch (const gdb_exception &)" but that depends on what kind of exception
> Tom> remote_hostio_close is expected to throw, and I don't know that, so I'm
> Tom> leaving it as is.
> 
> I think this is an improvement but while reading it I was left wondering
> if it does the right thing for a forced quit.
> 

Good point.  I grepped for set_forced_quit_flag and found 
~scoped_switch_fork_info, which has an identical problem, so I've 
updated the patch by just copying the solution from there:
...
         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 ();
           }
...

> Approved-By: Tom Tromey <tom@tromey.com>

Thank for the review, pushed with that change.

Thanks,
- Tom



More information about the Gdb-patches mailing list