Markus Metzger [Fri, 20 Jan 2017 08:05:03 +0000 (09:05 +0100)]
thread: add can_access_registers_ptid
Add a function can_access_registers_ptid that behaves like
validate_registers_access but returns a boolean value instead of throwing an
exception.
gdb/
* gdbthread.h (can_access_registers_ptid): New.
* thread.c (can_access_registers_ptid): New.
Jiong Wang [Tue, 31 Jan 2017 12:20:48 +0000 (12:20 +0000)]
[ld, testsuite] Append $board_cflags in one more place in ld-unique/unique.exp
ld/
* testsuite/ld-unique/unique.exp (Could not link a dynamic executable):
Append $board_cflags to link commands.
Senthil Kumar Selvaraj [Wed, 1 Feb 2017 06:08:39 +0000 (11:38 +0530)]
Fix failing print-memory-usage-1 on Windows
ld/
2017-01-31 Senthil Kumar Selvaraj <senthilkumar.selvaraj@microchip.com>
* testsuite/ld-scripts/print-memory-usage-1.l: Relax
check for digit in second decimal place.
Cary Coutant [Wed, 1 Feb 2017 00:32:59 +0000 (16:32 -0800)]
Don't allow mov-to-lea optimization for __ehdr_start.
gold/
PR gold/21090
* x86_64.cc (Target_x86_64::can_convert_mov_to_lea): Add check
for predefined symbol.
(Target_x86_64::Relocate::relocate): Fix formatting.
Maciej W. Rozycki [Tue, 31 Jan 2017 17:59:44 +0000 (17:59 +0000)]
PR ld/20828: LD/testsuite: Correct indentation
ld/
PR ld/20828
* testsuite/ld-elf/shared.exp: Correct PR ld/20828 test
indentation.
Pedro Alves [Wed, 1 Feb 2017 00:07:50 +0000 (00:07 +0000)]
[ob/pushed] Use gdb_insn_length instead of creating dummy stream
gdb/ChangeLog:
2017-02-01 Pedro Alves <palves@redhat.com>
* i386-tdep.c (i386_fast_tracepoint_valid_at): Use gdb_insn_length.
GDB Administrator [Wed, 1 Feb 2017 00:00:22 +0000 (00:00 +0000)]
Automatic date update in version.in
Pedro Alves [Tue, 31 Jan 2017 17:56:36 +0000 (17:56 +0000)]
gdb/mi/mi-interp.c: Fix typos
gdb/ChangeLog:
2017-01-31 Pedro Alves <palves@redhat.com>
* mi/mi-interp.c (mi_breakpoint_created, mi_breakpoint_modified):
Fix typos.
Pedro Alves [Tue, 31 Jan 2017 17:56:36 +0000 (17:56 +0000)]
gdb/stack.c: Remove unused mem_fileopen
gdb/ChangeLog:
2017-01-31 Pedro Alves <palves@redhat.com>
* stack.c (print_frame_args): Remove local mem_fileopen stream,
not used.
Pedro Alves [Tue, 31 Jan 2017 17:56:36 +0000 (17:56 +0000)]
gdb/varobj.c: Fix leak
Whoops, this function returns a std::string.
gdb/ChangeLog:
2017-01-31 Pedro Alves <palves@redhat.com>
* varobj.c (varobj_value_get_print_value): Remove xstrdup call.
Pedro Alves [Tue, 31 Jan 2017 17:56:35 +0000 (17:56 +0000)]
gdb: make_scoped_restore and types convertible to T
A following patch will want to do
string_file str_file;
scoped_restore save_stdout
= make_scoped_restore (&gdb_stdout, &str_file);
where gdb_stdout is a ui_file *, and string_file is a type that
inherits from ui_file, but that doesn't compile today:
src/gdb/top.c: In function ‘std::__cxx11::string execute_command_to_string(char*, int)’:
src/gdb/top.c:710:50: error: no matching function for call to ‘make_scoped_restore(ui_file**, string_file*)’
= make_scoped_restore (&gdb_stdout, &str_file);
^
[...]
In file included from src/gdb/utils.h:25:0,
from src/gdb/defs.h:732,
from src/gdb/top.c:20:
src/gdb/common/scoped_restore.h:94:24: note: candidate: template<class T> scoped_restore_tmpl<T> make_scoped_restore(T*, T)
scoped_restore_tmpl<T> make_scoped_restore (T *var, T value)
^
src/gdb/common/scoped_restore.h:94:24: note: template argument deduction/substitution failed:
src/gdb/top.c:710:50: note: deduced conflicting types for parameter ‘T’ (‘ui_file*’ and ‘string_file*’)
= make_scoped_restore (&gdb_stdout, &str_file);
^
This commit makes code such as the above possible.
gdb/ChangeLog:
2017-01-31 Pedro Alves <palves@redhat.com>
* common/scoped_restore.h
(scoped_restore_tmpl::scoped_restore_tmpl): Template on T2, and
change the value's parameter type to T2.
(make_scoped_restore): Likewise.
Nick Clifton [Tue, 31 Jan 2017 12:07:04 +0000 (12:07 +0000)]
Fix buffer overflows in ld when printing translated strings.
ld * ldmain.c (add_archive_element): Eliminate string buffer.
* ldlang.c (lang_print_asneeded): Likewise.
GDB Administrator [Tue, 31 Jan 2017 00:00:20 +0000 (00:00 +0000)]
Automatic date update in version.in
Maciej W. Rozycki [Mon, 30 Jan 2017 17:11:22 +0000 (17:11 +0000)]
MIPS: Add options to control branch ISA checks
Complement commit
9d862524f6ae ("MIPS: Verify the ISA mode and alignment
of branch and jump targets") and add GAS and LD options to control the
checks for invalid branches between ISA modes introduced there, to help
with some handwritten code lacking `.insn' annotation for labels used as
branch targets and code produced by older versions of GCC which suffers
from the issue with branches to code that has been optimized away,
addressed with GCC commit 242424 ("MIPS/GCC: Mark trailing labels with
`.insn'"), <https://gcc.gnu.org/ml/gcc-patches/2016-11/msg01061.html>.
bfd/
* elfxx-mips.h (_bfd_mips_elf_insn32): Rename prototype to...
(_bfd_mips_elf_linker_flags): ... this. Add another parameter.
* elfxx-mips.c (mips_elf_link_hash_table): Add
`ignore_branch_isa' member.
(mips_elf_perform_relocation): Do not treat an ISA mode mismatch
in branch relocation calculation as an error if
`ignore_branch_isa' has been set.
(_bfd_mips_elf_insn32): Rename to...
(_bfd_mips_elf_linker_flags): ... this. Rename the `on'
parameter to `insn32' and add an `ignore_branch_isa' parameter.
Handle the new parameter.
gas/
* config/tc-mips.c (mips_ignore_branch_isa): New variable.
(options): Add OPTION_IGNORE_BRANCH_ISA and
OPTION_NO_IGNORE_BRANCH_ISA enum values.
(md_longopts): Add "mignore-branch-isa" and
"mno-ignore-branch-isa" options.
(md_parse_option): Handle OPTION_IGNORE_BRANCH_ISA and
OPTION_NO_IGNORE_BRANCH_ISA.
(fix_bad_cross_mode_branch_p): Return FALSE if
`mips_ignore_branch_isa' has been set.
(md_show_usage): Add `-mignore-branch-isa' and
`-mno-ignore-branch-isa'.
* doc/as.texinfo (Target MIPS options): Add
`-mignore-branch-isa' and `-mno-ignore-branch-isa' options.
(-mignore-branch-isa, -mno-ignore-branch-isa): New options.
* doc/c-mips.texi (MIPS Options): Add `-mignore-branch-isa' and
`-mno-ignore-branch-isa' options.
* testsuite/gas/mips/branch-local-ignore-2.d: New test.
* testsuite/gas/mips/branch-local-ignore-3.d: New test.
* testsuite/gas/mips/branch-local-ignore-n32-2.d: New test.
* testsuite/gas/mips/branch-local-ignore-n32-3.d: New test.
* testsuite/gas/mips/branch-local-ignore-n64-2.d: New test.
* testsuite/gas/mips/branch-local-ignore-n64-3.d: New test.
* testsuite/gas/mips/mips.exp: Run the new tests.
ld/
* emultempl/mipself.em (ignore_branch_isa): New variable.
(mips_create_output_section_statements): Rename
`_bfd_mips_elf_insn32' called to `_bfd_mips_elf_linker_flags',
add `ignore_branch_isa' argument.
(PARSE_AND_LIST_PROLOGUE): Add OPTION_IGNORE_BRANCH_ISA and
OPTION_NO_IGNORE_BRANCH_ISA enum values.
(PARSE_AND_LIST_LONGOPTS): Add "ignore-branch-isa" and
"no-ignore-branch-isa" options.
(PARSE_AND_LIST_OPTIONS): Add `--ignore-branch-isa' and
`--no-ignore-branch-isa'.
(PARSE_AND_LIST_ARGS_CASES): Handle OPTION_IGNORE_BRANCH_ISA and
OPTION_NO_IGNORE_BRANCH_ISA.
* ld.texinfo (Options specific to MIPS targets): Add
`--ignore-branch-isa' and `--no-ignore-branch-isa' options.
(ld and the MIPS family): Likewise.
* testsuite/ld-mips-elf/bal-jalx-pic-ignore.d: New test.
* testsuite/ld-mips-elf/bal-jalx-pic-ignore-n32.d: New test.
* testsuite/ld-mips-elf/bal-jalx-pic-ignore-n64.d: New test.
* testsuite/ld-mips-elf/unaligned-branch-ignore-2.d: New test.
* testsuite/ld-mips-elf/unaligned-branch-ignore-r6-1: New test.
* testsuite/ld-mips-elf/unaligned-branch-ignore-mips16: New
test.
* testsuite/ld-mips-elf/unaligned-branch-ignore-micromips: New
test.
* testsuite/ld-mips-elf/mips-elf.exp: Run the new tests.
Maciej W. Rozycki [Mon, 30 Jan 2017 17:10:31 +0000 (17:10 +0000)]
MIPS/GAS/testsuite: Convert branch local list tests to dump tests
gas/
* testsuite/gas/mips/branch-local-2.d: New test.
* testsuite/gas/mips/branch-local-3.d: New test.
* testsuite/gas/mips/branch-local-n32-2.d: New test.
* testsuite/gas/mips/branch-local-n32-3.d: New test.
* testsuite/gas/mips/branch-local-n64-2.d: New test.
* testsuite/gas/mips/branch-local-n64-3.d: New test.
* testsuite/gas/mips/mips.exp: Fold corresponding list tests
into the new tests.
GDB Administrator [Mon, 30 Jan 2017 00:00:21 +0000 (00:00 +0000)]
Automatic date update in version.in
Hans-Peter Nilsson [Sun, 29 Jan 2017 15:15:16 +0000 (16:15 +0100)]
Fix another typo in the last ChangeLog entry.
Gah! Though this time I blame autocompletion.
Hans-Peter Nilsson [Sun, 29 Jan 2017 13:18:13 +0000 (14:18 +0100)]
Fix typo in ChangeLog
Hans-Peter Nilsson [Sun, 29 Jan 2017 13:13:38 +0000 (14:13 +0100)]
PR binutils/19935
Fix long-standing buglet and fallout from now-default initfini-array.
* emulparams/criself.sh (USER_LABEL_PREFIX): Define.
(OTHER_READONLY_SECTIONS, ENTRY): Delete now-redunant defines.
Hans-Peter Nilsson [Sun, 29 Jan 2017 12:53:58 +0000 (13:53 +0100)]
Fix long-standing buglet and fallout from now-default initfini-array.
* emulparams/criself.sh (USER_LABEL_PREFIX): Define.
(OTHER_READONLY_SECTIONS, ENTRY): Delete now-redunant defines.
GDB Administrator [Sun, 29 Jan 2017 00:00:21 +0000 (00:00 +0000)]
Automatic date update in version.in
GDB Administrator [Sat, 28 Jan 2017 00:00:27 +0000 (00:00 +0000)]
Automatic date update in version.in
Jiong Wang [Fri, 27 Jan 2017 23:06:28 +0000 (23:06 +0000)]
[ld, testsuite] XFAIL "pr20995-2", "Build pr20995-2.so" on arm*-*-eabi*
ld/
* testsuite/ld-elf/elf.exp ("pr20995-2", "Build pr20995-2.so"): XFAIL on
arm*-*-eabi*.
Some technical discussions about the reason of this XFAIL are available at
https://sourceware.org/ml/binutils/2017-01/msg00441.html
Walfred Tedeschi [Fri, 27 Jan 2017 14:19:14 +0000 (15:19 +0100)]
amd64-linux: expose system register FS_BASE and GS_BASE for Linux.
This patch allows examination of the registers FS_BASE and GS_BASE
for Linux Systems running on 64bit. Tests for simple read and write
of the new registers is also added with this patch.
2017-01-27 Walfred Tedeschi <walfred.tedeschi@intel.com>
Richard Henderson <rth@redhat.com>
gdb/ChangeLog:
* amd64-linux-nat.c (PTRACE_ARCH_PRCTL): New define.
(amd64_linux_fetch_inferior_registers): Add case to fetch FS_BASE
GS_BASE for older kernels.
(amd64_linux_store_inferior_registers): Add case to store FS_BASE
GS_BASE for older kernels.
* amd64-linux-tdep.c (amd64_linux_gregset_reg_offset): Add FS_BASE
and GS_BASE to the offset table.
(amd64_linux_register_reggroup_p): Add FS_BASE and GS_BASE to the
system register group.
* amd64-nat.c (amd64_native_gregset_reg_offset): Implements case
for older kernels.
* amd64-tdep.c (amd64_init_abi): Add segment registers for the
amd64 ABI.
* amd64-tdep.h (amd64_regnum): Add AMD64_FSBASE_REGNUM and
AMD64_GSBASE_REGNUM.
(AMD64_NUM_REGS): Set to AMD64_GSBASE_REGNUM + 1.
* features/Makefile (amd64-linux.dat, amd64-avx-linux.dat)
(amd64-mpx-linux.dat, amd64-avx512-linux.dat, x32-linux.dat)
(x32-avx-linux.dat, x32-avx512-linux.dat): Add
i386/64bit-segments.xml in those rules.
* features/i386/64bit-segments.xml: New file.
* features/i386/amd64-avx-mpx-linux.xml: Add 64bit-segments.xml.
* features/i386/amd64-avx-linux.xml: Add 64bit-segments.xml.
* features/i386/amd64-avx512-linux.xml: Add 64bit-segments.xml.
* features/i386/amd64-mpx-linux.xml: Add 64bit-segments.xml.
* features/i386/x32-avx512-linux.xml: Add 64bit-segments.xml.
* features/i386/x32-avx-linux.xml: Add 64bit-segments.xml.
* features/i386/amd64-linux.xml: Add 64bit-segments.xml.
* features/i386/amd64-avx-linux.c: Regenerated.
* features/i386/amd64-avx-mpx-linux.c: Regenerated.
* features/i386/amd64-avx-mpx.c: Regenerated.
* features/i386/amd64-avx512-linux.c: Regenerated.
* features/i386/amd64-linux.c: Regenerated.
* features/i386/amd64-mpx-linux.c: Regenerated.
* features/i386/i386-avx-mpx-linux.c: Regenerated.
* features/i386/i386-avx-mpx.c: Regenerated.
* features/i386/x32-avx-linux.c: Regenerated.
* features/i386/x32-avx512-linux.c: Regenerated.
* regformats/i386/amd64-avx-linux.dat: Regenerated.
* regformats/i386/amd64-avx-mpx-linux.dat: Regenerated.
* regformats/i386/amd64-avx512-linux.dat: Regenerated.
* regformats/i386/amd64-linux.dat: Regenerated.
* regformats/i386/amd64-mpx-linux.dat: Regenerated.
* regformats/i386/x32-avx-linux.dat: Regenerated.
* regformats/i386/x32-avx512-linux.dat: Regenerated.
* regformats/i386/x32-linux.dat: Regenerated.
gdb/doc/ChangeLog:
* gdb.texinfo (i386 Features): Add system segment registers
as feature.
gdb/gdbserver/ChangeLog:
* linux-x86-low.c (x86_64_regmap): Add fs_base and gs_base
to the register table.
(x86_fill_gregset): Add support for old kernels for the
fs_base and gs_base system registers.
(x86_store_gregset): Likewise.
* configure.srv (srv_i386_64bit_xmlfiles): Add 64bit-segments.xml.
gdb/testsuite/ChangeLog:
* gdb.arch/amd64-gs_base.c: New file.
* gdb.arch/amd64-gs_base.exp: New file.
Change-Id: I2e0eeb93058a2320d4d3b045082643cfe4aff963
Signed-off-by: Walfred Tedeschi <walfred.tedeschi@intel.com>
Walfred Tedeschi [Fri, 27 Jan 2017 14:19:13 +0000 (15:19 +0100)]
amd64: simplify addition of new general registers.
The purpose of this patch is only simplify the addition of new registers.
ORIG_RAX is kept as last register and any addition is done right before it.
2017-01-27 Walfred Tedeschi <walfred.tedeschi@intel.com>
* amd64-linux-tdep.h (AMD64_LINUX_ORIG_RAX_REGNUM):
Set to AMD64_NUM_REGS.
Walfred Tedeschi [Fri, 27 Jan 2017 14:19:12 +0000 (15:19 +0100)]
amd64: remove additional comparison for validity of a register number.
Second part of the && is already guaranteed in the "regnum < num_regs"
due to comparison above.
2017-01-27 Walfred Tedeschi <walfred.tedeschi@intel.com>
* amd64-nat.c (amd64_native_gregset_reg_offset): Simplify logic
that checks validity of a register number.
Walfred Tedeschi [Fri, 27 Jan 2017 14:19:12 +0000 (15:19 +0100)]
gdbserver-amd64: add HAVE_STRUCT_USER_REGS_STRUCT_(GS|FS)_BASE for gdbserver.
The macros mentioned in the title were set only for GDB. In gdbserver they
were not set until now. To align the code in GDB and gdbserver these macros
are also added into gdbserver, enabling read and write of gs_base and fs_base
registers from the system in new and old kernels.
2017-01-27 Walfred Tedeschi <walfred.tedeschi@intel.com>
gdb/gdbserver/ChangeLog:
* configure.ac: Check if the fs_base and gs_base members of
`struct user_regs_struct' exist.
* config.in: Regenerated.
* configure: Likewise.
Dilyan Palauzov [Fri, 27 Jan 2017 13:20:24 +0000 (13:20 +0000)]
Update description of the -plugin option used by the linker, ar and nm.
PR 20343
ld * ld.texinfo (Options): Extend documentation of the --plugin
option. Include a description of where the plugins should be
located.
binutils* doc/binutils.texi (ar): Extend documentation of the --plugin
option. Include a description of where the plugins should be
located.
(nm): Likewise.
Alexis Deruell [Fri, 27 Jan 2017 12:00:55 +0000 (12:00 +0000)]
Fix disassembling of TIC6X parallel instructions where the previous fetch packet ended with a 32-bit insn.
PR 21056
opcodes * tic6x-dis.c (print_insn_tic6x): Correct displaying of parallel
instructions when the previous fetch packet ends with a 32-bit
instruction.
gas * testsuite/gas/tic6x/insns16-parallel.s: New test case.
* testsuite/gas/tic6x/insns16-parallel.d: New test driver.
Nick Clifton [Fri, 27 Jan 2017 11:27:50 +0000 (11:27 +0000)]
Add Serbian translation for the LD directory.
ld * po/sr.po: New Serbian translation.
* configure.ac (ALL_LINGUAS): Add sr.
* configure: Regenerate.
Kees Cook [Fri, 27 Jan 2017 11:14:47 +0000 (11:14 +0000)]
Fix PTRACE_GETREGSET failure for compat inferiors on arm64
When running a 32-bit ARM inferior with a 32-bit ARM GDB on a 64-bit
AArch64 host, only VFP registers (NT_ARM_VFP) are available. The FPA
registers (NT_PRFPREG) are not available so GDB must not request them, as
this will fail with -EINVAL. This is most noticeably exposed when running
"generate-core-file":
(gdb) generate-core-file myprog.core
Unable to fetch the floating point registers.: Invalid argument.
ptrace(PTRACE_GETREGSET, 27642, NT_FPREGSET, 0xffcc67f0) = -1 EINVAL (Invalid argument)
gdb/ChangeLog:
2017-01-27 Kees Cook <keescook@google.com>
* gdb/arm-linux-nat.c (arm_linux_fetch_inferior_registers): Call
fetch_fpregs if target has fpa registers.
(arm_linux_store_inferior_registers): Call store_fpregs if target
has fpa registers.
Hans-Peter Nilsson [Fri, 27 Jan 2017 08:12:14 +0000 (09:12 +0100)]
Fix unused-but-set warning in elf32-cris.c:elf_cris_finish_dynamic_symbol
* elf32-cris.c (elf_cris_finish_dynamic_symbol): Remove now unused
local variable dynobj.
Hans-Peter Nilsson [Fri, 27 Jan 2017 00:50:06 +0000 (01:50 +0100)]
Fix PR ld/20995 for cris-linux
PR ld/20995
* elf32-cris.c (elf_cris_size_dynamic_sections): Handle sdynrelro.
(elf_cris_adjust_dynamic_symbol): Place variables copied into the
executable from read-only sections into sdynrelro.
(elf_cris_finish_dynamic_symbol): Select sreldynrelro for
dynamic relocs in sdynrelro.
(elf_backend_want_dynrelro): Define.
Luis Machado [Fri, 27 Jan 2017 00:06:40 +0000 (18:06 -0600)]
Add missing gdb/testsuite/ChangeLog entry.
GDB Administrator [Fri, 27 Jan 2017 00:00:20 +0000 (00:00 +0000)]
Automatic date update in version.in
Simon Marchi [Thu, 26 Jan 2017 21:12:12 +0000 (16:12 -0500)]
Change method of loading .py files in Python tests
With my debug build of Python (--with-pydebug), many tests fails because
of the same issue. Python scripts are loaded by the tests using this
pattern:
(gdb) python exec (open ('file.py').read ())
This causes Python to output this warning:
__main__:1: ResourceWarning: unclosed file <_io.TextIOWrapper name='file.py' mode='r' encoding='ANSI_X3.4-1968'>
and the test to fail because of that extra output. Instead of using the
open + read + exec trick which leaks the file and causes the warning,
why not just source the files?
(gdb) source file.py
This patch changes this, and standardizes the test names of the tests I
touched to "load python file" (some of them were empty, others were
overly complicated).
gdb/testsuite/ChangeLog:
* gdb.python/py-bad-printers.exp: Load python file using "source".
* gdb.python/py-events.exp: Likewise.
* gdb.python/py-evsignal.exp: Likewise.
* gdb.python/py-evthreads.exp: Likewise.
* gdb.python/py-frame-args.exp: Likewise.
* gdb.python/py-framefilter-invalidarg.exp: Likewise.
* gdb.python/py-framefilter-mi.exp: Likewise.
* gdb.python/py-framefilter.exp: Likewise.
* gdb.python/py-mi.exp: Likewise.
* gdb.python/py-pp-maint.exp: Likewise.
* gdb.python/py-pp-registration.exp: Likewise.
* gdb.python/py-prettyprint.exp: Likewise.
(run_lang_tests): Likewise.
* gdb.python/py-typeprint.exp: Likewise.
Luis Machado [Thu, 26 Jan 2017 20:05:37 +0000 (14:05 -0600)]
2017-01-26 Luis Machado <lgustavo@codesourcery.com>
* lib/memory.exp: Remove spurious empty newlines.
Luis Machado [Thu, 26 Jan 2017 19:51:09 +0000 (13:51 -0600)]
Harden tests that deal with memory regions
Exercising aarch64-elf with a custom debug stub i noticed a few failures in
both gdb.base/breakpoint-in-ro-region.exp and gdb.base/memattr.exp:
FAIL: gdb.base/breakpoint-in-ro-region.exp: create read-only mem region covering main
FAIL: gdb.base/breakpoint-in-ro-region.exp: writing to read-only memory fails
FAIL: gdb.base/breakpoint-in-ro-region.exp: inserting software breakpoint in read-only memory fails
FAIL: gdb.base/memattr.exp: create mem region 1
FAIL: gdb.base/memattr.exp: create mem region 2
FAIL: gdb.base/memattr.exp: create mem region 3
FAIL: gdb.base/memattr.exp: create mem region 4
FAIL: gdb.base/memattr.exp: create mem region 5
FAIL: gdb.base/memattr.exp: info mem (1)
FAIL: gdb.base/memattr.exp: mem1 cannot be read
FAIL: gdb.base/memattr.exp: mem2 cannot be written
FAIL: gdb.base/memattr.exp: mem2 can be read
FAIL: gdb.base/memattr.exp: disable mem 1
FAIL: gdb.base/memattr.exp: mem 1 was disabled
FAIL: gdb.base/memattr.exp: enable mem 1
FAIL: gdb.base/memattr.exp: mem 1 was enabled
FAIL: gdb.base/memattr.exp: disable mem 2 4
FAIL: gdb.base/memattr.exp: mem 2 and 4 were disabled
FAIL: gdb.base/memattr.exp: enable mem 2-4
FAIL: gdb.base/memattr.exp: mem 2-4 were enabled
FAIL: gdb.base/memattr.exp: mem 1 to 5 were disabled
FAIL: gdb.base/memattr.exp: mem 1 to 5 were enabled
FAIL: gdb.base/memattr.exp: delete mem 1
FAIL: gdb.base/memattr.exp: mem 1 was deleted
FAIL: gdb.base/memattr.exp: delete mem 2 4
FAIL: gdb.base/memattr.exp: mem 2 and 4 were deleted
FAIL: gdb.base/memattr.exp: mem 2-4 were deleted
These failures don't show up with gdbserver or native gdb on Linux because
they don't export any memory maps, therefore the vector of memory regions is
empty.
Outside of that scenario, we can't guarantee the absence of memory regions
reported by the target upon a connection. In our particular target, we
provide a memory map and the memory regions vector ceases to be empty.
With a non-empty memory regions vector, manipulating memory regions will cause
gdb to be more verbose and output text. For example:
memattr.c:require_user_regions
/* Otherwise, let the user know how to get back. */
if (from_tty)
warning (_("Switching to manual control of memory regions; use "
"\"mem auto\" to fetch regions from the target again."));
memattr.c:create_mem_region
if ((lo >= n->lo && (lo < n->hi || n->hi == 0))
|| (hi > n->lo && (hi <= n->hi || n->hi == 0))
|| (lo <= n->lo && ((hi >= n->hi && n->hi != 0) || hi == 0)))
{
printf_unfiltered (_("overlapping memory region\n"));
return;
}
In my particular case i got both of the above messages.
In order to fix this, i've moved the delete_memory proc from
gdb.base/memattr.exp to a new file lib/memory.exp and made lib/gdb.exp
load that file.
For both gdb.base/breakpoint-in-ro-region.exp and gdb.base/memattr.exp the
patch clears all existing memory regions after running to main. That way we
are guaranteed to have a clean state for memory regions so the tests can
exercise whatever they want and have an expected output pattern.
Regression checked on x86-64/Ubuntu 16.04.
gdb/testsuite/ChangeLog:
2017-01-26 Luis Machado <lgustavo@codesourcery.com>
* lib/memory.exp: New file.
* lib/gdb.exp: Load memory.exp.
* gdb.base/memattr.exp (delete_memory): Move proc to
lib/memory.exp and rename to delete_memory_regions.
Replace delete_memory with delete_memory_regions.
Cleanup memory regions before tests.
* gdb.base/breakpoint-in-ro-region.exp: Cleanup memory regions
before tests.
Andreas Arnez [Thu, 26 Jan 2017 18:33:54 +0000 (19:33 +0100)]
Big-endian hosts: Fix "set architecture cris"
The all-architectures-1.exp test case currently yields 66 FAILs on s390x,
because the "set architecture" command fails each time when attempting to
switch to "cris", "crisv32", or "cris:common_v10_v32". Actually, the
command would succeed if the endianness had been set to "little" before.
Instead, the test case sets the endianness to "auto", which results in
"big" on s390x.
So on x86_64:
(gdb) set endian auto
The target endianness is set automatically (currently little endian)
(gdb) set architecture cris
warning: A handler for the OS ABI "AIX" is not built into this configuration
of GDB. Attempting to continue with the default cris settings.
The target architecture is assumed to be cris
But on s390x:
(gdb) set endian auto
The target endianness is set automatically (currently big endian)
(gdb) set architecture cris
Architecture `cris' not recognized.
See also the test results for s390x and ppc64be:
https://sourceware.org/ml/gdb-testers/2016-q4/msg05150.html
https://sourceware.org/ml/gdb-testers/2016-q4/msg05713.html
Indeed, cris_gdbarch_init in cris-tdep.c returns a failure unless the
user-specified endianness is "little". Other architectures usually ignore
the user-specified endianness and return a valid gdbarch anyhow, even if
they can not really cope with the given endianness.
This patch removes the check in cris-tdep.c and forces little-endian byte
order instead.
gdb/ChangeLog:
* cris-tdep.c (cris_gdbarch_init): Remove check for
info.byte_order and force it to BFD_ENDIAN_LITTLE.
Luis Machado [Thu, 26 Jan 2017 17:04:08 +0000 (11:04 -0600)]
Missing ChangeLog and files for commit
8b00c176168dc7b0d78d0dc1f7d42f915375dc4a
This adds the missing testsuite files and Changelog entry.
Luis Machado [Thu, 26 Jan 2017 16:34:42 +0000 (10:34 -0600)]
Refactor gdb.reverse/insn-reverse.c
Changes in v2:
- Renamed arch-specific files to insn-reverse-<arch>.c.
- Adjusted according to reviews.
This patch prepares things for an upcoming testcase for record/replay support
on x86. As is, gdb.reverse/insn-reverse.c is divided into sections guarded by
a few #if blocks, and right now it only handles arm/aarch64.
If we move forward with requiring more tests for record/replay on different
architectures, i think this has the potential to become cluttered with a lot
of differing arch-specific code in the same file.
I've broken up the main file into other files with arch-specific bits
(insn-reverse-<arch>.c). The main file will hold the generic pieces that will
take care of calling the tests.
The arch-specific c files are then included at the top of the generic c file.
I've also added a generic initialize function since we need to run pre-test
checks on x86 to make sure the rdrand/rdseed instructions are supported,
otherwise we will run into a SIGILL.
The arch-specific files will implement their own initialize function with
whatever makes sense. Right now the aarch64 and arm files have an empty
initialization function.
Does this look reasonable?
gdb/testsuite/ChangeLog:
2017-01-26 Luis Machado <lgustavo@codesourcery.com>
* gdb.reverse/insn-reverse.c: Move arm and aarch64 code to their own
files.
(initialize): New function conditionally defined.
(testcases): Move within conditional block.
(main): Call initialize.
* gdb.reverse/insn-reverse-aarch64.c: New file, based on aarch64 bits
of gdb.reverse/insn-reverse.c.
* gdb.reverse/insn-reverse-arm.c: New file, based on arm bits of
gdb.reverse/insn-reverse.c.
Antoine Tremblay [Thu, 26 Jan 2017 15:47:27 +0000 (10:47 -0500)]
Fix crash when loading a core with unexpected register section size
When loading a core without an executable like so:
$ gdb --core core
for example often the gdbarch won't contain the
iterate_over_regset_sections method. For example on ARM.
This will generate a call to get_core_register_section with a NULL regset
like at corelow.c:628
get_core_register_section (regcache, NULL, ".reg", 0, 0, "general-purpose", 1);
However a check for REGSET_VARIABLE_SIZE in get_core_register_section
assumes that regset is != NULL thus leading to a crash with this backtrace:
(gdb) bt
#0 0x000000000065907b in get_core_register_section
(regcache=regcache@entry=0x2c26260, regset=regset@entry=0x0,
name=name@entry=0xdbf7b2 ".reg", min_size=min_size@entry=0,
which=which@entry=0, human_name=human_name@entry=0xdbac28
"general-purpose", required=1)
at ../../gdb/corelow.c:542
#1 0x0000000000659b70 in get_core_registers (ops=<optimized out>,
regcache=0x2c26260, regno=<optimized out>) at ../../gdb/corelow.c:628
#2 0x000000000076e5fb in target_fetch_registers
(regcache=regcache@entry=0x2c26260, regno=regno@entry=15)
at ../../gdb/target.c:3590
Note that commit:
f962539ad23759 ("Warn if core file register
section is larger than expected") introduced this issue.
Thus releases > 7.8.2 are affected.
Also, this would have been caught by gdb.base/corefile.exp but the
problem is that this triggers only if the core dump is missing some data
so that it's not recognized as a linux core dump, or it's not a linux core
dump and the core file register section is larger than expected.
So if you just create a core and read it on linux with ARM the osabi is
detected properly and iterate_over_regset_sections is present and so the
problem is not triggered.
Thus creating a linux test for this with a crafted core that meets the
problem requirements is non-trivial.
This patch fixes this crash by adding a check for regset existence before
running the condition.
gdb/ChangeLog:
* corelow.c (get_core_register_section): Check for regset
existence before checking for REGSET_VARIABLE_SIZE.
Yao Qi [Thu, 26 Jan 2017 14:29:20 +0000 (14:29 +0000)]
Don't throw exception in dis_asm_memory_error
Hi,
GDB calls some APIs from opcodes to do disassembly and provide some
call backs. This model makes troubles on C++ exception unwinding,
because GDB is a C++ program, and opcodes is still compiled as C.
As we can see, frame #10 and #12 are C++, while #frame 11 is C,
#10 0x0000000000544228 in memory_error (err=TARGET_XFER_E_IO, memaddr=<optimized out>) at ../../binutils-gdb/gdb/corefile.c:237
#11 0x00000000006b0a54 in print_insn_aarch64 (pc=0, info=0xffffffffeeb0) at ../../binutils-gdb/opcodes/aarch64-dis.c:3185
#12 0x0000000000553590 in gdb_pretty_print_insn (gdbarch=gdbarch@entry=0xbbceb0, uiout=uiout@entry=0xbc73d0, di=di@entry=0xffffffffeeb0,
insn=0xffffffffed40, insn@entry=0xffffffffed90, flags=flags@entry=0,
C++ exception unwinder can't go across frame #11 unless it has
unwind table. However, C program on many architectures doesn't
have it in default. As a result, GDB aborts, which is described
in PR 20939.
This is not the first time we see this kind of problem. We've
had a commit
89525768cd086a0798a504c81fdf7ebcd4c904e1
"Propagate GDB/C++ exceptions across readline using sj/lj-based TRY/CATCH".
We can fix the disassembly bug in a similar way, this is the option one.
Since opcodes is built with gdb, we fix this problem in a different
way as we did for the same issue with readline. Instead of throwing
exception in dis_asm_memory_error, we record the failed memory
address, and throw exception when GDB returns from opcodes disassemblers.
gdb:
2017-01-26 Yao Qi <yao.qi@linaro.org>
Pedro Alves <palves@redhat.com>
PR gdb/20939
* disasm.c (gdb_disassembler::dis_asm_memory_error): Don't
call memory_error, save memaddr instead.
(gdb_disassembler::print_insn): If gdbarch_print_insn returns
negative, cal memory_error.
* disasm.h (gdb_disassembler) <m_err_memaddr>: New field.
gdb/testsuite:
2017-01-26 Yao Qi <yao.qi@linaro.org>
* gdb.base/all-architectures.exp.in (do_arch_tests): Test
disassemble on address 0.
Yao Qi [Thu, 26 Jan 2017 14:29:19 +0000 (14:29 +0000)]
Disassembly unit test: memory error
This patch adds a unit test about memory error occurs on reading
memory, and check MEMORY_ERROR exception is always thrown.
gdb:
2017-01-26 Yao Qi <yao.qi@linaro.org>
* disasm-selftests.c (memory_error_test): New function.
(_initialize_disasm_selftests): Register memory_error_test.
Yao Qi [Thu, 26 Jan 2017 14:29:19 +0000 (14:29 +0000)]
Disassembly unit test: disassemble one instruction
This patch adds one unit test, which disassemble one instruction for
every gdbarch if available. The test needs one valid instruction of
each gdbarch, and most of them are got from breakpoint instruction.
For the rest gdbarch whose breakpoint instruction isn't a valid
instruction, I copy one instruction from the gas/testsuite/gas/
directory.
I get the valid instruction of most gdbarch except ia64, mep, mips,
tic6x, and xtensa. People familiar with these arch should be easy
to extend the test.
In order to achieve "do the unit test for every gdbarch", I add
selftest-arch.[c,h], so that we can register a function pointer,
which has one argument gdbarch. selftest.c will iterate over all
gdbarches to call the registered function pointer.
gdb:
2017-01-26 Yao Qi <yao.qi@linaro.org>
* Makefile.in (SFILES): Add disasm-selftests.c and
selftest-arch.c.
(COMMON_OBS): Add disasm-selftests.o and selftest-arch.o.
* disasm-selftests.c: New file.
* selftest-arch.c: New file.
* selftest-arch.h: New file.
Yao Qi [Thu, 26 Jan 2017 14:29:19 +0000 (14:29 +0000)]
Call print_insn_mep in mep_gdb_print_insn
opcodes/mep-dis.c:mep_print_insn has already had the code to
handle the case when info->section is NULL,
/* Picking the right ISA bitmask for the current context is tricky. */
if (info->section)
{
}
else /* sid or gdb */
{
}
so that we can still cal print_insn_mep even section can't be found.
On the other hand, user can disassemble an arbitrary address which
doesn't map to any section at all.
gdb:
2017-01-26 Yao Qi <yao.qi@linaro.org>
* mep-tdep.c (mep_gdb_print_insn): Set info->arch
to bfd_arch_mep. Don't return 0 if section is not
found. Call print_insn_mep.
Yao Qi [Thu, 26 Jan 2017 14:29:19 +0000 (14:29 +0000)]
Refactor disassembly code
This patch addes class gdb_disassembler, and refactor
code to use it. The gdb_disassembler object is saved
in disassember_info.application_data. However,
disassember_info.application_data is already used by
gdb for arm, mips spu, and scm-disasm. In arm and mips,
.application_data is gdbarch, but we can still get gdbarch
from gdb_disassember.
The use of application_data in spu is a little bit
complicated. It creates its own disassemble_info, and
save spu_dis_asm_data in .application_data. This will
overwrite the pointer to gdb_disassembler, so we need
to find another place to save spu_dis_asm_data. I
extend disassemble_info, and put "id" there.
gdb:
2017-01-26 Pedro Alves <palves@redhat.com>
Yao Qi <yao.qi@linaro.org>
* arm-tdep.c: Include "disasm.h".
(gdb_print_insn_arm): Update code to get gdbarch.
* disasm.c (dis_asm_read_memory): Change it to
gdb_disassembler::dis_asm_read_memory.
(dis_asm_memory_error): Likewise.
(dis_asm_print_address): Likewise.
(gdb_pretty_print_insn): Change it to
gdb_disassembler::pretty_print_insn.
(dump_insns): Add one argument gdb_disassemlber. All
callers updated.
(do_mixed_source_and_assembly_deprecated): Likewise.
(do_mixed_source_and_assembly): Likewise.
(do_assembly_only): Likewise.
(gdb_disassembler::gdb_disassembler): New.
(gdb_disassembler::print_insn): New.
* disasm.h (class gdb_disassembler): New.
(gdb_pretty_print_insn): Remove declaration.
(gdb_disassemble_info): Likewise.
* guile/scm-disasm.c (class gdbscm_disassembler): New.
(gdbscm_disasm_read_memory_worker): Update.
(gdbscm_disasm_read_memory): Update.
(gdbscm_disasm_memory_error): Remove.
(gdbscm_disasm_print_address): Remove.
(gdbscm_disassembler::gdbscm_disassembler): New.
(gdbscm_print_insn_from_port): Update.
* mips-tdep.c: Include disasm.h.
(gdb_print_insn_mips): Update code to get gdbarch.
* record-btrace.c (btrace_insn_history): Update.
* spu-tdep.c: Include disasm.h.
(struct spu_dis_asm_data): Remove.
(struct spu_dis_asm_info): New.
(spu_dis_asm_print_address): Use spu_dis_asm_info to get
SPU id.
(gdb_print_insn_spu): Cast disassemble_info to
spu_dis_asm_info.
Yao Qi [Thu, 26 Jan 2017 14:29:19 +0000 (14:29 +0000)]
New function null_stream
This patch adds a new function null_stream, which returns a null
stream. The null stream can be used in multiple places. It is
used in gdb_insn_length, and the following patches will use it too.
gdb:
2017-01-26 Yao Qi <yao.qi@linaro.org>
* disasm.c (do_ui_file_delete): Delete.
(gdb_insn_length): Move code creating stream to ...
* utils.c (null_stream): ... here. New function.
* utils.h (null_stream): Declare.
GDB Administrator [Thu, 26 Jan 2017 00:00:31 +0000 (00:00 +0000)]
Automatic date update in version.in
Yao Qi [Wed, 25 Jan 2017 16:24:44 +0000 (16:24 +0000)]
Use dwarf assembler in gdb.dwarf2/implptr-64bit.exp
This patch adds a DW_OP_implicit_value in dwarf assembler, and uses
dwarf assembler in implptr-64bit.exp. Using dwarf assembler in
implptr-64bit.exp exposes some limitations in dwarf assembler,
- some variables are not evaluated in the caller's context, so we
can not pass variable to assembler, like this
Dwarf::assemble $asm_file {
cu {
version $dwarf_version
addr_size $addr_size
is_64 $is_64
} {
}
and
{DW_AT_type :$struct_label "DW_FORM_ref$ref_addr_size"}
this limitation is fixed by adding "uplevel" and "subst".
- dwarf assembler doesn't emit DW_FORM_ref_addr for label referencing.
this limitation is fixed by adding a new character "%",
{ type %$int_label }
this means we want to emit DW_FORM_ref_addr for label referencing.
- we can't set the form of label referencing offset in dwarf assembler.
Nowadays, dwarf assembler guesses the form of labels, which is
DW_FORM_ref4. However, in implptr-64bit.exp, both DW_FORM_ref4
and DW_FORM_ref8 is used (see REF_ADDR in implptr-64bit.S). This
patch adds the flexibility of setting the form of label reference.
Both of them below are valid,
{DW_AT_type :$struct_label}
{DW_AT_type :$struct_label DW_FORM_ref8}
the former form is the default DW_FORM_ref4.
I compared the .debug_info of objects without and with this patch
applied. There is no changes except abbrev numbers.
gdb/testsuite:
2017-01-25 Andreas Arnez <arnez@linux.vnet.ibm.com>
Yao Qi <yao.qi@linaro.org>
* gdb.dwarf2/implptr-64bit.exp: Use dwarf assembler.
* gdb.dwarf2/implptr-64bit.S: Remove.
* lib/dwarf.exp (Dwarf): Handle character "%". Evaluate some
variables in caller's context. Add DW_OP_implicit_value.
Yao Qi [Wed, 25 Jan 2017 16:24:44 +0000 (16:24 +0000)]
Handle DW_OP_GNU_implicit_pointer in dwarf assembler
DW_OP_GNU_implicit_pointer refers to a DIE with an offset of different
sizes in different dwarf versions. In v2, the size is the pointer size,
while in v3 and above, it is the ref_addr size. This patch fixes
dwarf assembler to emit the correct size of offset. We've already fixed
this size issue in gdb,
https://sourceware.org/ml/gdb-patches/2011-09/msg00451.html
gdb/testsuite:
2017-01-25 Yao Qi <yao.qi@linaro.org>
* lib/dwarf.exp (Dwarf::_location): Handle
DW_OP_GNU_implicit_pointer with proper size.
Dimitar Dimitrov [Wed, 25 Jan 2017 12:19:27 +0000 (12:19 +0000)]
Clarify that include/opcode/ files are part of GNU opcodes
include/ChangeLog:
2017-01-25 Dimitar Dimitrov <dimitar@dinux.eu>
* opcode/hppa.h: Clarify that file is part of GNU opcodes.
* opcode/i860.h: Ditto.
* opcode/nios2.h: Ditto.
* opcode/nios2r1.h: Ditto.
* opcode/nios2r2.h: Ditto.
* opcode/pru.h: Ditto.
opcodes/ChangeLog:
2017-01-25 Dimitar Dimitrov <dimitar@dinux.eu>
* pru-opc.c: Remove vague reference to a future GDB port.
Pedro Alves [Wed, 25 Jan 2017 12:24:02 +0000 (12:24 +0000)]
Fix include/ChangeLog entry format
Add missing <> around name.
Sebastian Huber [Wed, 25 Jan 2017 07:26:46 +0000 (17:56 +1030)]
Remove all RTEMS a.out targets
* config.bfd (*-*-rtemsaout*): Mark as removed.
Sebastian Huber [Wed, 25 Jan 2017 07:25:57 +0000 (17:55 +1030)]
Move RTEMS target configuration to ELF sections
bfd/
* config.bfd (powerpcle-*-rtems*): Do not mark as removed.
(arm-*-rtems*): Move to (arm*-*-eabi*).
(i[3-7]86-*-rtems*): Move to (i[3-7]86-*-elf*).
(m68-*-rtems*): Move to (m68*-*-elf*).
ld/
* configure.tgt (arm-*-rtems*): Move to (arm*-*-eabi*).
(bfin-*-rtems*): Move to (bfin*-*-elf*).
(i[3-7]86-*-rtems*): Move to (i[3-7]86*-*-elf*).
(m68*-*-rtems*): Move to (m68*-*-elf*).
(mips*-*-rtems*): Move to (mips*-*-elf*).
(or1k*-*-rtems*): Move to (or1k*-*-elf*).
(powerpc*-*-rtems*): Move to (powerpc*-*-elf*).
(sparc*-*-rtems*): Move to (sparc*-*-elf*).
(sparc64*-*-rtems*): Move to (sparc64*-*-elf*).
Sebastian Huber [Wed, 25 Jan 2017 07:24:47 +0000 (17:54 +1030)]
gas: Default to ELF for RTEMS targets
* configure.tgt (aarch64*-*-rtems*): Remove.
(bfin-*-rtems*): Likewise.
(h8300-*-rtems*): Likewise.
(i386-*-rtems*): Likewise.
(m32c-*-rtems*): Likewise.
(m32r-*-rtems*): Likewise.
(m68k-*-rtems*): Likewise.
(mips-*-rtems*): Likewise.
(nios2-*-rtems*): Likewise.
(ppc-*-rtems*): Likewise.
(sh-*-rtems*): Likewise.
(sparc64-*-rtems*): Likewise.
(sparc-*-rtems*): Likewise.
(*-*-rtems*) Use ELF format.
Sebastian Huber [Wed, 25 Jan 2017 07:23:44 +0000 (17:53 +1030)]
gas: Use ARM EABI for RTEMS
* configure.tgt (arm-*-rtems*): Move to (arm-*-eabi*).
Sebastian Huber [Wed, 25 Jan 2017 07:22:27 +0000 (17:52 +1030)]
Remove all RTEMS COFF targets
bfd/
* config.bfd (*-*-rtemscoff*): Mark as removed.
gas/
* configure.tgt (sh-*-rtemscoff*): Remove.
ld/
* configure.tgt (h8300-*-rtemscoff*): Remove.
(i960-*-rtems*): Likewise.
(m68*-*-rtemscoff*): Likewise.
(sh-*-rtemscoff*): Likewise.
GDB Administrator [Wed, 25 Jan 2017 00:00:22 +0000 (00:00 +0000)]
Automatic date update in version.in
Simon Marchi [Tue, 24 Jan 2017 20:29:14 +0000 (15:29 -0500)]
Fix typo in ExitedEvent doc
The field "inferior" of the ExitedEvent object is not displayed
properly.
gdb/doc/ChangeLog:
* python.texi (Events In Python): Fix typo.
Sebastian Huber [Thu, 19 Jan 2017 08:10:51 +0000 (09:10 +0100)]
RISC-V gas: Remove em=linux from configure.tgt
The use of te-linux.h is unnecessary since the TE_LINUX define is unused
and LOCAL_LABELS_FB is defined to 1 in tc-riscv.h as well.
gas/
* configure.tgt (riscv*-*-*): Remove em=linux.
Maciej W. Rozycki [Mon, 23 Jan 2017 11:38:20 +0000 (11:38 +0000)]
PR ld/20828: Reorder the symbol sweep stage of section GC
Complement commit
81ff47b3a546 ("PR ld/20828: Fix linker script symbols
wrongly forced local with section GC") and move the symbol sweep stage
of section GC from `elf_gc_sweep' to `bfd_elf_size_dynamic_sections',
avoiding the need to clear the `forced_local' marker, problematic for
targets that have special processing in their `elf_backend_hide_symbol'
handler. Set `mark' instead in `bfd_elf_record_link_assignment' and,
matching changes from commit
3bd43ebcb602 ("ld --gc-sections fail with
__tls_get_addr_opt"), also in PowerPC `__tls_get_addr_opt' handling
code, removing a:
FAIL: PR ld/20828 dynamic symbols with section GC (version script)
test suite failure with the `score-elf' target.
The rationale is it is enough if symbols are swept at the beginning of
`bfd_elf_size_dynamic_sections' as it is only in this function that the
size of the GOT, the dynamic symbol table and other dynamic sections is
determined, which will depend on the number of symbols making it to the
dynamic symbol table. It is also appropriate to do the sweep at this
point as it is already after any changes have been made to symbols with
`bfd_elf_record_link_assignment', and not possible any earlier as calls
to that function are only made just beforehand -- barring audit entry
processing -- via `gld${EMULATION_NAME}_find_statement_assignment'
invoked from `gld${EMULATION_NAME}_before_allocation' which is the ELF
handler for `ldemul_before_allocation'.
bfd/
PR ld/20828
* elflink.c (bfd_elf_record_link_assignment): Revert last
change and don't ever clear `forced_local'. Set `mark'
unconditionally.
(elf_gc_sweep_symbol_info, elf_gc_sweep_symbol): Reorder within
file.
(elf_gc_sweep): Move the call to `elf_gc_sweep_symbol'...
(bfd_elf_size_dynamic_sections): ... here.
* elf32-ppc.c (ppc_elf_tls_setup): Don't clear `forced_local'
and set `mark' instead in `__tls_get_addr_opt' processing.
* elf64-ppc.c (ppc64_elf_tls_setup): Likewise.
Maciej W. Rozycki [Mon, 23 Jan 2017 11:37:19 +0000 (11:37 +0000)]
Solaris2/LD: Fix anonymous version script acceptance bug
Correct a bug in Solaris 2 linker emulation code triggered by a test
introduced with commit
81ff47b3a546 ("PR ld/20828: Fix linker script
symbols wrongly forced local with section GC") and only create implicit
version nodes if versioning is actually introduced with a version script
(or VERSION command) rather than only global vs local symbol visibility
selected, fixing an:
ld: anonymous version tag cannot be combined with other version tags
linker error produced whenever a version script (or VERSION command) is
used that does not assign symbol versions, such as:
{ global: foo; bar; local: *; };
and consequently removing a:
FAIL: PR ld/20828 dynamic symbols with section GC (version script)
test suite failure with the `x86_64-solaris2' target.
ld/
* emultempl/solaris2.em (elf_solaris2_before_allocation): Do not
add implicit version nodes if an anonymous version tag is being
used.
Alan Hayward [Tue, 24 Jan 2017 10:37:13 +0000 (10:37 +0000)]
[PATCH] Add NT_ARM_SVE
* elf/common.h (NT_ARM_SVE): Define.
Jiong Wang [Tue, 24 Jan 2017 09:33:00 +0000 (09:33 +0000)]
[ld, testsuite] Always assemble those intermeidate .o files used later
ld/
* testsuite/ld-plugin/lto.exp (lto_link_elf_tests): Move "Compile 7",
"Compile 8a", "Compile 8b"...
(lto_compile_elf_tests): ...to here. Always run these tests.
(lto_run_elf_tests): Move "LTO 7"...
(lto_run_elf_shared_tests): ...to here. Restrict these tests on
environment where share library is supported.
Alan Modra [Mon, 23 Jan 2017 22:13:01 +0000 (08:43 +1030)]
PowerPC dynamic relocations
This patch fixes a number of issues with powerpc dynamic relocations.
1) Both ppc and ppc64 were emitting more dynamic symbols and
relocations than necessary, due to not supporting static linker
resolution of tls_index entries for __tls_get_addr_opt. This meant
that any @got@tlsgd or @got@tlsld reloc needed to make their symbols
dynamic and generate dptmod and dtprel relocs for the dynamic linker.
That would have been passable, but what happened was that practically
all @got relocations resulted in their symbols being made dynamic and
dynamic relocations emitted against the GOT entries. (Mostly visible
on ppc32 executables since ppc64 gcc really only uses @got style
relocs for TLS.)
2) The PowerOpen syntax was not supported with __tls_get_addr_opt.
DTPMOD/DTPREL relocs on tls_index TOC entries did not use the trick of
forcing dynamic symbols and relocations so those entries always
resulted in the full __tls_get_addr processing. gcc doesn't use the
PowerOpen syntax for TLS, and normally such code would be optimized to
TLS IE or LE so the impact of missing this support was minimal.
3) In an executable, relocations against GNU indirect functions always
used the value of their PLT stub. While this is correct, it is
better in some cases to use a dynamic relocation. An extra dynamic
relocation can mean that calls via function pointers need not bounce
through the PLT stub at runtime.
The patch also tidies the PLT handling code in ppc32
allocate_dynrelocs. Allocating PLT entries after other dynamic relocs
allows the PLT loop to omit special handling for undefined weak
symbols, and that in turn allows the loop to be simplified.
bfd/
* elf32-ppc.c (ppc_elf_adjust_dynamic_symbol): Merge two cases
where dynamic relocs are preferable. Allow ifunc too.
(ensure_undefweak_dynamic): New function.
(allocate_dynrelocs): Use it here. Move plt handling last and
don't make symbols dynamic, simplifying loop. Only make undef
weak symbols with GOT entries dynamic. Correct condition
for GOT relocs. Handle dynamic relocs on ifuncs. Correct
comments. Remove goto.
(ppc_elf_relocate_section): Correct test for using dynamic
symbol on GOT relocs. Rearrange test for emitting GOT relocs
to suit. Set up explicit tls_index entries and implicit GOT
tls_index entries resolvable at link time for
__tls_get_addr_opt. Simplify test to clear mem for prelink.
* elf64-ppc.c (allocate_got): Correct condition for GOT relocs.
(ensure_undefweak_dynamic): New function.
(allocate_dynrelocs): Use it here. Only make undef weak symbols
with GOT entries dynamic. Remove unnecessary test of
WILL_CALL_FINISH_DYNAMIC_SYMBOL in PLT handling.
(ppc64_elf_relocate_section): Correct test for using dynamic
symbol on GOT relocs. Rearrange test for emitting GOT relocs
to suit. Set up explicit tls_index entries and implicit GOT
tls_index entries resolvable at link time for __tls_get_addr_opt.
Simplify expression to clear mem for prelink.
ld/
* testsuite/ld-powerpc/tlsexe.r: Update for fewer dynamic relocs
and symbols.
* testsuite/ld-powerpc/tlsexe.d: Likewise.
* testsuite/ld-powerpc/tlsexe.g: Likewise.
Rahul Chaudhry [Tue, 24 Jan 2017 01:34:14 +0000 (17:34 -0800)]
Add -e to test scripts where necessary.
gold/
* testsuite/icf_safe_so_test.sh: Use "set -e".
* testsuite/icf_safe_test.sh: Likewise.
* testsuite/icf_test.sh: Likewise.
Jim Wilson [Tue, 24 Jan 2017 01:26:53 +0000 (17:26 -0800)]
Add support for cmtst.
sim/aarch64/
* simulator.c (do_vec_compare): Add case 0x23 for CMTST.
sim/testsuite/sim/aarch64/
* cmtst.s: New.
Vladimir Radosavljevic [Tue, 24 Jan 2017 01:18:00 +0000 (17:18 -0800)]
Make the sh_info field of .rel.plt point to .plt (MIPS).
gold/
* mips.cc (Mips_output_data_plt::rel_plt): Remove const from return
type.
(Target_mips::make_plt_entry): Make the sh_info field of .rel.plt
point to .plt.
Vladimir Radosavljevic [Tue, 24 Jan 2017 01:12:10 +0000 (17:12 -0800)]
Fix MIPS GOT when global symbols are forced to local visibility.
gold/
PR gold/21054
* mips.cc (Mips_got_info::record_global_got_symbol): Don't add symbol
to the dynamic symbol table if it is forced to local visibility.
(Target_mips::do_finalize_sections): Don't add __RLD_MAP symbol to the
dynamic symbol table if it is forced to local visibility.
GDB Administrator [Tue, 24 Jan 2017 00:00:18 +0000 (00:00 +0000)]
Automatic date update in version.in
Simon Marchi [Mon, 23 Jan 2017 20:31:40 +0000 (15:31 -0500)]
Minor simplification of (Python) find_thread_object
Since the reference to the Inferior Python object is managed by
gdbpy_ref (RAII), we can return directly from the loop. It's just a
leftover from the cleanups era.
gdb/ChangeLog:
* python/py-inferior.c (find_thread_object): Return directly
from the loop. Remove "found" variable.
Yury Norov [Mon, 23 Jan 2017 17:07:13 +0000 (17:07 +0000)]
Fix AArch64 relocation handling in ILP32 mode.
bfd * elfnn-aarch64.c: Fix relaxations for ILP32 mode.
ld * testsuite/ld-aarch64/aarch64-elf.exp: Run new tests.
* testsuite/ld-aarch64/tls-desc-ie-ilp32.d: New test.
* testsuite/ld-aarch64/tls-relax-all-ilp32.d: New test.
* testsuite/ld-aarch64/tls-relax-gd-le-ilp32.d: New test.
* testsuite/ld-aarch64/tls-relax-gdesc-le-2-ilp32.d: New test.
* testsuite/ld-aarch64/tls-relax-gdesc-le-ilp32.d: New test.
* testsuite/ld-aarch64/tls-relax-ie-le-2-ilp32.d: New test.
* testsuite/ld-aarch64/tls-relax-ie-le-3-ilp32.d: New test.
* testsuite/ld-aarch64/tls-relax-ie-le-ilp32.d: New test.
* testsuite/ld-aarch64/tls-tiny-desc-ie-ilp32.d: New test.
* testsuite/ld-aarch64/tls-tiny-desc-le-ilp32.d: New test.
* testsuite/ld-aarch64/tls-tiny-gd-ie-ilp32.d: New test.
* testsuite/ld-aarch64/tls-tiny-gd-le-ilp32.d: New test.
Nick Clifton [Mon, 23 Jan 2017 16:28:46 +0000 (16:28 +0000)]
Fix typo in MAINTAINERS file
Nick Clifton [Mon, 23 Jan 2017 16:20:57 +0000 (16:20 +0000)]
Remove Mei Ligang as SCORE maintainer
Nick Clifton [Mon, 23 Jan 2017 16:16:55 +0000 (16:16 +0000)]
Add Bernd Schmidt to Past Maintainers list
Nick Clifton [Mon, 23 Jan 2017 15:57:59 +0000 (15:57 +0000)]
Restore ability to build zlib in a srcdir == builddir configuration.
* configure.ac: Restore old behaviour of only enabling multilibs
when a target subdirectory is defined. This allows building with
srcdir == builddir.
* configure: Regenerate.
Nick Clifton [Mon, 23 Jan 2017 15:23:07 +0000 (15:23 +0000)]
Fix spelling mistakes and typos in the GAS sources.
PR gas/21072
* asintl.h: Fix spelling mistakes and typos.
* atof-generic.c: Likewise.
* bit_fix.h: Likewise.
* config/atof-ieee.c: Likewise.
* config/bfin-defs.h: Likewise.
* config/bfin-parse.y: Likewise.
* config/obj-coff-seh.h: Likewise.
* config/obj-coff.c: Likewise.
* config/obj-evax.c: Likewise.
* config/obj-macho.c: Likewise.
* config/rx-parse.y: Likewise.
* config/tc-aarch64.c: Likewise.
* config/tc-alpha.c: Likewise.
* config/tc-arc.c: Likewise.
* config/tc-arm.c: Likewise.
* config/tc-avr.c: Likewise.
* config/tc-bfin.c: Likewise.
* config/tc-cr16.c: Likewise.
* config/tc-cris.c: Likewise.
* config/tc-crx.c: Likewise.
* config/tc-d10v.c: Likewise.
* config/tc-d30v.c: Likewise.
* config/tc-dlx.c: Likewise.
* config/tc-epiphany.c: Likewise.
* config/tc-frv.c: Likewise.
* config/tc-hppa.c: Likewise.
* config/tc-i370.c: Likewise.
* config/tc-i386-intel.c: Likewise.
* config/tc-i386.c: Likewise.
* config/tc-i960.c: Likewise.
* config/tc-ia64.c: Likewise.
* config/tc-m32r.c: Likewise.
* config/tc-m68hc11.c: Likewise.
* config/tc-m68k.c: Likewise.
* config/tc-mcore.c: Likewise.
* config/tc-mep.c: Likewise.
* config/tc-mep.h: Likewise.
* config/tc-metag.c: Likewise.
* config/tc-microblaze.c: Likewise.
* config/tc-mips.c: Likewise.
* config/tc-mmix.c: Likewise.
* config/tc-mn10200.c: Likewise.
* config/tc-mn10300.c: Likewise.
* config/tc-msp430.c: Likewise.
* config/tc-msp430.h: Likewise.
* config/tc-nds32.c: Likewise.
* config/tc-nds32.h: Likewise.
* config/tc-nios2.c: Likewise.
* config/tc-nios2.h: Likewise.
* config/tc-ns32k.c: Likewise.
* config/tc-pdp11.c: Likewise.
* config/tc-ppc.c: Likewise.
* config/tc-pru.c: Likewise.
* config/tc-rx.c: Likewise.
* config/tc-s390.c: Likewise.
* config/tc-score.c: Likewise.
* config/tc-score7.c: Likewise.
* config/tc-sh.c: Likewise.
* config/tc-sh64.c: Likewise.
* config/tc-sparc.c: Likewise.
* config/tc-tic4x.c: Likewise.
* config/tc-tic54x.c: Likewise.
* config/tc-v850.c: Likewise.
* config/tc-vax.c: Likewise.
* config/tc-visium.c: Likewise.
* config/tc-xgate.c: Likewise.
* config/tc-xtensa.c: Likewise.
* config/tc-z80.c: Likewise.
* config/tc-z8k.c: Likewise.
* config/te-vms.c: Likewise.
* config/xtensa-relax.c: Likewise.
* doc/as.texinfo: Likewise.
* doc/c-arm.texi: Likewise.
* doc/c-hppa.texi: Likewise.
* doc/c-i370.texi: Likewise.
* doc/c-i386.texi: Likewise.
* doc/c-m32r.texi: Likewise.
* doc/c-m68k.texi: Likewise.
* doc/c-mmix.texi: Likewise.
* doc/c-msp430.texi: Likewise.
* doc/c-nds32.texi: Likewise.
* doc/c-ns32k.texi: Likewise.
* doc/c-riscv.texi: Likewise.
* doc/c-rx.texi: Likewise.
* doc/c-s390.texi: Likewise.
* doc/c-tic6x.texi: Likewise.
* doc/c-tilegx.texi: Likewise.
* doc/c-tilepro.texi: Likewise.
* doc/c-v850.texi: Likewise.
* doc/c-xgate.texi: Likewise.
* doc/c-xtensa.texi: Likewise.
* dwarf2dbg.c: Likewise.
* ecoff.c: Likewise.
* itbl-ops.c: Likewise.
* listing.c: Likewise.
* macro.c: Likewise.
* po/gas.pot: Likewise.
* read.c: Likewise.
* struc-symbol.h: Likewise.
* symbols.h: Likewise.
* testsuite/gas/arc/relocs-errors.err: Likewise.
* write.c: Likewise.
Bernd Schmidt [Mon, 23 Jan 2017 14:00:23 +0000 (15:00 +0100)]
* MAINTAINERS (BFIN): Remove myself as Blackfin maintainer.
Nick Clifton [Mon, 23 Jan 2017 13:32:12 +0000 (13:32 +0000)]
Updated Irish translation for ld and Swedish translation for gas.
Nick Clifton [Mon, 23 Jan 2017 11:55:48 +0000 (11:55 +0000)]
Sync top-level make and configure files with FSF GCC mainline versions.
* configure.ac: Update year in copyright notice.
Sync from FSF GCC mainline, bringing in the following patches.
* Makefile.def: Likewise.
* Makefile.tpl: Likewise.
* configure: Regenerate.
* Makefile.in: Regenerate.
2016-12-21 Jakub Jelinek <jakub@redhat.com>
* configure.ac: Don't bootstrap libmpx unless --with-build-config
includes bootstrap-mpx.
2016-12-01 Matthias Klose <doko@ubuntu.com>
* configure.ac: Don't use pkg-config to check for bdw-gc.
2016-11-30 Matthias Klose <doko@ubuntu.com>
* Makefile.def: Remove reference to boehm-gc target module.
* configure.ac: Include pkg.m4, check for --with-target-bdw-gc
options and for the bdw-gc pkg-config module.
2016-11-15 Matthias Klose <doko@ubuntu.com>
* config-ml.in: Remove references to GCJ.
* configure.ac: Likewise.
2016-09-30 Jakub Jelinek <jakub@redhat.com>
* configure.ac: Add target-libffi to target_libraries.
Readd libgcj target disablings, modified to only target-libffi.
Readd target addition of go to unsupported languages.
2016-09-30 Andrew Haley <aph@redhat.com>
* Makefile.def: Remove libjava.
* Makefile.tpl: Likewise.
* configure.ac: Likewise.
2016-09-26 Anton Kolesov <Anton.Kolesov@synopsys.com>
* configure.ac: Disable "sim" directory for arc*-*-*.
2016-09-12 Maciej W. Rozycki <macro@imgtec.com>
* configure.ac: Check for the minimum in-tree MPFR version
handled.
Maciej W. Rozycki [Mon, 23 Jan 2017 11:21:19 +0000 (11:21 +0000)]
PR ld/20828: Work around RISC-V failures
Complement commit
81ff47b3a546 ("PR ld/20828: Fix linker script symbols
wrongly forced local with section GC") and add `.plt' to the list of
output sections created, fixing:
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)
failures with `riscv32-elf', `riscv32-linux', `riscv64-elf' and
`riscv64-linux' targets caused by LD crashing in the absence of such a
section.
ld/
PR ld/20828
* testsuite/ld-elf/pr20828.ld: Add `.plt'.
Maciej W. Rozycki [Mon, 23 Jan 2017 11:19:46 +0000 (11:19 +0000)]
PR ld/20828: Remove leading `_' from symbols used in tests
Complement commit
81ff47b3a546 ("PR ld/20828: Fix linker script symbols
wrongly forced local with section GC") and remove the leading underscore
from `_fdata' and `_edata' symbols used in tests, fixing a:
FAIL: PR ld/20828 dynamic symbols with section GC (version script)
failure with targets such as: `bfin-elf', `bfin-uclinux', `metag-elf',
`metag-linux' `mn10300-elf', `sh-elf', `sh64-elf', and possibly other
ones, that have `_' set (with `elf_symbol_leading_char') as the leading
character for symbols. As from commit
93252b1cf41a ("bfd/ld: handle ABI
prefixes in version scripts") these targets strip the leading underscore
before applying version script rules, because the (default) syntax for
symbol names is that of the C language rather than their low-level
symbol table encoding.
ld/
PR ld/20828
* testsuite/ld-elf/pr20828.ld: Rename `_fdata' and `_edata' to
`fdata' and `edata' respectively.
* testsuite/ld-elf/pr20828.ver: Adjust accordingly.
* testsuite/ld-elf/pr20828-a.sd: Likewise.
* testsuite/ld-elf/pr20828-b.sd: Likewise.
* testsuite/ld-elf/pr20828-c.sd: Likewise.
Maciej W. Rozycki [Mon, 23 Jan 2017 11:18:33 +0000 (11:18 +0000)]
PR ld/20828: Relax symbol ordering in tests
Complement commit
81ff47b3a546 ("PR ld/20828: Fix linker script symbols
wrongly forced local with section GC") and make tests check for the
presence of global `_fdata' and `_edata' symbols separately, removing
any dependency on symbol table ordering for tests to succeed and
removing:
FAIL: PR ld/20828 dynamic symbols with section GC (auxiliary shared library)
FAIL: PR ld/20828 dynamic symbols with section GC (plain)
failures with the `x86_64-solaris2' target, which has additional
intervening entries:
Symbol table '.dynsym' contains 6 entries:
Num: Value Size Type Bind Vis Ndx Name
0:
0000000000000000 0 NOTYPE LOCAL DEFAULT UND
1:
0000000000000000 0 NOTYPE GLOBAL DEFAULT 1 _fdata
2:
0000000000000000 0 OBJECT GLOBAL DEFAULT 1 _DYNAMIC
3:
0000000000000000 0 OBJECT GLOBAL DEFAULT ABS _PROCEDURE_LINKAGE_TABLE_
4:
0000000000000000 0 NOTYPE GLOBAL DEFAULT 1 _edata
5:
00000000000001b8 0 OBJECT GLOBAL DEFAULT 4 _GLOBAL_OFFSET_TABLE_
Rename dump pattern files accordingly for consistency.
ld/
PR ld/20828
* testsuite/ld-elf/pr20828-1.sd: Remove test.
* testsuite/ld-elf/pr20828-a.sd: New test.
* testsuite/ld-elf/pr20828-2a.sd: Rename test to...
* testsuite/ld-elf/pr20828-b.sd: ... this.
* testsuite/ld-elf/pr20828-2b.sd: Rename test to...
* testsuite/ld-elf/pr20828-c.sd: ... this.
* testsuite/ld-elf/shared.exp: Adjust accordingly.
Jiong Wang [Mon, 23 Jan 2017 09:59:10 +0000 (09:59 +0000)]
[ld, testsuite] Honor cflags when GCC used as linker driver
ld/
* testsuite/lib/ld-lib.exp (run_ld_link_exec_tests): Append
board_cflags as gcc is used as linker driver.
* testsuite/ld-unique/unique.exp: Likewise
GDB Administrator [Mon, 23 Jan 2017 00:00:25 +0000 (00:00 +0000)]
Automatic date update in version.in
GDB Administrator [Sun, 22 Jan 2017 00:00:22 +0000 (00:00 +0000)]
Automatic date update in version.in
Joel Brobecker [Sat, 21 Jan 2017 13:59:40 +0000 (17:59 +0400)]
Document the GDB 7.12.1 release in gdb/ChangeLog
gdb/ChangeLog:
GDB 7.12.1 released.
Simon Marchi [Sat, 21 Jan 2017 02:02:05 +0000 (21:02 -0500)]
Fix Py_DECREF being executed without holding the GIL
When the gdbpy_ref objects get destroyed, they call Py_DECREF to
decrement the reference counter of the python object they hold a
reference to. Any time we call into the Python API, we should be
holding the GIL. The gdbpy_enter object does that for us in an
RAII-fashion.
However, if gdbpy_enter is declared after a gdbpy_ref object in a
function, gdbpy_enter's destructor will be called (and the GIL will be
released) before gdbpy_ref's destructor is called. Therefore, we will
end up calling Py_DECREF without holding the GIL.
This became obvious with Python 3.6, where memory management functions
have asserts to make sure that the GIL is held. This was exposed by
tests py-as-string.exp, py-function.exp and py-xmethods. For example:
(gdb) p $_as_string(enum_valid)
Fatal Python error: Python memory allocator called without holding the GIL
Current thread 0x00007f7f7b21c780 (most recent call first):
[1] 18678 abort (core dumped) ./gdb -nx testsuite/outputs/gdb.python/py-as-string/py-as-string
#0 0x00007ffff618bc37 in raise () from /lib/x86_64-linux-gnu/libc.so.6
#1 0x00007ffff618f028 in abort () from /lib/x86_64-linux-gnu/libc.so.6
#2 0x00007ffff6b104d6 in Py_FatalError (msg=msg@entry=0x7ffff6ba15b8 "Python memory allocator called without holding the GIL") at Python/pylifecycle.c:1457
#3 0x00007ffff6a37a68 in _PyMem_DebugCheckGIL () at Objects/obmalloc.c:1972
#4 0x00007ffff6a3804e in _PyMem_DebugFree (ctx=0x7ffff6e65290 <_PyMem_Debug+48>, ptr=0x24f8830) at Objects/obmalloc.c:1994
#5 0x00007ffff6a38e1d in PyMem_Free (ptr=<optimized out>) at Objects/obmalloc.c:442
#6 0x00007ffff6b866c6 in _PyFaulthandler_Fini () at ./Modules/faulthandler.c:1369
#7 0x00007ffff6b104bd in Py_FatalError (msg=msg@entry=0x7ffff6ba15b8 "Python memory allocator called without holding the GIL") at Python/pylifecycle.c:1431
#8 0x00007ffff6a37a68 in _PyMem_DebugCheckGIL () at Objects/obmalloc.c:1972
#9 0x00007ffff6a3804e in _PyMem_DebugFree (ctx=0x7ffff6e652c0 <_PyMem_Debug+96>, ptr=0x7ffff46b6040) at Objects/obmalloc.c:1994
#10 0x00007ffff6a38f55 in PyObject_Free (ptr=<optimized out>) at Objects/obmalloc.c:503
#11 0x00007ffff6a5f27e in unicode_dealloc (unicode=unicode@entry=0x7ffff46b6040) at Objects/unicodeobject.c:1794
#12 0x00007ffff6a352a9 in _Py_Dealloc (op=0x7ffff46b6040) at Objects/object.c:1786
#13 0x000000000063f28b in gdb_Py_DECREF (op=0x7ffff46b6040) at /home/emaisin/src/binutils-gdb/gdb/python/python-internal.h:192
#14 0x000000000063fa33 in gdbpy_ref_policy::decref (ptr=0x7ffff46b6040) at /home/emaisin/src/binutils-gdb/gdb/python/py-ref.h:35
#15 0x000000000063fa77 in gdb::ref_ptr<_object, gdbpy_ref_policy>::~ref_ptr (this=0x7fffffffcdf0, __in_chrg=<optimized out>) at /home/emaisin/src/binutils-gdb/gdb/common/gdb_ref_ptr.h:91
#16 0x000000000064d8b8 in fnpy_call (gdbarch=0x2b50010, language=0x115d2c0 <c_language_defn>, cookie=0x7ffff46b7468, argc=1, argv=0x7fffffffcf48)
at /home/emaisin/src/binutils-gdb/gdb/python/py-function.c:145
The fix is to place the gdbpy_enter first in the function. I also
cleaned up the comments a bit and removed the unnecessary initialization
of the value variable.
gdb/ChangeLog:
* python/py-function.c (fnpy_call): Reorder declarations to have
the gdbpy_enter object declared first.
* python/py-xmethods.c (gdbpy_get_xmethod_arg_types): Likewise.
Simon Marchi [Sat, 21 Jan 2017 01:47:41 +0000 (20:47 -0500)]
Add missing PR reference in ChangeLog
Simon Marchi [Sat, 21 Jan 2017 01:39:08 +0000 (20:39 -0500)]
Fix python-interactive with Python 3.6
New in v2:
- Define PyMem_RawMalloc as PyMem_Malloc for Python < 3.4 and use
PyMem_RawMalloc in the code.
Since Python 3.4, the callback installed in PyOS_ReadlineFunctionPointer
should return a value allocated with PyMem_RawMalloc instead of
PyMem_Malloc. The reason is that PyMem_Malloc must be called with the
Python Global Interpreter Lock (GIL) held, which is not the case in the
context where this function is called. PyMem_RawMalloc was introduced
for cases like this.
In Python 3.6, it looks like they added an assert to verify that
PyMem_Malloc was not called without the GIL. The consequence is that
typing anything in the python-interactive mode of gdb crashes the
process. The same behavior was observed with the official package on
Arch Linux as well as with a manual Python build on Ubuntu 14.04.
This is what is shown with a debug build of Python 3.6 (the error with a
non-debug build is far less clear):
(gdb) pi
>>> print(1)
Fatal Python error: Python memory allocator called without holding the GIL
Current thread 0x00007f1459af8780 (most recent call first):
[1] 21326 abort ./gdb
and the backtrace:
#0 0x00007ffff618bc37 in raise () from /lib/x86_64-linux-gnu/libc.so.6
#1 0x00007ffff618f028 in abort () from /lib/x86_64-linux-gnu/libc.so.6
#2 0x00007ffff6b104d6 in Py_FatalError (msg=msg@entry=0x7ffff6ba15b8 "Python memory allocator called without holding the GIL") at Python/pylifecycle.c:1457
#3 0x00007ffff6a37a68 in _PyMem_DebugCheckGIL () at Objects/obmalloc.c:1972
#4 0x00007ffff6a3804e in _PyMem_DebugFree (ctx=0x7ffff6e65290 <_PyMem_Debug+48>, ptr=0x24f8830) at Objects/obmalloc.c:1994
#5 0x00007ffff6a38e1d in PyMem_Free (ptr=<optimized out>) at Objects/obmalloc.c:442
#6 0x00007ffff6b866c6 in _PyFaulthandler_Fini () at ./Modules/faulthandler.c:1369
#7 0x00007ffff6b104bd in Py_FatalError (msg=msg@entry=0x7ffff6ba15b8 "Python memory allocator called without holding the GIL") at Python/pylifecycle.c:1431
#8 0x00007ffff6a37a68 in _PyMem_DebugCheckGIL () at Objects/obmalloc.c:1972
#9 0x00007ffff6a37aa3 in _PyMem_DebugMalloc (ctx=0x7ffff6e65290 <_PyMem_Debug+48>, nbytes=5) at Objects/obmalloc.c:1980
#10 0x00007ffff6a38d91 in PyMem_Malloc (size=<optimized out>) at Objects/obmalloc.c:418
#11 0x000000000064dbe2 in gdbpy_readline_wrapper (sys_stdin=0x7ffff6514640 <_IO_2_1_stdin_>, sys_stdout=0x7ffff6514400 <_IO_2_1_stdout_>, prompt=0x7ffff4d4f7d0 ">>> ")
at /home/emaisin/src/binutils-gdb/gdb/python/py-gdb-readline.c:75
The documentation is very clear about it [1] and it was also mentioned
in the "What's New In Python 3.4" page [2].
[1] https://docs.python.org/3/c-api/veryhigh.html#c.PyOS_ReadlineFunctionPointer
[2] https://docs.python.org/3/whatsnew/3.4.html#changes-in-the-c-api
gdb/ChangeLog:
* python/python-internal.h (PyMem_RawMalloc): Define for
Python < 3.4.
* python/py-gdb-readline.c (gdbpy_readline_wrapper): Use
PyMem_RawMalloc instead of PyMem_Malloc.
GDB Administrator [Sat, 21 Jan 2017 00:00:21 +0000 (00:00 +0000)]
Automatic date update in version.in
Luis Machado [Fri, 20 Jan 2017 19:58:40 +0000 (13:58 -0600)]
Fix uppercase test names in gdb.python/py-xmethods.exp
Some leftover uppercase test names in py-xmethods.exp. The patch also
replaces two "continue" calls with untested calls to make things a bit more
clear.
gdb/testsuite/ChangeLog:
2017-01-20 Luis Machado <lgustavo@codesourcery.com>
* gdb.python/py-xmethods.exp: Fix test names starting with lowercase
and add untested calls.
Luis Machado [Fri, 20 Jan 2017 19:15:36 +0000 (13:15 -0600)]
Make gdb.python/python.exp more robust
I noticed gdb.python/python.exp failing on aarch64-elf like so:
FAIL: gdb.python/python.exp: Test decode_line func1 line number
This particular test expects the line number for func1 to be 19, hardcoded.
In my aarch64-elf tests gdb thinks func1 is at line 20, making the test fail.
The following patch addresses this by reading the line number information from
GDB and comparing it against the python decoded symtab information.
gdb/testsuite/ChangeLog:
2017-01-20 Luis Machado <lgustavo@codesourcery.com>
* gdb.python/python.exp: Check line number against what GDB thinks
the line number is for func1.
Luis Machado [Fri, 20 Jan 2017 14:13:03 +0000 (08:13 -0600)]
Add command to erase all flash memory regions
Changes in v4:
- Replaced phex call with hex_string.
Changes in v3:
- Addressed comments by Pedro.
- Output of memory region size now in hex format.
- Misc formatting fixups.
- Addressed Simon's comments on formatting.
- Adjusted command text in the manual entry.
- Fixed up ChangeLog.
- Renamed flash_erase_all_command to flash_erase_command.
Changes in v2:
- Added NEWS entry.
- Fixed long lines.
- Address printing with paddress.
Years ago we contributed flash programming patches upstream. The following
patch is a leftover one that complements that functionality by adding a new
command to erase all reported flash memory blocks.
The command is most useful when we're dealing with flash-enabled targets
(mostly bare-metal) and we need to reset the board for some reason.
The wiping out of flash memory regions should help the target come up with a
known clean state from which the user can load a new image and resume
debugging. It is convenient enough to do this from the debugger, and there is
also an MI command to expose this functionality to the IDE's.
gdb/doc/ChangeLog:
2017-01-20 Mike Wrighton <mike_wrighton@codesourcery.com>
Luis Machado <lgustavo@codesourcery.com>
* gdb.texinfo (-target-flash-erase): New MI command description.
(flash-erase): New CLI command description.
gdb/ChangeLog:
2017-01-20 Mike Wrighton <mike_wrighton@codesourcery.com>
Luis Machado <lgustavo@codesourcery.com>
* NEWS (New commands): Mention flash-erase.
(New MI commands): Mention target-flash-erase.
* mi/mi-cmds.c (mi_cmd_target_flash_erase): Add target-flash-erase MI
command.
* mi/mi-cmds.h (mi_cmd_target_flash_erase): New declaration.
* mi/mi-main.c (mi_cmd_target_flash_erase): New function.
* target.c (flash_erase_command): New function.
(initialize_targets): Add new flash-erase command.
* target.h (flash_erase_command): New declaration.
Jiong Wang [Fri, 20 Jan 2017 13:30:32 +0000 (13:30 +0000)]
[AArch64] Optimize .gnu.hash table size for executable
bfd/
* elfnn-aarch64.c (elf_aarch64_hash_symbol): New function.
(elf_backend_hash_symbol): Define.
ld/
* testsuite/ld-aarch64/aarch64-elf.exp (aarch64elflinktests): New tests.
* testsuite/ld-aarch64/func-in-so.s: New test source file.
* testsuite/ld-aarch64/func-sym-hash-opt.s: Likewise.
* testsuite/ld-aarch64/func-sym-hash-opt.d: New expected test result.
Nick Clifton [Fri, 20 Jan 2017 12:25:07 +0000 (12:25 +0000)]
Updated Irish translation for the opcodes library.
* po/ga.po: Updated Irish translation.
Nick Clifton [Fri, 20 Jan 2017 10:32:25 +0000 (10:32 +0000)]
Fix potential array overrun in x86 assembler.
* config/tc-i386.c (parse_operands): Check for operand overflow
before setting the unspecified bit.
Nick Clifton [Fri, 20 Jan 2017 10:21:17 +0000 (10:21 +0000)]
Fix problem in aarch64 gold sources uncovered by Coverty - using sizeof on a pointer instead of an array.
* aarch64.cc (Stub_template_repertoire): Change ST_E_835769_INSNS
from a pointer to an array.
Nick Clifton [Fri, 20 Jan 2017 10:17:42 +0000 (10:17 +0000)]
Sync zlib sources with GCC, upgrading to 1.2.10.
Changes in 1.2.10 (2 Jan 2017)
- Avoid warnings on snprintf() return value
- Fix bug in deflate_stored() for zero-length input
- Fix bug in gzwrite.c that produced corrupt gzip files
- Remove files to be installed before copying them in Makefile.in
- Add warnings when compiling with assembler code
Changes in 1.2.9 (31 Dec 2016)
- Fix contrib/minizip to permit unzipping with desktop API [Zouzou]
- Improve contrib/blast to return unused bytes
- Assure that gzoffset() is correct when appending
- Improve compress() and uncompress() to support large lengths
- Fix bug in test/example.c where error code not saved
- Remedy Coverity warning [Randers-Pehrson]
- Improve speed of gzprintf() in transparent mode
- Fix inflateInit2() bug when windowBits is 16 or 32
- Change DEBUG macro to ZLIB_DEBUG
- Avoid uninitialized access by gzclose_w()
- Allow building zlib outside of the source directory
- Fix bug that accepted invalid zlib header when windowBits is zero
- Fix gzseek() problem on MinGW due to buggy _lseeki64 there
- Loop on write() calls in gzwrite.c in case of non-blocking I/O
- Add --warn (-w) option to ./configure for more compiler warnings
- Reject a window size of 256 bytes if not using the zlib wrapper
- Fix bug when level 0 used with Z_HUFFMAN or Z_RLE
- Add --debug (-d) option to ./configure to define ZLIB_DEBUG
- Fix bugs in creating a very large gzip header
- Add uncompress2() function, which returns the input size used
- Assure that deflateParams() will not switch functions mid-block
- Dramatically speed up deflation for level 0 (storing)
- Add gzfread(), duplicating the interface of fread()
- Add gzfwrite(), duplicating the interface of fwrite()
- Add deflateGetDictionary() function
- Use snprintf() for later versions of Microsoft C
- Fix *Init macros to use z_ prefix when requested
- Replace as400 with os400 for OS/400 support [Monnerat]
- Add crc32_z() and adler32_z() functions with size_t lengths
- Update Visual Studio project files [AraHaan]