summaryrefslogtreecommitdiff
path: root/gdb/block.c
diff options
context:
space:
mode:
authorDoug Evans <dje@google.com>2012-06-18 20:31:26 +0000
committerDoug Evans <dje@google.com>2012-06-18 20:31:26 +0000
commita31920e2da14b17a48cd1d02a1acbe0687b6c7f6 (patch)
tree0c402fbf8f01e1188cb3c5fbf171c080f938cf46 /gdb/block.c
parent69a179f1518fae5168238f8775ff46013d0d155e (diff)
downloadgdb-a31920e2da14b17a48cd1d02a1acbe0687b6c7f6.tar.gz
* block.c (find_block_in_blockvector): Make explicit the fact that we
ignore GLOBAL_BLOCK.
Diffstat (limited to 'gdb/block.c')
-rw-r--r--gdb/block.c11
1 files changed, 8 insertions, 3 deletions
diff --git a/gdb/block.c b/gdb/block.c
index 15037300554..a0f82ece837 100644
--- a/gdb/block.c
+++ b/gdb/block.c
@@ -118,8 +118,13 @@ find_block_in_blockvector (struct blockvector *bl, CORE_ADDR pc)
return addrmap_find (BLOCKVECTOR_MAP (bl), pc);
/* Otherwise, use binary search to find the last block that starts
- before PC. */
- bot = 0;
+ before PC.
+ Note: GLOBAL_BLOCK is block 0, STATIC_BLOCK is block 1.
+ They both have the same START,END values.
+ Historically this code would choose STATIC_BLOCK over GLOBAL_BLOCK but the
+ fact that this choice was made was subtle, now we make it explicit. */
+ gdb_assert (BLOCKVECTOR_NBLOCKS (bl) >= 2);
+ bot = STATIC_BLOCK;
top = BLOCKVECTOR_NBLOCKS (bl);
while (top - bot > 1)
@@ -134,7 +139,7 @@ find_block_in_blockvector (struct blockvector *bl, CORE_ADDR pc)
/* Now search backward for a block that ends after PC. */
- while (bot >= 0)
+ while (bot >= STATIC_BLOCK)
{
b = BLOCKVECTOR_BLOCK (bl, bot);
if (BLOCK_END (b) > pc)