aboutsummaryrefslogtreecommitdiff
path: root/gdb
diff options
context:
space:
mode:
authorTom Tromey <tom@tromey.com>2023-01-16 17:44:20 -0700
committerTom Tromey <tom@tromey.com>2023-02-19 12:51:05 -0700
commit3c9d050626d9ab8c28082af114b5e8246b57b7de (patch)
tree14f9b06ca6b628eba07ef33e004828e5451f434b /gdb
parent3c45e9f915ae4aeab7312d6fc55a947859057572 (diff)
downloadgdb-3c9d050626d9ab8c28082af114b5e8246b57b7de.zip
gdb-3c9d050626d9ab8c28082af114b5e8246b57b7de.tar.gz
gdb-3c9d050626d9ab8c28082af114b5e8246b57b7de.tar.bz2
Convert block_linkage_function to method
This converts block_linkage_function to be a method. This was mostly written by script.
Diffstat (limited to 'gdb')
-rw-r--r--gdb/ada-lang.c2
-rw-r--r--gdb/ax-gdb.c2
-rw-r--r--gdb/block.c10
-rw-r--r--gdb/block.h9
-rw-r--r--gdb/blockframe.c4
-rw-r--r--gdb/breakpoint.c2
-rw-r--r--gdb/compile/compile-loc2c.c2
-rw-r--r--gdb/dwarf2/expr.c2
-rw-r--r--gdb/dwarf2/loc.c6
-rw-r--r--gdb/parse.c2
10 files changed, 22 insertions, 19 deletions
diff --git a/gdb/ada-lang.c b/gdb/ada-lang.c
index e063f58..e7e40cc 100644
--- a/gdb/ada-lang.c
+++ b/gdb/ada-lang.c
@@ -5309,7 +5309,7 @@ remove_irrelevant_renamings (std::vector<struct block_symbol> *syms,
if (current_block == NULL)
return;
- current_function = block_linkage_function (current_block);
+ current_function = current_block->linkage_function ();
if (current_function == NULL)
return;
diff --git a/gdb/ax-gdb.c b/gdb/ax-gdb.c
index 3cfe997..4e2d1c6 100644
--- a/gdb/ax-gdb.c
+++ b/gdb/ax-gdb.c
@@ -1887,7 +1887,7 @@ op_this_operation::do_generate_ax (struct expression *exp,
const struct language_defn *lang;
b = block_for_pc (ax->scope);
- func = block_linkage_function (b);
+ func = b->linkage_function ();
lang = language_def (func->language ());
sym = lookup_language_this (lang, b).symbol;
diff --git a/gdb/block.c b/gdb/block.c
index fc52333..dca6ff3 100644
--- a/gdb/block.c
+++ b/gdb/block.c
@@ -86,15 +86,13 @@ contained_in (const struct block *a, const struct block *b,
return false;
}
-
-/* Return the symbol for the function which contains a specified
- lexical block, described by a struct block BL. The return value
- will not be an inlined function; the containing function will be
- returned instead. */
+/* See block.h. */
struct symbol *
-block_linkage_function (const struct block *bl)
+block::linkage_function () const
{
+ const block *bl = this;
+
while ((bl->function () == NULL || bl->inlined_p ())
&& bl->superblock () != NULL)
bl = bl->superblock ();
diff --git a/gdb/block.h b/gdb/block.h
index 680b7d0..d1f4409 100644
--- a/gdb/block.h
+++ b/gdb/block.h
@@ -231,6 +231,13 @@ struct block
void set_using (struct using_direct *using_decl, struct obstack *obstack);
+ /* Return the symbol for the function which contains a specified
+ lexical block, described by a struct block. The return value
+ will not be an inlined function; the containing function will be
+ returned instead. */
+
+ struct symbol *linkage_function () const;
+
/* Addresses in the executable code that are in this block. */
CORE_ADDR m_start;
@@ -364,8 +371,6 @@ private:
struct block *m_blocks[1];
};
-extern struct symbol *block_linkage_function (const struct block *);
-
extern struct symbol *block_containing_function (const struct block *);
/* Return true if block A is lexically nested within block B, or if a
diff --git a/gdb/blockframe.c b/gdb/blockframe.c
index 2796fc9..65183b1 100644
--- a/gdb/blockframe.c
+++ b/gdb/blockframe.c
@@ -91,7 +91,7 @@ get_pc_function_start (CORE_ADDR pc)
bl = block_for_pc (pc);
if (bl)
{
- struct symbol *symbol = block_linkage_function (bl);
+ struct symbol *symbol = bl->linkage_function ();
if (symbol)
{
@@ -139,7 +139,7 @@ find_pc_sect_function (CORE_ADDR pc, struct obj_section *section)
if (b == 0)
return 0;
- return block_linkage_function (b);
+ return b->linkage_function ();
}
/* Return the function containing pc value PC.
diff --git a/gdb/breakpoint.c b/gdb/breakpoint.c
index b1922fc..a2f1190 100644
--- a/gdb/breakpoint.c
+++ b/gdb/breakpoint.c
@@ -9230,7 +9230,7 @@ resolve_sal_pc (struct symtab_and_line *sal)
sal->symtab->compunit ());
if (bv != NULL)
{
- sym = block_linkage_function (b);
+ sym = b->linkage_function ();
if (sym != NULL)
sal->section
= sym->obj_section (sal->symtab->compunit ()->objfile ());
diff --git a/gdb/compile/compile-loc2c.c b/gdb/compile/compile-loc2c.c
index 558460a..8a5a0f5 100644
--- a/gdb/compile/compile-loc2c.c
+++ b/gdb/compile/compile-loc2c.c
@@ -892,7 +892,7 @@ do_compile_dwarf_expr_to_c (int indent, string_file *stream,
if (!b)
error (_("No block found for address"));
- framefunc = block_linkage_function (b);
+ framefunc = b->linkage_function ();
if (!framefunc)
error (_("No function found for block"));
diff --git a/gdb/dwarf2/expr.c b/gdb/dwarf2/expr.c
index b48bab0b..2b41372 100644
--- a/gdb/dwarf2/expr.c
+++ b/gdb/dwarf2/expr.c
@@ -771,7 +771,7 @@ dwarf_expr_context::get_frame_base (const gdb_byte **start,
/* Use block_linkage_function, which returns a real (not inlined)
function, instead of get_frame_function, which may return an
inlined function. */
- symbol *framefunc = block_linkage_function (bl);
+ symbol *framefunc = bl->linkage_function ();
/* If we found a frame-relative symbol then it was certainly within
some function associated with a frame. If we can't find the frame,
diff --git a/gdb/dwarf2/loc.c b/gdb/dwarf2/loc.c
index 0ab54ab..4727651 100644
--- a/gdb/dwarf2/loc.c
+++ b/gdb/dwarf2/loc.c
@@ -451,7 +451,7 @@ dwarf2_find_location_expression (struct dwarf2_loclist_baton *baton,
struct symbol *pc_func = NULL;
if (pc_block)
- pc_func = block_linkage_function (pc_block);
+ pc_func = pc_block->linkage_function ();
if (pc_func && pc == pc_func->value_block ()->entry_pc ())
{
@@ -2643,7 +2643,7 @@ dwarf2_compile_expr_to_ax (struct agent_expr *expr, struct axs_value *loc,
if (!b)
error (_("No block found for address"));
- framefunc = block_linkage_function (b);
+ framefunc = b->linkage_function ();
if (!framefunc)
error (_("No function found for block"));
@@ -3169,7 +3169,7 @@ locexpr_describe_location_piece (struct symbol *symbol, struct ui_file *stream,
error (_("No block found for address for symbol \"%s\"."),
symbol->print_name ());
- framefunc = block_linkage_function (b);
+ framefunc = b->linkage_function ();
if (!framefunc)
error (_("No function found for block for symbol \"%s\"."),
diff --git a/gdb/parse.c b/gdb/parse.c
index 2f7d580..4c20b91 100644
--- a/gdb/parse.c
+++ b/gdb/parse.c
@@ -488,7 +488,7 @@ parse_exp_in_context (const char **stringptr, CORE_ADDR pc,
the current frame language to parse the expression. That's why
we do the following language detection only if the context block
has been specifically provided. */
- struct symbol *func = block_linkage_function (block);
+ struct symbol *func = block->linkage_function ();
if (func != NULL)
lang = language_def (func->language ());