gdb: make use of RAII in run_inferior_call
authorAndrew Burgess <aburgess@redhat.com>
Sat, 14 May 2022 09:35:54 +0000 (10:35 +0100)
committerAndrew Burgess <aburgess@redhat.com>
Fri, 24 Jun 2022 11:04:40 +0000 (12:04 +0100)
commita32c1a92d5d5a8ed32cb30b161daedb1aca72cb4
treeac72642aa88d105b9a313df9d8bfe0d91f9fb6bb
parent39b8a8090ed7e8967ceca3655aa5f3a2ae91219d
gdb: make use of RAII in run_inferior_call

In passing I noticed that there are three local variables in
run_inferior_call that are used to save, and then restore some state,
I think these could all be replaced with a RAII style scoped_restore
instead.

Of the three locals that I've changed, the only one that I believe is
now restored in a different location is ui::async, before this commit
the async field was restored after a call to either delete_file_handle
or ui_register_input_event_handler, and after this commit, the field
is restored before these calls.  However, I don't believe that either
of these functions depend on the value of the async field, so I
believe the commit is fine.

Tested on x86-64/Linux passes with no regressions.
gdb/infcall.c