Eliminate exceptions.c:print_any_exception.
[deliverable/binutils-gdb.git] / gdb / block.c
index 150373005547057a63c761d182cadf0a87d7fa38..a4b9ef550ba107364662d6b50a3f199123cb90e2 100644 (file)
@@ -1,6 +1,6 @@
 /* Block-related functions for the GNU debugger, GDB.
 
-   Copyright (C) 2003, 2007-2012 Free Software Foundation, Inc.
+   Copyright (C) 2003-2014 Free Software Foundation, Inc.
 
    This file is part of GDB.
 
@@ -107,7 +107,7 @@ block_inlined_p (const struct block *bl)
    It returns the containing block if there is one, or else NULL.  */
 
 static struct block *
-find_block_in_blockvector (struct blockvector *bl, CORE_ADDR pc)
+find_block_in_blockvector (const struct blockvector *bl, CORE_ADDR pc)
 {
   struct block *b;
   int bot, top, half;
@@ -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)
@@ -150,11 +155,11 @@ find_block_in_blockvector (struct blockvector *bl, CORE_ADDR pc)
    is none.  PBLOCK is a pointer to the block.  If PBLOCK is NULL, we
    don't pass this information back to the caller.  */
 
-struct blockvector *
+const struct blockvector *
 blockvector_for_pc_sect (CORE_ADDR pc, struct obj_section *section,
-                        struct block **pblock, struct symtab *symtab)
+                        const struct block **pblock, struct symtab *symtab)
 {
-  struct blockvector *bl;
+  const struct blockvector *bl;
   struct block *b;
 
   if (symtab == 0)             /* if no symtab specified by caller */
@@ -180,7 +185,7 @@ blockvector_for_pc_sect (CORE_ADDR pc, struct obj_section *section,
 /* Return true if the blockvector BV contains PC, false otherwise.  */
 
 int
-blockvector_contains_pc (struct blockvector *bv, CORE_ADDR pc)
+blockvector_contains_pc (const struct blockvector *bv, CORE_ADDR pc)
 {
   return find_block_in_blockvector (bv, pc) != NULL;
 }
@@ -203,7 +208,7 @@ call_site_for_pc (struct gdbarch *gdbarch, CORE_ADDR pc)
 
   if (slot == NULL)
     {
-      struct minimal_symbol *msym = lookup_minimal_symbol_by_pc (pc);
+      struct bound_minimal_symbol msym = lookup_minimal_symbol_by_pc (pc);
 
       /* DW_TAG_gnu_call_site will be missing just if GCC could not determine
         the call target.  */
@@ -211,7 +216,8 @@ call_site_for_pc (struct gdbarch *gdbarch, CORE_ADDR pc)
                   _("DW_OP_GNU_entry_value resolving cannot find "
                     "DW_TAG_GNU_call_site %s in %s"),
                   paddress (gdbarch, pc),
-                  msym == NULL ? "???" : SYMBOL_PRINT_NAME (msym));
+                  (msym.minsym == NULL ? "???"
+                   : MSYMBOL_PRINT_NAME (msym.minsym)));
     }
 
   return *slot;
@@ -221,8 +227,8 @@ call_site_for_pc (struct gdbarch *gdbarch, CORE_ADDR pc)
    containing the specified pc value, or 0 if there is none.
    Backward compatibility, no section.  */
 
-struct blockvector *
-blockvector_for_pc (CORE_ADDR pc, struct block **pblock)
+const struct blockvector *
+blockvector_for_pc (CORE_ADDR pc, const struct block **pblock)
 {
   return blockvector_for_pc_sect (pc, find_pc_mapped_section (pc),
                                  pblock, NULL);
@@ -231,11 +237,11 @@ blockvector_for_pc (CORE_ADDR pc, struct block **pblock)
 /* Return the innermost lexical block containing the specified pc value
    in the specified section, or 0 if there is none.  */
 
-struct block *
+const struct block *
 block_for_pc_sect (CORE_ADDR pc, struct obj_section *section)
 {
-  struct blockvector *bl;
-  struct block *b;
+  const struct blockvector *bl;
+  const struct block *b;
 
   bl = blockvector_for_pc_sect (pc, section, &b, NULL);
   if (bl)
@@ -246,7 +252,7 @@ block_for_pc_sect (CORE_ADDR pc, struct obj_section *section)
 /* Return the innermost lexical block containing the specified pc value,
    or 0 if there is none.  Backward compatibility, no section.  */
 
-struct block *
+const struct block *
 block_for_pc (CORE_ADDR pc)
 {
   return block_for_pc_sect (pc, find_pc_mapped_section (pc));
This page took 0.025059 seconds and 4 git commands to generate.