aboutsummaryrefslogtreecommitdiff
AgeCommit message (Collapse)AuthorFilesLines
2015-08-25Update MIPS tests for test failures on some configurations.Simon Dardis4-14/+20
* gas/mips/micromips32-move.d: Update expected disassembly. * gas/mips/move.d: Likewise. * gas/mips/move.s: Fix for some MIPS configurations.
2015-08-25remote: allow aborting long operations (e.g., file transfers)Pedro Alves9-21/+143
Currently, when remote debugging, if you type Ctrl-C just while the target stopped for an internal event, and GDB is busy doing something that takes a while (e.g., fetching chunks of a shared library off of the target, with vFile, to process ELF headers and debug info), the Ctrl-C is lost. The patch hooks up the QUIT macro to a new target method that lets the target react to the double-Ctrl-C before the event loop is reached, which allows reacting to a double-Ctrl-C even when GDB is busy doing some long operation and not waiting for a stop reply. That end result is: (gdb) c Continuing. ^C ^C Interrupted while waiting for the program. Give up waiting? (y or n) y Quit (gdb) info threads Id Target Id Frame * 1 Thread 11673 0x00007ffff7deb240 in _dl_debug_state () from target:/lib64/ld-linux-x86-64.so.2 (gdb) If, however, GDB is waiting for a stop reply (because the target has been resumed, with e.g., vCont;c), but the target isn't responding, we now get: (gdb) c Continuing. ^C ^C The target is not responding to interrupt requests. Stop debugging it? (y or n) y Disconnected from target. (gdb) info threads No threads. This offers to disconnect, because when we're waiting for a stop reply, there's nothing else we can send the target other than an interrupt request. And if that doesn't work, there's nothing else we can do. The Ctrl-C is presently lost because until we get to a user-visible stop, the SIGINT handler that is installed is the one that forwards the interrupt to the remote side, with the \003 "packet" [1]. But, gdbserver ignores an interrupt request if the program is stopped. Still, even if it didn't, the server can only report back a stop-because-of-SIGINT when the program is next resumed. And it may take a while to actually re-resume the target. [1] - In the old sync days, the remote target would react to a double-Ctrl-C by asking users whether they wanted to give up waiting and disconnect. The code is still there, but it it isn't reacheable on most hosts, which support serial connections in async mode (probably only DJGPP doesn't). Even then, in sync mode, remote.c's SIGINT handler is only installed while the target is resumed, and is removed as soon as the target sends back a stop reply. That means that a Ctrl-C just while GDB is processing an internal event can end up with an odd "Quit" at the prompt instead of "Program stopped by SIGINT". In contrast, in async mode, remote.c's SIGINT handler is set up as long as target_terminal_inferior or target_terminal_ours_for_output are in effect (IOW, until we get a user-visible stop and call target_terminal_ours), so the user shouldn't get back a spurious Quit. However, it's still desirable to be able to interrupt a long-running GDB operation, if GDB takes a while to re-resume the target or get back to the event loop. Tested on x86_64 Fedora 20. gdb/ChangeLog: 2015-08-24 Pedro Alves <palves@redhat.com> * defs.h (maybe_quit): Declare. (QUIT): Now calls maybe_quit. * event-loop.c (clear_async_signal_handler) (async_signal_handler_is_marked): New functions. * event-loop.h (async_signal_handler_is_marked) (clear_async_signal_handler): New declarations. * remote.c (remote_check_pending_interrupt): New function. (interrupt_query): Use make_cleanup_restore_target_terminal. No longer check whether the target is async. If waiting for a stop reply, and a Ctrl-C as been sent to the target, offer to disconnect, and throw TARGET_CLOSE_ERROR instead of a quit. Otherwise do not disconnect and throw a quit. (_initialize_remote): Install remote_check_pending_interrupt as to_check_pending_interrupt. * target.c (target_check_pending_interrupt): New function. * target.h (struct target_ops) <to_check_pending_interrupt>: New field. (target_check_pending_interrupt): New declaration. * utils.c (maybe_quit): New function. * target-delegates.c: Regenerate.
2015-08-25Support for the sparc %pmcdper privileged register.Jose E. Marchesi9-2/+30
opcodes/ChangeLog: 2015-08-25 Jose E. Marchesi <jose.marchesi@oracle.com> * sparc-dis.c (print_insn_sparc): Handle the privileged register %pmcdper. gas/ChangeLog: 2015-08-25 Jose E. Marchesi <jose.marchesi@oracle.com> * config/tc-sparc.c (priv_reg_table): New privileged register %pmcdper. gas/testsuite/ChangeLog: 2015-08-25 Jose E. Marchesi <jose.marchesi@oracle.com> * gas/sparc/wrpr.s: Test writing to the privileged %pmcdper register. * gas/sparc/wrpr.d: ...and the expected result. * gas/sparc/rdpr.s: Test reading from the privileged %pmcdper register. * gas/sparc/rdpr.d: ...and the expected result.
2015-08-25Print tid in debug output of debug_reg_change_callbackYao Qi2-5/+11
In debug_reg_change_callback, we change debug registers of each LWP. It makes more sense to print LWP's pid rather than group leader's pid. gdb: 2015-08-25 Yao Qi <yao.qi@linaro.org> * nat/aarch64-linux-hw-point.c (debug_reg_change_callback): Rename local variable pid to tid, and get lwpid of lwp. Update debug output.
2015-08-25DWARF: handle non-local references in nested functionsPierre-Marie de Rodat45-155/+1003
GDB's current behavior when dealing with non-local references in the context of nested fuctions is approximative: - code using valops.c:value_of_variable read the first available stack frame that holds the corresponding variable (whereas there can be multiple candidates for this); - code directly relying on read_var_value will instead read non-local variables in frames where they are not even defined. This change adds the necessary context to symbol reads (to get the block they belong to) and to blocks (the static link property, if any) so that GDB can make the proper decisions when dealing with non-local varibale references. gdb/ChangeLog: * ada-lang.c (ada_read_var_value): Add a var_block argument and pass it to default_read_var_value. * block.c (block_static_link): New accessor. * block.h (block_static_link): Declare it. * buildsym.c (finish_block_internal): Add a static_link argument. If there is a static link, associate it to the new block. (finish_block): Add a static link argument and pass it to finish_block_internal. (end_symtab_get_static_block): Update calls to finish_block and to finish_block_internal. (end_symtab_with_blockvector): Update call to finish_block_internal. * buildsym.h: Forward-declare struct dynamic_prop. (struct context_stack): Add a static_link field. (finish_block): Add a static link argument. * c-exp.y: Remove an obsolete comment (evaluation of variables already start from the selected frame, and now they climb *up* the call stack) and propagate the block information to the produced expression. * d-exp.y: Likewise. * f-exp.y: Likewise. * go-exp.y: Likewise. * jv-exp.y: Likewise. * m2-exp.y: Likewise. * p-exp.y: Likewise. * coffread.c (coff_symtab_read): Update calls to finish_block. * dbxread.c (process_one_symbol): Likewise. * xcoffread.c (read_xcoff_symtab): Likewise. * compile/compile-c-symbols.c (convert_one_symbol): Promote the "sym" parameter to struct block_symbol, update its uses and pass its block to calls to read_var_value. (convert_symbol_sym): Update the calls to convert_one_symbol. * compile/compile-loc2c.c (do_compile_dwarf_expr_to_c): Update call to read_var_value. * dwarf2loc.c (block_op_get_frame_base): New. (dwarf2_block_frame_base_locexpr_funcs): Implement the get_frame_base method. (dwarf2_block_frame_base_loclist_funcs): Likewise. (dwarf2locexpr_baton_eval): Add a frame argument and use it instead of the selected frame in order to evaluate the expression. (dwarf2_evaluate_property): Add a frame argument. Update call to dwarf2_locexpr_baton_eval to provide a frame in available and to handle the absence of address stack. * dwarf2loc.h (dwarf2_evaluate_property): Add a frame argument. * dwarf2read.c (attr_to_dynamic_prop): Add a forward declaration. (read_func_scope): Record any available static link description. Update call to finish_block. (read_lexical_block_scope): Update call to finish_block. * findvar.c (follow_static_link): New. (get_hosting_frame): New. (default_read_var_value): Add a var_block argument. Use get_hosting_frame to handle non-local references. (read_var_value): Add a var_block argument and pass it to the LA_READ_VAR_VALUE method. * gdbtypes.c (resolve_dynamic_range): Update calls to dwarf2_evaluate_property. (resolve_dynamic_type_internal): Likewise. * guile/scm-frame.c (gdbscm_frame_read_var): Update call to read_var_value, passing it the block coming from symbol lookup. * guile/scm-symbol.c (gdbscm_symbol_value): Update call to read_var_value (TODO). * infcmd.c (finish_command_continuation): Update call to read_var_value, passing it the block coming from symbol lookup. * infrun.c (insert_exception_resume_breakpoint): Likewise. * language.h (struct language_defn): Add a var_block argument to the LA_READ_VAR_VALUE method. * objfiles.c (struct static_link_htab_entry): New. (static_link_htab_entry_hash): New. (static_link_htab_entry_eq): New. (objfile_register_static_link): New. (objfile_lookup_static_link): New. (free_objfile): Free the STATIC_LINKS hashed map if needed. * objfiles.h: Include hashtab.h. (struct objfile): Add a static_links field. (objfile_register_static_link): New. (objfile_lookup_static_link): New. * printcmd.c (print_variable_and_value): Update call to read_var_value. * python/py-finishbreakpoint.c (bpfinishpy_init): Likewise. * python/py-frame.c (frapy_read_var): Update call to read_var_value, passing it the block coming from symbol lookup. * python/py-framefilter.c (extract_sym): Add a sym_block parameter and set the pointed value to NULL (TODO). (enumerate_args): Update call to extract_sym. (enumerate_locals): Update calls to extract_sym and to read_var_value. * python/py-symbol.c (sympy_value): Update call to read_var_value (TODO). * stack.c (read_frame_local): Update call to read_var_value. (read_frame_arg): Likewise. (return_command): Likewise. * symtab.h (struct symbol_block_ops): Add a get_frame_base method. (struct symbol): Add a block field. (SYMBOL_BLOCK): New accessor. * valops.c (value_of_variable): Remove frame/block handling and pass the block argument to read_var_value, which does this job now. (value_struct_elt_for_reference): Update calls to read_var_value. (value_of_this): Pass the block found to read_var_value. * value.h (read_var_value): Add a var_block argument. (default_read_var_value): Likewise. gdb/testsuite/ChangeLog: * gdb.base/nested-subp1.exp: New file. * gdb.base/nested-subp1.c: New file. * gdb.base/nested-subp2.exp: New file. * gdb.base/nested-subp2.c: New file. * gdb.base/nested-subp3.exp: New file. * gdb.base/nested-subp3.c: New file.
2015-08-25[AArch64] Fix a typo in the comment for BFD_RELOC_AARCH64_LD64_GOT_LO12_NCRenlin Li3-2/+8
2015-08-25 Renlin Li <renlin.li@arm.com> bfd/ * reloc.c (BFD_RELOC_AARCH64_LD64_GOTOFF_LO15): Use LP64 instead of ILP64. * bfd-in2.h: Regenerate.
2015-08-25Move aarch64_linux_new_thread to nat/aarch64-linux.cYao Qi6-29/+28
This patch moves aarch64_linux_new_thread in GDB and GDBserver to nat/aarch64-linux.c. gdb: 2015-08-25 Yao Qi <yao.qi@linaro.org> * aarch64-linux-nat.c (aarch64_linux_new_thread): Move it to ... * nat/aarch64-linux.c (aarch64_linux_new_thread): ... here. * nat/aarch64-linux.h (aarch64_linux_new_thread): Declare. gdb/gdbserver: 2015-08-25 Yao Qi <yao.qi@linaro.org> * linux-aarch64-low.c (aarch64_linux_new_thread): Remove.
2015-08-25Move aarch64_linux_prepare_to_resume to nat/aarch64-linux.cYao Qi11-81/+127
gdb: 2015-08-25 Yao Qi <yao.qi@linaro.org> * Makefile.in (aarch64-liunx.o): New rule. (HFILES_NO_SRCDIR): Add aarch64-linux.h. * config/aarch64/linux.mh (NAT_FILE): Add aarch64-linux.o. * aarch64-linux-nat.c: Include nat/aarch64-linux.h. * aarch64-linux-nat.c (aarch64_get_debug_reg_state): Make it extern. (aarch64_linux_prepare_to_resume): Move it nat/aarch64-linux.c. * nat/aarch64-linux-hw-point.h (aarch64_debug_reg_state): Declare * nat/aarch64-linux.c: New file. * nat/aarch64-linux.h: New file. gdb/gdbserver: 2015-08-25 Yao Qi <yao.qi@linaro.org> * Makefile.in (aarch64-linux.o): New rule. * configure.srv (aarch64*-*-linux*): Append aarch64-linux.o to srv_tgtobj. * linux-aarch64-low.c: Include nat/aarch64-linux.h. (aarch64_init_debug_reg_state): Make it extern. (aarch64_linux_prepare_to_resume): Remove.
2015-08-25Make aarch64_linux_prepare_to_resume the same on GDB and GDBserverYao Qi4-9/+18
gdb: 2015-08-25 Yao Qi <yao.qi@linaro.org> * aarch64-linux-nat.c (aarch64_linux_prepare_to_resume): Use lwp_arch_private_info and ptid_of_lwp. gdb/gdbserver: 2015-08-25 Yao Qi <yao.qi@linaro.org> * linux-aarch64-low.c (aarch64_linux_prepare_to_resume): Use lwp_arch_private_info and ptid_of_lwp.
2015-08-25Add pid argument in aarch64_get_debug_reg_stateYao Qi2-10/+16
This patch addes argument pid in aarch64_get_debug_reg_state, so that its interface is the same on both GDB and GDBserver. gdb/gdbserver: 2015-018-25 Yao Qi <yao.qi@linaro.org> * linux-aarch64-low.c (aarch64_get_debug_reg_state): Add argument pid. Find proc_info by find_process_pid. All callers updated.
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.