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 07/30] More use of block_symbol::address in tracepoint.c
Date: Sun, 29 Oct 2023 17:23:28 -0600	[thread overview]
Message-ID: <20231029-split-objfile-2023-bound-sym-october-v1-7-612531df2734@tromey.com> (raw)
In-Reply-To: <20231029-split-objfile-2023-bound-sym-october-v1-0-612531df2734@tromey.com>

This changes the remaining spots in tracepoint.c to use
block_symbol::address.
---
 gdb/expop.h      |  5 +++++
 gdb/tracepoint.c | 12 +++++++-----
 gdb/tracepoint.h |  2 +-
 3 files changed, 13 insertions(+), 6 deletions(-)

diff --git a/gdb/expop.h b/gdb/expop.h
index 25769d5b810..433c92c9a00 100644
--- a/gdb/expop.h
+++ b/gdb/expop.h
@@ -667,6 +667,11 @@ class var_value_operation
     return std::get<0> (m_storage).symbol;
   }
 
+  block_symbol get_block_symbol () const
+  {
+    return std::get<0> (m_storage);
+  }
+
 protected:
 
   void do_generate_ax (struct expression *exp,
diff --git a/gdb/tracepoint.c b/gdb/tracepoint.c
index 89611114c9b..6d017179283 100644
--- a/gdb/tracepoint.c
+++ b/gdb/tracepoint.c
@@ -905,7 +905,7 @@ collection_list::add_memrange (struct gdbarch *gdbarch,
 /* Add a symbol to a collection list.  */
 
 void
-collection_list::collect_symbol (struct symbol *sym,
+collection_list::collect_symbol (block_symbol bsym,
 				 struct gdbarch *gdbarch,
 				 long frame_regno, long frame_offset,
 				 CORE_ADDR scope,
@@ -916,6 +916,7 @@ collection_list::collect_symbol (struct symbol *sym,
   bfd_signed_vma offset;
   int treat_as_expr = 0;
 
+  symbol *sym = bsym.symbol;
   len = check_typedef (sym->type ())->length ();
   switch (sym->aclass ())
     {
@@ -928,7 +929,7 @@ collection_list::collect_symbol (struct symbol *sym,
 		  sym->print_name (), plongest (sym->value_longest ()));
       break;
     case LOC_STATIC:
-      offset = sym->value_address ();
+      offset = bsym.address ();
       if (info_verbose)
 	{
 	  gdb_printf ("LOC_STATIC %s: collect %ld bytes at %s.\n",
@@ -1049,7 +1050,8 @@ collection_list::add_local_symbols (struct gdbarch *gdbarch, CORE_ADDR pc,
   auto do_collect_symbol = [&] (const char *print_name,
 				struct symbol *sym)
     {
-      collect_symbol (sym, gdbarch, frame_regno,
+      block_symbol bsym { sym, block };
+      collect_symbol (bsym, gdbarch, frame_regno,
 		      frame_offset, pc, trace_string);
       count++;
       add_wholly_collected (print_name);
@@ -1392,8 +1394,8 @@ encode_actions_1 (struct command_line *action,
 			expr::var_value_operation *vvo
 			  = (gdb::checked_static_cast<expr::var_value_operation *>
 			     (exp->op.get ()));
-			struct symbol *sym = vvo->get_symbol ();
-			const char *name = sym->natural_name ();
+			block_symbol sym = vvo->get_block_symbol ();
+			const char *name = sym.symbol->natural_name ();
 
 			collect->collect_symbol (sym,
 						 arch,
diff --git a/gdb/tracepoint.h b/gdb/tracepoint.h
index b9ff31fa0f6..8c94f1d9fc2 100644
--- a/gdb/tracepoint.h
+++ b/gdb/tracepoint.h
@@ -270,7 +270,7 @@ class collection_list
   void add_memrange (struct gdbarch *gdbarch,
 		     int type, bfd_signed_vma base,
 		     unsigned long len, CORE_ADDR scope);
-  void collect_symbol (struct symbol *sym,
+  void collect_symbol (block_symbol sym,
 		       struct gdbarch *gdbarch,
 		       long frame_regno, long frame_offset,
 		       CORE_ADDR scope,

-- 
2.41.0


  parent reply	other threads:[~2023-10-29 23:23 UTC|newest]

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

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=20231029-split-objfile-2023-bound-sym-october-v1-7-612531df2734@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).