Andrew Burgess [Tue, 6 Mar 2018 16:19:52 +0000 (16:19 +0000)]
gdb/riscv: Remove use of pseudo registers
The code making use of pseudo registers was initially intended to
support running 32-bit ABI files on 64-bit riscv targets. However, the
implementation was incomplete, and broken.
For now I've removed all reference to pseudo registers from the riscv
target, we've not lost any functionality, and this cleans up failures in
the selftests.
Once the riscv target has matured a little we'll probably end up
bringing back some of the use of pseudo registers in order to better
support running 32-bit executables on a 64-bit target.
gdb/ChangeLog:
* riscv-tdep.c (riscv_pseudo_register_read): Delete.
(riscv_pseudo_register_write): Delete.
(riscv_gdbarch_init): Remove all use of pseudo registers.
Simon Marchi [Tue, 6 Mar 2018 14:51:33 +0000 (09:51 -0500)]
btrace: Remove ui_out cleanups
This patch replaces the cleanups that close the list and tuple of the
btrace instruction history output with ui_out_emit_tuple and
ui_out_emit_list.
This allows removing make_cleanup_ui_out_tuple_begin_end and
make_cleanup_ui_out_list_begin_end.
This patch (along with the previous ones in the series) was regtested on
the buildbot.
gdb/ChangeLog:
* record-btrace.c (btrace_print_lines): Replace cleanup
parameter with RAII equivalents.
(btrace_insn_history): Replace cleanup with RAII equivalents.
* ui-out.h (make_cleanup_ui_out_list_begin_end,
make_cleanup_ui_out_tuple_begin_end): Remove.
* ui-out.c (struct ui_out_end_cleanup_data, do_cleanup_end,
make_cleanup_ui_out_end, make_cleanup_ui_out_tuple_begin_end,
make_cleanup_ui_out_list_begin_end): Remove.
Simon Marchi [Tue, 6 Mar 2018 14:51:33 +0000 (09:51 -0500)]
btrace: Remove VEC cleanups
This patch replaces two VEC(tp_t) with std::vector<thread_info *>, which
allows to remove two cleanups. To make it easier to map the old code to
the new code, I added the ordered_remove and unordered_remove functions,
which operate on std::vector and do the same as VEC's
ordered_remove/unordered_remove.
gdb/ChangeLog:
* record-btrace.c (record_btrace_maybe_mark_async_event): Change
parameter types to std::vector. Use bool.
(record_btrace_wait): Replace VEC(tp_t) with
std::vector<thread_info *>.
* common/gdb_vecs.h (unordered_remove, ordered_remove): New.
Simon Marchi [Tue, 6 Mar 2018 14:51:32 +0000 (09:51 -0500)]
btrace: Remove btrace disable cleanup
This patch removes a cleanup that disables btrace on threads in case of
failure, so we don't leave it enabled for some the threads and disabled
for the rest.
gdb/ChangeLog:
* record-btrace.c (record_btrace_disable_callback): Remove.
(struct scoped_btrace_disable): New.
(record_btrace_open): Use scoped_btrace_disable.
Andrew Burgess [Tue, 6 Mar 2018 13:20:14 +0000 (13:20 +0000)]
gdb/riscv: Fix type when reading register from regcache
Should use a ULONGEST when reading from the regcache.
gdb/ChangeLog:
* riscv-tdep.c (riscv_return_value): Change type to ULONGEST for
reading values from registers.
Andrew Burgess [Tue, 6 Mar 2018 13:05:34 +0000 (13:05 +0000)]
gdb/riscv: Additional print format string fixes
Another riscv format string fix.
gdb/ChangeLog:
* riscv-tdep.c (riscv_push_dummy_call): Use core_addr_to_string_nz
where appropriate.
Andrew Burgess [Tue, 6 Mar 2018 12:31:07 +0000 (12:31 +0000)]
gdb/riscv: Fixes to printf format strings
Some of the format strings used in the new riscv target were incorrect,
resulting in build failures on some hosts. This commit does the
following:
1. Uses core_addr_to_string for formatting CORE_ADDR types.
2. Fixes legacy use of stderr for logging in one place that got
missed, instead gdb_stdlog is used.
3. Re-indent a few printf related lines that were wrong.
This should resolve some (but not all) of the build failures the new
riscv target introduced.
gdb/ChangeLog:
* riscv-tdep.c (riscv_print_arg_location): Add header comment,
change parameter type. Use GDB's print functions, and use
core_addr_to_string where appropriate.
(riscv_push_dummy_call): Use core_addr_to_string where
appropriate, update call to riscv_print_arg_location, and reindent
a few lines.
(riscv_return_value): Update call to riscv_print_arg_location.
Andrew Burgess [Thu, 9 Nov 2017 20:59:13 +0000 (20:59 +0000)]
gdb: Initial baremetal riscv support
This commit introduces basic support for baremetal RiscV as a GDB
target. This target is currently only tested against the RiscV software
simulator, which is not included as part of this commit. The target has
been tested against the following RiscV variants: rv32im, rv32imc,
rv32imf, rv32imfc, rv64im, rv64imc, rv64imfd, rv64imfdc.
Across these variants we pass on average 34858 tests, and fail 272
tests, which is ~0.8%.
The RiscV has a feature of its ABI where structures with a single
floating point field, a single complex float field, or one float and
one integer field are treated differently for argument passing. The
new test gdb.base/infcall-nested-structs.exp is added to cover this
feature. As passing these structures should work on all targets then
I've made the test as a generic one, even though, for most targets,
there's probably nothing special about any of these cases.
gdb/ChangeLog:
* Makefile.in (ALL_TARGET_OBS): Add riscv-tdep.o
(HFILES_NO_SRCDIR): Add riscv-tdep.h.
(ALLDEPFILES): Add riscv-tdep.c
* configure.tgt: Add riscv support.
* riscv-tdep.c: New file.
* riscv-tdep.h: New file.
* NEWS: Mention new target.
* MAINTAINERS: Add entry for riscv.
gdb/testsuite/ChangeLog:
* gdb.base/infcall-nested-structs.exp: New file.
* gdb.base/infcall-nested-structs.c: New file.
* gdb.base/float.exp: Add riscv support.
Andrew Burgess [Fri, 2 Mar 2018 15:48:23 +0000 (15:48 +0000)]
gdb/amd64: Ignore zero sized fields when calling functions
In some cases passing an argument to a function on amd64, or attempting
to fetch the return value, can trigger an assertion failure within GDB.
An example of a type that would trigger such an error is:
struct foo_t
{
long double a;
struct {
struct {
/* Empty. */
} es1;
} s1;
};
GCC does permit empty structures, so we should probably support this.
The test that exposes this bug is in the next commit along with the
RiscV support.
gdb/ChangeLog:
* amd64-tdep.c (amd64_classify_aggregate): Ignore zero sized
fields within aggregates.
GDB Administrator [Tue, 6 Mar 2018 00:00:25 +0000 (00:00 +0000)]
Automatic date update in version.in
H.J. Lu [Mon, 5 Mar 2018 11:44:46 +0000 (03:44 -0800)]
Use binary search on dynamic relocations
Replace linear search with binary search on dynamic relocations. After
finding a match, scan backward to the first matching relocation, then
scan forward for a matching relocation with non-absolute symbol.
On Fedora 27 x86-64, time for "objdump -d" on libxul.so from RHEL 7.4
x86-64 went from
134.46user 0.12system 2:15.03elapsed
to
8.49user 0.14system 0:08.64elapsed
PR binutils/22911
* objdump.c (is_significant_symbol_name): Return TRUE for all
.plt* sections.
(find_symbol_for_address): Replace linear search with binary
search on dynamic relocations.
Simon Marchi [Mon, 5 Mar 2018 01:02:35 +0000 (20:02 -0500)]
Propagate gdb_disassembly_flags to btrace_print_lines
This function can take the flags as the gdb_disassembly_flags type
instead of int.
gdb/ChangeLog:
* record-btrace.c (btrace_print_lines): Change type of flags to
gdb_disassembly_flags.
GDB Administrator [Mon, 5 Mar 2018 00:00:35 +0000 (00:00 +0000)]
Automatic date update in version.in
John Baldwin [Sun, 4 Mar 2018 05:25:33 +0000 (21:25 -0800)]
Use signal information to determine SIGTRAP type for FreeBSD.
Use the signal code from siginfo_t to distinguish SIGTRAP events due
to trace traps (TRAP_TRACE) and software breakpoints (TRAP_BRKPT).
For software breakpoints, adjust the PC when the event is reported as
part of the API when supplying "stopped_by_sw_breakpoint". Currently
FreeBSD only supports hardware watchpoints and breakpoints on x86
which are reported as trace traps. Signal information is not used on
MIPS and sparc64 kernels which do not reliably report TRAP_BRKPT for
software breakpoints.
gdb/ChangeLog:
* fbsd-nat.c: Include "inf-ptrace.h".
(USE_SIGTRAP_SIGINFO): Conditionally define.
[USE_SIGTRAP_SIGINFO] (fbsd_handle_debug_trap): New function.
(fbsd_wait) [USE_SIGTRAP_SIGINFO]: Call "fbsd_handle_debug_trap".
[USE_SIGTRAP_SIGINFO] (fbsd_stopped_by_sw_breakpoint): New
function.
[USE_SIGTRAP_SIGINFO] (fbsd_supports_stopped_by_sw_breakpoint):
Likewise.
[USE_SIGTRAP_SIGINFO] (fbsd_supports_stopped_by_hw_breakpoint):
Likewise.
(fbsd_nat_add_target) [USE_SIGTRAP_SIGINFO]: Set
"stopped_by_sw_breakpoint", "supports_stopped_by_sw_breakpoint",
"supports_stopped_by_hw_breakpoint" target methods.
John Baldwin [Sun, 4 Mar 2018 05:25:33 +0000 (21:25 -0800)]
Add a new debug knob for the FreeBSD native target.
For now this just logs information about the state of the current LWP
for each STOPPED event in fbsd_wait().
gdb/ChangeLog:
* NEWS (Changes since GDB 8.1): Add "set/show debug fbsd-nat".
* fbsd-nat.c (debug_fbsd_nat): New variable.
(show_fbsd_nat_debug): New function.
(fbsd_wait): Log LWP info if "debug_fbsd_nat" is enabled.
(_initialize_fbsd_nat): Add "fbsd-nat" debug boolean command.
gdb/doc/ChangeLog:
* gdb.texinfo (Debugging Output): Document "set/show debug
fbsd-nat".
John Baldwin [Sun, 4 Mar 2018 05:25:33 +0000 (21:25 -0800)]
Implement "to_stopped_by_hw_breakpoint" for x86 debug registers.
Report that a thread is stopped by a hardware breakpoint if a non-data
watchpoint is set in DR6. This change should be a no-op since a target
still needs to implement the "to_supports_stopped_by_hw_breakpoint"
method before this function is used.
gdb/ChangeLog:
* nat/x86-dregs.c (x86_dr_stopped_by_hw_breakpoint): New function.
* nat/x86-dregs.h (x86_dr_stopped_by_hw_breakpoint): New
prototype.
* x86-nat.c (x86_stopped_by_hw_breakpoint): New function.
(x86_use_watchpoints): Set "stopped_by_hw_breakpoint" target
method.
GDB Administrator [Sun, 4 Mar 2018 00:00:48 +0000 (00:00 +0000)]
Automatic date update in version.in
James Cowgill [Sat, 3 Mar 2018 15:49:21 +0000 (15:49 +0000)]
PR ld/21900: MIPS: Fix relocation processing with undefined symbols
Currently, when `mips_elf_calculate_relocation' is asked to relocate an
undefined symbol, it reports an error or a warning and immediately
returns without performing the relocation. This is fine if the link
fails, but if unresolved_syms_in_objects == RM_GENERATE_WARNING, the
link will continue and output some unrelocated code, which is a
regression from commit
e7e2196da3f0 ("MIPS/BFD: Correctly report
undefined relocations").
Fix this by continuing after calling the `undefined_symbol' hook unless
this is an error condition.
bfd/
PR ld/21900
* elfxx-mips.c (mips_elf_calculate_relocation): Only return
after calling `undefined_symbol' hook if this is an error
condition. Assume the value of 0 for the symbol requested
otherwise.
ld/
PR ld/21900
* testsuite/ld-mips-elf/undefined-warn.d: New test.
* testsuite/ld-mips-elf/undefined.s: Add padding at the end.
* testsuite/ld-mips-elf/mips-elf.exp: Run the new test.
Simon Marchi [Sat, 3 Mar 2018 04:27:46 +0000 (23:27 -0500)]
handle_general_set: Remove useless xstrdup
Unless I'm missing something very obvious, this xstrdup seems
unnecessary to me. We can pass "mode" directly to sprintf.
gdb/gdbserver/ChangeLog:
* server.c (handle_general_set): Remove unnecessary xstrdup.
Simon Marchi [Sat, 3 Mar 2018 04:22:10 +0000 (23:22 -0500)]
Remove free_char_ptr_vec
Nothing is using it anymore.
gdb/ChangeLog:
* common/gdb_vecs.c (free_char_ptr_vec): Remove.
* common/gdb_vecs.h (free_char_ptr_vec): Remove.
Simon Marchi [Sat, 3 Mar 2018 04:22:09 +0000 (23:22 -0500)]
C++ify charsets
This patch makes the charset list an std::vector instead of a VEC.
Because we must have access to the raw pointers as a simple array, we
can't use a vector of unique_ptr/unique_xmalloc_ptr. Therefore, wrap
the vector in a simple class to facilitate the cleanup. This allows
removing one usage of free_char_ptr_vec.
gdb/ChangeLog:
* charset.c (struct charset_vector): New.
(charsets): Change type to charset_vector.
(find_charset_names): Adjust.
(add_one): Adjust.
(_initialize_charset): Adjust.
Simon Marchi [Sat, 3 Mar 2018 04:22:08 +0000 (23:22 -0500)]
Make program_space::deleted_solibs a vector of std::string
This allows removing a usage of free_char_ptr_vec.
gdb/ChangeLog:
* progspace.h (struct program_space) <deleted_solibs>: Change
type to std::vector<std::string>.
* progspace.c (clear_program_space_solib_cache): Adjust.
* breakpoint.c (print_solib_event): Adjust.
(check_status_catch_solib): Adjust.
* solib.c (update_solib_list): Adjust.
* ui-out.h (class ui_out) <field_string>: New overload.
* ui-out.c (ui_out::field_string): New overload.
Simon Marchi [Sat, 3 Mar 2018 04:22:08 +0000 (23:22 -0500)]
C++ify program_space
This patch makes program_space a C++ object by adding a
constructor/destructor, giving default values to fields, and using
new/delete.
gdb/ChangeLog:
* progspace.h (struct program_space): Add constructor and
destructor, initialize fields.
(add_program_space): Remove.
* progspace.c (add_program_space): Rename to...
(program_space::program_space): ... this.
(release_program_space): Rename to...
(program_space::~program_space): ... this.
(delete_program_space): Use delete to delete program_space.
(initialize_progspace): Use new to allocate program_space.
* inferior.c (add_inferior_with_spaces): Likewise.
(clone_inferior_command): Likewise.
* infrun.c (follow_fork_inferior): Likewise.
(handle_vfork_child_exec_or_exit): Likewise.
Simon Marchi [Sat, 3 Mar 2018 04:22:06 +0000 (23:22 -0500)]
Make delim_string_to_char_ptr_vec return an std::vector
This patch makes delim_string_to_char_ptr_vec and all related functions
use std::vector of gdb::unique_xmalloc_ptr. This allows getting rid of
make_cleanup_free_char_ptr_vec. Returning a vector of
unique_xmalloc_ptr instead of std::string allows to minimize the impacts
on the calling code. We can evaluate later whether we could/should
return a vector of std::strings instead.
gdb/ChangeLog:
* common/gdb_vecs.h (make_cleanup_free_char_ptr_vec): Remove.
(delim_string_to_char_ptr_vec): Return std::vector of
gdb::unique_xmalloc_ptr.
(dirnames_to_char_ptr_vec_append): Take std::vector of
gdb::unique_xmalloc_ptr.
(dirnames_to_char_ptr_vec): Return std::vector of
gdb::unique_xmalloc_ptr.
* common/gdb_vecs.c (delim_string_to_char_ptr_vec_append):
Take std::vector of gdb::unique_xmalloc_ptr, adjust the code.
(delim_string_to_char_ptr_vec): Return an std::vector of
gdb::unique_xmalloc_ptr, adjust the code.
(dirnames_to_char_ptr_vec_append): Take an std::vector of
gdb::unique_xmalloc_ptr, adjust the code.
(dirnames_to_char_ptr_vec): Return an std::vector of
gdb::unique_xmalloc_ptr, adjust the code.
* auto-load.c (auto_load_safe_path_vec): Change type to
std::vector of gdb::unique_xmalloc_ptr.
(auto_load_expand_dir_vars): Return an std::vector of
gdb::unique_xmalloc_ptr, adjust the code.
(auto_load_safe_path_vec_update): Adjust.
(filename_is_in_auto_load_safe_path_vec): Adjust.
(auto_load_objfile_script_1): Adjust.
* build-id.c (build_id_to_debug_bfd): Adjust.
* linux-thread-db.c (thread_db_load_search): Adjust.
* source.c (add_path): Adjust.
(openp): Adjust.
* symfile.c (find_separate_debug_file): Adjust.
* utils.c (do_free_char_ptr_vec): Remove.
(make_cleanup_free_char_ptr_vec): Remove.
gdb/gdbserver/ChangeLog:
* server.c (parse_debug_format_options): Adjust to
delim_string_to_char_ptr_vec changes.
* thread-db.c (thread_db_load_search): Adjust to
dirnames_to_char_ptr_vec changes.
Alan Modra [Thu, 1 Mar 2018 21:53:50 +0000 (08:23 +1030)]
opcodes error messages
Another patch aimed at making binutils comply with the GNU coding
standard. The generated files require
https://sourceware.org/ml/cgen/2018-q1/msg00004.html
cpu/
* frv.opc: Include opintl.h.
(add_next_to_vliw): Use opcodes_error_handler to print error.
Standardize error message.
(fr500_check_insn_major_constraints, frv_vliw_add_insn): Likewise.
opcodes/
* sysdep.h (opcodes_error_handler): Define.
(_bfd_error_handler): Declare.
* Makefile.am: Remove stray #.
* opc2c.c (main): Remove bogus -l arg handling. Print "DO NOT
EDIT" comment.
* aarch64-dis.c, * arc-dis.c, * arm-dis.c, * avr-dis.c,
* d30v-dis.c, * h8300-dis.c, * mmix-dis.c, * ppc-dis.c,
* riscv-dis.c, * s390-dis.c, * sparc-dis.c, * v850-dis.c: Use
opcodes_error_handler to print errors. Standardize error messages.
* msp430-decode.opc, * nios2-dis.c, * rl78-decode.opc: Likewise,
and include opintl.h.
* nds32-asm.c: Likewise, and include sysdep.h and opintl.h.
* i386-gen.c: Standardize error messages.
* msp430-decode.c, * rl78-decode.c, rx-decode.c: Regenerate.
* Makefile.in: Regenerate.
* epiphany-asm.c, * epiphany-desc.c, * epiphany-dis.c,
* epiphany-ibld.c, * fr30-asm.c, * fr30-desc.c, * fr30-dis.c,
* fr30-ibld.c, * frv-asm.c, * frv-desc.c, * frv-dis.c, * frv-ibld.c,
* frv-opc.c, * ip2k-asm.c, * ip2k-desc.c, * ip2k-dis.c, * ip2k-ibld.c,
* iq2000-asm.c, * iq2000-desc.c, * iq2000-dis.c, * iq2000-ibld.c,
* lm32-asm.c, * lm32-desc.c, * lm32-dis.c, * lm32-ibld.c,
* m32c-asm.c, * m32c-desc.c, * m32c-dis.c, * m32c-ibld.c,
* m32r-asm.c, * m32r-desc.c, * m32r-dis.c, * m32r-ibld.c,
* mep-asm.c, * mep-desc.c, * mep-dis.c, * mep-ibld.c, * mt-asm.c,
* mt-desc.c, * mt-dis.c, * mt-ibld.c, * or1k-asm.c, * or1k-desc.c,
* or1k-dis.c, * or1k-ibld.c, * xc16x-asm.c, * xc16x-desc.c,
* xc16x-dis.c, * xc16x-ibld.c, * xstormy16-asm.c, * xstormy16-desc.c,
* xstormy16-dis.c, * xstormy16-ibld.c: Regenerate.
GDB Administrator [Sat, 3 Mar 2018 00:00:25 +0000 (00:00 +0000)]
Automatic date update in version.in
Sergio Durigan Junior [Thu, 1 Mar 2018 20:11:44 +0000 (15:11 -0500)]
Conditionally include "<windows.h>" on common/pathstuff.c (and unbreak build on mingw*)
commit
b4987c956dfa44ca9fd8552f63e15f5fa094b2a4
Author: Sergio Durigan Junior <sergiodj@redhat.com>
Date: Fri Feb 9 18:44:59 2018 -0500
Create new common/pathstuff.[ch]
Introduced a regression when compiling for mingw*:
/gdb/common/pathstuff.c: In function 'gdb::unique_xmalloc_ptr<char>
gdb_realpath(const char*)':
/gdb/common/pathstuff.c:56:14: error: 'MAX_PATH' was not declared in this scope
char buf[MAX_PATH];
^
/gdb/common/pathstuff.c:57:5: error: 'DWORD' was not declared in this scope
DWORD len = GetFullPathName (filename, MAX_PATH, buf, NULL);
^
/gdb/common/pathstuff.c:57:11: error: expected ';' before 'len'
DWORD len = GetFullPathName (filename, MAX_PATH, buf, NULL);
^
/gdb/common/pathstuff.c:63:9: error: 'len' was not declared in this scope
if (len > 0 && len < MAX_PATH)
^
/gdb/common/pathstuff.c:64:54: error: 'buf' was not declared in this scope
return gdb::unique_xmalloc_ptr<char> (xstrdup (buf));
^
make[2]: *** [pathstuff.o] Error 1
The proper fix is to conditionally include "<windows.h>". This commit
does that, without introducing any regressions as per tests made by
our BuildBot.
gdb/ChangeLog:
2018-03-01 Sergio Durigan Junior <sergiodj@redhat.com>
PR gdb/22907
* common/pathstuff.c: Conditionally include "<windows.h>".
Thomas Preud'homme [Fri, 2 Mar 2018 11:51:34 +0000 (11:51 +0000)]
[GDB/testsuite] Use %progbits in watch-loc.c
While using @progbits in .pushsection work on some targets, it does not
work on arm target where this introduces a comment. This patch replaces
its use in gdb.dlang/watch-loc.c and gdb.mi/dw2-ref-missing-frame-func.c
by %progbits which should work on all targets since it is used in
target-independent elf/section7.s GAS test.
2018-03-02 Thomas Preud'homme <thomas.preudhomme@arm.com>
gdb/testsuite/
* gdb.dlang/watch-loc.c: Use %progbits instead of @progbits.
* gdb.mi/dw2-ref-missing-frame-func.c: Likewise.
Jim Wilson [Fri, 2 Mar 2018 10:47:25 +0000 (10:47 +0000)]
Ensure 8-byte alignment for AArch64 stubs.
PR 22903
bfd * elfnn-aarch64.c (_bfd_aarch64_resize_stubs): Add 8 bytes for branch
and nop instead of 4.
(elfNN_arch64_build_stubs): Add nop after branch. Increase size by
8 instead of 4.
ld * emultempl/aarch64elf.em (elf${ELFSIZE}_aarch64_add_stub_section):
Give stub_sec 8 byte alignment.
* emulparams/aarch64cloudabi.sh (NOP): Set to 0x1f2003d5.
* emulparams/aarch64elf.sh (NOP): Likewise.
* emulparams/aarch64elf32.sh (NOP): Likewise.
* emulparams/aarch64fbsd.sh (NOP): Likewise.
* emulparams/aarch64linux.sh (NOP): Likewise.
* emulparams/aarch64linux32.sh (NOP): Likewise.
* testsuite/ld-aarch64/erratum835769.d: Adjust for added nop.
* testsuite/ld-aarch64/erratum843419.d: Likewise.
* testsuite/ld-aarch64/farcall-b-defsym.d: Likewise.
* testsuite/ld-aarch64/farcall-b-none-function.d: Likewise.
* testsuite/ld-aarch64/farcall-b-plt.d: Likewise.
* testsuite/ld-aarch64/farcall-b-section.d: Likewise.
* testsuite/ld-aarch64/farcall-b.d: Likewise.
* testsuite/ld-aarch64/farcall-back.d: Likewise.
* testsuite/ld-aarch64/farcall-bl-defsym.d: Likewise.
* testsuite/ld-aarch64/farcall-bl-none-function.d: Likewise.
* testsuite/ld-aarch64/farcall-bl-plt.d: Likewise.
* testsuite/ld-aarch64/farcall-bl-section.d: Likewise.
* testsuite/ld-aarch64/farcall-bl.d: Likewise.
Thomas Preud'homme [Fri, 2 Mar 2018 10:46:32 +0000 (10:46 +0000)]
[ARM] Fix NULL dereference of march_ext_opt
Commit
4d354d8b8932d450c77fd52f3501662827523014 introduced a NULL
pointer dereference by replacing a pointer assignment by a pointer
dereference assignment without adding a NULL pointer check. This patch
fixes it.
2018-03-02 Thomas Preud'homme <thomas.preudhomme@arm.com>
gas/
* config/tc-arm.c (md_begin): Add NULL pointer check before
dereferencing march_ext_opt.
GDB Administrator [Fri, 2 Mar 2018 00:00:32 +0000 (00:00 +0000)]
Automatic date update in version.in
Georg Sauthoff [Thu, 1 Mar 2018 22:23:31 +0000 (17:23 -0500)]
Improve gcore shell quoting and portability
The gcore shell script (gdb/gcore.in) doesn't quote its variables
enough.
For example, trying to write a core file with - say - a space
ungraciously fails like this:
$ gcore -o 'foo bar' 6270
/usr/bin/gcore: line 92: [: foo: binary operator expected
gcore: failed to create foo bar.6270
Similarly, one can inject meta characters like * (by accident)
that may yield unexpected results, e.g. as in:
$ gcore -o foobar '*'
This change fixes these issues in several places.
Aso, since the script uses array syntax, the patch changes the
the shell in the first line from `/bin/sh` to /bin/bash`.
POSIX doesn't specify the array syntax for shell, thus, the
script doesn't work on systems where /bin/sh is linked to - say -
dash.
Since the source gcore.in already is processed by a pre-processor
one could even auto-detect the path to bash and thus dynamically
generate the first line. For systems where bash isn't available
via /bin/bash. But I think this would be overkill and /bin/bash
is good enough as most systems probably have it.
gdb/ChangeLog:
PR gdb/22888
* gcore.in: Quote variables and switch interpreter to bash.
Jim Wilson [Thu, 1 Mar 2018 22:17:57 +0000 (14:17 -0800)]
RISC-V: Fix symbol size bug when relaxation deletes bytes.
bfd/
PR 22756
* elfnn-riscv.c (riscv_relax_delete_bytes): When adjust st_size, use
else if instead of if.
Tom Tromey [Wed, 28 Feb 2018 15:49:51 +0000 (08:49 -0700)]
Fix Rust enum test failures
Pedro pointed out that some Rust tests were failing after the recent
enum change. I was able to reproduce this even with the most current
Rust compiler -- no test was failing, but rather the gdb internal
error was causing an "untested" result, which I didn't notice.
The internal error is caused by a bad assertion in
alloc_discriminant_info. This happened because, in an earlier version
of the patch, the discriminant could only appear at index 0. However,
it can now appear anywhere. This patch fixes the assertion in the
obvious way, and adds a second assertion to ensure that the
discriminant is also correct.
Fixing this revealed a real failure, which was caused by using the
wrong base name when computing the name of a univariant enum's sole
member. This is also fixed here.
Tested by running the gdb.rust tests with rustc 1.23 and
double-checking the summary:
# of expected passes 276
Note that if you try this yourself, it is still possible to get an
"untested" result from traits.exp if your Rust compiler is old enough.
2018-03-01 Tom Tromey <tom@tromey.com>
* dwarf2read.c (alloc_discriminant_info): Fix default_index
assertion. Add assertion for discriminant_index.
(quirk_rust_enum): Use correct base type name in univariant case.
Thomas Preud'homme [Thu, 1 Mar 2018 16:22:28 +0000 (16:22 +0000)]
[ARM] Clean up selection of feature bits
I've always found the code in ARM backend of gas to control what
CPU/architecture and FPU are selected by the user and to support
autodetection of features complex and confusing. Chief among the
issues I have with that code is the lack of comments to explain
the meaning of the various variables. This patch addresses that
and much more:
- add comments to explain meaning of all arm_feature_set variables
- keep track of currently selected CPU, extensions and FPU in a separate
set of new variables
- make naming of variable more consistent
- remove dead code
- simplify handling of extensions
The overall approach is as follows:
* restrict m*_opt variable to hold the feature bits of the
corresponding mcpu/march/mfpu command-line options
* record selected CPU, extensions and FPU in new selected_* during
md_begin
* whenever a .cpu/.arch/.arch_extension/.fpu directive is met, update
the corresponding selected_* variables (eg. selected_arch, then
selected_cpu for a .cpu or .arch directive) and then finally
cpu_variant from them
* pass extension feature set pointer by value to arm_parse_extension
since it's only ever called from arm_parse_cpu and arm_parse_arch
which allocate the extension feature set themselves
* likewise, remove allocation from s_arm_arch_extension since the use
of arm_feature_set structure for selected_ext rather than a pointer
alleviate the need for it
* in autodetection mode, only set all CPU fits in cpu_variant but leave
selected_cpu* variables unset
* in md_begin, remove dead "else if" to set a default FPU when no FPU
was selected. Setting a default FPU based on CPU as did the code
before it turn dead should be based on the default FPU field of the
CPU and architecture table as will be done in a separate patch. Logic
is wrong anyway since it sets VFP2 as default FPU for Armv6-M and
Armv7-M
Hopefully that should be enough to understand the change but if not feel
free to ask questions about the patch. While I believe the new code is
easier to understand, it remains complex and the old one was even more
complex so the change is difficult to understand.
2018-03-01 Thomas Preud'homme <thomas.preudhomme@arm.com>
gas/
* config/tc-arm.c (cpu_variant, arm_arch_used, thumb_arch_used,
legacy_cpu, legacy_fpu, mcpu_cpu_opt, dyn_mcpu_ext_opt,
mcpu_fpu_opt, march_cpu_opt, dyn_march_ext_opt, march_fpu_opt,
mfpu_opt, object_arch, selected_cpu): Comment meaning of variables.
(dyn_mcpu_ext_opt): Also rename into ...
(mcpu_ext_opt): This.
(dyn_march_ext_opt): Also rename into ...
(march_ext_opt): This.
(object_arch): Also rename into ...
(selected_object_arch): This and make it a plain arm_feature_set
structure.
(selected_arch, selected_ext, selected_fpu): New static variables.
(mark_feature_used): Fix comments, feature is marked as used iff it is
currently allowed.
(do_bx): Adapt to change in name and type of object_arch.
(md_begin): Set selected_arch rather than mcpu_cpu_opt, selected_ext
rather than dyn_mcpu_ext_opt and selected_fpu rather than mfpu_opt.
Remove dead code to set default FPU if architecture version is greater
than 5. Set all CPU bits of cpu_variant directly in autodection
leaving mcpu_cpu_opt, selected_arch and selected_cpu unset.
(arm_parse_extension): Take extension feature set pointer parameter by
value rather than by pointer. Remove allocation code. Adapt code
accordingly.
(arm_parse_cpu): Adapt to variable renaming and changes in
arm_parse_extension () signature.
(arm_parse_arch): Likewise.
(aeabi_set_public_attributes): Also set selected_arch and selected_ext
in addition to selected_cpu. Set flags_arch and flags_ext from them
instead of selected_cpu. Adapt to variables renaming and type change.
(arm_md_post_relax): Adapt to variable renaming.
(s_arm_cpu): Set selcted_cpu_cpu and selected_ext instead of
mcpu_cpu_opt and dyn_mcpu_ext_opt. Set selected_cpu from them and
cpu_variant from selected_cpu and selected_fpu.
(s_arm_arch): Likewise.
(s_arm_object_arch): Adapt to variable renaming.
(s_arm_arch_extension): Use ARM_CPU_IS_ANY instead of checking feature
set against arm_any. Check selected_arch rather than *mcpu_cpu_opt.
Set selected_ext rather than *dyn_mcpu_ext_opt and remove allocation
code.
(s_arm_fpu): Set selected_fpu instead of mfpu_opt. Set all CPU feature
bits if in autodetection mode.
Nick Clifton [Thu, 1 Mar 2018 16:14:08 +0000 (16:14 +0000)]
Prevent illegal memory accesses triggerd by intger overflow when parsing corrupt DWARF information on a 32-bit host.
PR 22905
* dwarf.c (display_debug_ranges): Check that the offset loaded
from the range_entry structure is valid.
Simon Marchi [Thu, 1 Mar 2018 15:51:21 +0000 (10:51 -0500)]
Propagate record_print_flags
These flags are returned as an int by get_call_history_modifiers, and
get cast back to record_print_flags in the btrace code. Instead, we can
make the arguments of that type from start to end.
gdb/ChangeLog:
* record.c (get_call_history_modifiers): Return a
record_print_flags.
(cmd_record_call_history): Adjust.
* record-btrace.c (record_btrace_call_history): Adjust.
(record_btrace_call_history_range): Adjust.
(record_btrace_call_history_from): Adjust.
* target-debug.h (target_debug_print_record_print_flags): New.
* target-delegates.c: Re-generate.
* target.c (target_call_history): Change flags type.
(target_call_history_from): Likewise.
(target_call_history_range): Likewise.
* target.h (struct target_ops) <target_call_history>: Likewise.
(target_call_history_from): Likewise.
(target_call_history_range): Likewise.
H.J. Lu [Thu, 1 Mar 2018 14:08:04 +0000 (06:08 -0800)]
x86: Encode AVX256/AVX512 vpsub[bwdq] with VEX128/EVEX128
When 2 source registers are identical, AVX256 and AVX512 vpsub[bwdq]
instructions can be encoded with VEX128 or EVEX128 encodings.
gas/
* config/tc-i386.c (optimize_encoding): Optimize AVX256 and
AVX512 vpsub[bwdq] instructions.
* testsuite/gas/i386/optimize-1.s: Add tests for AVX256 and
AVX512 vpsub[bwdq] instructions.
* testsuite/gas/i386/x86-64-optimize-2.s: Likewise.
* testsuite/gas/i386/optimize-1.d: Updated.
* testsuite/gas/i386/x86-64-optimize-2.d: Likewise.
opcodes/
* * i386-opc.tbl: Add "Optimize" to AVX256 and AVX512
vpsub[bwdq] instructions.
* i386-tbl.h: Regenerated.
Markus Metzger [Mon, 26 Feb 2018 10:59:43 +0000 (11:59 +0100)]
btrace, gdbserver: check btrace target pointers
By removing the supports_btrace gdbserver target method we relied on GDB
trying to enable branch tracing and failing on the attempt.
For targets that do not provide the btrace methods, however, an initial
request from GDB for the branch trace configuration to detect whether
gdbserver is already recording resulted in a protocol error.
Have the btrace target methods throw a "Target does not suppor branch
tracing" error and be prepared to handle exceptions in all functions that
call btrace target methods. We therefore turn the target_* macros into
static inline functions.
Also remove the additional btrace target method checks that resulted in
the above protocol error.
Thanks to Maciej W. Rozycki <macro@mips.com> for reporting this.
gdbserver/
* target.h (target_enable_btrace, target_disable_btrace)
(target_read_btrace, target_read_btrace_conf): Turn macro into
inline function. Throw error if target method is not defined.
* server.c (handle_qxfer_btrace, handle_qxfer_btrace_conf): Remove
check for btrace target method. Be prepared to handle exceptions
from btrace target methods.
GDB Administrator [Thu, 1 Mar 2018 00:00:38 +0000 (00:00 +0000)]
Automatic date update in version.in
Alan Modra [Wed, 28 Feb 2018 21:56:51 +0000 (08:26 +1030)]
Add missing translations to ALL_LINGUAS
binutils/
* configure.ac (ALL_LINGUAS): Add sr. Sort.
* configure: Regenerate.
gas/
* configure.ac (ALL_LINGUAS): Add uk. Sort.
* configure: Regenerate.
gprof/
* configure.ac (ALL_LINGUAS): Add it, ro, ru, uk. Sort.
* configure: Regenerate.
ld/
* configure.ac (ALL_LINGUAS): Add ja. Sort.
* configure: Regenerate.
opcodes/
* configure.ac (ALL_LINGUAS): Sort.
* configure: Regenerate.
Alan Modra [Wed, 28 Feb 2018 21:51:11 +0000 (08:21 +1030)]
correct ft32 reloc range test
* elf32-ft32.c (ft32_info_to_howto_rela): Correct range test.
Sergio Durigan Junior [Wed, 28 Feb 2018 16:43:48 +0000 (11:43 -0500)]
Change order of error message printed when gdbserver can't find CWD
I forgot to address Pedro's comment about my last patch and change the
order of the message printed when getcwd returns NULL on gdbserver.
This obvious commit does it.
gdb/gdbserver/ChangeLog:
2018-02-28 Sergio Durigan Junior <sergiodj@redhat.com>
* server.c (captured_main): Change order of error message printed
when the current working directory cannot be found.
Sergio Durigan Junior [Fri, 9 Feb 2018 23:54:41 +0000 (18:54 -0500)]
Make gdbserver work with filename-only binaries
Simon mentioned on IRC that, after the startup-with-shell feature has
been implemented on gdbserver, it is not possible to specify a
filename-only binary, like:
$ gdbserver :1234 a.out
/bin/bash: line 0: exec: a.out: not found
During startup program exited with code 127.
Exiting
This happens on systems where the current directory "." is not listed
in the PATH environment variable. Although including "." in the PATH
variable is a possible workaround, this can be considered a regression
because before startup-with-shell it was possible to use only the
filename (due to reason that gdbserver used "exec*" directly).
The idea of the patch is to verify if the program path provided by the
user (or by the remote protocol) contains a directory separator
character. If it doesn't, it means we're dealing with a filename-only
binary, so we call "gdb_abspath" to properly expand it and transform
it into a full path. Otherwise, we leave the program path untouched.
This mimicks the behaviour seen on GDB (look at "openp" and
"attach_inferior", for example).
I am also submitting a testcase which exercises the scenario described
above. This test requires gdbserver to be executed in a different CWD
than the original, so I also created a helper function, "with_cwd" (on
testsuite/lib/gdb.exp), which takes care of cd'ing into and out of the
specified dir.
Built and regtested on BuildBot, without regressions.
gdb/ChangeLog:
2018-02-28 Sergio Durigan Junior <sergiodj@redhat.com>
Simon Marchi <simon.marchi@polymtl.ca>
* common/common-utils.c: Include "sys/stat.h".
(is_regular_file): Move here from "source.c"; change return
type to "bool".
* common/common-utils.h (is_regular_file): New prototype.
* common/pathstuff.c (contains_dir_separator): New function.
* common/pathstuff.h (contains_dir_separator): New prototype.
* source.c: Don't include "sys/stat.h".
(is_regular_file): Move to "common/common-utils.c".
gdb/gdbserver/ChangeLog:
2018-02-28 Sergio Durigan Junior <sergiodj@redhat.com>
* server.c: Include "filenames.h" and "pathstuff.h".
(program_name): Delete variable.
(program_path): New anonymous class.
(get_exec_wrapper): Use "program_path" instead of
"program_name".
(handle_v_run): Likewise.
(captured_main): Likewise.
(process_serial_event): Likewise.
gdb/testsuite/ChangeLog:
2018-02-28 Sergio Durigan Junior <sergiodj@redhat.com>
* gdb.server/abspath.exp: New file.
* lib/gdb.exp (with_cwd): New procedure.
Sergio Durigan Junior [Fri, 9 Feb 2018 23:44:59 +0000 (18:44 -0500)]
Create new common/pathstuff.[ch]
This commit moves the path manipulation routines found on utils.c to a
new common/pathstuff.c, and updates the Makefile.in's accordingly.
The routines moved are "gdb_realpath", "gdb_realpath_keepfile" and
"gdb_abspath".
This will be needed because gdbserver will have to call "gdb_abspath"
on my next patch, which implements a way to expand the path of the
inferior provided by the user in order to allow specifying just the
binary name when starting gdbserver, like:
$ gdbserver :1234 a.out
With the recent addition of the startup-with-shell feature on
gdbserver, this scenario doesn't work anymore if the user doesn't have
the current directory listed in the PATH variable.
I had to do a minor adjustment on "gdb_abspath" because we don't have
access to "tilde_expand" on gdbserver, so now the function is using
"gdb_tilde_expand" instead. Otherwise, the code is the same.
Regression tested on the BuildBot, without regressions.
gdb/ChangeLog:
2018-02-28 Sergio Durigan Junior <sergiodj@redhat.com>
* Makefile.in (COMMON_SFILES): Add "common/pathstuff.c".
(HFILES_NO_SRCDIR): Add "common/pathstuff.h".
* auto-load.c: Include "common/pathstuff.h".
* common/common-def.h (current_directory): Move here.
* common/gdb_tilde_expand.c (gdb_tilde_expand_up): New
function.
* common/gdb_tilde_expand.h (gdb_tilde_expand_up): New
prototype.
* common/pathstuff.c: New file.
* common/pathstuff.h: New file.
* compile/compile.c: Include "common/pathstuff.h".
* defs.h (current_directory): Move to "common/common-defs.h".
* dwarf2read.c: Include "common/pathstuff.h".
* exec.c: Likewise.
* guile/scm-safe-call.c: Likewise.
* linux-thread-db.c: Likewise.
* main.c: Likewise.
* nto-tdep.c: Likewise.
* objfiles.c: Likewise.
* source.c: Likewise.
* symtab.c: Likewise.
* utils.c: Include "common/pathstuff.h".
(gdb_realpath): Move to "common/pathstuff.c".
(gdb_realpath_keepfile): Likewise.
(gdb_abspath): Likewise.
* utils.h (gdb_realpath): Move to "common/pathstuff.h".
(gdb_realpath_keepfile): Likewise.
(gdb_abspath): Likewise.
gdb/gdbserver/ChangeLog:
2018-02-28 Sergio Durigan Junior <sergiodj@redhat.com>
* Makefile.in (SFILES): Add "$(srcdir)/common/pathstuff.c".
(OBJS): Add "pathstuff.o".
* server.c (current_directory): New global variable.
(captured_main): Initialize "current_directory".
Simon Marchi [Wed, 28 Feb 2018 13:58:25 +0000 (08:58 -0500)]
testsuite: Restore gdb_is_target_remote_prompt
In patch
Add test for load command
3275ef477498e0500d7ea440f1bc51787acf4610
I removed gdb_is_target_remote_prompt, but did not realize it was used
in mi_is_target_remote. This makes the gdb.mi/mi-nonstop.exp crash, for
example:
ERROR: (DejaGnu) proc "gdb_is_target_remote_prompt {[(]gdb[)]
}" does not exist.
The error code is TCL LOOKUP COMMAND gdb_is_target_remote_prompt
The info on the error is:
invalid command name "gdb_is_target_remote_prompt"
while executing
"::tcl_unknown gdb_is_target_remote_prompt {[(]gdb[)]
}"
("uplevel" body line 1)
invoked from within
"uplevel 1 ::tcl_unknown $args"
This patch restores it.
gdb/testsuite/ChangeLog:
* lib/gdb.exp (gdb_is_target_1): Add prompt_regexp parameter and
use it.
(gdb_is_target_remote_prompt): New proc.
(gdb_is_target_remote): Use gdb_is_target_remote_prompt.
(gdb_is_target_native): Pass prompt parameter to
gdb_is_target_1.
Nick Clifton [Wed, 28 Feb 2018 11:50:49 +0000 (11:50 +0000)]
Catch integer overflows/underflows when parsing corrupt DWARF FORM blocks.
PR 22895
PR 22893
* dwarf2.c (read_n_bytes): Replace size parameter with dwarf_block
pointer. Drop unused abfd parameter. Check the size of the block
before initialising the data field. Return the end pointer if the
size is invalid.
(read_attribute_value): Adjust invocations of read_n_bytes.
Alan Modra [Wed, 28 Feb 2018 11:39:50 +0000 (22:09 +1030)]
PR22887, null pointer dereference in aout_32_swap_std_reloc_out
PR 22887
* aoutx.h (swap_std_reloc_in): Correct r_index bound check.
Douglas B Rupp [Wed, 28 Feb 2018 11:44:26 +0000 (11:44 +0000)]
Remove any trailing directory separator from ld_canon_sysroot and adjust ld_canon_sysroot_len.
The problem was the ld expect libiberty/lrealpath() to always return a
path, but in some cases it returns a prefix. It seemed like too much of
an earthquake to propose a fix to lrealpath.
* ldmain.c (main): Remove directory separator, if any, from the
end of the canonicalized sysroot.
Nick Clifton [Wed, 28 Feb 2018 10:13:54 +0000 (10:13 +0000)]
Fix potential integer overflow when reading corrupt dwarf1 debug information.
PR 22894
* dwarf1.c (parse_die): Check the length of form blocks before
advancing the data pointer.
Alan Modra [Wed, 28 Feb 2018 06:44:24 +0000 (17:14 +1030)]
Nonsense error messages on invalid aout string offset
translate_symbol_table returns false on detecting an out of range name
string offset, hooray for error checking, but doesn't set bfd_error or
print a useful error. bfd_error therefore contains whatever it had
previously, in my testing, bfd_error_system_call. So the error
printed depended on errno.
PR 22887
* aoutx.h (translate_symbol_table): Print an error message and set
bfd_error on finding an invalid name string offset.
John Baldwin [Wed, 25 Oct 2017 04:06:00 +0000 (21:06 -0700)]
Workaround a FreeBSD ptrace() bug with clearing thread events.
When multiple threads within a process wish to report STOPPED events
from wait(), the kernel picks one thread event as the thread event to
report. The chosen thread event is retrieved via PT_LWPINFO by
passing the process ID as the request pid. If multiple events are
pending, then the subsequent wait() after resuming a process will
report another STOPPED event after resuming the process to handle the
next thread event and so on.
A single thread event is cleared as a side effect of resuming the
process with PT_CONTINUE, PT_STEP, etc. In older kernels, however,
the request pid was used to select which thread's event was cleared
rather than always clearing the event that was just reported. To
avoid clearing the event of the wrong LWP, always pass the process ID
instead of an LWP ID to PT_CONTINUE or PT_SYSCALL.
In the case of stepping, the process ID cannot be used with PT_STEP
since it would step the thread that reported an event which may not be
the thread indicated by PTID. For stepping, use PT_SETSTEP to enable
stepping on the desired thread before resuming the process via
PT_CONTINUE instead of using PT_STEP.
This manifested as a failure in the
gdb.threads/continue-pending-status.exp test. Specifically, if thread
2 reported a breakpoint and the test thus switched to thread 3 before
continuing, thread 3's event (if any) was discarded and thread 2's
breakpoint remained pending and was reported a second time as a
duplicate event. As a result, the PC was decremented twice for the
same breakpoint resulting in an illegal instruction fault on x86.
gdb/ChangeLog:
* fbsd-nat.c (fbsd_resume): Use PT_SETSTEP for stepping and a
wildcard process pid for super_resume for kernels with a
specific bug.
GDB Administrator [Wed, 28 Feb 2018 00:00:38 +0000 (00:00 +0000)]
Automatic date update in version.in
H.J. Lu [Tue, 27 Feb 2018 22:45:48 +0000 (14:45 -0800)]
gas: Rename .nop directive to .nops
Since directives of NO_PSEUDO_DOT targets don't have the leading '.'
and "nop" can be a valid instruction, rename .nop directive to .nops
to avoid conflict.
* NEWS: Rename .nop to .nops.
* doc/as.texinfo: Likewise.
* read.c (potable): Add "nops". Remove "nop".
(s_nop): Renamed to ...
(s_nops): This.
* read.h (s_nop): Renamed to ...
(s_nops): This.
* write.c (cvt_frag_to_fill): Rename .nop to .nops.
(md_generate_nops): Likewise.
(relax_segment): Likewise.
* testsuite/gas/i386/nop-1.d: Updated.
* testsuite/gas/i386/nop-1.s: Likewise.
* testsuite/gas/i386/nop-2.d: Likewise.
* testsuite/gas/i386/nop-2.s: Likewise.
* testsuite/gas/i386/nop-3.d: Likewise.
* testsuite/gas/i386/nop-3.s: Likewise.
* testsuite/gas/i386/nop-4.d: Likewise.
* testsuite/gas/i386/nop-4.s: Likewise.
* testsuite/gas/i386/nop-5.d: Likewise.
* testsuite/gas/i386/nop-5.s: Likewise.
* testsuite/gas/i386/nop-6.d: Likewise.
* testsuite/gas/i386/nop-6.s: Likewise.
* testsuite/gas/i386/nop-bad-1.l: Likewise.
* testsuite/gas/i386/nop-bad-1.s: Likewise.
* testsuite/gas/i386/x86-64-nop-1.d: Likewise.
* testsuite/gas/i386/x86-64-nop-2.d: Likewise.
* testsuite/gas/i386/x86-64-nop-3.d: Likewise.
* testsuite/gas/i386/x86-64-nop-4.d: Likewise.
* testsuite/gas/i386/x86-64-nop-5.d: Likewise.
* testsuite/gas/i386/x86-64-nop-6.d: Likewise.
Phil Muldoon [Tue, 27 Feb 2018 20:21:23 +0000 (12:21 -0800)]
Update get_args documentation
This patch adds argument compilation documentation, expanding on the
already existing comments, giving a more thorough explanation of
the source of the arguments used in the final argument string.
gdb/ChangeLog:
* compile/compile.c (get_args): Add additional comments
explaining function.
H.J. Lu [Tue, 27 Feb 2018 19:34:20 +0000 (11:34 -0800)]
ld: Add --enable-separate-code
This patch adds --enable-separate-code to ld configure to turn on
-z separate-code by default and enables it by default for Linux/x86.
This avoids mixing code pages with data to improve cache performance
as well as security.
To reduce x86-64 executable and shared object sizes, the maximum page
size is reduced from 2MB to 4KB when -z separate-code is turned on by
default. Note: -z max-page-size= can be used to set the maximum page
size.
We compared SPEC CPU 2017 performance before and after this change on
Skylake server. There are no any significant performance changes.
Everything is mostly below +/-1%.
bfd/
* config.in: Regenerated.
* configure: Likewise.
* configure.ac: Add --enable-separate-code.
(DEFAULT_LD_Z_SEPARATE_CODE): New AC_DEFINE_UNQUOTED. Default
to 1 for Linux/x86 targets,
* elf64-x86-64.c (ELF_MAXPAGESIZE): Set to 0x1000 if
DEFAULT_LD_Z_SEPARATE_CODE is 1.
ld/
* NEWS: Mention --enable-separate-code.
* configure.ac: Add --enable-separate-code.
(DEFAULT_LD_Z_SEPARATE_CODE): New AC_DEFINE_UNQUOTED.
* configure.tgt: Default ac_default_ld_z_separate_code to 1 for
Linux/x86 targets.
* config.in: Regenerated.
* configure: Likewise.
* emultempl/elf32.em (gld${EMULATION_NAME}_before_parse): Set
link_info.separate_code DEFAULT_LD_Z_SEPARATE_CODE.
Tom Tromey [Sat, 24 Feb 2018 16:55:30 +0000 (09:55 -0700)]
Change target_write_memory_blocks to use std::vector
This changes target_write_memory_blocks to use std::vector, rather
than VEC. This allows the removal of some cleanups.
This version incorporates the additions that Simon made.
Regression tested by the buildbot.
ChangeLog
2018-02-27 Simon Marchi <simon.marchi@polymtl.ca>
Tom Tromey <tom@tromey.com>
* target.h (memory_write_request_s): Remove typedef. Don't define
VEC.
(target_write_memory_blocks): Change argument to std::vector.
(struct memory_write_request): Add constructor.
* target-memory.c (compare_block_starting_address): Return bool.
Change argument types.
(claim_memory): Change arguments to use std::vector.
(split_regular_and_flash_blocks, blocks_to_erase)
(compute_garbled_blocks): Likewise.
(cleanup_request_data, cleanup_write_requests_vector): Remove.
(target_write_memory_blocks): Change argument to std::vector.
* symfile.c (struct load_section_data): Add constructor and
destructor. Use std::vector for "requests".
(struct load_progress_data): Add initializers.
(load_section_callback): Update. Use "new".
(clear_memory_write_data): Remove.
(generic_load): Update.
Thomas Preud'homme [Tue, 27 Feb 2018 16:40:45 +0000 (16:40 +0000)]
[ARM] Remove ARM_FEATURE_COPY macro
Among the macros to manipulate an arm_feature_set structure is the
ARM_FEATURE_COPY which copy the value of a feature set into another.
This can be achieved with a simple assignement which most of the
existing code does. This patch removes the last 2 uses of that macro and
remove the macro altogether.
2018-02-27 Thomas Preud'homme <thomas.preudhomme@arm.com>
include/
* opcode/arm.h (ARM_FEATURE_COPY): Remove macro definition.
2018-02-27 Thomas Preud'homme <thomas.preudhomme@arm.com>
opcodes/
* arm-dis.c (print_insn_coprocessor): Replace uses of ARM_FEATURE_COPY
macro by assignements.
Alan Hayward [Tue, 27 Feb 2018 16:21:52 +0000 (16:21 +0000)]
Explicitly specify common tdesc.h for use with aarch64.h
gdb/
* arch/aarch64.h: Use common/tdesc.h.
H.J. Lu [Tue, 27 Feb 2018 15:36:33 +0000 (07:36 -0800)]
x86: Add -O[2|s] assembler command-line options
On x86, some instructions have alternate shorter encodings:
1. When the upper 32 bits of destination registers of
andq $imm31, %r64
testq $imm31, %r64
xorq %r64, %r64
subq %r64, %r64
known to be zero, we can encode them without the REX_W bit:
andl $imm31, %r32
testl $imm31, %r32
xorl %r32, %r32
subl %r32, %r32
This optimization is enabled with -O, -O2 and -Os.
2. Since 0xb0 mov with 32-bit destination registers zero-extends 32-bit
immediate to 64-bit destination register, we can use it to encode 64-bit
mov with 32-bit immediates. This optimization is enabled with -O, -O2
and -Os.
3. Since the upper bits of destination registers of VEX128 and EVEX128
instructions are extended to zero, if all bits of destination registers
of AVX256 or AVX512 instructions are zero, we can use VEX128 or EVEX128
encoding to encode AVX256 or AVX512 instructions. When 2 source
registers are identical, AVX256 and AVX512 andn and xor instructions:
VOP %reg, %reg, %dest_reg
can be encoded with
VOP128 %reg, %reg, %dest_reg
This optimization is enabled with -O2 and -Os.
4. 16-bit, 32-bit and 64-bit register tests with immediate may be
encoded as 8-bit register test with immediate. This optimization is
enabled with -Os.
This patch does:
1. Add {nooptimize} pseudo prefix to disable instruction size
optimization.
2. Add optimize to i386_opcode_modifier to tell assembler that encoding
of an instruction may be optimized.
gas/
PR gas/22871
* NEWS: Mention -O[2|s].
* config/tc-i386.c (_i386_insn): Add no_optimize.
(optimize): New.
(optimize_for_space): Likewise.
(fits_in_imm7): New function.
(fits_in_imm31): Likewise.
(optimize_encoding): Likewise.
(md_assemble): Call optimize_encoding to optimize encoding.
(parse_insn): Handle {nooptimize}.
(md_shortopts): Append "O::".
(md_parse_option): Handle -On.
* doc/c-i386.texi: Document -O0, -O, -O1, -O2 and -Os as well
as {nooptimize}.
* testsuite/gas/cfi/cfi-x86_64.d: Pass -O0 to assembler.
* testsuite/gas/i386/ilp32/cfi/cfi-x86_64.d: Likewise.
* testsuite/gas/i386/i386.exp: Run optimize-1, optimize-2,
optimize-3, x86-64-optimize-1, x86-64-optimize-2,
x86-64-optimize-3 and x86-64-optimize-4.
* testsuite/gas/i386/optimize-1.d: New file.
* testsuite/gas/i386/optimize-1.s: Likewise.
* testsuite/gas/i386/optimize-2.d: Likewise.
* testsuite/gas/i386/optimize-2.s: Likewise.
* testsuite/gas/i386/optimize-3.d: Likewise.
* testsuite/gas/i386/optimize-3.s: Likewise.
* testsuite/gas/i386/x86-64-optimize-1.s: Likewise.
* testsuite/gas/i386/x86-64-optimize-1.d: Likewise.
* testsuite/gas/i386/x86-64-optimize-2.d: Likewise.
* testsuite/gas/i386/x86-64-optimize-2.s: Likewise.
* testsuite/gas/i386/x86-64-optimize-3.d: Likewise.
* testsuite/gas/i386/x86-64-optimize-3.s: Likewise.
* testsuite/gas/i386/x86-64-optimize-4.d: Likewise.
* testsuite/gas/i386/x86-64-optimize-4.s: Likewise.
opcodes/
PR gas/22871
* i386-gen.c (opcode_modifiers): Add Optimize.
* i386-opc.h (Optimize): New enum.
(i386_opcode_modifier): Add optimize.
* i386-opc.tbl: Add "Optimize" to "mov $imm, reg",
"sub reg, reg/mem", "test $imm, acc", "test $imm, reg/mem",
"and $imm, acc", "and $imm, reg/mem", "xor reg, reg/mem",
"movq $imm, reg" and AVX256 and AVX512 versions of vandnps,
vandnpd, vpandn, vpandnd, vpandnq, vxorps, vxorpd, vpxor,
vpxord and vpxorq.
* i386-tbl.h: Regenerated.
Nick Clifton [Tue, 27 Feb 2018 12:27:30 +0000 (12:27 +0000)]
Add a new Portuguese translation for the binutils sub-directory, and update the Russian translation for the gas sub-directory.
gas * po/ru.po: Updated Russian translation.
binutils* po/pt.po: New Portuguese translation.
* configure.ac (ALL_LINGUAS): Add pt.
* configure: Regenerate.
Nick Clifton [Tue, 27 Feb 2018 12:16:04 +0000 (12:16 +0000)]
Use standardized error message for unrecognized relocs.
bfd * aout-cris.c (swap_ext_reloc_out): Standadize error/warning
message.
* elf-hppa.h (elf_hppa_info_to_howto_rel): Likewise.
* elf32-i386.c (elf_i386_reloc_type_lookup): Likewise.
* elf32-xtensa.c (elf_xtensa_reloc_type_lookup): Likewise.
* elf64-ppc.c (ppc64_elf_reloc_type_lookup): Likewise.
* elf64-s390.c (elf_s390_reloc_type_lookup): Likewise.
* elf64-sh64.c (sh_elf64_info_to_howto): Likewise.
* elfxx-ia64.c (ia64_elf_reloc_type_lookup): Likewise.
* elfxx-sparc.c (_bfd_sparc_elf_reloc_type_lookup): Likewise.
* elfxx-tilegx.c (tilegx_reloc_type_lookup): Likewise.
Nick Clifton [Tue, 27 Feb 2018 10:15:13 +0000 (10:15 +0000)]
Have info_to_howto functions return a success/fail status. Check this result. Stop strip from completeing if one of these functions fails.
bfd PR 22875
* elf-bfd.h (struct elf_backend_data): Change the return type of
the elf_info_to_howto and elf_info_to_howto_rel function pointers
to bfd_boolean.
* elfcode.h (elf_slurp_reloc_table_from_section): Check the return value from the info_to_howto function and fail if that function failed.
* elf32-h8300.c (elf32_h8_relocate_section): Check return value from the info_to_howto function.
(elf32_h8_relax_section): Likewise.
* elf32-lm32.c (lm32_elf_relocate_section): Likewise.
* elf32-m68hc1x.c (elf32_m68hc11_relocate_section): Likewise.
* elf32-score.c (s3_bfd_score_elf_relocate_section): Likewise.
* elf32-score7.c (s7_bfd_score_elf_relocate_section): Likewise.
* elf32-tic6x.c (elf32_tic6x_relocate_section): Likewise.
* elf64-ia64-vms.c (elf64_ia64_relocate_section): Likewise.
* elf64-sparc.c (elf64_sparc_slurp_one_reloc_table): Likewise.
* elf64-x86-64.c (elf_x86_64_tls_transition): Likewise.
* elfnn-ia64.c (elfNN_ia64_relocate_section): Likewise.
* elfnn-riscv.c (riscv_elf_check_relocs): Likewise.
(riscv_elf_relocate_section): Likewise.
* elf-hppa.h (elf_hppa_info_to_howto): Change return type to
bfd_boolean. Issue an error message, set an error value and
return FALSE if the reloc is not recognized.
(elf_hppa_info_to_howto_rel): Likewise.
* elf-m10200.c (mn10200_info_to_howto): Likewise.
* elf-m10300.c (mn10300_info_to_howto): Likewise.
* elf.c (_bfd_elf_no_info_to_howto): Likewise.
* elf32-arc.c (arc_info_to_howto_rel): Likewise.
* elf32-arm.c (elf32_arm_info_to_howto): Likewise.
* elf32-avr.c (avr_info_to_howto_rela): Likewise.
* elf32-bfin.c (bfin_info_to_howto): Likewise.
* elf32-cr16.c (elf_cr16_info_to_howto): Likewise.
* elf32-cr16c.c (elf_cr16c_info_to_howto): Likewise.
* elf32-cris.c (elf_cr16c_info_to_howto_rel, cris_info_to_howto_rela): Likewise.
* elf32-crx.c (elf_crx_info_to_howto): Likewise.
* elf32-d10v.c (d10v_info_to_howto_rel): Likewise.
* elf32-d30v.c (d30v_info_to_howto_rel, d30v_info_to_howto_rela): Likewise.
* elf32-dlx.c (dlx_rtype_to_howto, elf32_dlx_info_to_howto, elf32_dlx_info_to_howto_rel): Likewise.
* elf32-epiphany.c (epiphany_info_to_howto_rela): Likewise.
* elf32-fr30.c (fr30_info_to_howto_rela): Likewise.
* elf32-frv.c (frv_info_to_howto_rela, frvfdpic_info_to_howto_rel): Likewise.
* elf32-ft32.c (ft32_info_to_howto_rela): Likewise.
* elf32-gen.c (elf_generic_info_to_howto, elf_generic_info_to_howto_rel): Likewise.
* elf32-h8300.c (elf32_h8_info_to_howto, elf32_h8_info_to_howto_rel): Likewise.
* elf32-i370.c (i370_elf_info_to_howto): Likewise.
* elf32-i386.c (elf_i386_reloc_type_lookup, elf_i386_rtype_to_howto, elf_i386_info_to_howto_rel): Likewise.
* elf32-i860.c (lookup_howto, elf32_i860_info_to_howto_rela): Likewise.
* elf32-i960.c (elf32_i960_info_to_howto_rel): Likewise.
* elf32-ip2k.c (ip2k_info_to_howto_rela): Likewise.
* elf32-iq2000.c (iq2000_info_to_howto_rela): Likewise.
* elf32-lm32.c (lm32_info_to_howto_rela): Likewise.
* elf32-m32c.c (m32c_info_to_howto_rela): Likewise.
* elf32-m32r.c (m32r_info_to_howto_rel, m32r_info_to_howto): Likewise.
* elf32-m68hc11.c (m68hc11_info_to_howto_rel): Likewise.
* elf32-m68hc12.c (m68hc11_info_to_howto_rel): Likewise.
* elf32-m68k.c (rtype_to_howto): Likewise.
* elf32-mcore.c (mcore_elf_info_to_howto): Likewise.
* elf32-mep.c (mep_info_to_howto_rela): Likewise.
* elf32-metag.c (metag_info_to_howto_rela): Likewise.
* elf32-microblaze.c (microblaze_elf_info_to_howto): Likewise.
* elf32-mips.c (mips_info_to_howto_rel, mips_info_to_howto_rela): Likewise.
* elf32-moxie.c (moxie_info_to_howto_rela): Likewise.
* elf32-msp430.c (msp430_info_to_howto_rela): Likewise.
* elf32-mt.c (mt_info_to_howto_rela): Likewise.
* elf32-nds32.c (nds32_info_to_howto_rel, nds32_info_to_howto): Likewise.
* elf32-nios2.c (nios2_elf32_info_to_howto): Likewise.
* elf32-or1k.c (or1k_info_to_howto_rela): Likewise.
* elf32-pj.c (pj_elf_info_to_howto): Likewise.
* elf32-ppc.c (ppc_elf_info_to_howto): Likewise.
* elf32-pru.c (pru_elf32_info_to_howto): Likewise.
* elf32-rl78.c (rl78_info_to_howto_rela): Likewise.
* elf32-rx.c (rx_info_to_howto_rela): Likewise.
* elf32-s390.c (elf_s390_info_to_howto): Likewise.
* elf32-score.c (s3_bfd_score_info_to_howto, _bfd_score_info_to_howto): Likewise.
* elf32-score7.c (s7_bfd_score_info_to_howto): Likewise.
* elf32-sh.c (sh_elf_info_to_howto): Likewise.
* elf32-spu.c (spu_elf_info_to_howto): Likewise.
* elf32-tic6x.c (elf32_tic6x_info_to_howto, elf32_tic6x_info_to_howto_rel): Likewise.
* elf32-tilepro.c (tilepro_info_to_howto_rela): Likewise.
* elf32-v850.c (v850_elf_info_to_howto_rel, v850_elf_info_to_howto_rela, v800_elf_info_to_howto): Likewise.
* elf32-vax.c (rtype_to_howto): Likewise.
* elf32-visium.c (visium_info_to_howto_rela): Likewise.
* elf32-wasm32.c (elf32_wasm32_rtype_to_howto, elf32_wasm32_info_to_howto_rela): Likewise.
* elf32-xc16x.c (elf32_xc16x_info_to_howto): Likewise.
* elf32-xgate.c (xgate_info_to_howto_rel): Likewise.
* elf32-xstormy16.c (xstormy16_info_to_howto_rela): Likewise.
* elf32-xtensa.c (elf_xtensa_info_to_howto_rela): Likewise.
* elf64-alpha.c (elf64_alpha_info_to_howto): Likewise.
* elf64-gen.c (elf_generic_info_to_howto, elf_generic_info_to_howto_rel): Likewise.
* elf64-ia64-vms.c (elf64_ia64_info_to_howto): Likewise.
* elf64-mips.c (mips_elf64_info_to_howto_rela): Likewise.
* elf64-mmix.c (mmix_info_to_howto_rela): Likewise.
* elf64-ppc.c (ppc64_elf_info_to_howto): Likewise.
* elf64-s390.c (elf_s390_reloc_type_lookup): Likewise.
* elf64-sh64.c (elf_s390_info_to_howto, sh_elf64_info_to_howto): Likewise.
* elf64-x86-64.c (elf_x86_64_info_to_howto): Likewise.
* elfn32-mips.c (mips_info_to_howto_rel, mips_info_to_howto_rela): Likewise.
* elfnn-aarch64.c (elfNN_aarch64_info_to_howto): Likewise.
* elfnn-ia64.c (elfNN_ia64_info_to_howto): Likewise.
* elfnn-riscv.c (riscv_info_to_howto_rela): Likewise.
* elfxx-ia64.c (ia64_elf_reloc_type_lookup): Likewise.
* elfxx-sparc.c (_bfd_sparc_elf_info_to_howto): Likewise.
* elfxx-tilegx.c (tilegx_info_to_howto_rela): Likewise.
* elf32-score.h (s7_bfd_score_info_to_howto): Update prototype.
* elfxx-sparc.h (_bfd_sparc_elf_info_to_howto): Update prototype.
* elfxx-tilegx.h (tilegx_info_to_howto_rela): Update prototype.
* elfxx-target.h (elf_info_to_howto, elf_info_to_howto_rel): Default to NULL.
binutils PR 22875
* objcopy.c (copy_object): Check the error status after marking symbols used in relocations.
* testsuite/binutils-all/strip-13.s: New test source file.
* testsuite/binutils-all/strip-13.s: New test driver file.
* testsuite/binutils-all/objcopy.exp: Run the new test.
GDB Administrator [Tue, 27 Feb 2018 00:00:26 +0000 (00:00 +0000)]
Automatic date update in version.in
Jim Wilson [Mon, 26 Feb 2018 22:09:12 +0000 (14:09 -0800)]
ChangeLog entry for previous commit.
Jim Wilson [Mon, 26 Feb 2018 22:05:13 +0000 (14:05 -0800)]
IA-64: Fix linker error with --no-keep-memory.
bfd/
PR 15904
* elfnn-ia64.c (elfNN_ia64_relax_section): After ia64_elf_relax_brl
call, set changed_contents and changed_relocs. Likewise after
successful ia64_elf_relax_br call.
Simon Marchi [Mon, 26 Feb 2018 19:30:43 +0000 (14:30 -0500)]
Add test for load command
There doesn't seem to by any test for the load command. I suggest to
add this test, so that we can have a minimum of confidence we don't
break it completely while refactoring the code that implements it.
gdb/testsuite/ChangeLog:
* gdb.base/load-command.c: New file.
* gdb.base/load-command.exp: New file.
* lib/gdb.exp (gdb_is_target_remote_prompt): Rename to...
(gdb_is_target_1): ...this, and generalize for other targets
than just remote.
(gdb_is_target_remote): Use gdb_is_target_1.
(gdb_is_target_native): use gdb_is_target_1.
Maciej W. Rozycki [Mon, 26 Feb 2018 19:43:17 +0000 (19:43 +0000)]
MIPS: Don't use a 32-bit BFD architecture with a 64-bit ABI
Select `bfd_mach_mips4000', which corresponds to the MIPS III ISA, the
earlies with 64-bit support, whenever a 32-bit BFD architecture has been
chosen to use with a 64-bit ABI. The situation can happen in a few
cases:
1. When the user has used `set architecture' or `set mips abi' commands
to override automatic selection and then starts a debug session by
requesting to run, attach or connect to a target.
2. In native debugging when reattaching to a previously debugged process
where the program to be debugged has been since discarded, as
observed with:
FAIL: gdb.base/attach.exp: attach2, with no file (GDB internal error)
in n32 and n64 regression testing.
3. In remote debugging with a non-XML debug stub when discarding the
program to be debugged while connected to the remote target, as
observed with:
FAIL: gdb.base/break-unload-file.exp: cmdline: always-inserted on: break: file (GDB internal error)
in n32 and n64 regression testing.
In the latter two cases the ABI, quite rightfully, is retained while the
program to be debugged is discarded. This is because in that case the
ABI previously determined is carried over along with `gdbarch' in use,
which is retained. The BFD architecture is however discarded and the
default then applies, because it is not attached to `gdbarch'.
In all these cases we trip with an internal error message as follows:
.../gdb/mips-tdep.c:766: internal-error: bad register size
A problem internal to GDB has been detected,
further debugging may prove unreliable.
Quit this debugging session? (y or n) n
This is a bug, please report it. For instructions, see:
<http://www.gnu.org/software/gdb/bugs/>.
coming from `mips_pseudo_register_read', because the raw register width
inferred from the BFD architecture turns out to be 4 for the general
registers while the cooked register width inferred from the ABI in
effect is 8.
We do not hit this internal error in remote debugging with an XML debug
stub, because in that case raw register width information is passed by
the stub along with the XML target description.
Ultimately I think we ought to make the BFD architecture sticky like the
ABI, however in the interim this simple fix will do, removing the error
across all three cases. The case where the user has used `set mips abi'
or `set architecture' commands has to be handled anyway, and although a
more sophisticated solution could be envisaged, such as reporting an
error with the respective `set' command, I think this is too much of a
corner case to bother.
gdb/
* mips-tdep.c (mips_gdbarch_init): Don't use a 32-bit BFD
architecture with a 64-bit ABI.
Maciej W. Rozycki [Mon, 26 Feb 2018 19:43:17 +0000 (19:43 +0000)]
MIPS: Reorder ABI determination ahead of target description loading
Move ABI determination code ahead of target description loading so that
architecture information can be adjusted according to the ABI selected,
and then used in OS dependent register information initialization needed
for target description processing. No functional change.
gdb/
* gdb/mips-tdep.c (mips_gdbarch_init): Reorder ABI determination
ahead of target description loading.
Tom Tromey [Wed, 26 Apr 2017 04:33:50 +0000 (22:33 -0600)]
Change frame_filter_flags to use DEF_ENUM_FLAGS_TYPE
This changes frame_filter_flags to use DEF_ENUM_FLAGS_TYPE, and
updates all the uses. It also changes the enum constants to use <<,
as suggested by Sergio.
ChangeLog
2018-02-26 Tom Tromey <tom@tromey.com>
* stack.c (backtrace_command_1): Update.
* python/python-internal.h (gdbpy_apply_frame_filter): Change type
of "flags".
* python/py-framefilter.c (py_print_frame)
(gdbpy_apply_frame_filter): Change type of "flags".
* mi/mi-cmd-stack.c (mi_apply_ext_lang_frame_filter): Change type
of "flags".
(mi_cmd_stack_list_frames, mi_cmd_stack_list_locals)
(mi_cmd_stack_list_args, mi_cmd_stack_list_variables): Update.
* extension.h (enum frame_filter_flag): Rename from
frame_filter_flags.
(frame_filter_flags): Define using DEF_ENUM_FLAGS_TYPE.
(apply_ext_lang_frame_filter): Change type of "flags".
* extension.c (apply_ext_lang_frame_filter): Change type of
"flags".
* extension-priv.h (struct extension_language_ops)
<apply_frame_filter>: Change type of "flags".
Tom Tromey [Mon, 20 Jun 2016 16:36:29 +0000 (10:36 -0600)]
Make "bt N" print correct number of frames when using a frame filter
PR python/16497 notes that using "bt" with a positive argument prints
the wrong number of frames when a frame filter is in use. Also, in this
case, the non-frame-filter path will print a message about "More stack
frames" when there are more; but this is not done in the frame-filter
case.
The first problem is that backtrace_command_1 passes the wrong value
to apply_ext_lang_frame_filter -- that function takes the final
frame's number as an argument, but backtrace_command_1 passes the
count, which is off by one.
The solution to the second problem is to have the C stack-printing
code stop at the correct number of frames and then print the message.
Tested using the buildbot.
ChangeLog
2018-02-26 Tom Tromey <tom@tromey.com>
PR python/16497:
* stack.c (backtrace_command_1): Set PRINT_MORE_FRAMES flag. Fix
off-by-one in py_end computation.
* python/py-framefilter.c (gdbpy_apply_frame_filter): Handle
PRINT_MORE_FRAMES.
* extension.h (enum frame_filter_flags) <PRINT_MORE_FRAMES>: New
constant.
2018-02-26 Tom Tromey <tom@tromey.com>
PR python/16497:
* gdb.python/py-framefilter.exp: Update test.
Tom Tromey [Wed, 10 Jan 2018 20:53:18 +0000 (13:53 -0700)]
Handle DW_TAG_variant_part and DW_TAG_variant
This changes dwarf2read to understand DW_TAG_variant_part and
DW_TAG_variant.
Note that DW_AT_discr_list is not handled. I did not need this for
Rust. I imagine this should not be too hard to add later, should
someone need it. Meanwhile I have gdb emit a complaint if it is seen.
There is a lurking issue concerning the placement of the discriminant
in the DWARF. For Rust, I ended up following the letter of the
standard and having the discriminant be a child of the
DW_TAG_variant_part. However, GCC's Ada support does not do this.
Pierre-Marie filed this with the DWARF committee:
http://dwarfstd.org/ShowIssue.php?issue=180123.1
However as that is read-only, if you have comments you might consider
adding them to the GCC bug:
https://gcc.gnu.org/bugzilla/show_bug.cgi?id=83935
Finally, there is a DWARF extension lurking in here. In Rust, a
univariant enum will not have a discriminant. However, in order to
unify the representation of all data-carrying enums, I've made LLVM
(and my forthcoming rustc patch) emit a univariant enum using a
DW_TAG_variant with a single variant part and without DW_AT_discr.
The lack of this DW_AT_discr is the extension. I will submit an issue
on dwarfstd.org about this.
2018-02-26 Tom Tromey <tom@tromey.com>
* dwarf2read.c (struct variant_field): New.
(struct nextfield) <variant>: New field.
(dwarf2_add_field): Handle DW_TAG_variant_part.
(dwarf2_attach_fields_to_type): Attach a discriminant_info to a
discriminated union.
(read_structure_type): Handle DW_TAG_variant_part.
(handle_struct_member_die): New function, extracted from
process_structure_scope. Handle DW_TAG_variant.
(process_structure_scope): Handle discriminated unions. Call
handle_struct_member_die.
2018-02-26 Tom Tromey <tom@tromey.com>
* gdb.dwarf2/variant.c: New file.
* gdb.dwarf2/variant.exp: New file.
Tom Tromey [Fri, 9 Feb 2018 20:31:51 +0000 (13:31 -0700)]
Convert Rust to use discriminated unions
A Rust enum is, essentially, a discriminated union. Currently the
Rust language support handles Rust enums locally, in rust-lang.c.
However, because I am changing the Rust compiler to use
DW_TAG_variant* to represent enums, it seemed better to have a single
internal representation for Rust enums in gdb.
This patch implements this idea by moving the current Rust enum
handling code to dwarf2read. This allows the simplification of some
parts of rust-lang.c as well.
2018-02-26 Tom Tromey <tom@tromey.com>
* rust-lang.h (rust_last_path_segment): Declare.
* rust-lang.c (rust_last_path_segment): Now public. Change
contract.
(struct disr_info): Remove.
(RUST_ENUM_PREFIX, RUST_ENCODED_ENUM_REAL)
(RUST_ENCODED_ENUM_HIDDEN, rust_union_is_untagged)
(rust_get_disr_info, rust_tuple_variant_type_p): Remove.
(rust_enum_p, rust_enum_variant): New function.
(rust_underscore_fields): Remove "offset" parameter.
(rust_print_enum): New function.
(rust_val_print) <TYPE_CODE_UNION>: Remove enum code.
<TYPE_CODE_STRUCT>: Call rust_print_enum when appropriate.
(rust_print_struct_def): Add "for_rust_enum" parameter. Handle
enums.
(rust_internal_print_type): New function, from rust_print_type.
Remove enum code.
(rust_print_type): Call rust_internal_print_type.
(rust_evaluate_subexp) <STRUCTOP_ANONYMOUS, STRUCTOP_STRUCT>:
Update enum handling.
* dwarf2read.c (struct dwarf2_cu) <rust_unions>: New field.
(rust_fully_qualify, alloc_discriminant_info, quirk_rust_enum)
(rust_union_quirks): New functions.
(process_full_comp_unit, process_full_type_unit): Call
rust_union_quirks.
(process_structure_scope): Update rust_unions if necessary.
2018-02-26 Tom Tromey <tom@tromey.com>
* gdb.rust/simple.exp: Accept more possible results in enum test.
Tom Tromey [Fri, 9 Feb 2018 20:31:42 +0000 (13:31 -0700)]
Initial support for variant parts
This adds some initial support for variant parts to gdbtypes.h. A
variant part is represented as a union. The union has a flag
indicating that it has a discriminant, and information about the
discriminant is attached using the dynamic property system.
2018-02-26 Tom Tromey <tom@tromey.com>
* value.h (value_union_variant): Declare.
* valops.c (value_union_variant): New function.
* gdbtypes.h (TYPE_FLAG_DISCRIMINATED_UNION): New macro.
(struct discriminant_info): New.
(enum dynamic_prop_node_kind) <DYN_PROP_DISCRIMINATED>: New
enumerator.
(struct main_type) <flag_discriminated_union>: New field.
Tom Tromey [Wed, 21 Feb 2018 17:36:55 +0000 (10:36 -0700)]
Sign-extend non-bit-fields in unpack_bits_as_long
unpack_bits_as_long is documented as sign-extending its result when
the type is signed. However, it was only doing sign-extension in the
case where the field was a bitfield -- that is, not when the "bitsize"
parameter was 0, indicating the size should be taken from the type.
Also, unpack_bits_as_long was incorrectly computing the shift for
big-endian architectures for the non-bitfield case.
This patch fixes these bugs in a straightforward way. A new selftest
is included.
2018-02-26 Tom Tromey <tom@tromey.com>
* Makefile.in (SUBDIR_UNITTESTS_SRCS): Add
unittests/unpack-selftests.c.
* unittests/unpack-selftests.c: New file.
* value.c (unpack_bits_as_long): Fix bugs in non-bitfield cases.
Maciej W. Rozycki [Mon, 26 Feb 2018 16:11:03 +0000 (16:11 +0000)]
GAS/doc: Clean up `.dc' and `.ds' directive descriptions
gas/
* doc/as.texinfo (Pseudo Ops): Clean up `.dc' and `.ds'
descriptions.
Yao Qi [Mon, 26 Feb 2018 15:38:01 +0000 (15:38 +0000)]
Move read_partial_die to partial_die_info::read
gdb:
2018-02-26 Yao Qi <yao.qi@linaro.org>
* dwarf2read.c (struct partial_die_info) <read>: New method.
(read_partial_die): Remove the declaration.
(load_partial_dies): Update.
(partial_die_info::partial_die_info):
(read_partial_die): Change it to partial_die_info::read.
Yao Qi [Mon, 26 Feb 2018 15:38:01 +0000 (15:38 +0000)]
Move fixup_partial_die to partial_die_info::fixup
fixup_partial_die can be a partial_die_info method fixup.
gdb:
2018-02-26 Yao Qi <yao.qi@linaro.org>
* dwarf2read.c (struct partial_die_info) <fixup>: New method.
(fixup_partial_die): Remove declaration.
(scan_partial_symbols): Update.
(partial_die_parent_scope): Likewise.
(partial_die_full_name): Likewise.
(fixup_partial_die): Change it to partial_die_info::fixup.
Yao Qi [Mon, 26 Feb 2018 15:38:01 +0000 (15:38 +0000)]
Remove one argument abbrev_len in read_partial_die
gdb:
2018-02-26 Yao Qi <yao.qi@linaro.org>
* dwarf2read.c (read_partial_die): Update the declaration.
(load_partial_dies): Caller update.
(read_partial_die): Remove one argument abbrev_len.
Yao Qi [Mon, 26 Feb 2018 15:38:01 +0000 (15:38 +0000)]
Class-fy partial_die_info
This patch is to class-fy partial_die_info. Two things special here,
- disable assignment operator, but keep copy ctor, which is used in
load_partial_dies,
- have a private ctor which is only used by dwarf2_cu::find_partial_die,
I don't want other code use it, so make it private,
gdb:
2018-02-26 Yao Qi <yao.qi@linaro.org>
* dwarf2read.c (struct partial_die_info): Add ctor, delete
assignment operator.
(load_partial_dies): Use ctor and copy ctor.
(read_partial_die): Update.
(dwarf2_cu::find_partial_die): Use ctor.
Yao Qi [Mon, 26 Feb 2018 15:38:01 +0000 (15:38 +0000)]
Change find_partial_die_in_comp_unit to dwarf2_cu::find_partial_die
This patch changes find_partial_die_in_comp_unit to a dwarf2_cu method
find_partial_die.
gdb:
2018-02-26 Yao Qi <yao.qi@linaro.org>
* dwarf2read.c (struct dwarf2_cu) <find_partial_die>: New method.
(find_partial_die_in_comp_unit): Change it to
dwarf2_cu::find_partial_die.
(find_partial_die): Update.
Yao Qi [Mon, 26 Feb 2018 15:38:00 +0000 (15:38 +0000)]
Don't check abbrev is NULL in read_partial_die
'abbrev' won't be NULL, so don't check it.
gdb:
2018-02-26 Yao Qi <yao.qi@linaro.org>
* dwarf2read.c (read_partial_die): Remove the code checking abbrev
is NULL.
Yao Qi [Mon, 26 Feb 2018 15:38:00 +0000 (15:38 +0000)]
Re-write partial_die_info allocation in load_partial_dies
load_partial_dies has a "while (1)" loop to visit each die, and create
partial_die_info if needed in each iteration, like this,
part_die = XOBNEW (&cu->comp_unit_obstack, struct partial_die_info);
while (1)
{
if (foo1) continue;
if (foo2) continue;
read_partial_die (, , part_die, ,);
....
part_die = XOBNEW (&cu->comp_unit_obstack, struct partial_die_info);
};
the code was written in a way that spaces are allocated on necessary on
cu->comp_unit_obstack. I want to class-fy partial_die_info, but
partial_die_info ctor can't follow XOBNEW immediately, so this patch
rewrite this loop to:
while (1)
{
if (foo1) continue;
if (foo2) continue;
struct partial_die_info pdi;
read_partial_die (, , &pdi, ,);
part_die = XOBNEW (&cu->comp_unit_obstack, struct partial_die_info);
memcpy (part_die, &pdi, sizeof (pdi));
};
we create a local variable pdi, if we need it, call XOBNEW, and copy.
This also reduce one XOBNEW call. I measured the number of XOBNEW call in
load_partial_dies when gdb reads dwarf2read.o, without this patch, it is
18827, and with this patch, it is 18826.
gdb:
2018-026-26 Yao Qi <yao.qi@linaro.org>
* dwarf2read.c (load_partial_dies): Move the location of XOBNEW.
Alan Hayward [Mon, 26 Feb 2018 10:51:36 +0000 (10:51 +0000)]
Move arch/tdesc.h to common/tdesc.h
gdb/
* arch/amd64.h: Use common/tdesc.h.
* arch/i386.c: Likewise.
* arch/i386.h: Likewise.
* arch/tic6x.c: Likewise.
* arch/tdesc.h: Move file from here...
* common/tdesc.h: ...to here.
* features/aarch64-core.c: Regenerate.
* features/aarch64-fpu.c: Regenerate.
* features/i386/32bit-avx.c: Regenerate.
* features/i386/32bit-avx512.c: Regenerate.
* features/i386/32bit-core.c: Regenerate.
* features/i386/32bit-linux.c: Regenerate.
* features/i386/32bit-mpx.c: Regenerate.
* features/i386/32bit-pkeys.c: Regenerate.
* features/i386/32bit-sse.c: Regenerate.
* features/i386/64bit-avx.c: Regenerate.
* features/i386/64bit-avx512.c: Regenerate.
* features/i386/64bit-core.c: Regenerate.
* features/i386/64bit-linux.c: Regenerate.
* features/i386/64bit-mpx.c: Regenerate.
* features/i386/64bit-pkeys.c: Regenerate.
* features/i386/64bit-segments.c: Regenerate.
* features/i386/64bit-sse.c: Regenerate.
* features/i386/x32-core.c: Regenerate.
* features/tic6x-c6xp.c: Regenerate.
* features/tic6x-core.c: Regenerate.
* features/tic6x-gp.c: Regenerate.
* target-descriptions.c: Use common/tdesc.h.
* target-descriptions.h: Likewise.
gdbserver/
* tdesc.c: Use common/tdesc.h.
* tdesc.h: Likewise.
Nick Clifton [Mon, 26 Feb 2018 11:28:23 +0000 (11:28 +0000)]
Fix typo in documentation of assembler's .dc directive.
* doc/as.texinfo (Dc): Fix typo.
Alan Modra [Sun, 25 Feb 2018 21:46:24 +0000 (08:16 +1030)]
Segfault on phdrs allocated but not created
A number of ARM tests show results like:
ld-new: no address assigned to the veneers output section .gnu.sgstubs
ld-new: can not size stub section: invalid operation
ld-new: warning: cannot find entry symbol _start; defaulting to
0000000000010074
ld-new: tmpdir/cmse-veneers-no-gnu_sgstubs: warning: allocated section `.text' not in segment
Segmentation fault
PASS: Secure gateway veneers: no .gnu.sgstubs section
The PASS despite the segv shows the danger of using "#..." to match
error output. This patch doesn't try to fix the testuite, but does
prevent the segfault.
* elf.c (assign_file_positions_except_relocs): Don't segfault
when actual number of phdrs is less than allocated. Delete
outdated comment. Formatting.
Alan Modra [Fri, 23 Feb 2018 23:58:12 +0000 (10:28 +1030)]
ld error/warning messages
This patch standardizes messages in ld, to better conform to the GNU
coding standard. Besides issues of capitalization and full-stops,
I've
- Split up help messages for target options, so that adding a new
option does not mean loss of translation for all the others.
- Embedded tabs have been removed, since a user might have tab stops
set at other than 8 char intervals.
- Added missing program name (%P). ld isn't the compiler.
- Put %F and %X first (and removed %X if %F was present). These can
go anywhere, but look silly in the m%Fiddle of a message, and
choosing "%P%F:" in some messages but "%F%P:" in others leads to the
likelihood of duplication in ld.pot. Besides, the colon belongs
with %P.
* emulparams/call_nop.sh, * emulparams/cet.sh,
* emulparams/elf32mcore.sh, * emultempl/aarch64elf.em
* emultempl/aix.em, * emultempl/alphaelf.em, * emultempl/armcoff.em,
* emultempl/armelf.em, * emultempl/avrelf.em, * emultempl/beos.em,
* emultempl/bfin.em, * emultempl/cr16elf.em, * emultempl/elf32.em,
* emultempl/elf-generic.em, * emultempl/hppaelf.em,
* emultempl/linux.em, * emultempl/lnk960.em,
* emultempl/m68hc1xelf.em, * emultempl/m68kcoff.em,
* emultempl/m68kelf.em, * emultempl/metagelf.em,
* emultempl/mipself.em, * emultempl/mmix-elfnmmo.em,
* emultempl/mmo.em, * emultempl/msp430.em, * emultempl/nds32elf.em,
* emultempl/nios2elf.em, * emultempl/pe.em, * emultempl/pep.em,
* emultempl/ppc32elf.em, * emultempl/ppc64elf.em,
* emultempl/scoreelf.em, * emultempl/sh64elf.em,
* emultempl/spuelf.em, * emultempl/sunos.em, * emultempl/tic6xdsbt.em,
* emultempl/ticoff.em, * emultempl/v850elf.em, * emultempl/vms.em,
* emultempl/vxworks.em, * emultempl/xtensaelf.em, * ldcref.c,
* ldctor.c, * ldexp.c, * ldfile.c, * ldgram.y, * ldlang.c,
* ldmain.c, * ldmisc.c, * ldwrite.c, * lexsup.c, * mri.c, * pe-dll.c,
* plugin.c: Standardize error/warning messages.
* testsuite/ld-arc/jli-overflow.err,
* testsuite/ld-arm/cmse-implib-errors.out,
* testsuite/ld-arm/cmse-new-earlier-later-implib.out,
* testsuite/ld-arm/cmse-new-implib-not-sg-in-implib.out,
* testsuite/ld-arm/cmse-new-wrong-implib.out,
* testsuite/ld-arm/cmse-veneers-no-gnu_sgstubs.out,
* testsuite/ld-arm/cmse-veneers-wrong-entryfct.out,
* testsuite/ld-arm/vxworks1-static.d,
* testsuite/ld-cris/tls-err-20x.d, * testsuite/ld-cris/tls-err-29.d,
* testsuite/ld-cris/tls-err-31.d, * testsuite/ld-cris/tls-err-33.d,
* testsuite/ld-cris/tls-err-35.d, * testsuite/ld-cris/tls-err-37.d,
* testsuite/ld-cris/tls-err-39.d, * testsuite/ld-cris/tls-err-41.d,
* testsuite/ld-cris/tls-err-43.d, * testsuite/ld-cris/tls-err-45.d,
* testsuite/ld-cris/tls-err-47.d, * testsuite/ld-cris/tls-err-49.d,
* testsuite/ld-cris/tls-err-51.d, * testsuite/ld-cris/tls-err-67.d,
* testsuite/ld-elf/dwarf2.err, * testsuite/ld-elf/dwarf3.err,
* testsuite/ld-elf/orphan-5.l, * testsuite/ld-elf/orphan-6.l,
* testsuite/ld-i386/vxworks1-static.d,
* testsuite/ld-mips-elf/bal-jalx-pic-micromips-n32.d,
* testsuite/ld-mips-elf/bal-jalx-pic-micromips-n64.d,
* testsuite/ld-mips-elf/bal-jalx-pic-micromips.d,
* testsuite/ld-mips-elf/bal-jalx-pic-n32.d,
* testsuite/ld-mips-elf/bal-jalx-pic-n64.d,
* testsuite/ld-mips-elf/bal-jalx-pic.d,
* testsuite/ld-mips-elf/jal-global-overflow-1.d,
* testsuite/ld-mips-elf/jal-local-overflow-1.d,
* testsuite/ld-mips-elf/mode-change-error-1.d,
* testsuite/ld-mips-elf/unaligned-branch-2.d,
* testsuite/ld-mips-elf/unaligned-branch-ignore-2.d,
* testsuite/ld-mips-elf/unaligned-branch-ignore-micromips.d,
* testsuite/ld-mips-elf/unaligned-branch-ignore-mips16.d,
* testsuite/ld-mips-elf/unaligned-branch-ignore-r6-1.d,
* testsuite/ld-mips-elf/unaligned-branch-micromips.d,
* testsuite/ld-mips-elf/unaligned-branch-mips16.d,
* testsuite/ld-mips-elf/unaligned-branch-r6-1.d,
* testsuite/ld-mips-elf/unaligned-branch-r6-2.d,
* testsuite/ld-mips-elf/unaligned-branch.d,
* testsuite/ld-mips-elf/unaligned-jalx-1.d,
* testsuite/ld-mips-elf/unaligned-jalx-3.d,
* testsuite/ld-mips-elf/unaligned-jalx-addend-1.d,
* testsuite/ld-mips-elf/unaligned-jalx-addend-3.d,
* testsuite/ld-mips-elf/unaligned-jalx-addend-micromips-1.d,
* testsuite/ld-mips-elf/unaligned-jalx-addend-mips16-1.d,
* testsuite/ld-mips-elf/unaligned-jalx-micromips-1.d,
* testsuite/ld-mips-elf/unaligned-jalx-mips16-1.d,
* testsuite/ld-mips-elf/unaligned-jump-micromips.d,
* testsuite/ld-mips-elf/unaligned-jump-mips16.d,
* testsuite/ld-mips-elf/unaligned-jump.d,
* testsuite/ld-mips-elf/unaligned-ldpc-1.d,
* testsuite/ld-mips-elf/unaligned-lwpc-1.d,
* testsuite/ld-mips-elf/undefined.d,
* testsuite/ld-mips-elf/vxworks1-static.d,
* testsuite/ld-mmix/bpo-20.d, * testsuite/ld-mmix/bpo-20m.d,
* testsuite/ld-mmix/bpo-7.d, * testsuite/ld-mmix/bpo-7m.d,
* testsuite/ld-mmix/bpo-8.d, * testsuite/ld-mmix/bpo-8m.d,
* testsuite/ld-mmix/greg-17.d, * testsuite/ld-mmix/greg-18.d,
* testsuite/ld-mmix/greg-8.d, * testsuite/ld-mmix/greg-9.d,
* testsuite/ld-plugin/plugin-14.d, * testsuite/ld-plugin/plugin-15.d,
* testsuite/ld-plugin/plugin-16.d, * testsuite/ld-plugin/plugin-20.d,
* testsuite/ld-plugin/plugin-21.d, * testsuite/ld-plugin/plugin-22.d,
* testsuite/ld-plugin/plugin-23.d, * testsuite/ld-plugin/plugin-6.d,
* testsuite/ld-plugin/plugin-7.d, * testsuite/ld-plugin/plugin-8.d,
* testsuite/ld-powerpc/aix-weak-3-32.d,
* testsuite/ld-powerpc/aix-weak-3-64.d,
* testsuite/ld-powerpc/vxworks1-static.d,
* testsuite/ld-sh/vxworks1-static.d,
* testsuite/ld-sparc/vxworks1-static.d,
* testsuite/ld-undefined/undefined.exp,
* testsuite/ld-x86-64/pie1.d: Update for changed errors and warnings.
* testsuite/ld-elf/warn1.d, * testsuite/ld-elf/warn2.d: Correct regex.
Alan Modra [Sat, 24 Feb 2018 08:20:21 +0000 (18:50 +1030)]
ld message translation for emultempl and emulparams
Most of the emultempl/*.em error/warning messages do not currently
appear in ld.pot, and fixing that is not simply a matter of adding
missing files to POTFILES. The difficulty is the shell-script
quoting, for example aarch64elf.em:PARSE_AND_LIST_OPTIONS "Don'\''t".
I suppose you could avoid contractions like "don't" but I'm unsure as
to whether gettext could handle everything in the emulparams scripts.
The right thing to do is feed the generated C files to gettext, as
this patch does. The patch just copies what is already done in bfd/
for generated files.
* Makefile.am (EMULATION_FILES, POTFILES): Delete.
(SRC_POTFILES, BLD_POTFILES): Define.
(po/POTFILES.in): Delete rule.
(po/SRC-POTFILES.in, po/BLD-POTFILES.in): New rules.
* configure.ac: Add AC_CONFIG_COMMANDS to create po/Makefile.
* po/Make-in (DISTFILES): Remove POTFILES.in, add SRC-POTFILES.in
and BLD-POTFILES.in.
(POTFILES): Delete.
(SRC-POTFILES, BLD-POTFILES): Define place marker.
(ld.pot): Build from SRC-POTFILES plus BLD-POTFILES.
(distclean, maintainer-clean): Tidy up new files.
(POTFILES, POTFILES.in): Delete rules.
(SRC-POTFILES, BLD-POTFILES, SRC-POTFILES.in, BLD-POTFILES.in):
New rules.
(Makefile): Depend on SRC-POTFILES and BLD-POTFILES.
* po/SRC-POTFILES.in: Rename from po/POTFILES.in.
* po/BLD-POTFILES.in: New file.
* Makefile.in: Regenerate.
* configure: Regenerate.
Alan Modra [Sat, 24 Feb 2018 00:03:33 +0000 (10:33 +1030)]
crx string overflow warning
gcc8 complains wrongly about the buffer not being large enough, at
least at -Og optimization.
* crx-dis.c (getregliststring): Allocate a large enough buffer
to silence false positive gcc8 warning.
GDB Administrator [Mon, 26 Feb 2018 00:00:31 +0000 (00:00 +0000)]
Automatic date update in version.in
Alan Modra [Wed, 21 Feb 2018 02:39:46 +0000 (13:09 +1030)]
assorted target messages
bfd/
* elf-m10300.c, * elf-s390-common.c, * elf32-arc.c, * elf32-cris.c,
* elf32-dlx.c, * elf32-frv.c, * elf32-i370.c, * elf32-lm32.c,
* elf32-m32r.c, * elf32-m68hc1x.c, * elf32-m68k.c,
* elf32-microblaze.c, * elf32-msp430.c, * elf32-nds32.c,
* elf32-nios2.c, * elf32-or1k.c, * elf32-rl78.c, * elf32-rx.c,
* elf32-score.c, * elf32-score7.c, * elf32-sh-symbian.c,
* elf32-sh.c, * elf32-spu.c, * elf32-v850.c, * elf32-xtensa.c,
* elf64-alpha.c, * elf64-ia64-vms.c, * elf64-mmix.c,
* elf64-sh64.c, * elf64-sparc.c, * elfnn-ia64.c, * elfxx-tilegx.c,
* mmo.c, * osf-core.c, * srec.c, * vms-alpha.c: Standardize
error/warning messages.
ld/
* testsuite/ld-cris/pcrelcp-1.d,
* testsuite/ld-mmix/start-2.d: Update.
Alan Modra [Wed, 21 Feb 2018 02:39:29 +0000 (13:09 +1030)]
BFD messages
bfd/
* archive.c, * bfd.c, * linker.c, * reloc.c, * stabs.c,
* syms.c: Standardize error/warning messages.
binutils/
* testsuite/binutils-all/mips/mips-reginfo-n32.d,
* testsuite/binutils-all/mips/mips-reginfo.d: Update.
gas/
* testsuite/gas/mips/reginfo-2.l: Update.
ld/
* testsuite/ld-arm/cmse-implib-errors.out,
* testsuite/ld-arm/cmse-new-earlier-later-implib.out,
* testsuite/ld-arm/cmse-new-implib-not-sg-in-implib.out,
* testsuite/ld-arm/cmse-new-wrong-implib.out,
* testsuite/ld-arm/cmse-veneers-no-gnu_sgstubs.out,
* testsuite/ld-arm/cmse-veneers-wrong-entryfct.out,
* testsuite/ld-cris/badgotr1.d,
* testsuite/ld-cris/tls-err-24.d,
* testsuite/ld-cris/tls-err-25.d,
* testsuite/ld-cris/tls-err-26.d,
* testsuite/ld-cris/tls-err-27.d,
* testsuite/ld-cris/tls-err-28.d,
* testsuite/ld-cris/tls-err-40.d,
* testsuite/ld-cris/tls-err-44.d,
* testsuite/ld-cris/tls-err-48.d,
* testsuite/ld-cris/tls-err-52.d,
* testsuite/ld-cris/tls-err-53.d,
* testsuite/ld-cris/tls-err-55.d,
* testsuite/ld-cris/tls-err-56.d,
* testsuite/ld-cris/tls-err-62.d,
* testsuite/ld-cris/tls-err-65.d,
* testsuite/ld-cris/tls-err-77.d,
* testsuite/ld-elf/empty-implib.out,
* testsuite/ld-elf/indirect.exp: Update.
Alan Modra [Wed, 21 Feb 2018 02:37:59 +0000 (13:07 +1030)]
AOUT/COFF/PE messages
Capitalization, full-stops and unnecessary trailing \n fixes.
* aout-adobe.c, * aout-cris.c, * i386linux.c, * m68klinux.c,
* sparclinux.c, * coff-alpha.c, * coff-arm.c, * coff-mcore.c,
* coffcode.h, * coffgen.c, * cofflink.c, * ecoff.c, * pe-mips.c,
* peXXigen.c, * peicode.h: Standardize error/warning messages.
Alan Modra [Wed, 21 Feb 2018 02:34:48 +0000 (13:04 +1030)]
ARM and AArch64 messages
More standarization of error/warning messages. The ARM backend has
some multi-line error messages, which don't fit particularly well with
the GNU coding standard insistence that error messages shouldn't be
capitalized or have a full-stop. I've replaced the line breaks with
semicolons.
So for instance the following
system/path/to/ld: myobject.o: invalid special symbol `foo'.
system/path/to/ld: It must be a global or weak function symbol.
becomes
system/path/to/ld: myobject.o: invalid special symbol `foo'; it must be a global or weak function symbol
bfd/
* elf32-arm.c, * elfnn-aarch64.c: Standardize error/warning messages.
ld/
* testsuite/ld-aarch64/reloc-overflow-bad.d,
* testsuite/ld-arm/attr-merge-9.out,
* testsuite/ld-arm/attr-merge-arch-2.d,
* testsuite/ld-arm/attr-merge-unknown-1.d,
* testsuite/ld-arm/attr-merge-unknown-2.d,
* testsuite/ld-arm/attr-merge-unknown-2r.d,
* testsuite/ld-arm/attr-merge-unknown-3.d,
* testsuite/ld-arm/cmse-implib-errors.out,
* testsuite/ld-arm/cmse-new-earlier-later-implib.out,
* testsuite/ld-arm/cmse-new-implib-no-output.out,
* testsuite/ld-arm/cmse-new-implib-not-sg-in-implib.out,
* testsuite/ld-arm/cmse-new-implib.out,
* testsuite/ld-arm/cmse-new-wrong-implib.out,
* testsuite/ld-arm/cmse-veneers-no-gnu_sgstubs.out,
* testsuite/ld-arm/cmse-veneers-wrong-entryfct.out,
* testsuite/ld-arm/group-relocs-alu-bad-2.d,
* testsuite/ld-arm/group-relocs-alu-bad.d,
* testsuite/ld-arm/group-relocs-ldc-bad-2.d,
* testsuite/ld-arm/group-relocs-ldc-bad.d,
* testsuite/ld-arm/group-relocs-ldr-bad-2.d,
* testsuite/ld-arm/group-relocs-ldr-bad.d,
* testsuite/ld-arm/group-relocs-ldrs-bad-2.d,
* testsuite/ld-arm/group-relocs-ldrs-bad.d,
* testsuite/ld-arm/stm32l4xx-cannot-fix-far-ldm.d: Update.
Alan Modra [Tue, 20 Feb 2018 10:32:16 +0000 (21:02 +1030)]
MIPS messages
More standardization of messages.
bfd/
* elfxx-mips.c: Standardize error/warning messages.
binutils/
* testsuite/binutils-all/mips/mips-reginfo-n32.d,
* testsuite/binutils-all/mips/mips-reginfo.d: Update.
gas/
* testsuite/gas/mips/reginfo-2.l: Update.
ld/
* testsuite/ld-mips-elf/attr-gnu-4-12.d,
* testsuite/ld-mips-elf/attr-gnu-4-13.d,
* testsuite/ld-mips-elf/attr-gnu-4-14.d,
* testsuite/ld-mips-elf/attr-gnu-4-16.d,
* testsuite/ld-mips-elf/attr-gnu-4-17.d,
* testsuite/ld-mips-elf/attr-gnu-4-18.d,
* testsuite/ld-mips-elf/attr-gnu-4-19.d,
* testsuite/ld-mips-elf/attr-gnu-4-21.d,
* testsuite/ld-mips-elf/attr-gnu-4-23.d,
* testsuite/ld-mips-elf/attr-gnu-4-24.d,
* testsuite/ld-mips-elf/attr-gnu-4-25.d,
* testsuite/ld-mips-elf/attr-gnu-4-26.d,
* testsuite/ld-mips-elf/attr-gnu-4-27.d,
* testsuite/ld-mips-elf/attr-gnu-4-28.d,
* testsuite/ld-mips-elf/attr-gnu-4-29.d,
* testsuite/ld-mips-elf/attr-gnu-4-31.d,
* testsuite/ld-mips-elf/attr-gnu-4-32.d,
* testsuite/ld-mips-elf/attr-gnu-4-34.d,
* testsuite/ld-mips-elf/attr-gnu-4-35.d,
* testsuite/ld-mips-elf/attr-gnu-4-36.d,
* testsuite/ld-mips-elf/attr-gnu-4-37.d,
* testsuite/ld-mips-elf/attr-gnu-4-38.d,
* testsuite/ld-mips-elf/attr-gnu-4-39.d,
* testsuite/ld-mips-elf/attr-gnu-4-41.d,
* testsuite/ld-mips-elf/attr-gnu-4-42.d,
* testsuite/ld-mips-elf/attr-gnu-4-43.d,
* testsuite/ld-mips-elf/attr-gnu-4-45.d,
* testsuite/ld-mips-elf/attr-gnu-4-46.d,
* testsuite/ld-mips-elf/attr-gnu-4-47.d,
* testsuite/ld-mips-elf/attr-gnu-4-48.d,
* testsuite/ld-mips-elf/attr-gnu-4-49.d,
* testsuite/ld-mips-elf/attr-gnu-4-52.d,
* testsuite/ld-mips-elf/attr-gnu-4-53.d,
* testsuite/ld-mips-elf/attr-gnu-4-54.d,
* testsuite/ld-mips-elf/attr-gnu-4-58.d,
* testsuite/ld-mips-elf/attr-gnu-4-59.d,
* testsuite/ld-mips-elf/attr-gnu-4-61.d,
* testsuite/ld-mips-elf/attr-gnu-4-62.d,
* testsuite/ld-mips-elf/attr-gnu-4-63.d,
* testsuite/ld-mips-elf/attr-gnu-4-64.d,
* testsuite/ld-mips-elf/attr-gnu-4-68.d,
* testsuite/ld-mips-elf/attr-gnu-4-69.d,
* testsuite/ld-mips-elf/attr-gnu-4-71.d,
* testsuite/ld-mips-elf/attr-gnu-4-72.d,
* testsuite/ld-mips-elf/attr-gnu-4-73.d,
* testsuite/ld-mips-elf/attr-gnu-4-74.d,
* testsuite/ld-mips-elf/attr-gnu-4-78.d,
* testsuite/ld-mips-elf/attr-gnu-4-79.d,
* testsuite/ld-mips-elf/attr-gnu-4-81.d,
* testsuite/ld-mips-elf/attr-gnu-4-89.d,
* testsuite/ld-mips-elf/attr-gnu-8-12.d,
* testsuite/ld-mips-elf/attr-gnu-8-21.d,
* testsuite/ld-mips-elf/bal-jalx-pic-micromips-n32.d,
* testsuite/ld-mips-elf/bal-jalx-pic-micromips-n64.d,
* testsuite/ld-mips-elf/bal-jalx-pic-micromips.d,
* testsuite/ld-mips-elf/bal-jalx-pic-n32.d,
* testsuite/ld-mips-elf/bal-jalx-pic-n64.d,
* testsuite/ld-mips-elf/bal-jalx-pic.d,
* testsuite/ld-mips-elf/mode-change-error-1.d,
* testsuite/ld-mips-elf/unaligned-branch-2.d,
* testsuite/ld-mips-elf/unaligned-branch-ignore-2.d,
* testsuite/ld-mips-elf/unaligned-branch-ignore-micromips.d,
* testsuite/ld-mips-elf/unaligned-branch-ignore-mips16.d,
* testsuite/ld-mips-elf/unaligned-branch-ignore-r6-1.d,
* testsuite/ld-mips-elf/unaligned-branch-micromips.d,
* testsuite/ld-mips-elf/unaligned-branch-mips16.d,
* testsuite/ld-mips-elf/unaligned-branch-r6-1.d,
* testsuite/ld-mips-elf/unaligned-branch-r6-2.d,
* testsuite/ld-mips-elf/unaligned-branch.d,
* testsuite/ld-mips-elf/unaligned-jalx-1.d,
* testsuite/ld-mips-elf/unaligned-jalx-3.d,
* testsuite/ld-mips-elf/unaligned-jalx-addend-1.d,
* testsuite/ld-mips-elf/unaligned-jalx-addend-3.d,
* testsuite/ld-mips-elf/unaligned-jalx-addend-micromips-1.d,
* testsuite/ld-mips-elf/unaligned-jalx-addend-mips16-1.d,
* testsuite/ld-mips-elf/unaligned-jalx-micromips-1.d,
* testsuite/ld-mips-elf/unaligned-jalx-mips16-1.d,
* testsuite/ld-mips-elf/unaligned-jump-micromips.d,
* testsuite/ld-mips-elf/unaligned-jump-mips16.d,
* testsuite/ld-mips-elf/unaligned-jump.d: Update.
Alan Modra [Tue, 20 Feb 2018 09:02:12 +0000 (19:32 +1030)]
ELF linker messages
This fixes a number of cases where we capitalized error messages or
printed a full-stop, and corrects "Dwarf" to "DWARF".
bfd/
* dwarf2.c, * elf-attrs.c, * elf-eh-frame.c, * elf.c, * elf32-gen.c,
* elflink.c: Standardize error/warning messages. Replace use of
linker callback einfo with _bfd_error_handler when possible.
ld/
* testsuite/ld-elf/indirect.exp,
* testsuite/ld-elf/pr22649-2ab-mips.msg,
* testsuite/ld-elf/pr22649-2cd-mips.msg,
* testsuite/ld-elf/pr22649.msg,
* testsuite/ld-elf/tls_common.exp,
* testsuite/ld-elfcomm/elfcomm.exp,
* testsuite/ld-arm/attr-merge-incompatible.d,
* testsuite/ld-tic6x/attr-compatibility-gnu-other.d,
* testsuite/ld-tic6x/attr-compatibility-other-gnu.d,
* testsuite/ld-tic6x/attr-compatibility-other-other.d,
* testsuite/ld-i386/warn1.d: Update expected error/warning messages.
Alan Modra [Wed, 21 Feb 2018 11:17:07 +0000 (21:47 +1030)]
unrecognized/unsupported reloc message
It must get boring translating all the variants we have of
unrecognized/unsupported/invalid/unexpected reloc number. This patch
cuts down on the number of variations.
* aoutx.h, * coff-alpha.c, * coff-i860.c, * coff-m68k.c,
* coff-mcore.c, * coff-ppc.c, * coff-rs6000.c, * coff-sh.c,
* coff-tic4x.c, * coff-tic54x.c, * coff-tic80.c, * coff-w65.c,
* elf-bfd.h, * elf-m10300.c, * elf.c, * elf32-avr.c, * elf32-bfin.c,
* elf32-cr16.c, * elf32-cr16c.c, * elf32-cris.c, * elf32-crx.c,
* elf32-d10v.c, * elf32-d30v.c, * elf32-dlx.c, * elf32-epiphany.c,
* elf32-fr30.c, * elf32-frv.c, * elf32-i370.c, * elf32-i386.c,
* elf32-i960.c, * elf32-ip2k.c, * elf32-iq2000.c, * elf32-lm32.c,
* elf32-m32c.c, * elf32-m32r.c, * elf32-m68hc11.c, * elf32-m68hc12.c,
* elf32-m68k.c, * elf32-mcore.c, * elf32-mep.c, * elf32-metag.c,
* elf32-microblaze.c, * elf32-mips.c, * elf32-moxie.c,
* elf32-msp430.c, * elf32-mt.c, * elf32-nds32.c, * elf32-or1k.c,
* elf32-pj.c, * elf32-ppc.c, * elf32-rl78.c, * elf32-rx.c,
* elf32-s390.c, * elf32-sh.c, * elf32-spu.c, * elf32-tic6x.c,
* elf32-v850.c, * elf32-vax.c, * elf32-visium.c, * elf32-wasm32.c,
* elf32-xgate.c, * elf32-xtensa.c, * elf64-alpha.c,
* elf64-ia64-vms.c, * elf64-mips.c, * elf64-mmix.c,
* elf64-ppc.c, * elf64-s390.c, * elf64-sparc.c, * elf64-x86-64.c,
* elfn32-mips.c, * elfnn-aarch64.c, * elfnn-ia64.c,
* elfnn-riscv.c, * elfxx-mips.c, * elfxx-riscv.c, * elfxx-riscv.h,
* elfxx-sparc.c, * elfxx-sparc.h, * reloc.c: Standardize
unrecognized/unsupported reloc message.
Alan Modra [Tue, 20 Feb 2018 08:59:09 +0000 (19:29 +1030)]
PPC error/warning messages
The GNU coding standard says error messages should be of the form
program:sourcefile:lineno: message
or
program: message
and
"The string message should not begin with a capital letter when it
follows a program name and/or file name, because that isn’t the
beginning of a sentence. (The sentence conceptually starts at the
beginning of the line.) Also, it should not end with a period."
This patch does that for ppc, and removes some British spelling.
I've also switched some error output from using the linker callback
einfo to _bfd_error_handler, due to improved compilation time
argument checking now done for the latter function.
bfd/
* elf32-ppc.c: Standardize error/warning messages. Use
_bfd_error_handler rather than einfo when einfo features not used.
* elf64-ppc.c: Likewise.
ld/
* testsuite/ld-powerpc/attr-gnu-12-21.d: Update.
* testsuite/ld-powerpc/attr-gnu-4-12.d: Update.
* testsuite/ld-powerpc/attr-gnu-4-13.d: Update.
* testsuite/ld-powerpc/attr-gnu-4-21.d: Update.
* testsuite/ld-powerpc/attr-gnu-4-23.d: Update.
* testsuite/ld-powerpc/attr-gnu-4-31.d: Update.
* testsuite/ld-powerpc/attr-gnu-4-32.d: Update.
* testsuite/ld-powerpc/attr-gnu-8-23.d: Update.
Simon Marchi [Sun, 25 Feb 2018 20:11:56 +0000 (15:11 -0500)]
Fix double space expected in cp_test_ptype_class
I noticed some failures of some buildbot slaves, e.g.:
FAIL: gdb.cp/nested-types.exp: ptype S10 (limit = 1) // wrong nested type enum definition: enum S10::E10 {S10::A10, S10::B10, S10::C10};
The issue is that they have an older gcc (not c++11 by default?) that
doesn't emit the enum underlying type information. When the
enum type is printed by ptype, it looks like this:
enum S10::E10 {S10::A10, S10::B10, S10::C10};
instead of this on older gccs:
enum S10::E10 : unsigned int {S10::A10, S10::B10, S10::C10};
The regex that matches this is in cp_test_ptype_class, and is
enum $nested_name (: (unsigned )?int)? \{
If the "unsigned int" portion is not present, then it requires the
string to have two spaces between the enum name and opening bracket.
The fix is simply to move the trailing space inside the ? group.
gdb/testsuite/ChangeLog:
* lib/cp-support.exp (cp_test_ptype_class): Move space inside
parentheses.
GDB Administrator [Sun, 25 Feb 2018 00:00:59 +0000 (00:00 +0000)]
Automatic date update in version.in