Commit 23283c1b changed the layout of some bss style sections on
powerpc64, but neglected to add a page gap before the third PT_LOAD
segment created by this reording. Without a page gap we get two
PT_LOAD headers that overlap by one page in memory. That shouldn't be
allowed because the dynamic loader will load garbage from the first
page of the last segment over the last page of the previous segment.
bfd/
* elf.c (_bfd_elf_map_sections_to_segments): Do not make a new
segment for loaded sections after nonloaded sections if the
sections are on the same page.
ld/testsuite/
* ld-powerpc/elfv2so.d: Update
This should fix some build errors seen on AIX, MinGW, and possibly other
non-GNU systems too due to missing asprintf().
bfd/
* configure.in: Add asprintf and vasprintf to AC_CHECK_DECLS.
* config.in, configure: Regenerate.
GCC 6 can be configured to generate PIE by default. But some linker
size tests expect non-PIE. This patch defines NOPIE_CFLAGS to
"-fno-PIE" and NOPIE_LDFLAGS to "-no-pie" if target compiler supports
them. Add $NOPIE_CFLAGS and $NOPIE_LDFLAGS to linker size tests if
needed.
* config/default.exp (NOPIE_CFLAGS): New.
(NOPIE_LDFLAGS): Likewise.
* ld-size/size.exp (run_cc_link_tests): Add $NOPIE_CFLAGS and
$NOPIE_LDFLAGS if needed.
(run_ld_link_exec_tests): Add $NOPIE_CFLAGS if needed.
Using gcc 5.2 (maybe other versions as well), building mi-pending.c gives
these warnings:
./gdb.mi/mi-pending.c: In function ‘thread_func’:
./gdb.mi/mi-pending.c:34:5: warning: ‘return’ with no value, in function returning non-void
return;
^
./gdb.mi/mi-pending.c:38:5: warning: ‘return’ with no value, in function returning non-void
return;
^
gdb_compile_pthreads assumes that the build was successful only if there
is no output. These warnings therefore make gdb_compile_pthreads think
that the build failed, and the test doesn't run.
The easy fix is to replace the "return" with "return NULL". I am
pushing this as obvious.
gdb/testsuite/ChangeLog:
* gdb.mi/mi-pending.c (thread_func): Replace return with return
NULL.
I noticed there was an unexpected pass in mi-watch.exp when running on
x86_64. Doing a bit of archeology shows that the xfail was added by
4a543da. This particular test failed on the MIPS architecture, which
the original contributor was working with. Here is the thread:
https://www.sourceware.org/ml/gdb-patches/2007-09/msg00151.html
Looking at the latest buildbot results for MIPS, it seems that it's also
an unexpected pass on that architecture. Therefore, I see no reason to
leave the xfail in place.
gdb/testsuite/ChangeLog:
* gdb.mi/mi-watch.exp (test_watchpoint_triggering): Remove xfail.
Since GCC 5 folds symbol address comparison, assuming each symbol has a
different address, &foo == &bar is always false for GCC 5. This patch
adds check_ptr_eq if 2 addresses are the same and uses it to check the
address of versined symbol.
PR ld/18718
* ld-elf/check-ptr-eq.c: New file.
* ld-elf/pr18718.c (main): Call check_ptr_eq.
* ld-elf/shared.exp: Add check-ptr-eq.c to PR ld/18718 tests.
GDB currently does not promptly quit after receiving a SIGTERM while no
proper target is active. This is because in handle_sigterm we currently
look at target_can_async_p to determine whether to asynchronously quit
GDB using an async signal handler or to asynchronously quit using the
quit flag. However, target_can_async_p is always false under the dummy
target, so under this target we always use the quit flag and not the
async signal handler to signal that GDB should quit. So GDB won't quit
until a code path that checks the quit flag is executed.
To fix this issue, this patch makes the SIGTERM handler no longer
inspect target_can_async_p, and instead makes the handler
unconditionally set the quit flag _and_ mark the corresponding async
signal handler, so that if the target is async (or if it's the dummy
target) then we will likely quit through the async signal handler, and
if it's not async then we will likely quit through the quit flag. This
redundant approach is similar to how we handle SIGINT.
gdb/ChangeLog:
* event-top.c (handle_sigterm): Don't inspect
target_can_async_p. Always set the quit flag and always mark
the async signal handler.
gdb/testsuite/ChangeLog:
* gdb.base/gdb-sigterm-2.exp: New test.
We don't use PTRACE_PEEKUSR/PTRACE_POKEUSR on aarch64-linux, so don't
need to set srv_linux_usrregs. This patch removes that line.
gdb/gdbserver:
2015-07-27 Yao Qi <yao.qi@linaro.org>
* configure.srv (case aarch64*-*-linux*): Don't set
srv_linux_usrregs.
I happen to see REMOTE_EXAMPLES isn't used anywhere, so this patch
removes it.
REMOTE_EXAMPLES was added in the following commit in 1991,
commit 86bbb439c8
Author: John Gilmore <gnu@cygnus>
Date: Fri May 3 19:57:13 1991 +0000
There should be a Makefile in the cvs main directory, configured
for "./config.gdb none", so that things like "make tags" and "make tar"
will work.
and it was used like:
TARFILES = ${TAGFILES_MAINDIR} ${OTHERS} ${REMOTE_EXAMPLES}
However TARFILES was removed by the change latter in 1994,
Tue Aug 16 15:24:03 1994 Jim Kingdon (kingdon@lioth.cygnus.com)
* symtab.c (decode_line_1): If funfirstline and we get a
non-LOC_BLOCK symbol (e.g. variable or type), then error().
* Makefile.in (TARFILES, NONSRC, SFILES_STAND, SFILES_KGDB):
Remove; unused.
Since then, REMOTE_EXAMPLES is not used any more.
gdb:
2015-07-27 Yao Qi <yao.qi@linaro.org>
* Makefile.in (REMOTE_EXAMPLES): Remove it.
S-records tests don't work with -fno-plt. This path appends $PLT_CFLAGS
to CC and CXX for S-records tests.
* ld-srec/srec.exp (CC): Save and restore. Append $PLT_CFLAGS.
(CXX): Likewise.
Some linker shard library tests without PIC expect PLT. This patch
passes $PLT_CFLAGS to ld_compile.
* ld-shared/shared.exp: Pass $PLT_CFLAGS to ld_compile.
NOCROSSREFS tests don't work with -fno-plt. This path appends
$PLT_CFLAGS to CC for NOCROSSREFS tests.
* ld-scripts/crossref.exp (CC): Save and restore. Append
$PLT_CFLAGS.
Some x86 linker tests expect PLT. This patch adds $PLT_CFLAGS to -fPIC
for run_cc_link_tests.
* ld-i386/i386.exp (run_cc_link_tests): Add $PLT_CFLAGS to
-fPIC if needed.
* ld-x86-64/mpx.exp (run_cc_link_tests): Likewise.
* ld-x86-64/x86-64.exp (run_cc_link_tests): Likewise.
Some linker visibility tests without PIC expect PLT. This patch passes
$PLT_CFLAGS to ld_compile.
* ld-elfvsb/elfvsb.exp (visibility_run): Pass $PLT_CFLAGS to
ld_compile.
Some linker symbol version tests without PIC expect PLT. This patch
adds $PLT_CFLAGS to CFLAGS.
* ld-elfvers/vers.exp (build_vers_lib_no_pic): Pass $PLT_CFLAGS
to build_binary.
GCC 6 supports -fno-plt. But some linker tests expect PLT. This patch
defines PLT_CFLAGS to "-fplt" if target compiler supports it.
* config/default.exp (PLT_CFLAGS): New.
Emit *GLOB_DAT instead of *RELATIVE relocs for protected data
in shared objects.
This is needed for the fix of glibc bug 17711:
https://sourceware.org/bugzilla/show_bug.cgi?id=17711
bfd:
PR ld/18705
* elfnn-aarch64.c (elf_backend_extern_protected_data): Define.
ld/testsuite:
PR ld/18705
* ld-aarch64/protected-data.d: New.
* ld-aarch64/protected-data.s: New.
* ld-aarch64/aarch64-elf.exp: Add new test.
Emit *GLOB_DAT instead of *RELATIVE relocs for protected data
in shared objects.
This is needed for the fix of glibc bug 17711:
https://sourceware.org/bugzilla/show_bug.cgi?id=17711
bfd:
PR ld/18705
* elf32-arm.c (elf_backend_extern_protected_data): Define.
ld/testsuite:
PR ld/18705
* ld-arm/protected-data.d: New.
* ld-arm/protected-data.s: New.
* ld-arm/arm-elf.exp: Add new test.
run_host_cmd_yesno should set errcnt and warncnt to 0. Otherwise, they
may leak to the next run.
* lib/ld-lib.exp (run_host_cmd_yesno): Set errcnt and warncnt
to 0.
When using GDB to debug an RX target using the GDB remote protocol,
using a Renesas supplied debug agent, I encountered the following
assertion error:
thread.c:85: internal-error: inferior_thread: Assertion `tp' failed.
A problem internal to GDB has been detected,
further debugging may prove unreliable.
Create a core file of GDB? (y or n) n
Command aborted.
This assertion error occurs due to the fact that the value associated
with inferior_ptid is not on the thread list.
The remote debug output (obtained with "set debug remote 1") is fairly
short, so I will include it up to the point where things go wrong -
which is somewhat before the assertion failure:
(gdb) target remote coyote.lan:61234
Remote debugging using coyote.lan:61234
Sending packet: $qSupported:multiprocess+;swbreak+;hwbreak+;qRelocInsn+#c9...Ack
Packet received: PacketSize=c00;qXfer:memory-map:read-;qXfer:features:read-;QStartNoAckMode+;multiprocess+;QNonStop+
Packet qSupported (supported-packets) is supported
Sending packet: $QStartNoAckMode#b0...Ack
Packet received: OK
Sending packet: $Hgp0.0#ad...Packet received: OK
Sending packet: $QNonStop:0#8c...Packet received: OK
Sending packet: $qTStatus#49...Packet received:
Packet qTStatus (trace-status) is NOT supported
Sending packet: $?#3f...Packet received: S02
Sending packet: $qfThreadInfo#bb...Packet received: m1
Sending packet: $qsThreadInfo#c8...Packet received: l
Sending packet: $qAttached:a410#bf...Packet received: 0
Packet qAttached (query-attached) is supported
Sending packet: $Hc-1#09...Packet received: OK
Sending packet: $qC#b4...Packet received: QC not supported
Above is the trace starting from the invocation of "target remote"
through the call of get_current_thread() in remote_start_remote().
Below, I've pasted this line of code along with additional lines of
context. The test following the call is especially important to
understanding both the problem and my patch.
/* We have thread information; select the thread the target
says should be current. If we're reconnecting to a
multi-threaded program, this will ideally be the thread
that last reported an event before GDB disconnected. */
inferior_ptid = get_current_thread (wait_status);
if (ptid_equal (inferior_ptid, null_ptid))
{
/* Odd... The target was able to list threads, but not
tell us which thread was current (no "thread"
register in T stop reply?). Just pick the first
thread in the thread list then. */
inferior_ptid = thread_list->ptid;
}
}
Prior to getting to the code pasted above, remote_start_remote()
made a call to target_update_thread_list(). This corresponds to the
following lines from the above trace:
Sending packet: $qfThreadInfo#bb...Packet received: m1
Sending packet: $qsThreadInfo#c8...Packet received: l
Sending packet: $qAttached:a410#bf...Packet received: 0
Packet qAttached (query-attached) is supported
Once target_update_thread_list has completed, the thread list
contains a single entry: {pid = 42000, lwp = 1, tid = 0}.
remote_start_remote() then makes a call to set_continue_thread(),
accounting for this line of the trace:
Sending packet: $Hc-1#09...Packet received: OK
Finally, the call to get_current_thread() is responsible for the last
line of the trace that I provided above:
Sending packet: $qC#b4...Packet received: QC not supported
get_current_thread() calls stop_reply_extract_thread() with the wait
status. This returns null_ptid.
get_current_thread() then calls remote_current_thread with a null
inferior_ptid. After the calls to putpkt() and getpkt(), rs->buf[0]
is 'Q', so read_ptid() is called and its result is returned.
The buffer passed to read_ptid() is " not supported". read_ptid ultimately
returns a ptid of {pid = 4200, lwp = 0, tid = 0}.
However, this thread is not on the thread list. As noted earlier, the
call to target_update_thread_list() had placed {pid = 42000, lwp = 1,
tid = 0} on the list. This is the only thread in the list.
When these calls ultimately return to remote_start_remote(),
inferior_ptid gets set to {pid = 4200, lwp = 0, tid = 0}, which
(again) is not on the thread list.
It appears to me that the string " not supported" is coming from the
debug agent. If so, it should be fixed, but I don't see a reason to
not consult the thread list in order to place a valid thread id in
inferior_ptid.
This (consultation of the thread list) is what is done when
inferior_ptid is null_ptid:
if (ptid_equal (inferior_ptid, null_ptid))
{
/* Odd... The target was able to list threads, but not
tell us which thread was current (no "thread"
register in T stop reply?). Just pick the first
thread in the thread list then. */
inferior_ptid = thread_list->ptid;
}
My patch causes a null inferior_ptid to be returned by read_ptid when
no thread id is found in the response from the debug agent. This
return value ends up being returned by remote_current_thread() and
then by get_current_thread. The assignment then places this null
value into inferior_ptid. That, in turn, allows the ptid_equal test
(noted above) to fetch a valid thread from the thread list. I no
longer see the assertion failure due a good value (which is on the
thread list) being placed in inferior_ptid.
This patch also adds two log warnings that may be output when "set
debug remote 1" is used. When running against the Renesas debug agent
mentioned earlier, this is the relevant portion of the log output:
Sending packet: $qC#b4...Packet received: QC not supported
warning: garbage in qC reply
warning: couldn't determine remote current thread; picking first in list.
gdb/ChangeLog:
* remote.c (read_ptid): Return null_ptid when no thread id
is found.
(remote_current_thread): Add log warning for malformed
qC reply.
(remote_start_remote): Add log warning when current thread
not found.
This reverts commit b558ff043d.
This reverts commit 4a11f20659.
The initial import commit failed to retain local changes made to
readline's configure.in (and the commit message erroneously stated that
there were no local changes that needed to be reapplied). Also the
import caused a couple of build errors and a scattering of testsuite
regressions throughout many arches. It's probably better to start over
with this import, hopefully more carefully next time.
Regressions, e.g.,
http://gdb-build.sergiodj.net/builders/Fedora-x86_64-m32/builds/1501
gdb/testsuite/ChangeLog:
Revert:
* Makefile.in (check/%.exp): Pass directory for GDB_PARALLEL.
(workers/%.worker, build-perf): New rule.
(GDB_PERFTEST_MODE): New variable.
(check-perf): Use it.
(clean): Clean up gdb.perf parallel build subdirs.
* lib/build-piece.exp: New file.
* lib/cache.exp (gdb_do_cache): Include $GDB_PARALLEL in path name.
* lib/gdb.exp (standard_output_file): Include $GDB_PARALLEL in path
name.
(standard_temp_file): Ditto.
(GDB_PARALLEL handling): Make outputs,temp,cache directories as subdirs
of $GDB_PARALLEL.
Since the sync to version 7.0-alpho, readline now by default builds
(unused) shared libraries alongside static libraries, whereas before it
only built static libraries. A couple of GDB buildbots were not happy
with this change:
http://gdb-build.sergiodj.net/builders/AIX-POWER7-plain/builds/240http://gdb-build.sergiodj.net/builders/Fedora-i686/builds/1518
To get these buildbots building again, this patch alters readline's
configure.ac file to not build shared libraries by default, as was the
case with readline 6.2. A more permanent fix may be to alter the
top-level Makefile.def to pass --disable-shared to readline, or to
investigate why these building these shared libraries are giving the
buildbots trouble. (I think the proximate reason why the i686 buildbot
fails is because it passes CFLAGS=-m32 instead of CC="gcc -m32" to the
top-level configure script, and readline's linker commands don't inherit
CFLAGS. Not sure about the AIX failure.)
readline/ChangeLog.gdb:
* configure.ac: Default opt_shared_libs to no.
* configure: Regenerate.