Mirror of the gdb-patches mailing list
 help / color / mirror / Atom feed
From: simon.marchi@polymtl.ca
To: gdb-patches@sourceware.org
Cc: Simon Marchi <simon.marchi@polymtl.ca>
Subject: [PATCH] gdb: remove context_stack::static_link
Date: Mon,  5 Jan 2026 15:38:18 -0500	[thread overview]
Message-ID: <20260105203822.699896-1-simon.marchi@polymtl.ca> (raw)

From: Simon Marchi <simon.marchi@polymtl.ca>

I don't think it's needed to record this information in the
context_stack structure.  The only user is the DWARF reader, where it
can very well be a local variable.

Change-Id: I6e33affbf03f11c0d0ab60067f169137fde1c994
---
 gdb/buildsym.h    |  4 ----
 gdb/dwarf2/read.c | 11 +++++------
 2 files changed, 5 insertions(+), 10 deletions(-)

diff --git a/gdb/buildsym.h b/gdb/buildsym.h
index ff1c2a075fcc..7ca5e57c7f4a 100644
--- a/gdb/buildsym.h
+++ b/gdb/buildsym.h
@@ -94,10 +94,6 @@ struct context_stack
   /* Name of function, if any, defining context.  */
   symbol *name = nullptr;
 
-  /* Expression that computes the frame base of the lexically enclosing
-     function, if any.  NULL otherwise.  */
-  dynamic_prop *static_link = nullptr;
-
   /* PC where this context starts.  */
   CORE_ADDR start_addr;
 
diff --git a/gdb/dwarf2/read.c b/gdb/dwarf2/read.c
index 4b706f654e0d..8c3bc156fc2f 100644
--- a/gdb/dwarf2/read.c
+++ b/gdb/dwarf2/read.c
@@ -8600,14 +8600,12 @@ read_func_scope (struct die_info *die, struct dwarf2_cu *cu)
     dwarf2_symbol_mark_computed (attr, ctx.name, cu, 1);
 
   /* If there is a location for the static link, record it.  */
-  ctx.static_link = NULL;
+  dynamic_prop *static_link = nullptr;
   attr = dwarf2_attr (die, DW_AT_static_link, cu);
   if (attr != nullptr)
     {
-      ctx.static_link
-	= XOBNEW (&objfile->objfile_obstack, struct dynamic_prop);
-      attr_to_dynamic_prop (attr, die, cu, ctx.static_link,
-			    cu->addr_type ());
+      static_link = XOBNEW (&objfile->objfile_obstack, struct dynamic_prop);
+      attr_to_dynamic_prop (attr, die, cu, static_link, cu->addr_type ());
     }
 
   cu->list_in_scope = &cu->get_builder ()->get_local_symbols ();
@@ -8650,9 +8648,10 @@ read_func_scope (struct die_info *die, struct dwarf2_cu *cu)
     }
 
   struct context_stack cstk = cu->get_builder ()->pop_context ();
+
   /* Make a block for the local symbols within.  */
   block = cu->get_builder ()->finish_block (cstk.name, cstk.old_blocks,
-				     cstk.static_link, lowpc, highpc);
+					    static_link, lowpc, highpc);
 
   /* For C++, set the block's scope.  */
   if ((cu->lang () == language_cplus

base-commit: 1819e42280cc89754db92a3416392b82794989a2
-- 
2.52.0


             reply	other threads:[~2026-01-05 20:38 UTC|newest]

Thread overview: 3+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2026-01-05 20:38 simon.marchi [this message]
2026-01-06 15:26 ` Tom Tromey
2026-01-06 16:48   ` Simon Marchi

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=20260105203822.699896-1-simon.marchi@polymtl.ca \
    --to=simon.marchi@polymtl.ca \
    --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