diff options
author | Gary Benson <gary@redhat.com> | 2012-03-16 16:47:34 +0000 |
---|---|---|
committer | Gary Benson <gary@redhat.com> | 2012-03-16 16:47:34 +0000 |
commit | 481860b396d7a4106d63b1a900486accc97bb56a (patch) | |
tree | 2a5706a6a591e3524d1917f019e13721cb16f6c8 /gdb/dwarf2read.c | |
parent | ac56ee8f4c059ffc48b2691dfc3bdd18ae03d9b4 (diff) | |
download | gdb-481860b396d7a4106d63b1a900486accc97bb56a.zip gdb-481860b396d7a4106d63b1a900486accc97bb56a.tar.gz gdb-481860b396d7a4106d63b1a900486accc97bb56a.tar.bz2 |
gdb:
PR breakpoints/10738
* dwarf2read.c (use_deprecated_index_sections): New global.
(struct partial_die_info): New member may_be_inlined.
(read_partial_die): Set may_be_inlined where appropriate.
(add_partial_subprogram): Add partial symbols for partial
DIEs that may be inlined.
(new_symbol_full): Add inlined subroutines to the current
scope.
(write_psymtabs_to_index): Bump version number.
(dwarf2_read_index): Read only version 6 indices unless
use_deprecated_index_sections is set.
* linespec.c (symbol_and_data_callback): New structure.
(iterate_inline_only): New function.
(iterate_over_all_matching_symtabs): New argument
"include_inline". If nonzero, also call the callback for
symbols representing inlined subroutines.
(lookup_prefix_sym): Pass extra argument to the above.
(find_function_symbols): Likewise.
(add_matching_symbols_to_info): Likewise.
* NEWS: Mention that GDB can now set breakpoints on inlined
functions.
gdb/doc:
PR breakpoints/10738
* gdb.texinfo (Inline Functions): Remove the now-unnecessary @item
stating that GDB cannot set breakpoints on inlined functions.
(Mode Options): Document --use-deprecated-index-sections.
(Index Section Format): Document new index section version format.
gdb/testsuite:
PR breakpoints/10738
* gdb.opt/inline-break.exp: New file.
* gdb.opt/inline-break.c: Likewise.
* gdb.dwarf2/inline-break.exp: Likewise.
* gdb.dwarf2/inline-break.S: Likewise.
* gdb.base/annota1.exp: Cope with old .gdb_index warnings.
* gdb.base/async-shell.exp: Likewise.
* lib/mi-support.exp (library_loaded_re): Likewise.
Diffstat (limited to 'gdb/dwarf2read.c')
-rw-r--r-- | gdb/dwarf2read.c | 56 |
1 files changed, 48 insertions, 8 deletions
diff --git a/gdb/dwarf2read.c b/gdb/dwarf2read.c index 31e0012..7944e0f 100644 --- a/gdb/dwarf2read.c +++ b/gdb/dwarf2read.c @@ -85,6 +85,9 @@ static int dwarf2_die_debug = 0; /* When non-zero, cross-check physname against demangler. */ static int check_physname = 0; +/* When non-zero, do not reject deprecated .gdb_index sections. */ +int use_deprecated_index_sections = 0; + static int pagesize; /* When set, the file that we're processing is known to have debugging @@ -539,6 +542,7 @@ struct partial_die_info unsigned int has_type : 1; unsigned int has_specification : 1; unsigned int has_pc_info : 1; + unsigned int may_be_inlined : 1; /* Flag set if the SCOPE field of this structure has been computed. */ @@ -2118,13 +2122,41 @@ dwarf2_read_index (struct objfile *objfile) /* Versions earlier than 3 emitted every copy of a psymbol. This causes the index to behave very poorly for certain requests. Version 3 contained incomplete addrmap. So, it seems better to just ignore such - indices. Index version 4 uses a different hash function than index - version 5 and later. */ + indices. */ if (version < 4) - return 0; - /* Indices with higher version than the one supported by GDB may be no + { + static int warning_printed = 0; + if (!warning_printed) + { + warning (_("Skipping obsolete .gdb_index section in %s."), + objfile->name); + warning_printed = 1; + } + return 0; + } + /* Index version 4 uses a different hash function than index version + 5 and later. + + Versions earlier than 6 did not emit psymbols for inlined + functions. Using these files will cause GDB not to be able to + set breakpoints on inlined functions by name, so we ignore these + indices unless the --use-deprecated-index-sections command line + option was supplied. */ + if (version < 6 && !use_deprecated_index_sections) + { + static int warning_printed = 0; + if (!warning_printed) + { + warning (_("Skipping deprecated .gdb_index section in %s, pass " + "--use-deprecated-index-sections to use them anyway"), + objfile->name); + warning_printed = 1; + } + return 0; + } + /* Indexes with higher version than the one supported by GDB may be no longer backward compatible. */ - if (version > 5) + if (version > 6) return 0; map = OBSTACK_ZALLOC (&objfile->objfile_obstack, struct mapped_index); @@ -4244,6 +4276,10 @@ add_partial_subprogram (struct partial_die_info *pdi, pdi->highpc - 1 + baseaddr, cu->per_cu->v.psymtab); } + } + + if (pdi->has_pc_info || (!pdi->is_external && pdi->may_be_inlined)) + { if (!pdi->is_declaration) /* Ignore subprogram DIEs that do not have a name, they are illegal. Do not emit a complaint at this point, we will @@ -9874,6 +9910,11 @@ read_partial_die (struct partial_die_info *part_die, language_of_main = language_fortran; } break; + case DW_AT_inline: + if (DW_UNSND (&attr) == DW_INL_inlined + || DW_UNSND (&attr) == DW_INL_declared_inlined) + part_die->may_be_inlined = 1; + break; default: break; } @@ -11718,8 +11759,7 @@ new_symbol_full (struct die_info *die, struct type *type, struct dwarf2_cu *cu, finish_block. */ SYMBOL_CLASS (sym) = LOC_BLOCK; SYMBOL_INLINED (sym) = 1; - /* Do not add the symbol to any lists. It will be found via - BLOCK_FUNCTION from the blockvector. */ + list_to_add = cu->list_in_scope; break; case DW_TAG_template_value_param: suppress_add = 1; @@ -17027,7 +17067,7 @@ write_psymtabs_to_index (struct objfile *objfile, const char *dir) total_len = size_of_contents; /* The version number. */ - val = MAYBE_SWAP (5); + val = MAYBE_SWAP (6); obstack_grow (&contents, &val, sizeof (val)); /* The offset of the CU list from the start of the file. */ |