aboutsummaryrefslogtreecommitdiff
path: root/gdb
diff options
context:
space:
mode:
authorSimon Marchi <simon.marchi@polymtl.ca>2022-04-20 17:17:11 -0400
committerSimon Marchi <simon.marchi@polymtl.ca>2022-04-27 22:05:03 -0400
commit414705d1c2d359694459d3991a0975d051ac70b5 (patch)
tree201d88e54b350f7a39e38863cb15fb5b4930a34b /gdb
parentbad9471aab31d1b5aa733b8985b8e40e2a97b8e7 (diff)
downloadgdb-414705d1c2d359694459d3991a0975d051ac70b5.zip
gdb-414705d1c2d359694459d3991a0975d051ac70b5.tar.gz
gdb-414705d1c2d359694459d3991a0975d051ac70b5.tar.bz2
gdb: remove BLOCKVECTOR_MAP macro
Replace with equivalent methods. Change-Id: I4e56c76dfc363c1447686fb29c4212ea18b4dba0
Diffstat (limited to 'gdb')
-rw-r--r--gdb/block.c4
-rw-r--r--gdb/block.h18
-rw-r--r--gdb/buildsym.c6
-rw-r--r--gdb/inline-frame.c5
-rw-r--r--gdb/jit.c2
-rw-r--r--gdb/objfiles.c4
-rw-r--r--gdb/symtab.c4
7 files changed, 26 insertions, 17 deletions
diff --git a/gdb/block.c b/gdb/block.c
index 1c3a003..39a39df 100644
--- a/gdb/block.c
+++ b/gdb/block.c
@@ -138,8 +138,8 @@ find_block_in_blockvector (const struct blockvector *bl, CORE_ADDR pc)
/* If we have an addrmap mapping code addresses to blocks, then use
that. */
- if (BLOCKVECTOR_MAP (bl))
- return (const struct block *) addrmap_find (BLOCKVECTOR_MAP (bl), pc);
+ if (bl->map () != nullptr)
+ return (const struct block *) addrmap_find (bl->map (), pc);
/* Otherwise, use binary search to find the last block that starts
before PC.
diff --git a/gdb/block.h b/gdb/block.h
index b6b8b86..b9f4e97 100644
--- a/gdb/block.h
+++ b/gdb/block.h
@@ -296,12 +296,24 @@ struct blockvector
const struct block *static_block () const
{ return this->block (STATIC_BLOCK); }
+ /* Return the address -> block map of this blockvector. */
+ addrmap *map ()
+ { return m_map; }
+
+ /* Const version of the above. */
+ const addrmap *map () const
+ { return m_map; }
+
+ /* Set this blockvector's address -> block map. */
+ void set_map (addrmap *map)
+ { m_map = map; }
+
+private:
/* An address map mapping addresses to blocks in this blockvector.
This pointer is zero if the blocks' start and end addresses are
enough. */
- struct addrmap *map;
+ struct addrmap *m_map;
-private:
/* Number of blocks in the list. */
int m_num_blocks;
@@ -309,8 +321,6 @@ private:
struct block *m_blocks[1];
};
-#define BLOCKVECTOR_MAP(blocklist) ((blocklist)->map)
-
/* Return the objfile of BLOCK, which must be non-NULL. */
extern struct objfile *block_objfile (const struct block *block);
diff --git a/gdb/buildsym.c b/gdb/buildsym.c
index 48cd967..c54e658 100644
--- a/gdb/buildsym.c
+++ b/gdb/buildsym.c
@@ -457,10 +457,10 @@ buildsym_compunit::make_blockvector ()
/* If we needed an address map for this symtab, record it in the
blockvector. */
if (m_pending_addrmap != nullptr && m_pending_addrmap_interesting)
- BLOCKVECTOR_MAP (blockvector)
- = addrmap_create_fixed (m_pending_addrmap, &m_objfile->objfile_obstack);
+ blockvector->set_map
+ (addrmap_create_fixed (m_pending_addrmap, &m_objfile->objfile_obstack));
else
- BLOCKVECTOR_MAP (blockvector) = 0;
+ blockvector->set_map (nullptr);
/* Some compilers output blocks in the wrong order, but we depend on
their being in the right order so we can binary search. Check the
diff --git a/gdb/inline-frame.c b/gdb/inline-frame.c
index c502674..57b58f3 100644
--- a/gdb/inline-frame.c
+++ b/gdb/inline-frame.c
@@ -286,11 +286,10 @@ block_starting_point_at (CORE_ADDR pc, const struct block *block)
const struct block *new_block;
bv = blockvector_for_pc (pc, NULL);
- if (BLOCKVECTOR_MAP (bv) == NULL)
+ if (bv->map () == nullptr)
return 0;
- new_block = (const struct block *) addrmap_find (BLOCKVECTOR_MAP (bv),
- pc - 1);
+ new_block = (const struct block *) addrmap_find (bv->map (), pc - 1);
if (new_block == NULL)
return 1;
diff --git a/gdb/jit.c b/gdb/jit.c
index 9f2df71..b4a070b 100644
--- a/gdb/jit.c
+++ b/gdb/jit.c
@@ -562,7 +562,7 @@ finalize_symtab (struct gdb_symtab *stab, struct objfile *objfile)
/* At the end of this function, (begin, end) will contain the PC range this
entire blockvector spans. */
- BLOCKVECTOR_MAP (bv) = NULL;
+ bv->set_map (nullptr);
begin = stab->blocks.front ().begin;
end = stab->blocks.front ().end;
bv->set_num_blocks (actual_nblocks);
diff --git a/gdb/objfiles.c b/gdb/objfiles.c
index 0fec523..3f18e98 100644
--- a/gdb/objfiles.c
+++ b/gdb/objfiles.c
@@ -667,8 +667,8 @@ objfile_relocate1 (struct objfile *objfile,
struct blockvector *bv = cust->blockvector ();
int block_line_section = cust->block_line_section ();
- if (BLOCKVECTOR_MAP (bv))
- addrmap_relocate (BLOCKVECTOR_MAP (bv), delta[block_line_section]);
+ if (bv->map () != nullptr)
+ addrmap_relocate (bv->map (), delta[block_line_section]);
for (block *b : bv->blocks ())
{
diff --git a/gdb/symtab.c b/gdb/symtab.c
index 31e7160..4b33d6c 100644
--- a/gdb/symtab.c
+++ b/gdb/symtab.c
@@ -2987,9 +2987,9 @@ find_pc_sect_compunit_symtab (CORE_ADDR pc, struct obj_section *section)
if (!in_range_p)
continue;
- if (BLOCKVECTOR_MAP (bv))
+ if (bv->map () != nullptr)
{
- if (addrmap_find (BLOCKVECTOR_MAP (bv), pc) == nullptr)
+ if (addrmap_find (bv->map (), pc) == nullptr)
continue;
return cust;