From: Doug Evans Date: Mon, 18 Jun 2012 20:31:26 +0000 (+0000) Subject: * block.c (find_block_in_blockvector): Make explicit the fact that we X-Git-Url: https://git.libre-soc.org/?a=commitdiff_plain;h=6ac9ef80f54f5364a49ad11fe7d6bd8cb97a54a6;p=binutils-gdb.git * block.c (find_block_in_blockvector): Make explicit the fact that we ignore GLOBAL_BLOCK. --- diff --git a/gdb/ChangeLog b/gdb/ChangeLog index 2eea10486c3..821c8d0b911 100644 --- a/gdb/ChangeLog +++ b/gdb/ChangeLog @@ -1,3 +1,8 @@ +2012-06-18 Doug Evans + + * block.c (find_block_in_blockvector): Make explicit the fact that we + ignore GLOBAL_BLOCK. + 2012-06-18 Tom Tromey * c-exp.y (operator): Remove trailing space after "delete" and 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)