public inbox for gdb-patches@sourceware.org
 help / color / mirror / Atom feed
From: Tom Tromey <tom@tromey.com>
To: gdb-patches@sourceware.org
Subject: [PATCH v2 16/31] Use read_var_value overload in finish_command_fsm
Date: Sun, 05 Nov 2023 11:11:54 -0700	[thread overview]
Message-ID: <20231105-split-objfile-2023-bound-sym-october-v2-16-dbd2d158bbc3@tromey.com> (raw)
In-Reply-To: <20231105-split-objfile-2023-bound-sym-october-v2-0-dbd2d158bbc3@tromey.com>

This changes finish_command_fsm to store a block_symbol, so that the
new read_var_value overload can be used.
---
 gdb/infcmd.c | 23 ++++++++++++-----------
 1 file changed, 12 insertions(+), 11 deletions(-)

diff --git a/gdb/infcmd.c b/gdb/infcmd.c
index c50d9bcd47d..03e54438686 100644
--- a/gdb/infcmd.c
+++ b/gdb/infcmd.c
@@ -1596,7 +1596,7 @@ struct finish_command_fsm : public thread_fsm
   breakpoint_up breakpoint;
 
   /* The function that we're stepping out of.  */
-  struct symbol *function = nullptr;
+  block_symbol function {};
 
   /* If the FSM finishes successfully, this stores the function's
      return value.  */
@@ -1629,14 +1629,14 @@ finish_command_fsm::should_stop (struct thread_info *tp)
 {
   struct return_value_info *rv = &return_value_info;
 
-  if (function != nullptr
+  if (function.symbol != nullptr
       && bpstat_find_breakpoint (tp->control.stop_bpstat,
 				 breakpoint.get ()) != nullptr)
     {
       /* We're done.  */
       set_finished ();
 
-      rv->type = function->type ()->target_type ();
+      rv->type = function.symbol->type ()->target_type ();
       if (rv->type == nullptr)
 	internal_error (_("finish_command: function has no target type"));
 
@@ -1644,13 +1644,13 @@ finish_command_fsm::should_stop (struct thread_info *tp)
 	{
 	  struct value *func;
 
-	  func = read_var_value (function, nullptr, get_current_frame ());
+	  func = read_var_value (function, get_current_frame ());
 
 	  if (return_buf != 0)
 	    /* Retrieve return value from the buffer where it was saved.  */
 	      rv->value = value_at (rv->type, return_buf);
 	  else
-	      rv->value = get_return_value (function, func);
+	      rv->value = get_return_value (function.symbol, func);
 
 	  if (rv->value != nullptr)
 	    rv->value_history_index = rv->value->record_latest ();
@@ -1883,22 +1883,22 @@ finish_command (const char *arg, int from_tty)
 
   /* Find the function we will return from.  */
   frame_info_ptr callee_frame = get_selected_frame (nullptr);
-  sm->function = find_pc_function (get_frame_pc (callee_frame)).symbol;
+  sm->function = find_pc_function (get_frame_pc (callee_frame));
   sm->return_buf = 0;    /* Initialize buffer address is not available.  */
 
   /* Determine the return convention.  If it is RETURN_VALUE_STRUCT_CONVENTION,
      attempt to determine the address of the return buffer.  */
-  if (sm->function != nullptr)
+  if (sm->function.symbol != nullptr)
     {
       enum return_value_convention return_value;
       struct gdbarch *gdbarch = get_frame_arch (callee_frame);
 
       struct type * val_type
-	= check_typedef (sm->function->type ()->target_type ());
+	= check_typedef (sm->function.symbol->type ()->target_type ());
 
       return_value
 	= gdbarch_return_value_as_value (gdbarch,
-					 read_var_value (sm->function, nullptr,
+					 read_var_value (sm->function,
 							 callee_frame),
 					 val_type, nullptr, nullptr, nullptr);
 
@@ -1916,10 +1916,11 @@ finish_command (const char *arg, int from_tty)
 	gdb_printf (_("Run back to call of "));
       else
 	{
-	  if (sm->function != nullptr && TYPE_NO_RETURN (sm->function->type ())
+	  if (sm->function.symbol != nullptr
+	      && TYPE_NO_RETURN (sm->function.symbol->type ())
 	      && !query (_("warning: Function %s does not return normally.\n"
 			   "Try to finish anyway? "),
-			 sm->function->print_name ()))
+			 sm->function.symbol->print_name ()))
 	    error (_("Not confirmed."));
 	  gdb_printf (_("Run till exit from "));
 	}

-- 
2.41.0


  parent reply	other threads:[~2023-11-05 18:11 UTC|newest]

Thread overview: 35+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2023-11-05 18:11 [PATCH v2 00/31] Baby step for objfile splitting Tom Tromey
2023-11-05 18:11 ` [PATCH v2 01/31] Introduce block-symbol.h Tom Tromey
2023-11-05 18:11 ` [PATCH v2 02/31] Add block_symbol::address Tom Tromey
2023-11-05 18:11 ` [PATCH v2 03/31] Add bound_symbol Tom Tromey
2023-11-05 18:11 ` [PATCH v2 04/31] Easy conversions to use block_symbol::address Tom Tromey
2023-11-05 18:11 ` [PATCH v2 05/31] Use block_symbol::address in ada-tasks.c Tom Tromey
2023-11-05 18:11 ` [PATCH v2 06/31] Use block_symbol::address in printcmd.c Tom Tromey
2023-11-05 18:11 ` [PATCH v2 07/31] Use bound_symbol::address in tracepoint.c Tom Tromey
2023-11-05 18:11 ` [PATCH v2 08/31] Use block_symbol::address " Tom Tromey
2023-11-05 18:11 ` [PATCH v2 09/31] Use block_symbol::address in ax-gdb.c Tom Tromey
2023-11-05 18:11 ` [PATCH v2 10/31] Use block_symbol::address in linespec.c Tom Tromey
2023-11-05 18:11 ` [PATCH v2 11/31] Use block_symbol::address in ada-lang.c Tom Tromey
2023-11-05 18:11 ` [PATCH v2 12/31] Use bound_symbol::address in symmisc.c Tom Tromey
2023-11-05 18:11 ` [PATCH v2 13/31] Introduce read_var_value overload Tom Tromey
2023-11-05 18:11 ` [PATCH v2 14/31] Use read_var_value in gdb/compile Tom Tromey
2023-11-05 18:11 ` [PATCH v2 15/31] Return a block_symbol from find_pc_sect_function Tom Tromey
2023-11-05 18:11 ` Tom Tromey [this message]
2023-11-05 18:11 ` [PATCH v2 17/31] Use block_symbol in overload-handling code Tom Tromey
2023-11-05 18:11 ` [PATCH v2 18/31] Change evaluate_var_value to accept a block_symbol Tom Tromey
2023-11-05 18:11 ` [PATCH v2 19/31] Change value_of_variable to take " Tom Tromey
2023-11-05 18:11 ` [PATCH v2 20/31] Return a block_symbol from get_frame_function Tom Tromey
2023-11-05 18:11 ` [PATCH v2 21/31] Use read_var_value overload in return_command Tom Tromey
2023-11-05 18:12 ` [PATCH v2 22/31] Use read_var_value overload in py-finishbreakpoint.c Tom Tromey
2023-11-05 18:12 ` [PATCH v2 23/31] Use read_var_value overload in py-framefilter.c Tom Tromey
2023-11-05 18:12 ` [PATCH v2 24/31] Use read_var_value overload in Guile Tom Tromey
2023-11-05 18:12 ` [PATCH v2 25/31] Use read_var_value in read_frame_arg and read_frame_local Tom Tromey
2023-11-05 18:12 ` [PATCH v2 26/31] Change print_variable_and_value to take a block_symbol Tom Tromey
2023-11-05 18:12 ` [PATCH v2 27/31] Change find_frame_funname to return " Tom Tromey
2023-11-05 18:12 ` [PATCH v2 28/31] Change btrace_function::sym to " Tom Tromey
2023-11-05 18:12 ` [PATCH v2 29/31] Use read_var_value overload in Python Tom Tromey
2023-11-05 18:12 ` [PATCH v2 30/31] Remove the old read_var_value Tom Tromey
2023-11-05 18:12 ` [PATCH v2 31/31] Change language_defn::read_var_value to accept block_symbol Tom Tromey
2023-11-06 15:16 ` [PATCH v2 00/31] Baby step for objfile splitting Andrew Burgess
2023-11-07  3:36   ` Tom Tromey
2023-11-07 11:06     ` Andrew Burgess

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=20231105-split-objfile-2023-bound-sym-october-v2-16-dbd2d158bbc3@tromey.com \
    --to=tom@tromey.com \
    --cc=gdb-patches@sourceware.org \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for read-only IMAP folder(s) and NNTP newsgroup(s).