Jiri Gaisler [Thu, 19 Feb 2015 22:31:20 +0000 (23:31 +0100)]
sim/erc32: Corrected wrong CPU implementation and version ID in psr
Jiri Gaisler [Thu, 19 Feb 2015 22:31:19 +0000 (23:31 +0100)]
sim/erc32: Disassembly in stand-alone mode did not work.
The API to print_insn_sparc() has changed over the years ...
GDB Administrator [Sun, 22 Feb 2015 00:00:08 +0000 (00:00 +0000)]
Automatic date update in version.in
Mike Frysinger [Sat, 21 Feb 2015 21:10:04 +0000 (16:10 -0500)]
binutils: readelf: add missing newline to warning message
Jan Kratochvil [Sat, 21 Feb 2015 14:24:20 +0000 (15:24 +0100)]
Testsuite patch for: i386: Fix internal error when prstatus in core file is too big
gdb/testsuite/ChangeLog
2015-02-21 Jan Kratochvil <jan.kratochvil@redhat.com>
PR corefiles/17808
* gdb.arch/i386-biarch-core.core.bz2: New file.
* gdb.arch/i386-biarch-core.exp: New file.
Pedro Alves [Sat, 21 Feb 2015 12:03:23 +0000 (12:03 +0000)]
gdb.threads/multi-create-ns-info-thr.exp and native-extended-remote board
The buildbot shows that the new
gdb.threads/multi-create-ns-info-thr.exp test is timing out when
tested with --target=native-extended-remote. The reason is:
No breakpoints or watchpoints.
(gdb) break main
Breakpoint 1 at 0x10000b00: file ../../../binutils-gdb/gdb/testsuite/gdb.threads/multi-create.c, line 72.
(gdb) run
Starting program: /home/gdb-buildbot/fedora-21-ppc64be-1/fedora-ppc64be-native-extended-gdbserver/build/gdb/testsuite/outputs/gdb.threads/multi-create-ns-info-thr/multi-cre
ate-ns-info-thr
Process /home/gdb-buildbot/fedora-21-ppc64be-1/fedora-ppc64be-native-extended-gdbserver/build/gdb/testsuite/outputs/gdb.threads/multi-create-ns-info-thr/multi-create-ns-inf
o-thr created; pid = 16266
Unexpected vCont reply in non-stop mode: T0501:
00003fffffffd190;40:
00000080560fe290;thread:p3f8a.3f8a;core:0;
^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
(gdb) break multi-create.c:45
Breakpoint 2 at 0x10000994: file ../../../binutils-gdb/gdb/testsuite/gdb.threads/multi-create.c, line 45.
(gdb) commands
Type commands for breakpoint(s) 2, one per line.
Non-stop tests don't really work with the
--target_board=native-extended-remote board, because tests toggle
non-stop on after GDB is already connected to gdbserver, while
Currently, non-stop must be enabled before connecting.
This adjusts the test to bail if running to main fails, like all other
non-stop tests.
Note non-stop tests do work with --target_board=native-gdbserver.
gdb/testsuite/ChangeLog:
2015-02-21 Pedro Alves <palves@redhat.com>
* gdb.threads/multi-create-ns-info-thr.exp: Return early if
runto_main fails.
GDB Administrator [Sat, 21 Feb 2015 00:00:09 +0000 (00:00 +0000)]
Automatic date update in version.in
Pedro Alves [Fri, 20 Feb 2015 23:10:53 +0000 (23:10 +0000)]
Fix gdb.base/solib-corrupted.exp after dtrace probes changes
Commit
6f9b8491 (Adapt `info probes' to support printing probes of
different types.) added a new type column to "info probes". That
caused a solib-corrupted.exp regression:
~~~~~~~~~~~~~~~~~~~~~
Running /home/pedro/gdb/mygit/src/gdb/testsuite/gdb.base/solib-corrupted.exp ...
FAIL: gdb.base/solib-corrupted.exp: corrupted list
=== gdb Summary ===
# of expected passes 2
# of unexpected failures 1
~~~~~~~~~~~~~~~~~~~~~
Tested on x86_64 Fedora 20.
gdb/testsuite/ChangeLog:
2015-02-20 Pedro Alves <palves@redhat.com>
* gdb.base/solib-corrupted.exp: Expect "stap" as first column of
info probes.
Pedro Alves [Fri, 20 Feb 2015 20:21:59 +0000 (20:21 +0000)]
GNU/Linux: Stop using libthread_db/td_ta_thr_iter
TL;DR - GDB can hang if something refreshes the thread list out of the
target while the target is running. GDB hangs inside td_ta_thr_iter.
The fix is to not use that libthread_db function anymore.
Long version:
Running the testsuite against my all-stop-on-top-of-non-stop series is
still exposing latent non-stop bugs.
I was originally seeing this with the multi-create.exp test, back when
we were still using libthread_db thread event breakpoints. The
all-stop-on-top-of-non-stop series forces a thread list refresh each
time GDB needs to start stepping over a breakpoint (to pause all
threads). That test hits the thread event breakpoint often, resulting
in a bunch of step-over operations, thus a bunch of thread list
refreshes while some threads in the target are running.
The commit adds a real non-stop mode test that triggers the issue,
based on multi-create.exp, that does an explicit "info threads" when a
breakpoint is hit. IOW, it does the same things the as-ns series was
doing when testing multi-create.exp.
The bug is a race, so it unfortunately takes several runs for the test
to trigger it. In fact, even when setting the test running in a loop,
it sometimes takes several minutes for it to trigger for me.
The race is related to libthread_db's td_ta_thr_iter. This is
libthread_db's entry point for walking the thread list of the
inferior.
Sometimes, when GDB refreshes the thread list from the target,
libthread_db's td_ta_thr_iter can somehow see glibc's thread list as a
cycle, and get stuck in an infinite loop.
The issue is that when a thread exits, its thread control structure in
glibc is moved from a "used" list to a "cache" list. These lists are
simply circular linked lists where the "next/prev" pointers are
embedded in the thread control structure itself. The "next" pointer
of the last element of the list points back to the list's sentinel
"head". There's only one set of "next/prev" pointers for both lists;
thus a thread can only be in one of the lists at a time, not in both
simultaneously.
So when thread C exits, simplifying, the following happens. A-C are
threads. stack_used and stack_cache are the list's heads.
Before:
stack_used -> A -> B -> C -> (&stack_used)
stack_cache -> (&stack_cache)
After:
stack_used -> A -> B -> (&stack_used)
stack_cache -> C -> (&stack_cache)
td_ta_thr_iter starts by iterating at the list's head's next, and
iterates until it sees a thread whose next pointer points to the
list's head again. Thus in the before case above, C's next points to
stack_used, indicating end of list. In the same case, the stack_cache
list is empty.
For each thread being iterated, td_ta_thr_iter reads the whole thread
object out of the inferior. This includes the thread's "next"
pointer.
In the scenario above, it may happen that td_ta_thr_iter is iterating
thread B and has already read B's thread structure just before thread
C exits and its control structure moves to the cached list.
Now, recall that td_ta_thr_iter is running in the context of GDB, and
there's no locking between GDB and the inferior. From it's local copy
of B, td_ta_thr_iter believes that the next thread after B is thread
C, so it happilly continues iterating to C, a thread that has already
exited, and is now in the stack cache list.
After iterating C, td_ta_thr_iter finds the stack_cache head, which
because it is not stack_used, td_ta_thr_iter assumes it's just another
thread. After this, unless the reverse race triggers, GDB gets stuck
in td_ta_thr_iter forever walking the stack_cache list, as no thread
in thatlist has a next pointer that points back to stack_used (the
terminating condition).
Before fully understanding the issue, I tried adding cycle detection
to GDB's td_ta_thr_iter callback. However, td_ta_thr_iter skips
calling the callback in some cases, which means that it's possible
that the callback isn't called at all, making it impossible for GDB to
break the loop. I did manage to get GDB stuck in that state more than
once.
Fortunately, we can avoid the issue altogether. We don't really need
td_ta_thr_iter for live debugging nowadays, given PTRACE_EVENT_CLONE.
We already know how to map and lwp id to a thread id without iterating
(thread_from_lwp), so use that more.
gdb/ChangeLog:
2015-02-20 Pedro Alves <palves@redhat.com>
* linux-nat.c (linux_handle_extended_wait): Call
thread_db_notice_clone whenever a new clone LWP is detected.
(linux_stop_and_wait_all_lwps, linux_unstop_all_lwps): New
functions.
* linux-nat.h (thread_db_attach_lwp): Delete declaration.
(thread_db_notice_clone, linux_stop_and_wait_all_lwps)
(linux_unstop_all_lwps): Declare.
* linux-thread-db.c (struct thread_get_info_inout): Delete.
(thread_get_info_callback): Delete.
(thread_from_lwp): Use td_thr_get_info and record_thread.
(thread_db_attach_lwp): Delete.
(thread_db_notice_clone): New function.
(try_thread_db_load_1): If /proc is mounted and shows the
process'es task list, walk over all LWPs and call thread_from_lwp
instead of relying on td_ta_thr_iter.
(attach_thread): Don't call check_thread_signals here. Split the
tail part of the function (which adds the thread to the core GDB
thread list) to ...
(record_thread): ... this function. Call check_thread_signals
here.
(thread_db_wait): Don't call thread_db_find_new_threads_1. Always
call thread_from_lwp.
(thread_db_update_thread_list): Rename to ...
(thread_db_update_thread_list_org): ... this.
(thread_db_update_thread_list): New function.
(thread_db_find_thread_from_tid): Delete.
(thread_db_get_ada_task_ptid): Simplify.
* nat/linux-procfs.c: Include <sys/stat.h>.
(linux_proc_task_list_dir_exists): New function.
* nat/linux-procfs.h (linux_proc_task_list_dir_exists): Declare.
gdb/gdbserver/ChangeLog:
2015-02-20 Pedro Alves <palves@redhat.com>
* thread-db.c: Include "nat/linux-procfs.h".
(thread_db_init): Skip listing new threads if the kernel supports
PTRACE_EVENT_CLONE and /proc/PID/task/ is accessible.
gdb/testsuite/ChangeLog:
2015-02-20 Pedro Alves <palves@redhat.com>
* gdb.threads/multi-create-ns-info-thr.exp: New file.
Pedro Alves [Fri, 20 Feb 2015 20:21:59 +0000 (20:21 +0000)]
linux-nat.c: fix a few lin_lwp_attach_lwp issues
This function has a few latent bugs that are triggered by a non-stop
mode test that will be added in a subsequent patch.
First, as described in the function's intro comment, the function is
supposed to return 1 if we're already auto attached to the thread, but
haven't processed the PTRACE_EVENT_CLONE event of its parent thread
yet.
Then, we may find that we're trying to attach to a clone child that
hasn't yet stopped for its initial stop, and therefore 'waitpid(...,
WNOHANG)' returns 0. In that case, we're currently adding the LWP to
the stopped_pids list, which results in linux_handle_extended_wait
skipping the waitpid call on the child, and thus confusing things
later on when the child eventually reports the stop.
Then, the tail end of lin_lwp_attach_lwp always sets the
last_resume_kind of the LWP to resume_stop, which is wrong given that
the user may be doing "info threads" while some threads are running.
And then, the else branch of lin_lwp_attach_lwp always sets the
stopped flag of the LWP. This branch is reached if the LWP is the
main LWP, which may well be running at this point (to it's wrong to
set its 'stopped' flag).
AFAICS, there's no reason anymore for special-casing the main/leader
LWP here:
- For the "attach" case, linux_nat_attach already adds the main LWP to
the lwp list, and sets its 'stopped' flag.
- For the "run" case, after linux_nat_create_inferior, end up in
linux_nat_wait_1 here:
/* The first time we get here after starting a new inferior, we may
not have added it to the LWP list yet - this is the earliest
moment at which we know its PID. */
if (ptid_is_pid (inferior_ptid))
{
/* Upgrade the main thread's ptid. */
thread_change_ptid (inferior_ptid,
ptid_build (ptid_get_pid (inferior_ptid),
ptid_get_pid (inferior_ptid), 0));
lp = add_initial_lwp (inferior_ptid);
lp->resumed = 1;
}
... which adds the LWP to the LWP list already, before
lin_lwp_attach_lwp can ever be reached.
gdb/ChangeLog:
2015-02-20 Pedro Alves <palves@redhat.com>
* linux-nat.c (lin_lwp_attach_lwp): No longer special case the
main LWP. Handle the case of waitpid returning 0 if we're already
attached to the LWP. Don't set the LWP's last_resume_kind to
resume_stop if we already knew about the LWP.
(linux_nat_filter_event): Add debug logs.
Pedro Alves [Thu, 19 Feb 2015 20:48:49 +0000 (20:48 +0000)]
Garbage collect forward_target_decr_pc_after_break
The definition was removed a year ago, but the declaration managed to
stay behind.
gdb/ChangeLog
2015-02-20 Pedro Alves <palves@redhat.com>
* target.h (forward_target_decr_pc_after_break): Delete
declaration.
Pedro Alves [Thu, 19 Feb 2015 20:48:54 +0000 (20:48 +0000)]
fix gdbserver/linux-low'c's pending status handling
Another fix I'm working made schedlock.exp fail with gdbserver
frequently. Looking deeper, it turns out to be a pre-existing bug.
status_pending_p_callback is filtering out LWPs incorrectly. The
result is that that sometimes status_pending_p_callback returns a
pending event for an LWP that isn't expected, and then GDBserver gets
very confused.
E.g,. when doing a step-over, linux_wait_for_event is called with a
particular LWP's ptid, meaning events for all other LWPs should be
left pending, but here we see it retuning an event for some other LWP:
linux_wait_1: [<all threads>]
step_over_bkpt set [LWP 29577.29577], doing a blocking wait <--------
my_waitpid (-1, 0x40000001)
my_waitpid (-1, 0x80000001): status(57f), 0
LWFE: waitpid(-1, ...) returned 0, ERRNO-OK
pc is 0x4007a0
src/gdb/gdbserver/linux-low.c:2587: A problem internal to GDBserver has been detected.
linux_wait_1: got event for 29581 <--------
Remote connection closed
(gdb) FAIL: gdb.threads/schedlock.exp: continue to breakpoint: return to loop (initial)
delete breakpoints
Tested on x86_64 Fedora 20.
gdb/gdbserver/ChangeLog:
2015-02-20 Pedro Alves <palves@redhat.com>
* linux-low.c (status_pending_p_callback): Use ptid_match.
Pedro Alves [Fri, 20 Feb 2015 19:50:36 +0000 (19:50 +0000)]
Fix no-attach-trace.exp with "target remote" / gdbserver
$ make check RUNTESTFLAGS="--target_board=native-gdbserver no-attach-trace.exp"
...
(gdb) trace main
Tracepoint 1 at 0x400594: file /home/pedro/gdb/mygit/src/gdb/testsuite/gdb.trace/no-attach-trace.c, line 25.
(gdb) PASS: gdb.trace/no-attach-trace.exp: set tracepoint on main
tstart
You can't do that when your target is `exec'
(gdb) FAIL: gdb.trace/no-attach-trace.exp: tstart
Even though this target supports tracing, the test restarts GDB and
doesn't do gdb_run_cmd so does not reconnect to the remote target. So
at that point, GDB only has the "exec" target, which obviously doesn't
do tracing.
The test is about doing "tstart" before running a program, so the fix
is to do gdb_target_supports_trace with whatever target GDB ends up
connected after clean_restart.
Tested on x86_64 Fedora 20, native, native-gdbserver and
native-extended-gdbserver boards. The test passes with the latter,
and is skipped with the first two.
gdb/testsuite/ChangeLog:
2015-02-20 Pedro Alves <palves@redhat.com>
* gdb.trace/no-attach-trace.exp: Don't run to main. Do
clean_restart before gdb_target_supports_trace.
Pedro Alves [Fri, 20 Feb 2015 19:00:21 +0000 (19:00 +0000)]
PR18006: internal error if threaded program calls clone(CLONE_VM)
On GNU/Linux, if a pthreaded program has a thread call clone(CLONE_VM)
directly, and then that clone LWP hits a debug event (breakpoint,
etc.) GDB internal errors. Threaded programs shouldn't really be
calling clone directly, but GDB shouldn't crash either.
The crash looks like this:
(gdb) break clone_fn
Breakpoint 2 at 0x4007d8: file clone-thread_db.c, line 35.
(gdb) r
...
[Thread debugging using libthread_db enabled]
...
src/gdb/linux-nat.c:1030: internal-error: lin_lwp_attach_lwp: Assertion `lwpid > 0' failed.
A problem internal to GDB has been detected,
further debugging may prove unreliable.
The problem is that 'clone' ends up clearing the parent thread's tid
field in glibc's thread data structure. For x86_64, the glibc code in
question is here:
sysdeps/unix/sysv/linux/x86_64/clone.S:
...
testq $CLONE_THREAD, %rdi
jne 1f
testq $CLONE_VM, %rdi
movl $-1, %eax <----
jne 2f
movl $SYS_ify(getpid), %eax
syscall
2: movl %eax, %fs:PID
movl %eax, %fs:TID <----
1:
When GDB refreshes the thread list out of libthread_db, it finds a
thread with LWP with pid -1 (the clone's parent), which naturally
isn't yet on the thread list. GDB then tries to attach to that bogus
LWP id, which is caught by that assertion.
The fix is to detect the bad PID early.
Tested on x86-64 Fedora 20. GDBserver doesn't need any fix.
gdb/ChangeLog:
2015-02-20 Pedro Alves <palves@redhat.com>
PR threads/18006
* linux-thread-db.c (thread_get_info_callback): Return early if
the thread's lwp id is -1.
gdb/testsuite/ChangeLog:
2015-02-20 Pedro Alves <palves@redhat.com>
PR threads/18006
* gdb.threads/clone-thread_db.c: New file.
* gdb.threads/clone-thread_db.exp: New file.
Joel Brobecker [Fri, 20 Feb 2015 17:20:23 +0000 (21:20 +0400)]
Document the GDB 7.9 release in gdb/ChangeLog
gdb/ChangeLog:
GDB 7.9 released.
Andreas Arnez [Fri, 20 Feb 2015 09:39:53 +0000 (10:39 +0100)]
S390: Support new vector register sections
The IBM z13 has new 128-bit wide vector registers v0-v31, where v0-v15
include the existing 64-bit wide floating point registers. The Linux
kernel presents the vector registers as two additional register sets,
one for the right halves of v0-v15 and another one for the full
registers v16-v31. Thus a new core file may contain two new register
note sections, and this patch adds support to binutils for them.
bfd/
* elf-bfd.h (elfcore_write_s390_vxrs_low): Add prototype.
(elfcore_write_s390_vxrs_high): Likewise.
* elf.c (elfcore_grok_s390_vxrs_low): New function.
(elfcore_grok_s390_vxrs_high): New function.
(elfcore_grok_note): Call them.
(elfcore_write_s390_vxrs_low): New function.
(elfcore_write_s390_vxrs_high): New function.
(elfcore_write_register_note): Call them.
binutils/
* readelf.c (get_note_type): Add NT_S390_VXRS_LOW and
NT_S390_VXRS_HIGH.
include/elf/
* common.h (NT_S390_VXRS_LOW): New macro.
(NT_S390_VXRS_HIGH): Likewise.
Mike Frysinger [Thu, 19 Feb 2015 09:09:54 +0000 (04:09 -0500)]
sim: drop unused headers
These look like left over hacks from the days where we had to protect
ourselves from the compiler and C library. None of these checks are
relevant, and we have common configure logic to do header tests. Punt
them all now.
Mike Frysinger [Thu, 19 Feb 2015 09:04:02 +0000 (04:04 -0500)]
sim: drop unused sim_kill function
This has been deprecated for a long time and no one calls it.
GDB Administrator [Fri, 20 Feb 2015 00:00:08 +0000 (00:00 +0000)]
Automatic date update in version.in
Chen Gang [Thu, 19 Feb 2015 22:51:12 +0000 (06:51 +0800)]
sim: ChangeLog: Correct the related items position and format.
Move several items from sim/ChangeLog to sim/*/ChangeLog. Also remove
the incorrect white space in sim/common/ChangeLog.
Pedro Alves [Thu, 12 Feb 2015 09:59:03 +0000 (09:59 +0000)]
Wrap a few opcodes headers in extern "C" for C++
These are sufficient to link an --enable-targets=all GDB build in C++
mode, on x86_64 Fedora 20.
include/opcode/
2015-02-19 Pedro Alves <palves@redhat.com>
* cgen.h [__cplusplus]: Wrap in extern "C".
* msp430-decode.h [__cplusplus]: Likewise.
* nios2.h [__cplusplus]: Likewise.
* rl78.h [__cplusplus]: Likewise.
* rx.h [__cplusplus]: Likewise.
* tilegx.h [__cplusplus]: Likewise.
opcodes/
2015-02-19 Pedro Alves <palves@redhat.com>
* microblaze-dis.h [__cplusplus]: Wrap in extern "C".
Pedro Alves [Thu, 19 Feb 2015 22:44:44 +0000 (22:44 +0000)]
floatformat.h: Wrap in extern "C"
Just like libiberty.h. So that C++ programs, such as GDB when built
as a C++ program, can use it.
include/ChangeLog:
2015-02-19 Pedro Alves <palves@redhat.com>
* floatformat.h [__cplusplus]: Wrap in extern "C".
Steve Ellcey [Thu, 19 Feb 2015 22:42:37 +0000 (14:42 -0800)]
2015-02-19 Steve Ellcey <sellcey@imgtec.com>
* dtrace-probe.c (dtrace_process_dof_probe): Initialize arg.expr.
(dtrace_get_probes) Change type of variable 'dof'.
Antoine Tremblay [Thu, 12 Feb 2015 19:55:08 +0000 (14:55 -0500)]
Fix non executable stack handling when calling functions in the inferior.
When gdb creates a dummy frame to execute a function in the inferior,
the process may generate a SIGSEGV, SIGTRAP or SIGILL because the stack
is non executable. If the signal handler set in gdb has option print
or stop enabled for these signals gdb handles this correctly.
However, in the case of noprint and nostop the signal is short-circuited
and the inferior process is sent the signal directly. This causes the
inferior to crash because of gdb.
This patch adds a check for SIGSEGV, SIGTRAP or SIGILL so that these
signals are sent to gdb rather than short-circuited in the inferior.
gdb then handles them properly and the inferior process does not
crash.
This patch also fixes the same behavior in gdbserver.
Also added a small testcase to test the issue called catch-gdb-caused-signals.
This applies to Linux only, tested on Linux.
gdb/ChangeLog:
PR breakpoints/16812
* linux-nat.c (linux_nat_filter_event): Report SIGTRAP,SIGILL,SIGSEGV.
* nat/linux-ptrace.c (linux_wstatus_maybe_breakpoint): Add.
* nat/linux-ptrace.h: Add linux_wstatus_maybe_breakpoint.
gdb/gdbserver/ChangeLog:
PR breakpoints/16812
* linux-low.c (wstatus_maybe_breakpoint): Remove.
(linux_low_filter_event): Update wstatus_maybe_breakpoint name.
(linux_wait_1): Report SIGTRAP,SIGILL,SIGSEGV.
gdb/testsuite/ChangeLog:
PR breakpoints/16812
* gdb.base/catch-gdb-caused-signals.c: New file.
* gdb.base/catch-gdb-caused-signals.exp: New file.
David Taylor [Thu, 19 Feb 2015 14:53:50 +0000 (18:53 +0400)]
[gdb/ax] small "setv" fix and documentation's adjustment.
gdb/doc/agentexpr.texi documents the "setv" opcode as follow:
@item @code{setv} (0x2d) @var{n}: @result{} @var{v}
Set trace state variable number @var{n} to the value found on the top
of the stack. The stack is unchanged, so that the value is readily
available if the assignment is part of a larger expression. The
handling of @var{n} is as described for @code{getv}.
The @item line is incorrect (and does not match with its
description), so this patch fixes it.
Additionally, in gdb/common/ax.def we find the line:
DEFOP (setv, 2, 0, 0, 1, 0x2d)
From the comment earlier in the file:
Each line is of the form:
DEFOP (name, size, data_size, consumed, produced, opcode)
[...]
CONSUMED is the number of stack elements consumed.
PRODUCED is the number of stack elements produced.
which is saying that nothing is consumed and one item is produced.
Both should be 0 or both should be 1.
This patch sets them both to 1, which seems better since if nothing
is on the stack an error will occur.
gdb/ChangeLog:
* common/ax.def (setv): Fix consumed entry in setv DEFOP.
gdb/doc/ChangeLog:
* agentexpr.texi (Bytecode Descriptions): Fix summary line for setv.
Tested on x86_64-linux.
H.J. Lu [Thu, 19 Feb 2015 12:45:27 +0000 (04:45 -0800)]
Use nm/readelf with "failif"
PR ld/4317
* ld-i386/compressed1.d: Use nm/readelf with "failif".
* ld-x86-64/compressed1.d: Likewise.
* ld-x86-64/pie1.d: Likewise.
Branko Drevensek [Thu, 19 Feb 2015 11:35:21 +0000 (22:05 +1030)]
Fix buffer overrun in verilog code
PR 17995
* verilog.c (verilog_write_record): Correct buffer size.
Mike Frysinger [Thu, 19 Feb 2015 08:41:36 +0000 (03:41 -0500)]
sim: microblaze: fix build failure after opcodes update
Commit
07774fccc3280323f43db9ed204f628503b34663 update the microblaze
opcodes table to avoid C++ collisions, but missed updating the sim.
That caused it to fail to build due to missing keywords.
Alan Modra [Mon, 16 Feb 2015 20:48:15 +0000 (07:18 +1030)]
tidy _bfd_elf_define_linkage_sym
* elflink.c (_bfd_elf_define_linkage_sym): Set 'bed' earlier.
Alan Modra [Sat, 14 Feb 2015 08:02:48 +0000 (18:32 +1030)]
gas doc warning fixes
* doc/as.texinfo (Local Symbol Names): Don't use ':' in pxref.
* doc/c-i386.texi: Reorder i386-Bugs after i386-Arch.
Alan Modra [Wed, 18 Feb 2015 06:32:39 +0000 (17:02 +1030)]
Strip undefined symbols from .symtab
bfd/
PR ld/4317
* elflink.c (elf_link_input_bfd): Drop undefined local syms.
(elf_link_output_extsym): Drop local and global undefined syms.
Tidy. Expand comment.
ld/testsuite/
PR ld/4317
* ld-aarch64/gc-tls-relocs.d, * ld-cris/locref2.d,
* ld-elf/ehdr_start-weak.d, * ld-elf/group1.d,
* ld-i386/compressed1.d, * ld-ia64/error1.d, * ld-ia64/error2.d,
* ld-ia64/error3.d, * ld-mips-elf/pic-and-nonpic-1.nd,
* ld-mmix/undef-3.d, * ld-powerpc/tlsexe.r, * ld-powerpc/tlsexetoc.r,
* ld-powerpc/tlsso.r, * ld-powerpc/tlstocso.r,
* ld-x86-64/compressed1.d, * ld-x86-64/pie1.d: Update.
GDB Administrator [Thu, 19 Feb 2015 00:00:08 +0000 (00:00 +0000)]
Automatic date update in version.in
Patrick Palka [Wed, 18 Feb 2015 23:50:51 +0000 (18:50 -0500)]
Add missing gdb/ChangeLog entry for previous change.
Patrick Palka [Tue, 17 Feb 2015 16:13:43 +0000 (11:13 -0500)]
Asynchronously resize the TUI
This patch teaches the TUI to resize itself asynchronously instead of
synchronously. Asynchronously resizing the screen when the underlying
terminal gets resized is the more intuitive behavior and is surprisingly
simple to implement thanks to GDB's async infrastructure.
The implementation is straightforward. TUI's SIGWINCH handler is just
tweaked to asynchronously invoke a new callback,
tui_async_resize_screen, which is responsible for safely resizing the
screen. Care must be taken to not to attempt to asynchronously resize
the screen while the TUI is not active. When the TUI is not active, the
callback will do nothing, but the screen will yet be resized in the next
call to tui_enable() by virtue of win_resized being TRUE.
(So, after the patch there are still two places where the screen gets
resized: one in tui_enable() and the other now in
tui_async_resize_screen() as opposed to being in
tui_handle_resize_during_io(). The one in tui_enable() is still
necessary to handle the case where the terminal gets resized inside the
CLI: in that case, the TUI still needs resizing, but it must wait until
the TUI gets re-enabled.)
gdb/ChangeLog:
* tui/tui-io.c (tui_handle_resize_during_io): Remove this
function.
(tui_putc): Don't call tui_handle_resize_during_io.
(tui_getc): Likewise.
(tui_mld_getc): Likewise.
* tui/tui-win.c: Include event-loop.h and tui/tui-io.h.
(tui_sigwinch_token): New static variable.
(tui_initialize_win): Adjust documentation. Set
tui_sigwinch_token.
(tui_async_resize_screen): New asynchronous callback.
(tui_sigwinch_handler): Adjust documentation. Asynchronously
invoke tui_async_resize_screen.
Jose E. Marchesi [Wed, 18 Feb 2015 12:52:53 +0000 (13:52 +0100)]
Factorize target program transformations in the GDB_AC_TRANSFORM macro.
This patch introduces a new M4 macro GDB_AC_TRANSFORM to avoid repeating
the common idiom which is the transformation of target program names,
i.e. from gdb to sparc64-linux-gnu-gdb. It also makes gdb/configure.ac
and gdb/testsuite/configure.ac to use the new macro.
gdb/ChangeLog:
2015-02-18 Jose E. Marchesi <jose.marchesi@oracle.com>
* configure: Regenerated.
* configure.ac: Use GDB_AC_TRANSFORM.
* Makefile.in (aclocal_m4_deps): Added transform.m4.
* acinclude.m4: sinclude transform.m4.
* transform.m4: New file.
(GDB_AC_TRANSFORM): New macro.
gdb/testsuite/ChangeLog:
2015-02-18 Jose E. Marchesi <jose.marchesi@oracle.com>
* configure: Regenerated.
* configure.ac: Use GDB_AC_TRANSFORM.
* aclocal.m4: sinclude ../transform.m4.
Alan Modra [Wed, 18 Feb 2015 12:06:35 +0000 (22:36 +1030)]
Fix gold error: hidden symbol '...' is not defined locally
Found when applying relocs in .debug that reference removed functions.
PR 17954
* powerpc.cc (Global_symbol_visitor_opd::operator()): Set default
visibility.
GDB Administrator [Wed, 18 Feb 2015 00:00:08 +0000 (00:00 +0000)]
Automatic date update in version.in
Rafael Ávila de Espíndola [Tue, 17 Feb 2015 15:49:41 +0000 (10:49 -0500)]
Simplify Garbage_collection::add_reference a bit.
this->section_reloc_map_[src_id] is created if it doesn't exist, so there
is no point in doing a find.
Rafael Ávila de Espíndola [Tue, 17 Feb 2015 15:47:02 +0000 (10:47 -0500)]
avoid std::vector copy.
Rafael Ávila de Espíndola [Tue, 17 Feb 2015 15:43:20 +0000 (10:43 -0500)]
Use std::upper_bound to simplify code a bit.
With std::upper_bound we don't have to check p->input_offset > input_offset.
Jose E. Marchesi [Tue, 17 Feb 2015 15:43:48 +0000 (16:43 +0100)]
Announce the DTrace USDT probes support in NEWS.
This patch simply adds a small entry to `Changes since GDB 7.8' announcing the
support for dtrace probes.
gdb/ChangeLog:
2015-02-17 Jose E. Marchesi <jose.marchesi@oracle.com>
* NEWS: Announce the support for DTrace SDT probes.
Jose E. Marchesi [Tue, 17 Feb 2015 15:42:15 +0000 (16:42 +0100)]
Documentation for DTrace USDT probes.
This patch modifies the `Static Probe Points' section on the GDB
manual in order to cover the support for DTrace USDT probes, in
addition to SystemTap SDT probes.
gdb/doc/ChangeLog:
2015-02-17 Jose E. Marchesi <jose.marchesi@oracle.com>
* gdb.texinfo (Static Probe Points): Add cindex `static probe
point, DTrace'.
(Static Probe Points): Modified to cover DTrace probes in addition
to SystemTap probes. Also modified to cover the `enable probe'
and `disable probe' commands.
Jose E. Marchesi [Tue, 17 Feb 2015 15:41:16 +0000 (16:41 +0100)]
Simple testsuite for DTrace USDT probes.
This patch adds some simple tests testing the support for DTrace USDT
probes. The testsuite will be skipped as unsupported in case the user
does not have DTrace installed on her system. The tests included in the
test suite test breakpointing on DTrace probes, enabling and disabling
probes, printing of probe arguments of several types and also
breakpointing on several probes with the same name.
gdb/ChangeLog:
2015-02-17 Jose E. Marchesi <jose.marchesi@oracle.com>
* lib/dtrace.exp: New file.
* gdb.base/dtrace-probe.exp: Likewise.
* gdb.base/dtrace-probe.d: Likewise.
* gdb.base/dtrace-probe.c: Likewise.
* lib/pdtrace.in: Likewise.
* configure.ac: Output variables with the transformed names of
the strip, readelf, as and nm tools. AC_SUBST lib/pdtrace.in.
* configure: Regenerated.
Jose E. Marchesi [Tue, 17 Feb 2015 15:04:01 +0000 (16:04 +0100)]
Support for DTrace USDT probes in x86_64 targets.
This patch adds the target-specific code in order to support the
calculation of DTrace probes arguments in x86_64 targets, and also the
enabling and disabling of probes. This is done by implementing the
`dtrace_*' gdbarch handlers.
gdb/ChangeLog:
2015-02-17 Jose E. Marchesi <jose.marchesi@oracle.com>
* amd64-linux-tdep.c: Include "parser-defs.h" and "user-regs.h".
(amd64_dtrace_parse_probe_argument): New function.
(amd64_dtrace_probe_is_enabled): Likewise.
(amd64_dtrace_enable_probe): Likewise.
(amd64_dtrace_disable_probe): Likewise.
(amd64_linux_init_abi): Register the
`gdbarch_dtrace_probe_argument', `gdbarch_dtrace_enable_probe',
`gdbarch_dtrace_disable_probe' and
`gdbarch_dtrace_probe_is_enabled' hooks.
(amd64_dtrace_disabled_probe_sequence_1): New constant.
(amd64_dtrace_disabled_probe_sequence_2): Likewise.
(amd64_dtrace_enable_probe_sequence): Likewise.
(amd64_dtrace_disable_probe_sequence): Likewise.
Jose E. Marchesi [Tue, 17 Feb 2015 15:03:22 +0000 (16:03 +0100)]
New probe type: DTrace USDT probes.
This patch adds a new type of probe to GDB: the DTrace USDT probes. The new
type is added by providing functions implementing all the entries of the
`probe_ops' structure defined in `probe.h'. The implementation is
self-contained and does not depend on DTrace source code in any way.
gdb/ChangeLog:
2015-02-7 Jose E. Marchesi <jose.marchesi@oracle.com>
* breakpoint.c (BREAK_ARGS_HELP): Help string updated to mention
the -probe-dtrace new vpossible value for PROBE_MODIFIER.
* configure.ac (CONFIG_OBS): dtrace-probe.o added if BFD can
handle ELF files.
* Makefile.in (SFILES): dtrace-probe.c added.
* configure: Regenerate.
* dtrace-probe.c: New file.
(SHT_SUNW_dof): New constant.
(dtrace_probe_type): New enum.
(dtrace_probe_arg): New struct.
(dtrace_probe_arg_s): New typedef.
(struct dtrace_probe_enabler): New struct.
(dtrace_probe_enabler_s): New typedef.
(dtrace_probe): New struct.
(dtrace_probe_is_linespec): New function.
(dtrace_dof_sect_type): New enum.
(dtrace_dof_dofh_ident): Likewise.
(dtrace_dof_encoding): Likewise.
(DTRACE_DOF_ENCODE_LSB): Likewise.
(DTRACE_DOF_ENCODE_MSB): Likewise.
(dtrace_dof_hdr): New struct.
(dtrace_dof_sect): Likewise.
(dtrace_dof_provider): Likewise.
(dtrace_dof_probe): Likewise.
(DOF_UINT): New macro.
(DTRACE_DOF_PTR): Likewise.
(DTRACE_DOF_SECT): Likewise.
(dtrace_process_dof_probe): New function.
(dtrace_process_dof): Likewise.
(dtrace_build_arg_exprs): Likewise.
(dtrace_get_arg): Likewise.
(dtrace_get_probes): Likewise.
(dtrace_get_probe_argument_count): Likewise.
(dtrace_can_evaluate_probe_arguments): Likewise.
(dtrace_evaluate_probe_argument): Likewise.
(dtrace_compile_to_ax): Likewise.
(dtrace_probe_destroy): Likewise.
(dtrace_gen_info_probes_table_header): Likewise.
(dtrace_gen_info_probes_table_values): Likewise.
(dtrace_probe_is_enabled): Likewise.
(dtrace_probe_ops): New variable.
(info_probes_dtrace_command): New function.
(_initialize_dtrace_probe): Likewise.
(dtrace_type_name): Likewise.
Jose E. Marchesi [Tue, 17 Feb 2015 14:54:44 +0000 (15:54 +0100)]
New gdbarch functions: dtrace_parse_probe_argument, dtrace_probe_is_enabled, dtrace_enable_probe, dtrace_disable_probe.
This patch adds several gdbarch functions (along with the corresponding
predicates): `dtrace_parse_probe_argument', `dtrace_probe_is_enabled',
`dtrace_enable_probe' and `dtrace_disable_probe'. These functions will
be implemented by target-specific code, and called from the DTrace
probes implementation in order to calculate the value of probe
arguments, and manipulate is-enabled probes.
gdb/ChangeLog:
2015-02-17 Jose E. Marchesi <jose.marchesi@oracle.com>
* gdbarch.sh (dtrace_parse_probe_argument): New.
(dtrace_probe_is_enabled): Likewise.
(dtrace_enable_probe): Likewise.
(dtrace_disable_probe): Likewise.
* gdbarch.c: Regenerate.
* gdbarch.h: Regenerate.
Jose E. Marchesi [Tue, 17 Feb 2015 14:51:07 +0000 (15:51 +0100)]
New commands `enable probe' and `disable probe'.
This patch adds the above-mentioned commands to the generic probe
abstraction implemented in probe.[ch]. The effects associated to
enabling or disabling a probe depend on the type of probe being
handled, and is triggered by invoking two back-end hooks in
`probe_ops'.
In case some particular probe type does not support the notion of
enabling and/or disabling, the corresponding fields on `probe_ops' can
be initialized to NULL. This is the case of SystemTap probes.
gdb/ChangeLog:
2015-02-17 Jose E. Marchesi <jose.marchesi@oracle.com>
* stap-probe.c (stap_probe_ops): Add NULLs in the static
stap_probe_ops for `enable_probe' and `disable_probe'.
* probe.c (enable_probes_command): New function.
(disable_probes_command): Likewise.
(_initialize_probe): Define the cli commands `enable probe' and
`disable probe'.
(parse_probe_linespec): New function.
(info_probes_for_ops): Use parse_probe_linespec.
* probe.h (probe_ops): New hooks `enable_probe' and
`disable_probe'.
gdb/doc/ChangeLog:
2015-02-17 Jose E. Marchesi <jose.marchesi@oracle.com>
* gdb.texinfo (Static Probe Points): Cover the `enable probe' and
`disable probe' commands.
Jose E. Marchesi [Tue, 17 Feb 2015 14:50:19 +0000 (15:50 +0100)]
Move `compute_probe_arg' and `compile_probe_arg' to probe.c
This patch moves the `compute_probe_arg' and `compile_probe_arg' functions
from stap-probe.c to probe.c. The rationale is that it is reasonable to
assume that all backends will provide the `$_probe_argN' convenience
variables, and that the user must be placed on the PC of the probe when
requesting that information. The value and type of the argument can still be
determined by the probe backend via the `pops->evaluate_probe_argument' and
`pops->compile_to_ax' handlers.
Note that a test in gdb.base/stap-probe.exp had to be adjusted because the "No
SystemTap probe at PC" messages are now "No probe at PC".
gdb/ChangeLog:
2015-02-17 Jose E. Marchesi <jose.marchesi@oracle.com>
* probe.c (compute_probe_arg): Moved from stap-probe.c
(compile_probe_arg): Likewise.
(probe_funcs): Likewise.
* stap-probe.c (compute_probe_arg): Moved to probe.c.
(compile_probe_arg): Likewise.
(probe_funcs): Likewise.
gdb/testsuite/ChangeLog:
2015-02-17 Jose E. Marchesi <jose.marchesi@oracle.com>
* gdb.base/stap-probe.exp (stap_test): Remove "SystemTap" from
expected message when trying to access $_probe_* convenience
variables while not on a probe.
Jose E. Marchesi [Tue, 17 Feb 2015 14:49:12 +0000 (15:49 +0100)]
Adapt `info probes' to support printing probes of different types.
A "probe type" (backend for the probe abstraction implemented in
probe.[ch]) can extend the information printed by `info probes' by
defining additional columns. This means that when `info probes' is
used to print all the probes regardless of their types, some of the
columns will be "not applicable" to some of the probes (like, say, the
Semaphore column only makes sense for SystemTap probes). This patch
makes `info probes' fill these slots with "n/a" marks (currently it
breaks the table) and not include headers for which no actual probe
has been found in the list of defined probes.
This patch also adds support for a new generic column "Type", that
displays the type of each probe. SystemTap probes identify themselves
as "stap" probes.
gdb/ChangeLog:
2015-02-17 Jose E. Marchesi <jose.marchesi@oracle.com>
* probe.c (print_ui_out_not_applicables): New function.
(exists_probe_with_pops): Likewise.
(info_probes_for_ops): Do not include column headers for probe
types for which no probe has been actually found on any object.
Also invoke `print_ui_out_not_applicables' in order to match the
column rows with the header when probes of several types are
listed.
Print the "Type" column.
* probe.h (probe_ops): Added a new probe operation `type_name'.
* stap-probe.c (stap_probe_ops): Add `stap_type_name'.
(stap_type_name): New function.
Alan Modra [Mon, 16 Feb 2015 22:44:59 +0000 (09:14 +1030)]
Properly place the NULL STT_FILE symbol revistited
I was having a little closer look at what is going on here and noticed
that HJ unconditionally emits a NULL STT_FILE symbol before emitting
forced local symbols. That means we really don't need a second pass
over forced local symbols. The only reason for two passes is when
some forced local symbol can be emitted before the NULL STT_FILE. So
I set about removing the second pass, updating the testsuite all over
again. It's also unnecessary to emit the NULL STT_FILE when no
previous file symbol has been emitted.
bfd/
PR ld/17975
* elflink.c (struct elf_outext_info): Remove need_second_pass
and second_pass.
(elf_link_output_extsym): Delete code handling second forced
local pass. Move code emitting NULL STT_FILE symbol later, so
that it can be omitted if forced local is stripped. Don't
emit the NULL STT_FILE if no file symbols have been output.
(bfd_elf_final_link): Remove second forced local pass.
* elf32-ppc.c (add_stub_sym): Set linker_def on linker syms.
(ppc_elf_size_dynamic_sections): Likewise.
* elf64-ppc.c (ppc_build_one_stub): Likewise.
(build_global_entry_stubs): Likewise.
(ppc64_elf_build_stubs): Likewise.
ld/testsuite/
PR ld/17975
* ld-aarch64/gc-tls-relocs.d, * ld-alpha/tlspic.rd,
* ld-cris/libdso-2.d, * ld-i386/tlsdesc-nacl.rd, * ld-i386/tlsdesc.rd,
* ld-i386/tlsnopic-nacl.rd, * ld-i386/tlsnopic.rd,
* ld-i386/tlspic-nacl.rd, * ld-i386/tlspic.rd, * ld-ia64/tlspic.rd,
* ld-powerpc/tlsexe.r, * ld-powerpc/tlsexetoc.r,
* ld-powerpc/tlsso.r, * ld-powerpc/tlstocso.r,
* ld-s390/tlspic.rd, * ld-s390/tlspic_64.rd,
* ld-sparc/tlssunnopic32.rd, * ld-sparc/tlssunnopic64.rd,
* ld-sparc/tlssunpic32.rd, * ld-sparc/tlssunpic64.rd,
* ld-tic6x/shlib-1.rd, * ld-tic6x/shlib-1b.rd, * ld-tic6x/shlib-1r.rd,
* ld-tic6x/shlib-1rb.rd, * ld-tic6x/shlib-noindex.rd,
* ld-x86-64/tlsdesc-nacl.rd, * ld-x86-64/tlsdesc.rd,
* ld-x86-64/tlspic-nacl.rd, * ld-x86-64/tlspic.rd: Update.
Patrick Palka [Tue, 17 Feb 2015 13:06:10 +0000 (08:06 -0500)]
Remove superfluous function key_is_command_char()
The function key_is_command_char() is simply a predicate that determines
whether the function tui_dispatch_ctrl_char() will do anything useful.
Since tui_dispatch_ctrl_char() performs the same checks as
key_is_command_char() it is unnecessary to keep key_is_command_char()
around. This patch removes this useless function and instead
unconditionally calls tui_dispatch_ctrl_char() inside its only caller,
tui_getc().
gdb/ChangeLog:
* tui/tui-io.c (tui_getc): Don't call key_is_command_char.
(key_is_command_char): Delete.
Pedro Alves [Tue, 17 Feb 2015 10:05:52 +0000 (10:05 +0000)]
TUI: resize windows to new terminal size before displaying them
If the user:
#1 - disables the TUI
#2 - resizes the terminal
#3 - and then re-enables the TUI
the next wgetch() returns KEY_RESIZE. This indicates to the ncurses
client that ncurses detected that the terminal has been resized. We
don't handle KEY_RESIZE anywhere, so it gets passed on to readline
which interprets it as a multibyte character, and then the end result
is that the first key press after enabling the TUI is misinterpreted.
We shouldn't really need to handle KEY_RESIZE (and not all ncurses
implementations have that). We have our own SIGWINCH handler, and,
when we re-enable the TUI, we explicitly detect terminal resizes and
resize all windows. The reason ncurses currently does detects a
resize is that something within tui_enable forces a refresh/display of
some window before we get to do the actual resizing. Setting a break
on ncurses' 'resizeterm' function helps find the culprit(s):
(top-gdb) bt
#0 resizeterm (ToLines=28, ToCols=114) at ../../ncurses/base/resizeterm.c:462
#1 0x0000003b42812f3f in _nc_update_screensize (sp=0x2674730) at ../../ncurses/tinfo/lib_setup.c:443
#2 0x0000003b0821cbe0 in doupdate () at ../../ncurses/tty/tty_update.c:726
#3 0x0000003b08215539 in wrefresh (win=0x2a7bc00) at ../../ncurses/base/lib_refresh.c:65
#4 0x00000000005257cb in tui_refresh_win (win_info=0xd73d60 <_locator>) at /home/pedro/gdb/mygit/src/gdb/tui/tui-wingeneral.c:60
#5 0x000000000052265b in tui_show_locator_content () at /home/pedro/gdb/mygit/src/gdb/tui/tui-stack.c:269
#6 0x00000000005273a6 in tui_set_key_mode (mode=TUI_COMMAND_MODE) at /home/pedro/gdb/mygit/src/gdb/tui/tui.c:321
#7 0x00000000005278c7 in tui_enable () at /home/pedro/gdb/mygit/src/gdb/tui/tui.c:494
#8 0x0000000000527011 in tui_rl_switch_mode (notused1=1, notused2=1) at /home/pedro/gdb/mygit/src/gdb/tui/tui.c:108
That is, tui_enable calls tui_set_key_mode before we've resized all
windows, and that refreshes a window as side effect.
And if we're already debugging something (there's a frame), then we'll
instead show a window from within tui_show_frame_info:
(top-gdb) bt
#0 resizeterm (ToLines=28, ToCols=114) at ../../ncurses/base/resizeterm.c:462
#1 0x0000003b42812f3f in _nc_update_screensize (sp=0x202e6c0) at ../../ncurses/tinfo/lib_setup.c:443
#2 0x0000003b0821cbe0 in doupdate () at ../../ncurses/tty/tty_update.c:726
#3 0x0000003b08215539 in wrefresh (win=0x2042890) at ../../ncurses/base/lib_refresh.c:65
#4 0x00000000005257cb in tui_refresh_win (win_info=0xd73d60 <_locator>) at /home/pedro/gdb/mygit/src/gdb/tui/tui-wingeneral.c:60
#5 0x000000000052265b in tui_show_locator_content () at /home/pedro/gdb/mygit/src/gdb/tui/tui-stack.c:269
#6 0x0000000000522931 in tui_show_frame_info (fi=0x16b9cc0) at /home/pedro/gdb/mygit/src/gdb/tui/tui-stack.c:364
#7 0x00000000005278ba in tui_enable () at /home/pedro/gdb/mygit/src/gdb/tui/tui.c:491
#8 0x0000000000527011 in tui_rl_switch_mode (notused1=1, notused2=1) at /home/pedro/gdb/mygit/src/gdb/tui/tui.c:108
The fix is to resize windows earlier.
gdb/ChangeLog:
2015-02-17 Pedro Alves <palves@redhat.com>
* tui/tui.c (tui_enable): Resize windows before anything
might show a window.
Maxim Ostapenko [Mon, 16 Feb 2015 16:24:53 +0000 (20:24 +0400)]
Fix GDB build fail on Aarch64 when -fno-common is enabled
Current trunk GDB (and gdb-7.8.1 too) fails to build on Aarch64 when
-fno-common is enabled. It fails during link stage due to multiple
definition of `tdesc_aarch64':
...
[ 199s] aarch64-linux-nat.o: In function `initialize_tdesc_aarch64':
[ 199s]
/home/abuild/rpmbuild/BUILD/gdb-7.8.1/gdb/features/aarch64.c:11:
multiple definition of `tdesc_aarch64'
[ 199s]
aarch64-tdep.o:/home/abuild/rpmbuild/BUILD/gdb-7.8.1/gdb/objfiles.h:540:
first defined here
[ 199s] aarch64-linux-nat.o: In function `initialize_tdesc_aarch64':
[ 199s]
/home/abuild/rpmbuild/BUILD/gdb-7.8.1/gdb/features/aarch64.c:11:
multiple definition of `tdesc_aarch64'
[ 199s]
aarch64-tdep.o:/home/abuild/rpmbuild/BUILD/gdb-7.8.1/gdb/objfiles.h:540:
first defined here
[ 199s] collect2: error: ld returned 1 exit status
[ 199s] make[2]: *** [gdb] Error 1
...
This happens because struct target_desc *tdesc_aarch64 is defined in
gdb/features/aarch64.c, which is included by two files
(gdb/aarch64-linux-nat.c and gdb/aarch64-tdep.c).
gdb/Changelog
2015-02-17 Max Ostapenko <m.ostapenko@partner.samsung.com>
PR gdb/17984
* aarch64-linux-nat.c: Don't include features/aarch64.c anymore.
(aarch64_linux_read_description): Remove initialize_tdesc_aarch64
call.
* aarch64-tdep.h (tdesc_aarch64): Declare.
Mark Wielaard [Mon, 9 Feb 2015 23:02:34 +0000 (00:02 +0100)]
[gold] Recognize DWARF5/GCC5 DW_LANG_Fortran03 and DW_LANG_Fortran08.
DWARFv5 defines and GCC5 may output two new DW_LANG constants for the
Fortran 2003 and Fortran 2008 standards. Recognize both in gold gdb-index
as unsupported.
For consistency also add the other new DWARF5/GCC5 language constants in
the elfcpp::DW_LANG enum to match include/dwarf2.h.
elfcpp/ChangeLog:
* dwarf.h (enum DW_LANG): Add DW_LANG_C_plus_plus_11,
DW_LANG_C11, DW_LANG_C_plus_plus_14, DW_LANG_Fortran03 and
DW_LANG_Fortran08 from ../include/dwarf2.h.
gold/ChangeLog:
* gdb-index.cc (Gdb_index_info_reader::visit_top_die): Recognize
DW_LANG_Fortran03 and DW_LANG_Fortran08.
Cary Coutant [Tue, 17 Feb 2015 06:15:12 +0000 (22:15 -0800)]
Fix --dynamic-list so that symbols not in the list are still exported.
In PR 13577, the complaint was that -Bsymbolic was overriding the binding
behavior for symbols listed in the --dynamic-list by setting the DT_SYMBOLIC
tag in the dynamic table. In reading the Gnu ld manual, I decided that
--dynamic-list should be mutually exclusive of -Bsymbolic, and modified
gold so that --dynamic-list would treat symbols listed as preemptible,
and all other symbols as internally bound. I was wrong.
PR 16992 shows that with --dynamic-list (and not -Bsymbolic), a symbol
not listed in the dynamic list is being internally bound within the
shared library, but because it's still in the dynamic symbol table, we
expose it to a COPY relocation, and things go really bad from there.
(I can reproduce the same failure, simply by turning on -Bsymbolic-functions
with the Gnu linker. Even though the symbol is bound internally, it's
still exported to the dynamic symbol table, and is exposed to a COPY
relocation.)
I've backed out part of the fix for PR 13577, and -Bsymbolic (or
-Bsymbolic-functions) can now be used with --dynamic-list, but if the
two are used together, we do not set DT_SYMBOLIC or DF_SYMBOLIC
(this matches Gnu ld behavior). We now treat symbols listed in the
dynamic list as premptible, but we do not automatically treat symbols
not listed there as non-premptible.
gold/
PR gold/13577
PR gold/16992
* layout.cc (Layout::finish_dynamic_section): Don't set DT_SYMBOLIC or
DF_SYMBOLIC if --dynamic-list option is used.
* options.cc (General_options::finalize): --dynamic-list is not
mutually exclusive with -Bsymbolic.
* symtab.h (Symbol::is_preemptible): Don't exclude dynamic symbols not
listed in --dynamic-list.
* testsuite/Makefile.am (dynamic_list_lib2.so): Add
-Bsymbolic-functions.
* testsuite/Makefile.in: Regenerate.
Cary Coutant [Tue, 17 Feb 2015 04:14:08 +0000 (20:14 -0800)]
Remove redundant include of "output.h".
gold/
PR gold/17971
* incremental.cc: Remove redundant include of "output.h".
GDB Administrator [Tue, 17 Feb 2015 00:00:09 +0000 (00:00 +0000)]
Automatic date update in version.in
H.J. Lu [Mon, 16 Feb 2015 17:07:42 +0000 (09:07 -0800)]
Correct a typo in ld/testsuite/ChangeLog
H.J. Lu [Mon, 16 Feb 2015 16:35:17 +0000 (08:35 -0800)]
Update more ld testcases after PR ld/17975 fix
* ld-alpha/tlspic.rd: Updated.
* ld-powerpc/tlsexe.r: Likewise.
* ld-powerpc/tlsexetoc.r: Likewise.
* ld-powerpc/tlsso.r: Likewise.
* ld-powerpc/tlstocso.r: Likewise.
* ld-s390/tlspic.rd: Likewise.
* ld-s390/tlspic_64.rd: Likewise.
* ld-sparc/gotop32.dd: Likewise.
* ld-sparc/gotop64.dd: Likewise.
* ld-sparc/tlssunnopic32.rd: Likewise.
* ld-sparc/tlssunnopic64.rd: Likewise.
* ld-sparc/tlssunpic32.rd: Likewise.
* ld-sparc/tlssunpic64.rd: Likewise.
* ld-tic6x/shlib-1.rd: Likewise.
* ld-tic6x/shlib-1b.rd: Likewise.
* ld-tic6x/shlib-1r.rd: Likewise.
* ld-tic6x/shlib-1rb.rd: Likewise.
* ld-tic6x/shlib-noindex.rd: Likewise.
H.J. Lu [Mon, 16 Feb 2015 15:31:46 +0000 (07:31 -0800)]
Add ChangeLog entries for PR ld/17975 fix
H.J. Lu [Sun, 15 Feb 2015 04:17:28 +0000 (20:17 -0800)]
Properly place the NULL STT_FILE symbol
We output a NULL STT_FILE symbol for forced local symbols so that they
are not associated with the STT_FILE symbol for real local symbols. This
patch makes sure that the NULL STT_FILE symbol is placed before forced
local symbols.
bfd/
PR ld/17975
* elflink.c (elf_link_output_extsym): Only check filesym_count
when outputting a NULL FILE symbol. Set second_pass_sym to
h->forced_local && !h->root.linker_def.
ld/testsuite/
PR ld/17975
* ld-i386/tlsbin-nacl.rd: Likewise.
* ld-i386/tlsbin.rd: Likewise.
* ld-i386/tlsbindesc-nacl.rd: Likewise.
* ld-i386/tlsbindesc.rd: Likewise.
* ld-i386/tlsdesc-nacl.rd: Likewise.
* ld-i386/tlsdesc.rd: Likewise.
* ld-i386/tlsnopic-nacl.rd: Likewise.
* ld-i386/tlsnopic.rd: Likewise.
* ld-i386/tlspic-nacl.rd: Likewise.
* ld-i386/tlspic.rd: Likewise.
* ld-x86-64/tlsbin-nacl.rd: Likewise.
* ld-x86-64/tlsbin.rd: Likewise.
* ld-x86-64/tlsbindesc-nacl.rd: Likewise.
* ld-x86-64/tlsbindesc.rd: Likewise.
* ld-x86-64/tlsdesc-nacl.rd: Likewise.
* ld-x86-64/tlsdesc.rd: Likewise.
* ld-x86-64/tlspic-nacl.rd: Likewise.
* ld-x86-64/tlspic.rd: Likewise.
Mark Wielaard [Thu, 12 Feb 2015 15:51:53 +0000 (16:51 +0100)]
Remove true and false ARI checks now that we use stdbool.h.
gdb/ChangeLog:
* contrib/ari/gdb_ari.sh: Remove checks for "true" and "false".
GDB Administrator [Mon, 16 Feb 2015 00:00:08 +0000 (00:00 +0000)]
Automatic date update in version.in
H.J. Lu [Sun, 15 Feb 2015 04:17:10 +0000 (20:17 -0800)]
Set root.linker_def on _TLS_MODULE_BASE_
* elf32-i386.c (elf_i386_always_size_sections): Set root.linker_def
on _TLS_MODULE_BASE_.
* elf64-x86-64.c (elf_x86_64_always_size_sections): Likewise.
Nick Clifton [Sun, 15 Feb 2015 15:05:18 +0000 (15:05 +0000)]
This fixes a bug I introduced to the PDP11 target when I was trying to fix an illegal memory access problem.
* pdp11.c (aout_get_external_symbols): Return TRUE if there are no
symbols - just set the count to zero.
Alan Modra [Sun, 15 Feb 2015 08:32:46 +0000 (19:02 +1030)]
fix
dbb3fbbb dwarf2.c breakage
m68hc11-elf +FAIL: 68HC12 indexed addressing mode with 5, 9 and 16-bit offsets (indexed12)
m68hc12-elf +FAIL: 68HC12 indexed addressing mode with 5, 9 and 16-bit offsets (indexed12)
* dwarf2.c (read_rangelist): Correct buffer overflow check
Whitespace throughout file.
GDB Administrator [Sun, 15 Feb 2015 00:00:07 +0000 (00:00 +0000)]
Automatic date update in version.in
H.J. Lu [Sat, 14 Feb 2015 13:45:08 +0000 (05:45 -0800)]
Add a testcase for PR ld/17973
ld/
PR ld/17973
* testplug2.c (allsymbolsread_silent): New.
(set_register_hook): Handle allsymbolsreadsilent.
(onall_symbols_read): Skip a message if allsymbolsread_silent is
TRUE.
ld/testsuite/
PR ld/17973
* ld-plugin/plugin.exp (regassilent): New.
Compile tmpdir/dummy.s and ld-plugin/pr17973.s.
(plugin_tests): Add a test for PR ld/17973.
* ld-plugin/pr17973.d: New file.
* ld-plugin/pr17973.s: Likewise.
Alan Modra [Sat, 14 Feb 2015 08:08:32 +0000 (18:38 +1030)]
PR ld/17973 LTO file syms
LTO output objects have an STT_FILE symbol using the name of the file,
a temporary file. This results in executables that can't be exactly
reproduced, so the file name needs to be dropped. We don't want to
lose all file symbols when linking a mix of lto and non-lto objects as
a file symbol can be used to figure which source file generated a
given local symbol. So lto output objects need to be marked.
I chose to mark lto output objects with a new bfd flag. This flag is
also used to fix a bug in the link-once handling; An object being
loaded after "loading_lto_outputs" is set might be one extracted from
an archive to satisfy new references from lto objects, not an lto
object itself.
The new flag is copied from archive to elements, and the same done
for no_export. This fixes a bug in that --exclude-libs doesn't work
with thin archives. I'm not completely happy with this part of the
patch and may revist this to avoid the hack in
_bfd_look_for_bfd_in_cache.
PR ld/17973
include/
* bfdlink.h (struct bfd_link_info): Delete loading_lto_outputs.
bfd/
* bfd.c (struct bfd): Add lto_output.
* linker.c (_bfd_handle_already_linked): Explicitly test for
objects added by the lto plugin.
* opncls.c (_bfd_new_bfd_contained_in): Copy lto_output and
no_export flags from archive.
* archive.c (open_nested_file): New function, setting lto_output
and no_export, extracted from..
(find_nested_archive): ..here. Flip params. Rename from
_bfd_find_nested_archive.
(_bfd_get_elt_at_filepos): Correct var typo. Use open_nested_file.
(_bfd_look_for_bfd_in_cache): Copy no_export.
* elflink.c (elf_link_add_object_symbols): Remove now unnecessary
my_archive->no_export test.
(elf_link_input_bfd): Drop existing lto_output STT_FILE syms.
Don't use the file name when adding lto_output STT_FILE sym.
* bfd-in2.h: Regenerate.
ld/
* ldlang.h (struct lang_input_statement_flags): Add lto_output.
* ldlang.c (lang_process): Don't set loading_lto_outputs.
* ldfile.c (ldfile_try_open_bfd): Transfer entry flags.lto_output
to bfd.
* plugin.c (add_input_file, add_input_library): Set flags.lto_output.
GDB Administrator [Sat, 14 Feb 2015 00:00:08 +0000 (00:00 +0000)]
Automatic date update in version.in
Doug Evans [Fri, 13 Feb 2015 20:03:50 +0000 (12:03 -0800)]
misc cp-namespace.c cleanups
gdb/ChangeLog:
* cp-namespace.c (cp_basic_lookup_symbol): Rename parameter
anonymous_namespace to is_in_anonymous for consistency with the rest
of the file.
(cp_lookup_bare_symbol): Fix typo in comment.
(cp_search_static_and_baseclasses): Ditto.
(search_symbol_list): Use vertical space in comment better.
(reset_directive_searched): Ditto. Fix typo.
(cp_lookup_nested_symbol_1): Clarify contents of NESTED_NAME parameter.
Chen Gang [Thu, 12 Feb 2015 21:32:30 +0000 (05:32 +0800)]
sim/common/gentmap.c: Include "string.h".
The related warnings:
gcc ../../../binutils-gdb/sim/mcore/../common/gentmap.c -o gentmap -g -O -I. -I../../../binutils-gdb/sim/mcore -I../common -I../../../binutils-gdb/sim/mcore/../common -I../../include -I../../../binutils-gdb/sim/mcore/../../include -I../../bfd -I../../../binutils-gdb/sim/mcore/../../bfd -I../../opcodes -I../../../binutils-gdb/sim/mcore/../../opcodes
../../../binutils-gdb/sim/mcore/../common/gentmap.c: In function ‘main’:
../../../binutils-gdb/sim/mcore/../common/gentmap.c:119:7: warning: implicit declaration of function ‘strcmp’ [-Wimplicit-function-declaration]
if (strcmp (argv[1], "-h") == 0)
^
2015-02-13 Chen Gang <gang.chen.5i5j@gmail.com>
* gentmap.c: Include "string.h".
H.J. Lu [Fri, 13 Feb 2015 15:54:21 +0000 (07:54 -0800)]
Mention support for LLVM plugin in NEWS
* NEWS: Mention support for LLVM plugin.
Nick Clifton [Fri, 13 Feb 2015 14:17:18 +0000 (14:17 +0000)]
Fixes for memory access violations triggered by running readelf on fuzzed binaries.
PR binutils/17531
* dwarf.c (display_debug_aranges): Add check for an excessive
ar_length value.
(process_cu_tu_index): Check for a row * columns sum being too
large.
Nick Clifton [Fri, 13 Feb 2015 12:14:05 +0000 (12:14 +0000)]
Fix illegal memory access errors triggered by running srconv on fuzzed binaries.
PR binutils/17512
* dwarf.c (read_leb128): Fix test for shift becoming too large.
* coffgrok.c (do_define): Add check for type size overflow.
* srconv.c (walk_tree_sfile): Check that enough sections are
available before parsing.
(prescan): Likewise.
Nick Clifton [Fri, 13 Feb 2015 11:13:20 +0000 (11:13 +0000)]
Fix mistake in recent code to check for an unterminated leb128 number.
* dwarf.c (read_leb128): Fix test for shift becoming too large.
Yao Qi [Fri, 13 Feb 2015 10:23:16 +0000 (10:23 +0000)]
Update Yao Qi's email address in MAINTAINERS
gdb:
* MAINTAINERS: Update my email address.
Alan Modra [Thu, 12 Feb 2015 03:10:00 +0000 (13:40 +1030)]
binutils/dwarf.c white space
The style fix here is for num_units * sizeof * debug_information.
* dwarf.c: Formatting, whitespace.
(process_debug_info): Style fix.
Alan Modra [Thu, 12 Feb 2015 03:10:33 +0000 (13:40 +1030)]
Correct ld.texinfo cross reference
Fixes
warning: @pxref cross-reference name should not contain `:'
* ld.texinfo (Options <--defsym>): Correct cross reference.
Alan Modra [Thu, 12 Feb 2015 23:46:16 +0000 (10:16 +1030)]
PowerPC64 offset check should test entire 64-bit value is in section
PR binutils/17512
* elf64-ppc.c (opd_entry_value): Tighten offset check. Remove
now redundant assert.
GDB Administrator [Fri, 13 Feb 2015 00:00:07 +0000 (00:00 +0000)]
Automatic date update in version.in
Jing Yu [Thu, 12 Feb 2015 19:22:25 +0000 (11:22 -0800)]
Add missing TLSLE relocations for gold aarch64 backend.
gold/ChangeLog:
* aarch64-reloc.def (TLSLE_MOVW_TPREL_G2, TLSLE_MOVW_TPREL_G1,
TLSLE_MOVW_TPREL_G1_NC, TLSLE_MOVW_TPREL_G0, TLSLE_MOVW_TPREL_G0_NC,):
New relocation.
* aarch64.cc (Target_aarch64::Scan::local): Add cases for new
TLSLE_MOVW_* relocations.
(Target_aarch64::Scan::global): Likewise.
(Target_aarch64::Relocate::relocate): Likewise.
(Target_aarch64::Relocate::relocate_tls): Add cases and handlings
for new TLSLE_MOVW_* relocations.
Doug Evans [Thu, 12 Feb 2015 21:32:36 +0000 (13:32 -0800)]
completer.c (completion_list_add_name): Fix memory leak.
gdb/ChangeLog:
* completer.c (completion_list_add_name): Fix memory leak.
David Taylor [Thu, 12 Feb 2015 20:38:28 +0000 (22:38 +0200)]
Fix documentation of the QTDV packet
gdb/doc/ChangeLog
2015-02-12 David Taylor <dtaylor@emc.com>
* gdb.texinfo (Tracepoint Packets): Document the builtin and name
fields of the QTDV packet.
Doug Evans [Thu, 12 Feb 2015 20:19:31 +0000 (12:19 -0800)]
completer.c (complete_line): Remove incorrect comment.
gdb/ChangeLog:
* completer.c (complete_line): Remove incorrect comment.
Nick Clifton [Thu, 12 Feb 2015 16:45:11 +0000 (16:45 +0000)]
Fix memory access violations triggered by running addr2line on fuzzed binaries.
PR binutils/17512
* dwarf.c (read_1_byte, read_1_signed_byte, read_2_bytes)
(read_4_bytes, read_8_bytes, read_n_bytes, read_string)
(read_indirect_string, read_alt_indirect_string)
(read_alt_indirect_ref, read_address, read_abbrevs)
(read_attribute_value, read_attribute, decode_line_info)
(find_abstract_instance_name, read_rangelist)
(scan_unit_for_symbols, parse_comp_unit)
(_bfd_dwarf2_find_nearest_line): Harden DWARF reading code. Pass
end pointers to reading functions and check for offsets taking
pointers out of range. Replace calls to read_*_leb128 with calls
to safe_read_leb128.
(* elf64-ppc.c (opd_entry_value): Add a check for an overlarge
offset.
* syms.c (_bfd_stab_section_find_nearest_line): Add checks for
computed file_name address being before the start of the string
table.
Nick Clifton [Thu, 12 Feb 2015 16:32:28 +0000 (16:32 +0000)]
oops - changelog entry accidentally omitted from previous delta.
H.J. Lu [Thu, 12 Feb 2015 12:59:57 +0000 (04:59 -0800)]
Replace elf_i386 with elf_i386_nacl for nacl
* ld-i386/i386.exp: Replace elf_i386 with elf_i386_nacl for nacl.
GDB Administrator [Thu, 12 Feb 2015 00:00:08 +0000 (00:00 +0000)]
Automatic date update in version.in
H.J. Lu [Wed, 11 Feb 2015 20:16:36 +0000 (12:16 -0800)]
Add --[no-]map-whole-files for gold compatibility
Gold supports:
--map-whole-files Map whole files to memory (default on 64-bit hosts)
--no-map-whole-files Map relevant file parts to memory (default on 32-bit hosts)
This patch adds --[no-]map-whole-files command line options for gold
compatibility. They are ignored for ld.
* lexsup.c (ld_options): Add --[no-]map-whole-files for gold
option compatibility.
H.J. Lu [Wed, 11 Feb 2015 20:16:07 +0000 (12:16 -0800)]
Output "warning:" or "error:" in plugin messages
When plugin generates LDPL_WARNING, LDPL_FATAL and LDPL_ERROR messages,
linker should display "warning:" or "error:" in plugin messages like
regular linker messages.
ld/
* plugin.c (message): Output "warning:" for LDPL_WARNING. Output
"error:" for LDPL_FATAL and LDPL_ERROR.
* testplug2.c (parse_option): Handle fatal, error and warning.
ld/testsuite/
* ld-plugin/plugin-27.d: New.
* ld-plugin/plugin-28.d: Likewise.
* ld-plugin/plugin-29.d: Likewise.
* plugin.exp (plugin_tests): Add tests for LDPL_FATAL, LDPL_ERROR
and LDPL_WARNING.
H.J. Lu [Wed, 11 Feb 2015 21:35:07 +0000 (13:35 -0800)]
Remove unused dump_tv_tag
* testplug2.c (dump_tv_tag): Removed.
(onall_symbols_read): Return LDPS_ERR if the file descriptor isn't
closed.
* testplug3.c (dump_tv_tag): Removed.
(onclaim_file): Fix typo.
Nick Clifton [Wed, 11 Feb 2015 14:36:39 +0000 (14:36 +0000)]
Fixes a problem with the RL78 disassembler which would incorrectly disassemble [HL+0] as [HL].
* rl78-decode.opc: Add 'a' attribute to instructions that support
[HL+0] addressing.
* rl78-decode.c: Regenerate.
* rl78-dis.c (print_insn_rl78): Display the offset in [HL+0]
addresses.
Jiong Wang [Wed, 11 Feb 2015 14:35:27 +0000 (14:35 +0000)]
[AArch64] Fix code formatting in the cpu-table
2015-02-11 Matthew Wahab <matthew.wahab@arm.com>
* config/tc-aarch64.c (aarch64_cpus): Fix code formatting.
Jan Kratochvil [Wed, 11 Feb 2015 13:53:14 +0000 (14:53 +0100)]
framefilter quit: New test
It definitely does not test all the RETURN_MASK_ERROR cases. But it tests at
least two of them.
gdb/testsuite/ChangeLog
2015-02-11 Jan Kratochvil <jan.kratochvil@redhat.com>
* gdb.python/py-framefilter.exp (pagination quit - *): New tests.
Jan Kratochvil [Wed, 11 Feb 2015 13:50:09 +0000 (14:50 +0100)]
framefilter quit: Use RETURN_MASK_ERROR
Now when the code is exception safe we can let RETURN_QUIT to pass through as
all the installed cleanups with handle that.
gdb/ChangeLog
2015-02-11 Jan Kratochvil <jan.kratochvil@redhat.com>
* python/py-framefilter.c (py_print_single_arg, enumerate_locals)
(py_print_frame): Use RETURN_MASK_ERROR.
Chen Gang [Wed, 11 Feb 2015 13:39:01 +0000 (21:39 +0800)]
sim/mcore/interp.c: Include "unistd.h".
The related warnings:
gcc -DHAVE_CONFIG_H -DPROFILE=1 -DWITH_PROFILE=-1 -DDEFAULT_INLINE=0 -I. -I../../../binutils-gdb/sim/mcore -I../common -I../../../binutils-gdb/sim/mcore/../common -I../../include -I../../../binutils-gdb/sim/mcore/../../include -I../../bfd -I../../../binutils-gdb/sim/mcore/../../bfd -I../../opcodes -I../../../binutils-gdb/sim/mcore/../../opcodes -g -O2 -c -o interp.o -MT interp.o -MMD -MP -MF .deps/interp.Tpo ../../../binutils-gdb/sim/mcore/interp.c
../../../binutils-gdb/sim/mcore/interp.c: In function ‘handle_trap1’:
../../../binutils-gdb/sim/mcore/interp.c:559:22: warning: implicit declaration of function ‘link’ [-Wimplicit-function-declaration]
cpu.gr[RET1] = link ((char *) a[0], (char *) a[1]);
^
../../../binutils-gdb/sim/mcore/interp.c:585:22: warning: implicit declaration of function ‘access’ [-Wimplicit-function-declaration]
cpu.gr[RET1] = access ((char *) a[0], a[1]);
^
2015-02-11 Chen Gang <gang.chen.5i5j@gmail.com>
* interp.c: Include "unistd.h".
Jan Kratochvil [Wed, 11 Feb 2015 13:44:00 +0000 (14:44 +0100)]
framefilter quit: Make it exception safe
gdb/ChangeLog
2015-02-11 Jan Kratochvil <jan.kratochvil@redhat.com>
* python/py-framefilter.c (py_print_frame): Mention RETURN_QUIT in
function comment. Wrap all function that can throw in cleanups.
(gdbpy_apply_frame_filter): Wrap all function that can throw in
cleanups.
Jan Kratochvil [Wed, 11 Feb 2015 13:40:14 +0000 (14:40 +0100)]
framefilter quit: Code cleanup: Avoid gotos
goto error patters are sometimes AFAIK used in C for the cases like:
int retval=-1;
if (!(a=malloc())) goto error;
if (!(b=malloc())) goto error_a;
if (!(c=malloc())) goto error_b;
retval=0;
error_c: free(c);
error_b: free(b);
error_a: free(a);
error: return retval;
But here there is single error label with one do_cleanups() which I do not find
it worth the goto complication. Without goto one can then furher merge code in
the exit paths in the next patches and ... after all it is all the same, just
without a goto.
gdb/ChangeLog
2015-02-11 Jan Kratochvil <jan.kratochvil@redhat.com>
* python/py-framefilter.c (py_print_frame): Substitute goto error.
Remove the error label.
Jan Kratochvil [Wed, 11 Feb 2015 13:37:40 +0000 (14:37 +0100)]
framefilter quit: Code cleanup: Reindentation
Nothing significant but I find code more clear with less deep indentation.
gdb/ChangeLog
2015-02-11 Jan Kratochvil <jan.kratochvil@redhat.com>
* python/py-framefilter.c (py_print_frame): Put conditional code paths
with goto first, indent the former else codepath left. Put variable
'elided' to a new inner block.