diff options
Diffstat (limited to 'gdb/blockframe.c')
-rw-r--r-- | gdb/blockframe.c | 91 |
1 files changed, 1 insertions, 90 deletions
diff --git a/gdb/blockframe.c b/gdb/blockframe.c index d5ed002..1f1659f 100644 --- a/gdb/blockframe.c +++ b/gdb/blockframe.c @@ -38,6 +38,7 @@ #include "dummy-frame.h" #include "command.h" #include "gdbcmd.h" +#include "block.h" /* Prototypes for exported functions. */ @@ -257,96 +258,6 @@ get_frame_function (struct frame_info *frame) } -/* Return the blockvector immediately containing the innermost lexical block - containing the specified pc value and section, or 0 if there is none. - PINDEX is a pointer to the index value of the block. If PINDEX - is NULL, we don't pass this information back to the caller. */ - -struct blockvector * -blockvector_for_pc_sect (register CORE_ADDR pc, struct sec *section, - int *pindex, struct symtab *symtab) -{ - register struct block *b; - register int bot, top, half; - struct blockvector *bl; - - if (symtab == 0) /* if no symtab specified by caller */ - { - /* First search all symtabs for one whose file contains our pc */ - if ((symtab = find_pc_sect_symtab (pc, section)) == 0) - return 0; - } - - bl = BLOCKVECTOR (symtab); - b = BLOCKVECTOR_BLOCK (bl, 0); - - /* Then search that symtab for the smallest block that wins. */ - /* Use binary search to find the last block that starts before PC. */ - - bot = 0; - top = BLOCKVECTOR_NBLOCKS (bl); - - while (top - bot > 1) - { - half = (top - bot + 1) >> 1; - b = BLOCKVECTOR_BLOCK (bl, bot + half); - if (BLOCK_START (b) <= pc) - bot += half; - else - top = bot + half; - } - - /* Now search backward for a block that ends after PC. */ - - while (bot >= 0) - { - b = BLOCKVECTOR_BLOCK (bl, bot); - if (BLOCK_END (b) > pc) - { - if (pindex) - *pindex = bot; - return bl; - } - bot--; - } - return 0; -} - -/* Return the blockvector immediately containing the innermost lexical block - containing the specified pc value, or 0 if there is none. - Backward compatibility, no section. */ - -struct blockvector * -blockvector_for_pc (register CORE_ADDR pc, int *pindex) -{ - return blockvector_for_pc_sect (pc, find_pc_mapped_section (pc), - pindex, NULL); -} - -/* Return the innermost lexical block containing the specified pc value - in the specified section, or 0 if there is none. */ - -struct block * -block_for_pc_sect (register CORE_ADDR pc, struct sec *section) -{ - register struct blockvector *bl; - int index; - - bl = blockvector_for_pc_sect (pc, section, &index, NULL); - if (bl) - return BLOCKVECTOR_BLOCK (bl, index); - return 0; -} - -/* Return the innermost lexical block containing the specified pc value, - or 0 if there is none. Backward compatibility, no section. */ - -struct block * -block_for_pc (register CORE_ADDR pc) -{ - return block_for_pc_sect (pc, find_pc_mapped_section (pc)); -} - /* Return the function containing pc value PC in section SECTION. Returns 0 if function is not known. */ |