Thomas Preud'homme [Wed, 1 Nov 2017 09:49:13 +0000 (09:49 +0000)]
[ARM] Fix Coprocessor instructions availability
A few coprocessor instructions introduced in ARMv2 are currently
accepted by GAS when targeting ARMv1 due to a typo in the code. This
patch fixes the issue and introduce a more fine grained testing for
coprocessor instructions availability. Coprocessor instructions are
grouped as follows:
* ARM coprocessor instructions introduced in ARMv2
Includes: ldc, stc, mcr, mrc, cdp, ldcl, stcl
Guarded by: ARM_EXT_V2
Tests: copro-arm_v2plus-arm_v*.d
* ARM coprocessor instructions introduced in ARMv5
Includes: ldc2, ldc2l, stc2, stc2l, cdp2, mcr2, mrc2
Guarded by: ARM_EXT_V5
Tests: copro-arm_v5plus-arm_v*.d
* ARM coprocessor instructions introduced in ARMv5TE
Includes: mcrr, mrrc
Guarded by: ARM_EXT_V5E
Tests: copro-arm_v5teplus-arm_v*.d
* ARM coprocessor instructions introduced in ARMv6
Includes: mcrr2, mrrc2
Guarded by: ARM_EXT_V6
Tests: copro-arm_v6plus-arm_v*.d
* Thumb coprocessor instructions introduced in ARMv6T2
Includes: ldc, ldcl, stc, stcl, mcr, mrc, mcrr, mrrc, cdp, ldc2,
ldc2l, stc2, stc2l, cdp2, mcr2, mrc2, mcrr2, mrrc2
Guarded by: ARM_EXT_V6T2
Tests: copro-thumb_v6t2plus-thumb_v*.d
For each of these groups, at least 2 tests are performed:
* instructions are not available in earlier architecture
* instructions are available in architecture where they were introduced
More tests need to be performed when instructions in a group span
several assembly files.
Note that an instruction in the original coprocessor testcase is
changed to unified syntax to allow the testcase to be assembled for ARM
and Thumb state. Correct processing of legacy syntax is covered in other
testcases.
2017-11-01 Thomas Preud'homme <thomas.preudhomme@arm.com>
gas/
* config/tc-arm.c (arm_ext_v2): Define to ARM_EXT_V2 feature bit.
* testsuite/gas/arm/copro.s: Split into ...
* testsuite/gas/arm/copro-arm_v2plus-thumb_v6t2plus.s: This while
changing it to unified syntax and ...
* testsuite/gas/arm/copro-arm_v5plus-thumb_v6t2plus.s: this and ...
* testsuite/gas/arm/copro-arm_v5teplus-thumb_v6t2plus.s: This and ...
* testsuite/gas/arm/copro-arm_v6plus-thumb_v6t2plus.s: This.
* testsuite/gas/arm/copro.d: Split into ...
* testsuite/gas/arm/copro-arm_v2plus-arm_v2.d: This but target ARMv2
and ...
* testsuite/gas/arm/copro-arm_v5plus-arm_v5.d: this but target ARMv5
and ...
* testsuite/gas/arm/copro-arm_v5teplus-arm_v5te.d: This but target
ARMv5TE and ...
* testsuite/gas/arm/copro-arm_v6plus-arm_v6.d: This but target ARMv6.
* testsuite/gas/arm/copro-arm_v2plus-arm_v1.d: New testcase.
* testsuite/gas/arm/copro-thumb_v6t2plus-thumb_v4t-1.d: New testcase.
* testsuite/gas/arm/copro-arm_v2plus-thumb_v6t2plus-unavail.l: Expected
errors for the above two testcases.
* testsuite/gas/arm/copro-thumb_v6t2plus-thumb_v6t2-1.d: New testcase.
* testsuite/gas/arm/copro-arm_v5plus-arm_v4.d: New testcase.
* testsuite/gas/arm/copro-thumb_v6t2plus-thumb_v4t-2.d: New testcase.
* testsuite/gas/arm/copro-arm_v5plus-thumb_v6t2plus-unavail.l:
Expected errors for the above two testcases.
* testsuite/gas/arm/copro-thumb_v6t2plus-thumb_v6t2-2.d: New testcase.
* testsuite/gas/arm/copro-arm_v5teplus-arm_v5.d: New testcase.
* testsuite/gas/arm/copro-thumb_v6t2plus-thumb_v4t-3.d: New testcase.
* testsuite/gas/arm/copro-arm_v5teplus-thumb_v6t2plus-unavail.l:
Expected errors for the above two testcases.
* testsuite/gas/arm/copro-thumb_v6t2plus-thumb_v6t2-3.d: New testcase.
* testsuite/gas/arm/copro-arm_v6plus-arm_v5te.d: New testcase.
* testsuite/gas/arm/copro-thumb_v6t2plus-thumb_v4t-4.d: New testcase.
* testsuite/gas/arm/copro-arm_v6plus-thumb_v6t2plus-unavail.l:
Expected errors for the above two testcases.
* testsuite/gas/arm/copro-thumb_v6t2plus-thumb_v6t2-4.d: New testcase.
Alan Modra [Tue, 31 Oct 2017 11:43:21 +0000 (22:13 +1030)]
PR22374, PowerPC unnecessary PLT entries
We don't need a PLT entry when function pointer initialization in a
read/write section is the only reference to a given function symbol.
This patch prevents the unnecessary PLT entry, and ensures no dynamic
relocs are emitted when UNDEFWEAK_NO_DYNAMIC_RELOC says so.
bfd/
PR 22374
* elf32-ppc.c (ppc_elf_adjust_dynamic_symbol): Don't create a plt
entry when just a dynamic reloc can serve. Ensure no dynamic
relocations when UNDEFWEAK_NO_DYNAMIC_RELOC by setting non_got_ref.
Expand and move the non_got_ref comment.
* elf64-ppc.c (ppc64_elf_adjust_dynamic_symbol): Likewise.
ld/
* testsuite/ld-powerpc/ambiguousv2.d: Remove FIXME.
Alan Modra [Tue, 31 Oct 2017 00:43:30 +0000 (11:13 +1030)]
PR22374 testcase, function pointer references in .data
Function pointer references in .data ought to use a dynamic reloc.
There shouldn't be any need for a PLT entry and definitely no copy
reloc.
This test fails on quite a few targets, but isn't something that
anyone should worry about too much. It's really just a missed
optimization.
PR 22374
* testsuite/ld-elf/pr22374a.s,
* testsuite/ld-elf/pr22374b.s,
* testsuite/ld-elf/pr22374-1.r,
* testsuite/ld-elf/pr22374-2.r: New test.
* testsuite/ld-elf/elf.exp: Run it.
Alan Modra [Tue, 31 Oct 2017 07:49:21 +0000 (18:19 +1030)]
Tidy elf.exp
* testsuite/ld-elf/elf.exp: Merge some conditionals, a better
name than "shared library for next test", and use xfail arg
of run_ld_link_tests in a few places.
Simon Marchi [Wed, 1 Nov 2017 01:30:24 +0000 (21:30 -0400)]
Use console uiout when executing breakpoint commands
As reported here
https://sourceware.org/ml/gdb/2017-10/msg00020.html
the output of certain commands, like backtrace, doesn't appear anywhere
when it is run as a breakpoint command and when using MI.
The reason is that the current_uiout is set to the mi_ui_out while these
commands run, whereas we want the output as CLI output. Some commands
like "print" work, because they use printf_filtered (gdb_stdout, ...)
directly, bypassing the current ui_out.
The fix I did is to force setting the cli_uiout as the current_uiout
when calling execute_control_command. I am not sure if this is the
right way to fix the problem, comments about the approach would be
appreciated.
I enhanced gdb.mi/mi-break.exp to test the backtrace command.
Regtested on the buildbot.
gdb/ChangeLog:
* cli/cli-script.c (execute_control_command): Rename to ...
(execute_control_command_1): ... this.
(execute_control_command): New function.
gdb/testsuite/ChangeLog:
* gdb.mi/mi-break.exp (test_breakpoint_commands): Test backtrace
as a breakpoint command.
GDB Administrator [Wed, 1 Nov 2017 00:00:19 +0000 (00:00 +0000)]
Automatic date update in version.in
Simon Marchi [Tue, 31 Oct 2017 18:29:25 +0000 (14:29 -0400)]
tracepoint: Remove unnecessary const_cast
We are passing a const char * to a const char * parameter, the
const_cast is not necessary.
gdb/ChangeLog:
* tracepoint.c (tfind_command): Remove const_cast.
Nick Clifton [Tue, 31 Oct 2017 14:29:40 +0000 (14:29 +0000)]
Fix illegal memory access triggered when parsing a PE binary with a corrupt data dictionary.
PR 22373
* peicode.h (pe_bfd_read_buildid): Check for invalid size and data
offset values.
Nick Clifton [Tue, 31 Oct 2017 13:48:03 +0000 (13:48 +0000)]
Remind users to use the --use-dynamic command line option to dump dynamic relocations.
* readelf.c (process_relocs): Tell users if no static relocs were
found, but if they had added --use-dynamic to the command line
then relocs would have been displayed.
Mike Gulick [Tue, 31 Oct 2017 00:11:52 +0000 (20:11 -0400)]
gdb/Makefile.in: fix 'make tags' failure
'make tags' fails with the following error:
make[2]: Entering directory '/local-ssd/mgulick/gdb/git/binutils-gdb/gdb'
make[2]: *** No rule to make target 'gdb.h', needed by 'TAGS'. Stop.
make[2]: Leaving directory '/local-ssd/mgulick/gdb/git/binutils-gdb/gdb'
The file gdb/gdb.h was removed in commit
65630365f7d073430e62b4fe65f34dcdc0a4b05e.
gdb/ChangeLog:
2017-10-30 Mike Gulick <mgulick@mathworks.com>
* Makefile.in (HFILES_NO_SRCDIR): Remove reference to gdb.h.
GDB Administrator [Tue, 31 Oct 2017 00:00:40 +0000 (00:00 +0000)]
Automatic date update in version.in
Simon Marchi [Mon, 30 Oct 2017 18:27:30 +0000 (14:27 -0400)]
Introduce in_inclusive_range, fix -Wtautological-compare warnings
When compiling with clang or gcc 8, we see warnings like this:
/home/emaisin/src/binutils-gdb/gdb/arm-tdep.c:10013:13: error: comparison of 0 <= unsigned expression is always true [-Werror,-Wtautological-compare]
if (0 <= insn_op1 && 3 >= insn_op1)
~ ^ ~~~~~~~~
/home/emaisin/src/binutils-gdb/gdb/arm-tdep.c:11722:20: error: comparison of unsigned expression >= 0 is always true [-Werror,-Wtautological-compare]
else if (opB >= 0 && opB <= 2)
~~~ ^ ~
This is because an unsigned integer (opB in this case) will always be >=
0. It is still useful to keep both bounds of the range in the
expression, even if one is at the edge of the data type range. This
patch introduces a utility function in_inclusive_range that gets rid of
the warning while conveying that we are checking for a range.
Tested by rebuilding.
gdb/ChangeLog:
* common/common-utils.h (in_inclusive_range): New function.
* arm-tdep.c (arm_record_extension_space): Use
in_inclusive_range.
(thumb_record_ld_st_reg_offset): Use in_inclusive_range.
* cris-tdep.c (cris_spec_reg_applicable): Use
in_inclusive_range.
Pedro Alves [Mon, 30 Oct 2017 11:41:34 +0000 (11:41 +0000)]
remote.c, QCatchSyscalls: Build std::string instead of unique_xmalloc_ptr
Simplify the code a little bit using std::string + string_appendf.
gdb/ChangeLog:
2017-10-30 Pedro Alves <palves@redhat.com>
Simon Marchi <simon.marchi@ericsson.com>
* remote.c (remote_set_syscall_catchpoint): Build a std::string
instead of a gdb::unique_xmalloc_ptr, using string_appendf.
Pedro Alves [Mon, 30 Oct 2017 11:41:34 +0000 (11:41 +0000)]
Introduce string_appendf/string_vappendf
string_appendf is like string_printf, but instead of allocating a new
string, it appends to an existing string. This allows reusing a
std::string's memory buffer across several calls, for example.
gdb/ChangeLog:
2017-10-30 Pedro Alves <palves@redhat.com>
* common/common-utils.c (string_appendf, string_vappendf): New
functions.
* common/common-utils.h (string_appendf, string_vappendf): New
declarations.
* unittests/common-utils-selftests.c (string_appendf_func)
(test_appendf_func, string_vappendf_wrapper, string_appendf_tests)
(string_vappendf_tests): New functions.
(_initialize_common_utils_selftests): Register "string_appendf" and
"string_vappendf tests".
Pedro Alves [Mon, 30 Oct 2017 11:41:34 +0000 (11:41 +0000)]
Merge/shared string_printf and string_vprintf unit tests
Merge the string_printf and string_vprintf tests, running them all
against both functions.
gdb/ChangeLog:
2017-10-30 Pedro Alves <palves@redhat.com>
* unittests/common-utils-selftests.c (format_func): New typedef.
(string_printf_tests, string_vprintf_tests): Tests factored out
and merged to ...
(test_format_func): ... this new function.
(string_printf_tests, string_vprintf_tests): Reimplement on top of
test_format_func.
Simon Marchi [Mon, 30 Oct 2017 02:37:11 +0000 (22:37 -0400)]
darwin-nat: Remove gdb.h include
gdb.h has been removed in
Eliminate catch_exceptions/catch_exceptions_with_msg
65630365f7d073430e62b4fe65f34dcdc0a4b05e
Remove the include in darwin-nat.c. Tested by rebuilding.
gdb/ChangeLog:
* darwin-nat.c: Remove include of gdb.h.
Alan Modra [Mon, 30 Oct 2017 01:32:42 +0000 (12:02 +1030)]
frv-elf --gc-sections failures
git commit
81742b83e9 exposed an frv-elf bug, with the object id not
matching the hash table id.
* elf32-frv.c (ELF_TARGET_ID): Don't define for generic
elf target.
Alan Modra [Sun, 29 Oct 2017 23:50:29 +0000 (10:20 +1030)]
relocs_compatible test for gc-sections
I noticed when looking at pr22300 that before calling check_relocs we
have an elf_object_id test (added for pr11933) as well as the
relocs_compatible test. I believe backend gc_mark_hook and
gc_sweep_hook ought to be protected similarly from being confused by
unexpected relocations (for example, both elf64-ppc.c and elf32-ppc.c
use _bfd_elf_relocs_compatible, so I think it would be possible for
the ppc64 gc_mark_hook to be presented with a ppc32 relocatable
object).
* elflink.c (elf_gc_sweep): Test elf_object_id in addition to
relocs_compatible.
(bfd_elf_gc_sections): Likewise.
Alan Modra [Fri, 27 Oct 2017 04:34:25 +0000 (15:04 +1030)]
Fix hppa-linux pr22269-1 fail
Adds UNDEFWEAK_NO_DYNAMIC_RELOC in the rest of places needed in this
file, reduces dynamic relocations in a number of cases, and removes
some bogus code that was attempting to handle dynamic common symbols
specially.
PR 22269
* elf32-hppa.c (elf32_hppa_check_relocs): Move SEC_ALLOC test to
ensure non_got_ref is not set due to debug references.
(elf32_hppa_adjust_dynamic_symbol): Tidy plabel handling. Use
SYMBOL_CALLS_LOCAL and UNDEFWEAK_NO_DYNAMIC_RELOC when determining
need for a plt entry.
(allocate_dynrelocs): Similarly for got entries. Tidy code discarding
dynamic relocs when pic. Remove bogus code attempting to handle
commons.
(elf32_hppa_relocate_section): Similarly. Delete resolved_to_zero
and simplify.
(elf32_hppa_finish_dynamic_symbol): Use UNDEFWEAK_NO_DYNAMIC_RELOC
and SYMBOL_REFERENCES_LOCAL in GOT handling.
GDB Administrator [Mon, 30 Oct 2017 00:00:32 +0000 (00:00 +0000)]
Automatic date update in version.in
Simon Marchi [Sun, 29 Oct 2017 17:01:19 +0000 (13:01 -0400)]
xtensa-xtregs: Fix formatting issues
Fix a few formatting issues in that file.
gdb/ChangeLog:
* xtensa-xtregs.c: Fix formatting issues.
Simon Marchi [Sun, 29 Oct 2017 05:13:33 +0000 (01:13 -0400)]
xtensa-xtregs: Constify field
Fix:
In file included from /home/emaisin/src/binutils-gdb/gdb/xtensa-linux-nat.c:46:0:
/home/emaisin/src/binutils-gdb/gdb/xtensa-xtregs.c:37:1: error: ISO C++ forbids converting a string constant to 'char*' [-Werror=write-strings]
};
^
gdb/ChangeLog:
* xtensa-xtregs.c (xtensa_regtable_t) <name>: Constify.
GDB Administrator [Sun, 29 Oct 2017 00:00:25 +0000 (00:00 +0000)]
Automatic date update in version.in
Maksim Dzabraev [Sat, 28 Oct 2017 18:14:34 +0000 (01:14 +0700)]
Make gdb.selected_thread().inferior return a new reference
thpy_get_inferior function should return a new reference to the
existing inferior object, and therefore should increment its refcount.
Fixed bug looks like this.
If multiple time call gdb.selected_thread ().inferior, gdb throws exception:
(gdb) pi gdb.selected_thread().inferior
<gdb.Inferior object at 0x7f1952bea698>
(gdb) pi gdb.selected_thread().inferior
Python Exception <type 'exceptions.AttributeError'> 'NoneType' object
has no attribute 'inferior':
Error while executing Python code.
(gdb) info threads
Id Target Id Frame
* 1 Thread 0x7f54f0474740 (LWP 584) "mc" 0x00007f54ef055c33 in
Alan Modra [Sat, 28 Oct 2017 11:01:16 +0000 (21:31 +1030)]
PR22361 readelf buffer overflow on fuzzed archive header
PR 22361
* readelf.c (process_archive_index_and_symbols): Ensure ar_size
field is zero terminated for strtoul.
(setup_archive, get_archive_member_name): Likewise.
Alan Modra [Sat, 28 Oct 2017 03:40:55 +0000 (14:10 +1030)]
PR22300, Abort in elf32_hppa_relocate_section building polyml
polyml produces object files with the wrong OS/ABI for hppa-linux.
This, along with the fact that elf32-hppa.c is using the strictest
backend relocs_compatible, results in wrong merging of ELF symbols.
So, remove the relocs_compatible check in _bfd_elf_merge_symbol.
_bfd_elf_merge_symbol is only called nowadays from within blocks
protected by is_elf_hash_table, so "we are doing an ELF link" as the
removed comment says, is true.
Also relax relocs_compatible for hppa and powerpc. relocs_compatible
is used for more than just merging symbols, as the name suggests.
This allows objects that are in fact reasonably compatible to be
linked.
PR 22300
* elflink.c (_bfd_elf_merge_symbol): Remove relocs_compatible check.
* elf32-hppa.c (elf_backend_relocs_compatible): Define.
* elf32-ppc.c (elf_backend_relocs_compatible): Define.
* elf64-ppc.c (elf_backend_relocs_compatible): Define.
Simon Marchi [Sat, 28 Oct 2017 03:44:12 +0000 (23:44 -0400)]
Remove find_inferior usage for thread_search
Replace it with for_each_thread. While at it, we can inline the
callback code. One little change is that I am using the
prev_general_thread variable instead of current_gen_ptid, since they
should have the same value.
gdb/gdbserver/ChangeLog:
* target.c (struct thread_search): Remove.
(thread_search_callback): Remove.
(prepare_to_access_memory): Use for_each_thread instead of
find_inferior. Inline code from thread_search_callback.
Simon Marchi [Sat, 28 Oct 2017 03:43:11 +0000 (23:43 -0400)]
Remove usage of find_inferior in resume
Change find_inferior with find_thread. Since we can now pass arguments
directly instead of through a void pointer, we don't need the
visit_actioned_threads_data structure anymore.
gdb/gdbserver/ChangeLog:
* server.c (struct visit_actioned_threads_data): Remove.
(visit_actioned_threads): Change prototype to take arguments
directly.
(resume): Use find_thread instead of find_inferior.
Simon Marchi [Sat, 28 Oct 2017 03:41:49 +0000 (23:41 -0400)]
Remove usages of find_inferior in handle_status
Replace one with find_thread, the other with for_each_thread.
gdb/gdbserver/ChangeLog:
* server.c (queue_stop_reply_callback): Change prototype, return
void.
(find_status_pending_thread_callback): Remove.
(handle_status): Replace find_inferior with find_thread and
for_each_thread.
Simon Marchi [Sat, 28 Oct 2017 03:36:19 +0000 (23:36 -0400)]
common-utils-selftests.c: Add ATTRIBUTE_PRINTF
Fix this, when building with clang:
/home/emaisin/src/binutils-gdb/gdb/unittests/common-utils-selftests.c:50:40: error: format string is not a string literal [-Werror,-Wformat-nonliteral]
std::string result = string_vprintf (fmt, vp);
^~~
gdb/ChangeLog:
* unittests/common-utils-selftests.c (format): Add
ATTRIBUTE_PRINTF.
Simon Marchi [Sat, 28 Oct 2017 02:23:33 +0000 (22:23 -0400)]
C++ify xml-syscall.c
This patch C++ifies the structures in xml-syscall.c, by using
std::vector instead of VEC, and std::string instead of char*.
Using a unique_ptr in syscall_parse_xml allows to remove a cleanup.
Something that seems strange with the existing code, if you look at
syscalls_info_free_syscalls_desc and
syscalls_info_free_syscall_group_desc, they free the structure elements
(the strings and vectors), but they don't free the syscall_desc and
syscall_group_desc structure themselves. I don't see anything freeing
those currently. Any idea why? According to the comment above
syscalls_info_free_syscall_group_desc, it kinda looks like it's on
purpose. With this patch, those structures are deleted when the vector
that contains them gets deleted.
The only time I'm aware a syscalls_info structure gets deleted is in the
case the data directory changes during runtime, in init_syscalls_info.
If tried that use case (including under valgrind):
(gdb) catch syscall
(gdb) set data-directory another-data-directory
(gdb) catch syscall
I confirmed that the syscalls_info structure got deleted and recreated,
and everything seemed fine.
Regtested on the buildbot.
gdb/ChangeLog:
* xml-syscall.c (struct syscall_desc): Add constructor.
<name>: Change type to std::string.
(syscall_desc_up): New typedef.
(syscall_desc_p): Remove typeder.
(DEF_VEC_P(syscall_desc_p)): Remove.
(struct syscall_group_desc): Add constructor.
<name>: Change type to std::string.
<syscalls>: Change type to std::vector.
(syscall_group_desc_up): New typedef.
(syscall_group_desc_p): Remove typedef.
(DEF_VEC_P(syscall_group_desc_p)): Remove.
(struct syscalls_info) <syscalls>: Change type to std::vector of
unique_ptr.
<groups>: Likewise.
<my_gdb_datadir>: Change type to std::string.
(syscalls_info_up): New typedef.
(allocate_syscalls_info): Remove.
(syscalls_info_free_syscalls_desc): Remove.
(syscalls_info_free_syscall_group_desc): Remove.
(free_syscalls_info): Remove.
(make_cleanup_free_syscalls_info): Remove.
(syscall_group_create_syscall_group_desc): Adjust.
(syscall_group_add_syscall): Adjust.
(syscall_create_syscall_desc): Adjust.
(syscall_parse_xml): Adjust, use unique_ptr instead of cleanup.
(init_syscalls_info): Adjust.
(syscall_group_get_group_by_name): Adjust.
(xml_get_syscall_number): Adjust.
(xml_get_syscall_name): Adjust.
(xml_list_of_syscalls): Adjust.
(xml_list_syscalls_by_group): Adjust.
(xml_list_of_groups): Adjust.
Simon Marchi [Sat, 28 Oct 2017 02:05:42 +0000 (22:05 -0400)]
Get rid of VEC(probe_p)
Replace the remaining usages of VEC(probe_p) with std::vector.
Regtested on the buildbot.
gdb/ChangeLog:
* probe.h: Don't include gdb_vecs.h.
(DEF_VEC_P (probe_p)): Remove.
(find_probes_in_objfile): Return an std::vector.
* probe.c (find_probes_in_objfile): Likewise.
* breakpoint.c (breakpoint_objfile_data)
<longjmp_probes>: Change type to std::vector.
<exception_probes>: Likewise.
(free_breakpoint_probes): Don't manually free vectors.
(create_longjmp_master_breakpoint): Adjust.
(create_exception_master_breakpoint): Adjust.
* solib-svr4.c (svr4_create_probe_breakpoints): Change
parameter type, adjust.
(svr4_create_solib_event_breakpoints): Adjust.
Simon Marchi [Sat, 28 Oct 2017 02:01:21 +0000 (22:01 -0400)]
Allocate breakpoint_objfile_data with new
Allocate with new and free with delete. This allows using an
std::vector in the following patch.
I renamed free_breakpoint_probes to free_breakpoint_objfile_data,
because it now doesn't only free the probes vector, but also the
breakpoint_objfile_data structure itself.
gdb/ChangeLog:
* breakpoint.c (breakpoint_objfile_data): Initialize fields.
(get_breakpoint_objfile_data): Allocate breakpoint_objfile_data
with new.
(free_breakpoint_probes): Rename to ...
(free_breakpoint_objfile_data): ... this, and call delete on
bp_objfile_data..
Simon Marchi [Sat, 28 Oct 2017 01:55:42 +0000 (21:55 -0400)]
Get rid of VEC(loaded_script_ptr)
Direct replacement with std::vector. This allows removing a cleanup as
well.
Regtested on the buildbot.
gdb/ChangeLog:
* auto-load.c: Don't include gdb_vecs.h, include algorithm.
(loaded_script_ptr): Remove typedef.
(DEF_VEC_P (loaded_script_ptr)): Remove.
(struct collect_matching_scripts_data): Add constructor.
<scripts_p>: Change type to (pointer to) std::vector.
(collect_matching_scripts_data): Adjust.
(sort_scripts_by_name): Make suitable for std::sort.
(print_scripts): Don't sort vector, adjust to std::vector.
(auto_load_info_scripts): Sort vectors, adjust to std::vector.
Simon Marchi [Sat, 28 Oct 2017 01:47:30 +0000 (21:47 -0400)]
Get rid of VEC(filename_language)
This patch removes VEC(filename_language), replacing its usage with
std::vector. filename_language::ext is changed to an std::string at the
same time.
Regtested on the buildbot.
gdb/ChangeLog:
* symfile.c (filename_language): Make struct, not typedef. Add
constructor.
<ext>: Change type to std::string.
(DEF_VEC_O (filename_language)): Remove.
(filename_language_table): Change type to std::vector.
(add_filename_language): Adjust.
(set_ext_lang_command): Adjust.
(info_ext_lang_command): Adjust.
(deduce_language_from_filename): Adjust.
(class scoped_restore_filename_language_table): Remove.
(test_filename_language): Use scoped_restore.
(test_set_ext_lang_command): Use scoped_restore, adjust to
std::vector change.
Simon Marchi [Sat, 28 Oct 2017 01:46:49 +0000 (21:46 -0400)]
Add tests for filename_language
The next patch touches the filename_language area, but I noticed there
is no test exercising that. This patch adds some selftests for
add_filename_language, deduce_language_from_filename and
set_ext_lang_command. Because these tests add entries to the global
filename_language_table vector, it is not possible to run them
successfully multiple times in a same GDB instance. They can
potentially interfere with each other for the same reason. I therefore
added the scoped_restore_filename_language_table class that is used to
make sure tests leave that global vector in the same state they found it
(it is replaced in the following patch by a simple scoped_restore).
gdb/ChangeLog:
* symfile.c: Include selftest.h.
(class scoped_restore_filename_language_table): New.
(test_filename_language): New test.
(test_set_ext_lang_command): New test.
(_initialize_symfile): Register tests.
GDB Administrator [Sat, 28 Oct 2017 00:00:30 +0000 (00:00 +0000)]
Automatic date update in version.in
Keith Seitz [Fri, 27 Oct 2017 17:57:23 +0000 (10:57 -0700)]
Use SaL symbol name when reporting breakpoint locations
Currently, "info break" can show some (perhaps) unexpected results when
setting a breakpoint on an inlined function:
(gdb) list
1 #include <stdio.h>
2
3 static inline void foo()
4 {
5 printf("Hello world\n");
6 }
7
8 int main()
9 {
10 foo();
11 return 0;
12 }
13
(gdb) b foo
Breakpoint 1 at 0x400434: file foo.c, line 5.
(gdb) i b
Num Type Disp Enb Address What
1 breakpoint keep y 0x0000000000400434 in main at foo.c:5
GDB reported that we understood what "foo" was, but we then report that the
breakpoint is actually set in main. While that is literally true, we can
do a little better.
This is accomplished by copying the symbol for which the breakpoint was set
into the bp_location. From there, print_breakpoint_location can use this
information to print out symbol information (if available) instead of calling
find_pc_sect_function.
With the patch installed,
(gdb) i b
Num Type Disp Enb Address What
1 breakpoint keep y 0x0000000000400434 in foo at foo.c:5
gdb/ChangeLog:
* breakpoint.c (print_breakpoint_location): Use the symbol saved
in the bp_location, falling back to find_pc_sect_function when
needed.
(add_location_to_breakpoint): Save sal->symbol.
* breakpoint.h (struct bp_location) <symbol>: New field.
* symtab.c (find_function_start_sal): Save the symbol into the SaL.
* symtab.h (struct symtab_and_line) <symbol>: New field.
gdb/testsuite/ChangeLog:
* gdb.opt/inline-break.exp (break_info_1): New procedure.
Test "info break" for every inlined function breakpoint.
Yao Qi [Fri, 27 Oct 2017 14:29:24 +0000 (15:29 +0100)]
[AArch64] Mark LR clobbered by BL in inline asm
LR is a caller-save register, so, if inline asm does BL (which touches
LR), we should mark LR clobbered.
gdb/testsuite:
2017-10-27 Yao Qi <yao.qi@linaro.org>
* gdb.arch/insn-reloc.c (can_relocate_bl): Mark "x30" clobbered.
Simon Marchi [Fri, 27 Oct 2017 13:01:36 +0000 (09:01 -0400)]
dwarf: Read register number as unsigned in DW_CFA_def_cfa*
When displaying the .debug_frame section, the register numbers in the
DW_CFA_def_cfa* statements are read as signed numbers. I have come
across a target that has register 121, encoded as 0x79 in unsigned LEB128.
Interpreting this as signed results in -7, which makes readelf display
"r-7".
The DWARF5 standard (6.4.2.2) states that the register numbers should be
treated as unsigned LEB128.
Simply replacing READ_SLEB with READ_ULEB resulted in warnings like
these:
/home/emaisin/src/binutils-gdb/binutils/dwarf.c: In function ‘display_debug_frames’:
/home/emaisin/src/binutils-gdb/binutils/dwarf.c:355:17: error: comparison between signed and unsigned integer expressions [-Werror=sign-compare]
if ((var) != _val) \
^
/home/emaisin/src/binutils-gdb/binutils/dwarf.c:7866:8: note: in expansion of macro ‘READ_ULEB’
READ_ULEB (fc->cfa_reg);
^
... so I also changed Frame_Chunk::cfa_reg to an unsigned int.
binutils/ChangeLog:
* dwarf.c (struct Frame_Chunk) <cfa_reg>: Change type to
unsigned int.
(display_debug_frames): Read CFA reg as an unsigned number.
Simon Marchi [Fri, 27 Oct 2017 12:57:10 +0000 (08:57 -0400)]
Add PR mention to previous commit
Patrick Frants [Fri, 27 Oct 2017 02:26:08 +0000 (22:26 -0400)]
Fix broken recursion detection when printing static members
Recursion detection for static members was broken. The implementation
uses a growing (and shrinking) obstack object to simulate a stack of
addresses (CORE_ADDR). Pushing addresses is implemented by calling
obstack_grow(), while popping is implemented by calling obstack_free().
The latter is problematic because obstack_free() expects a pointer to
the base of an object. When popping elements of the stack however,
obstack_free() was called with the new top, which potentially is not the
same as the base of the stack. This is unintended use and the effect is
that obstack->next_free and obstack->object_base members are assigned
the value of the new top, which equals an empty stack. Summary: popping
elements would always result in an empty stack, which breaks the
recursion detection.
The fix shrinks the stack using obstack_blank_fast() with a negative
value as described at the bottom of this page:
https://gcc.gnu.org/onlinedocs/libiberty/Extra-Fast-Growing.html "You
can use obstack_blank_fast with a “negative” size argument to make the
current object smaller. Just don’t try to shrink it beyond zero
length—there’s no telling what will happen if you do that. Earlier
versions of obstacks allowed you to use obstack_blank to shrink objects.
This will no longer work."
The reproducer is added to gdb.cp/classes.exp, which fails without this
patch.
gdb/ChangeLog:
* cp-valprint.c (cp_print_value_fields): Use obstack_blank_fast
to rewind obstack.
gdb/testsuite/ChangeLog:
* gdb.cp/classes.exp (test_static_members): Test printing
Outer::instance.
* gdb.cp/classes.c (struct Inner, struct Outer): New.
(Inner::instance, Outer::instance): New.
GDB Administrator [Fri, 27 Oct 2017 00:00:28 +0000 (00:00 +0000)]
Automatic date update in version.in
Pedro Alves [Thu, 26 Oct 2017 18:53:03 +0000 (19:53 +0100)]
Garbage collect remote.c:remote_async_terminal_ours_p
remote.c:remote_async_terminal_ours_p stopped being useful after
048094accce2 ("target remote: Don't rely on immediate_quit (introduce
quit handlers)") and commit
41fd2b0f5d95 ("Make input_fd be per UI"),
which turned remote's terminal_inferior/ours methods into nops.
gdb/ChangeLog:
2017-10-26 Pedro Alves <palves@redhat.com>
* remote.c (remote_async_terminal_ours_p): Delete.
(remote_open_1, remote_terminal_inferior, remote_terminal_ours):
Remove references to 'remote_async_terminal_ours_p'.
H.J. Lu [Thu, 26 Oct 2017 18:16:41 +0000 (11:16 -0700)]
x86: Check invalid XMM register in AVX512 gathers
Extend invalid register check for AVX512 gathers to XMM register.
PR gas/22352
* config/tc-i386.c (check_VecOperands): Also check XMM register
for invalid register in AVX512 gathers.
* testsuite/gas/i386/vgather-check.s: Add tests for AVX512
gathers with XMM register.
* testsuite/gas/i386/x86-64-vgather-check.s: Likewise.
* testsuite/gas/i386/vgather-check-error.l: Updated.
* testsuite/gas/i386/vgather-check-none.d: Likewise.
* testsuite/gas/i386/vgather-check-warn.d: Likewise.
* testsuite/gas/i386/vgather-check-warn.e: Likewise.
* testsuite/gas/i386/vgather-check.d: Likewise.
* testsuite/gas/i386/x86-64-vgather-check-error.l: Likewise.
* testsuite/gas/i386/x86-64-vgather-check-none.d: Likewise.
* testsuite/gas/i386/x86-64-vgather-check-warn.d: Likewise.
* testsuite/gas/i386/x86-64-vgather-check-warn.e: Likewise.
* testsuite/gas/i386/x86-64-vgather-check.d: Likewise.
Renlin Li [Thu, 26 Oct 2017 14:40:45 +0000 (15:40 +0100)]
[PR21703]Adjust pr21703 tests on various targets.
xfail tests for certain targets.
Check shared library support for shared test.
Relax pr21703-r.sd and pr21703-shared.sd with additional "#..." pattern lines.
ld/
* testsuite/ld-elf/elf.exp: xfail pr21703 tests on specific targets.
Only run shared lib test for targets which support it.
* testsuite/ld-elf/pr21703-r.sd: Adjust the expected output.
* testsuite/ld-elf/pr21703-shared.sd: Likewise.
James Greenhalgh [Thu, 26 Oct 2017 10:30:40 +0000 (11:30 +0100)]
As Alan predicted at https://sourceware.org/ml/binutils/2017-10/msg00137.html the values in some Arm tests need updating after recent changes. These looked a bit spooky at first, but they are just a difference in the order we emit veneers and far jumps, so are not so scary after all.
Checked with an arm-none-eabi tester and an arm-none-linux-gnueabi tester with no issues.
* testsuite/ld-arm/cortex-a8-far.d: Update expected disassembly.
* testsuite/ld-arm/farcall-group-size2: Likewise.
* testsuite/ld-arm/farcall-group.d: Likewise.
Yao Qi [Thu, 26 Oct 2017 08:53:38 +0000 (09:53 +0100)]
Remove regular_breakpoint_inserted_here_p declaration
There is no regular_breakpoint_inserted_here_p definition at all, so
this patch removes the declaration.
gdb:
2017-10-26 Yao Qi <yao.qi@linaro.org>
* breakpoint.h (regular_breakpoint_inserted_here_p): Remove.
Yao Qi [Thu, 26 Oct 2017 08:46:16 +0000 (09:46 +0100)]
const-fy breakpoint_ops->breakpoint_hit parameter aspace
gdb:
2017-10-26 Yao Qi <yao.qi@linaro.org>
* break-catch-sig.c (signal_catchpoint_breakpoint_hit): Make
aspace const.
* break-catch-syscall.c (breakpoint_hit_catch_syscall):
Likewise.
* breakpoint.c (bpstat_check_location): Remove cast.
(breakpoint_hit_catch_fork): Make aspce const.
(breakpoint_hit_catch_solib): Likewise.
(breakpoint_hit_catch_exec): Likewise.
(breakpoint_hit_ranged_breakpoint): Likewise.
(breakpoint_hit_watchpoint): Likewise.
(base_breakpoint_breakpoint_hit): Likewise.
(bkpt_breakpoint_hit): Likewise.
(dprintf_breakpoint_hit): Likewise.
(tracepoint_breakpoint_hit): Likewise.
* breakpoint.h (breakpoint_ops) <breakpoint_hit>: Likewise.
Yao Qi [Thu, 26 Oct 2017 08:46:16 +0000 (09:46 +0100)]
const-fy function parameter struct address_space *aspace
This patch changes the parameter "struct address_space *aspace" to "const
address_space *aspace" in many functions.
gdb:
2017-10-26 Yao Qi <yao.qi@linaro.org>
* breakpoint.c (breakpoint_location_address_match): Change
"struct address_space *" to "const address_space".
(breakpoint_location_address_range_overlap): Likewise.
(breakpoint_here_p): Likewise.
(breakpoint_in_range_p): Likewise.
(moribund_breakpoint_here_p): Likewise.
(bp_location_inserted_here_p): Likewise.
(software_breakpoint_inserted_here_p): Likewise.
(hardware_breakpoint_inserted_here_p): Likewise.
(hardware_watchpoint_inserted_in_range): Likewise.
(bpstat_check_location): Likewise.
(bpstat_stop_status): Likewise.
(breakpoint_address_match): Likewise.
(breakpoint_address_match_range): Likewise.
(breakpoint_location_address_match): Likewise.
(breakpoint_location_address_range_overlap): Likewise.
(insert_single_step_breakpoint): Likewise.
(breakpoint_has_location_inserted_here): Likewise.
(single_step_breakpoint_inserted_here_p): Likewise.
(pc_at_non_inline_function): Likewise.
* breakpoint.h (bpstat_stop_status): Update declaration.
(breakpoint_here_p): Likewise.
(breakpoint_in_range_p): Likewise.
(moribund_breakpoint_here_p): Likewise.
(breakpoint_inserted_here_p): Likewise.
(software_breakpoint_inserted_here_p): Likewise.
(hardware_breakpoint_inserted_here_p): Likewise.
(breakpoint_has_location_inserted_here): Likewise.
(single_step_breakpoint_inserted_here_p): Likewise.
(hardware_watchpoint_inserted_in_range): Likewise.
(breakpoint_address_match): Likewise.
(insert_single_step_breakpoint): Likewise.
(pc_at_non_inline_function): Likewise.
* gdbthread.h (thread_has_single_step_breakpoint_here): Likewise.
* record.c (record_check_stopped_by_breakpoint): Likewise.
* record.h (record_check_stopped_by_breakpoint): Likewise.
* thread.c (thread_has_single_step_breakpoint_here): Likewise.
GDB Administrator [Thu, 26 Oct 2017 00:00:22 +0000 (00:00 +0000)]
Automatic date update in version.in
Hans-Peter Nilsson [Wed, 25 Oct 2017 23:11:06 +0000 (01:11 +0200)]
testsuite/gas/all/fill-1.s: Use L2 rather than .L2.
For some targets, like mmix-knuth-mmixware, .L2 (and .L1) are invalid
symbols.
H.J. Lu [Wed, 25 Oct 2017 15:44:54 +0000 (08:44 -0700)]
ld: Correct -z ibt documentation
* ld.texinfo: Correct -z ibt.
Yao Qi [Wed, 25 Oct 2017 15:37:03 +0000 (16:37 +0100)]
s/get_regcache_arch (regcache)/regcache->arch ()/g
This patches removes get_regcache_arch, and use regache->arch () instead.
The motivation of this change is that I am going to move some basic stuff
into a base class of regcache. I don't need to update "client" code
regcache->arch (). On the other hand, this patch shortens the code a
little bit.
gdb:
2017-10-25 Yao Qi <yao.qi@linaro.org>
* aarch32-linux-nat.c (aarch32_gp_regcache_supply): Use
regcache->arch () instead get_regcache_arch.
* aarch64-fbsd-nat.c (aarch64_fbsd_fetch_inferior_registers):
Likewise.
(aarch64_fbsd_store_inferior_registers): Likewise.
* aarch64-linux-nat.c (fetch_gregs_from_thread): Likewise.
(store_gregs_to_thread): Likewise.
(fetch_fpregs_from_thread): Likewise.
(store_fpregs_to_thread): Likewise.
* aarch64-tdep.c (aarch64_extract_return_value): Likewise.
(aarch64_store_return_value): Likewise.
(aarch64_software_single_step): Likewise.
* aix-thread.c (aix_thread_wait): Likewise.
(supply_reg32): Likewise.
(supply_sprs64): Likewise.
(supply_sprs32): Likewise.
(fill_gprs64): Likewise.
(fill_gprs32): Likewise.
(fill_sprs64): Likewise.
(fill_sprs32): Likewise.
(store_regs_user_thread): Likewise.
(store_regs_kernel_thread): Likewise.
* alpha-bsd-nat.c (alphabsd_fetch_inferior_registers): Likewise.
(alphabsd_store_inferior_registers): Likewise.
* alpha-tdep.c (alpha_extract_return_value): Likewise.
(alpha_store_return_value): Likewise.
(alpha_deal_with_atomic_sequence): Likewise.
(alpha_next_pc): Likewise.
(alpha_software_single_step): Likewise.
* amd64-bsd-nat.c (amd64bsd_fetch_inferior_registers): Likewise.
(amd64bsd_store_inferior_registers): Likewise.
* amd64-linux-nat.c (amd64_linux_fetch_inferior_registers):
Likewise.
(amd64_linux_store_inferior_registers): Likewise.
* amd64-nat.c (amd64_supply_native_gregset): Likewise.
(amd64_collect_native_gregset): Likewise.
* amd64-obsd-tdep.c (amd64obsd_supply_uthread): Likewise.
(amd64obsd_collect_uthread): Likewise.
* amd64-tdep.c (amd64_supply_fpregset): Likewise.
(amd64_collect_fpregset): Likewise.
(amd64_supply_fxsave): Likewise.
(amd64_supply_xsave): Likewise.
(amd64_collect_fxsave): Likewise.
(amd64_collect_xsave): Likewise.
* arc-tdep.c (arc_write_pc): Likewise.
* arch-utils.c (default_skip_permanent_breakpoint): Likewise.
* arm-fbsd-nat.c (arm_fbsd_fetch_inferior_registers): Likewise.
(arm_fbsd_store_inferior_registers): Likewise.
* arm-linux-nat.c (fetch_vfp_regs): Likewise.
(store_vfp_regs): Likewise.
(arm_linux_fetch_inferior_registers): Likewise.
(arm_linux_store_inferior_registers): Likewise.
* arm-linux-tdep.c (arm_linux_supply_gregset): Likewise.
(arm_linux_sigreturn_next_pc): Likewise.
(arm_linux_get_next_pcs_syscall_next_pc): Likewise.
* arm-nbsd-nat.c (arm_supply_gregset): Likewise.
(fetch_register): Likewise.
(store_register): Likewise.
* arm-tdep.c (arm_is_thumb): Likewise.
(displaced_in_arm_mode): Likewise.
(bx_write_pc): Likewise.
(arm_get_next_pcs_addr_bits_remove): Likewise.
(arm_software_single_step): Likewise.
(arm_extract_return_value): Likewise.
(arm_store_return_value): Likewise.
(arm_write_pc): Likewise.
* bfin-tdep.c (bfin_extract_return_value): Likewise.
* bsd-uthread.c (bsd_uthread_fetch_registers): Likewise.
(bsd_uthread_store_registers): Likewise.
* core-regset.c (fetch_core_registers): Likewise.
* corelow.c (get_core_registers): Likewise.
* cris-tdep.c (cris_store_return_value): Likewise.
(cris_extract_return_value): Likewise.
(find_step_target): Likewise.
(find_step_target): Likewise.
(cris_software_single_step): Likewise.
* ctf.c (ctf_fetch_registers): Likewise.
* darwin-nat.c (cancel_breakpoint): Likewise.
* fbsd-tdep.c (fbsd_collect_thread_registers): Likewise.
* frv-tdep.c (frv_extract_return_value): Likewise.
* ft32-tdep.c (ft32_store_return_value): Likewise.
(ft32_extract_return_value): Likewise.
* go32-nat.c (fetch_register): Likewise.
(go32_fetch_registers): Likewise.
(go32_store_registers): Likewise.
(store_register): Likewise.
* h8300-tdep.c (h8300_extract_return_value): Likewise.
(h8300_store_return_value): Likewise.
* hppa-linux-nat.c (fetch_register): Likewise.
(store_register): Likewise.
(hppa_linux_fetch_inferior_registers): Likewise.
(hppa_linux_store_inferior_registers): Likewise.
* i386-darwin-nat.c (i386_darwin_fetch_inferior_registers): Likewise.
(i386_darwin_store_inferior_registers): Likewise.
* i386-gnu-nat.c (gnu_fetch_registers): Likewise.
(gnu_store_registers): Likewise.
* i386-linux-nat.c (fetch_register): Likewise.
(store_register): Likewise.
(supply_gregset): Likewise.
(fill_gregset): Likewise.
(i386_linux_fetch_inferior_registers): Likewise.
(i386_linux_store_inferior_registers): Likewise.
(i386_linux_resume): Likewise.
* i386-linux-tdep.c (i386_linux_get_syscall_number_from_regcache):
Likewise.
* i386-nto-tdep.c (i386nto_supply_gregset): Likewise.
* i386-obsd-nat.c (i386obsd_supply_pcb): Likewise.
* i386-obsd-tdep.c (i386obsd_supply_uthread): Likewise.
(i386obsd_collect_uthread): Likewise.
* i386-tdep.c (i386_mmx_regnum_to_fp_regnum): Likewise.
(i386_supply_gregset): Likewise.
(i386_collect_gregset): Likewise.
(i386_supply_fpregset): Likewise.
(i386_collect_fpregset): Likewise.
(i386_mpx_bd_base): Likewise.
* i386-v4-nat.c (supply_fpregset): Likewise.
(fill_fpregset): Likewise.
* i387-tdep.c (i387_supply_fsave): Likewise.
(i387_collect_fsave): Likewise.
(i387_supply_fxsave): Likewise.
(i387_collect_fxsave): Likewise.
(i387_supply_xsave): Likewise.
(i387_collect_xsave): Likewise.
* ia64-linux-nat.c (ia64_linux_fetch_registers): Likewise.
(ia64_linux_store_registers): Likewise.
* ia64-tdep.c (ia64_access_rse_reg): Likewise.
(ia64_extract_return_value): Likewise.
(ia64_store_return_value): Likewise.
(find_func_descr): Likewise.
* inf-child.c (inf_child_fetch_inferior_registers): Likewise.
* inf-ptrace.c (inf_ptrace_fetch_registers): Likewise.
(inf_ptrace_store_registers): Likewise.
* infrun.c (use_displaced_stepping): Likewise.
(displaced_step_prepare_throw): Likewise.
(resume): Likewise.
(proceed): Likewise.
(do_target_wait): Likewise.
(adjust_pc_after_break): Likewise.
(handle_inferior_event_1): Likewise.
(handle_signal_stop): Likewise.
(save_infcall_suspend_state): Likewise.
(restore_infcall_suspend_state): Likewise.
* iq2000-tdep.c (iq2000_extract_return_value): Likewise.
* jit.c (jit_frame_prev_register): Likewise.
* linux-nat.c (save_stop_reason): Likewise.
(linux_nat_wait_1): Likewise.
(resume_stopped_resumed_lwps): Likewise.
* linux-record.c (record_linux_sockaddr): Likewise.
(record_linux_msghdr): Likewise.
(record_linux_system_call): Likewise.
* linux-tdep.c (linux_collect_thread_registers): Likewise.
* lm32-tdep.c (lm32_extract_return_value): Likewise.
(lm32_store_return_value): Likewise.
* m32c-tdep.c (m32c_read_flg): Likewise.
(m32c_pseudo_register_read): Likewise.
(m32c_pseudo_register_write): Likewise.
* m32r-linux-tdep.c (m32r_linux_supply_gregset): Likewise.
(m32r_linux_collect_gregset): Likewise.
* m32r-tdep.c (m32r_store_return_value): Likewise.
(m32r_extract_return_value): Likewise.
* m68k-bsd-nat.c (m68kbsd_supply_fpregset): Likewise.
(m68kbsd_collect_fpregset): Likewise.
* m68k-bsd-tdep.c (m68kbsd_supply_fpregset): Likewise.
* m68k-linux-nat.c (fetch_register): Likewise.
(old_fetch_inferior_registers): Likewise.
(old_store_inferior_registers): Likewise.
(store_regs): Likewise.
* m68k-tdep.c (m68k_svr4_extract_return_value): Likewise.
(m68k_svr4_store_return_value): Likewise.
* m88k-tdep.c (m88k_store_arguments): Likewise.
* mi/mi-main.c (mi_cmd_data_list_changed_registers): Likewise.
(mi_cmd_data_write_register_values): Likewise.
* mips-fbsd-nat.c (mips_fbsd_fetch_inferior_registers): Likewise.
(mips_fbsd_store_inferior_registers): Likewise.
* mips-fbsd-tdep.c (mips_fbsd_supply_fpregs): Likewise.
(mips_fbsd_supply_gregs): Likewise.
(mips_fbsd_collect_fpregs): Likewise.
(mips_fbsd_collect_gregs): Likewise.
(mips_fbsd_supply_fpregset): Likewise.
(mips_fbsd_collect_fpregset): Likewise.
(mips_fbsd_supply_gregset): Likewise.
(mips_fbsd_collect_gregset): Likewise.
* mips-linux-nat.c (supply_gregset): Likewise.
(fill_gregset): Likewise.
(supply_fpregset): Likewise.
(fill_fpregset): Likewise.
* mips-linux-tdep.c (mips_supply_gregset): Likewise.
(mips_fill_gregset): Likewise.
(mips_supply_fpregset): Likewise.
(mips_fill_fpregset): Likewise.
(mips64_supply_gregset): Likewise.
(micromips_linux_sigframe_validate): Likewise.
* mips-nbsd-nat.c (mipsnbsd_fetch_inferior_registers): Likewise.
(mipsnbsd_fetch_inferior_registers): Likewise.
(mipsnbsd_store_inferior_registers): Likewise.
* mips-nbsd-tdep.c (mipsnbsd_supply_fpregset): Likewise.
(mipsnbsd_supply_gregset): Likewise.
(mipsnbsd_iterate_over_regset_sections): Likewise.
(mipsnbsd_supply_reg): Likewise.
(mipsnbsd_supply_fpreg): Likewise.
* mips-tdep.c (mips_in_frame_stub): Likewise.
(mips_dummy_id): Likewise.
(is_octeon_bbit_op): Likewise.
(micromips_bc1_pc): Likewise.
(extended_mips16_next_pc): Likewise.
(mips16_next_pc): Likewise.
(deal_with_atomic_sequence): Likewise.
* moxie-tdep.c (moxie_process_readu): Likewise.
* nios2-tdep.c (nios2_get_next_pc): Likewise.
* nto-procfs.c (procfs_store_registers): Likewise.
* ppc-fbsd-nat.c (ppcfbsd_fetch_inferior_registers): Likewise.
(ppcfbsd_store_inferior_registers): Likewise.
* ppc-linux-nat.c (fetch_vsx_register): Likewise.
(fetch_altivec_register): Likewise.
(get_spe_registers): Likewise.
(fetch_spe_register): Likewise.
(fetch_altivec_registers): Likewise.
(fetch_all_gp_regs): Likewise.
(fetch_all_fp_regs): Likewise.
(store_vsx_register): Likewise.
(store_altivec_register): Likewise.
(set_spe_registers): Likewise.
(store_spe_register): Likewise.
(store_altivec_registers): Likewise.
(store_all_gp_regs): Likewise.
(store_all_fp_regs): Likewise.
* ppc-linux-tdep.c (ppc_linux_supply_gregset): Likewise.
(ppc_linux_collect_gregset): Likewise.
(ppc_canonicalize_syscall): Likewise.
(ppc_linux_record_signal): Likewise.
(ppu2spu_prev_register): Likewise.
* ppc-nbsd-nat.c (ppcnbsd_supply_pcb): Likewise.
* ppc-obsd-nat.c (ppcobsd_fetch_registers): Likewise.
(ppcobsd_store_registers): Likewise.
* ppc-ravenscar-thread.c (ppc_ravenscar_generic_fetch_registers):
Likewise.
(ppc_ravenscar_generic_store_registers): Likewise.
* procfs.c (procfs_fetch_registers): Likewise.
(procfs_store_registers): Likewise.
* ravenscar-thread.c (ravenscar_fetch_registers): Likewise.
(ravenscar_store_registers): Likewise.
(ravenscar_prepare_to_store): Likewise.
* record-btrace.c (record_btrace_fetch_registers): Likewise.
* record-full.c (record_full_wait_1): Likewise.
(record_full_registers_change): Likewise.
(record_full_store_registers): Likewise.
(record_full_core_fetch_registers): Likewise.
(record_full_save): Likewise.
(record_full_goto_insn): Likewise.
* regcache.c (regcache_register_size): Likewise.
(get_regcache_arch): Remove.
(regcache_read_pc): Likewise.
* regcache.h (get_regcache_arch): Remove.
* remote-sim.c (gdbsim_fetch_register): Likewise.
(gdbsim_store_register): Likewise.
* remote.c (fetch_register_using_p): Likewise.
(send_g_packet): Likewise.
(remote_prepare_to_store): Likewise.
(store_registers_using_G): Likewise.
* reverse.c (save_bookmark_command): Likewise.
(goto_bookmark_command): Likewise.
* rs6000-aix-tdep.c (branch_dest): Likewise.
* rs6000-nat.c (rs6000_ptrace64): Likewise.
(fetch_register): Likewise.
* rs6000-tdep.c (ppc_supply_reg): Likewise.
(ppc_collect_reg): Likewise.
(ppc_collect_gregset): Likewise.
(ppc_collect_fpregset): Likewise.
(ppc_collect_vsxregset): Likewise.
(ppc_collect_vrregset): Likewise.
(ppc_displaced_step_hw_singlestep): Likewise.
(rs6000_pseudo_register_read): Likewise.
(rs6000_pseudo_register_write): Likewise.
* s390-linux-nat.c (supply_gregset): Likewise.
(fill_gregset): Likewise.
(s390_linux_fetch_inferior_registers): Likewise.
* s390-linux-tdep.c (s390_write_pc): Likewise.
(s390_software_single_step): Likewise.
(s390_all_but_pc_registers_record): Likewise.
(s390_linux_syscall_record): Likewise.
* sentinel-frame.c (sentinel_frame_prev_arch): Likewise.
* sh-nbsd-nat.c (shnbsd_fetch_inferior_registers): Likewise.
(shnbsd_store_inferior_registers): Likewise.
* sh-tdep.c (sh_extract_return_value_nofpu): Likewise.
(sh_extract_return_value_fpu): Likewise.
(sh_store_return_value_nofpu): Likewise.
(sh_corefile_supply_regset): Likewise.
(sh_corefile_collect_regset): Likewise.
* sh64-tdep.c (sh64_extract_return_value): Likewise.
(sh64_store_return_value): Likewise.
* sparc-linux-tdep.c (sparc32_linux_collect_core_fpregset): Likewise.
* sparc-nat.c (sparc_fetch_inferior_registers): Likewise.
(sparc_store_inferior_registers): Likewise.
* sparc-ravenscar-thread.c (register_in_thread_descriptor_p): Likewise.
(sparc_ravenscar_prepare_to_store): Likewise.
* sparc-tdep.c (sparc32_store_arguments): Likewise.
(sparc_analyze_control_transfer): Likewise.
(sparc_step_trap): Likewise.
(sparc_software_single_step): Likewise.
(sparc32_gdbarch_init): Likewise.
(sparc_supply_rwindow): Likewise.
(sparc_collect_rwindow): Likewise.
* sparc64-linux-tdep.c (sparc64_linux_collect_core_fpregset): Likewise.
* sparc64-nbsd-nat.c (sparc64nbsd_supply_gregset): Likewise.
(sparc64nbsd_collect_gregset): Likewise.
(sparc64nbsd_supply_fpregset): Likewise.
(sparc64nbsd_collect_fpregset): Likewise.
* sparc64-tdep.c (sparc64_store_arguments): Likewise.
(sparc64_supply_gregset): Likewise.
(sparc64_collect_gregset): Likewise.
(sparc64_supply_fpregset): Likewise.
(sparc64_collect_fpregset): Likewise.
* spu-linux-nat.c (spu_fetch_inferior_registers): Likewise.
* spu-tdep.c (spu_unwind_sp): Likewise.
(spu2ppu_prev_register): Likewise.
(spu_memory_remove_breakpoint): Likewise.
* stack.c (return_command): Likewise.
* tic6x-tdep.c (tic6x_extract_signed_field): Likewise.
* tracefile-tfile.c (tfile_fetch_registers): Likewise.
* tracefile.c (trace_save_ctf): Likewise.
* windows-nat.c (do_windows_fetch_inferior_registers): Likewise.
(do_windows_store_inferior_registers): Likewise.
(windows_resume): Likewise.
* xtensa-linux-nat.c (fill_gregset): Likewise.
(supply_gregset_reg): Likewise.
* xtensa-tdep.c (xtensa_register_write_masked): Likewise.
(xtensa_register_read_masked): Likewise.
(xtensa_supply_gregset): Likewise.
(xtensa_extract_return_value): Likewise.
(xtensa_store_return_value): Likewise.
Ulrich Weigand [Wed, 25 Oct 2017 13:32:23 +0000 (15:32 +0200)]
Target FP: Use target format throughout expression parsing
When parsing floating-point literals, the language parsers currently
use parse_float or some equivalent routine to parse the input string
into a DOUBLEST, which is then stored within a OP_DOUBLE expression
node. When evaluating the expression, the OP_DOUBLE is finally
converted into a value in target format.
On the other hand, *decimal* floating-point literals are parsed
directly into target format and stored that way in a OP_DECFLOAT
expression node. In order to eliminate the DOUBLEST, this patch
therefore unifies the handling of binary and decimal floating-
point literals and stores them both in target format within a
new OP_FLOAT expression node, replacing both OP_DOUBLE and
OP_DECFLOAT.
In order to store literals in target format, the parse_float
routine needs to know the type of the literal. All parsers
therefore need to be changed to determine the appropriate type
(e.g. by detecting suffixes) *before* calling parse_float,
instead of after it as today. However, this change is mostly
straightforward -- again, this is already done for decimal FP
today.
The core of the literal parsing is moved into a new routine
floatformat_from_string, mirroring floatformat_to_string.
The parse_float routine now calls either floatformat_from_string
or decimal_from_sting, allowing it to handle any type of FP
literal.
All language parsers need to be updated. Some notes on
specific changes to the various languages:
- C: Decimal FP is now handled in parse_float, and no longer
needs to be handled specially.
- D: Straightforward.
- Fortran: Still used a hard-coded "atof", also replaced by
parse_float now. Continues to always use builtin_real_s8
as the type of literal, even though this is probably wrong.
- Go: This used to handle "f" and "l" suffixes, even though
the Go language actually doesn't support those. I kept this
support for now -- maybe revisit later. Note the the GDB
test suite for some reason actually *verifies* that GDB supports
those unsupported suffixes ...
- Pascal: Likewise -- this handles suffixes that are not
supported in the language standard.
- Modula-2: Like Fortran, used to use "atof".
- Rust: Mostly straightforward, except for a unit-testing hitch.
The code use to set a special "unit_testing" flag which would
cause "rust_type" to always return NULL. This makes it not
possible to encode a literal into target format (which type?).
The reason for this flag appears to have been that during
unit testing, there is no "rust_parser" context set up, which
means no "gdbarch" is available to use its types. To fix this,
I removed the unit_testing flag, and instead simply just set up
a dummy rust_parser context during unit testing.
- Ada: This used to check sizeof (DOUBLEST) to determine which
type to use for floating-point literal. This seems questionable
to begin with (since DOUBLEST is quite unrelated to target formats),
and in any case we need to get rid of DOUBLEST. I'm now simply
always using the largest type (builtin_long_double).
gdb/ChangeLog:
2017-10-25 Ulrich Weigand <uweigand@de.ibm.com>
* doublest.c (floatformat_from_string): New function.
* doublest.h (floatformat_from_string): Add prototype.
* std-operator.def (OP_DOUBLE, OP_DECFLOAT): Remove, replace by ...
(OP_FLOAT): ... this.
* expression.h: Do not include "doublest.h".
(union exp_element): Replace doubleconst and decfloatconst by
new element floatconst.
* ada-lang.c (resolve_subexp): Handle OP_FLOAT instead of OP_DOUBLE.
(ada_evaluate_subexp): Likewise.
* eval.c (evaluate_subexp_standard): Handle OP_FLOAT instead of
OP_DOUBLE and OP_DECFLOAT.
* expprint.c (print_subexp_standard): Likewise.
(dump_subexp_body_standard): Likewise.
* breakpoint.c (watchpoint_exp_is_const): Likewise.
* parse.c: Include "dfp.h".
(write_exp_elt_dblcst, write_exp_elt_decfloatcst): Remove.
(write_exp_elt_floatcst): New function.
(operator_length_standard): Handle OP_FLOAT instead of OP_DOUBLE
and OP_DECFLOAT.
(operator_check_standard): Likewise.
(parse_float): Do not accept suffix. Take type as input. Return bool.
Return target format buffer instead of host DOUBLEST.
Use floatformat_from_string and decimal_from_string to parse
either binary or decimal floating-point types.
(parse_c_float): Remove.
* parser-defs.h: Do not include "doublest.h".
(write_exp_elt_dblcst, write_exp_elt_decfloatcst): Remove.
(write_exp_elt_floatcst): Add prototype.
(parse_float): Update prototype.
(parse_c_float): Remove.
* c-exp.y: Do not include "dfp.h".
(typed_val_float): Use byte buffer instead of DOUBLEST.
(typed_val_decfloat): Remove.
(DECFLOAT): Remove.
(FLOAT): Use OP_FLOAT and write_exp_elt_floatcst.
(parse_number): Update to new parse_float interface.
Parse suffixes and determine type before calling parse_float.
Handle decimal and binary FP types the same way.
* d-exp.y (typed_val_float): Use byte buffer instead of DOUBLEST.
(FLOAT_LITERAL): Use OP_FLOAT and write_exp_elt_floatcst.
(parse_number): Update to new parse_float interface.
Parse suffixes and determine type before calling parse_float.
* f-exp.y: Replace dval by typed_val_float.
(FLOAT): Use OP_FLOAT and write_exp_elt_floatcst.
(parse_number): Use parse_float instead of atof.
* go-exp.y (typed_val_float): Use byte buffer instead of DOUBLEST.
(parse_go_float): Remove.
(FLOAT): Use OP_FLOAT and write_exp_elt_floatcst.
(parse_number): Call parse_float instead of parse_go_float.
Parse suffixes and determine type before calling parse_float.
* p-exp.y (typed_val_float): Use byte buffer instead of DOUBLEST.
(FLOAT): Use OP_FLOAT and write_exp_elt_floatcst.
(parse_number): Update to new parse_float interface.
Parse suffixes and determine type before calling parse_float.
* m2-exp.y: Replace dval by byte buffer val.
(FLOAT): Use OP_FLOAT and write_exp_elt_floatcst.
(parse_number): Call parse_float instead of atof.
* rust-exp.y (typed_val_float): Use byte buffer instead of DOUBLEST.
(lex_number): Call parse_float instead of strtod.
(ast_dliteral): Use OP_FLOAT instead of OP_DOUBLE.
(convert_ast_to_expression): Handle OP_FLOAT instead of OP_DOUBLE.
Use write_exp_elt_floatcst.
(unit_testing): Remove static variable.
(rust_type): Do not check unit_testing.
(rust_lex_tests): Do not set uint_testing. Set up dummy rust_parser.
* ada-exp.y (type_float, type_double): Remove.
(typed_val_float): Use byte buffer instead of DOUBLEST.
(FLOAT): Use OP_FLOAT and write_exp_elt_floatcst.
* ada-lex.l (processReal): Use parse_float instead of sscanf.
Alan Modra [Wed, 25 Oct 2017 11:29:14 +0000 (21:59 +1030)]
PR22348, conflicting global vars in crx and cr16
include/
PR 22348
* opcode/cr16.h (instruction): Delete.
(cr16_words, cr16_allWords, cr16_currInsn): Delete.
* opcode/crx.h (crx_cst4_map): Rename from cst4_map.
(crx_cst4_maps): Rename from cst4_maps.
(crx_no_op_insn): Rename from no_op_insn.
(instruction): Delete.
opcodes/
PR 22348
* cr16-dis.c (cr16_cinvs, instruction, cr16_currInsn): Make static.
(cr16_words, cr16_allWords, processing_argument_number): Likewise.
(imm4flag, size_changed): Likewise.
* crx-dis.c (crx_cinvs, NUMCINVS, instruction, currInsn): Likewise.
(words, allWords, processing_argument_number): Likewise.
(cst4flag, size_changed): Likewise.
* crx-opc.c (crx_cst4_map): Rename from cst4_map.
(crx_cst4_maps): Rename from cst4_maps.
(crx_no_op_insn): Rename from no_op_insn.
gas/
PR 22348
* config/tc-crx.c (instruction, output_opcode): Make static.
(relocatable, ins_parse, cur_arg_num): Likewise.
(parse_insn): Adjust for renamed opcodes globals.
(check_range): Likewise
Alan Hayward [Wed, 25 Oct 2017 08:06:41 +0000 (09:06 +0100)]
Add common AARCH64 REGNUM defines
gdb/
* aarch64-tdep.h (enum aarch64_regnum): Remove.
* arch/aarch64.h: New file.
gdbserver/
* linux-aarch64-low.c (aarch64_fill_gregset): Replace defines
with REGNO.
(aarch64_store_gregset): Likewise.
(aarch64_fill_fpregset): Likewise.
(aarch64_store_fpregset): Likewise.
Alan Modra [Wed, 25 Oct 2017 05:02:52 +0000 (15:32 +1030)]
Allow for __gnu_lto_slim prefixed with extra "_"
Some targets prefix global symbols with "_".
bfd/
* archive.c (_bfd_compute_and_write_armap): Match "__gnu_lto_slim"
optionally prefixed with "_".
* linker.c (_bfd_generic_link_add_one_symbol): Likewise.
binutils/
* nm.c (filter_symbols): Match "__gnu_lto_slim" optionally prefixed
with "_".
gold/
* symtab.cc (Symbol_table::add_from_relobj): Match "__gnu_lto_slim"
optionally prefixed with "_".
ld/
* testsuite/ld-plugin/lto-3r.d: Match "__gnu_lto_v" optionally
prefixed with "_".
* testsuite/ld-plugin/lto-5r.d: Likewise.
Alan Modra [Wed, 25 Oct 2017 05:01:58 +0000 (15:31 +1030)]
Yet another fill-1 test fix
tic4x fails due to being a 4 octets per byte target, while tic54x is 2
octets per byte.
mmix still fails with
fill-1.s:4: Error: unknown pseudo-op: `.l1:'
fill-1.s:6: Error: unknown pseudo-op: `.l2:'
fill-1.s:3: Error: .space specifies non-absolute value
and if the labels are changed to L1 and L2 then mep-elf fails with
fill-1.s:3: Error: .space specifies non-absolute value
Since both of those look like they ought to be investigated by the
target maintainers, I'm tweaking the test to fail on both targets.
* testsuite/gas/all/fill-1.d: Exclude tic4x and tic54x.
* testsuite/gas/all/fill-1.s: Use L1 rather than .L1.
GDB Administrator [Wed, 25 Oct 2017 00:00:26 +0000 (00:00 +0000)]
Automatic date update in version.in
Hans-Peter Nilsson [Tue, 24 Oct 2017 22:46:24 +0000 (00:46 +0200)]
Fix format typos in previous previous ld/ChangeLog entry
Hans-Peter Nilsson [Tue, 24 Oct 2017 22:45:05 +0000 (00:45 +0200)]
testsuite/ld-riscv-elf/ld-riscv-elf.exp: Fix typo for istarget.
Pedro Alves [Tue, 24 Oct 2017 22:22:56 +0000 (23:22 +0100)]
Fix racy test in gdb.base/new-ui.exp
I noticed gdb.base/new-ui.exp failing once here with:
FAIL: gdb.base/new-ui.exp: do_test: delete all breakpoints on extra console (got interactive prompt)
FAIL: gdb.base/new-ui.exp: do_test: main console: next causes no spurious output on other console
FAIL: gdb.base/new-ui.exp: do_test: main console: breakpoint hit reported on other console
The problem is 100% reproducible with check-read1:
$ make check-read1 TESTS="gdb.*/new-ui.exp"
testsuite/gdb.log shows:
delete
Delete all breakpoints? (y or n) [answered Y; input not from terminal]
(gdb) FAIL: gdb.base/new-ui.exp: do_test: delete all breakpoints on extra console (got interactive prompt)
This commit fixes the problem.
gdb/testsuite/ChangeLog:
2017-10-24 Pedro Alves <palves@redhat.com>
* gdb.base/new-ui.exp (do_test): Split "delete all breakpoints on
extra console" test in two stages.
Andrew Waterman [Thu, 19 Oct 2017 18:21:44 +0000 (11:21 -0700)]
RISC-V: Fix disassembly of c.addi4spn, c.addi16sp, c.lui when imm=0
These are all invalid instructions, so they should not disassemble.
opcodes/ChangeLog
2017-10-24 Andrew Waterman <andrew@sifive.com>
* riscv-opc.c (match_c_addi16sp) : New function.
(match_c_addi4spn): New function.
(match_c_lui): Don't allow 0-immediate encodings.
(riscv_opcodes) <addi>: Use the above functions.
<add>: Likewise.
<c.addi4spn>: Likewise.
<c.addi16sp>: Likewise.
gas/ChangeLog
2017-10-24 Andrew Waterman <andrew@sifive.com>
* testsuite/gas/riscv/c-addi16sp-fail.d: New test.
testsuite/gas/riscv/c-addi16sp-fail.l: Likewise.
testsuite/gas/riscv/c-addi16sp-fail.s: Likewise.
testsuite/gas/riscv/c-addi4spn-fail.d: Likewise.
testsuite/gas/riscv/c-addi4spn-fail.l: Likewise.
testsuite/gas/riscv/c-addi4spn-fail.s: Likewise.
testsuite/gas/riscv/riscv.exp: Add new tests.
Ulrich Weigand [Tue, 24 Oct 2017 16:34:41 +0000 (18:34 +0200)]
Use const reference for decimal_from_string argument
No functional change.
gdb/ChangeLog:
2017-10-24 Ulrich Weigand <uweigand@de.ibm.com>
* dfp.h (decimal_from_string): Use const reference for argument.
* dfp.c (decimal_from_string): Likewise.
Ulrich Weigand [Tue, 24 Oct 2017 16:01:39 +0000 (18:01 +0200)]
Target FP printing: Use floatformat_to_string in tdep code
A few tdep files use target-specific printing routines to output values in
the floating-point registers. To get rid of host floating-point code,
this patch changes them to use floatformat_to_string instead.
No functional change intended, the resulting output should look the same.
ChangeLog:
2017-10-24 Ulrich Weigand <uweigand@de.ibm.com>
* i387-tdep.c (print_i387_value): Use floatformat_to_string.
* sh64-tdep.c (sh64_do_fp_register): Likewise.
* mips-tdep.c (mips_print_fp_register): Likewise.
Ulrich Weigand [Tue, 24 Oct 2017 16:00:50 +0000 (18:00 +0200)]
Target FP printing: Simplify and fix ui_printf
This patch adds support for handling format strings to both
floatformat_to_string and decimal_to_string, and then uses
those routines to implement ui_printf formatted printing.
There is already a subroutine printf_decfloat that ui_printf uses to
handle decimal FP. This is renamed to printf_floating and updated
to handle both binary and decimal FP. This includes the following
set of changes:
- printf_decfloat currently parses the format string again to determine
the intended target format. This seems superfluous since the common
parsing code in parse_format_string already did this, but then did
not pass the result on to its users. Fixed by splitting the decfloat_arg
argument class into three distinct classes, and passing them through.
- Now we can rename printf_decfloat to printf_floating and also call it
for the argument classes representing binary FP types.
- The code will now use the argclass to detect the type the value should
be printed at, and converts the input value to this type if necessary.
To remain compatible with current behavior, for binary FP the code
instead tries to re-interpret the input value as a FP type of the
same size if that exists. (Maybe this behavior is more confusing
than useful -- but this can be changed later if we want to ...)
- Finally, we can use floatformat_to_string / decimal_to_string passing
the format string to perform the formatted output using the desired
target FP type.
Note that we no longer generate different code depending on whether or not
the host supports "long double" -- this check is obsolete anyway since C++11
mandates "long double", and in any case a %lg format string is intended to
refer to the *target* long double type, not the host version.
Note also that formatted printing of DFP numbers may not work correctly,
since it attempts to use the host printf to do so (and makes unwarranted
assumptions about the host ABI while doing so!). This is no change to
the current behavior -- I simply moved the code from printf_decfloat to
the decimal_to_string routine in dfp.c. If we want to fix it in the
future, that is a more appropriate place anyway.
ChangeLog:
2017-10-24 Ulrich Weigand <uweigand@de.ibm.com>
* common/format.h (enum argclass): Replace decfloat_arg by
dec32float_arg, dec64float_arg, and dec128float_arg.
* common/format.c (parse_format_string): Update to return
new decimal float argument classes.
* printcmd.c (printf_decfloat): Rename to ...
(printf_floating): ... this. Add argclass argument, and use it
instead of parsing the format string again. Add support for
binary floating-point values, using floatformat_to_string.
Convert value to the target format if it doesn't already match.
(ui_printf): Call printf_floating instead of printf_decfloat,
also for double_arg / long_double_arg. Pass argclass.
* dfp.c (decimal_to_string): Add format string argument.
* dfp.h (decimal_to_string): Likewise.
* doublest.c (floatformat_to_string): Add format string argument.
* doublest.h (floatformat_to_string): Likewise.
Ulrich Weigand [Tue, 24 Oct 2017 15:59:22 +0000 (17:59 +0200)]
Target FP printing: Simplify and fix print_floating
The print_floating routine currently makes a lot of assumptions about host
and target floating point formats. This patch cleans up many of those.
One problem is that print_floating may currently be called with types
that are not actually floating-point types, and it tries hard to output
those as floating-point values anyway. However, there is only one single
caller of print_floating where this can ever happen: print_scalar_formatted.
And in fact, it is much simpler to handle the case where the value to be
printed is not already of floating-point type right there.
So this patch changes print_scalar_formatted to handle the 'f' format
as follows:
- If the value to be printed is already of floating-point type, just
call print_floating on it.
- Otherwise, if there is a standard target floating-point type of
the same size as the value, call print_floating using that type.
- Otherwise, just print the value as if the 'f' format had not been
specified at all.
This has the overall effect to printing everything the same way as
the old code did, but is overall a lot simpler. (Also, it would
allow us to change the above strategy more easily, if that might
be a more intuitive user interface. For example, in the third
case above, maybe an error would be more appropriate?)
Given that change, print_floating can become much simpler. In particular,
we now always have a floating-point format that we can consult. This
means we can use the floating-point format to programmatically determine
the number of digits necessary to print the value.
The current code uses a hard-coded value of 9, 17, or 35 digits. Note
that this matches the DECIMAL_DIG values for IEEE-32, IEEE-64, and
IEEE-128. (Actually, for IEEE-128 the correct value is 36 -- the 35
seems to be an oversight.) The DECIMAL_DIG value is defined to be
the smallest number so that any number in the target format, when
printed to this number of digits and then scanned back into a binary
floating-point number, will result in the original value.
Now that we always have a FP format, we can just compute the DECIMAL_DIG
value using the formula from the C standard. This will be correct for
*all* FP formats, not just the above list, and it will be correct (as
opposed to current code) if the target formats differ from the host ones.
The patch moves the new logic to a new floatformat_to_string routine
(analogous to the existing decimal_to_string). The print_floating
routine now calls floatformat_to_string or decimal_to_string, making
the separate print_decimal_floating and generic_val_print_decfloat routines
unnecessary.
gdb/ChangeLog:
2017-10-24 Ulrich Weigand <uweigand@de.ibm.com>
* doublest.c (floatformat_precision): New routine.
(floatformat_to_string): Likewise.
* doublest.c (floatformat_to_string): Add prototype.
* printcmd.c (print_scalar_formatted): Only call print_floating
on floating-point types.
* valprint.c: Do not include "floatformat.h".
(generic_val_print_decfloat): Remove.
(generic_val_print): Call generic_val_print_float for both
TYPE_CODE_FLT and TYPE_CODE_DECFLOAT.
(print_floating): Use floatformat_to_string. Handle decimal float.
(print_decimal_floating): Remove, merge into floatformat_to_string.
* value.h (print_decimal_floating): Remove.
* Makefile.in: Do not build doublest.c with -Wformat-nonliteral.
Andrew Waterman [Sun, 24 Sep 2017 01:04:16 +0000 (18:04 -0700)]
RISC-V: Only relax to C.LUI when imm != 0 and rd != 0/2
This matches the ISA specification. This also adds two tests: one to
make sure the assembler rejects invalid 'c.lui's, and one to make sure
we only relax valid 'c.lui's.
bfd/ChangeLog
2017-10-24 Andrew Waterman <andrew@sifive.com>
* elfnn-riscv.c (_bfd_riscv_relax_lui): Don't relax to c.lui
when rd is x0.
include/ChangeLog
2017-10-24 Andrew Waterman <andrew@sifive.com>
* opcode/riscv.h (VALID_RVC_LUI_IMM): c.lui can't load the
immediate 0.
gas/ChangeLog
2017-10-24 Andrew Waterman <andrew@sifive.com>
* testsuite/gas/riscv/c-lui-fail.d: New testcase.
gas/testsuite/gas/riscv/c-lui-fail.l: Likewise.
gas/testsuite/gas/riscv/c-lui-fail.s: Likewise.
gas/testsuite/gas/riscv/riscv.exp: Likewise.
ld/ChangeLog
2017-10-24 Andrew Waterman <andrew@sifive.com>
* ld/testsuite/ld-riscv-elf/c-lui.d: New testcase.
ld/testsuite/ld-riscv-elf/c-lui.s: Likewise.
ld/testsuite/ld-riscv-elf/ld-riscv-elf.exp: New test suite.
Palmer Dabbelt [Tue, 24 Oct 2017 13:58:48 +0000 (06:58 -0700)]
Fix my previous gas/ChangeLog entry
H.J. Lu [Tue, 24 Oct 2017 14:47:32 +0000 (07:47 -0700)]
i386: Support .code64 directive only with 64-bit bfd
Without 64-bit bfd, we can't properly support .code64 directive in
32-bit mode.
* config/tc-i386.c (md_pseudo_table): Add .code64 directive
only if BFD64 is defined.
* testsuite/gas/i386/code64-inval.l: New file.
* gas/testsuite/gas/i386/code64-inval.s: Likewise.
* gas/testsuite/gas/i386/code64.d: Likewise.
* gas/testsuite/gas/i386/code64.s: Likewise.
* testsuite/gas/i386/i386.exp: Run mixed-mode-reloc32,
att-regs, intel-regs, intel-expr and string-ok tests only if
assembler supports x86-64. Run code64 and code64-inval.
Ulrich Weigand [Tue, 24 Oct 2017 14:33:53 +0000 (16:33 +0200)]
Fix gdb.opt/inline-cmds.exp regressions
When sorting pending blocks in end_symtab_get_static_block, blocks
with the same starting address must remain in the original order
to preserve inline function caller/callee relationships.
The original code seems to have implicitly relied on the fact that the
glibc qsort implemention actually (in the common case) provides a stable
sort, although this is not guaranteed by the standard. But the GNU
libstdc++ std::sort implementation is *not* stable.
gdb/ChangeLog:
2017-10-24 Ulrich Weigand <uweigand@de.ibm.com>
* buildsym.c (end_symtab_get_static_block): Use std::stable_sort.
Renlin Li [Tue, 24 Oct 2017 11:42:30 +0000 (12:42 +0100)]
[BFD][PR21703]Override the new defined symbol with the old normal symbol when --allow-multiple-definition is provided.
The behavior of _bfd_elf_merge_symbol and _bfd_generic_link_add_one_symbol is
inconsistent.
In multiple definition case, _bfd_elf_merge_symbol decided to override the old
symbol definition with the new defintion, (size, type, target data)
In _bfd_generic_link_add_one_symbol, it simply return without doing anything
because of allow-multiple-definition is provided.
This leaves the symbol in a wrong state.
Here, following the documentation, I made this patch to force the old definition
override the new definition if the old symbol is not dynamic or weak.
Because, in those two cases, it's expected to do some merge. I have checked
that, those two cases are properly handled.
bfd/
PR ld/21703
* elflink.c (_bfd_elf_merge_symbol): Handle multiple definition case.
ld/
PR ld/21703
* testsuite/ld-elf/elf.exp: Run new tests.
* testsuite/ld-elf/pr21703-1.s: New.
* testsuite/ld-elf/pr21703-2.s: New.
* testsuite/ld-elf/pr21703-3.s: New.
* testsuite/ld-elf/pr21703-4.s: New.
* testsuite/ld-elf/pr21703-r.sd: New.
* testsuite/ld-elf/pr21703-shared.sd: New.
* testsuite/ld-elf/pr21703.sd: New.
* testsuite/ld-elf/pr21703.ver: New.
Pedro Alves [Tue, 24 Oct 2017 09:43:45 +0000 (10:43 +0100)]
Reindent gdb.threads/attach-into-signal.exp
A previous patch removed one nesting level.
gdb/testsuite/ChangeLog:
2017-10-24 Pedro Alves <palves@redhat.com>
* gdb.threads/attach-into-signal.exp (corefunc): Reindent.
Pedro Alves [Tue, 24 Oct 2017 09:43:35 +0000 (10:43 +0100)]
Drop /proc/PID/status polling from gdb.threads/attach-into-signal.exp
I noticed that the 'with_test_prefix "stoppedtry $stoppedtry"' prefix
in this testcase is unnecessary, because inside that block there are
no pass/fail calls. In fact the block includes a comment saying:
# No PASS message as we may be looping in multiple
# attempts.
but looking deeper at this I noticed a few odd things with this code
block:
1. This code is assuming that the second line in the /proc/PID/status
files is the "State:" line, which may have been true when this was
originally written, but is not true on my machine at least (Linux
4.8.13).
$ cat /proc/self/status
Name: cat
Umask: 0002
State: R (running)
So nowadays, that 'string match "*(stopped)*"' is running against
the "Umask:" line and thus always returns false, meaning the loop
always breaks on $stoppedtry == 0.
2. The loop seems to be waiting for the process to become "(stopped)",
but if so then that 'if {![string match]}' check is reversed, it
should be checking 'if {[string match]}' instead, because "string
match" returns true if the string matches, not 0.
3. But if we fixed all that, we'd still run into the simple fact that
nothing is actually stopping the test's inferior process before GDB
attaches... The top of the testcase says:
# This test was created by modifying attach-stopped.exp.
... and attach-stopped.exp does have:
# Stop the program
remote_exec build "kill -s STOP ${testpid}"
but then attach-stopped.exp doesn't have an equivalent
/proc/PID/status poll loop... (Maybe it could.)
So remove this whole loop as useless.
gdb/testsuite/ChangeLog:
2017-10-24 Pedro Alves <palves@redhat.com>
* gdb.threads/attach-into-signal.exp: Remove whole "stoppedtry"
loop.
Pedro Alves [Tue, 24 Oct 2017 09:43:35 +0000 (10:43 +0100)]
Fix unstable test names in gdb.threads/attach-into-signal.exp
Currently, if you diff testsuite/gdb.sum of two testsuite runs you'll
often see spurious hunks like these:
-PASS: gdb.threads/attach-into-signal.exp: nonthreaded: attempt 2: attach (pass 2), pending signal catch
+PASS: gdb.threads/attach-into-signal.exp: nonthreaded: attempt 1: attach (pass 2), pending signal catch
PASS: gdb.threads/attach-into-signal.exp: successfully compiled posix threads test case
PASS: gdb.threads/attach-into-signal.exp: threaded: handle SIGALRM stop print pass
-PASS: gdb.threads/attach-into-signal.exp: threaded: attempt 1: attach (pass 1), pending signal catch
-PASS: gdb.threads/attach-into-signal.exp: threaded: attempt 1: attach (pass 2), pending signal catch
+PASS: gdb.threads/attach-into-signal.exp: threaded: attempt 2: attach (pass 1), pending signal catch
+PASS: gdb.threads/attach-into-signal.exp: threaded: attempt 4: attach (pass 2), pending signal catch
Fix this by removing the "attempt $attempt" test prefix. The attempt
number can be retrieved from gdb.log instead, since the testcase is
already using "verbose -log" to that effect.
(The 'with_test_prefix "stoppedtry $stoppedtry"' prefix is unnecessary
too, because inside that block there are no pass/fail calls. In fact
the block includes a comment saying:
# No PASS message as we may be looping in multiple
# attempts.
but I'll drop that whole loop in the next patch instead.)
After this commit we'll show:
PASS: gdb.threads/attach-into-signal.exp: nonthreaded: handle SIGALRM stop print pass
PASS: gdb.threads/attach-into-signal.exp: nonthreaded: attach (pass 1), pending signal catch
PASS: gdb.threads/attach-into-signal.exp: nonthreaded: attach (pass 2), pending signal catch
PASS: gdb.threads/attach-into-signal.exp: successfully compiled posix threads test case
PASS: gdb.threads/attach-into-signal.exp: threaded: handle SIGALRM stop print pass
PASS: gdb.threads/attach-into-signal.exp: threaded: attach (pass 1), pending signal catch
PASS: gdb.threads/attach-into-signal.exp: threaded: attach (pass 2), pending signal catch
(I've avoided reindenting to make the patch easier to maintain/read.
I'll reindent the blocks after this is in.)
gdb/testsuite/ChangeLog:
2017-10-24 Pedro Alves <palves@redhat.com>
* gdb.threads/attach-into-signal.exp (corefunc): Remove "attach
$attempt" test prefix.
Pedro Alves [Tue, 24 Oct 2017 09:43:34 +0000 (10:43 +0100)]
Fix unstable test names in gdb.python/py-objfile.exp
Currently, if you diff testsuite/gdb.sum of different builds you see
this spurious hunk:
-PASS: gdb.python/py-objfile.exp: get python valueof "sep_objfile.build_id" (
6a0bfcab663f9810ccff33c756afdebb940037d4)
+PASS: gdb.python/py-objfile.exp: get python valueof "sep_objfile.build_id" (
1f5531c657c57777b05fc95baa0025fd1d115c3b)
Fix this by syncing get_python_valueof with get_integer_valueof, which
stopped outputting the value in commit
2f20e312aad6
("get_integer_valueof: Don't output value in test name").
After this commit we'll show:
PASS: gdb.python/py-objfile.exp: get python valueof "sep_objfile.build_id"
As the comment explicitly says get_python_valueof is modeled on
get_integer_valueof, I went ahead and also added the optional 'test'
parameter while at it.
gdb/testsuite/ChangeLog:
2017-10-24 Pedro Alves <palves@redhat.com>
* lib/gdb-python.exp (get_python_valueof): Add 'test' optional
parameter and handle it. Don't output read value in test name.
Pedro Alves [Tue, 24 Oct 2017 09:43:34 +0000 (10:43 +0100)]
Fix unstable test names in gdb.gdb/unittest.exp
Currently, if you diff testsuite/gdb.sum of two builds built from different
source directories you see this spurious hunk:
-PASS: gdb.gdb/unittest.exp: maintenance check xml-descriptions /home/pedro/gdb1/src/gdb/testsuite/../features
+PASS: gdb.gdb/unittest.exp: maintenance check xml-descriptions /home/pedro/gdb2/src/gdb/testsuite/../features
After this commit we'll show instead:
PASS: gdb.gdb/unittest.exp: maintenance check xml-descriptions ${srcdir}/../features
gdb/testsuite/ChangeLog:
2017-10-24 Pedro Alves <palves@redhat.com>
* gdb.gdb/unittest.exp ('maintenance check xml-descriptions'): Use
custom test name.
Pedro Alves [Tue, 24 Oct 2017 09:43:33 +0000 (10:43 +0100)]
Fix unstable test names in gdb.base/startup-with-shell.exp
Currently, if you diff testsuite/gdb.sum of two builds in different
directories you see these spurious hunks:
-PASS: gdb.base/startup-with-shell.exp: touch /home/pedro/gdb1/build/gdb/testsuite/outputs/gdb.base/startup-with-shell/unique-file.unique-extension
+PASS: gdb.base/startup-with-shell.exp: touch /home/pedro/gdb2/build/gdb/testsuite/outputs/gdb.base/startup-with-shell/unique-file.unique-extension
-PASS: gdb.base/startup-with-shell.exp: startup_with_shell = on; run_args = *.unique-extension: set args /home/pedro/gdb1/build/gdb/testsuite/outputs/gdb.base/startup-with-shell/*.unique-extension
+PASS: gdb.base/startup-with-shell.exp: startup_with_shell = on; run_args = *.unique-extension: set args /home/pedro/gdb2/build/gdb/testsuite/outputs/gdb.base/startup-with-shell/*.unique-extension
-PASS: gdb.base/startup-with-shell.exp: startup_with_shell = off; run_args = *.unique-extension: set args /home/pedro/gdb1/build/gdb/testsuite/outputs/gdb.base/startup-with-shell/*.unique-extension
+PASS: gdb.base/startup-with-shell.exp: startup_with_shell = off; run_args = *.unique-extension: set args /home/pedro/gdb2/build/gdb/testsuite/outputs/gdb.base/startup-with-shell/*.unique-extension
Since the run_args arguments are already shown in the test prefix, we
can change the "set args" test name to literally "set args $run_args".
I.e., after this commit we'll show:
PASS: gdb.base/startup-with-shell.exp: startup_with_shell = on; run_args = *.unique-extension: set args $run_args
PASS: gdb.base/startup-with-shell.exp: startup_with_shell = off; run_args = *.unique-extension: set args $run_args
PASS: gdb.base/startup-with-shell.exp: startup_with_shell = on; run_args = $TEST: set args $run_args
PASS: gdb.base/startup-with-shell.exp: startup_with_shell = off; run_args = $TEST: set args $run_args
gdb/testsuite/ChangeLog:
2017-10-24 Pedro Alves <palves@redhat.com>
* gdb.base/startup-with-shell.exp ('touch $unique_file'): Don't
include the unstable output directory name in the test's name.
(initial_setup_simple) <'set args'>: Use custom test name.
Pedro Alves [Tue, 24 Oct 2017 09:43:33 +0000 (10:43 +0100)]
Fix unstable test names in gdb.arch/arc-tdesc-cpu.exp
Currently if you diff testsuite/gdb.sum of two builds built from
different source trees you see this spurious hunk:
-PASS: gdb.arch/arc-tdesc-cpu.exp: set tdesc filename /home/pedro/gdb1/src/gdb/testsuite/gdb.arch/arc-tdesc-cpu.xml
+PASS: gdb.arch/arc-tdesc-cpu.exp: set tdesc filename /home/pedro/gdb2/src/gdb/testsuite/gdb.arch/arc-tdesc-cpu.xml
After this commit we'll show this instead in gdb.sum:
PASS: gdb.arch/arc-tdesc-cpu.exp: set tdesc filename $srcdir/gdb.arch/arc-tdesc-cpu.xml
gdb/testsuite/ChangeLog:
2017-10-24 Pedro Alves <palves@redhat.com>
* gdb.arch/arc-tdesc-cpu.exp ('set tdesc filename'): Use gdb_test
with explicit test name.
Palmer Dabbelt [Fri, 6 Oct 2017 19:06:45 +0000 (12:06 -0700)]
RISC-V: Don't emit 2-byte NOPs if the C extension is disabled
Systems without the C extension mandate 4-byte alignment for
instructions, so there is no reason to allow for 2-byte alignment. This
change avoids emitting lots of unimplemented instructions into object
files on non-C targets, which users keep reporting as a bug. While this
isn't actually a bug (as none of the offsets in object files are
relevant until RISC-V), it is ugly.
gas/ChangeLog
2017-10-23 Palmer Dabbelt <palmer@dabbelt.com>
* config/tc-riscv.c (riscv_frag_align_code): Align code by 4
bytes on non-RVC systems.
GDB Administrator [Tue, 24 Oct 2017 00:00:31 +0000 (00:00 +0000)]
Automatic date update in version.in
H.J. Lu [Mon, 23 Oct 2017 21:44:04 +0000 (14:44 -0700)]
i386: Don't add elf32_x86_64 to supported emulations
For 32-bit BFD, since elf64-x86-64.o isn't compiled in, "-m elf32_x86_64"
never worked. Don't add elf32_x86_64 to supported emulations with 32-bit
BFD.
* configure.tgt (i[3-7]86-*-linux-*): Move elf32_x86_64 from
targ_extra_libpath to targ64_extra_libpath.
Igor Tsimbalist [Mon, 23 Oct 2017 20:09:26 +0000 (13:09 -0700)]
Add missing ChangeLog entries
Nick Clifton [Mon, 23 Oct 2017 17:16:49 +0000 (18:16 +0100)]
Make sure that undefined symbols added to the linker command line via the -u option appear in the output executable, if they have not been resolved.
PR 22319
bfd * elflink.c (elf_link_output_extsym): Keep global undefined
symbols if they have been marked as needed.
ld * testsuite/ld-elf/pr22310.s: New test source file.
* testsuite/ld-elf/pr22310.d: New test driver.
* testsuite/ld-mmix/undef-3.d: Update expected output from readelf.
Igor Tsimbalist [Mon, 23 Oct 2017 16:28:46 +0000 (19:28 +0300)]
Fix the master due to bad regenerated files
* i386-init.h: Regenerate
* i386-tbl.h: Likewise
Maciej W. Rozycki [Mon, 23 Oct 2017 14:39:46 +0000 (15:39 +0100)]
MIPS: Preset EF_MIPS_ABI2 with n32 ELF objects
Fix a bug in MIPS n32 ELF object file generation and make such objects
consistent with the n32 BFD requested, by presetting the EF_MIPS_ABI2
flag in the `e_flags' member of the newly created ELF file header, as it
is this flag that tells n32 objects apart from o32 objects.
This flag will then stay set through to output file generation for
writers such as GAS or GDB's `generate-core-file' command. Readers will
overwrite the whole of `e_flags' along with the rest of the ELF file
header in `elf_swap_ehdr_in' and then verify in `mips_elf_n32_object_p'
that the flag is still set before accepting an input file as an n32
object.
The issue was discovered with GDB's `generate-core-file' command making
o32 core files out of n32 debuggees.
bfd/
* elfn32-mips.c (mips_elf_n32_mkobject): New prototype and
function.
(bfd_elf32_mkobject): Use `mips_elf_n32_mkobject' rather than
`_bfd_mips_elf_mkobject'.
gas/
* config/tc-mips.c (mips_elf_final_processing): Don't set
EF_MIPS_ABI2 in `e_flags'.
Igor Tsimbalist [Fri, 20 Oct 2017 20:56:30 +0000 (23:56 +0300)]
Enable Intel AVX512_BITALG instructions.
Intel has disclosed a set of new instructions. The spec is
https://software.intel.com/sites/default/files/managed/c5/15/architecture-instruction-set-extensions-programming-reference.pdf
gas/
* config/tc-i386.c (cpu_arch): Add .avx512_bitalg.
(cpu_noarch): noavx512_bitalg.
* doc/c-i386.texi: Document .avx512_bitalg, noavx512_bitalg.
* testsuite/gas/i386/i386.exp: Add AVX512_BITALG tests.
* testsuite/gas/i386/avx512f_bitalg-intel.d: New test.
* testsuite/gas/i386/avx512f_bitalg.d: Likewise.
* testsuite/gas/i386/avx512f_bitalg.s: Likewise.
* testsuite/gas/i386/avx512vl_bitalg-intel.d: Likewise.
* testsuite/gas/i386/avx512vl_bitalg.d: Likewise.
* testsuite/gas/i386/avx512vl_bitalg.s: Likewise.
* testsuite/gas/i386/x86-64-avx512f_bitalg-intel.d: Likewise.
* testsuite/gas/i386/x86-64-avx512f_bitalg.d: Likewise.
* testsuite/gas/i386/x86-64-avx512f_bitalg.s: Likewise.
* testsuite/gas/i386/x86-64-avx512vl_bitalg-intel.d: Likewise.
* testsuite/gas/i386/x86-64-avx512vl_bitalg.d: Likewise.
* testsuite/gas/i386/x86-64-avx512vl_bitalg.s: Likewise.
opcodes/
* i386-dis.c (enum): Add PREFIX_EVEX_0F3854, PREFIX_EVEX_0F388F.
(enum): Add EVEX_W_0F3854_P_2.
* i386-dis-evex.h (evex_table): Updated.
* i386-gen.c (cpu_flag_init): Add CPU_AVX512_BITALG,
CPU_ANY_AVX512_BITALG_FLAGS. Update CPU_ANY_AVX512F_FLAGS.
(cpu_flags): Add CpuAVX512_BITALG.
* i386-opc.h (enum): Add CpuAVX512_BITALG.
(i386_cpu_flags): Add cpuavx512_bitalg..
* i386-opc.tbl: Add Intel AVX512_BITALG instructions.
* i386-init.h: Regenerate.
* i386-tbl.h: Likewise.
Igor Tsimbalist [Fri, 20 Oct 2017 20:52:52 +0000 (23:52 +0300)]
Enable Intel AVX512_VNNI instructions.
Intel has disclosed a set of new instructions. The spec is
https://software.intel.com/sites/default/files/managed/c5/15/architecture-instruction-set-extensions-programming-reference.pdf
gas/
* config/tc-i386.c (cpu_arch): Add .avx512_vnni.
(cpu_noarch): Add noavx512_vnni.
* doc/c-i386.texi: Document .avx512_vnni.
* testsuite/gas/i386/i386.exp: Add AVX512_VNNI tests.
* testsuite/gas/i386/avx512vnni-intel.d: New test.
* testsuite/gas/i386/avx512vnni.d: Likewise.
* testsuite/gas/i386/avx512vnni.s: Likewise.
* testsuite/gas/i386/avx512vnni_vl-intel.d: Likewise.
* testsuite/gas/i386/avx512vnni_vl.d: Likewise.
* testsuite/gas/i386/avx512vnni_vl.s: Likewise.
* testsuite/gas/i386/x86-64-avx512vnni-intel.d: Likewise.
* testsuite/gas/i386/x86-64-avx512vnni.d: Likewise.
* testsuite/gas/i386/x86-64-avx512vnni.s: Likewise.
* testsuite/gas/i386/x86-64-avx512vnni_vl-intel.d: Likewise.
* testsuite/gas/i386/x86-64-avx512vnni_vl.d: Likewise.
* testsuite/gas/i386/x86-64-avx512vnni_vl.s: Likewise.
opcodes/
* i386-dis.c (enum): Add PREFIX_EVEX_0F3850, PREFIX_EVEX_0F3851.
* i386-dis-evex.h (evex_table): Updated.
* i386-gen.c (cpu_flag_init): Add CPU_AVX512_VNNI,
CPU_ANY_AVX512_VNNI_FLAGS. Update CPU_ANY_AVX512F_FLAGS.
(cpu_flags): Add CpuAVX512_VNNI.
* i386-opc.h (enum): Add CpuAVX512_VNNI.
(i386_cpu_flags): Add cpuavx512_vnni.
* i386-opc.tbl Add Intel AVX512_VNNI instructions.
* i386-init.h: Regenerate.
* i386-tbl.h: Likewise.
Igor Tsimbalist [Fri, 20 Oct 2017 20:42:40 +0000 (23:42 +0300)]
Enable Intel VPCLMULQDQ instruction.
Intel has disclosed a set of new instructions. The spec is
https://software.intel.com/sites/default/files/managed/c5/15/architecture-instruction-set-extensions-programming-reference.pdf
gas/
* config/tc-i386.c (cpu_arch): Add VPCLMULQDQ.
* doc/c-i386.texi: Document VPCLMULQDQ.
* testsuite/gas/i386/i386.exp: Run VPCLMULQDQ tests.
* testsuite/gas/i386/avx512f_vpclmulqdq-intel.d: New test.
* testsuite/gas/i386/avx512f_vpclmulqdq-wig.s: Ditto.
* testsuite/gas/i386/avx512f_vpclmulqdq-wig1-intel.d: Ditto.
* testsuite/gas/i386/avx512f_vpclmulqdq-wig1.d: Ditto.
* testsuite/gas/i386/avx512f_vpclmulqdq.d: Ditto.
* testsuite/gas/i386/avx512f_vpclmulqdq.s: Ditto.
* testsuite/gas/i386/avx512vl_vpclmulqdq-intel.d: Ditto.
* testsuite/gas/i386/avx512vl_vpclmulqdq-wig.s: Ditto.
* testsuite/gas/i386/avx512vl_vpclmulqdq-wig1-intel.d: Ditto.
* testsuite/gas/i386/avx512vl_vpclmulqdq-wig1.d: Ditto.
* testsuite/gas/i386/avx512vl_vpclmulqdq.d: Ditto.
* testsuite/gas/i386/avx512vl_vpclmulqdq.s: Ditto.
* testsuite/gas/i386/vpclmulqdq-intel.d: Ditto.
* testsuite/gas/i386/vpclmulqdq.d: Ditto.
* testsuite/gas/i386/vpclmulqdq.s: Ditto.
* testsuite/gas/i386/x86-64-avx512f_vpclmulqdq-intel.d: Ditto.
* testsuite/gas/i386/x86-64-avx512f_vpclmulqdq-wig.s: Ditto.
* testsuite/gas/i386/x86-64-avx512f_vpclmulqdq-wig1-intel.d: Ditto.
* testsuite/gas/i386/x86-64-avx512f_vpclmulqdq-wig1.d: Ditto.
* testsuite/gas/i386/x86-64-avx512f_vpclmulqdq.d: Ditto.
* testsuite/gas/i386/x86-64-avx512f_vpclmulqdq.s: Ditto.
* testsuite/gas/i386/x86-64-avx512vl_vpclmulqdq-intel.d: Ditto.
* testsuite/gas/i386/x86-64-avx512vl_vpclmulqdq-wig.s: Ditto.
* testsuite/gas/i386/x86-64-avx512vl_vpclmulqdq-wig1-intel.d: Ditto.
* testsuite/gas/i386/x86-64-avx512vl_vpclmulqdq-wig1.d: Ditto.
* testsuite/gas/i386/x86-64-avx512vl_vpclmulqdq.d: Ditto.
* testsuite/gas/i386/x86-64-avx512vl_vpclmulqdq.s: Ditto.
* testsuite/gas/i386/x86-64-vpclmulqdq-intel.d: Ditto.
* testsuite/gas/i386/x86-64-vpclmulqdq.d: Ditto.
* testsuite/gas/i386/x86-64-vpclmulqdq.s: Ditto.
opcodes/
* i386-dis.c (enum): Add PREFIX_EVEX_0F3A44.
(enum): Remove VEX_LEN_0F3A44_P_2.
(vex_len_table): Ditto.
(enum): Remove VEX_W_0F3A44_P_2.
(vew_w_table): Ditto.
(prefix_table): Adjust instructions (see prefixes above).
* i386-dis-evex.h (evex_table):
Add new instructions (see prefixes above).
* i386-gen.c (cpu_flag_init): Add VPCLMULQDQ.
(bitfield_cpu_flags): Ditto.
* i386-opc.h (enum): Ditto.
(i386_cpu_flags): Ditto.
(CpuUnused): Comment out to avoid zero-width field problem.
* i386-opc.tbl (vpclmulqdq): New instruction.
* i386-init.h: Regenerate.
* i386-tbl.h: Ditto.
Igor Tsimbalist [Fri, 20 Oct 2017 20:35:45 +0000 (23:35 +0300)]
Enable Intel VAES instructions.
Intel has disclosed a set of new instructions. The spec is
https://software.intel.com/sites/default/files/managed/c5/15/architecture-instruction-set-extensions-programming-reference.pdf
gas/
* config/tc-i386.c (cpu_arch): Add VAES.
* doc/c-i386.texi: Document VAES.
* testsuite/gas/i386/i386.exp: Run VAES tests.
* testsuite/gas/i386/avx512f_vaes-intel.d: New test.
* testsuite/gas/i386/avx512f_vaes-wig.s: Ditto.
* testsuite/gas/i386/avx512f_vaes-wig1-intel.d: Ditto.
* testsuite/gas/i386/avx512f_vaes-wig1.d: Ditto.
* testsuite/gas/i386/avx512f_vaes.d: Ditto.
* testsuite/gas/i386/avx512f_vaes.s: Ditto.
* testsuite/gas/i386/avx512vl_vaes-intel.d: Ditto.
* testsuite/gas/i386/avx512vl_vaes-wig.s: Ditto.
* testsuite/gas/i386/avx512vl_vaes-wig1-intel.d: Ditto.
* testsuite/gas/i386/avx512vl_vaes-wig1.d: Ditto.
* testsuite/gas/i386/avx512vl_vaes.d: Ditto.
* testsuite/gas/i386/avx512vl_vaes.s: Ditto.
* testsuite/gas/i386/vaes-intel.d: Ditto.
* testsuite/gas/i386/vaes.d: Ditto.
* testsuite/gas/i386/vaes.s: Ditto.
* testsuite/gas/i386/x86-64-avx512f_vaes-intel.d: Ditto.
* testsuite/gas/i386/x86-64-avx512f_vaes-wig.s: Ditto.
* testsuite/gas/i386/x86-64-avx512f_vaes-wig1-intel.d: Ditto.
* testsuite/gas/i386/x86-64-avx512f_vaes-wig1.d: Ditto.
* testsuite/gas/i386/x86-64-avx512f_vaes.d: Ditto.
* testsuite/gas/i386/x86-64-avx512f_vaes.s: Ditto.
* testsuite/gas/i386/x86-64-avx512vl_vaes-intel.d: Ditto.
* testsuite/gas/i386/x86-64-avx512vl_vaes-wig.s: Ditto.
* testsuite/gas/i386/x86-64-avx512vl_vaes-wig1-intel.d: Ditto.
* testsuite/gas/i386/x86-64-avx512vl_vaes-wig1.d: Ditto.
* testsuite/gas/i386/x86-64-avx512vl_vaes.d: Ditto.
* testsuite/gas/i386/x86-64-avx512vl_vaes.s: Ditto.
* testsuite/gas/i386/x86-64-vaes-intel.d: Ditto.
* testsuite/gas/i386/x86-64-vaes.d: Ditto.
* testsuite/gas/i386/x86-64-vaes.s: Ditto.
opcodes/
* i386-dis.c (enum): Add PREFIX_EVEX_0F38DC, PREFIX_EVEX_0F38DD,
PREFIX_EVEX_0F38DE, PREFIX_EVEX_0F38DF.
(enum): Remove VEX_LEN_0F38DC_P_2, VEX_LEN_0F38DD_P_2,
VEX_LEN_0F38DE_P_2, VEX_LEN_0F38DF_P_2.
(vex_len_table): Ditto.
(enum): Remove VEX_W_0F38DC_P_2, VEX_W_0F38DD_P_2,
VEX_W_0F38DE_P_2, VEX_W_0F38DF_P_2.
(vew_w_table): Ditto.
(prefix_table): Adjust instructions (see prefixes above).
* i386-dis-evex.h (evex_table):
Add new instructions (see prefixes above).
* i386-gen.c (cpu_flag_init): Add VAES.
(bitfield_cpu_flags): Ditto.
* i386-opc.h (enum): Ditto.
(i386_cpu_flags): Ditto.
* i386-opc.tbl (vaes{enc,dec}{last,}): New instructions.
* i386-init.h: Regenerate.
* i386-tbl.h: Ditto.
Igor Tsimbalist [Fri, 20 Oct 2017 20:26:11 +0000 (23:26 +0300)]
Enable Intel GFNI instructions.
Intel has disclosed a set of new instructions. The spec is
https://software.intel.com/sites/default/files/managed/c5/15/architecture-instruction-set-extensions-programming-reference.pdf
gas/
* config/tc-i386.c (cpu_arch): Add .gfni.
* doc/c-i386.texi: Document .gfni.
* testsuite/gas/i386/i386.exp: Add GFNI tests.
* testsuite/gas/i386/avx.s: New GFNI test.
* testsuite/gas/i386/x86-64-avx.s: Likewise.
* testsuite/gas/i386/avx.d: Adjust.
* testsuite/gas/i386/avx-intel.d: Likewise
* testsuite/gas/i386/ilp32/x86-64-avx-intel.d: Likewise.
* testsuite/gas/i386/ilp32/x86-64-avx.d: Likewise.
* testsuite/gas/i386/avx512f_gfni-intel.d: New test.
* testsuite/gas/i386/avx512f_gfni.d: Likewise.
* testsuite/gas/i386/avx512f_gfni.s: Likewise.
* testsuite/gas/i386/avx512vl_gfni-intel.d: Likewise.
* testsuite/gas/i386/avx512vl_gfni.d: Likewise.
* testsuite/gas/i386/avx512vl_gfni.s: Likewise.
* testsuite/gas/i386/gfni-intel.d: Likewise.
* testsuite/gas/i386/gfni.d: Likewise.
* testsuite/gas/i386/gfni.s: Likewise.
* testsuite/gas/i386/x86-64-avx512f_gfni-intel.d: Likewise.
* testsuite/gas/i386/x86-64-avx512f_gfni.d: Likewise.
* testsuite/gas/i386/x86-64-avx512f_gfni.s: Likewise.
* testsuite/gas/i386/x86-64-avx512vl_gfni-intel.d: Likewise.
* testsuite/gas/i386/x86-64-avx512vl_gfni.d: Likewise.
* testsuite/gas/i386/x86-64-avx512vl_gfni.s: Likewise.
* testsuite/gas/i386/x86-64-avx_gfni-intel.d: Likewise.
* testsuite/gas/i386/x86-64-avx_gfni.d: Likewise.
* testsuite/gas/i386/x86-64-avx_gfni.s: Likewise.
* testsuite/gas/i386/x86-64-gfni-intel.d: Likewise.
* testsuite/gas/i386/x86-64-gfni.d: Likewise.
* testsuite/gas/i386/x86-64-gfni.s: Likewise.
opcodes/
* i386-dis.c (enum): Add PREFIX_0F38CF, PREFIX_0F3ACE, PREFIX_0F3ACF,
PREFIX_VEX_0F38CF, PREFIX_VEX_0F3ACE, PREFIX_VEX_0F3ACF,
PREFIX_EVEX_0F38CF, PREFIX_EVEX_0F3ACE, PREFIX_EVEX_0F3ACF.
(enum): Add VEX_W_0F38CF_P_2, VEX_W_0F3ACE_P_2, VEX_W_0F3ACF_P_2,
EVEX_W_0F3ACE_P_2, EVEX_W_0F3ACF_P_2.
(prefix_table): Updated (see prefixes above).
(three_byte_table): Likewise.
(vex_w_table): Likewise.
* i386-dis-evex.h: Likewise.
* i386-gen.c (cpu_flag_init): Add CPU_GFNI_FLAGS, CpuGFNI.
(cpu_flags): Add CpuGFNI.
* i386-opc.h (enum): Add CpuGFNI.
(i386_cpu_flags): Add cpugfni.
* i386-opc.tbl: Add Intel GFNI instructions.
* i386-init.h: Regenerate.
* i386-tbl.h: Likewise.
Igor Tsimbalist [Fri, 20 Oct 2017 19:52:59 +0000 (22:52 +0300)]
Enable Intel AVX512_VBMI2 instructions.
Intel has disclosed a set of new instructions. The spec is
https://software.intel.com/sites/default/files/managed/c5/15/architecture-instruction-set-extensions-programming-reference.pdf
gas/
* config/tc-i386.c (cpu_arch): Add .avx512_vbmi2.
(cpu_noarch): noavx512_vbmi2.
* doc/c-i386.texi: Document .avx512_vbmi2, noavx512_vbmi2.
* testsuite/gas/i386/i386.exp: Add AVX512_VBMI2 tests.
* testsuite/gas/i386/avx512vbmi2-intel.d: New test.
* testsuite/gas/i386/avx512vbmi2.d: Likewise.
* testsuite/gas/i386/avx512vbmi2.s: Likewise.
* testsuite/gas/i386/avx512vbmi2_vl-intel.d: Likewise.
* testsuite/gas/i386/avx512vbmi2_vl.d: Likewise.
* testsuite/gas/i386/avx512vbmi2_vl.s: Likewise.
* testsuite/gas/i386/x86-64-avx512vbmi2-intel.d: Likewise.
* testsuite/gas/i386/x86-64-avx512vbmi2.d: Likewise.
* testsuite/gas/i386/x86-64-avx512vbmi2.s: Likewise.
* testsuite/gas/i386/x86-64-avx512vbmi2_vl-intel.d: Likewise.
* testsuite/gas/i386/x86-64-avx512vbmi2_vl.d: Likewise.
* testsuite/gas/i386/x86-64-avx512vbmi2_vl.s: Likewise.
opcodes/
* i386-dis.c (enum): Add b_scalar_mode, w_scalar_mode.
Define EXbScalar and EXwScalar for OP_EX.
(enum): Add PREFIX_EVEX_0F3862, PREFIX_EVEX_0F3863,
PREFIX_EVEX_0F3870, PREFIX_EVEX_0F3871, PREFIX_EVEX_0F3872,
PREFIX_EVEX_0F3873, PREFIX_EVEX_0F3A70, PREFIX_EVEX_0F3A71,
PREFIX_EVEX_0F3A72, PREFIX_EVEX_0F3A73.
(enum): Add EVEX_W_0F3862_P_2, EVEX_W_0F3863_P_2,
EVEX_W_0F3870_P_2, EVEX_W_0F3871_P_2, EVEX_W_0F3872_P_2,
EVEX_W_0F3873_P_2, EVEX_W_0F3A70_P_2, EVEX_W_0F3A71_P_2,
EVEX_W_0F3A72_P_2, EVEX_W_0F3A73_P_2.
(intel_operand_size): Handle b_scalar_mode and w_scalar_mode.
(OP_E_memory): Likewise.
* i386-dis-evex.h: Updated.
* i386-gen.c (cpu_flag_init): Add CPU_AVX512_VBMI2,
CPU_ANY_AVX512_VBMI2_FLAGS. Update CPU_ANY_AVX512F_FLAGS.
(cpu_flags): Add CpuAVX512_VBMI2.
* i386-opc.h (enum): Add CpuAVX512_VBMI2.
(i386_cpu_flags): Add cpuavx512_vbmi2.
* i386-opc.tbl: Add Intel AVX512_VBMI2 instructions.
* i386-init.h: Regenerate.
* i386-tbl.h: Likewise.
GDB Administrator [Mon, 23 Oct 2017 00:00:26 +0000 (00:00 +0000)]
Automatic date update in version.in
Hans-Peter Nilsson [Sun, 22 Oct 2017 11:32:44 +0000 (13:32 +0200)]
Fix spurious left-over quotes from last edit.
With a 32-bit bfd (default on an ILP32 system) the previous markings
on tests *were* correct. There, the results have been consistent
since they were added. The tests would appear to "spuriously" xpass
"only" on LP64 hosts, which were not the norm in 2000. (But, now CRIS
requires a 64-bit BFD.)
Hans-Peter Nilsson [Sun, 22 Oct 2017 11:05:07 +0000 (13:05 +0200)]
Fix gas/22304 by forcing a 64-bit bfd for cris*-*.
PR gas/22304
* config.bfd (cris-*-* | crisv32-*-*): Require a 64-bit BFD.
GDB Administrator [Sun, 22 Oct 2017 00:00:28 +0000 (00:00 +0000)]
Automatic date update in version.in
Hans-Peter Nilsson [Sat, 21 Oct 2017 17:46:22 +0000 (19:46 +0200)]
PR ld/21233
* testsuite/ld-elf/shared.exp: Remove kfails.
The test-cases started passing with
5c3261b0e834647c,
"ELF: Call check_relocs after opening all inputs".
The lists could now be re-concatenated (see other run_ld_link_tests
calls in shared.exp), but are for now left separate to simplify future
kfail/xfailing.
Simon Marchi [Sat, 21 Oct 2017 16:20:21 +0000 (12:20 -0400)]
Add overloads of for_each_thread/find_thread that filter on pid
It happens often that we want to iterate or find threads restricted to a
given pid. I think it's worth having an overload to help with this.
Right now there is a single user of each of the find_thread and
for_each_thread overload, but as we replace the usages of find_inferior
with for_each_thread/find_thread, more usages will pop up.
gdb/gdbserver/ChangeLog:
* gdbthread.h (find_thread, for_each_thread): New functions.
* inferiors.c (thread_of_pid): Remove.
(find_any_thread_of_pid): Use find_thread.
* linux-low.c (num_lwps): Use for_each_thread.
Simon Marchi [Sat, 21 Oct 2017 16:06:42 +0000 (12:06 -0400)]
Get rid of VEC (mem_region)
This patch removes VEC (mem_region). Doing so requires touching a lot
of little things here and there.
The fields in mem_attrib are now initialized during construction. The
values match those that were in default_mem_attrib (now removed).
unknown_mem_attrib is also removed, and replaced with a static method
(mem_attrib::unknown) that returns the equivalent.
mem_region is initialized in a way similar to mem_region_init (now
removed) did.
I found the organization of mem_region_list and target_mem_region_list a
bit confusing. Sometimes mem_region_list points to the same vector as
target_mem_region_list (and therefore does not own it), and sometimes
(when the user manually edits the mem regions) points to another vector,
and in this case owns it. To avoid this ambiguity, I think it is
simpler to have two vectors, one for target-defined regions and one for
user-defined regions, and have mem_region_list point to one or the
other. There are now no vector objects dynamically allocated, both are
static.
The make-target-delegates script does not generate valid code when a
target method returns a type with a parameter list. For this reason, I
created a typedef (mem_region_vector) that's only used in the target_ops
structure. If you speak perl, you are welcome to improve the script!
Regtested on the buildbot.
gdb/ChangeLog:
* memattr.h: Don't include vec.h.
(struct mem_attrib): Initialize fields.
<unknown>: New static method.
(struct mem_region): Add constructors, operator<, initialize
fields.
* memattr.c: Include algorithm.
(default_mem_attrib, unknown_mem_attrib): Remove.
(user_mem_region_list): New global.
(target_mem_region_list, mem_region_list): Change type to
std::vector<mem_region>.
(mem_use_target): Now a function.
(target_mem_regions_valid): Change type to bool.
(mem_region_lessthan, mem_region_cmp, mem_region_init): Remove.
(require_user_regions): Adjust.
(require_target_regions): Adjust.
(create_mem_region): Adjust.
(lookup_mem_region): Adjust.
(invalidate_target_mem_regions): Adjust.
(mem_clear): Rename to...
(user_mem_clear): ... this, and adjust.
(mem_command): Adjust.
(info_mem_command): Adjust.
(mem_enable, enable_mem_command, mem_disable,
disable_mem_command): Adjust.
(mem_delete): Adjust.
(delete_mem_command): Adjust.
* memory-map.h (parse_memory_map): Return an std::vector.
* memory-map.c (parse_memory_map): Likewise.
(struct memory_map_parsing_data): Add constructor.
<memory_map>: Point to std::vector.
(memory_map_start_memory): Adjust.
(memory_map_end_memory): Adjust.
(memory_map_end_property): Adjust.
(clear_result): Remove.
* remote.c (remote_memory_map): Return an std::vector.
* target-debug.h (target_debug_print_VEC_mem_region_s__p):
Remove.
(target_debug_print_mem_region_vector): New.
* target-delegates.c: Regenerate.
* target.h (mem_region_vector): New typedef.
(to_memory_map): Return mem_region_vector.
(target_memory_map): Return an std::vector.
* target.c (target_memory_map): Return an std::vector.
(flash_erase_command): Adjust.