From: Tom Tromey <tromey@adacore.com>
To: gdb-patches@sourceware.org
Cc: Tom Tromey <tromey@adacore.com>
Subject: [PATCH 3/6] Remove context_stack::depth
Date: Fri, 17 Apr 2026 12:24:05 -0600 [thread overview]
Message-ID: <20260417-list-in-scope-v1-3-0deb050fc03d@adacore.com> (raw)
In-Reply-To: <20260417-list-in-scope-v1-0-0deb050fc03d@adacore.com>
context_stack::depth is never used, and I think it's not really
useful, so this removes it.
---
gdb/buildsym.c | 7 +++----
gdb/buildsym.h | 10 +++-------
gdb/dwarf2/read.c | 4 ++--
3 files changed, 8 insertions(+), 13 deletions(-)
diff --git a/gdb/buildsym.c b/gdb/buildsym.c
index f6cc5c153c2..6d719cb25a0 100644
--- a/gdb/buildsym.c
+++ b/gdb/buildsym.c
@@ -933,17 +933,16 @@ buildsym_compunit::augment_type_symtab ()
}
}
-/* Push a context block. Args are an identifying nesting level
- (checkable when you pop it), and the starting PC address of this
+/* Push a context block. VALU is the starting PC address of this
context. */
context_stack &
-buildsym_compunit::push_context (int desc, CORE_ADDR valu)
+buildsym_compunit::push_context (CORE_ADDR valu)
{
context_stack &ctx
= m_context_stack.emplace_back (std::move (m_local_symbols),
m_local_using_directives,
- m_pending_blocks, valu, desc);
+ m_pending_blocks, valu);
m_local_using_directives = nullptr;
diff --git a/gdb/buildsym.h b/gdb/buildsym.h
index 06d8d3c691f..70d22229f53 100644
--- a/gdb/buildsym.h
+++ b/gdb/buildsym.h
@@ -74,12 +74,11 @@ using subfile_up = std::unique_ptr<subfile>;
struct context_stack
{
context_stack (std::vector<symbol *> locals, using_direct *local_using_directives,
- pending_block *old_blocks, CORE_ADDR start_addr, int depth)
+ pending_block *old_blocks, CORE_ADDR start_addr)
: locals (std::move (locals)),
local_using_directives (local_using_directives),
old_blocks (old_blocks),
- start_addr (start_addr),
- depth (depth)
+ start_addr (start_addr)
{}
/* Outer locals at the time we entered. */
@@ -96,9 +95,6 @@ struct context_stack
/* PC where this context starts. */
CORE_ADDR start_addr;
-
- /* For error-checking matching push/pop. */
- int depth;
};
/* Flags associated with a linetable entry. */
@@ -245,7 +241,7 @@ struct buildsym_compunit
m_producer = producer;
}
- context_stack &push_context (int desc, CORE_ADDR valu);
+ context_stack &push_context (CORE_ADDR valu);
context_stack pop_context ();
diff --git a/gdb/dwarf2/read.c b/gdb/dwarf2/read.c
index ebf7eeb673b..e1d70ea650d 100644
--- a/gdb/dwarf2/read.c
+++ b/gdb/dwarf2/read.c
@@ -7801,7 +7801,7 @@ read_func_scope (struct die_info *die, struct dwarf2_cu *cu)
}
gdb_assert (cu->get_builder () != nullptr);
- context_stack &ctx = cu->get_builder ()->push_context (0, lowpc);
+ context_stack &ctx = cu->get_builder ()->push_context (lowpc);
ctx.name = new_symbol (die, read_type_die (die, cu), cu, templ_func);
if (dwarf2_func_is_main_p (die, cu))
@@ -7953,7 +7953,7 @@ read_lexical_block_scope (struct die_info *die, struct dwarf2_cu *cu)
lowpc = per_objfile->relocate (unrel_low);
highpc = per_objfile->relocate (unrel_high);
- cu->get_builder ()->push_context (0, lowpc);
+ cu->get_builder ()->push_context (lowpc);
for (die_info *child_die : die->children ())
process_die (child_die, cu);
--
2.53.0
next prev parent reply other threads:[~2026-04-17 18:24 UTC|newest]
Thread overview: 11+ messages / expand[flat|nested] mbox.gz Atom feed top
2026-04-17 18:24 [PATCH 0/6] Some buildsym cleanups Tom Tromey
2026-04-17 18:24 ` [PATCH 1/6] Use scoped_restore for dwarf2_cu::list_in_scope Tom Tromey
2026-04-17 18:24 ` [PATCH 2/6] Remove some dead code from buildsym.c Tom Tromey
2026-04-17 20:10 ` Simon Marchi
2026-04-17 18:24 ` Tom Tromey [this message]
2026-04-17 18:24 ` [PATCH 4/6] Change pop_context to return a block Tom Tromey
2026-04-17 20:11 ` Simon Marchi
2026-04-17 18:24 ` [PATCH 5/6] Return void from buildsym_compunit::push_context Tom Tromey
2026-04-17 20:22 ` Simon Marchi
2026-04-17 18:24 ` [PATCH 6/6] Rename context_stack and make it private Tom Tromey
2026-04-17 20:24 ` [PATCH 0/6] Some buildsym cleanups 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=20260417-list-in-scope-v1-3-0deb050fc03d@adacore.com \
--to=tromey@adacore.com \
--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