diff options
author | Tom Tromey <tromey@redhat.com> | 2012-05-18 14:26:26 +0000 |
---|---|---|
committer | Tom Tromey <tromey@redhat.com> | 2012-05-18 14:26:26 +0000 |
commit | 9703b51377ca945155cb74f09761fe6fb0431613 (patch) | |
tree | cbdbb10c06ff4fb5d9b973ee1312dcf1521e0ab7 /gdb/dwarf2read.c | |
parent | 5a4398495b075cef77112aed5e98a6dddf3ee5b8 (diff) | |
download | gdb-9703b51377ca945155cb74f09761fe6fb0431613.zip gdb-9703b51377ca945155cb74f09761fe6fb0431613.tar.gz gdb-9703b51377ca945155cb74f09761fe6fb0431613.tar.bz2 |
* psymtab.c (find_pc_sect_symtab_from_partial): Return the symtab
directly corresponding to the found psymtab.
* dwarf2read.c (recursively_find_pc_sect_symtab): New function.
(dw2_find_pc_sect_symtab): Use it.
* block.h (blockvector_contains_pc): Declare.
* block.c (find_block_in_blockvector): New function.
(blockvector_for_pc_sect): Use it.
(blockvector_contains_pc): New function.
Diffstat (limited to 'gdb/dwarf2read.c')
-rw-r--r-- | gdb/dwarf2read.c | 29 |
1 files changed, 28 insertions, 1 deletions
diff --git a/gdb/dwarf2read.c b/gdb/dwarf2read.c index fc1a864..1514e13 100644 --- a/gdb/dwarf2read.c +++ b/gdb/dwarf2read.c @@ -2992,6 +2992,30 @@ dw2_expand_symtabs_matching } } +/* A helper for dw2_find_pc_sect_symtab which finds the most specific + symtab. */ + +static struct symtab * +recursively_find_pc_sect_symtab (struct symtab *symtab, CORE_ADDR pc) +{ + int i; + + if (BLOCKVECTOR (symtab) != NULL + && blockvector_contains_pc (BLOCKVECTOR (symtab), pc)) + return symtab; + + for (i = 0; symtab->includes[i]; ++i) + { + struct symtab *s; + + s = recursively_find_pc_sect_symtab (s, pc); + if (s != NULL) + return s; + } + + return NULL; +} + static struct symtab * dw2_find_pc_sect_symtab (struct objfile *objfile, struct minimal_symbol *msymbol, @@ -3000,6 +3024,7 @@ dw2_find_pc_sect_symtab (struct objfile *objfile, int warn_if_readin) { struct dwarf2_per_cu_data *data; + struct symtab *result; dw2_setup (objfile); @@ -3014,7 +3039,9 @@ dw2_find_pc_sect_symtab (struct objfile *objfile, warning (_("(Internal error: pc %s in read in CU, but not in symtab.)"), paddress (get_objfile_arch (objfile), pc)); - return dw2_instantiate_symtab (data); + result = recursively_find_pc_sect_symtab (dw2_instantiate_symtab (data), pc); + gdb_assert (result != NULL); + return result; } static void |