H.J. Lu [Mon, 9 Jul 2018 13:51:17 +0000 (06:51 -0700)]
bfd: Use changequote for "i[3-7]86-*-linux-*"
Use changequote to match "i[3-7]86-*-linux-*", instead of
"i3-786-*-linux-*".
PR ld/23388
* configure.ac: Use changequote for "i[3-7]86-*-linux-*".
* configure: Regenerated.
Alan Modra [Mon, 9 Jul 2018 02:39:59 +0000 (12:09 +0930)]
m68hc1* fixes
With config.sub now properly returning m68hc12-unknown-elf rather than
m68hc12-unknown-none, more ELF tests run. This patch enables
STB_GNU_UNIQUE processing fixing some testsuite failures that probably
no m68hc12 user cares about, and removes some XPASSes.
bfd/
* elf32-m68hc1x.c (elf32_m68hc11_post_process_headers): Call
_bfd_elf_post_process_headers.
ld/
* testsuite/ld-discard/extern.d: Remove m68hc12 xfail.
* testsuite/ld-discard/start.d: Likewise.
* testsuite/ld-discard/static.d: Likewise.
Christophe Lyon [Mon, 9 Jul 2018 07:45:46 +0000 (07:45 +0000)]
[ARM] Fix warning cannot find thumb start symbol
In case params.thumb_entry_symbol has its default NULL value, using it
to print a warning in gld${EMULATION_NAME}_finish results in a crash.
Use h->root.string instead which either points to
params.thumb_entry_symbol name or to entry_symbol name.
2018-07-09 Christophe Lyon <christophe.lyon@linaro.org>
* emultempl/armelf.em (gld${EMULATION_NAME}_finish): Use the right
symbol name in case of warning.
Change-Id: Iec61a833c0ad538b1440bf326ba67834c314dd63
GDB Administrator [Mon, 9 Jul 2018 00:00:48 +0000 (00:00 +0000)]
Automatic date update in version.in
GDB Administrator [Sun, 8 Jul 2018 00:01:00 +0000 (00:01 +0000)]
Automatic date update in version.in
Jan Kratochvil [Sat, 7 Jul 2018 21:02:36 +0000 (23:02 +0200)]
contrib/gdb-add-index.sh -dwarf-5
------------------------------------------------------------------------------
(gdb) help save gdb-index
Save a gdb-index file.
Usage: save gdb-index [-dwarf-5] DIRECTORY
No options create one file with .gdb-index extension for pre-DWARF-5
compatible .gdb_index section. With -dwarf-5 creates two files with
extension .debug_names and .debug_str for DWARF-5 .debug_names section.
------------------------------------------------------------------------------
But gdb-add-index command provided no way how to pass the -dwarf-5 option.
gdb/ChangeLog
2018-07-07 Jan Kratochvil <jan.kratochvil@redhat.com>
* contrib/gdb-add-index.sh ($dwarf5): New, use it.
Simon Marchi [Sat, 7 Jul 2018 15:13:14 +0000 (11:13 -0400)]
ia64-tdep.c: Fix -Wwrite-strings errors
Simply add const where necessary to get rid of errors like:
/home/simark/src/binutils-gdb/gdb/ia64-libunwind-tdep.c:114:1: error: ISO C++ forbids converting a string constant to ‘char*’ [-Werror=write-strings]
static char *get_reg_name = STRINGIFY(UNW_OBJ(get_reg));
^~~~~~~~~~~~~~
/home/simark/src/binutils-gdb/gdb/common/preprocessor.h:28:25: note: in definition of macro ‘STRINGIFY_1’
#define STRINGIFY_1(x) #x
^
/home/simark/src/binutils-gdb/gdb/ia64-libunwind-tdep.c:114:29: note: in expansion of macro ‘STRINGIFY’
static char *get_reg_name = STRINGIFY(UNW_OBJ(get_reg));
^~~~~~~~~
gdb/ChangeLog:
* ia64-tdep.c (get_reg_name, get_fpreg_name, get_saveloc_name,
is_signal_frame_name, step_name, init_remote_name,
create_addr_space_name, destroy_addr_space_name,
search_unwind_table_name, find_dyn_list_name): Constify.
GDB Administrator [Sat, 7 Jul 2018 00:00:46 +0000 (00:00 +0000)]
Automatic date update in version.in
Max Filippov [Mon, 2 Jul 2018 18:12:44 +0000 (11:12 -0700)]
xtensa: don't emit dynamic relocation for weak undefined symbol
Resolved reference to a weak undefined symbol in PIE must not have
a dynamic relative relocation against itself, otherwise the value of a
reference will be changed from 0 to the base of executable, breaking
code like the following:
void weak_function (void);
if (weak_function)
weak_function ();
This fixes tests for PR ld/22269 and a number of PIE tests in xtensa gcc
testsuite.
bfd/
2018-07-06 Max Filippov <jcmvbkbc@gmail.com>
* elf32-xtensa.c (elf_xtensa_allocate_dynrelocs): Don't allocate
space for dynamic relocation for undefined weak symbol.
(elf_xtensa_relocate_section): Don't emit R_XTENSA_RELATIVE
relocation for undefined weak symbols.
(shrink_dynamic_reloc_sections): Don't shrink dynamic relocation
section for relocations against undefined weak symbols.
Alan Hayward [Fri, 6 Jul 2018 15:25:21 +0000 (16:25 +0100)]
Add checks for the NT_ARM_SVE section in a core file.
The NT_ARM_SVE section is documented here:
https://github.com/torvalds/linux/blob/master/Documentation/arm64/sve.txt
* A NT_ARM_SVE note will be added to each coredump for each thread of the
dumped process. The contents will be equivalent to the data that would have
been read if a PTRACE_GETREGSET of NT_ARM_SVE were executed for each thread
when the coredump was generated.
* elf.c (elfcore_grok_aarch_sve): New function.
(elfcore_grok_note): Check for Aarch64 SVE.
(elfcore_write_aarch_sve): New function.
(elfcore_write_register_note): Check for Aarch64 SVE.
* elf-bfd.h(elfcore_grok_aarch_sve): New declaration.
Tamar Christina [Fri, 6 Jul 2018 15:18:19 +0000 (16:18 +0100)]
Fix SBO bit in disassembly mask for ldrah on AArch64.
The disassembly mask for ldarh incorrectly didn't mask out bit 20 which
is part of the SBO part of the instruction and shouldn't be considered input.
This fixes the wrong bit fixing the disassembly of instructions to
ldarh and makes the behavior consistent.
opcodes/
PR binutils/23242
* aarch64-tbl.h (ldarh): Fix disassembly mask.
Tamar Christina [Fri, 6 Jul 2018 15:15:41 +0000 (16:15 +0100)]
Fix the read/write flag for these registers on AArch64
The previous constraints were based on information already in opcodes and it
seems that a few of them were wrong. I have now hand verified the ones changed
by the previous patch and corrected where needed.
This prevents a warning to be issued when one shouldn't be.
opcodes/
PR binutils/23369
* aarch64-opc.c (aarch64_sys_regs): Make read/write csselr_el1,
vsesr_el2, osdtrrx_el1, osdtrtx_el1, pmsidr_el1.
gas/testsuite/
PR binutils/23369
* gas/aarch64/msr.d (csselr_el1,
vsesr_el2, osdtrrx_el1, osdtrtx_el1, pmsidr_el1): New.
* gas/aarch64/msr.s: Likewise.
Andrew Burgess [Tue, 10 Apr 2018 19:18:53 +0000 (20:18 +0100)]
gdb/testsuite: Ensure test links in malloc and free
The test associated with the source file
gdb.base/share-env-with-gdbserver.c relies on calling malloc and free
within the inferior from GDB. However, as the test source itself
makes no use of these functions, there's no requirement that they be
linked into the test executable.
This commit adds a dummy call to malloc and free to ensure they are
linked into the test executable.
gdb/testsuite/ChangeLog:
* gdb.base/share-env-with-gdbserver.c (main): Add call to
malloc/free.
Nick Clifton [Fri, 6 Jul 2018 12:52:59 +0000 (13:52 +0100)]
Stop readelf from reporting gaps in the gnu build notes if the gap crosses a section boundary.
* readelf.c (same_section): New function.
(print_gnu_build_attribute_description): Do not complain about
gaps that cross a section boundary.
Nick Clifton [Fri, 6 Jul 2018 10:46:14 +0000 (11:46 +0100)]
Fix the relocs created to adjust notes created by the assembler.
* write.c (maybe_generate_build_notes): Bias reloc offsets by the
number of notes already generated.
Sebastian Huber [Fri, 6 Jul 2018 06:23:40 +0000 (08:23 +0200)]
Update config.sub
* config.sub: Sync with upstream version 2018-07-03.
Alan Modra [Fri, 6 Jul 2018 05:37:08 +0000 (15:07 +0930)]
Fix diagnostic errors
Fixes a number of build errors like the following
.../elf32-arm.c: In function 'elf32_arm_nabi_write_core_note':
.../elf32-arm.c:2177: error: #pragma GCC diagnostic not allowed inside functions
.../elf32-arm.c:2186: error: #pragma GCC diagnostic not allowed inside functions
See the comment in diagnostics.h.
include/
* diagnostics.h: Comment on macro usage.
bfd/
* elf32-arm.c (elf32_arm_nabi_write_core_note): Don't use
DIAGNOTIC_PUSH and DIAGNOSTIC_POP unconditionally.
* elf32-ppc.c (ppc_elf_write_core_note): Likewise.
* elf32-s390.c (elf_s390_write_core_note): Likewise.
* elf64-ppc.c (ppc64_elf_write_core_note): Likewise.
* elf64-s390.c (elf_s390_write_core_note): Likewise.
* elfxx-aarch64.c (_bfd_aarch64_elf_write_core_note): Likewise.
Alan Modra [Thu, 5 Jul 2018 15:38:16 +0000 (01:08 +0930)]
[GOLD] PowerPC .gnu.attributes support
elfcpp/
* powerpc.h (Tag_GNU_Power_ABI_FP): Define.
(Tag_GNU_Power_ABI_Vector, Tag_GNU_Power_ABI_Struct_Return): Define.
gold/
* powerpc.cc: Include attributes.h.
(Powerpc_relobj::attributes_section_data_): New variable, with
accessor and associated constructor and destructor support.
(Powerpc_dynobj::attributes_section_data_): Likewise.
(Powerpc_relobj::do_read_symbols): Stash SHT_GNU_ATTRIBUTES section
contents in attributes_section_data_.
(Powerpc_dynobj::do_read_symbols): Likewise.
(Target_powerpc): Add attributes_section_data_, last_fp_, last_ld_,
last_vec_, and last_struct_ vars.
(Target_powerpc::merge_object_attributes): New function.
(Target_powerpc::do_finalize_sections): Iterate over input objects
merging attributes. Create output attributes section.
Simon Marchi [Fri, 6 Jul 2018 01:50:12 +0000 (21:50 -0400)]
darwin: Silence syscall deprecated declaration warning
This patch silences this warning:
/Users/simark/src/binutils-gdb/gdb/darwin-nat.c:839:10: error: 'syscall' is deprecated: first deprecated in macOS 10.12 - syscall(2) is unsupported; please switch to a supported interface. For SYS_kdebug_trace use kdebug_signpost(). [-Werror,-Wdeprecated-declarations]
res = syscall (SYS___pthread_kill, thread->gdb_port, nsignal);
^
/usr/include/unistd.h:745:6: note: 'syscall' has been explicitly marked deprecated here
int syscall(int, ...);
^
The comment of the new pthread_kill function explains why we use the
syscall function directly.
include/ChangeLog:
* diagnostics.h (DIAGNOSTIC_IGNORE_DEPRECATED_DECLARATIONS):
Define for clang.
gdb/ChangeLog:
* darwin-nat.c (darwin_pthread_kill): New function.
(darwin_resume_thread): Use darwin_pthread_kill.
Jim Wilson [Fri, 6 Jul 2018 00:49:11 +0000 (17:49 -0700)]
RISC-V: Add riscv-*-* configure support, and minor cleanup.
bfd/
* config.bfd (riscv32*-*-*): Renamed from riscv32-*-*.
(riscv64*-*-*): Likewise.
(riscv-*-*): Add as an alias for riscv32*-*-*.
ld/
* configure.tgt (riscv-*-*): Add as an alias for riscv32*-*-*.
GDB Administrator [Fri, 6 Jul 2018 00:00:41 +0000 (00:00 +0000)]
Automatic date update in version.in
Maciej W. Rozycki [Thu, 5 Jul 2018 18:44:02 +0000 (19:44 +0100)]
MIPS/LD/testsuite: Use $linux_gnu consistently across `mips-elf.exp'
Replace two remaining spelled-out calls to `[istarget mips*-*-linux*]'
in `mips-elf.exp' with $linux_gnu, which is equivalent.
ld/
* testsuite/ld-mips-elf/mips-elf.exp: Replace remaining calls to
`[istarget mips*-*-linux*]' with $linux_gnu.
H.J. Lu [Thu, 5 Jul 2018 16:24:07 +0000 (09:24 -0700)]
x86: Remove x86 ISA properties with empty bits
There is no need to generate x86 ISA properties with empty bits in
linker output.
bfd/
PR ld/23372
* elfxx-x86.c (_bfd_x86_elf_merge_gnu_properties): Remove x86
ISA properties with empty bits.
ld/
PR ld/23372
* testsuite/ld-i386/i386.exp: Run pr23372a and pr23372b.
* testsuite/ld-i386/pr23372a.d: New file.
* testsuite/ld-i386/pr23372a.s: Likewise.
* testsuite/ld-i386/pr23372b.d: Likewise.
* testsuite/ld-i386/pr23372b.s: Likewise.
* testsuite/ld-i386/pr23372c.s: Likewise.
* testsuite/ld-x86-64/pr23372a-x32.d: Likewise.
* testsuite/ld-x86-64/pr23372a.d: Likewise.
* testsuite/ld-x86-64/pr23372a.s: Likewise.
* testsuite/ld-x86-64/pr23372b-x32.d: Likewise.
* testsuite/ld-x86-64/pr23372b.d: Likewise.
* testsuite/ld-x86-64/pr23372b.s: Likewise.
* testsuite/ld-x86-64/pr23372c.s: Likewise.
* testsuite/ld-x86-64/x86-64.exp: Run pr23372a, pr23372a-x32,
pr23372b and pr23372b-x32.
Sebastian Huber [Fri, 29 Jun 2018 11:06:40 +0000 (13:06 +0200)]
Update config.guess and config.sub
* config.guess: Sync with upstream version 2018-06-26.
* config.sub: Sync with upstream version 2018-07-02.
Nick Clifton [Thu, 5 Jul 2018 11:16:56 +0000 (12:16 +0100)]
Updated Russian, Bulgarian, and Brazilian Portuguese translations for various components of the binutuls.
ld * po/bg.po: Updated Bulgarian translation.
* po/pt_BR.po: Updated Brazilian Portuguese translation.
binutils* po/bg.po: Updated Bulgarian translation.
bfd,gas * po/ru.po: Updated Russian translation.
Tom de Vries [Sat, 16 Jun 2018 16:39:30 +0000 (18:39 +0200)]
[gdb] Fix build error in macroexp.c
When doing a combined build with the gcc and binutils-gdb repos, I run into
this build error in gdb:
...
gdb/macroexp.c: \
In function ‘void get_next_token_for_substitution(macro_buffer*, \
macro_buffer*, char**, macro_buffer*, char**, int*, bool*)’:
gdb/macroexp.c:925:17: error: \
implicitly-declared ‘constexpr macro_buffer& \
macro_buffer::operator=(const macro_buffer&)’ is deprecated \
[-Werror=deprecated-copy]
*token = *lookahead;
...
Wdeprecated-copy is a new gcc warning added after gcc 8.
This patch fixes the build error by adding an explicit copy operator to the
macro_buffer class. I've added asserts to ensure that both the dest and src
of the copy are shared, in other words, neither is owner of the text pointer.
I've run the gdb testsuite on x86_64-linux and the asserts did not trigger.
2018-07-05 Tom de Vries <tdevries@suse.de>
* macroexp.c (macro_buffer) <operator=>: New member function.
Alan Modra [Wed, 4 Jul 2018 01:11:31 +0000 (10:41 +0930)]
Error for mismatched powerpc ABI tags
And report the two input files that are incompatible rather than
reporting that an input file is incompatible with the output.
bfd/
* elf-bfd.h (_bfd_elf_ppc_merge_fp_attributes): Update prototype.
* elf32-ppc.c (_bfd_elf_ppc_merge_fp_attributes): Return error
on mismatch. Remove "warning: " from messages. Track last bfd
used to set tags.
(ppc_elf_merge_obj_attributes): Likewise. Handle status from
_bfd_elf_ppc_merge_fp_attributes.
* elf64-ppc.c (ppc64_elf_merge_private_bfd_data): Handle status
from _bfd_elf_ppc_merge_fp_attributes.
ld/
* testsuite/ld-powerpc/attr-gnu-4-12.d: Update expected output.
* testsuite/ld-powerpc/attr-gnu-4-13.d: Likewise.
* testsuite/ld-powerpc/attr-gnu-4-21.d: Likewise.
* testsuite/ld-powerpc/attr-gnu-4-23.d: Likewise.
* testsuite/ld-powerpc/attr-gnu-4-31.d: Likewise.
* testsuite/ld-powerpc/attr-gnu-4-32.d: Likewise.
* testsuite/ld-powerpc/attr-gnu-8-23.d: Likewise.
* testsuite/ld-powerpc/attr-gnu-12-21.d: Likewise.
GDB Administrator [Thu, 5 Jul 2018 00:00:45 +0000 (00:00 +0000)]
Automatic date update in version.in
Tom Tromey [Wed, 4 Jul 2018 17:32:50 +0000 (11:32 -0600)]
Use exit_inferior in darwin_attach_pid
Commit
a50c11c666 was intended to use exit_inferior in
darwin_attach_pid, but I accidentally pushed the wrong version of the
patch. This fixes the problem.
gdb/ChangeLog
2018-07-04 Tom Tromey <tom@tromey.com>
* darwin-nat.c (darwin_attach_pid): Use exit_inferior.
Simon Marchi [Wed, 4 Jul 2018 16:40:25 +0000 (12:40 -0400)]
darwin: Don't use sbrk
This patch gets rid of this warning on macOS:
CXX main.o
/Users/simark/src/binutils-gdb/gdb/main.c:492:27: error: 'sbrk' is deprecated [-Werror,-Wdeprecated-declarations]
lim_at_start = (char *) sbrk (0);
^
/usr/include/unistd.h:585:1: note: 'sbrk' has been explicitly marked deprecated here
__deprecated __WATCHOS_PROHIBITED __TVOS_PROHIBITED
^
/usr/include/sys/cdefs.h:176:37: note: expanded from macro '__deprecated'
#define __deprecated __attribute__((deprecated))
^
sbrk on macOS is not useful for our purposes, since sbrk(0) always
returns the same value. From what I read, brk/sbrk on macOS is just an
emulation, it always returns a pointer in a 4MB section reserved for
that.
So instead of letting users use "maint set per-command space on" and
print silly results, I think we should just disable that feature for
this platform (as we do for platforms that don't have sbrk).
I defined a HAVE_USEFUL_SBRK macro and used that instead of HAVE_SBRK.
gdb/ChangeLog:
* common/common-defs.h (HAVE_USEFUL_SBRK): Define.
* main.c: Use HAVE_USEFUL_SBRK instead of HAVE_SBRK.
* maint.c: Likewise.
* top.c: Likewise.
Joel Brobecker [Wed, 4 Jul 2018 15:48:05 +0000 (08:48 -0700)]
Update NEWS post GDB 8.2 branch creation.
gdb/ChangeLog:
* NEWS: Create a new section for the next release branch.
Rename the section of the current branch, now that it has
been cut.
Joel Brobecker [Wed, 4 Jul 2018 15:42:44 +0000 (08:42 -0700)]
Bump version to 8.2.50.DATE-git.
Now that the GDB 8.2 branch has been created, we can
bump the version number.
gdb/ChangeLog:
GDB 8.2 branch created (
1b919490e8ba30bf1d6941df0ed112b0e557017e):
* version.in: Bump version to 8.2.50.DATE-git.
Vyacheslav Barinov [Wed, 4 Jul 2018 15:13:29 +0000 (16:13 +0100)]
Warn if /proc is not accessible
There's a buildroot where I want to debug a binary, and I tried to
connect to it from outside, but got very weird errors like
architecture mismatch or protocol errors. At last, after switching on
'--debug' for gdbserver I found a message 'Can't open /proc/pid/'
message and suddenly found that I forgot to mount procfs in my
buildroot.
Make discovering the problem easier by making GDB / GDBserver warn
(even without --debug) if /proc can not be accessed.
Native debugging:
(gdb) start
Temporary breakpoint 1 at 0x400835: file test.c, line 10.
Starting program: /tmp/test
warning: /proc is not accessible.
GDBserver/remote debugging:
$ ./gdbserver :9999 ./gdbserver
gdbserver: /proc is not accessible.
gdb/ChangeLog:
2018-07-04 Vyacheslav Barinov <v.barinov@samsung.com>
Pedro Alves <palves@redhat.com>
* linux-nat.c (linux_init_ptrace): Rename to ...
(linux_init_ptrace_procfs): ... this. Call
linux_proc_init_warnings.
(linux_nat_target::post_attach)
(linux_nat_target::post_startup_inferior): Adjust.
* nat/linux-procfs.c (linux_proc_init_warnings): Define function.
* nat/linux-procfs.h (linux_proc_init_warnings): Declare function.
gdb/gdbserver/ChangeLog:
2018-07-04 Vyacheslav Barinov <v.barinov@samsung.com>
Pedro Alves <palves@redhat.com>
* linux-low.c (initialize_low): Call linux_proc_init_warnings.
H.J. Lu [Wed, 4 Jul 2018 13:27:58 +0000 (06:27 -0700)]
ld: Set non_ir_ref_regular for --undefined SYMBOL
Set non_ir_ref_regular to TRUE for symbols forced into the output file
so that they won't be removed by garbage collection with LTO.
PR ld/23309
* ldlang.c (insert_undefined): Set non_ir_ref_regular to TRUE.
* plugin.c (is_visible_from_outside): Don't scan entry_symbol.
* testsuite/ld-plugin/pr23309.c: New file.
* testsuite/ld-plugin/pr23309.d: Likewise.
H.J. Lu [Wed, 4 Jul 2018 13:22:40 +0000 (06:22 -0700)]
ld: Properly display default for -z separate-code
Check DEFAULT_LD_Z_SEPARATE_CODE to display default for -z separate-code.
PR ld/23358
* lexsup.c (elf_shlib_list_options): Properly display default
for -z separate-code.
H.J. Lu [Wed, 4 Jul 2018 13:18:22 +0000 (06:18 -0700)]
Also install diagnostics.h
Since bfd.h is an installed header, also install diagnostics.h.
* Makefile.am (bfdinclude_HEADERS): Add $(INCDIR)/diagnostics.h.
* Makefile.in: Regenerated.
Tom de Vries [Tue, 3 Jul 2018 22:07:30 +0000 (00:07 +0200)]
[gdb/symtab] Fix version check in dwarf compilation unit header
The version check of the dwarf compilation unit header in
error_check_comp_unit_head is done too late, and consequently dwarf code with
an unsupported version in the compilation unit header is interpreted as dwarf5
code in read_comp_unit_head.
Fixed by moving the check earlier.
Build and reg-tested on x86_64-linux.
2018-07-04 Tom de Vries <tdevries@suse.de>
* dwarf2read.c (error_check_comp_unit_head): Move dwarf version
check ...
(read_comp_unit_head): ... here.
* gdb.dwarf2/dw2-error.exp: Update expected error message.
Tom Tromey [Tue, 5 Jun 2018 16:22:01 +0000 (10:22 -0600)]
Remove VEC from breakpoint
This removes a use of VEC from breakpoint.h, also removing the
now-unnecessary breakpoint_p typedef.
This patch fixes a latent memory leak in
find_matching_tracepoint_location, which neglected to free the vector
returned by all_tracepoints.
Tested by the buildbot.
gdb/ChangeLog
2018-07-03 Tom Tromey <tom@tromey.com>
* tracepoint.c (process_tracepoint_on_disconnect, start_tracing)
(stop_tracing, tstatus_command)
(find_matching_tracepoint_location, merge_uploaded_tracepoints)
(print_one_static_tracepoint_marker): Update.
* breakpoint.c (static_tracepoints_here, all_tracepoints): Return
std::vector.
* breakpoint.h (breakpoint_p): Remove typedef. Don't declare
VEC.
(all_tracepoints, static_tracepoints_here): Return std::vector.
GDB Administrator [Wed, 4 Jul 2018 00:01:24 +0000 (00:01 +0000)]
Automatic date update in version.in
Tom Tromey [Mon, 11 Jun 2018 20:45:22 +0000 (14:45 -0600)]
Remove ptid_equal
Remove ptid_equal in favor of using "==".
gdb/ChangeLog
2018-07-03 Tom Tromey <tom@tromey.com>
* common/ptid.c (ptid_equal): Remove.
* common/ptid.h (ptid_equal): Don't declare.
* ada-tasks.c: Update.
* breakpoint.c: Update.
* common/agent.c: Update.
* corelow.c: Update.
* darwin-nat-info.c: Update.
* darwin-nat.c: Update.
* dcache.c: Update.
* dtrace-probe.c: Update.
* dummy-frame.c: Update.
* fbsd-nat.c: Update.
* frame.c: Update.
* gdbthread.h: Update.
* gnu-nat.c: Update.
* go32-nat.c: Update.
* inf-loop.c: Update.
* inf-ptrace.c: Update.
* infcall.c: Update.
* infcmd.c: Update.
* inflow.c: Update.
* infrun.c: Update.
* linux-fork.c: Update.
* linux-nat.c: Update.
* linux-thread-db.c: Update.
* mi/mi-cmd-var.c: Update.
* mi/mi-interp.c: Update.
* mi/mi-main.c: Update.
* nto-procfs.c: Update.
* ppc-linux-tdep.c: Update.
* procfs.c: Update.
* python/py-inferior.c: Update.
* python/py-record-btrace.c: Update.
* python/py-record.c: Update.
* ravenscar-thread.c: Update.
* regcache.c: Update.
* remote-sim.c: Update.
* remote.c: Update.
* sol-thread.c: Update.
* solib.c: Update.
* target.c: Update.
* tui/tui-stack.c: Update.
* varobj.c: Update.
* windows-nat.c: Update.
* windows-tdep.c: Update.
gdb/gdbserver/ChangeLog
2018-07-03 Tom Tromey <tom@tromey.com>
* linux-low.c: Update.
* lynx-low.c: Update.
* mem-break.c: Update.
* nto-low.c: Update.
* remote-utils.c: Update.
* server.c: Update.
* spu-low.c: Update.
* target.c: Update.
* win32-low.c: Update.
Tom Tromey [Mon, 11 Jun 2018 20:35:00 +0000 (14:35 -0600)]
Remove ptid_match
This removes ptid_match in favor of the ptid_t::matches method.
gdb/ChangeLog
2018-07-03 Tom Tromey <tom@tromey.com>
* common/ptid.c (ptid_match): Remove.
* common/ptid.h (ptid_match): Don't declare.
* fbsd-nat.c: Update.
* infcmd.c: Update.
* infrun.c: Update.
* linux-nat.c: Update.
* record-btrace.c: Update.
* regcache.c: Update.
* remote.c: Update.
gdb/gdbserver/ChangeLog
2018-07-03 Tom Tromey <tom@tromey.com>
* server.c: Update.
Tom Tromey [Mon, 11 Jun 2018 18:22:04 +0000 (12:22 -0600)]
Remove ptid_tid_p
This removes ptid_tid_p in favor of the ptid_t::tid_p method.
gdb/ChangeLog
2018-07-03 Tom Tromey <tom@tromey.com>
* common/ptid.c (ptid_tid_p): Remove.
* common/ptid.h (ptid_tid_p): Don't declare.
* sol-thread.c: Update.
Tom Tromey [Mon, 11 Jun 2018 18:20:11 +0000 (12:20 -0600)]
Remove ptid_lwp_p
This removes ptid_lwp_p in favor of the ptid_t::lwp_p method.
gdb/ChangeLog
2018-07-03 Tom Tromey <tom@tromey.com>
* common/ptid.c (ptid_lwp_p): Remove.
* common/ptid.h (ptid_lwp_p): Don't declare.
* fbsd-nat.c: Update.
* linux-nat.c: Update.
* nat/linux-procfs.c: Update.
* nat/x86-linux-dregs.c: Update.
* sol-thread.c: Update.
Tom Tromey [Mon, 11 Jun 2018 18:18:15 +0000 (12:18 -0600)]
Remove ptid_is_pid
This removes ptid_is_pid in favor of the ptid_t::is_pid method.
gdb/ChangeLog
2018-07-03 Tom Tromey <tom@tromey.com>
* common/ptid.c (ptid_is_pid): Remove.
* common/ptid.h (ptid_is_pid): Don't declare.
* infrun.c: Update.
* linux-nat.c: Update.
* mi/mi-interp.c: Update.
* remote.c: Update.
* thread.c: Update.
gdb/gdbserver/ChangeLog
2018-07-03 Tom Tromey <tom@tromey.com>
* linux-low.c: Update.
Tom Tromey [Mon, 11 Jun 2018 18:14:34 +0000 (12:14 -0600)]
Remove ptid_get_tid
This removes ptid_get_tid in favor of calling the ptid_t::tid method.
gdb/ChangeLog
2018-07-03 Tom Tromey <tom@tromey.com>
* common/ptid.c (ptid_get_tid): Remove.
* common/ptid.h (ptid_get_tid): Don't declare.
* ada-tasks.c: Update.
* aix-thread.c: Update.
* bsd-uthread.c: Update.
* darwin-nat.c: Update.
* fbsd-nat.c: Update.
* i386-darwin-nat.c: Update.
* infrun.c: Update.
* linux-tdep.c: Update.
* nto-procfs.c: Update.
* ppc-ravenscar-thread.c: Update.
* python/py-infthread.c: Update.
* ravenscar-thread.c: Update.
* sol-thread.c: Update.
* sparc-ravenscar-thread.c: Update.
* windows-nat.c: Update.
gdb/gdbserver/ChangeLog
2018-07-03 Tom Tromey <tom@tromey.com>
* target.c: Update.
Tom Tromey [Mon, 11 Jun 2018 18:10:09 +0000 (12:10 -0600)]
Remove ptid_get_lwp
This removes ptid_get_lwp in favor of calling the ptid_t::lwp method.
gdb/ChangeLog
2018-07-03 Tom Tromey <tom@tromey.com>
* common/ptid.c (ptid_get_lwp): Remove.
* common/ptid.h (ptid_get_lwp): Don't declare.
* aarch64-linux-nat.c: Update.
* ada-tasks.c: Update.
* aix-thread.c: Update.
* amd64-linux-nat.c: Update.
* arm-linux-nat.c: Update.
* corelow.c: Update.
* fbsd-nat.c: Update.
* fbsd-tdep.c: Update.
* gnu-nat.c: Update.
* i386-cygwin-tdep.c: Update.
* i386-gnu-nat.c: Update.
* i386-linux-nat.c: Update.
* ia64-linux-nat.c: Update.
* inf-ptrace.c: Update.
* infrun.c: Update.
* linux-fork.c: Update.
* linux-nat.c: Update.
* linux-tdep.c: Update.
* linux-thread-db.c: Update.
* mips-linux-nat.c: Update.
* nat/aarch64-linux-hw-point.c: Update.
* nat/aarch64-linux.c: Update.
* nat/linux-btrace.c: Update.
* nat/linux-osdata.c: Update.
* nat/linux-procfs.c: Update.
* nat/x86-linux-dregs.c: Update.
* obsd-nat.c: Update.
* ppc-fbsd-nat.c: Update.
* ppc-linux-nat.c: Update.
* procfs.c: Update.
* python/py-infthread.c: Update.
* ravenscar-thread.c: Update.
* remote.c: Update.
* s390-linux-nat.c: Update.
* sol-thread.c: Update.
* sol2-tdep.c: Update.
* spu-linux-nat.c: Update.
* x86-linux-nat.c: Update.
* xtensa-linux-nat.c: Update.
gdb/gdbserver/ChangeLog
2018-07-03 Tom Tromey <tom@tromey.com>
* linux-low.c: Update.
* linux-mips-low.c: Update.
* lynx-low.c: Update.
* nto-low.c: Update.
* remote-utils.c: Update.
* server.c: Update.
* spu-low.c: Update.
* target.c: Update.
* thread-db.c: Update.
Tom Tromey [Mon, 11 Jun 2018 18:05:27 +0000 (12:05 -0600)]
Remove ptid_get_pid
This removes ptid_get_pid in favor of calling the ptid_t::pid method.
gdb/ChangeLog
2018-07-03 Tom Tromey <tom@tromey.com>
* common/ptid.c (ptid_get_pid): Remove.
* common/ptid.h (ptid_get_pid): Don't declare.
* aarch64-linux-nat.c: Update.
* ada-lang.c: Update.
* aix-thread.c: Update.
* alpha-bsd-nat.c: Update.
* amd64-fbsd-nat.c: Update.
* amd64-linux-nat.c: Update.
* arm-linux-nat.c: Update.
* arm-nbsd-nat.c: Update.
* auxv.c: Update.
* break-catch-syscall.c: Update.
* breakpoint.c: Update.
* bsd-uthread.c: Update.
* corelow.c: Update.
* ctf.c: Update.
* darwin-nat.c: Update.
* fbsd-nat.c: Update.
* fbsd-tdep.c: Update.
* gcore.c: Update.
* gnu-nat.c: Update.
* hppa-nbsd-nat.c: Update.
* hppa-obsd-nat.c: Update.
* i386-fbsd-nat.c: Update.
* ia64-linux-nat.c: Update.
* inf-ptrace.c: Update.
* infcmd.c: Update.
* inferior.c: Update.
* inferior.h: Update.
* inflow.c: Update.
* infrun.c: Update.
* linux-fork.c: Update.
* linux-nat.c: Update.
* linux-tdep.c: Update.
* linux-thread-db.c: Update.
* m68k-bsd-nat.c: Update.
* mi/mi-interp.c: Update.
* mi/mi-main.c: Update.
* mips-linux-nat.c: Update.
* mips-nbsd-nat.c: Update.
* mips64-obsd-nat.c: Update.
* nat/aarch64-linux-hw-point.c: Update.
* nat/aarch64-linux.c: Update.
* nat/linux-btrace.c: Update.
* nat/linux-osdata.c: Update.
* nat/linux-procfs.c: Update.
* nat/x86-linux-dregs.c: Update.
* nto-procfs.c: Update.
* obsd-nat.c: Update.
* ppc-linux-nat.c: Update.
* ppc-nbsd-nat.c: Update.
* ppc-obsd-nat.c: Update.
* proc-service.c: Update.
* procfs.c: Update.
* python/py-inferior.c: Update.
* python/py-infthread.c: Update.
* ravenscar-thread.c: Update.
* record.c: Update.
* remote-sim.c: Update.
* remote.c: Update.
* rs6000-nat.c: Update.
* s390-linux-nat.c: Update.
* sh-nbsd-nat.c: Update.
* sol-thread.c: Update.
* sparc-nat.c: Update.
* sparc64-tdep.c: Update.
* spu-linux-nat.c: Update.
* spu-tdep.c: Update.
* target-debug.h: Update.
* target.c: Update.
* thread.c: Update.
* tid-parse.c: Update.
* tracefile-tfile.c: Update.
* vax-bsd-nat.c: Update.
* windows-nat.c: Update.
* x86-linux-nat.c: Update.
* x86-nat.c: Update.
gdb/gdbserver/ChangeLog
2018-07-03 Tom Tromey <tom@tromey.com>
* linux-low.c: Update.
* linux-mips-low.c: Update.
* lynx-low.c: Update.
* mem-break.c: Update.
* nto-low.c: Update.
* remote-utils.c: Update.
* server.c: Update.
* spu-low.c: Update.
* target.c: Update.
* tracepoint.c: Update.
Tom Tromey [Mon, 11 Jun 2018 17:25:49 +0000 (11:25 -0600)]
Remove pid_to_ptid
This removes pid_to_ptid in favor of calling the ptid_t constructor
directly.
gdb/ChangeLog
2018-07-03 Tom Tromey <tom@tromey.com>
* common/ptid.c (pid_to_ptid): Remove.
* common/ptid.h (pid_to_ptid): Don't declare.
* aix-thread.c: Update.
* arm-linux-nat.c: Update.
* common/ptid.c: Update.
* common/ptid.h: Update.
* corelow.c: Update.
* ctf.c: Update.
* darwin-nat.c: Update.
* fbsd-nat.c: Update.
* fork-child.c: Update.
* gnu-nat.c: Update.
* go32-nat.c: Update.
* inf-ptrace.c: Update.
* infcmd.c: Update.
* inferior.c: Update.
* infrun.c: Update.
* linux-fork.c: Update.
* linux-nat.c: Update.
* nat/aarch64-linux-hw-point.c: Update.
* nat/fork-inferior.c: Update.
* nat/x86-linux-dregs.c: Update.
* nto-procfs.c: Update.
* obsd-nat.c: Update.
* procfs.c: Update.
* progspace.c: Update.
* remote.c: Update.
* rs6000-nat.c: Update.
* s390-linux-nat.c: Update.
* sol-thread.c: Update.
* spu-linux-nat.c: Update.
* target.c: Update.
* top.c: Update.
* tracefile-tfile.c: Update.
* windows-nat.c: Update.
gdb/gdbserver/ChangeLog
2018-07-03 Tom Tromey <tom@tromey.com>
* linux-low.c: Update.
* linux-ppc-low.c: Update.
* linux-x86-low.c: Update.
* proc-service.c: Update.
* server.c: Update.
* spu-low.c: Update.
* thread-db.c: Update.
* win32-low.c: Update.
Tom Tromey [Mon, 11 Jun 2018 17:18:51 +0000 (11:18 -0600)]
Remove ptid_build
This removes ptid_build in favor of simply calling the ptid_t
constructor directly.
gdb/ChangeLog
2018-07-03 Tom Tromey <tom@tromey.com>
* common/ptid.h (ptid_build): Don't declare.
* common/ptid.c (ptid_build): Remove.
* aix-thread.c: Update.
* bsd-kvm.c: Update.
* bsd-uthread.c: Update.
* common/agent.c: Update.
* common/ptid.c: Update.
* common/ptid.h: Update.
* corelow.c: Update.
* darwin-nat.c: Update.
* fbsd-nat.c: Update.
* gnu-nat.c: Update.
* linux-fork.c: Update.
* linux-nat.c: Update.
* linux-thread-db.c: Update.
* nat/linux-osdata.c: Update.
* nat/linux-procfs.c: Update.
* nto-procfs.c: Update.
* obsd-nat.c: Update.
* proc-service.c: Update.
* procfs.c: Update.
* ravenscar-thread.c: Update.
* remote-sim.c: Update.
* remote.c: Update.
* sol-thread.c: Update.
* target.c: Update.
* windows-nat.c: Update.
gdb/gdbserver/ChangeLog
2018-07-03 Tom Tromey <tom@tromey.com>
* linux-low.c: Update.
* lynx-low.c: Update.
* nto-low.c: Update.
* remote-utils.c: Update.
* spu-low.c: Update.
* thread-db.c: Update.
* win32-low.c: Update.
Tom Tromey [Mon, 2 Jul 2018 15:20:40 +0000 (09:20 -0600)]
Remove exit_inferior_num_silent
The sole caller of exit_inferior_num_silent was getting the inferior's
number to then use the number to look up the inferior again. I think
it's better to simply not have exit_inferior_num_silent; any potential
callers that only have the inferior's number should probably be
converted to pass the inferior itself around instead.
Tested by the buildbot.
gdb/ChangeLog
2018-07-03 Tom Tromey <tom@tromey.com>
* infrun.c (follow_exec): Use exit_inferior_silent.
* inferior.c (exit_inferior_num_silent): Remove.
* inferior.h (exit_inferior_num_silent): Don't declare.
Tom Tromey [Thu, 28 Jun 2018 17:57:39 +0000 (11:57 -0600)]
Fix crash in "run" on macOS when gdb is not signed
On macOS, when gdb is not code-signed, it will throw an exception from
darwin_attach_pid. However, gdb also then crashes:
thread.c:93: internal-error: struct thread_info *inferior_thread(): Assertion `tp' failed.
I think the problem here is that darwin_attach_pid does not clean up
inferior_ptid and inf->pid on failure. This leads to a situation
where gdb tries to find a thread, but cannot.
In other cases, gdb would mourn the inferior at this point; but here
this is not possible because the target has not been pushed. Instead
this patch works by simply updating the inferior and inferior_ptid on
failure.
Tested by building an unsigned gdb on macOS and trying to run an
inferior.
gdb/ChangeLog
2018-07-03 Tom Tromey <tom@tromey.com>
PR cli/23340:
* darwin-nat.c (darwin_attach_pid): Reset inferior and
inferior_ptid on error.
Alan Modra [Tue, 3 Jul 2018 08:27:36 +0000 (17:57 +0930)]
Correct removal of .gnu.attributes
Setting SEC_EXCLUDE for empty .gnu.attributes is too late in the link
process for the linker to remove the section. That must be done in
bfd_elf_final_link, as we do for removed group sections.
* elflink.c (bfd_elf_final_link): Remove zero size .gnu.attributes
sections.
Alan Modra [Tue, 3 Jul 2018 05:20:38 +0000 (14:50 +0930)]
GNU attribute output on errors
.gnu.attributes entries from linker input files are merged to the
output file, the output having the union of compatible input
attributes. Incompatible attributes generally cause a linker error
and no output. However in some cases only a warning is emitted, and
one of the incompatible input attributes is passed on to the output.
PowerPC tends to emit warnings rather than errors, and the output
takes the first input attribute. For example, if we have two input
files with Tag_GNU_Power_ABI_FP, the first with a value signifying
"double-precision hard float, IBM long double", the second with a
value signifying "double-precision hard float, IEEE long double",
we'll get a warning about incompatible long double types and the
output will say "double-precision hard float, IBM long double".
The output attribute of course isn't correct. It would be correct to
specify "IBM and IEEE long double", but we don't have a way to
represent that currently. While it would be possible to extend the
encoding, there isn't much gain in doing so. A shared library
providing support for both long double types should link against
objects using either long double type without warning or error. That
is what you'd get if such a shared library had no Tag_GNU_Power_ABI_FP
attribute.
So this patch provides a way for the backend to omit .gnu.attributes
tags from the output.
* elf-bfd.h (ATTR_TYPE_FLAG_ERROR, ATTR_TYPE_HAS_ERROR): Define.
* elf-attrs.c (is_default_attr): Handle ATTR_TYPE_HAS_ERROR.
* elf32-ppc.c (_bfd_elf_ppc_merge_fp_attributes): Use
ATTR_TYPE_FLAG_INT_VAL. Set ATTR_TYPE_HAS_ERROR on finding
incompatible attribute.
(ppc_elf_merge_obj_attributes): Likewise. Return
_bfd_elf_merge_object_attributes result.
* elf64-ppc.c (ppc64_elf_merge_private_bfd_data): Return
_bfd_elf_merge_object_attributes result.
Alan Modra [Tue, 3 Jul 2018 02:48:10 +0000 (12:18 +0930)]
Hide dynamic symbols in discarded sections
This is a followup to git commit
97196564c7 "Strip global symbol
defined in discarded section". If a symbol defined in a discarded
section was dynamic, that patch left .dynsym with holes (ie. all zero
entries). For example, the following from libstdc++.so:
Symbol table '.dynsym' contains 6090 entries:
Num: Value Size Type Bind Vis Ndx Name
0:
0000000000000000 0 NOTYPE LOCAL DEFAULT UND
1:
00000000000a74e0 0 SECTION LOCAL DEFAULT 10
2:
0000000000264180 0 SECTION LOCAL DEFAULT 17
3:
0000000000000000 0 NOTYPE WEAK DEFAULT UND _ITM_addUserCommitAction
4:
0000000000000000 0 NOTYPE WEAK DEFAULT UND _ITM_memcpyRtWn
5:
0000000000000000 0 NOTYPE LOCAL DEFAULT UND
readelf: Warning: local symbol 5 found at index >= .dynsym's sh_info value of 3
6:
0000000000000000 0 NOTYPE LOCAL DEFAULT UND
readelf: Warning: local symbol 6 found at index >= .dynsym's sh_info value of 3
[snip]
This patch removes the symbols from .dynsym too.
PR 17550
* elflink.c (_bfd_elf_fix_symbol_flags): Hide dynamic symbols
in discarded sections.
GDB Administrator [Tue, 3 Jul 2018 00:00:55 +0000 (00:00 +0000)]
Automatic date update in version.in
Maciej W. Rozycki [Mon, 2 Jul 2018 22:57:22 +0000 (23:57 +0100)]
MIPS/BFD: Make section GC work with `ict_irix5' targets
Prevent runtime procedure table symbols, produced with `ict_irix5' MIPS
targets, from being swept in section GC, fixing linker errors like:
./ld-new: tmpdir/dump: protected symbol `_procedure_table_size' isn't defined
./ld-new: final link failed: bad value
triggered whenever section GC is enabled with those targets and
consequently removing the following test suite failures:
FAIL: Build pr22649-2a.so
FAIL: Build pr22649-2c.so
FAIL: PR ld/20828 dynamic symbols with section GC (auxiliary shared library)
FAIL: PR ld/20828 dynamic symbols with section GC (plain)
FAIL: PR ld/20828 dynamic symbols with section GC (version script)
FAIL: PR ld/20828 dynamic symbols with section GC (versioned shared library)
FAIL: PR ld/20828 dynamic symbols with section GC (versioned)
FAIL: --gc-sections with .text._init
FAIL: pr20022
observed with `mips-elf', `tx39-elf', `mipsisa32-elf', `mipsisa64-elf',
`mipsel-elf', `mipsisa32el-elf', `mipsisa64el-elf', `mips64vr-elf',
`mips64vrel-elf', `mips64vr4300-elf', `mips64vr4300el-elf',
`mips-sgi-irix5' and `mips-rtems' targets, among others. This fix makes
section GC usable with the affected targets.
bfd/
* elfxx-mips.c (_bfd_mips_elf_create_dynamic_sections): Set
`mark' for symbols created from `mips_elf_dynsym_rtproc_names'
list.
Maciej W. Rozycki [Mon, 2 Jul 2018 22:57:22 +0000 (23:57 +0100)]
microMIPS/GAS: Handle several percent-ops with macros
In the microMIPS mode also accept %half, %got, %call, %got_hi, %got_lo,
%call_hi, %call_lo, %neg, %got_page, %highest, %got_disp, %tlsgd,
%tlsldm, %dtprel_hi, %dtprel_lo, %gottprel, %tprel_hi and %tprel_lo
percent-ops with macros, so that they can be used with instructions that
expand into sequences if relocation is required due to their limited
offset span, such as LL, LWL, etc., fixing GAS assertions:
.../gas/testsuite/gas/mips/elf-rel28.s: Assembler messages:
.../gas/testsuite/gas/mips/elf-rel28.s:17: Internal error in macro_build at .../gas/config/tc-mips.c:8854.
Please report this bug.
observed if an attempt is made to assemble the `elf-rel28.s' test case
modified to use one of the affected instructions to microMIPS code.
gas/
* config/tc-mips.c (macro_build) <'i', 'j'>: Also accept
BFD_RELOC_16, BFD_RELOC_MIPS_GOT16, BFD_RELOC_MIPS_CALL16,
BFD_RELOC_MIPS_GOT_HI16, BFD_RELOC_MIPS_GOT_LO16,
BFD_RELOC_MIPS_CALL_HI16, BFD_RELOC_MIPS_CALL_LO16,
BFD_RELOC_MIPS_SUB, BFD_RELOC_MIPS_GOT_PAGE,
BFD_RELOC_MIPS_HIGHEST, BFD_RELOC_MIPS_GOT_DISP,
BFD_RELOC_MIPS_TLS_GD, BFD_RELOC_MIPS_TLS_LDM,
BFD_RELOC_MIPS_TLS_DTPREL_HI16, BFD_RELOC_MIPS_TLS_DTPREL_LO16,
BFD_RELOC_MIPS_TLS_GOTTPREL, BFD_RELOC_MIPS_TLS_TPREL_HI16 and
BFD_RELOC_MIPS_TLS_TPREL_LO16 relocations if in the microMIPS
mode.
* testsuite/gas/mips/elf-rel28-lldscd-n32.d: New test.
* testsuite/gas/mips/elf-rel28-lldscd-micromips-n32.d: New test.
* testsuite/gas/mips/elf-rel28-lldscd-n64.d: New test.
* testsuite/gas/mips/elf-rel28-lldscd-micromips-n64.d: New test.
* testsuite/gas/mips/elf-rel28.s: Add instruction selection.
* testsuite/gas/mips/mips.exp: Run the new tests.
Maciej W. Rozycki [Mon, 2 Jul 2018 22:57:22 +0000 (23:57 +0100)]
microMIPS/BFD: Add missing NewABI TLS and miscellaneous relocations
Complement commit
df58fc944dbc ("MIPS: microMIPS ASE support"),
<https://sourceware.org/ml/binutils/2011-07/msg00198.html>, and add TLS
and a few miscellaneous relocations to NewABI microMIPS support, fixing
GAS assertion failures:
.../gas/testsuite/gas/mips/elf-rel28.s: Assembler messages:
.../gas/testsuite/gas/mips/elf-rel28.s:19: Internal error in append_insn at .../gas/config/tc-mips.c:7660.
Please report this bug.
observed if an attempt is made to assemble the `elf-rel28.s' test case
to microMIPS code. The relocations are the same as with o32 support,
except for `partial_inplace' and `src_mask' updates for the respective
RELA variants.
bfd/
* elf64-mips.c (micromips_elf64_howto_table_rel): Add
R_MICROMIPS_HI0_LO16, R_MICROMIPS_TLS_GD, R_MICROMIPS_TLS_LDM,
R_MICROMIPS_TLS_DTPREL_HI16, R_MICROMIPS_TLS_DTPREL_LO16,
R_MICROMIPS_TLS_GOTTPREL, R_MICROMIPS_TLS_TPREL_HI16,
R_MICROMIPS_TLS_TPREL_LO16, R_MICROMIPS_GPREL7_S2 and
R_MICROMIPS_PC23_S2 relocation entries.
(micromips_elf64_howto_table_rela): Likewise.
(micromips_reloc_map): Likewise.
* elfn32-mips.c (elf_micromips_howto_table_rel): Likewise.
(elf_micromips_howto_table_rela): Likewise.
(micromips_reloc_map): Likewise.
gas/
* testsuite/gas/mips/elf-rel28-micromips-n32.d: New test.
* testsuite/gas/mips/elf-rel28-micromips-n64.d: New test.
* testsuite/gas/mips/mips.exp: Run the new tests.
Maciej W. Rozycki [Mon, 2 Jul 2018 22:57:21 +0000 (23:57 +0100)]
MIPS/LD/testsuite: Fix a typo in PR ld/21334 test name
ld/
* testsuite/ld-mips-elf/mips-elf.exp: Fix a typo in PR ld/21334
test name.
Maciej W. Rozycki [Mon, 2 Jul 2018 22:57:21 +0000 (23:57 +0100)]
GDB PR tdep/8282: MIPS: Wire in `set disassembler-options'
Implement MIPS target support for passing options to the disassembler,
complementing commit
65b48a81404c ("GDB: Add support for the new
set/show disassembler-options commands.").
This includes options that expect an argument, so adjust the generic
code and data structures used so as to handle such options. So as to
give backends syntax flexibility no specific delimiter has been defined
to separate options from their respective arguments, so it has to be
included as the last character of the option name. Completion code
however has not been adjusted and consequently option arguments cannot
be completed at this time.
Also the MIPS target has non-empty defaults for the options, so that ABI
names for the general-purpose registers respect our `set mips abi ...'
setting rather than always being determined from the ELF headers of the
binary file selected. Handle these defaults as implicit options, never
shown to the user and always prepended to the user-specified options, so
that the latters can override the defaults.
The resulting output for the MIPS target is as follows:
(gdb) show disassembler-options
The current disassembler options are ''
The following disassembler options are supported for use with the
'set disassembler-options <option>[,<option>...]' command:
no-aliases Use canonical instruction forms.
msa Recognize MSA instructions.
virt Recognize the virtualization ASE instructions.
xpa Recognize the eXtended Physical Address (XPA) ASE
instructions.
ginv Recognize the Global INValidate (GINV) ASE instructions.
gpr-names=ABI Print GPR names according to specified ABI.
Default: based on binary being disassembled.
fpr-names=ABI Print FPR names according to specified ABI.
Default: numeric.
cp0-names=ARCH Print CP0 register names according to specified architecture.
Default: based on binary being disassembled.
hwr-names=ARCH Print HWR names according to specified architecture.
Default: based on binary being disassembled.
reg-names=ABI Print GPR and FPR names according to specified ABI.
reg-names=ARCH Print CP0 register and HWR names according to specified
architecture.
For the options above, the following values are supported for "ABI":
numeric 32 n32 64
For the options above, the following values are supported for "ARCH":
numeric r3000 r3900 r4000 r4010 vr4100 vr4111 vr4120 r4300 r4400 r4600
r4650 r5000 vr5400 vr5500 r5900 r6000 rm7000 rm9000 r8000 r10000 r12000
r14000 r16000 mips5 mips32 mips32r2 mips32r3 mips32r5 mips32r6 mips64
mips64r2 mips64r3 mips64r5 mips64r6 interaptiv-mr2 sb1 loongson2e
loongson2f loongson3a octeon octeon+ octeon2 octeon3 xlr xlp
(gdb)
which corresponds to what `objdump --help' used to print for the MIPS
target, with minor formatting changes, most notably option argument
lists being wrapped, but also the amount of white space separating
options from the respective descriptions. The relevant part the new
code is now also used by `objdump --help', which means these formatting
changes apply to both outputs, except for argument list wrapping, which
is GDB-specific.
This also adds a separating new line between the heading and option
lists where descriptions are provided, hence:
(gdb) set architecture s390:31-bit
(gdb) show disassembler-options
The current disassembler options are ''
The following disassembler options are supported for use with the
'set disassembler-options <option>[,<option>...]' command:
esa Disassemble in ESA architecture mode
zarch Disassemble in z/Architecture mode
insnlength Print unknown instructions according to length from first two bits
(gdb)
but:
(gdb) set architecture powerpc:common
(gdb) show disassembler-options
The current disassembler options are ''
The following disassembler options are supported for use with the
'set disassembler-options <option>[,<option>...]' command:
403, 405, 440, 464, 476, 601, 603, 604, 620, 7400, 7410, 7450, 7455, 750cl,
821, 850, 860, a2, altivec, any, booke, booke32, cell, com, e200z4, e300,
e500, e500mc, e500mc64, e5500, e6500, e500x2, efs, efs2, power4, power5,
power6, power7, power8, power9, ppc, ppc32, 32, ppc64, 64, ppc64bridge,
ppcps, pwr, pwr2, pwr4, pwr5, pwr5x, pwr6, pwr7, pwr8, pwr9, pwrx, raw, spe,
spe2, titan, vle, vsx
(gdb)
Existing affected target backends have been adjusted accordingly.
This has been verified manually with:
(gdb) set architecture arm
(gdb) set architecture powerpc:common
(gdb) set architecture s390:31-bit
to cause no issues with the `show disassembler-options' and `set
disassembler-options' commands. A test case for the MIPS target has
also been provided, covering the default settings with ABI overrides as
well as disassembler option overrides.
2018-07-02 Maciej W. Rozycki <macro@mips.com>
Simon Marchi <simon.marchi@polymtl.ca>
include/
PR tdep/8282
* dis-asm.h (disasm_option_arg_t): New typedef.
(disasm_options_and_args_t): Likewise.
(disasm_options_t): Add `arg' member, document members.
(disassembler_options_mips): New prototype.
(disassembler_options_arm, disassembler_options_powerpc)
(disassembler_options_s390): Update prototypes.
opcodes/
PR tdep/8282
* mips-dis.c (mips_option_arg_t): New enumeration.
(mips_options): New variable.
(disassembler_options_mips): New function.
(print_mips_disassembler_options): Reimplement in terms of
`disassembler_options_mips'.
* arm-dis.c (disassembler_options_arm): Adapt to using the
`disasm_options_and_args_t' structure.
* ppc-dis.c (disassembler_options_powerpc): Likewise.
* s390-dis.c (disassembler_options_s390): Likewise.
gdb/
PR tdep/8282
* disasm.h (gdb_disassembler): Add
`m_disassembler_options_holder'. member
* disasm.c (get_all_disassembler_options): New function.
(gdb_disassembler::gdb_disassembler): Use it.
(gdb_buffered_insn_length_init_dis): Likewise.
(gdb_buffered_insn_length): Adjust accordingly.
(set_disassembler_options): Handle options with arguments.
(show_disassembler_options_sfunc): Likewise. Add a leading new
line if showing options with descriptions.
(disassembler_options_completer): Adapt to using the
`disasm_options_and_args_t' structure.
* mips-tdep.c (mips_disassembler_options): New variable.
(mips_disassembler_options_o32): Likewise.
(mips_disassembler_options_n32): Likewise.
(mips_disassembler_options_n64): Likewise.
(gdb_print_insn_mips): Don't set `disassembler_options'.
(gdb_print_insn_mips_n32, gdb_print_insn_mips_n64): Remove
functions.
(mips_gdbarch_init): Always set `gdbarch_print_insn' to
`gdb_print_insn_mips'. Set `gdbarch_disassembler_options',
`gdbarch_disassembler_options_implicit' and
`gdbarch_valid_disassembler_options'.
* arm-tdep.c (_initialize_arm_tdep): Adapt to using the
`disasm_options_and_args_t' structure.
* gdbarch.sh (disassembler_options_implicit): New `gdbarch'
method.
(valid_disassembler_options): Switch from `disasm_options_t' to
the `disasm_options_and_args_t' structure.
* NEWS: Document `set disassembler-options' support for the MIPS
target.
* gdbarch.h: Regenerate.
* gdbarch.c: Regenerate.
gdb/doc/
PR tdep/8282
* gdb.texinfo (Source and Machine Code): Document `set
disassembler-options' support for the MIPS target.
gdb/testsuite/
PR tdep/8282
* gdb.arch/mips-disassembler-options.exp: New test.
* gdb.arch/mips-disassembler-options.s: New test source.
H.J. Lu [Mon, 2 Jul 2018 20:08:09 +0000 (13:08 -0700)]
x86-64: Clear the R_X86_64_converted_reloc_bit bit
We need to clear the R_X86_64_converted_reloc_bit bit after setting it
to avoid leaking it out by --emit-relocs.
bfd/
PR ld/23324
* elf64-x86-64.c (elf_x86_64_relocate_section): Clear the
R_X86_64_converted_reloc_bit bit.
ld/
PR ld/23324
* testsuite/ld-x86-64/pr23324.s: New file.
* testsuite/ld-x86-64/pr23324a.d: Likewise.
* testsuite/ld-x86-64/pr23324b.d: Likewise.
Tom Tromey [Thu, 28 Jun 2018 14:02:42 +0000 (08:02 -0600)]
Allow BFD to recognize macOS universal libraries
Bug #13157 is about a gdb regression, where previously it could handle
universal libraries, but now cannot.
gdb isn't working for me on macOS for other reasons, so I wrote this
small test program to show the problem:
#include <config.h>
#include <stdio.h>
#include <stdlib.h>
#include <bfd.h>
void
die (const char *what)
{
fprintf (stderr, "die: %s\n", what);
exit (1);
}
int
main (int argc, char **argv)
{
bfd *file = bfd_openr (argv[1], NULL);
if (file == NULL)
die ("couldn't open");
if (!bfd_check_format (file, bfd_archive))
die ("not an archive");
printf ("yay\n");
bfd_close (file);
return 0;
}
Then I built a simple universal binary. With git master BFD, I get:
$ ./doit ./universal-exe
die: not an archive
Jeff Muizelaar tracked this down to the BFD change for PR binutils/21787.
This patch changed bfd_generic_archive_p to sometimes reset the BFD's
"format" field.
However, simply changing bfd_generic_archive_p regressed the test case
in that bug.
Debugging PR binutils/21787 again, what I saw is that the mach-o
universal binary support acts like a bfd_archive but does not provide
a _close_and_cleanup function. However, if a BFD appears as an
archive member, it must always remove its own entry from its parent's
map. Otherwise, when the parent is destroyed, the already-destroyed
child BFD will be referenced. mach-o does not use the usual archive
member support, so simply using _bfd_archive_close_and_cleanup (as
other targets do) will not work.
This patch fixes the problem by introducing a new
_bfd_unlink_from_archive_parent function, then arranging for it to be
called in the mach-o case.
Ok?
bfd/ChangeLog
2018-07-02 Jeff Muizelaar <jrmuizel@gmail.com>
Tom Tromey <tom@tromey.com>
PR 13157
PR 21787
* mach-o.c (bfd_mach_o_fat_close_and_cleanup): New function.
(bfd_mach_o_close_and_cleanup): Redefine.
* archive.c (_bfd_unlink_from_archive_parent): New function,
extracted from..
(_bfd_archive_close_and_cleanup): ..here.
(bfd_generic_archive_p): Do not clear archive's format.
* libbfd-in.h (_bfd_unlink_from_archive_parent): Declare.
* libbfd.h: Regenerate.
Sebastian Huber [Fri, 29 Jun 2018 08:50:11 +0000 (10:50 +0200)]
gdb: Prefer RISC-V register name "s0" over "fp"
The "fp" register name is an alias for "s0" which is an alias for "x8".
The "fp" name is only understood by very recent Binutils and thus not
used by GCC. GCC does not emit a frame pointer with common optimization
options such as -Og or -O2.
It is still possible to use the "fp" register name, e.g.
(gdb) p/x $fp
$1 = 0x800367c8
works.
However, in the register dump you see now:
(gdb) info registers
...
t2 0xffffffffffffffff
18446744073709551615
s0 0x800367c8 0x800367c8
s1 0x80033280
2147693184
...
gdb/
* riscv-tdep.c (riscv_register_aliases): Swap "fp" and "s0"
entries.
Thomas Preud'homme [Mon, 2 Jul 2018 10:22:20 +0000 (11:22 +0100)]
[ARM] Update bfd's Tag_CPU_arch knowledge
BFD's bfd_get_mach () function returns a bfd specific value representing
the architecture of the target which is populated from the Tag_CPU_arch
build attribute value of that target. Among other users of that
interfacem, objdump which uses it to print the architecture version of
the binary being examinated and to decide what instruction is available
if run with "-m arm" via its own mapping from bfd_mach_arm_X values to
feature bits available.
However, both BFD and objdump's most recent known architecture is
Armv5TE. When encountering a newer architecture bfd_get_mach will return
bfd_mach_arm_unknown. This is unfortunate since objdump uses that value
to allow all instructions on all architectures which is already what it
does by default, making the "-m arm" trick useless.
This patch updates BFD and objdump's knowledge of Arm architecture
versions up to the latest Armv8-M Baseline and Mainline, Armv8-R and
Armv8.4-A architectures. Since several architecture versions (eg. 8.X-A)
share the same Tag_CPU_arch build attribute value and
bfd_mach_arm values, the mapping from bfd machine value to feature bits
need to return the most featureful feature bits that would yield the
given bfd machine value otherwise some instruction would not disassemble
under "-m arm" mode. The patch rework that mapping to make this clearer
and simplify writing the mapping rules. In particular, for simplicity
all FPU instructions are allowed in all cases.
Finally, the patch also rewrite the cpu_arch_ver table in GAS to use the
TAG_CPU_ARCH_X macros rather than hardcode their value.
2018-07-02 Thomas Preud'homme <thomas.preudhomme@arm.com>
bfd/
* archures.c (bfd_mach_arm_5TEJ, bfd_mach_arm_6, bfd_mach_arm_6KZ,
bfd_mach_arm_6T2, bfd_mach_arm_6K, bfd_mach_arm_7, bfd_mach_arm_6M,
bfd_mach_arm_6SM, bfd_mach_arm_7EM, bfd_mach_arm_8, bfd_mach_arm_8R,
bfd_mach_arm_8M_BASE, bfd_mach_arm_8M_MAIN): Define.
* bfd-in2.h: Regenerate.
* cpu-arm.c (arch_info_struct): Add entries for above new
bfd_mach_arm values.
* elf32-arm.c (bfd_arm_get_mach_from_attributes): Add Tag_CPU_arch to
bfd_mach_arm mapping logic for pre Armv4 and Armv5TEJ and later
architectures. Force assert failure for any new Tag_CPU_arch value.
gas/
* config/tc-arm.c (cpu_arch_ver): Use symbolic TAG_CPU_ARCH macros
rather than hardcode their values.
ld/
* arm-dis.c (select_arm_features): Fix typo in heading comment. Allow
all FPU features and add mapping from new bfd_mach_arm values to
allowed CPU feature bits.
opcodes/
* testsuite/ld-arm/tls-descrelax-be8.d: Add architecture version in
expected result.
* testsuite/ld-arm/tls-descrelax-v7.d: Likewise.
* testsuite/ld-arm/tls-longplt-lib.d: Likewise.
* testsuite/ld-arm/tls-longplt.d: Likewise.
Thomas Preud'homme [Mon, 2 Jul 2018 10:18:24 +0000 (11:18 +0100)]
Fix use of "command line X" in binutils doc
Binutils documentation uses a mix of spelling for the compound word
"command-line X". According to [1]:
"Sometimes compound words are written separately (nail polish),
sometimes with a hyphen (short-sighted) and sometimes as one word
(eyelashes). Often new compounds are written as two separate words and,
as they become more familiar, they are either connected with a hyphen
(-) or made into one word."
I think command-line X is common enough in our industry that the two
workds command and line should be connected. Since command-line is more
common than commandline, I propose to update binutils documentation to
consistently use "command-line" when this is used as an adjective to a
noun (eg. command-line argument, command-line switch, command-line
option and command-line flag). I've left occurences of "the command
line" as is. I've also left gdb, sim and readline alone and have only
touched public documentation (texi and NEWS files).
[1]
http://dictionary.cambridge.org/grammar/british-grammar/word-formation/compounds
2018-07-02 Thomas Preud'homme <thomas.preudhomme@arm.com>
bfd/
* doc/bfdint.texi: Use command-line consistently when used in a
compount word.
* doc/bfdsumm.texi: Likewise.
binutils/
* NEWS: Use command-line consistently when used in a compount word.
* doc/binutils.texi: Likewise and fix trailing whitespace on same
line.
gas/
* NEWS: Use command-line consistently when used in a compount word.
* doc/as.texi: Likewise.
* doc/c-aarch64.texi: Likewise.
* doc/c-alpha.texi: Likewise.
* doc/c-arc.texi: Likewise.
* doc/c-arm.texi: Likewise.
* doc/c-avr.texi: Likewise.
* doc/c-bfin.texi: Likewise.
* doc/c-cris.texi: Likewise.
* doc/c-epiphany.texi: Likewise.
* doc/c-i386.texi: Likewise.
* doc/c-ia64.texi: Likewise.
* doc/c-lm32.texi: Likewise.
* doc/c-m32r.texi: Likewise.
* doc/c-m68k.texi: Likewise.
* doc/c-mips.texi: Likewise.
* doc/c-mmix.texi: Likewise.
* doc/c-msp430.texi: Likewise.
* doc/c-mt.texi: Likewise.
* doc/c-nios2.texi: Likewise.
* doc/c-ppc.texi: Likewise.
* doc/c-pru.texi: Likewise.
* doc/c-rl78.texi: Likewise.
* doc/c-rx.texi: Likewise.
* doc/c-tic6x.texi: Likewise.
* doc/c-v850.texi: Likewise.
* doc/c-vax.texi: Likewise.
* doc/c-visium.texi: Likewise.
* doc/c-xstormy16.texi: Likewise.
* doc/c-xtensa.texi: Likewise.
* doc/c-z80.texi: Likewise.
* doc/c-z8k.texi: Likewise.
* doc/internals.texi: Likewise.
gprof/
* gprof.texi: Use command-line consistently when used in a compount
word.
ld/
* NEWS: Use command-line consistently when used in a compount word.
* ld.texinfo: Likewise.
* ldint.texinfo: Likewise.
GDB Administrator [Mon, 2 Jul 2018 00:00:53 +0000 (00:00 +0000)]
Automatic date update in version.in
GDB Administrator [Sun, 1 Jul 2018 00:01:04 +0000 (00:01 +0000)]
Automatic date update in version.in
Alexandre Oliva [Sat, 30 Jun 2018 02:49:28 +0000 (23:49 -0300)]
Introduce @unless/@endunless and postbootstrap Makefile targets
This patch turns dependencies of non-bootstrap targets on bootstrap
targets for bootstrap builds into dependencies on stage_last. This
arrangement gets stage1-bubble to run from stage_last if we haven't
started a bootstrap yet, and to use the current stage otherwise. This
was already the case of target libs, just not of non-bootstrapped host
modules.
In order to retain preexisting dependencies in non-bootstrap builds,
or in gcc-less builds, this introduces support for @unless/@endunless
pairs in Makefile.in.
There is a remaining possibility of problem if activating, in a tree
configured for bootstrap, a parallel build of two or more modules, at
least one bootstrapped and one not. In this case, make might decide
to build stage_current and stage_last in parallel, the latter will
start a submake to build stage1 while the initial make, having
satisfied stage_current, proceeds to build the bootstrapped module in
non-bootstrapped configurations. The two builds will overlap and will
likely conflict. This situation does NOT arise in normal settings,
however: a post-bootstrap build of all-host all-target will indeed
activate such targets concurrently, but only after building all
bootstrapped modules successfully, and it will have both stage_last
and stage_current targets already satisfied, so the potential race
between builds will not arise.
Another remaining problem, that is slightly expanded with this patch,
is that of an interrupted build in a tree configured for bootstrap,
continued with a non-bootstrapped target. Target modules that were
not bootstrapped would already fail to complete the current stage when
activated explicitly in the command line for a retry; host modules,
however, would attempt to build their bootstrapped dependencies, which
is what led to the problem of concurrent builds addressed with this
patch. An interrupted or failed build might still recover correctly,
if the non-bootstrapped target is activated in both builds, because
then make will remove stage_last when its build command is
interrupted, so that it will attempt to recreate it with stage1-bubble
in the second try. A bootstrap build, however, will not be attempting
to build stage_last, so the file will remain and the retry won't go
through stage1-bubble. We have lived with that for target modules, so
we can probably live with that for host modules too.
Another undesirable consequence of this change is that non-boostrapped
host modules, in a tree configured for bootstrap, when activated as
make all-<module>, will build all of stage1 instead of only the
module's usual dependencies. This is intentional and necessary to fix
the parallel-build problem. If it's not desirable, disabling the
unnecessary bootstrap configuration will suffice to restore the
original set of dependencies.
for ChangeLog
* configure.ac: Introduce support for @unless/@endunless.
* Makefile.tpl (dep-kind): Rewrite with cond; return
postbootstrap in some cases.
(make-postboot-dep, postboot-targets): New.
(dependencies): Do not output postbootstrap dependencies at
first. Output non-target ones changed for configure to depend
on stage_last @if gcc-bootstrap, and the original deps @unless
gcc-bootstrap.
* configure.in, Makefile.in: Rebuilt.
Sergio Durigan Junior [Sat, 30 Jun 2018 01:36:42 +0000 (21:36 -0400)]
Add missing parameter to 'amd64_create_target_description' (and unbreak build)
While building gdbserver on GNU/Linux, the build failed with:
../../../binutils-gdb/gdb/gdbserver/linux-x86-tdesc.c: In function ‘const target_desc* amd64_linux_read_description(uint64_t, bool)’:
../../../binutils-gdb/gdb/gdbserver/linux-x86-tdesc.c:121:67: error: too few arguments to function ‘target_desc* amd64_create_target_description(uint64_t, bool, bool, bool)’
*tdesc = amd64_create_target_description (xcr0, is_x32, true);
^
In file included from ../../../binutils-gdb/gdb/gdbserver/linux-x86-tdesc.c:26:0:
../../../binutils-gdb/gdb/gdbserver/../arch/amd64.h:21:14: note: declared here
target_desc *amd64_create_target_description (uint64_t xcr0, bool is_x32,
^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
According to Joel Brobecker:
> I think the parameter should be set to "true". Otherwise, it will
> not include the fs_base and gs_base register in the list of registers.
> Although the name of the source file says x86, the code itself is
> protected by...
>
> #ifdef __x86_64__
>
> ... and is inside a function called amd64_linux_read_description.
> I also verified that this file gets compiled on amd64-linux platforms.
> See gdb/gdbserver/configure.srv:
>
> x86_64-*-linux*) srv_regobj="$srv_amd64_linux_regobj $srv_i386_linux_regobj"
>
> The last piece of confirmation is that setting the parameter to "true"
> provides the behavior before the parameter was added; and the reason
> for adding the parameter was to remove the {fs,gs}_base registers
> from the list for Windows only.
Therefore I'm pushing the patch to unbreak the build.
gdb/gdbserver/ChangeLog:
2018-06-29 Joel Brobecker <brobecker@adacore.com>
* linux-x86-tdesc.c (amd64_linux_read_description): Add missing
parameter in call to 'amd64_create_target_description'.
GDB Administrator [Sat, 30 Jun 2018 00:00:50 +0000 (00:00 +0000)]
Automatic date update in version.in
Joel Brobecker [Fri, 29 Jun 2018 22:42:27 +0000 (18:42 -0400)]
fix GDB build failure for various amd64 targets
The following patch caused some amd64-*-tdep files to fail to compile:
| commit
de52b9607d2623f18b7a7dbee3e1123d8d63f5da
| Date: Tue Jun 26 16:33:27 2018 +0100
| Subject: x86_64-windows GDB crash due to fs_base/gs_base registers
This is because we added one additional "segments" argument to
function amd64_target_description and forgot to update all the callers.
This patch fixes the omissions.
gdb/ChangeLog:
* amd64-darwin-tdep.c (x86_darwin_init_abi_64): Add missing
parameter in call to amd64_target_description.
* amd64-dicos-tdep.c (amd64_dicos_init_abi): Likewise.
* amd64-fbsd-tdep.c (amd64fbsd_core_read_description)
(amd64fbsd_init_abi): Likewise.
* amd64-nbsd-tdep.c (amd64nbsd_init_abi): Likewise.
* amd64-obsd-tdep.c (amd64obsd_init_abi): Likewise.
* amd64-sol2-tdep.c (amd64_sol2_init_abi): Likewise.
* amd64-fbsd-nat.c (amd64_fbsd_nat_target): Likewise.
The change to amd64-fbsd-nat.c was done "blind" (no access to system),
but is reasonably straightforward. The changes to the -tdep.c files
were verify by rebuilding GDB on x86_64-linux when configured with
--enable-targets=all.
Jim Wilson [Fri, 29 Jun 2018 22:12:23 +0000 (15:12 -0700)]
RISC-V: Add gas support for "fp" register.
gas/
* config/tc-riscv.c (md_begin): Call hash_reg_name for "fp".
Pedro Alves [Tue, 26 Jun 2018 15:33:27 +0000 (16:33 +0100)]
x86_64-windows GDB crash due to fs_base/gs_base registers
GDB is currently crashing anytime we try to access the fs_base/gs_base
registers, either to read them, or to write them. This can be observed
under various scenarios:
- Explicit reference to those registers (eg: print $fs_base) --
probably relatively rare;
- Calling a function in the inferior, with the crash happening
because we are trying to read those registers in order to save
their value ahead of making the function call;
- Just a plain "info registers";
The crash was introduced by the following commit:
| commit
48aeef91c248291dd03583798904612426b1f40a
| Date: Mon Jun 26 18:14:43 2017 -0700
| Subject: Include the fs_base and gs_base registers in amd64 target descriptions.
The Windows-nat implementation was unfortunately not prepared to deal
with those new registers. In particular, the way it fetches registers
is done by using a table where the index is the register number, and
the value at that index is the offset in the area in the thread's CONTEXT
data where the corresponding register value is stored.
For instance, in amd64-windows-nat.c, we can find the mappings static
array containing the following 57 elements in it:
#define context_offset(x) (offsetof (CONTEXT, x))
static const int mappings[] =
{
context_offset (Rax),
[...]
context_offset (FloatSave.MxCsr)
};
That array is then used by windows_fetch_one_register via:
char *context_offset = ((char *) &th->context) + mappings[r];
The problem is that fs_base's register number is 172, which is
well past the end of the mappings array (57 elements in total).
We end up getting an undefined offset, which happens to be so large
that it then causes the address where we try to read the register
value (a little bit later) to be invalid, thus crashing GDB with
a SEGV.
This patch side-steps the issue entirely by removing support for
those registers in GDB on x86_64-windows, because a look at the
CONTEXT structure indicates no support for getting those registers.
A more comprehensive fix would patch the potential buffer overflow
of the mappings array, but this can be done as a separate commit.
gdb/ChangeLog:
* gdb/amd64-tdep.h (amd64_create_target_description): Add
"segments" parameter.
* gdb/amd64-tdep.c (amd64_none_init_abi, amd64_x32_none_init_abi)
(_initialize_amd64_tdep): Update call to
amd64_create_target_description.
(amd64_target_description): Add "segments" parameter. Adjust
the implementation to use it.
* gdb/amd64-linux-tdep.c (amd64_linux_read_description): Update
call to amd64_create_target_description.
* gdb/amd64-windows-tdep.c (amd64_windows_init_abi): Likewise.
* gdb/arch/amd64.h (amd64_create_target_description): Add
"segments" register.
* gdb/arch/amd64.c (amd64_create_target_description): Add
"segments" parameter. Call create_feature_i386_64bit_segments
only if SEGMENTS is true.
* gdb/gdbserver/win32-i386-low.c (i386_arch_setup): Update
call to amd64_create_target_description.
Tested on x86_64-windows using AdaCore's testsuite (by Joel Brobecker
<brobecker at adacore dot com>).
Pedro Alves [Fri, 29 Jun 2018 19:45:35 +0000 (20:45 +0100)]
Improve alignment of "info threads" output, align "Target Id" column
It's long annoyed me that "info threads"'s columns are misaligned.
Particularly the "Target Id" column's content is usually longer than
the specified column width, so the table ends up with the "Frame"
column misaligned. For example, currently we get this:
(gdb) info threads
Id Target Id Frame
1 Thread 0x7ffff7fb5740 (LWP 9056) "threads" 0x00007ffff7bc28ad in __pthread_join (threadid=
140737345763072, thread_return=0x7fffffffd3e8) at pthread_join.c:90
2 Thread 0x7ffff7803700 (LWP 9060) "function0" thread_function0 (arg=0x0) at threads.c:90
* 3 Thread 0x7ffff7002700 (LWP 9061) "threads" thread_function1 (arg=0x1) at threads.c:106
The fact that the "Frame" heading is in a weird spot is particularly
annoying.
This commit turns the above into into this:
(gdb) info threads
Id Target Id Frame
1 Thread 0x7ffff7fb5740 (LWP 7548) "threads" 0x00007ffff7bc28ad in __pthread_join (threadid=
140737345763072, thread_return=0x7fffffffd3e8) at pthread_join.c:90
2 Thread 0x7ffff7803700 (LWP 7555) "function0" thread_function0 (arg=0x0) at threads.c:91
* 3 Thread 0x7ffff7002700 (LWP 7557) "threads" thread_function1 (arg=0x1) at threads.c:104
It does that by computing the max width of the "Target Id" column and
using that as column width when creating the table.
This results in calling target_pid_to_str / target_extra_thread_info /
target_thread_name twice for each thread, but I think that it doesn't
matter in practice performance-wise, because the remote target caches
the info, and with native targets it shouldn't be noticeable. It
could matter if we have many threads (say, thousands), but then "info
threads" is practically useless in such a scenario anyway -- better
thread filtering and aggregation would be necessary.
(Note: I have an old branch somewhere where I attempted at making
gdb's "info threads"-like tables follow a model/view design, so that a
general framework took care of issues like these, but it's incomplete
and a much bigger change. This patch doesn't prevent going in that
direction in the future, of course.)
gdb/ChangeLog:
2018-06-29 Pedro Alves <palves@redhat.com>
* thread.c (thread_target_id_str): New, factored out from ...
(print_thread_info_1): ... here. Use it to compute the max
"Target Id" column width.
gdb/testsuite/ChangeLog:
2018-06-29 Pedro Alves <palves@redhat.com>
* gdb.threads/names.exp: Adjust expected "info threads" output.
Pedro Alves [Fri, 29 Jun 2018 19:45:34 +0000 (20:45 +0100)]
remote & target_extra_thread_info, use cache w/ qThreadExtraInfo and qP too
The following patch will make "info threads" call target_extra_thread_info
more frequently. When I looked at the remote implementation, I noticed
that if we're not using qXfer:threads:read, then we'd be increasing the
remote protocol traffic. This commit prevents that from happening.
Also, it removes a gratuitous local static buffer, which seems good on
its own.
gdb/ChangeLog:
2018-06-29 Pedro Alves <palves@redhat.com>
* remote.c (remote_target::extra_thread_info): Delete
'display_buf' and 'n' locals. from the cache, regardless of
packet mechanims is in use. Use cache for qThreadExtra and qP
methods too.
Pedro Alves [Fri, 29 Jun 2018 18:31:49 +0000 (19:31 +0100)]
"break LINENO/*ADDRESS", inline functions and "info break" output
While experimenting with the previous patch, I noticed this inconsistency
in GDB's output:
(gdb) b 32
Breakpoint 1 at 0x40062f: file inline-break.c, line 32. (1)
(gdb) r
....
Breakpoint 1, func1 (x=1) at inline-break.c:32 (2)
32 return x * 23; /* break here */
(gdb) info breakpoints
Num Type Disp Enb Address What
1 breakpoint keep y 0x40062f in main at inline-break.c:32 (3)
breakpoint already hit 1 time
(gdb)
Notice that when the breakpoint as set, GDB showed "inline-break.c,
line 32" (1), the same line number that was specified in the command.
When we run to the breakpoint, we present the stop at the same line
number, and correctly show "func1" as the function name (2).
But in "info break" output (3), notice that we say "in main", not "in
func1".
The same thing happens if you set a breakpoint by address. I.e.:
(gdb) b *0x40062f
Breakpoint 2 at 0x40062f: file inline-break.c, line 32.
(gdb) info breakpoints
Num Type Disp Enb Address What
2 breakpoint keep y 0x000000000040062f in main at inline-break.c:32
(gdb) r
....
Breakpoint 2, func1 (x=1) at inline-break.c:32
32 return x * 23; /* break here */
The problem is that the breakpoints were set at an inline function,
but when we set such a breakpoint by line number or address, we don't
record the functions symbol in the sal, and as consequence the
breakpoint location does not have an associated symbol either.
Then, in print_breakpoint_location, if the location does not have a
symbol, we call find_pc_sect_function to find one, and this is what
finds "main", because find_pc_sect_function uses
block_linkage_function:
/* Return the symbol for the function which contains a specified
lexical block, described by a struct block BL. The return value
will not be an inlined function; the containing function will be
returned instead. */
struct symbol *
block_linkage_function (const struct block *bl)
To fix this, this commit adds an alternative to find_pc_sect_function
that uses block_containing_function instead:
/* Return the symbol for the function which contains a specified
block, described by a struct block BL. The return value will be
the closest enclosing function, which might be an inline
function. */
struct symbol *
block_containing_function (const struct block *bl)
(It seems odd to me that block_linkage_function says "the CONTAINING
function will be returned", and then block_containing_function says it
returns "the closest enclosing function". Something seems reversed
here. Still, I've kept the same nomenclature and copied the comments,
so that at least there's consistency. Maybe we should fix that up
somehow.)
Then I wondered, why make print_breakpoint_location look up the symbol
every time it is called, instead of just always storing the symbol
when the location is created, since the location already stores the
symbol in some cases. So to find which cases might be missing setting
the symbol in the sal which is used to create the breakpoint location,
I added an assertion to print_breakpoint_location, and ran the
testsuite. That caught a few places, unsurprisingly:
- setting a breakpoint by line number
- setting a breapoint by address
- ifunc resolving
Those are all fixed by this commit. I decided not to add the
assertion to block_linkage_function and leave the existing "if (sym)"
check in place, because it's plausible that we have symtabs with line
info but no symbols. I.e., that would not be a GDB bug, but
a peculiarity of debug info input.
gdb/ChangeLog:
2018-06-29 Pedro Alves <palves@redhat.com>
* blockframe.c (find_pc_sect_containing_function): New function.
* breakpoint.c (print_breakpoint_location): Don't call
find_pc_sect_function.
* linespec.c (create_sals_line_offset): Record the location's
symbol in the sal.
* linespec.c (convert_address_location_to_sals): Fill in sal's
symbol with find_pc_sect_containing_function.
* symtab.c (find_function_start_sal): Rename to ...
(find_function_start_sal_1): ... this.
(find_function_start_sal): Reimplement as wrapper around
find_function_start_sal_1, and use
find_pc_sect_containing_function to fill in the sal's symbol.
(find_function_start_sal(symbol*, bool)): Adjust.
* symtab.h (find_pc_function, find_pc_sect_function): Adjust
comments.
(find_pc_sect_containing_function): Declare.
gdb/testsuite/ChangeLog:
2018-06-29 Pedro Alves <palves@redhat.com>
* gdb.opt/inline-break.exp (line number, address): Add "info
break" tests.
Pedro Alves [Fri, 29 Jun 2018 18:31:49 +0000 (19:31 +0100)]
Fix running to breakpoint set in inline function by lineno/address
Commit
61b04dd04ac2 ("Change inline frame breakpoint skipping logic
(fix gdb.gdb/selftest.exp)") caused a GDB crash when you set a
breakpoint by line number in an inline function, and then run to the
breakpoint:
$ gdb -q test Reading symbols from test...done.
(gdb) b inline-break.c:32
Breakpoint 1 at 0x40062f: file inline-break.c, line 32.
(gdb) run
Starting program: /[...]/test
[1] 75618 segmentation fault /[...]/gdb -q test
The problem occurs because we assume that a bp_location's symbol is
not NULL, which is not true when we set the breakpoint with a linespec
location:
Program received signal SIGSEGV, Segmentation fault.
0x00000000006f42bb in stopped_by_user_bp_inline_frame (
stop_chain=<optimized out>, frame_block=<optimized out>)
at gdb/inline-frame.c:305
305 && frame_block == SYMBOL_BLOCK_VALUE (loc->symbol))
(gdb) p loc->symbol
$1 = (const symbol *) 0x0
The same thing happens if you run to a breakpoint set in an inline
function by address:
(gdb) b *0x40062f
Breakpoint 3 at 0x40062f: file inline-break.c, line 32.
To fix this, add a null pointer check, to avoid the crash, and make it
so that if there's no symbol for the location, then we present the
stop at the inline function. This preserves the previous behavior
when e.g., setting a breakpoint by address, with "b *ADDRESS".
gdb/ChangeLog:
2018-06-29 Pedro Alves <palves@redhat.com>
* inline-frame.c (stopped_by_user_bp_inline_frame): Return
true if the the location has no symbol.
gdb/testsuite/ChangeLog:
2018-06-29 Pedro Alves <palves@redhat.com>
* gdb.opt/inline-break.c (func1): Add "break here" marker.
* gdb.opt/inline-break.exp: Test setting breakpoints by line
number and address and running to them.
Pedro Alves [Fri, 29 Jun 2018 18:32:57 +0000 (19:32 +0100)]
Fix format of last gdb/testsuite/ChangeLog entry
Richard Bunt [Fri, 29 Jun 2018 16:34:58 +0000 (17:34 +0100)]
Remove unstable test output
Changed test output from:
PASS: gdb.base/watchpoint-hw-attach.exp: attach 25501
to
PASS: gdb.base/watchpoint-hw-attach.exp: attach
gdb/testsuite/ChangeLog:
* gdb.base/watchpoint-hw-attach.exp: Remove unstable output.
Maciej W. Rozycki [Fri, 29 Jun 2018 14:45:28 +0000 (15:45 +0100)]
MIPS/BFD: Remove extraneous undefined weak symbol visibility check
Remove an extraneous symbol visibility check made for undefined weak
symbols in determination whether an R_MIPS_REL32 dynamic relocation has
to be placed in output, complementing commit
ad9512030937 ("mips: Check
UNDEFWEAK_NO_DYNAMIC_RELOC"). That check duplicates one already made by
the UNDEFWEAK_NO_DYNAMIC_RELOC macro as a part of a broader condition
used to decide if to enter undefined weak symbols to the dynamic symbol
table or not.
bfd/
* elfxx-mips.c (allocate_dynrelocs): Remove extraneous symbol
visibility check made for undefined weak symbols.
Ramana Radhakrishnan [Fri, 29 Jun 2018 12:06:05 +0000 (13:06 +0100)]
[Patch AArch64] Warn on unpredictable stlxrb , stlxrh and stlxr cases.
A recent case in golang highlighted that gas wasn't warning on these
unpredictable cases in the architecture. Fixed thusly.
I need to audit gcc to make sure we have early clobbers on the
patterns but that's a separate patch.
Tested aarch64-none-elf and gas
Ok ?
Ramana
2018-06-29 Ramana Radhakrishnan <ramana.radhakrishnan@arm.com>
* config/tc-aarch64.c (warn_unpredictable_ldst): Add
unpredictable cases for ldxp, stlxrb, stlxrh, stlxr. *
testsuite/gas/aarch64/diagnostic.s: New tests. *
testsuite/gas/aarch64/diagnostic.l: Adjust.
Tamar Christina [Fri, 29 Jun 2018 11:12:27 +0000 (12:12 +0100)]
Fix AArch64 encodings for by element instructions.
Some instructions in Armv8-a place a limitation on FP16 registers that can be
used as the register from which to select an element from.
e.g. fmla restricts Rm to 4 bits when using an FP16 register. This restriction
does not apply for all instructions, e.g. fcmla does not have this restriction
as it gets an extra bit from the M field.
Unfortunately, this restriction to S_H was added for all _Em operands before,
meaning for a large number of instructions you couldn't use the full register
file.
This fixes the issue by introducing a new operand _Em16 which applies this
restriction only when paired with S_H and leaves the _Em and the other
qualifiers for _Em16 unbounded (i.e. using the full 5 bit range).
Also the patch updates all instructions that should be affected by this.
opcodes/
PR binutils/23192
* aarch64-asm-2.c: Regenerate.
* aarch64-dis-2.c: Likewise.
* aarch64-opc-2.c: Likewise.
* aarch64-dis.c (aarch64_ext_reglane): Add AARCH64_OPND_Em16 constraint.
* aarch64-opc.c (operand_general_constraint_met_p,
aarch64_print_operand): Likewise.
* aarch64-tbl.h (aarch64_opcode_table): Change Em to Em16 for smlal,
smlal2, fmla, fmls, fmul, fmulx, sqrdmlah, sqrdlsh, fmlal, fmlsl,
fmlal2, fmlsl2.
(AARCH64_OPERANDS): Add Em2.
gas/
PR binutils/23192
* config/tc-aarch64.c (process_omitted_operand, parse_operands): Add
AARCH64_OPND_Em16
* testsuite/gas/aarch64/advsimd-armv8_3.s: Expand tests to cover upper
16 registers.
* testsuite/gas/aarch64/advsimd-armv8_3.d: Likewise.
* testsuite/gas/aarch64/advsimd-compnum.s: Likewise.
* testsuite/gas/aarch64/advsimd-compnum.d: Likewise.
* testsuite/gas/aarch64/sve.d: Likewise.
include/
PR binutils/23192
*opcode/aarch64.h (aarch64_opnd): Add AARCH64_OPND_Em16.
GDB Administrator [Fri, 29 Jun 2018 00:00:39 +0000 (00:00 +0000)]
Automatic date update in version.in
Tom Tromey [Thu, 28 Jun 2018 16:32:13 +0000 (10:32 -0600)]
Add --enable-codesign to gdb's configure
macOS requires that the gdb executable be signed in order to be able
to successfully use ptrace. This must be done after each link.
This patch adds a new --enable-codesign configure option so that this
step can be automated.
gdb/ChangeLog
2018-06-28 Tom Tromey <tom@tromey.com>
* NEWS: Mention --enable-codesign.
* silent-rules.mk (ECHO_SIGN): New variable.
* configure.ac: Add --enable-codesign.
* configure: Rebuild.
* Makefile.in (CODESIGN, CODESIGN_CERT): New variables.
(gdb$(EXEEXT)): Optionally invoke codesign.
Pedro Alves [Thu, 28 Jun 2018 19:18:24 +0000 (20:18 +0100)]
gdb: Eliminate the 'stop_pc' global
In my multi-target work, I need to add a few more
scoped_restore_current_thread and switch_to_thread calls in some
places, and in some lower-level places I was fighting against the fact
that switch_to_thread reads/refreshes the stop_pc global.
Instead of piling on workarounds, let's just finally eliminate the
stop_pc global. We already have the per-thread
thread_info->suspend.stop_pc field, so it's mainly a matter of using
that more/instead.
gdb/ChangeLog:
2018-06-28 Pedro Alves <palves@redhat.com>
* gdbthread.h (struct thread_suspend_state) <stop_pc>: Extend
comments.
(switch_to_thread_no_regs): Adjust comment.
* infcmd.c (stop_pc): Delete.
(post_create_inferior, info_program_command): Replace references
to stop_pc with references to thread_info->suspend.stop_pc.
* inferior.h (stop_pc): Delete declaration.
* infrun.c (proceed, handle_syscall_event, fill_in_stop_func)
(handle_inferior_event_1, handle_signal_stop)
(process_event_stop_test, keep_going_stepped_thread)
(handle_step_into_function, handle_step_into_function_backward)
(print_stop_location): Replace references to stop_pc with
references to thread_info->suspend.stop_pc.
(struct infcall_suspend_state) <stop_pc>: Delete field.
(save_infcall_suspend_state, restore_infcall_suspend_state):
Remove references to inf_stat->stop_pc.
* linux-fork.c (fork_load_infrun_state): Likewise.
* record-btrace.c (record_btrace_set_replay): Likewise.
* record-full.c (record_full_goto_entry): Likewise.
* remote.c (print_one_stopped_thread): Likewise.
* target.c (target_resume): Extend comment.
* thread.c (set_executing_thread): New.
(set_executing): Use it.
(switch_to_thread_no_regs, switch_to_no_thread, switch_to_thread):
Remove references to stop_pc.
Pedro Alves [Thu, 28 Jun 2018 15:57:18 +0000 (16:57 +0100)]
Fix follow-exec regression / crash
After commit
00431a78b28f ("Use thread_info and inferior pointers more
throughout"), following an exec can result in gdb crashing. On some
systems, this is visible with gdb.multi/multi-arch-exec.exp and
gdb.base/foll-exec-mode.exp. E.g.:
$ make check TESTS="gdb.multi/multi-arch-exec.exp gdb.base/foll-exec-mode.exp"
[snip]
FAIL: gdb.multi/multi-arch-exec.exp: first_arch=1: selected_thread=1: follow_exec_mode=new: continue across exec that changes architecture (GDB internal error)
ERROR: : spawn id exp10 not open
while executing
Running multi-arch-exec under Valgrind we easily spot the problem:
process 16305 is executing new program: ..../gdb.multi/multi-arch-exec/1-multi-arch-exec-hello
[New inferior 2 (process 0)]
[New process 16305]
==16129== Invalid read of size 8
==16129== at 0x7FA14D: get_thread_regcache(thread_info*) (regcache.c:399)
==16129== by 0x75E54B: handle_inferior_event_1(execution_control_state*) (infrun.c:5292)
==16129== by 0x75E82D: handle_inferior_event(execution_control_state*) (infrun.c:5382)
==16129== by 0x75BC6A: fetch_inferior_event(void*) (infrun.c:3918)
==16129== by 0x748DA3: inferior_event_handler(inferior_event_type, void*) (inf-loop.c:43)
==16129== by 0x464B5D: handle_target_event(int, void*) (linux-nat.c:4359)
==16129== by 0x7047E0: handle_file_event(file_handler*, int) (event-loop.c:733)
==16129== by 0x704D83: gdb_wait_for_event(int) (event-loop.c:859)
==16129== by 0x703BF6: gdb_do_one_event() (event-loop.c:322)
==16129== by 0x703CA2: start_event_loop() (event-loop.c:371)
==16129== by 0x791D95: captured_command_loop() (main.c:330)
==16129== by 0x79311C: captured_main(void*) (main.c:1157)
==16129== Address 0x15a5bad0 is 32 bytes inside a block of size 600 free'd
==16129== at 0x4C2E1E8: operator delete(void*) (vg_replace_malloc.c:576)
==16129== by 0x8A15D0: delete_thread_1(thread_info*, bool) (thread.c:465)
==16129== by 0x8A15FA: delete_thread(thread_info*) (thread.c:476)
==16129== by 0x8A0D43: add_thread_silent(ptid_t) (thread.c:291)
==16129== by 0x8A0DF0: add_thread_with_info(ptid_t, private_thread_info*) (thread.c:317)
==16129== by 0x8A0E79: add_thread(ptid_t) (thread.c:331)
==16129== by 0x75764C: follow_exec(ptid_t, char*) (infrun.c:1233)
==16129== by 0x75E534: handle_inferior_event_1(execution_control_state*) (infrun.c:5290)
==16129== by 0x75E82D: handle_inferior_event(execution_control_state*) (infrun.c:5382)
==16129== by 0x75BC6A: fetch_inferior_event(void*) (infrun.c:3918)
==16129== by 0x748DA3: inferior_event_handler(inferior_event_type, void*) (inf-loop.c:43)
==16129== by 0x464B5D: handle_target_event(int, void*) (linux-nat.c:4359)
The problem is that handle_inferior_event_1 is reading the stop_pc off
of a thread that was deleted by follow_exec. Before commit
00431a78b28f, we didn't crash because we were passing down a ptid to
get_thread_regcache instead of ecs->event_thread.
Fix this by simply moving the stop_pc reading until after
ecs->event_thread is refreshed.
gdb/ChangeLog:
2018-06-28 Pedro Alves <palves@redhat.com>
* infrun.c (handle_inferior_event_1) <TARGET_WAITKIND_EXECD>:
Moving fetching stop_pc until after ecs->event_thread is refreshed.
Tom Tromey [Tue, 5 Jun 2018 15:42:15 +0000 (09:42 -0600)]
Make dwarf2_free_objfile static
I noticed that dwarf2_free_objfile can be made static, by changing it
to be a registry cleanup function. This simplifies the code, as well,
because now symbol readers don't have to explicitly call it.
Tested by the buildbot.
gdb/ChangeLog
2018-06-28 Tom Tromey <tom@tromey.com>
* coffread.c (coff_symfile_finish): Update.
* xcoffread.c (xcoff_symfile_finish): Update.
* elfread.c (elf_symfile_finish): Update.
* symfile.h (dwarf2_free_objfile): Don't declare.
* dwarf2read.c (_initialize_dwarf2_read): Use
register_objfile_data_with_cleanup.
(dwarf2_free_objfile): Now static. Change signature.
Jan Kratochvil [Thu, 28 Jun 2018 14:09:37 +0000 (16:09 +0200)]
Remove 2 excessive executable permission flags
Fedora rpmbuild has been complaining:
*** WARNING: ./usr/src/debug/gdb-8.1.50.
20180618-24.fc28.x86_64/gdb/gdbserver/x86-tdesc.h is executable but has empty or no shebang, removing executable bit
gdb/gdbserver/ChangeLog
2018-06-28 Jan Kratochvil <jan.kratochvil@redhat.com>
* x86-tdesc.h: Remove executable permission flag.
gdb/testsuite/ChangeLog
2018-06-28 Jan Kratochvil <jan.kratochvil@redhat.com>
* lib/compiler.c: Remove executable permission flag.
Richard Bunt [Thu, 28 Jun 2018 07:59:59 +0000 (08:59 +0100)]
Fixed top frame assumption in watchpoint-hw-attach
watchpoint-hw-attach.exp was noticed to fail on some machines.
Thanks to the input from sergiodj and palves on the IRC channel,
it was concluded that the test case incorrectly assumed that on
attach it was landed in the top-most frame of the inferior. This
was fixed by running to a break point in main by explicitly
defining the source file name before continuing with the test.
Tested on the following architectures x86_64, aarch64 and ppc64le.
gdb/testsuite/ChangeLog:
* gdb.base/watchpoint-hw-attach.c (main): Remove unneeded
code.
* gdb.base/watchpoint-hw-attach.exp: Break in outermost frame.
Petr Tesarik [Thu, 28 Jun 2018 06:33:17 +0000 (08:33 +0200)]
Add an optional offset option to the "add-symbol-file" command
If all sections of a symbol file are loaded with a fixed offset, it
is easier to specify that offset than listing all sections
explicitly. There is also a similar option for "symbol-file".
gdb/ChangeLog:
2018-06-28 Petr Tesarik <ptesarik@suse.cz>
* symfile.c (add_symbol_file_command, _initialize_symfile): Add
option "-o" to add-symbol-file-load to add an offset to each
section's load address.
* symfile.c (set_objfile_default_section_offset): New function.
gdb/doc/ChangeLog:
2018-06-28 Petr Tesarik <ptesarik@suse.cz>
* gdb.texinfo (Files): Document "add-symbol-file -o offset".
gdb/testsuite/ChangeLog:
2018-06-28 Petr Tesarik <ptesarik@suse.cz>
* gdb.base/relocate.exp: Add test for "add-symbol-file -o ".
Petr Tesarik [Thu, 28 Jun 2018 06:32:27 +0000 (08:32 +0200)]
Make sure that sorting does not change section order
Symbol files may contain multiple sections with the same name.
Section addresses specified by add-symbol-file are assigned to the
corresponding BFD sections in addr_info_make_relative using sorted
indexes of both vectors. Since the sort algorithm is not inherently
stable, the comparison function uses sectindex to maintain the
original order. However, add_symbol_file_command uses zero for all
sections, so if the user specifies multiple sections with the same
name, they will be assigned randomly to symbol file sections with
the same name.
gdb/ChangeLog:
2018-06-28 Petr Tesarik <ptesarik@suse.cz>
* symfile.c (add_symbol_file_command): Make sure that sections
Petr Tesarik [Thu, 28 Jun 2018 06:30:42 +0000 (08:30 +0200)]
Make add-symbol-file's address argument optional
The (first) .text section must be always specified as the second
non-option argument. The documentation states that GDB cannot
figure out this address by itself. This is true if the object file
was indeed relocated, but it is also confusing, because all other
sections can be omitted and will use the address provided by BFD.
gdb/ChangeLog:
2018-06-28 Petr Tesarik <ptesarik@suse.cz>
* symfile.c (add_symbol_file_command, _initialize_symfile): Do not
require the second argument. If omitted, load sections at the
addresses specified in the file.
gdb/doc/ChangeLog:
2018-06-28 Petr Tesarik <ptesarik@suse.cz>
* gdb.texinfo (Files): The address argument for "add-symbol-file"
is no longer mandatory.
gdb/testsuite/ChangeLog:
2018-06-28 Petr Tesarik <ptesarik@suse.cz>
* gdb.base/relocate.exp: Test add-symbol-file behavior when the
address argument is omitted.
Petr Tesarik [Thu, 28 Jun 2018 06:01:33 +0000 (08:01 +0200)]
Add an optional offset option to the "symbol-file" command
If the main file is relocated at runtime, all symbols are offset by
a fixed amount. Let the user specify this offset when loading a
symbol file.
gdb/ChangeLog:
2018-06-28 Petr Tesarik <ptesarik@suse.cz>
* symfile.c (symbol_file_command, symbol_file_add_main_1)
(_initialize_symfile): Add option "-o" to symbol-file to add an
offset to each section of the symbol file.
gdb/doc/ChangeLog:
2018-06-28 Petr Tesarik <ptesarik@suse.cz>
* gdb.texinfo (Files): Document "symbol-file -o offset".
gdb/testsuite/ChangeLog:
2018-06-28 Petr Tesarik <ptesarik@suse.cz>
* gdb.base/relocate.exp: Add test for "symbol-file -o ".
Petr Tesarik [Thu, 28 Jun 2018 06:01:33 +0000 (08:01 +0200)]
Add myself as a write-after-approval GDB maintainer.
gdb/ChangeLog:
2018-06-28 Petr Tesarik <ptesarik@suse.cz>
* MAINTAINERS (Write After Approval): Add Petr Tesarik.
GDB Administrator [Thu, 28 Jun 2018 00:00:42 +0000 (00:00 +0000)]
Automatic date update in version.in
Tom Tromey [Tue, 5 Jun 2018 15:23:48 +0000 (09:23 -0600)]
Update "func" help text to GNU standards
In my earlier series to change help text to follow the GNU standards
for metasyntactic variables, I missed one: the "func" command. This
patch updates its help text.
Tested by the buildbot.
gdb/ChangeLog
2018-06-27 Tom Tromey <tom@tromey.com>
* stack.c (_initialize_stack): Update "func" help text.
Tom Tromey [Tue, 5 Jun 2018 16:02:45 +0000 (10:02 -0600)]
Remove a VEC from py-unwind.c
This removes a use of VEC from py-unwind.c, replacing it wit
std::vector. It also changes saved_regs to hold a gdbpy_ref<>,
simplifying the memory management.
Tested against gdb.python on x86-64 Fedora 26.
gdb/ChangeLog
2018-06-27 Tom Tromey <tom@tromey.com>
* python/py-unwind.c (unwind_info_object) <saved_regs>: Now a
std::vector.
(unwind_infopy_str, pyuw_create_unwind_info)
(unwind_infopy_add_saved_register, pyuw_sniffer)
(unwind_infopy_dealloc, unwind_infopy_add_saved_register):
Update.
(struct saved_reg): Add constructor.
<value>: Now a gdbpy_ref<>.
Tom Tromey [Wed, 27 Jun 2018 19:06:33 +0000 (13:06 -0600)]
Fix crash in machoread.c
"./gdb ./gdb" was crashing for me on macOS. Investigating showed that
macho_symfile_read was crashing because "symbol_table" was being freed
too soon. This was introduced by my earlier patch to change
macho_symfile_read to use a std::vector.
Tested on macOS 10.13.5 using "./gdb ./gdb". This should un-break
various already existing tests (testsuite/gdb.gdb at least), so no new
test case.
I'm checking this in as obvious.
gdb/ChangeLog
2018-06-27 Tom Tromey <tom@tromey.com>
* machoread.c (macho_symfile_read): Define "symbol_table" earlier.
Simon Marchi [Wed, 27 Jun 2018 19:31:05 +0000 (15:31 -0400)]
Format gdb-gdb.py.in with autopep8
Format using "autopep8 -i".
gdb/ChangeLog:
* gdb-gdb.py.in: Format using autopep8.
Simon Marchi [Wed, 27 Jun 2018 19:21:47 +0000 (15:21 -0400)]
Add pretty-printer for CORE_ADDR
Add a pretty-printer that prints CORE_ADDR values in hex.
gdb/ChangeLog:
* gdb-gdb.py.in (CoreAddrPrettyPrinter): New class.
(type_lookup_function): Recognize CORE_ADDR values.