[PATCHv5,2/4] gdb: make symbols const in struct inline_state

Message ID a8b96e4e8db7f7c2ae9180f04a3bfe96e9aa697d.1724164804.git.aburgess@redhat.com
State New
Headers
Series New inline-frames and blocks maintenance commands |

Checks

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

Commit Message

Andrew Burgess Aug. 20, 2024, 2:43 p.m. UTC
  Make the inline_state::skipped_symbols a vector of 'const symbol *',
adding the const qualifier.

There's only a couple of places this leaks into the rest of GDB and in
both places its fine for the symbol to become const.

There should be no functional change after this commit.

Approved-By: Simon Marchi <simon.marchi@efficios.com>
---
 gdb/frame.c        | 2 +-
 gdb/infcmd.c       | 2 +-
 gdb/inline-frame.c | 8 ++++----
 gdb/inline-frame.h | 2 +-
 4 files changed, 7 insertions(+), 7 deletions(-)
  

Patch

diff --git a/gdb/frame.c b/gdb/frame.c
index 4d092d0e8c8..a6900b28072 100644
--- a/gdb/frame.c
+++ b/gdb/frame.c
@@ -2859,7 +2859,7 @@  find_frame_sal (const frame_info_ptr &frame)
 
   if (frame_inlined_callees (frame) > 0)
     {
-      struct symbol *sym;
+      const symbol *sym;
 
       /* If the current frame has some inlined callees, and we have a next
 	 frame, then that frame must be an inlined frame.  In this case
diff --git a/gdb/infcmd.c b/gdb/infcmd.c
index 347684a0be1..90fa4f6c969 100644
--- a/gdb/infcmd.c
+++ b/gdb/infcmd.c
@@ -992,7 +992,7 @@  prepare_one_step (thread_info *tp, struct step_command_fsm *sm)
 	     Use inlined_subroutine info to make the range more narrow.  */
 	  if (inline_skipped_frames (tp) > 0)
 	    {
-	      symbol *sym = inline_skipped_symbol (tp);
+	      const symbol *sym = inline_skipped_symbol (tp);
 	      if (sym->aclass () == LOC_BLOCK)
 		{
 		  const block *block = sym->value_block ();
diff --git a/gdb/inline-frame.c b/gdb/inline-frame.c
index f65f39be40d..56b295520f9 100644
--- a/gdb/inline-frame.c
+++ b/gdb/inline-frame.c
@@ -36,7 +36,7 @@ 
 struct inline_state
 {
   inline_state (thread_info *thread_, int skipped_frames_, CORE_ADDR saved_pc_,
-		std::vector<symbol *> &&skipped_symbols_)
+		std::vector<const symbol *> &&skipped_symbols_)
     : thread (thread_), skipped_frames (skipped_frames_), saved_pc (saved_pc_),
       skipped_symbols (std::move (skipped_symbols_))
   {}
@@ -58,7 +58,7 @@  struct inline_state
   /* Only valid if SKIPPED_FRAMES is non-zero.  This is the list of all
      function symbols that have been skipped, from inner most to outer
      most.  It is used to find the call site of the current frame.  */
-  std::vector<struct symbol *> skipped_symbols;
+  std::vector<const symbol *> skipped_symbols;
 };
 
 static std::vector<inline_state> inline_states;
@@ -342,7 +342,7 @@  void
 skip_inline_frames (thread_info *thread, bpstat *stop_chain)
 {
   const struct block *frame_block, *cur_block;
-  std::vector<struct symbol *> skipped_syms;
+  std::vector<const symbol *> skipped_syms;
   int skip_count = 0;
 
   /* This function is called right after reinitializing the frame
@@ -419,7 +419,7 @@  inline_skipped_frames (thread_info *thread)
 /* If one or more inlined functions are hidden, return the symbol for
    the function inlined into the current frame.  */
 
-struct symbol *
+const symbol *
 inline_skipped_symbol (thread_info *thread)
 {
   inline_state *state = find_inline_frame_state (thread);
diff --git a/gdb/inline-frame.h b/gdb/inline-frame.h
index bbe617c7c5b..3ddc9cf2335 100644
--- a/gdb/inline-frame.h
+++ b/gdb/inline-frame.h
@@ -62,7 +62,7 @@  int inline_skipped_frames (thread_info *thread);
 /* If one or more inlined functions are hidden, return the symbol for
    the function inlined into the current frame.  */
 
-struct symbol *inline_skipped_symbol (thread_info *thread);
+const symbol *inline_skipped_symbol (thread_info *thread);
 
 /* Return the number of functions inlined into THIS_FRAME.  Some of
    the callees may not have associated frames (see