Pedro Alves [Sat, 29 Oct 2016 15:30:34 +0000 (16:30 +0100)]
gdb/NEWS: Clarify C++ requirement
gdb/ChangeLog:
2016-10-29 Pedro Alves <palves@redhat.com>
* NEWS: Clarify C++ requirement.
Pedro Alves [Sat, 29 Oct 2016 15:14:36 +0000 (16:14 +0100)]
gdb/NEWS: Mention C++11 requirement
gdb/ChangeLog:
2016-10-29 Pedro Alves <palves@redhat.com>
* NEWS: Adjust to mention C++11 requirement.
Eli Zaretskii [Sat, 29 Oct 2016 15:10:23 +0000 (18:10 +0300)]
Support command-line redirection in native MS-Windows debugging
gdb/ChangeLog
2016-10-29 Eli Zaretskii <eliz@gnu.org>
* NEWS: Mention support for redirection on MS-Windows.
* windows-nat.c (redir_open, redir_set_redirection)
(redirect_inferior_handles) [!__CYGWIN__]: New functions.
(windows_create_inferior) [!__CYGWIN__]: Use
'redirect_inferior_handles' to redirect standard handles of the
debuggee if the command line requests that.
Pedro Alves [Sat, 29 Oct 2016 15:07:31 +0000 (16:07 +0100)]
gdb/doc: Remove mention of vCont's default actions
Discussion with qemu folks suggests that the vCont description could
be even simpler and clearer. Given we now say:
For each inferior thread, the leftmost action with a matching
thread-id is applied.
There's really no need to even talk about "default" actions, which
raises doubts about whether "default" is special in some way (it's
not).
See <https://lists.gnu.org/archive/html/qemu-devel/2016-10/msg06944.html>.
gdb/doc/ChangeLog:
2016-10-29 Pedro Alves <palves@redhat.com>
* gdb.texinfo (Packets) <vCont>: Remove mention of default
actions.
GDB Administrator [Sat, 29 Oct 2016 00:00:19 +0000 (00:00 +0000)]
Automatic date update in version.in
Pedro Alves [Wed, 12 Oct 2016 23:27:45 +0000 (00:27 +0100)]
gdb: Require C++11
Use AX_CXX_COMPILE_STDCXX to detect if the compiler supports C++11,
and if -std=xxx switches are necessary to enable C++11.
We need to tweak AX_CXX_COMPILE_STDCXX a bit though. Pristine
upstream AX_CXX_COMPILE_STDCXX appends -std=gnu++11 to CXX directly.
That doesn't work for us, because the top level Makefile passes CXX
down to subdirs, and that overrides whatever gdb/Makefile may set CXX
to. The result would be that a make invocation from the build/gdb/
directory would use "g++ -std=gnu++11" as expected, while a make
invocation at the top level would not.
So instead of having AX_CXX_COMPILE_STDCXX set CXX directly, tweak it
to AC_SUBST a separate variable -- CXX_DIALECT -- and use '$(CXX)
(CXX_DIALECT)' to compile/link.
Confirmed that this enables C++11 starting with gcc 4.8, the first gcc
release with full C++11 support.
Also confirmed that configure errors out gracefully with older GCC
releases:
checking whether /opt/gcc-4.7/bin/g++ supports C++11 features by default... no
checking whether /opt/gcc-4.7/bin/g++ supports C++11 features with -std=gnu++11... no
checking whether /opt/gcc-4.7/bin/g++ supports C++11 features with -std=gnu++0x... no
checking whether /opt/gcc-4.7/bin/g++ supports C++11 features with -std=c++11... no
checking whether /opt/gcc-4.7/bin/g++ supports C++11 features with -std=c++0x... no
checking whether /opt/gcc-4.7/bin/g++ supports C++11 features with +std=c++11... no
checking whether /opt/gcc-4.7/bin/g++ supports C++11 features with -h std=c++11... no
configure: error: *** A compiler with support for C++11 language features is required.
Makefile:9451: recipe for target 'configure-gdb' failed
make[1]: *** [configure-gdb] Error 1
make[1]: Leaving directory '/home/pedro/brno/pedro/gdb/mygit/cxx-convertion/build-gcc-4.7'
If we need to revert back to making C++11 optional, all that's
necessary is to change the "mandatory" to "optional" in configure.ac
and regenerate configure (both gdb and gdbserver).
gdb/ChangeLog:
2016-10-28 Pedro Alves <palves@redhat.com>
* Makefile.in (CXX_DIALECT): Get from configure.
(COMPILE.pre, CC_LD): Append $(CXX_DIALECT).
(FLAGS_TO_PASS): Pass CXX_DIALECT.
* acinclude.m4: Include ax_cxx_compile_stdcxx.m4.
* ax_cxx_compile_stdcxx.m4: Add FSF copyright header. Set and
AC_SUBST CXX_DIALECT instead of changing CXX/CXXCPP.
* configure.ac: Call AX_CXX_COMPILE_STDCXX.
* config.in: Regenerate.
* configure: Regenerate.
gdb/gdbserver/ChangeLog:
2016-10-28 Pedro Alves <palves@redhat.com>
* Makefile.in (CXX_DIALECT): Get from configure.
(COMPILE.pre, CC_LD): Append $(CXX_DIALECT).
* acinclude.m4: Include ../ax_cxx_compile_stdcxx.m4.
* configure.ac: Call AX_CXX_COMPILE_STDCXX.
* config.in: Regenerate.
* configure: Regenerate.
Pedro Alves [Fri, 28 Oct 2016 15:00:38 +0000 (16:00 +0100)]
gdb: Import AX_CXX_COMPILE_STDCXX from the GNU Autoconf Archive
This macro throws C++11 code at the compiler in order to check whether
it supports C++11. final/override, rvalue references, static_assert,
decltype, auto, constexpr, etc., and adds -std=gnu++11 to CXX if
necessary.
Nothing uses the macro yet. Simply adding it as separate preliminary
step because we'll need local changes.
gdb/ChangeLog
2016-10-28 Pedro Alves <palves@redhat.com>
* ax_cxx_compile_stdcxx.m4: New file.
Pedro Alves [Fri, 28 Oct 2016 11:03:18 +0000 (12:03 +0100)]
gdb/testsuite: Avoid a buffer overrun in `gdb.base/maint.exp'
Fixes:
PASS: gdb.base/maint.exp: maint w/o args
ERROR: internal buffer is full.
UNRESOLVED: gdb.base/maint.exp: maint info line-table w/o a file name
The problem is just many symtabs and long line tables, enough to
overflow the expect buffer. Fix this by matching input incrementally.
gdb/testsuite/ChangeLog:
2016-10-28 Pedro Alves <palves@redhat.com>
* gdb.base/maint.exp <maint info line-table w/o a file name>: Use
gdb_test_multiple, tighten regexps and match symtabs and line
tables incrementally.
Luis Machado [Fri, 28 Oct 2016 13:45:27 +0000 (08:45 -0500)]
Make gdb.base/foll-exec.exp test pattern more general
Testing a powerpc toolchain running gdbserver on the other end i noticed a
failure in gdb.base/foll-exec.exp. Turns out gdb is outputting a slightly
different pattern due to the presence of debug information.
--
foll-exec is about to execlp(execd-prog)...^M
Continuing.^M
process 21222 is executing new program: gdb.d/outputs/gdb.base/foll-exec/execd-prog^M
^M
Catchpoint 2 (exec'd gdb.d/outputs/gdb.base/foll-exec/execd-prog), _start () at ../sysdeps/powerpc/powerpc32/dl-start.S:32^M
--
Notice the presence of source file information.
Now, on my local machine, i get this:
--
foll-exec is about to execlp(execd-prog)...^M
Continuing.^M
process 9285 is executing new program: gdb/testsuite/outputs/gdb.base/foll-exec/execd-prog^M
^M
Catchpoint 2 (exec'd gdb/testsuite/outputs/gdb.base/foll-exec/execd-prog), 0x00007ffff7dd7cc0 in ?? () from /lib64/ld-linux-x86-64.so.2^M
--
So the output differs slightly and the testcase is actually expecting only
the second form with the "in" anchor.
This patch removes the "in" pattern and lets the test match both kinds of
output.
gdb/testsuite/ChangeLog:
2016-10-28 Luis Machado <lgustavo@codesourcery.com>
* gdb.base/foll-exec.exp (do_exec_tests): Make test pattern more
general.
Pedro Alves [Fri, 28 Oct 2016 00:09:06 +0000 (01:09 +0100)]
Fix gdb.base/maint.exp regressions
This commit fixes these regressions:
FAIL: gdb.base/maint.exp: mt set per on for expand-symtabs
FAIL: gdb.base/maint.exp: maint set per-command on
caused by commit
1e3b796d58ac ("Change command stats reporting to use
class").
gdb.log shows that the command stats are now printing garbage:
(gdb) mt set per on
Command execution time: -6.-419590 (cpu),
1467139648.-
7706296840 (wall)
Space used: 9809920 (-
33276528 for this command)
(gdb) FAIL: gdb.base/maint.exp: mt set per on for expand-symtabs
while there should have been no output at all.
The stats printing is done from within the scoped_command_stats's
destructor, depending on whether some flags in the object are set.
The problem is simply that scoped_command_stats's ctor misses clearing
those flags on some paths.
Since scoped_command_stats objects are allocated on the stack, whether
you'll see the regression simply depends on whatever happens to
already be on the stack space the object occupies.
gdb/ChangeLog:
2016-10-28 Pedro Alves <palves@redhat.com>
* maint.c (scoped_command_stats::scoped_command_stats): Clear
m_space_enabled, m_time_enabled and m_symtab_enabled.
Markus Metzger [Thu, 21 Jan 2016 14:02:27 +0000 (15:02 +0100)]
btrace: bridge gaps
Most of the time, the trace should be in one piece. This case is handled fine
by GDB. In some cases, however, there may be gaps in the trace. They result
from trace decode errors or from overflows.
A gap in the trace means we lost an unknown amount of trace. Gaps can be very
small, such as a few instructions in the same function, or they can be rather
big. We may, for example, lose a few function calls or returns. The trace may
continue in a different function and we likely don't know how we got there.
Even though we can't say how the program executed across a gap, higher levels
may not be impacted too much by it. Let's assume we have functions a-e and a
trace that looks roughly like this:
a
\
b b
\ /
c <gap> c
/
d d
\ /
e
Even though we can't say for sure, it is likely that b and c are the same
function instance before and after the gap. This patch is trying to connect
the c and b function segments across the gap.
This will add a to the back trace of b on the right hand side. The changes are
reflected in GDB's internal representation of the trace and will improve:
- the output of "record function-call-history /c"
- the output of "backtrace" in replay mode
- source stepping in replay mode
will be improved indirectly via the improved back trace
I don't have an automated test for this patch; decode errors will be fixed and
overflows occur sporadically and are quite rare. I tested it by hacking GDB to
provoke a decode error and on the expected gap in the gdb.btrace/dlopen.exp
test.
The issue is that we can't predict where we will be able to re-sync in case of
errors. For the expected decode error in gdb.btrace/dlopen.exp, for example, we
may be able to re-sync somewhere in dlclose, in test, in main, or not at all.
Here's one example run of gdb.btrace/dlopen.exp with and without this patch.
(gdb) info record
Active record target: record-btrace
Recording format: Intel Processor Trace.
Buffer size: 16kB.
warning: Non-contiguous trace at instruction 66608 (offset = 0xa83, pc = 0xb7fdcc31).
warning: Non-contiguous trace at instruction 66652 (offset = 0xa9b, pc = 0xb7fdcc31).
warning: Non-contiguous trace at instruction 66770 (offset = 0xacb, pc = 0xb7fdcc31).
warning: Non-contiguous trace at instruction 66966 (offset = 0xb60, pc = 0xb7ff5ee4).
warning: Non-contiguous trace at instruction 66994 (offset = 0xb74, pc = 0xb7ff5f24).
warning: Non-contiguous trace at instruction 67334 (offset = 0xbac, pc = 0xb7ff5e6d).
warning: Non-contiguous trace at instruction 69022 (offset = 0xc04, pc = 0xb7ff60b3).
warning: Non-contiguous trace at instruction 69116 (offset = 0xc1c, pc = 0xb7ff60b3).
warning: Non-contiguous trace at instruction 69504 (offset = 0xc74, pc = 0xb7ff605d).
warning: Non-contiguous trace at instruction 83648 (offset = 0xecc, pc = 0xb7ff6134).
warning: Decode error (-13) at instruction 83876 (offset = 0xf48, pc = 0xb7fd6380): no memory mapped at this address.
warning: Non-contiguous trace at instruction 83876 (offset = 0x11b7, pc = 0xb7ff1c70).
Recorded 83948 instructions in 912 functions (12 gaps) for thread 1 (process 12996).
(gdb) record instruction-history 83876, +2
83876 => 0xb7fec46f <call_init.part.0+95>: call *%eax
[decode error (-13): no memory mapped at this address]
[disabled]
83877 0xb7ff1c70 <_dl_close_worker.part.0+1584>: nop
Without the patch, the trace is disconnected and the backtrace is short:
(gdb) record goto 83876
#0 0xb7fec46f in call_init.part () from /lib/ld-linux.so.2
(gdb) backtrace
#0 0xb7fec46f in call_init.part () from /lib/ld-linux.so.2
#1 0xb7fec5d0 in _dl_init () from /lib/ld-linux.so.2
#2 0xb7ff0fe3 in dl_open_worker () from /lib/ld-linux.so.2
Backtrace stopped: not enough registers or memory available to unwind further
(gdb) record goto 83877
#0 0xb7ff1c70 in _dl_close_worker.part.0 () from /lib/ld-linux.so.2
(gdb) backtrace
#0 0xb7ff1c70 in _dl_close_worker.part.0 () from /lib/ld-linux.so.2
#1 0xb7ff287a in _dl_close () from /lib/ld-linux.so.2
#2 0xb7fc3d5d in dlclose_doit () from /lib/libdl.so.2
#3 0xb7fec354 in _dl_catch_error () from /lib/ld-linux.so.2
#4 0xb7fc43dd in _dlerror_run () from /lib/libdl.so.2
#5 0xb7fc3d98 in dlclose () from /lib/libdl.so.2
#6 0x0804860a in test ()
#7 0x08048628 in main ()
With the patch, GDB is able to connect the trace pieces and we get a full
backtrace.
(gdb) record goto 83876
#0 0xb7fec46f in call_init.part () from /lib/ld-linux.so.2
(gdb) backtrace
#0 0xb7fec46f in call_init.part () from /lib/ld-linux.so.2
#1 0xb7fec5d0 in _dl_init () from /lib/ld-linux.so.2
#2 0xb7ff0fe3 in dl_open_worker () from /lib/ld-linux.so.2
#3 0xb7fec354 in _dl_catch_error () from /lib/ld-linux.so.2
#4 0xb7ff02e2 in _dl_open () from /lib/ld-linux.so.2
#5 0xb7fc3c65 in dlopen_doit () from /lib/libdl.so.2
#6 0xb7fec354 in _dl_catch_error () from /lib/ld-linux.so.2
#7 0xb7fc43dd in _dlerror_run () from /lib/libdl.so.2
#8 0xb7fc3d0e in dlopen@@GLIBC_2.1 () from /lib/libdl.so.2
#9 0xb7ff28ee in _dl_runtime_resolve () from /lib/ld-linux.so.2
#10 0x0804841c in ?? ()
#11 0x08048470 in dlopen@plt ()
#12 0x080485a3 in test ()
#13 0x08048628 in main ()
(gdb) record goto 83877
#0 0xb7ff1c70 in _dl_close_worker.part.0 () from /lib/ld-linux.so.2
(gdb) backtrace
#0 0xb7ff1c70 in _dl_close_worker.part.0 () from /lib/ld-linux.so.2
#1 0xb7ff287a in _dl_close () from /lib/ld-linux.so.2
#2 0xb7fc3d5d in dlclose_doit () from /lib/libdl.so.2
#3 0xb7fec354 in _dl_catch_error () from /lib/ld-linux.so.2
#4 0xb7fc43dd in _dlerror_run () from /lib/libdl.so.2
#5 0xb7fc3d98 in dlclose () from /lib/libdl.so.2
#6 0x0804860a in test ()
#7 0x08048628 in main ()
It worked nicely in this case but it may, of course, also lead to weird
connections; it is a heuristic, after all.
It works best when the gap is small and the trace pieces are long.
gdb/
* btrace.c (bfun_s): New typedef.
(ftrace_update_caller): Print caller in debug dump.
(ftrace_get_caller, ftrace_match_backtrace, ftrace_fixup_level)
(ftrace_compute_global_level_offset, ftrace_connect_bfun)
(ftrace_connect_backtrace, ftrace_bridge_gap, btrace_bridge_gaps): New.
(btrace_compute_ftrace_bts): Pass vector of gaps. Collect gaps.
(btrace_compute_ftrace_pt): Likewise.
(btrace_compute_ftrace): Split into this, ...
(btrace_compute_ftrace_1): ... this, and ...
(btrace_finalize_ftrace): ... this. Call btrace_bridge_gaps.
Markus Metzger [Tue, 19 Jan 2016 13:54:19 +0000 (14:54 +0100)]
btrace: preserve function level for unexpected returns
When encountering a return for which we have not seen a corresponding call, GDB
starts a new back trace from level -1, i.e. from the level of the first function
in the trace.
In the presence of trace gaps, this may cause some rather big jump.
(gdb) record function-call-history /c 192, +8
192 sbrk
193 brk
194 __x86.get_pc_thunk.bx
195 brk
196 __kernel_vsyscall
197 [disabled]
198 __kernel_vsyscall
199 brk
200 sbrk
This doesn't help to make things more clear. Let's remain on the same level
instead.
(gdb) record function-call-history /c 192, +8
192 sbrk
193 brk
194 __x86.get_pc_thunk.bx
195 brk
196 __kernel_vsyscall
197 [disabled]
198 __kernel_vsyscall
199 brk
200 sbrk
In this case it will look like we were able to connect the trace parts across
the disabled gap. We were not. More work is required to achieve this.
In the general case, the function-call history for the two trace parts won't
match. They may be off by a few levels or they may be entirely different. All
this patch does is to preserve the indentation level of the record
function-call-history command.
The disabled gap is caused by a sysenter not returning to the next instruction.
(gdb) record function-call-history /i 196, +1
196 __kernel_vsyscall inst 66515,66519
(gdb) record instruction-history 66515
66515 0xb7fdcbf8 <__kernel_vsyscall+0>: push %ecx
66516 0xb7fdcbf9 <__kernel_vsyscall+1>: push %edx
66517 0xb7fdcbfa <__kernel_vsyscall+2>: push %ebp
66518 0xb7fdcbfb <__kernel_vsyscall+3>: mov %esp,%ebp
66519 0xb7fdcbfd <__kernel_vsyscall+5>: sysenter
[disabled]
66520 0xb7fdcc08 <__kernel_vsyscall+16>: pop %ebp
66521 0xb7fdcc09 <__kernel_vsyscall+17>: pop %edx
66522 0xb7fdcc0a <__kernel_vsyscall+18>: pop %ecx
66523 0xb7fdcc0b <__kernel_vsyscall+19>: ret
66524 0xb7e8e09e <brk+30>: xchg %ecx,%ebx
(gdb) disassemble 0xb7fdcbf8, 0xb7fdcc0c
Dump of assembler code from 0xb7fdcbf8 to 0xb7fdcc0c:
0xb7fdcbf8 <__kernel_vsyscall+0>: push %ecx
0xb7fdcbf9 <__kernel_vsyscall+1>: push %edx
0xb7fdcbfa <__kernel_vsyscall+2>: push %ebp
0xb7fdcbfb <__kernel_vsyscall+3>: mov %esp,%ebp
0xb7fdcbfd <__kernel_vsyscall+5>: sysenter
0xb7fdcbff <__kernel_vsyscall+7>: nop
0xb7fdcc00 <__kernel_vsyscall+8>: nop
0xb7fdcc01 <__kernel_vsyscall+9>: nop
0xb7fdcc02 <__kernel_vsyscall+10>: nop
0xb7fdcc03 <__kernel_vsyscall+11>: nop
0xb7fdcc04 <__kernel_vsyscall+12>: nop
0xb7fdcc05 <__kernel_vsyscall+13>: nop
0xb7fdcc06 <__kernel_vsyscall+14>: int $0x80
0xb7fdcc08 <__kernel_vsyscall+16>: pop %ebp
0xb7fdcc09 <__kernel_vsyscall+17>: pop %edx
0xb7fdcc0a <__kernel_vsyscall+18>: pop %ecx
0xb7fdcc0b <__kernel_vsyscall+19>: ret
End of assembler dump.
I've seen this on 32-bit Fedora 23. I have not investigated what causes this
and whether we can avoid the gap in the first place. Let's first try to make
GDB handle such gaps more gracefully.
gdb/
* btrace.c (ftrace_new_return): Start from the previous function's level
if we can't find a matching call for a return.
Markus Metzger [Tue, 12 Jan 2016 15:05:15 +0000 (16:05 +0100)]
btrace: update tail call heuristic
An unconditional jump to the start of a function typically indicates a tail
call.
If we can't determine the start of the function at the destination address, we
used to treat it as a tail call, as well. This results in lots of tail calls
for code for which we don't have symbol information.
Restrict the heuristic to only consider jumps as tail calls that switch
functions in the case where we can't determine the start of a function. This
effectively disables tail call detection for code without symbol information.
gdb/
* btrace.c (ftrace_update_function): Update tail call heuristic.
Markus Metzger [Mon, 18 Jan 2016 15:59:21 +0000 (16:59 +0100)]
btrace: allow leading trace gaps
GDB ignores trace gaps from decode errors or overflows at the beginning of the
trace. There isn't really a gap in the trace; the trace just starts a bit
later than expected.
In cases where there is no trace at all or where the trace is smaller than
expected, this may hide the reason for the missing trace.
Allow leading trace gaps. They will be shown as decode warnings and by the
record function-call-history command.
(gdb) info record
Active record target: record-btrace
Recording format: Intel Processor Trace.
Buffer size: 16kB.
warning: Decode error (-6) at instruction 0 (offset = 0x58, pc = 0x0): unexpected packet context.
warning: Decode error (-6) at instruction 0 (offset = 0xb0, pc = 0x0): unexpected packet context.
warning: Decode error (-6) at instruction 0 (offset = 0x168, pc = 0x0): unexpected packet context.
warning: Decode error (-6) at instruction 54205 (offset = 0xe08, pc = 0x0): unexpected packet context.
warning: Decode error (-6) at instruction 54205 (offset = 0xe60, pc = 0x0): unexpected packet context.
warning: Decode error (-6) at instruction 54205 (offset = 0xed8, pc = 0x0): unexpected packet context.
Recorded 91582 instructions in 1111 functions (6 gaps) for thread 1 (process 15710).
(gdb) record function-call-history /c 1
1 [decode error (-6): unexpected packet context]
2 [decode error (-6): unexpected packet context]
3 [decode error (-6): unexpected packet context]
4 _dl_addr
5 ??
6 _dl_addr
7 ??
8 ??
9 ??
10 ??
Leading trace gaps will not be shown by the record instruction-history command
without further changes.
gdb/
* btrace.c (btrace_compute_ftrace_bts, ftrace_add_pt): Allow leading gaps.
* record-btrace.c (record_btrace_single_step_forward)
(record_btrace_single_step_backward): Jump back to last instruction if
step ends at a gap.
(record_btrace_goto_begin): Skip gaps.
Markus Metzger [Tue, 12 Jan 2016 09:44:37 +0000 (10:44 +0100)]
btrace: fix gap indication
Trace gaps due to overflows or non-contiguous trace are ignored in the 'info
record' command. Fix that.
Also add a warning when decoding the trace and print the instruction number
preceding the trace gap in that warning message. It looks like this:
(gdb) info record
Active record target: record-btrace
Recording format: Intel Processor Trace.
Buffer size: 16kB.
warning: Decode error (-13) at instruction 101044 (offset = 0x29f0, pc = 0x7ffff728a642): no memory mapped at this address.
Recorded 101044 instructions in 2093 functions (1 gaps) for thread 1 (process 5360).
(gdb) record instruction-history 101044
101044 0x00007ffff728a640: pop %r13
[decode error (-13): no memory mapped at this address]
Remove the dead code that was supposed to print a gaps warning at the end of
trace decode. This isn't really needed since we now print a warning for each
gap.
gdb/
* btrace.c (ftrace_add_pt): Fix gap indication. Add warning for non-
contiguous trace and overflow. Rephrase trace decode warning and print
instruction number. Remove dead gaps warning.
(btrace_compute_ftrace_bts): Rephrase warnings and print instruction
number.
GDB Administrator [Fri, 28 Oct 2016 00:00:18 +0000 (00:00 +0000)]
Automatic date update in version.in
Yao Qi [Thu, 27 Oct 2016 15:05:06 +0000 (16:05 +0100)]
Enable range stepping if software single step is supported
If the target can do software single step, it can do range
stepping.
gdb/gdbserver:
2016-10-27 Yao Qi <yao.qi@linaro.org>
* linux-low.c (linux_supports_agent): Return true if
can_software_single_step return true.
Yao Qi [Thu, 27 Oct 2016 15:05:06 +0000 (16:05 +0100)]
Get pending events in random
Nowadays, we select events to be reported to GDB in random, however
that is not enough when many GDBserver internal events (not reported
to GDB) are generated.
GDBserver pulls all events out of kernel via waitpid, and leave them
pending. When goes through threads which have pending events,
GDBserver uses find_inferior to find the first thread which has
pending event, and consumes it. Note that find_inferior always
iterate threads in a fixed order. If multiple threads keep hitting
GDBserver breakpoints, range stepping with single-step breakpoint for
example, threads in the head of the thread list are more likely to be
processed and threads in the tail are starved. This causes some timeout
fails in gdb.threads/non-stop-fair-events.exp when range stepping is
enabled on arm-linux.
This patch fixes this issue by randomly selecting pending events. It
adds a new function find_inferior_in_random, which iterates threads
which have pending events randomly.
gdb/gdbserver:
2016-10-27 Yao Qi <yao.qi@linaro.org>
* inferiors.c (find_inferior_in_random): New function.
* inferiors.h (find_inferior_in_random): Declare.
* linux-low.c (linux_wait_for_event_filtered): Call
find_inferior_in_random instead of find_inferior.
Yao Qi [Thu, 27 Oct 2016 15:05:06 +0000 (16:05 +0100)]
Remove single-step breakpoint for GDBserver internal event
This patch removes single-step breakpoints if the event is only
GDBserver internal, IOW, isn't reported back to GDB.
gdb/gdbserver:
2016-10-27 Yao Qi <yao.qi@linaro.org>
* linux-low.c (linux_wait_1): If single-step breakpoints are
inserted, remove them.
Andrew Burgess [Fri, 8 Jul 2016 17:01:00 +0000 (18:01 +0100)]
gas/arc: Don't rely on bfd list of cpu type for cpu selection
In the ARC assembler, when a cpu type is specified using the .cpu
directive, we rely on the bfd list of arc machine types in order to
validate the cpu name passed in.
This validation is only used in order to check that the cpu type passed
to the .cpu directive matches any machine type selected earlier on the
command line. Once that initial check has passed a full check is
performed using the assemblers internal list of know cpu types.
The problem is that the assembler knows about more cpu types than bfd,
some cpu types known by the assembler are actually aliases for a base
cpu type plus a specific set of assembler extensions. One such example
is NPS400, though more could be added later.
This commit removes the need for the assembler to use the bfd list of
machine types for validation. Instead the error checking, to ensure
that any value passed to a '.cpu' directive matches any earlier command
line selection, is moved into the function arc_select_cpu.
I have taken the opportunity to bundle the 4 separate static globals
that describe the currently selected machine type into a single
structure (called selected_cpu).
gas/ChangeLog:
* config/tc-arc.c (arc_target): Delete.
(arc_target_name): Delete.
(arc_features): Delete.
(arc_mach_type): Delete.
(mach_type_specified_p): Delete.
(enum mach_selection_type): New enum.
(mach_selection_mode): New static global.
(selected_cpu): New static global.
(arc_eflag): Rename to ...
(arc_initial_eflag): ...this, and make const.
(arc_select_cpu): Update comment, new parameter, check how
previous machine type selection was made, and record this
selection. Use selected_cpu instead of old globals.
(arc_option): Remove use of arc_get_mach, instead use
arc_select_cpu to validate machine type selection. Use
selected_cpu over old globals.
(allocate_tok): Use selected_cpu over old globals.
(find_opcode_match): Likewise.
(assemble_tokens): Likewise.
(arc_cons_fix_new): Likewise.
(arc_extinsn): Likewise.
(arc_extcorereg): Likewise.
(md_begin): Update default machine type selection, use
selected_cpu over old globals.
(md_parse_option): Update machine type selection option handling,
use selected_cpu over old globals.
* testsuite/gas/arc/nps400-0.s: Add .cpu directive.
bfd/ChangeLog:
* cpu-arc.c (arc_get_mach): Delete.
GDB Administrator [Thu, 27 Oct 2016 00:00:19 +0000 (00:00 +0000)]
Automatic date update in version.in
Sandra Loosemore [Wed, 26 Oct 2016 17:12:01 +0000 (12:12 -0500)]
PR 20569, segv in follow_exec
The following testcases make GDB crash whenever an invalid sysroot is
provided, when GDB is unable to find a valid path to the symbol file:
gdb.base/catch-syscall.exp
gdb.base/execl-update-breakpoints.exp
gdb.base/foll-exec-mode.exp
gdb.base/foll-exec.exp
gdb.base/foll-vfork.exp
gdb.base/pie-execl.exp
gdb.multi/bkpt-multi-exec.exp
gdb.python/py-finish-breakpoint.exp
gdb.threads/execl.exp
gdb.threads/non-ldr-exc-1.exp
gdb.threads/non-ldr-exc-2.exp
gdb.threads/non-ldr-exc-3.exp
gdb.threads/non-ldr-exc-4.exp
gdb.threads/thread-execl.exp
The immediate cause of the segv is that follow_exec is passing a NULL
argument (the result of exec_file_find) to strlen.
However, the problem is deeper than that: follow_exec simply isn't
prepared for the case where sysroot translation fails to locate the
new executable. Actually all callers of exec_file_find have bugs due
to confusion between host and target pathnames. This commit attempts
to fix all that.
In terms of the testcases that were formerly segv'ing, GDB now prints
a warning but continues execution of the new program, so that the
tests now mostly FAIL instead. You could argue the FAILs are due to a
legitimate problem with the test environment setting up the sysroot
translation incorrectly.
A new representative test is added which exercises the ne wwarning
code path even with native testing.
Tested on x86_64 Fedora 23, native and gdbserver.
gdb/ChangeLog:
2016-10-25 Sandra Loosemore <sandra@codesourcery.com>
Luis Machado <lgustavo@codesourcery.com>
Pedro Alves <palves@redhat.com>
PR gdb/20569
* exceptions.c (exception_print_same): Moved here from exec.c.
* exceptions.h (exception_print_same): Declare.
* exec.h: Include "symfile-add-flags.h".
(try_open_exec_file): New declaration.
* exec.c (exception_print_same): Moved to exceptions.c.
(try_open_exec_file): New function.
(exec_file_locate_attach): Rename exec_file and full_exec_path
variables to avoid confusion between target and host pathnames.
Move pathname processing logic to exec_file_find. Do not return
early if pathname lookup fails; Call try_open_exec_file.
* infrun.c (follow_exec): Split and rename execd_pathname variable
to avoid confusion between target and host pathnames. Warn if
pathname lookup fails. Pass target pathname to
target_follow_exec, not hostpathname. Call try_open_exec_file.
* main.c (symbol_file_add_main_adapter): New function.
(captured_main_1): Use it.
* solib-svr4.c (open_symbol_file_object): Adjust to pass
symfile_add_flags to symbol_file_add_main.
* solib.c (exec_file_find): Incorporate fallback logic for relative
pathnames formerly in exec_file_locate_attach.
* symfile.c (symbol_file_add_main, symbol_file_add_main_1):
Replace 'from_tty' parameter with a symfile_add_file.
(symbol_file_command): Adjust to pass symfile_add_flags to
symbol_file_add_main.
* symfile.h (symbol_file_add_main): Replace 'from_tty' parameter
with a symfile_add_file.
gdb/testsuite/ChangeLog:
2016-10-25 Luis Machado <lgustavo@codesourcery.com>
* gdb.base/exec-invalid-sysroot.exp: New file.
Pedro Alves [Wed, 26 Oct 2016 15:47:10 +0000 (16:47 +0100)]
Make symfile_add_flags and objfile->flags strongly typed
This makes these flag types be "enum flag" types. The benefit is
making use of C++'s stronger typing -- mixing the flags types by
mistake errors at compile time.
This caught one old bug in symbol_file_add_main_1 already, fixed by
this patch as well:
@@ -1318,7 +1326,7 @@ symbol_file_add_main_1 (const char *args, int from_tty, int flags)
what is frameless. */
reinit_frame_cache ();
- if ((flags & SYMFILE_NO_READ) == 0)
+ if ((add_flags & SYMFILE_NO_READ) == 0)
set_initial_language ();
}
Above, "flags" are objfile flags, not symfile_add_flags. So that was
actually checking for "flag & OBJF_PSYMTABS_READ", which has the same
value as SYMFILE_NO_READ...
I moved the flags definitions to separate files to break circular
dependencies.
Built with --enable-targets=all and tested on x86-64 Fedora 23.
gdb/ChangeLog:
2016-10-26 Pedro Alves <palves@redhat.com>
* coffread.c (coff_symfile_read): Use symfile_add_flags.
* dbxread.c (dbx_symfile_read): Ditto.
* elfread.c (elf_symfile_read): Ditto.
* inferior.h: Include symfile-add-flags.h.
(struct inferior) <symfile_flags>: Now symfile_add_flags.
* machoread.c (macho_add_oso_symfile, macho_symfile_read_all_oso)
(macho_symfile_read, mipscoff_symfile_read): Use
symfile_add_flags.
* objfile-flags.h: New file.
* objfiles.c (allocate_objfile): Use objfile_flags.
* objfiles.h: Include objfile-flags.h.
(struct objfile) <flags>: Now an objfile_flags.
(OBJF_REORDERED, OBJF_SHARED, OBJF_READNOW, OBJF_USERLOADED)
(OBJF_PSYMTABS_READ, OBJF_MAINLINE, OBJF_NOT_FILENAME): Delete.
Converted to an enum-flags in objfile-flags.h.
(allocate_objfile): Use objfile_flags.
* python/py-objfile.c (objfpy_add_separate_debug_file): Remove
unnecessary local.
* solib.c (solib_read_symbols, solib_add)
(reload_shared_libraries_1): Use symfile_add_flags.
* solib.h: Include "symfile-add-flags.h".
(solib_read_symbols): Use symfile_add_flags.
* symfile-add-flags.h: New file.
* symfile-debug.c (debug_sym_read): Use symfile_add_flags.
* symfile-mem.c (symbol_file_add_from_memory): Use
symfile_add_flags.
* symfile.c (read_symbols, syms_from_objfile_1)
(syms_from_objfile, finish_new_objfile): Use symfile_add_flags.
(symbol_file_add_with_addrs): Use symfile_add_flags and
objfile_flags.
(symbol_file_add_separate): Use symfile_add_flags.
(symbol_file_add_from_bfd, symbol_file_add): Use symfile_add_flags
and objfile_flags.
(symbol_file_add_main_1): : Use objfile_flags. Fix add_flags vs
flags confusion.
(symbol_file_command): Use objfile_flags.
(add_symbol_file_command): Use symfile_add_flags and
objfile_flags.
(clear_symtab_users): Use symfile_add_flags.
* symfile.h: Include "symfile-add-flags.h" and "objfile-flags.h".
(struct sym_fns) <sym_read>: Use symfile_add_flags.
(clear_symtab_users): Use symfile_add_flags.
(enum symfile_add_flags): Delete, moved to symfile-add-flags.h and
converted to enum-flags.
(symbol_file_add, symbol_file_add_from_bfd)
(symbol_file_add_separate): Use symfile_add_flags.
* xcoffread.c (xcoff_initial_scan): Use symfile_add_flags.
Pedro Alves [Wed, 26 Oct 2016 10:08:28 +0000 (11:08 +0100)]
gdb: Coalesce/aggregate (async) vCont packets/actions
Currently, with "maint set target-non-stop on", that is, when gdb
connects with the non-stop/asynchronous variant of the remote
protocol, even with "set non-stop off", GDB always sends one vCont
packet per thread resumed. This patch makes GDB aggregate and
coalesce vCont packets, so we send vCont packets like "vCont;s:p1.1;c"
in non-stop mode too.
Basically, this is done by:
- Adding a new target method target_commit_resume that is called
after calling target_resume one or more times. When resuming a
batch of threads, we'll only call target_commit_resume once after
calling target_resume for all threads.
- Making the remote target defer sending the actual vCont packet to
target_commit_resume.
Special care must be taken to avoid sending a vCont action with a
"wildcard" thread-id (all threads of process / all threads) when that
would resume threads/processes that should not be resumed. See
remote_commit_resume comments for details.
Unlike all-stop's remote_resume implementation, this handles the case
of too many actions resulting in a too-big vCont packet, by flushing
the vCont packet and starting a new one.
E.g., imagining that the "c" action in:
vCont;s:1;c
overflows the packet buffer, we split the actions like:
vCont;s:1
vCont;c
Tested on x86_64 Fedora 20, with and without "maint set
target-non-stop on".
Also tested with a hack that makes remote_commit_resume flush the vCont
packet after every action appended (which caught a few bugs).
gdb/ChangeLog:
2016-10-26 Pedro Alves <palves@redhat.com>
* inferior.h (ALL_NON_EXITED_INFERIORS): New macro.
* infrun.c (do_target_resume): Call target_commit_resume.
(proceed): Defer target_commit_resume while looping over threads,
resuming them. Call target_commit_resume at the end.
* record-btrace.c (record_btrace_commit_resume): New function.
(init_record_btrace_ops): Install it as to_commit_resume method.
* record-full.c (record_full_commit_resume): New function.
(record_full_wait_1): Call the beneath target's to_commit_resume
method.
(init_record_full_ops): Install record_full_commit_resume as
to_commit_resume method.
* remote.c (struct private_thread_info) <last_resume_step,
last_resume_sig, vcont_resumed>: New fields.
(remote_add_thread): Set the new thread's vcont_resumed flag.
(demand_private_info): Delete.
(get_private_info_thread, get_private_info_ptid): New functions.
(remote_update_thread_list): Adjust.
(process_initial_stop_replies): Clear the thread's vcont_resumed
flag.
(remote_resume): If connected in non-stop mode, record the resume
request and return early.
(struct private_inferior): New.
(struct vcont_builder): New.
(vcont_builder_restart, vcont_builder_flush)
(vcont_builder_push_action): New functions.
(MAX_ACTION_SIZE): New macro.
(remote_commit_resume): New function.
(thread_pending_fork_status, is_pending_fork_parent_thread): New
functions.
(check_pending_event_prevents_wildcard_vcont_callback)
(check_pending_events_prevent_wildcard_vcont): New functions.
(process_stop_reply): Adjust. Clear the thread's vcont_resumed
flag.
(init_remote_ops): Install remote_commit_resume.
* target-delegates.c: Regenerate.
* target.c (defer_target_commit_resume): New global.
(target_commit_resume, make_cleanup_defer_target_commit_resume):
New functions.
* target.h (struct target_ops) <to_commit_resume>: New field.
(target_resume): Update comments.
(target_commit_resume): New declaration.
Pedro Alves [Wed, 26 Oct 2016 15:17:25 +0000 (16:17 +0100)]
gdbserver: Leave already-vCont-resumed threads as they were
Currently GDB never sends more than one action per vCont packet, when
connected in non-stop mode. A follow up patch will change that, and
it exposed a gdbserver problem with the vCont handling.
For example, this in non-stop mode:
=> vCont;s:p1.1;c
<= OK
Should be equivalent to:
=> vCont;s:p1.1
<= OK
=> vCont;c
<= OK
But gdbserver currently doesn't handle this. In the latter case,
"vCont;c" makes gdbserver clobber the previous step request. This
patch fixes that.
Note the server side must ignore resume actions for the thread that
has a pending %Stopped notification (and any other threads with events
pending), until GDB acks the notification with vStopped. Otherwise,
e.g., the following case is mishandled:
#1 => g (or any other packet)
#2 <= [registers]
#3 <= %Stopped T05 thread:p1.2
#4 => vCont s:p1.1;c
#5 <= OK
Above, the server must not resume thread p1.2 when it processes the
vCont. GDB can't know that p1.2 stopped until it acks the %Stopped
notification. (Otherwise it wouldn't send a default "c" action.)
(The vCont documentation already specifies this.)
Finally, special care must also be given to handling fork/vfork
events. A (v)fork event actually tells us that two processes stopped
-- the parent and the child. Until we follow the fork, we must not
resume the child. Therefore, if we have a pending fork follow, we
must not send a global wildcard resume action (vCont;c). We can still
send process-wide wildcards though.
(The comments above will be added as code comments to gdb in a follow
up patch.)
gdb/gdbserver/ChangeLog:
2016-10-26 Pedro Alves <palves@redhat.com>
* linux-low.c (handle_extended_wait): Link parent/child fork
threads.
(linux_wait_1): Unlink them.
(linux_set_resume_request): Ignore resume requests for
already-resumed and unhandled fork child threads.
* linux-low.h (struct lwp_info) <fork_relative>: New field.
* server.c (in_queued_stop_replies_ptid, in_queued_stop_replies):
New functions.
(handle_v_requests) <vCont>: Don't call require_running.
* server.h (in_queued_stop_replies): New declaration.
Pedro Alves [Wed, 26 Oct 2016 10:08:27 +0000 (11:08 +0100)]
gdb/doc: Clarify vCont packet description
Specifically, what happens with multiple actions that could match a
thread, and what happens when we get a vCont action that matches a
thread that was already running. E.g., what does:
"vCont;s:2"
"vCont;s:1;c"
mean for thread 2.
(Thread 2 continues stepping.)
gdb/doc/ChangeLog:
2016-10-26 Pedro Alves <palves@redhat.com>
* gdb.texinfo (Packets): Clarify vCont packets with multiple
actions that match a thread, and what happens when an action
matches a thread that is already running.
Pedro Alves [Wed, 26 Oct 2016 10:08:26 +0000 (11:08 +0100)]
gdb: Free inferior->priv when inferior exits
(Where "exits" includes being killed or detached.)
Nothing is clearing inferior->priv currently. This is a problem if we
change the inferior's process_stratum targets in a single debug
session. This field is currently only used by darwin-nat.c, but a
follow up patch will make remote.c use it too. Without the fix,
remote.c might end up mistaking the priv object allocated by
darwin-nat.c with its own.
(Found by inspection.)
gdb/ChangeLog:
2016-10-26 Pedro Alves <palves@redhat.com>
* inferior.c (exit_inferior_1): Free 'priv'.
Pedro Alves [Wed, 26 Oct 2016 10:08:26 +0000 (11:08 +0100)]
gdb: Clean up remote.c:remote_resume
Just some refactoring / TLC. Mainly split the old c/s/C/S packet
handling to a separate function.
gdb/ChangeLog:
2016-10-26 Pedro Alves <palves@redhat.com>
* remote.c (remote_resume_with_hc): New function, factored out
from ...
(remote_resume): ... this. Always try vCont first.
(remote_vcont_resume): Rename to ...
(remote_resume_with_vcont): ... this. Bail out if execution
direction is reverse.
Alan Modra [Tue, 25 Oct 2016 22:58:31 +0000 (09:28 +1030)]
Revert "bison warning fixes"
This reverts commit
95e61695c199a07c832153cea25ae9c331d16a3c. People
still want to use older versions of bison, apparently.
Revert 2016-10-06 Alan Modra <amodra@gmail.com>
* config/rl78-parse.y: Do use old %name-prefix syntax.
* config/rx-parse.y: Likewise.
GDB Administrator [Wed, 26 Oct 2016 00:00:19 +0000 (00:00 +0000)]
Automatic date update in version.in
Pedro Alves [Tue, 25 Oct 2016 13:32:35 +0000 (14:32 +0100)]
Make dwarf_expr_context's destructor virtual
Ref: https://sourceware.org/ml/gdb-patches/2016-10/msg00662.html
$ make WERROR_CFLAGS="-Wnon-virtual-dtor" dwarf2expr.o
...
In file included from .../src/gdb/dwarf2expr.c:28:0:
.../src/gdb/dwarf2expr.h:68:8: warning: ‘struct dwarf_expr_context’ has virtual functions and accessible non-virtual destructor [-Wnon-virtual-dtor]
struct dwarf_expr_context
^~~~~~~~~~~~~~~~~~
Happens to not be a problem in practice currently because concrete
subclasses are allocated on the stack. I.e., we don't ever delete
objects of types that derive from dwarf_expr_context through pointers
to dwarf_expr_context.
gdb/ChangeLog:
2016-10-25 Pedro Alves <palves@redhat.com>
* dwarf2expr.h (struct dwarf_expr_context) <~dwarf_expr_context>:
Make virtual.
Rainer Orth [Tue, 25 Oct 2016 13:19:46 +0000 (15:19 +0200)]
Fix gdb C++ compilation on Solaris (PR build/20712)
gdb 7.12 doesn't compile as C++ (tried with g++ 4.9) on Solaris (tried
10 and 12, sparc and x86). The following patch (relative to the 7.12
release, though I expect most if not all issues to be present on trunk,
too) fixes this.
Only a few of the changes bear explanation:
* Initially, compilation failed whereever defs.h. was included:
In file included from /vol/src/gnu/gdb/gdb-7.12/gdb/gdb.c:19:0:
/vol/src/gnu/gdb/gdb-7.12/gdb/defs.h:630:33: error: 'double atof(const char*)' conflicts with a previous declaration
extern double atof (const char *); /* X3.159-1989 4.10.1.1 */
^
In file included from /usr/include/stdlib.h:17:0,
from build-gnulib/import/stdlib.h:36,
from /vol/src/gnu/gdb/gdb-7.12/gdb/common/common-defs.h:32,
from /vol/src/gnu/gdb/gdb-7.12/gdb/defs.h:28,
from /vol/src/gnu/gdb/gdb-7.12/gdb/gdb.c:19:
/vol/gcc-4.9/lib/gcc/i386-pc-solaris2.10/4.9.0/include-fixed/iso/stdlib_iso.h:119:15: note: previous declaration 'double std::atof(const char*)'
extern double atof(const char *);
^
This is due to this gem in gdb/defs.h which seems to have been present
like forever:
#ifndef atof
extern double atof (const char *); /* X3.159-1989 4.10.1.1 */
#endif
In the Solaris headers, the appropriate functions are in namespace std,
thus the conflict. I've wrapped the defs.h declaration in !__cplusplus
to avoid this; perhaps it can go completely instead.
* All the casts are necessary to appease g++ and should be pretty
obvious.
* The sol-thread.c changes are here to handle
/vol/src/gnu/gdb/gdb-7.12/gdb/sol-thread.c: In function 'void _initialize_sol_thread()':
/vol/src/gnu/gdb/gdb-7.12/gdb/sol-thread.c:1252:36: error: invalid conversion from 'void*' to 'void (*)(int)' [-fpermissive]
if (!(p_##X = dlsym (dlhandle, #X))) \
^
/vol/src/gnu/gdb/gdb-7.12/gdb/sol-thread.c:1255:3: note: in expansion of macro 'resolve'
resolve (td_log);
^
and are modeled after linux-thread-db.c (try_thread_db_load_1).
The patch allowed both 32 and 64-bit C++ builds on sparc-sun-solaris2.10
and i386-pc-solaris2.10 to complete. The resulting binary hasn't seen
more than a smoke test (invoke it on itself, b main, run) yet.
When investigating the failure to detect -static-libstdc++
support (more below), I found two more issues which only show up with
-Werror:
/vol/src/gnu/gdb/gdb/local/gdb/procfs.c: In function 'ssd* proc_get_LDT_entry(procinfo*, int)':
/vol/src/gnu/gdb/gdb/local/gdb/procfs.c:2487:19: error: variable 'old_chain' set but not used [-Werror=unused-but-set-variable]
struct cleanup *old_chain = NULL;
^
Unless I'm mistaken, you need to run do_cleanups on every return from
the function.
Afterwards, I ran a 32-bit compilation, which (after adding
--disable-largefile to avoid
In file included from /usr/include/sys/procfs.h:28:0,
from /vol/src/gnu/gdb/gdb/local/gdb/i386-sol2-nat.c:23:
/usr/include/sys/old_procfs.h:39:2: error: #error "Cannot use procfs in the large file compilation environment"
#error "Cannot use procfs in the large file compilation environment"
^
and two more instances) revealed
/vol/src/gnu/gdb/gdb/local/gdb/top.c: In function 'void gdb_safe_append_history()':
/vol/src/gnu/gdb/gdb/local/gdb/top.c:1170:59: error: format '%d' expects argument of type 'int', but argument 3 has type 'pid_t {aka long int}' [-Werror=format=]
= xstrprintf ("%s-gdb%d~", history_filename, getpid ());
^
Fixed by casting pid_t to long and printing it as such.
Pedro Alves [Tue, 25 Oct 2016 12:50:20 +0000 (13:50 +0100)]
common/common-defs.h: Define __STDC_FORMAT_MACROS as well
Ref: https://sourceware.org/ml/gdb-patches/2016-10/msg00694.html
gdb/ChangeLog:
2016-10-25 Pedro Alves <palves@redhat.com>
* common/common-defs.h (__STDC_FORMAT_MACROS): Define.
Pedro Alves [Tue, 25 Oct 2016 12:32:26 +0000 (13:32 +0100)]
new-op.c: Add comment about -fsanitize=address
gdb/ChangeLog:
2016-10-25 Pedro Alves <palves@redhat.com>
* common/new-op.c: Add comment about -fsanitize=address.
Pedro Alves [Tue, 25 Oct 2016 10:47:18 +0000 (11:47 +0100)]
Define __STDC_CONSTANT_MACROS/__STDC_LIMIT_MACROS again.
Revert commit
f6abaf7a4088 (gdb: no longer define
__STDC_CONSTANT_MACROS/__STDC_LIMIT_MACROS), with the tweak suggested
in that commit's log: the macros are now defined before any system
header is included.
This should fix AIX:
https://sourceware.org/ml/gdb-patches/2016-10/msg00682.html
gdb/ChangeLog:
2016-10-25 Pedro Alves <palves@redhat.com>
* common/common-defs.h (__STDC_CONSTANT_MACROS)
(__STDC_LIMIT_MACROS): Define.
Yao Qi [Tue, 25 Oct 2016 10:13:00 +0000 (11:13 +0100)]
Don't override operator new if GDB is built with -fsanitize=address
Nowadays, if we build GDB with -fsanitize=address, we can get the asan
error below,
(gdb) quit
=================================================================
==9723==ERROR: AddressSanitizer: alloc-dealloc-mismatch (malloc vs operator delete) on 0x60200003bf70
#0 0x7f88f3837527 in operator delete(void*) (/usr/lib/x86_64-linux-gnu/libasan.so.1+0x55527)
#1 0xac8e13 in __gnu_cxx::new_allocator<void (*)()>::deallocate(void (**)(), unsigned long) /usr/include/c++/4.9/ext/new_allocator.h:110
#2 0xac8cc2 in __gnu_cxx::__alloc_traits<std::allocator<void (*)()> >::deallocate(std::allocator<void (*)()>&, void (**)(), unsigned long) /usr/include/c++/4.9/ext/alloc_traits.h:185
....
0x60200003bf70 is located 0 bytes inside of 8-byte region [0x60200003bf70,0x60200003bf78)
allocated by thread T0 here:
#0 0x7f88f38367ef in __interceptor_malloc (/usr/lib/x86_64-linux-gnu/libasan.so.1+0x547ef)
#1 0xbd2762 in operator new(unsigned long) /home/yao/SourceCode/gnu/gdb/git/gdb/common/new-op.c:42
#2 0xac8edc in __gnu_cxx::new_allocator<void (*)()>::allocate(unsigned long, void const*) /usr/include/c++/4.9/ext/new_allocator.h:104
#3 0xac8d81 in __gnu_cxx::__alloc_traits<std::allocator<void (*)()> >::allocate(std::allocator<void (*)()>&, unsigned long) /usr/include/c++/4.9/ext/alloc_traits.h:182
The reason for this is that we override operator new but don't override
operator delete. This patch does the override if the code is NOT
compiled with asan.
gdb:
2016-10-25 Yao Qi <yao.qi@linaro.org>
PR gdb/20716
* common/new-op.c (__has_feature): New macro.
Don't override operator new if asan is used.
Maciej W. Rozycki [Tue, 25 Oct 2016 01:08:26 +0000 (02:08 +0100)]
elfxx-mips: Correct STUB_JALR's description
bfd/
* elfxx-mips.c (STUB_JALR): Correct description.
GDB Administrator [Tue, 25 Oct 2016 00:00:22 +0000 (00:00 +0000)]
Automatic date update in version.in
Luis Machado [Mon, 24 Oct 2016 22:51:33 +0000 (17:51 -0500)]
Fix potential NULL pointer dereference
This patch addresses a potential NULL pointer dereference when we try to
duplicate a string. The input pointer can be NULL and that may lead to
crashes. We simply add a check for that case.
gdb/ChangeLog:
2016-10-24 Luis Machado <lgustavo@codesourcery.com>
* exec.c (exec_file_locate_attach): Prevent NULL pointer dereference
when duplicating a string.
Luis Machado [Mon, 24 Oct 2016 22:44:56 +0000 (17:44 -0500)]
Fix obvious gotcha in string comparison
This patch fixes a gotcha when comparing exception's messages in
exception_print_same. It should've used the statically-allocated
string versions msg1 and msg2 instead.
As is, it could lead to crashes.
gdb/ChangeLog:
2016-10-24 Luis Machado <lgustavo@codesourcery.com>
* exec.c (exception_print_same): Fix string comparison to use
statically-allocated ones.
Jan Kratochvil [Mon, 24 Oct 2016 12:13:51 +0000 (14:13 +0200)]
testsuite: Fix false FAIL for gdb.base/morestack.exp
Since
[commit] [testsuite patch] Fix gcc_compiled for gcc 6 & 7
https://sourceware.org/ml/gdb-patches/2016-10/msg00620.html
there has started running again
Running gdb/testsuite/gdb.base/morestack.exp ...
+FAIL: gdb.base/morestack.exp: continue
+PASS: gdb.base/morestack.exp: up 3000
but as you can see it FAILs now - on Fedora 24 x86_64 (although for example it
still PASSes on CentOS-7.2 x86_64).
Program received signal SIGSEGV, Segmentation fault.
0x00007ffff787c7bb in malloc_consolidate (av=av@entry=0x7ffff7bbcb00 <main_arena>) at malloc.c:4181
4181 unlink(av, nextchunk, bck, fwd);
(gdb) bt
[...]
[...]
This apparently is due to - man gcc - -fsplit-stack:
When code compiled with -fsplit-stack calls code compiled without
-fsplit-stack, there may not be much stack space available for the
latter code to run. If compiling all code, including library code,
with -fsplit-stack is not an option, then the linker can fix up these
calls so that the code compiled without -fsplit-stack always has
a large stack. Support for this is implemented in the gold linker in
GNU binutils release 2.21 and later.
gdb/testsuite/ChangeLog
2016-10-24 Jan Kratochvil <jan.kratochvil@redhat.com>
* gdb.base/morestack.exp: Try to build it using -fuse-ld=gold first.
Yao Qi [Mon, 24 Oct 2016 09:59:11 +0000 (10:59 +0100)]
[GDBserver] Fix conversion warning
I got the following warning if I build GDBserver for aarch64_be-linux-gnu,
git/gdb/gdbserver/linux-aarch64-low.c:1539:39: error: invalid conversion from 'void*' to 'uint32_t* {aka unsigned int*}' [-fpermissive]
uint32_t *le_buf = xmalloc (byte_len);
^
The patch is to fix the warning.
gdb/gdbserver:
2016-10-24 Yao Qi <yao.qi@linaro.org>
PR server/20733
* linux-aarch64-low.c (append_insns): Cast the return value to
'uint32_t *'.
GDB Administrator [Mon, 24 Oct 2016 00:00:21 +0000 (00:00 +0000)]
Automatic date update in version.in
GDB Administrator [Sun, 23 Oct 2016 00:00:19 +0000 (00:00 +0000)]
Automatic date update in version.in
GDB Administrator [Sat, 22 Oct 2016 00:00:19 +0000 (00:00 +0000)]
Automatic date update in version.in
Tom Tromey [Thu, 20 Oct 2016 03:38:38 +0000 (21:38 -0600)]
Make some dwarf_expr_context methods pure virtual
This patch changes some dwarf_expr_context to be pure virtual, as
mentioned during the discussion of an earlier patch in this series.
2016-10-21 Tom Tromey <tom@tromey.com>
* dwarf2expr.h (class dwarf_expr_context)
<get_frame_base, get_frame_cfa, get_tls_address, dwarf_call,
push_dwarf_block_entry_value, get_addr_index, get_object_address>:
Now pure virtual.
* dwarf2-frame.c (class dwarf_expr_executor)
<get_frame_base, get_frame_cfa, get_tls_address, dwarf_call,
push_dwarf_block_entry_value, get_addr_index, get_object_address>:
New methods.
<invalid>: New method.
Tom Tromey [Fri, 14 Oct 2016 21:19:03 +0000 (15:19 -0600)]
Change minimal_symbol_reader::record_full to take a bool
This changes an "int" to a "bool" in the signature for
minimal_symbol_reader::record_full, and then fixes the callers.
2016-10-21 Tom Tromey <tom@tromey.com>
* minsyms.h (minimal_symbol_reader::record_full): "copy_name" now
a bool.
(record, record_with_info): Update.
* minsyms.c (record): Fix indentation.
(record_full): Fix indentation. Update for type change.
* elfread.c (record_minimal_symbol): "copy_name" now a bool.
(elf_symtab_read): "copy_names" now a bool.
(elf_rel_plt_read, elf_read_minimal_symbols): Update.
Tom Tromey [Wed, 12 Oct 2016 02:02:23 +0000 (20:02 -0600)]
Remove last cleanup from captured_main_1
An earlier patch split captured_main into two parts. This patch
removes the last remaining cleanup from captured_main_1, and also
replaces a second hand-rolled VEC-like array with a std::vector.
2016-10-21 Tom Tromey <tom@tromey.com>
* main.c: Include <vector>.
(cmdarg_s): Remove typedef. Don't define VEC.
(captured_main_1): Use vector, not VEC. Remove cleanups.
Tom Tromey [Mon, 26 Sep 2016 14:59:13 +0000 (08:59 -0600)]
Convert dwarf_expr_context_funcs to methods
This patch converts the function pointers in dwarf_expr_context_funcs
into methods on dwarf_expr_context, and then updates the various
implementations and callers to follow.
NB this patch uses "override" (which caught a couple of renaming bugs
during development) -- but this is C++11, so this patch at least has
to wait for Pedro's patch that adds the OVERRIDE macro.
After this patch it would be possible to do one more, that makes
various members of dwarf_expr_context "protected"; but I haven't done
this.
2016-10-21 Tom Tromey <tom@tromey.com>
* dwarf2loc.c (struct dwarf_expr_context_funcs): Don't declare.
(dwarf_expr_read_addr_from_reg, dwarf_expr_get_reg_value)
(dwarf_expr_read_mem, dwarf_expr_frame_base): Rename; turn into
methods.
(get_frame_pc_for_per_cu_dwarf_call): New function.
(dwarf_expr_frame_cfa, dwarf_expr_frame_pc)
(dwarf_expr_tls_address): Rename; turn into methods.
(per_cu_dwarf_call): Remove arguments. Use
get_frame_pc_for_per_cu_dwarf_call.
(dwarf_evaluate_loc_desc): New class.
(dwarf_expr_dwarf_call, dwarf_expr_context)
(dwarf_expr_push_dwarf_reg_entry_value)
(dwarf_expr_get_addr_index, dwarf_expr_get_obj_addr): Rename; turn
into methods.
(dwarf_expr_ctx_funcs): Remove.
(dwarf2_evaluate_loc_desc_full): Update.
(dwarf2_locexpr_baton_eval): Update.
(symbol_needs_eval_context): New class.
(symbol_needs_read_addr_from_reg, symbol_needs_get_reg_value)
(symbol_needs_read_mem, symbol_needs_frame_base)
(symbol_needs_frame_cfa, symbol_needs_tls_address)
(symbol_needs_dwarf_call, needs_dwarf_reg_entry_value): Rename;
turn into methods.
(needs_get_addr_index, needs_get_obj_addr): Remove; turn into
methods.
(symbol_needs_ctx_funcs): Remove.
(dwarf2_loc_desc_get_symbol_read_needs): Update.
* dwarf2expr.h (struct dwarf_expr_context_funcs): Remove; turn
contents into methods.
(struct dwarf_expr_context) <baton, funcs>: Remove.
<read_addr_from_reg, get_reg_value, read_mem, get_frame_base,
get_frame_cfa, get_frame_pc, get_tls_address, dwarf_call,
impl_get_base_type, push_dwarf_block_entry_value, get_addr_index,
get_object_address>: Declare new methods.
(ctx_no_get_frame_base, ctx_no_get_frame_cfa)
(ctx_no_get_frame_pc, ctx_no_get_tls_address, ctx_no_dwarf_call)
(ctx_no_get_base_type, ctx_no_push_dwarf_reg_entry_value)
(ctx_no_get_addr_index): Don't declare.
* dwarf2expr.c (get_base_type): Use impl_get_base_type.
(execute_stack_op): Update.
(ctx_no_get_frame_base, ctx_no_get_frame_cfa)
(ctx_no_get_frame_pc, ctx_no_get_tls_address, ctx_no_dwarf_call)
(ctx_no_get_base_type, ctx_no_push_dwarf_reg_entry_value)
(ctx_no_get_addr_index): Remove; now methods on
dwarf_expr_context.
* dwarf2-frame.c (read_addr_from_reg): Take a frame_info, not a
baton.
(class dwarf_expr_executor): New class.
(get_reg_value, read_mem): Rename, turn into methods.
(execute_stack_op): Use dwarf_expr_executor.
Tom Tromey [Sun, 25 Sep 2016 22:48:47 +0000 (16:48 -0600)]
Convert DWARF expr functions to methods
This converts various DWARF expr functions to be members on
dwarf_expr_context, then fixes up the various users. This results in
somewhat less wordy code and sets the stage for the next patch.
2016-10-21 Tom Tromey <tom@tromey.com>
* dwarf2loc.c (per_cu_dwarf_call)
(dwarf_expr_push_dwarf_reg_entry_value)
(dwarf2_evaluate_loc_desc_full, dwarf2_locexpr_baton_eval)
(needs_dwarf_reg_entry_value)
(dwarf2_loc_desc_get_symbol_read_needs): Update.
* dwarf2expr.h (dwarf_expr_context) <push_address, eval, fetch,
fetch_address, fetch_in_stack_memory, address_type, grow_stack,
push, stack_empty_p, add_piece, get_base_type, execute_stack_op,
pop>: New method declarations.
(dwarf_expr_push_address, dwarf_expr_eval, dwarf_expr_fetch)
(dwarf_expr_fetch_address, dwarf_expr_fetch_in_stack_memory):
Don't declare.
* dwarf2expr.c (address_type, grow_stack, push, push_address)
(pop, fetch, fetch_address, fetch_in_stack_memory)
(stack_empty_p, add_piece, eval, get_base_type)
(execute_stack_op): Rename. Turn into methods.
* dwarf2-frame.c (execute_stack_op): Update.
Tom Tromey [Sun, 25 Sep 2016 22:28:03 +0000 (16:28 -0600)]
Initial conversion of dwarf_expr_ctx
This is the first step in the conversion of dwarf_expr_ctx to a C++
class. This conversion is done in steps to make the patches, and the
reviews, a bit simpler. This patch changes dwarf_expr_ctx to be
stack-allocated and removes the associated cleanup.
2016-10-21 Tom Tromey <tom@tromey.com>
* dwarf2loc.c (dwarf2_evaluate_loc_desc_full): Stack-allocate
dwarf_expr_context. Remove cleanups.
(dwarf2_locexpr_baton_eval)
(dwarf2_loc_desc_get_symbol_read_needs): Likewise.
* dwarf2expr.h (dwarf_expr_context, ~dwarf_expr_context): Add
constructors and destructors.
(new_dwarf_expr_context, free_dwarf_expr_context)
(make_cleanup_free_dwarf_expr_context): Don't declare.
* dwarf2-frame.c (execute_stack_op): Stack-allocate
dwarf_expr_context. Remove cleanups.
(dwarf_expr_context): Rename from new_dwarf_expr_context. Turn
into constructor.
(free_dwarf_expr_context, free_dwarf_expr_context_cleanup):
Remove.
(~dwarf_expr_context): Rename from
make_cleanup_free_dwarf_expr_context. Turn into destructor.
Tom Tromey [Sun, 25 Sep 2016 22:17:15 +0000 (16:17 -0600)]
Some cleanup removal in dwarf2loc.c
This removes some cleanups and manual allocation handling in
dwarf2loc.c with std::vector. Note that this patch has a case where
the vector would normally fall into the "use gdb::unique_ptr"
guidelines -- but here because the vector is immediately initialized,
I moved the initialization into the constructor call, for further
code savings.
2016-10-21 Tom Tromey <tom@tromey.com>
* dwarf2loc.c: Include <vector>.
(read_pieced_value, write_pieced_value)
(dwarf2_compile_expr_to_ax): Use std::vector.
Tom Tromey [Sun, 25 Sep 2016 03:53:54 +0000 (21:53 -0600)]
Remove make_cleanup_restore_current_uiout
This removes make_cleanup_restore_current_uiout in favor of an
RAII-based class.
2016-10-21 Tom Tromey <tom@tromey.com>
* stack.c (print_stack_frame_to_uiout): Use scoped_restore.
* ui-out.c (make_cleanup_restore_current_uiout)
(restore_current_uiout_cleanup): Remove.
* infrun.c (print_stop_event): Use scoped_restore.
* ui-out.h (make_cleanup_restore_current_uiout): Don't declare.
Tom Tromey [Sun, 25 Sep 2016 03:31:36 +0000 (21:31 -0600)]
Use gdb::unique_ptr in elf_read_minimal_symbols
This changes elf_read_minimal_symbols to use gdb::unique_ptr rather
than an explicit allocation. This removes a cleanup.
2016-10-21 Tom Tromey <tom@tromey.com>
* elfread.c (elf_read_minimal_symbols): Use gdb::unique_ptr.
Tom Tromey [Sun, 25 Sep 2016 03:21:35 +0000 (21:21 -0600)]
Replace two xmallocs with unique_ptr
This replaces a couple of uses of xmalloc with gdb::unique_ptr, also
removing a couple of cleanups.
2016-10-21 Tom Tromey <tom@tromey.com>
* cli/cli-dump.c (dump_memory_to_file): Use gdb::unique_ptr.
(restore_binary_file): Likewise.
Tom Tromey [Sun, 25 Sep 2016 03:10:45 +0000 (21:10 -0600)]
Change command stats reporting to use class
This removes make_command_stats_cleanup in favor of an RAII class.
The patch is reasonably straightforward, but keeping the same
semantics without excessive reindentation required splitting
captured_main in two.
2016-10-21 Tom Tromey <tom@tromey.com>
* maint.h (scoped_command_stats): New class.
(make_command_stats_cleanup): Don't declare.
* maint.c (struct cmd_stats): Remove.
(~scoped_command_stats): Rename from report_command_stats. Now a
destructor.
(scoped_command_stats): Rename from make_command_stats_cleanup.
Now a constructor.
* main.c (captured_main_1): New function. Use
scoped_command_stats.
(captured_main): Call captured_main_1.
* event-top.c (command_handler): Use scoped_command_stats.
Tom Tromey [Sun, 25 Sep 2016 02:56:12 +0000 (20:56 -0600)]
Remove some cleanups in MI
This patch removes a couple of cleanups from MI by using
gdb::unique_ptr.
2016-10-21 Tom Tromey <tom@tromey.com>
* mi/mi-main.c (mi_cmd_data_read_memory): Use gdb::unique_ptr.
Remove some cleanups.
Tom Tromey [Sat, 24 Sep 2016 22:11:14 +0000 (16:11 -0600)]
Remove make_cleanup_restore_current_ui
This removes make_cleanup_restore_current_ui by converting the last
use. The last use was in a few functions used to iterate over all
UIs. This patch replaces these functions with a class, and arranges
for the class destructor to do the needed cleanup.
2016-10-21 Tom Tromey <tom@tromey.com>
* tui/tui-interp.c (tui_on_normal_stop, tui_on_signal_received)
(tui_on_end_stepping_range, tui_on_signal_exited, tui_on_exited)
(tui_on_no_history, tui_on_user_selected_context_changed):
Update.
* top.h (switch_thru_all_uis): New class.
(SWITCH_THRU_ALL_UIS): Rewrite.
(make_cleanup_restore_current_ui, switch_thru_all_uis_init)
(switch_thru_all_uis_cond, switch_thru_all_uis_next): Don't
declare.
* mi/mi-interp.c (mi_new_thread, mi_thread_exit)
(mi_record_changed, mi_inferior_added, mi_inferior_appeared)
(mi_inferior_exit, mi_inferior_removed, mi_on_signal_received)
(mi_on_end_stepping_range, mi_on_signal_exited, mi_on_exited)
(mi_on_no_history, mi_on_normal_stop, mi_traceframe_changed)
(mi_tsv_created, mi_tsv_deleted, mi_tsv_modified)
(mi_breakpoint_created, mi_breakpoint_deleted)
(mi_breakpoint_modified, mi_output_running_pid, mi_on_resume)
(mi_solib_loaded, mi_solib_unloaded, mi_command_param_changed)
(mi_memory_changed, mi_user_selected_context_changed): Update.
* infrun.c (all_uis_check_sync_execution_done)
(all_uis_on_sync_execution_starting, normal_stop): Update.
* event-top.c (restore_ui_cleanup)
(make_cleanup_restore_current_ui, switch_thru_all_uis_init)
(switch_thru_all_uis_cond, switch_thru_all_uis_next): Remove.
* cli/cli-interp.c (cli_on_normal_stop, cli_on_signal_received)
(cli_on_end_stepping_range, cli_on_signal_exited, cli_on_exited)
(cli_on_no_history, cli_on_user_selected_context_changed):
Update.
* breakpoint.c (watchpoint_check): Update.
Tom Tromey [Thu, 22 Sep 2016 20:25:08 +0000 (14:25 -0600)]
Record minimal symbols directly in reader.
This patch changes minimal symbol creation in two ways. First, it
removes global variables in favor of members of minimal_symbol_reader.
Second, it changes functions like prim_record_minimal_symbol to be
member functions of minimal_symbol_reader.
2016-10-21 Tom Tromey <tom@tromey.com>
* xcoffread.c (record_minimal_symbol, scan_xcoff_symtab): Add
"reader" argument. Update.
(xcoff_initial_scan): Update.
* symfile.h (mdebug_build_psymtabs): Add "reader" argument.
* mipsread.c (mipscoff_symfile_read): Update.
(read_alphacoff_dynamic_symtab): Add "reader" argument. Update.
* minsyms.h (minimal_symbol_reader) <record, record_full>:
Declare.
<m_msym_bunch, m_msym_bunch_index, m_msym_count>: New members.
<record_with_info>: New function, renamed from
prim_record_minimal_symbol_and_info.
* minsyms.c (msym_bunch, msym_bunch_index, msym_count): Remove
globals.
(minimal_symbol_reader): Initialize new members.
(minimal_symbol_reader::record): Renamed from
prim_record_minimal_symbol.
(minimal_symbol_reader::record_full): Renamed from
prim_record_minimal_symbol_full.
(prim_record_minimal_symbol_and_info): Move to minsyms.h; rename.
* mdebugread.c (mdebug_build_psymtabs, parse_partial_symbols)
(record_minimal_symbol): Add "reader" argument. Update.
(elfmdebug_build_psymtabs): Update.
* machoread.c (macho_symtab_add_minsym, macho_symtab_read): Add
"reader" argument. Update.
(macho_symfile_read): Update.
* elfread.c (record_minimal_symbol, elf_symtab_read)
(elf_rel_plt_read): Add "reader" argument. Update.
(elf_read_minimal_symbols): Update.
* dbxread.c (record_minimal_symbol, read_dbx_dynamic_symtab)
(read_dbx_symtab): Add "reader" argument. Update.
(dbx_symfile_read): Update.
* coffread.c (record_minimal_symbol, coff_symtab_read): Add
"reader" argument. Update.
(coff_symfile_read): Update.
* coff-pe-read.h (read_pe_exported_syms): Add "reader" argument.
* coff-pe-read.c (add_pe_exported_sym, add_pe_forwarded_sym)
(read_pe_exported_syms): Add "reader" argument. Update.
Tom Tromey [Thu, 22 Sep 2016 19:57:15 +0000 (13:57 -0600)]
Change minimal_symbol_reader to store objfile
This changes minimal_symbol_reader to require the objfile to be
passed to the constructor. The class now records the objfile and
automatically uses it later in "install".
This is a minor cleanup that will come in useful in the next patch.
It is separate from the first patch to keep that one a bit simpler to
understand.
2016-10-21 Tom Tromey <tom@tromey.com>
* xcoffread.c (xcoff_initial_scan): Update.
* mipsread.c (mipscoff_symfile_read): Update.
* minsyms.c (minimal_symbol_reader): Add obj argument.
Initialize member.
(install): Remove objfile argument. Update.
* mdebugread.c (elfmdebug_build_psymtabs): Update.
* machoread.c (macho_symfile_read): Update.
* elfread.c (elf_read_minimal_symbols): Update.
* dbxread.c (dbx_symfile_read): Update.
* coffread.c (coff_symfile_read): Update.
* minsyms.h (minimal_symbol_reader): Add m_objfile member.
(constructor): Add objfile argument.
(minimal_symbol_reader::install): Remove objfile argument.
Tom Tromey [Thu, 22 Sep 2016 19:47:48 +0000 (13:47 -0600)]
Introduce minimal_symbol_reader
This patch introduced minimal_symbol_reader, a RAII-based class which
replaces the current make_cleanup_discard_minimal_symbols.
2016-10-21 Tom Tromey <tom@tromey.com>
* xcoffread.c (xcoff_initial_scan): Use
minimal_symbol_reader.
* mipsread.c (mipscoff_symfile_read): Use
minimal_symbol_reader.
* minsyms.h (minimal_symbol_reader): New class.
(init_minimal_symbol_collection)
(make_cleanup_discard_minimal_symbols, install_minimal_symbols):
Don't declare.
* minsyms.c (minimal_symbol_reader): Renamed from
init_minimal_symbol_collection, turned into constructor.
(~minimal_symbol_reader): Renamed from
do_discard_minimal_symbols_cleanup, turned into destructor.
(make_cleanup_discard_minimal_symbols): Remove.
(minimal_symbol_reader::install): Rename form
install_minimal_symbols.
* mdebugread.c (elfmdebug_build_psymtabs): Use
minimal_symbol_reader.
* machoread.c (macho_symfile_read): Use
minimal_symbol_reader.
* elfread.c (elf_read_minimal_symbols): Use
minimal_symbol_reader.
* dbxread.c (dbx_symfile_read): Use minimal_symbol_reader.
* coffread.c (coff_symfile_read): Use
minimal_symbol_reader.
Tom Tromey [Fri, 23 Sep 2016 02:50:52 +0000 (20:50 -0600)]
Use scoped_restore for current_ui
This changes most uses of make_cleanup_restore_current_ui to use
scoped_restore. The use in switch_thru_all_uis_init still remains;
that is dealt with in a later patch by replacing this iterator with a
real class.
2016-10-21 Tom Tromey <tom@tromey.com>
* top.c (new_ui_command, wait_sync_command_done)
(gdb_readline_wrapper): Use scoped_restore.
* infrun.c (fetch_inferior_event): Use scoped_restore.
* infcall.c (call_thread_fsm_should_stop): Use scoped_restore.
Tom Tromey [Fri, 23 Sep 2016 02:33:30 +0000 (20:33 -0600)]
Use scoped_restore for ui_file
This replaces all the uses of make_cleanup_restore_ui_file with
scoped_restore.
2016-10-21 Tom Tromey <tom@tromey.com>
* utils.c (make_cleanup_restore_ui_file, do_restore_ui_file)
(struct restore_ui_file_closure): Remove.
* utils.h (make_cleanup_restore_ui_file): Don't declare.
* guile/scm-ports.c (ioscm_with_output_to_port_worker): Use
scoped_restore.
* top.c (execute_command_to_string): Use scoped_restore.
Tom Tromey [Fri, 23 Sep 2016 02:29:11 +0000 (20:29 -0600)]
Use RAII to save and restore scalars
This patch replaces many (but not all) uses of
make_cleanup_restore_integer with a simple RAII-based template class.
It also removes the similar restore_execution_direction cleanup in
favor of this new class. Subsequent patches will replace other
similar cleanups with this class.
The class is typically instantiated using make_scoped_restore. This
allows for template argument deduction.
2016-10-21 Tom Tromey <tom@tromey.com>
* common/scoped_restore.h: New file.
* utils.h: Include scoped_restore.h.
* top.c (execute_command_to_string): Use scoped_restore.
* python/python.c (python_interactive_command): Use
scoped_restore.
(python_command, execute_gdb_command): Likewise.
* printcmd.c (do_one_display): Use scoped_restore.
* mi/mi-main.c (exec_continue): Use scoped_restore.
* mi/mi-cmd-var.c (mi_cmd_var_assign): Use scoped_restore.
* linux-fork.c (checkpoint_command): Use scoped_restore.
* infrun.c (restore_execution_direction): Remove.
(fetch_inferior_event): Use scoped_restore.
* compile/compile.c (compile_file_command): Use
scoped_restore.
(compile_code_command, compile_print_command): Likewise.
* cli/cli-script.c (execute_user_command): Use
scoped_restore.
(while_command, if_command, script_from_file): Likewise.
* arm-tdep.c (arm_insert_single_step_breakpoint): Use
scoped_restore.
Tom Tromey [Fri, 21 Oct 2016 20:09:57 +0000 (14:09 -0600)]
Fix build failure in xcoffread.c
This changes read_xcoff_symtab to be const-correct. This fixes a
build failure.
2016-10-21 Tom Tromey <tom@tromey.com>
* xcoffread.c (read_xcoff_symtab): Make "filestring" const.
H.J. Lu [Fri, 21 Oct 2016 19:16:32 +0000 (12:16 -0700)]
X86: Remove pcommit instruction
Remove x86 pcommit instruction support, which has been deprecated:
https://software.intel.com/en-us/blogs/2016/09/12/deprecate-pcommit-instruction
gas/
* config/tc-i386.c (cpu_arch): Remove .pcommit.
* doc/c-i386.texi: Likewise.
* testsuite/gas/i386/i386.exp: Remove pcommit tests.
* testsuite/gas/i386/pcommit-intel.d: Removed.
* testsuite/gas/i386/pcommit.d: Likewise.
* testsuite/gas/i386/pcommit.s: Likewise.
* testsuite/gas/i386/x86-64-pcommit-intel.d: Likewise.
* testsuite/gas/i386/x86-64-pcommit.d: Likewise.
* testsuite/gas/i386/x86-64-pcommit.s: Likewise.
opcodes/
* i386-dis.c (PREFIX_RM_0_0FAE_REG_7): Removed.
(prefix_table): Remove the PREFIX_RM_0_0FAE_REG_7 entry.
(rm_table): Update the RM_0FAE_REG_7 entry.
* i386-gen.c (cpu_flag_init): Remove CPU_PCOMMIT_FLAGS.
(cpu_flags): Remove CpuPCOMMIT.
* i386-opc.h (CpuPCOMMIT): Removed.
(i386_cpu_flags): Remove cpupcommit.
* i386-opc.tbl: Remove pcommit.
* i386-init.h: Regenerated.
* i386-tbl.h: Likewise.
Gergely Nagy [Fri, 21 Oct 2016 18:08:20 +0000 (11:08 -0700)]
Fix PR 17704.
This fix keeps the section with the highest alignment when folding sections with ICF.
PR gold/17704
* icf.cc (match_sections): Add new parameter section_addraligns.
Check section alignment and keep the section with the strictest
alignment.
(find_identical_sections): New local variable section_addraligns.
Store each section's alignment.
* testsuite/pr17704a_test.s: New file.
* testsuite/Makefile.am (pr17704a_test): New test.
* testsuite/Makefile.in: Regenerate.
Ulrich Weigand [Fri, 21 Oct 2016 15:47:15 +0000 (17:47 +0200)]
Fix symbol table file name on AIX
When xlc -qfuncsect or gcc -ffunction-sections options is used in AIX,
each function csect is associated with each psymtab, so each psymtab
will have it's corresponding filename entries set.
If the pst filename isn't set then we will be seeing the below output
when we set a breakpoint.
(gdb) br main
Breakpoint 1 at 0x10000374: file _start_ , line 18.
With the fix it will be.
(gdb) br main
Breakpoint 1 at 0x10000518: file test.c, line 24.
Attached patch resolve this issue and correct filename will be set.
gdb/
2016-10-21 Sangamesh Mallayya <sangamesh.swamy@in.ibm.com>
Ulrich Weigand <uweigand@de.ibm.com>
* xcoffread.c (read_xcoff_symtab): Make name of current file as
pst->filename instead of _start_ in AIX.
Signed-off-by: Ulrich Weigand <ulrich.weigand@de.ibm.com>
Philipp Rudo [Fri, 21 Oct 2016 10:32:52 +0000 (12:32 +0200)]
Delete target_so_ops->special_symbol_handling hook
No one(!) actually implements this hook. So simply delete it.
gdb/ChangeLog:
* solist.h (struct target_so_ops): Delete special_symbol_handling
hook.
* solib.c (solib_add, reload_shared_libraries): Adjust.
* solib-aix.c (solib_aix_special_symbol_handling): Delete
(_initialize_solib_aix): Adjust
* solib-darwin.c (darwin_special_symbol_handling): Delete
(_initialize_darwin_solib): Adjust
* solib-dsbt.c (dsbt_special_symbol_handling): Delete
(_initialize_dsbt_solib): Adjust
* solib-frv.c (frv_special_symbol_handling): Delete
(_initialize_frv_solib): Adjust
* solib-svr4.c (svr4_special_symbol_handling): Delete
(_initialize_svr4_solib): Adjust
* solib-target.c (solib_target_special_symbol_handling): Delete
(_initialize_solib_target): Adjust
GDB Administrator [Fri, 21 Oct 2016 00:00:20 +0000 (00:00 +0000)]
Automatic date update in version.in
H.J. Lu [Thu, 20 Oct 2016 22:07:42 +0000 (15:07 -0700)]
Check invalid mask registers
In 32-bit, the REX_B bit in the 3-byte VEX prefix is ignored and the
the highest bit in VEX.vvvv is either 1 or ignored. In 64-bit, we
need to check invalid mask registers.
gas/
PR binutis/20705
* testsuite/gas/i386/i386.exp: Run x86-64-opcode-bad.
* testsuite/gas/i386/x86-64-opcode-bad.d: New file.
* testsuite/gas/i386/x86-64-opcode-bad.s: Likewise.
opcodes/
PR binutis/20705
* i386-dis.c (get_valid_dis386): Ignore the REX_B bit and
the highest bit in VEX.vvvv for the 3-byte VEX prefix in
32-bit mode. Don't check vex.register_specifier in 32-bit
mode.
(OP_E_register): Check invalid mask registers.
(OP_G): Likewise.
(OP_VEX): Likewise.
Jan Kratochvil [Thu, 20 Oct 2016 19:58:54 +0000 (21:58 +0200)]
testsuite: Fix gcc_compiled for gcc 6 & 7
gdb/testsuite/ChangeLog
2016-10-20 Jan Kratochvil <jan.kratochvil@redhat.com>
* lib/gdb.exp (get_compiler_info): Generalize gcc_compile regexp.
Nick Clifton [Thu, 20 Oct 2016 10:44:51 +0000 (11:44 +0100)]
Regenerate bfd.pot.
Yao Qi [Thu, 20 Oct 2016 10:33:07 +0000 (11:33 +0100)]
Don't configure gdb for vxworks target
VxWorks support was removed in 2004.
commit
e84ecc995d6a5e4e9114d3cea61717b8a573afb6
Author: Andrew Cagney <cagney@redhat.com>
Date: Sat Nov 13 23:10:02 2004 +0000
2004-11-13 Andrew Cagney <cagney@gnu.org>
* configure.tgt: Delete i[34567]86-*-vxworks*, m68*-netx-*,
m68*-*-vxworks*, mips*-*-vxworks*, powerpc-*-vxworks*, and
sparc-*-vxworks*.
* NEWS: Mention that vxworks was deleted.
This patch adds *-*-vxworks* in a list of targets GDB doesn't
support.
gdb:
2016-10-20 Yao Qi <yao.qi@linaro.org>
* configure.tgt: Don't configure if target is *-*-vxworks*.
GDB Administrator [Thu, 20 Oct 2016 00:00:22 +0000 (00:00 +0000)]
Automatic date update in version.in
Maciej W. Rozycki [Wed, 19 Oct 2016 17:20:54 +0000 (18:20 +0100)]
testsuite: Fix gdb.base/killed-outside.exp using irrelevant stale options
Fix a commit
4a556533cf02 ("Fix PR11094: JIT breakpoint is not properly
recreated on reruns") regression:
Running .../gdb/testsuite/gdb.base/killed-outside.exp ...
Executing on host: mips-mti-linux-gnu-gcc -Wl,--no-as-needed -c -g -o .../gdb/testsuite/outputs/gdb.base/killed-outside/killed-outside0.o .../gdb/testsuite/gdb.base/killed-outside.c .../gdb/testsuite/outputs/gdb.base/jit-simple/jit-simple-jit.so (timeout = 300)
spawn mips-mti-linux-gnu-gcc -Wl,--no-as-needed -c -g -o .../gdb/testsuite/outputs/gdb.base/killed-outside/killed-outside0.o .../gdb/testsuite/gdb.base/killed-outside.c .../gdb/testsuite/outputs/gdb.base/jit-simple/jit-simple-jit.so
mips-mti-linux-gnu-gcc: warning: .../gdb/testsuite/outputs/gdb.base/jit-simple/jit-simple-jit.so: linker input file unused because linking not done
output is:
mips-mti-linux-gnu-gcc: warning: .../gdb/testsuite/outputs/gdb.base/jit-simple/jit-simple-jit.so: linker input file unused because linking not done
gdb compile failed, mips-mti-linux-gnu-gcc: warning: .../gdb/testsuite/outputs/gdb.base/jit-simple/jit-simple-jit.so: linker input file unused because linking not done
UNTESTED: gdb.base/killed-outside.exp: failed to prepare
and adjust the call to `prepare_for_testing' by removing a reference to
`options', which is not set in this test case but a stale value is
carried over from `gdb.base/jit-simple.exp' previously executed in a
full test suite run.
gdb/testsuite/
* gdb.base/killed-outside.exp: Remove $options from a call to
`prepare_for_testing'.
Nick Clifton [Wed, 19 Oct 2016 13:04:34 +0000 (14:04 +0100)]
Add c-format tags to translatable strings with more than one argument-using formatting token.
* aout-adobe.c: Add missing c-format tags for translatable strings.
* aout-cris.c: Likewise.
* aoutx.h: Likewise.
* bfd.c: Likewise.
* binary.c: Likewise.
* cache.c: Likewise.
* coff-alpha.c: Likewise.
* coff-arm.c: Likewise.
* coff-i860.c: Likewise.
* coff-mcore.c: Likewise.
* coff-ppc.c: Likewise.
* coff-rs6000.c: Likewise.
* coff-sh.c: Likewise.
* coff-tic4x.c: Likewise.
* coff-tic54x.c: Likewise.
* coff-tic80.c: Likewise.
* coff64-rs6000.c: Likewise.
* coffcode.h: Likewise.
* coffgen.c: Likewise.
* cofflink.c: Likewise.
* coffswap.h: Likewise.
* cpu-arm.c: Likewise.
* dwarf2.c: Likewise.
* ecoff.c: Likewise.
* elf-attrs.c: Likewise.
* elf-eh-frame.c: Likewise.
* elf-ifunc.c: Likewise.
* elf-m10300.c: Likewise.
* elf-s390-common.c: Likewise.
* elf.c: Likewise.
* elf32-arc.c: Likewise.
* elf32-arm.c: Likewise.
* elf32-avr.c: Likewise.
* elf32-bfin.c: Likewise.
* elf32-cr16.c: Likewise.
* elf32-cr16c.c: Likewise.
* elf32-cris.c: Likewise.
* elf32-crx.c: Likewise.
* elf32-d10v.c: Likewise.
* elf32-d30v.c: Likewise.
* elf32-epiphany.c: Likewise.
* elf32-fr30.c: Likewise.
* elf32-frv.c: Likewise.
* elf32-gen.c: Likewise.
* elf32-hppa.c: Likewise.
* elf32-i370.c: Likewise.
* elf32-i386.c: Likewise.
* elf32-i960.c: Likewise.
* elf32-ip2k.c: Likewise.
* elf32-iq2000.c: Likewise.
* elf32-lm32.c: Likewise.
* elf32-m32c.c: Likewise.
* elf32-m32r.c: Likewise.
* elf32-m68hc11.c: Likewise.
* elf32-m68hc12.c: Likewise.
* elf32-m68hc1x.c: Likewise.
* elf32-m68k.c: Likewise.
* elf32-mcore.c: Likewise.
* elf32-mep.c: Likewise.
* elf32-metag.c: Likewise.
* elf32-microblaze.c: Likewise.
* elf32-moxie.c: Likewise.
* elf32-msp430.c: Likewise.
* elf32-mt.c: Likewise.
* elf32-nds32.c: Likewise.
* elf32-nios2.c: Likewise.
* elf32-or1k.c: Likewise.
* elf32-pj.c: Likewise.
* elf32-ppc.c: Likewise.
* elf32-rl78.c: Likewise.
* elf32-rx.c: Likewise.
* elf32-s390.c: Likewise.
* elf32-score.c: Likewise.
* elf32-score7.c: Likewise.
* elf32-sh-symbian.c: Likewise.
* elf32-sh.c: Likewise.
* elf32-sh64.c: Likewise.
* elf32-spu.c: Likewise.
* elf32-tic6x.c: Likewise.
* elf32-tilepro.c: Likewise.
* elf32-v850.c: Likewise.
* elf32-vax.c: Likewise.
* elf32-visium.c: Likewise.
* elf32-xgate.c: Likewise.
* elf32-xtensa.c: Likewise.
* elf64-alpha.c: Likewise.
* elf64-gen.c: Likewise.
* elf64-hppa.c: Likewise.
* elf64-ia64-vms.c: Likewise.
* elf64-mmix.c: Likewise.
* elf64-ppc.c: Likewise.
* elf64-s390.c: Likewise.
* elf64-sh64.c: Likewise.
* elf64-sparc.c: Likewise.
* elf64-x86-64.c: Likewise.
* elfcode.h: Likewise.
* elfcore.h: Likewise.
* elflink.c: Likewise.
* elfnn-aarch64.c: Likewise.
* elfnn-ia64.c: Likewise.
* elfxx-mips.c: Likewise.
* elfxx-sparc.c: Likewise.
* elfxx-tilegx.c: Likewise.
* ieee.c: Likewise.
* ihex.c: Likewise.
* libbfd.c: Likewise.
* linker.c: Likewise.
* m68klinux.c: Likewise.
* mach-o.c: Likewise.
* merge.c: Likewise.
* mmo.c: Likewise.
* oasys.c: Likewise.
* pdp11.c: Likewise.
* pe-mips.c: Likewise.
* peXXigen.c: Likewise.
* pei-x86_64.c: Likewise.
* peicode.h: Likewise.
* ppcboot.c: Likewise.
* reloc.c: Likewise.
* sparclinux.c: Likewise.
* srec.c: Likewise.
* stabs.c: Likewise.
* vms-alpha.c: Likewise.
* vms-lib.c: Likewise.
* xcofflink.c: Likewise.
Nick Clifton [Tue, 18 Oct 2016 11:02:52 +0000 (12:02 +0100)]
Remove spurious whitespace introduced by previous delta.
Pedro Alves [Wed, 19 Oct 2016 13:35:06 +0000 (14:35 +0100)]
Regen gdb/config.in
gdb/ChangeLog:
2016-10-19 Pedro Alves <palves@redhat.com>
* config.in: Regenerate.
Renlin Li [Wed, 19 Oct 2016 10:18:56 +0000 (11:18 +0100)]
[GAS][ARM]Generate unpredictable warning for pc used in data processing instructions with register-shifted register operand.
gas/
2016-10-19 Renlin Li <renlin.li@arm.com>
* config/tc-arm.c (encode_arm_shift): Generate unpredictable warning
for register-shifted register instructions.
* testsuite/gas/arm/shift-bad-pc.d: New.
* testsuite/gas/arm/shift-bad-pc.l: New.
* testsuite/gas/arm/shift-bad-pc.s: New.
GDB Administrator [Wed, 19 Oct 2016 00:00:22 +0000 (00:00 +0000)]
Automatic date update in version.in
Pedro Alves [Tue, 18 Oct 2016 19:48:37 +0000 (20:48 +0100)]
gdb: no longer define __STDC_CONSTANT_MACROS/__STDC_LIMIT_MACROS
My gnulib fix at:
https://lists.gnu.org/archive/html/bug-gnulib/2015-11/msg00010.html
was merged upstream meanwhile and our gnulib copy now includes it.
As a concidence, Kevin was telling me today that these macros are
causing a build problem on FreeBSD:
common/common-defs.h:47:0: error: "__STDC_CONSTANT_MACROS" redefined [-Werror]
#define __STDC_CONSTANT_MACROS 1
/usr/include/sys/cdefs.h:408:0: note: this is the location of the previous definition
#define __STDC_CONSTANT_MACROS
(and a similar error for __STDC_LIMIT_MACROS)
The problem seems to be that we should be defining these input macros
before including any system header, but, we're not.
So let's just revert
e063da67902e ([C++] Define __STDC_CONSTANT_MACROS
/ __STDC_LIMIT_MACROS for stdint.h). If this causes a problem
somewhere, we can re-define the macros higher up in the file, before
system headers are included.
gdb/ChangeLog:
2016-10-18 Pedro Alves <palves@redhat.com>
* common/common-defs.h (__STDC_CONSTANT_MACROS)
(__STDC_LIMIT_MACROS): Delete.
Pedro Alves [Tue, 18 Oct 2016 16:18:29 +0000 (17:18 +0100)]
Update gnulib to current upstream master
I tried building gdb with G++ 4.7 and CXX="g++ -std=gnu+11", and that
tripped on a build error:
In file included from build-gnulib/import/stdio.h:53:0,
from /home/pedro/gdb/mygit/cxx-convertion/src/gdb/common/common-defs.h:31,
from /home/pedro/gdb/mygit/cxx-convertion/src/gdb/defs.h:28,
from /home/pedro/gdb/mygit/cxx-convertion/src/gdb/armobsd-tdep.c:20:
build-gnulib/import/stddef.h:104:3: error: conflicting declaration ‘typedef union max_align_t max_align_t’
In file included from build-gnulib/import/stddef.h:55:0,
from build-gnulib/import/stdio.h:53,
from /home/pedro/gdb/mygit/cxx-convertion/src/gdb/common/common-defs.h:31,
from /home/pedro/gdb/mygit/cxx-convertion/src/gdb/defs.h:28,
from /home/pedro/gdb/mygit/cxx-convertion/src/gdb/armobsd-tdep.c:20:
/opt/gcc-4.7/lib/gcc/x86_64-unknown-linux-gnu/4.7.4/include/stddef.h:426:3: error: ‘max_align_t’ has a previous declaration as ‘typedef struct max_align_t max_align_t’
Updating gnulib to current master fixes it, since it brings in this
fix:
http://lists.gnu.org/archive/html/bug-gnulib/2016-04/msg00000.html
Our last update was in August 2015. This doesn't bring in much added
baggage, it's mostly bug fixes. It pulled in the "limits-h" module as
automatic dependency, and given that looks potentially useful I added
it to the set of modules we require.
Tested on x86_64 Fedora 23, with g++ 4.7 and g++ 5.3, native and gdbserver.
gdb/ChangeLog:
2016-10-18 Pedro Alves <palves@redhat.com>
* gnulib/update-gnulib.sh (GNULIB_COMMIT_SHA1): Set to
2692e23a48e21f6daa029e8af9f1a143b7532f47.
* gnulib/configure, gnulib/config.in, gnulib/aclocal.m4:
Regenerate.
* gnulib/import/Makefile: Update.
* gnulib/import/alloca: Update.
* gnulib/import/basename-lgpl: Update.
* gnulib/import/canonicalize-lgpl: Update.
* gnulib/import/config: Update.
* gnulib/import/dirent: Update.
* gnulib/import/dirfd: Update.
* gnulib/import/dirname-lgpl: Update.
* gnulib/import/dirname.h: Update.
* gnulib/import/dosname.h: Update.
* gnulib/import/errno: Update.
* gnulib/import/extra/snippet/arg-nonnull.h: Update.
* gnulib/import/extra/snippet/c++defs.h: Update.
* gnulib/import/extra/snippet/warn-on-use.h: Update.
* gnulib/import/extra/update-copyright: Update.
* gnulib/import/flexmember.h: Update.
* gnulib/import/float+.h: Update.
* gnulib/import/float: Update.
* gnulib/import/float: Update.
* gnulib/import/fnmatch: Update.
* gnulib/import/fnmatch: Update.
* gnulib/import/fnmatch_loop: Update.
* gnulib/import/fpucw.h: Update.
* gnulib/import/frexp: Update.
* gnulib/import/frexpl: Update.
* gnulib/import/gettimeofday: Update.
* gnulib/import/hard-locale: Update.
* gnulib/import/hard-locale.h: Update.
* gnulib/import/inttypes: Update.
* gnulib/import/isnan: Update.
* gnulib/import/isnand-nolibm.h: Update.
* gnulib/import/isnand: Update.
* gnulib/import/isnanl-nolibm.h: Update.
* gnulib/import/isnanl: Update.
* gnulib/import/itold: Update.
* gnulib/import/limits: Update.
* gnulib/import/localcharset: Update.
* gnulib/import/localcharset.h: Update.
* gnulib/import/lstat: Update.
* gnulib/import/m4/00gnulib: Update.
* gnulib/import/m4/absolute-header: Update.
* gnulib/import/m4/alloca: Update.
* gnulib/import/m4/canonicalize: Update.
* gnulib/import/m4/codeset: Update.
* gnulib/import/m4/configmake: Update.
* gnulib/import/m4/dirent_h: Update.
* gnulib/import/m4/dirfd: Update.
* gnulib/import/m4/dirname: Update.
* gnulib/import/m4/double-slash-root: Update.
* gnulib/import/m4/eealloc: Update.
* gnulib/import/m4/errno_h: Update.
* gnulib/import/m4/exponentd: Update.
* gnulib/import/m4/exponentl: Update.
* gnulib/import/m4/extensions: Update.
* gnulib/import/m4/extern-inline: Update.
* gnulib/import/m4/fcntl-o: Update.
* gnulib/import/m4/flexmember: Update.
* gnulib/import/m4/float_h: Update.
* gnulib/import/m4/fnmatch: Update.
* gnulib/import/m4/fpieee: Update.
* gnulib/import/m4/frexp: Update.
* gnulib/import/m4/frexpl: Update.
* gnulib/import/m4/gettimeofday: Update.
* gnulib/import/m4/glibc21: Update.
* gnulib/import/m4/gnulib-cache: Update.
* gnulib/import/m4/gnulib-common: Update.
* gnulib/import/m4/gnulib-comp: Update.
* gnulib/import/m4/gnulib-tool: Update.
* gnulib/import/m4/hard-locale: Update.
* gnulib/import/m4/include_next: Update.
* gnulib/import/m4/inttypes-pri: Update.
* gnulib/import/m4/inttypes: Update.
* gnulib/import/m4/isnand: Update.
* gnulib/import/m4/isnanl: Update.
* gnulib/import/m4/largefile: Update.
* gnulib/import/m4/limits-h: Update.
* gnulib/import/m4/localcharset: Update.
* gnulib/import/m4/locale-fr: Update.
* gnulib/import/m4/locale-ja: Update.
* gnulib/import/m4/locale-zh: Update.
* gnulib/import/m4/longlong: Update.
* gnulib/import/m4/lstat: Update.
* gnulib/import/m4/malloc: Update.
* gnulib/import/m4/malloca: Update.
* gnulib/import/m4/math_h: Update.
* gnulib/import/m4/mbrtowc: Update.
* gnulib/import/m4/mbsinit: Update.
* gnulib/import/m4/mbsrtowcs: Update.
* gnulib/import/m4/mbstate_t: Update.
* gnulib/import/m4/memchr: Update.
* gnulib/import/m4/memmem: Update.
* gnulib/import/m4/mmap-anon: Update.
* gnulib/import/m4/multiarch: Update.
* gnulib/import/m4/nocrash: Update.
* gnulib/import/m4/off_t: Update.
* gnulib/import/m4/pathmax: Update.
* gnulib/import/m4/rawmemchr: Update.
* gnulib/import/m4/readlink: Update.
* gnulib/import/m4/rename: Update.
* gnulib/import/m4/rmdir: Update.
* gnulib/import/m4/signal_h: Update.
* gnulib/import/m4/ssize_t: Update.
* gnulib/import/m4/stat: Update.
* gnulib/import/m4/stdbool: Update.
* gnulib/import/m4/stddef_h: Update.
* gnulib/import/m4/stdint: Update.
* gnulib/import/m4/stdio_h: Update.
* gnulib/import/m4/stdlib_h: Update.
* gnulib/import/m4/strchrnul: Update.
* gnulib/import/m4/string_h: Update.
* gnulib/import/m4/strstr: Update.
* gnulib/import/m4/strtok_r: Update.
* gnulib/import/m4/sys_socket_h: Update.
* gnulib/import/m4/sys_stat_h: Update.
* gnulib/import/m4/sys_time_h: Update.
* gnulib/import/m4/sys_types_h: Update.
* gnulib/import/m4/time_h: Update.
* gnulib/import/m4/unistd_h: Update.
* gnulib/import/m4/warn-on-use: Update.
* gnulib/import/m4/wchar_h: Update.
* gnulib/import/m4/wchar_t: Update.
* gnulib/import/m4/wctype_h: Update.
* gnulib/import/m4/wint_t: Update.
* gnulib/import/malloc: Update.
* gnulib/import/malloca: Update.
* gnulib/import/malloca.h: Update.
* gnulib/import/math: Update.
* gnulib/import/math: Update.
* gnulib/import/mbrtowc: Update.
* gnulib/import/mbsinit: Update.
* gnulib/import/mbsrtowcs-impl.h: Update.
* gnulib/import/mbsrtowcs-state: Update.
* gnulib/import/mbsrtowcs: Update.
* gnulib/import/memchr: Update.
* gnulib/import/memmem: Update.
* gnulib/import/pathmax.h: Update.
* gnulib/import/rawmemchr: Update.
* gnulib/import/readlink: Update.
* gnulib/import/ref-add.sin: Update.
* gnulib/import/ref-del.sin: Update.
* gnulib/import/rename: Update.
* gnulib/import/rmdir: Update.
* gnulib/import/same-inode.h: Update.
* gnulib/import/signal: Update.
* gnulib/import/stat: Update.
* gnulib/import/stdbool: Update.
* gnulib/import/stddef: Update.
* gnulib/import/stdint: Update.
* gnulib/import/stdio: Update.
* gnulib/import/stdlib: Update.
* gnulib/import/str-two-way.h: Update.
* gnulib/import/strchrnul: Update.
* gnulib/import/streq.h: Update.
* gnulib/import/string: Update.
* gnulib/import/stripslash: Update.
* gnulib/import/strnlen1: Update.
* gnulib/import/strnlen1.h: Update.
* gnulib/import/strstr: Update.
* gnulib/import/strtok_r: Update.
* gnulib/import/sys_stat: Update.
* gnulib/import/sys_time: Update.
* gnulib/import/sys_types: Update.
* gnulib/import/time: Update.
* gnulib/import/unistd: Update.
* gnulib/import/unistd: Update.
* gnulib/import/verify.h: Update.
* gnulib/import/wchar: Update.
* gnulib/import/wctype: Update.
* gnulib/import/flexmember.h: New file.
* gnulib/import/hard-locale.c: New file.
* gnulib/import/hard-locale.h: New file.
* gnulib/import/limits.in.h: New file.
* gnulib/import/m4/flexmember.m4: New file.
* gnulib/import/m4/hard-locale.m4: New file.
* gnulib/import/m4/limits-h.m4: New file.
H.J. Lu [Tue, 18 Oct 2016 16:06:27 +0000 (09:06 -0700)]
Check addr32flag instead of sizeflag for rip/eip
Since the address size prefix, 0x67, is ignored for MPX instructions in
64-bit mode, we should check addr32flag instead of sizeflag for rip/eip.
PR binutis/20699
* i386-dis.c (OP_E_memory): Check addr32flag instead of sizeflag
for rip/eip.
H.J. Lu [Tue, 18 Oct 2016 15:14:10 +0000 (08:14 -0700)]
Remove the remaining SSE5 support
PR binutis/20704
* i386-dis.c (three_byte_table): Remove the remaining SSE5 support.
Pedro Alves [Tue, 18 Oct 2016 10:42:35 +0000 (11:42 +0100)]
Introduce gdb::unique_ptr
Many make_cleanup uses in the code base are best eliminated by using a
"owning" smart pointer to manage ownership of the resource
automatically.
The question is _which_ smart pointer.
GDB currently supports building with a C++03 compiler. We have
std::auto_ptr in C++03, but, as is collective wisdom by now, that's
too easy to misuse, and has therefore been deprecated in C++11 and
finally removed in C++17.
It'd be nice to be able to use std::unique_ptr instead, which is the
modern, safe std::auto_ptr replacement in C++11.
In addition to extra safety -- moving (i.e., transfer of ownership of
the managed pointer between smart pointers) must be explicit --
std::unique_ptr has (among others) one nice feature that std::auto_ptr
doesn't --- ability to specify a custom deleter as template parameter.
In gdb's context, that allows easily creating a smart pointer for
memory allocated with xmalloc -- the smart pointer then knows to
release with xfree instead of delete. This is particularly
interesting when managing objects allocated in C libraries, and also,
for C++-fying parts of GDB that interact with other parts that still
return objects allocated with xmalloc.
Since std::unique_ptr's API is quite nice, and eventually we'd like to
move to C++11, this patch adds a C++03-compatible smart pointer that
exposes the subset of the std::unique_ptr API that we're interested
in. An advantage is that whenever we start requiring C++11, we won't
have to learn a new API. Meanwhile, this allows continuing to support
building with a C++03 compiler.
Since C++03 doesn't support rvalue references (boost gets close to
emulating them, but it's not fully transparent to user code), the
C++03 std::unique_ptr emulation here doesn't try hard to prevent
accidentally moving, which is where most of complication of a more
thorough emulation would be. Instead, we rely on the fact that GDB
will be usually compiled with a C++11 compiler, and use the real
std::unique_ptr in that case to catch such accidental moves. IOW, the
goal here is to allow code that would be correct using std::unique_ptr
to be equally correct in C++03 mode, and, just as efficient.
The C++03 version was originally based on GCC 7.0's std::auto_ptr and
then heavily customized to behave more like C++11's std::unique_ptr:
- Support for custom (stateless) deleters. (Support for stateful
deleters could be added, if necessary.)
- unique_ptr<T[]> partial specialization (auto_ptr<T> does not know
to use delete[]).
- Support for all of 'ptr != NULL', 'ptr == NULL' and 'if (ptr)'
using the safe bool idiom to emulate C++11's explicit bool
operator.
- There's no nullptr in C++03, so this allows initialization and
assignment from NULL instead (std::auto_ptr allows neither).
- Variable names un-uglified (ie., no leading __ prefix everywhere).
- Formatting made to follow GDB's coding conventions, including
comment style.
- Converting "move" constructors done differently in order to truly
support:
unique_ptr<Derived> func_returning_unique_ptr (.....);
...
unique_ptr<Base> ptr = func_returning_unique_ptr (.....);
At this point, it no longer shares much at all with the original file,
but, that's the history.
See comments in the code to find out more.
I thought of putting the "emulation" / shim in the "std" namespace, so
that when we start requiring C++11 at some point, no actual changes to
users of the smart pointer throughout would be necessary. Putting
things in the std namespace is technically undefined, however in
practice it doesn't cause any issue with any compiler. However,
thinking that people might be confused with seeing std::unique_ptr and
thinking that we're actually requiring C++11 already, I put the new
types in the "gdb" namespace instead.
For managing xmalloc pointers, this adds a gdb::unique_xmalloc_ptr<T>
"specialization" with a custom xfree deleter.
No actual use of any smart pointer is introduced in this patch.
That'll be done in following patches.
Tested (along with the rest of the series) on:
- NetBSD 5.1 (gcc70 on the compile farm), w/ gcc 4.1.3
- x86-64 Fedora 23, gcc 5.3.1 (gnu++03)
- x86-64 Fedora 23, and gcc 7.0 (gnu++14)
gdb/ChangeLog:
2016-10-18 Pedro Alves <palves@redhat.com>
* common/common-defs.h: Include "gdb_unique_ptr.h".
* common/gdb_unique_ptr.h: New.
Nick Clifton [Tue, 18 Oct 2016 09:56:12 +0000 (10:56 +0100)]
Updated Danish translation for the BFD library.
Mike Frysinger [Mon, 17 Oct 2016 02:34:08 +0000 (22:34 -0400)]
sim: avr: move changelog entries to subdir
Maciej W. Rozycki [Mon, 17 Oct 2016 15:15:33 +0000 (16:15 +0100)]
i386-tdep: Verify architecture before proceeding with `set/show mpx'
Make sure the architecture is `bfd_arch_i386' before handling the `set
mpx' and `show mpx' commands, avoiding the issue with `i386_mpx_enabled'
interpreting `gdbarch->tdep' according to the `struct gdbarch_tdep'
definition in i386-tdep.h while indeed in a multi-target configuration
it may have a different layout and cause GDB to crash or at least
misbehave.
gdb/
* i386-tdep.c (i386_mpx_info_bounds): Make sure the architecture
is `bfd_arch_i386' before proceeding.
(i386_mpx_set_bounds): Likewise.
Maciej W. Rozycki [Mon, 17 Oct 2016 15:18:06 +0000 (16:18 +0100)]
tilegx-tdep: Correct aliasing errors in `tilegx_analyze_prologue'
Fix a load of aliasing build errors:
cc1plus: warnings being treated as errors
.../gdb/tilegx-tdep.c: In function 'CORE_ADDR tilegx_analyze_prologue(gdbarch*, CORE_ADDR, CORE_ADDR, tilegx_frame_cache*, frame_info*)':
.../gdb/tilegx-tdep.c:609: error: dereferencing pointer 'operands' does break strict-aliasing rules
.../gdb/tilegx-tdep.c:592: error: dereferencing pointer 'operands' does break strict-aliasing rules
.../gdb/tilegx-tdep.c:571: error: dereferencing pointer 'operands' does break strict-aliasing rules
[...]
.../gdb/tilegx-tdep.c:601: error: dereferencing pointer '<anonymous>' does break strict-aliasing rules
.../gdb/tilegx-tdep.c:601: note: initialized from here
cc1plus: error: dereferencing pointer 'operands' does break strict-aliasing rules
cc1plus: error: dereferencing pointer 'operands' does break strict-aliasing rules
.../gdb/tilegx-tdep.c:452: note: initialized from here
cc1plus: error: dereferencing pointer 'pretmp.896' does break strict-aliasing rules
cc1plus: note: initialized from here
cc1plus: error: dereferencing pointer 'pretmp.896' does break strict-aliasing rules
cc1plus: note: initialized from here
make[1]: *** [tilegx-tdep.o] Error 1
from an attempt to cast a `long long' pointer to an `int64_t' pointer,
which may not necessarily be compatible types. Use the `long long' type
for the auxiliary variable then as this is the type of the structure
member referred.
gdb/
* tilegx-tdep.c (tilegx_analyze_prologue): Use the `long long'
type for `operands'.
Maciej W. Rozycki [Tue, 18 Oct 2016 03:36:01 +0000 (04:36 +0100)]
AArch64/opcodes: Correct an `index' global shadowing error
Fix a commit
4df068de5214 ("Add support for SVE addressing modes") build
regression:
cc1: warnings being treated as errors
.../opcodes/aarch64-dis.c: In function 'aarch64_ext_sve_addr_rr_lsl':
.../opcodes/aarch64-dis.c:1324: error: declaration of 'index' shadows a global declaration
/usr/include/string.h:303: error: shadowed declaration is here
make[3]: *** [aarch64-dis.lo] Error 1
in a way following commit
91d6fa6a035c ("Add -Wshadow to the gcc command
line options used when compiling the binutils.").
opcodes/
* aarch64-dis.c (aarch64_ext_sve_addr_rr_lsl): Rename `index'
local variable to `index_regno'.
Maciej W. Rozycki [Tue, 18 Oct 2016 03:34:36 +0000 (04:34 +0100)]
NDS32/BFD: Correct an aliasing error in `nds32_elf_check_relocs'
Fix an aliasing build error:
cc1: warnings being treated as errors
.../bfd/elf32-nds32.c: In function 'nds32_elf_check_relocs':
.../bfd/elf32-nds32.c:6644: warning: dereferencing type-punned pointer will break strict-aliasing rules
make[3]: *** [elf32-nds32.lo] Error 1
in a way following commit
6edfbbad0864 ("Fix up gcc4.1 aliasing
warnings"), <https://sourceware.org/ml/binutils/2005-10/msg00071.html>.
bfd/
* elf32-nds32.c (nds32_elf_check_relocs): Avoid aliasing warning
from GCC.
Maciej W. Rozycki [Tue, 18 Oct 2016 03:28:34 +0000 (04:28 +0100)]
ARM/BFD: Correct an `index' global shadowing error
Fix a commit
5025eb7c0d87 ("Delete relocations associatesd with deleted
exidx entries.") build regression:
cc1: warnings being treated as errors
.../bfd/elf32-arm.c: In function 'elf32_arm_update_relocs':
.../bfd/elf32-arm.c:14951: warning: declaration of 'index' shadows a global declaration
/usr/include/string.h:304: warning: shadowed declaration is here
make[3]: *** [elf32-arm.lo] Error 1
in a way following commit
91d6fa6a035c ("Add -Wshadow to the gcc command
line options used when compiling the binutils.").
bfd/
* elf32-arm.c (elf32_arm_update_relocs): Rename `index' local
variable to `reloc_index'.
GDB Administrator [Tue, 18 Oct 2016 00:00:21 +0000 (00:00 +0000)]
Automatic date update in version.in
Simon Marchi [Mon, 17 Oct 2016 21:05:46 +0000 (17:05 -0400)]
Fix duplicate test message in mi-trace-save.exp
gdb/testsuite/ChangeLog:
* gdb.trace/mi-trace-save.exp (test_trace_save_wrong_num_args):
Change test message.
Simon Marchi [Mon, 17 Oct 2016 20:54:24 +0000 (16:54 -0400)]
Fix comment in mi-trace-save.exp
This fixes a comment I forgot to update in the previous patch.
gdb/testsuite/ChangeLog:
* gdb.trace/mi-trace-save.exp (test_trace_save_wrong_num_args):
Update comment.
Simon Marchi [Mon, 17 Oct 2016 20:47:36 +0000 (16:47 -0400)]
Fix -trace-save crash when argument is missing
-trace-save doesn't check whether an argument is passed, leading to a
segfault if you pass nothing.
I added a small test, which only tests the error conditions of
-trace-save.
gdb/ChangeLog:
* mi/mi-main.c (mi_cmd_trace_save): Check if argument is present
before using it.
gdb/testsuite/ChangeLog:
* gdb.trace/mi-trace-save.exp: New file.
Pedro Alves [Mon, 17 Oct 2016 16:13:26 +0000 (17:13 +0100)]
gdb: Fix phony iconv build
Cross building gdb for mingw32 on Fedora 23 fails with:
x86_64-w64-mingw32-g++ -g -O2 [...] ../../src/gdb/charset.c
In file included from ../../src/gdb/charset.c:21:0:
../../src/gdb/charset.h:134:3: error: 'iconv_t' does not name a type
iconv_t m_desc;
^
../../src/gdb/charset.c: In constructor 'wchar_iterator::wchar_iterator(const gdb_byte*, size_t, const char*, size_t)':
../../src/gdb/charset.c:600:3: error: 'm_desc' was not declared in this scope
m_desc = iconv_open (INTERMEDIATE_ENCODING, charset);
^
../../src/gdb/charset.c: In destructor 'wchar_iterator::~wchar_iterator()':
../../src/gdb/charset.c:607:7: error: 'm_desc' was not declared in this scope
if (m_desc != (iconv_t) -1)
^
../../src/gdb/charset.c: In member function 'int wchar_iterator::iterate(wchar_iterate_result*, gdb_wchar_t**, const gdb_byte**, size_t*)':
../../src/gdb/charset.c:633:25: error: 'm_desc' was not declared in this scope
size_t r = iconv (m_desc, &inptr, &m_bytes, &outptr, &out_avail);
^
This is a regression caused by commit
cda6c55bd399 (Turn wchar
iterator into a class). The problem is that iconv_t is now exposed in
gdb/charset.h, while before it was only used in gdb/charset.c.
gdb/charset.c, under #ifdef PHONY_ICONV, does:
#undef iconv_t
#define iconv_t int
So it seems the simplest is to use 'int' in the header file too.
gdb/ChangeLog:
2016-10-17 Pedro Alves <palves@redhat.com>
* charset.h (class wchar_iterator) [PHONY_ICONV] <m_desc>: Use
'int' as type.
Cupertino Miranda [Mon, 17 Oct 2016 14:45:57 +0000 (16:45 +0200)]
Fixed matching in newly added test.
gas/ChangeLog:
2016-10-17 Cupertino Miranda <cmiranda@synopsys.com>
* testsuite/arc/dis-inv.d: Fixed target match.
Nick Clifton [Mon, 17 Oct 2016 14:29:43 +0000 (15:29 +0100)]
Display unknown notes. Decode NT_GNU_HWCAP notes.
* readelf.c (apply_relocations): Fail if the symbol table section
linked to by the reloc section does not have either the SHT_SYMTAB
or SHT_DYNSYM type.
(print_gnu_note): Decode the contents of NT_GNU_HWCAP notes.
Print the contents of unknown note types.
(process_note): Add the file and section to the parameter list.
Use print_symbol to display the note name.
Display the contents of unknown note types.
(process_corefile_note_segment): Rename to process_notes_at.
Add section parameter. Apply relocations to the notes when
loading from a section. Display section name when processing
notes in a section.
* testsuite/binutils-all/readelf.n: Update expected output.