Nick Clifton [Tue, 28 Jun 2016 13:05:34 +0000 (14:05 +0100)]
Relax previous restriction on running binutils ar tests for Alpha targets, allowing the tests to be run for ELF variants.
* testsuite/binutils-all/ar.exp: Relax previous restriction on
Alpha targets. Allow ELF based Alpha targets.
Maciej W. Rozycki [Tue, 28 Jun 2016 12:21:36 +0000 (13:21 +0100)]
Use `supports_gnu_unique' with the `unique_symbol' and `type' tests
Complement commit
a43942db49b0 ("LD/ELF: Unify STB_GNU_UNIQUE handling")
and use `supports_gnu_unique' with the `unique_symbol' and `type' tests,
fixing failures like:
.../binutils/testsuite/binutils-all/unique.s: Assembler messages:
.../binutils/testsuite/binutils-all/unique.s:2: Error: symbol type "gnu_unique_object" is supported only by GNU targets
ERROR: .../binutils/testsuite/binutils-all/unique.s: assembly failed
UNRESOLVED: ar unique symbol in archive
.../binutils/ar -s -r -c tmpdir/artest.a tmpdir/unique.o
Executing on host: .../binutils/ar -s -r -c tmpdir/artest.a tmpdir/unique.o (timeout = 300)
.../binutils/ar: tmpdir/unique.o: No such file or directory
FAIL: ar unique symbol in archive
and:
.../gas/testsuite/gas/elf/type.s: Assembler messages:
.../gas/testsuite/gas/elf/type.s:30: Error: symbol type "gnu_unique_object" is supported only by GNU targets
../as-new: BFD (GNU Binutils) 2.26.51.
20160628 internal error, aborting at .../gas/write.c:608 in size_seg
../as-new: Please report this bug.
.../gas/testsuite/../../binutils/readelf -s dump.o | grep "1 *\[FIONTCU\]" > dump.out
Executing on host: sh -c {.../gas/testsuite/../../binutils/readelf -s dump.o >readelf.out 2>gas.stderr} /dev/null (timeout = 300)
readelf: Error: dump.o: Failed to read file's magic number
FAIL: elf type list
on MIPS/FreeBSD targets:
mips-freebsd -FAIL: ar unique symbol in archive
mips-freebsd -FAIL: elf type list
mips64-freebsd -FAIL: ar unique symbol in archive
mips64-freebsd -FAIL: elf type list
mips64el-freebsd -FAIL: ar unique symbol in archive
mips64el-freebsd -FAIL: elf type list
mipsel-freebsd -FAIL: ar unique symbol in archive
mipsel-freebsd -FAIL: elf type list
binutils/
* testsuite/binutils-all/ar.exp: Use `supports_gnu_unique' with
the `unique_symbol' test.
gas/
* testsuite/gas/elf/elf.exp: Use `supports_gnu_unique' with the
`type' test.
Nick Clifton [Tue, 28 Jun 2016 12:22:49 +0000 (13:22 +0100)]
Mark ARM mapping symbols in object files are precious, so that strip will not remove them.
* elf32-arm.c (elf32_arm_backend_symbol_processing): New
function. Marks mapping symbols in object files as precious, so
that strip will not remove them.
(elf_backend_symbol_processing): Define.
Nick Clifton [Tue, 28 Jun 2016 11:43:14 +0000 (12:43 +0100)]
Fix RX and M68HC11 linker testsuite failures.
ld * testsuite/ld-elf/merge.d: Add m68hc11 to list of targets that
expect to fail this test.
* testsuite/ld-scripts/overlay-size.d: Skip the entire test for
RX.
* testsuite/ld-scripts/rgn-at10.d: No longer expect this test to
fail for the RX.
* testsuite/ld-scripts/rgn-at11.d: Likewise.
* testsuite/ld-scripts/rgn-at2.d: Likewise.
* testsuite/ld-scripts/rgn-at6.d: Likewise.
* testsuite/ld-scripts/rgn-at7.d: Likewise.
* testsuite/ld-scripts/rgn-at8.d: Likewise.
Yao Qi [Tue, 28 Jun 2016 11:02:36 +0000 (12:02 +0100)]
Implement get_syscall_trapinfo for arm-linux
gdb/gdbserver:
2016-06-28 Yao Qi <yao.qi@linaro.org>
* linux-arm-low.c (arm_get_syscall_trapinfo): New function.
(the_low_target): Install arm_get_syscall_trapinfo.
Yao Qi [Tue, 28 Jun 2016 11:02:35 +0000 (12:02 +0100)]
Implement get_syscall_trapinfo for aarch64-linux
gdb/gdbserver:
2016-06-28 Yao Qi <yao.qi@linaro.org>
* linux-aarch64-low.c (aarch64_get_syscall_trapinfo): New
function.
(the_low_target): Install aarch64_get_syscall_trapinfo.
Yao Qi [Tue, 28 Jun 2016 11:02:35 +0000 (12:02 +0100)]
Remove parameter sysret from linux_target_ops.get_syscall_trapinfo
When I implement linux_target_ops.get_syscall_trapinfo for aarch64 and arm,
I find the second parameter sysret isn't used at all. In RSP, we don't
need syscall return value either, because GDB can figure out the return
value from registers content got by 'g' packet.
This patch is to remove them.
gdb/gdbserver:
2016-06-28 Yao Qi <yao.qi@linaro.org>
* linux-low.c (get_syscall_trapinfo): Remove parameter sysret.
Callers updated.
* linux-low.h (struct linux_target_ops) <get_syscall_trapinfo>:
Remove parameter sysno.
* linux-x86-low.c (x86_get_syscall_trapinfo): Remove parameter
sysret.
Yao Qi [Tue, 28 Jun 2016 11:02:35 +0000 (12:02 +0100)]
Probe catch syscall support
In
82075af2c14b1f8a54fa5796fb63f7ef23f98d9d (Implement 'catch syscall'
for gdbserver), only x86 is supported, but the test can still be run
on other linux targets, like aarch64 and ppc, with native-gdbserver.
This causes many new fails.
This patch removes the check on isnative and on target triplets.
Instead, we can insert catch point, and resume the program to see whether
catch syscall is supported or not.
gdb/testsuite:
2016-06-28 Yao Qi <yao.qi@linaro.org>
* gdb.base/catch-syscall.exp: Remove check on isnative and target
triplets. Start gdb, execute catch syscall, and continue. Check
gdb's output to determine catch syscall is supported.
James Clarke [Tue, 28 Jun 2016 11:00:56 +0000 (12:00 +0100)]
Don't convert R_SPARC_32 to R_SPARC_RELATIVE if class is ELFCLASS64.
bfd * elfxx-sparc.c (_bfd_sparc_elf_relocate_section): Don't convert
R_SPARC_32 to R_SPARC_RELATIVE if class is ELFCLASS64.
gold * sparc.cc (Target_sparc::Scan::local): Don't convert R_SPARC_32
to R_SPARC_RELATIVE if class is ELFCLASS64.
(Target_sparc::Scan::global): Likewise.
ld * testsuite/ld-elf/symbolic-func.r: Allow non-zero offsets from
.text.
Maciej W. Rozycki [Tue, 28 Jun 2016 10:08:58 +0000 (11:08 +0100)]
MIPS/LD/testsuite: Accept any UNIX OS/ABI with GNU attribute tests
Remove failures with FreeBSD targets, e.g:
regexp_diff match failure
regexp "^ OS/ABI: UNIX - System V$"
line " OS/ABI: UNIX - FreeBSD"
FAIL: ld-mips-elf/attr-gnu-4-50
introduced with commit
351cdf24d223 ("[MIPS] Implement O32 FPXX, FP64
and FP64A ABI extensions").
ld/
* testsuite/ld-mips-elf/attr-gnu-4-10.d: Match any UNIX OS/ABI.
* testsuite/ld-mips-elf/attr-gnu-4-50.d: Likewise.
* testsuite/ld-mips-elf/attr-gnu-4-60.d: Likewise.
* testsuite/ld-mips-elf/attr-gnu-4-70.d: Likewise.
Alan Modra [Tue, 28 Jun 2016 09:33:59 +0000 (19:03 +0930)]
Fix new testcase for hppa64
Anything in first column is a label on hppa64.
PR gas/20247
* testsuite/gas/elf/section11.s: Don't start directives in first column.
Alan Modra [Tue, 28 Jun 2016 09:32:08 +0000 (19:02 +0930)]
Don't run ld-scripts/pr20302 on linuxaout
PR ld/20302
* testsuite/ld-scripts/pr20302.d: Exclude *-*-*aout.
Alan Modra [Tue, 28 Jun 2016 09:29:33 +0000 (18:59 +0930)]
Invalid read in _bfd_elf_get_symbol_version_string
PR 20304
* objdump.c (objdump_print_symname): Don't attempt to retrieve
version info from synthetic symbols.
Richard Sandiford [Tue, 28 Jun 2016 08:21:04 +0000 (09:21 +0100)]
[AArch64] Make register indices be full 64-bit values
aarch64_opnd_info used bitfields to hold vector element indices,
but values were stored into those bitfields before their ranges had
been checked. This meant large invalid indices could be silently
truncated to smaller valid indices.
The two obvious fixes were to do the range checking earlier or use
a full 64-bit field for the index. I went for the latter for two
reasons:
- Doing the range checking in operand_general_constraint_met_p
seems structurally cleaner than doing it while parsing.
- The bitfields didn't really buy us anything. The imm field
of the union is already 128 bits, so we can use a full int64_t
index without growing the structure.
The patch also adds missing range checks for the elements in a register
list index.
include/
* opcode/aarch64.h (aarch64_opnd_info): Change index fields to int64_t.
opcodes/
* aarch64-opc.c (operand_general_constraint_met_p): Check the
range of ldst_elemlist operands.
(print_register_list): Use PRIi64 to print the index.
(aarch64_print_operand): Likewise.
gas/
* testsuite/gas/aarch64/diagnostic.s,
testsuite/gas/aarch64/diagnostic.l: Add tests for out-of-range indices.
Maciej W. Rozycki [Tue, 28 Jun 2016 00:23:36 +0000 (01:23 +0100)]
MIPS16: Add R_MIPS16_PC16_S1 branch relocation support
For R_MIPS16_PC16_S1 the calculation is `(sign_extend(A) + S - P) >> 1'
and the usual MIPS16 bit shuffling applies to relocated field handling,
as per the encoding of the branch target in the extended form of the
MIPS16 B, BEQZ, BNEZ, BTEQZ and BTNEZ instructions.
include/
* elf/mips.h (R_MIPS16_PC16_S1): New relocation.
bfd/
* elf32-mips.c (elf_mips16_howto_table_rel): Add
R_MIPS16_PC16_S1.
(mips16_reloc_map): Likewise.
* elf64-mips.c (mips16_elf64_howto_table_rel): Likewise.
(mips16_elf64_howto_table_rela): Likewise.
(mips16_reloc_map): Likewise.
* elfn32-mips.c (elf_mips16_howto_table_rel): Likewise.
(elf_mips16_howto_table_rela): Likewise.
(mips16_reloc_map): Likewise.
* elfxx-mips.c (mips16_branch_reloc_p): New function.
(mips16_reloc_p): Handle R_MIPS16_PC16_S1.
(b_reloc_p): Likewise.
(mips_elf_calculate_relocation): Likewise.
(_bfd_mips_elf_check_relocs): Likewise.
* reloc.c (BFD_RELOC_MIPS16_16_PCREL_S1): New relocation.
* bfd-in2.h: Regenerate.
* libbfd.h: Regenerate.
gas/
* config/tc-mips.c (mips16_reloc_p): Handle
BFD_RELOC_MIPS16_16_PCREL_S1.
(b_reloc_p): Likewise.
(limited_pcrel_reloc_p): Likewise.
(md_pcrel_from): Likewise.
(md_apply_fix): Likewise.
(tc_gen_reloc): Likewise.
(md_convert_frag): Likewise.
(mips_fix_adjustable): Update comment.
* testsuite/gas/mips/mips16-branch-reloc-2.d: Remove error
output, add dump patterns.
* testsuite/gas/mips/mips16-branch-reloc-3.d: Remove error
output, add dump patterns.
* testsuite/gas/mips/mips16-branch-addend-2.d: Remove error
output, add dump patterns.
* testsuite/gas/mips/mips16-branch-addend-3.d: Remove error
output, add dump patterns.
* testsuite/gas/mips/mips16-branch-absolute.d: Remove error
output, add dump patterns.
* testsuite/gas/mips/mips16-branch-reloc-2.l: Remove file.
* testsuite/gas/mips/mips16-branch-reloc-3.l: Remove file.
* testsuite/gas/mips/mips16-branch-addend-2.l: Remove file.
* testsuite/gas/mips/mips16-branch-addend-3.l: Remove file.
* testsuite/gas/mips/mips16-branch-absolute.l: Remove file.
* testsuite/gas/mips/mips16-branch-addend-2.s: Add padding.
* testsuite/gas/mips/branch-weak.s: Adjust alignment, avoid
implicit instruction padding, avoid MIPS16 JR->JRC conversion.
* testsuite/gas/mips/branch-weak-6.d: New test.
* testsuite/gas/mips/branch-weak-7.d: New test.
* testsuite/gas/mips/mips.exp: Run the new tests.
ld/
* testsuite/ld-mips-elf/mips16-branch-2.d: New test.
* testsuite/ld-mips-elf/mips16-branch-3.d: New test.
* testsuite/ld-mips-elf/mips16-branch-addend-2.d: New test.
* testsuite/ld-mips-elf/mips16-branch-addend-3.d: New test.
* testsuite/ld-mips-elf/mips16-branch.s: New test source.
* testsuite/ld-mips-elf/mips-elf.exp: Run the new tests.
GDB Administrator [Tue, 28 Jun 2016 00:00:21 +0000 (00:00 +0000)]
Automatic date update in version.in
Manish Goregaokar [Mon, 27 Jun 2016 16:54:15 +0000 (22:24 +0530)]
Fix changelog
Manish Goregaokar [Mon, 27 Jun 2016 15:46:59 +0000 (21:16 +0530)]
Print void types correctly in Rust
Rust prefers to not specify the return type of a function when it is unit
(`()`). The type is also referred to as "void" in debuginfo but not in actual
usage, so we should never be printing "void" when the language is Rust.
2016-06-27 Manish Goregaokar <manish@mozilla.com>
gdb/ChangeLog:
* rust-lang.c (rust_print_type): Print unit types as "()"
* rust-lang.c (rust_print_type): Omit return type for functions
returning unit
gdb/testsuite/ChangeLog:
* gdb.rust/simple.rs: Add test for returning unit in a function
* gdb.rust/simple.exp: Add expectation for functions returning unit
Vineet Gupta [Mon, 27 Jun 2016 15:50:29 +0000 (16:50 +0100)]
Make the kernel dwarf stack unwinder work for ARC targets.
* config//tc-arc.c (tc_arc_frame_initial_instructions): Use
cfi_add_CFA_def_cfa to generate default CFA with offset
* testsuite/gas/cfi/cfi-arc-1.d: Update expected output.
Nick Clifton [Mon, 27 Jun 2016 15:35:58 +0000 (16:35 +0100)]
Allow a second -T<section>=<addr> to override a previous version on the same linker command line.
PR ld/20302
* lexsup.c (set_segment_start): If resetting the start address of
a section, remember to generate a new script element as well.
* testsuite/ld-scripts/pr20302.d: New test.
* testsuite/ld-scripts/scripts.exp: Run the new test.
Nick Clifton [Mon, 27 Jun 2016 12:52:20 +0000 (13:52 +0100)]
oops - omitted from previous delta
Nick Clifton [Mon, 27 Jun 2016 12:49:09 +0000 (13:49 +0100)]
Add command line option to stop the assembler from padding the end of sections to their alignment boundary.
PR gas/20247
* as.h (do_not_pad_sections_to_alignment): New global variable.
* as.c (show_usage): Add --no-pad-sections.
(parse_args): Likewise.
* write.c (size_seg): Skip padding the end of the section if
requested from the command line.
(SUB_SEGMENT_ALIGN): Likewise.
* doc/as.texinfo: Document the new option.
* NEWS: Mention the new feature.
* testsuite/gas/elf/section11.s: New test.
* testsuite/gas/elf/section11.d: New test driver.
* testsuite/gas/elf/elf.exp: Run the new test.
Alan Modra [Mon, 27 Jun 2016 10:30:09 +0000 (20:00 +0930)]
PR 19264 looping in ppc64_elf_size_stubs
b399102 fixed the testcase in this PR but it may be possible to
trigger the problem in other ways.
PR ld/19264
* elf64-ppc.c (STUB_SHRINK_ITER): Define.
(ppc64_elf_size_stubs): Exit stub sizing loop past STUB_SHRINK_ITER
if shrinking stubs.
(ppc64_elf_size_stubs): Adjust to suit.
Pierre-Marie de Rodat [Mon, 27 Jun 2016 10:11:25 +0000 (12:11 +0200)]
Fix use of a dangling pointer for Python breakpoint objects
When a Python script tries to create a breakpoint but fails to do so,
gdb.Breakpoint.__init__ raises an exception and the breakpoint does not
exist anymore in the Python interpreter. However, GDB still keeps a
reference to the Python object to be used for a later hook, which is
wrong.
This commit adds the necessary cleanup code so that there is no stale
reference to this Python object. It also adds a new testcase to
reproduce the bug and check the fix.
2016-06-25 Pierre-Marie de Rodat <derodat@adacore.com>
gdb/
* python/py-breakpoint.c (bppy_init): Clear bppy_pending_object
when there is an error during the breakpoint creation.
gdb/testsuite
* gdb.python/py-breakpoint-create-fail.c,
gdb.python/py-breakpoint-create-fail.exp,
gdb.python/py-breakpoint-create-fail.py: New testcase.
Trevor Saunders [Mon, 27 Jun 2016 10:01:34 +0000 (06:01 -0400)]
add ChangeLog entries
Trevor Saunders [Sat, 4 Jun 2016 01:43:06 +0000 (21:43 -0400)]
dlx: move prototype of dlx_set_skip_hi16 to elf/dlx.h
bfd/ChangeLog:
2016-06-27 Trevor Saunders <tbsaunde+binutils@tbsaunde.org>
* elf32-dlx.h: New file.
* elf32-dlx.c: Adjust.
gas/ChangeLog:
2016-06-27 Trevor Saunders <tbsaunde+binutils@tbsaunde.org>
* config/tc-dlx.c: Include bfd/elf32-dlx.h.
* config/tc-dlx.h: Remove prototype of dlx_set_skip_hi16.
Trevor Saunders [Mon, 23 May 2016 04:35:40 +0000 (00:35 -0400)]
xtensa: remove a sentinal
gas/ChangeLog:
2016-06-27 Trevor Saunders <tbsaunde+binutils@tbsaunde.org>
* config/tc-xtensa.c (xtensa_elf_suffix): Use ARRAY_SIZE instead of a
sentinal element.
(map_suffix_reloc_to_operator): Likewise.
(map_operator_to_reloc): Likewise.
Trevor Saunders [Sat, 28 May 2016 22:16:47 +0000 (18:16 -0400)]
nds32: remove a sentinal
gas/ChangeLog:
2016-06-27 Trevor Saunders <tbsaunde+binutils@tbsaunde.org>
* config/tc-nds32.c (md_begin): Use ARRAY_SIZE instead of a sentinal
element in relax_table.
GDB Administrator [Mon, 27 Jun 2016 00:00:10 +0000 (00:00 +0000)]
Automatic date update in version.in
GDB Administrator [Sun, 26 Jun 2016 00:00:17 +0000 (00:00 +0000)]
Automatic date update in version.in
Trevor Saunders [Sat, 4 Jun 2016 21:56:32 +0000 (17:56 -0400)]
aarch64: make the type of reg_entry::type aarch64_reg_type
gas/ChangeLog:
2016-06-25 Trevor Saunders <tbsaunde+binutils@tbsaunde.org>
* config/tc-aarch64.c: Make the type of reg_entry::type
aarch_reg_type.
Trevor Saunders [Thu, 21 Apr 2016 13:56:50 +0000 (09:56 -0400)]
remove a few sentinals
gas/ChangeLog:
2016-06-25 Trevor Saunders <tbsaunde+binutils@tbsaunde.org>
* config/tc-bfin.c (bfin_cpus): Remove sentinal.
(md_parse_option): Adjust.
* config/tc-aarch64.c (aarch64_parse_abi): Replace use of a sentinal
with iteration from 0 to ARRAY_SIZE.
* config/tc-mcore.c (md_begin): Likewise.
* config/tc-visium.c (visium_parse_arch): Likewise.
opcodes/ChangeLog:
2016-06-25 Trevor Saunders <tbsaunde+binutils@tbsaunde.org>
* mcore-opc.h: Remove sentinal.
* mcore-dis.c (print_insn_mcore): Adjust.
Trevor Saunders [Mon, 6 Jun 2016 02:25:21 +0000 (22:25 -0400)]
simplify tic54x_set_default_include ()
its only called with an argument of 0, so we might as well remove the code
supporting other values.
gas/ChangeLog:
2016-06-25 Trevor Saunders <tbsaunde+binutils@tbsaunde.org>
* config/tc-tic54x.c (tic54x_set_default_include): remove argument
and simplify accordingly.
(tic54x_include): Adjust.
(tic54x_mlib): Likewise.
Trevor Saunders [Sat, 4 Jun 2016 20:46:58 +0000 (16:46 -0400)]
xtensa: prototype xtensa_make_property_section in elf/xtensa.h
There's no reason to have multiple prototypes for the same function.
include/ChangeLog:
2016-06-25 Trevor Saunders <tbsaunde+binutils@tbsaunde.org>
* elf/xtensa.h (xtensa_make_property_section): New prototype.
gas/ChangeLog:
2016-06-25 Trevor Saunders <tbsaunde+binutils@tbsaunde.org>
* config/tc-xtensa.c (xtensa_make_property_section): Remove prototype.
bfd/ChangeLog:
2016-06-25 Trevor Saunders <tbsaunde+binutils@tbsaunde.org>
* elf32-xtensa.c (xtensa_make_property_section): Remove prototype.
Tom Tromey [Sat, 25 Jun 2016 14:41:45 +0000 (08:41 -0600)]
Fix formatting in rust-lang.c
This fixes up a few formatting nits in rust-lang.c.
Built and regtested on x86-64 Fedora 23.
2016-06-25 Tom Tromey <tom@tromey.com>
* rust-lang.c (rust_get_disr_info, rust_print_type): Fix
formatting.
Manish Goregaokar [Sat, 25 Jun 2016 05:40:38 +0000 (11:10 +0530)]
Add tests for printing of NonZero-optimized enums in Rust
gdb/testsuite/ChangeLog:
2016-06-25 Manish Goregaokar <manish@mozilla.com>
PR gdb/20239
* gdb.rust/simple.rs: Add more tests for printing NonZero enums.
* gdb.rust/simple.exp: Add test expectations for new NonZero tests.
Manish Goregaokar [Sat, 25 Jun 2016 05:39:23 +0000 (11:09 +0530)]
Make evaluation and type-printing of all NonZero optimized enums work
gdb/ChangeLog:
2016-06-25 Manish Goregaokar <manish@mozilla.com>
PR gdb/20239
* rust-lang.c (rust_get_disr_info): Correctly interpret
NonZero-optimized enums of arbitrary depth.
(rust_print_type): Correctly print NonZero-optimized
enums.
David Taylor [Tue, 12 Apr 2016 19:02:57 +0000 (15:02 -0400)]
Support structure offsets that are 512K or larger.
GDB computes structure byte offsets using a 32 bit integer. And,
first it computes the offset in bits and then converts to bytes. The
result is that any offset that if 512K bytes or larger overflows.
This patch changes GDB to use LONGEST for such calculations.
PR gdb/17520 Structure offset wrong when 1/4 GB or greater.
* c-lang.h: Change all parameters, variables, and struct or union
members used as struct or union fie3ld offsets from int to
LONGEST.
* c-valprint.c: Likewise.
* cp-abi.c: Likewise.
* cp-abi.h: Likewise.
* cp-valprint.c: Likewise.
* d-valprint.c: Likewise.
* dwarf2loc.c: Likewise.
* eval.c: Likewise.
* extension-priv.h: Likewise.
* extension.c: Likewise.
* extension.h: Likewise.
* findvar.c: Likewise.
* gdbtypes.h: Likewise.
* gnu-v2-abi.c: Likewise.
* gnu-v3-abi.c: Likewise.
* go-valprint.c: Likewise.
* guile/guile-internal.h: Likewise.
* guile/scm-pretty-print.c: Likewise.
* jv-valprint.c Likewise.
* opencl-lang.c: Likewise.
* p-lang.h: Likewise.
* python/py-prettyprint.c: Likewise.
* python/python-internal.h: Likewise.
* spu-tdep.c: Likewise.
* typeprint.c: Likewise.
* valarith.c: Likewise.
* valops.c: Likewise.
* valprint.c: Likewise.
* valprint.h: Likewise.
* value.c: Likewise.
* value.h: Likewise.
* p-valprint.c: Likewise.
* c-typeprint.c (c_type_print_base): When printing offset, use
plongest, not %d.
* gdbtypes.c (recursive_dump_type): Ditto.
GDB Administrator [Sat, 25 Jun 2016 00:00:19 +0000 (00:00 +0000)]
Automatic date update in version.in
Maciej W. Rozycki [Fri, 24 Jun 2016 23:49:10 +0000 (00:49 +0100)]
MIPS16/GAS: Restore unsupported relocation diagnostics
Correct a MIPS16 relocation handling regression in GAS introduced with:
commit
177b4a6ad0047c8995fbc55016bc4f4b68d53b4a
Author: Alexandre Oliva <aoliva@redhat.com>
Date: Mon Mar 18 18:56:18 2002 +0000
discussed at <https://sourceware.org/ml/binutils/2002-03/msg00345.html>,
which removed a preparatory call to `mips16_extended_frag' previously
made from `md_estimate_size_before_relax'. As a result the function is
never called with its `sec' parameter non-NULL and consequently all the
unsupported relocation checks within are dead and never trigger, causing
any unhandled relocations to silently resolve to 0. Unfortunately there
was no sufficient test suite coverage back then to catch this.
Remove all dead code then, and all the associated comments. Update the
remaining call to `mips16_extended_frag' from `mips_relax_frag' to pass
the relocation section as the `sec' parameter and use it to mark frags
which require an external relocation, as extended. Finally handle any
outstanding MIPS16 relocations in `md_convert_frag' and report an error
since we don't support any except with percent operators.
gas/
* config/tc-mips.c (append_insn): Use any `O_symbol' expression
unchanged with relaxed MIPS16 instructions.
(mips16_extended_frag): Adjust accordingly. Return 1 right
away if a relocation will be required for the symbol requested.
Remove dead first relaxation pass code.
(mips_relax_frag): Pass `sec' down to `mips16_extended_frag'.
(md_convert_frag): Adjust symbol value calculation. Raise an
error if a relocation is required for the symbol requested.
* testsuite/gas/mips/mips16@relax-swap3.d: Remove dump patterns,
add error output.
* testsuite/gas/mips/mips16@relax-swap3.l: New error output.
* testsuite/gas/mips/mips16-pcrel-relax-0.d: New test.
* testsuite/gas/mips/mips16-pcrel-relax-1.d: New test.
* testsuite/gas/mips/mips16-pcrel-relax-2.d: New test.
* testsuite/gas/mips/mips16-pcrel-relax-3.d: New test.
* testsuite/gas/mips/mips16-pcrel-reloc-0.d: New test.
* testsuite/gas/mips/mips16-pcrel-reloc-1.d: New test.
* testsuite/gas/mips/mips16-pcrel-reloc-2.d: New test.
* testsuite/gas/mips/mips16-pcrel-reloc-3.d: New test.
* testsuite/gas/mips/mips16-pcrel-reloc-4.d: New test.
* testsuite/gas/mips/mips16-pcrel-reloc-5.d: New test.
* testsuite/gas/mips/mips16-pcrel-reloc-6.d: New test.
* testsuite/gas/mips/mips16-pcrel-reloc-7.d: New test.
* testsuite/gas/mips/mips16-pcrel-addend-0.d: New test.
* testsuite/gas/mips/mips16-pcrel-addend-1.d: New test.
* testsuite/gas/mips/mips16-pcrel-addend-2.d: New test.
* testsuite/gas/mips/mips16-pcrel-addend-3.d: New test.
* testsuite/gas/mips/mips16-pcrel-absolute.d: New test.
* testsuite/gas/mips/mips16-branch-reloc-0.d: New test.
* testsuite/gas/mips/mips16-branch-reloc-1.d: New test.
* testsuite/gas/mips/mips16-branch-reloc-2.d: New test.
* testsuite/gas/mips/mips16-branch-reloc-3.d: New test.
* testsuite/gas/mips/mips16-branch-addend-0.d: New test.
* testsuite/gas/mips/mips16-branch-addend-1.d: New test.
* testsuite/gas/mips/mips16-branch-addend-2.d: New test.
* testsuite/gas/mips/mips16-branch-addend-3.d: New test.
* testsuite/gas/mips/mips16-branch-absolute.d: New test.
* testsuite/gas/mips/mips16-absolute-reloc-0.d: New test.
* testsuite/gas/mips/mips16-absolute-reloc-1.d: New test.
* testsuite/gas/mips/mips16-absolute-reloc-2.d: New test.
* testsuite/gas/mips/mips16-absolute-reloc-3.d: New test.
* testsuite/gas/mips/mips16-pcrel-reloc-2.l: New error output.
* testsuite/gas/mips/mips16-pcrel-reloc-3.l: New error output.
* testsuite/gas/mips/mips16-pcrel-reloc-6.l: New error output.
* testsuite/gas/mips/mips16-pcrel-reloc-7.l: New error output.
* testsuite/gas/mips/mips16-pcrel-addend-2.l: New error output.
* testsuite/gas/mips/mips16-pcrel-addend-3.l: New error output.
* testsuite/gas/mips/mips16-pcrel-absolute.l: New error output.
* testsuite/gas/mips/mips16-branch-reloc-2.l: New error output.
* testsuite/gas/mips/mips16-branch-reloc-3.l: New error output.
* testsuite/gas/mips/mips16-branch-addend-2.l: New error output.
* testsuite/gas/mips/mips16-branch-addend-3.l: New error output.
* testsuite/gas/mips/mips16-branch-absolute.l: New error output.
* testsuite/gas/mips/mips16-absolute-reloc-2.l: New error output.
* testsuite/gas/mips/mips16-absolute-reloc-3.l: New error output.
* testsuite/gas/mips/mips16-pcrel-relax-0.s: New test source.
* testsuite/gas/mips/mips16-pcrel-relax-2.s: New test source.
* testsuite/gas/mips/mips16-pcrel-reloc-0.s: New test source.
* testsuite/gas/mips/mips16-pcrel-reloc-1.s: New test source.
* testsuite/gas/mips/mips16-pcrel-reloc-2.s: New test source.
* testsuite/gas/mips/mips16-pcrel-reloc-3.s: New test source.
* testsuite/gas/mips/mips16-pcrel-reloc-4.s: New test source.
* testsuite/gas/mips/mips16-pcrel-reloc-5.s: New test source.
* testsuite/gas/mips/mips16-pcrel-reloc-6.s: New test source.
* testsuite/gas/mips/mips16-pcrel-reloc-7.s: New test source.
* testsuite/gas/mips/mips16-pcrel-addend-0.s: New test source.
* testsuite/gas/mips/mips16-pcrel-addend-1.s: New test source.
* testsuite/gas/mips/mips16-pcrel-addend-2.s: New test source.
* testsuite/gas/mips/mips16-pcrel-addend-3.s: New test source.
* testsuite/gas/mips/mips16-pcrel-absolute.s: New test source.
* testsuite/gas/mips/mips16-branch-reloc-0.s: New test source.
* testsuite/gas/mips/mips16-branch-reloc-1.s: New test source.
* testsuite/gas/mips/mips16-branch-reloc-2.s: New test source.
* testsuite/gas/mips/mips16-branch-reloc-3.s: New test source.
* testsuite/gas/mips/mips16-branch-addend-0.s: New test source.
* testsuite/gas/mips/mips16-branch-addend-1.s: New test source.
* testsuite/gas/mips/mips16-branch-addend-2.s: New test source.
* testsuite/gas/mips/mips16-branch-addend-3.s: New test source.
* testsuite/gas/mips/mips16-branch-absolute.s: New test source.
* testsuite/gas/mips/mips16-absolute-reloc-0.s: New test source.
* testsuite/gas/mips/mips16-absolute-reloc-1.s: New test source.
* testsuite/gas/mips/mips16-absolute-reloc-2.s: New test source.
* testsuite/gas/mips/mips16-absolute-reloc-3.s: New test source.
* testsuite/gas/mips/mips.exp: Run the new tests.
David Taylor [Fri, 24 Jun 2016 21:05:31 +0000 (17:05 -0400)]
Add myself as a Write After Approval maintainer.
John Baldwin [Mon, 13 Jun 2016 04:24:42 +0000 (21:24 -0700)]
Add support for catching system calls to native FreeBSD targets.
All platforms on FreeBSD use a shared system call table, so use a
single XML file to describe the system calls available on each FreeBSD
platform.
Recent versions of FreeBSD include the identifier of the current
system call when reporting a system call entry or exit event in the
ptrace_lwpinfo structure obtained via PT_LWPINFO in fbsd_wait. As
such, FreeBSD native targets do not use the gdbarch method to fetch
the system call code. In addition, FreeBSD register sets fetched via
ptrace do not include an equivalent of 'orig_rax' (on amd64 for
example), so the system call code cannot be extracted from the
available registers during a system call exit. However, GDB assumes
that system call catch points are not supported if the gdbarch method
is not present. As a workaround, FreeBSD ABIs install a dummy gdbarch
method that throws an internal_error if it is ever invoked.
gdb/ChangeLog:
* configure.ac: Check for support for system call LWP fields on
FreeBSD.
* config.in, configure: Rebuild.
* data-directory/Makefile.in (SYSCALLS_FILES): Add freebsd.xml.
* fbsd-nat.c (fbsd_wait) [HAVE_STRUCT_PTRACE_LWPINFO_PL_SYSCALL_CODE]:
Report system call events.
[HAVE_STRUCT_PTRACE_LWPINFO_PL_SYSCALL_CODE]
(fbsd_set_syscall_catchpoint): New function.
(fbsd_nat_add_target) [HAVE_STRUCT_PTRACE_LWPINFO_PL_SYSCALL_CODE]:
Set "to_set_syscall_catchpoint" to "fbsd_set_syscall_catchpoint".
* fbsd-tdep.c: Include xml-syscall.h
(fbsd_get_syscall_number): New function.
(fbsd_init_abi): Set XML system call file name.
Add "get_syscall_number" gdbarch method.
* syscalls/freebsd.xml: New file.
John Baldwin [Thu, 16 Jun 2016 04:33:42 +0000 (21:33 -0700)]
Add a gdbarch 'print_auxv_entry' method for FreeBSD ABIs.
Add a 'print_auxv_entry' method for FreeBSD ABIs that parses
FreeBSD-specific auxiliary vector entries and outputs a suitable
description using fprint_auxv_entry.
gdb/ChangeLog:
* fbsd-tdep.c: Include "auxv.h".
(fbsd_print_auxv_entry): New function.
(fbsd_init_abi): Install gdbarch "print_auxv_entry" method.
John Baldwin [Sat, 11 Jun 2016 22:51:38 +0000 (15:51 -0700)]
Add a new gdbarch method to print a single AUXV entry.
Different platforms have different meanings for auxiliary vector
entries. The 'print_auxv_entry' gdbarch method allows an architecture
to output a suitable description for platform-specific entries.
A fprint_auxv_entry function is split out of fprint_target_auxv.
This function outputs the description of a single auxiliary vector
entry to the specified file using caller-supplied formatting and
strings to describe the vector type.
The existing switch on auxiliary vector types is moved out of
fprint_target_auxv into a new default_print_auxv_entry function.
default_print_auxv_entry chooses an appropriate format and description
and calls fprint_single_auxv to describe a single vector entry.
This function is used as the default 'print_auxv_entry' gdbarch method.
fprint_target_auxv now invokes the gdbarch 'print_auxv_entry' method
on each vector entry.
gdb/ChangeLog:
* auxv.c (fprint_auxv_entry): New function.
(default_print_auxv_entry): New function.
(fprint_target_auxv): Use gdbarch_print_auxv_entry.
* auxv.h (enum auxv_format): New enum.
(fprint_auxv_entry): Declare.
(default_print_auxv_entry): Declare.
* gdbarch.sh (print_auxv_entry): New.
* gdbarch.c, gdbarch.h: Re-generated.
John Baldwin [Sun, 12 Jun 2016 19:34:51 +0000 (12:34 -0700)]
Create a pseudo section for the ELF AUXV core dump note on FreeBSD.
The procstat AUXV core dump note in FreeBSD consists of 32-bit integer
followed by an array of auxiliary vector entries.
bfd/ChangeLog:
* elf.c (elfcore_grok_freebsd_note): Handle NT_FREEBSD_PROCSTAT_AUXV
notes.
John Baldwin [Sat, 11 Jun 2016 22:07:38 +0000 (15:07 -0700)]
Fetch the ELF auxiliary vector from live processes on FreeBSD.
Use the kern.proc.auxv.<pid> sysctl to fetch the ELF auxiliary vector for
a live process.
gdb/ChangeLog:
* fbsd-nat.c [KERN_PROC_AUXV] New variable super_xfer_partial.
(fbsd_xfer_partial): New function.
(fbsd_nat_add_target) [KERN_PROC_AUXV] Set "to_xfer_partial" to
"fbsd_xfer_partial".
John Baldwin [Sun, 12 Jun 2016 15:56:31 +0000 (08:56 -0700)]
Add elfcore_grok_freebsd_note to parse FreeBSD ELF core notes.
Move parsing of FreeBSD-specific ELF core notes out of elfcore_grok_note
into a new elfcore_grok_freebsd_note function. Add core note grok routines
for FreeBSD's psinfo and prstatus notes while here rather than depending
on the native handling in elfcore_grok_note.
bfd/ChangeLog:
* elf.c (elfcore_grok_note): Remove handling of NT_X86_XSTATE for
FreeBSD. Remove case for NT_FREEBSD_THRMISC.
(elfcore_grok_freebsd_psinfo): New function.
(elfcore_grok_freebsd_prstatus): New function.
(elfcore_grok_freebsd_note): New function.
(elf_parse_notes): Use "elfcore_grok_freebsd_note" for "FreeBSD"
notes.
John Baldwin [Thu, 16 Jun 2016 05:44:11 +0000 (22:44 -0700)]
Add constants for FreeBSD-specific auxiliary vector entry types.
include/ChangeLog:
* elf/common.h (AT_FREEBSD_EXECPATH, AT_FREEBSD_CANARY)
(AT_FREEBSD_CANARYLEN, AT_FREEBSD_OSRELDATE, AT_FREEBSD_NCPUS)
(AT_FREEBSD_PAGESIZES, AT_FREEBSD_PAGESIZESLEN)
(AT_FREEBSD_TIMEKEEP, AT_FREEBSD_STACKPROT): Define.
Joel Brobecker [Fri, 24 Jun 2016 17:04:56 +0000 (13:04 -0400)]
Add missing ChangeLog entry for "fix undefined reference [...]" commit.
Joel Brobecker [Fri, 24 Jun 2016 16:16:24 +0000 (12:16 -0400)]
fix undefined reference to bfd_link_plugin_object_p during link
When configured with the default options, GDB currently fails to link,
due to an undefined reference to bfd_link_plugin_object_p, coming from
elflink.c:
#ifdef BFD_SUPPORTS_PLUGINS
|| (abfd->plugin_format == bfd_plugin_unknown
&& bfd_link_plugin_object_p (abfd))
#endif
This is because BFD_SUPPORTS_PLUGINS is always defined. It is its value
that determines whether plugin support is enabled or not.
bfd/ChangeLog:
* elflink.c: Check the value of BFD_SUPPORTS_PLUGINS rather
than its existance.
Alan Modra [Thu, 23 Jun 2016 12:41:57 +0000 (22:11 +0930)]
MIPS objcopy --rename-section fix
Some MIPS targets use a named section symbol rather than a symbol with
no name as is used with most ELF targets. When renaming sections, the
named section symbol needs to be renamed too.
Rather than fix this bug, I'd originally intended to just correct the
xfail added recently for update-1.o vs update4.o in update-section.exp,
using the same set of targets for the localize-hidden-1 mips xfail.
I'd extracted that target test into a new function, is_bad_symtab. It
turns out to be useful in readelf.exp too.
bfd/
* config.bfd: Delete mips vxworks patterns matched earlier.
Combine mips*-*-none with mips*-*-elf*.
binutils/
* objcopy.c (find_section_rename): Forward declare. Remove
ibfd and sec_ptr param. Add old_name param. Allow for NULL
returned_flags. Move read of section name and flags to..
(setup_section): ..here. Update find_section_rename call.
(filter_symbols): Rename section symbols for renamed sections.
(copy_object): Call filter_symbols when renamed sections.
* testsuite/lib/binutils-common.exp (is_bad_symtab): New.
* testsuite/binutils-all/update-section.exp: Revert
96037eb0
mips xfail.
* testsuite/binutils-all/objcopy.exp (copy_executable): Use
is_bad_symtab.
(localize-hidden-1): xfail if is_bad_symtab.
* testsuite/binutils-all/readelf.exp: Use is_bad_symtab to select
between mips/tmips.
Alan Modra [Fri, 24 Jun 2016 01:50:53 +0000 (11:20 +0930)]
aarch64 ld testsuite
Fixes failure on aarch64-rtems.
* testsuite/ld-aarch64/aarch64-elf.exp (aarch64_choose_ilp32_emul):
Don't error out, always return an emulation.
Alan Modra [Fri, 24 Jun 2016 01:24:50 +0000 (10:54 +0930)]
alpha-openbsd build failure
This target doesn't build, due to a missing gas/config/te-obsd.h file.
It's been that way since the commit switching to elf, in 2002.
https://lists.gnu.org/archive/html/bug-gnu-utils/2002-07/msg00128.html
* configure.tgt (alpha-*-openbsd*): Use em=nbsd.
Alan Modra [Fri, 24 Jun 2016 01:20:25 +0000 (10:50 +0930)]
Limit objdump -S context lines
Showing context lines is confusing in many cases, an obvious example
being loops.
* objdump.c (struct print_file_list): Add "max_printed".
(try_print_file_open): Init new field.
(show_line): Don't show 5 context lines when redisplaying source.
H.J. Lu [Fri, 24 Jun 2016 12:21:43 +0000 (05:21 -0700)]
Check DEFAULT_LD_Z_RELRO for -z relro help message
* lexsup.c (elf_shlib_list_options): Check DEFAULT_LD_Z_RELRO
for -z relro help message.
Tom Tromey [Thu, 26 May 2016 21:04:07 +0000 (15:04 -0600)]
Move logic out of symbol_find_demangled_name
This patch moves most of the demangling logic out of
symbol_find_demangled_name into the various language_defn objects.
The simplest way to do this seemed to be to add a new method to
language_defn. This is shame given the existing la_demangle, but
given Ada's unusual needs, and the differing demangling options
between languages, la_demangle didn't seem to fit.
In order to make this work, I made enum language order-sensitive.
This helps preserve the current ordering of demangling operations.
2016-06-23 Tom Tromey <tom@tromey.com>
* symtab.c (symbol_find_demangled_name): Loop over languages and
use language_sniff_from_mangled_name.
* rust-lang.c (rust_sniff_from_mangled_name): New function.
(rust_language_defn): Update.
* p-lang.c (pascal_language_defn): Update.
* opencl-lang.c (opencl_language_defn): Update.
* objc-lang.c (objc_sniff_from_mangled_name): New function.
(objc_language_defn): Update.
* m2-lang.c (m2_language_defn): Update.
* language.h (struct language_defn) <la_sniff_from_mangled_name>: New
field.
(language_sniff_from_mangled_name): Declare.
* language.c (language_sniff_from_mangled_name): New function.
(unknown_language_defn, auto_language_defn, local_language_defn):
Update.
* jv-lang.c (java_sniff_from_mangled_name): New function.
(java_language_defn): Use it.
* go-lang.c (go_sniff_from_mangled_name): New function.
(go_language_defn): Use it.
* f-lang.c (f_language_defn): Update.
* defs.h (enum language): Reorder.
* d-lang.c (d_sniff_from_mangled_name): New function.
(d_language_defn): Use it.
* cp-support.h (gdb_sniff_from_mangled_name): Declare.
* cp-support.c (gdb_sniff_from_mangled_name): New function.
* c-lang.c (c_language_defn, cplus_language_defn)
(asm_language_defn, minimal_language_defn): Update.
* ada-lang.c (ada_sniff_from_mangled_name): New function.
(ada_language_defn): Use it.
Tom Tromey [Thu, 26 May 2016 16:33:28 +0000 (10:33 -0600)]
Move filename extensions into language_defn
This moves filename extensions from a function in symfile.c out to
each language_defn. I think this is an improvement because it means
less digging around when writing a new language port.
2016-06-23 Tom Tromey <tom@tromey.com>
* ada-lang.c (ada_extensions): New array.
(ada_language_defn): Use it.
* c-lang.c (c_extensions): New array.
(c_language_defn): Use it.
(cplus_extensions): New array.
(cplus_language_defn): Use it.
(asm_extensions): New array.
(asm_language_defn): Use it.
(minimal_language_defn): Update.
* d-lang.c (d_extensions): New array.
(d_language_defn): Use it.
* f-lang.c (f_extensions): New array.
(f_language_defn): Use it.
* go-lang.c (go_language_defn): Update.
* jv-lang.c (java_extensions): New array.
(java_language_defn): Use it.
* language.c (add_language): Call add_filename_language.
(unknown_language_defn, auto_language_defn, local_language_defn):
Update.
* language.h (struct language_defn) <la_filename_extensions>: New
field.
* m2-lang.c (m2_language_defn): Update.
* objc-lang.c (objc_extensions): New array.
(objc_language_defn): Use it.
* opencl-lang.c (opencl_language_defn): Update.
* p-lang.c (p_extensions): New array.
(pascal_language_defn): Use it.
* rust-lang.c (rust_extensions): New array.
(rust_language_defn): Use it.
* symfile.c (add_filename_language): No longer static. Make "ext"
const.
(init_filename_language_table): Remove.
(_initialize_symfile): Update.
* symfile.h (add_filename_language): Declare.
Tom Tromey [Thu, 26 May 2016 16:22:03 +0000 (10:22 -0600)]
Use VEC for filename_language_table
This patch changes filename_language_table to be a VEC. This seemed
like a reasonable cleanup over the old code.
2016-06-23 Tom Tromey <tom@tromey.com>
* symfile.c (filename_language_table): Now a VEC.
(fl_table_size, fl_table_next): Remove.
(add_filename_language): Use VEC_safe_push.
(set_ext_lang_command, info_ext_lang_command)
(deduce_language_from_filename): Use VEC_iterate.
(init_filename_language_table): Use VEC_empty.
Tom Tromey [Thu, 9 Jun 2016 21:07:55 +0000 (15:07 -0600)]
Make gdbpy_parameter static
While working on the next patch in this series, I noticed that
gdbpy_parameter did not need to be exported. This makes it "static".
2016-06-23 Tom Tromey <tom@tromey.com>
* python/python.c (gdbpy_parameter): Now static.
* python/python-internal.h (gdbpy_parameter): Don't declare.
GDB Administrator [Fri, 24 Jun 2016 00:00:15 +0000 (00:00 +0000)]
Automatic date update in version.in
Cary Coutant [Thu, 23 Jun 2016 16:45:25 +0000 (09:45 -0700)]
Fix bug with grouping sections.
The fix for PR 15370 did not correctly check all patterns in a group,
but instead threw all unassigned sections into the group. This patch
fixes that.
2016-06-23 Cary Coutant <ccoutant@gmail.com>
Igor Kudrin <ikudrin@accesssoftek.com>
gold/
PR gold/15370
* script-sections.cc
(Output_section_element_input::set_section_addresses): Keep bin_count
separate from input_pattern_count.
* testsuite/script_test_12.t: Add another section .x4.
* testsuite/script_test_12i.t: Likewise.
* testsuite/script_test_12a.c: Likewise.
* testsuite/script_test_12b.c: Likewise.
Igor Kudrin [Thu, 23 Jun 2016 15:50:18 +0000 (08:50 -0700)]
Fix compilation error in MSYS2 environment.
gold/
* gold-threads.cc (impl_threads::Lock_impl_threads): Fix typos.
Tom Tromey [Mon, 20 Jun 2016 16:28:37 +0000 (10:28 -0600)]
PR gdb/16483 - simplify "info frame-filters" output
PR gdb/16483 notes that the output of "info frame-filters" is quite
voluminous. In particular it prints an entry for each objfile, even if
only to say that the objfile does not have any associated frame filters.
I think it's better to only print output when there is a frame filter.
There's nothing worth doing with the no-frame-filter information, and
limiting the output makes it much more readable.
Built and regtested on x86-64 Fedora 23.
2016-06-23 Tom Tromey <tom@tromey.com>
PR gdb/16483:
* python/lib/gdb/command/frame_filters.py
(InfoFrameFilter.list_frame_filters): Rename to print_list. Print
nothing if no filters found. Return value indicating whether
filters were printed.
(InfoFrameFilter.print_list): Remove.
(InfoFrameFilter.invoke): Print message if no frame filters
found.
2016-06-23 Tom Tromey <tom@tromey.com>
PR gdb/16483:
* gdb.python/py-framefilter.exp: Add "info frame-filter" test
before any filters are loaded.
Maciej W. Rozycki [Thu, 23 Jun 2016 10:33:52 +0000 (11:33 +0100)]
MIPS/GAS: Keep the original microMIPS symbol reference in branch relocs
Keep original microMIPS symbols in references from branch relocations so
that the ISA bit is retained and can be verified for validity in static
link. No need to update WRT MIPS16 symbols because we keep them all
anyway for other reasons.
gas/
* config/tc-mips.c (b_reloc_p): New function.
(mips_fix_adjustable): Also keep the original microMIPS symbol
referred from branch relocations.
* testsuite/gas/mips/branch-local-1.d: New test.
* testsuite/gas/mips/branch-local-n32-1.d: New test.
* testsuite/gas/mips/branch-local-n64-1.d: New test.
* testsuite/gas/mips/micromips@branch-misc-4-64.d: Update
relocations.
* testsuite/gas/mips/branch-local-1.s: New test source.
* testsuite/gas/mips/mips.exp: Run the new cases.
Graham Markall [Tue, 21 Jun 2016 19:25:29 +0000 (20:25 +0100)]
[ARC] Misc minor edits/fixes
The code supporting -mspfp, -mdpfp, and -mfpuda options are in
sections of code that are commented as being for backward
compatibility only, and having no effect. However, they do have an
effect, enabling the SPX, DPX, and DPA instruction subclasses
respectively. This commit moves the code supporting these options
away from the comments indicating that they are dummy options, and
also fixes a small issue where -mnps400 had the additional effect
of enabling SPX instructions.
A couple of other minor edits (that make no functional change) are
also included.
gas/ChangeLog:
* config/tc-arc.c (options, md_longopts, md_parse_option):
Move -mspfp, -mdpfp and -mfpuda out of the sections for
dummy options. Correct erroneous enabling of SPFP
instructions when using -mnps400.
include/ChangeLog:
* opcode/arc.h: Make insn_class_t alphabetical again.
opcodes/ChangeLog:
* arc-opc.c: Correct description of availability of NPS400
features.
GDB Administrator [Thu, 23 Jun 2016 00:00:23 +0000 (00:00 +0000)]
Automatic date update in version.in
Maciej W. Rozycki [Wed, 22 Jun 2016 23:41:34 +0000 (00:41 +0100)]
MIPS/LD/testsuite: Use wildcard address matching in `undefweak-overflow'
So that test case updates result in legible dump pattern changes.
ld/
* testsuite/ld-mips-elf/undefweak-overflow.d: Use wildcard
address matching.
Maciej W. Rozycki [Wed, 22 Jun 2016 23:29:14 +0000 (00:29 +0100)]
MIPS/LD/testsuite: Uniquely identify `undefweak-overflow' tests
ld/
* testsuite/ld-mips-elf/mips-elf.exp: Uniquely identify
`undefweak-overflow' tests.
Maciej W. Rozycki [Tue, 21 Jun 2016 20:22:39 +0000 (21:22 +0100)]
MIPS/GAS: Handle resolved R6 PC-relative relocations (ChangeLog)
Add missing ChangeLog entry for commit
41947d9e38c4 ("MIPS/GAS: Handle
resolved R6 PC-relative relocations").
Peter Bergner [Wed, 22 Jun 2016 22:55:17 +0000 (17:55 -0500)]
Add support for yet some more new ISA 3.0 instructions.
opcodes/
* ppc-opc.c (RM, DRM, VXASH, VXASH_MASK, XMMF, XMMF_MASK): New defines.
(powerpc_opcodes) <brd, brh, brw, mffsce, mffscdrn, mffscdrni,
mffscrn, mffscrni, mffsl, nandxor, rldixor, setbool,
xor3>: New mnemonics.
<setb>: Change to a VX form instruction.
(insert_sh6): Add support for rldixor.
(extract_sh6): Likewise.
gas/
* testsuite/gas/ppc/power9.d <brd, brh, brw, mffs, mffs., mffsce,
mffscdrn, mffscdrni, mffscrn, mffscrni, mffsl, nandxor, rldixor,
setbool, xor3>: New tests.
* testsuite/gas/ppc/power9.s: Likewise.
Trevor Saunders [Sat, 4 Jun 2016 03:11:46 +0000 (23:11 -0400)]
addmore extern C
opcodes/ChangeLog:
2016-06-22 Trevor Saunders <tbsaunde+binutils@tbsaunde.org>
* arc-ext.h: Wrap in extern C.
include/ChangeLog:
2016-06-22 Trevor Saunders <tbsaunde+binutils@tbsaunde.org>
* elf/dlx.h: Wrap in extern C.
* elf/xtensa.h: Likewise.
* opcode/arc.h: Likewise.
Nick Clifton [Wed, 22 Jun 2016 13:42:26 +0000 (14:42 +0100)]
Fix various binutils testsuite failures.
* testsuite/binutils-all/ar.exp: Skip tests for Alpha target.
Skip bfdtest1 tests for tic30 target.
* testsuite/binutils-all/arm/objdump.exp: Skip for aout arm
target.
* testsuite/binutils-all/compress.exp: Expect some tests to fail
on the nds32.
* testsuite/binutils-all/copy-3.d: Skip for go32 targets.
* testsuite/binutils-all/copy-4.d: Skip for AIX and linuxecoff
targets.
* testsuite/binutils-all/nm.exp: Treat beos based targets as ELF
targets.
* testsuite/binutils-all/objcopy.exp: Only run reverse bytes tests
if the bintest.o file was created. Use the
get_standard_section_names proc to get the name of the data
section.
* testsuite/binutils-all/objdump.exp: Update regexps to allow for
RX section names.
* testsuite/binutils-all/readelf.exp: Use
get_standard_section_names proc to get the name of the data
section.
* testsuite/binutils-all/readelf.r: Allow for non standard text
section names.
* testsuite/binutils-all/readelf.s: Update regexps for tilepro.
* testsuite/binutils-all/size.exp: Allow for non standard section
names.
* testsuite/binutils-all/update-section.exp: Expect comapre 1vs4
to fail on mips targets.
* testsuite/lib/utils-lib.exp (default_binutils_run): Use
get_standard_section_names proc.
(run_dump_test): Likewise.
(proc get_standard_section_names): New proc.
H.J. Lu [Wed, 22 Jun 2016 12:39:22 +0000 (05:39 -0700)]
gold: Add a linker configure option --enable-relro
Add a configure option --enable-relro to decide whether -z relro should
be enabled by default. Default to yes.
PR ld/20283
* NEWS: Mention --enable-relro.
* configure.ac: Add --enable-relro.
(DEFAULT_LD_Z_RELRO): New. Set by --enable-relro and default
to 1.
* config.in: Regenerated.
* configure: Likewise.
* options.h (General_options::relro): Default to
DEFAULT_LD_Z_RELRO.
H.J. Lu [Wed, 22 Jun 2016 12:37:24 +0000 (05:37 -0700)]
ld: Add a linker configure option --enable-relro
Add a configure option --enable-relro to decide whether -z relro should
be enabled in ELF linker by default. Default to yes for all Linux
targets, except FRV, HPPA, IA64 and MIPS, since many relro tests fail
on these targets.
PR ld/20283
* NEWS: Mention --enable-relro.
* configure.ac: Add --enable-relro.
(DEFAULT_LD_Z_RELRO): New. Set by --enable-relro.
* configure.tgt (ac_default_ld_z_relro): Default it to 1 for
some Linux targets.
* config.in: Regenerated.
* configure: Likewise.
* emultempl/elf32.em (gld${EMULATION_NAME}_before_parse): Set
link_info.relro to DEFAULT_LD_Z_RELRO.
* testsuite/config/default.exp (ld_elf_shared_opt): New.
* testsuite/lib/ld-lib.exp (run_dump_test): Pass
$ld_elf_shared_opt to ld for ELF targets with shared object
support.
(run_ld_link_tests): Likewise.
Trevor Saunders [Sat, 28 May 2016 15:54:51 +0000 (11:54 -0400)]
tilegx: move TILEGX_NUM_PIPELINE_ENCODINGS to tilegx_pipeline enum
Its closely related to what the encodings are, more than a set of random
constants, so it seems to make sense to put it here.
include/ChangeLog:
2016-06-22 Trevor Saunders <tbsaunde+binutils@tbsaunde.org>
* opcode/tilegx.h: Move TILEGX_NUM_PIPELINE_ENCODINGS into
tilegx_pipeline.
Trevor Saunders [Sat, 4 Jun 2016 20:45:13 +0000 (16:45 -0400)]
xtensa: include elf/xtensa.h in tc-xtensa.c
There's no reason to define these macros twice.
gas/ChangeLog:
2016-06-22 Trevor Saunders <tbsaunde+binutils@tbsaunde.org>
* config/tc-xtensa.c: Include elf/xtensa.h.
Nick Clifton [Wed, 22 Jun 2016 08:55:50 +0000 (09:55 +0100)]
Increase size of string buffer used to hold printed versions of timestamps.
binutils* readelf.c (dynamic_section_mips_val): Increase size of timebuf.
(process_mips_specific): Likewise.
(process_gnu_liblist): Likewise.
GDB Administrator [Wed, 22 Jun 2016 00:00:09 +0000 (00:00 +0000)]
Automatic date update in version.in
Maciej W. Rozycki [Tue, 21 Jun 2016 20:22:39 +0000 (21:22 +0100)]
MIPS/GAS: Handle resolved R6 PC-relative relocations
Complement commit
7361da2c952e ("Add support for MIPS R6.") and fix
internal errors like:
foo.s: Assembler messages:
foo.s: Internal error!
Assertion failure in md_apply_fix at .../gas/config/tc-mips.c:15028.
Please report this bug.
triggered by resolved R6 PC-relative relocations in sources containing
R6 code fragments wrapped into ISA override blocks embedded within code
otherwise assembled for an older ISA.
gas/
* config/tc-mips.c (calculate_reloc) <BFD_RELOC_HI16_S_PCREL>
<BFD_RELOC_LO16_PCREL>: New switch cases.
(md_apply_fix) <BFD_RELOC_HI16_S_PCREL, BFD_RELOC_LO16_PCREL>:
Move switch cases along `BFD_RELOC_MIPS_JMP'.
<BFD_RELOC_MIPS_21_PCREL_S2, BFD_RELOC_MIPS_26_PCREL_S2>
<BFD_RELOC_MIPS_18_PCREL_S3, BFD_RELOC_MIPS_19_PCREL_S2>: Handle
the resolved case.
* testsuite/gas/mips/pcrel-reloc-4.d: New test.
* testsuite/gas/mips/pcrel-reloc-4-r6.d: New test.
* testsuite/gas/mips/pcrel-reloc-5.d: New test.
* testsuite/gas/mips/pcrel-reloc-5-r6.d: New test.
* testsuite/gas/mips/pcrel-reloc-6.d: New test.
* testsuite/gas/mips/pcrel-reloc-6.l: New list test.
* testsuite/gas/mips/pcrel-reloc-4.s: New test source.
* testsuite/gas/mips/pcrel-reloc-6.s: New test source.
* testsuite/gas/mips/mips.exp: Run the new tests.
Maciej W. Rozycki [Tue, 21 Jun 2016 19:12:00 +0000 (20:12 +0100)]
MIPS/GAS: Fix null pointer dereferences in R6 PC-relative relocation checks
Avoid segmentation faults in alignment checks made in `md_apply_fix' for
BFD_RELOC_MIPS_18_PCREL_S3 and BFD_RELOC_MIPS_19_PCREL_S2 relocations
caused by dereferencing `fixP->fx_addsy' which will be null if the
relocation processed has been fully resolved.
gas/
* config/tc-mips.c (md_apply_fix) <BFD_RELOC_MIPS_18_PCREL_S3>
<BFD_RELOC_MIPS_19_PCREL_S2>: Avoid null pointer dereferences
via `fixP->fx_addsy'.
Maciej W. Rozycki [Tue, 21 Jun 2016 17:54:16 +0000 (18:54 +0100)]
MIPS/GAS: Correct BFD_RELOC_MIPS_18_PCREL_S3 calculation
The PC-relative R_MIPS_PC18_S3 relocation and consequently its BFD
internal BFD_RELOC_MIPS_18_PCREL_S3 representation is calculated from
the address of the aligned doubleword containing the location being
relocated: (sign_extend(A) + S - (P & ~0x7)) >> 3 rather than the
address of the location itself. Reflect this in calculations made by
GAS so that the relocated field is set correctly if resolved by GAS,
such as with local symbols in the same section which do not require
relocations to be propagated to the link stage.
gas/
* config/tc-mips.c (md_pcrel_from) <BFD_RELOC_MIPS_18_PCREL_S3>:
Calculate relocation from the containing aligned doubleword.
(tc_gen_reloc) <BFD_RELOC_MIPS_18_PCREL_S3>: Calculate the
addend from the containing aligned doubleword.
Maciej W. Rozycki [Tue, 21 Jun 2016 15:01:27 +0000 (16:01 +0100)]
MIPS/GAS: Use the module level ISA setting for R6 relaxation
Use the module level ISA setting rather than the last ISA selected with
a `.set' directive in the source file in determination as to whether to
keep PC-relative relocations and then with the original symbol referred,
for the purpose of R6 linker relaxation.
This is so that with e.g. code like this:
b foo
.set mips32r2
...
it's the command line options or any `.module' directive that decides
how to encode any relocation for `foo' rather than the presence of `.set
mips32r2'.
gas/
* config/tc-mips.c (mips_force_relocation): Use `file_mips_opts'
rather than `mips_opts' for the R6 ISA check.
(mips_fix_adjustable): Likewise.
* testsuite/gas/mips/pcrel-reloc-1.d: New test.
* testsuite/gas/mips/pcrel-reloc-1-r6.d: New test.
* testsuite/gas/mips/pcrel-reloc-2.d: New test.
* testsuite/gas/mips/pcrel-reloc-2-r6.d: New test.
* testsuite/gas/mips/pcrel-reloc-3.d: New test.
* testsuite/gas/mips/pcrel-reloc-3-r6.d: New test.
* testsuite/gas/mips/pcrel-reloc-1.s: New test source.
* testsuite/gas/mips/mips.exp: Run the new tests.
Maciej W. Rozycki [Tue, 21 Jun 2016 13:06:27 +0000 (14:06 +0100)]
MIPS/BFD: Don't stop processing on a cross-mode jump conversion error
As with commit
ed53407eec9e ("MIPS/BFD: Don't stop processing on
`bfd_reloc_outofrange'") don't bail out right away and instead continue
processing on a cross-mode jump conversion error, so that any further
issues are also reported. Adjust message formatting accordingly, using
`%X' to abort processing at conclusion. Remove the full stop from the
end of the message, for consistency across error reporting.
Adjust the corresponding test case accordingly and make it trigger the
error twice.
bfd/
* elfxx-mips.c (mips_elf_perform_relocation): Call
`info->callbacks->einfo' rather than `*_bfd_error_handler' and
use the `%X%H' format for the cross-mode jump conversion error
message. Remove the full stop from the end of the message.
Continue processing rather than returning failure.
ld/
* testsuite/ld-mips-elf/mode-change-error-1a.s: Trigger an error
twice rather than once.
* testsuite/ld-mips-elf/mode-change-error-1.d: Adjust
accordingly. Remove the full stop from the end of the message.
Walfred Tedeschi [Tue, 21 Jun 2016 13:15:04 +0000 (15:15 +0200)]
Improve user experience in printing Fortran derived types.
Output for Fortran derived classes is like:
"( 9, 'abc')"
with this changes the output is changed to:
"( lucky_number = 9, letters = 'abc')"
2016-06-21 Walfred Tedeschi <walfred.tedeschi@intel.com>
* f-valprint.c (f_val_print): Add field names for printing
derived types fields.
gdb/testsuite:
* gdb.fortran/derived-type.exp (print q): Add fields to the output.
* gdb.fortran/vla-type.exp (print twov): Fix vla tests with
structs.
* gdb.fortran/derived-type-function.exp: New file.
* gdb.fortran/derived-type-function.f90: New file.
Graham Markall [Tue, 21 Jun 2016 13:03:08 +0000 (14:03 +0100)]
Arc assembler: Convert nps400 from a machine type to an extension.
gas * config/tc-arc.c (check_cpu_feature, md_parse_option):
Add nps400 option and feature. Add check for nps400
feature. Refactor existing checks to check subclass before
feature enablement.
(md_show_usage): Document flags for NPS-400 and add some other
undocumented flags.
(cpu_type): Remove nps400 CPU type entry
(check_zol): Remove bfd_mach_arc_nps400 case.
(md_show_usage): Add help on -mcpu=nps400.
(cpu_types): Add entry for nps400 as arc700 plus nps400 extension
set.
* doc/c-arc.texi: Document the -mnps400, -mspfp, -mdpfp, and
-fpuda flags. Document -mcpu=nps400.
* testsuite/gas/arc/nps-400-0.d: Use -mcpu=arc700 -mnps400. Change
expected flags to match ARC700 instead of NPS400.
* testsuite/gas/arc/nps-400-1.d: Use -mcpu=arc700 -mnps400.
* testsuite/gas/arc/nps-400-2.d: Likewise.
* testsuite/gas/arc/nps-400-3.d: Likewise.
* testsuite/gas/arc/nps-400-4.d: Likewise.
* testsuite/gas/arc/nps-400-5.d: Likewise.
* testsuite/gas/arc/nps-400-6.d: Likewise.
* testsuite/gas/arc/nps-400-7.d: Likewise.
* testsuite/gas/arc/textinsn2op01.s: Change opcode of myinsn to
avoid clash with cbba instruction.
* testsuite/gas/arc/textinsn2op01.d: Likewise.
* testsuite/gas/arc/textinsn3op.d: Likewise.
* testsuite/gas/arc/textinsn3op.s: Likewise.
* testsuite/gas/arc/nps-400-0.d: Test using NPS-400 using
-mcpu=nps400 as an alternative to -mcpu=arc700 -mnps400 flags.
binutils* readelf.c (decode_ARC_machine_flags): Remove E_ARC_MACH_NPS400
case.
ld * testsuite/ld-arc/nps-1a.d: Use -mcpu=arc700 -mnps400.
* testsuite/ld-arc/nps-1b.d: Likewise.
include * opcode/arc.h: Add nps400 extension and instruction
subclass.
Remove ARC_OPCODE_NPS400
* elf/arc.h: Remove E_ARC_MACH_NPS400
opcodes * arc-dis.c (arc_insn_length): Add comment on instruction length.
Use same method for determining instruction length on ARC700 and
NPS-400.
(arc_insn_length, print_insn_arc): Remove bfd_mach_arc_nps400.
* arc-nps400-tbl.h: Make all nps400 instructions ARC700 instructions
with the NPS400 subclass.
* arc-opc.c: Likewise.
bfd * archures.c: Remove bfd_mach_arc_nps400.
* bfd-in2.h: Likewise.
* cpu-arc.c (arch_info_struct): Likewise.
* elf32-arc.c (arc_elf_object_p, arc_elf_final_write_processing):
Likewise.
Andreas Arnez [Tue, 21 Jun 2016 11:26:11 +0000 (13:26 +0200)]
S390 gdbserver: Mark local funcs/vars as static
Compiling with '-Wmissing-declarations' yields warnings in
linux-s390-low.c. To fix this, mark appropriate functions as static.
gdb/gdbserver/ChangeLog:
* linux-s390-low.c (s390_emit_eq_goto): Mark function static.
(s390_emit_ne_goto): Likewise.
(s390_emit_lt_goto): Likewise.
(s390_emit_le_goto): Likewise.
(s390_emit_gt_goto): Likewise.
(s390_emit_ge_goto): Likewise.
(s390x_emit_eq_goto): Likewise.
(s390x_emit_ne_goto): Likewise.
(s390x_emit_lt_goto): Likewise.
(s390x_emit_le_goto): Likewise.
(s390x_emit_gt_goto): Likewise.
(s390x_emit_ge_goto): Likewise.
(s390_emit_ops_impl): Mark variable static.
(s390x_emit_ops): Likewise.
Andreas Arnez [Tue, 21 Jun 2016 11:26:11 +0000 (13:26 +0200)]
S390: Fix typo "s930" -> "s390"
This fixes a typo in the name of the "last-break" regset.
gdb/ChangeLog:
* s390-linux-tdep.c (s390_iterate_over_regset_sections): Fix typo
in name of last-break regset.
Cary Coutant [Tue, 21 Jun 2016 03:13:08 +0000 (20:13 -0700)]
Update gold to version 1.12.
gold/
* NEWS: Add new features in 1.12.
* version.cc (version_string): Bump to 1.12.
Pedro Alves [Tue, 21 Jun 2016 00:11:57 +0000 (01:11 +0100)]
Add "new-ui console" tests
This adds a test that uses new-ui to create a secondary console, and
then runs some basic smoke tests. It ensures that:
- synchronous commands send output to the UI that initiated it
- asynchronous events like breakpoint hits are reported on all
consoles.
- "new-ui" without arguments doesn't crash.
- The "new-ui" command doesn't repeat.
gdb/testsuite/ChangeLog:
2016-06-21 Pedro Alves <palves@redhat.com>
* gdb.base/new-ui.exp: New file.
* lib/mi-support.exp (switch_gdb_spawn_id): Move to ...
* lib/gdb.exp (switch_gdb_spawn_id): ... here.
(with_spawn_id): New procedure.
Pedro Alves [Tue, 21 Jun 2016 00:11:57 +0000 (01:11 +0100)]
Always switch fork child to the main UI
The following scenario:
- gdb started in normal CLI mode.
- separate MI channel created with new-ui
- inferior output redirected with the "set inferior-tty" command.
- use -exec-run in the MI channel to run the inferior
is presently mishandled.
When we create the inferior, in fork-child.c, right after vfork, we'll
close all the file descriptors in the vfork child, and then dup the
tty to file descriptors 0/1/2, create a session, etc. Note that when
we close all descriptors, we close the file descriptors behind
gdb_stdin/gdb_stdout/gdb_stderr of all secondary UIs... So if
anything goes wrong in the child and it calls warning/error, it'll end
up writting to the current UI's stdout/stderr streams, which are
backed by file descriptors that have since been closed. Because this
happens in a vfork region, the corresponding stdin/stdout/stderr in
the parent/gdb end up corrupted.
The fix is to switch to the main UI right after the vfork, so that
gdb_stdin/gdb_stdout/gdb_stderr are correctly mapped to
stdin/stdout/stderr (and thus to file descriptors 0/1/2), so this code
works as it has always worked.
(Technically, we're doing a lot of stuff we shouldn't be doing after a
vfork, while we should only be calling async-signal-safe functions.)
gdb/ChangeLog:
2016-06-21 Pedro Alves <palves@redhat.com>
* fork-child.c (fork_inferior): Switch the child to the main UI
right after vfork. Save/restore the current UI in the parent.
Flush outputs of the main UI instead of the current UI.
gdb/testsuite/ChangeLog:
2016-06-21 Pedro Alves <palves@redhat.com>
* gdb.mi/mi-exec-run.exp: New file.
Pedro Alves [Tue, 21 Jun 2016 00:11:56 +0000 (01:11 +0100)]
Make mi-break.exp always expect breakpoint commands output on the main UI
mi-break.exp regresses when tested with MI running on a secondary UI,
with RUNTESTFLAGS="FORCE_SEPARATE_MI_TTY=1".
The problem is simply that the test sets a breakpoint, and attaches
"print" commands to the breakpoint. Since breakpoint commands always
run with the main UI as current UI, the breakpoint command's output
goes to the main UI. So we need to tweak the test to expect it there.
gdb/testsuite/ChangeLog:
2016-06-21 Pedro Alves <palves@redhat.com>
* gdb.mi/mi-break.exp (test_breakpoint_commands): Always expect
breakpoint command's output on the main UI.
(test_break): New procedure, factored out from calls in the top
level.
(top level): Use foreach_with_prefix to test MI as main UI and as
separate UI.
Pedro Alves [Tue, 21 Jun 2016 00:11:56 +0000 (01:11 +0100)]
Send deleted watchpoint-scope output to all UIs
Testing with:
make check RUNTESTFLAGS="SEPARATE_MI_TTY=1"
shows this, in gdb.mi/mi-watch.exp:
-*stopped,reason="watchpoint-scope",wpnum="2",frame={addr="0x00000000004005cb",
+*stopped,frame={addr="0x00000000004005cb",
(...)
-PASS: gdb.mi/mi-watch.exp: hw: watchpoint trigger
+FAIL: gdb.mi/mi-watch.exp: hw: watchpoint trigger (unknown output after running)
That is, we lose the "watchpoint-scope" output on the MI UI.
This commit fixes it, and makes the test run with MI running as both
main UI and separate UI.
gdb/ChangeLog:
2016-06-21 Pedro Alves <palves@redhat.com>
* breakpoint.c (watchpoint_check): Send watchpoint-deleted output
to all UIs.
gdb/testsuite/ChangeLog:
2016-06-21 Pedro Alves <palves@redhat.com>
* gdb.mi/mi-watch.exp (test_watchpoint_creation_and_listing)
(test_awatch_creation_and_listing)
(test_rwatch_creation_and_listing, test_watchpoint_triggering):
Remove 'type' parameter.
(test_watchpoint_all): New parameter mi_mode. Remove
with_test_prefix.
(top level): Use foreach_with_prefix, and add main/separate UI MI
testing axis.
Pedro Alves [Tue, 21 Jun 2016 00:11:55 +0000 (01:11 +0100)]
Add testing infrastruture bits for running with MI on a separate UI
With this, a specific test may can start GDB with MI on a separate UI
by using:
mi_gdb_start separate-mi-tty
In addition, it's also possible to run the whole testsuite with MI on
a separate tty, with:
make check RUNTESTFLAGS="FORCE_SEPARATE_MI_TTY=1"
gdb_main_spawn_id and mi_spawn_id are added so that tests may expect
output from either channel.
While at it, inferior_spawn_id was not being cleared when gdb exits,
unlike the other spawn ids, thus a test that starts gdb more than once
would end up using a stale spawn id.
gdb/testsuite/ChangeLog:
2016-06-21 Pedro Alves <palves@redhat.com>
* README (Testsuite Parameters): Document FORCE_SEPARATE_MI_TTY.
* lib/gdb.exp (default_gdb_exit): Clear inferior_spawn_id.
* lib/mi-support.exp (mi_uncatched_gdb_exit): Unset
gdb_main_spawn_id, mi_spawn_id, unset inferior_spawn_id.
(gdb_main_spawn_id, mi_spawn_id): Declare and
comment.
(mi_create_inferior_pty): New procedure,
factored out from default_mi_gdb_start.
(switch_gdb_spawn_id, mi_gdb_start_separate_mi_tty): New
procedures.
(default_mi_gdb_start): Call mi_gdb_start_separate_mi_tty if the
separate-mi-tty option is specified, or SEPARATE_MI_TTY is set.
Use mi_create_inferior_pty.
(mi_gdb_start): Use eval to pass down args list.
Pedro Alves [Tue, 21 Jun 2016 00:11:55 +0000 (01:11 +0100)]
[DOC] Document support for running interpreters on separate UIs
gdb/ChangeLog:
2016-06-21 Pedro Alves <palves@redhat.com>
* NEWS: Mention support for running interpreters on separate
UIs and the new new-ui command.
gdb/doc/ChangeLog:
2016-06-21 Pedro Alves <palves@redhat.com>
* gdb.texinfo (Interpreters): Update intepreter-exec section,
document new-ui and explain use case.
Pedro Alves [Tue, 21 Jun 2016 00:11:55 +0000 (01:11 +0100)]
Add new command to create extra console/mi UIs
With all the previous plumbing in place, it's now easy to add a
command that actually creates a new console/mi UI.
The intended use case is to make it possible and easy for MI frontends
to provide a fully featured GDB console to users, with readline
support, command line editing, history, etc., just like if gdb was
started on the command line. Currently MI frontends have to try to
implement all of that theirselves and make use of "-interpreter-exec
console ...", which is far from perfect. If you ever tried Eclipse's
gdb console window, you'll know what I mean...
Instead of trying to multiplex console through MI, this command let's
just leverage all the built in readline/editing support already inside
gdb.
The plan is for the MI frontend to start GDB in regular console mode,
running inside a terminal emulator widget embedded in Eclipse (which
already exists, for supporting the shell widget; other frontends have
similar widgets), and then tell GDB to run a full MI interpreter on an
specified input/output device, independent of the console.
My original prototype planned to do things the other way around --
start GDB in MI mode, and then start an extra CLI console on separate
tty. I handed over that prototype to Marc Khouzam @ Eclipse CDT, and
after experimentation and discussion, we ended up concluding that
starting GDB in CLI mode instead was both easier and actually also
supported an interesting use case -- connect an Eclipse frontend to a
GDB that is already running outside Eclipse.
The current usage is "new-ui <interpreter> <tty>".
E.g., on a terminal run this scriplet:
$ cat gdb-client
#!/bin/bash
reset
tty
tail -f /dev/null
$ gdb-client
/dev/pts/15
Now run gdb on another terminal, and tell it to start a MI interpreter
on the tty of the other terminal:
...
(gdb) new-ui mi /dev/pts/15
New UI allocated
Now back to the the gdb-client terminal, we'll get an MI prompt, ready
for MI input:
/dev/pts/15
=thread-group-added,id="i1"
(gdb)
You can also start a new UI running a CLI, with:
(gdb) new-ui console /dev/pts/15
Though note that this console won't support readline command editing.
It works as if "set editing off" was entered.
gdb/ChangeLog:
2016-06-21 Pedro Alves <palves@redhat.com>
* interps.c (set_top_level_interpreter): New function, factored
out from captured_main.
(interpreter_completer): Make extern.
* interps.h (set_top_level_interpreter, interpreter_completer):
New declarations.
(captured_main): Use set_top_level_interpreter.
* top.c [!O_NOCTTY] (O_NOCTTY): Define as 0.
(open_terminal_stream, new_ui_command): New functions.
(init_main): Install the "new-ui" command.
Pedro Alves [Tue, 21 Jun 2016 00:11:54 +0000 (01:11 +0100)]
Make stdin be per UI
This commit makes each UI have its own "stdin" stream pointer. This
is used to determine whether the "from_tty" argument to
execute_command, etc. should be true.
Related, this commit makes input_from_terminal_p take an UI parameter,
and then avoids the gdb_has_a_terminal in it. gdb_has_a_terminal only
returns info on gdb's own main/primary terminal (the real stdin).
However, the places that call input_from_terminal_p really want to
know is whether the command came from an interactive tty. This patch
thus renames input_from_terminal_p to input_interactive_p for clarity,
and then makes input_interactive_p check for "set interactive" itself,
along with ISATTY, instead of calling gdb_has_a_terminal. Actually,
quit_force wants to call input_interactive_p _after_ stdin is closed,
we can't call ISATTY that late. So instead we save the result of
ISATTY in a field of the UI.
gdb/ChangeLog:
2016-06-21 Pedro Alves <palves@redhat.com>
* cli/cli-script.c (read_next_line): Adjust to per-UI stdin.
(read_command_lines): Use input_interactive_p instead of
input_from_terminal_p.
* defs.h (struct ui): Forward declare.
(input_from_terminal_p): Rename to ...
(input_interactive_p): ... this.
* event-top.c (stdin_event_handler): Pass 0 as from_tty argument
to quit_command.
(command_handler): Adjust to per-UI stdin.
(handle_line_of_input): Adjust to per-UI stdin and use
input_interactive_p instead of ISATTY and input_from_terminal_p.
(gdb_readline_no_editing_callback): Adjust to per-UI stdin.
(command_line_handler): Always pass true as "from_tty" parameter
of handle_line_of_input and execute_command.
(async_sigterm_handler): Pass 0 as from_tty argument to
quit_command.
* inflow.c (interactive_mode, show_interactive_mode): Moved to ...
(gdb_has_a_terminal): Don't check interactive_mode here.
(_initialize_inflow): Don't install "set interactive-mode" here.
* main.c (captured_command_loop): Adjust to per-UI stdin.
* mi/mi-interp.c (mi_execute_command_wrapper): Adjust to per-UI
stdin.
* top.c (new_ui): Save the stdin stream and whether it's a tty.
(dont_repeat): Adjust to per-UI stdin.
(command_line_input): Adjust to per-UI stdin and to use
input_interactive_p.
(quit_force): Write history if any UI supports interactive input.
(interactive_mode, show_interactive_mode): Move here, from
inflow.c.
(input_from_terminal_p): Rename to ...
(input_interactive_p): ... this, and check the "interactive_mode"
global instead of calling gdb_has_a_terminal.
(_initialize_top): Install "set interactive-mode" here.
* top.h (struct ui) <stdin_stream, input_interactive_p>: New
fields.
* utils.c (quit): Pass 0 as from_tty argument to quit_force.
(defaulted_query): Adjust to per-UI stdin and to use
input_interactive_p.
Pedro Alves [Tue, 21 Jun 2016 00:11:54 +0000 (01:11 +0100)]
Handle UI's terminal closing
Without this, GDB exits if a secondary UIs terminal/input stream is
closed:
$ ./gdb -ex "new-ui mi /dev/pts/6"
New UI allocated
<<< close /dev/pts/6
(gdb) Error detected on fd 9
$
We want that for the main UI, but not secondary UIs.
gdb/ChangeLog:
2016-06-21 Pedro Alves <palves@redhat.com>
* event-top.c (stdin_event_handler): Don't quit gdb if it was a
secondary UI's input stream that closed. Instead, just delete the
UI.
Pedro Alves [Tue, 21 Jun 2016 00:11:53 +0000 (01:11 +0100)]
Make main_ui be heap allocated
This is preparation for being able to create more than one UI object.
The change to gdb_main to stop using catch_errors is necessary because
catch_errors references current_uiout, which expands to
current_ui->m_current_ui, which would crash because current_ui is not
initialized yet at that point. It didn't trigger earlier in the
series because before this patch, main_ui/current_ui always start out
non-NULL.
gdb/ChangeLog:
2016-06-21 Pedro Alves <palves@redhat.com>
* event-top.c (main_ui_): Delete.
(main_ui, current_ui, ui_list): No longer initialize here.
* main.c (captured_main): UI initialization code factored out to
new new_ui function.
(gdb_main): Wrap captured_main with TRY/CATCH instead of
catch_errors.
* top.c (highest_ui_num): New global.
(new_ui): New function.
* top.h (struct ui) <num>: New field.
(new_ui): New declaration.
Pedro Alves [Tue, 21 Jun 2016 00:11:53 +0000 (01:11 +0100)]
Only send sync execution command output to the UI that ran the command
Currently when a "step", "next", etc. finishes, the current source
line is printed on all console UIs.
This patch makes the CLI and TUI interpreters reuse MI's logic to only
emit console output related to a synchronous command on the
console-like interpreter that started the command in the first place.
gdb/ChangeLog:
2016-06-21 Pedro Alves <palves@redhat.com>
* cli/cli-interp.c (cli_on_normal_stop): Bail out early if there's
nothing to print. Use should_print_stop_to_console.
* tui/tui-interp.c (tui_on_normal_stop): Likewise.
Pedro Alves [Tue, 21 Jun 2016 00:11:53 +0000 (01:11 +0100)]
Push thread->control.command_interp to the struct thread_fsm
I noticed that if we step into an inline function, step_1 never
reaches proceed, and thus nevers sets the thread's
tp->control.command_interp. Because of that,
should_print_stop_to_console fails to determine that is should print
stop output to the console.
The fix is to set the thread's command_interp earlier. However, I
realized that we can move that field to the thread_fsm, given that its
lifetime is exactly the same as thread_fsm. So the patch plumbs all
fsms constructors to take the command interp and store it in the
thread_fsm.
We can see the fix in action, with e.g., the gdb.opt/inline-cmds.exp
test, and issuing a step when stopped at line 67:
&"s\n"
^running
*running,thread-id="all"
(gdb)
~"67\t result = func2 ();\n"
*stopped,reason="end-stepping-range",frame={addr="0x00000000004004d0",func="main",args=[],file="/home/pedro/gdb/mygit/src/gdb/testsuite/gdb.opt/inline-cmds.c",fullname="/home/pedro/gdb/mygit/src/gdb/testsuite/gdb.opt/inline-cmds.c",line="67"},thread-id="1",stopped-threads="all",core="0"
(gdb)
s
&"s\n"
^running
*running,thread-id="all"
(gdb)
+ ~"func2 () at /home/pedro/gdb/mygit/src/gdb/testsuite/gdb.opt/inline-cmds.c:67\n"
+ ~"67\t result = func2 ();\n"
*stopped,reason="end-stepping-range",frame={addr="0x00000000004004d0",func="func2",args=[],file="/home/pedro/gdb/mygit/src/gdb/testsuite/gdb.opt/inline-cmds.c",fullname="/home/pedro/gdb/mygit/src/gdb/testsuite/gdb.opt/inline-cmds.c",line="67"},thread-id="1",stopped-threads="all",core="0"
(gdb)
(The inline-cmds.exp command is adjusted to exercise this.)
(Due to the follow_fork change, this also fixes "next N" across a fork
with "set follow-fork child" with "set detach-on-fork on". Commands
that rely on internal breakpoints, like "finish" will still require
more work to migrate breakpoints etc. to the child thread.)
gdb/ChangeLog:
2016-06-21 Pedro Alves <palves@redhat.com>
* breakpoint.c (new_until_break_fsm): Add 'cmd_interp' parameter.
(until_break_fsm_should_stop, until_break_fsm_clean_up): Add
thread parameter.
(until_break_command): Pass command interpreter to thread fsm
ctor.
* cli/cli-interp.c (should_print_stop_to_console): Adjust.
* gdbthread.h (struct thread_control_state) <command_interp>:
Delete field.
* infcall.c (new_call_thread_fsm): Add 'cmd_interp' parameter.
Pass it down.
(call_thread_fsm_should_stop): Add thread parameter.
(call_function_by_hand_dummy): Pass command interpreter to thread
fsm ctor. Pass thread pointer to fsm clean up method.
* infcmd.c: Include interps.h.
(struct step_command_fsm) <thread>: Delete field.
(new_step_command_fsm): Add 'cmd_interp' parameter. Pass it down.
(step_command_fsm_prepare): Remove references to fsm's thread
field.
(step_1): Pass command interpreter to thread
fsm ctor. Pass thread pointer to fsm clean up method.
(step_command_fsm_should_stop, step_command_fsm_clean_up): Add
thread parameter and use it.
(new_until_next_fsm): Add 'cmd_interp' parameter. Pass it down.
(until_next_fsm_should_stop, until_next_fsm_clean_up): Add thread
parameter and use it.
(until_next_command): Pass command interpreter to thread fsm ctor.
(struct finish_command_fsm) <thread>: Delete field.
(finish_command_fsm_ops): Add NULL slot for should_notify_stop.
(new_finish_command_fsm): Add 'cmd_interp' parameter and pass it
down. Remove thread parameter and adjust.
(finish_command_fsm_should_stop, finish_command_fsm_clean_up): Add
thread parameter and use it.
(finish_command): Pass command interpreter to thread fsm ctor.
Don't pass thread.
* infrun.c (follow_fork): Move thread fsm to child fork instead of
command interpreter, only.
(clear_proceed_status_thread): Remove reference to command_interp.
(proceed): Don't record the thread's command interpreter.
(clean_up_just_stopped_threads_fsms): Pass thread to fsm clean_up
method.
(fetch_inferior_event): Pass thread to fsm should_stop method.
* thread-fsm.c (thread_fsm_ctor): Add 'cmd_interp' parameter.
Store it.
(thread_fsm_clean_up, thread_fsm_should_stop): Add thread
parameter and pass it down.
* thread-fsm.h (struct thread_fsm) <command_interp>: New field.
(struct thread_fsm_ops) <clean_up, should_stop>: Add thread
parameter.
(thread_fsm_ctor): Add 'cmd_interp' parameter.
(thread_fsm_clean_up, thread_fsm_should_stop): Add thread
parameter.
* thread.c (thread_cancel_execution_command): Pass thread to
thread fsm clean_up method.
gdb/testsuite/ChangeLog:
2016-06-21 Pedro Alves <palves@redhat.com>
* gdb.opt/inline-cmds.c: Add "set mi break here" marker.
* gdb.opt/inline-cmds.exp: Add MI tests.