summaryrefslogtreecommitdiff
path: root/gdb/block.c
diff options
context:
space:
mode:
Diffstat (limited to 'gdb/block.c')
-rw-r--r--gdb/block.c15
1 files changed, 15 insertions, 0 deletions
diff --git a/gdb/block.c b/gdb/block.c
index 7bfd8663848..1360a1589d0 100644
--- a/gdb/block.c
+++ b/gdb/block.c
@@ -199,3 +199,18 @@ block_initialize_namespace (struct block *block, struct obstack *obstack)
BLOCK_NAMESPACE (block)->using = NULL;
}
}
+
+/* Return the static block associated to BLOCK. Return NULL if block
+ is NULL or if block is a global block. */
+
+const struct block *
+block_static_block (const struct block *block)
+{
+ if (block == NULL || BLOCK_SUPERBLOCK (block) == NULL)
+ return NULL;
+
+ while (BLOCK_SUPERBLOCK (BLOCK_SUPERBLOCK (block)) != NULL)
+ block = BLOCK_SUPERBLOCK (block);
+
+ return block;
+}