2012-06-06 Pedro Alves <palves@redhat.com>
* infrun.c (struct execution_control_state): Remove
`new_thread_event' field.
(handle_inferior_event): Simplify new threads handling; don't
resume the inferior if we find a new thread.
gdb/testsuite/
2012-06-06 Pedro Alves <palves@redhat.com>
* gdb.threads/clone-new-thread-event.c: New file.
* gdb.threads/clone-new-thread-event.exp: New file.
* elflink.c (elf_link_input_bfd): Provide a file symbol for
each input file with local syms, if the input lacks such.
(bfd_elf_final_link): Add a file symbol to mark end of locals
for which we can associate with input files.
(struct elf_final_link_info): Add filesym_count field.
(struct elf_outext_info): Add need_second_pass and second_pass.
(elf_link_output_extsym): Detect symbols defined in the output
file, emit them on second pass over locals.
ld/testsuite/
Update to suit added STT_FILE symbols.
* gdb.base/dprintf.c (main): Add extra parameter when calling
printf and fprintf.
(bar): New function. It is a dead function, but to ensure
'malloc' is linked explicitly.
* symfile-mem.c: Change gdb_static_assert to ssize_t.
(target_read_memory_bfd): Cast gdb_assert LEN to ssize_t.
* target.c (target_read_memory): Change LEN to ssize_t.
* target.h (target_read_memory): Change LEN to ssize_t.
This patch sets the windows target to use their own version of
the iterate_over_objfiles_in_search_order gdbarch method, in
order to make global symbol searches sensitive to the current
objfile.
gdb/ChangeLog:
* windows-tdep.h (windows_iterate_over_objfiles_in_search_order):
Add declaration.
* windows-tdep.c: #include "objfiles.h".
(windows_iterate_over_objfiles_in_search_order): New function.
* amd64-windows-tdep.c (amd64_windows_init_abi): Set
iterate_over_objfiles_in_search_order gdbarch method to
windows_iterate_over_objfiles_in_search_order.
* i386-cygwin-tdep.c (i386_cygwin_init_abi): Likewise.
This patch introduces the "iterate_over_objfiles_in_search_order"
gdbarch method, as well as its default implementation, and converts
the areas where it will matter to using this gdbarch method.
The default method implementation is the only one installed, and
the changes should have no functional impact in terms of behavior.
This only paves the way for the architectures that will need their
own version.
gdb/ChangeLog:
* gdbarch.sh: Add generation of
"iterate_over_objfiles_in_search_order_cb_ftype" typedef in
gdbarch.h. Add include of "objfiles.h" in gdbarch.c.
(iterate_over_objfiles_in_search_order): New gdbarch method.
* gdbarch.h, gdbarch.c: Regenerate.
* objfiles.h (default_iterate_over_objfiles_in_search_order):
Add declaration.
* objfiles.c (default_iterate_over_objfiles_in_search_order):
New function.
* symtab.c (lookup_symbol_aux_objfile): New function, extracted
out of lookup_symbol_aux_symtabs.
(lookup_symbol_aux_symtabs): Replace extracted-out code by
call to lookup_symbol_aux_objfile.
(struct global_sym_lookup_data): New type.
(lookup_symbol_global_iterator_cb): New function.
(lookup_symbol_global): Search for symbol using
gdbarch_iterate_over_objfiles_in_search_order and
lookup_symbol_global_iterator_cb.
* findvar.c (struct minsym_lookup_data): New type.
(minsym_lookup_iterator_cb): New function.
(default_read_var_value) [case LOC_UNRESOLVED]: Resolve the
symbol's address via gdbarch_iterate_over_objfiles_in_search_order
and minsym_lookup_iterator_cb.
The search order used in this patch breaks global symbol lookups
for certain symbols when copy-relocation is used. A slightly different
search order will be implemented later.
gdb/ChangeLog:
Revert the following patch:
* findvar.c (default_read_var_value): For LOC_UNRESOLVED symbols,
try locating the symbol in the symbol's own objfile first, before
extending the search to all objfiles.
* symtab.c (lookup_symbol_aux_objfile): New function, extracted
out of lookup_symbol_aux_symtabs.
(lookup_symbol_aux_symtabs): Add new parameter "exclude_objfile".
Replace extracted-out code by call to lookup_symbol_aux_objfile.
Do not search EXCLUDE_OBJFILE.
(lookup_static_symbol_aux): Update call to lookup_symbol_aux_symtabs.
(lookup_symbol_global): Search for matches in the block's objfile
first, before searching all other objfiles.
This patch adjusts the testing strategy used in a couple of testcases
where we are trying to print the value of a global variable defined
at multiple locations. The problem is that the actual value depends
on the platform. So instead of hard-coding the expected value in
the testcase script, we use local variables (in the inferior) holding
the correct value, and we compare the global variable's value with
the local variable's value.
gdb/testsuite/ChangeLog:
* gdb.base/ctxobj-f.c (GET_VERSION): Introduce local variable
and add comment.
* gdb.base/ctxobj-m.c (main): Rewrite, and add comment.
* gdb.base/ctxobj.exp: Insert breakpoint in ctxobj-f.c using
"STOP" marker. Adjust testing strategy to make it work on
all targets.
* gdb.base/print-file-var-main.c (main): Rewrite using local
variables and adjust get_version_2's return value check.
Add small comment.
* gdb.base/print-file-var.exp: Insert breakpoint using "STOP"
marker. Adjust testing strategy to make it work on all targets.
With an Ada program, trying to break on a specific Ada task, but
with the wrong capitalization of the `task' keyword, we currently
get only pieces of the "garbage" that caused the error:
(gdb) b *rendez_vous'address TASK 2
Garbage 2 at end of command
Pushing this a little further:
(gdb) b *rendez_vous'address TASK Task TaSK 2
Garbage 2 at end of command
Another interesting failure mode:
(gdb) b *rendez_vous'address TASK if
Argument required (expression to compute).
The parser skipped `TASK', then found the `if' keyword, and thus
started looking for a condition.
This patch fixes the problem by aborting the parsing as soon as
an invalid keyword is found. This makes it consistent with the
case where the REST parameter is passed as NULL (where an error
is raised immediately after seeing the first invalid keyword).
It also introduces a new testcase that reproduces all above scenarios.
gdb/ChangeLog:
* breakpoint.c (find_condition_and_thread): Stop parsing
as soon as the first invalid keyword is found.
gdb/testsuite/ChangeLog:
* gdb.ada/bad-task-bp-keyword: New testcase.
Normally, all files should have a copyright header, but gdb/CONTRIBUTE
currently doesn't, and it adding one at the top of the file would
probably be more pollution than information. So don't require
a copyright header for now.
gdb/ChangeLog:
* copyright.py (EXCLUDE_LIST): Add 'gdb/CONTRIBUTE' to list.
There is an extra coma after the copyright year which tricks
gnulib's update-copyright script.
gdb/stubs/ChangeLog:
* ia64vms-stub.c: Adjust copyright header to follow convention
expected by gnulib's update-copyright script.
The location where we store the gnulib import has changed.
This patch updates accordingly the path to gnulib's update-copyright
script.
gdb/ChangeLog:
* copyright.py (update_files, main): Fix path to update-copyright
script.
gdb/ChangeLog:
* copyright.py (MULTIPLE_COPYRIGHT_HEADERS): New constant.
(main): Add MULTIPLE_COPYRIGHT_HEADERS to the list of files
for which a reminder to update by hand is printed.
* bfd-in.h (bfd_elf_bfd_from_remote_memory): Make LEN argument
of target_read_memory as bfd_size_type.
* bfd-in2.h: Regenerate.
* elf-bfd.h (elf_backend_bfd_from_remote_memory): Make LEN
argument of target_read_memory as bfd_size_type.
(_bfd_elf32_bfd_from_remote_memory): Likewise.
(_bfd_elf64_bfd_from_remote_memory): Likewise.
* elf.c (bfd_elf_bfd_from_remote_memory): Likewise.
* elfcode.h (NAME(_bfd_elf,bfd_from_remote_memory)): Likewise.
gdb/
* symfile-mem.c: 3 new gdb_static_assert for target_read_memory_bfd
parameters.
(target_read_memory_bfd): New function.
(symbol_file_add_from_memory): Use it.
* gdb.base/code_elim.exp (add-symbol-file ${testfile1} 0x100000):
Simplify it to ...
(symbol-file ${testfile1}): ... here.
(test eliminated var my_global_symbol)
(test eliminated var my_static_symbol)
(test eliminated var my_global_func, get address of main): Wrap them to
'single psymtabs' and 'single symtabs'
(get address of my_global_symbol, get address of my_static_symbol)
(get address of my_global_func, get address of main): Wrap them to
'order1' and 'order2'.
* elf.c (elf_find_function): Cache last function sym info.
(_bfd_elf_maybe_function_sym): Return function size, pass in
section of interest.
* elf-bfd.h (struct elf_backend_data <maybe_function_sym>): Likewise.
(_bfd_elf_maybe_function_sym): Likewise.
* elf64-ppc.c (ppc64_elf_maybe_function_sym): Likewise.
(opd_entry_value): Add in_code_sec param. Revert caching code.
Return -1 if in_code_sec and function found in wrong section.
Update all calls.