public inbox for gdb-cvs@sourceware.org
help / color / mirror / Atom feed
* [binutils-gdb] Convert block_gdbarch to method
@ 2023-02-19 23:37 Tom Tromey
0 siblings, 0 replies; only message in thread
From: Tom Tromey @ 2023-02-19 23:37 UTC (permalink / raw)
To: gdb-cvs
https://sourceware.org/git/gitweb.cgi?p=binutils-gdb.git;h=7f5937df01cc829544baa921bfb81bfe0ccdc892
commit 7f5937df01cc829544baa921bfb81bfe0ccdc892
Author: Tom Tromey <tom@tromey.com>
Date: Mon Jan 16 17:24:16 2023 -0700
Convert block_gdbarch to method
This converts block_gdbarch to be a method. This was mostly written
by script.
Diff:
---
gdb/ada-lang.c | 2 +-
gdb/block.c | 8 ++++----
gdb/block.h | 8 ++++----
gdb/cp-namespace.c | 2 +-
gdb/d-namespace.c | 2 +-
gdb/symtab.c | 2 +-
6 files changed, 12 insertions(+), 12 deletions(-)
diff --git a/gdb/ada-lang.c b/gdb/ada-lang.c
index 0198598982c..a1de8c43bf2 100644
--- a/gdb/ada-lang.c
+++ b/gdb/ada-lang.c
@@ -13822,7 +13822,7 @@ public:
if (block == NULL)
gdbarch = target_gdbarch ();
else
- gdbarch = block_gdbarch (block);
+ gdbarch = block->gdbarch ();
sym.symbol
= language_lookup_primitive_type_as_symbol (this, gdbarch, name);
if (sym.symbol != NULL)
diff --git a/gdb/block.c b/gdb/block.c
index d7d5f0bf19e..b9c48e79d46 100644
--- a/gdb/block.c
+++ b/gdb/block.c
@@ -54,12 +54,12 @@ block::objfile () const
/* See block. */
struct gdbarch *
-block_gdbarch (const struct block *block)
+block::gdbarch () const
{
- if (block->function () != nullptr)
- return block->function ()->arch ();
+ if (function () != nullptr)
+ return function ()->arch ();
- return block->objfile ()->arch ();
+ return objfile ()->arch ();
}
/* See block.h. */
diff --git a/gdb/block.h b/gdb/block.h
index 2243c9a2a52..b9f1ba81b50 100644
--- a/gdb/block.h
+++ b/gdb/block.h
@@ -208,6 +208,10 @@ struct block
struct objfile *objfile () const;
+ /* Return the architecture of this block. */
+
+ struct gdbarch *gdbarch () const;
+
/* Addresses in the executable code that are in this block. */
CORE_ADDR m_start;
@@ -335,10 +339,6 @@ private:
struct block *m_blocks[1];
};
-/* Return the architecture of BLOCK, which must be non-NULL. */
-
-extern struct gdbarch *block_gdbarch (const struct block *block);
-
extern struct symbol *block_linkage_function (const struct block *);
extern struct symbol *block_containing_function (const struct block *);
diff --git a/gdb/cp-namespace.c b/gdb/cp-namespace.c
index b1c54c57da6..97b7a653e33 100644
--- a/gdb/cp-namespace.c
+++ b/gdb/cp-namespace.c
@@ -197,7 +197,7 @@ cp_lookup_bare_symbol (const struct language_defn *langdef,
if (block == NULL)
gdbarch = target_gdbarch ();
else
- gdbarch = block_gdbarch (block);
+ gdbarch = block->gdbarch ();
sym.symbol
= language_lookup_primitive_type_as_symbol (langdef, gdbarch, name);
sym.block = NULL;
diff --git a/gdb/d-namespace.c b/gdb/d-namespace.c
index 2978e5fecaf..aaef1dfae1f 100644
--- a/gdb/d-namespace.c
+++ b/gdb/d-namespace.c
@@ -94,7 +94,7 @@ d_lookup_symbol (const struct language_defn *langdef,
if (block == NULL)
gdbarch = target_gdbarch ();
else
- gdbarch = block_gdbarch (block);
+ gdbarch = block->gdbarch ();
sym.symbol
= language_lookup_primitive_type_as_symbol (langdef, gdbarch, name);
sym.block = NULL;
diff --git a/gdb/symtab.c b/gdb/symtab.c
index 408416890ac..7b7e52505ef 100644
--- a/gdb/symtab.c
+++ b/gdb/symtab.c
@@ -2442,7 +2442,7 @@ language_defn::lookup_symbol_nonlocal (const char *name,
if (block == NULL)
gdbarch = target_gdbarch ();
else
- gdbarch = block_gdbarch (block);
+ gdbarch = block->gdbarch ();
result.symbol = language_lookup_primitive_type_as_symbol (this,
gdbarch, name);
result.block = NULL;
^ permalink raw reply [flat|nested] only message in thread
only message in thread, other threads:[~2023-02-19 23:37 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:37 [binutils-gdb] Convert block_gdbarch 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).