X-Git-Url: http://drtracing.org/?a=blobdiff_plain;f=gdb%2Fblockframe.c;h=05c26bc2c2a208cbd97f4d7e141515705d790735;hb=60db1b8565060f4bd2287b060ea9724c93289982;hp=fe7807b87a6e726e1474fe3949c1154c470633ea;hpb=2030c079717475f5b6fad837bb81758891f3b802;p=deliverable%2Fbinutils-gdb.git diff --git a/gdb/blockframe.c b/gdb/blockframe.c index fe7807b87a..05c26bc2c2 100644 --- a/gdb/blockframe.c +++ b/gdb/blockframe.c @@ -1,7 +1,7 @@ /* Get info from stack frames; convert between frames, blocks, functions and pc values. - Copyright (C) 1986-2019 Free Software Foundation, Inc. + Copyright (C) 1986-2020 Free Software Foundation, Inc. This file is part of GDB. @@ -209,7 +209,7 @@ clear_pc_function_cache (void) /* See symtab.h. */ -int +bool find_pc_partial_function (CORE_ADDR pc, const char **name, CORE_ADDR *address, CORE_ADDR *endaddr, const struct block **block) { @@ -219,7 +219,7 @@ find_pc_partial_function (CORE_ADDR pc, const char **name, CORE_ADDR *address, struct compunit_symtab *compunit_symtab = NULL; CORE_ADDR mapped_pc; - /* To ensure that the symbol returned belongs to the correct setion + /* To ensure that the symbol returned belongs to the correct section (and that the last [random] symbol from the previous section isn't returned) try to find the section containing PC. First try the overlay code (which by default returns NULL); and second try @@ -236,19 +236,7 @@ find_pc_partial_function (CORE_ADDR pc, const char **name, CORE_ADDR *address, goto return_cached_value; msymbol = lookup_minimal_symbol_by_pc_section (mapped_pc, section); - for (objfile *objfile : current_program_space->objfiles ()) - { - if (objfile->sf) - { - compunit_symtab - = objfile->sf->qf->find_pc_sect_compunit_symtab (objfile, msymbol, - mapped_pc, - section, - 0); - } - if (compunit_symtab != NULL) - break; - } + compunit_symtab = find_pc_sect_compunit_symtab (mapped_pc, section); if (compunit_symtab != NULL) { @@ -269,7 +257,7 @@ find_pc_partial_function (CORE_ADDR pc, const char **name, CORE_ADDR *address, { const struct block *b = SYMBOL_BLOCK_VALUE (f); - cache_pc_function_name = SYMBOL_LINKAGE_NAME (f); + cache_pc_function_name = f->linkage_name (); cache_pc_function_section = section; cache_pc_function_block = b; @@ -331,11 +319,13 @@ find_pc_partial_function (CORE_ADDR pc, const char **name, CORE_ADDR *address, *address = 0; if (endaddr != NULL) *endaddr = 0; - return 0; + if (block != nullptr) + *block = nullptr; + return false; } cache_pc_function_low = BMSYMBOL_VALUE_ADDRESS (msymbol); - cache_pc_function_name = MSYMBOL_LINKAGE_NAME (msymbol.minsym); + cache_pc_function_name = msymbol.minsym->linkage_name (); cache_pc_function_section = section; cache_pc_function_high = minimal_symbol_upper_bound (msymbol); cache_pc_function_block = nullptr; @@ -372,7 +362,7 @@ find_pc_partial_function (CORE_ADDR pc, const char **name, CORE_ADDR *address, if (block != nullptr) *block = cache_pc_function_block; - return 1; + return true; } /* See symtab.h. */ @@ -439,11 +429,11 @@ find_gnu_ifunc_target_type (CORE_ADDR resolver_funaddr) /* If we found a pointer to function, then the resolved type is the type of the pointed-to function. */ - if (TYPE_CODE (resolver_ret_type) == TYPE_CODE_PTR) + if (resolver_ret_type->code () == TYPE_CODE_PTR) { struct type *resolved_type = TYPE_TARGET_TYPE (resolver_ret_type); - if (TYPE_CODE (check_typedef (resolved_type)) == TYPE_CODE_FUNC) + if (check_typedef (resolved_type)->code () == TYPE_CODE_FUNC) return resolved_type; } }