external/binutils.git
10 years agodaily update
Alan Modra [Thu, 23 Oct 2014 23:00:51 +0000 (09:30 +1030)]
daily update

10 years agoRefactoring/cleanup of nios2 opcodes and assembler code.
Sandra Loosemore [Thu, 23 Oct 2014 16:54:15 +0000 (09:54 -0700)]
Refactoring/cleanup of nios2 opcodes and assembler code.

2014-10-23  Sandra Loosemore  <sandra@codesourcery.com>

include/opcode/
* nios2.h (enum iw_format_type): New.
(struct nios2_opcode): Update comments.  Add size and format fields.
(NIOS2_INSN_OPTARG): New.
(REG_NORMAL, REG_CONTROL, REG_COPROCESSOR): New.
(struct nios2_reg): Add regtype field.
(GET_INSN_FIELD, SET_INSN_FIELD): Delete.
(IW_A_LSB, IW_A_MSB, IW_A_SZ, IW_A_MASK): Delete.
(IW_B_LSB, IW_B_MSB, IW_B_SZ, IW_B_MASK): Delete.
(IW_C_LSB, IW_C_MSB, IW_C_SZ, IW_C_MASK): Delete.
(IW_IMM16_LSB, IW_IMM16_MSB, IW_IMM16_SZ, IW_IMM16_MASK): Delete.
(IW_IMM26_LSB, IW_IMM26_MSB, IW_IMM26_SZ, IW_IMM26_MASK): Delete.
(IW_OP_LSB, IW_OP_MSB, IW_OP_SZ, IW_OP_MASK): Delete.
(IW_OPX_LSB, IW_OPX_MSB, IW_OPX_SZ, IW_OPX_MASK): Delete.
(IW_SHIFT_IMM5_LSB, IW_SHIFT_IMM5_MSB): Delete.
(IW_SHIFT_IMM5_SZ, IW_SHIFT_IMM5_MASK): Delete.
(IW_CONTROL_REGNUM_LSB, IW_CONTROL_REGNUM_MSB): Delete.
(IW_CONTROL_REGNUM_SZ, IW_CONTROL_REGNUM_MASK): Delete.
(OP_MASK_OP, OP_SH_OP): Delete.
(OP_MASK_IOP, OP_SH_IOP): Delete.
(OP_MASK_IRD, OP_SH_IRD): Delete.
(OP_MASK_IRT, OP_SH_IRT): Delete.
(OP_MASK_IRS, OP_SH_IRS): Delete.
(OP_MASK_ROP, OP_SH_ROP): Delete.
(OP_MASK_RRD, OP_SH_RRD): Delete.
(OP_MASK_RRT, OP_SH_RRT): Delete.
(OP_MASK_RRS, OP_SH_RRS): Delete.
(OP_MASK_JOP, OP_SH_JOP): Delete.
(OP_MASK_IMM26, OP_SH_IMM26): Delete.
(OP_MASK_RCTL, OP_SH_RCTL): Delete.
(OP_MASK_IMM5, OP_SH_IMM5): Delete.
(OP_MASK_CACHE_OPX, OP_SH_CACHE_OPX): Delete.
(OP_MASK_CACHE_RRS, OP_SH_CACHE_RRS): Delete.
(OP_MASK_CUSTOM_A, OP_SH_CUSTOM_A): Delete.
(OP_MASK_CUSTOM_B, OP_SH_CUSTOM_B): Delete.
(OP_MASK_CUSTOM_C, OP_SH_CUSTOM_C): Delete.
(OP_MASK_CUSTOM_N, OP_SH_CUSTOM_N): Delete.
(OP_<insn>, OPX_<insn>, OP_MATCH_<insn>, OPX_MATCH_<insn>): Delete.
(OP_MASK_<insn>, OP_MASK): Delete.
(GET_IW_A, GET_IW_B, GET_IW_C, GET_IW_CONTROL_REGNUM): Delete.
(GET_IW_IMM16, GET_IW_IMM26, GET_IW_OP, GET_IW_OPX): Delete.
Include nios2r1.h to define new instruction opcode constants
and accessors.
(nios2_builtin_opcodes): Rename to nios2_r1_opcodes.
(bfd_nios2_num_builtin_opcodes): Rename to nios2_num_r1_opcodes.
(bfd_nios2_num_opcodes): Rename to nios2_num_opcodes.
(NUMOPCODES, NUMREGISTERS): Delete.
* nios2r1.h: New file.

opcodes/
* nios2-opc.c (nios2_builtin_regs): Add regtype field initializers.
(nios2_builtin_opcodes): Rename to nios2_r1_opcodes.  Use new
MATCH_R1_<insn> and MASK_R1_<insn> macros in initializers.  Add
size and format initializers.  Merge 'b' arguments into 'j'.
(NIOS2_NUM_OPCODES): Adjust definition.
(bfd_nios2_num_builtin_opcodes): Rename to nios2_num_r1_opcodes.
(nios2_opcodes): Adjust.
(bfd_nios2_num_opcodes): Rename to nios2_num_opcodes.
* nios2-dis.c (INSNLEN): Update comment.
(nios2_hash_init, nios2_hash): Delete.
(OPCODE_HASH_SIZE): New.
(nios2_r1_extract_opcode): New.
(nios2_disassembler_state): New.
(nios2_r1_disassembler_state): New.
(nios2_init_opcode_hash): Add state parameter.  Adjust to use it.
(nios2_find_opcode_hash): Use state object.
(bad_opcode): New.
(nios2_print_insn_arg): Add op parameter.  Use it to access
format.  Remove 'b' case.
(nios2_disassemble): Remove special case for nop.  Remove
hard-coded instruction size.

gas/
* config/tc-nios2.c (nios2_insn_infoS): Add constant_bits field.
(nios2_arg_infoS, nios2_arg_hash, nios2_arg_lookup): Delete.
(nios2_control_register_arg_p): Delete.
(nios2_coproc_reg): Delete.
(nios2_relax_frag): Remove hard-coded instruction size.
(md_convert_frag): Use new insn accessor macros.
(nios2_diagnose_overflow): Remove hard-coded instruction size.
(md_apply_fix): Likewise.
(bad_opcode): New.
(nios2_parse_reg): New.
(nios2_assemble_expression): Remove prev_reloc parameter.  Adjust
uses and callers.
(nios2_assemble_arg_c): New.
(nios2_assemble_arg_d): New.
(nios2_assemble_arg_s): New.
(nios2_assemble_arg_t): New.
(nios2_assemble_arg_i): New.
(nios2_assemble_arg_u): New.
(nios2_assemble_arg_o): New.
(nios2_assemble_arg_j): New.
(nios2_assemble_arg_l): New.
(nios2_assemble_arg_m): New.
(nios2_assemble_args): New.
(nios2_assemble_args_dst): Delete.
(nios2_assemble_args_tsi): Delete.
(nios2_assemble_args_tsu): Delete.
(nios2_assemble_args_sto): Delete.
(nios2_assemble_args_o): Delete.
(nios2_assemble_args_is): Delete.
(nios2_assemble_args_m): Delete.
(nios2_assemble_args_s): Delete.
(nios2_assemble_args_tis): Delete.
(nios2_assemble_args_dc): Delete.
(nios2_assemble_args_cs): Delete.
(nios2_assemble_args_ds): Delete.
(nios2_assemble_args_ldst): Delete.
(nios2_assemble_args_none): Delete.
(nios2_assemble_args_dsj): Delete.
(nios2_assemble_args_d): Delete.
(nios2_assemble_args_b): Delete.
(nios2_arg_info_structs): Delete.
(NIOS2_NUM_ARGS): Delete.
(nios2_consume_arg): Remove insn parameter.  Use new macros.
Don't check register arguments here.  Remove 'b' case.
(nios2_consume_separator): Move check for missing separators to...
(nios2_parse_args): ...here.  Remove special case for optional
arguments.
(output_insn): Avoid using hard-coded insn size.
(output_ubranch): Likewise.
(output_cbranch): Likewise.
(output_call): Use new macros.
(output_addi): Likewise.
(output_ori): Likewise.
(output_xori): Likewise.
(output_movia): Likewise.
(md_begin): Remove nios2_arg_info_structs initialization.
(md_assemble): Initialize constant_bits field.  Use
nios2_parse_args instead of looking up parse function in hash table.

gdb/
* nios2-tdep.c (nios2_analyze_prologue): Use new instruction field
accessors and constants from nios2 opcodes update.
(nios2_get_next_pc): Likewise.

10 years agoARM: plt_size functions need to read instructions in right byte order
Victor Kamensky [Thu, 23 Oct 2014 01:23:53 +0000 (11:53 +1030)]
ARM: plt_size functions need to read instructions in right byte order

elf32_arm_plt0_size and elf32_arm_plt_size read instructions
to determine what is size of PLT entry.  However it does not
read instruction correctly in case of ARM big endian V7 case.
In this case instructions are still kept in little endian
order (BE8).

* elf32-arm.c (read_code32): New function to read 32 bit
arm instruction.
(read_code16): New function to read 16 bit thumb instrution.
(elf32_arm_plt0_size, elf32_arm_plt_size): Use read_code32
and read_code16 to read instructions.

10 years agodaily update
Alan Modra [Wed, 22 Oct 2014 23:00:53 +0000 (09:30 +1030)]
daily update

10 years agoMIPS Documentation fixes
Matthew Fortune [Tue, 21 Oct 2014 10:58:19 +0000 (11:58 +0100)]
MIPS Documentation fixes

gas/
* doc/as.texinfo: Update the MIPS FP ABI descriptions.
* doc/c-mips.texi: Spell check and correct throughout.

10 years agoShow information about unknown ASEs and extensions in .MIPS.abiflags
Matthew Fortune [Fri, 17 Oct 2014 10:07:17 +0000 (11:07 +0100)]
Show information about unknown ASEs and extensions in .MIPS.abiflags

bfd/
* elfxx-mips.c (print_mips_ases): Print unknown ASEs.
(print_mips_isa_ext): Print the value of an unknown extension.

binutils/

* readelf.c (print_mips_ases): Print unknown ASEs.
(print_mips_isa_ext): Print the value of an unknown extension.

include/

* elf/mips.h (AFL_ASE_MASK): Define.

10 years agodaily update
Alan Modra [Tue, 21 Oct 2014 23:00:32 +0000 (09:30 +1030)]
daily update

10 years agoMIPS/GAS: Correct file option settings with `.insn'
Maciej W. Rozycki [Tue, 21 Oct 2014 22:06:23 +0000 (23:06 +0100)]
MIPS/GAS: Correct file option settings with `.insn'

This makes sure `HAVE_CODE_COMPRESSION' evaluates correctly when the
`.insn' directive is used at the beginning of a source file before any
instructions have been produced and that ELF file header's MIPS16 and
microMIPS ASE flags are set correctly in the case where no instructions
have been produced other than with the said directive.

gas/
* config/tc-mips.c (s_insn): Set file options.

gas/testsuite/
* gas/mips/insn-opts.d: New test.
* gas/mips/insn-opts.s: New test source.
* gas/mips/mips.exp: Run the new test.

10 years ago[GOLD] Add gcc-4.9 libgomp symbols requiring --plt-thread-safe for power7
Alan Modra [Tue, 21 Oct 2014 21:38:30 +0000 (08:08 +1030)]
[GOLD] Add gcc-4.9 libgomp symbols requiring --plt-thread-safe for power7

As for bfd.ld.  Refer 2300b5a14

* powerpc.cc (do_relax): Add gcc-4.9 libgomp functions to
thread_starter.

10 years ago[AARCH64] Add thunderx support to gas
Andrew Pinski [Mon, 20 Oct 2014 18:39:49 +0000 (11:39 -0700)]
[AARCH64] Add thunderx support to gas

This patch adds -mcpu=thunderx support to gas.

OK? Tested with no regressions.

ChangeLog:
* config/tc-aarch64.c (aarch64_cpus):
Add thunderx.
* doc/c-aarch64.texi: Document that thunderx
is a valid processor name.

10 years agoRelax ppc64_elf_tls_optimize assertion
Alan Modra [Tue, 21 Oct 2014 10:14:38 +0000 (20:44 +1030)]
Relax ppc64_elf_tls_optimize assertion

The code in ppc64_elf_tls_optimize looking at the .toc is only
interested in .toc entries that are addresses.  .toc can contain more
than just an array of addresses, so if we have items that aren't
8-byte aligned, ignore them.

* elf64-ppc.c (ppc64_elf_tls_optimize): Ignore relocs against toc
entries that aren't a multiple of 8 rather than failing assertion.

10 years agogas: avoid bogus warnings in false branches of conditional
Jan Beulich [Tue, 21 Oct 2014 07:57:41 +0000 (09:57 +0200)]
gas: avoid bogus warnings in false branches of conditional

The construct being added to the cond.s test case otherwise triggered
both the "missing closing ..." and the "stray ..." (twice) warnings in
_find_end_of_line(). As that code fragments suggests, this is needed to
support (include) files that can be used for both assembler .include
and compiler #include directives.

10 years agoppc: enable msgclr and msgsnd on Power8
Jan Beulich [Tue, 21 Oct 2014 07:56:38 +0000 (09:56 +0200)]
ppc: enable msgclr and msgsnd on Power8

According to my reading of the spec it was an oversight for them to
not having got enabled when Power8 support got added.

10 years agoaarch64: move bogus assertion
Jan Beulich [Tue, 21 Oct 2014 07:53:25 +0000 (09:53 +0200)]
aarch64: move bogus assertion

Asserting "idx" to be non-negative when subsequent code handles this
case is bogus. In fact the assertion triggers e.g. when mistakenly
using the arm32 comment character @ following an instruction.

While doing this I also noticed that despite there being local
variables "detail" and "idx", not all places where they could be used
did actually make use of them, so this is being adjusted at once.

Finally, for the code to be slightly more robust, also change
comparisons against -1 to such checking for a (non-)negative value.

10 years agoAdd gcc-4.9 libgomp symbols requiring --plt-thread-safe for power7
Alan Modra [Tue, 21 Oct 2014 06:36:01 +0000 (17:06 +1030)]
Add gcc-4.9 libgomp symbols requiring --plt-thread-safe for power7

powerpc64 ld builds plt call stubs with a read barrier to provide
thread safety on lazy plt updates, necessary on multi-threaded apps
with power7 or later weakly ordered memory.  gcc-4.9 libgomp
introduced more functions that could call pthread_create, which means
we have more functions that if referenced in an executable should
cause a default of --plt-thread-safe.

* elf64-ppc.c (ppc64_elf_size_stubs): Add gcc-4.9 libgomp functions
to thread_starter.

10 years agodaily update
Alan Modra [Mon, 20 Oct 2014 23:00:53 +0000 (09:30 +1030)]
daily update

10 years agoSmall fixes to the Python API doc
Simon Marchi [Mon, 20 Oct 2014 17:29:36 +0000 (13:29 -0400)]
Small fixes to the Python API doc

First:
"Breakpoint.delete" is missing parenthesis.

Second:
Someone on IRC asked, how come there is no disable() method in the
Breakpoint object.  It turns out you have to do "bp.enabled = False".
Since every normal person would probably search for "disable" in that page
if their intent is to disable a python breakpoint, I thought it would be
useful if the description contained "disable" so it would be easy to find.
The result might seem a bit silly and redundant, so I am open to
suggestions.

gdb/doc/ChangeLog:

* python.texi (Breakpoints In Python): Add parenthesis after
Breakpoint.delete.  Clarify Breakpoint.enabled description so
that it contains "disable".

10 years agoRename py-objfile-script-gdb.py.in to py-objfile-script-gdb.py
Yao Qi [Mon, 29 Sep 2014 13:37:32 +0000 (21:37 +0800)]
Rename py-objfile-script-gdb.py.in to py-objfile-script-gdb.py

Patch <https://sourceware.org/ml/gdb-patches/2011-07/msg00225.html> was
to fix the problem that py-objfile-script-gdb.py is removed after an
in-tree build and test.  As a result of the previous patch (we don't
remove files copied to host any more), this patch is no longer needed.
This patch is to revert it logically.

gdb/testsuite:

2014-10-20  Yao Qi  <yao@codesourcery.com>

* gdb.python/py-objfile-script-gdb.py.in: Rename it to ...
* gdb.python/py-objfile-script-gdb.py: New file.
* gdb.python/py-objfile-script.exp: Update reference to
py-objfile-script-gdb.py.in.  Use gdb_remote_donwload instead
of remote_download.  Remove the dest file.

10 years agoDon't remove files copied to host
Yao Qi [Mon, 29 Sep 2014 12:47:30 +0000 (20:47 +0800)]
Don't remove files copied to host

Nowadays, if we do in-tree build and run tests sequentially, some source
files are removed, due to the following pattern:

set pi_txt [gdb_remote_download host ${srcdir}/${subdir}/pi.txt]

remote_exec host "rm -f $pi_txt"

If testing is run sequentially, file ${srcdir}/${subdir}/pi.txt is
copied to ${objdir}/${subdir}/pi.txt.  However, ${objdir} is ${srcdir}
in the in-tree build/test, so the file is coped to itself, as a nop.
As a result, the file in source is removed at the end of test.

This patch fixes this problem by not removing files copied to host in
each test.  This patch also addresses the question we've had that why
don't we keep files copied to host because they are needed to reproduce
certain fails.

gdb/testsuite:

2014-10-20  Yao Qi  <yao@codesourcery.com>

* gdb.base/checkpoint.exp: Don't remove file copied on host.
* gdb.base/step-line.exp: Likewise.
* gdb.dwarf2/dw2-anonymous-func.exp: Likewise.
* gdb.dwarf2/dw2-basic.exp: Likewise.
* gdb.dwarf2/dw2-compressed.exp: Likewise.
* gdb.dwarf2/dw2-filename.exp: Likewise.
* gdb.dwarf2/dw2-intercu.exp: Likewise.
* gdb.dwarf2/dw2-intermix.exp: Likewise.
* gdb.dwarf2/dw2-producer.exp: Likewise.
* gdb.dwarf2/mac-fileno.exp: Likewise.
* gdb.python/py-frame-args.exp: Likewise.
* gdb.python/py-framefilter.exp: Likewise.
* gdb.python/py-mi.exp: Likewise.
* gdb.python/py-objfile-script.exp: Likewise
* gdb.python/py-pp-integral.exp: Likewise.
* gdb.python/py-pp-re-notag.exp: Likewise.
* gdb.python/py-prettyprint.exp: Likewise.
* gdb.python/py-section-script.exp: Likewise.
* gdb.python/py-typeprint.exp: Likewise.
* gdb.python/py-xmethods.exp: Likewise.
* gdb.stabs/weird.exp: Likewise.
* gdb.xml/tdesc-regs.exp: Likewise.

10 years agodaily update
Alan Modra [Sun, 19 Oct 2014 23:00:41 +0000 (09:30 +1030)]
daily update

10 years agoFix some comments to say minus_one_ptid instead of PID == -1.
Doug Evans [Sun, 19 Oct 2014 20:36:54 +0000 (13:36 -0700)]
Fix some comments to say minus_one_ptid instead of PID == -1.

gdb/ChangeLog:

* gdbthread.h (set_running): Fix comment.
(set_executing, finish_thread_state): Fix comment.

10 years agolinux-nat.c (linux_nat_wait_1): Make local prev_mask non-static.
Doug Evans [Sun, 19 Oct 2014 04:24:47 +0000 (21:24 -0700)]
linux-nat.c (linux_nat_wait_1): Make local prev_mask non-static.

gdb/ChangeLog:

linux-nat.c (linux_nat_wait_1): Make local prev_mask non-static.

10 years agodaily update
Alan Modra [Sat, 18 Oct 2014 23:00:47 +0000 (09:30 +1030)]
daily update

10 years agoFix the gdb.dwarf2/dw2-dir-file-name.exp test on MIPS
Kwok Cheung Yeung [Sat, 18 Oct 2014 20:45:36 +0000 (21:45 +0100)]
Fix the gdb.dwarf2/dw2-dir-file-name.exp test on MIPS

This patch fixes the failures that occur with the
gdb.dwarf2/dw2-dir-file-name.exp test on 64-bit MIPS and compressed
MIPS ISAs (i.e. MIPS16 and microMIPS).

The failures on 64-bit occur because the generated DWARF address
information is always 32-bit, which causes the upper 32-bits of
addresses to be truncated and causes breakpoints to be set on the
wrong address if any of the upper 32-bits are non-zero.  I suspect
that other 64-bit architectures get away with it because they
place all their instructions at a VMA lower than 2^32 by default.
This patch causes 64-bit addresses to be generated if a 64-bit
target is detected.

The failures on MIPS16 and microMIPS occur because the breakpoint
address needs to have the LSB set to 1 (used to indicate that the
code is compressed). However, the function name is interpreted as
a data label, causing GDB to set breakpoints at even addresses.
This is fixed by explicitly adding a '.insn' directive (see
https://sourceware.org/binutils/docs/as/MIPS-insn.html) after the
label on MIPS only.

gdb/testsuite/

2014-10-18  Kwok Cheung Yeung  <kcy@codesourcery.com>

* gdb.dwarf2/dw2-dir-file-name.exp (addr_len): New.
(out_cu): Use addr_len for the size of addresses.
(out_line): Likewise.  Size DW_LNE_set_address instruction
according to addr_len.
* gdb.dwarf2/dw2-dir-file-name.c (START_INSNS): New.
(FUNC): Add START_INSNS to definition.

10 years agoSkip testing argv[0] on target argv[0] isn't available
Yao Qi [Tue, 14 Oct 2014 07:40:15 +0000 (15:40 +0800)]
Skip testing argv[0] on target argv[0] isn't available

I see the following two fails on arm-none-eabi target, because argv[0]
isn't available.

print argv[0]^M
$1 = 0x1f78 "/dev/null"^M
(gdb) FAIL: gdb.base/argv0-symlink.exp: kept file symbolic link name

print argv[0]^M
$1 = 0x1f78 "/dev/null"^M
(gdb) FAIL: gdb.base/argv0-symlink.exp: kept directory symbolic link name

My first thought is to check [target_info exists noargs], and skip the
test if it returns true.  However, noargs is set in gdbserver board
files, so argv0-symlink.exp will be skipped on gdbserver board file.
The change is too aggressive.

When the program is running with gdbserver, argv[1] to argv[N] aren't
available, but argv[0] is.  Fortunately, argv0-symlink.exp only
requires argv[0].  argv0-symlink.exp can be run with gdbserver board
file, as what we do now.

What we need to check is whether argv[0] is available, so I add a new
proc gdb_has_argv0 to do so by starting a program, and check
argc/argv[0] to see whether argv[0] is available.

Dan fixed the similar problem by checking noargs, which is too strong.
https://sourceware.org/ml/gdb-patches/2010-02/msg00398.html as a
result, the test is skipped on gdbserver.  This patch fixed it too.

gdb/testsuite:

2014-10-18  Yao Qi  <yao@codesourcery.com>

* gdb.base/argv0-symlink.exp: Check argv[0] value if
gdb_has_argv0 return true.
* gdb.guile/scm-value.exp (test_value_in_inferior): Don't
check [target_info exists noargs], check [gdb_has_argv0]
instead.
* gdb.python/py-value.exp (test_value_in_inferior): Likewise.
* lib/gdb.exp (gdb_has_argv0, gdb_has_argv0_1): New
procedures.

10 years agoPowerPC64 ELFv1 function symbol definition vs LTO and discarded sections
Alan Modra [Sat, 18 Oct 2014 11:16:48 +0000 (21:46 +1030)]
PowerPC64 ELFv1 function symbol definition vs LTO and discarded sections

When functions are emitted in comdat groups, global symbols defined in
duplicates of the group are treated as if they were undefined.  That
prevents the symbols in the discarded sections from affecting the
linker's global symbol hash table or causing duplicate symbol errors.
Annoyingly, when gcc emits a function to a comdat group, it does not
put *all* of a function's code and data in the comdat group.
Typically, constant tables, exception handling info, and debug info
are emitted to normal sections outside of the group, which is a
perennial source of linker problems due to the special handling needed
to deal with the extra-group pieces that ought to be discarded.  In
the case of powerpc64-gcc, the OPD entry for a function is not put in
the group.  Since the function symbol is defined on the OPD entry this
means we need to handle symbols in .opd specially.

To see how this affects LTO in particular, consider the linker
testcase PR ld/12942 (1).  This testcase links an LTO object file
pr12942a.o with a normal (non-LTO) object pr12942b.o.  Both objects
contain a definition for _Z4testv in a comdat group.  On loading
pr12942a.o, the linker sees a comdat group (actually linkonce section)
for _Z4testv and a weak _Z4testv defined in the IR.  On loading
pr12942b.o, the linker sees the same comdat group, and thus discards
it.  However, _Z4testv is a weak symbol defined in .opd, not part of
the group, so this weak symbol overrides the weak IR symbol.  On
(re)loading the LTO version of pr12942a.o, the linker sees another
weak _Z4testv, but this one does not override the value we have from
pr12942b.o.  The result is a linker complaint about "`_Z4testv'
... defined in discarded section `.group' of tmpdir/pr12942b.o".

* elf64-ppc.c (ppc64_elf_add_symbol_hook): If function code
section for function symbols defined in .opd is discarded, let
the symbol appear to be undefined.
(opd_entry_value): Ensure the result section is that for the
function code section in the same object as the OPD entry.

10 years agoFix PR17493, attempted output of *GAS `reg' section* symbol
Alan Modra [Sat, 18 Oct 2014 00:40:53 +0000 (11:10 +1030)]
Fix PR17493, attempted output of *GAS `reg' section* symbol

The write.c change is to make gas report an error if reg_section
symbols should leak in future.  The tc-i386.c change is the real fix.

Note that the error isn't the most helpful, "redefined symbol cannot
be used on reloc", but I'm not inclined to improve what is really an
internal gas error.  reg_section symbols shouldn't leak..

gas/
PR 17493
* write.c (adjust_reloc_syms): Don't allow symbols in reg_section
to be reduced to reg_section section symbol.
* gas/config/tc-i386.c (i386_finalize_immediate): Reject all
reg_section immediates.
gas/testsuite/
* gas/i386/inval-equ-2.l: Adjust.

10 years ago* configure.tgt (targ_extra_obj) [aarch64*-*]: Define.
Andreas Schwab [Sat, 18 Oct 2014 08:30:54 +0000 (10:30 +0200)]
* configure.tgt (targ_extra_obj) [aarch64*-*]: Define.

10 years agoAdd "typename" keyword to satisfy GCC 4.2.
Cary Coutant [Fri, 17 Oct 2014 23:22:55 +0000 (16:22 -0700)]
Add "typename" keyword to satisfy GCC 4.2.

gold/
* aarch64.cc (AArch64_relocate_functions::maybe_apply_stub):
Add "typename" keyword.

10 years agodaily update
Alan Modra [Fri, 17 Oct 2014 23:00:32 +0000 (09:30 +1030)]
daily update

10 years agoopcodes, elf: annotate instructions with HWCAP2_VIS3B.
Jose E. Marchesi [Wed, 15 Oct 2014 06:46:54 +0000 (08:46 +0200)]
opcodes, elf: annotate instructions with HWCAP2_VIS3B.

This patch annotates the following SPARC instructions as VIS3B
instructions: ldx *, %efsr, fpadd64, fpsub64, fpcmpule8, fpcmpune8,
fpcmpugt8, fpcmpueq8.  It also improves the documentation of the VIS3B
capability in several headers.

Tested in sparc64-unknown-linux-gnu and sparc-unknown-linux-gnu.
No visible regressions.

opcodes/ChangeLog:

  2014-10-17  Jose E. Marchesi  <jose.marchesi@oracle.com>

* sparc-opc.c (sparc-opcodes): Annotate several instructions with
the HWCAP2_VIS3B hwcap.

include/opcodes/ChangeLog:

  2014-10-17  Jose E. Marchesi  <jose.marchesi@oracle.com>

* sparc.h (HWCAP2_VIS3B): Documentation improved.

include/elf/ChangeLog:

  2014-10-17  Jose E. Marchesi  <jose.marchesi@oracle.com>

* sparc.h (ELF_SPARC_HWCAP2_VIS3B): Documentation improved.

10 years agoopcodes: fix several misplaced hwcap entries.
Jose E. Marchesi [Fri, 17 Oct 2014 19:56:41 +0000 (21:56 +0200)]
opcodes: fix several misplaced hwcap entries.

This patch fixes the hwcap entries in `sparc-opcodes' (which were
incorrectly located in the flags field) for the following
instructions:

  wr r,r,%sys_tick
  wr r,i,%sys_tick
  wr r,r,%sys_tick_cmpr
  wr r,i,%sys_tick_cmpr
  edge8n edge8ln edge16n edge16ln edge32n edge32ln
  bmask bshuffle siam

Tested in sparc-unknown-linux-gnu and sparc64-unknown-linux-gnu.
No visible regressions.

opcodes/ChangeLog:

  2014-10-17  Jose E. Marchesi  <jose.marchesi@oracle.com>

* sparc-opc.c (sparc-opcodes): Fix several misplaced hwcap
entries.

10 years agoFix bad @value references in MIPS documentation
Matthew Fortune [Fri, 17 Oct 2014 19:25:09 +0000 (20:25 +0100)]
Fix bad @value references in MIPS documentation

gas/

* doc/c-mips.texi: Fix bad @value references.

10 years agoNew python event "clear_objfiles".
Doug Evans [Fri, 17 Oct 2014 18:12:17 +0000 (11:12 -0700)]
New python event "clear_objfiles".

If one is watching new_objfile events in python, it helps to know
when the list of objfiles is cleared.  This patch adds a new
clear_objfiles event to support this.

This patch is all just cut-n-paste-n-tweak derived from
the new_objfiles event.

gdb/ChangeLog:

* NEWS: Mention new event gdb.clear_objfiles.
* python/py-event.h (emit_clear_objfiles_event): Clear
* python/py-events.h (events_object): New member clear_objfiles.
* python/py-evts.c (gdbpy_initialize_py_events): Add clear_objfiles
event.
* python/py-inferior.c (python_new_objfile): If objfile is NULL,
emit clear_objfiles event.
* python/py-newobjfileevent.c (create_clear_objfiles_event_object): New
function.
(emit_clear_objfiles_event): New function.
(clear_objfiles): New event.
* python/python-internal.h (gdbpy_initialize_clear_objfiles_event):
Declare.
* python/python.c (_initialize_python): Call
gdbpy_initialize_clear_objfiles_event.

gdb/doc/ChangeLog:

* python.texi (Events In Python): Document clear_objfiles event.

gdb/testsuite/ChangeLog:

* gdb.python/py-events.exp: Update expected output for clear_objfiles
event.
* gdb.python/py-events.py: Add clear_objfiles event.

10 years agoAdd gdb.Objfile.progspace attribute.
Doug Evans [Fri, 17 Oct 2014 17:57:26 +0000 (10:57 -0700)]
Add gdb.Objfile.progspace attribute.

gdb/ChangeLog:

* NEWS: Mention new gdb.Objfile.progspace attribute.
* python/py-objfile.c (objfpy_get_progspace): New function.
(objfile_getset): New entry for "progspace".

gdb/doc/ChangeLog:

* python.texi (Objfiles In Python): Document new progspace attribute.

gdb/testsuite/ChangeLog:

* gdb.python/py-objfile.exp: Test progspace attribute.

10 years agoFix mingw32 failures due to incorrect directory separator in pattern
Luis Machado [Fri, 17 Oct 2014 14:28:17 +0000 (11:28 -0300)]
Fix mingw32 failures due to incorrect directory separator in pattern

Some testcases, mostly gdb.reverse ones, assume the presence of a
'/' directory separator before the source file name. This is
incorrect for mingw32 hosts, generating false failures for those
tests.

I attempted to catch most of the occurrences of the pattern
".*/$srcfile" and replaced them with ".*$srcfile". The latter
is used elsewhere in the testsuite. The resulting patch is attached.

I also see other occurrences of the same assumption throughout the
testsuite, but usually they are arguments for function calls and i
seem to recall either the test harness or GDB deals with those
paths properly.

gdb/testsuite:

2014-10-17  Luis Machado  <lgustavo@codesourcery.com>

* gdb.guile/scm-breakpoint.exp: Do not assume any
directory separators when matching source file paths.
* gdb.python/py-breakpoint.exp: Likewise.
* gdb.reverse/break-precsave.exp: Likewise.
* gdb.reverse/break-reverse.exp: Likewise.
* gdb.reverse/consecutive-precsave.exp: Likewise.
* gdb.reverse/finish-precsave.exp: Likewise.
* gdb.reverse/finish-reverse-bkpt.exp: Likewise.
* gdb.reverse/finish-reverse.exp: Likewise.
* gdb.reverse/i386-precsave.exp: Likewise.
* gdb.reverse/i387-env-reverse.exp: Likewise.
* gdb.reverse/i387-stack-reverse.exp: Likewise.
* gdb.reverse/machinestate-precsave.exp: Likewise.
* gdb.reverse/machinestate.exp: Likewise.
* gdb.reverse/sigall-precsave.exp: Likewise.
* gdb.reverse/solib-precsave.exp: Likewise.
* gdb.reverse/step-precsave.exp: Likewise.
* gdb.reverse/until-precsave.exp: Likewise.
* gdb.reverse/watch-precsave.exp: Likewise.
* gdb.reverse/watch-reverse.exp: Likewise.

10 years agoCopy xml files to host
Yao Qi [Fri, 15 Aug 2014 03:28:39 +0000 (11:28 +0800)]
Copy xml files to host

When I run test with board file local-remote-host-native.exp, I see
the following warning,

$ make check RUNTESTFLAGS="--host_board=local-remote-host-native
--target_board=local-remote-host-native tdesc-arch.exp
HOST_DIR=/tmp/foo/"

(gdb) set tdesc filename ../../../../git/gdb/testsuite/gdb.xml/trivial.xml^M
warning: Could not open "../../../../git/gdb/testsuite/gdb.xml/trivial.xml"
(gdb) quit^

because "${srcdir}/gdb.xml/trivial.xml" doesn't exist on host.  This
patch is to copy trivial.xml to host and the warning goes away.

(gdb) set tdesc filename /tmp/foo/trivial.xml^M
(gdb) quit^

tdesc-regs.exp has the similar problem that single-reg.xml may not
exist on host at all, and it should be copied to host too.

gdb/testsuite:

2014-10-17  Yao Qi  <yao@codesourcery.com>

* lib/gdb.exp (gdb_skip_xml_test): Copy trivial.xml to host.
* gdb.xml/tdesc-regs.exp: Copy single-reg.xml to host.

10 years agoPR gdb/17471: Repeating a background command makes it foreground
Pedro Alves [Fri, 17 Oct 2014 12:31:26 +0000 (13:31 +0100)]
PR gdb/17471: Repeating a background command makes it foreground

When we repeat a command, by just pressing <ret>, the input from the
previous command is reused for the new command invocation.

When an execution command strips the "&" out of its incoming argument
string, to detect background execution, we poke a '\0' directly to the
incoming argument string.

Combine both, and a repeat of a background command loses the "&".

This is actually only visible if args other than "&" are specified
(e.g., "c 1&" or "next 2&" or "c -a&"), as in the special case of "&"
alone (e.g. "c&") doesn't actually clobber the incoming string.

Fix this by making strip_bg_char return a new string instead of poking
a hole in the input string.

New test included.

Tested on x86_64 Fedora 20, native and gdbserver.

gdb/
2014-10-17  Pedro Alves  <palves@redhat.com>

PR gdb/17471
* infcmd.c (strip_bg_char): Change prototype and rewrite.  Now
returns a copy of the input.
(run_command_1, continue_command, step_1, jump_command)
(signal_command, until_command, advance_command, finish_command)
(attach_command): Adjust and install a cleanup to free the
stripped args.

gdb/testsuite/
2014-10-17  Pedro Alves  <palves@redhat.com>

PR gdb/17471
* gdb.base/bg-execution-repeat.c: New file.
* gdb.base/bg-execution-repeat.exp: New file.

10 years agoPR gdb/17300: Input after "c -a" crashes readline/GDB
Pedro Alves [Fri, 17 Oct 2014 12:31:25 +0000 (13:31 +0100)]
PR gdb/17300: Input after "c -a" crashes readline/GDB

If all threads in the target were already running when the user does
"c -a", nothing puts the inferior's terminal settings in effect and
removes stdin from the event loop, which we must when running a
foreground command.  The result is that user input afterwards crashes
readline/gdb:

 (gdb) start
 Temporary breakpoint 1 at 0x4005d4: file continue-all-already-running.c, line 23.
 Starting program: continue-all-already-running

 Temporary breakpoint 1, main () at continue-all-already-running.c:23
 23        sleep (10);
 (gdb) c -a&
 Continuing.
 (gdb) c -a
 Continuing.
 p 1
 readline: readline_callback_read_char() called with no handler!
 Aborted (core dumped)
 $

Backtrace:

 Program received signal SIGABRT, Aborted.
 0x0000003b36a35877 in __GI_raise (sig=sig@entry=6) at ../nptl/sysdeps/unix/sysv/linux/raise.c:56
 56        return INLINE_SYSCALL (tgkill, 3, pid, selftid, sig);
 (top-gdb) p 1
 $1 = 1
 (top-gdb) bt
 #0  0x0000003b36a35877 in __GI_raise (sig=sig@entry=6) at ../nptl/sysdeps/unix/sysv/linux/raise.c:56
 #1  0x0000003b36a36f68 in __GI_abort () at abort.c:89
 #2  0x0000000000784aa9 in rl_callback_read_char () at readline/callback.c:116
 #3  0x0000000000619181 in rl_callback_read_char_wrapper (client_data=0x0) at gdb/event-top.c:167
 #4  0x0000000000619557 in stdin_event_handler (error=0, client_data=0x0) at gdb/event-top.c:373
 #5  0x000000000061814a in handle_file_event (data=...) at gdb/event-loop.c:763
 #6  0x0000000000617631 in process_event () at gdb/event-loop.c:340
 #7  0x00000000006176f8 in gdb_do_one_event () at gdb/event-loop.c:404
 #8  0x0000000000617748 in start_event_loop () at gdb/event-loop.c:429
 #9  0x00000000006191b3 in cli_command_loop (data=0x0) at gdb/event-top.c:182
 #10 0x000000000060f538 in current_interp_command_loop () at gdb/interps.c:318
 #11 0x0000000000610701 in captured_command_loop (data=0x0) at gdb/main.c:323
 #12 0x000000000060c3f5 in catch_errors (func=0x6106e6 <captured_command_loop>, func_args=0x0, errstring=0x9002c1 "", mask=RETURN_MASK_ALL)
     at gdb/exceptions.c:237
 #13 0x0000000000611bff in captured_main (data=0x7fffffffd780) at gdb/main.c:1151
 #14 0x000000000060c3f5 in catch_errors (func=0x610afe <captured_main>, func_args=0x7fffffffd780, errstring=0x9002c1 "", mask=RETURN_MASK_ALL)
     at gdb/exceptions.c:237
 #15 0x0000000000611c28 in gdb_main (args=0x7fffffffd780) at gdb/main.c:1159
 #16 0x000000000045ef97 in main (argc=5, argv=0x7fffffffd888) at gdb/gdb.c:32
 (top-gdb)

Tested on x86_64 Fedora 20, native and gdbserver.

gdb/
2014-10-17  Pedro Alves  <palves@redhat.com>

PR gdb/17300
* infcmd.c (continue_1): If continuing all threads in the
foreground, make sure the inferior's terminal settings are put in
effect.

gdb/testsuite/
2014-10-17  Pedro Alves  <palves@redhat.com>

PR gdb/17300
* gdb.base/continue-all-already-running.c: New file.
* gdb.base/continue-all-already-running.exp: New file.

10 years agoPR gdb/17472: With annotations, input while executing in the foreground crashes readl...
Pedro Alves [Fri, 17 Oct 2014 12:31:25 +0000 (13:31 +0100)]
PR gdb/17472: With annotations, input while executing in the foreground crashes readline/GDB

Jan caught an intermittent GDB crash with the annota1.exp test:

 Starting program: .../gdb/testsuite/gdb.base/annota1 ^M
 [...]
 FAIL: gdb.base/annota1.exp: run until main breakpoint (timeout)
 [...]
 readline: readline_callback_read_char() called with no handler!^M
 ERROR: Process no longer exists

All we need to is to continue the inferior in the foreground, and type
a command while the inferior is running.  E.g.:

 (gdb) set annotate 2

 â–’â–’pre-prompt
 (gdb)
 â–’â–’prompt
 c

 â–’â–’post-prompt
 Continuing.

 â–’â–’starting

 â–’â–’frames-invalid

 *inferior is running now*

 p 1<ret>

 readline: readline_callback_read_char() called with no handler!
 Aborted (core dumped)
 $

When we run a foreground execution command we call
target_terminal_inferior to stop GDB from processing input, and to put
the inferior's terminal settings in effect.  Then we tell readline to
hide the prompt with display_gdb_prompt, which clears readline's input
callback too.  When the target stops, we call target_terminal_ours,
which re-installs stdin in the event loop, and then we redisplay the
prompt, reinstalling the readline callbacks.

However, when annotations are in effect, the "frames-invalid"
annotation code calls target_terminal_ours after 'resume' had already
called target_terminal_inferior:

 (top-gdb) bt
 #0  0x000000000056b82f in annotate_frames_invalid () at gdb/annotate.c:219
 #1  0x000000000072e6cc in reinit_frame_cache () at gdb/frame.c:1705
 #2  0x0000000000594bb9 in registers_changed_ptid (ptid=...) at gdb/regcache.c:612
 #3  0x000000000064cca1 in target_resume (ptid=..., step=1, signal=GDB_SIGNAL_0) at gdb/target.c:2136
 #4  0x00000000005f57af in resume (step=1, sig=GDB_SIGNAL_0) at gdb/infrun.c:2263
 #5  0x00000000005f6051 in proceed (addr=18446744073709551615, siggnal=GDB_SIGNAL_DEFAULT, step=1) at gdb/infrun.c:2613

And then once we hide the prompt and remove readline's input handler
callback, we're in a bad state.  We end up with the target running
supposedly in the foreground, but with stdin still installed on the
event loop.  Any input then calls into readline, which aborts because
no rl_linefunc callback handler is installed:

 Program received signal SIGABRT, Aborted.
 0x0000003b36a35877 in __GI_raise (sig=sig@entry=6) at ../nptl/sysdeps/unix/sysv/linux/raise.c:56
 56        return INLINE_SYSCALL (tgkill, 3, pid, selftid, sig);

 (top-gdb) bt
 #0  0x0000003b36a35877 in __GI_raise (sig=sig@entry=6) at ../nptl/sysdeps/unix/sysv/linux/raise.c:56
 #1  0x0000003b36a36f68 in __GI_abort () at abort.c:89
 During symbol reading, debug info gives source 9 included from file at zero line 0.
 During symbol reading, debug info gives command-line macro definition with non-zero line 19: _STDC_PREDEF_H 1.
 #2  0x0000000000784a25 in rl_callback_read_char () at src/readline/callback.c:116
 #3  0x0000000000619111 in rl_callback_read_char_wrapper (client_data=0x0) at src/gdb/event-top.c:167
 #4  0x00000000006194e7 in stdin_event_handler (error=0, client_data=0x0) at src/gdb/event-top.c:373
 #5  0x00000000006180da in handle_file_event (data=...) at src/gdb/event-loop.c:763
 #6  0x00000000006175c1 in process_event () at src/gdb/event-loop.c:340
 #7  0x0000000000617688 in gdb_do_one_event () at src/gdb/event-loop.c:404
 #8  0x00000000006176d8 in start_event_loop () at src/gdb/event-loop.c:429
 #9  0x0000000000619143 in cli_command_loop (data=0x0) at src/gdb/event-top.c:182
 #10 0x000000000060f4c8 in current_interp_command_loop () at src/gdb/interps.c:318
 #11 0x0000000000610691 in captured_command_loop (data=0x0) at src/gdb/main.c:323
 #12 0x000000000060c385 in catch_errors (func=0x610676 <captured_command_loop>, func_args=0x0, errstring=0x900241 "", mask=RETURN_MASK_ALL)
     at src/gdb/exceptions.c:237
 #13 0x0000000000611b8f in captured_main (data=0x7fffffffd7b0) at src/gdb/main.c:1151
 #14 0x000000000060c385 in catch_errors (func=0x610a8e <captured_main>, func_args=0x7fffffffd7b0, errstring=0x900241 "", mask=RETURN_MASK_ALL)
     at src/gdb/exceptions.c:237
 #15 0x0000000000611bb8 in gdb_main (args=0x7fffffffd7b0) at src/gdb/main.c:1159
 #16 0x000000000045ef57 in main (argc=3, argv=0x7fffffffd8b8) at src/gdb/gdb.c:32

The fix is to make the annotation code call target_terminal_inferior
again after printing, if the inferior's settings were in effect.

While at it, when we're doing output only, instead of
target_terminal_ours, we should call target_terminal_ours_for_output.
The latter doesn't actually remove stdin from the event loop, and also
leaves SIGINT forwarded to the target.

New test included.

Tested on x86_64 Fedora 20, native and gdbserver.

gdb/
2014-10-17  Pedro Alves  <palves@redhat.com>

PR gdb/17472
* annotate.c (annotate_breakpoints_invalid): Use
target_terminal_our_for_output instead of target_terminal_ours.
Give back the terminal to the target.
(annotate_frames_invalid): Likewise.

gdb/testsuite/
2014-10-17  Pedro Alves  <palves@redhat.com>

PR gdb/17472
* gdb.base/annota-input-while-running.c: New file.
* gdb.base/annota-input-while-running.exp: New file.

10 years agoMake common code handle target_terminal_* idempotency
Pedro Alves [Fri, 17 Oct 2014 12:31:25 +0000 (13:31 +0100)]
Make common code handle target_terminal_* idempotency

I found a place that should be giving back the terminal to the target,
but only if the target was already owning it.  So I need to add a
getter for who owns the terminal.

The trouble is that several places/target have their own globals to
track this state:

 - inflow.c:terminal_is_ours
 - remote.c:remote_async_terminal_ours_p
 - linux-nat.c:async_terminal_is_ours
 - go32-nat.c:terminal_is_ours

While one might think of adding a new target_ops method to query this,
conceptually, this state isn't really part of a particular target_ops.
Considering multi-target, the core shouldn't have to ask all targets
to know whether it's GDB that owns the terminal.  There's only one GDB
(or rather, only one top level interpreter).

So what this comment does is add a new global that is tracked by the
core instead.  A subsequent pass may later remove the other globals.

Tested on x86_64 Fedora 20, native and gdbserver.

gdb/
2014-10-17  Pedro Alves  <palves@redhat.com>

* target.c (enum terminal_state): New enum.
(terminal_state): New global.
(target_terminal_init): New function.
(target_terminal_inferior): Skip if inferior already owns the
terminal.
(target_terminal_ours, target_terminal_ours_for_output): New
functions.
* target.h (target_terminal_init): Convert to function prototype.
(target_terminal_ours_for_output): Convert to function prototype
and tweak comment.
(target_terminal_ours): Convert to function prototype and tweak
comment.
* windows-nat.c (do_initial_windows_stuff): Call
target_terminal_init instead of child_terminal_init_with_pgrp.

10 years agoFix ld tests with sysroot=/ and --enable-targets=all and test --print-sysroot
Hans-Peter Nilsson [Fri, 17 Oct 2014 11:10:18 +0000 (13:10 +0200)]
Fix ld tests with sysroot=/ and --enable-targets=all and test --print-sysroot

* ld-scripts/sysroot-prefix.exp: Log $ld_sysroot.  Handle sysroot
== "/" as a separate sysroot-configuration with separable
test-types.
(sysroot_prefix_tests): Include all existing sysroot tests in
sysroot == "/" tests except exclude those where a --sysroot option
is not specified.
* lib/ld-lib.exp (check_sysroot_available): Rewrite to use
--print-sysroot instead of relying on error code from using
--sysroot=...  Also, set $ld_sysroot.

The reason we exclude not just the failing "full-path =-prefixed
without" but also the passing "plain =-prefixed without but -Lpath"
for sysroot == "/" is that for the latter to succeed, we have to make
assumptions about the system not having a /sysroot directory or
assumptions about its contents etc.

When passing --enable-targets=all --enable-64-bit-bfd (the
latter not required for a "64-bit-host" of course) the ld --help
output got too much to handle for poor tcl (or maybe dejagnu is
to blame) and remote_exec exited with an error, so the
configuration being tested was mishandled as being a
sysroot-less configuration.  Using --version instead of --help
would work too, but the new --print-sysroot option calls for
nominal coverage, so why not use that instead.

10 years agoImplement --print-sysroot in ld.
Hans-Peter Nilsson [Fri, 17 Oct 2014 11:07:09 +0000 (13:07 +0200)]
Implement --print-sysroot in ld.

* ldlex.h (enum option_values): Add entry OPTION_PRINT_SYSROOT.
* lexsup.c (ld_options): Add entry for --print-sysroot.
(parse_args) <OPTION_PRINT_SYSROOT>: Print sysroot and exit early.

10 years agoImplement --print-sysroot in ld.
Hans-Peter Nilsson [Fri, 17 Oct 2014 11:06:56 +0000 (13:06 +0200)]
Implement --print-sysroot in ld.

* ldlex.h (enum option_values): Add entry OPTION_PRINT_SYSROOT.
* lexsup.c (ld_options): Add entry for --print-sysroot.
(parse_args) <OPTION_PRINT_SYSROOT>: Print sysroot and exit early.

10 years agoDelete Tru64 support
Pedro Alves [Fri, 17 Oct 2014 10:18:59 +0000 (11:18 +0100)]
Delete Tru64 support

This commit does most of the mechanical removal.  IOW, the easy part.

procfs.c isn't touched beyond removing a couple obvious bits that are
guarded by a couple macros defined in config/alpha/nm-osf3.h.  Going
beyond that for procfs.c & co would be a harder excision that
potentially affects Solaris.

Some comments in the generic alpha code ABIs that may still be
relevant and I wouldn't know what to do with them.  That can always be
done on a separate pass, preferably by someone who can test on alpha.

A couple other spots have references to OSF/Tru64 and related files
being removed, but it felt like removing them would make things worse,
not better.  We can revisit those when we next need to touch that
code.

I didn't remove a reference to osf in testsuite/lib/future.exp, as I
believe that code is imported from DejaGNU.

Built and tested on x86_64 Fedora 20, with --enable-targets=all.

Tested that building for --target=alpha-osf3 on x86_64 Fedora 20
fails with:

 checking for default auto-load directory... $debugdir:$datadir/auto-load
 checking for default auto-load safe-path... $debugdir:$datadir/auto-load
 *** Configuration alpha-unknown-osf3 is obsolete.
 *** Support has been REMOVED.
 make[1]: *** [configure-gdb] Error 1
 make[1]: Leaving directory `build-osf'
 make: *** [all] Error 2

gdb/
2014-10-17  Pedro Alves  <palves@redhat.com>

* Makefile.in (ALL_64_TARGET_OBS): Remove alpha-osf1-tdep.o.
(HFILES_NO_SRCDIR): Remove config/alpha/nm-osf3.h.
(ALLDEPFILES): Remove alpha-nat.c, alpha-osf1-tdep.c and
solib-osf.c.
* NEWS: Mention that support for alpha*-*-osf* has been removed.
* ada-lang.h [__alpha__ && __osf__]
(ADA_KNOWN_RUNTIME_FILE_NAME_PATTERNS): Delete.
* alpha-nat.c, alpha-osf1-tdep.c: Delete files.
* alpha-tdep.c (alpha_gdbarch_init): Remove reference to
GDB_OSABI_OSF1.
* config/alpha/alpha-osf3.mh, config/alpha/nm-osf3.h: Delete
files.
* config/djgpp/fnchange.lst (config/alpha/alpha-osf1.mh)
(config/alpha/alpha-osf2.mh, config/alpha/alpha-osf3.mh): Delete.
* configure: Regenerate.
* configure.ac: Remove references to osf.
* configure.host: Handle alpha*-*-osf* in the obsolete hosts
section.  Remove all other references to osf.
* configure.tgt: Add alpha*-*-osf* to the obsolete targets section.
Remove all other references to osf.
* dec-thread.c: Delete file.
* defs.h (GDB_OSABI_OSF1): Delete.
* inferior.h (START_INFERIOR_TRAPS_EXPECTED): New unconditionally
defined.
* osabi.c (gdb_osabi_names): Delete "OSF/1".
* procfs.c (procfs_debug_inferior) [PROCFS_DONT_TRACE_FAULTS]:
Delete code.
(unconditionally_kill_inferior)
[PROCFS_NEED_CLEAR_CURSIG_FOR_KILL]: Delete code.
* solib-osf.c: Delete file.

gdb/testsuite/
2014-10-17  Pedro Alves  <palves@redhat.com>

* gdb.base/callfuncs.exp: emove references to osf.
* gdb.base/sigall.exp: Likewise.
* gdb.gdb/selftest.exp: Likewise.
* gdb.hp/gdb.base-hp/callfwmall.exp: Likewise.
* gdb.mi/non-stop.c: Likewise.
* gdb.mi/pthreads.c: Likewise.
* gdb.reverse/sigall-precsave.exp: Likewise.
* gdb.reverse/sigall-reverse.exp: Likewise.
* gdb.threads/pthreads.c: Likewise.
* gdb.threads/pthreads.exp: Likewise.

gdb/doc/
2014-10-17  Pedro Alves  <palves@redhat.com>

* gdb.texinfo (Ada Tasks and Core Files): Delete mention of Tru64.
(SVR4 Process Information): Delete mention of OSF/1.

10 years agoFix build without libexpat
Pedro Alves [Fri, 17 Oct 2014 10:05:06 +0000 (11:05 +0100)]
Fix build without libexpat

clear_threads_listing_context is used for thread listing methods other
than the xml based, but it's only defined when HAVE_LIBEXPAT is defined.

gdb/
2014-10-17  Pedro Alves  <palves@redhat.com>

* remote.c (clear_threads_listing_context): Move higher up, out of
the HAVE_LIBEXPAT guard.

10 years agoDon't check target_info exists noargs in commands.exp
Yao Qi [Fri, 10 Oct 2014 13:17:11 +0000 (21:17 +0800)]
Don't check target_info exists noargs in commands.exp

I am confused by the noargs checking at each proc in commands.exp,

    if [target_info exists noargs] {
        verbose "Skipping progvar_simple_while_test because of noargs."
        return
    }
    gdb_test_no_output "set args 5" "set args in progvar_simple_while_test"
    if { ![runto factorial] } then { gdb_suppress_tests }
    # Don't depend upon argument passing, since most simulators don't
    # currently support it.  Bash value variable to be what we want.
    gdb_test "p value=5" ".*" "set value to 5 in progvar_simple_if_test #2"

They are conflicting to me.  If the argument passing can't be done on
the target, we skip this test, why do we still have to set value below?
On the other hand, the test case is compiled with -DFAKEARGV, it doesn't
get anything from argv[1], why do we need to skip it if noargs is true?

I don't find any useful clues from the git log, as the code is quite
old, predating import to sourceware cvs.  However, I find something
useful from the ChangeLog.

Thu Jul 20 13:28:36 1995  Jeffrey A. Law  <law@rtl.cygnus.com>

        .....
        * gdb.base/commands.exp: Protect tests which need arguments with
        $noargs conditionals.

Mon Apr 21 13:38:58 1997  Fred Fish  <fnf@cygnus.com>

        * gdb.base/run.c: Use FAKEARGV to build test executable that
        does not require a command line arg, since most simulators
        don't currently support passing such an arg into the simulated
        program.
        * gdb.base/commands.exp: Change tests to insert the proper
        value as the arg to the first recursive factorial call.  Change
        compilation line to define FAKEARGV at compile time.

Jeff added noargs checking as argument is passed to the inferior.  Then,
I presume Fred wanted to run this test on simulators which don't support
argument passing, and change the code not get input from argv.  (I guess)
noargs wasn't set in simulator board files at that moment.

Since Fred changed test to set input by gdb, instead of getting input
from argv, the test should be able to run on target doesn't support
argument passing, such as simulator and gdbserver.

This patch is to remove these checks to noargs and "set args".  I run
commands.exp with these board files, and no fail is found

 - unix and native-gdbserver
 - arm-none-eabi with qemu
 - gdbserver on arm-linux-gnueabi with qemu

gdb/testsuite:

2014-10-17  Yao Qi  <yao@codesourcery.com>

* gdb.base/commands.exp (gdbvar_complex_if_while_test): Don't check
'target_info exists noargs'.
(test_command_prompt_position): Likewise.
(progvar_simple_if_test): Don't check 'target_info exists noargs'.
 Remove "set args".
(progvar_simple_while_test): Likewise.
(progvar_complex_if_while_test): Likewise.
(if_while_breakpoint_command_test): Likewise.
(infrun_breakpoint_command_test): Likewise.
(breakpoint_command_test): Likewise.
(watchpoint_command_test): Likewise.
(bp_deleted_in_command_test): Likewise.
(temporary_breakpoint_commands): Likewise.

10 years agodaily update
Alan Modra [Thu, 16 Oct 2014 23:01:12 +0000 (09:31 +1030)]
daily update

10 years agoUse strtod instead of strtold in libiberty/d-demangle.c
Joel Brobecker [Tue, 14 Oct 2014 16:47:43 +0000 (12:47 -0400)]
Use strtod instead of strtold in libiberty/d-demangle.c

strtold is currently used to decode templates which have a floating-point
value encoded inside; but this routine is not available on some systems,
such as Solaris 2.9 for instance.

This patch fixes the issue by replace the use of strtold by strtod.
It reduces a bit the precision, but it should still remain acceptable
in most cases.

libiberty/ChangeLog:

        * d-demangle.c: Replace strtold with strtod in global comment.
        (strtold): Remove declaration.
        (strtod): New declaration.
        (dlang_parse_real): Declare value as double instead of long
        double.  Replace call to strtold by call to strtod.
        Update format in call to snprintf.

10 years agoDarwin: sanitize %gs and %fs values.
Tristan Gingold [Thu, 16 Oct 2014 11:50:07 +0000 (13:50 +0200)]
Darwin: sanitize %gs and %fs values.

Some Darwin kernels return values out of bounds for gs and fs segments.
With this commit, they are masked to avoid garbage.

gdb/ChangeLog:
* i386-darwin-nat.c (i386_darwin_fetch_inferior_registers)
(i386_darwin_store_inferior_registers): Sanitize gs and fs values
on amd64.

10 years agoFix 17492, ld segfault with --oformat=binary
Alan Modra [Thu, 16 Oct 2014 10:46:07 +0000 (21:16 +1030)]
Fix 17492, ld segfault with --oformat=binary

PR 17492
* elf32-arm.c (elf32_arm_add_symbol_hook): Only set has_gnu_symbols
on ELF output bfd.
* elf32-i386.c (elf_i386_add_symbol_hook): Likewise.
* elf32-m68k.c (elf_m68k_add_symbol_hook): Likewise.
* elf32-ppc.c (ppc_elf_add_symbol_hook): Likewise.
* elf32-sparc.c (elf32_sparc_add_symbol_hook): Likewise.
* elf64-ppc.c (ppc64_elf_add_symbol_hook): Likewise.
* elf64-sparc.c (elf64_sparc_add_symbol_hook): Likewise.
* elf64-x86-64.c (elf_x86_64_add_symbol_hook): Likewise.
* elfxx-aarch64.c (_bfd_aarch64_elf_add_symbol_hook): Likewise.
* elf-s390-common.c (elf_s390_add_symbol_hook): Likewise.  Handle
STB_GNU_UNIQUE too.

10 years agoDon't check noargs in remotetimeout.exp
Yao Qi [Fri, 10 Oct 2014 12:52:25 +0000 (20:52 +0800)]
Don't check noargs in remotetimeout.exp

The condition [target_info exists noargs] is checked when
remotetimeout.exp was added
https://sourceware.org/ml/gdb-patches/2005-02/msg00052.html

noargs means GDB does not support argument passing for inferior,
rather than doesn't support argument passing to GDB.  remotetimeout.exp
passes -l to GDB only, doesn't pass any arguments to the inferior.

This patch is to remove such unnecessary checking, and
remotetimeout.exp then can be run with native-gdbserver board file.

gdb/testsuite:

2014-10-16  Yao Qi  <yao@codesourcery.com>

* gdb.base/remotetimeout.exp: Remove noargs checking.

10 years agoPR17488, powerpc64-linux-ld segfault
Alan Modra [Wed, 15 Oct 2014 23:08:09 +0000 (09:38 +1030)]
PR17488, powerpc64-linux-ld segfault

For binary ouput, we don't have an ELF bfd output so can't access
elf_elfheader.  The elf64-ppc.c changes are really just a tidy,
triggered by looking at all places where the abiversion bits are
accessed.

bfd/
* elf64-ppc.c (ppc64_elf_before_check_relocs): Do .opd processing
even when output is not ppc64 ELF.  Remove redundant tests on
type of input bfd.
ld/
PR 17488
* emultempl/ppc64elf.em (gld${EMULATION_NAME}_finish): Don't attempt
to access ELF header e_flags when not ppc64 ELF output.

10 years agodaily update
Alan Modra [Wed, 15 Oct 2014 23:01:12 +0000 (09:31 +1030)]
daily update

10 years agoHere we have the patch for gold aarch64 backend to support relaxation.
Han Shen [Wed, 15 Oct 2014 22:23:01 +0000 (15:23 -0700)]
Here we have the patch for gold aarch64 backend to support relaxation.

In short relaxation is the linker's generation of stubs that fixes the
out-of-range jumps/branches in the original object file.

With this implementation, we are able to link a 456MB aarch64 application.

Tested:
1) Build natively on x86_64 and aarch64 machines.
2) Pass unit tests regarding relaxation.

10 years agoDEC threads: Simplify updating the thread list
Pedro Alves [Wed, 15 Oct 2014 21:48:35 +0000 (22:48 +0100)]
DEC threads: Simplify updating the thread list

Seems to me that we can simplify DEC thread's
target_update_thread_list implementation, avoiding the need to build
the array of GDB threads.

I have no way to test this, but then again support for Tru64 is about
to be removed.

Pushing anyway to have the last version in git be the cleanest one
should start from, if this file turns out to be resurrected in the
future.

gdb/
2014-10-15  Pedro Alves  <palves@redhat.com>

* dec-thread.c (dec_thread_count_gdb_threads)
(dec_thread_add_gdb_thread): Delete.
(dec_thread_update_thread_list): Delete.
(dec_thread_find_new_threads): Rename to ...
(dec_thread_update_thread_list): ... this.  Delete GDB-size
threads that are no longer found in dec_thread_list.
(resync_thread_list): Delete.
(dec_thread_wait): Call dec_thread_update_thread_list instead of
resync_thread_list.

10 years agoremote: get rid of all the T packets when syncing the thread list
Pedro Alves [Wed, 15 Oct 2014 21:44:00 +0000 (22:44 +0100)]
remote: get rid of all the T packets when syncing the thread list

This commit avoids the prune_threads call in the remote target's
target_update_thread_list's implementation, eliminating all the "thread
alive" RSP traffic (one packet per thread) whenever we fetch the
thread list.

IOW, this:

 Sending packet: $Tp2141.2150#82...Packet received: OK
 Sending packet: $Tp2141.214f#b7...Packet received: OK
 Sending packet: $Tp2141.2141#82...Packet received: OK
 ... more T packets; it's one per previously known live thread ...
 Sending packet: $qXfer:threads:read::0,fff#03...Packet received: l<threads>\n<thread id="p2141.2141" core="2"/>\n<thread id="p2141.214f" core="1"/>\n<thread id="p2141.2150" core="2"/>\n</threads>\n

Becomes:

 Sending packet: $qXfer:threads:read::0,fff#03...Packet received: l<threads>\n<thread id="p2141.2141" core="2"/>\n<thread id="p2141.214f" core="1"/>\n<thread id="p2141.2150" core="2"/>\n</threads>\n

Tested on x86_64 Fedora 20, native gdbserver:
  - tests the qXfer:threads:read method.

Tested on x86_64 Fedora 20, native gdbserver with qXfer:threads:read
force-disabled in gdbserver:
  - So that GDB falls back to the qfThreadInfo/qsThreadInfo method.

And also manually smoked tested force disabling both
qXfer:threads:read and qfThreadInfo/qsThreadInfo in gdbserver.

gdb/
2014-10-15  Pedro Alves  <palves@redhat.com>

* gdbthread.h (ALL_NON_EXITED_THREADS_SAFE): New macro.
* remote.c (remote_update_thread_list): Skip calling prune_threads
if any thread listing method is supported, and instead walk over
the set of remote threads listed, deleting those that are not
found in GDB's thread list.

10 years agoPush pruning old threads down to the target
Pedro Alves [Wed, 15 Oct 2014 21:44:00 +0000 (22:44 +0100)]
Push pruning old threads down to the target

When GDB wants to sync the thread list with the target's (e.g., due to
"info threads"), it calls update_thread_list:

 update_thread_list (void)
 {
   prune_threads ();
   target_find_new_threads ();
   update_threads_executing ();
 }

And then prune_threads does:

 prune_threads (void)
 {
   struct thread_info *tp, *next;

   for (tp = thread_list; tp; tp = next)
     {
       next = tp->next;
       if (!thread_alive (tp))
 delete_thread (tp->ptid);
     }
 }

Calling thread_live on each thread one by one is expensive.

E.g., on Linux, it ends up doing kill(SIG0) once for each thread.  Not
a big deal, but still a bunch of syscalls...

With the remote target, it's cumbersome.  That thread_alive call ends
up generating one T packet per thread:

 Sending packet: $Tp2141.2150#82...Packet received: OK
 Sending packet: $Tp2141.214f#b7...Packet received: OK
 Sending packet: $Tp2141.2141#82...Packet received: OK
 Sending packet: $qXfer:threads:read::0,fff#03...Packet received: l<threads>\n<thread id="p2141.2141" core="2"/>\n<thread id="p2141.214f" core="1"/>\n<thread id="p2141.2150" core="2"/>\n</threads>\n

That seems a bit silly when target_find_new_threads method
implementations will always fetch the whole current set of target
threads, and then add those that are not in GDB's thread list, to
GDB's thread list.

This patch thus pushes down the responsibility of pruning dead threads
to the target_find_new_threads method instead, so a target may
implement pruning dead threads however it wants.

Once we do that, target_find_new_threads becomes a misnomer, so the
patch renames it to target_update_thread_list.

The patch doesn't attempt to do any optimization to any target yet.
It simply exports prune_threads, and makes all implementations of
target_update_thread_list call that.  It's meant to be a no-op.

gdb/
2014-10-15  Pedro Alves  <palves@redhat.com>

* ada-tasks.c (print_ada_task_info, task_command_1): Adjust.
* bsd-uthread.c (bsd_uthread_find_new_threads): Rename to ...
(bsd_uthread_update_thread_list): ... this.  Call prune_threads.
(bsd_uthread_target): Adjust.
* corelow.c (core_open): Adjust.
* dec-thread.c (dec_thread_find_new_threads): Update comment.
(dec_thread_update_thread_list): New function.
(init_dec_thread_ops): Adjust.
* gdbthread.h (prune_threads): New declaration.
* linux-thread-db.c (thread_db_find_new_threads): Rename to ...
(thread_db_update_thread_list): ... this.  Call prune_threads.
(init_thread_db_ops): Adjust.
* nto-procfs.c (procfs_find_new_threads): Rename to ...
(procfs_update_thread_list): ... this.  Call prune_threads.
(procfs_attach, procfs_create_inferior, init_procfs_targets):
Adjust.
* obsd-nat.c (obsd_find_new_threads): Rename to ...
(obsd_update_thread_list): ... this.  Call prune_threads.
(obsd_add_target): Adjust.
* procfs.c (procfs_target): Adjust.
(procfs_notice_thread): Update comment.
(procfs_find_new_threads): Rename to ...
(procfs_update_thread_list): ... this.  Call prune_threads.
* ravenscar-thread.c (ravenscar_update_inferior_ptid): Update
comment.
(ravenscar_wait): Adjust.
(ravenscar_find_new_threads): Rename to ...
(ravenscar_update_thread_list): ... this.  Call prune_threads.
(init_ravenscar_thread_ops): Adjust.
* record-btrace.c (record_btrace_find_new_threads): Rename to ...
(record_btrace_update_thread_list): ... this.  Adjust comment.
(init_record_btrace_ops): Adjust.
* remote.c (remote_threads_info): Rename to ...
(remote_update_thread_list): ... this.  Call prune_threads.
(remote_start_remote, extended_remote_attach_1, init_remote_ops):
Adjust.
* sol-thread.c (check_for_thread_db): Adjust.
(sol_find_new_threads_callback): Rename to ...
(sol_update_thread_list_callback): ... this.
(sol_find_new_threads): Rename to ...
(sol_update_thread_list): ... this.  Call prune_threads.  Adjust.
(sol_get_ada_task_ptid, init_sol_thread_ops): Adjust.
* target-delegates.c: Regenerate.
* target.c (target_find_new_threads): Rename to ...
(target_update_thread_list): ... this.
* target.h (struct target_ops): Rename to_find_new_threads field
to to_update_thread_list.
(target_find_new_threads): Rename to ...
(target_update_thread_list): ... this.
* thread.c (prune_threads): Make extern.
(update_thread_list): Adjust.

10 years agoMerge remote thread listing methods
Pedro Alves [Wed, 15 Oct 2014 21:43:59 +0000 (22:43 +0100)]
Merge remote thread listing methods

We have three methods to list the current remote thread list:

1. The qXfer:threads:read method (the preferred one nowadays), builds a
remote thread list while parsing the XML, and then after the XML
parsing is done, goes over the built list and adds threads GDB doesn't
know about yet to GDB's list.

2. If the qXfer method isn't available, we fallback to using the
qfThreadInfo/qsThreadInfo packets.  When we do this, we adds threads
to GDB's list immediately as we parse the qfThreadInfo/qsThreadInfo
packet replies.

3. And then if the previous method isn't available either, we try the
old deprecated qL packet.  This path is already looking somewhat
broken for not using remote_notice_new_inferior to add threads to
GDB's list.

This patch makes all variants work in two passes, like the qXfer
method, and then makes all variants share the code path that adds
threads to GDB's list.

Tested on x86_64 Fedora 20 with native gdbserver.

gdb/
2014-10-15  Pedro Alves  <palves@redhat.com>

* remote.c (remote_get_threadlist, remote_threadlist_iterator):
Add describing comment.  Return -1 if the qL packet is not
supported.
(struct thread_item, thread_item_t): Move higher up in
the file.  Add comments.
(struct threads_parsing_context): Move higher up in
the file, add comments, and remote to ...
(struct threads_listing_context): ... this.
(remote_newthread_step): Don't add the thread to GDB's thread
database here.  Instead push it to the thread_listing_context
list.
(remote_find_new_threads): Rename to ...
(remote_get_threads_with_ql): ... this.  Add target_ops and
targets_listing_context parameters.  Pass down context.
(start_thread): Adjust.
(clear_threads_parsing_context): Rename to ...
(clear_threads_listing_context): ... this.
(remote_get_threads_with_qxfer): New, with parts salvaged from old
remote_threads_info.
(remote_get_threads_with_qthreadinfo): Ditto.
(remote_threads_info): Reimplement.

10 years agoNon-stop + software single-step archs: don't force displaced-stepping for all single...
Pedro Alves [Wed, 15 Oct 2014 19:18:32 +0000 (20:18 +0100)]
Non-stop + software single-step archs: don't force displaced-stepping for all single-steps

This finally reverts this bit of commit 929dfd4f:

  2009-07-31  Pedro Alves  <pedro@codesourcery.com>
      Julian Brown  <julian@codesourcery.com>

 ...
 (resume): If this is a software single-stepping arch, and
 displaced-stepping is enabled, use it for all single-step
 requests.
 ...

That means that in non-stop (or really displaced-stepping) mode, on
software single-step archs - even those that only use sss breakpoints
to deal with atomic sequences, like PPC - if we have more than one
thread single-stepping, we'll always serialize the threads'
single-steps, as only one thread may be displaced stepping at a given
time, because there's only one scratch pad.

We originally did that because GDB didn't support having multiple
threads software-single-stepping simultaneously.  The previous patches
fixed that limitation, so we can now finally revert this too.

Tested on:

  - x86_64 Fedora 20, on top of the 'software single-step on x86'
    series.

gdb/
2014-10-15  Pedro Alves  <palves@redhat.com>

* infrun.c (resume): Don't force displaced-stepping for all
single-steps on software single-stepping archs.

10 years agoMake single-step breakpoints be per-thread
Pedro Alves [Wed, 15 Oct 2014 19:18:32 +0000 (20:18 +0100)]
Make single-step breakpoints be per-thread

This patch finally makes each thread have its own set of single-step
breakpoints.  This paves the way to have multiple threads software
single-stepping, though this patch doesn't flip that switch on yet.
That'll be done on a subsequent patch.

gdb/
2014-10-15  Pedro Alves  <palves@redhat.com>

* breakpoint.c (single_step_breakpoints): Delete global.
(insert_single_step_breakpoint): Adjust to store the breakpoint
pointer in the current thread.
(single_step_breakpoints_inserted, remove_single_step_breakpoints)
(cancel_single_step_breakpoints): Delete functions.
(breakpoint_has_location_inserted_here): Make extern.
(single_step_breakpoint_inserted_here_p): Adjust to walk the
breakpoint list.
* breakpoint.h (breakpoint_has_location_inserted_here): New
declaration.
(single_step_breakpoints_inserted, remove_single_step_breakpoints)
(cancel_single_step_breakpoints): Remove declarations.
* gdbthread.h (struct thread_control_state)
<single_step_breakpoints>: New field.
(delete_single_step_breakpoints)
(thread_has_single_step_breakpoints_set)
(thread_has_single_step_breakpoint_here): New declarations.
* infrun.c (follow_exec): Also clear the single-step breakpoints.
(singlestep_breakpoints_inserted_p, singlestep_ptid)
(singlestep_pc): Delete globals.
(infrun_thread_ptid_changed): Remove references to removed
globals.
(resume_cleanups): Delete the current thread's single-step
breakpoints.
(maybe_software_singlestep): Remove references to removed globals.
(resume): Adjust to use thread_has_single_step_breakpoints_set and
delete_single_step_breakpoints.
(init_wait_for_inferior): Remove references to removed globals.
(delete_thread_infrun_breakpoints): Delete the thread's
single-step breakpoints too.
(delete_just_stopped_threads_infrun_breakpoints): Don't delete
single-step breakpoints here.
(delete_stopped_threads_single_step_breakpoints): New function.
(adjust_pc_after_break): Adjust to use
thread_has_single_step_breakpoints_set.
(handle_inferior_event): Remove references to removed globals.
Use delete_stopped_threads_single_step_breakpoints.
(handle_signal_stop): Adjust to per-thread single-step
breakpoints.  Swap test order to do cheaper tests first.
(switch_back_to_stepped_thread): Extend debug output.  Remove
references to removed globals.
* record-full.c (record_full_wait_1): Adjust to per-thread
single-step breakpoints.
* thread.c (delete_single_step_breakpoints)
(thread_has_single_step_breakpoints_set)
(thread_has_single_step_breakpoint_here): New functions.
(clear_thread_inferior_resources): Also delete the thread's
single-step breakpoints.

10 years agothread.c: cleanup breakpoint deletion
Pedro Alves [Wed, 15 Oct 2014 19:18:32 +0000 (20:18 +0100)]
thread.c: cleanup breakpoint deletion

A little refactoring to reduce duplicate code.

gdb/
2014-10-15  Pedro Alves  <palves@redhat.com>

* thread.c (delete_thread_breakpoint): New function.
(delete_step_resume_breakpoint)
(delete_exception_resume_breakpoint): Use it.
(delete_at_next_stop): New function.
(clear_thread_inferior_resources): Use delete_at_next_stop.

10 years agoRemove deprecated_insert_raw_breakpoint and friends
Pedro Alves [Wed, 15 Oct 2014 19:18:31 +0000 (20:18 +0100)]
Remove deprecated_insert_raw_breakpoint and friends

There are no users of deprecated_{insert,remove}_raw_breakpoint left.

gdb/
2014-10-15  Pedro Alves  <palves@redhat.com>

* breakpoint.c (regular_breakpoint_inserted_here_p): Inline ...
(breakpoint_inserted_here_p): ... here.  Remove special case for
software single-step breakpoints.
(find_non_raw_software_breakpoint_inserted_here): Inline ...
(software_breakpoint_inserted_here_p): ... here.  Remove special
case for software single-step breakpoints.
(bp_target_info_copy_insertion_state)
(deprecated_insert_raw_breakpoint)
(deprecated_remove_raw_breakpoint): Delete functions.
* breakpoint.h (deprecated_insert_raw_breakpoint)
(deprecated_remove_raw_breakpoint): Remove declarations.

10 years agoPut single-step breakpoints on the bp_location chain
Pedro Alves [Wed, 15 Oct 2014 19:18:31 +0000 (20:18 +0100)]
Put single-step breakpoints on the bp_location chain

This patch makes single-step breakpoints "real" breakpoints on the
global location list.

There are several benefits to this:

- It removes the currently limitation that only 2 single-step
  breakpoints can be inserted.  See an example here of a discussion
  around a case that wants more than 2, possibly unbounded:

  https://sourceware.org/ml/gdb-patches/2014-03/msg00663.html

- makes software single-step work on read-only code regions.

  The logic to convert a software breakpoint to a hardware breakpoint
  if the memory map says the breakpoint address is in read only memory
  is in insert_bp_location.  Because software single-step breakpoints
  bypass all that go and straight to target_insert_breakpoint, we
  can't software single-step over read only memory.  This patch
  removes that limitation, and adds a test that makes sure that works,
  by forcing a code region to read-only with "mem LOW HIGH ro" and
  then stepping through that.

- Fixes PR breakpoints/9649

  This is an assertion failure in insert_single_step_breakpoint in
  breakpoint.c, because we may leave stale single-step breakpoints
  behind on error.

  The tests for stepping through read-only regions exercise the root
  cause of the bug, which is that we leave single-step breakpoints
  behind if we fail to insert any single-step breakpoint.  Deleting
  the single-step breakpoints in resume_cleanups,
  delete_just_stopped_threads_infrun_breakpoints, and
  fetch_inferior_event fixes this.  Without that, we'd no longer hit
  the assertion, as that code is deleted, but we'd instead run into
  errors/warnings trying to insert/remove the stale breakpoints on
  next resume.

- Paves the way to have multiple threads software single-stepping at
  the same time, leaving update_global_location_list to worry about
  duplicate locations.

- Makes the moribund location machinery aware of software single-step
  breakpoints, paving the way to enable software single-step on
  non-stop, instead of forcing serialized displaced stepping for all
  single steps.

- It's generaly cleaner.

  We no longer have to play games with single-step breakpoints
  inserted at the same address as regular breakpoints, like we
  recently had to do for 7.8.  See this discussion:

  https://sourceware.org/ml/gdb-patches/2014-06/msg00052.html.

Tested on x86_64 Fedora 20, on top of my 'single-step breakpoints on
x86' series.

gdb/
2014-10-15  Pedro Alves  <palves@redhat.com>

PR breakpoints/9649
* breakpoint.c (single_step_breakpoints, single_step_gdbarch):
Delete array globals.
(single_step_breakpoints): New global.
(breakpoint_xfer_memory): Remove special handling for single-step
breakpoints.
(update_breakpoints_after_exec): Delete bp_single_step
breakpoints.
(detach_breakpoints): Remove special handling for single-step
breakpoints.
(breakpoint_init_inferior): Delete bp_single_step breakpoints.
(bpstat_stop_status): Add comment.
(bpstat_what, bptype_string, print_one_breakpoint_location)
(adjust_breakpoint_address, init_bp_location): Handle
bp_single_step.
(new_single_step_breakpoint): New function.
(set_momentary_breakpoint, bkpt_remove_location): Remove special
handling for single-step breakpoints.
(insert_single_step_breakpoint, single_step_breakpoints_inserted)
(remove_single_step_breakpoints, cancel_single_step_breakpoints):
Rewrite.
(detach_single_step_breakpoints, find_single_step_breakpoint):
Delete functions.
(breakpoint_has_location_inserted_here): New function.
(single_step_breakpoint_inserted_here_p): Rewrite.
* breakpoint.h: Remove FIXME.
(enum bptype) <bp_single_step>: New enum value.
(insert_single_step_breakpoint): Update comment.
* infrun.c (resume_cleanups)
(delete_step_thread_step_resume_breakpoint): Remove single-step
breakpoints.
(fetch_inferior_event): Install a cleanup that removes infrun
breakpoints.
(switch_back_to_stepped_thread) <expect thread advanced also>:
Clear step-over info.

gdb/testsuite/
2014-10-15  Pedro Alves  <palves@redhat.com>

PR breakpoints/9649
* gdb.base/breakpoint-in-ro-region.c (main): Add more instructions.
* gdb.base/breakpoint-in-ro-region.exp
(probe_target_hardware_step): New procedure.
(top level): Probe hardware stepping and hardware breakpoint
support.  Test stepping through a read-only region, with both
"breakpoint auto-hw" on and off and both "always-inserted" on and
off.

10 years agoinfrun.c: add for_each_just_stopped_thread
Pedro Alves [Wed, 15 Oct 2014 19:18:30 +0000 (20:18 +0100)]
infrun.c: add for_each_just_stopped_thread

This is a preparatory/cleanup patch that does two things:

- Renames 'delete_step_thread_step_resume_breakpoint'.  The
  "step_resume" part is misnomer these days, as the function deletes
  other kinds of breakpoints, not just the step-resume breakpoint.  A
  following patch will want to make it delete yet another kind of
  breakpoint, even.

- Splits out the logic of which threads get those breakpoints deleted
  to a separate "for_each"-style function, so that the same following
  patch may use it with a different callback.

Tested on x86_64 Fedora 20.

gdb/
2014-10-15  Pedro Alves  <palves@redhat.com>

* infrun.c (delete_step_resume_breakpoint_callback): Delete.
(delete_thread_infrun_breakpoints): New function, with parts
salvaged from delete_step_resume_breakpoint_callback.
(delete_step_thread_step_resume_breakpoint): Delete.
(for_each_just_stopped_thread_callback_func): New typedef.
(for_each_just_stopped_thread): New function.
(delete_just_stopped_threads_infrun_breakpoints): New function.
(delete_step_thread_step_resume_breakpoint_cleanup): Rename to ...
(delete_just_stopped_threads_infrun_breakpoints_cleanup):
... this.  Adjust.
(wait_for_inferior, fetch_inferior_event): Adjust to renames.

10 years agoRewrite non-continuable watchpoints handling
Pedro Alves [Wed, 15 Oct 2014 19:18:30 +0000 (20:18 +0100)]
Rewrite non-continuable watchpoints handling

When GDB finds out the target triggered a watchpoint, and the target
has non-continuable watchpoints, GDB sets things up to step past the
instruction that triggered the watchpoint.  This is just like stepping
past a breakpoint, but goes through a different mechanism - it resumes
only the thread that needs to step past the watchpoint, but also
switches a "infwait state" global, that has the effect that the next
target_wait only wait for events only from that thread.

This forcing of a ptid to pass to target_wait obviously becomes a
bottleneck if we ever support stepping past different watchpoints
simultaneously (in separate processes).

It's also unnecessary -- the target should only return events for
threads that have been resumed; if no other thread than the one we're
stepping past the watchpoint has been resumed, then those other
threads should not report events.  If we couldn't assume that, then
stepping past regular breakpoints would be broken for not likewise
forcing a similar infwait_state.

So this patch eliminates infwait_state, and instead teaches keep_going
to mark step_over_info in a way that has the breakpoints module skip
inserting watchpoints (because we're stepping past one), like it skips
breakpoints when we're stepping past one.

Tested on:

 - x86_64 Fedora 20 (continuable watchpoints)
 - PPC64 Fedora 18  (non-steppable watchpoints)

gdb/
2014-10-15  Pedro Alves  <palves@redhat.com>

* breakpoint.c (should_be_inserted): Don't insert watchpoints if
trying to step past a non-steppable watchpoint.
* gdbthread.h (struct thread_info) <stepping_over_watchpoint>: New
field.
* infrun.c (struct step_over_info): Add new field
'nonsteppable_watchpoint_p' and adjust comments.
(set_step_over_info): New 'nonsteppable_watchpoint_p' parameter.
Adjust.
(clear_step_over_info): Clear nonsteppable_watchpoint_p as well.
(stepping_past_nonsteppable_watchpoint): New function.
(step_over_info_valid_p): Also return true if stepping past a
nonsteppable watchpoint.
(proceed): Adjust call to set_step_over_info.  Remove reference to
init_infwait_state.
(init_wait_for_inferior): Remove reference to init_infwait_state.
(waiton_ptid): Delete global.
(struct execution_control_state)
<stepped_after_stopped_by_watchpoint>: Delete field.
(wait_for_inferior, fetch_inferior_event): Always pass
minus_one_ptid to target_wait.
(init_thread_stepping_state): Clear 'stepping_over_watchpoint'
field.
(init_infwait_state): Delete function.
(handle_inferior_event): Remove infwait_state handling.
(handle_signal_stop) <watchpoints handling>: Adjust after
stepped_after_stopped_by_watchpoint removal.  Don't remove
breakpoints here nor set infwait_state.  Set the thread's
stepping_over_watchpoint flag, and call keep_going instead.
(keep_going): Handle stepping_over_watchpoint.  Adjust
set_step_over_info calls.
* infrun.h (stepping_past_nonsteppable_watchpoint): Declare
function.

10 years agoDecide whether we may have removed breakpoints based on step_over_info
Pedro Alves [Wed, 15 Oct 2014 19:18:29 +0000 (20:18 +0100)]
Decide whether we may have removed breakpoints based on step_over_info

... instead of trap_expected.

Gets rid of one singlestep_breakpoints_inserted_p reference, and is
generally more to the point.

gdb/
2014-10-15  Pedro Alves  <palves@redhat.com>

* infrun.c (step_over_info_valid_p): New function.
(resume): Use step_over_info_valid_p instead of checking the
threads's trap_expected flag.

10 years agogdbserver/win32: Rewrite debug registers handling
Pedro Alves [Wed, 15 Oct 2014 18:55:50 +0000 (19:55 +0100)]
gdbserver/win32: Rewrite debug registers handling

Don't use debug_reg_state for both:

 * "intent" - what we want the debug registers to look like

 * "reality" - what/which were the contents of the DR registers when
   the event triggered

Reserve it for the former only, like in the GNU/Linux port.

Otherwise the core x86 debug registers code can get confused if the
inferior itself changes the debug registers since GDB last set them.

This is also a requirement for being able to set watchpoints while the
target is running, if/when we get to it on Windows.  See the big
comment in x86_dr_stopped_data_address.

Seems to me this may also fixes propagating watchpoints to all threads
-- continue_one_thread only calls win32_set_thread_context (what
copies the DR registers to the thread), if something already fetched
the thread's context before.  Something else may be masking this
issue, I haven't checked.

Smoke tested by running gdbserver under Wine, connecting to it from
GNU/Linux, and checking that I could trigger a watchpoint as expected.

Joel tested it on x86-windows using AdaCore's testsuite.

gdb/gdbserver/
2014-10-15  Pedro Alves  <palves@redhat.com>

PR server/17487
* win32-arm-low.c (arm_set_thread_context): Remove current_event
parameter.
(arm_set_thread_context): Delete.
(the_low_target): Adjust.
* win32-i386-low.c (debug_registers_changed)
(debug_registers_used): Delete.
(update_debug_registers_callback): New function.
(x86_dr_low_set_addr, x86_dr_low_set_control): Mark all threads as
needing to update their debug registers.
(win32_get_current_dr): New function.
(x86_dr_low_get_addr, x86_dr_low_get_control)
(x86_dr_low_get_status): Fetch the debug register from the thread
record's context.
(i386_initial_stuff): Adjust.
(i386_get_thread_context): Remove current_event parameter.  Don't
clear debug_registers_changed nor copy DR values to
debug_reg_state.
(i386_set_thread_context): Delete.
(i386_prepare_to_resume): New function.
(i386_thread_added): Mark the thread as needing to update irs
debug registers.
(the_low_target): Remove i386_set_thread_context and install
i386_prepare_to_resume.
* win32-low.c (win32_get_thread_context): Adjust.
(win32_set_thread_context): Use SetThreadContext
directly.
(win32_prepare_to_resume): New function.
(win32_require_context): New function, factored out from ...
(thread_rec): ... this.
(continue_one_thread): Call win32_prepare_to_resume on each thread
we're about to continue.
(win32_resume): Call win32_prepare_to_resume on the event thread.
* win32-low.h (struct win32_thread_info)
<debug_registers_changed>: New field.
(struct win32_target_ops): Change prototype of set_thread_context,
delete set_thread_context and add prepare_to_resume.
(win32_require_context): New declaration.

10 years agoPR python/17364
Doug Evans [Wed, 15 Oct 2014 18:43:49 +0000 (11:43 -0700)]
PR python/17364

gdb/ChangeLog:

* python/lib/gdb/__init__.py (packages): Add "printer".
* python/lib/gdb/command/bound_registers.py: Moved to ...
* python/lib/gdb/printer/bound_registers.py: ... here.
Add printer to global set of builtin printers.  Rename printer from
"bound" to "mpx_bound128".
* python/lib/gdb/printing.py (_builtin_pretty_printers): New global,
registered as global "builtin" printer.
(add_builtin_pretty_printer): New function.
* data-directory/Makefile.in (PYTHON_FILE_LIST): Update, and add
gdb/printer/__init__.py.

10 years agoRemove d-support.c and use gdb_demangle for demangling D symbols.
Iain Buclaw [Wed, 15 Oct 2014 18:28:19 +0000 (19:28 +0100)]
Remove d-support.c and use gdb_demangle for demangling D symbols.

gdb/ChangeLog

* Makefile.in (SFILES): Remove d-support.c.
(COMMON_OBS): Remove d-support.o.
* d-lang.h (d_parse_symbol): Remove declaration.
* d-lang.c (d_demangle): Use gdb_demangle to demangle D symbols.
* d-support.c: Remove file.

gdb/testsuite/ChangeLog

* gdb.dlang/demangle.exp: Update for demangling changes.

10 years agoRemove non-address bits for longjmp resume breakpoint
Andreas Arnez [Thu, 9 Oct 2014 11:32:22 +0000 (11:32 +0000)]
Remove non-address bits for longjmp resume breakpoint

On 32-bit S390 targets the longjmp target address "naturally" has the
most significant bit set.  That bit indicates the addressing mode and
is not part of the address itself.  Thus, in analogy with similar
cases (like when computing the caller PC in
insert_step_resume_breakpoint_at_caller), this change removes
non-address bits from the longjmp target address before using it as a
breakpoint address.

Note that there are two ways for determining the longjmp target
address: via a probe or via a gdbarch method.  This change only
affects the probe method, because it is assumed that the address
returned by the gdbarch method is usable as-is.

This change was tested together with a patch that enables longjmp
probes in glibc for S/390:

  https://sourceware.org/ml/libc-alpha/2014-10/msg00277.html

gdb/ChangeLog:

* gdb/infrun.c (process_event_stop_test): Apply
gdbarch_addr_bits_remove to longjmp resume address.

10 years agoDelete gdb/regformats/microblaze.dat
Pedro Alves [Wed, 15 Oct 2014 15:21:59 +0000 (16:21 +0100)]
Delete gdb/regformats/microblaze.dat

This file:

 - Isn't used by GDBserver currently.

 - Isn't included in the WHICH list in features/Makefile, so hasn't
   been regenerated to pick the latest microblaze or generic fixes.

Just delete it.

gdb/
2014-10-15  Pedro Alves  <palves@redhat.com>

* regformats/microblaze.dat: Delete file.

10 years agoMicroblaze: Replace microblaze-expedite from pc to rpc
Ajit Kumar Agarwal [Mon, 13 Oct 2014 08:58:22 +0000 (14:28 +0530)]
Microblaze: Replace microblaze-expedite from pc to rpc

The Microblaze PC register is called "rpc", not "pc", as can be seen
in microblaze-core.xml.  Fix this, so GDBserver can find the register in
the regcache.

gdb/
2014-10-15  Ajit Agarwal  <ajitkum@xilinx.com>

* features/Makefile (microblaze-expedite): Replace pc with rpc.
* regformats/microblaze-with-stack-protect.dat: Regenerate.

10 years agoMerge bfd_find_nearest_line variants
Alan Modra [Wed, 15 Oct 2014 11:22:20 +0000 (21:52 +1030)]
Merge bfd_find_nearest_line variants

When bfd_find_nearest_line_discriminator was added, not enough care
was taken to ensure all targets had a proper definition of the function.
This patch cures that by merging bfd_find_nearest_line_discriminator
and bfd_find_nearest_line target implementations.

PR 17481
* aoutx.h (NAME (aout, find_nearest_line)): Add "discriminator_ptr"
param, group "section" and "offset" params.  Zero discriminator.
* bfd.c (bfd_find_nearest_line): Implement with new
_bfd_find_nearest_line.
(bfd_find_nearest_line_discriminator): Likewise.
* coff-i386.c (_bfd_generic_find_nearest_line_discriminator): Don't
define.
* coff-rs6000.c (xcoff_find_nearest_line,
xcoff_find_nearest_line_discriminator): Delete.
(_bfd_xcoff_find_nearest_line): Don't define.
(_bfd_xcoff_find_nearest_line): Define as coff_find_nearest_line.
* coff-x86_64.c (_bfd_generic_find_nearest_line_discriminator): Don't
define.
* coff64-rs6000.c (rs6000_xcoff64_vec, rs6000_xcoff64_aix_vec): Adjust.
* coffgen.c (coff_find_nearest_line_with_names): Reorder params,
adjust _bfd_dwarf2_find_nearest_line call.
(coff_find_nearest_line): Add "discriminator_ptr" param, reorder
others.  Set discriminator.  Adjust call.
(coff_find_nearest_line_discriminator): Delete.
* dwarf1.c (_bfd_dwarf1_find_nearest_line): Reorder params.
* dwarf2.c (find_line): Rename to..
(_bfd_dwarf2_find_nearest_line): ..this, reordering params.
Simplify setting of do_line.  Delete old function.
(_bfd_dwarf2_find_line): Delete.
* ecoff.c (_bfd_ecoff_find_nearest_line): Reorder params, add
discriminator_ptr and set it.
* elf-bfd.h (_bfd_elf_find_nearest_line): Update prototype.
(_bfd_elf_find_nearest_line_discriminator): Delete.
(_bfd_elf_find_line_discriminator): Delete.
(_bfd_generic_find_nearest_line_discriminator): Don't define.
* elf.c (elf_find_function): Reorder params.
(_bfd_elf_find_nearest_line): Reorder params, add discriminator_ptr.
Adjust calls.
(_bfd_elf_find_nearest_line_discriminator): Delete.
(_bfd_elf_find_line): Adjust call.
* elf32-arm.c (arm_elf_find_function): Reorder params.
(elf32_arm_find_nearest_line): Reorder params, add discriminator_ptr.
Adjust calls.
* elf64-alpha.c (elf64_alpha_find_nearest_line): Similarly.
* elfnn-aarch64.c (aarch64_elf_find_function): Reorder params.
(elfNN_aarch64_find_nearest_line): Reorder params, add
discriminator_ptr.  Adjust calls.
* elfxx-mips.c (_bfd_mips_elf_find_nearest_line): Similarly.
* elfxx-mips.h (_bfd_mips_elf_find_nearest_line): Update prototype.
* libaout.h (NAME (aout, find_nearest_line)): Update prototype.
* libbfd-in.h (_bfd_nosymbols_find_nearest_line): Update.
(_bfd_dwarf1_find_nearest_line): Likewise.
(_bfd_dwarf2_find_nearest_line): Likewise.
(_bfd_dwarf2_find_line): Delete.
(_bfd_generic_find_nearest_line_discriminator): Delete.
* libbfd.c (_bfd_generic_find_nearest_line_discriminator): Delete.
* libcoff-in.h (coff_find_nearest_line): Update prototype.
(coff_find_nearest_line_discriminator): Delete.
(coff_find_nearest_line_with_names): Update prototype.
* libecoff.h (_bfd_ecoff_find_nearest_line): Update prototype.
* mach-o.c (bfd_mach_o_find_nearest_line): Reorder params, add
discriminator_ptr.  Adjust calls.
* mach-o.h (bfd_mach_o_find_nearest_line): Update prototype.
* pdp11.c (NAME (aout, find_nearest_line)): Reorder params, add
discriminator_ptr and set.
* som.c (som_find_nearest_line): Similarly.
* targets.c (BFD_JUMP_TABLE_SYMBOLS): Delete entry for
_bfd_find_nearest_line_discriminator.
(struct bfd_target <_bfd_find_nearest_line>): Adjust prototype.
(struct bfd_target <_bfd_find_nearest_line_discriminator>): Delete.
* vms-alpha.c (_bfd_vms_find_nearest_dst_line): Rename to..
(_bfd_vms_find_nearest_line): ..this.  Reorder params, add
"discriminator" and set.
(_bfd_vms_find_nearest_line_discriminator): Delete.
(_bfd_generic_find_nearest_line_discriminator): Don't define.
(alpha_vms_find_nearest_line): Update define.
* bfd-in2.h: Regenerate.
* libbfd.h: Regenerate.
* libcoff.h: Regenerate.

10 years agoDefine bfd_find_line entry of BFD_JUMP_TABLE_SYMBOLS using NAME.
Alan Modra [Wed, 15 Oct 2014 05:10:45 +0000 (15:40 +1030)]
Define bfd_find_line entry of BFD_JUMP_TABLE_SYMBOLS using NAME.

In https://www.sourceware.org/ml/binutils/2005-06/msg00082.html
HJ implemented bfd_find_line for DWARF2, but cheated a little in not
using the usual NAME##_find_line, saving quite a lot of boring
editing.  However that shortcut probably contributed to
bfd_find_nearest_line_discriminator being implemented the same way,
and missing support for some targets.

* targets.c (BFD_JUMP_TABLE_SYMBOLS): Use NAME##_find_line.
* aout-adobe.c (aout_32_find_line): Define.
(aout_32_bfd_make_debug_symbol, aout_32_bfd_reloc_type_lookup,
aout_32_bfd_reloc_name_lookup): Define using _bfd_nosymbols define.
* aout-target.h (MY_find_line): Define.
* aout-tic30.c (MY_find_line): Define.
* binary.c (binary_find_line): Define.
* bout.c (aout_32_find_line): Define.
* coff-rs6000.c (_bfd_xcoff_find_line): Define.
* coff64-rs6000.c (rs6000_xcoff64_vec): Use coff_find_line.
(rs6000_xcoff64_aix_vec): Likewise.
* elf-bfd.h (_bfd_generic_find_line): Don't define.
* elfxx-target.h (bfd_elfNN_find_line): Define.
* i386msdos.c (msdos_find_line): Define.
* i386os9k.c (aout_32_find_line): Define.
* ieee.c (ieee_find_nearest_line, ieee_find_inliner_info): Delete func.
(ieee_find_nearest_line, ieee_find_line,
ieee_find_inliner_info): Define.
* ihex.c (ihex_find_line): Define.
* libbfd-in.h (_bfd_nosymbols_find_line): Define.
(_bfd_generic_find_line): Don't define.
* libbfd.c (_bfd_generic_find_line): Delete.
* libcoff-in.h (coff_find_line): Define.
* libecoff.h (_bfd_ecoff_find_line): Define.
* mach-o.h (bfd_mach_o_find_line): Define.
* mmo.c (mmo_find_line): Define.
* nlm-target.h (nlm_find_line): Define.
* oasys.c (oasys_find_nearest_line, oasys_find_inliner_info): Delete.
(oasys_find_nearest_line, oasys_find_line,
oasys_find_inliner_info): Define.
* pef.c (bfd_pef_find_line): Define.
* plugin.c (bfd_plugin_find_line): Define.
* ppcboot.c (ppcboot_find_line): Define.
* som.c (som_find_line): Define.
* srec.c (srec_find_line): Define.
* tekhex.c (tekhex_find_line): Define.
* versados.c (versados_find_line): Define.
* vms-alpha.c (alpha_vms_find_line): Define.
* xsym.c (bfd_sym_find_line): Define.
* bfd-in2.h: Regenerate.
* libbfd.h: Regenerate.
* libcoff.h: Regenerate.

10 years agoFix gnuv3_pass_by_reference to treat dynamic classes as non-trivial.
Siva Chandra [Tue, 9 Sep 2014 13:50:26 +0000 (06:50 -0700)]
Fix gnuv3_pass_by_reference to treat dynamic classes as non-trivial.

gdb/ChangeLog:

* gnu-v3-abi.c (gnuv3_pass_by_reference): Treat dynamic classes
as non-trivial.

10 years agoAdd new non-trial return value tests.
Siva Chandra [Tue, 9 Sep 2014 13:46:14 +0000 (06:46 -0700)]
Add new non-trial return value tests.

gdb/testsuite/ChangeLog:

* gdb.cp/non-trivial-retval.cc: Add new test cases.
* gdb.cp/non-trivial-retval.exp: Add new tests.

10 years agoFix gnuv3_pass_by_reference to lookup copy c-tors with qualified args.
Siva Chandra [Tue, 9 Sep 2014 13:03:42 +0000 (06:03 -0700)]
Fix gnuv3_pass_by_reference to lookup copy c-tors with qualified args.

Before this, a copy constructor declared as in the following snippet was
not being treated as a copy constructor.

class A
{
public:
  A (A &); // OK.
  A (const A &); // Not being treated as a copy constructor because of the
                 // 'const' qualifier.
};

gdb/ChangeLog:

PR c++/13403
PR c++/15154
* gnu-v3-abi.c (gnuv3_pass_by_reference): Lookup copy constructors
with qualified args.

10 years agoNon trivial return value tests.
Siva Chandra [Mon, 8 Sep 2014 14:04:59 +0000 (07:04 -0700)]
Non trivial return value tests.

gdb/testsuite/ChangeLog:

PR c++/13403
PR c++/15154
* gdb.cp/non-trivial-retval.cc: New file.
* gdb.cp/non-trivial-retval.exp: New file.

10 years agoBump bfd version.
Tristan Gingold [Wed, 15 Oct 2014 08:21:25 +0000 (10:21 +0200)]
Bump bfd version.

bfd/
2014-10-15  Tristan Gingold  <gingold@adacore.com>

* version.m4: Bump version to 2.25.51
* configure: Regenerate.

binutils/
2014-10-15  Tristan Gingold  <gingold@adacore.com>

* configure: Regenerate.

gas/
2014-10-15  Tristan Gingold  <gingold@adacore.com>

* configure: Regenerate.

gprof/
2014-10-15  Tristan Gingold  <gingold@adacore.com>

* configure: Regenerate.

ld/
2014-10-15  Tristan Gingold  <gingold@adacore.com>

* configure: Regenerate.

opcodes/
2014-10-15  Tristan Gingold  <gingold@adacore.com>

* configure: Regenerate.

10 years agosrc-release.sh: configure using --target.
Tristan Gingold [Wed, 15 Oct 2014 07:50:53 +0000 (09:50 +0200)]
src-release.sh: configure using --target.

* src-release.sh (do_proto_toplev): Configure with --target.

10 years agoFix py-parameter.exp for remote host
Yao Qi [Mon, 15 Sep 2014 11:06:22 +0000 (19:06 +0800)]
Fix py-parameter.exp for remote host

Test gdb.python/py-parameter.exp expects output "$srcdir/$subdir:\$cdir:\$cwd",
but proc gdb_reinitialize_dir doesn't set $srcdir/$subdir in search
directories on remote host because it doesn't exist on remote host.

proc gdb_reinitialize_dir { subdir } {
    global gdb_prompt

    if [is_remote host] {
return ""
    }

It causes the fail below:

(gdb) python print (gdb.parameter ('directories'))^M
/tmp/gdb:$cdir:$cwd^M
(gdb) FAIL: gdb.python/py-parameter.exp: python print (gdb.parameter ('directories'))

This patch is to fix this fail by not matching $srcdir/$subdir on remote host.

gdb/testsuite:

2014-10-15  Yao Qi  <yao@codesourcery.com>

* gdb.python/py-parameter.exp: Don't match $srcdir/$subdir on
remote host.

10 years agoFix file name matching on remote host.
Yao Qi [Mon, 15 Sep 2014 09:40:54 +0000 (17:40 +0800)]
Fix file name matching on remote host.

I see the following fails in the remote host testing we do for mingw32
hosted GDB,

python print (symtab[1][0].symtab)^M
python.c^M
(gdb) FAIL: gdb.python/python.exp: Test decode_line current locationn filename

python print (symtab[1][0].symtab)^M
python.c^M
(gdb) FAIL: gdb.python/python.exp: Test decode_line python.c:26 filename

The test cases doesn't consider remote host and assumes that directory
on build also exists on host.  In this patch, we only match file base
name if host is remote, otherwise, match file with dir name.

gdb/testsuite:

2014-10-15  Yao Qi  <yao@codesourcery.com>

* gdb.python/py-symbol.exp: Match file base name if host is
remote, otherwise match file name with dir name.
* gdb.python/py-symtab.exp: Likewise.
* gdb.python/python.exp: Likewise.

10 years agoClean up gdb.python/ tests
Yao Qi [Mon, 15 Sep 2014 08:41:39 +0000 (16:41 +0800)]
Clean up gdb.python/ tests

This patch is to clean up various gdb.python/*.exp tests, such as
removing trailing ".*" from the pattern and fix one typo I find during
reading the code.

gdb/testsuite:

2014-10-15  Yao Qi  <yao@codesourcery.com>

* gdb.python/python.exp: Remove trailing ".*".  Fix typo
locationn.
* gdb.python/py-symbol.exp: Remove trailing ".*" in the
pattern.
* gdb.python/py-symtab.exp: Likewise.

10 years agoAllow unquoted = as the first character in ldscript input_list names
Hans-Peter Nilsson [Wed, 15 Oct 2014 01:10:25 +0000 (03:10 +0200)]
Allow unquoted = as the first character in ldscript input_list names

* ldlex.l (INPUTLIST): New start condition.
(comment pattern, ",", "(", ")", "AS_NEEDED")
({FILENAMECHAR1}{FILENAMECHAR}*, "-l"{FILENAMECHAR}+)
(quoted string pattern, whitespace pattern): Add INPUTLIST to
valid start conditions.
(<INPUTLIST>"="{FILENAMECHAR1}{FILENAMECHAR}*): New NAME rule.
(ldlex_inputlist): New start-condition-setter function.
* ldgram.y (input_list1): Rename from input_list.  All recursive
use changed.
(input_list): New wrapper rule for input_list1, setting
INPUTLIST lexer state for the duration of parsing input_list1.

All this to say INPUT(=/path/to/file) and not be forced to use
INPUT("=/path/to/file") whenever there's a need to force a sysroot-
prefix.  Still, IMHO it seems better to make use of a previously
invalid syntax and not only change the meaning of quoted =-prefixed
paths (though arguably that's not very useful before this patchset).

This got a little bit hairier than I'd expected: I had to add a new
lexer state (aka. start condition) to avoid a first "=" being lexed as
the token "=", despite that not making sense in constructs expecting
file-names in the first place.  (The grammar doesn't allow for
expressions in any part of those lists.)  I guess I *could* have made
it work using that token anyway, but I didn't like the idea that you
would be able to separate the "=" from the rest of the file-name with
whitespace.

10 years agoIf "=" is the first character in a ldscript input file, force a sysroot prefix.
Hans-Peter Nilsson [Wed, 15 Oct 2014 01:03:59 +0000 (03:03 +0200)]
If "=" is the first character in a ldscript input file, force a sysroot prefix.

* ldlang.c (lang_add_input_file): If the first character in the
filename is '=', prepend the sysroot and force the context of that
input file to non-sysroot.

The "input_flags.sysrooted = 0" thing described in the comment is
covered by the testsuite part ("root-anchored =-prefixed script
inside"), but only observable for --with-sysroot configurations.

10 years agoAdd sysroot-prefix ld linker tests.
Hans-Peter Nilsson [Wed, 15 Oct 2014 00:59:41 +0000 (02:59 +0200)]
Add sysroot-prefix ld linker tests.

* ld-scripts/sysroot-prefix.exp, ld-scripts/sysroot-prefix-x.s,
ld-scripts/sysroot-prefix-y.s: New files.

N.B: full coverage is only possible with complementary use of
--with-sysroot when configuring.

10 years agolib/ld-lib.exp (check_sysroot_available): New proc.
Hans-Peter Nilsson [Wed, 15 Oct 2014 00:54:56 +0000 (02:54 +0200)]
lib/ld-lib.exp (check_sysroot_available): New proc.

10 years agold.texinfo: "=" path-prefix forces sysroot in scripts not only SEARCH_DIR
Hans-Peter Nilsson [Wed, 15 Oct 2014 00:50:03 +0000 (02:50 +0200)]
ld.texinfo: "=" path-prefix forces sysroot in scripts not only SEARCH_DIR

* ld.texinfo (input files in linker scripts): When mentioning
behavior of first character "/" on scripts within sysroot, also
mention that effect can be forced by prefixing with "=" and
refer to SEARCH_DIR.

10 years agold.texinfo: Clarify that sysroot affects "=" expansion.
Hans-Peter Nilsson [Wed, 15 Oct 2014 00:42:14 +0000 (02:42 +0200)]
ld.texinfo: Clarify that sysroot affects "=" expansion.

* ld.texinfo (Options): When mentioning "=" and sysroot, mention
that --sysroot controls it, not only through the configuration.

10 years agoChangeLog typo fix
Alan Modra [Tue, 14 Oct 2014 23:21:53 +0000 (09:51 +1030)]
ChangeLog typo fix

10 years agoFix memory overflow issue about strncat
Chen Gang [Tue, 14 Oct 2014 23:18:47 +0000 (09:48 +1030)]
Fix memory overflow issue about strncat

If src contains n or more bytes, strncat() writes n+1 bytes to dest
(n from src plus the terminating null byte).   Therefore, the size of
dest must be at least strlen(dest)+n+1.

* config/tc-tic4x.c (md_assemble): Correct strncat size.

10 years agodaily update
Alan Modra [Tue, 14 Oct 2014 23:01:05 +0000 (09:31 +1030)]
daily update

10 years ago[Ada] Error adding/subtracting pointer value to/from integral.
Joel Brobecker [Thu, 9 Oct 2014 16:37:17 +0000 (12:37 -0400)]
[Ada] Error adding/subtracting pointer value to/from integral.

When trying to evaluate an expression which adds a pointer and
an integral, the evaluation succeeds if the pointer is on
the left handside of the operator, but not when it is on the right
handside:

    (gdb) p something'address + 0
    $1 = (system.address) 0x613418 <pck.something>
    (gdb) p 0 + something'address
    Argument to arithmetic operation not a number or boolean.

Same issue when doing subtractions:

    (gdb) p something'address - 0
    $2 = (system.address) 0x613418 <pck.something>
    (gdb) p 0 - something'address
    Argument to arithmetic operation not a number or boolean.

This patch enhances the Ada expression evaluator to handle
these two situations.

gdb/ChangeLog:

        * ada-lang.c (ada_evaluate_subexp) <BINOP_ADD>: Add handling
        of the case where the second operand is a pointer.
        <BINOP_SUB>: Likewise.

gdb/testsuite/ChangeLog:

        * gdb.ada/addr_arith: New testcase.

Tested on x86_64-linux.

10 years agogdb.dwarf2: Testsuite 64-bit pointer truncation fixes
Maciej W. Rozycki [Tue, 14 Oct 2014 20:16:07 +0000 (21:16 +0100)]
gdb.dwarf2: Testsuite 64-bit pointer truncation fixes

* gdb.dwarf2/dw2-case-insensitive-debug.S: Handle 64-bit pointers.
* gdb.dwarf2/dw2-case-insensitive.exp: Update accordingly.
* gdb.dwarf2/dw2-skip-prologue.S: Handle 64-bit pointers.
* gdb.dwarf2/dw2-skip-prologue.exp: Update accordingly.

10 years agoOnly call {set,clear}_semaphore probe function if they are not NULL
Sergio Durigan Junior [Tue, 14 Oct 2014 18:45:13 +0000 (14:45 -0400)]
Only call {set,clear}_semaphore probe function if they are not NULL

This patch is a response to what I commented on:

  <https://sourceware.org/ml/gdb-patches/2014-10/msg00046.html>

When reviewing Jose's USDT probe support patches.  Basically, in his
patch he had to create dummy functions for the set_semaphore and the
clear_semaphore methods of probe_ops (gdb/probe.h), because those
functions were called inconditionally from inside gdb/breakpoint.c and
gdb/tracepoint.c.  However, the semaphore concept may not apply to all
types of probes, and this is the case here: USDT probes do not have
semaphores (although SDT probes do).

Anyway, this is a simple (almost obvious) patch to guard the call to
{set,clear}_semaphore.  It does not introduce any regression on a
Fedora 20 x86_64.

I will apply it in a few days in case there is no comment.

gdb/ChangeLog:
2014-10-14  Sergio Durigan Junior  <sergiodj@redhat.com>

* breakpoint.c (bkpt_probe_insert_location): Call set_semaphore
only if it is not NULL.
(bkpt_probe_remove_location): Likewise, for clear_semaphore.
* probe.h (struct probe_ops) <set_semaphore>: Update comment.
(struct probe_ops) <clear_semaphore>: Likewise.
* tracepoint.c (start_tracing): Call set_semaphore only if it is
not NULL.
(stop_tracing): Likewise, for clear_semaphore.

10 years agoExplicitly use language_c when evaluating a SDT probe argument
Sergio Durigan Junior [Tue, 14 Oct 2014 18:31:09 +0000 (14:31 -0400)]
Explicitly use language_c when evaluating a SDT probe argument

Joel contacted me offlist with a question about a warning that one of
his customers was seeing.  The message came from the new
linker-debugger interface, which uses SDT probes internally.  The
warning said:

    (gdb) run
    [...]
    warning: Probes-based dynamic linker interface failed.
    Reverting to original interface.

    Argument to arithmetic operation not a number or boolean.

This should not have happened in the environment the customer was
using (RHEL-6.x), so I found it strange.  Another thing caught my
attention: the last message, saying "Argument to arithmetic operation
not a number or boolean.".

Joel kindly investigated the issue further, and found the answer for
this.  To quote him:

(gdb) set lang c
(gdb) p 48+$ebp
$4 = (void *) 0xffffd0f8

    So far so good. But...

(gdb) set lang ada
(gdb) p 48+$ebp
Argument to arithmetic operation not a number or boolean.

    Ooops! Interestingly, if you revert the order of the operands...

(gdb) p $ebp+48
$5 = (access void) 0xffffd0f8

So the problem is doing pointer arithmetics when the language is set
to Ada.

I remembered that, during the parsing and the evaluation of SDT probe
arguments, the code sets the language as current_language, because, at
that time, I thought it was not necessary to worry about the language
given that the code implements its own parser.  I was wrong.  So here
is a patch to fix that, by setting the language as C, which should
guarantee that the maths are done in the right way (TM).

It was somewhat hard to find a reproducer for this issue.  In the end,
what I had to do was to create a testcase that used the %ebp register
on some displacement (e.g., "-4(%ebp)"), which finally triggered the
bug.  I am not sure why I could not trigger it when using other
registers, but I did not want to spend too much time investigating
this issue, which seemed like an Ada issue.  Also, because of this
peculiar way to trigger the problem, the testcase only covers x86-like
targets (i.e., i*86 and x86_64 with -m32).

Joel kindly tested this for me, and it worked.  I also ran a full
regression test here on my Fedora 20 x86_64, and everything is fine.

I will push this patch in a few days if there are no comments.

gdb/ChangeLog:
2014-10-14  Sergio Durigan Junior  <sergiodj@redhat.com>

* stap-probe.c (stap_parse_argument): Initialize expout explicitly
using language_c, instead of current_language.

gdb/testsuite/ChangeLog:
2014-10-14  Sergio Durigan Junior  <sergiodj@redhat.com>

* gdb.arch/stap-eval-lang-ada.S: Likewise.
* gdb.arch/stap-eval-lang-ada.c: Likewise.
* gdb.arch/stap-eval-lang-ada.exp: New file.

10 years agoConvert mov to lea only if r_offset >= 2
H.J. Lu [Tue, 14 Oct 2014 15:03:32 +0000 (08:03 -0700)]
Convert mov to lea only if r_offset >= 2

* elf32-i386.c (elf_i386_convert_mov_to_lea): Skip if relocation
offset is less than 2.
* elf64-x86-64.c (elf_x86_64_convert_mov_to_lea): Likewise.

10 years agoFix fail in mi-var-child.exp and mi-var-display.exp
Yao Qi [Sat, 30 Aug 2014 13:30:36 +0000 (21:30 +0800)]
Fix fail in mi-var-child.exp and mi-var-display.exp

Hi,
I see the following fails on arm-none-eabi target,

-var-list-children --simple-values struct_declarations  ^M
^done,numchild="11",children=[...,child={name="struct_declarations.func_ptr_struct",exp="func_ptr_struct",numchild="0",value="0x0 <_ftext>",type="struct _struct_decl (*)(int, char *, long)",thread-id="1"},child={name="struct_declarations.func_ptr_ptr",exp="func_ptr_ptr",numchild="0",value="0x0 <_ftext>",type="struct _struct_decl *(*)(int, char *, long)",thread-id="1"},...
(gdb) ^M
FAIL: gdb.mi/mi-var-child.exp: listing of children, simple types: names, type and values, complex types: names and types

-var-set-format weird.func_ptr_ptr natural^M
^done,format="natural",value="0x0 <_ftext>"^M
(gdb) ^M
FAIL: gdb.mi/mi-var-display.exp: set format variable weird.func_ptr_ptr in natural

In the test, "0x0" is expected, but "0x0 <_ftext>" is in the output.
Function pointers point to address zero, and tests assume there is no
symbol on address zero.  However, on my arm-none-eabi target, there is
a code symbol _ftext on address zero, and test fails.  Note that "set
print symbol off" doesn't take effect for function pointer.

int (*f) (void);
f = main;

(gdb) p f
$1 = (int (*)(void)) 0x8048400 <main>
(gdb) set print symbol off
(gdb) p f
$2 = (int (*)(void)) 0x8048400 <main>

In order to erase the difference, we can assign some function address
explicitly to function pointer, so the test behaves in a unique way.
In this patch, we assign nothing1 and nothing2 to function pointers
func_ptr_struct and func_ptr_ptr respectively, and update test as the
source file is changed.

gdb/testsuite:

2014-10-14  Yao Qi  <yao@codesourcery.com>

* gdb.mi/mi-var-child.c (nothing1): New function.
(nothing2): New function.
(do_children_tests): Set function pointers by nothing1 and
nothing2.
* gdb.mi/mi-var-child.exp: Step over new added statements.
Update test to match the new output.
* gdb.mi/var-cmd.c (nothing1): New function.
(nothing2): New function.
(do_children_tests): Set function pointers by  nothing1 and
nothing2.
* gdb.mi/mi-var-display.exp: Update test to match output.
Step to the line specified by $line_dct_nothing.
Increase the number of lines to step.

10 years agoUse mi_varobj_update in mi-var-child.exp and mi2-var-child.exp
Yao Qi [Sat, 23 Aug 2014 12:24:07 +0000 (20:24 +0800)]
Use mi_varobj_update in mi-var-child.exp and mi2-var-child.exp

Hi,
I modify mi-var-child.exp and find that the pattern to match the output
of -var-update * is quite complicated.  However, it can be simplified by
using mi_varobj_update.  That is what this patch does.

gdb/testsuite:

2014-10-14  Yao Qi  <yao@codesourcery.com>

* gdb.mi/mi-var-child.exp: Use mi_varobj_update to simplify
tests.
* gdb.mi/mi2-var-child.exp: Likewise.