X-Git-Url: http://drtracing.org/?a=blobdiff_plain;f=gdb%2Fblockframe.c;h=f6dd861c36f9f498138892cf2b19a64e869809fd;hb=e04caa70901ed44eb9537ccdbd286fe9b0a46ce2;hp=6ea09658b5333c6ef870119f3bad82ce058962c4;hpb=2b1ffcfd6fe5b88d50b6ad1c2ab3e9623ede5e35;p=deliverable%2Fbinutils-gdb.git diff --git a/gdb/blockframe.c b/gdb/blockframe.c index 6ea09658b5..f6dd861c36 100644 --- a/gdb/blockframe.c +++ b/gdb/blockframe.c @@ -377,6 +377,43 @@ find_pc_partial_function (CORE_ADDR pc, const char **name, CORE_ADDR *address, /* See symtab.h. */ +bool +find_function_entry_range_from_pc (CORE_ADDR pc, const char **name, + CORE_ADDR *address, CORE_ADDR *endaddr) +{ + const struct block *block; + bool status = find_pc_partial_function (pc, name, address, endaddr, &block); + + if (status && block != nullptr && !BLOCK_CONTIGUOUS_P (block)) + { + CORE_ADDR entry_pc = BLOCK_ENTRY_PC (block); + + for (int i = 0; i < BLOCK_NRANGES (block); i++) + { + if (BLOCK_RANGE_START (block, i) <= entry_pc + && entry_pc < BLOCK_RANGE_END (block, i)) + { + if (address != nullptr) + *address = BLOCK_RANGE_START (block, i); + + if (endaddr != nullptr) + *endaddr = BLOCK_RANGE_END (block, i); + + return status; + } + } + + /* It's an internal error if we exit the above loop without finding + the range. */ + internal_error (__FILE__, __LINE__, + _("Entry block not found in find_function_entry_range_from_pc")); + } + + return status; +} + +/* See symtab.h. */ + struct type * find_function_type (CORE_ADDR pc) {