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(-)
@@ -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 };
}
@@ -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;
@@ -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;
@@ -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 ());
@@ -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);
@@ -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)
@@ -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;
@@ -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++;
@@ -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)
@@ -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;
@@ -2514,7 +2514,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)
@@ -2699,7 +2699,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)