aboutsummaryrefslogtreecommitdiff
path: root/bfd
diff options
context:
space:
mode:
authorMihail-Marian Nistor <mihail.nistor@freescale.com>2014-12-20 11:04:44 -0500
committerJoel Brobecker <brobecker@adacore.com>2014-12-20 11:32:25 -0500
commit87186c6a5ccf857d7f4e55478dda3aa06387c3c4 (patch)
treea85e9b9aca0ef2e2645846deeaf4395dd49cc4c6 /bfd
parentbd040da1dbb7e6640440f306ddf993af98441851 (diff)
downloadgdb-87186c6a5ccf857d7f4e55478dda3aa06387c3c4.zip
gdb-87186c6a5ccf857d7f4e55478dda3aa06387c3c4.tar.gz
gdb-87186c6a5ccf857d7f4e55478dda3aa06387c3c4.tar.bz2
gdb/17394: cannot put breakpoint only in selected ASM file.
This patch fixes a problem when trying to insert a breakpoint on a specific symbol defined in a specific file, eg: break foo.c:func This currently works for files in C/C++/Ada, etc, but doesn't always work for Asm files. Analysis of the problem showed that this related to a limitation in gas, which does not generate debug info for functions/ symbols. Thus, we have a symtab for the file ("info sources" shows the file), but it contains no symbols. When find_linespec_symbols is called in linespec_parse_basic, it calls find_function_symbols, which uses add_matching_symbols_to_info to collect all matching symbols. That function does [pardon any mangled formatting]: for (ix = 0; VEC_iterate (symtab_ptr, info->file_symtabs, ix, elt); ++ix) { if (elt == NULL) { iterate_over_all_matching_symtabs (info->state, name, VAR_DOMAIN, collect_symbols, info, pspace, 1); search_minsyms_for_name (info, name, pspace); } else if (pspace == NULL || pspace == SYMTAB_PSPACE (elt)) { /* Program spaces that are executing startup should have been filtered out earlier. */ gdb_assert (!SYMTAB_PSPACE (elt)->executing_startup); set_current_program_space (SYMTAB_PSPACE (elt)); iterate_over_file_blocks (elt, name, VAR_DOMAIN, collect_symbols, info); } } This iterates over the symtabs. In the failing use case, ELT is non-NULL (points to the symtab for the .s file), so it calls iterate_over_file_blocks. Herein is where the problem exists: it is assumed that if NAME exists, it must exist in the given symtab -- a reasonable assumption for "normal" (non-asm) cases. It never searches minimal symbols (or in the global default symtab). This patch fixes the problem by doing so. It is important to note that iterating over minsyms is fairly expensive, so this patch only adds that extra search if the language is language_asm and iterate_over_file_blocks returns no symbols. gdb/ChangeLog: 2014-12-20 Keith Seitz <keiths@redhat.com> Mihail-Marian Nistor <mihail.nistor@freescale.com> PR gdb/17394 * linespec.c (struct collect_minsyms): Add new member `symtab'. (add_minsym): Handle cases where info.symtab is non-NULL. (search_minsyms_for_name): Add new parameter `symtab'. Handle limiting searches to a specific symtab. (add_matching_symtabs_to_info): Search through minimal symbols for language_asm files for which no new symbols are found. gdb/testsuite/ChangeLog: 2014-12-20 Mihail-Marian Nistor <mihail.nistor@freescale.com> PR gdb/17394 * gdb.linespec/break-asm-file.c: New file. * gdb.linespec/break-asm-file.exp: New file. * gdb.linespec/break-asm-file0.s: New file. * gdb.linespec/break-asm-file1.s: New file.
Diffstat (limited to 'bfd')
0 files changed, 0 insertions, 0 deletions