This changes the out parameter of find_frame_funname to be a
block_symbol. This helps a later patch.
---
gdb/python/py-frame.c | 4 +++-
gdb/python/py-unwind.c | 4 +++-
gdb/stack.c | 19 ++++++++++---------
gdb/stack.h | 2 +-
4 files changed, 17 insertions(+), 12 deletions(-)
@@ -316,6 +316,7 @@ frapy_block (PyObject *self, PyObject *args)
static PyObject *
frapy_function (PyObject *self, PyObject *args)
{
+ block_symbol bsym = {};
struct symbol *sym = NULL;
frame_info_ptr frame;
@@ -326,7 +327,8 @@ frapy_function (PyObject *self, PyObject *args)
FRAPY_REQUIRE_VALID (self, frame);
gdb::unique_xmalloc_ptr<char> funname
- = find_frame_funname (frame, &funlang, &sym);
+ = find_frame_funname (frame, &funlang, &bsym);
+ sym = bsym.symbol;
}
catch (const gdb_exception &except)
{
@@ -658,6 +658,7 @@ pending_framepy_function (PyObject *self, PyObject *args)
PENDING_FRAMEPY_REQUIRE_VALID (pending_frame);
struct symbol *sym = nullptr;
+ block_symbol bsym = {};
try
{
@@ -665,7 +666,8 @@ pending_framepy_function (PyObject *self, PyObject *args)
frame_info_ptr frame = pending_frame->frame_info;
gdb::unique_xmalloc_ptr<char> funname
- = find_frame_funname (frame, &funlang, &sym);
+ = find_frame_funname (frame, &funlang, &bsym);
+ sym = bsym.symbol;
}
catch (const gdb_exception &except)
{
@@ -1258,21 +1258,21 @@ get_last_displayed_sal ()
gdb::unique_xmalloc_ptr<char>
find_frame_funname (frame_info_ptr frame, enum language *funlang,
- struct symbol **funcp)
+ block_symbol *funcp)
{
- struct symbol *func;
+ block_symbol func;
gdb::unique_xmalloc_ptr<char> funname;
*funlang = language_unknown;
if (funcp)
- *funcp = NULL;
+ *funcp = {};
- func = get_frame_function (frame).symbol;
- if (func)
+ func = get_frame_function (frame);
+ if (func.symbol != nullptr)
{
- const char *print_name = func->print_name ();
+ const char *print_name = func.symbol->print_name ();
- *funlang = func->language ();
+ *funlang = func.symbol->language ();
if (funcp)
*funcp = func;
if (*funlang == language_cplus)
@@ -1319,14 +1319,15 @@ print_frame (const frame_print_options &fp_opts,
struct ui_out *uiout = current_uiout;
enum language funlang = language_unknown;
struct value_print_options opts;
- struct symbol *func;
CORE_ADDR pc = 0;
int pc_p;
pc_p = get_frame_pc_if_available (frame, &pc);
+ block_symbol bfunc;
gdb::unique_xmalloc_ptr<char> funname
- = find_frame_funname (frame, &funlang, &func);
+ = find_frame_funname (frame, &funlang, &bfunc);
+ struct symbol *func = bfunc.symbol;
annotate_frame_begin (print_level ? frame_relative_level (frame) : 0,
gdbarch, pc);
@@ -22,7 +22,7 @@
gdb::unique_xmalloc_ptr<char> find_frame_funname (frame_info_ptr frame,
enum language *funlang,
- struct symbol **funcp);
+ block_symbol *funcp);
typedef gdb::function_view<void (const char *print_name, struct symbol *sym)>
iterate_over_block_arg_local_vars_cb;