Maciej W. Rozycki [Tue, 12 Jul 2016 00:30:48 +0000 (01:30 +0100)]
MIPS/GAS: Keep the ISA bit in the addend of branch relocations
Correct a problem with the ISA bit being stripped from the addend of
compressed branch relocations, affecting RELA targets. It has been
there since microMIPS support has been added, with:
commit
df58fc944dbc6d5efd8d3826241b64b6af22f447
Author: Richard Sandiford <rdsandiford@googlemail.com>
Date: Sun Jul 24 14:20:15 2011 +0000
<https://sourceware.org/ml/binutils/2011-07/msg00198.html>, ("MIPS:
microMIPS ASE support") and R_MICROMIPS_PC7_S1, R_MICROMIPS_PC10_S1 and
R_MICROMIPS_PC16_S1 relocations originally affected, and the
R_MIPS16_PC16_S1 relocation recently added with commit
c9775dde3277
("MIPS16: Add R_MIPS16_PC16_S1 branch relocation support") actually
triggering a linker error, due to its heightened processing strictness
level:
$ cat test.s
.text
.set mips16
foo:
b bar
.set bar, 0x1235
.align 4, 0
$ as -EB -n32 -o test.o test.s
$ objdump -dr test.o
test.o: file format elf32-ntradbigmips
Disassembly of section .text:
00000000 <foo>:
0: f000 1000 b 4 <foo+0x4>
0: R_MIPS16_PC16_S1 *ABS*+0x1230
...
$ ld -melf32btsmipn32 -Ttext 0 -e 0 -o test test.o
test.o: In function `foo':
(.text+0x0): Branch to a non-instruction-aligned address
$
This is because the ISA bit of the branch target does not match the ISA
bit of the referring branch, hardwired to 1 of course.
Retain the ISA bit then, so that the linker knows this is really MIPS16
code referred:
$ objdump -dr fixed.o
fixed.o: file format elf32-ntradbigmips
Disassembly of section .text:
00000000 <foo>:
0: f000 1000 b 4 <foo+0x4>
0: R_MIPS16_PC16_S1 *ABS*+0x1231
...
$ ld -melf32btsmipn32 -Ttext 0 -e 0 -o fixed fixed.o
$
Add a set of MIPS16 tests to cover the relevant cases, excluding linker
tests though which would overflow the in-place addend on REL targets and
use them as dump patterns for RELA targets only.
gas/
* config/tc-mips.c (md_apply_fix) <BFD_RELOC_MIPS16_16_PCREL_S1>
<BFD_RELOC_MICROMIPS_7_PCREL_S1, BFD_RELOC_MICROMIPS_10_PCREL_S1>
<BFD_RELOC_MICROMIPS_16_PCREL_S1>: Keep the ISA bit in the
addend calculated.
* testsuite/gas/mips/mips16-branch-absolute.s: Set the ISA bit
in `bar', export `foo'.
* testsuite/gas/mips/mips16-branch-absolute.d: Adjust
accordingly.
* testsuite/gas/mips/mips16-branch-absolute-n32.d: Likewise.
* testsuite/gas/mips/mips16-branch-absolute-n64.d: Likewise.
* testsuite/gas/mips/mips16-branch-absolute-addend-n32.d:
Likewise.
* testsuite/gas/mips/mips16-branch-absolute-addend-n64.d:
Likewise.
ld/
* testsuite/ld-mips-elf/mips16-branch-absolute.d: New test.
* testsuite/ld-mips-elf/mips16-branch-absolute-n32.d: New test.
* testsuite/ld-mips-elf/mips16-branch-absolute-n64.d: New test.
* testsuite/ld-mips-elf/mips16-branch-absolute-addend.d: New
test.
* testsuite/ld-mips-elf/mips16-branch-absolute-addend-n32.d: New
test.
* testsuite/ld-mips-elf/mips16-branch-absolute-addend-n64.d: New
test.
* testsuite/ld-mips-elf/mips-elf.exp: Run the new tests, except
from `mips16-branch-absolute' and
`mips16-branch-absolute-addend', referred indirectly only.
Maciej W. Rozycki [Tue, 12 Jul 2016 00:30:01 +0000 (01:30 +0100)]
BFD: Let targets handle relocations against absolute symbols
Fix a generic BFD issue with relocations against absolute symbols, which
are installed without using any individual relocation handler provided
by the backend. This causes any absolute section's addend to be lost on
REL targets such as o32 MIPS, and also relocation-specific calculation
adjustments are not made.
As an example assembling this program:
$ cat test.s
.text
foo:
b bar
b baz
.set bar, 0x1234
$ as -EB -32 -o test-o32.o test.s
$ as -EB -n32 -o test-n32.o test.s
produces this binary code:
$ objdump -dr test-o32.o test-n32.o
test-o32.o: file format elf32-tradbigmips
Disassembly of section .text:
00000000 <foo>:
0:
10000000 b 4 <foo+0x4>
0: R_MIPS_PC16 *ABS*
4:
00000000 nop
8:
1000ffff b 8 <foo+0x8>
8: R_MIPS_PC16 baz
c:
00000000 nop
test-n32.o: file format elf32-ntradbigmips
Disassembly of section .text:
00000000 <foo>:
0:
10000000 b 4 <foo+0x4>
0: R_MIPS_PC16 *ABS*+0x1230
4:
00000000 nop
8:
10000000 b c <foo+0xc>
8: R_MIPS_PC16 baz-0x4
c:
00000000 nop
$
where it is clearly visible in `test-o32.o', which uses REL relocations,
that the absolute section's addend equivalent to the value of `bar' -- a
reference to which cannot be fully resolved at the assembly time,
because the reference is PC-relative -- has been lost, as has been the
relocation-specific adjustment of -4, required to take into account the
PC+4-relative calculation made by hardware with branches and seen in the
external symbol reference to `baz' as the `ffff' addend encoded in the
instruction word. In `test-n32.o', which uses RELA relocations, the
absolute section's addend has been correctly retained.
Give precedence then in `bfd_perform_relocation' and
`bfd_install_relocation' to any individual relocation handler the
backend selected may have provided, while still resorting to the generic
calculation otherwise. This retains the semantics which we've had since
forever or before the beginning of our repository history, and is at the
very least compatible with `bfd_elf_generic_reloc' being used as the
handler.
Retain the `bfd_is_und_section' check unchanged at the beginning of
`bfd_perform_relocation' since this does not affect the semantics of the
function. The check returns the same `bfd_reloc_undefined' code the
check for a null `howto' does, so swapping the two does not matter.
Also the check is is mutually exclusive with the `bfd_is_abs_section'
check, since a section cannot be absolute and undefined both at once, so
swapping the two does not matter either.
With this change applied the program quoted above now has the in-place
addend correctly calculated and installed in the field being relocated:
$ objdump -dr fixed-o32.o
fixed-o32.o: file format elf32-tradbigmips
Disassembly of section .text:
00000000 <foo>:
0:
1000048c b 1234 <bar>
0: R_MIPS_PC16 *ABS*
4:
00000000 nop
8:
1000ffff b 8 <foo+0x8>
8: R_MIPS_PC16 baz
c:
00000000 nop
$
Add a set of MIPS tests to cover the relevant cases, including absolute
symbols with addends, and verifying that PC-relative relocations against
symbols concerned resolve to the same value in the final link regardless
of whether the REL or the RELA relocation form is used. Exclude linker
tests though which would overflow the in-place addend on REL targets and
use them as dump patterns for RELA targets only.
bfd/
* reloc.c (bfd_perform_relocation): Try the `howto' handler
first with relocations against absolute symbols.
(bfd_install_relocation): Likewise.
gas/
* testsuite/gas/mips/mips16-branch-absolute.d: Update patterns.
* testsuite/gas/mips/branch-absolute.d: New test.
* testsuite/gas/mips/branch-absolute-n32.d: New test.
* testsuite/gas/mips/branch-absolute-n64.d: New test.
* testsuite/gas/mips/branch-absolute-addend-n32.d: New test.
* testsuite/gas/mips/branch-absolute-addend-n64.d: New test.
* testsuite/gas/mips/mips16-branch-absolute-n32.d: New test.
* testsuite/gas/mips/mips16-branch-absolute-n64.d: New test.
* testsuite/gas/mips/mips16-branch-absolute-addend-n32.d: New
test.
* testsuite/gas/mips/mips16-branch-absolute-addend-n64.d: New
test.
* testsuite/gas/mips/micromips-branch-absolute.d: New test.
* testsuite/gas/mips/micromips-branch-absolute-n32.d: New test.
* testsuite/gas/mips/micromips-branch-absolute-n64.d: New test.
* testsuite/gas/mips/micromips-branch-absolute-addend-n32.d: New
test.
* testsuite/gas/mips/micromips-branch-absolute-addend-n64.d: New
test.
* testsuite/gas/mips/branch-absolute.s: New test source.
* testsuite/gas/mips/branch-absolute-addend.s: New test source.
* testsuite/gas/mips/mips16-branch-absolute-addend.s: New test
source.
* testsuite/gas/mips/micromips-branch-absolute.s: New test
source.
* testsuite/gas/mips/micromips-branch-absolute-addend.s: New
test source.
* testsuite/gas/mips/mips.exp: Run the new tests.
ld/
* testsuite/ld-mips-elf/branch-absolute.d: New test.
* testsuite/ld-mips-elf/branch-absolute-n32.d: New test.
* testsuite/ld-mips-elf/branch-absolute-n64.d: New test.
* testsuite/ld-mips-elf/branch-absolute-addend.d: New test.
* testsuite/ld-mips-elf/branch-absolute-addend-n32.d: New test.
* testsuite/ld-mips-elf/branch-absolute-addend-n64.d: New test.
* testsuite/ld-mips-elf/micromips-branch-absolute.d: New test.
* testsuite/ld-mips-elf/micromips-branch-absolute-n32.d: New
test.
* testsuite/ld-mips-elf/micromips-branch-absolute-n64.d: New
test.
* testsuite/ld-mips-elf/micromips-branch-absolute-addend.d: New
test.
* testsuite/ld-mips-elf/micromips-branch-absolute-addend-n32.d:
New test.
* testsuite/ld-mips-elf/micromips-branch-absolute-addend-n64.d:
New test.
* testsuite/ld-mips-elf/mips-elf.exp: Run the new tests, except
from `branch-absolute-addend' and
`micromips-branch-absolute-addend', referred indirectly only.
Tom Tromey [Thu, 14 Jul 2016 17:50:55 +0000 (11:50 -0600)]
Add missing newline to py-breakpoint.c
In https://sourceware.org/ml/gdb-patches/2016-07/msg00152.html,
Yao noted that a patch of mine was missing a newline.
I thought I had fixed this but when looking today I realized it was
not fixed. This patch adds it.
I'm checking this in as obvious.
2016-07-14 Tom Tromey <tom@tromey.com>
* python/py-breakpoint.c (gdbpy_breakpoint_deleted): Add missing
newline.
Tom Tromey [Mon, 6 Jun 2016 20:18:30 +0000 (14:18 -0600)]
Remove unused variables
This patch removes set-but-unused variables. This holds all the
removals I consider to be simple and relatively uncontroversial.
2016-07-14 Tom Tromey <tom@tromey.com>
* mips-tdep.c (micromips_scan_prologue): Remove "frame_addr".
(mips_o32_push_dummy_call): Remove "stack_used_p".
* aarch64-tdep.c (aarch64_record_data_proc_imm): Remove
"insn_bit28".
* rust-lang.c (rust_print_type): Remove "len".
* rust-exp.y (super_name): Remove "current_len".
* python/py-framefilter.c (py_print_type): Remove "type".
* mdebugread.c (parse_partial_symbols): Remove
"past_first_source_file".
<N_SO>: Remove "valu", "first_so_symnum", "prev_textlow_not_set".
* m2-valprint.c (m2_print_unbounded_array): Remove
"content_type".
(m2_val_print): Remove "i".
* linespec.c (unexpected_linespec_error): Remove "cleanup".
* f-valprint.c (f_val_print): Remove "i".
* elfread.c (elf_symtab_read): Remove "offset".
* dwarf2-frame.c (dwarf2_fetch_cfa_info): Remove "addr_size".
* jit.c (jit_dealloc_cache): Remove "i" and "frame_arch".
Tom Tromey [Mon, 6 Jun 2016 20:18:23 +0000 (14:18 -0600)]
Remove some variables but call functions for side effects
This patch consolidates the (possibly-questionable) spots where we
remove a declaration but continue to call some function for side
effects. In a couple of cases it wasn't entirely clear to me that
this mattered; and in some other cases it might be more aesthetically
pleasing to use ATTRIBUTE_UNUSED. So, I broke this out into a
separate patch for simpler review.
2016-07-14 Tom Tromey <tom@tromey.com>
* arch-utils.c (default_skip_permanent_breakpoint): Remove
"bp_insn".
* disasm.c (do_assembly_only): Remove "num_displayed".
* dwarf2read.c (read_abbrev_offset): Remove "length".
(dwarf_decode_macro_bytes) <DW_MACINFO_vendor_ext>: Remove
"constant".
* m32c-tdep.c (make_regs): Remove "r2hl", "r3hl", and "intbhl".
* microblaze-tdep.c (microblaze_frame_cache): Remove "func".
* tracefile.c (trace_save): Remove "status".
Tom Tromey [Mon, 6 Jun 2016 19:45:59 +0000 (13:45 -0600)]
Remove some unused overlay code
This patch removes some unneeded initializations in overlay code in
symfile.c. It also deletes some old commented-out code.
2016-07-14 Tom Tromey <tom@tromey.com>
* symfile.c (simple_overlay_update_1): Remove initialization
of "size", and commented-out code.
(simple_overlay_update): Likewise.
Tom Tromey [Tue, 28 Jun 2016 20:25:49 +0000 (14:25 -0600)]
Use getcurx in curses code
As suggested by Pedro, this changes a few spots to use getcurx, rather
than getyx. This avoids some unused variable warnings.
2016-07-14 Tom Tromey <tom@tromey.com>
* tui/tui-winsource.c (tui_show_source_line): Use getcurx.
* tui/tui-io.c (tui_puts): Use getcurx.
(tui_redisplay_readline): Likewise.
Tom Tromey [Mon, 6 Jun 2016 19:43:50 +0000 (13:43 -0600)]
Add one use of ATTRIBUTE_UNUSED
One spot needed ATTRIBUTE_UNUSED to cope with the new warnings.
The case in inflow.c is just a mass of ifdefs; and while the only use
of "result" is guarded by "#if 0", I thought it simplest to leave it
all in place.
2016-07-14 Tom Tromey <tom@tromey.com>
* inflow.c (child_terminal_ours_1): Use ATTRIBUTE_UNUSED.
Tom Tromey [Mon, 6 Jun 2016 19:01:52 +0000 (13:01 -0600)]
Change reopen_exec_file to check result of stat
This seems to be a real bug found by -Wunused-but-set-variable. If
"stat" fails for some reason, gdb would use the uninitialized "st".
2016-07-14 Tom Tromey <tom@tromey.com>
* corefile.c (reopen_exec_file): Only examine st.st_mtime if stat
succeeded.
Andrew Burgess [Fri, 21 Aug 2015 19:08:26 +0000 (20:08 +0100)]
objcopy/strip: Add option --remove-relocations=SECTIONPATTERN
The objcopy and strip tools make use of the bfd library to manipulate
the state of the input file (to produce an output file). Within the
input file (for ELF at least), relocations are held within a section,
and so, if the user wanted to remove the relocations, but keep the
section to which the relocations would have been applied, it is tempting
to think that specifying the name of a relocation section to objcopy's
--remove-section option might do what you want, for example:
objcopy --remove-section=.rela.text input.elf output.elf
However, this does not work. The reason is that when the input file is
loaded, relocations are not managed as sections, but are, instead,
loaded as data associated with the section to which the relocations
would be applied. In our example above the relocations in '.rela.text'
are held as data on the section '.text' once 'input.elf' is loaded.
One task that objcopy and strip do is copy the relocations from the
input file to the output file if the section is also being copied from
the input file to the output file.
This commit adds a new command line option for objcopy and strip,
--remove-relocations, which can be used to remove the relocations, while
keeping the section that the relocations would have been applied to, for
example:
objcopy --remove-relocations=.text input.elf output.elf
in this case the section '.text' will appear in both 'input.elf' and
'output.elf', but any relocations in 'input.elf' that apply to '.text'
will not be present in 'output.elf'.
I have also added a special case to the handling of --remove-section
that spots if a user tries to remove a relocation section (currently
this is done by spotting the '.rela.' or '.rel.' prefix) and forwards
the request to --remove-relocations.
As with --remove-section and --only-section the --remove-relocations
option supports the '!' prefix on the section-patterns it takes to allow
for sections to be specifically not matched.
There are tests for all the new functionality.
binutils/ChangeLog:
* doc/binutils.texi (objcopy): Document 'remove-relocations'.
(strip): Likewise.
* objcopy.c (SECTION_CONTEXT_REMOVE_RELOCS): Define.
(enum command_line_switch): Add 'OPTION_REMOVE_RELOCS'.
(struct option strip_options): Add 'remove-relocations'.
(struct option copy_options): Likewise.
(copy_usage): Likewise.
(strip_usage): Likewise.
(handle_remove_relocations_option): New function.
(discard_relocations): New function.
(handle_remove_section_option): New function.
(copy_relocations_in_section): Use discard_relocations.
(strip_main): Use handle_remove_section_option for
'remove-section', and handle 'remove-relocations' option.
(copy_main): Likewise.
* testsuite/binutils-all/objcopy.exp: Run new tests.
* testsuite/binutils-all/remove-relocs-01.d: New file.
* testsuite/binutils-all/remove-relocs-01.s: New file.
* testsuite/binutils-all/remove-relocs-02.d: New file.
* testsuite/binutils-all/remove-relocs-03.d: New file.
* testsuite/binutils-all/remove-relocs-04.d: New file.
* testsuite/binutils-all/remove-relocs-05.d: New file.
* testsuite/binutils-all/remove-relocs-06.d: New file.
Andrew Burgess [Mon, 24 Aug 2015 12:02:39 +0000 (13:02 +0100)]
objcopy/strip: Allow section patterns starting with '!'.
For symbol matching, prefixing a pattern with '!' will indicate a
non-matching pattern, however, this is not the case for section
patterns. As a result it is not possible to say "apply this action to
all sections except ...".
With this commit the objcopy and strip tools now support '!' prefix for
section patterns, so we can say:
objcopy --remove-section="*" --remove-section="!.text*"
Which will remove all sections, except those matching the pattern
'.text*'.
binutils/ChangeLog:
* objcopy.c (find_section_list): Handle section patterns starting
with '!' being a non-matching pattern.
* doc/binutils.texi (objcopy): Give example of using '!' with
--remove-section and --only-section.
(strip): Give example of using '!' with --remove-section.
* testsuite/binutils-all/data-sections.s: New file.
* testsuite/binutils-all/only-section-01.d: New file.
* testsuite/binutils-all/remove-section-01.d: New file.
* testsuite/binutils-all/objcopy.exp: Run new tests.
* NEWS: Mention new feature.
Nick Clifton [Thu, 14 Jul 2016 09:38:07 +0000 (10:38 +0100)]
Small improvements to the ARM simulator to cope with illegal binaries.
* armemu.c (Multiply64): Only issue error messages about invalid
arguments if debugging is enabled.
* armos.c (ARMul_OSHandleSWI): Ignore invalid flags.
Claudiu Zissulescu [Fri, 8 Jul 2016 09:55:49 +0000 (11:55 +0200)]
[ARC] Fix/improve small data support.
The R_ARC_SDA32 is wrongly described as a ME relocation, fix it. Offset the
__SDATA_BEGIN__ to take advantage of the signed 9-bit field of the
load/store instructions.
include/
2016-07-08 Claudiu Zissulescu <claziss@synopsys.com>
* elf/arc-reloc.def (ARC_SDA32): Don't use ME transformation.
ld/
2016-07-08 Claudiu Zissulescu <claziss@synopsys.com>
* emulparams/arcelf.sh (SDATA_START_SYMBOLS): Add offset.
* testsuite/ld-arc/sda-relocs.dd: New file.
* testsuite/ld-arc/sda-relocs.ld: Likewise.
* testsuite/ld-arc/sda-relocs.rd: Likewise.
* testsuite/ld-arc/sda-relocs.s: Likewise.
* testsuite/ld-arc/arc.exp: Add SDA tests.
GDB Administrator [Thu, 14 Jul 2016 00:00:24 +0000 (00:00 +0000)]
Automatic date update in version.in
Tom Tromey [Tue, 5 May 2015 03:49:11 +0000 (21:49 -0600)]
PR python/15620, PR python/18620 - breakpoint events in Python
This patch adds some breakpoint events to Python. In particular,
there is a creation event that is emitted when a breakpoint is
created; a modification event that is emitted when a breakpoint
changes somehow; and a deletion event that is emitted when a
breakpoint is deleted.
In this patch, the event's payload is the breakpoint itself. I
considered making a new event type to hold the breakpoint, but I
didn't see a need. Still, I thought I would mention this as a spot
where some other choice is possible.
Built and regtested on x86-64 Fedora 23.
2016-07-13 Tom Tromey <tom@tromey.com>
PR python/15620, PR python/18620:
* python/py-evts.c (gdbpy_initialize_py_events): Call
add_new_registry for new events.
* python/py-events.h (events_object) <breakpoint_created,
breakpoint_deleted, breakpoint_modified>: New fields.
* python/py-breakpoint.c (gdbpy_breakpoint_created): Emit the
breakpoint changed event.
(gdbpy_breakpoint_deleted): Emit the breakpoint deleted event.
(gdbpy_breakpoint_modified): New function.
(gdbpy_initialize_breakpoints): Attach to the breakpoint modified
observer.
2016-07-13 Tom Tromey <tom@tromey.com>
PR python/15620, PR python/18620:
* python.texi (Events In Python): Document new breakpoint events.
2016-07-13 Tom Tromey <tom@tromey.com>
PR python/15620, PR python/18620:
* gdb.python/py-breakpoint.exp (connect_event, check_last_event)
(test_bkpt_events): New procs.
Tom Tromey [Thu, 19 May 2016 21:51:00 +0000 (15:51 -0600)]
PR python/17698 - add Breakpoint.pending
This patch adds a "pending" attribute to gdb.Breakpoint.
Built and regtested on x86-64 Fedora 23.
2016-07-13 Tom Tromey <tom@tromey.com>
PR python/17698:
* NEWS: Update.
* python/py-breakpoint.c (bppy_get_pending): New function.
(breakpoint_object_getset): Add entry for "pending".
* breakpoint.h (pending_breakpoint_p): Declare.
* breakpoint.c (pending_breakpoint_p): New function.
2016-07-13 Tom Tromey <tom@tromey.com>
PR python/17698:
* python.texi (Breakpoints In Python): Document
Breakpoint.pending.
2016-07-13 Tom Tromey <tom@tromey.com>
PR python/17698:
* gdb.python/py-breakpoint.exp (test_bkpt_basic): Add "pending"
test.
(test_watchpoints): Likewise.
(test_bkpt_pending): New proc.
Tom Tromey [Thu, 19 May 2016 21:52:52 +0000 (15:52 -0600)]
use user_breakpoint_p in python code
I noticed that bppy_get_visibility and gdbpy_breakpoint_created
implemented their own visibility checks, but subtly different from
user_breakpoint_p. I think the latter is more correct, and so changed
the Python code to use it.
I suspect there isn't a decent way to test this, so no new test.
Built and regtested on x86-64 Fedora 23.
2016-07-13 Tom Tromey <tom@tromey.com>
* python/py-breakpoint.c (bppy_get_visibility)
(gdbpy_breakpoint_created): Use user_breakpoint_p.
Tom Tromey [Thu, 19 May 2016 21:40:54 +0000 (15:40 -0600)]
Rearrange Python breakpoint node in documentation
I noticed that the Python breakpoint documentation was ordered a bit
oddly. It documented the constructor; then the stop method; then the
watchpoint constants (used for the constructor); then various other
methods and attributes; then the other constants used by the
constructor; and then finally some more methods and attributes.
This patch rearranges the node a little to move the constants to just
after the constructor and before the other methods and attributes.
2016-07-13 Tom Tromey <tom@tromey.com>
* python.texi (Breakpoints In Python): Move table of types and
table of watchpoint types earlier in node.
Tom Tromey [Mon, 2 Mar 2015 03:33:00 +0000 (20:33 -0700)]
Fix PR cli/18053
PR cli/18053 concerns a couple of minor bugs in the JIT debuginfo
support. First, jit-reader-load should use filename completion and
support tilde expansion. Second, the help for jit-reader-unload is
incorrect. While working on this I also realized that
jit-reader-unload should use the no-op completer, so I've included
that as well.
Built and regtested on x86-64 Fedora 23. A completer test for
jit-reader-load is included, but not a tilde-expansion test, as I
couldn't think of a reliable way to test that.
2016-07-13 Tom Tromey <tom@tromey.com>
PR cli/18053:
* jit.c (jit_reader_load_command): Use tilde_expand.
(_initialize_jit): Fix help for jit-reader-unload. Set completer
for new commands.
2016-07-13 Tom Tromey <tom@tromey.com>
PR cli/18053:
* gdb.base/jit-so.exp (one_jit_test): Add jit-reader-load
completion test.
Maciej W. Rozycki [Fri, 8 Jul 2016 15:07:39 +0000 (16:07 +0100)]
MIPS/opcodes: Address issues with NAL disassembly
Address issues with the disassembly of the NAL assembly idiom and R6
instruction introduced with commit
7361da2c952e ("Add support for MIPS
R6.") and then further tweaked with commit
b9121b573e2e ("Add in a JALRC
alias and fix the NAL instruction."). As from R6 this instruction has
replaced the encoding of `bltzal $0, . + 4' as the solely supported form
of the former BLTZAL instruction for the regular MIPS ISA.
The instruction is marked as an alias only in our regular MIPS opcode
table, making it fail to disassemble in R6 code if the `no-aliases'
machine option has been passed to `objdump':
$ cat test.s
.text
foo:
nal
$ as -mips64r6 -o test.o test.s
$ objdump -dr --prefix-addresses --show-raw-insn -M no-aliases test.o
nal.o: file format elf32-tradbigmips
Disassembly of section .text:
00000000 <foo>
04100000 0x4100000
...
$
This is because the `bltzal' entry has been marked as pre-R6 only in the
opcode table and there is no other opcode pattern to match.
Additionally the changes referred made NAL replace the equivalent
`bltzal $0, . + 4' instruction in disassembly, unless the `no-aliases'
machine option has been used, in legacy code. Seeing NAL, especially in
its updated form lacking the branch target argument, in the disassembly
of such code may be confusing to people. This is because unlike with
EHB only used in R2 and newer code -- the machine encoding of which we
anyway always disassemble to its corresponding current architecture's
mnemonic rather than its legacy meaning of `sll $0, $0, 3' -- BLTZAL has
been indeed used in legacy code. Even though `bltzal $0, . + 8' and its
machine code encoding (0x04100001) -- which is not equivalent to NAL and
still disassembles as BLTZAL -- has been the predominant form as opposed
to NAL's `bltzal $0, . + 4' (0x04100000), it makes sense to always keep
the old form in disassembly, while still accepting `nal' in assembly.
Remove the alias marking then from the the `nal' instruction pattern,
making it always match for R6 code, even with the `no-aliases' option.
And move the entry beyond the `bltzal' entry, making the latter one take
precedence for legacy binary code, while letting the former still match
any `nal' mnemonic in source code assembled for a legacy target.
Add a suitable test case to the GAS test suite. While the change
affects the disassembler more than the assembler, so placing the test
case in the binutils test suite might be more appropriate, the intent is
also to verify that `nal' is still accepted by GAS for legacy targets,
plus we have test infrastructure available in the GAS test suite for
automatic multiple ISA level testing, which we lack from the binutils
framework.
opcodes/
* mips-opc.c (mips_builtin_opcodes): Remove the INSN2_ALIAS
annotation from the "nal" entry and reorder it beyond "bltzal".
gas/
* testsuite/gas/mips/nal-1.d: New test.
* testsuite/gas/mips/mipsr6@nal-1.d: New test.
* testsuite/gas/mips/nal-2.d: New test.
* testsuite/gas/mips/mipsr6@nal-2.d: New test.
* testsuite/gas/mips/nal.s: New test source.
* testsuite/gas/mips/mips.exp: Run the new tests.
Maciej W. Rozycki [Wed, 13 Jul 2016 16:31:17 +0000 (17:31 +0100)]
MIPS/GAS: Remove extraneous `install_insn' call from `append_insn' (CL)
Add missing ChangeLog entry for commit
b8bca85b334b ("MIPS/GAS: Remove
extraneous `install_insn' call from `append_insn'").
Jose E. Marchesi [Wed, 13 Jul 2016 08:42:28 +0000 (01:42 -0700)]
opcodes,gas: support for the ldtxa SPARC instructions.
This patch adds support for the LDTXA instructions, along with the
corresponding ASIs. Tests for GAS are included.
opcodes/ChangeLog:
2016-07-12 Jose E. Marchesi <jose.marchesi@oracle.com>
* sparc-opc.c (ldtxa): New macro.
(sparc_opcodes): Use the macro defined above to add entries for
the LDTXA instructions.
(asi_table): Add the ASI_TWINX_* asis used in the LDTXA
instruction.
gas/ChangeLog:
2016-07-12 Jose E. Marchesi <jose.marchesi@oracle.com>
* testsuite/gas/sparc/ldtxa.s: New file.
* testsuite/gas/sparc/ldtxa.d: Likewise.
* testsuite/gas/sparc/sparc.exp: Execute the ldtxa test.
Jan Kratochvil [Wed, 13 Jul 2016 11:58:19 +0000 (13:58 +0200)]
[ppc64] Fix for function descriptors
Marin Cermak has found various testcases (or one of them) of GDB FAIL on
ppc64.
https://sourceware.org/bugzilla/show_bug.cgi?id=20328
.o contained only the function descriptor address.
The DWARF as produced by Tcl Dwarf::assemble:
<1><27>: Abbrev Number: 4 (DW_TAG_subprogram)
<28> DW_AT_name : main
<2d> DW_AT_external : 1
<2e> DW_AT_low_pc : 0x1001ff98
<36> DW_AT_high_pc : 0x1002ff98
<2><3e>: Abbrev Number: 5 (DW_TAG_lexical_block)
Runtime info:
$2 = {<text variable, no debug info>} 0x10000674 <.main>
$3 = {void ()} 0x1001ff98 <main>
On Tue, 12 Jul 2016 15:22:49 +0200, Ulrich Weigand wrote:
Well, most of the gdb.dwarf2 test cases simply use explicitly placed labels
for the DW_AT_low_pc / DW_AT_high_pc attributes.
See e.g. dw2-unresolved-main.c:
asm (".globl cu_text_start");
asm ("cu_text_start:");
On Wed, 13 Jul 2016 10:54:00 +0200, Jan Kratochvil wrote:
Now I see I should not do that because:
lib/dwarf.exp:
proc function_range { func src } {
So I am providing this patch.
gdb/testsuite/ChangeLog
2016-07-13 Jan Kratochvil <jan.kratochvil@redhat.com>
* gdb.dwarf2/atomic-type.exp: Use function_range for low_pc and high_pc.
* gdb.dwarf2/atomic.c (f): Rename f_end_lbl to f_label.
* gdb.dwarf2/dw2-bad-mips-linkage-name.c (f): Rename f_end_lbl to
f_label.
(g): Rename g_end_lbl to g_label.
* gdb.dwarf2/dw2-bad-mips-linkage-name.exp: Use function_range for
low_pc and high_pc.
* gdb.dwarf2/dw2-lexical-block-bare.exp: Likewise.
GDB Administrator [Wed, 13 Jul 2016 00:00:19 +0000 (00:00 +0000)]
Automatic date update in version.in
H.J. Lu [Tue, 12 Jul 2016 22:33:47 +0000 (15:33 -0700)]
Align x86-64 .got/.got.plt sections to 8 bytes
Align x86-64 .got and .got.plt sections to their entry size.
* elf64-x86-64.c (elf_x86_64_create_dynamic_sections): Align
.got/.got.plt sections to 8 bytes.
Tom Tromey [Thu, 9 Jun 2016 21:20:09 +0000 (15:20 -0600)]
PR python/19293 - invalidate frame cache when unwinders change
PR python/19293 notes that when a Python unwinder is disabled, the
frame cache is not invalidated. This means that disabling an unwinder
doesn't have any immediate effect -- but in my experience it's often
the case that I want to enable or disable an unwinder in order to see
what happens.
This patch adds a new gdb.invalidate_cached_frames function and
arranges for the relevant bits of library code to call it. I've only
partially documented this function, considering a warning sufficient
without going into all the reasons ordinary code should not call it.
The name of the new function was taken from a comment in frame.h next
to reinit_frame_cache.
No new test as I think the updates to the existing test are sufficient
to show that the code is working as intended.
Built and regtested on x86-64 Fedora 23.
2016-07-12 Tom Tromey <tom@tromey.com>
PR python/19293:
* python/lib/gdb/command/unwinders.py (do_enable_unwinder): Call
gdb.invalidate_cached_frames.
* python/lib/gdb/unwinder.py (register_unwinder): Call
gdb.invalidate_cached_frames.
* python/python.c (gdbpy_invalidate_cached_frames): New function.
(python_GdbMethods): Add entry for invalidate_cached_frames.
2016-07-12 Tom Tromey <tom@tromey.com>
PR python/19293:
* python.texi (Frames In Python): Document
gdb.invalidate_cached_frames.
2016-07-12 Tom Tromey <tom@tromey.com>
PR python/19293:
* gdb.python/py-unwind-maint.exp: Update tests.
Nick Clifton [Tue, 12 Jul 2016 14:46:02 +0000 (15:46 +0100)]
Second fix for grammar in error message.
* binary.c (binary_set_section_contents): Second grammar fix.
Yao Qi [Tue, 12 Jul 2016 14:39:34 +0000 (15:39 +0100)]
Match the selftest output when captured_main is inlined
In gdb.gdb/observer.exp, I see the following fail,
(gdb) break captured_main^M
Breakpoint 1 at 0x57e409: file ../../binutils-gdb/gdb/main.c, line 492.^M
(gdb) PASS: gdb.gdb/observer.exp: breakpoint in captured_main
run -nw -nx -data-directory /home/yao.qi/SourceCode/gnu/build/gdb/testsuite/../data-directory^M
Starting program: /home/yao.qi/SourceCode/gnu/build/gdb/testsuite/outputs/gdb.gdb/observer/xgdb -nw -nx -data-directory /home/yao.qi/SourceCode/gnu/build/gdb/testsuite/../data-directory^M
[Thread debugging using libthread_db enabled]^M
Using host libthread_db library "/lib/x86_64-linux-gnu/libthread_db.so.1".^M
^M
Breakpoint 1, gdb_main (args=args@entry=0x7fffffffdca0) at ../../binutils-gdb/gdb/main.c:1157^M
1157 captured_main (args);^M
(gdb) FAIL: gdb.gdb/observer.exp: run until breakpoint at captured_main
looks the test sets breakpoint on captured_main, and expects program
stops at captured_main. However, program stops at the place where
captured_main is called, because captured_main is inlined,
<1><8519e3>: Abbrev Number: 58 (DW_TAG_subprogram)
<8519e4> DW_AT_name : (indirect string, offset: 0x880d3): captured_main
<8519e8> DW_AT_decl_file : 1
<8519e9> DW_AT_decl_line : 444
<8519eb> DW_AT_type : <0x846e48>
<8519ef> DW_AT_inline : 1 (inlined)
<8519f0> DW_AT_sibling : <0x851c01>
The test passes if I build GDB with '-O0 -g3', because captured_main
isn't inlined. This patch is to match the output when captured_main
is inlined.
gdb/testsuite:
2016-07-12 Yao Qi <yao.qi@linaro.org>
* lib/selftest-support.exp (selftest_setup): Match the output
when captured_main is inlined.
Chung-Lin Tang [Tue, 12 Jul 2016 13:02:14 +0000 (06:02 -0700)]
Add type casts to allow C++ compile.
gdb/gdbserver/
* linux-nios2-low.c (nios2_fill_gregset): Add type cast
to buf parameter.
(nios2_store_gregset): Likewise.
Douglas B Rupp [Tue, 12 Jul 2016 10:05:13 +0000 (11:05 +0100)]
Fix grammar in error message.
* binary.c (binary_set_section_contents): Fix grammar in warning
message.
GDB Administrator [Tue, 12 Jul 2016 00:00:19 +0000 (00:00 +0000)]
Automatic date update in version.in
Claudiu Zissulescu [Mon, 11 Jul 2016 13:41:23 +0000 (15:41 +0200)]
[ARC] Update test.
ld/
2016-07-11 Claudiu Zissulescu <claziss@synopsys.com>
* testsuite/ld-arc/nps-1b.err: Update test to handle more
verbosity.
Claudiu Zissulescu [Thu, 30 Jun 2016 13:11:57 +0000 (15:11 +0200)]
TLS: DTPOFF can accept offsets, stored into addendum. Remove the need of base
gas/ChangeLog:
2016-07-05 Claudiu Zissulescu <claziss@synopsys.com>
* config/tc-arc.c (arc_reloc_op_tag): Allow complex ops for dtpoff.
(tc_gen_reloc): Remove passing DTPOFF base info into reloc addendum as it is
no longer needed.
Signed-off-by: Claudiu Zissulescu <claziss@synopsys.com>
Cupertino Miranda [Thu, 23 Jun 2016 09:38:30 +0000 (11:38 +0200)]
Enable relocation overflow messages by default.
bfd/ChangeLog:
2016-06-23 Cupertino Miranda <cmiranda@synopsys.com>
elf32-arc.c: made PR_DEBUG always defined.
Signed-off-by: Claudiu Zissulescu <claziss@synopsys.com>
Cupertino Miranda [Tue, 14 Jun 2016 20:55:44 +0000 (22:55 +0200)]
Fixes done to TLS.
TLS relocations did not support multiple TLS modes for the same
symbol in a single object file.
Refactored how GOT and TLS is implemented. Removed code duplications between
local and global symbols conditioning.
bfd/ChangeLog:
2016-06-14 Cupertino Miranda <cmiranda@synopsys.com>
* arc-got.h: Moved got related structures from elf32-arc.c to
this file. More precisely, tls_type_e, tls_got_entries, got_entry.
* (arc_get_local_got_ents,
got_entry_for_type,
new_got_entry_to_list,
tls_type_for_reloc,
symbol_has_entry_of_type,
get_got_entry_list_for_symbol,
arc_got_entry_type_for_reloc,
ADD_SYMBOL_REF_SEC_AND_RELOC,
arc_fill_got_info_for_reloc,
relocate_fix_got_relocs_for_got_info,
create_got_dynrelocs_for_single_entry,
create_got_dynrelocs_for_got_info): Added to file.
* elf32-arc.c: Removed GOT & TLS related structs and functions to
arc-got.h.
Signed-off-by: Claudiu Zissulescu <claziss@synopsys.com>
GDB Administrator [Mon, 11 Jul 2016 00:00:19 +0000 (00:00 +0000)]
Automatic date update in version.in
GDB Administrator [Sun, 10 Jul 2016 00:00:20 +0000 (00:00 +0000)]
Automatic date update in version.in
Alan Modra [Sat, 9 Jul 2016 04:55:31 +0000 (14:25 +0930)]
PR20337, Objdump makes poor choice of symbols
binutils/
PR binutils/20337
* objdump.c (compare_symbols): For ELF, sort same value/type
symbols according to size.
ld/
* testsuite/ld-powerpc/elfv2exe.d: Update.
GDB Administrator [Sat, 9 Jul 2016 00:00:21 +0000 (00:00 +0000)]
Automatic date update in version.in
jamesbowman [Fri, 8 Jul 2016 18:53:31 +0000 (11:53 -0700)]
FT32: Correct 32-bit reloc for BFD_RELOC_32
The reloc for BFD_RELOC_32 was using the the 20-bit. This hack causes
problems in gdb. Fixed it to be the proper 32-bit reloc, R_FT32_32.
bfd/ChangeLog:
* elf32-ft32.c (ft32_reloc_map): Use R_FT32_32 for BFD_RELOC_32.
jamesbowman [Fri, 8 Jul 2016 18:38:35 +0000 (11:38 -0700)]
FT32: adjust disassembly opcode match fields
Tighten up the opcode match fields for conditional jump and call
instructions so more general opcodes don't match them in disassembly.
opcodes/ChangeLog:
* opcodes/ft32-opc.c (ft32_opc_info): Correct mask for "callc"
and "jmpc".
Maciej W. Rozycki [Fri, 8 Jul 2016 13:37:46 +0000 (14:37 +0100)]
MIPS/GAS: Remove extraneous `install_insn' call from `append_insn'
Complement:
commit
1e91584932efd70020c8c98037d0cb93a0552a20
Author: Richard Sandiford <rdsandiford@googlemail.com>
Date: Wed Mar 9 09:17:02 2005 +0000
<https://sourceware.org/ml/binutils/2005-03/msg00217.html>, ("Rework
MIPS nop-insertion code, add -mfix-vr4130 [5/11]"), and remove a call to
`install_insn' from `append_insn', which as from that change has become
redundant. This is because such a call, to place an instruction's bit
pattern in output, is already made from `move_insn', called from
`add_relaxed_insn' or `add_fixed_insn' as appropriate, either of which
now always is and has to be made from `append_insn' before the repeated
call to `install_insn' is made. Previously the place where this second
invocation is made was the only one where the output stream was updated,
although the update was made inline rather than with a function call.
Remove the repeated call then, to reclaim some performance.
gas/
* config/tc-mips.c (append_insn): Remove extraneous
`install_insn' call.
GDB Administrator [Fri, 8 Jul 2016 00:00:20 +0000 (00:00 +0000)]
Automatic date update in version.in
Walfred Tedeschi [Thu, 7 Jul 2016 17:07:36 +0000 (19:07 +0200)]
[obv] Fix broken build on Fedora 23.
Compiler complains about possible utilization of "symbol" which is member
of lang_def.
Initialization was added.
2016-07-07 Walfred Tedeschi <walfred.tedeschi@intel.com>
gdb/ChangeLog:
* cp-namespace.c (cp_lookup_bare_symbol): Initialize
lang_this.symbol.
Walfred Tedeschi [Thu, 7 Jul 2016 15:33:05 +0000 (17:33 +0200)]
Fix of default lookup for "this" symbol.
Using the default lookup for the symbol "this" might lead to segmentation
fault in GDB.
Some languages, e.g. Fortran, use as default lookup routine the C++
routines.
For those languages "this" can be the instance of a class or even the
definition of a class.
When an instance of a class having the name "this" is evaluated
in GDB a segmentation fault was observed.
As example of the issue take into consideration the Fortran code:
type foo
real :: a
type(bar) :: x
character*7 :: b
end type foo
type(foo) :: this
Issue appears when evaluating the variable "this" in GDB.
Within the language definition structure there is a field that represents
the name of the special symbol used for the C++ "this" for the language
being described.
The fix presented here takes into account the aforementioned field. In the
case the aforementioned field is NULL "this" is not represented in the
language described and the lookup should return a null_block_symbol.
Tests: Performed tests with gfortran and ifort.
Reviewed:
https://sourceware.org/ml/gdb-patches/2016-04/msg00068.html
After the commited patch:
https://sourceware.org/ml/gdb-patches/2016-06/msg00364.html
Patch can be applied.
2016-06-16 Walfred Tedeschi <walfred.tedeschi@intel.com>
gdb/ChangeLog:
* cp-namespace.c (cp_lookup_bare_symbol): Use language passed as
parameter to look for the symbol "this".
gdb/testsuite/ChangeLog:
* gdb.fortran/derived-types.exp (result_line, result_line_2):
New variables.
(print this%a, print this%b, print this): New tests.
* gdb.fortran/derived-types.f90 (this): New object and
initialization.
jamesbowman [Thu, 7 Jul 2016 01:55:25 +0000 (18:55 -0700)]
FT32 linker script cleanup
Fix a typo (__PMSIZE was written as __PMSIZE_) and add section alignment
for DATA and BSS.
ld/ChangeLog:
* scripttempl/ft32.sc (__PMSIZE): Correct __PMSIZE_.
(DATA): add ALIGN.
(BSS): add ALIGN
GDB Administrator [Thu, 7 Jul 2016 00:00:21 +0000 (00:00 +0000)]
Automatic date update in version.in
Simon Marchi [Wed, 6 Jul 2016 14:18:10 +0000 (10:18 -0400)]
gdb.ada/arraydim.exp: Fix directory layout
I forgot to fix this one in the previous commit.
gdb/testsuite/ChangeLog:
* gdb.ada/arraydim.exp: Remove extra directory level in build
directory.
Simon Marchi [Wed, 6 Jul 2016 14:02:48 +0000 (10:02 -0400)]
Remove extra output directory level for Ada tests
The output of Ada tests create a layout where the test name
("formatted_ref" in this example) appears twice:
outputs
└── gdb.ada
└── formatted_ref
└── formatted_ref
├── b~formatted_ref.adb
├── b~formatted_ref.ads
├── b~formatted_ref.ali
├── b~formatted_ref.o
├── defs.ali
├── defs.o
├── formatted_ref
├── formatted_ref.ali
└── formatted_ref.o
This causes a problem when testing with the native-gdbserver board, when
the binary has the same name as the test. When gdb_remote_download is
called to upload the compiled binary, the implementation for
native-gdbserver copies it in the standard output directory (in
outputs/gdb.ada/formatted_ref). However, there is already a directory
named formatted_ref in there, so the copy fails and gdbserver isn't able
to load the binary.
This patch bypasses the problem by removing the extra directory level.
The compiled binary will already be in its final location in the
standard output directory, so the copy will effectively be a no-op.
gdb/testsuite/ChangeLog:
* lib/ada.exp: Remove extra directory level in build directory.
* gdb.ada/cond_lang.exp: Likewise.
* gdb.ada/exec_changed.exp: Likewise.
* gdb.ada/lang_switch.exp: Likewise.
John Baldwin [Mon, 20 Jun 2016 23:16:31 +0000 (16:16 -0700)]
Remove extraneous parentheses.
gdb/ChangeLog:
* h8300-tdep.c (h8300_print_register): Remove extraneous parentheses.
John Baldwin [Sat, 11 Jun 2016 20:18:15 +0000 (13:18 -0700)]
Use unsigned integer constant with left shifts.
This avoids undefined behavior.
gdb/ChangeLog:
* ada-lang.c (ada_unpack_from_contents): Use unsigned constants with
left shifts.
John Baldwin [Sat, 11 Jun 2016 14:43:46 +0000 (07:43 -0700)]
Set uses_fp for frames with a valid FP register explicitly.
Since CORE_ADDR is unsigned, the saved FP register is always greater than
or equal to zero. Replace the comparison by explicitly setting uses_fp to
1 for frames with a valid FP register.
gdb/ChangeLog:
* sh64-tdep.c (sh64_analyze_prologue): Set "uses_fp" when setting
the MEDIA_FP_REGNUM register.
John Baldwin [Sat, 11 Jun 2016 14:38:42 +0000 (07:38 -0700)]
Remove check for negative size.
Since CORE_ADDR is unsigned, this value can never be negative.
gdb/ChangeLog:
* score-tdep.c (score7_malloc_and_get_memblock): Remove check for
negative size.
John Baldwin [Fri, 1 Jul 2016 17:18:50 +0000 (10:18 -0700)]
Use 'ptid_t' instead of 'ptid' for fbsd_next_vfork_done's return type.
'ptid' compiles in C++, but not C.
gdb/ChangeLog:
* fbsd-nat.c (fbsd_is_vfork_done_pending): Fix return type.
Yao Qi [Tue, 5 Jul 2016 14:29:20 +0000 (15:29 +0100)]
[ARM] Fix endless recursion on calculating CPRC candidate
When GDB determines whether type T can be part of candidate for
passing and returning in VFP registers, it calls
arm_vfp_cprc_sub_candidate recursively. However, if type T has
self-reference field, like,
class C
{
static C s;
};
arm_vfp_cprc_sub_candidate won't return. This fix is to skip calling
arm_vfp_cprc_sub_candidate if the field is static.
gdb:
2016-07-06 Yao Qi <yao.qi@linaro.org>
* arm-tdep.c (arm_vfp_cprc_sub_candidate): Don't call
arm_vfp_cprc_sub_candidate for static field.
Manish Goregaokar [Wed, 6 Jul 2016 05:25:10 +0000 (10:55 +0530)]
Allow subscripting raw pointers
This will be useful for dealing with vectors; regardless of our final solution
for the Index trait.
2016-07-06 Manish Goregaokar <manish@mozilla.com>
gdb/ChangeLog:
* rust-lang.c (rust_subscript): Allow subscripting pointers
gdb/testsuite/ChangeLog:
* simple.rs: Add test for raw pointer subscripting
* simple.exp: Add test expectations
GDB Administrator [Wed, 6 Jul 2016 00:00:20 +0000 (00:00 +0000)]
Automatic date update in version.in
H.J. Lu [Tue, 5 Jul 2016 14:35:52 +0000 (07:35 -0700)]
Add -flto to PR ld/20321 test
Before GCC 4.9, -flto is required for final LTO link. Add -flto to PR
ld/20321 test to support older versions of GCC.
* testsuite/ld-plugin/lto.exp: Add -flto to PR ld/20321 test.
Yao Qi [Tue, 5 Jul 2016 13:46:21 +0000 (14:46 +0100)]
Fix fail in gdb.mi/mi-reverse.exp
Commit
38b022b4452f996fb5a8598f80d850b594621bcf adds "method" and
"format" fields in =record-started, but doesn't update test case
gdb.mi/mi-reverse.exp, so it causes the fail like this,
PASS: gdb.mi/mi-reverse.exp: mi runto main
Expecting: ^(-interpreter-exec console record[^M
]+)?(=record-started,thread-group="i1"^M
\^done[^M
]+[(]gdb[)] ^M
[ ]*)
-interpreter-exec console record^M
=record-started,thread-group="i1",method="full"^M
^done^M
(gdb) ^M
FAIL: gdb.mi/mi-reverse.exp: Turn on process record
and regression was found by buildbot too
https://sourceware.org/ml/gdb-testers/2016-q2/msg04492.html
gdb/testsuite:
2016-07-05 Yao Qi <yao.qi@linaro.org>
* gdb.mi/mi-reverse.exp: Match =record-started output.
Andre Vieria [Tue, 5 Jul 2016 10:39:06 +0000 (11:39 +0100)]
[ARM] Purecode compatible long branch veneer for M-profile targets with MOVW.
2016-07-05 Andre Vieria <andre.simoesdiasvieira@arm.com>
* elf32-arm.c (THUMB32_MOVT): New veneer macro.
(THUMB32_MOVW): Likewise.
(elf32_arm_stub_long_branch_thumb2_only_pure): New.
(DEF_STUBS): Define long_branch_thumb2_only_pure.
(arm_stub_is_thumb): Add new veneer stub.
(arm_type_of_stub): Use new veneer.
(arm_stub_required_alignment): Add new veneer.
2016-07-05 Andre Vieria <andre.simoesdiasvieira@arm.com>
* testsuite/ld-arm/farcall-thumb2-purecode.d: New test result.
* testsuite/ld-arm/farcall-thumb2-purecode.s: New test.
* testsuite/ld-arm/arm-elf.exp: Run it.
Andre Vieria [Tue, 5 Jul 2016 10:28:46 +0000 (11:28 +0100)]
[ARM] Change noread to purecode.
bfd/ChangeLog
2016-07-05 Andre Vieria <andre.simoesdiasvieira@arm.com>
* bfd-in2.h (SEC_ELF_NOREAD): Rename to ...
(SEC_ELF_PURECODE): ... this.
* elf32-arm.c (elf32_arm_post_process_headers): Rename SEC_ELF_NOREAD
to SEC_ELF_NOREAD.
(elf32_arm_fake_sections): Likewise.
(elf_32_arm_section_flags): Likewise.
(elf_32_arm_lookup_section_flags): Likewise.
* section.c (SEC_ELF_NOREAD): Rename to ...
(SEC_ELF_PURECODE): ... this.
binutils/ChangeLog
2016-07-05 Andre Vieria <andre.simoesdiasvieira@arm.com>
* objdump.c (dump_section_header): Rename SEC_ELF_NOREAD
to SEC_ELF_NOREAD.
* readelf.c (get_elf_section_flags): Rename ARM_NOREAD to
ARM_PURECODE and SHF_ARM_NOREAD to SHF_ARM_PURECODE.
(process_section_headers): Rename noread to purecode.
* section.c (SEC_ELF_NOREAD): Rename to ...
(SEC_ELF_PURECODE): ... this.
include/ChangeLog
2016-07-05 Andre Vieria <andre.simoesdiasvieira@arm.com>
* elf/arm.h (SHF_ARM_NOREAD): Rename to ...
(SHF_ARM_PURECODE): ... this.
ld/ChangeLog
2016-07-05 Andre Vieria <andre.simoesdiasvieira@arm.com>
* testsuite/ld-arm/arm_noread.ld: Renamed to ...
testsuite/ld-arm/arm_purecode.ld: ... this, and replaced
all noread's by purecode.
Jan Beulich [Tue, 5 Jul 2016 09:36:08 +0000 (11:36 +0200)]
ld: track linker-definedness of symbols
Keep "lineno" as zero while not processing any script, and use it being
zero to set the "linker_def" field to true.
Jan Beulich [Tue, 5 Jul 2016 09:14:51 +0000 (11:14 +0200)]
x86: fix register check in check_qword_reg()
A missing 'r' (or wrong 'e') register prefix needs to be complained
about if the template allows for a 64-bit register, not a 32-bit one.
I assume this was a copy-and-paste type of mistake
(from check_long_reg()).
Jan Kratochvil [Tue, 5 Jul 2016 08:47:18 +0000 (10:47 +0200)]
babeltrace compilation regression
Since:
commit
2d681be471cf8aff8f296cb7713c39e9aa4fc2bb
Author: Andreas Arnez <arnez@linux.vnet.ibm.com>
Date: Wed Apr 27 15:52:16 2016 +0200
Avoid non-C++-enabled babeltrace versions
tested with:
libbabeltrace-devel-1.2.4-4.fc24.x86_64
libbabeltrace-devel-1.4.0-2.fc25.x86_64
it can no longer build due to:
configure:16435: gcc -o conftest -m64 -g3 -pipe -Wall -fexceptions -fstack-protector-strong --param=ssp-buffer-size=4 -fno-diagno
stics-show-caret -Werror -static-libstdc++ -static-libgcc conftest.c -ldl -ldl -lncurses -lm -ldl -lbabeltrace -lbabeltrace-ctf >&5
conftest.c: In function 'main':
conftest.c:208:7: error: 'pos' is a pointer; did you mean to use '->'?
gdb/ChangeLog
2016-07-05 Jan Kratochvil <jan.kratochvil@redhat.com>
* configure: Regenerate.
* configure.ac (HAVE_LIBBABELTRACE): Fix pos variable dereference.
GDB Administrator [Tue, 5 Jul 2016 00:00:21 +0000 (00:00 +0000)]
Automatic date update in version.in
H.J. Lu [Mon, 4 Jul 2016 15:55:04 +0000 (08:55 -0700)]
Warn and return for duplicated plugin
If a plugin has been loaded already, we should warn and return, instead
of adding it on the plugin list.
PR ld/20321
* plugin.c (plugin_opt_plugin): Warn and return if plugin has
been loaded already.
* testsuite/ld-plugin/lto.exp: Run PR ld/20321 test.
* testsuite/ld-plugin/pr20321.c: New file.
Nick Clifton [Mon, 4 Jul 2016 14:44:10 +0000 (15:44 +0100)]
Allow the flash and ram memory region sizes to be specified in the default FT32 linker script.
* scripttempl/ft32.sc (__PMSIZE_): If not defined, set to 256K.
(__RAMSIZE): If not defined, set to 64K.
(MEMORY): Set the flash region size to __PMSIZE and the ram region
size to __RAMSIZE.
GDB Administrator [Mon, 4 Jul 2016 00:00:15 +0000 (00:00 +0000)]
Automatic date update in version.in
GDB Administrator [Sun, 3 Jul 2016 00:00:21 +0000 (00:00 +0000)]
Automatic date update in version.in
Maciej W. Rozycki [Sat, 2 Jul 2016 22:39:18 +0000 (23:39 +0100)]
MIPS/GAS/testsuite: Remove remnants of a.out/ECOFF support
Complement:
commit
16e5e222b6eae6f110ea72bf627585c095a453a8
Author: Richard Sandiford <rdsandiford@googlemail.com>
Date: Sat Jun 22 16:57:42 2013 +0000
<https://sourceware.org/ml/binutils/2013-06/msg00195.html>, ("Make
gas/mips/mips.exp ELF-only"), and remove the remaining stale ECOFF test
dumps and pieces of a.out/ECOFF support in relocation match patterns.
gas/
* testsuite/gas/mips/ecoff@ld.d: Remove test.
* testsuite/gas/mips/ecoff@ld-forward.d: Remove test.
* testsuite/gas/mips/ecoff@ld-zero-3.d: Remove test.
* testsuite/gas/mips/ecoff@sd.d: Remove test.
* testsuite/gas/mips/ecoff@sd-forward.d: Remove test.
* testsuite/gas/mips/beq.d: Remove a.out and ECOFF support from
reloc patterns.
* testsuite/gas/mips/mipsr6@beq.d: Likewise.
* testsuite/gas/mips/bge.d: Likewise.
* testsuite/gas/mips/mipsr6@bge.d: Likewise.
* testsuite/gas/mips/bgeu.d: Likewise.
* testsuite/gas/mips/mipsr6@bgeu.d: Likewise.
* testsuite/gas/mips/blt.d: Likewise.
* testsuite/gas/mips/mipsr6@blt.d: Likewise.
* testsuite/gas/mips/bltu.d: Likewise.
* testsuite/gas/mips/mipsr6@bltu.d: Likewise.
* testsuite/gas/mips/branch-likely.d: Likewise.
* testsuite/gas/mips/la.d: Likewise.
* testsuite/gas/mips/lb.d: Likewise.
* testsuite/gas/mips/lifloat.d: Likewise.
* testsuite/gas/mips/sb.d: Likewise.
* testsuite/gas/mips/uld.d: Likewise.
* testsuite/gas/mips/ulh.d: Likewise.
* testsuite/gas/mips/ulw.d: Likewise.
* testsuite/gas/mips/usd.d: Likewise.
* testsuite/gas/mips/ush.d: Likewise.
* testsuite/gas/mips/usw.d: Likewise.
Maciej W. Rozycki [Sat, 2 Jul 2016 22:14:20 +0000 (23:14 +0100)]
MIPS/LD/testsuite: Resurrect `branch-misc-2' test
Revert:
commit
c9c1e416d7dd1a35bd7c1a96d034dca1d5071cd1
Author: Alexandre Oliva <aoliva@redhat.com>
Date: Thu Dec 12 04:39:44 2002 +0000
<https://sourceware.org/ml/binutils/2002-11/msg00657.html>, ("mips:
branches to external labels are broken"), complementing:
commit
bad36eacdad37042c4efb1c5fbf48476b47de82b
Author: Daniel Jacobowitz <drow@false.org>
Date: Wed Nov 23 14:04:18 2005 +0000
<https://sourceware.org/ml/binutils/2005-11/msg00324.html>,
("R_MIPS_PC16, again").
ld/
* testsuite/ld-mips-elf/branch-misc-2.d: New test.
* testsuite/ld-mips-elf/mips-elf.exp: Run it.
Maciej W. Rozycki [Sat, 2 Jul 2016 22:09:06 +0000 (23:09 +0100)]
MIPS/GAS/testsuite: Split `branch-misc-2' tests into two
Move `branch-misc-2' tests for non locally-defined-global symbols into
separate files. These tests have been introduced with:
commit
6f171daac941741e5fa904f6e462adb75a595495
Author: Alexandre Oliva <aoliva@redhat.com>
Date: Thu Dec 12 04:40:22 2002 +0000
<https://sourceware.org/ml/binutils/2002-11/msg00631.html>, ("mips:
branches to external labels are broken"), and:
commit
d17b874b6c14caa2f2ed1b5544a48de9f39a1a65
Author: Alexandre Oliva <aoliva@redhat.com>
Date: Wed Mar 12 23:07:22 2003 +0000
<https://sourceware.org/ml/binutils/2003-03/msg00136.html>, ("On
resolving the MIPS gas branch reloc issue"), while the test case served
a different purpose. With the original intent of the test case brought
back with:
commit
bad36eacdad37042c4efb1c5fbf48476b47de82b
Author: Daniel Jacobowitz <drow@false.org>
Date: Wed Nov 23 14:04:18 2005 +0000
<https://sourceware.org/ml/binutils/2005-11/msg00324.html>,
("R_MIPS_PC16, again"), these stand in the way for linker testing.
gas/
* testsuite/gas/mips/branch-misc-2.s: Move non
locally-defined-global symbol tests...
* testsuite/gas/mips/branch-misc-5.s: ... to this new test.
* testsuite/gas/mips/branch-misc-2.d: Update accordingly.
* testsuite/gas/mips/branch-misc-2-64.d: Likewise.
* testsuite/gas/mips/branch-misc-2pic.d: Likewise.
* testsuite/gas/mips/branch-misc-2pic-64.d: Likewise.
* testsuite/gas/mips/mipsr6@branch-misc-2-64.d: Likewise.
* testsuite/gas/mips/mipsr6@branch-misc-2pic-64.d: Likewise.
* testsuite/gas/mips/micromips@branch-misc-2.d: Likewise.
* testsuite/gas/mips/micromips@branch-misc-2-64.d: Likewise.
* testsuite/gas/mips/micromips@branch-misc-2pic.d: Likewise.
* testsuite/gas/mips/micromips@branch-misc-2pic-64.d: Likewise.
* testsuite/gas/mips/branch-misc-5.d: New test.
* testsuite/gas/mips/branch-misc-5pic.d: New test.
* testsuite/gas/mips/branch-misc-5-64.d: New test.
* testsuite/gas/mips/branch-misc-5pic-64.d: New test.
* testsuite/gas/mips/mipsr6@branch-misc-5-64.d: New test.
* testsuite/gas/mips/mipsr6@branch-misc-5pic-64.d: New test.
* testsuite/gas/mips/micromips@branch-misc-5.d: New test.
* testsuite/gas/mips/micromips@branch-misc-5pic.d: New test.
* testsuite/gas/mips/micromips@branch-misc-5-64.d: New test.
* testsuite/gas/mips/micromips@branch-misc-5pic-64.d: New test.
* testsuite/gas/mips/mips.exp: Run the new tests.
Maciej W. Rozycki [Sat, 2 Jul 2016 21:19:15 +0000 (22:19 +0100)]
MIPS/GAS/testsuite: Reenable disabled external BEQ tests
Complement:
commit
bad36eacdad37042c4efb1c5fbf48476b47de82b
Author: Daniel Jacobowitz <drow@false.org>
Date: Wed Nov 23 14:04:18 2005 +0000
<https://sourceware.org/ml/binutils/2005-11/msg00324.html>,
("R_MIPS_PC16, again"), and reenable external BEQ tests, the remaining
subset missed from the set of branch tests previously disabled with:
commit
6f171daac941741e5fa904f6e462adb75a595495
Author: Alexandre Oliva <aoliva@redhat.com>
Date: Thu Dec 12 04:40:22 2002 +0000
<https://sourceware.org/ml/binutils/2002-11/msg00631.html>, ("mips:
branches to external labels are broken").
gas/
* testsuite/gas/mips/beq.s: Uncomment branches to undefined
symbols.
* testsuite/gas/mips/beq.d: Update accordingly.
* testsuite/gas/mips/mipsr6@beq.d: Likewise.
* testsuite/gas/mips/micromips@beq.d: Likewise.
Maciej W. Rozycki [Sat, 2 Jul 2016 21:14:27 +0000 (22:14 +0100)]
MIPS/GAS/testsuite: Restrict 64-bit `branch-mips' tests to NewABI targets
... removing numerous `mips-sgi-irix5' failures.
gas/
* testsuite/gas/mips/mips.exp: Restrict 64-bit `branch-mips'
tests to NewABI targets.
Maciej W. Rozycki [Sat, 2 Jul 2016 21:04:41 +0000 (22:04 +0100)]
MIPS/GAS/testsuite: Group `branch-misc' tests together
gas/
* testsuite/gas/mips/mips.exp: Group `branch-misc' tests
together.
GDB Administrator [Sat, 2 Jul 2016 00:00:22 +0000 (00:00 +0000)]
Automatic date update in version.in
Don Breazeal [Fri, 1 Jul 2016 18:13:48 +0000 (11:13 -0700)]
Optimize memory_xfer_partial for remote
Some analysis we did here showed that increasing the cap on the
transfer size in target.c:memory_xfer_partial could give 20% or more
improvement in remote load across JTAG. Transfer sizes were capped
to 4K bytes because of performance problems encountered with the
restore command, documented here:
https://sourceware.org/ml/gdb-patches/2013-07/msg00611.html
and in commit
67c059c29e1f ("Improve performance of large restore
commands").
The 4K cap was introduced because in a case where the restore command
requested a 100MB transfer, memory_xfer_partial would repeatedy
allocate and copy an entire 100MB buffer in order to properly handle
breakpoint shadow instructions, even though memory_xfer_partial would
actually only write a small portion of the buffer contents.
A couple of alternative solutions were suggested:
* change the algorithm for handling the breakpoint shadow instructions
* throttle the transfer size up or down based on the previous actual
transfer size
I tried implementing the throttling approach, and my implementation
reduced the performance in some cases.
This patch implements a new target function that returns that target's
limit on memory transfer size. It defaults to ULONGEST_MAX bytes,
because for native targets there is no marshaling and thus no limit is
needed. For remote targets it uses get_memory_write_packet_size.
gdb/ChangeLog:
* remote.c (remote_get_memory_xfer_limit): New function.
* target-delegates.c: Regenerate.
* target.c (memory_xfer_partial): Call
target_ops.to_get_memory_xfer_limit.
* target.h (struct target_ops)
<to_get_memory_xfer_limit>: New member.
Szabolcs Nagy [Fri, 1 Jul 2016 15:20:50 +0000 (16:20 +0100)]
[AArch64] Fix +nofp16 handling
Feature flag handling was not perfect, +nofp16 disabled fp
instructions too.
New feature flag macros were added to check features with multiple
bits set (matters for FP_F16 and SIMD_F16 opcode feature tests).
The unused AARCH64_OPCODE_HAS_FEATURE was removed, all checks should
use one of the AARCH64_CPU_HAS_* macros. AARCH64_CPU_HAS_FEATURE
now checks all feature bits.
The aarch64_features table now contains the dependencies as
a separate field (so when the feature is enabled all dependencies
are enabled and when it is disabled everything that depends on it
is disabled).
Note that armv8-a+foo+nofoo is not equivalent to armv8-a if
+foo turns on dependent features that nofoo does not turn off.
gas/
* config/tc-aarch64.c (struct aarch64_option_cpu_value_table): Add
require field.
(aarch64_features): Initialize require fields.
(aarch64_parse_features): Handle dependencies.
(aarch64_feature_enable_set, aarch64_feature_disable_set): New.
(md_assemble): Use AARCH64_CPU_HAS_ALL_FEATURES.
* testsuite/gas/aarch64/illegal-nofp16.s: New.
* testsuite/gas/aarch64/illegal-nofp16.l: New.
* testsuite/gas/aarch64/illegal-nofp16.d: New.
include/
* opcode/aarch64.h (AARCH64_CPU_HAS_ALL_FEATURES): New.
(AARCH64_CPU_HAS_ANY_FEATURES): New.
(AARCH64_CPU_HAS_FEATURE): Define as AARCH64_CPU_HAS_ALL_FEATURES.
(AARCH64_OPCODE_HAS_FEATURE): Remove.
John Baldwin [Sat, 25 Jun 2016 04:00:04 +0000 (21:00 -0700)]
Fake VFORK_DONE events when following only the parent after a vfork.
FreeBSD does not currently report a ptrace event for a parent process
after it resumes due to the child exiting the shared memory region after
a vfork. Take the same approach used in linux-nat.c in this case of
sleeping for a while and then reporting a fake VFORK_DONE event.
gdb/ChangeLog:
* fbsd-nat.c (struct fbsd_fork_child_info): Rename to ...
(struct fbsd_fork_info): ... this.
(struct fbsd_fork_info) <child>: Rename to ...
(struct fbsd_fork_info) <ptid>: ... this.
(fbsd_pending_children): Update type.
(fbsd_remember_child): Update type and field name.
(fbsd_is_child_pending): Likewise.
(fbsd_pending_vfork_done): New variable.
(fbsd_is_vfork_done_pending): New function.
(fbsd_next_vfork_done): New function.
(fbsd_resume): Don't resume processes with a pending vfork done
event.
(fbsd_wait): Report pending vfork done events.
(fbsd_follow_fork): Delay and record a pending vfork done event
for a vfork parent when detaching the child.
John Baldwin [Sat, 25 Jun 2016 04:06:36 +0000 (21:06 -0700)]
Move fbsd_resume and related functions below fork following helper code.
gdb/ChangeLog:
* fbsd-nat.c (super_resume): Move earlier next to "super_wait".
(resume_one_thread_cb): Move below fork following helper code.
(resume_all_threads_cb): Likewise.
(fbsd_resume): Likewise.
John Baldwin [Sat, 25 Jun 2016 01:24:21 +0000 (18:24 -0700)]
Honor detach-on-fork on FreeBSD.
Only detach from the new child process in the follow fork callback
if detach_fork is true.
gdb/ChangeLog:
* fbsd-nat.c (fbsd_follow_fork): Only detach child if
"detach_fork" is true.
Thomas Preud'homme [Fri, 1 Jul 2016 15:13:25 +0000 (16:13 +0100)]
Fix Thumb-2 BL detection
2016-07-01 Thomas Preud'homme <thomas.preudhomme@arm.com>
bfd/
* elf32-arm.c (using_thumb2_bl): New function.
(arm_type_of_stub): Declare thumb2 variable together and change type
to bfd_boolean. Use using_thumb2_bl () to determine whether
THM_MAX_FWD_BRANCH_OFFSET or THM2_MAX_FWD_BRANCH_OFFSET should be
checked for BL range.
(elf32_arm_final_link_relocate): Use using_thumb2_bl () to determine
the bit size of BL offset.
ld/
* testsuite/ld-arm/arm-elf.exp (Thumb-2 BL): Assemble for ARMv7.
(Thumb-2 BL on ARMv6-M): New testcase.
* testsuite/ld-arm/thumb2-bl.d: Do not try to match testcase filename.
* testsuite/ld-arm/thumb2-bl.s: Do not select architecture.
John Baldwin [Tue, 28 Jun 2016 00:44:58 +0000 (17:44 -0700)]
Set debug registers on all threads belonging to the current inferior.
gdb/ChangeLog:
* x86bsd-nat.c: Include 'gdbthread.h'.
(x86bsd_dr_set): Set debug registers on all threads belonging to
the current inferior.
John Baldwin [Mon, 27 Jun 2016 20:19:09 +0000 (13:19 -0700)]
Consolidate x86 debug register code for BSD native targets.
Move the debug register support code from amd64bsd-nat.c and
i386bsd-nat.c into a shared x86bsd-nat.c.
Instead of setting up x86_dr_low in amd64fbsd-nat.c and
i386fbsd-nat.c, add a x86bsd_target function that creates a new target
that inherits from inf_ptrace and sets up x86 debug registers if
supported. In addition to initializing x86_dr_low, the x86bsd target
installs a custom mourn_inferior target operation to clean up the
x86 debug register state. Previously this was only done on amd64.
Now it will be done for both i386 and amd64. The i386bsd_target and
amd64bsd_target functions create targets that inherit from x86bsd
rather than inf_ptrace.
gdb/ChangeLog:
* Makefile.in [HFILES_NO_SRCDIR]: Replace 'amd64bsd-nat.h' with
'x86bsd-nat.h'.
* amd64bsd-nat.c: Include 'x86bsd-nat.h' instead of
'amd64bsd-nat.h'.
(amd64bsd_xsave_len): Rename and move to x86bsd-nat.c.
(amd64bsd_fetch_inferior_registers): Replace 'amd64bsd_xsave_len'
with 'x86bsd_xsave_len'.
(amd64bsd_store_inferior_registers): Likewise.
(amd64bsd_target): Inherit from x86bsd_target.
(amd64bsd_dr_get): Rename and move to x86bsd-nat.c.
(amd64bsd_dr_set): Likewise.
(amd64bsd_dr_set_control): Likewise.
(amd64bsd_dr_set_addr): Likewise.
(amd64bsd_dr_get_addr): Likewise.
(amd64bsd_dr_get_status): Likewise.
(amd64bsd_dr_get_control): Likewise.
* amd64fbsd-nat.c: Include 'x86bsd-nat.h' instead of
'amd64bsd-nat.h'.
(super_mourn_inferior): Move to x86bsd-nat.c.
(amd64fbsd_mourn_inferior): Rename and move to x86bsd-nat.c.
(amd64fbsd_read_description): Replace 'amd64bsd_xsave_len' with
'x86bsd_xsave_len'.
(_initialize_amd64fbsd_nat): Remove x86 watchpoint setup and
mourn_inferior' target op.
* config/i386/fbsd.mh (NATDEPFILES): Add x86bsd-nat.o.
* config/i386/fbsd64.mh: Likewise.
* config/i386/nbsd64.mh: Likewise.
* config/i386/nbsdelf.mh: Likewise.
* config/i386/obsd.mh: Likewise.
* config/i386/obsd64.mh: Likewise.
* i386bsd-nat.c: Include 'x86bsd-nat.h'.
(i386bsd_xsave_len): Rename and move to x86bsd-nat.c.
(i386bsd_fetch_inferior_registers): Replace 'i386bsd_xsave_len'
with 'x86bsd_xsave_len'.
(i386bsd_store_inferior_registers): Likewise.
(i386bsd_target): Inherit from x86bsd_target.
(i386bsd_dr_get): Rename and move to x86bsd-nat.c.
(i386bsd_dr_set): Likewise.
(i386bsd_dr_set_control): Likewise.
(i386bsd_dr_set_addr): Likewise.
(i386bsd_dr_get_addr): Likewise.
(i386bsd_dr_get_status): Likewise.
(i386bsd_dr_get_control): Likewise.
* i386bsd-nat.h (i386bsd_xsave_len): Remove.
(i386bsd_dr_set_control): Remove.
(i386bsd_dr_set_addr): Remove.
(i386bsd_dr_get_addr): Remove.
(i386bsd_dr_get_status): Remove.
(i386bsd_dr_get_control): Remove.
* i386fbsd-nat.c: Include 'x86bsd-nat.h'.
(i386fbsd_read_description): Replace 'i386bsd_xsave_len' with
'x86bsd_xsave_len'.
(_initialize_i386fbsd_nat): Remove x86 watchpoint setup and
mourn_inferior' target op.
* x86bsd-nat.c: New file.
* x86bsd-nat.h: New file.
Nick Clifton [Fri, 1 Jul 2016 11:35:01 +0000 (12:35 +0100)]
Fix potential buffer overflows with sprintf and very large integer values.
binutuils* prdbg.c (pr_enum_type): Use a buffer big enough to hold an
extremely large decimal value.
(pr_range_type): Likewise.
(pr_array_type): Likewise.
(pr_struct_field): Likewise.
(pr_class_baseclass): Likewise.
(pr_class_method_variant): Likewise.
(pr_tag_type): Likewise.
(pr_int_constant): Likewise.
(pr_typed_constant): Likewise.
(pr_variable): Likewise.
(pr_function_parameter): Likewise.
(pr_start_block): Likewise.
(pr_lineno): Likewise.
(pr_end_block): Likewise.
(tg_enum_type): Likewise.
(tg_int_constant): Likewise.
(tg_typed_constant): Likewise.
(tg_start_block): Likewise.
gas * macro.c (macro_expand_body): Use a buffer big enough to hold an
extremely large integer.
Pedro Alves [Fri, 1 Jul 2016 10:56:39 +0000 (11:56 +0100)]
Extend JIT-reader test and fix GDB problems that exposes
The jit-reader.exp test isn't really exercising the jit-reader's
unwinder API at all. This commit address that, and then fixes GDB
problems exposed.
- The custom JIT reader provided for the jit-reader.exp testcase
always rejects the jitted function's frame...
This is because the custom JIT reader in the testcase never ever
sets state->code_begin/end, so the bounds check in
gdb.base/jitreader.c:unwind_frame:
if (this_ip >= state->code_end || this_ip < state->code_begin)
return GDB_FAIL;
tends to fail, unless you're "lucky" (because it references
uninitialized data).
The result is that GDB is always actually using a built-in unwinder
for the jitted function.
- The provided unwinder doesn't do anything that GDB's built-in
unwinder can't do.
IOW, we can't really tell whether the JIT reader's unwinder is
working or not.
I fixed that by making the jitted function mangle its own stack
pointer with a xor, and then teaching the jit unwinder to demangle
it back (another xor). So now "backtrace" with GDB's built-in
unwinder fails while with the jit unwinder, it succeeds.
- GDB crashes after unloading the JIT reader, and flushing frames...
I made the testcase use the "flushregs" command after unloading the
JIT reader, to force the JIT frames to be flushed. However, that
crashes GDB...
When reinit_frame_cache tears down a frame's cache, it calls its
unwinder's dealloc_cache method, which for JIT frames ends up in
jit.c:jit_dealloc_cache. This function calls each of the frame's
gdb_reg_value's "free" pointer:
for (i = 0; i < gdbarch_num_regs (frame_arch); i++)
if (priv_data->registers[i] && priv_data->registers[i]->free)
priv_data->registers[i]->free (priv_data->registers[i]);
and the problem is these gdb_reg_value instances have been returned
by the JIT reader that has been already unloaded, and their "free"
function pointers likely point to functions in the DSO that has
already been unloaded...
A fix for that could be to call reinit_frame_cache in
jit_reader_unload_command _before_ unloading the jit reader DSO so
that the jit reader is given a chance to clean up the gdb_reg_values
before it is unloaded. However, the fix for the point below makes
this unnecessary, because it stops jit.c from keeping around
gdb_reg_values in the first place.
- However, it still makes sense to clear the frame cache when loading
or unloading a JIT unwinder.
This makes testing a JIT unwinder a bit simpler.
- Not only the frame cache actually -- gdb is not unloading the
jit-registered objfiles when the JIT reader is unloaded, and not
loading the already-registered descriptors when a JIT reader is
loaded.
The new test exercises unloading the jit reader, loading it back
again, and then making sure the JIT reader's unwinder works again.
Without the unload/re-load of already-read descriptors, the newly
loaded JIT would have no idea where the new function is, because
it's stored at symbol read time.
- I added a couple "info frame" calls to the test, and that
crashes GDB...
The problem is that jit_frame_prev_register assumes it'll only be
called for raw registers, so when it gets a pseudo register number,
the "priv->registers[reg]" access is really an out-of-bounds access.
To fix that, I made jit_frame_prev_register use
gdbarch_pseudo_register_read_value for reading the pseudo-registers.
However, that works with a regcache and we don't have one. To fix
that, I made the JIT unwinder store a regcache in its cache instead
of an array of gdb_reg_value pointers.
gdb/ChangeLog:
2016-07-01 Pedro Alves <palves@redhat.com>
Tom Tromey <tom@tromey.com>
* jit.c (jit_reader_load_command): Call reinit_frame_cache and
jit_inferior_created_hook.
(jit_reader_unload_command): Call reinit_frame_cache and
jit_inferior_exit_hook.
* jit.c (struct jit_unwind_private) <registers>: Delete field.
<regcache>: New field.
(jit_unwind_reg_set_impl): Set the register's value in the
regcache. Free the passed-in gdb_reg_value.
(jit_dealloc_cache): Adjust to free the regcache.
(jit_frame_sniffer): Allocate a regcache instead of an array of
gdb_reg_value pointers.
(jit_frame_this_id): Adjust.
(jit_frame_prev_register): Read raw registers off of the regcache
instead of from the gdb_reg_value pointer array. Use
gdbarch_pseudo_register_read_value to read pseudo registers.
* regcache.c (regcache_raw_set_cached_value): New function,
factored out from ...
(regcache_raw_write): ... here.
* regcache.h (regcache_raw_set_cached_value): Declare.
gdb/testsuite/ChangeLog:
2016-07-01 Pedro Alves <palves@redhat.com>
* gdb.base/jit-reader.exp (info_registers_current_frame): New
procedure.
(jit_reader_test): Test the jit reader's unwinder.
* gdb.base/jithost.c (jit_function_00_code): New global.
(main): Use memcpy to fill in the mmapped code, instead of poking
bytes manually here.
* gdb.base/jitreader.c (enum register_mapping) <AMD64_RBP>: New
value.
(read_debug_info): Save the function's range.
(read_sp): New function.
(unwind_frame): Use it. Also unwind RBP.
(get_frame_id): Use read_sp.
(gdb_init_reader): Use calloc instead of malloc.
* lib/gdb.exp (get_hexadecimal_valueof): Add optional 'test'
parameter. Use gdb_test_multiple.
Pedro Alves [Fri, 1 Jul 2016 10:16:33 +0000 (11:16 +0100)]
Fix failure to detach if process exits while detaching on Linux
This commit fixes detaching on Linux when some thread exits the whole
thread group (process) just while we're detaching.
On Linux, a ptracer must detach from each LWP individually, with
PTRACE_DETACH. Since PTRACE_DETACH sets the thread running free, if
one of the already-detached threads causes the whole thread group to
exit (e.g., simply calls exit), the kernel force-kills the other
threads in the group, making them zombie, just as we're still
detaching them. Since PTRACE_DETACH against a zombie thread fails
with ESRCH, and gdb/gdbserver are not expecting this, the detach fails
with an error like: "Can't detach process: No such process.".
This patch detects this detach failure as normal, and instead of
erroring out, reaps the now-dead thread.
New test included, that exercises several different scenarios that
cause GDB/GDBserver to error out when it should not.
Tested on x86-64 GNU/Linux with {unix, native-gdbserver,
native-extended-gdbserver}
Note: without the previous fix, the "single-process + continue"
variant of the new test would fail with:
(gdb) PASS: gdb.threads/process-dies-while-detaching.exp: single-process: continue: watchpoint: switch to parent
continue
Continuing.
Warning:
Could not insert hardware watchpoint 3.
Could not insert hardware breakpoints:
You may have requested too many hardware breakpoints/watchpoints.
Command aborted.
(gdb) FAIL: gdb.threads/process-dies-while-detaching.exp: single-process: continue: watchpoint: continue
gdb/gdbserver/ChangeLog:
2016-07-01 Pedro Alves <palves@redhat.com>
Antoine Tremblay <antoine.tremblay@ericsson.com>
* linux-low.c: Change interface to take the target lwp_info
pointer directly and return void. Handle detaching from a zombie
thread.
(linux_detach_lwp_callback): New function.
(linux_detach): Detach from the leader thread after detaching from
the clone threads.
gdb/ChangeLog:
2016-07-01 Pedro Alves <palves@redhat.com>
Antoine Tremblay <antoine.tremblay@ericsson.com>
* inf-ptrace.c (inf_ptrace_detach_success): New function, factored
out from ...
(inf_ptrace_detach): ... here.
* inf-ptrace.h (inf_ptrace_detach_success): New declaration.
* linux-nat.c (get_pending_status): Rename to ...
(get_detach_signal): ... this, and return a host signal instead of
filling in a wait status.
(detach_one_lwp): New function, factored out from detach_callback
and adjusted to handle detaching from a zombie thread.
(detach_callback): Skip the leader thread.
(linux_nat_detach): No longer defer to inf_ptrace_detach to detach
the leader thread, nor build a signal string to pass down.
Instead, use target_announce_detach, detach_one_lwp and
inf_ptrace_detach_success.
gdb/testsuite/ChangeLog:
2016-07-01 Pedro Alves <palves@redhat.com>
Antoine Tremblay <antoine.tremblay@ericsson.com>
* gdb.threads/process-dies-while-detaching.c: New file.
* gdb.threads/process-dies-while-detaching.exp: New file.
Pedro Alves [Fri, 1 Jul 2016 10:16:32 +0000 (11:16 +0100)]
Forget watchpoint locations when inferior exits or is killed/detached
If you have two inferiors (or more), set watchpoints in one of the
inferiors, and then that inferior exits, until you manually delete the
watchpoint (or something forces a breakpoint re-set), you can't resume
the other inferior.
This is exercised by the test added by this commit. Without the GDB
fix, this test fails like this:
FAIL: gdb.multi/watchpoint-multi-exit.exp: dispose=kill: continue to marker in inferior 1
FAIL: gdb.multi/watchpoint-multi-exit.exp: dispose=detach: continue to marker in inferior 1
FAIL: gdb.multi/watchpoint-multi-exit.exp: dispose=exit: continue to marker in inferior 1
and gdb.log shows (in all three cases):
(gdb) continue
Continuing.
Warning:
Could not insert hardware watchpoint 2.
Could not insert hardware breakpoints:
You may have requested too many hardware breakpoints/watchpoints.
Command aborted.
(gdb) FAIL: gdb.multi/watchpoint-multi-exit.exp: dispose=kill: continue to marker in inferior 1
The problem is that GDB doesn't forget about the locations of
watchpoints set in the inferior that is now dead. When we try to
continue the inferior that is still alive, we reach
insert_breakpoint_locations, which has the the loop that triggers the
error:
/* If we failed to insert all locations of a watchpoint, remove
them, as half-inserted watchpoint is of limited use. */
That loop finds locations that are not marked inserted, but which
according to should_be_inserted should have been inserted, and so
errors out.
gdb/ChangeLog:
2016-07-01 Pedro Alves <palves@redhat.com>
* breakpoint.c (breakpoint_init_inferior): Discard watchpoint
locations.
* infcmd.c (detach_command): Call breakpoint_init_inferior.
gdb/testsuite/ChangeLog:
2016-07-01 Pedro Alves <palves@redhat.com>
* gdb.multi/watchpoint-multi-exit.c: New file.
* gdb.multi/watchpoint-multi-exit.exp: New file.
Pedro Alves [Fri, 1 Jul 2016 10:16:32 +0000 (11:16 +0100)]
Factor out "Detaching from program" message printing
Several targets have a copy of the same code that prints
"Detaching from program ..."
in their target_detach implementation. Factor that out to a common
function.
(For now, I left the couple targets that print this a bit differently
alone. Maybe this could be further pulled out into infcmd.c. If we
did that, and those targets want to continue printing differently,
this new function could be converted to a target method.)
gdb/ChangeLog:
2016-07-01 Pedro Alves <palves@redhat.com>
* darwin-nat.c (darwin_detach): Use target_announce_detach.
* inf-ptrace.c (inf_ptrace_detach): Likewise.
* nto-procfs.c (procfs_detach): Likewise.
* remote.c (remote_detach_1): Likewise.
* target.c (target_announce_detach): New function.
* target.h (target_announce_detach): New declaration.
Pedro Alves [Fri, 1 Jul 2016 10:24:21 +0000 (11:24 +0100)]
Fix formatting of some previous gdb/testsuite/ChangeLog entries
Pedro Alves [Fri, 1 Jul 2016 10:17:58 +0000 (11:17 +0100)]
Fix formatting of some previous gdb/ChangeLog entries
Nick Clifton [Fri, 1 Jul 2016 09:32:45 +0000 (10:32 +0100)]
Expect the objcopy without global symbols test to fail for ARM and AArch64 targets.
* testsuite/binutils-all/objcopy.exp
(objcopy_test_without_global_symbol): Expect this test to fail on
the AArch64 and ARM targets, since they preserve their mapping
symbols.
Jan Beulich [Fri, 1 Jul 2016 09:17:30 +0000 (11:17 +0200)]
x86-64/MPX: relax no-RIP-relative-addressing testcase
... for COFF targets.
Tristan Gingold [Fri, 1 Jul 2016 08:57:46 +0000 (10:57 +0200)]
Add marker for 2.27 branch.
binutils/
2016-07-01 Tristan Gingold <gingold@adacore.com>
* NEWS: Add marker for 2.27.
gas/
2016-07-01 Tristan Gingold <gingold@adacore.com>
* NEWS: Add marker for 2.27.
ld/
2016-07-01 Tristan Gingold <gingold@adacore.com>
* NEWS: Add marker for 2.27.
Tristan Gingold [Wed, 29 Jun 2016 10:09:06 +0000 (12:09 +0200)]
Fix mis-placement in binutils.texi
binutils/
* doc/binutils.texi (objdump): Fix mis-placement.
Jan Beulich [Fri, 1 Jul 2016 07:07:15 +0000 (09:07 +0200)]
x86-64/MPX: bndmk, bndldx, and bndstx don't allow RIP-relative addressing
Additionally warn about scaling factors other than 1 for the latter
two, as those get ignored by the hardware.
Jan Beulich [Fri, 1 Jul 2016 07:06:16 +0000 (09:06 +0200)]
x86/MPX: fix address size handling
While address overrides are ignored in 64-bit mode (and hence shouldn't
really result in an error, but upon v1 converting this to a warning I
was told otherwise), trying to use 16-bit addressing is documented to
result in #UD, and hence the assembler should reject the attempt. (The
added test case at once also checks that bndc{l,n,u} won't accept
16-bit register operands.)
Jan Beulich [Fri, 1 Jul 2016 07:03:02 +0000 (09:03 +0200)]
x86/Intel: don't accept bogus instructions
... due to their last byte looking like a suffix, when after its
stripping a matching instruction can be found. Since memory operand
size specifiers in Intel mode get converted into suffix representation
internally, we need to keep track of the actual mnemonic suffix which
may have got trimmed off, and check its validity while looking for a
matching template. I tripper over this quite some time again after
support for AMD's SSE5 instructions got removed, as at that point some
of the SSE5 mnemonics, other than expected, didn't fail to assemble.
But the problem affects many more instructions, namely (almost) all
MMX, SSE, and AVX ones as it looks. I don't think it makes sense to
add a testcase covering all of them, nor do I think it makes sense to
pick out some random examples for a new test case.
Jan Beulich [Fri, 1 Jul 2016 07:01:41 +0000 (09:01 +0200)]
x86: allow suffix-less movzw and 64-bit movzb
... just like is already the case for 16- and 32-bit movzb: I can't see
why omitting suffixes on this (and movs{b,w,l}) is not allowed, when it
is allowed for all other instructions where the suffix is redundant
with (one of) the operands.
Jan Beulich [Fri, 1 Jul 2016 06:57:21 +0000 (08:57 +0200)]
x86: remove stray instruction attributes
- with Cpu64 Disp16 makes no sense for memory operands
- with CpuNo64 Disp32S makes no sense
- non-64-bit lgdt doesn't allow 10-byte operands