[1/3] Change thread_fsm::return_value to thread_fsm::print_return_values
Commit Message
A later patch implements print_return_values also for step_command_fsm,
to print the return values of all stepped-over functions.
This keeps all of the return value printing code in infrun.c, so
print_return_value could be made static.
---
gdb/infcmd.c | 12 ++++++------
gdb/infrun.c | 11 ++---------
gdb/infrun.h | 7 -------
gdb/thread-fsm.h | 6 ++----
4 files changed, 10 insertions(+), 26 deletions(-)
@@ -1575,7 +1575,7 @@ print_return_value_1 (struct ui_out *uiout, struct return_value_info *rv)
RV points at an object representing the captured return value/type
and its position in the value history. */
-void
+static void
print_return_value (struct ui_out *uiout, struct return_value_info *rv)
{
if (rv->type == nullptr
@@ -1623,7 +1623,7 @@ struct finish_command_fsm : public thread_fsm
bool should_stop (struct thread_info *thread) override;
void clean_up (struct thread_info *thread) override;
- struct return_value_info *return_value () override;
+ void print_return_values (struct ui_out *uiout) override;
enum async_reply_reason do_async_reply_reason () override;
};
@@ -1684,13 +1684,13 @@ finish_command_fsm::clean_up (struct thread_info *thread)
delete_longjmp_breakpoint (thread->global_num);
}
-/* Implementation of the 'return_value' FSM method for the finish
+/* Implementation of the 'print_return_values' FSM method for the finish
commands. */
-struct return_value_info *
-finish_command_fsm::return_value ()
+void
+finish_command_fsm::print_return_values (struct ui_out *uiout)
{
- return &return_value_info;
+ print_return_value (uiout, &return_value_info);
}
/* Implementation of the 'async_reply_reason' FSM method for the
@@ -8490,15 +8490,8 @@ print_stop_event (struct ui_out *uiout, bool displays)
}
tp = inferior_thread ();
- if (tp->thread_fsm () != nullptr
- && tp->thread_fsm ()->finished_p ())
- {
- struct return_value_info *rv;
-
- rv = tp->thread_fsm ()->return_value ();
- if (rv != nullptr)
- print_return_value (uiout, rv);
- }
+ if (tp->thread_fsm () != nullptr)
+ tp->thread_fsm ()->print_return_values (uiout);
}
/* See infrun.h. */
@@ -225,13 +225,6 @@ extern void print_exited_reason (struct ui_out *uiout, int exitstatus);
inferior has stopped. */
extern void print_no_history_reason (struct ui_out *uiout);
-/* Print the result of a function at the end of a 'finish' command.
- RV points at an object representing the captured return value/type
- and its position in the value history. */
-
-extern void print_return_value (struct ui_out *uiout,
- struct return_value_info *rv);
-
/* Print current location without a level number, if we have changed
functions or hit a breakpoint. Print source line if we have one.
If the execution command captured a return value, print it. If
@@ -58,11 +58,9 @@ struct thread_fsm
function's return value here. */
virtual bool should_stop (struct thread_info *thread) = 0;
- /* If this FSM saved a function's return value, you can use this
- method to retrieve it. Otherwise, this returns NULL. */
- virtual struct return_value_info *return_value ()
+ /* Print return values saved by this FSM. */
+ virtual void print_return_values (struct ui_out *uiout)
{
- return nullptr;
}
enum async_reply_reason async_reply_reason ()