binutils-gdb.git
8 years agogdb-gdb.py: SyntaxError: Missing parentheses in call to 'print'
Jan Kratochvil [Mon, 22 Feb 2016 16:15:14 +0000 (17:15 +0100)]
gdb-gdb.py: SyntaxError: Missing parentheses in call to 'print'

After building GDB
--with-python=/usr/bin/python3
and for example stripping ./gdb and running:
./gdb -data-directory data-directory/ -iex "add-auto-load-safe-path $PWD/gdb-gdb.gdb" -iex "add-auto-load-safe-path $PWD/gdb-gdb.
py" ./gdb
I get:
Make breakpoint pending on future shared library load? (y or [n]) [answered N; input not from terminal]
  File "/home/jkratoch/redhat/gdb-test-python3/gdb/gdb-gdb.py", line 91
    print "Warning: Cannot find enum type_flag_value type."
  ^
SyntaxError: Missing parentheses in call to 'print'
(top-gdb) q

gdb/ChangeLog
2016-02-22  Jan Kratochvil  <jan.kratochvil@redhat.com>

* gdb-gdb.py (class TypeFlagsPrinter): Use parentheses for print.

8 years agoAdd more const type qualifiers to GAS sources.
Trevor Saunders [Mon, 22 Feb 2016 14:11:27 +0000 (14:11 +0000)]
Add more const type qualifiers to GAS sources.

* output-file.c (output_file_create): Make file name argument const.
(output_file_close): Likewise.
* output-file.h (output_file_create): Adjust.
(output_file_close): Likewise.
* depend.c (quote_string_for_make): Make src argument const char *.
(register_dependency): Likewise.
(wrap_output): Likewise.
* as.h (register_dependency): Adjust.
* config/tc-xtensa.c (finish_vinsn): Remove unnecessary calls to
as_where ();
* symbols.c (S_SET_EXTERNAL): Likewise.
* input-scrub.c (as_where): Return the file name.
* as.h (as_where): Adjust prototype.
* app.c (do_scrub_chars): Adjust.
* cond.c (s_elseif): Likewise.
(s_else): Likewise.
(initialize_cframe): Likewise.
* config/obj-coff.c (obj_coff_init_stab_section): Likewise.
* config/obj-elf.c (obj_elf_init_stab_section): Likewise.
* config/obj-som.c (obj_som_init_stab_section): Likewise.
* config/tc-aarch64.c (output_info): Likewise.
* config/tc-ia64.c (md_assemble): Likewise.
(dot_alias): Likewise.
* config/tc-m68k.c (m68k_frob_label): Likewise.
* config/tc-mmix.c (s_bspec): Likewise.
(mmix_handle_mmixal): Likewise.
* config/tc-rx.c (rx_include): Likewise.
* config/tc-tic54x.c (tic54x_set_default_include): Likewise.
(tic54x_adjust_symtab): Likewise.
* config/tc-xtensa.c (directive_push): Likewise.
(xtensa_sanity_check): Likewise.
(xtensa_relax_frag): Likewise.
(md_convert_frag): Likewise.
(tinsn_to_slotbuf): Likewise.
* dwarf2dbg.c (dwarf2_where): Likewise.
* ecoff.c (add_file): Likewise.
(ecoff_generate_asm_lineno): Likewise.
* expr.c (make_expr_symbol): Likewise.
* frags.c (frag_new): Likewise.
(frag_var_init): Likewise.
* listing.c (listing_newline): Likewise.
* messages.c (identify): Likewise.
(as_show_where): Likewise.
(as_warn_internal): Likewise.
(as_bad_internal): Likewise.
* read.c (s_irp): Likewise.
(s_macro): Likewise.
(s_reloc): Likewise.
* stabs.c (stabs_generate_asm_file): Likewise.
(stabs_generate_asm_lineno): Likewise.
(stabs_generate_asm_func): Likewise.
* write.c (fix_new_internal): Likewise.
* as.h (PRINTF_WHERE_LIKE): Make file name argument const.
(as_warn_value_out_of_range): Adjust prototype.
(as_bad_value_out_of_range): Adjust prototype.
* messages.c (identify): Make file name argument const char *.
(as_warn_internal): Likewise.
(as_warn_where): Likewise.
(as_bad_internal): Likewise.
(as_bad_where): Likewise.
(as_internal_value_out_of_range): Likewise.
(as_warn_value_out_of_range): Likewise.
(as_bad_value_out_of_range): Likewise.
* as.h (found_comment_file): Change type to const char *.
* cond.c (file_line::file): Likewise.
* config/obj-coff.c (obj_coff_init_stab_section): Make variable const.
* config/obj-elf.c (obj_elf_init_stab_section): Likewise.
* config/obj-som.c (obj_som_init_stab_section): Likewise.
* config/tc-aarch64.c (output_info): Likewise.
* config/tc-alpha.c (insert_operand): Likewise.
* config/tc-arc.c (insert_operand): Likewise.
* config/tc-d30v.c (check_size): Likewise.
* config/tc-ia64.c (struct alias): Likewise.
* config/tc-m68k.c (struct label_line): Likewise.
* config/tc-mcore.c (md_apply_fix): Likewise.
* config/tc-microblaze.c (md_estimate_size_before_relax): Likewise.
* config/tc-mips.c (mips16_immed): Likewise.
* config/tc-mmix.c (mmix_handle_mmixal): Likewise.
* config/tc-ppc.c (ppc_insert_operand): Likewise.
* config/tc-rx.c (rx_include): Likewise.
* config/tc-s390.c (s390_insert_operand): Likewise.
* config/tc-tic54x.c (tic54x_set_default_include): Likewise.
(tic54x_adjust_symtab): Likewise.
* config/tc-tilegx.c (insert_operand): Likewise.
(apply_special_operator): Likewise.
* config/tc-tilepro.c (insert_operand): Likewise.
* config/tc-xtensa.c (directive_push): Likewise.
* ecoff.c (add_file): Likewise.
(ecoff_generate_asm_lineno): Likewise.
* listing.c (listing_newline): Likewise.
* read.c (s_irp): Likewise.
* write.c (install_reloc): Likewise.
* write.h (struct fix): Likewise.
* input-file.c (file_name): Change type to const char *.
(saved_file::file_name): Likewise.
(input_file_open): Change type of argument to const char *.
* input-file.h (input_file_open): Adjust.
* input-scrub.c (logical_input_file): change type to const char *.
(physical_input_file): Likewise.
        (struct input_save): Adjust.
(input_scrub_push): Adjust.
(input_scrub_begin): Adjust.
(as_where): Adjust.
* input-scrub.c (input_scrub_new_file): Make file name argument const.
(input_scrub_include_file): Likewise.
(new_logical_line_flags): Likewise.
(new_logical_line): Likewise.
* as.h: Adjust.
* frags.h (struct frag): Change type of fr_file to const char *.
* expr.c (expr_symbol_where): Change type of file argument to
const char **.
* expr.h (expr_symbol_where): Likewise.
* config/tc-i370.c (md_apply_fix): adjust.
* config/tc-mmix.c (mmix_md_end): Likewise.
* config/tc-ppc.c (md_apply_fix): Likewise.
* config/tc-s390.c (md_apply_fix): Likewise.
* symbols.c (report_op_error): Likewise.
(resolve_symbol_value): Likewise.
* config/tc-ia64.c (slot::src_file): Change type to const char *.
(rsrc::file): Likewise.
* config/tc-xtensa.c (xtensa_sanity_check): Change type of variable to
const char *.
(xtensa_relax_frag): Likewise.
(md_convert_frag): Likewise.
(tinsn_to_slotbuf): Likewise.
* expr.c (expr_symbol_line): Likewise.
* macro.c (define_macro): Likewise.
* macro.h (macro_struct): Likewise.
* messages.c (as_show_where): Likewise.
* read.c (s_macro): Likewise.
* stabs.c (stabs_generate_asm_file): Likewise.
(generate_asm_file): Likewise.
(stabs_generate_asm_lineno): Likewise.
* write.h (struct reloc_list): Likewise.
* input-scrub.c (as_where): Change return type to const char *.
* as.h (as_wheree): Adjust.

8 years agoRemove BSF_COMMON from comments
H.J. Lu [Mon, 22 Feb 2016 12:39:21 +0000 (04:39 -0800)]
Remove BSF_COMMON from comments

BSF_COMMON isn't defined in BFD.

* syms.c: Remove BSF_COMMON from comments.
* bfd-in2.h: Regenerated.

8 years ago[AArch64] Remove redundant calculation of plt stub destination for veneer
Jiong Wang [Mon, 22 Feb 2016 12:16:06 +0000 (12:16 +0000)]
[AArch64] Remove redundant calculation of plt stub destination for veneer

elfNN_aarch64_size_stubs, the caller of aarch64_type_stub has redirected
the final destination of long branch veneer to plt stub if the call
should go through it.

It's redundant to do the same check and redirect again from scratch
inside aarch64_type_stub.

bfd/
  * elfnn-aarch64. (aarch64_type_of_stub): Remove redundation calcuation
  for destination.  Remove useless function parameters.
  (elfNN_aarch64_size_stubs): Update parameters for aarch64_type_of_stub.

8 years agoFix arm process record code format
Yao Qi [Mon, 22 Feb 2016 12:08:51 +0000 (12:08 +0000)]
Fix arm process record code format

This patch fixes the various code format issues in arm process record
in arm-tdep.c, such as using tab instead of spaces.

gdb:

2016-02-22  Yao Qi  <yao.qi@linaro.org>

* arm-tdep.c: Fix code format issues.

8 years agoAutomatic date update in version.in
GDB Administrator [Mon, 22 Feb 2016 00:00:18 +0000 (00:00 +0000)]
Automatic date update in version.in

8 years agoAlso update recursive call to d_lookup_symbol_imports.
Iain Buclaw [Sun, 21 Feb 2016 21:05:46 +0000 (22:05 +0100)]
Also update recursive call to d_lookup_symbol_imports.

8 years agoRemove search_parents parameter from d_lookup_symbol_imports.
Iain Buclaw [Sun, 21 Feb 2016 20:38:10 +0000 (21:38 +0100)]
Remove search_parents parameter from d_lookup_symbol_imports.

gdb/ChangeLog:

* d-namespace.c (d_lookup_symbol_imports): Remove argument
'search_parents'.  All callers updated.

8 years agoSet BFD compression bits in write_object_file
H.J. Lu [Sun, 21 Feb 2016 14:43:20 +0000 (06:43 -0800)]
Set BFD compression bits in write_object_file

There is no need to set BFD compression bits for each section.  We
should just set it once in write_object_file.

* write.c (compress_debug): Move BFD compression bits setting
to ...
(write_object_file): Here.

8 years agoAutomatic date update in version.in
GDB Administrator [Sun, 21 Feb 2016 00:00:17 +0000 (00:00 +0000)]
Automatic date update in version.in

8 years agoSkip pr19539 test for cris*-*-* targets
H.J. Lu [Sat, 20 Feb 2016 22:43:52 +0000 (14:43 -0800)]
Skip pr19539 test for cris*-*-* targets

cris*-*-* targets doesn't support PIE with relocation in pr19539 test.

* testsuite/ld-elf/pr19539.d: Skip cris*-*-* targets.

8 years ago[i386] Check RegVRex in register_number
H.J. Lu [Sat, 20 Feb 2016 17:23:20 +0000 (09:23 -0800)]
[i386] Check RegVRex in register_number

Increment register number by 16 if RegVRex is set.

* config/tc-i386.c (register_number): Check RegVRex.
* testsuite/gas/i386/x86-64-avx512f.s: Add a test for vgatherqpd
with %zmm19 and %zmm3.
* testsuite/gas/i386/x86-64-avx512f-intel.d: Updated.
* testsuite/gas/i386/x86-64-avx512f.d: Likewise.

8 years agoAutomatic date update in version.in
GDB Administrator [Sat, 20 Feb 2016 00:00:08 +0000 (00:00 +0000)]
Automatic date update in version.in

8 years agoFix snafu - add missing const declaration to 'string' local variable in s_stab_generic.
Nick Clifton [Fri, 19 Feb 2016 16:15:48 +0000 (16:15 +0000)]
Fix snafu - add missing const declaration to 'string' local variable in s_stab_generic.

8 years agoPrevent a seg-fault in the linker when accessing a specially crafted, corrupt, aout...
Nick Clifton [Fri, 19 Feb 2016 15:55:06 +0000 (15:55 +0000)]
Prevent a seg-fault in the linker when accessing a specially crafted, corrupt, aout binary.

PR ld/19629
* aoutx.h (aout_link_add_symbols): Check for out of range string
table offsets.

8 years agoFix a seg-fault in the linker when it encounters a corrupt binary containing a reloc...
Nick Clifton [Fri, 19 Feb 2016 15:20:30 +0000 (15:20 +0000)]
Fix a seg-fault in the linker when it encounters a corrupt binary containing a reloc with no associated symbol.

PR ld/19628
* reloc.c (bfd_generic_get_relocated_section_contents): Stop
processing if we encounter a reloc without an associated symbol.

8 years ago[ARM] Add FP16 feature extension for ARMv8.2 architecture
Jiong Wang [Fri, 19 Feb 2016 14:27:23 +0000 (14:27 +0000)]
[ARM] Add FP16 feature extension for ARMv8.2 architecture

include/
  * opcode/arm.h (ARM_EXT2_FP16_INSN): New.

gas/
  * config/tc-arm.c (arm_ext_fp16): New.
  (arm_extensions): New entry for "fp16".

8 years agoPrevent seg-fault in gas reading a binary input file.
Nick Clifton [Fri, 19 Feb 2016 13:19:57 +0000 (13:19 +0000)]
Prevent seg-fault in gas reading a binary input file.

PR 19630
* read.c (read_a_source_file): Check for assemble_one returning
with input_line_pointer set to NULL.

8 years agoChange the return type of the rebuffer_line function to void.
Trevor Saunders [Fri, 19 Feb 2016 12:13:08 +0000 (12:13 +0000)]
Change the return type of the rebuffer_line function to void.

* listing.c (rebuffer_line): Change return type to void.

8 years agoAdd const to various variables in the gas sources.
Trevor Saunders [Fri, 19 Feb 2016 12:03:08 +0000 (12:03 +0000)]
Add const to various variables in the gas sources.

* symbols.c (decode_local_label_name): Make type a const char *.
* listing.c (print_source): Make type of p const char *.
(print_line): Make type of string const char *.
(buffer_line): Return const char *.
(title): Make type const char *.
(subtitle): Likewise.
(listing_listing): Make type of p const char *.
* messages.c (as_internal_value_out_of_range): Make type of prefix
const char *.
* stabs.c (s_stab_generic): make type of stab_secname, stabstr_secname
and string const char *.
* read.c (_bfd_rel): Make type of name const char *.
* app.c (out_string): Change type to const char *.
        (struct app_save::out_string): Likewise.

8 years agoAutomatic date update in version.in
GDB Administrator [Fri, 19 Feb 2016 00:00:10 +0000 (00:00 +0000)]
Automatic date update in version.in

8 years agoAdd D support to gdb_default_target_compile.
Iain Buclaw [Thu, 18 Feb 2016 21:01:44 +0000 (22:01 +0100)]
Add D support to gdb_default_target_compile.

gdb/testsuite/ChangeLog:

* lib/future.exp: Add D support.
(gdb_find_gdc): New proc.
(gdb_default_target_compile): Add D support.

8 years agoDetermine the iteration count based on wallclock instead of user+system time.
Wei-cheng Wang [Thu, 20 Aug 2015 17:32:18 +0000 (01:32 +0800)]
Determine the iteration count based on wallclock instead of user+system time.

gdb/testsuite/ChangeLog:

2016-02-18  Wei-cheng Wang  <cole945@gmail.com>

* gdb.trace/tspeed.c (myclock): Return wallclock instead of
user+system time.
(trace_speed_test): Determine the iteration count for a time
between 15..30 seconds.

8 years agogdb/s390: Fill guess_tracepoint_registers hook.
Marcin Kościelnicki [Sat, 23 Jan 2016 22:53:41 +0000 (23:53 +0100)]
gdb/s390: Fill guess_tracepoint_registers hook.

gdb/ChangeLog:

* s390-linux-tdep.c (s390_guess_tracepoint_registers): New function.
(s390_gdbarch_init): Fill guess_tracepoint_registers hook.

8 years agoIntel MPX bound violation handling
Walfred Tedeschi [Thu, 18 Feb 2016 16:24:59 +0000 (17:24 +0100)]
Intel MPX bound violation handling

With Intel Memory Protection Extensions it was introduced the concept of
boundary violation.  A boundary violations is presented to the inferior as
a segmentation fault having SIGCODE 3.  This patch adds a
handler for a boundary violation extending the information displayed
when a bound violation is presented to the inferior.  In the stop mode
case the debugger will also display the kind of violation: "upper" or
"lower", bounds and the address accessed.
On no stop mode the information will still remain unchanged.  Additional
information about bound violations are not meaningful in that case user
does not know the line in which violation occurred as well.

When the segmentation fault handler is stop mode the out puts will be
changed as exemplified below.

The usual output of a segfault is:
Program received signal SIGSEGV, Segmentation fault
0x0000000000400d7c in upper (p=0x603010, a=0x603030, b=0x603050,
c=0x603070, d=0x603090, len=7) at i386-mpx-sigsegv.c:68
68        value = *(p + len);

In case it is a bound violation it will be presented as:
Program received signal SIGSEGV, Segmentation fault
Upper bound violation while accessing address 0x7fffffffc3b3
Bounds: [lower = 0x7fffffffc390, upper = 0x7fffffffc3a3]
0x0000000000400d7c in upper (p=0x603010, a=0x603030, b=0x603050,
c=0x603070, d=0x603090, len=7) at i386-mpx-sigsegv.c:68
68        value = *(p + len);

In mi mode the output of a segfault is:
*stopped,reason="signal-received",signal-name="SIGSEGV",
signal-meaning="Segmentation fault", frame={addr="0x0000000000400d7c",
func="upper",args=[{name="p", value="0x603010"},{name="a",value="0x603030"}
,{name="b",value="0x603050"}, {name="c",value="0x603070"},
{name="d",value="0x603090"},{name="len",value="7"}],
file="i386-mpx-sigsegv.c",fullname="i386-mpx-sigsegv.c",line="68"},
thread-id="1",stopped-threads="all",core="6"

in the case of a bound violation:
*stopped,reason="signal-received",signal-name="SIGSEGV",
signal-meaning="Segmentation fault",
sigcode-meaning="Upper bound violation",
lower-bound="0x603010",upper-bound="0x603023",bound-access="0x60302f",
frame={addr="0x0000000000400d7c",func="upper",args=[{name="p",
value="0x603010"},{name="a",value="0x603030"},{name="b",value="0x603050"},
{name="c",value="0x603070"},{name="d",value="0x603090"},
{name="len",value="7"}],file="i386-mpx-sigsegv.c",
fullname="i386-mpx-sigsegv.c",line="68"},thread-id="1",
stopped-threads="all",core="6"

2016-02-18  Walfred Tedeschi  <walfred.tedeschi@intel.com>

gdb/ChangeLog:

* NEWS: Add entry for bound violation.
* amd64-linux-tdep.c (amd64_linux_init_abi_common):
Add handler for segmentation fault.
* gdbarch.sh (handle_segmentation_fault): New.
* gdbarch.c: Regenerate.
* gdbarch.h: Regenerate.
* i386-linux-tdep.c (i386_linux_handle_segmentation_fault): New.
(SIG_CODE_BONDARY_FAULT): New define.
(i386_linux_init_abi): Use i386_mpx_bound_violation_handler.
* i386-linux-tdep.h (i386_linux_handle_segmentation_fault) New.
* i386-tdep.c (i386_mpx_enabled): Add as external.
* i386-tdep.c (i386_mpx_enabled): Add as external.
* infrun.c (handle_segmentation_fault): New function.
(print_signal_received_reason): Use handle_segmentation_fault.

gdb/testsuite/ChangeLog:

* gdb.arch/i386-mpx-sigsegv.c: New file.
* gdb.arch/i386-mpx-sigsegv.exp: New file.
* gdb.arch/i386-mpx-simple_segv.c: New file.
* gdb.arch/i386-mpx-simple_segv.exp: New file.

gdb/doc/ChangeLog:

* gdb.texinfo (Signals): Add bound violation display hints for
a SIGSEGV.

8 years agogdb: Add guess_tracepoint_registers hook to gdbarch.
Marcin Kościelnicki [Thu, 18 Feb 2016 08:21:38 +0000 (09:21 +0100)]
gdb: Add guess_tracepoint_registers hook to gdbarch.

When we're looking at a tracefile trace frame where registers are not
available, and the tracepoint has only one location, we supply
the location's address as the PC register.  However, this only works
if PC is not a pseudo register, and individual architectures may want
to guess more registers.  Add a gdbarch hook that will handle that.

gdb/ChangeLog:

* arch-utils.c (default_guess_tracepoint_registers): New function.
* arch-utils.h (default_guess_tracepoint_registers): New prototype.
* gdbarch.c: Regenerate.
* gdbarch.h: Regenerate.
* gdbarch.sh: Add guess_tracepoint_registers hook.
* tracefile.c (tracefile_fetch_registers): Use the new gdbarch hook.

8 years agoEnable PR ld/19617 tests only for Linux/GNU/Solaris
H.J. Lu [Thu, 18 Feb 2016 15:48:57 +0000 (07:48 -0800)]
Enable PR ld/19617 tests only for Linux/GNU/Solaris

Since PR ld/19617 tests require share library support, enable them
only for Linux/GNU/Solaris targets.

* testsuite/ld-elf/pr19617a.d: Enable only for *-*-linux*,
*-*-gnu* and *-*-solaris*.
* testsuite/ld-elf/pr19617b.d: Likewise.
* testsuite/ld-elf/pr19617c.d: Likewise.

8 years agoRemove setup_kfail server/13796 in disp-step-syscall.exp
Yao Qi [Thu, 18 Feb 2016 13:02:12 +0000 (13:02 +0000)]
Remove setup_kfail server/13796 in disp-step-syscall.exp

This patch series add fork support in target remote,

  [PATCH v2 0/3] Target remote mode fork and exec support
  https://sourceware.org/ml/gdb-patches/2015-12/msg00144.html

so GDB can be informed about the child, and adjust child correctly in
displaced stepping.  The PR server/13796 was fixed by this patch
series actually.  Test results on buildbot show this KFAIL->KPASS
change https://sourceware.org/ml/gdb-testers/2015-q4/msg10128.html

gdb/testsuite:

2016-02-18  Yao Qi  <yao.qi@linaro.org>

* gdb.base/disp-step-syscall.exp (disp_step_cross_syscall):
Don't call setup_kfail.

8 years agoSet breakpoint condition-evaluation in forking-threads-plus-breakpoint.exp
Yao Qi [Thu, 18 Feb 2016 12:04:32 +0000 (12:04 +0000)]
Set breakpoint condition-evaluation in forking-threads-plus-breakpoint.exp

Proc do_test in forking-threads-plus-breakpoint.exp has an argument
cond_bp_target, but the test doesn't use it to set
"breakpoint condition-evaluation", which is an oversight in the test.

This patch fixes it by setting "breakpoint condition-evaluation" per
$cond_bp_target.

gdb/testsuite:

2016-02-18  Yao Qi  <yao.qi@linaro.org>

* gdb.threads/forking-threads-plus-breakpoint.exp (do_test):
Set "set breakpoint condition-evaluation" per $cond_bp_target.

8 years agoAlways create dynamic sections for -E/--dynamic-list
H.J. Lu [Thu, 18 Feb 2016 11:13:19 +0000 (03:13 -0800)]
Always create dynamic sections for -E/--dynamic-list

In embedded environments, including boot loaders, the non-PIC executable
needs to export its symbols to modules loaded in the future.  We should
always create dynamic sections for -E/--dynamic-list.

bfd/

PR ld/19617
* elflink.c (elf_link_add_object_symbols): Always create dynamic
sections for -E/--dynamic-list.

ld/

PR ld/19617
* testsuite/ld-elf/pr19617.s: New file.
* testsuite/ld-elf/pr19617a.d: Likewise.
* testsuite/ld-elf/pr19617b.d: Likewise.
* testsuite/ld-elf/pr19617c.d: Likewise.

8 years agoFix computation of CXX_FOR_TARGET so that it can detect an in-tree xg++ executable.
Nick Clifton [Thu, 18 Feb 2016 10:10:36 +0000 (10:10 +0000)]
Fix computation of CXX_FOR_TARGET so that it can detect an in-tree xg++ executable.

* Makefile.am (CXX_FOR_TARGET): Check for the presence of an
in-tree xg++ executable after checking for the presence of an
in-tree g++ executable.
* Makefile.in: Regenerate.

8 years agoAvoid setting or recording negative alignments when the target stores multiple octets...
Dan Gisselquist [Thu, 18 Feb 2016 09:47:31 +0000 (09:47 +0000)]
Avoid setting or recording negative alignments when the target stores multiple octets in a single byte.

gas * read.c (finish_bundle): Avoid recording a negative alignment.
(do_align): Use unsigned values for n, len and max.  Only create
a frag if the alignment requirement is greater than the minimum
byte alignment.  Avoid recording a negative alignment.
(s_align): Use unsigned values where appropriate.
(bss_alloc): Use an unsigned value for the alignment.
(sizeof_sleb128): Add a comment noting that we encode one octet
per byte, regardless of the value of OCTETS_PER_BYTE_POWER.
(emit_leb129_expr): Abort if the emitted encoding was longer than
expected.
* read.h (output_leb128): Update prototype.
(sizeof_leb128): Update prototype.
(bss_alloc): Update prototype.
* write.c (record_alignment): Use an unsigned value for the
alignment.  Do not record alignments less than the minimum
alignment for a byte.
* write.h (record_alignment): Update prototype.

8 years agogdb/doc: Add documentation for tfile description section lines.
Marcin Kościelnicki [Wed, 10 Feb 2016 20:09:24 +0000 (21:09 +0100)]
gdb/doc: Add documentation for tfile description section lines.

gdb/doc/ChangeLog:

* gdb.texinfo (Trace File Format): Add documentation for description
section lines.

8 years agoAutomatic date update in version.in
GDB Administrator [Thu, 18 Feb 2016 00:00:19 +0000 (00:00 +0000)]
Automatic date update in version.in

8 years agoUpdate IFUNC tests for x32
H.J. Lu [Wed, 17 Feb 2016 21:05:06 +0000 (13:05 -0800)]
Update IFUNC tests for x32

* testsuite/ld-ifunc/ifunc-1-local-x86.d: Updated.
* testsuite/ld-ifunc/ifunc-1-x86.d: Likewise.
* testsuite/ld-ifunc/ifunc-3a-x86.d: Likewise.

8 years agoxtensa: fix .init/.fini literals moving
Max Filippov [Mon, 15 Feb 2016 23:23:28 +0000 (02:23 +0300)]
xtensa: fix .init/.fini literals moving

Despite the documentation and the comment in xtensa_move_literals, in
the presence of --text-section-literals and --auto-litpools literals are
moved from the separate literal sections into .init and .fini, because
the check in the xtensa_move_literals is incorrect.

This moving was broken with introduction of auto litpools: some literals
now may be lost. This happens because literal frags emitted from .init
and .fini are not closed when new .literal_position marks new literal
pool. Then frag_align(2, 0, 0) changes type of the last literal frag to
rs_align. rs_align frags are skipped in the xtensa_move_literals. As a
result fixups against such literals are not moved out of .init.literal/
.fini.literal sections producing the following assembler error:

  test.S: Warning: fixes not all moved from .init.literal
  test.S: Internal error!

Fix check for .init.literal/.fini.literal in the xtensa_move_literals
and don't let it move literals from there in the presence of
--text-section-literals or --auto-litpools.

2016-02-17  Max Filippov  <jcmvbkbc@gmail.com>
gas/
* config/tc-xtensa.c (xtensa_move_literals): Fix check for
.init.literal/.fini.literal section name.
* testsuite/gas/xtensa/all.exp: Add init-fini-literals to the
list of xtensa tests.
* testsuite/gas/xtensa/init-fini-literals.d: New file:
init-fini-literals test result patterns.
* testsuite/gas/xtensa/init-fini-literals.s: New file:
init-fini-literals test.

8 years ago[x86-64] Omit dynamic sections symbols
H.J. Lu [Wed, 17 Feb 2016 19:18:53 +0000 (11:18 -0800)]
[x86-64] Omit dynamic sections symbols

Define elf_backend_omit_section_dynsym to bfd_true for x86-64, similar
to i386, x86-64 doesn't need dynamic sections symbols.

bfd/

* elf64-x86-64.c (elf_backend_omit_section_dynsym): New.  Defined
to bfd_true.

ld/

* testsuite/ld-ifunc/ifunc-1-local-x86.d: Updated.
* testsuite/ld-ifunc/ifunc-1-x86.d: Likewise.
* testsuite/ld-ifunc/ifunc-2-local-x86-64.d: Likewise.
* testsuite/ld-ifunc/ifunc-2-x86-64.d: Likewise.
* testsuite/ld-ifunc/ifunc-3a-x86.d: Likewise.
* testsuite/ld-ifunc/pr17154-x86-64.d: Likewise.
* testsuite/ld-x86-64/bnd-ifunc-1.d: Likewise.
* testsuite/ld-x86-64/bnd-ifunc-2.d: Likewise.
* testsuite/ld-x86-64/bnd-plt-1.d: Likewise.
* testsuite/ld-x86-64/ilp32-4-nacl.d: Likewise.
* testsuite/ld-x86-64/ilp32-4.d: Likewise.
* testsuite/ld-x86-64/load1c-nacl.d: Likewise.
* testsuite/ld-x86-64/load1c.d: Likewise.
* testsuite/ld-x86-64/load1d-nacl.d: Likewise.
* testsuite/ld-x86-64/load1d.d: Likewise.
* testsuite/ld-x86-64/pr14207.d: Likewise.
* testsuite/ld-x86-64/pr19162.d: Likewise.
* testsuite/ld-x86-64/tlsdesc-nacl.rd: Likewise.
* testsuite/ld-x86-64/tlsdesc.rd: Likewise.
* testsuite/ld-x86-64/tlsgdesc-nacl.rd: Likewise.
* testsuite/ld-x86-64/tlsgdesc.rd: Likewise.
* testsuite/ld-x86-64/tlspic-nacl.rd: Likewise.
* testsuite/ld-x86-64/tlspic.rd: Likewise.

8 years agoAdd missing cleanup in exec_file_locate_attach
Gary Benson [Wed, 17 Feb 2016 14:38:36 +0000 (14:38 +0000)]
Add missing cleanup in exec_file_locate_attach

exec_file_locate_attach allocates memory for full_exec_path (using
either exec_file_find, source_full_path_of or xstrdup) but this
memory is never freed.  This commit adds the necessary cleanup.

gdb/ChangeLog:

* exec.c (exec_file_locate_attach): Add missing cleanup.

8 years agoSkip eh-frame-hdr test for arc-elf targets.
Nick Clifton [Wed, 17 Feb 2016 10:20:53 +0000 (10:20 +0000)]
Skip eh-frame-hdr test for arc-elf targets.

ld * testsuite/ld-elf/eh-frame-hdr.d: Skip for ARC ELF targets.

8 years agoUpdate list of known MSP430 MCUs.
Nick Clifton [Wed, 17 Feb 2016 09:55:32 +0000 (09:55 +0000)]
Update list of known MSP430 MCUs.

* config/tc-msp430.c (msp430_mcu_data): Sync with data from TI's
devices.csv file as of March 2016.

8 years agogdbserver/s390: Advertise Z0 packet support.
Marcin Kościelnicki [Tue, 19 Jan 2016 18:37:38 +0000 (19:37 +0100)]
gdbserver/s390: Advertise Z0 packet support.

This is necessary for upcoming tracepoint support - otherwise, setting
a tracepoint and a breakpoint on the same address will fail, since gdbserver
won't know about gdb's breakpoint.

Tested on s390x-ibm-linux-gnu and s390-ibm-linux-gnu, RHEL 7.2.

gdb/gdbserver/ChangeLog:

* linux-s390-low.c (s390_supports_z_point_type): New function.
(struct linux_target_ops): Wire s390_supports_z_point_type in.

8 years agoAutomatic date update in version.in
GDB Administrator [Wed, 17 Feb 2016 00:00:22 +0000 (00:00 +0000)]
Automatic date update in version.in

8 years agoAdd a missing break to readelf.c
H.J. Lu [Tue, 16 Feb 2016 23:03:39 +0000 (15:03 -0800)]
Add a missing break to readelf.c

PR binutils/19647
* readelf.c (get_section_type_name): Add a missing break.

8 years agoWhitespace cleanup for skip testcase.
Doug Evans [Tue, 16 Feb 2016 20:39:16 +0000 (12:39 -0800)]
Whitespace cleanup for skip testcase.

gdb/testsuite/ChangeLog:

* gdb.base/skip.c: Add copyright.  Whitespace cleanup.
* gdb.base/skip1.c: Ditto.
* gdb.base/skip.exp: Whitespace cleanup.

8 years agoPR remote/19496, internal err forking-threads-plus-bkpt
Don Breazeal [Tue, 16 Feb 2016 16:56:06 +0000 (08:56 -0800)]
PR remote/19496, internal err forking-threads-plus-bkpt

This patch fixes an internal error that occurs in
gdb.threads/forking-threads-plus-breakpoint.exp:

/blah/binutils-gdb/gdb/target.c:2723: internal-error: Can't determine the
current address space of thread Thread 3170.3170

In default_thread_address_space, find_inferior_ptid couldn't find 3170.3170
because it had been overwritten in inferior_appeared, called as follows:

inferior_appeared
  remote_add_inferior
    remote_notice_new_inferior
      remote_update_thread_list

The cause of the problem was the following sequence of events:

* GDB knows only about the main thread

* the first fork event is reported to GDB, saved as pending_event

* qXfer:threads:read gets the threads from the remote.
  remove_new_fork_children id's the fork child from the pending event
  and removes it from the list reported to GDB.  All the rest of the
  threads, including the fork parent, are added to the GDB thread list.

* GDB stops all the threads.  All the stop events are pushed onto the
  stop reply queue behind the pending fork event.  The fork waitstatus
  is saved in the fork parent thread's pending status field
  thread_info.suspend.

* remote_wait_ns calls queued_stop_reply and process_stop_reply to
  remove the fork event from the front of the stop reply queue and save
  event information in the thread_info structure for the fork parent
  thread.  Unfortunately, none of the information saved in this way is
  the fork-specific information.

* A subsequent qXfer:threads:read packet gets the thread list including
  the fork parent and fork child.  remove_new_fork_children checks the
  thread list to see if there is a fork parent, doesn't find one, checks
  the stop reply queue for a pending fork event, doesn't find one, and
  allows the fork child thread to be reported to GDB before the fork
  event has been handled.  remote_update_thread_list calls
  remote_notice_new_thread and overwrites the current (main) thread in
  inferior_appeared.

So the fork event has been reported out of target_wait but it was left
pending on the infrun side (infrun.c:save_waitstatus).  IOW, the fork
event hasn't been processed by handle_inferior_event yet, so it hasn't
made it to tp->pending_follow yet.

The fix is to check thread_info.suspend along with the
thread_info.pending_follow in remote.c:remove_new_fork_children, to
prevent premature reporting of the fork child thread creation.

gdb/ChangeLog:

PR remote/19496
* remote.c (remove_new_fork_children): Check for pending
fork status in thread_info.suspend.

gdb/testsuite/ChangeLog:

PR remote/19496
* gdb.threads/forking-threads-plus-breakpoint.exp (do_test):
Remove kfail for PR remote/19496.

8 years ago[ARC] Enable .cfi_* pseudo-ops.
Claudiu Zissulescu [Tue, 16 Feb 2016 14:56:04 +0000 (15:56 +0100)]
[ARC] Enable .cfi_* pseudo-ops.

gas/
2016-02-16  Claudiu Zissulescu  <claziss@synopsys.com>

* config/tc-arc.c (tc_arc_frame_initial_instructions): New
function.
(tc_arc_regname_to_dw2regnum): Likewise.
* config/tc-arc.h (TARGET_USE_CFIPOP): Define
(tc_cfi_frame_initial_instructions): Likewise.
(tc_regname_to_dw2regnum): Likewise.

gas/testsuite
2016-02-16  Claudiu Zissulescu  <claziss@synopsys.com>

* gas/cfi/cfi-arc-1.d: New file.
* gas/cfi/cfi-arc-1.s: Likewise.
* gas/cfi/cfi.exp: Allow running tests for arc.

binutils/
2016-02-16  Claudiu Zissulescu  <claziss@synopsys.com>

* readelf.c (is_32bit_pcrel_reloc): Add R_ARC_32_PCREL.

8 years agotestsuite: Make standard_temp_file use invocation-specific directories
Simon Marchi [Tue, 16 Feb 2016 14:00:51 +0000 (09:00 -0500)]
testsuite: Make standard_temp_file use invocation-specific directories

Just like standard_output_file, standard_temp_file should use multiple
directories to make the tests parallel-safe.  However,
standard_temp_file is sometimes called in some procedures that are not
test-specific.  For example, gdb_init uses it, but is called once before
all test files are ran.  Therefore, we can't organize it in a
temp/gdb.subdir/testname layout, like standard_output_file.

Because it's just meant for temporary files that don't really need to be
inspected after the test, we can just put them in a directory based on
the runtest pid.  There is always a single exp file being executed by a
particular runtest invocation at any given time, so it should be safe.

gdb/testsuite/ChangeLog:

* lib/gdb.exp (standard_temp_file): Return a path specific to
the runtest invocation.

8 years agotestsuite: Fix save-trace.exp writing outside standard output directory
Simon Marchi [Tue, 16 Feb 2016 14:00:50 +0000 (09:00 -0500)]
testsuite: Fix save-trace.exp writing outside standard output directory

In save-trace.exp, we want to test loading of a tracepoint definition
file with a relative path (I am not sure why in fact).  We currently use
"savetrace-relative.tr", which ends up directly in testsuite/.  If we
use [standard_output_file] on that path, it becomes absolute.  I decided
to just replace [pwd] with . (a dot) in the path given by
standard_output_file to make it relative.  However, this trick only
works because [pwd] is a prefix of the standard output directory.  So I
added a check to verify that precondition.

gdb/testsuite/ChangeLog:

* gdb.trace/save-trace.exp: Change relative path to be in the
standard output directory.

8 years agoPass -mrelax-relocations=yes to $(TEST_AS)
H.J. Lu [Tue, 16 Feb 2016 13:55:11 +0000 (05:55 -0800)]
Pass -mrelax-relocations=yes to $(TEST_AS)

x86_64_mov_to_lea5.o and x86_64_mov_to_lea6.o must be assembled with
-mrelax-relocations=yes since when assembler is configured with
--disable-x86-relax-relocations, R_X86_64_GOTPCRELX relocation won't
be generated.  This linker optimization requires R_X86_64_GOTPCRELX
relocation.

This patch also removed the duplicated x86_64_overflow_pc32.o target.

* testsuite/Makefile.am (x86_64_mov_to_lea5.o): Pass
-mrelax-relocations=yes to $(TEST_AS).
(x86_64_mov_to_lea6.o): Likewise.
(x86_64_overflow_pc32.o): Remove duplicated target.
* testsuite/Makefile.in: Regenerated.

8 years agoFix cleanup in arm_linux_software_single_step
Yao Qi [Tue, 16 Feb 2016 13:53:35 +0000 (13:53 +0000)]
Fix cleanup in arm_linux_software_single_step

I see the following error in testing aarch64 GDB debugging arm
program.

(gdb) PASS: gdb.reverse/readv-reverse.exp: set breakpoint at marker2
continue
Continuing.
=================================================================
==32273==ERROR: AddressSanitizer: attempting free on address which was not malloc()-ed: 0x000000ce4c00 in thread T0
    #0 0x2ba5615645c7 in __interceptor_free (/usr/lib/x86_64-linux-gnu/libasan.so.1+0x545c7)^M
    #1 0x4be8b5 in VEC_CORE_ADDR_cleanup /home/yao/SourceCode/gnu/gdb/git/gdb/common/gdb_vecs.h:34^M
    #2 0x5e6d95 in do_my_cleanups /home/yao/SourceCode/gnu/gdb/git/gdb/common/cleanups.c:154^M
    #3 0x64c99a in fetch_inferior_event /home/yao/SourceCode/gnu/gdb/git/gdb/infrun.c:3975^M
    #4 0x678437 in inferior_event_handler /home/yao/SourceCode/gnu/gdb/git/gdb/inf-loop.c:44^M
    #5 0x5078f6 in remote_async_serial_handler /home/yao/SourceCode/gnu/gdb/git/gdb/remote.c:13223^M
    #6 0x4cecfd in run_async_handler_and_reschedule /home/yao/SourceCode/gnu/gdb/git/gdb/ser-base.c:137^M
    #7 0x676864 in gdb_wait_for_event /home/yao/SourceCode/gnu/gdb/git/gdb/event-loop.c:834^M
    #8 0x676a27 in gdb_do_one_event /home/yao/SourceCode/gnu/gdb/git/gdb/event-loop.c:323^M
    #9 0x676aed in start_event_loop /home/yao/SourceCode/gnu/gdb/git/gdb/event-loop.c:347^M
    #10 0x6706d2 in captured_command_loop /home/yao/SourceCode/gnu/gdb/git/gdb/main.c:318^M
    #11 0x66db8c in catch_errors /home/yao/SourceCode/gnu/gdb/git/gdb/exceptions.c:240^M
    #12 0x6716dd in captured_main /home/yao/SourceCode/gnu/gdb/git/gdb/main.c:1157^M
    #13 0x66db8c in catch_errors /home/yao/SourceCode/gnu/gdb/git/gdb/exceptions.c:240^M
    #14 0x671b7a in gdb_main /home/yao/SourceCode/gnu/gdb/git/gdb/main.c:1165^M
    #15 0x467684 in main /home/yao/SourceCode/gnu/gdb/git/gdb/gdb.c:32^M
    #16 0x2ba563ed7ec4 in __libc_start_main (/lib/x86_64-linux-gnu/libc.so.6+0x21ec4)^M
    #17 0x4676b2 (/scratch/yao/gdb/build-git/aarch64-linux-gnu/gdb/gdb+0x4676b2)

looks we should discard cleanup if function
arm_linux_software_single_step returns early, or create cleanup when
it is needed.

gdb:

2016-02-16  Yao Qi  <yao.qi@linaro.org>

* arm-linux-tdep.c (arm_linux_software_single_step): Assign
'old_chain' later.

8 years agoRemove PC from syscall_next_pc
Yao Qi [Tue, 16 Feb 2016 13:47:17 +0000 (13:47 +0000)]
Remove PC from syscall_next_pc

Method syscall_next_pc of struct arm_get_next_pcs_ops has an argument
PC, which is not necessary, because PC can be got from regcache in
'struct arm_get_next_pcs'.  This patch removes the PC argument of
syscall_next_pc.

gdb:

2016-02-16  Yao Qi  <yao.qi@linaro.org>

* arch/arm-get-next-pcs.h (struct arm_get_next_pcs_ops)
<syscall_next_pc>: Remove argument PC.  Callers updated.
* arm-linux-tdep.c (arm_linux_get_next_pcs_syscall_next_pc):
Remove argument PC.  Get pc from regcache_read_pc.
* arm-tdep.c (arm_get_next_pcs_syscall_next_pc): Remove
argument PC.

gdb/gdbserver:

2016-02-16  Yao Qi  <yao.qi@linaro.org>

* linux-arm-low.c (get_next_pcs_syscall_next_pc): Remove argument
PC.  Get pc from regcache_read_pc.

8 years agoRemove documentation of deleted function S_IS_EXTERN.
Trevor Saunders [Tue, 16 Feb 2016 10:37:32 +0000 (10:37 +0000)]
Remove documentation of deleted function S_IS_EXTERN.

8 years agoFix formatting problems caused by previous update to as.texinfo.
Nick Clifton [Tue, 16 Feb 2016 10:35:54 +0000 (10:35 +0000)]
Fix formatting problems caused by previous update to as.texinfo.

* doc/as.texinfo (Section): Fix up texinfo snafus in previous
update.

8 years ago[PR19620][GAS][AArch64]Remove mov[z,k,n] relocation symbol name restriction.
Renlin Li [Tue, 16 Feb 2016 10:00:29 +0000 (10:00 +0000)]
[PR19620][GAS][AArch64]Remove mov[z,k,n] relocation symbol name restriction.

In AArch64 gas, register name or string starts with valid register name
is not allowed as symbol name for mov[z,k,n] instruction.
This patch removes the restriction.

gas/
PR gas/19620
* config/tc-aarch64.c (parse_half): Remove restrictions on symbol name.
* testsuite/gas/aarch64/movw_label.d: New.
* testsuite/gas/aarch64/movw_label.s: New.

8 years agoFix BFD format matching for x86_64-w64-mingw32 -m32 LTO.
Joseph Myers [Tue, 16 Feb 2016 00:27:11 +0000 (00:27 +0000)]
Fix BFD format matching for x86_64-w64-mingw32 -m32 LTO.

In <https://sourceware.org/ml/binutils/2015-12/msg00190.html> (commit
4a07dc81356ed8728e204e9aabeb256703c59aef), Kwok fixed a problem with
the template used for a dummy BFD for an IR file for LTO on MinGW,
where the input and output formats are not the same.

A problem, however, remains in the case of linking for
x86_64-w64-mingw32 -m32, where LTO linking reports an ambiguity
between the pe-i386 and pei-i386 formats.  An object (pe-i386) with
plugin data is being tested by the linker to see what formats match.
The default format initially set by the linker when
bfd_check_format_matches is called is pei-i386 (as that's the output
format from the linker script), which does not match, so the function
goes on to the loop over possible BFD vectors.  The pe-i386 vector
matches, as it should.  One other vector matches: the plugin vector.

bfd_check_format_matches tests a vector for matching by temporarily
modifying the BFD object to use that vector then using
_bfd_check_format on it.  So the BFD object is temporarily using
plugin_vec.  _bfd_check_format ends up using bfd_plugin_object_p which
uses plugin_object_p from ld which uses plugin_get_ir_dummy_bfd which
succeeds, having created a BFD based on link_info.output_bfd (because
srctemplate is the BFD temporarily using plugin_vec, even after Kwok's
patch link_info.output_bfd is all that's available to base the dummy
BFD on).  So we end up with a match from the plugin vector which uses
the pei-i386 vector even though the pei-i386 vector itself does not
match the input object.  (In the i686-mingw32 case, as opposed to this
multilib case, pe-i386 is the default BFD target, which would
short-circuit that logic.)

There are two cases of the linker handling inputs with a plugin: they
may be inputs that are also accepted by some non-plugin BFD format, as
here, or they may be a format that would not be recognized at all, as
with some tests in the ld testsuite.  In the former case, there is no
need for BFD to accept the objects using the plugin vector, as the
linker has its own logic to allow plugins to claim objects accepted by
some other BFD vector.  Thus, this patch arranges for the plugin
vector to have the lowest match priority, and for the priority from
that vector to be used in the relevant case (the attempted match to
the plugin vector results in TEMP pointing to the pei-i386 vector).

Tested for GCC and Binutils testsuites for x86_64-pc-linux-gnu, as
well as verifying that it fixes the observed LTO issue for
x86_64-w64-mingw32.

* plugin.c (plugin_vec): Set match priority to 255.
* format.c (bfd_check_format_matches) [BFD_SUPPORTS_PLUGINS]: When
matching against the plugin vector, take priority from there not
from TEMP.

8 years agoFix typos in gas/ChangeLog
H.J. Lu [Tue, 16 Feb 2016 00:11:23 +0000 (16:11 -0800)]
Fix typos in gas/ChangeLog

8 years agoAdd parentheses to prevent truncated addresses
H.J. Lu [Mon, 15 Feb 2016 23:58:42 +0000 (15:58 -0800)]
Add parentheses to prevent truncated addresses

* i386-dis.c (print_insn): Parenthesize expression to prevent
truncated addresses.
(OP_J): Likewise.

8 years agoAutomatic date update in version.in
GDB Administrator [Tue, 16 Feb 2016 00:00:20 +0000 (00:00 +0000)]
Automatic date update in version.in

8 years agoAdd missing gdb.arch/i386-prologue.c prototypes
Jan Kratochvil [Mon, 15 Feb 2016 18:01:03 +0000 (19:01 +0100)]
Add missing gdb.arch/i386-prologue.c prototypes

The testfile has not ran because:
gdb.arch/i386-prologue.c:34:3: warning: implicit declaration of function 'standard' [-Wimplicit-function-declaration]
   standard ();
   ^
gdb.arch/i386-prologue.c:35:3: warning: implicit declaration of function 'stack_align_ecx' [-Wimplicit-function-declaration]
   stack_align_ecx ();
   ^
gdb.arch/i386-prologue.c:36:3: warning: implicit declaration of function 'stack_align_edx' [-Wimplicit-function-declaration]
   stack_align_edx ();
   ^
gdb.arch/i386-prologue.c:37:3: warning: implicit declaration of function 'stack_align_eax' [-Wimplicit-function-declaration]
   stack_align_eax ();
   ^

gdb/testsuite/ChangeLog
2016-02-15  Jan Kratochvil  <jan.kratochvil@redhat.com>

* gdb.arch/i386-prologue.c: Add missing prototypes.

8 years agoFix more testcases with standard_output_file.
Jan Kratochvil [Mon, 15 Feb 2016 17:54:03 +0000 (18:54 +0100)]
Fix more testcases with standard_output_file.

Since
commit 2151ccc56c74b55a8f0debf0724a495368f92591
Author: Simon Marchi <simon.marchi@ericsson.com>
Date:   Mon Feb 8 14:02:36 2016 -0500
    Always organize test artifacts in a directory hierarchy
these testfiles could not build.

gdb/testsuite/ChangeLog
2016-02-15  Jan Kratochvil  <jan.kratochvil@redhat.com>

* gdb.arch/i386-gnu-cfi.exp: Use standard_output_file.
* gdb.arch/i386-prologue.exp: Likewise.
* gdb.arch/i386-size.exp: Likewise.

8 years agoFix changelog entry for previous delta.
Nick Clifton [Mon, 15 Feb 2016 16:54:49 +0000 (16:54 +0000)]
Fix changelog entry for previous delta.

8 years agotestsuite: Fix some tests that write outside of the standard output directory
Simon Marchi [Mon, 15 Feb 2016 16:46:10 +0000 (11:46 -0500)]
testsuite: Fix some tests that write outside of the standard output directory

gdb/testsuite/ChangeLog:

* gdb.base/wrong_frame_bt_full.exp: Use standard_output_file to
define object file path.
* gdb.btrace/gcore.exp: Use standard_output_file to define core
file path.
* lib/opencl.exp (gdb_compile_opencl_hostapp): Use
standard_output_file to define binfile.

8 years agoCorrect opcode generated for RX indirect MOVs without an offset.
Vinay Kumar G [Mon, 15 Feb 2016 16:34:34 +0000 (16:34 +0000)]
Correct opcode generated for RX indirect MOVs without an offset.

PR gas/19665
* config/rx-parse.y (MOV):  Opcode generation for index
register addressing mode.
* testsuite/gas/rx/rx.exp: Updated for new testcase.
* testsuite/gas/rx/pr19665.s: New file.
* testsuite/gas/rx/pr19665.s: New file.
* testsuite/gas/rx/mov.d: Update expected output.

8 years agoEnhance GAS's .section directive so that it can take numeric values for the flags...
Nick Clifton [Mon, 15 Feb 2016 11:11:46 +0000 (11:11 +0000)]
Enhance GAS's .section directive so that it can take numeric values for the flags and type fields.  (ELF only)

gas * doc/as.texinfo (.section): Document that numeric values can now
be used for the flags and type fields of the ELF target's .section
directive.  Add notes about the restrictions on setting flags and
types.
* config/obj-elf.c (obj_elf_change_section): Allow known sections
to be given processor specific section types.  Allow processor and
application specific flags of a section to be set after
definition.
(obj_elf_parse_section_letters): Handle parsing numeric values.
(obj_elf_section_type): Handle parsing numeric values.
(obj_elf_section): Allow numeric type values.
* config/obj-elf.h (obj_elf_change_section): Update prototype.
* testsuite/gas/elf/section10.d: New test.
* testsuite/gas/elf/section10.s: Source file for new test.
* testsuite/gas/elf/elf.exp: Run the new test.
* testsuite/gas/i386/ilp32/x86-64-unwind.d: Remove dependency upon
the description of the flags produced by readelf.
* testsuite/gas/tic6x/scomm-directive-4.d: Likewise.
* NEWS: Mention the new feature.

bfd * elf-bfd.h (struct bfd_elf_special_section): Use unsigned values
for length and type fields.  Use a signed value for the
suffix_length field.

binutils* readelf.c (get_section_type_name): Add hex prefix to offsets
printed for LOPROC and LOOS values.  Ensure that a result is
always returned for the V850 target, even when an unrecognised
processor specific value is encountered.
(process_section_headers): Display key values in the order in
which they appear to the user.  Add the "C (compressed)" value to
the list.

ld * testsuite/ld-i386/pr12718.d: Remove dependency upon the
description of the flags produced by readelf.
* testsuite/ld-i386/pr12921.d: Likewise.
* testsuite/ld-i386/tlsbin-nacl.rd: Likewise.
* testsuite/ld-i386/tlsbin.rd: Likewise.
* testsuite/ld-i386/tlsbindesc-nacl.rd: Likewise.
* testsuite/ld-i386/tlsbindesc.rd: Likewise.
* testsuite/ld-i386/tlsdesc-nacl.rd: Likewise.
* testsuite/ld-i386/tlsdesc.rd: Likewise.
* testsuite/ld-i386/tlsgdesc-nacl.rd: Likewise.
* testsuite/ld-i386/tlsgdesc.rd: Likewise.
* testsuite/ld-i386/tlsnopic-nacl.rd: Likewise.
* testsuite/ld-i386/tlsnopic.rd: Likewise.
* testsuite/ld-i386/tlspic-nacl.rd: Likewise.
* testsuite/ld-i386/tlspic.rd: Likewise.
* testsuite/ld-s390/tlsbin.rd: Likewise.
* testsuite/ld-s390/tlsbin_64.rd: Likewise.
* testsuite/ld-s390/tlspic.rd: Likewise.
* testsuite/ld-s390/tlspic_64.rd: Likewise.
* testsuite/ld-sh/tlsbin-2.d: Likewise.
* testsuite/ld-sh/tlspic-2.d: Likewise.
* testsuite/ld-tic6x/common.d: Likewise.
* testsuite/ld-tic6x/shlib-1.rd: Likewise.
* testsuite/ld-tic6x/shlib-1b.rd: Likewise.
* testsuite/ld-tic6x/shlib-1r.rd: Likewise.
* testsuite/ld-tic6x/shlib-1rb.rd: Likewise.
* testsuite/ld-tic6x/shlib-app-1.rd: Likewise.
* testsuite/ld-tic6x/shlib-app-1b.rd: Likewise.
* testsuite/ld-tic6x/shlib-app-1r.rd: Likewise.
* testsuite/ld-tic6x/shlib-app-1rb.rd: Likewise.
* testsuite/ld-tic6x/shlib-noindex.rd: Likewise.
* testsuite/ld-tic6x/static-app-1.rd: Likewise.
* testsuite/ld-tic6x/static-app-1b.rd: Likewise.
* testsuite/ld-tic6x/static-app-1r.rd: Likewise.
* testsuite/ld-tic6x/static-app-1rb.rd: Likewise.
* testsuite/ld-x86-64/ilp32-4-nacl.d: Likewise.
* testsuite/ld-x86-64/ilp32-4.d: Likewise.
* testsuite/ld-x86-64/pr12718.d: Likewise.
* testsuite/ld-x86-64/pr12921.d: Likewise.
* testsuite/ld-x86-64/split-by-file-nacl.rd: Likewise.
* testsuite/ld-x86-64/split-by-file.rd: Likewise.
* testsuite/ld-x86-64/tlsbin-nacl.rd: Likewise.
* testsuite/ld-x86-64/tlsbin.rd: Likewise.
* testsuite/ld-x86-64/tlsbindesc-nacl.rd: Likewise.
* testsuite/ld-x86-64/tlsbindesc.rd: Likewise.
* testsuite/ld-x86-64/tlsdesc-nacl.rd: Likewise.
* testsuite/ld-x86-64/tlsdesc.rd: Likewise.
* testsuite/ld-x86-64/tlsgdesc-nacl.rd: Likewise.
* testsuite/ld-x86-64/tlsgdesc.rd: Likewise.
* testsuite/ld-x86-64/tlspic-nacl.rd: Likewise.
* testsuite/ld-x86-64/tlspic.rd: Likewise.
* testsuite/ld-xtensa/tlsbin.rd: Likewise.
* testsuite/ld-xtensa/tlspic.rd: Likewise.

8 years agogold: Add s390 -fsplit-stack support.
Marcin Kościelnicki [Sun, 13 Dec 2015 01:53:09 +0000 (02:53 +0100)]
gold: Add s390 -fsplit-stack support.

gold/ChangeLog:

* s390.cc (Target_s390::match_view_u): New helper method.
(Target_s390::do_is_call_to_non_split): New method.
(Target_s390::ss_code_st_r14): New const.
(Target_s390::ss_code_l_r14): New const.
(Target_s390::ss_code_bras_8): New const.
(Target_s390::ss_code_l_basr): New const.
(Target_s390::ss_code_a_basr): New const.
(Target_s390::ss_code_ear): New const.
(Target_s390::ss_code_c): New const.
(Target_s390::ss_code_larl): New const.
(Target_s390::ss_code_brasl): New const.
(Target_s390::ss_code_jg): New const.
(Target_s390::ss_code_jgl): New const.
(Target_s390::ss_match_mcount): New helper method.
(Target_s390::ss_match_l): New helper method.
(Target_s390::ss_match_ahi): New helper method.
(Target_s390::ss_match_alfi): New helper method.
(Target_s390::ss_match_cr): New helper method.
(Target_s390::do_calls_non_split): New method.
* testsuite/Makefile.am: Added new tests.
* testsuite/split_s390.sh: New test.
* testsuite/split_s390_1_a1.s: New test.
* testsuite/split_s390_1_a2.s: New test.
* testsuite/split_s390_1_n1.s: New test.
* testsuite/split_s390_1_n2.s: New test.
* testsuite/split_s390_1_z1.s: New test.
* testsuite/split_s390_1_z2.s: New test.
* testsuite/split_s390_1_z3.s: New test.
* testsuite/split_s390_1_z4.s: New test.
* testsuite/split_s390_2_ns.s: New test.
* testsuite/split_s390_2_s.s: New test.
* testsuite/split_s390x_1_a1.s: New test.
* testsuite/split_s390x_1_a2.s: New test.
* testsuite/split_s390x_1_n1.s: New test.
* testsuite/split_s390x_1_n2.s: New test.
* testsuite/split_s390x_1_z1.s: New test.
* testsuite/split_s390x_1_z2.s: New test.
* testsuite/split_s390x_1_z3.s: New test.
* testsuite/split_s390x_1_z4.s: New test.
* testsuite/split_s390x_2_ns.s: New test.
* testsuite/split_s390x_2_s.s: New test.

8 years agoDon't print 0x for core_addr_to_string_nz
Yao Qi [Mon, 15 Feb 2016 10:05:56 +0000 (10:05 +0000)]
Don't print 0x for core_addr_to_string_nz

core_addr_to_string_nz returns string which has "0x" prefix, so don't
need to print "0x" again.  This patch is to remove the "0x".

gdb:

2016-02-15  Yao Qi  <yao.qi@linaro.org>

* aarch64-tdep.c (aarch64_analyze_prologue): Remove "0x".

8 years agoAutomatic date update in version.in
GDB Administrator [Mon, 15 Feb 2016 00:00:20 +0000 (00:00 +0000)]
Automatic date update in version.in

8 years agotestsuite: Fix false Fortran regressions with recent gcc
Jan Kratochvil [Sun, 14 Feb 2016 08:21:18 +0000 (09:21 +0100)]
testsuite: Fix false Fortran regressions with recent gcc

gcc-4.9.2-6.fc21.x86_64 -> gcc-5.3.1-2.fc23.x86_64

-PASS: gdb.fortran/vla-ptype.exp: ptype pvla not initialized
+FAIL: gdb.fortran/vla-ptype.exp: ptype pvla not initialized
-PASS: gdb.fortran/vla-history.exp: print vla1 allocated
+FAIL: gdb.fortran/vla-history.exp: print vla1 allocated
-PASS: gdb.fortran/vla-history.exp: print $2
+FAIL: gdb.fortran/vla-history.exp: print $2
-PASS: gdb.fortran/vla-value.exp: print undefined pvla
+FAIL: gdb.fortran/vla-value.exp: print undefined pvla
-PASS: gdb.fortran/vla-value.exp: print non-associated &pvla
+FAIL: gdb.fortran/vla-value.exp: print non-associated &pvla
-PASS: gdb.fortran/vla-value.exp: print undefined pvla(1,3,8)
+FAIL: gdb.fortran/vla-value.exp: print undefined pvla(1,3,8)

These issues get fixed (or removed if no longer applicable) by attached patch.

It is based on Googled:
http://www.cs.rpi.edu/~szymansk/OOF90/bugs.html#5
When a pointer is declared its status is undefined, and cannot be
safely queried with the associated intrinsic.
-> nullify(VARNAME)
+
https://software.intel.com/en-us/forums/intel-fortran-compiler-for-linux-and-mac-os-x/topic/268786
ALLOCATE is not supposed to initialize the array.
-> Remove checks like an initial print is: \\( *0, *0, *0...\\)

These regressions remain:
-PASS: gdb.fortran/library-module.exp: print var_i in lib
+FAIL: gdb.fortran/library-module.exp: print var_i in lib
-PASS: gdb.fortran/library-module.exp: print var_i in main
+FAIL: gdb.fortran/library-module.exp: print var_i in main
I believe it is more a GDB bug (in a code contributed by me), filed:
gdb.fortran/library-module.exp false regression on GCC upgrade
https://sourceware.org/bugzilla/show_bug.cgi?id=19635

gdb/testsuite/ChangeLog
2016-02-14  Jan Kratochvil  <jan.kratochvil@redhat.com>

Fix compatibility with recent gfortran-5.3.1.
* gdb.fortran/vla-history.exp (print vla1 allocated)
(print vla2 allocated, print $2, print $3): Remove
(print $4): Rename to ...
(print $2): ... here.
(print $9): Rename to ...
(print $5): ... here.
(print $10): Rename to ...
(print $6): ... here.
* gdb.fortran/vla.f90: Add pvla initialization.

8 years agotestsuite regression: gdb.fortran/vla-value-sub.exp gdb.fortran/vla-value-sub-finish.exp
Jan Kratochvil [Sun, 14 Feb 2016 08:10:59 +0000 (09:10 +0100)]
testsuite regression: gdb.fortran/vla-value-sub.exp gdb.fortran/vla-value-sub-finish.exp

> +static int max_value_size = 65536; /* 64k bytes */

FAIL: gdb.fortran/vla-value-sub.exp: print array2 in foo after it was filled (passed fixed array)
FAIL: gdb.fortran/vla-value-sub.exp: print array2 in foo after it was mofified in debugger (passed fixed array)
FAIL: gdb.fortran/vla-value-sub-finish.exp: print array2 in foo after it was filled
FAIL: gdb.fortran/vla-value-sub-finish.exp: print array2 in foo after it was mofified in debugger

print array2
value requires 296352 bytes, which is more than max-value-size
(gdb) FAIL: gdb.fortran/vla-value-sub.exp: print array2 in foo after it was filled (passed fixed array)

gdb/testsuite/ChangeLog
2016-02-14  Jan Kratochvil  <jan.kratochvil@redhat.com>

* gdb.fortran/vla-value-sub-finish.exp (set max-value-size 1024*1024):
New test.
* gdb.fortran/vla-value-sub.exp: Likewise.

8 years agoAutomatic date update in version.in
GDB Administrator [Sun, 14 Feb 2016 00:00:19 +0000 (00:00 +0000)]
Automatic date update in version.in

8 years agoAutomatic date update in version.in
GDB Administrator [Sat, 13 Feb 2016 00:00:18 +0000 (00:00 +0000)]
Automatic date update in version.in

8 years agoFix a typo in objcopy manual
H.J. Lu [Fri, 12 Feb 2016 21:38:57 +0000 (13:38 -0800)]
Fix a typo in objcopy manual

For objcopy, --compress-debug-sections=none is the same as
--decompress-debug-sections, not --nocompress-debug-sections.

* doc/binutils.texi: Fix a typo.

8 years agogdb.trace/tfile-avx.c: Change ymm15 to xmm15 for old gcc.
Marcin Kościelnicki [Fri, 12 Feb 2016 19:32:28 +0000 (20:32 +0100)]
gdb.trace/tfile-avx.c: Change ymm15 to xmm15 for old gcc.

gcc older than 4.9 doesn't understand ymm15 as a register name.  Use
xmm15 instead.

gdb/testsuite/ChangeLog:

* gdb.trace/tfile-avx.c (main): Change ymm15 to xmm15.

8 years agoi386-biarch-core.exp: Use standard_output_file
Simon Marchi [Fri, 12 Feb 2016 18:56:21 +0000 (13:56 -0500)]
i386-biarch-core.exp: Use standard_output_file

Fix the core file path to use the standard output directory.

gdb/testsuite/ChangeLog:

* i386-biarch-core.exp: Define corefile using
standard_output_file.

8 years ago[gdbserver, aarch64] Use linux_{set,get}_pc_{64,32}bit
Yao Qi [Fri, 12 Feb 2016 16:08:25 +0000 (16:08 +0000)]
[gdbserver, aarch64] Use linux_{set,get}_pc_{64,32}bit

We can use shared functions linux_{set,get}_pc_{64,32}bit in
linux-aarch64-low.c to write and read pc.

gdb/gdbserver:

2016-02-12  Yao Qi  <yao.qi@linaro.org>

* linux-aarch64-low.c (aarch64_get_pc): Call linux_get_pc_64bit
or linux_get_pc_32bit.
(aarch64_set_pc): Call linux_set_pc_64bit or linux_set_pc_32bit.

8 years ago[ARM] Software single step cross kernel helpers
Yao Qi [Wed, 10 Feb 2016 14:21:38 +0000 (14:21 +0000)]
[ARM] Software single step cross kernel helpers

GDB step cross kernel helpers only works if the kernel helpers are tail
called, which is the case how it is used in glibc.  See __aeabi_read_tp
in sysdeps/unix/sysv/linux/arm/aeabi_read_tp.S.  In __aeabi_read_tp,
branch/jump to the kernel helper is the last instruction, and the next
instruction address is in LR, which is in caller function.  GDB can
handle this correctly.  For example, glibc function __GI___ctype_init
calls __aeabi_read_tp

   0xb6e19b30 <__GI___ctype_init+4>: ldr r3, [pc, #80] ;
   0xb6e19b34 <__GI___ctype_init+8>: bl 0xb6e0a6e0 <__aeabi_read_tp>
   0xb6e19b38 <__GI___ctype_init+12>: ldr r3, [pc, r3]

and __aeabi_read_tp calls kernel helper,

(gdb) disassemble __aeabi_read_tp
   0xb6fef5d0 <+0>: mvn r0, #61440 ; 0xf000
   0xb6fef5d4 <+4>: sub pc, r0, #31

once GDB or GDBserver single step instruction on 0xb6fef5d4, LR is
0xb6e19b38, which is right address of next instruction to set breakpoint
on.

However, if the kernel helpers are not tail-called, the LR is still the
address in the caller function of kernel helper's caller, which isn't
the right address of next instruction to set breakpoint on.  For example,
we use kernel helper in main,

(gdb) disassemble main
....
   0x00008624 <+32>:    mov     r3, #4064       ; 0xfe0^M
   0x00008628 <+36>:    movt    r3, #65535      ; 0xffff^M
   0x0000862c <+40>:    blx     r3
   0x00008630 <+44>:    ldr     r3, [r11, #-8]

kernel helper is called on 0x0000862c and the expected next instruction
address is 0x00008630, but the LR now is the return address of main.
The problem here is LR may not have the right address because when we
single step the instruction, it isn't executed yet, so the LR isn't
updated.  This patch fix this problem by decoding instruction, if the
instruction updates LR (BL and BLX), the next instruction address is
PC + INSN_SIZE, otherwise, get the address of next instruction from LR.

gdb:

2016-02-12  Yao Qi  <yao.qi@linaro.org>

* arch/arm-linux.c (arm_linux_get_next_pcs_fixup): Calculate
nextpc according to instruction.

gdb/testsuite:

2016-02-12  Yao Qi  <yao.qi@linaro.org>

* gdb.arch/arm-single-step-kernel-helper.c: New.
* gdb.arch/arm-single-step-kernel-helper.exp: New.

8 years ago[ARM] Fixup PC in software single step
Yao Qi [Mon, 8 Feb 2016 16:05:31 +0000 (16:05 +0000)]
[ARM] Fixup PC in software single step

When I exercise GDBserver software single step, I see the following
error, which has been already handled by GDB properly.

In GDBserver log, we can see, GDBserver tries to single step instruction
on 0xb6e0a6e4, and destination address is 0xffff0fe0,

 stop pc is 0xb6e0a6e4
 Writing f001f0e7 to 0xffff0fe0 in process 7132
 Failed to insert breakpoint at 0xffff0fe0 (Input/output error).
 Failed to insert breakpoint at 0xffff0fe0 (-1).

(gdb) disassemble __aeabi_read_tp,+8
Dump of assembler code from 0xb6e0a6e0 to 0xb6e0a6e8:
   0xb6e0a6e0 <__aeabi_read_tp+0>: mvn r0, #61440 ; 0xf000
   0xb6e0a6e4 <__aeabi_read_tp+4>: sub pc, r0, #31

however, it fails inserting breakpoint there.  This problem has already
fixed by GDB, see comments in arm-linux-tdep.c:arm_linux_software_single_step

      /* The Linux kernel offers some user-mode helpers in a high page.  We can
 not read this page (as of 2.6.23), and even if we could then we
 couldn't set breakpoints in it, and even if we could then the atomic
 operations would fail when interrupted.  They are all called as
 functions and return to the address in LR, so step to there
 instead.  */

so we need to do the same thing in GDB side as well.  This patch adds
a new field fixup in arm_get_next_pcs_ops, so that we can fix up PC
for arm-linux target.  In this way, both GDB and GDBserver can single
step instructions going to kernel helpers.

gdb:

2016-02-12  Yao Qi  <yao.qi@linaro.org>

* arch/arm-get-next-pcs.c (arm_get_next_pcs): Call
self->ops->fixup if it isn't NULL.
* arch/arm-get-next-pcs.h: Include gdb_vecs.h.
(struct arm_get_next_pcs_ops) <fixup>: New field.
* arch/arm-linux.c: Include common-regcache.h and
arch/arm-get-next-pcs.h.
(arm_linux_get_next_pcs_fixup): New function.
* arch/arm-linux.h (arm_linux_get_next_pcs_fixup): Declare.
* arm-linux-tdep.c (arm_linux_get_next_pcs_ops): Initialize
it with arm_linux_get_next_pcs_fixup.
(arm_linux_software_single_step): Move code to
arm_linux_get_next_pcs_fixup.
* arm-tdep.c (arm_get_next_pcs_ops): Initialize it.

gdb/gdbserver:

2016-02-12  Yao Qi  <yao.qi@linaro.org>

* linux-arm-low.c (get_next_pcs_ops): Initialize it with
arm_linux_get_next_pcs_fixup.

8 years agogdb.trace: Deduplicate write_inferior_data_ptr.
Marcin Kościelnicki [Thu, 28 Jan 2016 15:39:26 +0000 (16:39 +0100)]
gdb.trace: Deduplicate write_inferior_data_ptr.

This function is now basically identical to write_inferior_data_pointer,
remove it and change all references.

gdb/gdbserver/ChangeLog:

* tracepoint.c (x_tracepoint_action_download): Change
write_inferior_data_ptr to write_inferior_data_pointer.
(cmd_qtstart): Likewise.
(write_inferior_data_ptr): Remove.
(download_agent_expr): Change write_inferior_data_ptr to
write_inferior_data_pointer.
(download_tracepoint_1): Likewise.
(download_tracepoint): Likewise.
(download_trace_state_variables): Likewise.

8 years agogdb: Fix build failure in xml-tdesc.c without expat.
Marcin Kościelnicki [Thu, 11 Feb 2016 22:52:44 +0000 (23:52 +0100)]
gdb: Fix build failure in xml-tdesc.c without expat.

Introduced by 18d3cec54e1b4fce278dba436484846f8048d7d6.

gdb/ChangeLog:

* xml-tdesc.c (target_fetch_description_xml) [!HAVE_LIBEXPAT]: Warn
and return NULL.

8 years agobtrace, frame: fix crash in get_frame_type
Markus Metzger [Tue, 26 Jan 2016 13:58:44 +0000 (14:58 +0100)]
btrace, frame: fix crash in get_frame_type

In skip_artificial_frames we repeatedly call get_prev_frame_always until we get
a non-inline and non-tailcall frame assuming that there must be such a frame
eventually.

For record targets, however, we may have a frame chain that consists only of
artificial frames.  This leads to a crash in get_frame_type when dereferencing a
NULL frame pointer.

Change skip_artificial_frames and skip_tailcall_frames to return NULL in such a
case and modify each caller to cope with a NULL return.

In frame_unwind_caller_pc and frame_unwind_caller_arch, we simply assert that
the returned value is not NULL.  Their caller was supposed to check
frame_unwind_caller_id before calling those functions.

In other cases, we thrown an error.

In infcmd further move the skip_tailcall_frames call to the forward-stepping
case since we don't need a frame for reverse execution and we don't want to fail
because of that.  Reverse-finish does make sense for a tailcall frame.

gdb/
* frame.h (skip_tailcall_frames): Update comment.
* frame.c (skip_artificial_frames, skip_tailcall_frames): Return NULL
if only artificial frames are found.  Update comment.
(frame_unwind_caller_id): Handle NULL return.
(frame_unwind_caller_pc, frame_unwind_caller_arch): Assert that
skip_artificial_frames does not return NULL.
(frame_pop): Add an error if only tailcall frames are found.
* infcmd.c (finish_command): Move skip_tailcall_frames call into forward-
execution case.  Add an error if only tailcall frames are found.

testsuite/
* gdb.btrace/tailcall-only.exp: New.
* gdb.btrace/tailcall-only.c: New.
* gdb.btrace/x86_64-tailcall-only.S: New.
* gdb.btrace/i686-tailcall-only.S: New.

8 years agostack: check frame_unwind_caller_id
Markus Metzger [Thu, 11 Feb 2016 10:07:09 +0000 (11:07 +0100)]
stack: check frame_unwind_caller_id

Callers of frame_unwind_caller_* functions are supposed to check
frame_unwind_caller_id.

Add such a check to frame_info and treat an invalid caller ID as if the caller
PC were not available.

gdb/
* stack.c (frame_info): Check frame_unwind_caller_id.

8 years agoframe: add skip_tailcall_frames
Markus Metzger [Fri, 5 Feb 2016 08:32:53 +0000 (09:32 +0100)]
frame: add skip_tailcall_frames

Add a new function skip_tailcall_frames to skip TAILCALL_FRAME frames.

gdb/
* frame.h (skip_tailcall_frames): New.
* frame.c (skip_tailcall_frames): New.
(frame_pop): Call skip_tailcall_frames.
* infcmd.c (finish_command): Call skip_tailcall_frames.

8 years agoAutomatic date update in version.in
GDB Administrator [Fri, 12 Feb 2016 00:00:08 +0000 (00:00 +0000)]
Automatic date update in version.in

8 years agoFix a typo in ld/ChangeLog
H.J. Lu [Thu, 11 Feb 2016 23:37:00 +0000 (15:37 -0800)]
Fix a typo in ld/ChangeLog

8 years agoAdd ChangeLog for PR ld/19615 fix
H.J. Lu [Thu, 11 Feb 2016 23:24:33 +0000 (15:24 -0800)]
Add ChangeLog for PR ld/19615 fix

8 years agoEnable -Bsymbolic and -Bsymbolic-functions to PIE
H.J. Lu [Thu, 11 Feb 2016 18:28:33 +0000 (10:28 -0800)]
Enable -Bsymbolic and -Bsymbolic-functions to PIE

Before binutils 2.26, -Bsymbolic and -Bsymbolic-functions were also
applied to PIE so that "ld -pie -Bsymbolic -E" can be used to export
symbols in PIE with local binding.  This patch re-enables -Bsymbolic
and -Bsymbolic-functions for PIE.

PR ld/19615
* ld.texinfo: Document -Bsymbolic and -Bsymbolic-functions for
PIE.
* lexsup.c (parse_args): Enable -Bsymbolic and
-Bsymbolic-functions for PIE.
* testsuite/ld-i386/i386.exp: Run pr19175.
* testsuite/ld-i386/pr19615.d: New file.
* testsuite/ld-i386/pr19615.s: Likewise.
* testsuite/ld-x86-64/pr19615.d: Likewise.
* testsuite/ld-x86-64/pr19615.s: Likewise.

8 years agogdbserver: Remove tracepoint_action ops.
Wei-cheng Wang [Sat, 27 Jun 2015 16:21:38 +0000 (00:21 +0800)]
gdbserver: Remove tracepoint_action ops.

This patch removes 'ops' in tracepoint, and uses helper functions to
call action handler instead.

The object layout of tracepoint_action may differ in gdbserver and
inferior depend on the alignment rule of target ABI, so gdbserver cannot
simply copy the object from its memory to inferior memory.

For example,

  struct collect_memory_action
  {
    struct tracepoint_action base;
    {
      #ifndef IN_PROCESS_AGENT
      const struct tracepoint_action_ops *ops;
      #if
  -   char type;
  | }
  | ULONGEST addr;
  | ULONGEST len;
  - int32_t basereg;
  };

and on PowerPC,

     Wihtout ops           with ops
      0   1   2   3         0   1   2   3
   0 |type| PADDING...    0 |ops-------------|
   4 .................    4 |type|PADDING....|
   8 |addr------------    8 |addr-------------
   c ----------------|    c -----------------|
  10 |len-------------   10 |len--------------
  14 ----------------|   14 -----------------|
  18 |basereg--------|   18 |basereg---------|

so we cannot directly copy the object.

In this patch, 'ops' is removed in order to make the objects identical.

gdb/gdbserver/ChangeLog:

2016-02-11  Wei-cheng Wang  <cole945@gmail.com>
    Marcin Kościelnicki  <koriakin@0x04.net>

* tracepoint.c (struct tracepoint_action_ops): Remove.
(struct tracepoint_action): Remove ops.
(m_tracepoint_action_download, r_tracepoint_action_download)
(x_tracepoint_action_download, l_tracepoint_action_download): Adjust
size and offset accordingly.
(m_tracepoint_action_ops, r_tracepoint_action_ops)
(x_tracepoint_action_ops, l_tracepoint_action_ops): Remove.
(tracepoint_action_send, tracepoint_action_download): New functions.
Helpers for trace action handlers.
(add_tracepoint_action): Remove setup actions ops.
(download_tracepoint_1, tracepoint_send_agent): Call helper functions.

8 years agoAdd missing quotes to gdb/testsuite/README
Pedro Alves [Thu, 11 Feb 2016 19:55:46 +0000 (19:55 +0000)]
Add missing quotes to gdb/testsuite/README

gdb/testsuite/ChangeLog:
2016-02-11  Pedro Alves  <palves@redhat.com>

* README (Parallel testing): Add missing double quotes.

8 years agoSupport 'make check-parallel' in gdb's build dir
Pedro Alves [Thu, 11 Feb 2016 19:36:39 +0000 (19:36 +0000)]
Support 'make check-parallel' in gdb's build dir

Currently, you can cd to the gdb/testsuite/ dir and use
make check-parallel, instead of using FORCE_PARALLEL:

 $ make -j8 check-parallel RUNTESTFLAGS="--target_board=native-gdbserver"
 $ make -j8 check RUNTESTFLAGS="--target_board=native-gdbserver" FORCE_PARALLEL=1

But you can't do that in the build/gdb/ dir:

 $ make check-parallel RUNTESTFLAGS="--target_board=native-gdbserver"
 make: *** No rule to make target `check-parallel'.  Stop.

I find check-parallel a bit more convenient, and more typo-proof, so
this patch makes it work from the gdb build dir too.

While documenting this in testsuite/README, I found that the parallel
testing mode would better be pulled out to its own section and
extended.

gdb/ChangeLog:
2016-02-11  Pedro Alves  <palves@redhat.com>

* Makefile.in (check-parallel): New rule.

gdb/testsuite/ChangeLog:
2016-02-11  Pedro Alves  <palves@redhat.com>

* README (Parallel testing): New section.
(GDB_PARALLEL): Rewrite.
(FORCE_PARALLEL): Document.

8 years agoarm-tdep.c: Remove unused variables
Simon Marchi [Thu, 11 Feb 2016 19:09:25 +0000 (14:09 -0500)]
arm-tdep.c: Remove unused variables

Just a little bit of cleanup.

gdb/ChangeLog:

* arm-tdep.c (arm_skip_prologue): Remove unused variables.
(arm_analyze_prologue): Likewise.
(arm_scan_prologue): Likewise.
(arm_m_exception_prev_register): Likewise.
(arm_copy_block_xfer): Likewise.
(thumb2_copy_block_xfer): Likewise.
(arm_decode_miscellaneous): Likewise.
(arm_decode_ld_st_word_ubyte): Likewise.
(arm_decode_svc_copro): Likewise.
(thumb2_decode_svc_copro): Likewise.
(thumb_copy_16bit_ldr_literal): Likewise.
(thumb_copy_pop_pc_16bit): Likewise.
(decode_thumb_32bit_ld_mem_hints): Likewise.
(arm_show_force_mode): Likewise.
(_initialize_arm_tdep): Likewise.
(arm_record_strx): Likewise.
(arm_record_extension_space): Likewise.
(arm_record_data_proc_misc_ld_str): Likewise.
(arm_record_exreg_ld_st_insn): Likewise.
(arm_record_vfp_data_proc_insn): Likewise.
(arm_record_coproc_data_proc): Likewise.
(thumb_record_misc): Likewise.
(thumb_record_ldm_stm_swi): Likewise.
(thumb2_record_ld_st_dual_ex_tbb): Likewise.
(thumb2_record_ld_mem_hints): Likewise.
(thumb2_record_lmul_lmla_div): Likewise.
(thumb2_record_asimd_struct_ld_st): Likewise.
(arm_process_record): Likewise.

8 years agoarm-tdep.c: Remove unused arm_displaced_step_copy_insn
Simon Marchi [Thu, 11 Feb 2016 19:08:53 +0000 (14:08 -0500)]
arm-tdep.c: Remove unused arm_displaced_step_copy_insn

This function is never used, since it is superseded by
arm_linux_displaced_step_copy_insn.

gdb/ChangeLog:

* arm-tdep.c (arm_displaced_step_copy_insn): Remove.
(ARM displaced stepping support): Remove reference to
arm_displaced_step_copy_insn in comment.
* arm-tdep.h (arm_displaced_step_copy_insn): Remove.
* arm-linux-tdep.c (arm_linux_displaced_step_copy_insn): Remove
reference to arm_displaced_step_copy_insn in comment.

8 years agoarm-tdep.c: Change type of insn parameters
Simon Marchi [Thu, 11 Feb 2016 18:21:32 +0000 (13:21 -0500)]
arm-tdep.c: Change type of insn parameters

Almost obvious... change the type of some insn parameters, so that it
matches the rest of the code.

gdb/ChangeLog:

* arm-tdep.c (thumb_copy_unmodified_16bit): Change type of insn.
(thumb_copy_b): Likewise.
(arm_decode_b_bl_ldmstm): Likewise.
(thumb_copy_16bit_ldr_literal): Likewise.
(thumb_copy_pop_pc_16bit): Likewise.

8 years agoRemove info message for every erratum 843419 found and fixed.
Han Shen [Thu, 11 Feb 2016 17:47:49 +0000 (09:47 -0800)]
Remove info message for every erratum 843419 found and fixed.

2016-02-11 Rahul Chaudhry  <rahulchaudhry@google.com>

* aarch64.cc (Target_aarch64::scan_erratum_843419_span):
Remove info message for every erratum 843419 found and fixed.

8 years agoAllow the .cfi_sections directive to be reissued provided that CFI generation has...
Nick Clifton [Thu, 11 Feb 2016 15:30:55 +0000 (15:30 +0000)]
Allow the .cfi_sections directive to be reissued provided that CFI generation has not yet started.

PR gas/19614
* dw2gencfi.c (cfi_sections_set): Delay setting this variable
until it is actually used.
(cfi_set_sections): Set cfi_sections_set to true.
(dot_cfi_startproc): Likewise.
(dot_cfi_endproc): Likewise.
(dot_cfi_fde_data): Likewise.
(cfi_finish): Likewise.
(dot_cfi_sections): Do not set cfi_sections_set.
* doc/as.texinfo (.cfi_sections): Note that targets can provide
their own cfi section name.  Also note that the directive can be
reissued provided that CFI generation has not started.
* testsuite/gas/mips/compact-eh-err2.s: Add .cfi_startproc and
.cfi_endproc directives so that the redefinition of .cfi_sections
will trigger the generation of the error message.
* testsuite/gas/mips/compact-eh-err2.l: Update expected line
number of error message.

8 years agogdb.trace: Add a testcase for tdesc in tfile.
Marcin Kościelnicki [Sat, 6 Feb 2016 17:19:49 +0000 (18:19 +0100)]
gdb.trace: Add a testcase for tdesc in tfile.

This tests whether $ymm15 can be correctly collected and printed from
tfile.  It covers:

- storing tdesc in tfile (without that, $ymm15 doesn't exist)
- ax_pseudo_register_collect for x86 (without that, $ymm15 cannot be
  collected)
- register order in tfile_fetch_registers (without that, $ymm15h is
  fetched from wrong position)
- off-by-one in tfile_fetch_registers (without that, $ymm15h is
  incorrectly considered to be out of bounds)
- using proper tdesc in encoding tracepoint actions (without that,
  internal error happens due to $ymm15h being considered unavailable)

gdb/testsuite/ChangeLog:

* gdb.trace/tfile-avx.c: New test.
* gdb.trace/tfile-avx.exp: New test.

8 years agoUse the target architecture when encoding tracepoint actions
Antoine Tremblay [Thu, 11 Feb 2016 13:14:12 +0000 (08:14 -0500)]
Use the target architecture when encoding tracepoint actions

This patch uses the target architecture rather then the objfile
architecture when encoding tracepoint actions.

The target architecture may contain additional registers. E.g. ARM VFP
registers. This information is needed to allow their collection. Since we
can never know whether the registers numbers in the target match the
binary's we have to use tdesc here.

One note about combined debuggers / multi-inferior from Pedro Alves:

In the combined debugger case taking Cell as the practical example that
gdb supports currently:

In that case, the main target_gdbarch() will be powerpc, but you may have set a
tracepoint on _spu_ code, which has a different gdbarch.  so for that case,
target_gdbarch would be wrong.  I think that in that case, we'd need to
find __the_ target/tdesc gdbarch that is (bfd) compatible with the
objfile's gdbarch.

I think cell/spu gdbserver doesn't support tracepoints, so we can ignore
this for now.

The multi-inferior/process case is somewhat related, but its simpler.
each inferior has its own gdbarch.

That is, target_gdbarch depends on the current inferior selected.
In fact, that just returns inferior->gdbarch nowaways.

No regressions, tested on ubuntu 14.04 ARMv7 and x86.
With gdbserver-{native,extended} / { -marm -mthumb }

gdb/ChangeLog:

* tracepoint.c (encode_actions_1): Use target_gdbarch () rather
than loc->gdbarch.

8 years agoMask off the least significant bit in GOT offset
H.J. Lu [Thu, 11 Feb 2016 03:33:52 +0000 (19:33 -0800)]
Mask off the least significant bit in GOT offset

The least significant bit in GOT offset is to record whether we have
initialized the GOT entry in R_386_GOT32 processing.  We need to mask
it off for R_386_GOT32X.

PR ld/19601
* elf32-i386.c (elf_i386_relocate_section): Mask off the least
significant bit in GOT offset for R_386_GOT32X.

8 years agoAutomatic date update in version.in
GDB Administrator [Thu, 11 Feb 2016 00:00:14 +0000 (00:00 +0000)]
Automatic date update in version.in

8 years agogdb.trace: Read XML target description from tfile.
Marcin Kościelnicki [Sat, 6 Feb 2016 00:49:14 +0000 (01:49 +0100)]
gdb.trace: Read XML target description from tfile.

gdb/ChangeLog:

* tracefile-tfile.c (trace_tdesc): New static variable.
(tfile_open): Clear trace_tdesc, call target_find_description.
(tfile_interp_line): Recognize tdesc lines.
(tfile_close): Clear trace_tdesc.
(tfile_xfer_partial_features): New function.
(tfile_xfer_partial): Call tfile_xfer_partial_features.
(tfile_append_tdesc_line): New function.

8 years agogdb.trace: Save XML target description in tfile.
Marcin Kościelnicki [Fri, 5 Feb 2016 20:32:52 +0000 (21:32 +0100)]
gdb.trace: Save XML target description in tfile.

gdb/ChangeLog:

* ctf.c (ctf_write_tdesc): New function.
(ctf_write_ops): Wire in ctf_write_tdesc.
* tracefile-tfile.c (tfile_write_tdesc): New function.
(tfile_write_ops): Wire in tfile_write_tdesc.
* tracefile.c (trace_save): Call write_tdesc method.
* tracefile.h (struct trace_file_write_ops): Add write_tdesc method.
* xml-tdesc.c (target_fetch_description_xml): New function.
* xml-tdesc.h: Add target_fetch_description_xml prototype.