diff options
Diffstat (limited to 'gdb/printcmd.c')
-rw-r--r-- | gdb/printcmd.c | 30 |
1 files changed, 23 insertions, 7 deletions
diff --git a/gdb/printcmd.c b/gdb/printcmd.c index 1b855a4..298de93 100644 --- a/gdb/printcmd.c +++ b/gdb/printcmd.c @@ -31,6 +31,12 @@ Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA. */ #include "breakpoint.h" #include "demangle.h" +/* These are just for containing_function_bounds. It might be better + to move containing_function_bounds to blockframe.c or thereabouts. */ +#include "bfd.h" +#include "symfile.h" +#include "objfiles.h" + extern int asm_demangle; /* Whether to demangle syms in asm printouts */ extern int addressprint; /* Whether to print hex addresses in HLL " */ @@ -1846,18 +1852,28 @@ static int containing_function_bounds (pc, low, high) CORE_ADDR pc, *low, *high; { - int scan; + CORE_ADDR scan; + CORE_ADDR limit; + struct obj_section *sec; if (!find_pc_partial_function (pc, 0, low)) return 0; + sec = find_pc_section (pc); + if (sec == NULL) + return 0; + limit = sec->endaddr; + scan = *low; - do { - scan++; - if (!find_pc_partial_function (scan, 0, high)) - return 0; - } while (*low == *high); - + while (scan < limit) + { + ++scan; + if (!find_pc_partial_function (scan, 0, high)) + return 0; + if (*low != *high) + return 1; + } + *high = limit; return 1; } |