aboutsummaryrefslogtreecommitdiff
path: root/gdb/block.h
diff options
context:
space:
mode:
authorTom Tromey <tromey@adacore.com>2023-10-24 07:27:01 -0600
committerTom Tromey <tromey@adacore.com>2023-11-14 08:43:34 -0700
commitedf1b9640bbc981c8a094d6ca29d444b1ed50a2c (patch)
tree9790dd6fb7e5a4703afa94c167a18affc307d113 /gdb/block.h
parent3141397e865d4edd98737bbdceeb2aee3ec35eb8 (diff)
downloadgdb-edf1b9640bbc981c8a094d6ca29d444b1ed50a2c.zip
gdb-edf1b9640bbc981c8a094d6ca29d444b1ed50a2c.tar.gz
gdb-edf1b9640bbc981c8a094d6ca29d444b1ed50a2c.tar.bz2
Add two convenience methods to block
This adds a couple of convenience methods, block::is_static_block and block::is_global_block.
Diffstat (limited to 'gdb/block.h')
-rw-r--r--gdb/block.h15
1 files changed, 15 insertions, 0 deletions
diff --git a/gdb/block.h b/gdb/block.h
index 3a197e6..9fccbe0 100644
--- a/gdb/block.h
+++ b/gdb/block.h
@@ -254,10 +254,25 @@ struct block : public allocate_on_obstack
const struct block *static_block () const;
+ /* Return true if this block is a static block. */
+
+ bool is_static_block () const
+ {
+ const block *sup = superblock ();
+ if (sup == nullptr)
+ return false;
+ return sup->is_global_block ();
+ }
+
/* Return the static block associated with block. */
const struct block *global_block () const;
+ /* Return true if this block is a global block. */
+
+ bool is_global_block () const
+ { return superblock () == nullptr; }
+
/* Set the compunit of this block, which must be a global block. */
void set_compunit_symtab (struct compunit_symtab *);