aboutsummaryrefslogtreecommitdiff
AgeCommit message (Collapse)AuthorFilesLines
2015-08-25Move debug_reg_change_callback and aarch64_notify_debug_reg_change to ↵Yao Qi6-170/+108
nat/aarch64-linux-hw-point.c gdb: 2015-08-25 Yao Qi <yao.qi@linaro.org> * aarch64-linux-nat.c (struct arch64_dr_update_callback_param): Move it to nat/aarch64-linux-hw-point.c. (debug_reg_change_callback): Likewise. (aarch64_notify_debug_reg_change): :Likewise. * nat/aarch64-linux-hw-point.c: Include nat/linux-nat.h. (aarch64_dr_update_callback_param): New. (debug_reg_change_callback): New function. (aarch64_notify_debug_reg_change): Likewise. * nat/aarch64-linux-hw-point.h (aarch64_notify_debug_reg_change): Remove the declaration. gdb/gdbserver: 2015-08-25 Yao Qi <yao.qi@linaro.org> * linux-aarch64-low.c (struct arch64_dr_update_callback_param): Remove. (debug_reg_change_callback): Remove. (aarch64_notify_debug_reg_change): Remove.
2015-08-25Make debug_reg_change_callback the same on GDB and GDBserverYao Qi2-2/+2
This patch makes function debug_reg_change_callback in GDB and GDBserver look the same, so that the following patch can move them to nat/aarch64-linux-hw-point.c. gdb: 2015-08-25 Yao Qi <yao.qi@linaro.org> * aarch64-linux-nat.c (debug_reg_change_callback): Use ptid_of_lwp to get ptid of lwp. gdb/gdbserver: 2015-08-25 Yao Qi <yao.qi@linaro.org> * linux-aarch64-low.c (debug_reg_change_callback): Use ptid_of_lwp to get ptid of lwp.
2015-08-25Make aarch64_notify_debug_reg_change the same on GDB and GDBserverYao Qi4-2/+12
gdb: 2015-08-25 Yao Qi <yao.qi@linaro.org> * aarch64-linux-nat.c (aarch64_notify_debug_reg_change): Call current_lwp_ptid. gdb/gdbserver: 2015-08-25 Yao Qi <yao.qi@linaro.org> * linux-aarch64-low.c (aarch64_notify_debug_reg_change): Call current_lwp_ptid.
2015-08-25Use debug_printf in debug_reg_change_callbackYao Qi4-21/+28
gdb: 2015-08-25 Yao Qi <yao.qi@linaro.org> * aarch64-linux-nat.c (debug_reg_change_callback): Use debug_printf. gdb/gdbserver: 2015-08-25 Yao Qi <yao.qi@linaro.org> * linux-aarch64-low.c (debug_reg_change_callback): Use debug_printf.
2015-08-25Use phex debug_reg_change_callbackYao Qi2-8/+12
This patch is to use phex in debug_reg_change_callback to make it identical in GDB and GDBserver. gdb/gdbserver: 2015-08-25 Yao Qi <yao.qi@linaro.org> * linux-aarch64-low.c (debug_reg_change_callback): Use phex.
2015-08-25Get pid rather than lwpidYao Qi2-1/+6
We print PID rather than LWPID in the debug output, so we need call ptid_get_pid in debug_reg_change_callback. gdb: 2015-08-25 Yao Qi <yao.qi@linaro.org> * aarch64-linux-nat.c (debug_reg_change_callback): Call ptid_get_pid rather than ptid_get_lwp.
2015-08-25Remove some comments in debug_reg_change_callbackYao Qi2-20/+4
gdb/gdbserver: 2015-08-25 Yao Qi <yao.qi@linaro.org> * linux-aarch64-low.c (debug_reg_change_callback): Remove comments.
2015-08-25Re-indent the codeYao Qi2-33/+38
gdb/gdbserver: 2015-08-25 Yao Qi <yao.qi@linaro.org> * linux-aarch64-low.c (debug_reg_change_callback): Re-indent the code.
2015-08-25[gdbserver] Use iterate_over_lwps in aarch64_notify_debug_reg_changeYao Qi2-19/+21
This patch makes more bits on aarch64 watchpoint between GDB and GDBserver look similar. gdb/gdbserver: 2015-08-25 Yao Qi <yao.qi@linaro.org> * linux-aarch64-low.c (aarch64_dr_update_callback_param) <pid>: Remove. (debug_reg_change_callback): Remove argument entry and add argument lwp. Remove local variable thread. Don't print thread id in the debugging output. Don't check whether pid of thread equals to pid. (aarch64_notify_debug_reg_change): Don't set param.pid. Call iterate_over_lwps instead find_inferior.
2015-08-25Automatic date update in version.inGDB Administrator1-1/+1
2015-08-24gdbserver crashes when multiprocess extensions aren't supportedPedro Alves7-3/+110
Ref: https://sourceware.org/ml/gdb-patches/2015-08/msg00675.html If multiprocess extensions are off (because specific gdbserver port doesn't support them), then when gdbserver doesn't have a thread selected yet, and GDB sends Hg packet to select one, gdbserver crashes. That's because extracting the desired thread id out of the packet that GDB sent depends on the current thread to fill in the missing process id ... Fix this by getting the process id from the first (and only) process in the processes list instead. The GNU/Linux port doesn't trip on this because it always runs with multiprocess extensions enabled. To make it easier to catch such regressions going forward, this commit also adds a new smoke test that spawns gdbserver, connects to it and runs to main with the multiprocess extensions force-disabled. gdb/gdbserver/ChangeLog: 2015-08-24 Pedro Alves <palves@redhat.com> * inferiors.c (get_first_process): New function. * inferiors.h (get_first_process): New declaration. * remote-utils.c (read_ptid): Default to the first process in the list, instead of to the current thread's process. gdb/testsuite/ChangeLog: 2015-08-24 Pedro Alves <palves@redhat.com> * gdb.server/connect-without-multi-process.c: New file. * gdb.server/connect-without-multi-process.exp: New file.
2015-08-24Add "set remote multiprocess-extensions-packet" commandPedro Alves5-2/+26
Being able to force-disable the RSP multiprocess extensions is useful for testing. gdb/ChangeLog: 2015-08-24 Pedro Alves <palves@redhat.com> * NEWS (New commands): Mention set/show remote multiprocess-extensions-packet. * remote.c (remote_query_supported): Only tell the server to use the multiprocess extensions if the user hasn't force-disabled them with "set remote multiprocess-extensions-packet off". gdb/doc/ChangeLog: 2015-08-24 Pedro Alves <palves@redhat.com> * gdb.texinfo (Remote Configuration): Document the "set/show remote multiprocess-extensions-packet" commands.
2015-08-24Update gnulib to current upstream masterPedro Alves160-1272/+3885
2015-08-24 Pedro Alves <palves@redhat.com> * gnulib/update-gnulib.sh (GNULIB_COMMIT_SHA1): Set to 1029a8112290f6eee9d7878a391c49db42c999bd. * gnulib/configure, gnulib/config.in, gnulib/aclocal.m4: Regenerate. * gnulib/import/Makefile.am: Update. * gnulib/import/Makefile.in: Update. * gnulib/import/alloca.in.h: Update. * gnulib/import/basename-lgpl.c: Update. * gnulib/import/canonicalize-lgpl.c: Update. * gnulib/import/config.charset: Update. * gnulib/import/dirent.in.h: Update. * gnulib/import/dirfd.c: Update. * gnulib/import/dirname-lgpl.c: Update. * gnulib/import/dirname.h: Update. * gnulib/import/dosname.h: Update. * gnulib/import/errno.in.h: 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/float+.h: Update. * gnulib/import/float.c: Update. * gnulib/import/float.in.h: Update. * gnulib/import/fnmatch.c: Update. * gnulib/import/fnmatch.in.h: Update. * gnulib/import/fnmatch_loop.c: Update. * gnulib/import/fpucw.h: Update. * gnulib/import/frexp.c: Update. * gnulib/import/frexpl.c: Update. * gnulib/import/gettimeofday.c: Update. * gnulib/import/inttypes.in.h: Update. * gnulib/import/isnan.c: Update. * gnulib/import/isnand-nolibm.h: Update. * gnulib/import/isnand.c: Update. * gnulib/import/isnanl-nolibm.h: Update. * gnulib/import/isnanl.c: Update. * gnulib/import/itold.c: Update. * gnulib/import/localcharset.c: Update. * gnulib/import/localcharset.h: Update. * gnulib/import/lstat.c: Update. * gnulib/import/m4/00gnulib.m4: Update. * gnulib/import/m4/absolute-header.m4: Update. * gnulib/import/m4/alloca.m4: Update. * gnulib/import/m4/canonicalize.m4: Update. * gnulib/import/m4/codeset.m4: Update. * gnulib/import/m4/configmake.m4: Update. * gnulib/import/m4/dirent_h.m4: Update. * gnulib/import/m4/dirfd.m4: Update. * gnulib/import/m4/dirname.m4: Update. * gnulib/import/m4/double-slash-root.m4: Update. * gnulib/import/m4/eealloc.m4: Update. * gnulib/import/m4/errno_h.m4: Update. * gnulib/import/m4/exponentd.m4: Update. * gnulib/import/m4/exponentl.m4: Update. * gnulib/import/m4/extensions.m4: Update. * gnulib/import/m4/extern-inline.m4: Update. * gnulib/import/m4/fcntl-o.m4: Update. * gnulib/import/m4/float_h.m4: Update. * gnulib/import/m4/fnmatch.m4: Update. * gnulib/import/m4/fpieee.m4: Update. * gnulib/import/m4/frexp.m4: Update. * gnulib/import/m4/frexpl.m4: Update. * gnulib/import/m4/gettimeofday.m4: Update. * gnulib/import/m4/glibc21.m4: Update. * gnulib/import/m4/gnulib-cache.m4: Update. * gnulib/import/m4/gnulib-common.m4: Update. * gnulib/import/m4/gnulib-comp.m4: Update. * gnulib/import/m4/gnulib-tool.m4: Update. * gnulib/import/m4/include_next.m4: Update. * gnulib/import/m4/inttypes-pri.m4: Update. * gnulib/import/m4/inttypes.m4: Update. * gnulib/import/m4/isnand.m4: Update. * gnulib/import/m4/isnanl.m4: Update. * gnulib/import/m4/largefile.m4: Update. * gnulib/import/m4/localcharset.m4: Update. * gnulib/import/m4/locale-fr.m4: Update. * gnulib/import/m4/locale-ja.m4: Update. * gnulib/import/m4/locale-zh.m4: Update. * gnulib/import/m4/longlong.m4: Update. * gnulib/import/m4/lstat.m4: Update. * gnulib/import/m4/malloc.m4: Update. * gnulib/import/m4/malloca.m4: Update. * gnulib/import/m4/math_h.m4: Update. * gnulib/import/m4/mbrtowc.m4: Update. * gnulib/import/m4/mbsinit.m4: Update. * gnulib/import/m4/mbsrtowcs.m4: Update. * gnulib/import/m4/mbstate_t.m4: Update. * gnulib/import/m4/memchr.m4: Update. * gnulib/import/m4/memmem.m4: Update. * gnulib/import/m4/mmap-anon.m4: Update. * gnulib/import/m4/multiarch.m4: Update. * gnulib/import/m4/nocrash.m4: Update. * gnulib/import/m4/off_t.m4: Update. * gnulib/import/m4/pathmax.m4: Update. * gnulib/import/m4/readlink.m4: Update. * gnulib/import/m4/rename.m4: Update. * gnulib/import/m4/rmdir.m4: Update. * gnulib/import/m4/ssize_t.m4: Update. * gnulib/import/m4/stat.m4: Update. * gnulib/import/m4/stdbool.m4: Update. * gnulib/import/m4/stddef_h.m4: Update. * gnulib/import/m4/stdint.m4: Update. * gnulib/import/m4/stdio_h.m4: Update. * gnulib/import/m4/stdlib_h.m4: Update. * gnulib/import/m4/string_h.m4: Update. * gnulib/import/m4/strstr.m4: Update. * gnulib/import/m4/strtok_r.m4: Update. * gnulib/import/m4/sys_socket_h.m4: Update. * gnulib/import/m4/sys_stat_h.m4: Update. * gnulib/import/m4/sys_time_h.m4: Update. * gnulib/import/m4/sys_types_h.m4: Update. * gnulib/import/m4/time_h.m4: Update. * gnulib/import/m4/unistd_h.m4: Update. * gnulib/import/m4/warn-on-use.m4: Update. * gnulib/import/m4/wchar_h.m4: Update. * gnulib/import/m4/wchar_t.m4: Update. * gnulib/import/m4/wctype_h.m4: Update. * gnulib/import/m4/wint_t.m4: Update. * gnulib/import/malloc.c: Update. * gnulib/import/malloca.c: Update. * gnulib/import/malloca.h: Update. * gnulib/import/math.in.h: Update. * gnulib/import/mbrtowc.c: Update. * gnulib/import/mbsinit.c: Update. * gnulib/import/mbsrtowcs-impl.h: Update. * gnulib/import/mbsrtowcs-state.c: Update. * gnulib/import/mbsrtowcs.c: Update. * gnulib/import/memchr.c: Update. * gnulib/import/memmem.c: Update. * gnulib/import/pathmax.h: Update. * gnulib/import/readlink.c: Update. * gnulib/import/ref-add.sin: Update. * gnulib/import/ref-del.sin: Update. * gnulib/import/rename.c: Update. * gnulib/import/rmdir.c: Update. * gnulib/import/same-inode.h: Update. * gnulib/import/stat.c: Update. * gnulib/import/stdbool.in.h: Update. * gnulib/import/stddef.in.h: Update. * gnulib/import/stdint.in.h: Update. * gnulib/import/stdio.c: Update. * gnulib/import/stdio.in.h: Update. * gnulib/import/stdlib.in.h: Update. * gnulib/import/str-two-way.h: Update. * gnulib/import/streq.h: Update. * gnulib/import/string.in.h: Update. * gnulib/import/stripslash.c: Update. * gnulib/import/strnlen1.c: Update. * gnulib/import/strnlen1.h: Update. * gnulib/import/strstr.c: Update. * gnulib/import/strtok_r.c: Update. * gnulib/import/sys_stat.in.h: Update. * gnulib/import/sys_time.in.h: Update. * gnulib/import/sys_types.in.h: Update. * gnulib/import/time.in.h: Update. * gnulib/import/unistd.in.h: Update. * gnulib/import/verify.h: Update. * gnulib/import/wchar.in.h: Update. * gnulib/import/wctype.in.h: Update. * gnulib/import/gettimeofday.c: New file. * gnulib/import/m4/absolute-header.m4: New file. * gnulib/import/m4/gettimeofday.m4: New file. * gnulib/import/m4/sys_socket_h.m4: New file. * gnulib/import/m4/sys_time_h.m4: New file. * gnulib/import/stdio.c: Delete file. * gnulib/import/sys_time.in.h: New file.
2015-08-24Prepare for gnulib updatePedro Alves24-28/+94
After the last gnulib import (Dec 2012), gnulib upstream started replacing mingw's 'struct timeval' with a version with 64-bit time_t, for POSIX compliance: commit f8e84098084b3b53bc6943a5542af1f607ffd477 Author: Bruno Haible <bruno@clisp.org> Date: Sat Jan 28 18:12:10 2012 +0100 sys_time: Override 'struct timeval' on some native Windows platforms. See: https://lists.gnu.org/archive/html/bug-gnulib/2012-01/msg00372.html However, that results in conflicts with native Winsock2's 'select': select()'s argument http://sourceforge.net/p/mingw-w64/mailman/message/29610438/ ... and libiberty's timeval-utils.h timeval_add/timeval_sub, at the least. We don't really need the POSIX compliance, so this patch prepares us to simply not use gnulib's 'struct timeval' replacement once a more recent gnulib is imported, thus preserving the current behavior, by adding a sys/time.h wrapper header that undefs gnulib's replacements, and including that everywhere instead. The SIZE -> OSIZE change is necessary because newer gnulib's sys/time.h also includes windows.h/winsock2.h, which defines a conflicting SIZE symbol. Cross build-tested mingw-w64 32-bit and 64-bit. Regtested on x86_64 Fedora 20. gdb/ChangeLog: 2015-08-24 Pedro Alves <palves@redhat.com> * Makefile.in (HFILES_NO_SRCDIR): Add common/gdb_sys_time.h. * common/gdb_sys_time.h: New file. * event-loop.c: Include gdb_sys_time.h instead of sys/time.h. * gdb_select.h: Likewise. * gdb_usleep.c: Likewise. * maint.c: Likewise. * mi/mi-main.c: Likewise. * mi/mi-parse.h: Likewise. * remote-fileio.c: Likewise. * remote-m32r-sdi.c: Likewise. * remote.c: Likewise. * ser-base.c: Likewise. * ser-pipe.c: Likewise. * ser-tcp.c: Likewise. * ser-unix.c: Likewise. * symfile.c: Likewise. * symfile.c: Likewise. Rename OSIZE to SIZE throughout. * target-memory.c: Include gdb_sys_time.h instead of sys/time.h. * utils.c: Likewise. gdb/gdbserver/ChangeLog: 2015-08-24 Pedro Alves <palves@redhat.com> * debug.c: Include gdb_sys_time.h instead of sys/time.h. * event-loop.c: Likewise. * remote-utils.c: Likewise. * tracepoint.c: Likewise.
2015-08-24Fix gdbserver SPU buildPedro Alves2-1/+6
Ref: https://sourceware.org/ml/gdb-patches/2015-08/msg00675.html gdbserver/spu-low.c: In function 'spu_request_interrupt': gdbserver/spu-low.c:639: error: incompatible type for argument 1 of 'ptid_get_lwp' gdb/gdbserver/ChangeLog: 2015-08-24 Pedro Alves <palves@redhat.com> * spu-low.c (spu_request_interrupt): Use lwpid_of instead of ptid_get_lwp.
2015-08-24Make z intLuis Machado2-1/+5
This makes z an int for gdb/testsuite/gdb.opt/inline-markers.c. gdb/testsuite/ChangeLog: 2015-08-24 Luis Machado <lgustavo@codesourcery.com> * gdb.opt/inline-markers.c: Make z int.
2015-08-24Make z volatile.Luis Machado2-1/+6
This fixes a typo in gdb/testsuite/gdb.opt/inline-markers.c, making z a volatile variable. gdb/testsuite/ChangeLog: 2015-08-24 Luis Machado <lgustavo@codesourcery.com> * gdb.opt/inline-markers.c: Make z volatile.
2015-08-24Prevent GCC from folding inline test functionsLuis Machado5-3/+15
While doing some powerpc Linux tests on a ppc 476 board using GCC 5.2, i noticed inline-bt.exp, inline-cmds.exp and inline-locals.exp failing. FAIL: gdb.opt/inline-bt.exp: continue to bar (1) FAIL: gdb.opt/inline-bt.exp: backtrace from bar (1) FAIL: gdb.opt/inline-bt.exp: continue to bar (2) FAIL: gdb.opt/inline-bt.exp: backtrace from bar (2) FAIL: gdb.opt/inline-bt.exp: continue to bar (3) FAIL: gdb.opt/inline-bt.exp: backtrace from bar (3) FAIL: gdb.opt/inline-cmds.exp: continue to bar (1) FAIL: gdb.opt/inline-cmds.exp: backtrace from bar (1) FAIL: gdb.opt/inline-cmds.exp: continue to bar (2) FAIL: gdb.opt/inline-cmds.exp: backtrace from bar (2) FAIL: gdb.opt/inline-cmds.exp: continue to marker FAIL: gdb.opt/inline-cmds.exp: backtrace from marker FAIL: gdb.opt/inline-cmds.exp: step into finish marker FAIL: gdb.opt/inline-locals.exp: continue to bar (1) FAIL: gdb.opt/inline-locals.exp: continue to bar (2) FAIL: gdb.opt/inline-locals.exp: backtrace from bar (2) FAIL: gdb.opt/inline-locals.exp: continue to bar (3) FAIL: gdb.opt/inline-locals.exp: backtrace from bar (3) They failed because the breakpoint supposedly inserted at bar was actually inserted at noinline. (gdb) break inline-markers.c:20^M Breakpoint 2 at 0x1000079c: file gdb/testsuite/gdb.opt/inline-markers.c, line 20.^M (gdb) continue^M Continuing.^M ^M Breakpoint 2, noinline () at gdb/testsuite/gdb.opt/inline-markers.c:35^M 35 inlined_fn (); /* inlined */^M As we can see, line 20 is really inside bar, not noinline: 18 void bar(void) 19 { 20 x += y; /* set breakpoint 1 here */ 21 } Further investigation shows that this is really due to GCC 5's new ICF pass (-fipa-icf), now enabled by default at -O2, which folds bar and marker into noinline, where the call to inlined_fn was inlined. This breaks the testcase since it expects to stop at specific spots. I thought about two possible fixes for this issue. - Disable the ICF pass manually when building the binary (-fno-ipa-icf). This has the advantage of not having to touch the testcase sources themselves, but the disadvantage of having to add conditional blocks to test the GCC version. If we ever change GCC's default, we will have to adjust the conditional block again to match GCC's behavior. - Modify the testcase sources to make the identical functions unique. This solution doesn't touch the testcase itself, but changes the source code slightly in order to make bar, marker and inlined_fn unique. This causes GCC's ICF pass to ignore these functions and not fold them into a common identical function. I'm good with either of them, but i'm more inclined to go with the second one. The attached patch implements this by adding the new global variable z, set to 0, that gets added in different ways to marker and inlined_fn. Since it is 0, it doesn't affect any possible value checks that we may wish to do in the future (we currently only check for values changed by bar). Ok? ps: I also noticed GDB doesn't do a great job at stating that the breakpoint was actually inserted at a different source line than previously requested, so this sounds like a bug that should be fixed, if it is not just wrong DWARF information (did not investigate it further). gdb/testsuite/ChangeLog: 2015-08-24 Luis Machado <lgustavo@codesourcery.com> * gdb.opt/inline-bt.c: New volatile global z. * gdb.opt/inline-cmds.c: Likewise. * gdb.opt/inline-locals.c: Likewise. * gdb.opt/inline-markers.c: New extern global z. (marker): Use z. (inline_fn): Likewise.
2015-08-24gdb/testsuite/: garbage collect a few references to dead targetsPedro Alves7-49/+32
gdb/testsuite/ChangeLog: 2015-08-24 Pedro Alves <palves@redhat.com> * config/m32r-stub.exp: Remove file. * gdb.base/call-ar-st.exp: Remove reference to sparclet. * gdb.base/call-rt-st.exp: Likewise. * gdb.base/call-strs.exp: Likewise. * gdb.base/default.exp: Remove references to h8300-*-hms and *-*-udi*. * gdb.base/funcargs.exp: Remove reference to sparclet-*-*.
2015-08-24gdb manual: Remove references to deleted targetsPedro Alves2-398/+16
Support for target dbug/picobug/dink32/m32r/mon2000/ppcbug was just removed, but support for ARM RDI, Sparclet, Sparclite, Z8000, target r3900, target array, target sds, target op50n and target w89k had already been removed many years ago. Drop it all in one go. gdb/doc/ChangeLog: 2015-08-24 Pedro Alves <palves@redhat.com> * gdb.texinfo (Embedded Processors) <ARM>: Remove references to RDI. <M32R>: Remove references to M32R/D. <M68K>: Remove references to target dbug. <MIPS Embedded>: Remove references to target r3900 and target array. <PowerPC Embedded>: Remove references to target dink32 and target ppcbug, target sds <PA, Sparclet, Sparclite, Z8000>: Delete nodes.
2015-08-24Delete the remaining ROM monitor targetsPedro Alves13-4452/+46
Ref: https://sourceware.org/ml/gdb/2015-07/msg00011.html All of these targets use gdb/monitor.c, which has bit rotted years ago (I'd guess around ~6), and nobody seems to have noticed: | target | source | |----------------+----------------------| | target dbug | gdb/dbug-rom.c | | target picobug | gdb/microblaze-rom.c | | target dink32 | gdb/dink32-rom.c | | target m32r | gdb/m32r-rom.c | | target mon2000 | gdb/m32r-rom.c | | target ppcbug | gdb/ppcbug-rom.c | This deletes them, along with finally removing monitor.c. A manual update will be done separately. gdb/ChangeLog: 2015-08-24 Pedro Alves <palves@redhat.com> * NEWS: Mention removed support for the various ROM monitors. * Makefile.in (ALL_TARGET_OBS): Remove dbug-rom.o, dink32-rom.o, ppcbug-rom.o, m32r-rom.o, dsrec.o and monitor.o from gdb_target_obs. * configure.tgt (h8300-*-*): Remove monitor.o and m32r-rom.o from gdb_target_obs. (m68*-*-*): Remove monitor.o dbug-rom.o and dsrec.o from gdb_target_obs. (microblaze*-linux-*): Remove microblaze-rom.o, monitor.o and dsrec.o from gdb_target_obs. (microblaze*-*-*): Remove microblaze-rom.o, monitor.o and dsrec.o from gdb_target_obs. (powerpc-*-lynx*178): Remove monitor.o and dsrec.o from gdb_target_obs. (powerpc*-*-*): Remove monitor.o, dsrec.o, ppcbug-rom.o and dink32-rom.o from gdb_target_obs. (sh*-*-linux*): Remove monitor.o and dsrec.o from gdb_target_obs. (sh*): Remove monitor.o and dsrec.o from gdb_target_obs. * dbug-rom.c, dink32-rom.c, dsrec.c, m32r-rom.c, microblaze-rom.c, monitor.c, monitor.h, ppcbug-rom.c, srec.h: Delete files.
2015-08-24Fix the partial disassembly of a broken three byte instruction at the end of ↵Jan Stancek5-2/+29
a function. opcodes * i386-dis.c (print_insn): Fix decoding of three byte operands. tests * gas/i386/intel.s: Add test of disassembly of a potential three byte instuction at the end of a function. * gas/i386/intel.d: Update expected disassembly.
2015-08-24gnu_vector.exp: Avoid some more known FAILsAndreas Arnez2-13/+60
This avoids two more types of FAILs with the gnu_vector test case. First, for POWER targets newer GCCs emit an ABI note when invoked with "-mcpu=native". Then the test case fell back to non-native compile, producing code for a non-vector ABI. But that is not supported by GDB. Thus the compiler note is now suppressed with "-Wno-psabi". Second, on s390 the test case produced FAILs after falling back to a non-vector ABI when using "finish" or "return" in a vector-valued function. This was due to a long-standing known bug (Bug 8549). This case is now detected, and KFAILs are emitted instead. gdb/testsuite/ChangeLog: * gdb.base/gnu_vector.exp: Try compilation with "-mcpu=native -Wno-psabi" if "-mcpu=native" fails. For the tests with "finish" and "return" use KFAIL when GDB can not read/write the vector return value.
2015-08-24Missing parts of fixes for in-tree libiconvYaakov Selkowitz4-36/+112
(Commit d23d1dff missed pushing the config/iconv.m4 change, and to regenerate binutils' configure.) Original description: This is the second in a series of patches to make a build with an in-tree GNU libiconv work as designed. Currently GDB is the only toolchain component which actually uses an in-tree libiconv. This patch modifies the common AM_ICONV to use an in-tree libiconv when present and not already provided by libc. (GDB's workaround uses an in-tree libiconv even when libc provides iconv(3); I'm not sure when or why that would be desirable.) config/ChangeLog: 2015-08-24 Yaakov Selkowitz <yselkowi@redhat.com> * iconv.m4 (AM_ICONV_LINK): Use in-tree libiconv when present. binutils/ChangeLog: 2015-08-24 Yaakov Selkowitz <yselkowi@redhat.com> * configure: Regenerate.
2015-08-24Automatic date update in version.inGDB Administrator1-1/+1
2015-08-23Reorder enum output_type for better code generationAlan Modra2-1/+5
Works around a gcc bug #67328 for the most commonly used of bfd_link_pic and bfd_link_executable. * bfdlink.h (enum output_type): Reorder enum.
2015-08-23Automatic date update in version.inGDB Administrator1-1/+1
2015-08-22Uninitialized vd_nodenameAlan Modra2-1/+7
Belt and braces fix. Either of the changes here is sufficient to ensure vd_nodename is initialized properly. * elf.c (_bfd_elf_slurp_version_tables): Always init vd_nodename. Don't copy fields not set by _bfd_elf_swap_verdef_in.
2015-08-22Automatic date update in version.inGDB Administrator1-1/+1
2015-08-21Fix ax.c:gdb_eval_agent_exprPedro Alves2-1/+6
In C++ mode: src/gdb/gdbserver/ax.c: In function ‘eval_result_type gdb_eval_agent_expr(eval_agent_expr_context*, agent_expr*, ULONGEST*)’: src/gdb/gdbserver/ax.c:1335:11: error: invalid conversion from ‘int’ to ‘eval_result_type’ [-fpermissive] return 1; ^ "1" as an enum eval_result_type is expr_eval_empty_expression, but clearly this wants to return expr_eval_unhandled_opcode. gdb/gdbserver/ChangeLog: 2015-08-21 Pedro Alves <palves@redhat.com> * ax.c (gdb_eval_agent_expr): Return expr_eval_unhandled_opcode instead of literal 1.
2015-08-21C++: Initialize a couple const globalsPedro Alves4-2/+10
In C++ mode, we get: src/gdb/gdbserver/tdesc.c:43:33: error: uninitialized const ‘default_description’ [-fpermissive] static const struct target_desc default_description; ^ In file included from src/gdb/gdbserver/tdesc.c:19:0: src/gdb/gdbserver/tdesc.h:26:8: note: ‘const struct target_desc’ has no user-provided default constructor struct target_desc ^ gdb/ChangeLog: 2015-08-21 Pedro Alves <palves@redhat.com> * frame.c (null_frame_id): Explicitly zero-initialize. gdb/gdbserver/ChangeLog: 2015-08-21 Pedro Alves <palves@redhat.com> * tdesc.c (default_description): Explicitly zero-initialize.
2015-08-21gdb/dwarf2read.c: rename a field for c++Tom Tromey2-60/+70
Fixes: ../../src/gdb/dwarf2read.c:127:15: error: declaration of ‘asection* dwarf2_section_info::<anonymous union>::asection’ [-fpermissive] asection *asection; ^ In file included from ../../src/gdb/common/common-types.h:35:0, from ../../src/gdb/common/common-defs.h:44, from ../../src/gdb/defs.h:28, from ../../src/gdb/dwarf2read.c:31: ../bfd/bfd.h:1596:3: error: changes meaning of ‘asection’ from ‘typedef struct bfd_section asection’ [-fpermissive] } asection; ^ gdb/ChangeLog: 2015-08-21 Tom Tromey <tromey@redhat.com> * dwarf2read.c (struct dwarf2_section_info): Rename field 'asection' to 'section'. (dwarf2_has_info, get_section_bfd_owner, get_section_bfd_section) (dwarf2_locate_sections, dwarf2_locate_sections) (locate_dwz_sections, locate_v1_virtual_dwo_sections) (dwarf2_locate_dwo_sections, dwarf2_locate_dwo_sections) (dwarf2_locate_v2_dwp_sections): Adjust.
2015-08-21tui: don't overwrite a secondary prompt that was given no inputPatrick Palka4-1/+34
This patch fixes the following bug in TUI: (gdb) break foo No symbol table is loaded. Use the "file" command. Make breakpoint pending on future shared library load? (y or [n]) <ENTER> By submitting an empty command line to a secondary prompt, the line corresponding to the secondary prompt is undesirably cleared and overwritten. Outside of a secondary prompt, clearing the prompt line after submitting an empty command line is intended behavior which complements GDB's repeat-command shorthand. But inside a secondary prompt, this behavior is undesired since the shorthand is not applicable in that case. We should retain the secondary-prompt line even when it's given no input. This patch makes sure that a prompt that was given an empty command line is cleared and overwritten only if it's not a secondary prompt. To acheive this, a new predicate is defined which informs us whether the current input handler is a secondary prompt. gdb/ChangeLog: * top.h (gdb_in_secondary_prompt_p): Declare. * top.c (gdb_secondary_prompt_depth): Define. (gdb_in_secondary_prompt_p): Define. (gdb_readline_wrapper_cleanup): Decrement gdb_secondary_prompt_depth. (gdb_readline_wrapper): Increment gdb_secondary_prompt_depth. * tui/tui-io.c (tui_getc): Don't clear the prompt line if we are in a secondary prompt.
2015-08-21Use tui_putc to output newline entered by the userPatrick Palka2-1/+6
This is necessary to make sure that start_line is updated after a command has been entered. Usually, start_line gets updated anyway because most commands output text, and outputting text is done through the function tui_puts, which updates start_line. However if a command does not output text, then tui_puts will not get called and start_line will not get updated in time for the next prompt to be displayed. One can observe this bug by executing the command "delete" within TUI. After executing, the prompt line (gdb) delete gets overwritten by the next prompt. With this patch, the prompt line gets preserved. gdb/ChangeLog: * tui/tui-io.c (tui_getc): Use tui_putc instead of waddch to emit the newline.
2015-08-21Fix gdbserver crash exposed by gdb.threads/process-dies-while-handling-bp.expPedro Alves4-19/+35
Running that test in a loop, I found a gdbserver core dump with the following back trace: Core was generated by `../gdbserver/gdbserver --once --multi :2346'. Program terminated with signal SIGSEGV, Segmentation fault. #0 0x0000000000406ab6 in inferior_regcache_data (inferior=0x0) at src/gdb/gdbserver/inferiors.c:236 236 return inferior->regcache_data; (gdb) up #1 0x0000000000406d7f in get_thread_regcache (thread=0x0, fetch=1) at src/gdb/gdbserver/regcache.c:31 31 regcache = (struct regcache *) inferior_regcache_data (thread); (gdb) bt #0 0x0000000000406ab6 in inferior_regcache_data (inferior=0x0) at src/gdb/gdbserver/inferiors.c:236 #1 0x0000000000406d7f in get_thread_regcache (thread=0x0, fetch=1) at src/gdb/gdbserver/regcache.c:31 #2 0x0000000000409271 in prepare_resume_reply (buf=0x20dd593 "", ptid=..., status=0x20edce0) at src/gdb/gdbserver/remote-utils.c:1147 #3 0x000000000040ab0a in vstop_notif_reply (event=0x20edcc0, own_buf=0x20dd590 "T05") at src/gdb/gdbserver/server.c:183 #4 0x0000000000426b38 in notif_write_event (notif=0x66e6c0 <notif_stop>, own_buf=0x20dd590 "T05") at src/gdb/gdbserver/notif.c:69 #5 0x0000000000426c55 in handle_notif_ack (own_buf=0x20dd590 "T05", packet_len=8) at src/gdb/gdbserver/notif.c:113 #6 0x000000000041118f in handle_v_requests (own_buf=0x20dd590 "T05", packet_len=8, new_packet_len=0x7fff742c77b8) at src/gdb/gdbserver/server.c:2862 #7 0x0000000000413850 in process_serial_event () at src/gdb/gdbserver/server.c:4148 #8 0x0000000000413945 in handle_serial_event (err=0, client_data=0x0) at src/gdb/gdbserver/server.c:4196 #9 0x000000000041a1ef in handle_file_event (event_file_desc=5) at src/gdb/gdbserver/event-loop.c:429 #10 0x00000000004199b6 in process_event () at src/gdb/gdbserver/event-loop.c:184 #11 0x000000000041a735 in start_event_loop () at src/gdb/gdbserver/event-loop.c:547 #12 0x00000000004123d2 in captured_main (argc=4, argv=0x7fff742c7ac8) at src/gdb/gdbserver/server.c:3562 #13 0x000000000041252e in main (argc=4, argv=0x7fff742c7ac8) at src/gdb/gdbserver/server.c:3631 Clearly this means that a thread pushed a stop reply in the event queue, and then before GDB confused the event, the whole process died, along with its thread. But the pending thread event was left dangling. When GDB fetched that event, gdbserver looked up the corresponding thread, but found NULL; not expecting this, gdbserver crashes when it tries to read this thread's registers. gdb/gdbserver/ 2015-08-21 Pedro Alves <palves@redhat.com> PR gdb/18749 * inferiors.c (remove_thread): Discard any pending stop reply for this thread. * server.c (remove_all_on_match_pid): Rename to ... (remove_all_on_match_ptid): ... this. Work with a filter ptid instead of a pid. (discard_queued_stop_replies): Change parameter to a ptid. Now extern. (handle_v_kill, kill_inferior_callback) (process_serial_event): Adjust. (captured_main): Call initialize_notif before starting the program, thus before threads are created. * server.h (discard_queued_stop_replies): Declare.
2015-08-21gdbserver: don't pick a random thread if the current thread diesPedro Alves8-53/+83
In all-stop mode, if the current thread disappears while stopping all threads, gdbserver calls set_desired_thread(0) ['0' means "I want the continue thread"] which just picks the first thread in the list. This looks like a dangerous thing to do. GDBserver continues processing whatever it was doing, but to the wrong thread. If debugging more than one process, we may even pick the wrong process. Instead, GDBserver should detect the situation and bail out of whatever is was doing. The backends used to pay attention to the set 'cont_thread' (the Hc thread, used in the old way to resume threads, before vCont), but all such 'cont_thread' checks have been eliminated meanwhile. The remaining implicit dependencies that I found on there being a selected thread in the backends are in the Ctrl-C handling, which some backends use as thread to send a signal to. Even that seems to me to be better handled by always using the first thread in the list or by using the signal_pid PID. In order to make this a systematic approach, I'm making set_desired_thread never fallback to a random thread, and instead end up with current_thread == NULL, like already done in non-stop mode. Then I updated all callers to handle the situation. I stumbled on this while fixing other bugs exposed by gdb.threads/fork-plus-threads.exp test. The problems I saw were fixed in a different way, but in any case, I think the potential for problems is more or less obvious, and the resulting code looks a bit less magical to me. Tested on x86-64 Fedora 20, w/ native-extended-gdbserver board. gdb/gdbserver/ChangeLog: 2015-08-21 Pedro Alves <palves@redhat.com> * linux-low.c (wait_for_sigstop): Always switch to no thread selected if the previously current thread dies. * lynx-low.c (lynx_request_interrupt): Use the first thread's process instead of the current thread's. * remote-utils.c (input_interrupt): Don't check if there's no current thread. * server.c (gdb_read_memory, gdb_write_memory): If setting the current thread to the general thread fails, error out. (handle_qxfer_auxv, handle_qxfer_libraries) (handle_qxfer_libraries_svr4, handle_qxfer_siginfo) (handle_qxfer_spu, handle_qxfer_statictrace, handle_qxfer_fdpic) (handle_query): Check if there's a thread selected instead of checking whether there's any thread in the thread list. (handle_qxfer_threads, handle_qxfer_btrace) (handle_qxfer_btrace_conf): Don't error out early if there's no thread in the thread list. (handle_v_cont, myresume): Don't set the current thread to the continue thread. (process_serial_event) <Hg handling>: Also set thread_id if the previous general thread is still alive. (process_serial_event) <g/G handling>: If setting the current thread to the general thread fails, error out. * spu-low.c (spu_resume, spu_request_interrupt): Use the first thread's lwp instead of the current thread's. * target.c (set_desired_thread): If the desired thread was not found, leave the current thread pointing to NULL. Return an int (boolean) indicating success. * target.h (set_desired_thread): Change return type to int.
2015-08-21Make remote file transfers interruptibleGary Benson2-0/+6
This commit makes it possible to interrupt remote file transfers.
2015-08-21Warn when accessing binaries from remote targetsGary Benson9-24/+97
GDB provides no indicator of progress during file operations, and can appear to have locked up during slow remote transfers. This commit updates GDB to print a warning each time a file is accessed over RSP. An additional message detailing how to avoid remote transfers is printed for the first transfer only. gdb/ChangeLog: * target.h (struct target_ops) <to_fileio_open>: New argument warn_if_slow. Update comment. All implementations updated. (target_fileio_open_warn_if_slow): New declaration. * target.c (target_fileio_open): Renamed as... (target_fileio_open_1): ...this. New argument warn_if_slow. Pass warn_if_slow to implementation. Update debug printing. (target_fileio_open): New function. (target_fileio_open_warn_if_slow): Likewise. * gdb_bfd.c (gdb_bfd_iovec_fileio_open): Use new function target_fileio_open_warn_if_slow. gdb/testsuite/ChangeLog: * gdb.trace/pending.exp: Cope with remote transfer warnings.
2015-08-21Fix stale cleanup left by linux_mntns_access_fsGary Benson2-1/+6
This commit fixes a stale cleanup left by linux_mntns_access_fs. gdb/ChangeLog: * nat/linux-namespaces.c (linux_mntns_access_fs): Do not overwrite old_chain.
2015-08-21Allow symbol and label names to be enclosed in double quotes.Nick Clifton59-911/+900
gas PR gas/18581 * expr.c (get_symbol_end): Rename to get_symbol_name. Add a return parameter pointing to the start of the symbol. Allow symbol names enclosed in double quotes. (restore_line_pointer): New function. Replace the NUL character inserted into the input stream with the given character. If the character was a double quote, advance the input pointer. * expr.h (get_symbol_end): Delete. (get_symbol_name): Add prototype. (restore_line_pointer): Prototype. * read.h (SKIP_WHITESPACE_AFTER_NAME): New macro. * doc/as.texinfo (Symbol Intro): Document that symbol names can now be enclosed in double quotes. * cond.c (s_ifdef): Replace get_symbol_end with get_symbol_name. Use restore_line_pointer to replace the NUL in the input stream. Use SKIP_WHITESPACE_AFTER_NAME to skip past the end of a symbol. Check for the use of double quoted symbol names. * expr.c: Likewise. * config/obj-aout.c: Likewise. * config/obj-coff-seh.c: Likewise. * config/obj-coff.c: Likewise. * config/obj-elf.c: Likewise. * config/obj-evax.c: Likewise. * config/obj-macho.c: Likewise. * config/obj-som.c: Likewise. * config/tc-alpha.c: Likewise. * config/tc-arc.c: Likewise. * config/tc-arm.c: Likewise. * config/tc-dlx.c: Likewise. * config/tc-h8300.c: Likewise. * config/tc-hppa.c: Likewise. * config/tc-i370.c: Likewise. * config/tc-i386-intel.c: Likewise. * config/tc-i386.c: Likewise. * config/tc-i960.c: Likewise. * config/tc-ia64.c: Likewise. * config/tc-iq2000.c: Likewise. * config/tc-m32r.c: Likewise. * config/tc-m68hc11.c: Likewise. * config/tc-m68k.c: Likewise. * config/tc-microblaze.c: Likewise. * config/tc-mips.c: Likewise. * config/tc-mmix.c: Likewise. * config/tc-mn10200.c: Likewise. * config/tc-mn10300.c: Likewise. * config/tc-nios2.c: Likewise. * config/tc-ppc.c: Likewise. * config/tc-s390.c: Likewise. * config/tc-score.c: Likewise. * config/tc-score7.c: Likewise. * config/tc-sparc.c: Likewise. * config/tc-tic4x.c: Likewise. * config/tc-tic54x.c: Likewise. * config/tc-tic6x.c: Likewise. * config/tc-tilegx.c: Likewise. * config/tc-tilepro.c: Likewise. * config/tc-v850.c: Likewise. * config/tc-xtensa.c: Likewise. * config/tc-z80.c: Likewise. * dw2gencfi.c: Likewise. * dwarf2dbgc.: Likewise. * ecoff.c: Likewise. * read.c: Likewise. * stabs.c: Likewise. tests PR gas/18581 * gas/all/byte.d: Disable this test. Quoted expressions are now allowed in .byte directives. * gas/all/quoted-sym-names.s: New test. * gas/all/quoted-sym-names.d: Expected output. * gas/all/gas.exp: Run the new test.
2015-08-21xtensa: implement NPTL helpersMax Filippov9-22/+120
These changes allow debugging multithreaded NPTL xtensa applications. 2015-08-20 Max Filippov <jcmvbkbc@gmail.com> gdb/gdbserver/ * configure.srv (xtensa*-*-linux*): Add srv_linux_thread_db=yes. * linux-xtensa-low.c (arch/xtensa.h gdb_proc_service.h): New #includes. (ps_get_thread_area): New function. 2015-08-20 Max Filippov <jcmvbkbc@gmail.com> gdb/ * arch/xtensa.h: New file. * xtensa-linux-nat.c (gdb_proc_service.h): New #include. (ps_get_thread_area): New function. * xtensa-linux-tdep.c (xtensa_linux_init_abi): Add call to set_gdbarch_fetch_tls_load_module_address to enable TLS support. * xtensa-tdep.c (osabi.h): New #include. (xtensa_gdbarch_init): Call gdbarch_init_osabi to register xtensa-specific hooks. * xtensa-tdep.h (struct xtensa_elf_gregset_t): Add threadptr member and move the structure to arch/xtensa.h.
2015-08-21PR binutils/18257: Properly decode x86/Intel mask instructions.Alexander Fomin7-61/+1452
opcodes/ PR binutils/18257 * i386-dis.c: Use MOD_TABLE for most of mask instructions. (MOD enum): Add MOD_VEX_W_0_0F41_P_0_LEN_1, MOD_VEX_W_1_0F41_P_0_LEN_1, MOD_VEX_W_0_0F41_P_2_LEN_1, MOD_VEX_W_1_0F41_P_2_LEN_1, MOD_VEX_W_0_0F42_P_0_LEN_1, MOD_VEX_W_1_0F42_P_0_LEN_1, MOD_VEX_W_0_0F42_P_2_LEN_1, MOD_VEX_W_1_0F42_P_2_LEN_1, MOD_VEX_W_0_0F44_P_0_LEN_1, MOD_VEX_W_1_0F44_P_0_LEN_1, MOD_VEX_W_0_0F44_P_2_LEN_1, MOD_VEX_W_1_0F44_P_2_LEN_1, MOD_VEX_W_0_0F45_P_0_LEN_1, MOD_VEX_W_1_0F45_P_0_LEN_1, MOD_VEX_W_0_0F45_P_2_LEN_1, MOD_VEX_W_1_0F45_P_2_LEN_1, MOD_VEX_W_0_0F46_P_0_LEN_1, MOD_VEX_W_1_0F46_P_0_LEN_1, MOD_VEX_W_0_0F46_P_2_LEN_1, MOD_VEX_W_1_0F46_P_2_LEN_1, MOD_VEX_W_0_0F47_P_0_LEN_1, MOD_VEX_W_1_0F47_P_0_LEN_1, MOD_VEX_W_0_0F47_P_2_LEN_1, MOD_VEX_W_1_0F47_P_2_LEN_1, MOD_VEX_W_0_0F4A_P_0_LEN_1, MOD_VEX_W_1_0F4A_P_0_LEN_1, MOD_VEX_W_0_0F4A_P_2_LEN_1, MOD_VEX_W_1_0F4A_P_2_LEN_1, MOD_VEX_W_0_0F4B_P_0_LEN_1, MOD_VEX_W_1_0F4B_P_0_LEN_1, MOD_VEX_W_0_0F4B_P_2_LEN_1, MOD_VEX_W_0_0F91_P_0_LEN_0, MOD_VEX_W_1_0F91_P_0_LEN_0, MOD_VEX_W_0_0F91_P_2_LEN_0, MOD_VEX_W_1_0F91_P_2_LEN_0, MOD_VEX_W_0_0F92_P_0_LEN_0, MOD_VEX_W_0_0F92_P_2_LEN_0, MOD_VEX_W_0_0F92_P_3_LEN_0, MOD_VEX_W_1_0F92_P_3_LEN_0, MOD_VEX_W_0_0F93_P_0_LEN_0, MOD_VEX_W_0_0F93_P_2_LEN_0, MOD_VEX_W_0_0F93_P_3_LEN_0, MOD_VEX_W_1_0F93_P_3_LEN_0, MOD_VEX_W_0_0F98_P_0_LEN_0, MOD_VEX_W_1_0F98_P_0_LEN_0, MOD_VEX_W_0_0F98_P_2_LEN_0, MOD_VEX_W_1_0F98_P_2_LEN_0, MOD_VEX_W_0_0F99_P_0_LEN_0, MOD_VEX_W_1_0F99_P_0_LEN_0, MOD_VEX_W_0_0F99_P_2_LEN_0, MOD_VEX_W_1_0F99_P_2_LEN_0, MOD_VEX_W_0_0F3A30_P_2_LEN_0, MOD_VEX_W_1_0F3A30_P_2_LEN_0, MOD_VEX_W_0_0F3A31_P_2_LEN_0, MOD_VEX_W_1_0F3A31_P_2_LEN_0, MOD_VEX_W_0_0F3A32_P_2_LEN_0, MOD_VEX_W_1_0F3A32_P_2_LEN_0, MOD_VEX_W_0_0F3A33_P_2_LEN_0, MOD_VEX_W_1_0F3A33_P_2_LEN_0. (vex_w_table): Replace terminals with MOD_TABLE entries for most of mask instructions. gas/testsuite PR binutils/18257 * gas/i386/disassem.s: Add mask instructions with invalid ModR/M byte. * gas/i386/x86-64-disassem.s: Likewise. * gas/i386/disassem.d: Updated. * gas/i386/x86-64-disassem.d: Likewise.
2015-08-21Add readahead cache to gdb's vFile:preadPedro Alves2-4/+149
This patch almost halves the time it takes to "target remote + run to main" on a higher-latency connection. E.g., I've got a ping time of ~85ms to an x86-64 machine on the gcc compile farm (almost 2000km away from me), and I'm behind a ~16Mbit ADSL. When I connect to a gdbserver debugging itself on that machine and run to main, it takes almost 55 seconds: [palves@gcc76] $ ./gdbserver :9999 ./gdbserver [palves@home] $ ssh -L 9999:localhost:9999 gcc76.fsffrance.org [palves@home] $ time ./gdb -data-directory=data-directory -ex "tar rem :9999" -ex "b main" -ex "c" -ex "set confirm off" -ex "quit" Pristine gdb 7.10.50.20150820-cvs gets us: ... Remote debugging using :9999 Reading symbols from target:/home/palves/gdb/build/gdb/gdbserver/gdbserver...done. Reading symbols from target:/lib64/ld-linux-x86-64.so.2...(no debugging symbols found)...done. 0x00007ffff7ddd190 in ?? () from target:/lib64/ld-linux-x86-64.so.2 Breakpoint 1 at 0x41200c: file ../../../src/gdb/gdbserver/server.c, line 3635. Continuing. Breakpoint 1, main (argc=1, argv=0x7fffffffe3d8) at ../../../src/gdb/gdbserver/server.c:3635 3635 ../../../src/gdb/gdbserver/server.c: No such file or directory. /home/palves/gdb/build/gdb/gdbserver/gdbserver: No such file or directory. real 0m54.803s user 0m0.329s sys 0m0.064s While with the readahead cache added by this patch, it drops to: real 0m29.462s user 0m0.454s sys 0m0.054s I added a few counters to show cache hit/miss, and got: readahead cache miss 142 readahead cache hit 310 Tested on x86_64 Fedora 20. gdb/ChangeLog: 2015-08-21 Pedro Alves <palves@redhat.com> * remote.c (struct readahead_cache): New. (struct remote_state) <readahead_cache>: New field. (remote_open_1): Invalidate the cache. (readahead_cache_invalidate, readahead_cache_invalidate_fd): New functions. (remote_hostio_pwrite): Invalidate the readahead cache. (remote_hostio_pread): Rename to ... (remote_hostio_pread_vFile): ... this. (remote_hostio_pread_from_cache): New function. (remote_hostio_pread): Reimplement. (remote_hostio_close): Invalidate the readahead cache.
2015-08-21procfs.c: Include "filestuff.h"Marcin Cieslak2-0/+6
Fixes implicit function declaration error in gdb/procfs.c:4927 about undeclared make_cleanup_close(). gdb/ChangeLog: PR build/18843 * procfs.c: Include "filestuff.h".
2015-08-20Remove fields curch and cur_line from TUI_CMD_WINPatrick Palka5-37/+30
These fields are currently used to track the location of the cursor inside the command window. But their usefulness is questionable because ncurses already internally keeps track of the location of the cursor, whose coordinates we can query using the functions getyx(), getcurx() or getcury(). It is an unnecessary pain to keep these fields in sync with ncurses, and their meaning is not well-defined anyway. For instance, it is not clear whether the coordinates held in these fields are authoritative, or whether the coordinates reported by ncurses are. So to keep things simple, this patch removes these fields and replaces existing reads of these fields with calls to the appropriate ncurses querying functions, and replaces writes to these fields with calls to wmove() (when necessary and applicable). In the function tui_cont_sig(), I removed the call to wmove() entirely because moving to (start_line, curch) makes no sense. The move should have been to (cur_line, curch) -- which would now be a no-op. Tested on x86_64 Fedora 22, no obvious regressions. gdb/ChangeLog: * tui/tui-data.h (tui_command_info): Remove fields cur_line and curch. * tui/tui-data.c (tui_clear_win_detail) [CMD_WIN]: Don't set cur_line or curch, instead call wmove(). (init_win_info) [CMD_WIN]: Likewise. * tui/tui-io.c (tui_puts): Likewise. Don't read cur_line, instead call getcury(). (tui_redisplay_readline): Don't set cur_line or curch. (tui_mld_erase_entire_line): Don't read cur_line, instead call getcury(). (tui_cont_sig): Remove call to wmove. (tui_getc): Don't read cur_line or curch, instead call getcury() or getyx(). Don't set curch. * tui/tui-win.c (make_visible_with_new_height) [CMD_WIN]: Don't set cur_line or curch. Always move cursor to (0,0).
2015-08-21Automatic date update in version.inGDB Administrator1-1/+1
2015-08-20Fix gdb.server/solib-list.exp native-extended-gdbserver regressionPedro Alves2-9/+5
Commit 221e1a37 (remote non-stop: Process initially stopped threads before other commands) caused a test regression when testing with the native-extended-gdbserver board: FAIL: gdb.server/solib-list.exp: non-stop 1: non-stop interior stop (timeout) This "interior stop" now happens before "target remote" prints the prompt, so we should no longer explicitly expect it. gdb/testsuite/ChangeLog: 2015-08-20 Pedro Alves <palves@redhat.com> * gdb.server/solib-list.exp: No longer expect an interior stop in non-stop mode.
2015-08-20remote non-stop: Process initially stopped threads before other commandsPedro Alves7-25/+219
The main motivation for this is making non-stop / all-stop behave similarly on initial connection, in order to move in the direction of reimplementing all-stop mode with the remote target always running in non-stop mode. When we connect to a remote target in non-stop mode, we may find threads either running or already stopped. The act of connecting itself does not force threads to stop. To handle that, the remote non-stop connection is currently roughly like this: #1 - Fetch list of remote threads (qXfer:threads:read, qfThreadInfo, etc). All threads are assumed to be running until the target reports an asynchronous stop reply for them. #2 - Fetch the initial set of threads that were already stopped, with the '?' packet. (In non-stop, this is coupled with the vStopped mechanism to be able to retrieve the status of more than one thread.) The stop replies fetched in #2 are placed in the pending stop reply queue, and left for the regular event loop to process. That is, "target remote" finishes and returns _before_ those stops are processed. That means that it's possible to have GDB process further commands before the initial set of stopped threads is reported to the user. E.g., before the patch, note how the prompt is printed before the frame: Remote debugging using :9999 (gdb) [Thread 15296] #1 stopped. 0x0000003615a011f0 in ?? () Even though thread #1 was not running, for a moment, the user can see it as such: $ gdb a.out -ex "set non-stop 1" -ex "tar rem :9999" -ex "info threads" -ex "info registers" Remote debugging using :9999 Id Target Id Frame * 1 Thread 4772 (running) Target is executing. <<<<<<< info registers (gdb) [Thread 4772] #1 stopped. 0x0000003615a011f0 in ?? () To fix that, this commit makes gdb process all threads found already stopped at connection time, before giving the prompt to the user. The fix takes a cue from fork-child.c:startup_inferior [1], and processes the events locally in remote.c, avoiding the whole wait_for_inferior/handle_inferior_event path. I decided to try this approach after noticing that: - several cases in handle_inferior_event miss checking stop_soon. - we don't want to fetch the thread list in normal_stop. and trying to fix them was resulting in sprinkling stop_soon checks in many places, and uglifying normal_stop even more. While with this patch, I'm avoiding changing GDB's output other than when the prompt is printed, I think this approach is more flexible if we do want to change it. And also, it's likely easier to get rid of the MI *running event that is still sent for threads that are initially found stopped, if we want to. This happens to fix the testsuite too. All non-stop tests are racy against "target remote" / gdbserver testing currently. That is, sometimes the tests run, but other times they're just skipped without any indication of PASS/FAIL. When that happens, the logs show: target remote localhost:2346 Remote debugging using localhost:2346 (gdb) [Thread 25418] #1 stopped. 0x0000003615a011f0 in ?? () ^CQuit (gdb) Remote debugging from host 127.0.0.1 Killing process(es): 25418 monitor exit (gdb) Remote connection closed (gdb) testcase /home/pedro/gdb/mygit/build/../src/gdb/testsuite/gdb.threads/multi-create-ns-info-thr.exp completed in 61 seconds The trouble here is that there's output after the prompt, and the regex in question doesn't expect that: -re "Remote debugging using .*$serialport_re.*$gdb_prompt $" { verbose "Set target to $targetname" return 0 } [1] - before startup_inferior was added, we'd go through wait_for_inferior/handle_inferior_event while going through the shell, and that turned out problematic. Tested on x86_64 Fedora 20, gdbserver. gdb/ChangeLog: 2015-08-20 Pedro Alves <palves@redhat.com> * infrun.c (print_target_wait_results): Make extern. * infrun.h (print_target_wait_results): Declare. * remote.c (set_stop_requested_callback): Delete. (process_initial_stop_replies): New function. (remote_start_remote): Use it. (stop_reply_queue_length): New function. gdb/testsuite/ChangeLog: 2015-08-20 Pedro Alves <palves@redhat.com> * gdb.server/connect-stopped-target.c: New file. * gdb.server/connect-stopped-target.exp: New file.
2015-08-20Fix language of compilation unit with unknown file extensionPedro Alves5-1/+126
Here, in dwarfread.c:process_full_comp_unit: /* Set symtab language to language from DW_AT_language. If the compilation is from a C file generated by language preprocessors, do not set the language if it was already deduced by start_subfile. */ if (!(cu->language == language_c && COMPUNIT_FILETABS (cust)->language != language_c)) COMPUNIT_FILETABS (cust)->language = cu->language; in case start_subfile doesn't manage to deduce a language COMPUNIT_FILETABS(cust)->language ends up as language_unknown, not language_c. So the condition above evals false and we never set the language from the cu's language. gdb/ChangeLog: 2015-08-20 Pedro Alves <palves@redhat.com> * dwarf2read.c (process_full_comp_unit): To tell whether start_subfile managed to deduce a language, test for language_unknown instead of language_c. gdb/testsuite/ChangeLog: 2015-08-20 Pedro Alves <palves@redhat.com> * gdb.dwarf2/comp-unit-lang.exp: New file. * gdb.dwarf2/comp-unit-lang.c: New file.
2015-08-20[Ada] Fix parsing for expressions with attributes and charactersPierre-Marie de Rodat5-1/+77
Before this change, trying to evaluate the following Ada expression yielded a syntax error, even though it's completely legal: (gdb) p s'first = 'a' Error in expression, near `'. The problem lies in the lexer (gdb/ada-lex.l): at the point we reach "'a'", we're still in the BEFORE_QUAL_QUOTE start condition (the mechanism to distinguish character literals from other "tick" usages: qualified expressions and attributes), so we consider that this quote is actually a separate "tick". This changes resets the start condition to INITIAL in the {TICK}[a-zA-Z][a-zA-Z]+ rule (for attributes): attributes activate this BEFORE_QUAL_QUOTE condition and in this case the above rule is always executed rather than the <BEFORE_QUAL_QUOTE>"'" one (in flex, it's always the longest match that is chosen). We now have instead: (gdb) p s'first = 'a' $1 = true gdb/ChangeLog: * ada-lex.l: Reset the start condition to INITIAL in the rule that matches attributes. gdb/testsuite/ChangeLog: * gdb.ada/attr_ref_and_charlit.exp: New testcase. * gdb.ada/attr_ref_and_charlit/foo.adb: New file. Tested on x86_64-linux, no regression.