binutils-gdb.git
10 years agoFix handling of __ehdr_start when it cannot be defined.
Cary Coutant [Wed, 2 Apr 2014 21:21:14 +0000 (14:21 -0700)]
Fix handling of __ehdr_start when it cannot be defined.

2014-05-02  Cary Coutant  <ccoutant@google.com>

* defstd.cc (in_segment): Define __ehdr_start here...
* layout.cc (Layout::finalize): ...Instead of here.  Set the
output segment when known.
* resolve.cc (Symbol::override_base_with_special): Remember
the original binding.
* symtab.cc (Symbol::set_output_segment): New function.
(Symbol::set_undefined): New function.
* symtab.h (Symbol::is_weak_undefined): Check original undef
binding.
(Symbol::is_strong_undefined): New function.
(Symbol::set_output_segment): New function.
(Symbol::set_undefined): New function.
* target-reloc.h (is_strong_undefined): Remove.
(issue_undefined_symbol_error): Call Symbol::is_weak_undefined.
Check for hidden undefs.
(relocate_section): Call Symbol::is_strong_undefined.

* testsuite/Makefile.am (ehdr_start_test_1)
(ehdr_start_test_2, ehdr_start_test_3)
(ehdr_start_test_4, ehdr_start_test_5): New test cases.
* testsuite/Makefile.in: Regenerate.
* testsuite/ehdr_start_def.cc: New source file.
* testsuite/ehdr_start_test.cc: New source file.
* testsuite/ehdr_start_test.t: New linker script.
* testsuite/ehdr_start_test_4.sh: New shell script.

10 years agoExtend recognized types of SDT probe's arguments
Sergio Durigan Junior [Fri, 2 May 2014 20:50:45 +0000 (17:50 -0300)]
Extend recognized types of SDT probe's arguments

This commit is actually an update to make the parser in
gdb/stap-probe.c be aware of all the possible prefixes that a probe
argument can have.  According to the section "Argument Format" in:

  <https://sourceware.org/systemtap/wiki/UserSpaceProbeImplementation>

The bitness of the arguments can be 8, 16, 32 or 64 bits, signed or
unsigned.  Currently GDB recognizes only 32 and 64-bit arguments.
This commit extends this.  It also provides a testcase, only for
x86_64 systems.

gdb/
2014-05-02  Sergio Durigan Junior  <sergiodj@redhat.com>

* stap-probe.c (enum stap_arg_bitness): New enums to represent 8
and 16-bit signed and unsigned arguments.  Update comment.
(stap_parse_probe_arguments): Extend code to handle such
arguments.  Use warning instead of complaint to notify about
unrecognized bitness.

gdb/testsuite/
2014-05-02  Sergio Durigan Junior  <sergiodj@redhat.com>

* gdb.arch/amd64-stap-optional-prefix.S (main): Add several
probes to test for bitness recognition.
* gdb.arch/amd64-stap-optional-prefix.exp
(test_probe_value_without_reg): New procedure.
Add code to test for different kinds of bitness.

10 years agoFix PR breakpoints/16889: gdb segfaults when printing ASM SDT arguments
Sergio Durigan Junior [Fri, 2 May 2014 20:45:35 +0000 (17:45 -0300)]
Fix PR breakpoints/16889: gdb segfaults when printing  ASM SDT arguments

This commit fixes PR breakpoints/16889, which is about a bug that
triggers when GDB tries to parse probes whose arguments do not contain
the initial (and optional) "N@" part.  For reference sake, the de
facto format is described here:

  <https://sourceware.org/systemtap/wiki/UserSpaceProbeImplementation>

Anyway, this PR actually uncovered two bugs (related) that were
happening while parsing the arguments.  The first one was that the
parser *was* catching *some* arguments that were missing the "N@"
part, but it wasn't correctly setting the argument's type.  This was
causing a NULL pointer being dereferenced, ouch...

The second bug uncovered was that the parser was not catching all of
the cases for a probe which did not provide the "N@" part.  The fix
for that was to simplify the check that the code was making to
identify non-prefixed probes.  The code is simpler and easier to read
now.

I am also providing a testcase for this bug, only for x86_64
architectures.

gdb/
2014-05-02  Sergio Durigan Junior  <sergiodj@redhat.com>

PR breakpoints/16889
* stap-probe.c (stap_parse_probe_arguments): Simplify
check for non-prefixed probes (i.e., probes whose
arguments do not start with "N@").  Always set the
argument type to a sane value.

gdb/testsuite/
2014-05-02  Sergio Durigan Junior  <sergiodj@redhat.com>

PR breakpoints/16889
* gdb.arch/amd64-stap-optional-prefix.S: New file.
* gdb.arch/amd64-stap-optional-prefix.exp: Likewise.

10 years agoMove fwait test with prefix to prefix.s
H.J. Lu [Fri, 2 May 2014 15:39:09 +0000 (08:39 -0700)]
Move fwait test with prefix to prefix.s

* gas/i386/opcode-intel.d: Undo the last change.
* gas/i386/opcode-suffix.d: Likewise.
* gas/i386/opcode.d: Likewise.
* gas/i386/opcode.s: Likewise.

* gas/i386/prefix.s: Add test for fwait with prefix.
* gas/i386/prefix.d: Updated.

10 years agoUse sigsetjmp/siglongjmp in opcodes
H.J. Lu [Fri, 2 May 2014 15:27:16 +0000 (08:27 -0700)]
Use sigsetjmp/siglongjmp in opcodes

sigsetjmp/siglongjmp without saving the signal mask is faster than
setjmp/longjmp on systems where the signal mask is saved.  This patch
uses sigsetjmp/siglongjmp without saving the signal mask if possible.

PR binutils/16886
* config.in: Regenerated.
* configure: Likewise.
* configure.in: Check if sigsetjmp is available.
* h8500-dis.c (private): Replace jmp_buf with OPCODES_SIGJMP_BUF.
(fetch_data): Replace longjmp with OPCODES_SIGLONGJMP.
(print_insn_h8500): Replace setjmp with OPCODES_SIGSETJMP.
* i386-dis.c (dis_private): Replace jmp_buf with OPCODES_SIGJMP_BUF.
(fetch_data): Replace longjmp with OPCODES_SIGLONGJMP.
(print_insn): Replace setjmp with OPCODES_SIGSETJMP.
* ns32k-dis.c (private): Replace jmp_buf with OPCODES_SIGJMP_BUF.
(fetch_data): Replace longjmp with OPCODES_SIGLONGJMP.
(print_insn_ns32k): Replace setjmp with OPCODES_SIGSETJMP.
* sysdep.h (OPCODES_SIGJMP_BUF): New macro.
(OPCODES_SIGSETJMP): Likewise.
(OPCODES_SIGLONGJMP): Likewise.
* vax-dis.c (private): Replace jmp_buf with OPCODES_SIGJMP_BUF.
(fetch_data): Replace longjmp with OPCODES_SIGLONGJMP.
(print_insn_vax): Replace setjmp with OPCODES_SIGSETJMP.
* xtensa-dis.c (dis_private): Replace jmp_buf with
OPCODES_SIGJMP_BUF.
(fetch_data): Replace longjmp with OPCODES_SIGLONGJMP.
(print_insn_xtensa): Replace setjmp with OPCODES_SIGSETJMP.
* z8k-dis.c(instr_data_s): Replace jmp_buf with OPCODES_SIGJMP_BUF.
(fetch_data): Replace longjmp with OPCODES_SIGLONGJMP.
(print_insn_z8k): Replace setjmp with OPCODES_SIGSETJMP.

10 years agoSort target vectors to suit renaming
Alan Modra [Fri, 2 May 2014 10:41:49 +0000 (20:11 +0930)]
Sort target vectors to suit renaming

* targets.c: Sort bfd_target vectors somewhat alphabetically.
* configure.in: Likewise.
* configure: Regenerate.

10 years agobfd target vector rationalisation
Alan Modra [Fri, 2 May 2014 10:39:40 +0000 (20:09 +0930)]
bfd target vector rationalisation

This renames the bfd targets to <cpu>_<format>_<other>_<endian>_vec.
So for example, bfd_elf32_ntradlittlemips_vec becomes
mips_elf32_ntrad_le_vec and hp300bsd_vec becomes m68k_aout_hp300bsd_vec.

bfd/
* aix386-core.c, * aout-adobe.c, * aout-arm.c, * aout-ns32k.c,
* aout-sparcle.c, * aout0.c, * aoutx.h, * armnetbsd.c, * bout.c,
* cf-i386lynx.c, * cf-sparclynx.c, * cisco-core.c, * coff-alpha.c,
* coff-apollo.c, * coff-arm.c, * coff-aux.c, * coff-go32.c,
* coff-h8300.c, * coff-h8500.c, * coff-i386.c, * coff-i860.c,
* coff-i960.c, * coff-m68k.c, * coff-m88k.c, * coff-mips.c,
* coff-rs6000.c, * coff-sh.c, * coff-sparc.c, * coff-stgo32.c,
* coff-svm68k.c, * coff-tic80.c, * coff-u68k.c, * coff-w65.c,
* coff-we32k.c, * coff-x86_64.c, * coff-z80.c, * coff-z8k.c,
* coff64-rs6000.c, * config.bfd, * configure.com, * configure.in,
* demo64.c, * elf-m10200.c, * elf-m10300.c, * elf32-am33lin.c,
* elf32-arc.c, * elf32-arm.c, * elf32-avr.c, * elf32-bfin.c,
* elf32-cr16.c, * elf32-cr16c.c, * elf32-cris.c, * elf32-crx.c,
* elf32-d10v.c, * elf32-d30v.c, * elf32-dlx.c, * elf32-epiphany.c,
* elf32-fr30.c, * elf32-frv.c, * elf32-gen.c, * elf32-h8300.c,
* elf32-hppa.c, * elf32-i370.c, * elf32-i386.c, * elf32-i860.c,
* elf32-i960.c, * elf32-ip2k.c, * elf32-iq2000.c, * elf32-lm32.c,
* elf32-m32c.c, * elf32-m32r.c, * elf32-m68hc11.c, * elf32-m68hc12.c,
* elf32-m68k.c, * elf32-m88k.c, * elf32-mcore.c, * elf32-mep.c,
* elf32-metag.c, * elf32-microblaze.c, * elf32-mips.c, * elf32-moxie.c,
* elf32-msp430.c, * elf32-mt.c, * elf32-nds32.c, * elf32-nios2.c,
* elf32-or1k.c, * elf32-pj.c, * elf32-ppc.c, * elf32-rl78.c,
* elf32-rx.c, * elf32-s390.c, * elf32-score.c, * elf32-sh-symbian.c,
* elf32-sh.c, * elf32-sh64.c, * elf32-sparc.c, * elf32-spu.c,
* elf32-tic6x.c, * elf32-tilegx.c, * elf32-tilepro.c, * elf32-v850.c,
* elf32-vax.c, * elf32-xc16x.c, * elf32-xgate.c, * elf32-xstormy16.c,
* elf32-xtensa.c, * elf64-alpha.c, * elf64-gen.c, * elf64-hppa.c,
* elf64-ia64-vms.c, * elf64-mips.c, * elf64-mmix.c, * elf64-ppc.c,
* elf64-s390.c, * elf64-sh64.c, * elf64-sparc.c, * elf64-tilegx.c,
* elf64-x86-64.c, * elfn32-mips.c, * elfnn-aarch64.c, * elfnn-ia64.c,
* epoc-pe-arm.c, * epoc-pei-arm.c, * hp300bsd.c, * hp300hpux.c,
* hppabsd-core.c, * hpux-core.c, * i386aout.c, * i386bsd.c,
* i386dynix.c, * i386freebsd.c, * i386linux.c, * i386lynx.c,
* i386mach3.c, * i386msdos.c, * i386netbsd.c, * i386os9k.c,
* irix-core.c, * m68k4knetbsd.c, * m68klinux.c, * m68knetbsd.c,
* m88kmach3.c, * m88kopenbsd.c, * mach-o-i386.c, * mach-o-x86-64.c,
* makefile.vms, * mipsbsd.c, * mmo.c, * netbsd-core.c, * newsos3.c,
* nlm32-alpha.c, * nlm32-i386.c, * nlm32-ppc.c, * nlm32-sparc.c,
* ns32knetbsd.c, * osf-core.c, * pc532-mach.c, * pe-arm-wince.c,
* pe-arm.c, * pe-i386.c, * pe-mcore.c, * pe-mips.c, * pe-ppc.c,
* pe-sh.c, * pe-x86_64.c, * pei-arm-wince.c, * pei-arm.c,
* pei-i386.c, * pei-ia64.c, * pei-mcore.c, * pei-mips.c, * pei-ppc.c,
* pei-sh.c, * pei-x86_64.c, * ppcboot.c, * ptrace-core.c, * riscix.c,
* sco5-core.c, * som.c, * sparclinux.c, * sparclynx.c,
* sparcnetbsd.c, * sunos.c, * targets.c, * trad-core.c,
* vax1knetbsd.c, * vaxbsd.c, * vaxnetbsd.c, * versados.c,
* vms-alpha.c, * vms-lib.c: Rename bfd targets to
<cpu>_<format>_<other>_<endian>_vec.  Adjust associated MY macros
on aout targets.
* configure: Regenerate.
binutils/
* emul_aix.c: Update bfd target vector naming.
* testsuite/binutils-all/objcopy.exp: Likewise.
ld/
* emultempl/metagelf.em: Update bfd target vector naming.
* emultempl/nios2elf.em: Likewise.
* emultempl/spuelf.em: Likewise.
* emultempl/tic6xdsbt.em: Likewise.

10 years agodaily update
Alan Modra [Fri, 2 May 2014 00:00:38 +0000 (09:30 +0930)]
daily update

10 years agogdb_load: Fix latent bugs
Pedro Alves [Thu, 1 May 2014 23:59:31 +0000 (00:59 +0100)]
gdb_load: Fix latent bugs

In a test I was writting, I needed a procedure that would connect to
the target, and do "load", or equivalent.

Years ago, boards would override gdb_load to implement that.  Then
gdb_reload was added, and gdb_load was relaxed to allow boards avoid
the spawing and connecting to the target.  This sped up gdbserver
testing.  See
https://www.sourceware.org/ml/gdb-patches/2007-02/msg00318.html.

To actually spawn the target and load the executable on the target
side, gdb_reload was born:

 # gdb_reload -- load a file into the target.  Called before "running",
 # either the first time or after already starting the program once,
 # for remote targets.  Most files that override gdb_load should now
 # override this instead.

 proc gdb_reload { } {
     # For the benefit of existing configurations, default to gdb_load.
     # Specifying no file defaults to the executable currently being
     # debugged.
     return [gdb_load ""]
 }

Note the comment about specifying no file.  Indeed looking at
config/sid.exp, or config/monitor.exp, we see examples of that.

However, the default gdb_load itself doesn't handle the case of no
file specified.  When passed no file, it just calls gdb_file_cmd with
no file either, which ends up invocing the "file" command with no
argument, which means unloading the file and its symbols...  That
means calling gdb_reload when testing against native targets is
broken.  We don't see that today because the only call to gdb_reload
that exists today is guarded by target_info exists
gdb,do_reload_on_run.

The native-extended-gdbserver.exp board is likewise broken here.  When
[gdb_load ""] is called, the board sets the remote exec-file to "" ...

Tested on x86_64 Fedora 17, native, remote gdbserver and
extended-remote gdbserver.

testsuite/
2014-05-01  Pedro Alves  <palves@redhat.com>

* lib/gdb.exp (gdb_load): Extend comment.  Skip calling
gdb_file_cmd if no file is specified.
* boards/native-extended-gdbserver.exp (gdb_load): Use the
last_loaded_file to set the remote exec-file.

10 years agold/testsuite:
Hans-Peter Nilsson [Thu, 1 May 2014 22:31:58 +0000 (00:31 +0200)]
ld/testsuite:
* ld-mmix/sec-11.d, ld-mmix/sec-11.ld, ld-mmix/sec-10.s,
ld-mmix/sec-10.d, ld-mmix/b-offlocmis.s, ld-mmix/sec-12.d: New
tests.
* ld-mmix/b-offloc.s: Correct address in comment.

10 years ago * mmo.c (mmo File layout documentation): Add note about low bits
Hans-Peter Nilsson [Thu, 1 May 2014 22:30:42 +0000 (00:30 +0200)]
* mmo.c (mmo File layout documentation): Add note about low bits
of address.
(mmo_write_chunk): When handling data remainder, assert that
previous remaining data is flushed.
(mmo_write_loc_chunk): Only look for trailing and leading zeros
when dealing with an aligned VMA and for aligned lengths.  Don't skip
the last 32-bit-word of zeros.
(mmo_write_loc_chunk): Emit an error if the VMA is not aligned.
(mmo_scan) <case LOP_QUOTE>: Move re-alignment of vma before
emitting data, not after updating it.
<case LOP_LOC>: Call mmo_decide_section with aligned vma.

10 years ago * config.sub, config.guess: Import from upstream.
Richard Sandiford [Thu, 1 May 2014 20:49:01 +0000 (21:49 +0100)]
* config.sub, config.guess: Import from upstream.

10 years agoinclude/opcode/
Richard Sandiford [Thu, 1 May 2014 20:39:48 +0000 (21:39 +0100)]
include/opcode/
* mips.h (mips_isa_table): Avoid hard-coding INSN_ISA* values.

10 years agocompare-sections: New -r option.
David Taylor [Thu, 1 May 2014 17:09:43 +0000 (18:09 +0100)]
compare-sections: New -r option.

When connecting to a remote system, we use the compare-sections
command to verify that the box is running the code that we think it is
running.  Since the system is up and running and *NOT* 'freshly
downloaded without yet executing anything', read-write sections, of
course, differ from what they were in the executable file.

Comparing read-write sections takes time and more importantly the
MIS-MATCHED output is confusing to some users.

The compare-sections command compares all loadable sections including
read-write sections.  This patch gives the user the option to compare
just the loadable read-only sections.

gdb/
2014-05-01  David Taylor  <dtaylor@emc.com>

* remote.c (compare_sections_command): Add -r option to compare
all loadable read-only sections.

gdb/doc/
2014-05-01  David Taylor  <dtaylor@emc.com>

* gdb.texinfo (compare-sections): Document the new -r (read-only)
option.

10 years agoHandle prefixes before fwait
H.J. Lu [Thu, 1 May 2014 16:39:51 +0000 (09:39 -0700)]
Handle prefixes before fwait

0x9b (fwait) is both an instruction and an opcode prefix.  When 0x9b is
treated as an instruction, we need to handle any prefixes before it.
This patch handles it properly.

gas/testsuite/

PR binutils/16891
* gas/i386/opcode.s: Add test for fwait with prefix.
* gas/i386/opcode-intel.d: Updated.
* gas/i386/opcode-suffix.d: Likewise.
* gas/i386/opcode.d: Likewise.

opcodes/

PR binutils/16891
* i386-dis.c (print_insn): Handle prefixes before fwait.

10 years agoNew testsuite/boards/local-remote-host.exp board, now with editing on
Pedro Alves [Thu, 1 May 2014 16:25:52 +0000 (17:25 +0100)]
New testsuite/boards/local-remote-host.exp board, now with editing on

This adds a variant of local-remote-host-notty.exp that forces
pseudo-tty allocation, so that readline/editing is enabled.

 $ ssh localhost gdb -q
 (gdb) show editing
 Editing of command lines as they are typed is off.
 (gdb)

vs:

 $ ssh -t localhost gdb -q
 (gdb) show editing
 Editing of command lines as they are typed is on.

We now get, e.g.:

 Running ../../../src/gdb/testsuite/gdb.base/filesym.exp ...
 PASS: gdb.base/filesym.exp: complete on "filesy"
 PASS: gdb.base/filesym.exp: completion list for "filesym"
 PASS: gdb.base/filesym.exp: set breakpoint at filesym

gdb/testsuite/
2014-05-01  Pedro Alves  <palves@redhat.com>

        * boards/local-remote-host.exp: New file.

10 years agoRename testsuite/boards/local-remote-host.exp -> testsuite/boards/local-remote-host...
Pedro Alves [Thu, 1 May 2014 16:25:51 +0000 (17:25 +0100)]
Rename testsuite/boards/local-remote-host.exp -> testsuite/boards/local-remote-host-notty.exp

When testing with this board, stdin is not a tty, and so
readline/editing is disabled:

 $ ssh localhost gdb -q
 (gdb) show editing
 Editing of command lines as they are typed is off.
 (gdb)

Rename the file, to make room for a version of this board that forces a pseudo-tty.

gdb/testsuite/
2014-05-01  Pedro Alves  <palves@redhat.com>

* boards/local-remote-host.exp: Rename to ...
* boards/local-remote-host-notty.exp: ... this.

10 years ago2014-05-01 Steve Ellcey <sellcey@mips.com>
Steve Ellcey [Thu, 1 May 2014 16:09:33 +0000 (09:09 -0700)]
2014-05-01  Steve Ellcey  <sellcey@mips.com>

* include/longlong.h: Import latest version from GCC tree.

10 years agodaily update
Alan Modra [Thu, 1 May 2014 00:00:38 +0000 (09:30 +0930)]
daily update

10 years agoFixes a problem with the BFD library running out of memory because it mistakenly
Nick Clifton [Wed, 30 Apr 2014 16:04:04 +0000 (17:04 +0100)]
Fixes a problem with the BFD library running out of memory because it mistakenly
thought that an uncompressed .debug_str section was compressed.

* compress.c (bfd_is_section_compressed): When checking the
.debug_str section, also check the fifth byte in the section is
not part of a string.

* binutils-all/debug_str.s: New test.
* binutils-all/debug_str.d: New test control file.
* binutils-all/compress.exp: Run debug_str test.

10 years agoRemove unused arguments to few functions in dwarf2loc.c and gdbtypes.c.
Siva Chandra [Tue, 29 Apr 2014 12:27:14 +0000 (05:27 -0700)]
Remove unused arguments to few functions in dwarf2loc.c and gdbtypes.c.

gdb/ChangeLog:

* dwarf2loc.c (dwarf2_locexpr_baton_eval,
dwarf2_evaluate_property): Remove unused CORE_ADDR argument.
Update all callers.
* dwarf2loc.h (dwarf2_evaluate_property): Update signature.
* gdbtypes.c (resolve_dynamic_range, resolve_dynamic_array):
Remove unused CORE_ADDR argument.  Update all callers.

10 years agoDon't use vma to identify eh_frame personality function
Alan Modra [Wed, 30 Apr 2014 00:41:56 +0000 (10:11 +0930)]
Don't use vma to identify eh_frame personality function

This is all we should need to be able to run the eh_frame parts of
bfd_elf_discard_info before bfd_elf_size_dynamic_sections

* elf-eh-frame.c (struct cie.personality): Replace val with sym.
(find_merged_cie): Identify personality functions by (bfd_id,index)
pair when a local sym is used.

10 years agodaily update
Alan Modra [Wed, 30 Apr 2014 00:00:37 +0000 (09:30 +0930)]
daily update

10 years agoor1k: Do not override section for non-TLS symbols.
Christian Svensson [Mon, 28 Apr 2014 22:34:59 +0000 (00:34 +0200)]
or1k: Do not override section for non-TLS symbols.

Outgoing section for relocations was computed by setting a shared
pointer to which section should be used. For TLS this was overriden to
use .rela.got since they use GOT entries but since the pointer is per
section that whole section was relocated to .rela.got, even non-TLS
relocations.

* elf32-or1k.c: Fix a bug where non-TLS relocations would be forced
into .rela.got if it contained TLS relocations as well.

10 years agoFix remote connection to targets that don't support the QNonStop packet.
Pedro Alves [Tue, 29 Apr 2014 13:01:27 +0000 (14:01 +0100)]
Fix remote connection to targets that don't support the QNonStop packet.

... and others.  The recent patch that fixed several "set remote
foo-packet on/off" commands introduced a regression, observable when
connecting GDB to QEMU.  For instance:

        (gdb) set debug remote 1
        (gdb) tar rem :4444
        Remote debugging using :4444
        Sending packet: $qSupported:multiprocess+;qRelocInsn+#2a...Ack
        Packet received: PacketSize=1000;qXfer:features:read+
        Packet qSupported (supported-packets) is supported
        Sending packet: $Hgp0.0#ad...Ack
        Packet received: OK
        Sending packet: $qXfer:features:read:target.xml:0,ffb#79...Ack
        Packet received: [...]
        Sending packet: $qXfer:features:read:arm-core.xml:0,ffb#08...Ack
        Packet received: [...]
 !!! -> Sending packet: $QNonStop:0#8c...Ack
        Packet received:
        Remote refused setting all-stop mode with:

The "QNonStop" feature is associated with the PACKET_QNonStop packet,
with a default of PACKET_DISABLE, so GDB should not be sending the
packet at all.

The patch that introduced the regression decoupled packet_config's
'detect' and 'support' fields, making the former (an auto_boolean)
purely the associated "set remote foo-packet" command's variable.  In
the example above, the packet config's 'supported' field does end up
correctly set to PACKET_DISABLE.  However, nothing is presently
initializing packet configs that don't actually have a command
associated.  Those configs's 'detect' field then ends up set to
AUTO_BOOLEAN_TRUE, simply because that happens to be 0.  This forces
GDB to assume the packet is supported, irrespective of what the target
claims it supports, just like if the user had done "set remote
foo-packet on" (this being the associated command, if there was one).

Ideally, all packet configs would have a command associated.  While
that isn't true, make sure all packet configs are initialized, even if
no command is associated, and add an assertion that prevents adding
more packets/features without an associated command.

Tested on x86_64 Fedora 17, against pristine gdbserver, and against a
gdbserver with the QNonStop packet/feature disabled with a local hack.

gdb/
2014-04-29  Pedro Alves  <palves@redhat.com>

* remote.c (struct packet_config) <detect>: Extend comment.
(add_packet_config_cmd): Don't set the config's detect or support
fields here.
(init_all_packet_configs): Also initialize the config's 'detect'
field.
(reset_all_packet_configs_support): New function.
(remote_open_1): Call reset_all_packet_configs_support instead of
init_all_packet_configs.
(_initialize_remote): Initialize all packet configs.  Assert that
all packets have an associated command, except a few known
outliers.

10 years agodaily update
Alan Modra [Tue, 29 Apr 2014 00:00:42 +0000 (09:30 +0930)]
daily update

10 years agoAdd gdb.ada/dyn_arrayidx testcase.
Joel Brobecker [Sun, 20 Apr 2014 05:19:02 +0000 (22:19 -0700)]
Add gdb.ada/dyn_arrayidx testcase.

This add a testcases that verifies correct handling of dynamicity
for lower bounds of arrays.

gdb/testsuite/ChangeLog:

        * gdb.ada/dyn_arrayidx: New testcase.

10 years agodwarf2read.c::read_subrange_type: Handle dynamic lower bounds
Joel Brobecker [Sun, 20 Apr 2014 03:41:56 +0000 (20:41 -0700)]
dwarf2read.c::read_subrange_type: Handle dynamic lower bounds

Currently, read_subrange_type handles dynamicity only in the case of
the upper bound, and assumes that the lower bound is always static.
That's rooted in the fact that dynamicity was added to support C99
variable-length arrays, where the lower bound is always zero, and
therefore never dynamic.  But the lower bound can, in fact, be dynamic
in other languages such as Ada.

Consider for instance the following declaration in Ada...

    type Array_Type is array (L .. U) of Natural;

... where L and U are parameters of the function where the declaration
above was made, and whose value are 5 and 10.  Currently, the debugger
is able to print the value of the upper bound correctly, but not the
lower bound:

    (gdb) ptype array_type
    type = array (1 .. 10) of natural

After this patch, the debugger now prints:

    (gdb) ptype array_type
    type = array (5 .. 10) of natural

gdb/ChangeLog:

        * dwarf2read.c (read_subrange_type): Handle dynamic
        DW_AT_lower_bound attributes.

10 years agoImprove Ada dynamic range type handling.
Joel Brobecker [Sat, 19 Apr 2014 16:55:14 +0000 (09:55 -0700)]
Improve Ada dynamic range type handling.

Consider the following declaration in Ada...

   type Array_Type is array (L .. U) of Natural;

... where L and U are parameters of the function where the declaration
above was made. At the moment, GDB relies on descriptive types in order
to properly decode the array bounds. For instance, if L was 5, and U
was 10, we would see the following:

    (gdb) ptype array_type
    type = array (5 .. 10) of natural
    (gdb) maintenance set ada ignore-descriptive-types
    (gdb) ptype array_type
    type = array (1 .. 28544912) of natural

This patch enhances ada_discrete_type_{high,low}_bound to resolve
any dynamicity.  This is sufficient to fix the case of the upper bound.
For the lower bound, the dwarf2read module does not handle dynamic
lower bounds yet, but once it does, the lower bound should be correctly
handled as well [1].

gdb/ChangeLog:

        * ada-lang.c (ada_discrete_type_high_bound): Resolve the type's
        dynamic bounds before computing its upper bound.
        (ada_discrete_type_low_bound): Same as above with the lower bound.

[1]: The reason why we do not enhance dwarf2read to handle dynamic
lower bounds ahead of this patch is because it unveils some latent
issues such as this one.

10 years agoEnhance dwarfread.c::resolve_dynamic_type to resolve dynamic ranges
Joel Brobecker [Sat, 19 Apr 2014 16:40:53 +0000 (09:40 -0700)]
Enhance dwarfread.c::resolve_dynamic_type to resolve dynamic ranges

This change breaks down the resolve_dynamic_bounds function which
works only on arrays and its index range types into two functions,
one that resolves range types, and one that resolves arrays (using
the new routine to resolve the array's index range type). The
is_dynamic_type and resolve_dynamic_type function are then re-organized
to handle range types as well.

One small change worth mentioning is the fact that, now that range
types are resolved on their own (rather than in the limited context
of array index types), the resolved range types are created from
a copy of the dynamic range type, rather than from scratch (first
parameter of create_range_type). This allows us to preserve as many
original properties in the resolved type as possible (Eg. the type's
name).

This is preparation work that will help better support dynamic range
types for languages that allow the declaration of such types (Eg. Ada).

gdb/ChangeLog:

        * dwarf2read.c (is_dynamic_type): Return true for dynamic
        range types.  Adjust the array handling implementation to
        take advantage of this change.
        (resolve_dynamic_range): New function, mostly extracted from
        resolve_dynamic_bounds.
        (resolve_dynamic_array): New function, mostly extracted from
        resolve_dynamic_bounds.
        (resolve_dynamic_bounds): Delete.
        (resolve_dynamic_type): Reimplement.  Add handling of
        TYPE_CODE_RANGE types.

10 years agoUnnecessary XA type handling in ada_varobj_describe_simple_array_child
Joel Brobecker [Thu, 24 Apr 2014 16:09:11 +0000 (12:09 -0400)]
Unnecessary XA type handling in ada_varobj_describe_simple_array_child

ada-varobj.c::ada_varobj_describe_simple_array_child only ever gets
called after all GNAT encodings have been applied to (parent_value,
parent_type). So there is no point in redoing it partially by
checking for parallel XA types again.

gdb/ChangeLog:

* ada-varobj.c (ada_varobj_describe_simple_array_child): Remove
handling of parallel ___XA types.

10 years agoremove unnecessary second call to static_unwrap_type in ada_evaluate_subexp
Joel Brobecker [Tue, 18 Mar 2014 17:52:08 +0000 (10:52 -0700)]
remove unnecessary second call to static_unwrap_type in ada_evaluate_subexp

In ada-lang.c::ada_evaluate_subexp, case OP_VAR_VALUE, when noside
is EVAL_AVOID_SIDE_EFFECTS, the first thing we do is set type as
follow:

    type = static_unwrap_type (SYMBOL_TYPE (exp->elts[pc + 2].symbol));

Later on in the same block, we make the same call:

    return value_zero
      (to_static_fixed_type
       (static_unwrap_type (SYMBOL_TYPE (exp->elts[pc + 2].symbol))),
       not_lval);

This patch removes the second call, since it should result in the same
type being returned, so no point in making that call again.

gdb/ChangeLog:

        * ada-lang.c (ada_evaluate_subexp) <OP_VAR_VALUE>: Remove
        unnecessary second call to static_unwrap_type.

10 years agoThis fixes a bootstrapping problem with gcc 4.9 in an x86 PE environment.
Nick Clifton [Mon, 28 Apr 2014 13:32:59 +0000 (14:32 +0100)]
This fixes a bootstrapping problem with gcc 4.9 in an x86 PE environment.
The problem was that references to weak function symbols were being
incorrectly biased by definition's offset.

PR gas/16858
* config/tc-i386.c (md_apply_fix): Do not adjust value of
pc-relative fixes against weak symbols.

10 years ago[gdbserver] Correctly generate i386-avx512.c
Yao Qi [Mon, 28 Apr 2014 10:56:06 +0000 (18:56 +0800)]
[gdbserver] Correctly generate i386-avx512.c

The makefile rule i386-avx512.c is to generate i386-avx512.c, but it
is written to i386-avx.c by mistake.  This patch is to fix this typo.

gdb/gdbserver:

2014-04-28  Yao Qi  <yao@codesourcery.com>

* Makefile.in (i386-avx512.c): Fix the typo of generated file
name.

10 years agoThis patch reworks the fix to avoid a compile time warning so that it will work
Nick Clifton [Mon, 28 Apr 2014 08:34:02 +0000 (09:34 +0100)]
This patch reworks the fix to avoid a compile time warning so that it will work
with later versions of gcc.

PR ld/16821
* peXXigen.c (_bfd_XXi_swap_sym_out): Rework fix to avoid compile
time warning.

10 years agodaily update
Alan Modra [Mon, 28 Apr 2014 00:00:57 +0000 (09:30 +0930)]
daily update

10 years agoMake "set disassemble-next-line on" can work with DUMMY_FRAME, SIGTRAMP_FRAME and...
Hui Zhu [Sun, 27 Apr 2014 14:23:43 +0000 (22:23 +0800)]
Make "set disassemble-next-line on" can work with DUMMY_FRAME, SIGTRAMP_FRAME and ARCH_FRAME

When GDB debug DUMMY_FRAME, SIGTRAMP_FRAME and ARCH_FRAME, even if
"set disassemble-next-line on", it will not output the asm code:
(gdb) set disassemble-next-line on
(gdb) si
<signal handler called>
(gdb)
<signal handler called>
(gdb)
<signal handler called>

So make this patch make they can work together, it will become:
(gdb) si
<signal handler called>
=> 0xffffffff816bfb09 <int_with_check+0>: 65 48 8b 0c 25 c8 c7 00 00 mov    %gs:0xc7c8,%rcx
(gdb)
<signal handler called>
=> 0xffffffff816bfb12 <int_with_check+9>: 48 81 e9 d8 1f 00 00 sub    $0x1fd8,%rcx
(gdb)
<signal handler called>
=> 0xffffffff816bfb19 <int_with_check+16>: 8b 51 10 mov    0x10(%rcx),%edx

2014-04-27  Hui Zhu  <hui@codesourcery.com>

* stack.c (print_frame_info): Call do_gdb_disassembly with
DUMMY_FRAME, SIGTRAMP_FRAME and ARCH_FRAME.

10 years agodaily update
Alan Modra [Sun, 27 Apr 2014 00:00:59 +0000 (09:30 +0930)]
daily update

10 years ago* guile/scm-safe-call.c (scscm_eval_scheme_string): Fix comment.
Doug Evans [Sat, 26 Apr 2014 20:13:13 +0000 (13:13 -0700)]
* guile/scm-safe-call.c (scscm_eval_scheme_string): Fix comment.

10 years agoRegenerate files for openrisk -> or1k change
Alan Modra [Sat, 26 Apr 2014 13:30:09 +0000 (23:00 +0930)]
Regenerate files for openrisk -> or1k change

bfd/
* po/SRC-POTFILES.in: Regenerate.
* configure: Regenerate.
gas/
* po/POTFILES.in: Regenerate.
opcodes/
* po/POTFILES.in: Regenerate.

10 years agoCompute the function length instead of hard coding it
Yao Qi [Thu, 24 Apr 2014 08:51:33 +0000 (16:51 +0800)]
Compute the function length instead of hard coding it

In Dwarf::assemble in dwz.exp, 10 is hard-coded in it,

      subprogram {
  {name main}
  {low_pc main addr}
{high_pc "main + 10" addr}
      }

however, the length of main function varies on architectures.  The
hard-coded 10 here causes dwz.exp fails on some targets, such as
nios2.

This patch is to add some code to compute the length of function main,
which is similar to what we are doing in entry-values.exp.

gdb/testsuite:

2014-04-26  Yao Qi  <yao@codesourcery.com>

* gdb.dwarf2/dwz.exp: Compile main.c to object.  Restart GDB
and compute the length of function main.  Save it in
$main_length.
(Dwarf::assemble): Use $main_length instead of hard-coded 10.
(top-level): Use gdb_compile to compile objects into
executable and restart GDB.  Remove invocation to
prepare_for_testing.

10 years agodaily update
Alan Modra [Sat, 26 Apr 2014 00:00:55 +0000 (09:30 +0930)]
daily update

10 years agoAdd missing gdbserver/ChangeLog entry for previous commit.
Pedro Alves [Fri, 25 Apr 2014 18:22:27 +0000 (19:22 +0100)]
Add missing gdbserver/ChangeLog entry for previous commit.

2014-04-25  Pedro Alves  <palves@redhat.com>

PR server/16255
* linux-low.c (linux_attach_fail_reason_string): New function.
(linux_attach_lwp): Delete.
(linux_attach_lwp_1): Rename to ...
(linux_attach_lwp): ... this.  Take a ptid instead of a pid as
argument.  Remove "initial" parameter.  Return int instead of
void.  Don't error or warn here.
(linux_attach): Adjust to call linux_attach_lwp.  Call error on
failure to attach to the tgid.  Call warning when failing to
attach to an lwp.
* linux-low.h (linux_attach_lwp): Take a ptid instead of a pid as
argument.  Remove "initial" parameter.  Return int instead of
void.  Don't error or warn here.
(linux_attach_fail_reason_string): New declaration.
* thread-db.c (attach_thread): Adjust to linux_attach_lwp's
interface change.  Use linux_attach_fail_reason_string.

10 years agoPR server/16255: gdbserver cannot attach to a second inferior that is multi-threaded.
Pedro Alves [Fri, 25 Apr 2014 18:07:33 +0000 (19:07 +0100)]
PR server/16255: gdbserver cannot attach to a second inferior that is multi-threaded.

On Linux, we need to explicitly ptrace attach to all lwps of a
process.  Because GDB might not be connected yet when an attach is
requested, and thus it may not be possible to activate thread_db, as
that requires access to symbols (IOW, gdbserver --attach), a while ago
we make linux_attach loop over the lwps as listed by /proc/PID/task to
find the lwps to attach to.

linux_attach_lwp_1 has:

...
  if (initial)
    /* If lwp is the tgid, we handle adding existing threads later.
       Otherwise we just add lwp without bothering about any other
       threads.  */
    ptid = ptid_build (lwpid, lwpid, 0);
  else
    {
      /* Note that extracting the pid from the current inferior is
 safe, since we're always called in the context of the same
 process as this new thread.  */
      int pid = pid_of (current_inferior);
      ptid = ptid_build (pid, lwpid, 0);
    }

That "safe" comment referred to linux_attach_lwp being called by
thread-db.c.  But this was clearly missed when a new call to
linux_attach_lwp_1 was added to linux_attach.  As a result,
current_inferior will be set to some random process, and non-initial
lwps of the second inferior get assigned the pid of the wrong
inferior.  E.g., in the case of attaching to two inferiors, for the
second inferior (and so on), non-initial lwps of the second inferior
get assigned the pid of the first inferior.  This doesn't trigger on
the first inferior, when current_inferior is NULL, add_thread switches
the current inferior to the newly added thread.

Rather than making linux_attach switch current_inferior temporarily
(thus avoiding further reliance on global state), or making
linux_attach_lwp_1 get the tgid from /proc, which add extra syscalls,
and will be wrong in case of the user having originally attached
directly to a non-tgid lwp, and then that lwp spawning new clones (the
ptid.pid field of further new clones should be the same as the
original lwp's pid, which is not the tgid), we note that callers of
linux_attach_lwp/linux_attach_lwp_1 always have the right pid handy
already, so they can pass it down along with the lwpid.

The only other reason for the "initial" parameter is to error out
instead of warn in case of attach failure, when we're first attaching
to a process.  There are only three callers of
linux_attach_lwp/linux_attach_lwp_1, and each wants to print a
different warn/error string, so we can just move the error/warn out of
linux_attach_lwp_1 to the callers, thus getting rid of the "initial"
parameter.

There really nothing gdbserver-specific about attaching to two
threaded processes, so this adds a new test under gdb.multi/.  The
test passes cleanly against the native GNU/Linux target, but
fails/triggers the bug against GDBserver (before the patch), with the
native-extended-remote board (as plain remote doesn't support
multi-process).

Tested on x86_64 Fedora 17, with the native-extended-gdbserver board.

gdb/gdbserver/
2014-04-25  Pedro Alves  <palves@redhat.com>

PR server/16255
* linux-low.c (linux_attach_fail_reason_string): New function.
(linux_attach_lwp): Delete.
(linux_attach_lwp_1): Rename to ...
(linux_attach_lwp): ... this.  Take a ptid instead of a pid as
argument.  Remove "initial" parameter.  Return int instead of
void.  Don't error or warn here.
(linux_attach): Adjust to call linux_attach_lwp.  Call error on
failure to attach to the tgid.  Call warning when failing to
attach to an lwp.
* linux-low.h (linux_attach_lwp): Take a ptid instead of a pid as
argument.  Remove "initial" parameter.  Return int instead of
void.  Don't error or warn here.
(linux_attach_fail_reason_string): New declaration.
* thread-db.c (attach_thread): Adjust to linux_attach_lwp's
interface change.  Use linux_attach_fail_reason_string.

gdb/
2014-04-25  Pedro Alves  <palves@redhat.com>

PR server/16255
* common/linux-ptrace.c (linux_ptrace_attach_warnings): Rename to ...
(linux_ptrace_attach_fail_reason): ... this.  Remove "warning: "
and newline from built string.
* common/linux-ptrace.h (linux_ptrace_attach_warnings): Rename to ...
(linux_ptrace_attach_fail_reason): ... this.
* linux-nat.c (linux_nat_attach): Adjust to use
linux_ptrace_attach_fail_reason.

gdb/testsuite/
2014-04-25  Simon Marchi  <simon.marchi@ericsson.com>
    Pedro Alves  <palves@redhat.com>

PR server/16255
* gdb.multi/multi-attach.c: New file.
* gdb.multi/multi-attach.exp: New file.

10 years agoFix several "set remote foo-packet on/off" commands.
Pedro Alves [Fri, 25 Apr 2014 17:07:02 +0000 (18:07 +0100)]
Fix several "set remote foo-packet on/off" commands.

For several RSP packets, there's a corresponding "set remote
foo-packet on/off/auto" command that one can use do bypass
auto-detection of support for the packet or feature.  However, I
noticed that setting several of these commands to 'on' or 'off'
doesn't actually have any effect.  These are, at least:

 set remote breakpoint-commands-packet
 set remote conditional-breakpoints-packet
 set remote fast-tracepoints-packet
 set remote static-tracepoints-packet
 set remote install-in-trace-packet

These are commands that control a remote protocol feature that doesn't
have a corresponding regular packet, and because of that we cache the
knowledge of the remote side support as returned by the qSupported
packet in the remote_state object.

E.g., in the case of the 'set remote breakpoint-commands-packet'
command, whether the feature is supported is recorded in the
'breakpoint_commands' field of the remote_state object.

Whether to bypass packet support auto-detection or not is controlled
by the 'detect' field of the corresponding packet's packet_config
structure.  That field is the variable associated directly with the
"set remote foo-packet" command.  Actual remote stub support for the
packet (or feature) is recorded in the 'support' field of the same
structure.

However, when the user toggles the command, the 'support' field is
also correspondingly updated to PACKET_ENABLE/DISABLE/SUPPORT_UNKNOWN,
discarding the knowledge of whether the target actually supports the
feature.  If one toggles back to 'auto', it's no big issue for real
packets, as they'll just end up re-probed the next time they might be
necessary.  But features whose support is only reported through
qSupported don't get their corresponding (manually added/maintained)
fields in remote_state objected updated.  As we lost the actual status
of the target support for the feature, GDB would need to probe the
qSupported features again, which GDB doesn't do.

But we can avoid that extra traffic, and clean things up, IMO.
Instead of going in that direction, this patch completely decouples
struct packet_config's 'detect' and 'support' fields.  E.g., when the
user does "set remote foo-packet off", instead of setting the packet
config's 'support' field to PACKET_DISABLE, the 'support' field is not
touched at all anymore.  That is, we end up respecting this simple
table:

| packet_config->detect | packet_config->support | should use packet/feature? |
|-----------------------+------------------------+----------------------------|
| auto                  | PACKET_ENABLE          | PACKET_ENABLE              |
| auto                  | PACKET_DISABLE         | PACKET_DISABLE             |
| auto                  | PACKET_UNKNOWN         | PACKET_UNKNOWN             |
| yes                   | don't care             | PACKET_ENABLE              |
| no                    | don't care             | PACKET_DISABLE             |

This is implemented by the new packet_support function.  With that, we
need to update this pattern throughout:

  if (remote_protocol_packets[PACKET_foo].support == PACKET_DISABLE)

to do this instead:

  if (packet_support (PACKET_qAttached) == PACKET_DISABLE)

where as mentioned, the packet_support function takes struct
packet_config's 'detect' field into account, like in the table above.

As when the packet is force-disabled or force-enabled, the 'support'
field is just ignored, if the command is set back to auto, we'll
resume respecting whatever the target said it supports.  IOW, the end
result is that the 'support' field always represents whether the
target actually supports the packet or not.

After all that, the manually maintained breakpoint_commands and
equivalent fields of struct remote_state can then be eliminated, with
references replaced by checking the result of calling the
packet_support function on the corresponding packet or feature.  This
required adding new PACKET_foo enum values for several features that
didn't have it yet.  (The patch does not add corresponding "set remote
foo-packet" style commands though, focusing only on bug fixing and
laying the groundwork).

Tested on x86_64 Fedora 17, native GDBserver.  The new tests all fail
without this patch.

gdb/
2014-04-25  Pedro Alves  <palves@redhat.com>

* remote.c (struct remote_state): Remove multi_process_aware,
non_stop_aware, cond_tracepoints, cond_breakpoints,
breakpoint_commands, fast_tracepoints, static_tracepoints,
install_in_trace, disconnected_tracing,
enable_disable_tracepoints, string_tracing, and
augmented_libraries_svr4_read fields.
(remote_multi_process_p): Move further below in the file.
(struct packet_config): Add comments.
(update_packet_config): Delete function.
(show_packet_config_cmd): Use packet_config_support.
(add_packet_config_cmd): Use NULL as set callback.
(packet_ok): "set remote foo-packet"-style commands no longer
change config->supported -- adjust.
(PACKET_ConditionalTracepoints, PACKET_ConditionalBreakpoints)
(PACKET_BreakpointCommands, PACKET_FastTracepoints)
(PACKET_StaticTracepoints, PACKET_InstallInTrace): Add comments.
(PACKET_QNonStop, PACKET_multiprocess_feature)
(PACKET_EnableDisableTracepoints_feature, PACKET_tracenz_feature)
(PACKET_DisconnectedTracing_feature)
(PACKET_augmented_libraries_svr4_read_feature): New enum values.
(set_remote_protocol_packet_cmd): Delete function.
(packet_config_support, packet_support): New functions.
(set_remote_protocol_Z_packet_cmd): Don't call
update_packet_config.
(remote_query_attached, remote_pass_signals)
(remote_program_signals, remote_threads_info)
(remote_threads_extra_info, remote_start_remote): Use
packet_support.
(remote_start_remote): Use packet_config_support and
packet_support.
(init_all_packet_configs): Set all packets to unknown support,
instead of calling update_packet_config.
(remote_check_symbols): Use packet_support.
(remote_supported_packet): Unconditionally set the packet config's
support status.
(remote_multi_process_feature, remote_non_stop_feature)
(remote_cond_tracepoint_feature, remote_cond_breakpoint_feature)
(remote_breakpoint_commands_feature)
(remote_fast_tracepoint_feature, remote_static_tracepoint_feature)
(remote_install_in_trace_feature)
(remote_disconnected_tracing_feature)
(remote_enable_disable_tracepoint_feature)
(remote_string_tracing_feature)
(remote_augmented_libraries_svr4_read_feature): Delete functions.
(remote_protocol_features): Adjust to use remote_supported_packet
for "augmented-libraries-svr4-read", "multiprocess", "QNonStop",
"ConditionalTracepoints", "ConditionalBreakpoints",
"BreakpointCommands", "FastTracepoints", "StaticTracepoints",
"InstallInTrace", "DisconnectedTracing", "DisconnectedTracing",
"EnableDisableTracepoints", and "tracenz".
(remote_query_supported): Use packet_support.
(remote_open_1): Adjust.
(extended_remote_attach_1): Use packet_support.  Switch on the
result of packet_ok instead of checking whether the packet ended
up disabled.
(remote_vcont_resume): Use packet_support.
(remote_resume, remote_stop_ns, fetch_register_using_p)
(remote_prepare_to_store, store_register_using_P)
(check_binary_download, remote_write_bytes): Use packet_support.
(remote_vkill): Use packet_support.  Switch on the result of
packet_ok instead of checking whether the packet ended up
disabled.
(extended_remote_supports_disable_randomization): Use
packet_support.
(extended_remote_run): Switch on the result of packet_ok instead
of checking whether the packet ended up disabled.
(remote_insert_breakpoint, remote_remove_breakpoint)
(remote_insert_watchpoint, remote_remove_watchpoint)
(remote_insert_hw_breakpoint, remote_remove_hw_breakpoint): Use
packet_support.
(remote_search_memory): Use packet_config_support.
(remote_get_thread_local_address, remote_get_tib_address)
(remote_hostio_send_command, remote_can_execute_reverse): Use
packet_support.
(remote_supports_cond_tracepoints)
(remote_supports_cond_breakpoints)
(remote_supports_fast_tracepoints)
(remote_supports_static_tracepoints)
(remote_supports_install_in_trace)
(remote_supports_enable_disable_tracepoint)
(remote_supports_string_tracing)
(remote_can_run_breakpoint_commands): Rewrite, checking whether
the packet config says the feature is enabled or disabled.
(remote_download_tracepoint, remote_trace_set_readonly_regions)
(remote_get_trace_status): Use packet_support.
(remote_set_disconnected_tracing): Adjust to check whether the
feature is enabled with packet_support.
(remote_set_trace_buffer_size, remote_use_agent)
(remote_can_use_agent, remote_supports_btrace): Use
packet_support.
(remote_enable_btrace, remote_disable_btrace, remote_read_btrace):
Use packet_config_support.
(remote_augmented_libraries_svr4_read): Rewrite, checking whether
the packet config says the feature is enabled or disabled.
(set_range_stepping): Use packet_support.

gdb/testsuite/
2014-04-25  Pedro Alves  <palves@redhat.com>

* gdb.base/cond-eval-mode.exp (warning): Move trailing \r\n to
user.
(top level): Test that "set remote conditional-breakpoints-packet
off" works as intended.
* gdb.base/dprintf.exp: Test that "set remote
breakpoint-commands-packet off" works as intended.
* gdb.trace/change-loc.exp (tracepoint_install_in_trace_disabled):
New function.
(top level): Call it.
* gdb.trace/ftrace.exp (test_fast_tracepoints): Test that "set
remote fast-tracepoints-packet off" works as intended.
* gdb.trace/qtro.exp (gdb_is_target_remote): Moved ...
* lib/gdb.exp (gdb_is_target_remote): ... here.

10 years agoThis fixes a compile time warning which is being treated as an error. Older
Nick Clifton [Fri, 25 Apr 2014 16:00:20 +0000 (17:00 +0100)]
This fixes a compile time warning which is being treated as an error.  Older
versions of gcc complain about part of a conditional expression always
evaluating to false because of the size of the operands involved, even when
the entire expression is already known to be false.

* peXXigen.c (_bfd_XXi_swap_sym_out): Another fix for building on
a 342-bit host.  This time for older versions of gcc.

10 years agodocument "quit" command's argument
Tom Tromey [Fri, 25 Apr 2014 15:43:47 +0000 (09:43 -0600)]
document "quit" command's argument

2014-04-25  Tom Tromey  <tromey@redhat.com>

* cli/cli-cmds.c (_initialize_cli_cmds): Document "quit" command's
argument.

10 years agonews: mention support for C99 variable length arrays
Sanimir Agovic [Tue, 22 Apr 2014 14:26:33 +0000 (15:26 +0100)]
news: mention support for C99 variable length arrays

* NEWS: Mention support for C99 variable length arrays.

10 years agoEnsure unreferenced static symbols aren't omitted by clang (either marking them __att...
David Blaikie [Fri, 11 Apr 2014 06:45:28 +0000 (23:45 -0700)]
Ensure unreferenced static symbols aren't omitted by clang (either marking them __attribute__((used)) or making them non-static)

gdb/testsuite/
       * gdb.base/catch-syscall.c: Make unreferenced statics non-static to
       ensure clang would not discard them.
       * gdb.base/gdbvars.c: Ditto.
       * gdb.base/memattr.c: Ditto.
       * gdb.base/whatis.c: Ditto.
       * gdb.python/py-prettyprint.c: Ditto.
       * gdb.trace/actions.c: Ditto.
       * gdb.cp/ptype-cv-cp.cc: Mark unused global const int as used to
       ensure clang would not discard it.

10 years agoCause clang to emit the definition of a type used only by pointer
David Blaikie [Fri, 25 Apr 2014 05:16:29 +0000 (22:16 -0700)]
Cause clang to emit the definition of a type used only by pointer

gdb/testsuite/
* gdb.stabs/gdb11479.c (tag_dummy_enum): introduce a variable to cause
clang to emit the full definition of type required by the test
* gdb.stabs/gdb11479.exp (do_test): correct a typo in a test message

10 years agoReturn by value to coax Clang into emitting the full definition of a test type.
David Blaikie [Sun, 13 Apr 2014 07:48:45 +0000 (00:48 -0700)]
Return by value to coax Clang into emitting the full definition of a test type.

gdb/testsuite/
* gdb.cp/pr10728-x.cc: Return by value instead of pointer to coax
Clang into emitting the definition of the type.
* gdb.cp/pr10728-x.h: Ditto.
* gdb.cp/pr10728-y.cc: Ditto.

10 years agoXFAIL under Clang tests using labels
David Blaikie [Sun, 13 Apr 2014 18:42:02 +0000 (11:42 -0700)]
XFAIL under Clang tests using labels

gdb/testsuite/
* gdb.base/label.exp: XFAIL label related tests under Clang.
* gdb.cp/cplabel.exp: Ditto.
* gdb.linespec/ls-errs.exp: Refactor tests to execute directly
and XFAIL under Clang those using labels.

10 years agoRemove unused labels in dwarf assembler
Yao Qi [Thu, 24 Apr 2014 10:46:22 +0000 (18:46 +0800)]
Remove unused labels in dwarf assembler

I happen to see that 'double_label' isn't used in dwz.exp dwarf assembler.
Similarly, partial_label and double_label aren't used in dwzbuildid.exp.
This patch is to remove them.

gdb/testsuite:

2014-04-25  Yao Qi  <yao@codesourcery.com>

* gdb.dwarf2/dwz.exp (Dwarf::assemble): Remove unused
double_label.
* gdb.dwarf2/dwzbuildid.exp (Dwarf::assemble): Remove
partial_label and double_label.

10 years agodaily update
Alan Modra [Fri, 25 Apr 2014 00:00:56 +0000 (09:30 +0930)]
daily update

10 years agoAdd maintainers for OR1K.
Christian Svensson [Thu, 24 Apr 2014 22:40:41 +0000 (00:40 +0200)]
Add maintainers for OR1K.

* MAINTAINERS: Add myself and Stefan as OR1K maintainers.

10 years agoFix and XFAIL test due to GCC PR55641, passes with clang
David Blaikie [Sun, 13 Apr 2014 07:38:47 +0000 (00:38 -0700)]
Fix and XFAIL test due to GCC PR55641, passes with clang

gdb/testsuite/
* gdb.python/lib-types.exp: Fix test and xfail under gcc due to gcc/55641.

10 years agoada-lang.c: Expand standard_exc's introductory comment.
Joel Brobecker [Thu, 24 Apr 2014 20:16:38 +0000 (13:16 -0700)]
ada-lang.c: Expand standard_exc's introductory comment.

This patch expands standard_exc's introductory comment to explain
why this table does not include Numeric_Error.

gdb/ChangeLog:

        * ada-lang.c (standard_exc): Expand introductory comment.

10 years agoAdjust start-of-function braces to be compatible with Clang
David Blaikie [Mon, 14 Apr 2014 00:37:56 +0000 (17:37 -0700)]
Adjust start-of-function braces to be compatible with Clang

gdb/testsuite/
* gdb.cp/cpexprs.cc: Move braces to the same line as the start
of the function to work across GCC and Clang.
* gdb.cp/cpexprs.exp: Account for GCC/Clang difference in vtable
pointer types (const void ** const V void **).

10 years ago * peXXigen.c (rsrc_print_section): Fix compile time warning for
Nick Clifton [Thu, 24 Apr 2014 14:49:37 +0000 (15:49 +0100)]
* peXXigen.c (rsrc_print_section): Fix compile time warning for
32-bit hosts.

10 years agoAdd AVX512 registers support to GDB and GDBserver.
Michael Sturm [Mon, 16 Dec 2013 15:43:05 +0000 (16:43 +0100)]
Add AVX512 registers support to GDB and GDBserver.

This patch adds support for the Intel(R) Advanced Vector
Extensions 512 (Intel(R) AVX-512) registers.  Native and remote
debugging are covered by this patch.

Intel(R) AVX-512 is an extension to AVX to support 512-bit wide
SIMD registers in 64-bit mode (XMM0-XMM31, YMM0-YMM31, ZMM0-ZMM31).
The number of available registers in 32-bit mode is still 8
(XMM0-7, YMM0-7, ZMM0-7).  The lower 256-bits of the ZMM registers
are aliased to the respective 256-bit YMM registers.  The lower
128-bits are aliased to the respective 128-bit XMM registers.

There are also 8 new, dedicated mask registers (K0-K7) in both 32-bit
mode and 64-bit mode.

For more information please see
Intel(R) Developer Zone: Intel(R) AVX
http://software.intel.com/en-us/intel-isa-extensions#pid-16007-1495

Intel(R) Architecture Instruction Set Extensions Programming Reference:
http://software.intel.com/en-us/file/319433-017pdf

2014-04-24  Michael Sturm  <michael.sturm@mintel.com>
            Walfred Tedeschi  <walfred.tedeschi@intel.com>

     * amd64-linux-nat.c (amd64_linux_gregset32_reg_offset): Add
     AVX512 registers.
     (amd64_linux_read_description): Add code to handle AVX512 xstate
     mask and return respective tdesc.
     * amd64-linux-tdep.c: Include features/i386/amd64-avx512-linux.c
     and features/i386/x32-avx512-linux.c.
     (amd64_linux_gregset_reg_offset): Add AVX512 registers.
     (amd64_linux_core_read_description): Add code to handle AVX512
     xstate mask and return respective tdesc.
     (_initialize_amd64_linux_tdep): Initialize AVX512 tdesc.
     * amd64-linux-tdep.h (AMD64_LINUX_ORIG_RAX_REGNUM): Adjust regnum
     calculation.
     (AMD64_LINUX_NUM_REGS): Adjust to new number of registers.
     (tdesc_amd64_avx512_linux): New prototype.
     (tdesc_x32_avx512_linux): Likewise.
     * amd64-tdep.c: Include features/i386/amd64-avx512.c and
     features/i386/x32-avx512.c.
     (amd64_ymm_avx512_names): New register names for pseudo
     registers YMM16-31.
     (amd64_ymmh_avx512_names): New register names for raw registers
     YMMH16-31.
     (amd64_k_names): New register names for K registers.
     (amd64_zmmh_names): New register names for ZMM raw registers.
     (amd64_zmm_names): New registers names for ZMM pseudo registers.
     (amd64_xmm_avx512_names): New register names for XMM16-31
     registers.
     (amd64_pseudo_register_name): Add code to return AVX512 pseudo
     registers.
     (amd64_init_abi): Add code to intitialize AVX512 tdep variables
     if feature is present.
     (_initialize_amd64_tdep): Call AVX512 tdesc initializers.
     * amd64-tdep.h (enum amd64_regnum): Add AVX512 registers.
     (AMD64_NUM_REGS): Adjust to new number of registers.
     * i386-linux-nat.c (GETXSTATEREGS_SUPPLIES): Extend range of
     registers supplied via XSTATE by AVX512 registers.
     (i386_linux_read_description): Add case for AVX512.
     * i386-linux-tdep.c: Include i386-avx512-linux.c.
     (i386_linux_gregset_reg_offset): Add AVX512 registers.
     (i386_linux_core_read_description): Add case for AVX512.
     (i386_linux_init_abi): Install supported register note section
     for AVX512.
     (_initialize_i386_linux_tdep): Add call to tdesc init function for
     AVX512.
     * i386-linux-tdep.h (I386_LINUX_NUM_REGS): Set number of
     registers to be number of zmm7h + 1.
     (tdesc_i386_avx512_linux): Add tdesc for AVX512 registers.
     * i386-tdep.c: Include features/i386/i386-avx512.c.
     (i386_zmm_names): Add ZMM pseudo register names array.
     (i386_zmmh_names): Add ZMM raw register names array.
     (i386_k_names): Add K raw register names array.
     (num_lower_zmm_regs): Add constant for the number of lower ZMM
     registers. AVX512 has 16 more ZMM registers than there are YMM
     registers.
     (i386_zmmh_regnum_p): Add function to look up register number of
     ZMM raw registers.
     (i386_zmm_regnum_p): Likewise for ZMM pseudo registers.
     (i386_k_regnum_p): Likewise for K raw registers.
     (i386_ymmh_avx512_regnum_p): Likewise for additional YMM raw
     registers added by AVX512.
     (i386_ymm_avx512_regnum_p): Likewise for additional YMM pseudo
     registers added by AVX512.
     (i386_xmm_avx512_regnum_p): Likewise for additional XMM registers
     added by AVX512.
     (i386_register_name): Add code to hide YMMH16-31 and ZMMH0-31.
     (i386_pseudo_register_name): Add ZMM pseudo registers.
     (i386_zmm_type): Construct and return vector registers type for ZMM
     registers.
     (i386_pseudo_register_type): Return appropriate type for YMM16-31,
     ZMM0-31 pseudo registers and K registers.
     (i386_pseudo_register_read_into_value): Add code to read K, ZMM
     and YMM16-31 registers from register cache.
     (i386_pseudo_register_write): Add code to write  K, ZMM and
     YMM16-31 registers.
     (i386_register_reggroup_p): Add code to include/exclude AVX512
     registers in/from respective register groups.
     (i386_validate_tdesc_p): Handle AVX512 feature, add AVX512
     registers if feature is present in xcr0.
     (i386_gdbarch_init): Add code to initialize AVX512 feature
     variables in tdep structure, wire in pseudo registers and call
     initialize_tdesc_i386_avx512.
     * i386-tdep.h (struct gdbarch_tdep): Add AVX512 related
     variables.
     (i386_regnum): Add AVX512 registers.
     (I386_SSE_NUM_REGS): New define for number of SSE registers.
     (I386_AVX_NUM_REGS): Likewise for AVX registers.
     (I386_AVX512_NUM_REGS): Likewise for AVX512 registers.
     (I386_MAX_REGISTER_SIZE): Change to 64 bytes, ZMM registers are
     512 bits wide.
     (i386_xmm_avx512_regnum_p): New prototype for register look up.
     (i386_ymm_avx512_regnum_p): Likewise.
     (i386_k_regnum_p): Likewise.
     (i386_zmm_regnum_p): Likewise.
     (i386_zmmh_regnum_p): Likewise.
     * i387-tdep.c : Update year in copyright notice.
     (xsave_ymm_avx512_offset): New table for YMM16-31 offsets in
     XSAVE buffer.
     (XSAVE_YMM_AVX512_ADDR): New macro.
     (xsave_xmm_avx512_offset): New table for XMM16-31 offsets in
     XSAVE buffer.
     (XSAVE_XMM_AVX512_ADDR): New macro.
     (xsave_avx512_k_offset): New table for K register offsets in
     XSAVE buffer.
     (XSAVE_AVX512_K_ADDR): New macro.
     (xsave_avx512_zmm_h_offset): New table for ZMM register offsets
     in XSAVE buffer.
     (XSAVE_AVX512_ZMM_H_ADDR): New macro.
     (i387_supply_xsave): Add code to supply AVX512 registers to XSAVE
     buffer.
     (i387_collect_xsave): Add code to collect AVX512 registers from
     XSAVE buffer.
     * i387-tdep.h (I387_NUM_XMM_AVX512_REGS): New define for number
     of XMM16-31 registers.
     (I387_NUM_K_REGS): New define for number of K registers.
     (I387_K0_REGNUM): New define for K0 register number.
     (I387_NUM_ZMMH_REGS): New define for number of ZMMH registers.
     (I387_ZMM0H_REGNUM): New define for ZMM0H register number.
     (I387_NUM_YMM_AVX512_REGS): New define for number of YMM16-31
     registers.
     (I387_YMM16H_REGNUM): New define for YMM16H register number.
     (I387_XMM16_REGNUM): New define for XMM16 register number.
     (I387_YMM0_REGNUM): New define for YMM0 register number.
     (I387_KEND_REGNUM): New define for last K register number.
     (I387_ZMMENDH_REGNUM): New define for last ZMMH register number.
     (I387_YMMH_AVX512_END_REGNUM): New define for YMM31 register
     number.
     (I387_XMM_AVX512_END_REGNUM): New define for XMM31 register
     number.
     * common/i386-xstate.h: Add AVX 3.1 feature bits, mask and XSTATE
     size.
     * features/Makefile: Add AVX512 related files.
     * features/i386/32bit-avx512.xml: New file.
     * features/i386/64bit-avx512.xml: Likewise.
     * features/i386/amd64-avx512-linux.c: Likewise.
     * features/i386/amd64-avx512-linux.xml: Likewise.
     * features/i386/amd64-avx512.c: Likewise.
     * features/i386/amd64-avx512.xml: Likewise.
     * features/i386/i386-avx512-linux.c: Likewise.
     * features/i386/i386-avx512-linux.xml: Likewise.
     * features/i386/i386-avx512.c: Likewise.
     * features/i386/i386-avx512.xml: Likewise.
     * features/i386/x32-avx512-linux.c: Likewise.
     * features/i386/x32-avx512-linux.xml: Likewise.
     * features/i386/x32-avx512.c: Likewise.
     * features/i386/x32-avx512.xml: Likewise.
     * regformats/i386/amd64-avx512-linux.dat: New file.
     * regformats/i386/amd64-avx512.dat: Likewise.
     * regformats/i386/i386-avx512-linux.dat: Likewise.
     * regformats/i386/i386-avx512.dat: Likewise.
     * regformats/i386/x32-avx512-linux.dat: Likewise.
     * regformats/i386/x32-avx512.dat: Likewise.
     * NEWS: Add note about new support for AVX512.

testsuite/
     * Makefile.in (EXECUTABLES): Added i386-avx512.
     * gdb.arch/i386-avx512.c: New file.
     * gdb.arch/i386-avx512.exp: Likewise.

gdbserver/
     * Makefile.in: Added rules to handle new files
     i386-avx512.c i386-avx512-linux.c amd64-avx512.c
     amd64-avx512-linux.c x32-avx512.c x32-avx512-linux.c.
     * configure.srv (srv_i386_regobj): Add i386-avx512.o.
     (srv_i386_linux_regobj): Add i386-avx512-linux.o.
     (srv_amd64_regobj): Add amd64-avx512.o and x32-avx512.o.
     (srv_amd64_linux_regobj): Add amd64-avx512-linux.o and
     x32-avx512-linux.o.
     (srv_i386_32bit_xmlfiles): Add i386/32bit-avx512.xml.
     (srv_i386_64bit_xmlfiles): Add i386/64bit-avx512.xml.
     (srv_amd64_xmlfiles): Add i386/amd64-avx512.xml and
     i386/x32-avx512.xml.
     (srv_i386_linux_xmlfiles): Add i386/i386-avx512-linux.xml.
     (srv_amd64_linux_xmlfiles): Add i386/amd64-avx512-linux.xml and
     i386/x32-avx512-linux.xml.
     * i387-fp.c (num_avx512_k_registers): New constant for number
     of K registers.
     (num_avx512_zmmh_low_registers): New constant for number of
     lower ZMM registers (0-15).
     (num_avx512_zmmh_high_registers): New constant for number of
     higher ZMM registers (16-31).
     (num_avx512_ymmh_registers): New contant for number of higher
     YMM registers (ymm16-31 added by avx521 on x86_64).
     (num_avx512_xmm_registers): New constant for number of higher
     XMM registers (xmm16-31 added by AVX512 on x86_64).
     (struct i387_xsave): Add space for AVX512 registers.
     (i387_cache_to_xsave): Change raw buffer size to 64 characters.
     Add code to handle AVX512 registers.
     (i387_xsave_to_cache): Add code to handle AVX512 registers.
     * linux-x86-low.c (init_registers_amd64_avx512_linux): New
     prototypei from generated file.
     (tdesc_amd64_avx512_linux): Likewise.
     (init_registers_x32_avx512_linux): Likewise.
     (tdesc_x32_avx512_linux): Likewise.
     (init_registers_i386_avx512_linux): Likewise.
     (tdesc_i386_avx512_linux): Likewise.
     (x86_64_regmap): Add AVX512 registers.
     (x86_linux_read_description): Add code to handle AVX512 XSTATE
     mask.
     (initialize_low_arch): Add code to initialize AVX512 registers.

doc/
     * gdb.texinfo (i386 Features): Add description of AVX512
     registers.

Change-Id: Ifc4c08c76b85dbec18d02efdbe6182e851584438
Signed-off-by: Michael Sturm <michael.sturm@intel.com>
10 years agoPR16867, linking object with separate debug file
Alan Modra [Thu, 24 Apr 2014 12:29:56 +0000 (21:59 +0930)]
PR16867, linking object with separate debug file

This teaches the DWARF2 find_line functions how to deal with separate
debug relocatable object files.  Also fixes a major bug:
When _bfd_dwarf2_slurp_debug_info was split out, place_sections ran
after .debug_info was relocated.  This defeated the whole purpose of
place_sections.  See the comment I added before place_sections.
Fixes some minor bugs too:
- place_sections didn't set VMA for alloc but non-load sections (bss).
- zero size sections can have symbols, so they need their VMA set too.
- last_vma was incorrectly adjusted.
- my last change to place_sections left VMA unchanged for .debug_info
  when the linker has mapped input to output sections, but this is
  wrong since bfd_simple_get_relocated_section_contents unmaps debug
  sections.

PR 16867
* dwarf2.c: Formatting.
(struct dwarf2_debug): Make adjusted_section_count signed.
(unset_sections): Make i signed.
(set_debug_vma): New function.
(place_sections): Handle separate debug object file.  Set VMA
on debug sections, even if they have an output section.  Also
set VMA on zero size sections, and non-load but alloc sections.
Set adjusted_section_count to -1 when no section adjustment.
Malloc adjusted_sections.  Don't double last_vma.  Transfer
alloc section VMAs to separate debug file.
(_bfd_dwarf2_cleanup_debug_info): Free adjusted_sections.
(_bfd_dwarf2_slurp_debug_info): Add do_place parameter.  Drop
test on symbols being the same before using old stash.  Read
and use separate debug file symbols.  Call place_sections.
(find_line): Don't call place_sections here.
* libbfd-in.h (_bfd_dwarf2_slurp_debug_info): Update proto.
* libbfd.h: Regenerate.
* mach-o.c (bfd_mach_o_find_nearest_line): Adjust
_bfd_dwarf2_slurp_debug_info call.
* simple.c (simple_save_output_info): Clarify comment.

10 years agoFix a problem building the ARM assembler for non-ELF based toolchains.
Nick Clifton [Thu, 24 Apr 2014 10:35:51 +0000 (11:35 +0100)]
Fix a problem building the ARM assembler for non-ELF based toolchains.

* config/tc-arm.c (s_ltorg): Only create a mapping symbol for ELF
based targets.

10 years agoFix PE/COFF resource merging problems. There were two issues:
Nick Clifton [Thu, 24 Apr 2014 10:15:43 +0000 (11:15 +0100)]
Fix PE/COFF resource merging problems.  There were two issues:

  1. Strings (and then resource data) must follow immediately after
     the end of the tables.
  2. Units of resource data must be 8-byte aligned.

PR ld/16807
* peXXigen.c (struct rsrc_regions): New structure.
(rsrc_print_resource_directory): Use new structure.  Include
offset of directory in listing.
(rsrc_print_resource_entry): Likewise.
(rsrc_print_section): Likewise.
(rsrc_count_entries): Do not increment sizeof_strings or
sizeof_leaves.
(rsrc_count_directory): Do not increment sizeof_tables.
(rsrc_compute_region_sizes): New function.
(rsrc_write_leaf): Maintain 8-byte alignment for resource data.
(rsrc_process_section): Compute size of regions after merging
entries.

10 years agodaily update
Alan Modra [Thu, 24 Apr 2014 00:00:44 +0000 (09:30 +0930)]
daily update

10 years agoAdd missing PR ref to ChangeLog entry.
Cary Coutant [Wed, 23 Apr 2014 22:20:56 +0000 (15:20 -0700)]
Add missing PR ref to ChangeLog entry.

10 years agoAdd missing break statement for case elfcpp::R_X86_64_PLTOFF64.
Cary Coutant [Wed, 23 Apr 2014 22:17:16 +0000 (15:17 -0700)]
Add missing break statement for case elfcpp::R_X86_64_PLTOFF64.

gold/
* x86_64.cc (Target_x86_64::Relocate::relocate): Add missing break.

10 years agoIntroduce some new MI test suite cleanups for breakpoint and
Keith Seitz [Wed, 23 Apr 2014 19:17:31 +0000 (12:17 -0700)]
Introduce some new MI test suite cleanups for breakpoint and
breakpoint table handling.  This is a patch in five parts (all committed
here in one commit).

----- 1/5: parse_args
parse_args is a very useful utility function which allows you to do
getopt-y kinds of things in Tcl.

Example:
proc myproc {foo args} {
        parse_args {{bar} {baz "abc"} {qux}}
          # ...
}
myproc ABC -bar -baz DEF peanut butter

will define the following variables in myproc:
foo (=ABC), bar (=1), baz (=DEF), and qux (=0)
args will be the list {peanut butter}

----- 2/5: mi_build_kv_pairs
build_kv_pairs simply does what it says: given the input list
and an option join string, it combines list elements into kv-pairs
for MI handling.  It knows how to handle tuples and other special
MI types.

Example:
mi_build_kv_pairs {a b c d e f g \[.*\]}
returns a=\"b\",c=\"d\",e=\"f\",g=\[.*\]

----- 3/5: mi_make_breakpoint
This function builds breakpoint regexps, such as
"bkpt={number=\".*\", [snip]}".

Note that ONLY the options given to mi_make_breakpoint/mi_create_breakpoint
will actually be tested. So if -number is omitted, the regexp will allow
anything [number=\".*\"]

Examples:
mi_make_breakpoint -number 3

mi_create_breakpoint "myfile.c:21" -file myfile.c -line 21

----- 4/5: mi_make_breakpoint_table
This function builds MI breakpoint table regexps.

Example:
set bps {}
lappend bps [mi_make_breakpoint -number 1 -func "main" \
    -file ".*/myfile.c" -line 42
lappend bps [mi_make_breakpoint -number 2 -func "marker" \
    -file ".*myfile.c" -line 21
gdb_test "-break-info" "\\^done,[mi_make_breakpoint_table $bps]" \
    "breakpoint list"

----- 5/5: Update all callers
Self-explanatory

testsuite/ChangeLog
2014-04-23  Keith Seitz  <keiths@redhat.com>

* lib/mi-support.exp (mi_list_breakpoints): Delete.
(mi_make_breakpoint_table): New procedure.
(mi_create_breakpoint): Use mi_make_breakpoint
and return the result.
(mi_make_breakpoint): New procedure.
(mi_build_kv_pairs): New procedure.

* gdb.mi/mi-break.exp: Remove unused globals,
update mi_create_breakpoint usage, and use mi_make_breakpoint_table.
All callers updated.
* gdb.mi/mi-dprintf.exp: Use variable to track command
number.
Update all callers of mi_create_breakpoint and use
mi_make_breakpoint_table.
Remove any unused global variables.
* gdb.mi/mi-nonstop.exp: Likewise.
* gdb.mi/mi-nsintrall.exp: Likewise.
* gdb.mi/mi-nsmoribund.exp: Likewise.
* gdb.mi/mi-nsthrexec.exp: Likewise.
* gdb.mi/mi-reverse.exp: Likewise.
* gdb.mi/mi-simplerun.exp: Likewise.
* gdb.mi/mi-stepn.exp: Likewise.
* gdb.mi/mi-syn-frame.exp: Likewise.
* gdb.mi/mi-until.exp: Likewise.
* gdb.mi/mi-var-cp.exp: Likewise.
* gdb.mi/mi-var-display.exp: Likewise.
* gdb.mi/mi2-amd64-entry-value.exp: Likewise.
* gdb.mi/mi2-var-child.exp: Likewise.
* gdb.mi/mi-vla-c99.exp: Likewise.
* lib/mi-support.exp: Likewise.

From Ian Lance Taylor  <iant@cygnus.com>:
* lib/gdb.exp (parse_args): New procedure.

10 years ago[gdbserver] mem-break.c:find_gdb_breakpoint_at: Make static.
Pedro Alves [Tue, 22 Apr 2014 18:47:06 +0000 (19:47 +0100)]
[gdbserver] mem-break.c:find_gdb_breakpoint_at: Make static.

Nothing calls this outside mem-break.c.

gdb/gdbserver/
2014-04-23  Pedro Alves  <palves@redhat.com>

* mem-break.c (find_gdb_breakpoint_at): Make static.
* mem-break.h (find_gdb_breakpoint_at): Delete declaration.

10 years agogdbserver: decouple x86 watchpoint / hw breakpoint routines from Z packet numbers.
Pedro Alves [Tue, 22 Apr 2014 18:47:04 +0000 (19:47 +0100)]
gdbserver: decouple x86 watchpoint / hw breakpoint routines from Z packet numbers.

My main motivation here is moving in the direction of decoupling
insert_point/remove_point from packet numbers, though this bit alone
should make it a little bit easier to merge gdb/gdbserver/i386-low.c
and gdb/i386-nat.c (which are largely the same).

Tested on x86_64 Fedora 17, and cross built for i686-mingw32 too.

gdb/gdbserver/
2014-04-23  Pedro Alves  <palves@redhat.com>

* i386-low.c: Don't include break-common.h here.
(i386_low_insert_watchpoint, i386_low_remove_watchpoint): Change
prototype to take target_hw_bp_type as argument instead of a Z
packet char.
* i386-low.h: Include break-common.h here.
(Z_packet_to_hw_type): Declare.
(i386_low_insert_watchpoint, i386_low_remove_watchpoint): Change
prototypes.
* linux-x86-low.c (x86_insert_point): Convert the packet number to
a target_hw_bp_type before calling i386_low_insert_watchpoint.
(x86_remove_point): Convert the packet number to a
target_hw_bp_type before calling i386_low_remove_watchpoint.
* win32-i386-low.c (i386_insert_point): Convert the packet number
to a target_hw_bp_type before calling i386_low_insert_watchpoint.
(i386_remove_point): Convert the packet number to a
target_hw_bp_type before calling i386_low_remove_watchpoint.

10 years agogdbserver: perror_with_name: Add ATTRIBUTE_NORETURN.
Pedro Alves [Tue, 22 Apr 2014 18:47:03 +0000 (19:47 +0100)]
gdbserver: perror_with_name: Add ATTRIBUTE_NORETURN.

perror_with_name doesn't return, but unlike gdb's version, it wasn't
marked that way.

gdb/gdbserver/
2014-04-23  Pedro Alves  <palves@redhat.com>

* utils.h (perror_with_name): Add ATTRIBUTE_NORETURN.

10 years agoStale breakpoint instructions, spurious SIGTRAPS.
Pedro Alves [Tue, 22 Apr 2014 22:19:19 +0000 (23:19 +0100)]
Stale breakpoint instructions, spurious SIGTRAPS.

Without the code portion of the patch, we get these failures:

 FAIL: gdb.base/break-unload-file.exp: always-inserted on: break: continue
 FAIL: gdb.base/break-unload-file.exp: always-inserted on: hbreak: continue
 FAIL: gdb.base/sym-file.exp: stale bkpts: continue to breakpoint: end here

They all looks like random SIGTRAPs:

 continue
 Continuing.

 Program received signal SIGTRAP, Trace/breakpoint trap.
 0x0000000000400541 in foo () at ../../../src/gdb/testsuite/gdb.base/break-unload-file.c:21
 21      }
 (gdb) FAIL: gdb.base/break-unload-file.exp: always-inserted on: break: continue

(This is a regression caused by the remove-symbol-file command
series.)

break-unload-file.exp is about having breakpoints inserted, and then
doing "file".  I caught this while writing a test that does "file
PROGRAM", while PROGRAM was already loaded, which internally does
"file" first, because I wanted to force a breakpoint_re_set, but the
test is more explicit in case GDB ever optimizes out that re-set.

The problem is that unloading the file with "file" ends up in
disable_breakpoints_in_freed_objfile, which marks all breakpoint
locations of the objfile as both shlib_disabled, _and_ clears the
inserted flag, without actually removing the breakpoints from the
inferior.  Now, usually, in all-stop, breakpoints will already be
removed from the inferior before the user can issue the "file"
command, but, with non-stop, or breakpoints always-inserted on mode,
breakpoints stay inserted even while the user has the prompt.  In the
latter case, then, if we let the program continue, and it executes the
address where we had previously set the breakpoint, it'll actually
execute the breakpoint instruction that we left behind...

Now, one issue is that the intent of
disable_breakpoints_in_freed_objfile is really to handle the unloading
of OBJF_USERLOADED objfiles.  These are objfiles that were added with
add-symbol-file and that are removed with remove-symbol-file.

"add-symbol-file"'s docs in the manual clearly say these commands are
used to let GDB know about dynamically loaded code:

 You would use this command when @var{filename} has been dynamically
 loaded (by some other means) into the program that is running.

Similarly, the online help says:

 (gdb) help add-symbol-file
 Load symbols from FILE, assuming FILE has been dynamically loaded.

So it makes sense to, like when shared libraries are unloaded through
the generic solib machinery, mark the breakpoint locations as
shlib_disabled.  But, the "file" command is not about dynamically
loaded code, it's about the main program.  So the patch makes
disable_breakpoints_in_freed_objfile skip all objfiles but
OBJF_USERLOADED ones, thus skipping the main objfile.

Then, the reason that disable_breakpoints_in_freed_objfile was
clearing the inserted flag isn't clear, but likely to avoid breakpoint
removal errors, assuming remove-symbol-file was called after the
dynamic object was already unmapped from the inferior.  In that case,
it'd okay to simply clear the inserted flag, but not so if the user
for example does remove-symbol-file to remove the library because he
made a mistake in the library's address, and wants to re-do
add-symbol-file with the correct address.

To address all that, I propose an alternative implementation, that
handles both cases.  The patch includes changes to sym-file.exp to
cover them.

This implementation leaves the inserted flag alone, and handles
breakpoint insertion/removal failure gracefully when the locations are
in OBJF_USERLOADED objfiles, just like we handle insertion/removal
failure gracefully for locations in shared libraries.

To try to make sure we aren't patching back stale shadow memory
contents into the inferior, in case the program mapped a different
library at the same address where we had the breakpoint, without the
user having had a chance of remove-symbol-file'ing before, this adds a
new memory_validate_breakpoint function that checks if the breakpoint
instruction is still in memory.  ppc_linux_memory_remove_breakpoint
does this unconditionally for all memory breakpoints, and questions
whether memory_remove_breakpoint should be changed to do this for all
breakpoints.  Possibly yes, though I'm not certain, hence this
baby-steps patch.

Tested on x86_64 Fedora 17, native and gdbserver.

gdb/
2014-04-23  Pedro Alves  <palves@redhat.com>

* breakpoint.c (insert_bp_location): Tolerate errors if the
breakpoint is set in a user-loaded objfile.
(remove_breakpoint_1): Likewise.  Also tolerate errors if the
location is marked shlib_disabled.  If the breakpoint is set in a
user-loaded objfile is a GDB-side memory breakpoint, validate it
before uninsertion.  (disable_breakpoints_in_freed_objfile): Skip
non-OBJF_USERLOADED objfiles.  Don't clear the location's inserted
flag.
* mem-break.c (memory_validate_breakpoint): New function.
* objfiles.c (userloaded_objfile_contains_address_p): New
function.
* objfiles.h (userloaded_objfile_contains_address_p): Declare.
* target.h (memory_validate_breakpoint): New declaration.

gdb/testsuite/
2014-04-23  Pedro Alves  <palves@redhat.com>

* gdb.base/break-unload-file.c: New file.
* gdb.base/break-unload-file.exp: New file.
* gdb.base/sym-file-lib.c (baz): New function.
* gdb.base/sym-file-loader.c (struct segment) <mapped_size>: New
field.
(load): Store the segment's mapped size.
(unload): New function.
(unload_shlib): New function.
* gdb.base/sym-file-loader.h (unload_shlib): New declaration.
* gdb.base/sym-file-main.c (main): Unload, and reload the library,
set a breakpoint at baz, and call it.
* gdb.base/sym-file.exp: New tests for stale breakpoint
instructions.

10 years agoDon't suppress errors inserting/removing hardware breakpoints in shared
Pedro Alves [Wed, 23 Apr 2014 14:06:47 +0000 (15:06 +0100)]
Don't suppress errors inserting/removing hardware breakpoints in shared
libraries.

As explained in
https://sourceware.org/ml/gdb-patches/2008-08/msg00361.html, after a
shared library was unloaded, we can no longer insert or remove
breakpoints into/from its (no longer present) code segment.  That'll
fail with memory errors.  However, that concern does not apply to
hardware breakpoints.  By definition, hardware breakpoints are
implemented using a mechanism that is not dependent on being able to
modify the target's memory.  Usually, by setting up CPU debug
registers.  IOW, we should be able to set hw breakpoints in an
unmapped address.  We don't seem to have a test that exercises that,
so this patch adds one.

I noticed the error supression because of a related issue -- the
target_insert_hw_breakpoint/target_remove_hw_breakpoint interfaces
don't really distinguish "not supported" from "error" return, and so
remote.c returns -1 in both cases.  This results in hardware
breakpoints set in shared libraries silently ending up pending forever
even though the target doesn't actually support hw breakpoints.

 (gdb) set breakpoint always-inserted on
 (gdb) set remote Z-packet off
 (gdb) info breakpoints
 No breakpoints or watchpoints.
 (gdb) hbreak shrfunc
 Hardware assisted breakpoint 3 at 0x7ffff7dfb657: file ../../../src/gdb/testsuite/gdb.base/hbreak-in-shr-unsupported-shr.c, line 21.
 (gdb) info break
 Num     Type           Disp Enb Address            What
 3       hw breakpoint  keep y   <PENDING>          shrfunc

After the patch we get the expected:

 (gdb) hbreak shrfunc
 Hardware assisted breakpoint 3 at 0x7ffff7dfb657: file ../../../src/gdb/testsuite/gdb.base/hbreak-in-shr-unsupported-shr.c, line 21.
 Warning:
 Cannot insert hardware breakpoint 3.
 Could not insert hardware breakpoints:
 You may have requested too many hardware breakpoints/watchpoints.

 (gdb) info break
 Num     Type           Disp Enb Address            What
 3       hw breakpoint  keep y   0x00007ffff7dfb657 in shrfunc at ../../../src/gdb/testsuite/gdb.base/hbreak-in-shr-unsupported-shr.c:21

(HW breakpoints set in the main executable, when the target doesn't
support HW breakpoints always resulted in the latter output.)

We probably should improve the insert/remove interface to return a
different error code for unsupported.  But I chose to fix the error
supression first, as it's a deeper and wider issue.

Tested on x86_64 Fedora 17, native and gdbserver.

gdb/
2014-04-23  Pedro Alves  <palves@redhat.com>

* breakpoint.c (insert_bp_location, remove_breakpoint_1): If
the breakpoint is set in a shared library, only suppress
errors for software breakpoints, not hardware breakpoints.

gdb/testsuite/
2014-04-23  Pedro Alves  <palves@redhat.com>

* gdb.base/hbreak-in-shr-unsupported-shr.c: New file.
* gdb.base/hbreak-in-shr-unsupported.c: New file.
* gdb.base/hbreak-in-shr-unsupported.exp: New file.
* gdb.base/hbreak-unmapped.c: New file.
* gdb.base/hbreak-unmapped.exp: New file.
* gdb.trace/qtro.exp (gdb_is_target_remote): Move ...
* lib/gdb.exp (gdb_is_target_remote): ... here.

10 years agold/arm: Fix testsuite failures for armeb-linux-eabi
Will Newton [Fri, 4 Apr 2014 14:08:50 +0000 (15:08 +0100)]
ld/arm: Fix testsuite failures for armeb-linux-eabi

Fix all the cases where endianness needs to be taken into account
in the ARM ld dump tests.

ld/testsuite/ChangeLog:

2014-04-23  Will Newton  <will.newton@linaro.org>

* ld-arm/arm-no-rel-plt.ld: Remove OUTPUT_FORMAT and
SEARCH_DIR commands.
* ld-arm/arm-rel32.d: Update regexps to allow test to
pass on armeb-linux-eabi configuration.
* ld-arm/data-only-map.d: Likewise.
* ld-arm/fix-arm1176-off.d: Likewise.
* ld-arm/fix-arm1176-on.d: Likewise.
* ld-arm/ifunc-1.gd: Likewise.
* ld-arm/ifunc-10.gd: Likewise.
* ld-arm/ifunc-11.gd: Likewise.
* ld-arm/ifunc-12.gd: Likewise.
* ld-arm/ifunc-13.gd: Likewise.
* ld-arm/ifunc-14.gd: Likewise.
* ld-arm/ifunc-15.gd: Likewise.
* ld-arm/ifunc-16.gd: Likewise.
* ld-arm/ifunc-17.gd: Likewise.
* ld-arm/ifunc-2.gd: Likewise.
* ld-arm/ifunc-3.gd: Likewise.
* ld-arm/ifunc-4.gd: Likewise.
* ld-arm/ifunc-5.gd: Likewise.
* ld-arm/ifunc-6.gd: Likewise.
* ld-arm/ifunc-7.gd: Likewise.
* ld-arm/ifunc-8.gd: Likewise.
* ld-arm/ifunc-9.gd: Likewise.
* ld-arm/jump-reloc-veneers-long.d: Likewise.
* ld-arm/reloc-boundaries.d: Likewise.

10 years agogas/arm: Fix gas tests to run on armeb-linux-eabi
Will Newton [Fri, 4 Apr 2014 10:52:59 +0000 (11:52 +0100)]
gas/arm: Fix gas tests to run on armeb-linux-eabi

Fix various places where endianness needed to be taken into account
in the gas testsuite for ARM.

gas/testsuite/ChangeLog:

2014-04-23  Will Newton  <will.newton@linaro.org>

* gas/arm/backslash-at.d: Fix dump output regexps for
armeb-linux-eabi configuration.
* gas/arm/got_prel.d: Likewise.
* gas/arm/inst-po.d: Likewise.
* gas/arm/unwind.d: Likewise.

10 years agogas/arm: Force output of a data mapping symbol for literal pools
Will Newton [Fri, 4 Apr 2014 09:07:06 +0000 (10:07 +0100)]
gas/arm: Force output of a data mapping symbol for literal pools

If there is a a trailing align statement in a code section we may
output data padding with a data mapping followed by a code alignment
with a code mapping. The literal pool may then be output with a code
mapping symbol which will cause it to be endian swapped in a big-endian
configuration. When outputting a literal pool make sure that a data
mapping symbol is output in all cases.

gas/ChangeLog:

2014-04-23  Will Newton  <will.newton@linaro.org>

* config/tc-arm.c (s_ltorg): Call make_mapping_symbol
directly instead of mapping_state.

gas/testsuite/ChangeLog:

2014-04-23  Will Newton  <will.newton@linaro.org>

* gas/arm/mapmisc.d: Check literal pool mapping with
a trailing .align statement.
* gas/arm/mapmisc.s: Likewise.

10 years agoAdd support for the MIPS eXtended Physical Address (XPA) ASE.
Andrew Bennett [Wed, 23 Apr 2014 10:24:30 +0000 (11:24 +0100)]
Add support for the MIPS eXtended Physical Address (XPA) ASE.

ChangeLog:

binutils/
* doc/binutils.texi: Document the disassemble MIPS XPA instructions
command line option.

gas/
* config/tc-mips.c (options): Add OPTION_XPA and OPTION_NO_XPA.
  (md_longopts): Add xpa and no-xpa command line options.
  (mips_ases): Add MIPS XPA ASE.
  (mips_cpu_info_table): Update p5600 entry to allow the XPA ASE.
  * doc/as.texinfo: Document the MIPS XPA command line options.
  * doc/c-mips.texi: Document the MIPS XPA command line options,
  and assembler directives.

gas/testsuite/
  * gas/mips/mips.exp: Add xpa tests.
  * gas/mips/xpa.s: New test.
  * gas/mips/xpa.d: Likewise.

include/
  * opcode/mips.h (ASE_XPA): New define.

opcodes/
  * mips-dis.c (mips_arch_choices): Update mips32r2 and mips64r2
  to allow the MIPS XPA ASE.
  (parse_mips_dis_option): Process the -Mxpa option.
  * mips-opc.c (XPA): New define.
  (mips_builtin_opcodes): Add MIPS XPA instructions and move the
  locations of the ctc0 and cfc0 instructions.

10 years agoPR ld/16787, stale dwarf2 stash
Alan Modra [Wed, 23 Apr 2014 04:56:19 +0000 (14:26 +0930)]
PR ld/16787, stale dwarf2 stash

Throw away the dwarf2 stash if it becomes invalid due to section
VMAs changing.  It would be nice to reclaim all the bfd_alloc
memory here when we throw away the stash, perhaps by putting
everything we alloc on a private dwarf2 objalloc, but I haven't done
that with this patch.

I've also fixed a problem with bfd_perform_relocation losing reloc
addends, which meant a second or subsequent look at debug info
sections did not properly relocate the sections.  I can't see why
bfd_perform_relocation should need to change addends except for ld -r,
and the history (985fca12e98e6ec1) doesn't help much.

Finally, the patch tweaks place_sections to avoid unnecessary work.
If we've mapped input to output sections, then input section VMA
isn't used so there's not much point in adjusting it.  Incidentally,
this also means place_sections isn't effective in all cases.

PR ld/16787
* dwarf2.c (struct dwarf2_debug): Add sec_vma field.
(place_sections): Do not modify VMA of sections when called from
linker after sections have been placed in output sections.  Short
circuit single section case.
(save_section_vma, section_vma_same): New functions.
(_bfd_dwarf2_slurp_debug_info): Throw away stash if section VMAs
change.
* reloc.c (bfd_perform_relocation): Do not modify reloc addend
when non-relocatable.

10 years agoAdd missing ChangeLog entries for nios2 gas selftest patch.
Sandra Loosemore [Wed, 23 Apr 2014 02:41:14 +0000 (19:41 -0700)]
Add missing ChangeLog entries for nios2 gas selftest patch.

10 years agodaily update
Alan Modra [Wed, 23 Apr 2014 00:00:59 +0000 (09:30 +0930)]
daily update

10 years agoFix alignment for the first section frag on xtensa
Max Filippov [Tue, 15 Apr 2014 15:12:46 +0000 (19:12 +0400)]
Fix alignment for the first section frag on xtensa

Linking object files produced by partial linking with link-time
relaxation enabled sometimes fails with the following error message:

dangerous relocation: call8: misaligned call target: (.text.unlikely+0x63)

This happens because no basic block with an XTENSA_PROP_ALIGN flag in the
property table is generated for the first basic block, even if the
.align directive is present.
It was believed that the first frag alignment could be derived from the
section alignment, but this was not implemented for the partial linking
case: after partial linking first frag of a section may become not
first, but no additional alignment frag is inserted before it.
Basic block for such frag may be merged with previous basic block into
extended basic block during relaxation pass losing its alignment
restrictions.

Fix this by always recording alignment for the first section frag.

2014-04-22  Max Filippov  <jcmvbkbc@gmail.com>

gas/
    * config/tc-xtensa.c (xtensa_handle_align): record alignment for the
    first section frag.

gas/testsuite/
    * gas/xtensa/all.exp: Add test for the first section frag alignment.
    * gas/xtensa/first_frag_align.d: First section frag alignment expected
    dump.
    * gas/xtensa/first_frag_align.s: First section frag alignment test
    source.

10 years agoConsecutive step-overs trigger internal error.
Pedro Alves [Tue, 22 Apr 2014 14:00:56 +0000 (15:00 +0100)]
Consecutive step-overs trigger internal error.

If a thread trips on a breakpoint that needs stepping over just after
finishing a step over, GDB currently fails an assertion.  This is a
regression caused by the "Handle multiple step-overs." patch
(99619beac6252113fed212fdb9e1ab97bface423) at
https://sourceware.org/ml/gdb-patches/2014-02/msg00765.html.

 (gdb) x /4i $pc
 => 0x400540 <main+4>:   movl   $0x0,0x2003da(%rip)        # 0x600924 <i>
    0x40054a <main+14>:  movl   $0x1,0x2003d0(%rip)        # 0x600924 <i>
    0x400554 <main+24>:  movl   $0x2,0x2003c6(%rip)        # 0x600924 <i>
    0x40055e <main+34>:  movl   $0x3,0x2003bc(%rip)        # 0x600924 <i>
 (gdb) PASS: gdb.base/consecutive-step-over.exp: get breakpoint addresses
 break *0x40054a
 Breakpoint 2 at 0x40054a: file ../../../src/gdb/testsuite/gdb.base/consecutive-step-over.c, line 23.
 (gdb) PASS: gdb.base/consecutive-step-over.exp: insn 1: set breakpoint
 condition $bpnum condition
 (gdb) PASS: gdb.base/consecutive-step-over.exp: insn 1: set condition
 break *0x400554
 Breakpoint 3 at 0x400554: file ../../../src/gdb/testsuite/gdb.base/consecutive-step-over.c, line 24.
 (gdb) PASS: gdb.base/consecutive-step-over.exp: insn 2: set breakpoint
 condition $bpnum condition
 (gdb) PASS: gdb.base/consecutive-step-over.exp: insn 2: set condition
 break *0x40055e
 Breakpoint 4 at 0x40055e: file ../../../src/gdb/testsuite/gdb.base/consecutive-step-over.c, line 25.
 (gdb) PASS: gdb.base/consecutive-step-over.exp: insn 3: set breakpoint
 condition $bpnum condition
 (gdb) PASS: gdb.base/consecutive-step-over.exp: insn 3: set condition
 break 27
 Breakpoint 5 at 0x400568: file ../../../src/gdb/testsuite/gdb.base/consecutive-step-over.c, line 27.
 (gdb) continue
 Continuing.
 ../../src/gdb/infrun.c:5200: internal-error: switch_back_to_stepped_thread: Assertion `!tp->control.trap_expected' failed.
 A problem internal to GDB has been detected,
 further debugging may prove unreliable.
 FAIL: gdb.base/consecutive-step-over.exp: continue to breakpoint: break here (GDB internal error)

The assertion fails, because the code is not expecting that the event
thread itself might need another step over.  IOW, not expecting that
TP in:

     tp = find_thread_needs_step_over (stepping_thread != NULL,
                                      stepping_thread);

could be the event thread.

A small fix for this would be to clear the event thread's
trap_expected earlier, before asserting.  But looking deeper, although
currently_stepping_or_nexting_callback's intention is finding the
thread that is doing a step/next, it also returns the thread that is
doing a step-over dance, with trap_expected set.  If there ever was a
reason for that (it was I who added
currently_stepping_or_nexting_callback , but I can't recall why I put
trap_expected there in the first place), the only remaining reason
nowadays is to aid in implementing switch_back_to_stepped_thread's
assertion that is now triggering, by piggybacking on the walk over all
threads, thus avoiding a separate walk.  This is quite obscure, and I
think we can do even better, by merging the walks that look for the
stepping thread, and the walk that looks for some thread that might
need a step over.

Tested on x86_64 Fedora 17, native and gdbserver, and also native on
top of my "software single-step on x86_64" series.

gdb/
2014-04-22  Pedro Alves  <palves@redhat.com>

* infrun.c (schedlock_applies): New function, factored out from
find_thread_needs_step_over.
(find_thread_needs_step_over): Use it.
(switch_back_to_stepped_thread): Always clear trap_expected if the
step over is finished.  Return early if scheduler locking applies.
Look for the stepping thread and a potential step-over thread with
a single loop.
(currently_stepping_or_nexting_callback): Delete.

2014-04-22  Pedro Alves  <palves@redhat.com>

* gdb.base/consecutive-step-over.c: New file.
* gdb.base/consecutive-step-over.exp: New file.

10 years agoMake gdb_continue_to_breakpoint fail quickly on internal errors.
Pedro Alves [Tue, 22 Apr 2014 18:15:48 +0000 (19:15 +0100)]
Make gdb_continue_to_breakpoint fail quickly on internal errors.

This switches the gdb_continue_to_breakpoint routine to use
gdb_test_multiple instead of send_gdb/gdb_expect, so that an internal
error is detected immediately, instead of failing on timeout.

gdb/testsuite/
2014-04-22  Pedro Alves  <palves@redhat.com>

* lib/gdb.exp (gdb_continue_to_breakpoint): Use gdb_test_multiple
instead of send_gdb/gdb_expect.

10 years agoFix Nios II assembler self-test mode.
Sandra Loosemore [Tue, 22 Apr 2014 17:56:02 +0000 (10:56 -0700)]
Fix Nios II assembler self-test mode.

2014-04-22  Sandra Loosemore  <sandra@codesourcery.com>

gas/
* config/tc-nios2.c (nios2_consume_arg): Add case for 'E' to
unbreak self-test mode.

gas/testsuite/
* gas/nios2/selftest.s: New.
* gas/nios2/selftest.d: New.

10 years agoAdd tests for PR ld/16846
H.J. Lu [Tue, 22 Apr 2014 17:22:39 +0000 (10:22 -0700)]
Add tests for PR ld/16846

PR ld/16846
* ld-plugin/lto.exp (lto_link_tests): Add tests for PR ld/16846.
* ld-plugin/pr16846a.c: New file.
* ld-plugin/pr16846b.c: Likewise.
* ld-plugin/pr16846c.c: Likewise.

10 years agoAnother fix for building on a 32-bit host.
Nick Clifton [Tue, 22 Apr 2014 15:57:34 +0000 (16:57 +0100)]
Another fix for building on a 32-bit host.

PR ld/16821
* peXXigen.c (_bfd_XXi_swap_sym_out): Fix for 32-bit hosts.

10 years agoRemove support for the (deprecated) openrisc and or32 configurations and replace
Christian Svensson [Tue, 22 Apr 2014 14:57:47 +0000 (15:57 +0100)]
Remove support for the (deprecated) openrisc and or32 configurations and replace
with support for the new or1k configuration.

10 years agoAdd a note to the GDB/NEWS file mentioning that the ARM simulator now
Nick Clifton [Tue, 22 Apr 2014 10:23:05 +0000 (11:23 +0100)]
Add a note to the GDB/NEWS file mentioning that the ARM simulator now
supports instruction tracing with or without disassembly alongside.

* NEWS: Mention that ARM sim now supports tracing.

10 years agoFix build problem on 32-bit hosts with the recent patch for PR 16821.
Yuanhui Zhang [Tue, 22 Apr 2014 10:00:39 +0000 (11:00 +0100)]
Fix build problem on 32-bit hosts with the recent patch for PR 16821.

PR ld/16821
* peXXigen.c (abs_finder): Fix for 32-bit host builds.

10 years agobfd/elfnn-aarch64.c: Remove elfNN_aarch64_section_flags
Will Newton [Mon, 14 Apr 2014 12:37:51 +0000 (13:37 +0100)]
bfd/elfnn-aarch64.c: Remove elfNN_aarch64_section_flags

This function seems to be a left over from some previous
functionality that no longer exists - the comment above seems to
make no sense with the current code. Remove the function as it
breaks handling of SystemTap static probe note sections.

bfd/ChangeLog:

2014-04-22  Will Newton  <will.newton@linaro.org>

* elfnn-aarch64.c (elfNN_aarch64_section_flags): Remove
function.  (elf_backend_section_flags): Remove define.

10 years agoCheck tracefile is generated by binary execution
Yao Qi [Fri, 21 Mar 2014 04:52:24 +0000 (12:52 +0800)]
Check tracefile is generated by binary execution

In gdb.trace/tfile.exp, we execute binary to generate tracefile,

  remote_exec target "$binfile"

however, this fails on bare metal target.  This patch is to
handle binary execution failure by running binary in GDB.
The binary will do some io operation to generate tracefile, so
we need a check 'target_info exists gdb,nofileio'.

This patch is to check whether tracefile is generated.  tfile.exp can
be skipped if generation is failed, while test_tfind_tfile in
mi-traceframe-changed.exp is skipped if generated failed.  The rest of
the mi-traceframe-changed.exp can still be executed, because on some
bare metal targets, the remote stub supports tracepoint but doesn't
support fileio.

gdb/testsuite:

2014-04-22  Yao Qi  <yao@codesourcery.com>

* lib/trace-support.exp (generate_tracefile): New procedure.
* gdb.trace/tfile.exp: Skip the test if generate_tracefile
return 0.
* gdb.trace/mi-traceframe-changed.exp: Invoke test_tfind_tfile
if generate_tracefile returns 1.

10 years agoUnify ctf_fetch_registers and tfile_fetch_registers
Yao Qi [Fri, 18 Apr 2014 11:32:01 +0000 (19:32 +0800)]
Unify ctf_fetch_registers and tfile_fetch_registers

Functions ctf_fetch_registers and tfile_fetch_registers have some
duplicated code about guessing the PC in regcache.  Sometimes, we
may change one function and forget to update the other one, like this
https://www.sourceware.org/ml/gdb-patches/2014-01/msg00292.html

This patch is to move the duplicated code into a new function
tracefile_fetch_registers, and let both ctf_fetch_registers and
tfile_fetch_registers call it.

gdb:

2014-04-22  Yao Qi  <yao@codesourcery.com>

* tracefile-tfile.c (tfile_fetch_registers): Move the bottom to ...
* tracefile.c (tracefile_fetch_registers): ... it.  New function.
* tracefile.h (tracefile_fetch_registers): Declare.
* ctf.c (ctf_fetch_registers): Remove the bottom.  Call
tracefile_fetch_registers.

10 years agodaily update
Alan Modra [Tue, 22 Apr 2014 00:00:39 +0000 (09:30 +0930)]
daily update

10 years agoFix alpha-elf relaxation
Richard Henderson [Mon, 21 Apr 2014 15:14:18 +0000 (08:14 -0700)]
Fix alpha-elf relaxation

ld/
* emultempl/alphaelf.em (alpha_after_parse): Enable 2 relax passes.
bfd/
* elf64-alpha.c (elf64_alpha_size_got_sections): New may_merge
parameter; honor it and disable got merging when false.
(elf64_alpha_relax_got_load): Do not relax to GPREL relocs during
the first pass of relaxation.
(elf64_alpha_relax_with_lituse): Likewise.  Move relaxed relocs to
the end of the LITERAL+LITUSE chain.
(elf64_alpha_relax_section): Only process LITERAL relocs during the
second pass of relaxation.

10 years agoEnable secureplt by default for alpha-linux
Richard Henderson [Mon, 21 Apr 2014 15:05:49 +0000 (08:05 -0700)]
Enable secureplt by default for alpha-linux

* configure.ac (use_secureplt): Enable by default.
* configure: Rebuild.

10 years agodaily update
Alan Modra [Mon, 21 Apr 2014 00:00:38 +0000 (09:30 +0930)]
daily update

10 years agodaily update
Alan Modra [Sun, 20 Apr 2014 00:00:38 +0000 (09:30 +0930)]
daily update

10 years agoPR gdb/14018 -- avoid "PC register not available" errors.
Eli Zaretskii [Sat, 19 Apr 2014 08:12:19 +0000 (11:12 +0300)]
PR gdb/14018 -- avoid "PC register not available" errors.

gdb/windows-nat.c (thread_rec): Don't display a warning when
SuspendThread fails with ERROR_ACCESS_DENIED.  If SuspendThread
fails for any reason, set th->suspended to -1, so that we don't
try to resume such a thread.  Also, don't return NULL in these
cases, to avoid completely ruin the session due to "PC register is
not available" error.
(do_windows_fetch_inferior_registers): Check errors in
GetThreadContext call.
(windows_continue): Accept an additional argument KILLED; if not
zero, ignore errors in the SetThreadContext call, since the
inferior was killed and is shutting down.
(windows_resume, get_windows_debug_event)
(windows_create_inferior, windows_mourn_inferior)
(windows_kill_inferior): All callers of windows_continue changed
to adjust to its new calling sequence.

10 years agoCall post_create_inferior in ctf_open.
Yao Qi [Fri, 18 Apr 2014 11:19:22 +0000 (19:19 +0800)]
Call post_create_inferior in ctf_open.

We don't call post_create_inferior at the end of ctf_open.  It is an
oversight in patch

  [PATCH 2/2] Create inferior for ctf target.
  https://sourceware.org/ml/gdb-patches/2014-01/msg01056.html

This patch is to call post_create_inferior at the end of ctf_open,
like the end of tfile_open.

gdb:

2014-04-19  Yao Qi  <yao@codesourcery.com>

* ctf.c (ctf_open): Call post_create_inferior.

10 years agoGet trace_regblock_size from metadata instead of event
Yao Qi [Sat, 19 Apr 2014 02:14:58 +0000 (10:14 +0800)]
Get trace_regblock_size from metadata instead of event

In ctf trace, for each 'R' block, we save it as a "register" event,
as defined below in metadata.

event {
        name = "register";
        id = 0;
        fields := struct {
                ascii contents[440];
        };
}

Nowadays, we initialize trace_regblock_size by getting the length of
"contents" from a "register" event.  However, 'R' block may not exist
in traceframe, as a result, "register" event doesn't exist in trace file
and trace_regblock_size isn't set.

This patch changes to get trace_regblock_size from metadata (or declaration)
which always exists.

gdb:

2014-04-19  Yao Qi  <yao@codesourcery.com>

* ctf.c (handle_id): New static variable.
(ctf_open_dir): Get handle_id from bt_context_add_trace return
value.  Get the declaration of event "register" and get length
of field "contents".

10 years agoAdd null pointer check in ctf_xfer_partial
Yao Qi [Fri, 18 Apr 2014 11:22:23 +0000 (19:22 +0800)]
Add null pointer check in ctf_xfer_partial

I find a gdb crash when gdb reads ctf trace.  The crash is caused by passing
NULL to strcmp.  This patch is to add null pointer check, as what we did
somewhere else in ctf.c.

gdb:

2014-04-19  Yao Qi  <yao@codesourcery.com>

* ctf.c (ctf_xfer_partial): Check 'name' is NULL before strcmp.