[26/30] Change find_frame_funname to return a block_symbol

Message ID 20231029-split-objfile-2023-bound-sym-october-v1-26-612531df2734@tromey.com
State New
Headers
Series Baby step for objfile splitting |

Checks

Context Check Description
linaro-tcwg-bot/tcwg_gdb_build--master-aarch64 success Testing passed
linaro-tcwg-bot/tcwg_gdb_build--master-arm success Testing passed
linaro-tcwg-bot/tcwg_gdb_check--master-arm success Testing passed
linaro-tcwg-bot/tcwg_gdb_check--master-aarch64 success Testing passed

Commit Message

Tom Tromey Oct. 29, 2023, 11:23 p.m. UTC
  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(-)
  

Patch

diff --git a/gdb/python/py-frame.c b/gdb/python/py-frame.c
index 1a55e514e39..555354df920 100644
--- a/gdb/python/py-frame.c
+++ b/gdb/python/py-frame.c
@@ -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)
     {
diff --git a/gdb/python/py-unwind.c b/gdb/python/py-unwind.c
index ee50c51b531..97035c5a140 100644
--- a/gdb/python/py-unwind.c
+++ b/gdb/python/py-unwind.c
@@ -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)
     {
diff --git a/gdb/stack.c b/gdb/stack.c
index 6916df77929..8b76a1d524d 100644
--- a/gdb/stack.c
+++ b/gdb/stack.c
@@ -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);
diff --git a/gdb/stack.h b/gdb/stack.h
index 1b0c2b342a4..616eb9a93d4 100644
--- a/gdb/stack.h
+++ b/gdb/stack.h
@@ -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;