From: Tom Tromey <tom@tromey.com>
To: gdb-patches@sourceware.org
Subject: [PATCH v2 20/31] Return a block_symbol from get_frame_function
Date: Sun, 05 Nov 2023 11:11:58 -0700 [thread overview]
Message-ID: <20231105-split-objfile-2023-bound-sym-october-v2-20-dbd2d158bbc3@tromey.com> (raw)
In-Reply-To: <20231105-split-objfile-2023-bound-sym-october-v2-0-dbd2d158bbc3@tromey.com>
This changes get_frame_function to return a block_symbol, allowing
updates in other places. Like some earlier patches, this change is
the direction the code should go anyway -- the return value will
eventually carry an objfile along with it.
---
gdb/blockframe.c | 6 +++---
gdb/breakpoint.c | 2 +-
gdb/findvar.c | 2 +-
gdb/frame.c | 2 +-
gdb/frame.h | 3 ++-
gdb/infcmd.c | 4 ++--
gdb/infrun.c | 4 ++--
gdb/inline-frame.c | 2 +-
gdb/skip.c | 2 +-
gdb/stack.c | 8 ++++----
10 files changed, 18 insertions(+), 17 deletions(-)
diff --git a/gdb/blockframe.c b/gdb/blockframe.c
index 981094803ed..3977ecd6229 100644
--- a/gdb/blockframe.c
+++ b/gdb/blockframe.c
@@ -114,18 +114,18 @@ get_pc_function_start (CORE_ADDR pc)
/* Return the symbol for the function executing in frame FRAME. */
-struct symbol *
+block_symbol
get_frame_function (frame_info_ptr frame)
{
const struct block *bl = get_frame_block (frame, 0);
if (bl == NULL)
- return NULL;
+ return {};
while (bl->function () == NULL && bl->superblock () != NULL)
bl = bl->superblock ();
- return bl->function ();
+ return { bl->function (), bl };
}
\f
diff --git a/gdb/breakpoint.c b/gdb/breakpoint.c
index 52ce63afade..e9dd942da4e 100644
--- a/gdb/breakpoint.c
+++ b/gdb/breakpoint.c
@@ -5287,7 +5287,7 @@ watchpoint_check (bpstat *bs)
{
struct symbol *function;
- function = get_frame_function (fr);
+ function = get_frame_function (fr).symbol;
if (function == NULL
|| !function->value_block ()->contains (b->exp_valid_block))
within_current_scope = false;
diff --git a/gdb/findvar.c b/gdb/findvar.c
index 909dca65532..f3be783ec24 100644
--- a/gdb/findvar.c
+++ b/gdb/findvar.c
@@ -408,7 +408,7 @@ follow_static_link (frame_info_ptr frame,
in. */
for (; frame != NULL; frame = get_prev_frame (frame))
{
- struct symbol *framefunc = get_frame_function (frame);
+ struct symbol *framefunc = get_frame_function (frame).symbol;
/* Stacks can be quite deep: give the user a chance to stop this. */
QUIT;
diff --git a/gdb/frame.c b/gdb/frame.c
index 7077016ccba..315b94e4447 100644
--- a/gdb/frame.c
+++ b/gdb/frame.c
@@ -2833,7 +2833,7 @@ find_frame_sal (frame_info_ptr frame)
function, which can not be inferred from get_frame_pc. */
next_frame = get_next_frame (frame);
if (next_frame)
- sym = get_frame_function (next_frame);
+ sym = get_frame_function (next_frame).symbol;
else
sym = inline_skipped_symbol (inferior_thread ());
diff --git a/gdb/frame.h b/gdb/frame.h
index 1d7422cac32..0f1640c4a68 100644
--- a/gdb/frame.h
+++ b/gdb/frame.h
@@ -69,6 +69,7 @@
*/
+#include "block-symbol.h"
#include "cli/cli-option.h"
#include "frame-id.h"
#include "gdbsupport/common-debug.h"
@@ -856,7 +857,7 @@ extern const struct block *get_frame_block (frame_info_ptr,
extern const struct block *get_selected_block (CORE_ADDR *addr_in_block);
-extern struct symbol *get_frame_function (frame_info_ptr);
+extern block_symbol get_frame_function (frame_info_ptr);
extern CORE_ADDR get_pc_function_start (CORE_ADDR);
diff --git a/gdb/infcmd.c b/gdb/infcmd.c
index 03e54438686..2e9d913c41c 100644
--- a/gdb/infcmd.c
+++ b/gdb/infcmd.c
@@ -957,7 +957,7 @@ prepare_one_step (thread_info *tp, struct step_command_fsm *sm)
frame = get_current_frame ();
sal = find_frame_sal (frame);
- sym = get_frame_function (frame);
+ sym = get_frame_function (frame).symbol;
if (sym != nullptr)
fn = sym->print_name ();
@@ -1085,7 +1085,7 @@ jump_command (const char *arg, int from_tty)
resolve_sal_pc (&sal); /* May error out. */
/* See if we are trying to jump to another function. */
- fn = get_frame_function (get_current_frame ());
+ fn = get_frame_function (get_current_frame ()).symbol;
sfn = find_pc_sect_containing_function (sal.pc,
find_pc_mapped_section (sal.pc));
if (fn != nullptr && sfn != fn)
diff --git a/gdb/infrun.c b/gdb/infrun.c
index 2a004690e67..3c85cb5f481 100644
--- a/gdb/infrun.c
+++ b/gdb/infrun.c
@@ -4846,7 +4846,7 @@ inline_frame_is_marked_for_skip (bool prev_frame, struct thread_info *tp)
break;
sal = find_frame_sal (frame);
- sym = get_frame_function (frame);
+ sym = get_frame_function (frame).symbol;
if (sym != nullptr)
fn = sym->print_name ();
@@ -8390,7 +8390,7 @@ check_exception_resume (struct execution_control_state *ecs,
return;
}
- func = get_frame_function (frame);
+ func = get_frame_function (frame).symbol;
if (!func)
return;
diff --git a/gdb/inline-frame.c b/gdb/inline-frame.c
index 80765d5cca5..48ada3597bf 100644
--- a/gdb/inline-frame.c
+++ b/gdb/inline-frame.c
@@ -179,7 +179,7 @@ inline_frame_this_id (frame_info_ptr this_frame,
which generates DW_AT_entry_pc for inlined functions when
possible. If this attribute is available, we should use it
in the frame ID (and eventually, to set breakpoints). */
- func = get_frame_function (this_frame);
+ func = get_frame_function (this_frame).symbol;
gdb_assert (func != NULL);
(*this_id).code_addr = func->value_block ()->entry_pc ();
(*this_id).artificial_depth++;
diff --git a/gdb/skip.c b/gdb/skip.c
index 28902a6d326..a11a35314e3 100644
--- a/gdb/skip.c
+++ b/gdb/skip.c
@@ -205,7 +205,7 @@ skip_function_command (const char *arg, int from_tty)
if (arg == NULL)
{
frame_info_ptr fi = get_selected_frame (_("No default function now."));
- struct symbol *sym = get_frame_function (fi);
+ struct symbol *sym = get_frame_function (fi).symbol;
const char *name = NULL;
if (sym != NULL)
diff --git a/gdb/stack.c b/gdb/stack.c
index 39dcefa87b8..a2ea7301394 100644
--- a/gdb/stack.c
+++ b/gdb/stack.c
@@ -1266,7 +1266,7 @@ find_frame_funname (frame_info_ptr frame, enum language *funlang,
if (funcp)
*funcp = NULL;
- func = get_frame_function (frame);
+ func = get_frame_function (frame).symbol;
if (func)
{
const char *print_name = func->print_name ();
@@ -1498,7 +1498,7 @@ info_frame_command_core (frame_info_ptr fi, bool selected_frame_p)
pc_regname = "pc";
frame_pc_p = get_frame_pc_if_available (fi, &frame_pc);
- func = get_frame_function (fi);
+ func = get_frame_function (fi).symbol;
symtab_and_line sal = find_frame_sal (fi);
s = sal.symtab;
gdb::unique_xmalloc_ptr<char> func_only;
@@ -2510,7 +2510,7 @@ print_frame_arg_vars (frame_info_ptr frame,
return;
}
- func = get_frame_function (frame);
+ func = get_frame_function (frame).symbol;
if (func == NULL)
{
if (!quiet)
@@ -2692,7 +2692,7 @@ return_command (const char *retval_exp, int from_tty)
std::string query_prefix;
thisframe = get_selected_frame ("No selected frame.");
- thisfun = get_frame_function (thisframe);
+ thisfun = get_frame_function (thisframe).symbol;
gdbarch = get_frame_arch (thisframe);
if (get_frame_type (get_current_frame ()) == INLINE_FRAME)
--
2.41.0
next prev 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 ` [PATCH v2 16/31] Use read_var_value overload in finish_command_fsm Tom Tromey
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 ` Tom Tromey [this message]
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-20-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).