binutils-gdb.git
9 years agoTest the interaction between GDBHISTSIZE and .gdbinit
Patrick Palka [Wed, 17 Jun 2015 19:41:07 +0000 (15:41 -0400)]
Test the interaction between GDBHISTSIZE and .gdbinit

The value inside the GDBHISTSIZE environment variable, only if valid,
should override setting the history size through one's .gdbinit file.

gdb/testsuite/ChangeLog:

* gdb.base/gdbinit-history.exp: Test the interaction between
setting GDBHISTSIZE and setting the history size via .gdbinit.

9 years agoAdd support for using the ADR alias in Thumb mode against nearby symbols.
Nick Clifton [Thu, 18 Jun 2015 09:23:16 +0000 (10:23 +0100)]
Add support for using the ADR alias in Thumb mode against nearby symbols.

PR gas/18541
gas * config/tc-arm.c (md_apply_fix): Add support for ADR in thumb
mode against a nearby symbol.

tests * gas/arm/thumb.s: Add test of ADR against a nearby symbol.
* gas/arm/thumb.d: Update expected output.
* gas/arm/thumb-eabi.d: Likewise.

9 years agoFix the computation of the addends for an ARM_TLS_LE32 reloc.
Nick Clifton [Thu, 18 Jun 2015 09:18:42 +0000 (10:18 +0100)]
Fix the computation of the addends for an ARM_TLS_LE32 reloc.

PR gas/18481
bfd * elf32-arm.c (R_ARM_TLS_LE32): Set the special function to NULL.

gas * config/tc-arm.c (tc_gen_reloc): Include BFD_RELOC_ARM_TLS_LE32
in the same case as BFD_RELOC_ARM_TLS_IS32.

tests * gas/arm/tls.s: Add tests of the tpoff pseudo with a local
symbol.
* gas/arm/tls.d: Update expected output.

9 years agosim: syscall: simplify unknown syscall trace
Mike Frysinger [Thu, 18 Jun 2015 08:06:27 +0000 (04:06 -0400)]
sim: syscall: simplify unknown syscall trace

Since we always include the raw syscall number when tracing, also
including it in the name when it's unknown is redundant.  Simplify
the code by using a constant string.

9 years agosim: callback: fix sentinel testing when walking maps
Mike Frysinger [Thu, 18 Jun 2015 08:02:26 +0000 (04:02 -0400)]
sim: callback: fix sentinel testing when walking maps

The new helpers for walking the maps tested the wrong value for exiting
the for loop.  This caused crashes when looking up entries that were not
in the map.

9 years agoAutomatic date update in version.in
GDB Administrator [Thu, 18 Jun 2015 00:00:08 +0000 (00:00 +0000)]
Automatic date update in version.in

9 years agoFix problems with finishing a dummy function call on simulators.
Luis Machado [Wed, 17 Jun 2015 19:50:57 +0000 (16:50 -0300)]
Fix problems with finishing a dummy function call on simulators.

Some simulators don't handle permanent breakpoints properly and will
sometimes terminate when hitting such a breakpoint instruction or have
unwanted effects.

When a permanent breakpoint is inserted, GDB will not attempt to insert
other breakpoint locations on top of it, leading to the problem described
above.

By not marking permanent breakpoint locations as inserted, we allow the
insertion of breakpoint locations on top of the permanent ones, preventing
the simulators from running into that situation.

gdb/ChangeLog:

2015-06-17  Luis Machado  <lgustavo@codesourcery.com>

* breakpoint.c (add_location_to_breakpoint): Don't mark permanent
locations as inserted.
Update and expand comment about permanent locations.
(bp_loc_is_permanent): Don't return 0 for bp_call_dummy.
Move comment to add_location_to_breakpoint.
(update_global_location_list): Don't error out if a permanent
breakpoint is not marked inserted.
Don't error out if a non-permanent breakpoint location is inserted on
top of a permanent breakpoint.

9 years agoRemove unused function make_breakpoint_permanent.
Luis Machado [Wed, 17 Jun 2015 14:08:55 +0000 (11:08 -0300)]
Remove unused function make_breakpoint_permanent.

make_breakpoint_permanent is no longer used anywhere and can be
safely removed.

gdb/ChangeLog:

2015-06-17  Luis Machado  <lgustavo@codesourcery.com>

* breakpoint.c (make_breakpoint_permanent): Remove unused
function.
* breakpoint.h (make_breakpoint_permanent): Remove declaration.

9 years agoMake NEWS entry and manual regarding GDBHISTSIZE more consistent
Patrick Palka [Wed, 17 Jun 2015 18:44:38 +0000 (14:44 -0400)]
Make NEWS entry and manual regarding GDBHISTSIZE more consistent

... by mentioning in the manual that setting GDBHISTSIZE to the empty
string disables truncation, like the NEWS entry does.

gdb/doc/ChangeLog:

* gdb.texinfo (Command History): Mention that setting
GDBHISTSIZE to the empty string disables history truncation.

9 years agoTweak the handling of $GDBHISTSIZE edge cases [PR gdb/16999]
Patrick Palka [Tue, 12 May 2015 10:50:26 +0000 (06:50 -0400)]
Tweak the handling of $GDBHISTSIZE edge cases [PR gdb/16999]

When GDB reads a nonsensical value for the GDBHISTSIZE environment
variable, i.e. one that is non-numeric or negative, GDB then sets its
history size to 0.  This behavior is annoying and also inconsistent
with the behavior of bash.

This patch makes the behavior of invalid GDBHISTSIZE consistent with how
bash handles HISTSIZE.  When we encounter a null or out-of-range
GDBHISTSIZE (outside of [0, INT_MAX]) we now set the history size to
unlimited instead of 0.  When we encounter a non-numeric GDBHISTSIZE we
do nothing.

gdb/ChangeLog:

PR gdb/16999
* NEWS: Mention new GDBHISTSIZE behavior.
* top.c (init_history): For null or out-of-range GDBHISTSIZE,
set history size to unlimited.  Ignore non-numeric GDBHISTSIZE.

gdb/doc/ChangeLog:

PR gdb/16999
* gdb.texinfo (Command History): Mention new GDBHISTSIZE
behavior.

gdb/testsuite/ChangeLog:

PR gdb/16999
* gdb.base/gdbhistsize-history.exp: New test.

9 years agoRead $GDBHISTSIZE instead of $HISTSIZE
Patrick Palka [Wed, 17 Jun 2015 17:31:56 +0000 (13:31 -0400)]
Read $GDBHISTSIZE instead of $HISTSIZE

The HISTSIZE environment variable is generally expected to be read by
shells, not by applications.  Some distros for example globally export
HISTSIZE in /etc/profile -- with the intention that it only affects
shells -- and by doing so it renders useless GDB's own mechanism for
setting the history size via .gdbinit.  Also, annoyances may arise when
HISTSIZE is not interpreted the same way by the shell and by GDB, e.g.
PR gdb/16999.  That can always be fixed on a shell-by-shell basis but it
may be impossible to be consistent with the behavior of all shells at
once.  Finally it just makes sense to not confound shell environment
variables with application environment variables.

gdb/ChangeLog:

* NEWS: Mention that GDBHISTSIZE is read instead of HISTSIZE.
* top.c (init_history): Read from GDBHISTSIZE instead of
HISTSIZE.
(init_main): Refer to GDBHISTSIZE instead of HISTSIZE.

gdb/doc/ChangeLog:

* gdb.texinfo (Command History): Replace occurrences of HISTSIZE
with GDBHISTSIZE.

gdb/testsuite/ChangeLog:

* gdb.base/gdbinit-history.exp: Replace occurrences of HISTSIZE
with GDBHISTSIZE.
* gdb.base/readline.exp: Likewise.

9 years agosim: syscall: add common sim_syscall helpers
Mike Frysinger [Mon, 15 Jun 2015 13:37:38 +0000 (19:22 +0545)]
sim: syscall: add common sim_syscall helpers

Many ports have the same sim syscall logic, so add some helpers to handle
all the common details.  The arches still have to deal with the unpacking
and packing of the syscall arguments, but the rest of the sim<->callback
glue is now shared.

9 years agosim: syscall: unify memory helpers
Mike Frysinger [Mon, 15 Jun 2015 15:24:21 +0000 (21:09 +0545)]
sim: syscall: unify memory helpers

Almost every port implements these two callbacks in the same way, so
unify them in the common layer.

9 years agosim: callback: add human readable strings for debugging to maps
Mike Frysinger [Mon, 15 Jun 2015 13:32:16 +0000 (19:17 +0545)]
sim: callback: add human readable strings for debugging to maps

When tracing, we often want to display the human readable name for the
various syscall/errno values.  Rather than make each target duplicate
the lookup, extend the existing maps to include the string directly,
and add helper functions to look up the constants.

While most targets are autogenerated (from libgloss), the bfin/cris
targets have custom maps for the Linux ABI which need to be updated
by hand.

9 years agoFix tcl error
Yao Qi [Wed, 17 Jun 2015 16:03:03 +0000 (17:03 +0100)]
Fix tcl error

This patch fixes the following tcl error

Running ../../../binutils-gdb/gdb/testsuite/gdb.base/break-interp.exp ...
ERROR: (DejaGnu) proc "else" does not exist.
The error code is NONE
The info on the error is:
invalid command name "else"
    while executing
"::tcl_unknown else"
    ("uplevel" body line 1)
    invoked from within
"uplevel 1 ::tcl_unknown $args"

gdb/testsuite:

2015-06-17  Yao Qi  <yao.qi@linaro.org>

* lib/gdb.exp (get_build_id): Move braces and "else" to the same
line.

9 years ago[AArch64] Select correct linker emulation for ILP32 according to endianes
Jiong Wang [Wed, 17 Jun 2015 15:36:04 +0000 (16:36 +0100)]
[AArch64] Select correct linker emulation for ILP32 according to endianes

2015-06-17  Jiong Wang  <jiong.wang@arm.com>

ld/testsuite/
  * ld-aarch64/aarch64-elf.exp (aarch64_choose_ilp32_emul): New function.
  * ld-aarch64/emit-relocs-28.d: Use aarch64_choose_ilp32_emul to choose
  emulation mode.

9 years agoFix compile warnings building previous delta in a 32-bit environment.
Nick Clifton [Wed, 17 Jun 2015 15:10:36 +0000 (16:10 +0100)]
Fix compile warnings building previous delta in a 32-bit environment.

* config/tc-arm.c (is_double_a_single): Make conditional upon the
availablity of a 64-bit type.  Use this type for the argument and
mantissa.
(double_to_single): Likewise.
* config/tc-arm.c (move_or_literal_pool): Use a 64-bit type for
the constant value, if available.  Generate a 64-bit value from a
bignum if supported.  Only perform the second optimization for
PR 18500 if the 64-bit type is available.

9 years agoDon't truncate the history file when history size is unlimited
Patrick Palka [Thu, 4 Jun 2015 14:12:27 +0000 (10:12 -0400)]
Don't truncate the history file when history size is unlimited

We still do not handle "set history size unlimited" correctly.  In
particular, after writing to the history file, we truncate the history
even if it is unlimited.

This patch makes sure that we do not call history_truncate_file() if the
history is not stifled (i.e. if it's unlimited).  This bug causes the
history file to be truncated to zero on exit when one has "set history
size unlimited" in their gdbinit file.  Although this code exists in GDB
7.8, the bug is masked by a pre-existing bug that's been only fixed in
GDB 7.9 (PR gdb/17820).

gdb/ChangeLog:

* top.c (gdb_safe_append_history): Do not call
history_truncate_file if the history is not stifled.

gdb/testsuite/ChangeLog:

* gdb.base/gdbinit-history.exp: Add test case to check that
an unlimited history file does not get truncated on exit.

9 years agoAdd support for converting LDR Rx,=<imm> to MOV or MVN in Thumb2 mode.
Alessandro Marzocchi [Wed, 17 Jun 2015 12:50:52 +0000 (13:50 +0100)]
Add support for converting LDR Rx,=<imm> to MOV or MVN in Thumb2 mode.

PR gas/18499
gas * config/tc-arm.c (move_or_literal_pool): Add support for LDR Rx,=
to MOV.w or MVN.w for Thumb2.

tests * gas/arm/thumb2_ldr_immediate_armv6.s: New test case.
* gas/arm/thumb2_ldr_immediate_armv6.d: Expected disassembly.
* gas/arm/thumb2_ldr_immediate_armv6t2.s: New test case.
* gas/arm/thumb2_ldr_immediate_armv6t2.d: Expected disassembly.

9 years agoAdd support for converting VLDR <reg>,=<constant> to a VMOV instruction when appropriate.
Alessandro Marzocchi [Wed, 17 Jun 2015 11:56:17 +0000 (12:56 +0100)]
Add support for converting VLDR <reg>,=<constant> to a VMOV instruction when appropriate.

PR gas/18500
gas * config/tc-arm.c (is_double_a_single): New function.
(double_to_single): New function.
(move_or_literal_pool): Add support for converting VLDR to VMOV.

tests * gas/arm/vfpv2-ldr_immediate.s: New test case.
* gas/arm/vfpv2-ldr_immediate.d: Expected disassembly.
* gas/arm/vfpv3-ldr_immediate.s: New test case.
* gas/arm/vfpv3-ldr_immediate.d: Expected disassembly.
* gas/arm/vfpv3xd-ldr_immediate.s: New test case.
* gas/arm/vfpv3xd-ldr_immediate.d: Expected disassembly.

9 years agoS390: Add syscall info for syscalls from 344 up to 354
Andreas Arnez [Wed, 17 Jun 2015 09:17:08 +0000 (11:17 +0200)]
S390: Add syscall info for syscalls from 344 up to 354

Represent new Linux syscalls for s390 and s390x in GDB's syscall info.
Add the syscalls from 344 (finit_module) up to 354 (execveat).

gdb/ChangeLog:

* syscalls/s390-linux.xml: Add syscalls 344 through 354.
* syscalls/s390x-linux.xml: Likewise.

9 years agoAdd vector ABI tests to gnu_vector.exp
Andreas Arnez [Wed, 17 Jun 2015 09:17:07 +0000 (11:17 +0200)]
Add vector ABI tests to gnu_vector.exp

So far the gnu_vector test was limited to "static" aspects of GDB's
vector support, like evaluating vector-valued expressions.  This patch
enriches the test and adds checks for GDB's vector ABI support as well.
The new checks particularly verify inferior function calls with vector
arguments and GDB's handling of vector return values.

The test now attempts to compile for the target's "native" architecture,
such that a hardware vector ABI is used if available.

Since GDB has no vector ABI support for x86 and x86_64 targets, most of
the new checks are KFAILed there.

gdb/testsuite/ChangeLog:

* gdb.base/gnu_vector.c: Include stdarg.h and stdio.h.
(VECTOR): New macro.  Use it...
(int4, uint4, char4, float4, int2, longlong2, float2, double2):
...for these typedefs.
(int8, char1, int1, double1): New typedefs.
(struct just_int2, struct two_int2): New structures.
(add_some_intvecs, add_many_charvecs, add_various_floatvecs)
(add_structvecs, add_singlevecs): New functions.
(main): Call add_some_intvecs twice.
* gdb.base/gnu_vector.exp: Drop GCC version check; just attempt
the compile and exit upon failure.  Try compiling for the "native"
architecture.  Test inferior function calls with vector arguments
and vector return value handling with "finish" and "return".

9 years agoAutomatic date update in version.in
GDB Administrator [Wed, 17 Jun 2015 00:00:07 +0000 (00:00 +0000)]
Automatic date update in version.in

9 years agogas: section name substitution sequence
Nicolas Pitre [Wed, 10 Jun 2015 03:06:29 +0000 (23:06 -0400)]
gas: section name substitution sequence

This patch adds the ability to automatically construct a section name
based on the prior section.

When gas is invoked with --sectname-subst, the occurrence of %S in a
section name will be substituted by the name of the current section. For
example:

.macro exception_code
.pushsection %S.exception
[exception code here]
.popsection
.endm

.text
[code]
exception_code
[...]

.section .init
[init code]
exception_code
[...]

The first and second exception_code invocations create the
.text.exception and the .init.exception sections respectively.  This is
useful e.g. to discriminate between anciliary sections that are tied to
.init code and can be discarded at run time when initialization is over
vs anciliary sections tied to .text sections that need to stay resident.

* as.c (show_usage): Document --sectname-subst.
(parse_args): Add --sectname-subst.
* as.h (flag_sectname_subst): New.
* config/obj-elf.c (obj_elf_section_name): Add %S substitution.
* doc/as.texinfo: Document it.

9 years agoGDB Namespaces - Define MSG_CMSG_CLOEXEC if not defined.
Michael Eager [Tue, 16 Jun 2015 14:18:03 +0000 (07:18 -0700)]
GDB Namespaces - Define MSG_CMSG_CLOEXEC if not defined.

2015-06-16  Michael Eager  <eager@eagercon.com>

* nat/linux-namespaces.c (MSG_CMSG_CLOEXEC): Define if not defined.

9 years agoCall target_terminal_ours_for_output() before refreshing TUI's frame info
Patrick Palka [Tue, 2 Jun 2015 01:30:50 +0000 (21:30 -0400)]
Call target_terminal_ours_for_output() before refreshing TUI's frame info

In some cases tui_show_frame_info() may get called while the inferior's
terminal settings are still in effect.  But when we call this function
we absolutely need to have our terminal settings in effect because the
function is responsible for redrawing TUI's windows following a change
in the selected frame or a change in the PC.  If our terminal settings
are not in effect, the screen does not get redrawn properly, causing
temporary display artifacts (which can be fixed via ^L).

This scenario happens most prominently when stepping through a program
in TUI while a watchpoint is in effect.

Here is an example backtrace for when tui_show_frame_info() gets called
while target_terminal_is_inferior() == 1:

  #1  0x00000000004988ee in tui_selected_frame_level_changed_hook (level=0)
  #2  0x0000000000617b99 in select_frame (fi=0x18c9820)
  #3  0x0000000000617c3f in get_selected_frame (message=message@entry=0x0)
  #4  0x00000000004ce534 in update_watchpoint (b=b@entry=0x2d9a760,
      reparse=reparse@entry=0)
  #5  0x00000000004d625e in insert_breakpoints ()
  #6  0x0000000000531cfe in keep_going (ecs=ecs@entry=0x7ffea7884ac0)
  #7  0x00000000005326d7 in process_event_stop_test (ecs=ecs@entry=0x7ffea7884ac0)
  #8  0x000000000053596e in handle_inferior_event_1 (ecs=0x7ffea7884ac0)

The fix is simple: call target_terminal_ours_for_output() before calling
tui_show_frame_info() in TUI's frame-changed hook, making sure to
restore the original terminal settings afterwards.

gdb/ChangeLog:

* tui/tui-hooks.c (tui_selected_frame_level_changed_hook): Call
target_terminal_ours_for_output() before calling
tui_show_frame_info(), and restore the original terminal
settings afterwards.

9 years ago[AArch64] Support id_mmfr4 system register
Matthew Wahab [Tue, 16 Jun 2015 13:15:54 +0000 (14:15 +0100)]
[AArch64] Support id_mmfr4 system register

2015-06-16  Matthew Wahab  <matthew.wahab@arm.com>
opcodes/
  * aarch64-opc.c (aarch64_sys_regs): Add "id_mmfr4_el1".

gas/testsuite
  * sysreg.d: Add id_mmfr4_el1, update expected output.
  * sysreg.s: Add id_mmfr4_el1.

9 years agoFix build when size_t is not available in bfd-in2.h
Jon Turney [Mon, 15 Jun 2015 18:20:02 +0000 (19:20 +0100)]
Fix build when size_t is not available in bfd-in2.h

bfd/ChangeLog:

2015-06-15  Jon Turney  <jon.turney@dronecode.org.uk>

* bfd.c: Change struct bfd_build_id to use bfd_size_type.
* bfd-in2.h : Regenerate.

9 years agoFixes a compile time warnng about left shifting a negative value.
Szabolcs Nagy [Tue, 16 Jun 2015 12:35:33 +0000 (13:35 +0100)]
Fixes a compile time warnng about left shifting a negative value.

* arm-dis.c (print_insn_coprocessor): Avoid negative shift.

9 years agoFix compilation of gdb/arm-linux-nat.c on Raspbian GNU/Linux 7
Martin Simmons [Tue, 16 Jun 2015 08:32:47 +0000 (09:32 +0100)]
Fix compilation of gdb/arm-linux-nat.c on Raspbian GNU/Linux 7

GDB trunk fails to compile on Raspbian GNU/Linux 7 because
PTRACE_GETREGSET and PTRACE_SETREGSET are not defined in sys/ptrace.h.

gcc -g -O2   -I. -I. -I./common -I./config -DLOCALEDIR="\"/usr/local/share/locale\"" -DHAVE_CONFIG_H -I./../include/opcode -I./../opcodes/.. -I./../readline/.. -I./../zlib -I../bfd -I./../bfd -I./../include -I../libdecnumber -I./../libdecnumber  -I./gnulib/import -Ibuild-gnulib/import   -DTUI=1  -Wall -Wpointer-arith -Wno-unused -Wunused-value -Wunused-function -Wno-switch -Wno-char-subscripts -Wempty-body -Wpointer-sign -Wmissing-prototypes -Wdeclaration-after-statement -Wmissing-parameter-type -Wold-style-declaration -Wold-style-definition -Wformat-nonliteral -Werror -c -o arm-linux-nat.o -MT arm-linux-nat.o -MMD -MP -MF .deps/arm-linux-nat.Tpo arm-linux-nat.c
arm-linux-nat.c: In function 'fetch_fpregister':
arm-linux-nat.c:103:21: error: 'PTRACE_GETREGSET' undeclared (first use in this function)
arm-linux-nat.c:103:21: note: each undeclared identifier is reported only once for each function it appears in
arm-linux-nat.c: In function 'fetch_fpregs':
arm-linux-nat.c:144:21: error: 'PTRACE_GETREGSET' undeclared (first use in this function)
arm-linux-nat.c: In function 'store_fpregister':
arm-linux-nat.c:184:21: error: 'PTRACE_GETREGSET' undeclared (first use in this function)
arm-linux-nat.c:211:21: error: 'PTRACE_SETREGSET' undeclared (first use in this function)
...

This patch includes the gdb header file nat/linux-ptrace.h, which provides
fallback definitions.

2015-06-16  Martin Simmons  <martin@lispworks.com>  (tiny patch)

* arm-linux-nat.c: Include nat/linux-ptrace.h.

9 years agoppc476 linker workaround shared lib fixes again
Alan Modra [Tue, 16 Jun 2015 07:17:51 +0000 (16:47 +0930)]
ppc476 linker workaround shared lib fixes again

Huh, I can't even write a binary search properly.

bfd/
* elf32-ppc.c (ppc_elf_relocate_section): Correct binary search of
dynamic relocs.
ld/testsuite/
* ld-powerpc/ppc476-shared.s: Repeat dynamic reloc generating insns.
* ld-powerpc/ppc476-shared.d: Update.
* ld-powerpc/ppc476-shared2.d: Update.

9 years agoAutomatic date update in version.in
GDB Administrator [Tue, 16 Jun 2015 00:00:08 +0000 (00:00 +0000)]
Automatic date update in version.in

9 years agoMI: consider addressable unit size when reading/writing memory
Simon Marchi [Mon, 15 Jun 2015 19:50:31 +0000 (15:50 -0400)]
MI: consider addressable unit size when reading/writing memory

As a user of the target memory read/write interface, the MI code must
adjust its memory allocations to take into account the addressable memory
unitsize of the target.

gdb/ChangeLog:

mi/mi-main.c (mi_cmd_data_read_memory_bytes): Consider byte
size.
(mi_cmd_data_write_memory_bytes): Same.

9 years agoClarify doc about memory read/write and non-8-bits addressable memory unit sizes
Simon Marchi [Mon, 15 Jun 2015 19:31:00 +0000 (15:31 -0400)]
Clarify doc about memory read/write and non-8-bits addressable memory unit sizes

New in v3:

 * Change RSP documentation as well. The m, M and X packets now use
 lengths in addressable memory units.

New in v2:

 * Change wording: use byte for 8-bits chunks and addressable memory unit
   for the unit of data associated to a single address.
 * Introduce definition of addressable memory unit in the Memory
   section.

This patch modifies the manual to clarify the MI, RSP and Python APIs in
regard to reading/writing memory on architectures with addressable
memory unit that are not 8 bits.

Care is taken to use the word "addressable memory unit" or "memory unit"
when referring to one piece of the smallest addressable size on the
current architecture and the word "byte" when referring to an 8-bits
data piece.

For MI, -data-{read,write}-memory are not modified, since they are
deprecated.

gdb/doc/ChangeLog:

* gdb.texinfo (GDB/MI Data Manipulation): Clarify usage of
bytes and memory units for -data-{read,write}-memory-bytes.
(Packets): Same for m, M and X packets.
* python.texi (Inferiors In Python): Same for read_memory and
write_memory.

9 years agoCleanup write_memory doc
Simon Marchi [Mon, 15 Jun 2015 17:34:47 +0000 (13:34 -0400)]
Cleanup write_memory doc

This doc about write_memory seems outdated.

gdb/ChangeLog:

* corefile.c (write_memory): Update doc.
* gdbcore.h (write_memory): Same.

9 years agoCode cleanup: Rename enum -> enum filterflags
Jan Kratochvil [Mon, 15 Jun 2015 15:10:44 +0000 (17:10 +0200)]
Code cleanup: Rename enum -> enum filterflags

Bit mask ints are better to make enums as GDB already has support to
automatically decode them:

before this patch:
(gdb) p filterflags
$1 = 51
(gdb) p/x filterflags
$2 = 0x33

after this patch:
(gdb) p filterflags
$1 = (COREFILTER_ANON_PRIVATE | COREFILTER_ANON_SHARED | COREFILTER_ELF_HEADERS | COREFILTER_HUGETLB_PRIVATE)

gdb/ChangeLog
2015-06-15  Jan Kratochvil  <jan.kratochvil@redhat.com>

* linux-tdep.c (enum filterflags): Make it from anonymous enum.
(dump_mapping_p): Use it for parameter filterflags.
(linux_find_memory_regions_full): Use it for variable filterflags.

9 years agoMerge multiple hex conversions
Jan Kratochvil [Mon, 15 Jun 2015 15:08:49 +0000 (17:08 +0200)]
Merge multiple hex conversions

gdb/ChangeLog
2015-06-15  Aleksandar Ristovski  <aristovski@qnx.com
    Jan Kratochvil  <jan.kratochvil@redhat.com>

Merge multiple hex conversions.
* monitor.c: Include rsp-low.h.
(fromhex): Remove definition.

gdb/gdbserver/ChangeLog
2015-06-15  Aleksandar Ristovski  <aristovski@qnx.com
    Jan Kratochvil  <jan.kratochvil@redhat.com>

Merge multiple hex conversions.
* gdbreplay.c (tohex): Rename to 'fromhex'.
(logchar): Use fromhex.

9 years agoMove utility functions to common/
Jan Kratochvil [Mon, 15 Jun 2015 15:04:56 +0000 (17:04 +0200)]
Move utility functions to common/

gdb/ChangeLog
2015-06-15  Aleksandar Ristovski  <aristovski@qnx.com
    Jan Kratochvil  <jan.kratochvil@redhat.com>

Move utility functions to common/.
* cli/cli-utils.c (skip_spaces, skip_spaces_const, skip_to_space_const):
Move defs to common/common-utils.c.
* cli/cli-utils.h (skip_spaces, skip_spaces_const, skip_to_space)
(skip_to_space_const): Move decls to common/common-utils.h.
* common/common-defs.h: Move include of common-types.h before
common-utils.h.
* common/common-utils.c: Include host-defs.h and ctype.h.
(HIGH_BYTE_POSN, is_digit_in_base, digit_to_int, strtoulst): Move
from utils.c.
(skip_spaces, skip_spaces_const, skip_to_space_const): Move from
cli/cli-utils.c.
* common/common-utils.h (strtoulst): Move decl from utils.h.
(skip_spaces, skip_spaces_const, skip_to_space, skip_to_space_const):
Move from cli/cli-utils.h.
* common/host-defs.h: Include limits.h.
(TARGET_CHAR_BIT, HOST_CHAR_BIT): Moved from defs.h.
(skip_spaces, skip_spaces_const): Move decls from cli/cli-utils.h.
* defs.h (TARGET_CHAR_BIT, HOST_CHAR_BIT): Move to
common/common-utils.h.
* utils.c (HIGH_BYTE_POSN, is_digit_in_base, digit_to_int)
(strtoulst): Move to common/common-utils.c.
* utils.h (strtoulst): Moved decl to common/common-utils.h.

9 years agoCopy aarch64-linux.xml to build tree.
Yao Qi [Mon, 15 Jun 2015 11:41:09 +0000 (12:41 +0100)]
Copy aarch64-linux.xml to build tree.

This patch fixes a bug that aarch64-linux.xml isn't copied to the
build tree, so that some tests catch-syscall.exp fail.

gdb:

2015-06-15  Yao Qi  <yao.qi@linaro.org>

* data-directory/Makefile.in (SYSCALLS_FILES): Add aarch64-linux.xml.

9 years agoFix ChangeLog entry.
Ulrich Weigand [Mon, 15 Jun 2015 11:49:43 +0000 (13:49 +0200)]
Fix ChangeLog entry.

9 years agoAllow gdb to find debug symbols file by build-id for PE file format also
Jon Turney [Tue, 7 Apr 2015 19:49:08 +0000 (20:49 +0100)]
Allow gdb to find debug symbols file by build-id for PE file format also

This promotes BFD's struct elf_build_id to the generic struct bfd_build_id,
populated when an ELF or PE BFD is read.

gdb is updated to use that, and to use the build-id to find symbols for PE files
also.

There is currently no generic way to extract the build-id from an object file,
perhaps an option to objdump to do this might make sense?

On x86_64-pc-cygwin, gdb's sepdebug.exp changes:

-# of unsupported tests          1
+# of expected passes            90

I don't seem to get consistent testsuite runs on i686-linux-gnu, but there
don't appear to be any regressions.

bfd/ChangeLog:

2015-06-10  Jon Turney  <jon.turney@dronecode.org.uk>

* elf-bfd.h : Remove struct elf_build_id.
* bfd.c : Add struct bfd_build_id.
* bfd-in2.h: Regenerate.
* elf.c (elfobj_grok_gnu_build_id): Update to use bfd_build_id.
* libpei.h: Add protoype and macros for
bfd_XXi_slurp_codeview_record.
* peXXigen.c (_bfd_XXi_slurp_codeview_record): Make public
* peicode.h (pe_bfd_read_buildid): Add.
(pe_bfd_object_p): Use pe_bfd_read_buildid().

gdb/ChangeLog:

2015-06-10  Jon Turney  <jon.turney@dronecode.org.uk>

* build-id.c: Don't include elf-bfd.h.
(build_id_bfd_get): Use bfd_build_id.
(build_id_verify): Ditto.
* build-id.h: Ditto.
(find_separate_debug_file_by_buildid): Ditto.
* python/py-objfile.c: Don't include elf-bfd.h.
(objfpy_get_build_id) Use bfd_build_id.
(objfpy_build_id_matches, objfpy_lookup_objfile_by_build_id): Ditto.
* coffread.c: Include build-id.h.
(coff_symfile_read): Try find_separate_debug_file_by_buildid.

gdb/doc/ChangeLog:

2015-06-10  Jon Turney  <jon.turney@dronecode.org.uk>

* gdb.texinfo (Separate Debug Files): Document that PE is also
supported.

gdb/testsuite/ChangeLog:

2015-06-10  Jon Turney  <jon.turney@dronecode.org.uk>

* gdb.base/sepdebug.exp: Add EXEEXT where needed.
* lib/gdb.exp (get_build_id): Teach how to extract build-id from a
PE file.
* lib/future.exp (gdb_find_objdump): Add gdb_find_objdump.

Signed-off-by: Jon Turney <jon.turney@dronecode.org.uk>
9 years agowindows-nat: Replace __COPY_CONTEXT_SIZE conditional with __CYGWIN__
Jon Turney [Wed, 3 Jun 2015 12:58:45 +0000 (13:58 +0100)]
windows-nat: Replace __COPY_CONTEXT_SIZE conditional with __CYGWIN__

Replace __COPY_CONTEXT_SIZE conditional with __CYGWIN__

__COPY_CONTEXT_SIZE was added to Cygwin's headers in 2006.

Versions of Cygwin which don't define __COPY_CONTEXT_SIZE are long obsolete.

Also see the thread starting at
https://sourceware.org/ml/gdb-patches/2015-03/msg00989.html for some discussion

Note that __COPY_CONTEXT_SIZE should just be sizeof(CONTEXT) (which is a
platform constant), but isn't due to historical mistakes in Cygwin headers.

gdb/ChangeLog:

2015-06-03  Jon Turney  <jon.turney@dronecode.org.uk>

* windows-nat.c (do_windows_fetch_inferior_registers)
(handle_output_debug_string): Replace __COPY_CONTEXT_SIZE
conditional with __CYGWIN__.

Signed-off-by: Jon Turney <jon.turney@dronecode.org.uk>
9 years ago[AArch64] Gas add BFD_RELOC_AARCH64_LD64_GOTOFF_LO15 support
Renlin Li [Mon, 15 Jun 2015 10:07:37 +0000 (11:07 +0100)]
[AArch64] Gas add BFD_RELOC_AARCH64_LD64_GOTOFF_LO15 support

2015-06-15  Renlin Li <renlin.li@arm.com>
bfd/
    * reloc.c (BFD_RELOC_AARCH64_LD64_GOTOFF_LO15): New entry.
    * elfnn-aarch64.c (elfNN_aarch64_howto_table): New entry for
    BFD_RELOC_AARCH64_LD64_GOTOFF_LO15.
    * bfd-in2.h: Regenerate.
    * libbfd.h: Regenerate.

gas/
    * config/tc-aarch64.c (reloc_table): New relocation modifier.
    (md_apply_fix): Support BFD_RELOC_AARCH64_LD64_GOTOFF_LO15.
    (aarch64_force_relocation): Ditto

gas/testsuite/
    * gas/aarch64/reloc-insn.s: Update test
    * gas/aarch64/reloc-insn.d: Update expected result.

9 years agoFix a segmentation fault triggered when trying to handle an unresolved PE symbol...
Nick Clifton [Mon, 15 Jun 2015 08:25:26 +0000 (09:25 +0100)]
Fix a segmentation fault triggered when trying to handle an unresolved PE symbol with a very long name.

PR ld/18466
* emultempl/pe.em (pe_find_data_imports): Generate an error if a
symbol name is too long to handle.
* emultempl/pep.em (pep_find_data_imports): Likewise.

9 years agogas: Don't use frag_align but use plain padding to align .debug_aranges.
Mark Wielaard [Sat, 13 Jun 2015 21:47:41 +0000 (17:47 -0400)]
gas: Don't use frag_align but use plain padding to align .debug_aranges.

out_debug_aranges uses frag_align to make sure the addresses start
out aligned. Using frag_align will call frag_var[_init], which will
end up calling TC_FRAG_INIT. On arm and aarch64 TC_FRAG_INIT will
generate a $d mapping symbol for the .debug_aranges to show that at
that point a sequence of data items starts.

Such a symbol pointing into a non-allocated debug section will confuse
eu-strip -g. And it seems inefficient and wrong in general to have
additional mapping symbols for debug sections, which won't contain
actual code in the first place.

Just keep track of the aranges header size and use plain padding to
align the addresses which avoids generating any mapping symbols on
aarch64 and arm.

Includes a testcase for aarch64 that PASS with this patch and shows
the extra $d mapping symbol in .debug_aranges before.

gas/ChangeLog

       * dwarf2dbg.c (out_header): Document EXPR->X_add_number value,
       out_debug_aranges depends on it.
       (out_debug_aranges): Track size of header to properly pad header
       for address alignment.

gas/testsuite/ChangeLog

       * gas/aarch64/dwarf.d: New.
       * gas/aarch64/dwarf.s: New.

9 years agoDJGPP port of binutils broken due to 64 bit cygwin fix
Alan Modra [Tue, 9 Jun 2015 04:44:41 +0000 (14:14 +0930)]
DJGPP port of binutils broken due to 64 bit cygwin fix

* cofflink.c (_bfd_coff_generic_relocate_section): Revert
2014-03-26 change.  Call _bfd_clear_contents for relocs against
local and global symbols defined in discarded input sections.

9 years agoAutomatic date update in version.in
GDB Administrator [Mon, 15 Jun 2015 00:00:08 +0000 (00:00 +0000)]
Automatic date update in version.in

9 years agoAutomatic date update in version.in
GDB Administrator [Sun, 14 Jun 2015 00:00:08 +0000 (00:00 +0000)]
Automatic date update in version.in

9 years agogdb: Rework command completion on 'tui reg'.
Andrew Burgess [Tue, 26 May 2015 22:23:23 +0000 (23:23 +0100)]
gdb: Rework command completion on 'tui reg'.

We previously specified a few known register groups for the 'tui reg'
command.  Other register groups could be accessed, but only by using the
'tui reg next' command and cycling through all the groups.

This commit removes the hard coded sub-commands of 'tui reg' and instead
adds dynamic completion of sub-commands based on the architecturally
defined register groups, giving immediate access to all available
register groups.

There is still the 'next' and 'prev' commands for cycling through the
register groups if that's wanted.

The new code maintains the ability to only enter partial names for
register groups, which is something we got for free when using the
standard sub-command mechanism.

The register (and register group) completer has been changed to use
get_current_arch rather than using the architecture of the currently
selected frame.  When the target is running, this is equivalent,
however, when the target is not running, using get_current_arch will
provide results from the default architecture.

gdb/ChangeLog:

* completer.c: Add arch-utils.h include.
(enum reg_completer_targets): New enum.
(reg_or_group_completer_1): New function containing old
reg_or_group_completer, add and use new parameter to control what
is completed on.  Use get_current_arch rather than architecture of
currently selected frame.
(reg_or_group_completer): Call new reg_or_group_completer_1.
(reggroup_completer): Call new reg_or_group_completer_1.
* completer.h (reggroup_completer): Add declaration.
* tui/tui-regs.c: Add 'completer.h' include.
(tui_reg_next_command): Renamed to...
(tui_reg_next): ...this.  Adjust parameters and return rather than
display new group.
(tui_reg_prev_command): Renamed to...
(tui_reg_prev): ...this.  Adjust parameters and return rather than
display new group.
(tui_reg_float_command): Delete.
(tui_reg_general_command): Delete.
(tui_reg_system_command): Delete.
(tui_reg_command): Rewrite to perform switching of register group.
Add header comment.
(tuireglist): Remove.
(tui_reggroup_completer): New function.
(_initialize_tui_regs): Remove 'tui reg' sub-commands, update
creation of 'tui reg' command.
* NEWS: Add comment about 'tui reg' changes.

gdb/doc/ChangeLog:

* gdb.texinfo (TUI Commands): Bring all 'tui reg' commands into a
single table entry.

9 years agoAutomatic date update in version.in
GDB Administrator [Sat, 13 Jun 2015 00:00:08 +0000 (00:00 +0000)]
Automatic date update in version.in

9 years ago[gold][aarch64] Fix erratum 835769.
Han Shen [Wed, 10 Jun 2015 21:50:26 +0000 (14:50 -0700)]
[gold][aarch64] Fix erratum 835769.

gold/ChangeLog:

* aarch64.cc (AArch64_insn_utilities::BYTES_PER_INSN): Move
defintion outside class definition.
(AArch64_insn_utilities::AARCH64_ZR): New static constant.
(AArch64_insn_utilities::aarch64_op31): New member.
(AArch64_insn_utilities::aarch64_ra): New member.
(AArch64_insn_utilities::aarch64_mac): New member.
(AArch64_insn_utilities::aarch64_mlxl): New member.
(ST_E_835769): New global enum member.
(Stub_table::relocate_stubs): Add 835769 handler.
(Stub_template_repertoire::Stub_template_repertoire): Install new
stub type.
(AArch64_relobj::scan_errata): This func is renamed from
scan_erratum_843419.
(AArch64_relobj::do_count_local_symbols): Add 835769 handler.
(AArch64_relobj::do_relocate_sections): Add 835769 handler.
(AArch64_relobj::scan_sections_for_stubs): Add 835769 handler.
(Target_aarch64::scan_erratum_835769_span): New method.
(Target_aarch64::create_erratum_stub): New method.
(Target_aarch64::is_erratum_835769_sequence): New method.
(Target_aarch64::scan_erratum_843419_sequence): Move part of the
code into create_erratum_stub.
* options.h (fix_cortex_a53_835769): New option.

9 years agotarget: consider addressable unit size when reading/writing memory
Simon Marchi [Fri, 12 Jun 2015 21:02:44 +0000 (17:02 -0400)]
target: consider addressable unit size when reading/writing memory

If we are reading/writing from a memory object, the length represents
the number of "addresses" to read/write, so the addressable unit size
needs to be taken into account when allocating memory on gdb's side.

gdb/ChangeLog:

* target.c (target_read): Consider addressable unit size when
reading from a memory object.
(read_memory_robust): Same.
(read_whatever_is_readable): Same.
(target_write_with_progress): Consider addressable unit size
when writing to a memory object.
* target.h (target_read): Update documentation.
(target_write): Add documentation.

9 years agogdbarch: add addressable_memory_unit_size method
Simon Marchi [Fri, 12 Jun 2015 20:51:51 +0000 (16:51 -0400)]
gdbarch: add addressable_memory_unit_size method

Add a new gdbarch method to get the length of an addressable memory unit
for a given architecture. The default implementation returns 1.

gdb/ChangeLog:

* arch-utils.h (default_addressable_memory_unit_size): New.
* arch-utils.c (default_addressable_memory_unit_size): New.
* gdbarch.sh (addressable_memory_unit_size): New.
* gdbarch.h: Re-generate.
* gdbarch.c: Re-generate.

9 years agoRemove unused MTMSRD_L macro and re-add accidentally deleted comment.
Peter Bergner [Fri, 12 Jun 2015 20:06:07 +0000 (15:06 -0500)]
Remove unused MTMSRD_L macro and re-add accidentally deleted comment.

In the commit that added PowerPC Pair Singles, Ben accidentally removed
a comment and re-added an unused MTMSRD_L macro Alan had recently deleted.
This was probably just an oversite when he was refreshing his patch to
trunk.

opcodes/
* ppc-opc.c: Add comment accidentally removed by old commit.
(MTMSRD_L): Delete.

9 years agoVarious cleanups in target read/write code
Simon Marchi [Fri, 12 Jun 2015 17:08:12 +0000 (13:08 -0400)]
Various cleanups in target read/write code

This contains various cleanups in the target memory read and write code.
They are not directly related to the non-8-bits changes, but they
clarify things a bit down the line.

gdb/ChangeLog:

* target.c (target_read): Rename variables and use
TARGET_XFER_E_IO.
(target_read_with_progress): Same.
(read_memory_robust): Constify parameters and rename
variables.
(read_whatever_is_readable): Constify parameters,
rename variables, adjust formatting.
* target.h (read_memory_robust): Constify parameters.

9 years agosim: bfin: expand CB_SYS_xxx comment
Mike Frysinger [Fri, 12 Jun 2015 16:12:52 +0000 (12:12 -0400)]
sim: bfin: expand CB_SYS_xxx comment

9 years agosim: update configure.in->configure.ac docs
Mike Frysinger [Fri, 12 Jun 2015 16:04:42 +0000 (12:04 -0400)]
sim: update configure.in->configure.ac docs

A few places still refer to the configure.in file; update them.

9 years agoppc64: Handle short vectors as function return types
Ulrich Weigand [Fri, 12 Jun 2015 15:43:48 +0000 (17:43 +0200)]
ppc64: Handle short vectors as function return types

Short synthetic vector types (i.e. those defined using GCC's
attribute ((vector_size)) instead of AltiVec vector types)
are returned in r3.  Fix ppc64_sysv_abi_return_value to
correctly handle this.

gdb/ChangeLog:

* ppc-sysv-tdep.c (ppc64_sysv_abi_return_value_base): Handle short
synthetic (non-AltiVec) vector types.
(ppc64_sysv_abi_return_value): Likewise.

9 years agosim: drop -DTRACE from configure
Mike Frysinger [Fri, 12 Jun 2015 14:32:54 +0000 (10:32 -0400)]
sim: drop -DTRACE from configure

No code uses this anymore and the symbol conflicts with the new TRACE
helper.  Punt it from configure.

9 years agosim: msp430: use new common trace print helpers
Mike Frysinger [Fri, 12 Jun 2015 14:07:55 +0000 (19:52 +0545)]
sim: msp430: use new common trace print helpers

Replace the "if (TRACE_xxx_P) trace_generic" form with "TRACE_xxx".
The output is the same, but the code is nicer to read.

9 years agoFix MI dprintf-insert not printing on a resolved pending location.
Antoine Tremblay [Fri, 12 Jun 2015 11:58:47 +0000 (07:58 -0400)]
Fix MI dprintf-insert not printing on a resolved pending location.

This patch fixes the "Format string required" error when trying to print
a dprintf on a now resolved, pending location when set via the MI interface
even if the format string is entered correctly.

This patch also adds a test case to check that issue called
mi-dprintf-pending.exp.

gdb/ChangeLog:

PR breakpoints/16465
* breakpoint.c (create_breakpoint): Save extra_string for
pending breakpoints.

gdb/testsuite/ChangeLog:

PR breakpoints/16465
* gdb.mi/mi-dprintf-pending.c: New file.
* gdb.mi/mi-dprintf-pending.exp: New test.
* gdb.mi/mi-dprintf-pendshr.c: New file.

9 years agosim: moxie: use new common trace defines
Mike Frysinger [Fri, 12 Jun 2015 09:53:03 +0000 (15:38 +0545)]
sim: moxie: use new common trace defines

Now that there's common helpers for printing trace data, switch to that
to restore the insn tracing support for this target.

9 years agosim: trace: add common macros for logging info
Mike Frysinger [Thu, 11 Jun 2015 10:28:25 +0000 (18:28 +0800)]
sim: trace: add common macros for logging info

The Blackfin port had some TRACE_xxx macros for easily logging trace data.
Use these as a base for common ones that have a simple form and match the
existing sets of helper macros.

9 years agosim: mips: switch to common WITH_TRACE_ANY_P
Mike Frysinger [Fri, 12 Jun 2015 10:06:35 +0000 (15:51 +0545)]
sim: mips: switch to common WITH_TRACE_ANY_P

We want to add new common trace helpers including "TRACE", so change the
mips one to the new WITH_TRACE_ANY_P macro since they do the same thing.

9 years agosim: trace: add WITH_TRACE_ANY_P helper
Mike Frysinger [Fri, 12 Jun 2015 10:07:07 +0000 (15:52 +0545)]
sim: trace: add WITH_TRACE_ANY_P helper

We have STRACE_ANY_P and TRACE_ANY_P, so add WITH_TRACE_ANY_P to fill
out the API.  This lets us wrap the internal configure symbol.

9 years agosim: moxie: rename TRACE to MOXIE_TRACE_INSN
Mike Frysinger [Fri, 12 Jun 2015 09:51:32 +0000 (15:36 +0545)]
sim: moxie: rename TRACE to MOXIE_TRACE_INSN

We want to add new common trace helpers including "TRACE", so rename the
moxie one to MOXIE_TRACE_INSN.  This also matches what the code is doing.

9 years agoAdd new ld option: --print-memory-usage
Tristan Gingold [Fri, 5 Jun 2015 13:09:31 +0000 (15:09 +0200)]
Add new ld option: --print-memory-usage

ld/
* NEWS: Mention new option.
* lexsup.c (parse_args): Handle --print-memory-usage.
(ld_options): Add --print-memory-usage.
* ldmain.c (main): Call lang_print_memory_usage.
* ldlex.h (enum option_values): Add OPTION_PRINT_MEMORY_USAGE.
* ldlang.h: Add prototype of lang_print_memory_usage.
* ldlang.c (lang_print_memory_size, lang_print_memory_usage): New
functions.
* ld.texinfo (Options): Document --print-memory-usage.
* ld.h (args_type): Add print_memory_usage field.

ld/testsuite/
* ld-scripts/print-memory-usage-1.t,
* ld-scripts/print-memory-usage-1.s,
* ld-scripts/print-memory-usage-1.l,
* ld-scripts/print-memory-usage-2.t,
* ld-scripts/print-memory-usage-2.l,
* ld-scripts/print-memory-usage-3.s,
* ld-scripts/print-memory-usage-3.t,
* ld-scripts/print-memory-usage-3.l,
* ld-scripts/print-memory-usage.t: New tests.
* ld-scripts/print-memory-usage.exp: Run them.

9 years agosim: cgen: namespace custom trace functions
Mike Frysinger [Fri, 12 Jun 2015 07:44:02 +0000 (13:29 +0545)]
sim: cgen: namespace custom trace functions

The cgen code declares some macros/funcs using the trace_xxx prefix, but
the code isn't generic and only works with cgen targets.  This is blocking
the creation of new common trace functions.

Let's blindly add cgen_xxx prefixes to all these symbols.  Some already
use this convention to avoid conflicts, so it makes sense to align them.
In the future we might want to move some to the common trace core, but
one thing at a time.

9 years agoFix broken GDB build after adding Bound table support for i386.
Walfred Tedeschi [Fri, 12 Jun 2015 07:42:16 +0000 (09:42 +0200)]
Fix broken GDB build after adding Bound table support for i386.

Types used for some variables could not be used for 32 bits, causing a
compilation failure.
This patch adds a cast to force a quite compilation, but at the same
time it bails out in the case that the cast performed is not safe, i.e.
in the case where the debuggee is 64bit and debugger is 32bit.

Documentation was also affected, once a different version of texinfo the
docs could not be build.

2015-06-10  Walfred Tedeschi  <walfred.tedeschi@intel.com>

* i386-tdep.c (i386_mpx_get_bt_entry): Add a cast for mpx_bd_mask
and bt_mask to CORE_ADDR.

doc:
* gdb.textinfo (i386): Fix "@end table" end and "@table" placement.

9 years agoAutomatic date update in version.in
GDB Administrator [Fri, 12 Jun 2015 00:00:07 +0000 (00:00 +0000)]
Automatic date update in version.in

9 years agotc-hppa.c: Speed up search for last label
John David Anglin [Thu, 11 Jun 2015 22:50:39 +0000 (18:50 -0400)]
tc-hppa.c: Speed up search for last label

9 years agoFix gold build error at -O0.
Cary Coutant [Thu, 11 Jun 2015 20:19:38 +0000 (13:19 -0700)]
Fix gold build error at -O0.

In aarch64.cc, Erratum_stub::STUB_ADDR_ALIGN and Reloc_stub::STUB_ADDR_ALIGN
are declared as static const int, and initialized in the class body. These
values are referenced from outside the class body, and with no optimization,
the references go unresolved.

gold/
* aarch64.cc (Erratum_stub::STUB_ADDR_ALIGN): Move initialization
outside class body.
(Reloc_stub::STUB_ADDR_ALIGN): Likewise.

9 years agoFix bug where SECTIONS clause does not handle compressed debug sections.
Cary Coutant [Thu, 11 Jun 2015 17:17:04 +0000 (10:17 -0700)]
Fix bug where SECTIONS clause does not handle compressed debug sections.

When laying out .debug_* sections, we translate the names of compressed
debug sections that start with ".zdebug", but when processing input
section specs in a linker script, we do not handle the translation there.
This results in an internal error as reported in PR 17731.

gold/
PR gold/17731
* layout.cc (corresponding_uncompressed_section_name): New function.
(Layout::choose_output_section): Call it.
* layout.h (corresponding_uncompressed_section_name): New function.
* script-sections.cc (Input_section_info::set_section_name): Check
for compressed debug section (.zdebug style).

9 years agoFix broken gold/testsuite/script_test_12 in some setup.
Jing Yu [Thu, 11 Jun 2015 19:41:36 +0000 (12:41 -0700)]
Fix broken gold/testsuite/script_test_12 in some setup.

This patch adds -O0 to gold script_test_12 test, hoping that compiler
won't change the order of globel variables that the test assumes.

Changelog:
testsuite/Makefile.am: Add -O0 to compile script_test_12 test.
testsuite/Makefile.in: Regenerate.

9 years agosim: msp430: delete unused trace macros
Mike Frysinger [Thu, 11 Jun 2015 16:08:11 +0000 (21:53 +0545)]
sim: msp430: delete unused trace macros

These macros were copied from the Blackfin port but never used, so delete
them as part of the trace unification work.

9 years agosim: trace: centralize the system tracing
Mike Frysinger [Wed, 10 Jun 2015 10:02:52 +0000 (18:02 +0800)]
sim: trace: centralize the system tracing

First we convert the ETRACE_P to STRACE_EVENTS_P.  This means we move from
using the sim_events.trace storage to the common sim_state_base.trace_data
array.  With that deleted, the common trace init code can be simplified so
the sim state works the same as the sim cpu.

9 years agosim: trace: add STRACE_xxx_P macros
Mike Frysinger [Wed, 10 Jun 2015 10:00:09 +0000 (18:00 +0800)]
sim: trace: add STRACE_xxx_P macros

These are the parallel to the TRACE_xxx_P macros and fill out the full
set to match the existing debug one.

9 years agosim: trace: use existing defines for the useful mask
Mike Frysinger [Wed, 10 Jun 2015 08:01:29 +0000 (16:01 +0800)]
sim: trace: use existing defines for the useful mask

No point in duplicating the shift logic when we have macros already to
keep that all unified.

9 years agosim: trace: create a common WITH_TRACE_P macro
Mike Frysinger [Wed, 10 Jun 2015 07:58:03 +0000 (15:58 +0800)]
sim: trace: create a common WITH_TRACE_P macro

This way we can use the IDX macros everywhere and not worry about the
encoding of the WITH_TRACE define in multiple places.

9 years agosim: frv: drop custom debug mask
Mike Frysinger [Wed, 10 Jun 2015 07:54:16 +0000 (15:54 +0800)]
sim: frv: drop custom debug mask

This is the only sim that sets up its own WITH_TRACE mask and it conflicts
with the user setting their own list at configure time.  Drop it to match
all the other sims.

9 years agosim: m68hc11: delete unused interrupt_names
Mike Frysinger [Tue, 9 Jun 2015 15:44:25 +0000 (23:44 +0800)]
sim: m68hc11: delete unused interrupt_names

The interrupts.c file has a static/fuller definition that is used,
so drop this copy in interp.c.

9 years agosim: m68hc11: switch to common sim_resume
Mike Frysinger [Tue, 9 Jun 2015 15:44:13 +0000 (23:44 +0800)]
sim: m68hc11: switch to common sim_resume

This code already matched the common sim reusme logic, so we can simply
drop it and pull in the common code.

9 years agosim: mn10300: delete unused memory code
Mike Frysinger [Tue, 9 Jun 2015 15:38:15 +0000 (23:38 +0800)]
sim: mn10300: delete unused memory code

Only one place used get_word/put_word, so inline the usage there.
All the rest is dead code so trim it.

9 years agoUse pulongest for printing ssize_t
Gary Benson [Thu, 11 Jun 2015 12:38:15 +0000 (13:38 +0100)]
Use pulongest for printing ssize_t

This commit changes the debug printing code in linux-namespaces.c
to use pulongest instead of "%ld".

gdb/ChangeLog:

* nat/linux-namespaces.c (mnsh_send_message): Use pulongest.
(mnsh_recv_message): Likewise.

9 years agoFix ARI new warnings introduced in i386-tdep.c.
Walfred Tedeschi [Thu, 11 Jun 2015 11:48:26 +0000 (13:48 +0200)]
Fix ARI new warnings introduced in i386-tdep.c.

1. gdb/i386-tdep.c:8720: Do not use 'long long', instead use LONGEST
gdb/i386-tdep.c:8720:  long long int size;

2. gdb/i386-tdep.c:8755: Do not use printf(%ll), instead use printf(%s,phex()) to dump a 'long long' value
gdb/i386-tdep.c:8755: ui_out_field_fmt (uiout, "size", "%lld", size);

2015-06-11  Walfred Tedeschi  <walfred.tedeschi@intel.com>

* i386-tdep.c (i386_mpx_print_bounds): use of LONGEST instead of
long long int and plongest instead of %ll.

Signed-off-by: Walfred Tedeschi <walfred.tedeschi@intel.com>
9 years agosim: mn10300: add missing static markings
Mike Frysinger [Tue, 9 Jun 2015 14:31:51 +0000 (22:31 +0800)]
sim: mn10300: add missing static markings

9 years agosim: mn10300: delete unused exception/exited/debug state
Mike Frysinger [Tue, 9 Jun 2015 14:27:09 +0000 (22:27 +0800)]
sim: mn10300: delete unused exception/exited/debug state

The syscall path was the only code checking the custom exception state
after recent cleanups.  Once we change that to the common engine halt
function, we can delete that state entirely.

This also helps highlight some other dead code that we can cull.

9 years agosim: mn10300: use common size types
Mike Frysinger [Tue, 9 Jun 2015 15:23:41 +0000 (23:23 +0800)]
sim: mn10300: use common size types

No point in open coding this logic here when we have common size types
already that give the right answer.

9 years agosim: m68hc11/mn10300/v850: delete redundant INLINE defines
Mike Frysinger [Tue, 9 Jun 2015 14:26:16 +0000 (22:26 +0800)]
sim: m68hc11/mn10300/v850: delete redundant INLINE defines

The sim-inline.h header already takes care of this for us, so punt
the local definitions.

9 years agosim: microblaze: switch to common sim_resume/sim_stop_reason
Mike Frysinger [Tue, 9 Jun 2015 08:10:49 +0000 (16:10 +0800)]
sim: microblaze: switch to common sim_resume/sim_stop_reason

This allows us to use the common code for all exception handling.

9 years agoFix ARI warning in linux-namespaces.c
Gary Benson [Thu, 11 Jun 2015 09:58:41 +0000 (10:58 +0100)]
Fix ARI warning in linux-namespaces.c

This commit fixes the following ARI warning:

  gdb/nat/linux-namespaces.c:28: regression: Do not include
  wait.h or sys/wait.h, instead include gdb_wait.h

gdb/ChangeLog:

* nat/linux-namespaces.c (gdb_wait.h): New include.
(sys/wait.h): Do not include.

9 years ago[GOLD] Fix handling of __start/__stop symbols
Davide Italiano [Sun, 31 May 2015 20:22:11 +0000 (13:22 -0700)]
[GOLD] Fix handling of __start/__stop symbols

If the section contains 'Q' in the name, is_cident() returns false,
__start and __stop symbols for the section are not generated..

* gold.h (is_cident): Correct typo.

9 years agoAutomatic date update in version.in
GDB Administrator [Thu, 11 Jun 2015 00:00:07 +0000 (00:00 +0000)]
Automatic date update in version.in

9 years agodwarf2read: call dwarf_finish_line when ending a sequence
Simon Marchi [Wed, 10 Jun 2015 20:34:16 +0000 (16:34 -0400)]
dwarf2read: call dwarf_finish_line when ending a sequence

Commit d9b3de22f33e400f7f409cce3acf6c7dab07dd79 introduced a behaviour
change where dwarf_finish_line was not called anymore when ending a
sequence of machine instructions. This patch restores the original
behaviour.

gdb/ChangeLog:

* dwarf2read.c (dwarf_record_line): Call dwarf_record_line if
 end_sequence is true.

9 years agoCode cleanup: Use explicit NULL comparison
Jan Kratochvil [Wed, 10 Jun 2015 17:37:19 +0000 (19:37 +0200)]
Code cleanup: Use explicit NULL comparison

gdb/ChangeLog
2015-06-10  Jan Kratochvil  <jan.kratochvil@redhat.com>

Code cleanup.
* solib-target.c (library_list_start_list): Use explicit NULL
comparison.

9 years agoPatch for erratum-843419 (2 of 2 - fix erratum occurrences).
Han Shen [Wed, 10 Jun 2015 16:50:22 +0000 (09:50 -0700)]
Patch for erratum-843419 (2 of 2 - fix erratum occurrences).

Now fixing for 843419 is fully functional.

The first part of the erratum fix CL is here -
https://sourceware.org/ml/binutils/2015-04/msg00229.html

gold/ChangeLog
2015-06-10  Han Shen  <shenhan@google.com>

    * aarch64.cc(global enum): New constants representing stub types.
    (Stub_template): New POD struct.
    (Stub_template_repertoire): New class.
    (Stub_base): New class.
    (Erratum_stub): New class.
    (Reloc_stub): Refactored to be a subclass of Stub_base.
    (Reloc_stub::Stub_type): Removed.
    (Reloc_stub::offset): Moved to Stub_base.
    (Reloc_stub::set_offset): Moved to Stub_base.
    (Reloc_stub::destination_address): Moved to Stub_base.
    (Reloc_stub::set_destination_address): Moved to Stub_base.
    (Reloc_stub::reset_destination_address): Moved to Stub_base.
    (Reloc_stub::stub_type): Renamed and moved to Stub_base.
    (Reloc_stub::stub_size): Renamed and moved to Stub_base.
    (Reloc_stub::stub_insns): Renamed and moved to Stub_base.
    (Reloc_stub::write): Moved to Stub_base.
    (Reloc_stub::invalid_offset): Moved to Stub_base.
    (Reloc_stub::invalid_address): Moved to Stub_base.
    (Reloc_stub::stub_type_): Renamed and moved to Stub_base.
    (Reloc_stub::stub_insns_): Moved to Stub_base.
    (Reloc_stub::offset_): Moved to Stub_base.
    (Reloc_stub::destination_address_): Moved to Stub_base.
    (Stub_table::The_aarch64_relobj): New typedef.
    (Stub_table::The_erratum_stub): New typedef.
    (Stub_table::The_erratum_stub_less): New typedef.
    (Stub_table::The_erratum_stub_set): New typedef.
    (Stub_table::The_erratum_stub_set_iter): New typedef.
    (Stub_table::empty): Added emptiness testing for erratum stubs.
    (Stub_table::add_erratum_stub): New method to add an erratum stub.
    (Stub_table::find_erratum_stub): New method.
    (Stub_table::find_erratum_stubs_for_input_section): New method.
    (Stub_table::erratum_stub_address): New method.
    (Stub_table::update_date_size_changed_p): Modified to handle erratum stubs.
    (Stub_table::do_addralign): Modified to handle erratum stubs.
    (Stub_table::erratum_stubs_): New member.
    (Stub_table::erratum_stub_size_): New member.
    (Stub_table::relocate_stubs): Modified to handle erratum stubs.
    (Stub_table::do_write): Modified to handle erratum stubs.
    (AArch64_relobj::The_erratum_stub): New typedef.
    (AArch64_relobj::Erratum_stub_set_iter): New typedef.
    (AArch64_relobj::fix_errata): New method.
    (Target_aarch64::The_reloc_stub_type): Removed.
    (Target_aarch64::The_erratum_stub): New typede.
    (AArch64_relocate_functions::construct_b): New method.

9 years agoFix gdbserver <library-list> and its #FIXED version="1.0"
Jan Kratochvil [Wed, 10 Jun 2015 16:29:05 +0000 (18:29 +0200)]
Fix gdbserver <library-list> and its #FIXED version="1.0"

While reimplementing <library-list/> I found from expat-2.0.1-11.fc15.x86_64:

warning: while parsing target library list (at line 1): Required attribute "version" of <library-list-svr4> not specified

I believe the same bug has to apply for existing FSF gdbserver but I do not
have any <library-list/> platform to test it (I did not try to build MinGW).

features/library-list.dtd:
<!ATTLIST library-list  version CDATA   #FIXED  "1.0">

http://www.xml.com/pub/a/98/10/guide0.html?page=3 says:

In this case, the attribute is not required, but if it occurs, it must
have the specified value.

Which would suggest gdbserver is right but solib-target.c is wrong.  One could
also make gdbserver explicit for the version (if those 14 bytes are not of
a concern).

gdb/ChangeLog
2015-06-10  Jan Kratochvil  <jan.kratochvil@redhat.com>

* solib-target.c (library_list_start_list): Do not dereference
variable version in its initialization.  Make the VERSION check handle
NULL.
(library_list_attributes): Make "version" GDB_XML_AF_OPTIONAL.

gdb/gdbserver/ChangeLog
2015-06-10  Jan Kratochvil  <jan.kratochvil@redhat.com>

* server.c (handle_qxfer_libraries): Set `version' attribute for
<library-list>.

9 years agoAnnounce new container-awareness features for GNU/Linux systems
Gary Benson [Wed, 10 Jun 2015 13:28:44 +0000 (14:28 +0100)]
Announce new container-awareness features for GNU/Linux systems

This commit announces the newly added ability to directly access
executable and shared library files when attaching to processes
running in containers on GNU/Linux systems.

gdb/ChangeLog:

* NEWS: Announce support for direct access of executable and
shared library files when attaching to inferiors in containers
on GNU/Linux systems.

9 years agoImplement vFile:setfs in gdbserver
Gary Benson [Wed, 10 Jun 2015 13:28:44 +0000 (14:28 +0100)]
Implement vFile:setfs in gdbserver

This commit implements the "vFile:setfs" packet in gdbserver.

gdb/gdbserver/ChangeLog:

* target.h (struct target_ops) <multifs_open>: New field.
<multifs_unlink>: Likewise.
<multifs_readlink>: Likewise.
* linux-low.c (nat/linux-namespaces.h): New include.
(linux_target_ops): Initialize the_target->multifs_open,
the_target->multifs_unlink and the_target->multifs_readlink.
* hostio.h (hostio_handle_new_gdb_connection): New declaration.
* hostio.c (hostio_fs_pid): New static variable.
(hostio_handle_new_gdb_connection): New function.
(handle_setfs): Likewise.
(handle_open): Use the_target->multifs_open as appropriate.
(handle_unlink): Use the_target->multifs_unlink as appropriate.
(handle_readlink): Use the_target->multifs_readlink as
appropriate.
(handle_vFile): Handle vFile:setfs packets.
* server.c (handle_query): Call hostio_handle_new_gdb_connection
after target_handle_new_gdb_connection.

9 years agoImplement multiple-filesystem support for remote targets
Gary Benson [Wed, 10 Jun 2015 13:28:44 +0000 (14:28 +0100)]
Implement multiple-filesystem support for remote targets

This commit allows GDB to access executables and shared libraries
on remote targets where the remote stub does not share a common
filesystem with the inferior(s).  A new packet "vFile:setfs" is
added to the remote protocol and the three remote hostio functions
with filename arguments are modified to send "vFile:setfs" packets
as necessary.

gdb/ChangeLog:

* remote.c (struct remote_state) <fs_pid>: New field.
(new_remote_state): Initialize the above.
(PACKET_vFile_setfs): New enum value.
(remote_hostio_set_filesystem): New function.
(remote_hostio_open): Call the above.
(remote_hostio_unlink): Likewise.
(remote_hostio_readlink): Likewise.
(_initialize_remote): Register new "set/show remote
hostio-setfs-packet" command.
* NEWS: Announce new vFile:setfs packet.

gdb/doc/ChangeLog:

* gdb.texinfo (Remote Configuration): Document the
"set/show remote hostio-setfs-packet" command.
(Host I/O Packets): Document the vFile:setfs packet.