platform/upstream/binutils.git
10 years agofix memory errors with demangled name hash
Tom Tromey [Mon, 16 Jun 2014 09:17:19 +0000 (03:17 -0600)]
fix memory errors with demangled name hash

This fixes a regression that Jan pointed out.

The bug is that some names were allocated by dwarf2read on the objfile
obstack, but then passed to SYMBOL_SET_NAMES with copy_name=0.  This
violates the invariant that the names must have a lifetime tied to the
lifetime of the BFD.

The fix is to allocate names on the per-BFD obstack.

I looked at all callers, direct or indirect, of SYMBOL_SET_NAMES that
pass copy_name=0.  Note that only the ELF and DWARF readers do this;
other symbol readers were never updated (and perhaps cannot be,
depending on the details of the formats).  This is why the patch is
relatively small.

Built and regtested on x86-64 Fedora 20.

2014-06-26  Tom Tromey  <tromey@redhat.com>

PR symtab/16902:
* dwarf2read.c (fixup_go_packaging, dwarf2_compute_name)
(dwarf2_physname, read_partial_die)
(guess_partial_die_structure_name, fixup_partial_die)
(guess_full_die_structure_name, anonymous_struct_prefix)
(dwarf2_name): Use per-BFD obstack.

10 years agoThis adds the ability to the strings program to display strings that contain \n and...
Erik Akermann [Thu, 26 Jun 2014 13:10:48 +0000 (14:10 +0100)]
This adds the ability to the strings program to display strings that contain \n and \r characters.

* strings.c: Add -w/--include-all-whitespace option to include any
whitespace character in the displayed strings.
* NEWS: Mention the new feature.
* doc/binutils.texi (strings): Document the new command line
option.

10 years agoFix a compile time warning on 32-bit hosts.
Philippe De Muyter [Thu, 26 Jun 2014 12:18:04 +0000 (13:18 +0100)]
Fix a compile time warning on 32-bit hosts.

* or1k-desc.h (spr_field_masks): Add U suffix to the end of long
constants.

10 years agoChange the default behaviour of the PE targeted linker so that timestamps are
Linda Zhang [Thu, 26 Jun 2014 11:18:39 +0000 (12:18 +0100)]
Change the default behaviour of the PE targeted linker so that timestamps are
inserted.  This is for compatibility with other, non-GNU tools.  Deterministic
binaries can still be created by using the new --no-insert-timestamp command line
option.

* emultempl/pe.em: Initialise insert_timestamp to true.
Add a --no-insert-timestamp command line option.
* emultempl/pep.em: Likewise.
* ld.texinfo: Document that --insert-timestamp is enabled by
default and that it now has an inverse command line option.
* NEWS: Mention the new behaviour.

10 years agoFixes part of a problem reading deliberately non-conforming ELF binaries - where a
Nick Clifton [Thu, 26 Jun 2014 08:32:25 +0000 (09:32 +0100)]
Fixes part of a problem reading deliberately non-conforming ELF binaries - where a
note segment is present but no note section.

* readelf.c (process_note_sections): If there are no note sections
try processing note segments instead.

10 years agoMove local variables to inner block
Yao Qi [Tue, 24 Jun 2014 13:47:14 +0000 (21:47 +0800)]
Move local variables to inner block

dummy_frame_sniffer has two local variables dummyframe and this_id,
but they are only used in the if block below.  This patch is to move
them into the inner block.

gdb:

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

* dummy-frame.c (dummy_frame_sniffer): Move local variables
dummyframe and this_id into inner block below.

10 years agoFixes a problem displaying the contents of a binary containing corrupt debug
Nick Clifton [Thu, 26 Jun 2014 08:12:55 +0000 (09:12 +0100)]
Fixes a problem displaying the contents of a binary containing corrupt debug
information, specifically a DW_AT_MIPS_linkage_name attribute that has a numeric
value rather than a string value.

PR binutils/16949
* dwarf2.c (is_str_attr): New function.
(find_abstract_instance_name): Use it to determine when an
attribute has a string value.

10 years agoTypo fix in signal_pass initialization
Yao Qi [Thu, 26 Jun 2014 06:25:22 +0000 (14:25 +0800)]
Typo fix in signal_pass initialization

When I read the code, I happen to see this:

   signal_pass = (unsigned char *)
     xmalloc (sizeof (signal_program[0]) * numsigs);
                      ^^^^^^^^^^^^^^
It is a typo, and this patch is to fix it.

gdb:

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

* infrun.c (_initialize_infrun): Replace "signal_program[0]"
with "signal_pass[0]" in the initialization of signal_pass.

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

10 years agoFixes to allow a toolchain configured with --enable-all to build on a 32-bit host.
Nick Clifton [Wed, 25 Jun 2014 15:35:58 +0000 (16:35 +0100)]
Fixes to allow a toolchain configured with --enable-all to build on a 32-bit host.

* Makefile.am (ALL_EMULATION_SOURCES): Move ei386pep.c from
here...
(ALL_64_EMULATION_SOURCES): ... to here.
(ALL_EMUL_EXTRA_OFILES): Move pep-dll.o from here...
(ALL_64_EMUL_EXTRA_OFILES): New.  ... to here.
* configure.in (EMUL_EXTRA_OFILES): Include
ALL_64_EMUL_EXTRA_OFILES when making a 64-bit enabled build.
* Makefile.in: Regenerate.
* configure: Regenerate.

10 years agold/arm: adjust offsets in tls-gdierelax2.d
Kyle McMartin [Wed, 25 Jun 2014 14:57:45 +0000 (10:57 -0400)]
ld/arm: adjust offsets in tls-gdierelax2.d

Addition of DF_STATIC_TLS in eea6dad2 results in the addition of
flags to the dynamic section, which in turn changes these addresses.
Fix them up to match their new positions.

ld/testsuite/Changelog:

2014-06-24  Kyle McMartin  <kyle@redhat.com>

* ld-arm/tls-gdierelax2.d: Fix expected offsets.

10 years agobtrace: pretend we're not replaying when generating a core file
Markus Metzger [Tue, 20 May 2014 13:53:44 +0000 (15:53 +0200)]
btrace: pretend we're not replaying when generating a core file

When generating a core file using the "generate-core-file" command while
replaying with the btrace record target, we won't be able to access all
registers and all memory.  This leads to the following assertion:

    gdb/regcache.c:1034: internal-error: regcache_raw_supply: Assertion `regnum >= 0 && regnum < regcache->descr->nr_raw_registers' failed.
    A problem internal to GDB has been detected,
    further debugging may prove unreliable.
    Quit this debugging session? (y or n) FAIL: gdb.btrace/gcore.exp: generate-core-file core (GDB internal error)
    Resyncing due to internal error.

Pretend that we are not replaying while generating a core file.  This will
forward fetch and store registers as well as xfer memory calls to the target
beneath.

gdb/
* record-btrace.c (record_btrace_generating_corefile)
(record_btrace_prepare_to_generate_core)
(record_btrace_done_generating_core): New.
(record_btrace_xfer_partial, record_btrace_fetch_registers)
(record_btrace_store_registers, record_btrace_prepare_to_store):
Forward request when generating a core file.
(record_btrace_open): Set record_btrace_generating_corefile to zero.
(init_record_btrace_ops): Set to_prepare_to_generate_core and
to_done_generating_core.

testsuite/
* gdb.btrace/gcore.exp: New.

10 years agogcore, target: allow target to prepare/cleanup for/after core file generation
Markus Metzger [Tue, 20 May 2014 13:22:53 +0000 (15:22 +0200)]
gcore, target: allow target to prepare/cleanup for/after core file generation

Add new target functions to_prepare_to_generate_core and
to_done_generating_core that are called before and after generating a core
file, respectively.

This allows targets to prepare for core file generation and to clean up
afterwards.

gdb/
* target.h (target_ops) <to_prepare_to_generate_core>
<to_done_generating_core>: New.
(target_prepare_to_generate_core, target_done_generating_core): New.
* target.c (target_prepare_to_generate_core)
(target_done_generating_core): New.
* target-delegates.c: Regenerate.
* gcore.c: (write_gcore_file): Rename to ...
(write_gcore_file_1): ...this.
(write_gcore_file): Call target_prepare_to_generate_core
and target_done_generating_core.

10 years agomake_corefile_notes: have caller free returned memory
Markus Metzger [Thu, 22 May 2014 06:47:42 +0000 (08:47 +0200)]
make_corefile_notes: have caller free returned memory

The various make_corefile_notes implementations for gdbarch as well as target
currently make an xfree cleanup on the data they return.  This causes problems
when trying to put a TRY_CATCH around the make_corefile_notes call.
Specifically, we get a stale cleanup error in restore_my_cleanups.

Omit the make_cleanup and have the caller free the memory.

gdb/
* fbsd-nat.c (fbsd_make_corefile_notes): Remove make_cleanup call.
* gcore.c (write_gcore_file): Free memory returned from
make_corefile_notes.
* linux-tdep.c (linux_make_corefile_notes): Remove make_cleanup call.
* procfs.c (procfs_make_note_section): Remove make_cleanup call.

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

10 years agoFix dwp to allow intermediate .dwp files with no .debug_types sections.
Cary Coutant [Tue, 24 Jun 2014 19:17:09 +0000 (12:17 -0700)]
Fix dwp to allow intermediate .dwp files with no .debug_types sections.

gold/
* dwp.cc (Dwo_file::read): Allow files with no .debug_types
sections.
(Dwo_file::sized_read_unit_index): Likewise.

10 years agoMinor improvements in manual indexing.
Eli Zaretskii [Tue, 24 Jun 2014 16:28:40 +0000 (19:28 +0300)]
Minor improvements in manual indexing.

* doc/gdb.texinfo (Screen Size): Add more index entries.

10 years agoDon't strip section defining _SDA_BASE_
Alan Modra [Tue, 24 Jun 2014 03:53:04 +0000 (13:23 +0930)]
Don't strip section defining _SDA_BASE_

Prior to 93d1b056 _SDA_BASE_ used to be defined in a linker script
output section.  Now _SDA_BASE_ is defined in an input section that is
subject to being stripped.  If the section is stripped we don't output
the symbol, which results in --emit-relocs trying to emit relocs with
dangling references to _SDA_BASE_.

* elf32-ppc.c (ppc_elf_size_dynamic_sections): Arrange to keep
.sdata/.sdata2 when _SDA_BASE_/_SDA2_BASE_ should be output
for --emit-relocs.

10 years agoSkip 'bx reg' on arm-linux
Yao Qi [Fri, 30 May 2014 08:08:10 +0000 (16:08 +0800)]
Skip 'bx reg' on arm-linux

In arm-tdep.c, arm_skip_stub is installed to gdbarch
skip_trampoline_code, but in arm-linux-tdep.c,
find_solib_trampoline_target is installed to skip_trampoline_code.
That means gdb configured for arm-linux target doesn't recognize some
arm specific trampolines or stubs.  Beside handling generic solib
trampoline, gdb for arm-linux target should be able to handle arm
specific trampolines.  This patch is to skip arm specific stubs, if
any, and as a fallback, skip the generic solib trampoline.

gdb:

2014-06-24  Yao Qi  <yao@codesourcery.com>

* arm-linux-tdep.c (arm_linux_skip_trampoline_code): New.
(arm_linux_init_abi): Set skip_trampoline_code with
gdbarch_skip_trampoline_code instead of
find_solib_trampoline_target.

10 years agoApply stub unwinder to 'bx reg' trampoline
Yao Qi [Fri, 30 May 2014 08:06:32 +0000 (16:06 +0800)]
Apply stub unwinder to 'bx reg' trampoline

In target arm-none-eabi, prologue unwinder is used for trampoline
'bx reg'.  However, in target arm-linux, exidx unwinder is selected for
trampoline at first, which is not expected.  The main function and the
trampoline is,

   0x00009dfc <main+0>: push    {r4, r5, r6, r7, lr}
   ......
   0x0000ac30 <main+3636>:      ldrdeq  r3, [r1], -r8
   0x0000ac34:  bx      r2
   0x0000ac36:  bx      r4

and .ARM.exidx is:

0x9dfc <main>: @0xb404
  Compact model index: 1
  0x97      vsp = r7
  0x20      vsp = vsp + 132
  0x3f      vsp = vsp + 256
  0x80 0xf0 pop {r8, r9, r10, r11}
  0xab      pop {r4, r5, r6, r7, r14}

0xac38 <__aeabi_drsub>: 0x1 [cantunwind]

Trampolines 'bx r2' and 'bx r4' doesn't belong to main, but the exidx
for main is still selected form them because there is no end address
of each exidx entry.

Instead of teaching exidx unwinder ignore this trampoline (which looks
complicated and error prone), I decide to let stub unwinder to handle
trampoline, because stub undwinder is installed before exidx unwinder,
and this trampoline can be regarded as a stub too.

This patch is to add the code to match 'bx reg' trampoline in the
sniffer of stub unwinder.

gdb:

2014-06-24  Yao Qi  <yao@codesourcery.com>

* arm-tdep.c (arm_stub_unwind_sniffer): Return 1 if
arm_skip_bx_reg returns non-zero.

10 years agoSkip 'bx reg' trampoline on arm-none-eabi
Yao Qi [Fri, 30 May 2014 07:51:45 +0000 (15:51 +0800)]
Skip 'bx reg' trampoline on arm-none-eabi

After this patch
<https://gcc.gnu.org/ml/gcc-patches/2005-01/msg00813.html> applied to
GCC, a new trampoline is generated but GDB doesn't recognize it.  This
patch is to teach GDB to understand this trampoline.  See details
about this trampoline and the heuristics in the comments.

gdb:

2014-06-24  Yao Qi  <yao@codesourcery.com>

* arm-tdep.c (arm_skip_bx_reg): New function.
(arm_skip_stub): Call arm_skip_bx_reg.

10 years agodaily update
Alan Modra [Tue, 24 Jun 2014 00:01:18 +0000 (09:31 +0930)]
daily update

10 years agogold/
Sasa Stankovic [Mon, 23 Jun 2014 18:52:34 +0000 (11:52 -0700)]
gold/
* mips.cc: New file.
* Makefile.am (TARGETSOURCES): Add mips.cc
(ALL_TARGETOBJS): Add mips.$(OBJEXT)
* configure.tgt: Add entries for mips*.
* configure.ac: Likewise.
* Makefile.in: Regenerate.
* configure: Likewise.

10 years agoAdd myself as write-after-approval maintainer.
Don Breazeal [Mon, 23 Jun 2014 18:24:43 +0000 (11:24 -0700)]
Add myself as write-after-approval maintainer.

10 years agox86 Linux watchpoints: Couldn't write debug register: Invalid argument.
Pedro Alves [Mon, 23 Jun 2014 15:44:04 +0000 (16:44 +0100)]
x86 Linux watchpoints: Couldn't write debug register: Invalid argument.

This patch fixes this on x86 Linux:

 (gdb) watch *buf@2
 Hardware watchpoint 8: *buf@2
 (gdb) si
 0x00000000004005a7      34        for (i = 0; i < 100000; i++); /* stepi line */
 (gdb) del
 Delete all breakpoints? (y or n) y
 (gdb) watch *(buf+1)@1
 Hardware watchpoint 9: *(buf+1)@1
 (gdb) si
 0x00000000004005a7 in main () at ../../../src/gdb/testsuite/gdb.base/watchpoint-reuse-slot.c:34
 34        for (i = 0; i < 100000; i++); /* stepi line */
 Couldn't write debug register: Invalid argument.
 (gdb)

In the example above the debug registers are being switched from this
state:

        CONTROL (DR7): 0000000000050101          STATUS (DR6): 0000000000000000
        DR0: addr=0x0000000000601040, ref.count=1  DR1: addr=0x0000000000000000, ref.count=0
        DR2: addr=0x0000000000000000, ref.count=0  DR3: addr=0x0000000000000000, ref.count=0

to this:

        CONTROL (DR7): 0000000000010101          STATUS (DR6): 0000000000000000
        DR0: addr=0x0000000000601041, ref.count=1  DR1: addr=0x0000000000000000, ref.count=0
        DR2: addr=0x0000000000000000, ref.count=0  DR3: addr=0x0000000000000000, ref.count=0

That is, before, DR7 was setup for watching a 2 byte region starting
at what's in DR0 (0x601040).

And after, DR7 is setup for watching a 1 byte region starting at
what's in DR0 (0x601041).

We always write DR0..DR3 before DR7, because if we enable a slot's
bits in DR7, you need to have already written the corresponding
DR0..DR3 registers -- the kernel rejects the DR7 write with EINVAL
otherwise.

The error shown above is the opposite scenario.  When we try to write
0x601041 to DR0, DR7's bits still indicate intent of watching a 2-byte
region.  That DR0/DR7 combination is invalid, because 0x601041 is
unaligned.  To watch two bytes, we'd have to use two slots.  So the
kernel errors out with EINVAL.

Fix this by always first clearing DR7, then writing DR0..DR3, and then
setting DR7's bits.

A little optimization -- if we're disabling the last watchpoint, then
we can clear DR7 just once.  The changes to nat/i386-dregs.c make that
easier to detect, and as bonus, they make it a little easier to make
sense of DR7 in the debug logs, as we no longer need to remember we're
seeing stale bits.

Tested on x86_64 Fedora 20, native and GDBserver.

This adds an exhaustive test that switches between many different
combinations of watchpoint types and addresses and widths.

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

* amd64-linux-nat.c (amd64_linux_prepare_to_resume): Clear
DR_CONTROL before setting DR0..DR3.
* i386-linux-nat.c (i386_linux_prepare_to_resume): Likewise.
* nat/i386-dregs.c (i386_remove_aligned_watchpoint): Clear all
bits of DR_CONTROL related to the debug register slot being
disabled.  If all slots are vacant, clear local slowdown as well,
and assert DR_CONTROL is 0.

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

* linux-x86-low.c (x86_linux_prepare_to_resume): Clear DR_CONTROL
before setting DR0..DR3.

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

* gdb.base/watchpoint-reuse-slot.c: New file.
* gdb.base/watchpoint-reuse-slot.exp: New file.

10 years agoAlign behavior of xmethod commands with that of pretty-printer commands.
Siva Chandra [Wed, 18 Jun 2014 10:46:37 +0000 (03:46 -0700)]
Align behavior of xmethod commands with that of pretty-printer commands.

Currently, the xmethod commands lookup xmethod matchers in the current
progspace even if the locus regular expression matches the progspace's
filename.  Pretty printer commands do not match the current progspace's
filename.

gdb/

* python/lib/gdb/command/xmethods.py
(get_method_matchers_in_loci):  Lookup xmethod matchers in the
current progspace only if the string "progspace" matches LOCUS_RE.

gdb/testsuite

* gdb.python/py-xmethods.exp: Use "progspace" instead of the
progspace's filename in 'info', 'enable' and 'disable' command
tests.

10 years agotestsuite: Use istarget and is_lp64_target for 3 testcases.
Jan Kratochvil [Mon, 23 Jun 2014 06:24:36 +0000 (08:24 +0200)]
testsuite: Use istarget and is_lp64_target for 3 testcases.

On x86_64 with -m32 or on i686 it will:

Running ./gdb.arch/amd64-stap-special-operands.exp ...
gdb compile failed, amd64-stap-triplet.c: Assembler messages:
amd64-stap-triplet.c:35: Error: bad register name `%rbp'
amd64-stap-triplet.c:38: Error: bad register name `%rsp'
amd64-stap-triplet.c:40: Error: bad register name `%rbp)'
amd64-stap-triplet.c:41: Error: bad register name `%rsi'
amd64-stap-triplet.c:42: Error: bad register name `%rbp)'
/tmp/ccjOdmpl.s:63: Error: bad register name `%rbp'

2014-06-23  Jan Kratochvil  <jan.kratochvil@redhat.com>

* gdb.arch/amd64-stap-special-operands.exp: Use is_lp64_target.
* gdb.arch/amd64-stap-optional-prefix.exp: Likewise.
* gdb.dwarf2/dw2-error.exp: Use istarget and is_lp64_target.

Message-ID: <20140622211401.GA3716@host2.jankratochvil.net>

10 years agodaily update
Alan Modra [Mon, 23 Jun 2014 00:00:34 +0000 (09:30 +0930)]
daily update

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

10 years agodaily update
Alan Modra [Sat, 21 Jun 2014 00:00:43 +0000 (09:30 +0930)]
daily update

10 years agoFix fallout from 6d00b590
Philippe De Muyter [Fri, 20 Jun 2014 23:46:15 +0000 (09:16 +0930)]
Fix fallout from 6d00b590

* targets.c (_bfd_target_vector): Add missing #ifdef BFD64 for
a number of targets.

10 years agoFix --with-system-readline with readline-6.3 patch 5
Jan Kratochvil [Fri, 20 Jun 2014 15:43:56 +0000 (17:43 +0200)]
Fix --with-system-readline with readline-6.3 patch 5

I have filed now:
--with-system-readline uses bundled readline include files
https://sourceware.org/bugzilla/show_bug.cgi?id=17077

To see any effect of the patch below you have to do:
rm -rf readline
Otherwise readline include files get used the bundled ones from GDB which are
currently 6.2 while system readline may be 6.3 already.

You also have to use system readline-6.3 including its upstream patch:
[Bug-readline] Readline-6.3 Official Patch 5
http://lists.gnu.org/archive/html/bug-readline/2014-04/msg00018.html
Message-ID: <140415125618.AA57598.SM@caleb.ins.cwru.edu>

In short it happens on Fedora Rawhide since:
readline-6.3-1.fc21
https://koji.fedoraproject.org/koji/buildinfo?buildID=538941

The error is:
../../gdb/tui/tui-io.c:132:1: error: 'Function' is deprecated [-Werror=deprecated-declarations]
 static Function *tui_old_rl_getc_function;
 ^
../../gdb/tui/tui-io.c:133:1: error: 'VFunction' is deprecated [-Werror=deprecated-declarations]
 static VFunction *tui_old_rl_redisplay_function;
 ^
../../gdb/tui/tui-io.c:134:1: error: 'VFunction' is deprecated [-Werror=deprecated-declarations]
 static VFunction *tui_old_rl_prep_terminal;
 ^
../../gdb/tui/tui-io.c:135:1: error: 'VFunction' is deprecated [-Werror=deprecated-declarations]
 static VFunction *tui_old_rl_deprep_terminal;
 ^

It is since bash change:
lib/readline/rltypedefs.h
       - remove old Function/VFunction/CPFunction/CPPFunction typedefs as
 suggested by Tom Tromey <tromey@redhat.com>

The new typedefs used below are present in readline/rltypedefs.h since:
git://git.savannah.gnu.org/bash.git
commit 28ef6c316f1aff914bb95ac09787a3c83c1815fd
Date:   Fri Apr 6 19:14:31 2001 +0000

gdb/
2014-06-20  Jan Kratochvil  <jan.kratochvil@redhat.com>

Fix --with-system-readline with readline-6.3 patch 5.
* tui/tui-io.c (tui_old_rl_getc_function, tui_old_rl_redisplay_function)
(tui_old_rl_prep_terminal, tui_old_rl_deprep_terminal): Use rl_*_t
types.

Message-ID: <20140620105004.GA22236@host2.jankratochvil.net>

10 years agomake obstack object allocators more type-safe
Tom Tromey [Fri, 13 Jun 2014 19:08:23 +0000 (13:08 -0600)]
make obstack object allocators more type-safe

This changes OBSTACK_ZALLOC and OBSTACK_CALLOC to cast their value to
the correct type.  This is more type-safe and also is more in line
with the other object-allocation macros in libiberty.h.

Making this change revealed one trivial error in dwarf2read.c.
On the whole that seems pretty good to me.

Tested by rebuilding.

2014-06-20  Tom Tromey  <tromey@redhat.com>

* dwarf2read.c (dw2_get_real_path): Use correct type in
OBSTACK_CALLOC.
* gdb_obstack.h (OBSTACK_ZALLOC, OBSTACK_CALLOC): Cast result.

10 years agoFix mingw32 build on x86-64 RHEL 6.5
Gary Benson [Fri, 20 Jun 2014 14:41:28 +0000 (15:41 +0100)]
Fix mingw32 build on x86-64 RHEL 6.5

This commit fixes the mingw32 build on x86-64 RHEL 6.5.

gdb/gdbserver/
2014-06-20  Gary Benson  <gbenson@redhat.com>

* configure.ac (AC_REPLACE_FUNCS) <vasprintf, vsnprintf>: Removed.
* configure: Regenerated.
* config.in: Likewise.

10 years agoMove shared native target specific code to gdb/nat
Gary Benson [Thu, 19 Jun 2014 13:46:38 +0000 (14:46 +0100)]
Move shared native target specific code to gdb/nat

https://sourceware.org/gdb/wiki/Common describes the following
directory structure:

 gdb/nat/
   Native target backend files. Code that interfaces with the
   host debug API. E.g., ptrace code, Windows debug API code,
   procfs code should go here.

 gdb/target/
   Host-independent, target vector specific code (target_ops).

 gdb/common/
   All other shared code.

This commit moves all native target backend files currently in
gdb/common to gdb/nat.

gdb/
2014-06-20  Gary Benson  <gbenson@redhat.com>

* common/gdb_thread_db.h: Moved to nat.  All includes updated.
* common/glibc_thread_db.h: Likewise.
* common/i386-cpuid.h: Likewise.
* common/i386-gcc-cpuid.h: Likewise.
* common/linux-btrace.h: Likewise.
* common/linux-osdata.h: Likewise.
* common/linux-procfs.h: Likewise.
* common/linux-ptrace.h: Likewise.
* common/mips-linux-watch.h: Likewise.
* common/linux-btrace.c: Moved to nat.
* common/linux-osdata.c: Likewise.
* common/linux-procfs.c: Likewise.
* common/linux-ptrace.c: Likewise.
* common/mips-linux-watch.c: Likewise.
* nat/gdb_thread_db.h: Moved from common.
* nat/glibc_thread_db.h: Likewise.
* nat/i386-cpuid.h: Likewise.
* nat/i386-gcc-cpuid.h: Likewise.
* nat/linux-btrace.c: Likewise.
* nat/linux-btrace.h: Likewise.
* nat/linux-osdata.c: Likewise.
* nat/linux-osdata.h: Likewise.
* nat/linux-procfs.c: Likewise.
* nat/linux-procfs.h: Likewise.
* nat/linux-ptrace.c: Likewise.
* nat/linux-ptrace.h: Likewise.
* nat/mips-linux-watch.c: Likewise.
* nat/mips-linux-watch.h: Likewise.
* Makefile.in (HFILES_NO_SRCDIR): Reflect new locations.
(object file files): Reordered.
* gdb/copyright.py (EXCLUDE_LIST): Reflect new location
of glibc_thread_db.h.

gdb/gdbserver/
2014-06-20  Gary Benson  <gbenson@redhat.com>

* Makefile.in (SFILES): Update locations for files moved
from common to nat.
(object file files): Reordered.

gdb/testsuite/
2014-06-20  Gary Benson  <gbenson@redhat.com>

* gdb.arch/i386-avx.exp: Fix include file location.
* gdb.arch/i386-sse.exp: Likewise.

10 years agoVectorize gdbserver x86 debug register accessors
Gary Benson [Thu, 19 Jun 2014 10:55:26 +0000 (11:55 +0100)]
Vectorize gdbserver x86 debug register accessors

This commit makes gdbserver access the x86 debug register accessor
functions via the same function vector as GDB proper.  This removes
a chunk of conditional code that was previously in i386-{nat,low}.h
and leaves a single macro as the only GDB/gdbserver difference in
nat/i386-dregs.c.

gdb/
2014-06-20  Gary Benson  <gbenson@redhat.com>

* i386-nat.h (debug_hw_points): Moved to nat/i386-dregs.c.
(i386_dr_low_type): Moved to nat/i386-dregs.h.
(i386_dr_low): Likewise.
(i386_dr_low_can_set_addr): Moved to nat/i386-dregs.c.
(i386_dr_low_set_addr): Likewise.
(i386_dr_low_get_addr): Likewise.
(i386_dr_low_can_set_control): Likewise.
(i386_dr_low_set_control): Likewise.
(i386_dr_low_get_control): Likewise.
(i386_dr_low_get_status): Likewise.
(i386_get_debug_register_length): Likewise.
* nat/i386-dregs.h (i386_dr_low_type): Moved from i386-nat.h.
(i386_dr_low): Likewise.
* nat/i386-dregs.c (i386-low.h): Remove include.
(i386-nat.h): Likewise.
(nat/i386-dregs.h): New include.
(i386_dr_low_can_set_addr): Moved from i386-nat.h.
(i386_dr_low_set_addr): Likewise.
(i386_dr_low_get_addr): Likewise.
(i386_dr_low_can_set_control): Likewise.
(i386_dr_low_set_control): Likewise.
(i386_dr_low_get_control): Likewise.
(i386_dr_low_get_status): Likewise.
(i386_get_debug_register_length): Likewise.
(debug_hw_points): Likewise.

gdb/gdbserver/
2014-06-20  Gary Benson  <gbenson@redhat.com>

* i386-low.h (i386_dr_low_can_set_addr): Removed.
(i386_dr_low_set_addr): Likewise.
(i386_dr_low_get_addr): Likewise.
(i386_dr_low_can_set_control): Likewise.
(i386_dr_low_set_control): Likewise.
(i386_dr_low_get_control): Likewise.
(i386_dr_low_get_status): Likewise.
(i386_get_debug_register_length): Likewise.
* linux-x86-low.c (i386_dr_low_set_addr):
Changed signature.  Made static.
(i386_dr_low_get_addr): Likewise.
(i386_dr_low_set_control): Likewise.
(i386_dr_low_get_control): Likewise.
(i386_dr_low_get_status): Likewise.
(i386_dr_low): New global variable.
* win32-i386-low.c (i386_dr_low_set_addr):
Changed signature.  Made static.
(i386_dr_low_get_addr): Likewise.
(i386_dr_low_set_control): Likewise.
(i386_dr_low_get_control): Likewise.
(i386_dr_low_get_status): Likewise.
(i386_dr_low): New global variable.

10 years agoFix gdbserver cross build.
Marcus Shawcroft [Fri, 20 Jun 2014 10:48:15 +0000 (11:48 +0100)]
Fix gdbserver cross build.

The recent libiberty patch caused issues when cross building
gdbserver.  The Makefile ends invoking the build machine's "ar"
instead of the --host version:

  ar  ./libiberty.a \
    ./regex.o (...)

  ar: illegal option -- .
  Usage: ar [emulation options] [-]{dmpqrstx}[abcfilNoPsSuvV] [member-name] [count] archive-file file...
 ar -M [<mri-script]

The libiberty configure script does probe for and finds an appropriate
AR.  However, gdbserver's configure does not probe for AR and
overrides the AR used in the libiberty build by explicitly passing AR
to the sub-builds.

gdb/gdbserver/
2014-06-20  Marcus Shawcroft  <marcus.shawcroft@arm.com>

* configure.ac: Invoke. AC_CHECK_TOOL(AR, ar).
* Makefile.in (AR, AR_FLAGS): Define.
* configure: Regenerate.

10 years agoSimilarly to the AArch64 patch, set DF_STATIC_TLS for consistency with
Kyle McMartin [Fri, 20 Jun 2014 10:14:09 +0000 (11:14 +0100)]
Similarly to the AArch64 patch, set DF_STATIC_TLS for consistency with
other architectures when we emit IE relocs in a shared library.

* elf32-arm.c (elf32_arm_check_relocs): Set DF_STATIC_TLS when
emitting initial-exec relocs when not linking an executable.

10 years agodaily update
Alan Modra [Fri, 20 Jun 2014 00:00:42 +0000 (09:30 +0930)]
daily update

10 years agoInitial pass at D language expression parser support.
Iain Buclaw [Thu, 19 Jun 2014 18:29:26 +0000 (19:29 +0100)]
Initial pass at D language expression parser support.

gdb/
2014-06-05  Iain Buclaw  <ibuclaw@gdcproject.org>

* Makefile.in (SFILES): Add d-exp.y.
(YYFILES): Add d-exp.c.
(YYOBJ): Add d-exp.o.
(local-maintainer-clean): Delete d-exp.c.
* d-exp.y: New file.
* d-lang.h (d_parse): New declaration.
(d_error): New declaration.
* d-lang.c (d_op_print_tab): Add entry for BINOP_CONCAT and BINOP_EXP.
Set BINOP_EQUAL and BINOP_NOTEQUAL to same precedence as other
PREC_ORDER operators.
(d_language_defn): Use d_parse, d_error instead of c_parse, c_error.

gdb/testsuite/
2014-06-05  Iain Buclaw  <ibuclaw@gdcproject.org>

* gdb.dlang/expression.exp: New file.

10 years agoRemove any_running
Yao Qi [Wed, 18 Jun 2014 14:03:20 +0000 (22:03 +0800)]
Remove any_running

Function any_running isn't used.  This patch is to remove it.
Rebuild GDB for linux and mingw.

gdb:

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

* gdbthread.h (any_running): Remove the declaration.
* thread.c (any_running): Remove.

10 years agoUse enum thread_state
Yao Qi [Wed, 18 Jun 2014 14:00:54 +0000 (22:00 +0800)]
Use enum thread_state

This patch is to change field state's type to 'enum thread_state', and
replace RUNNING with THREAD_RUNNING and STOPPED with THREAD_STOPPED
respectively in comments.

gdb:

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

* gdbthread.h (struct thread_info) <state>: Change its type to
'enum thread_state'.  Update comments.

10 years agoFix next over threaded execl with "set scheduler-locking step".
Pedro Alves [Thu, 19 Jun 2014 10:59:03 +0000 (11:59 +0100)]
Fix next over threaded execl with "set scheduler-locking step".

Running gdb.threads/thread-execl.exp with scheduler-locking set to
"step" reveals a problem:

 (gdb) next^M
 [Thread 0x7ffff7fda700 (LWP 27168) exited]^M
 [New LWP 27168]^M
 [Thread 0x7ffff74ee700 (LWP 27174) exited]^M
 process 27168 is executing new program: /home/jkratoch/redhat/gdb-clean/gdb/testsuite/gdb.threads/thread-execl^M
 [Thread debugging using libthread_db enabled]^M
 Using host libthread_db library "/lib64/libthread_db.so.1".^M
 infrun.c:5225: internal-error: switch_back_to_stepped_thread: Assertion `!schedlock_applies (1)' failed.^M
 A problem internal to GDB has been detected,^M
 further debugging may prove unreliable.^M
 Quit this debugging session? (y or n) FAIL: gdb.threads/thread-execl.exp: schedlock step: get to main in new image (GDB internal error)

The assertion is correct.  The issue is that GDB is mistakenly trying
to switch back to an exited thread, that was previously stepping when
it exited.  This is exactly the sort of thing the test wants to make
sure doesn't happen:

# Now set a breakpoint at `main', and step over the execl call.  The
# breakpoint at main should be reached.  GDB should not try to revert
# back to the old thread from the old image and resume stepping it

We don't see this bug with schedlock off only because a different
sequence of events makes GDB manage to delete the thread instead of
marking it exited.

This particular internal error can be fixed by making the loop over
all threads in switch_back_to_stepped_thread skip exited threads.
But, looking over other ALL_THREADS users, all either can or should be
skipping exited threads too.  So for simplicity, this patch replaces
ALL_THREADS with a new macro that skips exited threads itself, and
updates everything to use it.

Tested on x86_64 Fedora 20.

gdb/
2014-06-19  Pedro Alves  <palves@redhat.com>

* gdbthread.h (ALL_THREADS): Delete.
(ALL_NON_EXITED_THREADS): New macro.
* btrace.c (btrace_free_objfile): Use ALL_NON_EXITED_THREADS
instead of ALL_THREADS.
* infrun.c (find_thread_needs_step_over)
(switch_back_to_stepped_thread): Use ALL_NON_EXITED_THREADS
instead of ALL_THREADS.
* record-btrace.c (record_btrace_open)
(record_btrace_stop_recording, record_btrace_close)
(record_btrace_is_replaying, record_btrace_resume)
(record_btrace_find_thread_to_move, record_btrace_wait): Likewise.
* remote.c (append_pending_thread_resumptions): Likewise.
* thread.c (thread_apply_all_command): Likewise.

gdb/testsuite/
2014-06-19  Pedro Alves  <palves@redhat.com>

* gdb.threads/thread-execl.exp (do_test): New procedure, factored
out from ...
(top level): ... here.  Iterate running tests under different
scheduler-locking settings.

10 years agoDirectly call i386-dregs functions
Gary Benson [Thu, 19 Jun 2014 09:54:15 +0000 (10:54 +0100)]
Directly call i386-dregs functions

Three target_ops functions in i386-nat.c call other local target_ops
functions.  This commit changes those functions to call the functions
in i386-dregs.c directly.

gdb/
2014-06-19  Gary Benson  <gbenson@redhat.com>

* i386-nat.c (i386_stopped_by_watchpoint):
Use i386_dr_stopped_by_watchpoint.
(i386_insert_hw_breakpoint): Use i386_dr_insert_watchpoint.
(i386_remove_hw_breakpoint): Use i386_dr_remove_watchpoint.

10 years agoCreate nat/i386-dregs.c
Gary Benson [Thu, 19 Jun 2014 09:53:12 +0000 (10:53 +0100)]
Create nat/i386-dregs.c

This commit moves code to be shared from i386-{nat,low}.[ch]
into a new file, nat/i386-dregs.c.

gdb/
2014-06-19  Gary Benson  <gbenson@redhat.com>

* nat/i386-dregs.c: New file.
* Makefile.in (i386-dregs.o): New rule.
* config/i386/cygwin.mh (NATDEPFILES): Add i386-dregs.o.
* config/i386/cygwin64.mh (NATDEPFILES): Likewise.
* config/i386/darwin.mh (NATDEPFILES): Likewise.
* config/i386/fbsd.mh (NATDEPFILES): Likewise.
* config/i386/fbsd64.mh (NATDEPFILES): Likewise.
* config/i386/go32.mh (NATDEPFILES): Likewise.
* config/i386/linux.mh (NATDEPFILES): Likewise.
* config/i386/linux64.mh (NATDEPFILES): Likewise.
* config/i386/mingw.mh (NATDEPFILES): Likewise.
* config/i386/mingw64.mh (NATDEPFILES): Likewise.
* i386-nat.h (debug_hw_points): New declaration.
* i386-nat.c (breakpoint.h): Remove include.
(command.h): Likewise.
(target.h): Likewise.
(gdb_assert.h): Likewise.
(debug_hw_points): Made nonstatic.
(debug_printf): Now in i386-dregs.c.
(TARGET_HAS_DR_LEN_8): Likewise.
(DR_CONTROL_SHIFT): Likewise.
(DR_CONTROL_SIZE): Likewise.
(DR_RW_EXECUTE): Likewise.
(DR_RW_WRITE): Likewise.
(DR_RW_READ): Likewise.
(DR_RW_IORW): Likewise.
(DR_LEN_1): Likewise.
(DR_LEN_2): Likewise.
(DR_LEN_4): Likewise.
(DR_LEN_8): Likewise.
(DR_LOCAL_ENABLE_SHIFT): Likewise.
(DR_GLOBAL_ENABLE_SHIFT): Likewise.
(DR_ENABLE_SIZE): Likewise.
(DR_LOCAL_SLOWDOWN): Likewise.
(DR_GLOBAL_SLOWDOWN): Likewise.
(DR_CONTROL_RESERVED): Likewise.
(I386_DR_CONTROL_MASK): Likewise.
(I386_DR_VACANT): Likewise.
(I386_DR_LOCAL_ENABLE): Likewise.
(I386_DR_GLOBAL_ENABLE): Likewise.
(I386_DR_DISABLE): Likewise.
(I386_DR_SET_RW_LEN): Likewise.
(I386_DR_GET_RW_LEN): Likewise.
(I386_DR_WATCH_HIT): Likewise.
(i386_wp_op_t): Likewise.
(i386_show_dr): Likewise.
(i386_length_and_rw_bits): Likewise.
(i386_insert_aligned_watchpoint): Likewise.
(i386_remove_aligned_watchpoint): Likewise.
(i386_handle_nonaligned_watchpoint): Likewise.
(i386_update_inferior_debug_regs): Likewise.
(i386_insert_watchpoint): Use i386_dr_insert_watchpoint.
(i386_remove_watchpoint): Use i386_dr_remove_watchpoint.
(i386_region_ok_for_watchpoint):
Use i386_dr_region_ok_for_watchpoint.
(i386_stopped_data_address): Use i386_dr_stopped_data_address.

gdb/gdbserver/
2014-06-19  Gary Benson  <gbenson@redhat.com>

* Makefile.in (i386-dregs.o): New rule.
* configure.srv: Add i386-dregs.o to all targets using i386-low.o.
* i386-low.c (target.h): Remove include.
(TARGET_HAS_DR_LEN_8): Now in i386-dregs.c.
(DR_CONTROL_SHIFT): Likewise.
(DR_CONTROL_SIZE): Likewise.
(DR_RW_EXECUTE): Likewise.
(DR_RW_WRITE): Likewise.
(DR_RW_READ): Likewise.
(DR_RW_IORW): Likewise.
(DR_LEN_1): Likewise.
(DR_LEN_2): Likewise.
(DR_LEN_4): Likewise.
(DR_LEN_8): Likewise.
(DR_LOCAL_ENABLE_SHIFT): Likewise.
(DR_GLOBAL_ENABLE_SHIFT): Likewise.
(DR_ENABLE_SIZE): Likewise.
(DR_LOCAL_SLOWDOWN): Likewise.
(DR_GLOBAL_SLOWDOWN): Likewise.
(DR_CONTROL_RESERVED): Likewise.
(I386_DR_CONTROL_MASK): Likewise.
(I386_DR_VACANT): Likewise.
(I386_DR_LOCAL_ENABLE): Likewise.
(I386_DR_GLOBAL_ENABLE): Likewise.
(I386_DR_DISABLE): Likewise.
(I386_DR_SET_RW_LEN): Likewise.
(I386_DR_GET_RW_LEN): Likewise.
(I386_DR_WATCH_HIT): Likewise.
(i386_wp_op_t): Likewise.
(i386_show_dr): Likewise.
(i386_length_and_rw_bits): Likewise.
(i386_insert_aligned_watchpoint): Likewise.
(i386_remove_aligned_watchpoint): Likewise.
(i386_handle_nonaligned_watchpoint): Likewise.
i386_update_inferior_debug_regs(): Likewise.
(i386_dr_insert_watchpoint): Likewise.
(i386_dr_remove_watchpoint): Likewise.
(i386_dr_region_ok_for_watchpoint): Likewise.
(i386_dr_stopped_data_address): Likewise.
(i386_dr_stopped_by_watchpoint): Likewise.

10 years agoRefactor i386_{insert,remove}_hw_breakpoint
Gary Benson [Thu, 19 Jun 2014 09:50:20 +0000 (10:50 +0100)]
Refactor i386_{insert,remove}_hw_breakpoint

This commit refactors i386_{insert,remove}_hw_breakpoint
to call i386_{insert,remove}_watchpoint rather than
duplicating functionality.

gdb/
2014-06-19  Gary Benson  <gbenson@redhat.com>

* i386-nat.c (i386_insert_hw_breakpoint): Use
i386_insert_watchpoint.
(i386_remove_hw_breakpoint): Use i386_remove_watchpoint.

10 years agoPartially revert 4be83cc2b28ea09aa8ff789839e6520df60836f8
Gary Benson [Wed, 18 Jun 2014 14:17:02 +0000 (15:17 +0100)]
Partially revert 4be83cc2b28ea09aa8ff789839e6520df60836f8

The above commit did two things:

 1) A number of functions were renamed and made nonstatic.
 2) A number of other functions were renamed only.

This commit reverts #1 but not #2.  In addition, prototypes for
functions now remade static have been removed from i386-dregs.h.

gdb/
2014-06-19  Gary Benson  <gbenson@redhat.com>

* i386-nat.c (i386_dr_show): Renamed to
i386_show_dr and made static.  All uses updated.
(i386_dr_length_and_rw_bits): Renamed to
i386_length_and_rw_bits and made static.
All uses updated.
(i386_dr_insert_aligned_watchpoint): Renamed to
i386_insert_aligned_watchpoint and made static.
All uses updated.
(i386_dr_remove_aligned_watchpoint): Renamed to
i386_remove_aligned_watchpoint and made static.
All uses updated.
(i386_dr_update_inferior_debug_regs): Renamed to
i386_update_inferior_debug_regs and made static.
All uses updated.
* nat/i386-dregs.h (i386_dr_show): Removed.
(i386_dr_length_and_rw_bits): Likewise.
(i386_dr_insert_aligned_watchpoint): Likewise.
(i386_dr_remove_aligned_watchpoint): Likewise.
(i386_dr_update_inferior_debug_regs): Likewise.

gdb/gdbserver/
2014-06-19  Gary Benson  <gbenson@redhat.com>

* i386-low.c (i386_dr_show): Renamed to
i386_show_dr and made static.  All uses updated.
(i386_dr_length_and_rw_bits): Renamed to
i386_length_and_rw_bits and made static.
All uses updated.
(i386_dr_insert_aligned_watchpoint): Renamed to
i386_insert_aligned_watchpoint and made static.
All uses updated.
(i386_dr_remove_aligned_watchpoint): Renamed to
i386_remove_aligned_watchpoint and made static.
All uses updated.
(i386_dr_update_inferior_debug_regs): Renamed to
i386_update_inferior_debug_regs and made static.
All uses updated.

10 years agoDemangler crash handler
Gary Benson [Thu, 19 Jun 2014 08:13:57 +0000 (09:13 +0100)]
Demangler crash handler

This commit wraps calls to the demangler with a segmentation fault
handler.  The first time a segmentation fault is caught a core file
is generated and the user is prompted to file a bug and offered the
choice to exit or to continue their GDB session.  A maintainence
option is provided to allow the user to disable the crash handler
if required.

gdb/
2014-06-19  Gary Benson  <gbenson@redhat.com>

* configure.ac [AC_CHECK_FUNCS] <sigaltstack>: New check.
* configure: Regenerate.
* config.in: Likewise.
* main.c (signal.h): New include.
(setup_alternate_signal_stack): New function.
(captured_main): Call the above.
* cp-support.c (signal.h): New include.
(catch_demangler_crashes): New flag.
(SIGJMP_BUF): New define.
(SIGSETJMP): Likewise.
(SIGLONGJMP): Likewise.
(gdb_demangle_jmp_buf): New static global.
(gdb_demangle_attempt_core_dump): Likewise.
(gdb_demangle_signal_handler): New function.
(gdb_demangle): If catch_demangler_crashes is set, install the
above signal handler before calling bfd_demangle, and restore
the original signal handler afterwards.  Display the offending
symbol and call demangler_warning the first time a segmentation
fault is caught.
(_initialize_cp_support): New maint set/show command.

gdb/doc/
2014-06-19  Gary Benson  <gbenson@redhat.com>

* gdb.texinfo (Maintenance Commands): Document new
"maint set/show catch-demangler-crashes" option.

10 years agoRefactor and expose core-dumping functionality
Gary Benson [Thu, 19 Jun 2014 08:12:26 +0000 (09:12 +0100)]
Refactor and expose core-dumping functionality

This commit exposes the functions that dump core outside utils.c.
can_dump_core gains a new parameter, "limit_kind", to allow either
the soft or hard limit to be checked, and its printing has separated
into the new function warn_cant_dump_core.  The new function
can_dump_core_warn does what can_dump_core previously did (print and
warn).

gdb/
2014-06-19  Gary Benson  <gbenson@redhat.com>

* utils.h (resource_limit_kind): New enum.
(can_dump_core): New declaration.
(warn_cant_dump_core): Likewise.
(dump_core): Likewise.
* utils.c (dump_core): Made nonstatic.  Added new
parameter "limit_kind".
(can_dump_core): Made nonstatic. Moved printing code to...
(warn_cant_dump_core): New function.
(can_dump_core_warn): Likewise.
(internal_vproblem): Replace calls to can_dump_core with
calls to can_dump_core_warn.  Supply new argument to each.

10 years agoAdd new internal problem for demangler warnings
Gary Benson [Thu, 19 Jun 2014 08:10:44 +0000 (09:10 +0100)]
Add new internal problem for demangler warnings

This commit adds a new category of internal problem for demangler
warnings.  Demangler warnings behave in much the same way as internal
warnings except that they do not create core files and no option to
change this is presented to the user.

gdb/
2014-06-19  Gary Benson  <gbenson@redhat.com>

* utils.h (demangler_vwarning): New declaration.
(demangler_warning): Likewise.
* utils.c (struct internal_problem)
<user_settable_should_quit>: New field.
<user_settable_should_dump_core>: Likewise
(internal_error_problem): Add values for above new fields.
(internal_warning_problem): Likewise.
(demangler_warning_problem): New static global.
(demangler_vwarning): New function.
(demangler_warning): Likewise.
(add_internal_problem_command): Selectively add commands.
(_initialize_utils): New internal problem command.
* maint.c (maintenance_demangler_warning): New function.
(_initialize_maint_cmds): New command.

gdb/doc/
2014-06-19  Gary Benson  <gbenson@redhat.com>

* gdb.texinfo (Maintenance Commands): Document new
"maint demangler-warning" command and new
"maint set/show demangler-warning" option.

10 years agoThe testcase was generating DW_AT_high_pc and DW_AT_low_pc entries
Luis Machado [Thu, 19 Jun 2014 06:07:48 +0000 (07:07 +0100)]
The testcase was generating DW_AT_high_pc and DW_AT_low_pc entries
with type DW_FORM_string, which is wrong.

GDB was using that information to load data as strings, and then
proceeded to use the string pointers as addresses.

Even then, the test was passing just fine, because we were lucky
enough to have the low_pc string pointer smaller than the high_pc
string pointer.

Two issues are fixed.  The first one is the DW_FORM_string type. The
second one is adjusting the addresses so that they are non-zero,
since GDB doesn't like seeing 0 in these fields due to a check
contained in dwarf2_get_pc_bounds:

  if (low == 0 && !dwarf2_per_objfile->has_section_at_zero)
    return 0;

With both fixes, the testcase passes deterministically.

2014-06-19  Luis Machado  <lgustavo@codesourcery.com>

* gdb.cp/nsalias.exp: Set type of low_pc and high_pc entries
to DW_FORM_addr and use non-zero addresses.

10 years agodaily update
Alan Modra [Thu, 19 Jun 2014 00:01:16 +0000 (09:31 +0930)]
daily update

10 years ago[rx] Make .B suffix optional when possible.
DJ Delorie [Wed, 18 Jun 2014 21:16:30 +0000 (17:16 -0400)]
[rx] Make .B suffix optional when possible.

* config/rx-parse.y (BSET, BCLR, BTST, BNOT, BMCMD): Make .B
suffix optional.

10 years agold/ARM: Add target arm*b-*-freebsd*, update target arm*-*-freebsd*.
Andreas Tobler [Wed, 18 Jun 2014 19:58:19 +0000 (21:58 +0200)]
ld/ARM: Add target arm*b-*-freebsd*, update target arm*-*-freebsd*.

ld/ChangeLog:

2014-06-18  Andreas Tobler  <andreast@fgznet.ch>

        * configure.tgt (arm*-*-freebsd*): Update targ_extra_emuls.
(arm*b-*-freebsd*): Add target.
* emulparams/armelfb_fbsd.sh: Added.
* emulparams/armelf_fbsd.sh: Updated.
* Makefile.am (ALL_EMULATION_SOURCES): Add earmelfb_fbsd.c.
* Makefile.in: Regenerate.

10 years agomake common_block const
Tom Tromey [Wed, 11 Jun 2014 14:02:48 +0000 (08:02 -0600)]
make common_block const

This changes general_symbol_info to make "common_block" const.

2014-06-18  Tom Tromey  <tromey@redhat.com>

* f-valprint.c (info_common_command_for_block): Update.
* symtab.h (struct general_symbol_info) <common_block>: Now
const.

10 years agoconstify some blockvector APIs
Tom Tromey [Tue, 10 Jun 2014 19:11:19 +0000 (13:11 -0600)]
constify some blockvector APIs

Generally, the blockvector ought to be readonly.  So, this patch makes
the blockvector const in the symtab, and also changes various
blockvector APIs to be const.

This patch has a couple of spots that cast away const.  I consider
these to be ok because they occur in mdebugread and are used while
constructing the blockvector.  I have added comments at these spots.

2014-06-18  Tom Tromey  <tromey@redhat.com>

* symtab.h (struct symtab) <blockvector>: Now const.
* ada-lang.c (ada_add_global_exceptions): Update.
* buildsym.c (augment_type_symtab): Update.
* dwarf2read.c (dw2_lookup_symbol): Update.
* jit.c (finalize_symtab): Update.
* jv-lang.c (add_class_symtab_symbol): Update.
* mdebugread.c (parse_symbol, add_block, sort_blocks, new_symtab):
Update.
* objfiles.c (objfile_relocate1): Update.
* psymtab.c (lookup_symbol_aux_psymtabs)
(maintenance_check_psymtabs): Update.
* python/py-symtab.c (stpy_global_block, stpy_static_block):
Update.
* spu-tdep.c (spu_catch_start): Update.
* symmisc.c (dump_symtab_1): Update.
* symtab.c (lookup_global_symbol_from_objfile)
(lookup_symbol_aux_objfile, lookup_symbol_aux_quick)
(basic_lookup_transparent_type_quick)
(basic_lookup_transparent_type, find_pc_sect_symtab)
(find_pc_sect_line, search_symbols): Update.
* block.c (find_block_in_blockvector): Make "bl" const.
(blockvector_for_pc_sect, blockvector_for_pc): Make return type
const.
(blockvector_contains_pc): Make "bv" const.
(block_for_pc_sect): Update.
* block.h (blockvector_for_pc, blockvector_for_pc_sect)
(blockvector_contains_pc): Update.
* breakpoint.c (resolve_sal_pc): Update.
* inline-frame.c (block_starting_point_at): Update.

10 years agoconstify complete_line
Tom Tromey [Mon, 15 Apr 2013 16:22:12 +0000 (10:22 -0600)]
constify complete_line

This changes complete_line to take a const parameter.

2014-06-18  Tom Tromey  <tromey@redhat.com>

* completer.c (complete_line): Make "line_buffer" const.
* completer.h (complete_line): Update.

10 years agoremove unneeded cast in symtab.c
Tom Tromey [Thu, 28 Mar 2013 17:09:08 +0000 (11:09 -0600)]
remove unneeded cast in symtab.c

This removes an unneeded const cast from symtab.c:add_macro_name.

2014-06-18  Tom Tromey  <tromey@redhat.com>

* symtab.c (add_macro_name): Remove unneeded cast.

10 years agoconstify parse_cli_boolean_value
Tom Tromey [Wed, 27 Mar 2013 16:35:35 +0000 (10:35 -0600)]
constify parse_cli_boolean_value

This changes a parameter of parse_cli_boolean_value to be const.

2014-06-18  Tom Tromey  <tromey@redhat.com>

* cli/cli-setshow.h (parse_cli_boolean_value): Update.
* cli/cli-setshow.c (parse_cli_boolean_value): Make "arg" const.

10 years agoconstify probe.c function
Tom Tromey [Tue, 10 Jun 2014 17:25:18 +0000 (11:25 -0600)]
constify probe.c function

This constifies an argument to info_probes_for_ops.

2014-06-18  Tom Tromey  <tromey@redhat.com>

* probe.c (info_probes_for_ops): Make "arg" const.
* probe.h (info_probes_for_ops): Update.

10 years agoconstify struct block in some places
Tom Tromey [Tue, 12 Mar 2013 15:51:37 +0000 (09:51 -0600)]
constify struct block in some places

This makes some spots in gdb, particularly general_symbol_info, use a
"const struct block", then fixes the fallout.

The justification is that, ordinarily, blocks ought to be readonly.
Note though that we can't add "const" in the blockvector due to block
relocation.  This can be done once blocks are made independent of the
program space.

2014-06-18  Tom Tromey  <tromey@redhat.com>

* varobj.c (varobj_create): Update.
* valops.c (value_of_this): Update.
* tracepoint.c (add_local_symbols, scope_info): Update.
* symtab.h (struct general_symbol_info) <block>: Now const.
* symtab.c (skip_prologue_sal)
(default_make_symbol_completion_list_break_on)
(skip_prologue_using_sal): Update.
* stack.h (iterate_over_block_locals)
(iterate_over_block_local_vars): Update.
* stack.c (print_frame_args): Update.
(iterate_over_block_locals, iterate_over_block_local_vars): Make
parameter const.
(get_selected_block): Make return type const.
* python/py-frame.c (frapy_block): Update.
* python/py-block.c (gdbpy_block_for_pc): Update.
* p-exp.y (%union) <bval>: Now const.
* mi/mi-cmd-stack.c (list_args_or_locals): Update.
* mdebugread.c (mylookup_symbol, parse_procedure): Update.
* m2-exp.y (%union) <bval>: Now const.
* linespec.c (get_current_search_block): Make return type const.
(create_sals_line_offset, find_label_symbols): Update.
* inline-frame.c (inline_frame_sniffer, skip_inline_frames):
Update.
(block_starting_point_at): Make "block" const.
* infrun.c (insert_exception_resume_breakpoint): Make "b" const.
(check_exception_resume): Update.
* guile/scm-frame.c (gdbscm_frame_block): Update.
* guile/scm-block.c (gdbscm_lookup_block): Update.
* frame.h (get_frame_block): Update.
(get_selected_block): Make return type const.
* frame.c (frame_id_inner): Update.
* f-valprint.c (info_common_command_for_block)
(info_common_command): Update.
* dwarf2loc.c (dwarf2_find_location_expression)
(dwarf_expr_frame_base, dwarf2_compile_expr_to_ax)
(locexpr_describe_location_piece): Update.
* c-exp.y (%union) <bval>: Now const.
* breakpoint.c (resolve_sal_pc): Update.
* blockframe.c (get_frame_block):Make return type const.
(get_pc_function_start, get_frame_function, find_pc_sect_function)
(block_innermost_frame): Update.
* block.h (blockvector_for_pc, blockvector_for_pc_sect)
(block_for_pc, block_for_pc_sect): Update.
* block.c (blockvector_for_pc_sect, blockvector_for_pc): Make
'pblock' const.
(block_for_pc_sect, block_for_pc): Make return type const.
* ax-gdb.c (gen_expr): Update.
* alpha-mdebug-tdep.c (find_proc_desc): Update.
* ada-lang.c (ada_read_renaming_var_value): Make 'block' const.
(ada_make_symbol_completion_list, ada_add_exceptions_from_frame)
(ada_read_var_value): Update.
* ada-exp.y (struct name_info) <block>: Now const.
(%union): Likewise.
(block_lookup): Constify.

10 years agoMake xmethods tests not to depend on inferior IO.
Siva Chandra [Thu, 5 Jun 2014 14:03:56 +0000 (07:03 -0700)]
Make xmethods tests not to depend on inferior IO.

gdb/testsuite/

PR gdb/17017
* gdb.python/py-xmethods.cc: Add global function call counters and
increment them in their respective functions.  Remove "cout"
statements.
* gdb.python/py-xmethods.exp: Make tests check the global function
call counters instead of depending on inferior IO.

10 years agoMove macros from i386-{nat,low}.c to i386-{nat,low}.h
Gary Benson [Mon, 16 Jun 2014 14:19:21 +0000 (15:19 +0100)]
Move macros from i386-{nat,low}.c to i386-{nat,low}.h

This commit moves macros required by the soon-to-be-created
nat/i386-dregs.c into i386-{nat,low}.h.

10 years agoCreate nat/i386-dregs.h
Gary Benson [Mon, 16 Jun 2014 11:18:41 +0000 (12:18 +0100)]
Create nat/i386-dregs.h

This commit moves code to be shared from i386-{nat,low}.[ch]
into a new file, nat/i386-dregs.h.

gdb/
2014-06-18  Gary Benson  <gbenson@redhat.com>

* nat/i386-dregs.h: New file.
* Makefile.in (HFILES_NO_SRCDIR): Add the above.
* i386-nat.h (i386-dregs.h): New include.
(DR_FIRSTADDR): Now in i386-dregs.h.
(DR_LASTADDR): Likewise.
(DR_NADDR): Likewise.
(DR_STATUS): Likewise.
(DR_CONTROL): Likewise.
(i386_debug_reg_state): Likewise.
* i386-nat.c (ALL_DEBUG_REGISTERS): Likewise.

gdb/gdbserver/
2014-06-18  Gary Benson  <gbenson@redhat.com>

* i386-low.h (i386-dregs.h): New include.
(DR_FIRSTADDR): Now in i386-dregs.h.
(DR_LASTADDR): Likewise.
(DR_NADDR): Likewise.
(DR_STATUS): Likewise.
(DR_CONTROL): Likewise.
(i386_debug_reg_state): Likewise.
(i386_dr_insert_watchpoint): Likewise.
(i386_dr_remove_watchpoint): Likewise.
(i386_dr_region_ok_for_watchpoint): Likewise.
(i386_dr_stopped_data_address): Likewise.
(i386_dr_stopped_by_watchpoint): Likewise.
* i386-low.c (ALL_DEBUG_REGISTERS): Likewise.

10 years agoSymptom:
Luis Machado [Wed, 18 Jun 2014 09:25:47 +0000 (10:25 +0100)]
Symptom:

Using the test program gdb.base/foll-fork.c, with follow-fork-mode set to
"child" and detach-on-fork set to "off", stepping or running past the fork
call results in the child process running to completion, when it should
just finish the single step.  In addition, the breakpoint is not removed
from the parent process, so if it is resumed it receives a SIGTRAP.

Cause:

No matter what the setting for detach-on-fork, when stepping past a fork,
the single-step breakpoint (step_resume_breakpoint) is not handled
correctly in the parent.  The SR breakpoint is cloned for the child
process, but before the clone is associated with the child it is treated as
a duplicate of the original, associated wth the parent.  This results in
the insertion state of the original SR breakpoint and the clone being
"swapped" by breakpoint.c:update_global_location_list, so that the clone is
marked as inserted.

In the case where the parent is not detached, the two breakpoints remain in
that state.  The breakpoint is never inserted in the child, because
although the cloned SR breakpoint is associated with the child, it is
marked as inserted.  When the child is resumed, it runs to completion.  The
breakpoint is never removed from the parent, so that if it is resumed after
the child exits, it gets a SIGTRAP.

Here is the sequence of events:

1) handle_inferior_event: FORK event is recognized.

2) handle_inferior_event: detach_breakpoints removes all breakpoints
from the child.

3) follow_fork: the parent SR breakpoint is cloned.  Part of this procedure
is to call update_global_location_list, which swaps the insertion state of
the original and cloned SR breakpoints as part of ensuring that duplicate
breakpoints are only inserted once.  At this point the original SR
breakpoint is not marked as inserted, and the clone is.  The breakpoint is
actually inserted in the parent but not the child.

4) follow_fork: the original breakpoint is deleted by calling
delete_step_resume_breakpoint.  Since the original is not marked as
inserted, the actual breakpoint remains in the parent process.
update_global_location_list is called again as part of the deletion.  The
clone is still associated with the parent, but since it is marked as
enabled and inserted, the breakpoint is left in the parent.

5) follow_fork: if detach-on-fork is 'on', the actual breakpoint will be
removed from the parent in target_detach, based on the cloned breakpoint
still associated with the parent.  Then the clone is no longer marked as
inserted.  In follow_inferior_reset_breakpoints the clone is associated
with the child, and can be inserted.

If detach-on-fork is 'off', the actual breakpoint in the parent is never
removed (although the breakpoint had been deleted from the list).  Since
the clone continues to be marked 'inserted', the SR breakpoint is never
inserted in the child.

Fix:

Set the cloned breakpoint as disabled from the moment it is created.  This
is done by modifying clone_momentary_breakpoint to take an additional
argument, LOC_ENABLED, which is used as the value of the
bp_location->enabled member.  The clone must be disabled at that point
because clone_momentary_breakpoint calls update_global_location_list, which
will swap treat the clone as a duplicate of the original breakpoint if it
is enabled.

All the calls to clone_momentary_breakpoint had to be modified to pass '1'
or '0'.  I looked at implementing an enum for the enabled member, but
concluded that readability would suffer because there are so many places it
is used as a boolean, e.g. "if (bl->enabled)".

In follow_inferior_reset_breakpoints the clone is set to enabled once it
has been associated with the child process.  With this, the bp_location
'inserted' member is maintained correctly throughout the follow-fork
procedure and the behavior is as expected.

The same treatment is given to the exception_resume_breakpoint when
following a fork.

Testing:

Ran 'make check' on Linux x64.

Along with the fix above, the coverage of the follow-fork test
gdb.base/foll-fork.exp was expanded to:

1) cover all the combinations of values for
   follow-fork-mode and detach-on-fork

2) make sure that both user breakpoints and
   single-step breakpoints are propagated
   correctly to the child

3) check that the inferior list has the
   expected contents after following the fork.

4) check that unfollowed, undetached inferiors
   can be resumed.

gdb/

2014-06-18  Don Breazeal  <donb@codesourcery.com>

* breakpoint.c (set_longjmp_breakpoint): Call
momentary_breakpoint_from_master with additional argument.
(set_longjmp_breakpoint_for_call_dummy): Call
momentary_breakpoint_from_master with additional argument.
(set_std_terminate_breakpoint): Call
momentary_breakpoint_from_master with additional argument.
(momentary_breakpoint_from_master): Add argument to function
definition and use it to initialize structure member flag.
(clone_momentary_breakpoint): Call
momentary_breakpoint_from_master with additional argument.
* infrun.c (follow_inferior_reset_breakpoints): Clear structure
member flags set in momentary_breakpoint_from_master.

gdb/testsuite/

2014-06-18  Don Breazeal  <donb@codesourcery.com>

* gdb.base/foll-fork.exp (default_fork_parent_follow):
Deleted procedure.
(explicit_fork_parent_follow): Deleted procedure.
(explicit_fork_child_follow): Deleted procedure.
(test_follow_fork): New procedure.
(do_fork_tests): Replace calls to deleted procedures with
calls to test_follow_fork and reset GDB for subsequent
procedure calls.

10 years agoRename functions and make nonstatic as necessary
Gary Benson [Mon, 16 Jun 2014 10:06:43 +0000 (11:06 +0100)]
Rename functions and make nonstatic as necessary

This commit renames the functions that are to be shared.
Functions to be shared that were static are made nonstatic.

gdb/
2014-06-18  Gary Benson  <gbenson@redhat.com>

* i386-nat.c (i386_show_dr): Renamed to
i386_dr_show and made nonstatic.  All uses updated.
(i386_length_and_rw_bits): Renamed to
i386_dr_length_and_rw_bits and made nonstatic.
All uses updated.
(i386_insert_aligned_watchpoint): Renamed to
i386_dr_insert_aligned_watchpoint and made nonstatic.
All uses updated.
(i386_remove_aligned_watchpoint): Renamed to
i386_dr_remove_aligned_watchpoint and made nonstatic.
All uses updated.
(i386_update_inferior_debug_regs): Renamed to
i386_dr_update_inferior_debug_regs and made nonstatic.
All uses updated.

gdb/gdbserver/
2014-06-18  Gary Benson  <gbenson@redhat.com>

* i386-low.h (i386_low_insert_watchpoint): Renamed to
i386_dr_insert_watchpoint.
(i386_low_remove_watchpoint): Renamed to
i386_dr_remove_watchpoint.
(i386_low_region_ok_for_watchpoint): Renamed to
i386_dr_region_ok_for_watchpoint.
(i386_low_stopped_data_address): Renamed to
i386_dr_stopped_data_address.
(i386_low_stopped_by_watchpoint): Renamed to
i386_dr_stopped_by_watchpoint.
* i386-low.c (i386_show_dr): Renamed to
i386_dr_show and made nonstatic.  All uses updated.
(i386_length_and_rw_bits): Renamed to
i386_dr_length_and_rw_bits and made nonstatic.
All uses updated.
(i386_insert_aligned_watchpoint): Renamed to
i386_dr_insert_aligned_watchpoint and made nonstatic.
All uses updated.
(i386_remove_aligned_watchpoint): Renamed to
i386_dr_remove_aligned_watchpoint and made nonstatic.
All uses updated.
(i386_update_inferior_debug_regs): Renamed to
i386_dr_update_inferior_debug_regs and made nonstatic.
All uses updated.
(i386_low_insert_watchpoint): Renamed to
i386_dr_insert_watchpoint.  All uses updated.
(i386_low_remove_watchpoint): Renamed to
i386_dr_remove_watchpoint.  All uses updated.
(i386_low_region_ok_for_watchpoint): Renamed to
i386_dr_region_ok_for_watchpoint.  All uses updated.
(i386_low_stopped_data_address): Renamed to
i386_dr_stopped_data_address.  All uses updated.
(i386_low_stopped_by_watchpoint): Renamed to
i386_dr_stopped_by_watchpoint.  All uses updated.

10 years agoAbstract i386_dr_low access
Gary Benson [Mon, 16 Jun 2014 14:06:09 +0000 (15:06 +0100)]
Abstract i386_dr_low access

This commit adds macros to abstract access to the i386_dr_low
function vector used by i386-nat.c.  The macros are named so
as to match the names of the functions that do the same work
in gdbserver.

gdb/
2014-06-18  Gary Benson  <gbenson@redhat.com>

* i386-nat.c (i386_dr_low_can_set_addr): New macro.
(i386_dr_low_can_set_control): Likewise.
(i386_dr_low_set_addr): Likewise.
(i386_dr_low_set_control): Likewise.
(i386_dr_low_get_addr): Likewise.
(i386_dr_low_get_status): Likewise.
(i386_dr_low_get_control): Likewise.
(i386_insert_aligned_watchpoint): Use new macros.
(i386_update_inferior_debug_regs): Likewise.
(i386_stopped_data_address): Likewise.

gdb/gdbserver/
2014-06-18  Gary Benson  <gbenson@redhat.com>

* i386-low.c (i386_dr_low_can_set_addr): New macro.
(i386_dr_low_can_set_control): Likewise.
(i386_insert_aligned_watchpoint): New check.

10 years agoMerge i386_update_inferior_debug_regs
Gary Benson [Thu, 12 Jun 2014 11:01:11 +0000 (12:01 +0100)]
Merge i386_update_inferior_debug_regs

This commit synchronizes the i386_update_inferior_debug_regs functions
in i386-nat.c and i386-low.c.

gdb/
2014-06-18  Gary Benson  <gbenson@redhat.com>

* i386-nat.c (i386_update_inferior_debug_regs) <state>:
New parameter.  All uses updated.

gdb/gdbserver/
2014-06-18  Gary Benson  <gbenson@redhat.com>

* i386-low.c (i386_update_inferior_debug_regs) <inf_state>:
Renamed to state.

10 years agoRename maint_show_dr to debug_hw_points
Gary Benson [Wed, 11 Jun 2014 14:30:50 +0000 (15:30 +0100)]
Rename maint_show_dr to debug_hw_points

This commit renames maint_show_dr to debug_hw_points in i386-nat.c.

gdb/
2014-06-18  Gary Benson  <gbenson@redhat.com>

* i386-nat.c (maint_show_dr): Renamed to debug_hw_points.
All uses updated.

10 years agoMerge error handling
Gary Benson [Wed, 11 Jun 2014 14:42:34 +0000 (15:42 +0100)]
Merge error handling

This commit makes all error handling in i386-low.c use internal_error
rather than fatal and error.

gdb/gdbserver/
2014-06-18  Gary Benson  <gbenson@redhat.com>

* i386-low.c (i386_length_and_rw_bits): Use internal_error
instead of fatal and error.
(i386_handle_nonaligned_watchpoint): Likewise.

10 years agoMerge printing code
Gary Benson [Tue, 17 Jun 2014 10:32:58 +0000 (11:32 +0100)]
Merge printing code

This commit synchronizes the debug printing code in i386-nat.c and
i386-low.c.

gdb/
2014-06-18  Gary Benson  <gbenson@redhat.com>

* i386-nat.c (debug_printf): New macro.
(i386_get_debug_register_length): Likewise.
(TARGET_HAS_DR_LEN_8): Use above macro.
(i386_show_dr): Use debug_printf instead of puts_unfiltered
and printf_unfiltered.  Use phex to format values.

gdb/gdbserver/
2014-06-18  Gary Benson  <gbenson@redhat.com>

* i386-low.c (i386_get_debug_register_length): New macro.
(TARGET_HAS_DR_LEN_8): Remove conditional.  Use above macro.
(i386_show_dr): Use debug_printf instead of fprintf.  Use
phex to format values.

10 years agoAdd a const
Gary Benson [Tue, 10 Jun 2014 09:44:00 +0000 (10:44 +0100)]
Add a const

This commit adds a const that was in i386-low.c but not in i386-nat.c.

gdb/
2014-06-18  Gary Benson  <gbenson@redhat.com>

* i386-nat.c (i386_handle_nonaligned_watchpoint) <size_try_array>:
Make const.

10 years agoComment changes
Gary Benson [Tue, 17 Jun 2014 10:32:26 +0000 (11:32 +0100)]
Comment changes

This commit fixes various comment differences between
i386-nat.[ch] and i386-low.[ch].

gdb/
2014-06-18  Gary Benson  <gbenson@redhat.com>

* i386-nat.c: Comment changes.

gdb/gdbserver/
2014-06-18  Gary Benson  <gbenson@redhat.com>

* i386-low.h: Comment changes.
* i386-low.c: Likewise.

10 years agoRemove unused macro
Gary Benson [Mon, 16 Jun 2014 09:47:02 +0000 (10:47 +0100)]
Remove unused macro

This commit removes an unused macro from i386-nat.c.

gdb/
2014-06-18  Gary Benson  <gbenson@redhat.com>

* i386-nat.c (I386_DR_WATCH_MASK): Remove macro.

10 years agoRemove unnecessary prototypes
Gary Benson [Thu, 12 Jun 2014 13:15:58 +0000 (14:15 +0100)]
Remove unnecessary prototypes

This commit removes four unnecessary prototypes from i386-nat.c.

gdb/
2014-06-18  Gary Benson  <gbenson@redhat.com>

* i386-nat.c (i386_length_and_rw_bits): Remove prototype.
(i386_insert_aligned_watchpoint): Likewise.
(i386_remove_aligned_watchpoint): Likewise.
(i386_handle_nonaligned_watchpoint): Likewise.

10 years agoWhitespace changes
Gary Benson [Tue, 17 Jun 2014 12:11:56 +0000 (13:11 +0100)]
Whitespace changes

This commit fixes various whitespace differences between i386-nat.c
and i386-low.c.

gdb/
2014-06-18  Gary Benson  <gbenson@redhat.com>

* i386-nat.c: Whitespace changes.

gdb/gdbserver/
2014-06-18  Gary Benson  <gbenson@redhat.com>

* i386-low.c: Whitespace changes.

10 years agoBrown paper bag: left out part of the ChangeLog entry ...
Samuel Bronson [Wed, 18 Jun 2014 04:26:46 +0000 (00:26 -0400)]
Brown paper bag: left out part of the ChangeLog entry ...

10 years ago* MAINTAINERS: Update Roland McGrath's email address.
Samuel Bronson [Wed, 18 Jun 2014 04:12:57 +0000 (00:12 -0400)]
* MAINTAINERS: Update Roland McGrath's email address.
Thanks to Sergio Durigan Junior for pointing out that he left
Red Hat a while ago, and giving me a current address.

10 years agodaily update
Alan Modra [Wed, 18 Jun 2014 00:23:09 +0000 (09:53 +0930)]
daily update

10 years agoGAS: Fix MMIX err-fb-2.s regression caused by recent generic GAS changes.
Hans-Peter Nilsson [Tue, 17 Jun 2014 22:11:01 +0000 (00:11 +0200)]
GAS: Fix MMIX err-fb-2.s regression caused by recent generic GAS changes.

10 years agoremove redundant savestring declaration
Tom Tromey [Tue, 17 Jun 2014 18:57:06 +0000 (12:57 -0600)]
remove redundant savestring declaration

I happened to notice that savestring is still declared in utils.h,
despite the fact that it was moved to common/ a while back.  This
patch removes the redundant declaration.  Tested by rebuilding.  I'm
committing this as obvious.

2014-06-17  Tom Tromey  <tromey@redhat.com>

* utils.h (savestring): Remove declaration.

10 years agouse make_cleanup_freeargv
Tom Tromey [Tue, 17 Jun 2014 17:43:21 +0000 (11:43 -0600)]
use make_cleanup_freeargv

This replaces a function cast with a call to make_cleanup_freeargv.

I'm checking this in as obvious.

2014-06-17  Tom Tromey  <tromey@redhat.com>

* remote.c (extended_remote_run): Use make_cleanup_freeargv.

10 years agoThis fixes a bug whereby #line directives inside a macro would be ignored,
Chris Metcalf [Tue, 17 Jun 2014 16:21:08 +0000 (17:21 +0100)]
This fixes a bug whereby #line directives inside a macro would be ignored,
thus resulting in bad line debug information.

PR gas/16908
* macro.c (buffer_and_nest): Honour #line directives inside
macros.

10 years agoPrevent large (or negative) version values from overflowing into other fields when
Nick Clifton [Tue, 17 Jun 2014 15:50:15 +0000 (16:50 +0100)]
Prevent large (or negative) version values from overflowing into other fields when
parsing version strings.

PR binutils/16923
* rcparse.y (fixedverinfo): Prevent large version numbers from
corrupting other values.

10 years agoDifferent outputs affected by hosts
Yao Qi [Tue, 27 May 2014 11:56:21 +0000 (19:56 +0800)]
Different outputs affected by hosts

We find the following fails in gdb test on mingw host.

FAIL: gdb.base/wchar.exp: print repeat
FAIL: gdb.base/wchar.exp: print repeat_p
FAIL: gdb.base/wchar.exp: print repeat (print null on)
FAIL: gdb.base/wchar.exp: print repeat (print elements 3)
FAIL: gdb.base/wchar.exp: print repeat_p (print elements 3)

print repeat^M
$7 = L"A", '¢' <repeats 21 times>, "B", '\000' <repeats 104 times>^M
(gdb) FAIL: gdb.base/wchar.exp: print repeat

the \242 is expected in the test but cent sign is displayed.

In valprint.c:print_wchar, wchar_printable is called to determine
whether a wchar is printable.  wchar_printable calls iswprint but
the iswprint's return value depends on LC_CTYPE setting of locale [1, 2].
The output may vary with different locale settings and OS.  IMO, '¢'
(cent sign) is a correct output on Windows.

[1] http://pubs.opengroup.org/onlinepubs/009604499/functions/iswprint.html
[2] http://msdn.microsoft.com/en-us/library/ewx8s4kw.aspx

This patch is set $cent to cent sign if the GDB is running on a
Windows host.

gdb/testsuite:

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

* gdb.base/wchar.exp: Set $cent to \u00A2 if "host-charset" is
CP1252.

10 years agoIn a couple functions (type_update_when_use_rtti_test and
Luis Machado [Tue, 17 Jun 2014 09:42:23 +0000 (10:42 +0100)]
In a couple functions (type_update_when_use_rtti_test and
skip_type_update_when_not_use_rtti_test) the testcase assumes an
uninitialized object has a specific type. In particular, 'ptr' and
's'.

In reality the compiler is free to do what it wants with that
uninitialized variable, even initialize it beforehand with the future
assignment's value.  This is exactly what happens on some targets.

ptr should have type 'Base *', but it really has type 'Derived *'
because it is already initialized (earlier) by the compiler. The same
thing happens to 's'.

The following patch addresses this by explicitly initializing those
variables so the compiler doesn't optimize their assignments and GDB
can print their correct values.

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

* gdb.mi/mi-var-rtti.cc (type_update_when_use_rtti_test):
Initialize ptr and S explicitly.
(skip_type_update_when_not_use_rtti_test): Likewise.

10 years agogas/ARM: Misses deprecated IT instruction warning for ARMv8
Jiong Wang [Tue, 17 Jun 2014 09:06:00 +0000 (10:06 +0100)]
gas/ARM: Misses deprecated IT instruction warning for ARMv8

  Add sp increment and decrement to ARMv8 IT block deprecate
  pattern.

  gas/
    * config/tc-arm.c (depr_it_insns): New check for inc/dec sp.

  gas/testsuite/
    * gas/arm/armv8-a-it-bad.s: New check for inc/dec sp.
    * gas/arm/armv8-a-it-bad.l: Likewise.

10 years agodaily update
Alan Modra [Tue, 17 Jun 2014 00:01:07 +0000 (09:31 +0930)]
daily update

10 years agoGAS: Fix CRIS double-error reports caused by recent generic GAS changes.
Hans-Peter Nilsson [Mon, 16 Jun 2014 22:56:01 +0000 (00:56 +0200)]
GAS: Fix CRIS double-error reports caused by recent generic GAS changes.

10 years agoFix for PR mi/15863
Keith Seitz [Wed, 11 Jun 2014 20:26:50 +0000 (13:26 -0700)]
Fix for PR mi/15863

If an MI client creates a varobj and attempts to update the root
/before/ the inferior is started, gdb will throw an internal error:

(gdb)
-var-create * - batch_flag
^done,name="var1",numchild="0",value="0",type="int",has_more="0"
(gdb)
-var-update var1
^done,changelist=[]
(gdb)
-var-update *
~"../../src/gdb/thread.c:628: internal-error: is_thread_state: Assertion `tp' failed.\nA problem internal to GDB has been detected,\nfurther debugging may prove unreliable.\nQuit this debugging session? "
~"(y or n) "

The function that handles the varobj update in the failing case,
mi_cmd_var_udpate_iter, checks if the thread/inferior is stopped before
attempting to update the varobj. It calls is_stopped (inferior_ptid)
which calls is_thread_state:

    tp = find_thread_ptid (ptid);
    gdb_assert (tp);

When there is no inferior, ptid is null_ptid, and find_thread_ptid (null_ptid)
returns NULL and the assertion is triggered.

This patch changes mi_cmd_var_update_iter to behave the same way
"-var-update var1" does: by calling the thread "stopped" if
there is no inferior (and thereby calling varobj_update_one).

ChangeLog
2014-06-16  Keith Seitz  <keiths@redhat.com>

PR mi/15863
* mi/mi-cmd-var.c (mi_cmd_var_update_iter): Do not attempt
to update the varobj if inferior_ptid is null_ptid.

testsuite/ChangeLog
2014-06-16  Keith Seitz  <keiths@redhat.com>

PR mi/15863
* gdb.mi/mi-var-cmd.exp: Add test for -var-update before
the inferior is started.

10 years agoFixes a problem exposed by the aarcg64/illegal.s test case - where the assembler was
Nick Clifton [Mon, 16 Jun 2014 16:37:46 +0000 (17:37 +0100)]
Fixes a problem exposed by the aarcg64/illegal.s test case - where the assembler was
generating too many error messages.

* config/tc-aarch64.c (md_apply_fix): Ignore unused relocs.

10 years agoconstify to_info_proc and friends
Tom Tromey [Fri, 6 Jun 2014 19:38:16 +0000 (13:38 -0600)]
constify to_info_proc and friends

This makes a parameter of to_info_proc const and then fixes up some
fallout, including parameters in a couple of gdbarch methods.

I could not test the procfs.c change.  I verified it by inspection.
If this causes an error here, it will be trivial to fix.

2014-06-16  Tom Tromey  <tromey@redhat.com>

* target.h (struct target_ops) <to_info_proc>: Make parameter
const.
(target_info_proc): Update.
* target.c (target_info_proc): Make "args" const.
* procfs.c (procfs_info_proc): Update.
* linux-tdep.c (linux_info_proc): Update.
(linux_core_info_proc_mappings): Make "args" const.
(linux_core_info_proc): Update.
* gdbarch.sh (info_proc, core_info_proc): Make "args" const.
* gdbarch.c: Rebuild.
* gdbarch.h: Rebuild.
* corelow.c (core_info_proc): Update.

10 years agoconstify to_disconnect
Tom Tromey [Fri, 6 Jun 2014 19:26:53 +0000 (13:26 -0600)]
constify to_disconnect

This constifies an parameter of to_disconnect and updates
target_disconnect as well.

2014-06-16  Tom Tromey  <tromey@redhat.com>

* target.h (struct target_ops) <to_disconnect>: Make parameter
const.
(target_disconnect): Update.
* target.c (target_disconnect): Make "args" const.
* target-delegates.c: Rebuild.
* remote.c (remote_disconnect): Update.
* record.h (record_disconnect): Update.
* record.c (record_disconnect): Update.
* inf-child.c (inf_child_disconnect): Update.

10 years agoconstify to_rcmd
Tom Tromey [Fri, 6 Jun 2014 19:19:53 +0000 (13:19 -0600)]
constify to_rcmd

This makes the "command" parameter of the to_rcmd target method const.

2014-06-16  Tom Tromey  <tromey@redhat.com>

* target.h (struct target_ops) <to_rcmd>: Make "command" const.
* target.c (debug_to_rcmd, default_rcmd): Update.
* target-delegates.c: Rebuild.
* remote.c (remote_rcmd): Update.
* monitor.c (monitor_rcmd): Update.

10 years agoThis fixes the aarch64 assembler so that it will generate error messages when
Jiong Wang [Mon, 16 Jun 2014 16:22:19 +0000 (17:22 +0100)]
This fixes the aarch64 assembler so that it will generate error messages when
a syntax error is detected in an optional operand.

  * config/tc-aarch64.c (END_OF_INSN): New macro.
  (parse_operands): Handle operand given and be in wrong
  format when operand is optional.

  * gas/aarch64/diagnostic.s: New test patterns.
  * gas/aarch64/diagnostic.l: Likewise.

10 years agold/ARM: Fix IFUNC and TLS descriptors in the same shared object
Will Newton [Mon, 16 Jun 2014 14:49:07 +0000 (15:49 +0100)]
ld/ARM: Fix IFUNC and TLS descriptors in the same shared object

Combining TLS descriptors and GNU indirect functions in the same
object could lead to assertions or multiple dynamic relocations
for the same GOT slot. Fix the bookkeeping so this doesn't happen.

This allows building and make checking glibc with -mtls-dialect=gnu2.

bfd/ChangeLog:

2014-06-16  Will Newton  <will.newton@linaro.org>

* elf32-arm.c (elf32_arm_allocate_plt_entry): Increment
htab->next_tls_desc_index in the non-IPLT case.
Calculate GOT offset correctly for the non-IPLT case.
(allocate_dynrelocs_for_symbol): Don't increment
htab->next_tls_desc_index here.

ld/testsuite/ChangeLog:

2014-06-16  Will Newton  <will.newton@linaro.org>

* ld-arm/arm-elf.exp: Add ifunc-gdesc test.
* ld-arm/ifunc-gdesc.r: New file.
* ld-arm/ifunc-gdesc.s: Likewise.
* ld-arm/ifunc-gdesc.ver: Likewise.

10 years ago"$ gdb PROGRAM" vs "(gdb) file PROGRAM" difference; warn on failure to remove breakpoint.
Pedro Alves [Mon, 16 Jun 2014 14:38:13 +0000 (15:38 +0100)]
"$ gdb PROGRAM" vs "(gdb) file PROGRAM" difference; warn on failure to remove breakpoint.

Turns out there's a difference between loading the program with "gdb
PROGRAM", vs loading it with "(gdb) file PROGRAM".  The latter results
in the objfile ending up with OBJF_USERLOADED set, while not with the
former.  (That difference seems bogus, but still that's not the point
of this patch.  We can revisit that afterwards.)

The new code that suppresses breakpoint removal errors for
add-symbol-file objects ends up being too greedy:

      /* In some cases, we might not be able to remove a breakpoint in
         a shared library that has already been removed, but we have
         not yet processed the shlib unload event.  Similarly for an
         unloaded add-symbol-file object - the user might not yet have
         had the chance to remove-symbol-file it.  shlib_disabled will
         be set if the library/object has already been removed, but
         the breakpoint hasn't been uninserted yet, e.g., after
         "nosharedlibrary" or "remove-symbol-file" with breakpoints
         always-inserted mode.  */
      if (val
          && (bl->loc_type == bp_loc_software_breakpoint
              && (bl->shlib_disabled
                  || solib_name_from_address (bl->pspace, bl->address)
                  || userloaded_objfile_contains_address_p (bl->pspace,
                                                            bl->address))))
        val = 0;

as it turns out that OBJF_USERLOADED can be set for objfiles loaded by
some other means not add-symbol-file.  In this case, symbol-file (or
"file", which is really just "exec-file"+"symbol-file").

Recall that add-symbol-file is documented as:

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

And it's the "dynamically loaded" aspect that the breakpoint.c code
cares about.  So make add-symbol-file set OBJF_SHARED on its objfiles
too, and tweak the breakpoint.c code to look for OBJF_SHARED instead
of OBJF_USERLOADED.

This restores back the missing breakpoint removal warning when we let
sss-bp-on-user-bp-2.exp run on native GNU/Linux
(https://sourceware.org/ml/gdb-patches/2014-06/msg00335.html):

 (gdb) PASS: gdb.base/sss-bp-on-user-bp-2.exp: define stepi_del_break
 stepi_del_break
 warning: Error removing breakpoint 3
 (gdb) FAIL: gdb.base/sss-bp-on-user-bp-2.exp: stepi_del_break

I say "restores" because this was GDB's behavior in 7.7 and earlier.

And, likewise, "file" with no arguments only started turning
breakpoints set in the main executable to "<pending>" with the
remote-symbol-file patch (63644780).  The old behavior is now
restored, and we break-unload-file.exp test now exercizes both "gdb;
file PROGRAM" and "gdb PROGRAM".

gdb/
2014-06-16  Pedro Alves  <palves@redhat.com>

* breakpoint.c (insert_bp_location, remove_breakpoint_1): Adjust.
(disable_breakpoints_in_freed_objfile): Skip objfiles that don't
have OBJF_SHARED set.
* objfiles.c (userloaded_objfile_contains_address_p): Rename to...
(shared_objfile_contains_address_p): ... this.  Check OBJF_SHARED
instead of OBJF_USERLOADED.
* objfiles.h (OBJF_SHARED): Update comment.
(userloaded_objfile_contains_address_p): Rename to ...
(shared_objfile_contains_address_p): ... this, and update
comments.
* symfile.c (add_symbol_file_command): Also set OBJF_SHARED in the
new objfile.
(remove_symbol_file_command): Skip objfiles that don't have
OBJF_SHARED set.

gdb/testsuite/
2014-06-16  Pedro Alves  <palves@redhat.com>

* gdb.base/break-main-file-remove-fail.c: New file.
* gdb.base/break-main-file-remove-fail.exp: New file.
* gdb.base/break-unload-file.exp: Use build_executable instead of
prepare_for_testing.
(test_break): New parameter "initial_load".  Handle it.
(top level): Add initial_load cmdline/file axis.

10 years agofix incorrect comments in minsyms.h
Tom Tromey [Mon, 16 Jun 2014 08:07:50 +0000 (02:07 -0600)]
fix incorrect comments in minsyms.h

minsyms.h incorrectly claims that a couple of functions call
prim_record_minimal_symbol_full with COPY_NAME=0 -- but actually they
pass 1.  Passing 1 is the correct behavior, so this patch fixes the
documentation.

I'm checking this in as obvious.

2014-06-16  Tom Tromey  <tromey@redhat.com>

* minsyms.h (prim_record_minimal_symbol)
(prim_record_minimal_symbol_and_info): Update comments.

10 years agoFix duplicated assignments to __rel_iplt and __rela_iplt symbols
Alan Modra [Mon, 16 Jun 2014 12:51:16 +0000 (22:21 +0930)]
Fix duplicated assignments to __rel_iplt and __rela_iplt symbols

and fix more nds32 dependencies.

* scripttempl/elf.sc: Edit out __rela_iplt symbol assignments from
.rel sections, and __rel_iplt from .rela sections.
* scripttempl/nds32elf.sc: Likewise.
* Makefile.am (ends32*.c): Depend on nds32elf.sc.
* Makefile.in: Regenerate.

10 years agoRun write_object_file after errors
Alan Modra [Mon, 16 Jun 2014 01:34:04 +0000 (11:04 +0930)]
Run write_object_file after errors

This is to fix unitialised memory access when printing listings.
Many targets don't initialise parts of insn frags or data frags that
have fixups, relying on md_apply_fix to finalise the frag.  Which is
fine normally, but means we need to run write_object_file after
errors, for listings.  Otherwise MALLOC_PERTURB_=1 causes errors like:
x86_64-linux  +FAIL: i386 mpx-inval-1
x86_64-linux  +FAIL: i386 inval-equ-1
x86_64-linux  +FAIL: i386 x86-64-mpx-inval-1

Running write_object_file after errors requires some tweaking to the
testsuite, since we then get extra errors reported from md_apply_fix.

gas/
* write.h (subsegs_finish): Delete declaration.
* write.c (subsegs_finish): Make static.
(write_object_file): Call subsegs_finish from here.  Don't print
warning and error count here..
* as.c (main): ..do so here instead.  Remove dead code for "no
object file generated".  Split out count strings to better support
internationalisation.  Don't call subsegs_finish. Tidy setting of
"keep_it".  Run write_object_file even after errors.
(keep_it): Make static.
* config/obj-elf.c (elf_frob_symbol): Remove assert.
(elf_frob_file_before_adjust): Likewise.
gas/testsuite/
* gas/elf/bad-group.s: Use %function.
* gas/elf/bad-group.err: Expect correct line number.  Allow
other errors.
* gas/elf/bad-size.err: Allow other errors.  Match expected
error somewhat more rigorously.
* gas/i386/reloc32.l: Allow other errors.
* gas/i386/mpx-inval-1.l: Match applied relocs.
* gas/i386/x86-64-mpx-inval-1.l: Likewise, and nop padding.
* gas/i386/x86-64-mpx-inval-2.l: Match nop padding, and allow
other errors.
* gas/macros/dot.s: Use .balign.
* gas/macros/dot.l: Update alignment output.
* gas/symver/symver6.l: Allow other errors.