public inbox for gdb-cvs@sourceware.org
help / color / mirror / Atom feed
* [binutils-gdb] Convert block_objfile 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=46baa3c6cf679e53b233708f7d5efd543c1084d7
commit 46baa3c6cf679e53b233708f7d5efd543c1084d7
Author: Tom Tromey <tom@tromey.com>
Date: Mon Jan 16 17:16:44 2023 -0700
Convert block_objfile to method
This converts block_objfile to be a method. This was mostly written
by script.
Diff:
---
gdb/ada-exp.y | 2 +-
gdb/block.c | 12 ++++++------
gdb/block.h | 8 ++++----
gdb/cp-support.c | 2 +-
gdb/expprint.c | 2 +-
gdb/printcmd.c | 2 +-
gdb/symtab.c | 10 +++++-----
gdb/varobj.c | 2 +-
8 files changed, 20 insertions(+), 20 deletions(-)
diff --git a/gdb/ada-exp.y b/gdb/ada-exp.y
index 5436585b73b..9b704968f90 100644
--- a/gdb/ada-exp.y
+++ b/gdb/ada-exp.y
@@ -1699,7 +1699,7 @@ write_var_or_type (struct parser_state *par_state,
{
struct objfile *objfile = nullptr;
if (block != nullptr)
- objfile = block_objfile (block);
+ objfile = block->objfile ();
struct bound_minimal_symbol msym
= ada_lookup_simple_minsym (decoded_name.c_str (), objfile);
diff --git a/gdb/block.c b/gdb/block.c
index 5751a6b6f84..d7d5f0bf19e 100644
--- a/gdb/block.c
+++ b/gdb/block.c
@@ -40,14 +40,14 @@ struct block_namespace_info : public allocate_on_obstack
/* See block.h. */
struct objfile *
-block_objfile (const struct block *block)
+block::objfile () const
{
const struct global_block *global_block;
- if (block->function () != nullptr)
- return block->function ()->objfile ();
+ if (function () != nullptr)
+ return function ()->objfile ();
- global_block = (struct global_block *) block_global_block (block);
+ global_block = (struct global_block *) block_global_block (this);
return global_block->compunit_symtab->objfile ();
}
@@ -59,7 +59,7 @@ block_gdbarch (const struct block *block)
if (block->function () != nullptr)
return block->function ()->arch ();
- return block_objfile (block)->arch ();
+ return block->objfile ()->arch ();
}
/* See block.h. */
@@ -434,7 +434,7 @@ set_block_compunit_symtab (struct block *block, struct compunit_symtab *cu)
struct dynamic_prop *
block_static_link (const struct block *block)
{
- struct objfile *objfile = block_objfile (block);
+ struct objfile *objfile = block->objfile ();
/* Only objfile-owned blocks that materialize top function scopes can have
static links. */
diff --git a/gdb/block.h b/gdb/block.h
index 379359f07be..2243c9a2a52 100644
--- a/gdb/block.h
+++ b/gdb/block.h
@@ -204,6 +204,10 @@ struct block
return this->ranges ()[0].start ();
}
+ /* Return the objfile of this block. */
+
+ struct objfile *objfile () const;
+
/* Addresses in the executable code that are in this block. */
CORE_ADDR m_start;
@@ -331,10 +335,6 @@ private:
struct block *m_blocks[1];
};
-/* Return the objfile of BLOCK, which must be non-NULL. */
-
-extern struct objfile *block_objfile (const struct block *block);
-
/* Return the architecture of BLOCK, which must be non-NULL. */
extern struct gdbarch *block_gdbarch (const struct block *block);
diff --git a/gdb/cp-support.c b/gdb/cp-support.c
index fe56e610a5c..764e2b8b469 100644
--- a/gdb/cp-support.c
+++ b/gdb/cp-support.c
@@ -1467,7 +1467,7 @@ add_symbol_overload_list_qualified (const char *func_name,
symbols which match. */
const block *block = get_selected_block (0);
- struct objfile *current_objfile = block ? block_objfile (block) : nullptr;
+ struct objfile *current_objfile = block ? block->objfile () : nullptr;
gdbarch_iterate_over_objfiles_in_search_order
(current_objfile ? current_objfile->arch () : target_gdbarch (),
diff --git a/gdb/expprint.c b/gdb/expprint.c
index 63004f7f106..0c7cc754179 100644
--- a/gdb/expprint.c
+++ b/gdb/expprint.c
@@ -78,7 +78,7 @@ namespace expr
bool
check_objfile (const struct block *block, struct objfile *objfile)
{
- return check_objfile (block_objfile (block), objfile);
+ return check_objfile (block->objfile (), objfile);
}
void
diff --git a/gdb/printcmd.c b/gdb/printcmd.c
index df47bccc326..88984691ae9 100644
--- a/gdb/printcmd.c
+++ b/gdb/printcmd.c
@@ -2371,7 +2371,7 @@ clear_dangling_display_expressions (struct objfile *objfile)
struct objfile *bl_objf = nullptr;
if (d->block != nullptr)
{
- bl_objf = block_objfile (d->block);
+ bl_objf = d->block->objfile ();
if (bl_objf->separate_debug_objfile_backlink != nullptr)
bl_objf = bl_objf->separate_debug_objfile_backlink;
}
diff --git a/gdb/symtab.c b/gdb/symtab.c
index 3a380f131cd..408416890ac 100644
--- a/gdb/symtab.c
+++ b/gdb/symtab.c
@@ -1970,7 +1970,7 @@ lookup_language_this (const struct language_defn *lang,
symbol_lookup_debug_printf_v ("lookup_language_this (%s, %s (objfile %s))",
lang->name (), host_address_to_string (block),
- objfile_debug_name (block_objfile (block)));
+ objfile_debug_name (block->objfile ()));
while (block)
{
@@ -2058,7 +2058,7 @@ lookup_symbol_aux (const char *name, symbol_name_match_type match_type,
if (symbol_lookup_debug)
{
struct objfile *objfile = (block == nullptr
- ? nullptr : block_objfile (block));
+ ? nullptr : block->objfile ());
symbol_lookup_debug_printf
("demangled symbol name = \"%s\", block @ %s (objfile %s)",
@@ -2204,7 +2204,7 @@ lookup_symbol_in_block (const char *name, symbol_name_match_type match_type,
if (symbol_lookup_debug)
{
struct objfile *objfile
- = block == nullptr ? nullptr : block_objfile (block);
+ = block == nullptr ? nullptr : block->objfile ();
symbol_lookup_debug_printf_v
("lookup_symbol_in_block (%s, %s (objfile %s), %s)",
@@ -2472,7 +2472,7 @@ lookup_symbol_in_static_block (const char *name,
if (symbol_lookup_debug)
{
struct objfile *objfile = (block == nullptr
- ? nullptr : block_objfile (block));
+ ? nullptr : block->objfile ());
symbol_lookup_debug_printf
("lookup_symbol_in_static_block (%s, %s (objfile %s), %s)",
@@ -2612,7 +2612,7 @@ lookup_global_symbol (const char *name,
struct objfile *objfile = nullptr;
if (block != nullptr)
{
- objfile = block_objfile (block);
+ objfile = block->objfile ();
if (objfile->separate_debug_objfile_backlink != nullptr)
objfile = objfile->separate_debug_objfile_backlink;
}
diff --git a/gdb/varobj.c b/gdb/varobj.c
index 7f34cd01e26..1d545382f5e 100644
--- a/gdb/varobj.c
+++ b/gdb/varobj.c
@@ -2397,7 +2397,7 @@ varobj_invalidate_if_uses_objfile (struct objfile *objfile)
{
if (var->root->valid_block != nullptr)
{
- struct objfile *bl_objfile = block_objfile (var->root->valid_block);
+ struct objfile *bl_objfile = var->root->valid_block->objfile ();
if (bl_objfile->separate_debug_objfile_backlink != nullptr)
bl_objfile = bl_objfile->separate_debug_objfile_backlink;
^ 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_objfile 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).