/* Code dealing with blocks for GDB.
- Copyright (C) 2003-2022 Free Software Foundation, Inc.
+ Copyright (C) 2003-2023 Free Software Foundation, Inc.
This file is part of GDB.
/* Return a view on this block's ranges. */
gdb::array_view<blockrange> ranges ()
- { return gdb::make_array_view (m_ranges->range, m_ranges->nranges); }
+ {
+ if (m_ranges == nullptr)
+ return {};
+ else
+ return gdb::make_array_view (m_ranges->range, m_ranges->nranges);
+ }
/* Const version of the above. */
gdb::array_view<const blockrange> ranges () const
- { return gdb::make_array_view (m_ranges->range, m_ranges->nranges); }
+ {
+ if (m_ranges == nullptr)
+ return {};
+ else
+ return gdb::make_array_view (m_ranges->range, m_ranges->nranges);
+ }
/* Set this block's ranges array. */
void set_ranges (blockranges *ranges)
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;
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);