public inbox for gdb-cvs@sourceware.org
help / color / mirror / Atom feed
* [binutils-gdb] Convert block_static_link to method
@ 2023-02-19 23:38 Tom Tromey
0 siblings, 0 replies; only message in thread
From: Tom Tromey @ 2023-02-19 23:38 UTC (permalink / raw)
To: gdb-cvs
https://sourceware.org/git/gitweb.cgi?p=binutils-gdb.git;h=7bf30a4447713192eb49be43d7f66630d570652b
commit 7bf30a4447713192eb49be43d7f66630d570652b
Author: Tom Tromey <tom@tromey.com>
Date: Thu Jan 19 17:50:30 2023 -0700
Convert block_static_link to method
This converts block_static_link to be a method. This was mostly
written by script.
Diff:
---
gdb/block.c | 8 ++++----
gdb/block.h | 24 +++++++++++++-----------
gdb/findvar.c | 2 +-
3 files changed, 18 insertions(+), 16 deletions(-)
diff --git a/gdb/block.c b/gdb/block.c
index 3cd90dcb4ed..8aa0e676894 100644
--- a/gdb/block.c
+++ b/gdb/block.c
@@ -420,16 +420,16 @@ block::set_compunit_symtab (struct compunit_symtab *cu)
/* See block.h. */
struct dynamic_prop *
-block_static_link (const struct block *block)
+block::static_link () const
{
- struct objfile *objfile = block->objfile ();
+ struct objfile *objfile = this->objfile ();
/* Only objfile-owned blocks that materialize top function scopes can have
static links. */
- if (objfile == NULL || block->function () == NULL)
+ if (objfile == NULL || function () == NULL)
return NULL;
- return (struct dynamic_prop *) objfile_lookup_static_link (objfile, block);
+ return (struct dynamic_prop *) objfile_lookup_static_link (objfile, this);
}
/* Return the compunit of the global block. */
diff --git a/gdb/block.h b/gdb/block.h
index ce8c9679a07..9bc80490d7c 100644
--- a/gdb/block.h
+++ b/gdb/block.h
@@ -258,6 +258,19 @@ struct block
void set_compunit_symtab (struct compunit_symtab *);
+ /* Return a property to evaluate the static link associated to this
+ block.
+
+ In the context of nested functions (available in Pascal, Ada and
+ GNU C, for instance), a static link (as in DWARF's
+ DW_AT_static_link attribute) for a function is a way to get the
+ frame corresponding to the enclosing function.
+
+ Note that only objfile-owned and function-level blocks can have a
+ static link. Return NULL if there is no such property. */
+
+ struct dynamic_prop *static_link () const;
+
/* Addresses in the executable code that are in this block. */
CORE_ADDR m_start;
@@ -421,17 +434,6 @@ extern struct block *allocate_block (struct obstack *obstack);
extern struct block *allocate_global_block (struct obstack *obstack);
-/* Return a property to evaluate the static link associated to BLOCK.
-
- In the context of nested functions (available in Pascal, Ada and GNU C, for
- instance), a static link (as in DWARF's DW_AT_static_link attribute) for a
- function is a way to get the frame corresponding to the enclosing function.
-
- Note that only objfile-owned and function-level blocks can have a static
- link. Return NULL if there is no such property. */
-
-extern struct dynamic_prop *block_static_link (const struct block *block);
-
/* A block iterator. This structure should be treated as though it
were opaque; it is only defined here because we want to support
stack allocation of iterators. */
diff --git a/gdb/findvar.c b/gdb/findvar.c
index 806f41d0afa..60b5ca3faf3 100644
--- a/gdb/findvar.c
+++ b/gdb/findvar.c
@@ -498,7 +498,7 @@ get_hosting_frame (struct symbol *var, const struct block *var_block,
else if (frame_block->function ())
{
const struct dynamic_prop *static_link
- = block_static_link (frame_block);
+ = frame_block->static_link ();
int could_climb_up = 0;
if (static_link != NULL)
^ permalink raw reply [flat|nested] only message in thread
only message in thread, other threads:[~2023-02-19 23:38 UTC | newest]
Thread overview: (only message) (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2023-02-19 23:38 [binutils-gdb] Convert block_static_link to method Tom Tromey
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for read-only IMAP folder(s) and NNTP newsgroup(s).