]> git.ipfire.org Git - thirdparty/binutils-gdb.git/commitdiff
* block.c (find_block_in_blockvector): Make explicit the fact that we
authorDoug Evans <dje@google.com>
Mon, 18 Jun 2012 20:31:26 +0000 (20:31 +0000)
committerDoug Evans <dje@google.com>
Mon, 18 Jun 2012 20:31:26 +0000 (20:31 +0000)
ignore GLOBAL_BLOCK.

gdb/ChangeLog
gdb/block.c

index 2eea10486c3d5b3f78b38153d009925bfc92f3e3..821c8d0b91115ee0bb263e57e559165fab1a5b51 100644 (file)
@@ -1,3 +1,8 @@
+2012-06-18  Doug Evans  <dje@google.com>
+
+       * block.c (find_block_in_blockvector): Make explicit the fact that we
+       ignore GLOBAL_BLOCK.
+
 2012-06-18  Tom Tromey  <tromey@redhat.com>
 
        * c-exp.y (operator): Remove trailing space after "delete" and
index 150373005547057a63c761d182cadf0a87d7fa38..a0f82ece83790b3b68bd0e38cd1322b793928c19 100644 (file)
@@ -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)