* symfile.c (objfilep): New typedef and new DEF_VEC_P.
(reread_symbols): Remove variable reread_one, new variables
new_objfiles, all_cleanups and ix. Use new_objfiles instead of
reread_one. Push changed objfiles to new_objfiles, call
observer_notify_new_objfile for them later.
We are iterating over all symbols in a partial symtab that would
match a given name, so we should match the partial symbols
search name against the given name rather than using the natural
name. In C++, that does not make a difference, but it does in
Ada, because Ada searches using the symbol encoded name...
We also update the generation of the .gdb_index file to match this
change in the search. Although technically an incompatible change,
we do not increment the gdb_index version number, because Ada is
the only language where it would make a difference - except that
this feature is not supported for Ada.
gdb/ChangeLog:
* psymtab.c (expand_symtabs_matching_via_partial): Match
the partial symbols using their SYMBOL_SEARCH_NAME.
* symfile.h (struct quick_symbol_functions): Udate the
documentation of expand_symtabs_matching.
* dwarf2read.c (write_psymbols): Use SYMBOL_SEARCH_NAME instead
of SYMBOL_NATURAL_NAME in index entry.
This patch enhances the linespec parser to recognize unqualified
operator names in linespecs. This allows the user to insert a breakpoint
on operator "+" as follow, for instance:
(gdb) break "+"
Previously, it was possible to insert such a breakpoint, but one
had to fully qualify the function name. For instance:
(gdb) break ops."+"
gdb/ChangeLog:
* linespec.c (locate_first_half): Add handling of Ada operators
when the current language is Ada.
This fixes a problem where the debugger is trying to locate a minimal
symbol from its address, when the symbol is inside a section whose
VMA is different from its LMA.
We have a program that was built on ppc-elf using a linker script
such that data sections are placed in ROM, and then loaded onto RAM
at execution. So their VMA addresses are indeed different from
their LMA address.
Unfortunately, there is one place where GDB gets slightly confused
into thinking that these data sections are overlayed, while it's
not the case here. This show up when trying to print the list of
Ada tasks, where GDB is unable to determine their names, and thus
prints a generic `Ravenscar task' instead:
(gdb) info tasks
ID TID P-ID Pri State Name
1 1d580 127 Delay Sleep Ravenscar task
2 183f8 127 Delay Sleep Ravenscar task
* 3 13268 127 Runnable Ravenscar task
We expected:
(gdb) info tasks
ID TID P-ID Pri State Name
1 1d580 127 Delay Sleep environment_task
2 183f8 127 Delay Sleep raven2
* 3 13268 127 Runnable raven1
The name of the task is determined by looking up the symbol table
using the task ID, which is the address where the symbol is defined.
So, ada-tasks calls...
msym = lookup_minimal_symbol_by_pc (task_id);
... which in turn first tries to determine the section associated
to this address (find_pc_section), which itself uses a map of sections
to find it. The map itself is recomputed every time objfiles are
loaded/changed by `update_section_map'. And `update_section_map'
relies on `insert_section_p' to determine whether the section should
be inserted in the map or not.
This is where things get interesting for us, because `insert_section_p'
simply rejects overlay sections:
if (lma != 0 && lma != bfd_section_vma (abfd, section)
&& (bfd_get_file_flags (abfd) & BFD_IN_MEMORY) == 0)
/* This is an overlay section. IN_MEMORY check is needed to avoid
discarding sections from the "system supplied DSO" (aka vdso)
on some Linux systems (e.g. Fedora 11). */
return 0;
However, it shouldn't reject our section in this case, since overlay
debugging is off. The fix is to add a check that overlay debugging
is active before rejecting the section. This is similar to what is
done in `section_is_overlay' (which takes obj_section objects), for
instance.
gdb/Changelog:
* objfiles.c (insert_section_p): Do not detect overlay sections
if overlay debugging is off.
Consider the following declaration:
package Pck is
task Dummy_Task is
entry Start;
end Dummy_Task;
end Pck;
Inserting a breakpoint on the body of that task does not currently
work:
(gdb) b pck.dummy_task
"pck.dummy_task" is not a function
Make breakpoint pending on future shared library load? (y or [n]) n
What happens here is that the compiler generates two symbols:
(a) Symbol `pck__dummy_task' which is a *variable* referencing
the task;
(b) Symbol `pck__dummy_taskTKB' which is the subprogram implementing
the body of the task.
The symbol lookup only finds the variable before of the TKB suffix in
the subprogram name. This patch fixes the problem by adjusting the
ada-lang.c:is_name_suffix routine to recognize "TKB" suffixes. But
that's not enough, because the search in the symtab is performed via
the block dictionary, using a hashing algorithm. So, for the search
to find `pck__dummy_taskTKB', I had to modify the hashing function
to ignore TKB suffixes as well.
gdb/ChangeLog:
* ada-lang.c (is_name_suffix): Add handling of "TKB" suffixes.
Update function documentation.
* dictionary.c (dict_hash): Ignore "TKB" suffixes in hash
computation.
gdb/testsuite/ChangeLog:
* gdb.ada/task_bp: New testcase.
Jan Kratochvil <jan.kratochvil@redhat.com>
* linux-nat.c (add_lwp): Don't call linux_nat_new_thread on the
first LWP.
* amd64-linux-nat.c (update_debug_registers_callback): Instantiate
`lwp->arch_private' if NULL.
(amd64_linux_prepare_to_resume): Do nothing if `lwp->arch_private'
is NULL.
* i386-linux-nat.c (update_debug_registers_callback): Instantiate
`lwp->arch_private' if NULL.
(i386_linux_prepare_to_resume): Do nothing if `lwp->arch_private'
is NULL.
* symfile.c (reread_symbols): Move free_objfile_separate_debug,
preserve_values, sym_finish and clear_objfile_data calls before BFD
close. Move free_objfile_separate_debug as the very first call. New
comment on the ordering.
gdb/testsuite/
* gdb.base/reread.exp: If srcfile2 fails to build retry it with
-DNO_SECTIONS.
* gdb.base/reread2.c <!NO_SECTIONS>: New sections block.
* gdb.cp/ptype-cv-cp.exp (ptype v_volatile_const_my_int): Make
PR gcc/45997 XFAIL conditional for gcc <= 4.5.
* gdb.python/py-type.exp (python print ttype.template_argument(2)):
Change PR gcc/41736 to the more specific PR gcc/46955. Make it
conditional for gcc <= 4.5.
* gdbint.texinfo (Testsuite): Describe KFAIL and XFAIL in Writing
tests.
gdb/testsuite/
* gdb.cp/ptype-cv-cp.exp (ptype v_volatile_const_my_int): Replace KFAIL
by XFAIL.
* gdb.cp/static-method.exp (info addr A::func())
(list static-method.cc:xxx::(anonymous namespace)::A::func)
(list 'static-method.cc:xxx::(anonymous namespace)::A::func')
(list 'static-method.cc':'xxx::(anonymous namespace)::A::func')
(list static-method.cc:'xxx::(anonymous namespace)::A::func'): Likewise.
* gdb.cp/temargs.exp (test value of F in k2_m, test type of F in k3_m)
(test value of F in k3_m): Likewise.
* gdb.python/py-type.exp (python print ttype.template_argument(2)):
Likewise.
Comment says it all:
/* On ia64-hpux, we have discovered that the system linker
adds undefined symbols with nonzero addresses that cannot
be right (their address points inside the code of another
function in the .text section). This creates problems
when trying to determine which symbol corresponds to
a given address.
We try to detect those buggy symbols by checking which
section we think they correspond to. Normally, PLT symbols
are stored inside their own section, and the typical name
for that section is ".plt". So, if there is a ".plt"
section, and yet the section name of our symbol does not
start with ".plt", we ignore that symbol. */
gdb/ChangeLog:
* elfread.c (elf_symtab_read): Ignore undefined symbols with
nonzero addresses if they do not correspond to a .plt section
when one is available in the objfile.
* linux-low.c (linux_create_inferior): Put empty if clause for write.
Revert:
2011-12-18 Hui Zhu <teawater@gmail.com>
* linux-low.c (linux_create_inferior): Save return value to ret.
regset_from_core_section.
(amd64obsd_core_init_abi): New function that sets
regset_from_core_section.
(_initialize_amd64obsd_tdep): Use amd64obsd_core_init_abi for
traditional core dumps.