This adds string_vprintf, a va_list variant of string_printf. This
will be used in later patches.
gdb/ChangeLog
2017-09-29 Tom Tromey <tom@tromey.com>
* unittests/common-utils-selftests.c (format): New function.
(string_vprintf_tests): New function.
(_initialize_common_utils_selftests): Register new tests.
* common/common-utils.c (string_vprintf): New function.
* common/common-utils.h (string_vprintf): Declare.
Same line but different file ought to display file and line.
PR 21978
* objdump.c: Formatting.
(show_line): Reset prev_line when function name changes.
This finally eliminates an old hack left in place when tracepoint RSP
support was migrated from tracepoint.c to remote.c, back in
35b1e5cca0 ("Make tracepoint operations go through target vector.")
over 7 years ago.
Tested on x86_64 GNU/Linux.
gdb/ChangeLog:
2017-09-29 Pedro Alves <palves@redhat.com>
* remote.c (target_buf, target_buf_size): Delete.
(remote_get_noisy_reply): Remove buf_p and sizeof_buf parameters.
Use the connection's packet buffer instead.
All callers adjusted.
(_initialize_remote): Remove references to target_buf and
target_buf_size.
If we had this in place before, then the regression fixed by the
previous commit would have been been visible is all test runs. E.g.:
Running src/gdb/testsuite/gdb.threads/multi-create-ns-info-thr.exp ...
FAIL: gdb.threads/multi-create-ns-info-thr.exp: continue to breakpoint 6
Debugging manually we'd see this:
gdbserver: Cannot get thread handle for LWP 1467: generic error
Instead of:
gdbserver: PID mismatch! Expected 27472, got 27471
which is misleading - gdbserver didn't 27471, that was stale stack
data from previous function invocations.
gdb/gdbserver/ChangeLog:
2017-09-29 Pedro Alves <palves@redhat.com>
* proc-service.c (ps_pdread): Return PS_ERR if reading memory
fails.
Commit 8629910955 ("Add thread_db_notice_clone to gdbserver")
introduced calls into libthread_db without making sure that the
current thread is pointing to a know-stopped thread. This resulted in
sometimes thread_db_notice_clone failing->find_one_thread failing like
this, as seen when running gdb.threads/multi-create-ns-info-thr.exp:
~~~
Thread <6> executing
Thread <7> executing
gdbserver: PID mismatch! Expected 27472, got 27471
gdbserver: Cannot find thread after clone.
Thread <1000> executing
Thread <1001> executing
~~~
Things go south from here and sometimes that ends up resulting in
gdbserver crashing and the test failing.
gdb/gdbserver/ChangeLog:
2017-09-29 Pedro Alves <palves@redhat.com>
* linux-low.c (handle_extended_wait): Pass parent thread instead
of process to thread_db_notice_clone.
* linux-low.h (thread_db_notice_clone): Replace parent process
parameter with parent thread parameter.
* thread-db.c (find_one_thread): Add comment.
(thread_db_notice_clone): Replace parent process parameter with
parent thread parameter. Temporarily switch to the parent thread.
I was looking at Debian bug #874674 again today, and think I might
have spotted the problem. It appears that merge.c tries to cope with
memory allocation failures in some circumstances, but doesn't quite
manage to get everything right. This patch will make ld report memory
allocation failures instead of silently not merging strings.
* merge.c (merge_strings): Return FALSE on malloc failure.
(_bfd_merge_sections): Return failures from record_section and
merge_strings.
This file was only under gdb/ currently because it predates the
gdb/unittests/ directory.
gdb/ChangeLog:
2017-09-28 Pedro Alves <palves@redhat.com>
* Makefile.in (SUBDIR_UNITTESTS_SRCS): Add
unittests/common-utils-selftests.c.
(SUBDIR_UNITTESTS_OBS): Add common-utils-selftests.o.
(COMMON_OBS): Remove utils-selftests.o.
* utils-selftests.c: Move to ...
* unittests/common-utils-selftests.c: ... here and rename self
test to "string_printf".
This is a "tiny patch", no assignment required.
2017-09-28 Alexander Shaposhnikov <alexander.v.shaposhnikov@gmail.com>
* dwarf2read.c (open_and_init_dwp_file): Protect against dwp_file
having NULL cus or tus.
I am applying a patch that has been lying around in the Fedora
binutils sources for a while. It skips the PR14918 linker test for
ARM based targets. This test checks that libgcc is not included in a
link of an empty executable. This works for most targets, but on the
ARM the crt1.o startup code calls __libc_csu_init which is in
/usr/lib/libc_nonshared.a(elf-init.oS). This in turn needs
__aeabi_unwind_cpp_pr0@@GCC_3.5 which is provided by libgcc_s.so.1,
and so the test fails.
non_ir_ref_dynamic wasn't being set in the case where we have a
versioned dynamic symbol definition with a non-versioned matching IR
symbol.
bfd/
PR 22220
* elflink.c (_bfd_elf_merge_symbol): Set non_ir_ref_dynamic in
a case where plugin_notice isn't called.
ld/
* testsuite/ld-plugin/pr22220.h,
* testsuite/ld-plugin/pr22220lib.cc,
* testsuite/ld-plugin/pr22220lib.ver,
* testsuite/ld-plugin/pr22220main.cc: New test.
* testsuite/ld-plugin/lto.exp: Run it.
Many tdep files need to perform conversions between two floating-point
types, usually when accessing FP registers. Most targets now use the
convert_typed_floating helper routine to do so. However, a small number
still use the old method of converting via a DOUBLEST. Since we want
to get rid of DOUBLEST, these targets need to be moved to the new
method as well.
The main obstacle is that for convert_typed_floating we need an actual
*type*, not just a floatformat.
In arm-tdep.c, this is very straightforward, since there is already a
type using the ARM extended floatformat.
For sh-tdep.c and sh64-tdep.c, no such type already exists, so I've
added one to the gdbarch_tdep struct as done on other targets.
gdb/ChangeLog
2017-09-27 Ulrich Weigand <uweigand@de.ibm.com>
* arm-tdep.c: (convert_from_extended): Remove.
(convert_to_extended): Likewise.
(arm_extract_return_value): Use convert_typed_floating.
(arm_store_return_value): Likewise.
* sh-tdep.h (struct gdbarch_tdep): Add sh_littlebyte_bigword_type.
* sh-tdep.c: Do not include "floatformat.h".
(sh_littlebyte_bigword_type): New function.
(sh_register_convert_to_virtual): Use convert_typed_floating.
(sh_register_convert_to_raw): Likewise.
* sh64-tdep.c: (struct gdbarch_tdep): Add sh_littlebyte_bigword_type.
(sh64_littlebyte_bigword_type): New function.
(sh64_extract_return_value): Use convert_typed_floating.
(sh64_register_convert_to_virtual): Likewise.
(sh64_register_convert_to_raw): Likewise.
For historical reasons, the TYPE_FLOATFORMAT element is still set to hold
an array of two floatformat structs, one for big-endian and the other for
little-endian. When accessing the element via floatformat_from_type,
the code would check the type's byte order and return the appropriate
floatformat.
However, these days this is quite unnecessary, since the type's byte order
is already known at the time the type is allocated and the floatformat is
installed into TYPE_FLOATFORMAT. Therefore, we can just install the correct
version here.
Also, moves the (now trivially simple) floatformat_from_type accessor to
gdbtypes.{c,h}, since it doesn't really need to be in doublest.c now.
gdb/ChangeLog
2017-09-27 Ulrich Weigand <uweigand@de.ibm.com>
* doublest.h (floatformat_from_type): Move to gdbtypes.h.
* doublest.c (floatformat_from_type): Move to gdbtypes.c.
* gdbtypes.h (union type_specific): Make field floatformat hold
just a single struct floatformat, not an array.
(floatformat_from_type): Move here.
* gdbtypes.c (floatformat_from_type): Move here. Update to
changed TYPE_FLOATFORMAT definition.
(verify_floatformat): Update to changed TYPE_FLOATFORMAT.
(recursive_dump_type): Likewise.
(init_float_type): Install correct floatformat for byte order.
(arch_float_type): Likewise.
This changes the interfaces to init_type and arch_type to take the
type length in bits as input (instead of as bytes). The routines
assert that the length is a multiple of TARGET_CHAR_BIT.
For consistency, arch_flags_type is changed likewise, so that now
all type creation interfaces always use length in bits.
All callers are updated in the straightforward manner.
The assert actually found a bug in read_range_type, where the
init_integer_type routine was called with a wrong argument (probably
a bug introduced with the conversion to use init_integer_type).
gdb/ChangeLog
2017-09-27 Ulrich Weigand <uweigand@de.ibm.com>
* gdbtypes.c (init_type): Change incoming argument from
length-in-bytes to length-in-bits. Assert length is a
multiple of TARGET_CHAR_BITS.
(arch_type, arch_flags_type): Likewise.
(init_integer_type): Update call to init_type.
(init_character_type): Likewise.
(init_boolean_type): Likewise.
(init_float_type): Likewise.
(init_decfloat_type): Likewise.
(init_complex_type): Likewise.
(init_pointer_type): Likewise.
(objfile_type): Likewise.
(arch_integer_type): Update call to arch_type.
(arch_character_type): Likewise.
(arch_boolean_type): Likewise.
(arch_float_type): Likewise.
(arch_decfloat_type): Likewise.
(arch_complex_type): Likewise.
(arch_pointer_type): Likewise.
(gdbtypes_post_init): Likewise.
* dwarf2read.c (dwarf2_init_float_type): Update call to init_type.
(read_base_type): Likewise.
* mdebugread.c (basic_type): Likewise.
* stabsread.c (dbx_init_float_type): Likewise.
(rs6000_builtin_type): Likewise.
(read_range_type): Likewise. Also, fix call to init_integer_type
with erroneous length argument.
* ada-lang.c (ada_language_arch_info): Update call to arch_type.
* d-lang.c (build_d_types): Likewise.
* f-lang.c (build_fortran_types): Likewise.
* go-lang.c (build_go_types): Likewise.
* opencl-lang.c (build_opencl_types): Likewise.
* jit.c (finalize_symtab): Likewise.
* gnu-v3-abi.c (build_gdb_vtable_type): Likewise.
(build_std_type_info_type): Likewise.
* target-descriptions.c (tdesc_gdb_type): Likewise. Also,
update call to arch_flags_type.
* linux-tdep.c (linux_get_siginfo_type_with_fields): Update call to
arch_type.
* fbsd-tdep.c (fbsd_get_siginfo_type): Likewise.
* windows-tdep.c (windows_get_tlb_type): Likewise.
* avr-tdep.c (avr_gdbarch_init): Update call to arch_type.
* ft32-tdep.c (ft32_gdbarch_init): Likewise.
* m32c-tdep.c (make_types): Likewise.
* rl78-tdep.c (rl78_gdbarch_init): Likewise.
(rl78_psw_type): Update call to arch_flags_type.
* m68k-tdep.c (m68k_ps_type): Update call to arch_flags_type.
* rx-tdep.c (rx_psw_type): Likewise.
(rx_fpsw_type): Likewise.
* sparc-tdep.c (sparc_psr_type): Likewise.
(sparc_fsr_type): Likewise.
* sparc64-tdep.c (sparc64_pstate_type): Likewise.
(sparc64_ccr_type): Likewise.
(sparc64_fsr_type): Likewise.
(sparc64_fprs_type): Likewise.
PR 22179
opcodes * riscv-opc.c (riscv_opcodes): Add fmv.x.w and fmv.w.x as the new
names for the fmv.x.s and fmv.s.x instructions respectively.
gas * testsuite/gas/riscv/fmv.x.s: New file: Tests the support for the
renamed fmv.x.s and fmv.s.x instructions.
* testsuite/gas/riscv/fmv.x.d: New file: Test driver.
This also makes delete_command static; but now I wonder if it is used
in Insight and should not be touched.
gdb/ChangeLog
2017-09-27 Tom Tromey <tom@tromey.com>
* breakpoint.h (delete_command): Don't declare.
* breakpoint.c (delete_command, enable_once_command)
(enable_count_command, enable_delete_command, breakpoint_1)
(maintenance_info_breakpoints, stopin_command, stopat_command)
(delete_command, delete_trace_command, save_breakpoints)
(save_breakpoints_command, save_tracepoints_command): Constify.
Note that this commit also changes deprecated_file_changed_hook -- not
used in the tree, but Insight will require a (presumably minor)
change.
gdb/ChangeLog
2017-09-27 Tom Tromey <tom@tromey.com>
* symfile.c (symbol_file_command): Constify.
* gdbcore.h (deprecated_file_changed_hook): Constify.
* exec.c (deprecated_file_changed_hook, exec_file_command)
(file_command): Constify.
* defs.h (symbol_file_command): Constify.
In addition to the constification, this fixes a command-repeat bug.
gdb/ChangeLog
2017-09-27 Tom Tromey <tom@tromey.com>
* tracepoint.c (delete_trace_variable_command)
(tfind_end_command, tfind_start_command, tfind_pc_command)
(tfind_tracepoint_command, tfind_line_command)
(tfind_range_command, tfind_outside_command): Constify.