binutils-gdb.git
9 years agoFix gdb.threads/thread-specific-bp.exp race
Pedro Alves [Wed, 4 Mar 2015 17:23:55 +0000 (17:23 +0000)]
Fix gdb.threads/thread-specific-bp.exp race

Gary stumbled on this:

 (gdb) PASS: gdb.threads/thread-specific-bp.exp: all-stop: continue to end
 info threads
   Id   Target Id         Frame
 * 1    Thread 0x7ffff7fdb700 (LWP 13717) "thread-specific" end () at /home/gary/work/archer/startswith/src/gdb/testsuite/gdb.threads/thread-specific-bp.c:29
 (gdb) FAIL: gdb.threads/thread-specific-bp.exp: all-stop: thread start is gone
 info breakpoint

The problem is that "...archer/startswith/src..." has a "start" in it,
which matches the too-lax regex in the test.

Rather than tweaking the regex, we can just remove the whole "info
threads", like we removed similar ones in other files -- GDB nowadays
does this implicitly already, so things should work without it.  Thus
removing this even improves testing here a bit.

gdb/testsuite/ChangeLog:
2015-03-04  Pedro Alves  <palves@redhat.com>

* gdb.threads/thread-specific-bp.exp: Delete "info threads" test.

9 years agofollow-fork: don't lose the ptids as set by the target
Pedro Alves [Wed, 4 Mar 2015 15:03:33 +0000 (15:03 +0000)]
follow-fork: don't lose the ptids as set by the target

This Linuxism has made its way into infrun.c, in the follow-fork code:

       inferior_ptid = ptid_build (child_pid, child_pid, 0);

The OS-specific code should fill in the LWPID, TID parts with the
appropriate values, if any, and the core code should not be peeking at
the components of the ptids.

gdb/
2015-03-04  Pedro Alves  <palves@redhat.com>

* infrun.c (follow_fork_inferior): Use the whole of the
inferior_ptid and pending_follow.related_pid ptids instead of
building ptids from the process components.  Adjust verbose output
to use target_pid_to_str.
* linux-nat.c (linux_child_follow_fork): Use the whole of the
inferior_ptid and pending_follow.related_pid ptids instead of
building ptids from the process components.

9 years agoStupid git!
Mark Kettenis [Wed, 4 Mar 2015 14:36:03 +0000 (15:36 +0100)]
Stupid git!

Apparently fixing a typo while you're editing the commit message doesn't work.

9 years agoAdd linux-aarch64-low.c in SFILE
Yao Qi [Tue, 3 Mar 2015 16:10:27 +0000 (16:10 +0000)]
Add linux-aarch64-low.c in SFILE

gdb/gdbserver:

2015-03-04  Yao Qi  <yao.qi@linaro.org>

* Makefile.in (SFILES): Add linux-aarch64-low.c.

9 years agoEnable gdb.base/foll-fork.exp on OpenBSD
Mark Kettenis [Wed, 4 Mar 2015 13:53:14 +0000 (14:53 +0100)]
Enable gdb.base/foll-fork.exp on OpenBSD

gdb/testsuite/
2015-03-04  Mark Kettenis  <kettenis@gnu.org>

        * gdb.base/foll-fork.exp: Enable on *-*-openbsd*.

9 years agoMake "catch fork" work on systems with PT_GET_PROCESS_STATE
Mark Kettenis [Wed, 4 Mar 2015 13:22:42 +0000 (14:22 +0100)]
Make "catch fork" work on systems with PT_GET_PROCESS_STATE

These systems (OpenBSD and HP-UX 10.x) already support follow-fork
including the events needed to for "catch fork".  This just makes
the upper layers realize this.

gdb/
2015-03-04  Mark Kettenis  <kettenis@gnu.org>

        * inf-ptrace.c [PT_GET_PROCESS_STATE]
        (inf_ptrace_insert_fork_catchpoint): New function.
        (inf_ptrace_remove_fork_catchpoint): New function.
        (inf_ptrace_target) [PT_GET_PROCESS_STATE]: Install them.

9 years ago[AArch64] Removing unused functions.
Marcus Shawcroft [Wed, 4 Mar 2015 12:21:02 +0000 (12:21 +0000)]
[AArch64] Removing unused functions.

Removing a group of unused functions from the AArch64 BFD backend.

9 years ago[AArch64] Call abort() consistently in unhandled stub switch statements.
Marcus Shawcroft [Mon, 2 Mar 2015 12:12:37 +0000 (12:12 +0000)]
[AArch64] Call abort() consistently in unhandled stub switch statements.

Ensure we hard stop via abort() for unhandled stub types rather than
continuing either silently (or noisly with a BFD_FAIL()).

Call abort() giving a hard stop rather than BFD_FAIL () for unhandled
stub types.

9 years agoS390: Name "invisible" registers with the empty string instead of NULL
Andreas Arnez [Wed, 4 Mar 2015 09:40:41 +0000 (10:40 +0100)]
S390: Name "invisible" registers with the empty string instead of NULL

When adding vector register support to GDB, s390_register_name() was
added to suppress the right halves of the first 16 vector registers.
However, that function returned NULL instead of an empty string in such
a case.  This leads to an incomplete list of registers returned by
"complete info registers ", because completion stops at the first NULL
return value from user_reg_map_regnum_to_name().

gdb/ChangeLog:

* s390-linux-tdep.c (s390_register_name): Return empty string
instead of NULL for registers that shouldn't be visible.

9 years agobreakpoint-in-ro-region.exp: Support targets stopping in mid-line after "si"
Andreas Arnez [Wed, 4 Mar 2015 09:40:40 +0000 (10:40 +0100)]
breakpoint-in-ro-region.exp: Support targets stopping in mid-line after "si"

On some targets each of the assignments "i = 0" in the C source for
"breakpoint-in-ro-region.exp" are compiled to a single instruction.
Then each "si" stops at the beginning of the next source line.  But on
some other targets (like s390) such an assignment compiles to multiple
instructions.  Then "si" may stop in mid-line, and GDB displays the PC
address in addition to the source line number.  This was not considered
by the regexp for this case.

gdb/testsuite/ChangeLog:

* gdb.base/breakpoint-in-ro-region.exp (test_single_step): In the
regexps for GDB's current line display, accept a hex address
preceding the line number.

9 years agocatch-syscall.exp: Fix missing architecture name for s390:31-bit
Andreas Arnez [Wed, 4 Mar 2015 09:40:40 +0000 (10:40 +0100)]
catch-syscall.exp: Fix missing architecture name for s390:31-bit

For the "multiple targets" test in catch-syscall.exp, set the 'arch1'
variable to a valid string.

gdb/testsuite/ChangeLog:

* gdb.base/catch-syscall.exp (test_catch_syscall_multi_arch): Set
the 'arch1' variable for "s390*-linux*" targets.

9 years agoS390: Fix syscall list for s390x
Andreas Arnez [Wed, 4 Mar 2015 09:40:40 +0000 (10:40 +0100)]
S390: Fix syscall list for s390x

This patch fixes a typo that caused the wrong syscall XML file to be
used for s390x targets.

gdb/ChangeLog:

* s390-linux-tdep.c (s390_gdbarch_init): Use the correct syscall
XML file for 64-bit targets.

9 years agoS390: Place "s390:31-bit" after default arch in 64-bit arch list
Andreas Arnez [Wed, 4 Mar 2015 09:40:39 +0000 (10:40 +0100)]
S390: Place "s390:31-bit" after default arch in 64-bit arch list

On 64-bit platforms GDB did not include "s390:31-bit" in its list of
architecture names.  This patch fixes that.

To determine the list of architecture names for S390,
gdbarch_printable_names() walks through the linked list of BFD arches
starting with the default S390 arch, which is "s390:64-bit" on 64-bit
platforms.  But since "s390:64-bit" was at the end of that list, the
31-bit architecture was not reached.  The patch swaps the elements of
that list on 64-bit platforms.

bfd/ChangeLog:

* cpu-s390.c (N): New macro.
(bfd_s390_31_arch): New.  Define only if default target word size
is 64 bits.  Otherwise define...
(bfd_390_64_arch): ...this.  Make static.
(bfd_s390_arch): Define according to the default target word size.
Let the 'next' field point to the alternate arch.

9 years agogdb.threads/clone-thread_db.c: Add missing includes and fix pthread_join call
Pedro Alves [Wed, 4 Mar 2015 09:13:49 +0000 (09:13 +0000)]
gdb.threads/clone-thread_db.c: Add missing includes and fix pthread_join call

This fixes:

> gdb compile failed, /gdb/testsuite/gdb.threads/clone-thread_db.c: In function 'main':
> /gdb/testsuite/gdb.threads/clone-thread_db.c:67:3: warning: implicit declaration of function 'alarm' [-Wimplicit-function-declaration]
>    alarm (300);
>    ^
> /gdb/testsuite/gdb.threads/clone-thread_db.c:69:3: warning: implicit declaration of function 'pthread_create' [-Wimplicit-function-declaration]
>    pthread_create (&child, NULL, thread_fn, NULL);
>    ^
> /gdb/testsuite/gdb.threads/clone-thread_db.c:70:3: warning: implicit declaration of function 'pthread_join' [-Wimplicit-function-declaration]
>    pthread_join (child);
>    ^

And then adding the missing headers revealed the pthread_join call was
incorrect.  This probably fixes the crash we see on ppc64be, e.g., at

 https://sourceware.org/ml/gdb-testers/2015-q1/msg04415.html

the logs there show:

 ...
 Program received signal SIGSEGV, Segmentation fault.
 [Switching to Thread 0x3fffb7ff54a0 (LWP 9275)]
 0x00003fffb7f3ce74 in .pthread_join () from /lib64/libpthread.so.0
 (gdb) FAIL: gdb.threads/clone-thread_db.exp: continue to end
 ...

Tested on x86_64 Fedora 20.

gdb/testsuite/
2015-03-04  Pedro Alves  <palves@redhat.com>

* gdb.threads/clone-thread_db.c: Include unistd.h and pthread.h.
(main): Pass missing retval argument to pthread_join call.

9 years agoAllow MOVK for R_AARCH64_TLSLE_MOVW_TPREL_G{0,1}NC
Richard Sandiford [Wed, 4 Mar 2015 09:08:49 +0000 (09:08 +0000)]
Allow MOVK for R_AARCH64_TLSLE_MOVW_TPREL_G{0,1}NC

bfd/
PR gas/17843
* elfxx-aarch64.c (_bfd_aarch64_elf_put_addend): Expect
R_AARCH64_TLSLE_MOVW_TPREL_G0_NC and R_AARCH64_TLSLE_MOVW_TPREL_G1_NC
to be used with MOVK rather than MOVZ.

gas/
PR gas/17843
* config/tc-aarch64.c (process_movw_reloc_info): Allow
R_AARCH64_TLSLE_MOVW_TPREL_G0_NC and R_AARCH64_TLSLE_MOVW_TPREL_G1_NC
for MOVK.

gas/testsuite/
PR gas/17843
* gas/aarch64/tls.s, gas/aarch64/tls.d: Add test for
R_AARCH64_TLSLE_MOVW_TPREL_G0/R_AARCH64_TLSLE_MOVW_TPREL_G1_NC
sequence.

ld/testsuite/
PR gas/17843
* ld-aarch64/tlsle.s, ld-aarch64/tlsle.d: New test.
* ld-aarch64/aarch64-elf.exp: Run it.

9 years agoAutomatic date update in version.in
GDB Administrator [Wed, 4 Mar 2015 00:00:08 +0000 (00:00 +0000)]
Automatic date update in version.in

9 years agoRL78 - fix ADDR16 relax
DJ Delorie [Tue, 3 Mar 2015 22:49:44 +0000 (17:49 -0500)]
RL78 - fix ADDR16 relax

* elf32-rl78.c (rl78_elf_relax_section): Only relax ADDR16's if
there's a symbol.

9 years agoRemove unused function declarations in target.h
Simon Marchi [Tue, 3 Mar 2015 17:45:11 +0000 (12:45 -0500)]
Remove unused function declarations in target.h

find_default_create_inferior and find_default_attach were removed in b3ccfe11.

gdb/ChangeLog:

* target.h (find_default_create_inferior): Remove declaration.
(find_default_attach): Likewise.

9 years agoinf-ptrace.c: use ptid_get_pid when resuming all threads
Pedro Alves [Tue, 3 Mar 2015 16:28:15 +0000 (16:28 +0000)]
inf-ptrace.c: use ptid_get_pid when resuming all threads

In this case, we want to resume the entire process and not an
individual thread.

gdb/
2015-03-03  Pedro Alves  <palves@redhat.com>

* inf-ptrace.c (inf_ptrace_resume): Remove spurious whitespace.
Use ptid_get_pid to get the overall process id when resuming all
threads.

9 years agoFix GDB/MI doc: duplicate syscall-entry under *stopped
Philippe Proulx [Tue, 3 Mar 2015 04:15:54 +0000 (23:15 -0500)]
Fix GDB/MI doc: duplicate syscall-entry under *stopped

gdb/doc/ChangeLog:

2015-03-03  Philippe Proulx  eeppeliteloop@gmail.com

* gdb.texinfo (gdb/mi Async Records): Fix duplicate syscall-entry
under *stopped.

9 years ago[ARM] Skip private symbol when doing objdump
Jiong Wang [Tue, 3 Mar 2015 15:00:59 +0000 (15:00 +0000)]
[ARM] Skip private symbol when doing objdump

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

  opcode/
    * arm-dis.c (arm_symbol_is_valid): Skip ARM private symbols.

  binutils/testsuite/
    * binutils-all/arm/rvct_symbol.s: New testcase.
    * binutils-all/arm/objdump.exp: Run it.

9 years agoLinux/ptrace: don't convert ptids when asking inf-ptrace layer to resume LWP
Pedro Alves [Tue, 3 Mar 2015 13:33:44 +0000 (13:33 +0000)]
Linux/ptrace: don't convert ptids when asking inf-ptrace layer to resume LWP

Ref: https://sourceware.org/ml/gdb-patches/2015-03/msg00060.html

The record-btrace target can hit an assertion here:

 Breakpoint 1, record_btrace_fetch_registers (ops=0x974bfc0 <record_btrace_ops>,
     regcache=0x9a0a798, regno=8) at gdb/record-btrace.c:1202
 1202   gdb_assert (tp != NULL);

 (gdb) p regcache->ptid
 $3 = {pid = 23856, lwp = 0, tid = 0}

The problem is that the linux-nat layer converts the ptid to a
single-process ptid before passing the request down to the inf-ptrace
layer, which loses information, and then record-btrace can't find the
corresponding thread in GDB's thread list:

 (gdb) bt
 #0  record_btrace_fetch_registers (ops=0x974bfc0 <record_btrace_ops>, regcache=0x9a0a798, regno=8)
     at gdb/record-btrace.c:1202
 #1  0x083f4ee2 in delegate_fetch_registers (self=0x974bfc0 <record_btrace_ops>, arg1=0x9a0a798,
     arg2=8) at gdb/target-delegates.c:149
 #2  0x08406562 in target_fetch_registers (regcache=0x9a0a798, regno=8)
     at gdb/target.c:3279
 #3  0x08355255 in regcache_raw_read (regcache=0x9a0a798, regnum=8,
     buf=0xbfffe6c0 "¨\003\222\tÀ8kIøæÿ¿HO5\b\035]")
     at gdb/regcache.c:643
 #4  0x083558a7 in regcache_cooked_read (regcache=0x9a0a798, regnum=8,
     buf=0xbfffe6c0 "¨\003\222\tÀ8kIøæÿ¿HO5\b\035]")
     at gdb/regcache.c:734
 #5  0x08355de3 in regcache_cooked_read_unsigned (regcache=0x9a0a798, regnum=8, val=0xbfffe738)
     at gdb/regcache.c:838
 #6  0x0827a106 in i386_linux_resume (ops=0x9737ca0 <linux_ops_saved>, ptid=..., step=1,
     signal=GDB_SIGNAL_0) at gdb/i386-linux-nat.c:670
 #7  0x08280c12 in linux_resume_one_lwp (lp=0x9a0a5b8, step=1, signo=GDB_SIGNAL_0)
     at gdb/linux-nat.c:1529
 #8  0x08281281 in linux_nat_resume (ops=0x98da608, ptid=..., step=1, signo=GDB_SIGNAL_0)
     at gdb/linux-nat.c:1708
 #9  0x0850738e in record_btrace_resume (ops=0x98da608, ptid=..., step=1, signal=GDB_SIGNAL_0)
     at gdb/record-btrace.c:1760
 ...

The fix is just to not lose information, and let the intact ptid reach
record-btrace.c.

Tested on x86-64 Fedora 20, -m32.

gdb/ChangeLog:
2015-03-03  Pedro Alves  <palves@redhat.com>

* i386-linux-nat.c (i386_linux_resume): Get the ptrace PID out of
the lwp field of ptid.  Pass the full ptid to get_thread_regcache.
* inf-ptrace.c (get_ptrace_pid): New function.
(inf_ptrace_resume): Use it.
* linux-nat.c (linux_resume_one_lwp): Pass the LWP's ptid ummodified
to the lower layer.

9 years agoFix incorrect vFile: prefix lengths
Gary Benson [Tue, 3 Mar 2015 12:34:40 +0000 (12:34 +0000)]
Fix incorrect vFile: prefix lengths

gdb/gdbserver/ChangeLog:

* hostio.c (handle_vFile): Fix prefix lengths.

9 years agobtrace: support 32-bit inferior on 64-bit host
Markus Metzger [Thu, 29 Jan 2015 09:43:05 +0000 (10:43 +0100)]
btrace: support 32-bit inferior on 64-bit host

The heuristic for filtering out kernel addressess in BTS trace checks the
most significant bit in each address.  This works fine for 32-bit and 64-bit
mode.

For 32-bit compatibility mode, i.e. a 32-bit inferior running on 64-bit
host, we need to check bit 63 (or any bit bigger than 31), not bit 31.

Use the machine field in struct utsname provided by a uname call to
determine whether we are running on a 64-bit host.

Thanks to Jan Kratochvil for reporting the issue.

gdb/
* nat/linux-btrace.c: Include sys/utsname.h.
(linux_determine_kernel_ptr_bits): New.
(linux_enable_bts): Call linux_determine_kernel_ptr_bits.
* x86-linux-nat.c (x86_linux_enable_btrace): Do not overwrite non-zero
ptr_bits.

gdbserver/
* linux-low.c (linux_low_enable_btrace): Do not overwrite non-zero
ptr_bits.

9 years agobtrace: work around _dl_runtime_resolve returning to resolved function
Markus Metzger [Fri, 23 Jan 2015 12:32:12 +0000 (13:32 +0100)]
btrace: work around _dl_runtime_resolve returning to resolved function

On some systems, _dl_runtime_resolve returns to the resolved function
instead of jumping to it.  Since btrace will not find the function in
the current stack back trace, it will start a new back trace on the
same level.  It will look the same to the user via the backtrace
command but the frames will have different id's which confuses stepping.

This fixes a test fail with 32-bit inferior reported by Jan Kratochvil.

gdb/
* btrace.c (ftrace_update_function): Treat return as tailcall for
"_dl_runtime_resolve".

9 years agobtrace: compute line range when printing
Markus Metzger [Tue, 24 Jun 2014 12:25:50 +0000 (14:25 +0200)]
btrace: compute line range when printing

The "record function-call-history" command prints the range of source lines
for a function segment when given the /l modifier.  This information is
computed for the entire execution history when processing the recorded branch
trace.

To speed up the initial trace processing, we compute the information when
we print a function segment and only if requested.  The computation is fast
enough (due to the limited scope) that it is not worth storing the data in
struct btrace_function, anymore.

gdb/
* btrace.h (btrace_function) <lbegin, lend>: Remove.
* btrace.c (ftrace_debug): Do not print the line range.
(ftrace_skip_file, ftrace_update_lines): Remove.
(ftrace_new_function): Remove lbegin and lend initialization.
(btrace_compute_ftrace_bts): Remove call to ftrace_update_lines.
* record-btrace.c (btrace_compute_src_line_range): New.
(btrace_call_history_src_line): Call btrace_compute_src_line_range.

9 years agofollow-exec: delete all non-execing threads
Pedro Alves [Tue, 3 Mar 2015 01:25:17 +0000 (01:25 +0000)]
follow-exec: delete all non-execing threads

This fixes invalid reads Valgrind first caught when debugging against
a GDBserver patched with a series that adds exec events to the remote
protocol.  Like these, using the gdb.threads/thread-execl.exp test:

$ valgrind ./gdb -data-directory=data-directory ./testsuite/gdb.threads/thread-execl  -ex "tar extended-remote :9999" -ex "b thread_execler" -ex "c" -ex "set scheduler-locking on"
...
Breakpoint 1, thread_execler (arg=0x0) at src/gdb/testsuite/gdb.threads/thread-execl.c:29
29        if (execl (image, image, NULL) == -1)
(gdb) n
Thread 32509.32509 is executing new program: build/gdb/testsuite/gdb.threads/thread-execl
[New Thread 32509.32532]
==32510== Invalid read of size 4
==32510==    at 0x5AA7D8: delete_breakpoint (breakpoint.c:13989)
==32510==    by 0x6285D3: delete_thread_breakpoint (thread.c:100)
==32510==    by 0x628603: delete_step_resume_breakpoint (thread.c:109)
==32510==    by 0x61622B: delete_thread_infrun_breakpoints (infrun.c:2928)
==32510==    by 0x6162EF: for_each_just_stopped_thread (infrun.c:2958)
==32510==    by 0x616311: delete_just_stopped_threads_infrun_breakpoints (infrun.c:2969)
==32510==    by 0x616C96: fetch_inferior_event (infrun.c:3267)
==32510==    by 0x63A2DE: inferior_event_handler (inf-loop.c:57)
==32510==    by 0x4E0E56: remote_async_serial_handler (remote.c:11877)
==32510==    by 0x4AF620: run_async_handler_and_reschedule (ser-base.c:137)
==32510==    by 0x4AF6F0: fd_event (ser-base.c:182)
==32510==    by 0x63806D: handle_file_event (event-loop.c:762)
==32510==  Address 0xcf333e0 is 16 bytes inside a block of size 200 free'd
==32510==    at 0x4A07577: free (in /usr/lib64/valgrind/vgpreload_memcheck-amd64-linux.so)
==32510==    by 0x77CB74: xfree (common-utils.c:98)
==32510==    by 0x5AA954: delete_breakpoint (breakpoint.c:14056)
==32510==    by 0x5988BD: update_breakpoints_after_exec (breakpoint.c:3765)
==32510==    by 0x61360F: follow_exec (infrun.c:1091)
==32510==    by 0x6186FA: handle_inferior_event (infrun.c:4061)
==32510==    by 0x616C55: fetch_inferior_event (infrun.c:3261)
==32510==    by 0x63A2DE: inferior_event_handler (inf-loop.c:57)
==32510==    by 0x4E0E56: remote_async_serial_handler (remote.c:11877)
==32510==    by 0x4AF620: run_async_handler_and_reschedule (ser-base.c:137)
==32510==    by 0x4AF6F0: fd_event (ser-base.c:182)
==32510==    by 0x63806D: handle_file_event (event-loop.c:762)
==32510==
[Switching to Thread 32509.32532]

Breakpoint 1, thread_execler (arg=0x0) at src/gdb/testsuite/gdb.threads/thread-execl.c:29
29        if (execl (image, image, NULL) == -1)
(gdb)

The breakpoint in question is the step-resume breakpoint of the
non-main thread, the one that was "next"ed.

The exact same issue can be seen on mainline with native debugging, by
running the thread-execl.exp test in non-stop mode, because the kernel
doesn't report a thread exit event for the execing thread.

Tested on x86_64 Fedora 20.

gdb/ChangeLog:
2015-03-02  Pedro Alves  <palves@redhat.com>

* infrun.c (follow_exec): Delete all threads of the process except
the event thread.  Extended comments.

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

* gdb.threads/thread-execl.exp (do_test): Handle non-stop.
(top level): Call do_test with non-stop as well.

9 years agoAutomatic date update in version.in
GDB Administrator [Tue, 3 Mar 2015 00:00:07 +0000 (00:00 +0000)]
Automatic date update in version.in

9 years agogdb_test_multiple: return -1 on internal error
Pedro Alves [Mon, 2 Mar 2015 20:05:25 +0000 (20:05 +0000)]
gdb_test_multiple: return -1 on internal error

gdb_test_multiple is supposed to return -1 on internal error:

  # Returns:
  #    1 if the test failed, according to a built-in failure pattern
  #    0 if only user-supplied patterns matched
  #   -1 if there was an internal error.

But alas, that's broken, it returns success...  It looks like the code
is assuming an earlier 'set result -1' is still in effect, but
'result' is set to 0 at the end, just before we call gdb_expect:

    set result 0
    set code [catch {gdb_expect $code} string]

gdb/testsuite/
2015-03-02  Pedro Alves  <palves@redhat.com>

* lib/gdb.exp (gdb_test_multiple) <internal error>: Set result to
-1.

9 years agoFix crash when processing merge section with entsize of 0.
Cary Coutant [Mon, 2 Mar 2015 18:20:21 +0000 (10:20 -0800)]
Fix crash when processing merge section with entsize of 0.

2015-02-04  Peter Collingbourne  <pcc@google.com>
            Cary Coutant  <ccoutant@google.com>

gold/
* output.cc (Output_section::add_merge_input_section): Do not
attempt to merge sections with an entsize of 0.

9 years agoFix an internal error in do_print_to_mapfile on Arm.
Cary Coutant [Mon, 2 Mar 2015 18:10:52 +0000 (10:10 -0800)]
Fix an internal error in do_print_to_mapfile on Arm.

2015-02-02  Khem Raj  <raj.khem@gmail.com>

gold/
* attributes.h (class Output_attributes_section_data ): Add
do_print_to_mapfile function.

9 years agogdb.texinfo (Specify Location): Fix syntax of filename:function.
Doug Evans [Mon, 2 Mar 2015 16:33:10 +0000 (08:33 -0800)]
gdb.texinfo (Specify Location): Fix syntax of filename:function.

gdb/doc/ChangeLog:

* gdb.texinfo (Specify Location): Fix syntax of filename:function.

9 years agoRevert "Remove true and false ARI checks now that we use stdbool.h."
Joel Brobecker [Mon, 2 Mar 2015 14:05:01 +0000 (06:05 -0800)]
Revert "Remove true and false ARI checks now that we use stdbool.h."

As we cannot use type bool until conversion to C++ is official,
this patch re-instates the ARI checks for "true/false".

gdb/ChangeLog:

        * contrib/ari/gdb_ari.sh: Reinstate checks for "true" and "false".

9 years agoRemove use of stdbool.h in GDB sources.
Joel Brobecker [Mon, 2 Mar 2015 14:01:23 +0000 (06:01 -0800)]
Remove use of stdbool.h in GDB sources.

Using type bool from stdbool unfortunately causes problems trying
to build GDB on AiX and Solaris:

    In file included from ../../src/gdb/utils.h:24:0,
                     from ../../src/gdb/defs.h:707,
                     from ../../src/gdb/utils.c:20:
    /[...]/curses.h:96:14: error: two or more data types in declaration
    specifiers
     typedef char bool;
                  ^
    make[2]: *** [utils.o] Error 1

In theory, the problem is in curses.h which, in both cases, do
something similar. On Solaris:

    #if !defined(__cplusplus) && !defined(_BOOL)
    typedef char bool;
    #endif /* !defined(__cplusplus) && !defined(_BOOL) */

On AiX:

    #if !defined(__cplusplus) || (defined(__IBMCPP__) &&(__IBMCPP__<400))
    #ifndef _BOOL
    #define _BOOL
    typedef int bool;
    #endif
    #endif

You can reproduce the same problem by trying to compile:

    % cat toto.c
    #include <stdbool.h>
    #include <curses.h>
    % gcc -c toto.c
    In file included from toto.c:1:0:
    /[...]/curses.h:159:13: error: two or more data types in declaration
    specifiers
     typedef int bool;
             ^

This specific issue wouldn't occur if we included curses.h before
including stdbool.h, and I looked at that just to be complete.
Here is a small schematic representation of the include logic:

  * utils.c:
      -> defs.h -> utils.h -> stdbool.h
      -> gdb_curses.h -> curses.h

Because defs.h should always be first on the list, it means that
stdbool.h will always necessarily be included ahead of curses.h.

But, thinking beyond this very specific issue, it shows that using
stdbool.h is going to cause problems on these systems until either
GCC fixes those includes in a way that makes them work; or we switch
to C++.

In the meantime, I think the path of least resistance is to revert
the use of stdbool.h, and use integers, the way we've done up until
now. The benefits of using type "bool" are modest, IMO, so not
a great loss, and a temporary one.

gdb/ChangeLog:

        * utils.h: Remove <stdbool.h> #include.
        (producer_is_gcc): Change return type to "int".
        * utils.c (producer_is_gcc): Change return type to int.
        Return 1 instead of true, and 0 instead of false.
        Adjust function documentation accordingly.

9 years agoS390: Vector register test case
Andreas Arnez [Mon, 2 Mar 2015 09:57:40 +0000 (10:57 +0100)]
S390: Vector register test case

Add a test case for S/390 vector registers support.

gdb/testsuite/ChangeLog:

* gdb.arch/s390-vregs.exp: New test.
* gdb.arch/s390-vregs.S: New file.

9 years agoS390: Add vector register support to gdbserver
Andreas Arnez [Mon, 2 Mar 2015 09:57:40 +0000 (10:57 +0100)]
S390: Add vector register support to gdbserver

On S/390 targets with vector registers, enable gdbserver to advertise
and handle the feature "org.gnu.gdb.s390.vx".

gdb/gdbserver/ChangeLog:

* Makefile.in (s390-vx-linux64.c, s390-tevx-linux64.c)
(s390x-vx-linux64.c, s390x-tevx-linux64.c): New rules.
(clean): Add "rm -f" for above C files.
* configure.srv (srv_regobj): Add s390-vx-linux64.o,
s390-tevx-linux64.o, s390x-vx-linux64.o, and s390x-tevx-linux64.o.
(srv_xmlfiles): Add s390-vx-linux64.xml, s390-tevx-linux64.xml,
s390x-vx-linux64.xml, s390x-tevx-linux64.xml, and s390-vx.xml.
* linux-s390-low.c (HWCAP_S390_VX): New macro.
(init_registers_s390_vx_linux64, init_registers_s390_tevx_linux64)
(init_registers_s390x_vx_linux64)
(init_registers_s390x_tevx_linux64)
(tdesc_s390_vx_linux64, tdesc_s390_tevx_linux64)
(tdesc_s390x_vx_linux64, tdesc_s390x_tevx_linux64): New extern
declarations.
(s390_fill_vxrs_low, s390_store_vxrs_low, s390_fill_vxrs_high)
(s390_store_vxrs_high): New functions.
(s390_regsets): Add entries for NT_S390_VXRS_LOW and
NT_S390_VXRS_HIGH.
(s390_arch_setup): Add logic for selecting one of the new target
descriptions.  Activate the new vector regsets if applicable.
(initialize_low_arch): Also invoke init_registers_s390_vx_linux64,
init_registers_s390_tevx_linux64, init_registers_s390x_vx_linux64,
and init_registers_s390x_tevx_linux64.

9 years agoS390: Add vector register support to gdb
Andreas Arnez [Mon, 2 Mar 2015 09:57:39 +0000 (10:57 +0100)]
S390: Add vector register support to gdb

Recognize S/390 targets with the new vector feature and present their
vector registers appropriately: as 32 new 128-bit wide registers
v0-v31, where the first 16 embed the floating point registers f0-f15.
Each of the full registers v0-v15 is modelled as a pseudo register.

gdb/ChangeLog:

* s390-linux-nat.c (have_regset_vxrs): New static variable.
(s390_linux_fetch_inferior_registers): Handle vector registers, if
present.
(s390_linux_store_inferior_registers): Likewise.
(s390_get_hwcap): Remove function.  Embed its logic...
(s390_read_description): ...here.  Yield a target description with
vector registers if applicable.
* s390-linux-tdep.c: Include "features/s390-vx-linux64.c",
"features/s390-tevx-linux64.c", "features/s390x-vx-linux64.c", and
"features/s390x-tevx-linux64.c".
(struct gdbarch_tdep) <v0_full_regnum>: New field.
(s390_dwarf_regmap): Add vector registers.  Remove bogus entries
for "GNU/Linux-specific registers".
(s390_dwarf_reg_r0l): New enum value.
(s390_dwarf_reg_to_regnum): Support vector registers.
(s390_adjust_frame_regnum): Adjust pseudo DWARF register numbers
of GPR lower halves.
(regnum_is_vxr_full): New function.
(s390_register_name): New function.
(s390_pseudo_register_name): Handle v0-v15, which are composed of
f0-f15 and v0l-v15l.
(s390_pseudo_register_type): Likewise.
(s390_pseudo_register_read): Likewise.
(s390_pseudo_register_write): Likewise.
(s390_value_from_register): Account for the fact that values are
placed left-justified in vector registers.
(s390_pseudo_register_reggroup_p): Add pseudo registers v0-v15 to
the vector reggroup and omit them from the general reggroup.
(s390_regmap_vxrs_low, s390_regmap_vxrs_high): New register maps.
(s390_vxrs_low_regset, s390_vxrs_high_regset): New regsets.
(s390_iterate_over_regset_sections): Add iterations for the two
new vector regsets.
(s390_core_read_description): Yield a target description with
vector registers if applicable.
(s390_gdbarch_init): Handle target descriptions with vector
registers.  Add "register_name" gdbarch method.
(_initialize_s390_tdep): Call new tdesc initialization functions.
* s390-linux-tdep.h (HWCAP_S390_VX): New macro.
(S390_V0_LOWER_REGNUM, S390_V1_LOWER_REGNUM, S390_V2_LOWER_REGNUM)
(S390_V3_LOWER_REGNUM, S390_V4_LOWER_REGNUM, S390_V5_LOWER_REGNUM)
(S390_V6_LOWER_REGNUM, S390_V7_LOWER_REGNUM, S390_V8_LOWER_REGNUM)
(S390_V9_LOWER_REGNUM, S390_V10_LOWER_REGNUM)
(S390_V11_LOWER_REGNUM, S390_V12_LOWER_REGNUM)
(S390_V13_LOWER_REGNUM, S390_V14_LOWER_REGNUM)
(S390_V15_LOWER_REGNUM, S390_V16_REGNUM, S390_V17_REGNUM)
(S390_V18_REGNUM, S390_V19_REGNUM, S390_V20_REGNUM)
(S390_V21_REGNUM, S390_V22_REGNUM, S390_V23_REGNUM)
(S390_V24_REGNUM, S390_V25_REGNUM, S390_V26_REGNUM)
(S390_V27_REGNUM, S390_V28_REGNUM, S390_V29_REGNUM)
(S390_V30_REGNUM, S390_V31_REGNUM): New macros.
(S390_NUM_REGS): Adjust value.
(s390_vxrs_low_regset, s390_vxrs_high_regset): Declare.
(tdesc_s390_vx_linux64, tdesc_s390_tevx_linux64)
(tdesc_s390x_vx_linux64, tdesc_s390x_tevx_linux64): Likewise.
* NEWS: Announce S/390 vector register support.

9 years agoS390: Add target descriptions for vector register sets
Andreas Arnez [Mon, 2 Mar 2015 09:57:39 +0000 (10:57 +0100)]
S390: Add target descriptions for vector register sets

The IBM z13 has new vector registers v0-v31 which are presented by the
Linux kernel as two additional register sets.  This patch adds XML
descriptions and the respective autogenerated .c and .dat files for
S390 targets with this feature.  Note that supported combinations
include targets with and without a transactional execution facility.

gdb/ChangeLog:

* features/s390-tevx-linux64.xml: New file.
* features/s390-vx-linux64.xml: New file.
* features/s390-vx.xml: New file.
* features/s390x-tevx-linux64.xml: New file.
* features/s390x-vx-linux64.xml: New file.
* features/Makefile (WHICH): Add s390-vx-linux64,
s390x-vx-linux64, s390-tevx-linux64, and s390x-tevx-linux64.
(s390-vx-linux64-expedite, s390-tevx-linux64-expedite)
(s390x-vx-linux64-expedite, s390x-tevx-linux64-expedite): New
macros.
* features/s390-tevx-linux64.c: New generated file.
* features/s390-vx-linux64.c: Likewise.
* features/s390x-tevx-linux64.c: Likewise.
* features/s390x-vx-linux64.c: Likewise.
* regformats/s390-tevx-linux64.dat: Likewise.
* regformats/s390-vx-linux64.dat: Likewise.
* regformats/s390x-tevx-linux64.dat: Likewise.
* regformats/s390x-vx-linux64.dat: Likewise.

gdb/doc/ChangeLog:

* gdb.texinfo (S/390 and System z Features): Describe new feature
"org.gnu.gdb.s390.vx".

9 years agoCorrect -z nocopyreloc doc
Alan Modra [Mon, 2 Mar 2015 06:23:07 +0000 (16:53 +1030)]
Correct -z nocopyreloc doc

This option is misnamed.  It should probably be called -z nodynbss,
but it's too late to change now.

* ld.texinfo (Options <-z nocopyreloc>): Rewrite.

9 years agoAutomatic date update in version.in
GDB Administrator [Mon, 2 Mar 2015 00:00:07 +0000 (00:00 +0000)]
Automatic date update in version.in

9 years agoFix 32-bit x86 in-process agent build
Pedro Alves [Sun, 1 Mar 2015 14:55:29 +0000 (14:55 +0000)]
Fix 32-bit x86 in-process agent build

Git commit 3c14e5a39bb4fddd added a declaration for
gdb_agent_get_raw_reg to tracepoint.h, and this now caught that the
32-bit x86 implementation has the wrong prototype:

 ../../../src/gdb/gdbserver/linux-i386-ipa.c:103:1: error: conflicting types for ‘gdb_agent_get_raw_reg’
  gdb_agent_get_raw_reg (unsigned char *raw_regs, int regnum)
  ^
 In file included from ../../../src/gdb/gdbserver/linux-i386-ipa.c:24:0:
 ../../../src/gdb/gdbserver/tracepoint.h:168:31: note: previous declaration of ‘gdb_agent_get_raw_reg’ was here
  IP_AGENT_EXPORT_FUNC ULONGEST gdb_agent_get_raw_reg
^
 make[2]: *** [linux-i386-ipa.o] Error 1

gdb/gdbserver/
2015-03-01  Pedro Alves  <palves@redhat.com>

* linux-i386-ipa.c (gdb_agent_get_raw_reg): Constify 'raw_regs'
parameter.

9 years agoAutomatic date update in version.in
GDB Administrator [Sun, 1 Mar 2015 00:00:07 +0000 (00:00 +0000)]
Automatic date update in version.in

9 years agoobjcopy: Add --update-section option.
Andrew Burgess [Fri, 13 Feb 2015 17:04:42 +0000 (17:04 +0000)]
objcopy: Add --update-section option.

New option for objcopy --update-section allows the contents of a section
to be updated while maintaining the section flags, and, for ELF files,
the section to segment mapping.

New test uses --dump-section and --update-section to check that a
section can be made larger and smaller with an update.

binutils/ChangeLog:

* objcopy.c (update_sections): New list.
(command_line_switch): Add OPTION_UPDATE_SECTION.
(copy_options): Add update-section.
(copy_usage): Document new option.
(is_update_section): New function.
(is_strip_section_1): Add check for attempt to update and remove
the same section.
(copy_object): Update size and content of requested sections.
(skip_section): Don't copy for updated sections.
(copy_main): Handle --update-section.
* doc/binutils.texi (objcopy): Add description of --update-section
option.
* NEWS: Mention --update-section option.

binutils/testsuite/ChangeLog:

* binutils-all/update-1.s: New file.
* binutils-all/update-2.s: New file.
* binutils-all/update-3.s: New file.
* binutils-all/update-4.s: New file.
* binutils-all/update-section.exp: New file.

9 years agosymtab.h (struct symtab) <next>: Fix comment.
Doug Evans [Sat, 28 Feb 2015 20:05:27 +0000 (12:05 -0800)]
symtab.h (struct symtab) <next>: Fix comment.

gdb/ChangeLog:

* symtab.h (struct symtab) <next>: Fix comment.

9 years agoPad only text sections at end by default
Alan Modra [Tue, 24 Feb 2015 23:06:36 +0000 (09:36 +1030)]
Pad only text sections at end by default

gas/
* write.c (SUB_SEGMENT_ALIGN): Don't pad non-code sections at
end to their alignment.
gas/testsuite/
* gas/sparc/pcrel.d: Update for changed padding in data sections.
* gas/sparc/pcrel64.d: Likewise.
ld/testsuite/
* ld-sparc/gotop32.rd: Update for changed padding in data sections.
* ld-sparc/gotop32.td: Likewise.
* ld-sparc/gotop64.rd: Likewise.
* ld-sparc/gotop64.td: Likewise.
* ld-tilegx/external.s: Align .data.
* ld-tilepro/external.s: Likewise.

9 years agoTweak ppc32 tls_get_addr optimisation
Alan Modra [Fri, 27 Feb 2015 01:13:21 +0000 (11:43 +1030)]
Tweak ppc32 tls_get_addr optimisation

This patch is cosmetic.  It prevents references to __tls_get_addr_opt
(an alias for __tls_get_addr) when the optimisation isn't possible.

* elf32-ppc.c (ppc_elf_tls_setup): Set no_tls_get_addr_opt if
not PLT_NEW.

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

9 years agoFix Python 3 build: rename GdbMethods
Simon Marchi [Fri, 27 Feb 2015 22:40:36 +0000 (17:40 -0500)]
Fix Python 3 build: rename GdbMethods

Rename forgotten GdbMethods to python_GdbMethods.

gdb/ChangeLog:

* python/python.c (python_GdbModuleDef): Rename GdbMethods to
python_GdbMethods.

9 years agoConvert mov to lea only if needed
H.J. Lu [Fri, 27 Feb 2015 19:27:31 +0000 (11:27 -0800)]
Convert mov to lea only if needed

We can convert mov to lea only if there are R_386_GOT32/R_X86_64_GOTPCREL
relocations against non IFUNC symbols.

* elf32-i386.c (need_convert_mov_to_lea): New.
(elf_i386_check_relocs): Set need_convert_mov_to_lea if needed.
(elf_i386_convert_mov_to_lea): Return TRUE if
need_convert_mov_to_lea is unset.
* elf64-x86-64.c (need_convert_mov_to_lea): New.
(elf_x86_64_check_relocs): Set need_convert_mov_to_lea if needed.
(elf_x86_64_convert_mov_to_lea): Return TRUE if
need_convert_mov_to_lea is unset.

9 years agoMore redefinition errors in C++ mode
Pedro Alves [Thu, 26 Feb 2015 14:03:47 +0000 (14:03 +0000)]
More redefinition errors in C++ mode

In C++, we can't forward declare objects like in C.  The compiler
complains about symbol redefinition.  Most cases of this were fixed in
e36122e9, but dtrace probes introduced a new one meanwhile.  This
patch fixes it the same way e36122e9 fixed the others.

gdb/
2015-02-27  Pedro Alves  <palves@redhat.com>

* dtrace-probe.c (dtrace_probe_ops): Make extern.

9 years agoMove exception_none to common code, and use it
Pedro Alves [Mon, 9 Feb 2015 14:59:12 +0000 (14:59 +0000)]
Move exception_none to common code, and use it

gdb/ChangeLog:
2015-02-27  Pedro Alves  <palves@redhat.com>

* common/common-exceptions.h (exception_none): Declare.
* common/common-exceptions.c (exception_none): Moved from
exceptions.c.
(exceptions_state_mc_init): Use exception_none.
* exceptions.c (exception_none): Move to
common/common-exceptions.c.
* exceptions.h (exception_none): Move to
common/common-exceptions.h.

9 years agocatch_command_errors: Remove 'mask' parameter
Pedro Alves [Mon, 9 Feb 2015 14:59:10 +0000 (14:59 +0000)]
catch_command_errors: Remove 'mask' parameter

All callers of catch_command_errors pass RETURN_MASK_ALL as mask
argument.  This patch eliminates the mask parameter as unnecessary.

gdb/ChangeLog:
2015-02-27  Pedro Alves  <palves@redhat.com>

* main.c (catch_command_errors, catch_command_errors_const):
Remove 'mask' argument.  Adjust.
(captured_main): Adjust callers.

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

* gdb.gdb/python-interrupts.exp (test_python_interrupts): Adjust
call to catch_command_errors.
* gdb.gdb/python-selftest.exp (selftest_python): Adjust call to
catch_command_errors.

9 years agoAdjust self tests to cope with GDB built as a C++ program
Pedro Alves [Wed, 22 Oct 2014 14:14:41 +0000 (15:14 +0100)]
Adjust self tests to cope with GDB built as a C++ program

gdb/testsuite/
2015-02-27  Pedro Alves  <palves@redhat.com>

* gdb.gdb/complaints.exp (test_initial_complaints): Also accept
"true" for boolean result.
* gdb.gdb/selftest.exp (test_with_self): Also accept full
prototype of main.

9 years agopython/python-internal.h: enum ‘ext_lang_rc’ not defined
Pedro Alves [Wed, 22 Oct 2014 11:27:50 +0000 (12:27 +0100)]
python/python-internal.h: enum ‘ext_lang_rc’ not defined

Fixes this in C++ mode:

  src/gdb/python/python-internal.h: At global scope:
  src/gdb/python/python-internal.h:313:13: error: use of enum ‘ext_lang_rc’ without previous declaration
   extern enum ext_lang_rc gdbpy_apply_val_pretty_printer
       ^
  src/gdb/python/python-internal.h:320:41: error: invalid type in declaration before ‘;’ token
      const struct language_defn *language);
   ^

gdb/ChangeLog:
2015-02-27  Pedro Alves  <palves@redhat.com>

* python/python-internal.h: Include "extension-priv.h".

9 years agobreakpoint.h: move enum ‘print_stop_action’
Pedro Alves [Wed, 22 Oct 2014 11:26:06 +0000 (12:26 +0100)]
breakpoint.h: move enum ‘print_stop_action’

Building GDB in C++, we get:

  src/gdb/breakpoint.h:529:8: error: use of enum ‘print_stop_action’ without previous declaration

We can't forward declare enums in C++.

gdb/ChangeLog:
2015-02-27  Pedro Alves  <palves@redhat.com>

* breakpoint.h (enum print_stop_action): Move further up in the
file.

9 years agogdbarch.h: include regcache.h
Pedro Alves [Wed, 22 Oct 2014 11:16:56 +0000 (12:16 +0100)]
gdbarch.h: include regcache.h

Building GDB in C++ mode, I got:

  src/gdb/gdbarch.h:240:149: error: invalid type in declaration before ‘;’ token
  src/gdb/gdbarch.h:240:14: error: use of enum ‘register_status’ without previous declaration
  src/gdb/gdbarch.h:241:13: error: use of enum ‘register_status’ without previous declaration
  src/gdb/gdbarch.h:241:140: error: invalid type in declaration before ‘;’ token

That's because 'enum register_status' has not been declared (and we can't
forward declare enums in C++).

gdb/ChangeLog:
2015-02-27  Pedro Alves  <palves@redhat.com>

* gdbarch.sh: Include regcache.h.
* gdbarch.h: Regenerate.

9 years agoRemove duplicate const
Pedro Alves [Wed, 22 Oct 2014 04:58:23 +0000 (05:58 +0100)]
Remove duplicate const

Building --enable-targets=all in C++ mode fails with:

  gdb/sparc-sol2-tdep.c:179:7: error: duplicate ‘const’
  gdb/arm-tdep.c:13878:33: error: duplicate ‘const’
  gdb/arm-tdep.c:13891:33: error: duplicate ‘const’

gdb/ChangeLog:
2015-02-27  Pedro Alves  <palves@redhat.com>

* arm-tdep.c (decode_insn) <arm_handle_insn, thumb_handle_insn>:
Remove duplicate const.
* sparc-sol2-tdep.c (sparc_sol2_static_transform_name): Remove
duplicate const.

9 years agoExported const objects
Pedro Alves [Mon, 9 Feb 2015 13:22:27 +0000 (13:22 +0000)]
Exported const objects

const works different in C vs C++.  In C++, a global "const" variable
has internal linkage by default, resulting in link errors like:

  ...
  extension.o: In function `get_ext_lang_defn(extension_language)':
  gdb/extension.c:126: undefined reference to `extension_language_guile'
  gdb/extension.c:124: undefined reference to `extension_language_guile'
  ...

The fix is to define exported const objects with "extern const".  But
that in C would not be a definition.  So we need to #ifdef C vs C++ in
this case.

EXPORTED_CONST comes from include/ansidecl.h, but in the
feature_to_c.sh case I think it's better to leave the script with no
dependencies.

gdb/ChangeLog:
2015-02-27  Pedro Alves  <palves@redhat.com>

* cp-valprint.c (vtbl_ptr_name): Use EXPORTED_CONST.
* guile/guile.c (extension_language_guile): Use EXPORTED_CONST.
* features/feature_to_c.sh: Tag the generated xml_builtin array
with extern const in C++ mode.

9 years agoRename struct lzma_stream to avoid clash with system header
Tom Tromey [Thu, 5 Jun 2014 20:36:27 +0000 (14:36 -0600)]
Rename struct lzma_stream to avoid clash with system header

/home/pedro/gdb/mygit/src/gdb/minidebug.c: At global scope:
/home/pedro/gdb/mygit/src/gdb/minidebug.c:55:8: error: using typedef-name ‘lzma_stream’ after ‘struct’
 struct lzma_stream
        ^
In file included from /usr/include/lzma.h:281:0,
                 from /home/pedro/gdb/mygit/src/gdb/minidebug.c:28:
/usr/include/lzma/base.h:498:3: note: ‘lzma_stream’ has a previous declaration here
 } lzma_stream;
   ^

gdb/ChangeLog:
2015-02-27  Tom Tromey  <tromey@redhat.com>

* minidebug.c (struct lzma_stream): Rename to ...
(struct gdb_lzma_stream): ... this.
(lzma_open, lzma_pread, lzma_close, lzma_stat): Adjust.

9 years agomi/mi-cmd-stack.c|frame filters: print_values <-> ext_lang_frame_args
Pedro Alves [Wed, 22 Oct 2014 04:09:07 +0000 (05:09 +0100)]
mi/mi-cmd-stack.c|frame filters: print_values <-> ext_lang_frame_args

The enums are value compatible by design, but building in C++ mode trips
on them, like:

  ...
  gdb/mi/mi-cmd-stack.c:363:34: error: cannot convert ‘print_values’ to ‘ext_lang_frame_args’ for argument ‘3’ to ‘ext_lang_bt_status apply_ext_lang_frame_filter(frame_info*, int, ext_lang_frame_args, ui_out*, int, int)’
  ...

Fix this by adding a helper function.

gdb/ChangeLog:
2015-02-27  Pedro Alves  <palves@redhat.com>

* mi/mi-cmd-stack.c (mi_apply_ext_lang_frame_filter): New
function.
(mi_cmd_stack_list_locals, mi_cmd_stack_list_args)
(mi_cmd_stack_list_variables): Use it.

9 years agox86 Linux/ptrace: fix offsetof usage in C++ mode
Pedro Alves [Wed, 22 Oct 2014 12:51:07 +0000 (13:51 +0100)]
x86 Linux/ptrace: fix offsetof usage in C++ mode

In C++ mode, we get:

  gdb/gdbserver/linux-x86-low.c: In function ‘void x86_linux_dr_set(ptid_t, int, long unsigned int)’:
  gdb/gdbserver/linux-x86-low.c:558:38: error: ‘regnum’ cannot appear in a constant-expression
      offsetof (struct user, u_debugreg[regnum]), value);
                                      ^
gdb/gdbserver/ChangeLog:
2015-02-27  Pedro Alves  <palves@redhat.com>

* linux-x86-low.c (u_debugreg_offset): New function.
(x86_linux_dr_get, x86_linux_dr_set): Use it.

gdb/ChangeLog:
2015-02-27  Pedro Alves  <palves@redhat.com>

* x86-linux-nat.c (u_debugreg_offset): New function.
(x86_linux_dr_get, x86_linux_dr_set): Use it.

9 years agoDon't forward declare enum target_hw_bp_type
Pedro Alves [Sun, 19 Oct 2014 23:06:55 +0000 (00:06 +0100)]
Don't forward declare enum target_hw_bp_type

Can't do that in C++.

2015-02-27  Pedro Alves  <palves@redhat.com>

* nat/x86-dregs.h (enum target_hw_bp_type): Remove forward
declaration.
Include break-common.h.

9 years agoDo not increment of decrement enums
Tom Tromey [Wed, 22 Oct 2014 05:08:20 +0000 (06:08 +0100)]
Do not increment of decrement enums

In C++, we can't do arithmetic on enums.  This patch fixes build errors like:

 src/gdb/i386-tdep.c: In function ‘int i386_stap_parse_special_token(gdbarch*, stap_parse_info*)’:
 src/gdb/i386-tdep.c:4309:7: error: no match for ‘operator++’ (operand type is ‘i386_stap_parse_special_token(gdbarch*, stap_parse_info*)::<anonymous enum>’)
++current_state;
^
 ...
 src/gdb/rs6000-tdep.c:4265:18: error: no match for ‘operator++’ (operand type is ‘powerpc_vector_abi’)
 src/gdb/arm-tdep.c:9428:71: error: no match for ‘operator++’ (operand type is ‘arm_float_model’)
 src/gdb/arm-tdep.c:9465:64: error: no match for ‘operator++’ (operand type is ‘arm_abi_kind’)
 ...

gdb/ChangeLog:
2015-02-27  Tom Tromey  <tromey@redhat.com>
    Pedro Alves <palves@redhat.com>

* arm-tdep.c (set_fp_model_sfunc, arm_set_abi): Use 'int' for
local used to iterate over enums.
* completer.c (signal_completer): Likewise.
* i386-tdep.c (i386_stap_parse_special_token): Likewise.
* rs6000-tdep.c (powerpc_set_vector_abi): Likewise.
* tui/tui-data.c (tui_next_win, tui_prev_win): Likewise.
* tui/tui-layout.c (next_layout, prev_layout): Likewise.
* tui/tui-win.c (tui_refresh_all_win, tui_rehighlight_all)
(tui_resize_all, tui_set_focus_command, tui_all_windows_info): Likewise.
* tui-wingeneral.c (tui_refresh_all):  Likewise.

9 years agotarget.h: Include infrun.h
Pedro Alves [Wed, 22 Oct 2014 03:35:38 +0000 (04:35 +0100)]
target.h: Include infrun.h

Fixes:

  src/gdb/target.h:753:10: error: use of enum ‘exec_direction_kind’ without previous declaration

in C++ mode.  We can't forward declare enums.

gdb/ChangeLog:
2015-02-27  Pedro Alves  <palves@redhat.com>

* target.h: Include "infrun.h".

9 years agoproc-service, extern "C"
Pedro Alves [Mon, 9 Feb 2015 14:59:09 +0000 (14:59 +0000)]
proc-service, extern "C"

libthread_db.so calls symbols in the client (GDB), through the
proc-service interface.  These routines must have extern "C" linkage
so their symbol names are not mangled when GDB is built as a C++
program.  On the GDBserver side, we were missing fallback declarations for
all these symbols.

gdb/ChangeLog:
2015-02-27  Pedro Alves  <palves@redhat.com>

* gdb_proc_service.h: Wrap with EXTERN_C_PUSH/EXTERN_C_POP.

gdb/gdbserver/ChangeLog:
2015-02-27  Pedro Alves  <palves@redhat.com>

* gdb_proc_service.h: Wrap with EXTERN_C_PUSH/EXTERN_C_POP.
[!HAVE_PROC_SERVICE_H] (struct ps_prochandle): Forward declare.
[!HAVE_PROC_SERVICE_H] (ps_pdread, ps_pdwrite, ps_ptread)
ps_ptwrite, ps_lgetregs, ps_lsetregs, ps_lgetfpregs)
(ps_lsetfpregs, ps_getpid)
(ps_get_thread_area, ps_pglobal_lookup, ps_pstop, ps_pcontinue)
(ps_lstop, ps_lcontinue, ps_lgetxregsize, ps_lgetxregs)
(ps_lsetxregs, ps_plog): Declare.

9 years agoMake functions and variables exported by the IPA be extern "C"
Pedro Alves [Mon, 9 Feb 2015 14:59:08 +0000 (14:59 +0000)]
Make functions and variables exported by the IPA be extern "C"

Functions and variables that are exported by the IPA DSO (that
GDBserver needs to look up) should have "C" mangling, thus be declared
with extern "C".

Function and variable declarations need the extern "C" marker, but
variable definitions can't be marked extern, so the patch splits
IP_AGENT_EXPORT into three.

Building in C++ mode revealed that a few variables were missing
IP_AGENT_EXPORT, thus the IPA has been broken when stripped, even in C
mode...  So this ends being a bug fix as well.

gdb/ChangeLog:
2015-02-27  Pedro Alves  <palves@redhat.com>

* common/agent.h (IPA_SYM_EXPORTED_NAME): New.
(IPA_SYM): Use it.
* common/common-defs.h (EXTERN_C_PUSH, EXTERN_C_POP): New macros.

gdb/gdbserver/ChangeLog:
2015-02-27  Pedro Alves  <palves@redhat.com>

* linux-amd64-ipa.c (gdb_agent_get_raw_reg): Use
IP_AGENT_EXPORT_FUNC.
* linux-i386-ipa.c (gdb_agent_get_raw_reg): Use
IP_AGENT_EXPORT_FUNC.
* tracepoint.c (ATTR_USED, ATTR_NOINLINE, ATTR_CONSTRUCTOR)
(IP_AGENT_EXPORT): Delete.
(gdb_tp_heap_buffer, gdb_jump_pad_buffer, gdb_jump_pad_buffer_end)
(gdb_trampoline_buffer, gdb_trampoline_buffer_end)
(gdb_trampoline_buffer_error, collecting, gdb_collect)
(stop_tracing, flush_trace_buffer, about_to_request_buffer_space)
(trace_buffer_is_full, stopping_tracepoint, expr_eval_result)
(error_tracepoint, tracepoints, tracing, trace_buffer_ctrl)
(trace_buffer_ctrl_curr, trace_buffer_lo, trace_buffer_hi)
(traceframe_read_count, traceframe_write_count)
(traceframes_created, trace_state_variables, get_raw_reg)
(get_trace_state_variable_value, set_trace_state_variable_value)
(ust_loaded, helper_thread_id, cmd_buf): Use
IPA_SYM_EXPORTED_NAME.
(stop_tracing, flush_trace_buffer): Use IP_AGENT_EXPORT_FUNC.
(tracepoints) Use IP_AGENT_EXPORT_VAR.
(stopping_tracepoint, trace_buffer_is_full, expr_eval_result): Use
IP_AGENT_EXPORT_VAR and wrap in EXTERN_C_PUSH/EXTERN_C_POP.
(last_tracepoint): Move into !IN_PROCESS_AGENT block.
(error_tracepoint): Use IP_AGENT_EXPORT_VAR and wrap in
EXTERN_C_PUSH/EXTERN_C_POP.
(trace_state_variables): Use IP_AGENT_EXPORT_VAR.
(trace_buffer_lo, trace_buffer_hi): Use IP_AGENT_EXPORT_VAR and
wrap in EXTERN_C_PUSH/EXTERN_C_POP.
(trace_buffer_ctrl, trace_buffer_ctrl_curr)
(traceframe_write_count, traceframe_read_count)
(traceframes_created, tracing): Use IP_AGENT_EXPORT_VAR.
(about_to_request_buffer_space, get_trace_state_variable_value)
(set_trace_state_variable_value): Use IP_AGENT_EXPORT_FUNC.
(collecting): Use IP_AGENT_EXPORT_VAR and wrap in
EXTERN_C_PUSH/EXTERN_C_POP.
(gdb_collect): Use IP_AGENT_EXPORT_FUNC.
(ust_loaded, cmd_buf): Use IP_AGENT_EXPORT_VAR.
(helper_thread_id, gdb_agent_capability): Use IP_AGENT_EXPORT_VAR
and wrap in EXTERN_C_PUSH/EXTERN_C_POP.
(gdb_tp_heap_buffer, gdb_jump_pad_buffer, gdb_jump_pad_buffer_end)
(gdb_trampoline_buffer, gdb_trampoline_buffer_end)
(gdb_trampoline_buffer_error): Use IP_AGENT_EXPORT_VAR.
* tracepoint.h (ATTR_USED, ATTR_NOINLINE, EXPORTED_SYMBOL):
Define.
(IP_AGENT_EXPORT_FUNC, IP_AGENT_EXPORT_VAR)
(IP_AGENT_EXPORT_VAR_DECL): Define.
(tracing): Declare.
(gdb_agent_get_raw_reg): Declare.

9 years agoAdd extern "C" to declarations of C symbols
Pedro Alves [Mon, 9 Feb 2015 14:59:08 +0000 (14:59 +0000)]
Add extern "C" to declarations of C symbols

These symbols are defined in C code, so in C++ mode we need to use
extern "C" to declare them.  As extern "C" can't be used inside a
function's scope, we move the declarations to the global scope at the
same time.

gdb/ChangeLog:
2015-02-27  Pedro Alves  <palves@redhat.com>

* cli-out.c (_rl_erase_entire_line): Move declaration out of
cli_mld_erase_entire_line, and make it extern "C".
* common/common-defs.h (EXTERN_C): New.
* completer.c (_rl_completion_prefix_display_length)
(_rl_print_completions_horizontally, QSFUNC): Move declarations
out of gdb_display_match_list_1.
(_rl_qsort_string_compare): Move declaration out of
gdb_display_match_list_1, and make it extern "C".
* defs.h (re_comp): Use EXTERN_C.
* maint.c (_mcleanup): Move declaration out of mcleanup_wrapper,
and make it extern "C".
(monstartup): Move declaration out of maintenance_set_profile_cmd,
and make it extern "C".
(main): Move declaration out of maintenance_set_profile_cmd.
* nat/linux-ptrace.c (linux_ptrace_attach_fail_reason_string): Use
EXTERN_C.

9 years agoMake array object extern
Pedro Alves [Mon, 9 Feb 2015 14:59:06 +0000 (14:59 +0000)]
Make array object extern

Compiling python.c in C++ mode, we get:

  ...src/gdb/python/python.c: At global scope:
  ...src/gdb/python/python.c:106:31: error: storage size of ‘GdbMethods’ isn’t known
   static PyMethodDef GdbMethods[];
 ^

Fix it by making the affected array objects extern.

gdb/ChangeLog:
2015-02-27  Pedro Alves  <palves@redhat.com>

* python/python.c (GdbMethods): Rename to ...
(python_GdbMethods): ... this and make extern.
(GdbModuleDef): Rename to ...
(python_GdbModuleDef): ... this and make extern.

9 years agorecord-btrace.c: Remove redefinitions
Pedro Alves [Mon, 9 Feb 2015 17:13:39 +0000 (17:13 +0000)]
record-btrace.c: Remove redefinitions

The set_record_btrace_cmdlist and show_record_btrace_cmdlist objects
are declared twice in the file, seemingly a simply copy/paste
oversight.  In C, the first time counts as forward declaration, but in
C++, they are all definitions.  That results in:

 src/gdb/record-btrace.c:80:33: error: redefinition of ‘cmd_list_element* set_record_btrace_cmdlist’
 src/gdb/record-btrace.c:61:33: error: ‘cmd_list_element* set_record_btrace_cmdlist’ previously declared here
 src/gdb/record-btrace.c:81:33: error: redefinition of ‘cmd_list_element* show_record_btrace_cmdlist’
 src/gdb/record-btrace.c:62:33: error: ‘cmd_list_element* show_record_btrace_cmdlist’ previously declared here

gdb/ChangeLog:
2015-02-27  Pedro Alves  <palves@redhat.com>

* record-btrace.c (set_record_btrace_cmdlist)
(show_record_btrace_cmdlist): Remove redefinitions.
 ---

 gdb/record-btrace.c |    4 ----
 1 file changed, 4 deletions(-)

9 years agoFix struct, union, and enum nesting in C++
Tom Tromey [Mon, 9 Feb 2015 14:59:05 +0000 (14:59 +0000)]
Fix struct, union, and enum nesting in C++

In C, an enum or structure defined inside other structure has global
scope just like it had been defined outside the struct in the first
place.  However, in C++, such a nested structure is given a name that
is nested inside the structure.  This patch moves such affected
structures/enums out to global scope, so that code using them works
the same in C++ as it works today in C.

gdb/ChangeLog:
2015-02-27  Tom Tromey  <tromey@redhat.com>
    Pedro Alves  <palves@redhat.com>

* dwarf2-frame.c (enum cfa_how_kind, struct
dwarf2_frame_state_reg_info): Move out of struct
dwarf2_frame_state.
* dwarf2read.c (struct tu_stats): Move out of struct
dwarf2_per_objfile.
(struct file_entry): Move out of struct line_header.
(struct nextfield, struct nextfnfield, struct fnfieldlist, struct
typedef_field_list): Move out of struct field_info.
* gdbtypes.h (enum dynamic_prop_kind, union dynamic_prop_data):
Move out of struct dynamic_prop.
(union type_owner, union field_location, struct field, struct
range_bounds, union type_specific): Move out of struct main_type.
(struct fn_fieldlist, struct fn_field, struct typedef_field)
(VOFFSET_STATIC): Move out of struct cplus_struct_type.
(struct call_site_target, union call_site_parameter_u, struct
call_site_parameter): Move out of struct call_site.
* m32c-tdep.c (enum m32c_prologue_kind): Move out of struct
m32c_prologue.
(enum srcdest_kind): Move out of struct srcdest.
* main.c (enum cmdarg_kind): Move out of struct cmdarg.
* prologue-value.h (enum prologue_value_kind): Move out of struct
prologue_value.
* s390-linux-tdep.c (enum s390_abi_kind): Move out of struct
gdbarch_tdep.
* stabsread.c (struct nextfield, struct next_fnfieldlist): Move
out of struct field_info.
* symfile.h (struct other_sections): Move out of struct
section_addr_info.
* symtab.c (struct symbol_cache_slot): Move out struct
block_symbol_cache.
* target-descriptions.c (enum tdesc_type_kind): Move out of
typedef struct tdesc_type.
* tui/tui-data.h (enum tui_line_or_address_kind): Move out of
struct tui_line_or_address.
* value.c (enum internalvar_kind, union internalvar_data): Move
out of struct internalvar.
* xtensa-tdep.h (struct ctype_cache): Move out of struct
gdbarch_tdep.

9 years agoC++ keyword cleanliness, mostly auto-generated
Pedro Alves [Fri, 27 Feb 2015 16:33:07 +0000 (16:33 +0000)]
C++ keyword cleanliness, mostly auto-generated

This patch renames symbols that happen to have names which are
reserved keywords in C++.

Most of this was generated with Tromey's cxx-conversion.el script.
Some places where later hand massaged a bit, to fix formatting, etc.
And this was rebased several times meanwhile, along with re-running
the script, so re-running the script from scratch probably does not
result in the exact same output.  I don't think that matters anyway.

gdb/
2015-02-27  Tom Tromey  <tromey@redhat.com>
    Pedro Alves  <palves@redhat.com>

Rename symbols whose names are reserved C++ keywords throughout.

gdb/gdbserver/
2015-02-27  Tom Tromey  <tromey@redhat.com>
    Pedro Alves  <palves@redhat.com>

Rename symbols whose names are reserved C++ keywords throughout.

9 years agoAdd --enable-build-with-cxx configure switch
Pedro Alves [Fri, 27 Feb 2015 13:11:25 +0000 (13:11 +0000)]
Add --enable-build-with-cxx configure switch

This new option, disabled by default for now, allows specifying
whether to build GDB, GDBserver, and friends with a C++ (98/03)
compiler.

The name of the switch should be familiar to those who followed GCC's
own C++ conversion process.

. Adding -fpermissive to COMPILER in C++ mode (see the new
build-with-cxx.m4 file) makes errors like these be warnings instead:

  gdb/infrun.c:6597:1: error:   initializing argument 1 of ‘void sig_print_info(gdb_signal)’ [-fpermissive]
   sig_print_info (enum gdb_signal oursig)
   ^
  gdb/infrun.c: In function ‘void do_restore_infcall_suspend_state_cleanup(void*)’:
  gdb/infrun.c:7164:39: error: invalid conversion from ‘void*’ to ‘infcall_suspend_state*’ [-fpermissive]
     restore_infcall_suspend_state (state);
 ^

so that the compiler carries on compiling the file.  -Werror still
catches the warnings, so nothing is lost, only our lifes are made
easier by concentrating on getting other more important things out of
the way first.

There's no way to quiet those warnings.  Until they're all fixed, when
building in C++ mode, -Werror is disabled by default.

. Adding -Wno-narrowing suppresses thousands of instances of this warning:

  gdb/arm-linux-tdep.c:439:1: error: narrowing conversion of ‘-1’ from ‘int’ to ‘ULONGEST {aka long unsigned int}’ inside { } is ill-formed in C++11 [-Werror=narrowing]
  gdb/arm-linux-tdep.c:439:1: error: narrowing conversion of ‘-1l’ from ‘LONGEST {aka long int}’ to ‘ULONGEST {aka long unsigned int}’ inside { } is ill-formed in C++11 [-Werror=narrowing]
  gdb/arm-linux-tdep.c:450:1: error: narrowing conversion of ‘-1’ from ‘int’ to ‘ULONGEST {aka long unsigned int}’ inside { } is ill-formed in C++11 [-Werror=narrowing]

We can defer handling those until we target C++11.

. Adding -Wno-sign-compare suppresses thousands of instances of this warning:

  gdb/linux-record.c:1763:32: warning: comparison between signed and unsigned integer expressions [-Wsign-compare]
 if (tmpulongest == tdep->fcntl_F_GETLK64)
  ^

. Adding -Wno-write-strings suppresses thousands of instances of this warning:

  gdb/mi/mi-cmd-var.c: In function ‘void mi_cmd_var_show_attributes(char*, char**, int)’:
  gdb/mi/mi-cmd-var.c:514:12: warning: deprecated conversion from string constant to ‘char*’ [-Wwrite-strings]
       attstr = "editable";
      ^
  gdb/mi/mi-cmd-var.c:516:12: warning: deprecated conversion from string constant to ‘char*’ [-Wwrite-strings]
       attstr = "noneditable";
      ^

For now, it's best to hide these warnings from view until we're
'-fpermissive'-clean, and can thus start building with -Werror.
The C compiler has always managed to build working GDBs with these
issues in the code, so a C++ compiler should too.

gdb/ChangeLog:
2015-02-27  Pedro Alves  <palves@redhat.com>

* Makefile.in (COMPILER): New, get it from autoconf.
(COMPILE.pre, CC_LD): Use COMPILER.
(CXX): Get from autoconf instead.
(CXX_FOR_TARGET): Default to g++ instead of gcc.
* acinclude.m4: Include build-with-cxx.m4.
* build-with-cxx.m4: New file.
* configure.ac: Call AC_PROG_CXX and GDB_AC_BUILD_WITH_CXX.
Disable -Werror by default if building in C++ mode.
(build_warnings): Add -Wno-sign-compare, -Wno-write-strings and
-Wno-narrowing in C++ mode.  Only enable -Wpointer-sign in C mode.
Run supported-warning-flags tests with the C++ compiler.
Save/restore CXXFLAGS too.
* configure: Regenerate.

gdb/gdbserver/ChangeLog:
2015-02-27  Pedro Alves  <palves@redhat.com>

* Makefile.in (COMPILER): New, get it from autoconf.
(CXX): Get from autoconf instead.
(COMPILE.pre): Use COMPILER.
(CC-LD): Rename to ...
(CC_LD): ... this.  Use COMPILER.
(gdbserver$(EXEEXT), gdbreplay$(EXEEXT), $(IPA_LIB)): Adjust.
(CXX_FOR_TARGET): Default to g++ instead of gcc.
* acinclude.m4: Include build-with-cxx.m4.
* configure.ac: Call AC_PROG_CXX and GDB_AC_BUILD_WITH_CXX.
Disable -Werror by default if building in C++ mode.
(build_warnings): Add -Wno-sign-compare, -Wno-write-strings and
-Wno-narrowing in C++ mode. Run supported-warning-flags tests with
the C++ compiler.  Save/restore CXXFLAGS too.
* configure: Regenerate.

9 years agoFixes a problem with the linker script parser not always handling the ! character...
Nick Clifton [Fri, 27 Feb 2015 16:19:57 +0000 (16:19 +0000)]
Fixes a problem with the linker script parser not always handling the ! character in memort region attributes.

PR ld/17900
* ldlang.c (lang_set_flags): Allow exclamation mark to reverse the
sense of the following memory region attribute characters.

9 years agoCreate libiberty.m4, have GDB and GDBserver use it
Pedro Alves [Fri, 27 Feb 2015 15:52:02 +0000 (15:52 +0000)]
Create libiberty.m4, have GDB and GDBserver use it

Converting GDB to be a C++ program, I stumbled on 'basename' issues,
like:

 src/gdb/../include/ansidecl.h:169:64: error: new declaration ‘char* basename(const char*)’
 /usr/include/string.h:597:26: error: ambiguates old declaration ‘const char* basename(const char*)’

which I believe led to this bit in gold's configure.ac:

 dnl We have to check these in C, not C++, because autoconf generates
 dnl tests which have no type information, and current glibc provides
 dnl multiple declarations of functions like basename when compiling
 dnl with C++.
 AC_CHECK_DECLS([basename, ffs, asprintf, vasprintf, snprintf, vsnprintf, strverscmp])

These checks IIUC intend to generate all the HAVE_DECL_FOO symbols
that libiberty.h and ansidecl.h check.

GDB is missing these checks currently, which results in the conflict
shown above.

This adds an m4 file that both GDB and GDBserver's configury use to
pull in the autoconf checks that libiberty clients needs done in order
to use these libiberty.h/ansidecl.h.

gdb/ChangeLog:
2015-02-27  Pedro Alves  <palves@redhat.com>

* libiberty.m4: New file.
* acinclude.m4: Include libiberty.m4.
* configure.ac: Call libiberty_INIT.
* config.in, configure: Regenerate.

gdb/gdbserver/
2015-02-27  Pedro Alves  <palves@redhat.com>

* acinclude.m4: Include libiberty.m4.
* configure.ac: Call libiberty_INIT.
* config.in, configure: Regenerate.

9 years agoFixes a problem recognizing libraries created by Visual Studio.
Nick Clifton [Fri, 27 Feb 2015 15:38:32 +0000 (15:38 +0000)]
Fixes a problem recognizing libraries created by Visual Studio.

PR binutils/17910
* coffgen.c (_bfd_coff_internal_syment_name): Only check for
string length overflow when the string table length is actually
set.

9 years agoAdd "../lib/unbuffer_output.c" and use it in gdb.base/interrupt.c
Pedro Alves [Fri, 27 Feb 2015 13:54:22 +0000 (13:54 +0000)]
Add "../lib/unbuffer_output.c" and use it in gdb.base/interrupt.c

In some scenarios, GDB or GDBserver can be spawned with input _not_
connected to a tty, and then tests that rely on stdio fail with
timeouts, because the inferior's stdout and stderr streams end up
fully buffered.

See discussion here:
  https://sourceware.org/ml/gdb-patches/2015-02/msg00809.html

We have a hack in place that works around this for Windows testing,
that forces every test program to link with an .o file that does
(lib/set_unbuffered_mode.c):

 static int __gdb_set_unbuffered_output (void) __attribute__ ((constructor));
 static int
 __gdb_set_unbuffered_output (void)
 {
   setvbuf (stdout, NULL, _IONBF, BUFSIZ);
   setvbuf (stderr, NULL, _IONBF, BUFSIZ);
 }

That's a bit hacky; it ends up done for _all_ tests.

This patch adds a way to do this unbuffering explicitly from the test
code itself, so it is done only when necessary, and for all
targets/hosts.  For starters, it adjusts gdb.base/interrupt.c to use
it.

Tested on x86_64 Fedora 20, native, and against a remote gdbserver
board file that connects to the target with ssh, with and without -t
(create pty).

gdb/testsuite/
2015-02-27  Pedro Alves  <palves@redhat.com>

* lib/unbuffer_output.c: New file.
* gdb.base/interrupt.c: Include "../lib/unbuffer_output.c".
(main): Call gdb_unbuffer_output.

9 years agoDon't skip catch-syscall.exp on hppa*-hp-hpux* target
Yao Qi [Fri, 27 Feb 2015 13:45:06 +0000 (13:45 +0000)]
Don't skip catch-syscall.exp on hppa*-hp-hpux* target

As far as I know, "catch syscall" is supported on hppa*-hp-hpux*, but
the test catch-syscall.exp is skipped on this target by mistake.  This
patch is to fix it.  However, I don't have a hpux machine to test.

gdb/testsuite:

2015-02-27  Yao Qi  <yao.qi@linaro.org>

* gdb.base/catch-syscall.exp: Don't skip it on hppa*-hp-hpux*
target.

9 years agoRegenerate bfd-in2.h and libbfd.h
Marcus Shawcroft [Fri, 27 Feb 2015 12:21:54 +0000 (12:21 +0000)]
Regenerate bfd-in2.h and libbfd.h

9 years agoFixes problems building the V850 simulator introduced with the previous delta.
Nick Clifton [Fri, 27 Feb 2015 09:49:20 +0000 (09:49 +0000)]
Fixes problems building the V850 simulator introduced with the previous delta.

* sim-main.h (reg64_t): New type.
(v850_regs): Add selID_sregs field.
(VR, SAT16, SAT32, ABS16, ABS32 ): New macros.
* v850-dc: Add fields for v850e3v5 instructions.
* v850.igen (cvtf.dl): Use correctly signed local value.
(cvtf.dw, cvtf.sw, trncf.dul, trncf.dl, trncf.sul, trncf.sw):
Likewise.
* interp.c: Fix old style function declarations.
* simops.c: Likewise.

9 years agoS390: Fix compiler invocation with "compile" command
Andreas Arnez [Fri, 27 Feb 2015 09:47:54 +0000 (10:47 +0100)]
S390: Fix compiler invocation with "compile" command

On 64-bit S390 platforms the "compile" command always failed because
gcc was not invoked correctly.  This patch fixes the compiler
invocation.

gdb/ChangeLog:

* s390-linux-tdep.c (s390_gcc_target_options): Not just handle
31-bit targets, but 64-bit targets as well.
(s390_gnu_triplet_regexp): New function.
(s390_gdbarch_init): Set the gcc_target_options gdbarch method for
64-bit targets as well.  Set the gnu_triplet_regexp gdbarch
method.

9 years agoMark latest entry in gdb/ChangeLog as "(tiny patch)".
Joel Brobecker [Fri, 27 Feb 2015 08:49:59 +0000 (09:49 +0100)]
Mark latest entry in gdb/ChangeLog as "(tiny patch)".

9 years agoRetrieve segment registers on Windows amd64
Jon TURNEY [Wed, 18 Feb 2015 23:13:47 +0000 (23:13 +0000)]
Retrieve segment registers on Windows amd64

For amd64, CONTEXT_FULL does not contain CONTEXT_SEGMENTS, which seems
to be needed to retrieve all the segment registers.  Add it explicitly,
with a little de-cruftification.

The value of the segment registers isn't terribly useful on amd64, but
at least this makes the output of 'info registers' correct.

Before:

    (gdb)  i r cs ss ds es fs gs
    cs             0x33     51
    ss             0x2b     43
    ds             0x0      0
    es             0x0      0
    fs             0x0      0
    gs             0x0      0

After:

    (gdb) i r cs ss ds es fs gs
    cs             0x33     51
    ss             0x2b     43
    ds             0x2b     43
    es             0x2b     43
    fs             0x53     83
    gs             0x2b     43

gdb/ChangeLog

2015-02-27  Jon TURNEY  <jon.turney@dronecode.org.uk>

* windows-nat.c (CONTEXT_DEBUGGER): Remove.
(CONTEXT_DEBUGGER_DR): Add CONTEXT_SEGMENTS.  Incorporate flags
from CONTEXT_DEBUGGER.

9 years agoAdjust ChangeLog entry.
Marcus Shawcroft [Fri, 27 Feb 2015 08:07:55 +0000 (08:07 +0000)]
Adjust ChangeLog entry.

9 years agoAdd missing CHECK_TYPEDEF calls to recent vptr_{fieldno,basetype} cleanup.
Doug Evans [Fri, 27 Feb 2015 01:31:29 +0000 (17:31 -0800)]
Add missing CHECK_TYPEDEF calls to recent vptr_{fieldno,basetype} cleanup.

gdb/ChangeLog:

* gdbtypes.c (internal_type_vptr_fieldno): Add missing call to
CHECK_TYPEDEF.
(set_type_vptr_fieldno): Ditto.
(internal_type_vptr_basetype, set_type_vptr_basetype): Ditto.
* gnu-v3-abi.c (gnuv3_dynamic_class): Ditto.

gdb/testsuite/ChangeLog:

* gdb.cp/class2.cc (Dbase, D): New classes.
(main): New local delta.
* gdb.cp/class2.exp: Test printing delta.
* gdb.cp/classes.cc (DynamicBase2, DynamicBar): New classes.
(dynbar): New global.
* gdb.cp/classes.exp (test_ptype_class_objects): Test ptype DynamicBar.

9 years agoFix recent h8300 configury changes
Alan Modra [Thu, 26 Feb 2015 02:31:50 +0000 (13:01 +1030)]
Fix recent h8300 configury changes

* Makefile.am (ALL_EMULATION_SOURCES): Sort new h8300 entries.
(eh8300elf_linux.c, eh8300helf_linux.c, eh8300self_linux.c,
eh8300sxelf_linux.c): Do not invoke genscripts here.
* Makefile.in: Regenerate.

9 years agoAutomatic date update in version.in
GDB Administrator [Fri, 27 Feb 2015 00:00:08 +0000 (00:00 +0000)]
Automatic date update in version.in

9 years ago[AArch64] Add tiny DESC test cases.
Marcus Shawcroft [Thu, 19 Feb 2015 09:52:24 +0000 (09:52 +0000)]
[AArch64] Add tiny DESC test cases.

9 years ago[AArch64] Add support for :tlsdesc: and TLSDESC_LD_PREL19
Marcus Shawcroft [Wed, 18 Feb 2015 15:37:35 +0000 (15:37 +0000)]
[AArch64] Add support for :tlsdesc: and TLSDESC_LD_PREL19

9 years ago[AArch64] Add support for :tlsdesc: and TLSDESC_ADR_PREL21
Marcus Shawcroft [Wed, 18 Feb 2015 15:36:40 +0000 (15:36 +0000)]
[AArch64] Add support for :tlsdesc: and TLSDESC_ADR_PREL21

9 years agoAdd tiny memory model GD test cases.
Marcus Shawcroft [Thu, 19 Feb 2015 09:10:11 +0000 (09:10 +0000)]
Add tiny memory model GD test cases.

9 years agoAdd ADR :tlsgd: directive and TLSGD_ADR_PREL21 support.
Marcus Shawcroft [Fri, 13 Feb 2015 07:13:57 +0000 (07:13 +0000)]
Add ADR :tlsgd: directive and TLSGD_ADR_PREL21 support.

9 years agoAdding tls-tiny-ie test.
Marcus Shawcroft [Wed, 18 Feb 2015 18:10:59 +0000 (18:10 +0000)]
Adding tls-tiny-ie test.

9 years agoAdding support for TLSIE_LD_GOTTREL_PREL19.
Marcus Shawcroft [Fri, 13 Feb 2015 09:57:11 +0000 (09:57 +0000)]
Adding support for TLSIE_LD_GOTTREL_PREL19.

9 years agoAdding ld_literal_type.
Marcus Shawcroft [Wed, 18 Feb 2015 18:10:27 +0000 (18:10 +0000)]
Adding ld_literal_type.

Extend the address modifier parsing to distinguish between the
modifers used in LDR literal and LDR register offset address modes.

The current parser incorrectly accepts the :got: modifier on a
register offset instruction resulting in silent corruption of the
output binary.

9 years agoAdding test case for abuse of :got: in offset load
Marcus Shawcroft [Wed, 18 Feb 2015 18:32:43 +0000 (18:32 +0000)]
Adding test case for abuse of :got: in offset load

The :got: modifier is not meaningful in a register offset load store
instruction and should result in a diagnostic.

9 years agoAdding adr_type and prevent adr :got:
Marcus Shawcroft [Thu, 5 Feb 2015 16:57:09 +0000 (16:57 +0000)]
Adding adr_type and prevent adr :got:

The current implementation of the :got: assembler modifier does not
distinguish the ADR and ADRP instruction.  The :got: modifier does not
make sense on and ADR instruction and should be error'd rather than
the current behavior of applying an inappropriate relocation to the
output and scrambling the underlying instruction silently.

9 years agoAdd test case for ADR :got:foo
Marcus Shawcroft [Thu, 5 Feb 2015 13:16:33 +0000 (13:16 +0000)]
Add test case for ADR :got:foo

The modifier :got: does not make sense on an ADR instruction.  Add a
test case to ensure we gripe.

9 years agoFix field size for TLSDESC_CALL
Marcus Shawcroft [Wed, 18 Feb 2015 15:08:34 +0000 (15:08 +0000)]
Fix field size for TLSDESC_CALL

This relocation is a marker and does not result in a modification to
the binary.  Changing the HOWTO bit field width to reflect this
property.

9 years agoFix field size for TLSLE_MOVW_TPREL_* relocations.
Marcus Shawcroft [Thu, 26 Feb 2015 21:20:05 +0000 (21:20 +0000)]
Fix field size for TLSLE_MOVW_TPREL_* relocations.

The HOWTO table entries for the TLSLE_MOVW_TPREL_* relocations are
wrong by inspection.  The current implementation does not actually use
these field widths for these relocations but they should be corrected.

9 years agoFix TLSIE_MOVW_GOTTPREL_G0_NC field size.
Marcus Shawcroft [Wed, 18 Feb 2015 15:00:27 +0000 (15:00 +0000)]
Fix TLSIE_MOVW_GOTTPREL_G0_NC field size.