/* Block-related functions for the GNU debugger, GDB.
- Copyright (C) 2003-2020 Free Software Foundation, Inc.
+ Copyright (C) 2003-2021 Free Software Foundation, Inc.
This file is part of GDB.
if (BLOCK_FUNCTION (block) != NULL)
return symbol_arch (BLOCK_FUNCTION (block));
- return get_objfile_arch (block_objfile (block));
+ return block_objfile (block)->arch ();
}
/* See block.h. */
if (a == b)
return true;
/* If A is a function block, then A cannot be contained in B,
- except if A was inlined. */
+ except if A was inlined. */
if (!allow_nested && BLOCK_FUNCTION (a) != NULL && !block_inlined_p (a))
- return false;
+ return false;
a = BLOCK_SUPERBLOCK (a);
}
while (a != NULL);
while (bot >= STATIC_BLOCK)
{
b = BLOCKVECTOR_BLOCK (bl, bot);
+ if (!(BLOCK_START (b) <= pc))
+ return NULL;
if (BLOCK_END (b) > pc)
return b;
bot--;
return block_iter_match_step (iterator, name, 0);
}
-/* Return true if symbol A is the best match possible for DOMAIN. */
+/* See block.h. */
-static bool
+bool
best_symbol (struct symbol *a, const domain_enum domain)
{
return (SYMBOL_DOMAIN (a) == domain
&& SYMBOL_CLASS (a) != LOC_UNRESOLVED);
}
-/* Return symbol B if it is a better match than symbol A for DOMAIN.
- Otherwise return A. */
+/* See block.h. */
-static struct symbol *
+struct symbol *
better_symbol (struct symbol *a, struct symbol *b, const domain_enum domain)
{
if (a == NULL)
struct blockranges *
make_blockranges (struct objfile *objfile,
- const std::vector<blockrange> &rangevec)
+ const std::vector<blockrange> &rangevec)
{
struct blockranges *blr;
size_t n = rangevec.size();
blr = (struct blockranges *)
obstack_alloc (&objfile->objfile_obstack,
- sizeof (struct blockranges)
+ sizeof (struct blockranges)
+ (n - 1) * sizeof (struct blockrange));
blr->nranges = n;