aboutsummaryrefslogtreecommitdiff
path: root/gdb/gdbserver/ChangeLog
AgeCommit message (Collapse)AuthorFilesLines
2016-11-23gdbserver: Use warning for warningsPedro Alves1-0/+7
gdb/gdbserver/ChangeLog: 2016-11-23 Pedro Alves <palves@redhat.com> * event-loop.c (handle_file_event): Use warning. * linux-low.c (linux_resume_one_lwp_throw): Use warning. * mem-break.c (add_breakpoint_condition, add_breakpoint_commands): Use warning.
2016-11-23gdbserver: Use debug_printf for debug outputPedro Alves1-0/+11
gdb/gdbserver/ChangeLog: 2016-11-23 Pedro Alves <palves@redhat.com> * linux-low.c (check_zombie_leaders): Use debug_printf for debug output. * notif.c (handle_notif_ack, notif_event_enque): Likewise. * remote-utils.c (putpkt_binary_1, readchar, getpkt): Use debug_printf and debug_flush for debug output. * server.c (handle_general_set): Likewise. * thread-db.c (try_thread_db_load): Use debug_printf for debug output.
2016-11-17Makefile: Replace old suffix rules with pattern rulesSimon Marchi1-0/+5
As mentioned here [1], suffix rules are obsolete and have been superseeded with pattern rules. People (myself included, before writing this patch) are more likely to know what pattern rules are than suffix rules. AFAIK, .SUFFIXES targets are only used for those rules, and can be removed as well. New in v2: - Replace rule in gdbserver/Makefile.in as well. [1] https://www.gnu.org/software/make/manual/html_node/Suffix-Rules.html gdb/ChangeLog: * Makefile.in (.c.o): Replace rule with ... (%.o: %.c): ... this one. (.po.gmo): Replace rule with ... (%.gmo: %.po): ... this one. (.po.pox): Replace rule with ... (%.pox: %.po): ... this one. (.y.c): Replace rule with ... (%.c: %.y): ... this one. (.l.c): Replace rule with ... (%.c: %.l): ... this one. (.SUFFIXES): Remove all instances. gdb/gdbserver/ChangeLog: * Makefile.in (.c.o): Replace rule with ... (%.o: %.c): ... this one.
2016-11-17Remove code that checks for GNU/non-GNU makeSimon Marchi1-0/+8
Since GNU make is now required to build GDB, we can remove everything that checks whether the current make implemention is the GNU one or not. I simply removed the @GMAKE_TRUE@ prefixes and removed the whole lines that were prefixed with @GMAKE_FALSE@. I removed the code in the configure scripts that set those variables. I also removed the following bits from the configure scripts: AC_CHECK_PROGS(MAKE, make): GNU make already defines a MAKE variable internally to be used when invoking Makefiles recursively. I don't see this variable being used anywhere else (in scripts for example), so I think it's safe for removal. AC_PROG_MAKE_SET: This macro defines a SET_MAKE output variable, which is meant to be used in Makefiles to define the MAKE variable when using an implementation of make that doesn't already define it. Since we are now requiring GNU make, we don't need it anymore. Plus, I don't see SET_MAKE being used anywhere, so I don't think it was actually doing anything... gdb/ChangeLog: * Makefile.in: Remove @GMAKE_TRUE@ prefixes and removes lines prefixed with @GMAKE_FALSE@. Update comment related to non-GNU make. * configure.ac: Remove checks for the make program. * configure: Re-generate. gdb/gdbserver/ChangeLog: * Makefile.in: Remove @GMAKE_TRUE@ prefixes and removes lines prefixed with @GMAKE_FALSE@. Update comment related to non-GNU make. * configure.ac: Remove checks for the make program. * configure: Re-generate. gdb/testsuite/ChangeLog: * Makefile.in: Remove @GMAKE_TRUE@ prefixes and removes lines prefixed with @GMAKE_FALSE@. Update comment related to non-GNU make. * configure.ac: Remove checks for the make program. * configure: Re-generate.
2016-10-28gdb: Require C++11Pedro Alves1-0/+9
Use AX_CXX_COMPILE_STDCXX to detect if the compiler supports C++11, and if -std=xxx switches are necessary to enable C++11. We need to tweak AX_CXX_COMPILE_STDCXX a bit though. Pristine upstream AX_CXX_COMPILE_STDCXX appends -std=gnu++11 to CXX directly. That doesn't work for us, because the top level Makefile passes CXX down to subdirs, and that overrides whatever gdb/Makefile may set CXX to. The result would be that a make invocation from the build/gdb/ directory would use "g++ -std=gnu++11" as expected, while a make invocation at the top level would not. So instead of having AX_CXX_COMPILE_STDCXX set CXX directly, tweak it to AC_SUBST a separate variable -- CXX_DIALECT -- and use '$(CXX) (CXX_DIALECT)' to compile/link. Confirmed that this enables C++11 starting with gcc 4.8, the first gcc release with full C++11 support. Also confirmed that configure errors out gracefully with older GCC releases: checking whether /opt/gcc-4.7/bin/g++ supports C++11 features by default... no checking whether /opt/gcc-4.7/bin/g++ supports C++11 features with -std=gnu++11... no checking whether /opt/gcc-4.7/bin/g++ supports C++11 features with -std=gnu++0x... no checking whether /opt/gcc-4.7/bin/g++ supports C++11 features with -std=c++11... no checking whether /opt/gcc-4.7/bin/g++ supports C++11 features with -std=c++0x... no checking whether /opt/gcc-4.7/bin/g++ supports C++11 features with +std=c++11... no checking whether /opt/gcc-4.7/bin/g++ supports C++11 features with -h std=c++11... no configure: error: *** A compiler with support for C++11 language features is required. Makefile:9451: recipe for target 'configure-gdb' failed make[1]: *** [configure-gdb] Error 1 make[1]: Leaving directory '/home/pedro/brno/pedro/gdb/mygit/cxx-convertion/build-gcc-4.7' If we need to revert back to making C++11 optional, all that's necessary is to change the "mandatory" to "optional" in configure.ac and regenerate configure (both gdb and gdbserver). gdb/ChangeLog: 2016-10-28 Pedro Alves <palves@redhat.com> * Makefile.in (CXX_DIALECT): Get from configure. (COMPILE.pre, CC_LD): Append $(CXX_DIALECT). (FLAGS_TO_PASS): Pass CXX_DIALECT. * acinclude.m4: Include ax_cxx_compile_stdcxx.m4. * ax_cxx_compile_stdcxx.m4: Add FSF copyright header. Set and AC_SUBST CXX_DIALECT instead of changing CXX/CXXCPP. * configure.ac: Call AX_CXX_COMPILE_STDCXX. * config.in: Regenerate. * configure: Regenerate. gdb/gdbserver/ChangeLog: 2016-10-28 Pedro Alves <palves@redhat.com> * Makefile.in (CXX_DIALECT): Get from configure. (COMPILE.pre, CC_LD): Append $(CXX_DIALECT). * acinclude.m4: Include ../ax_cxx_compile_stdcxx.m4. * configure.ac: Call AX_CXX_COMPILE_STDCXX. * config.in: Regenerate. * configure: Regenerate.
2016-10-27Enable range stepping if software single step is supportedYao Qi1-0/+5
If the target can do software single step, it can do range stepping. gdb/gdbserver: 2016-10-27 Yao Qi <yao.qi@linaro.org> * linux-low.c (linux_supports_agent): Return true if can_software_single_step return true.
2016-10-27Get pending events in randomYao Qi1-0/+7
Nowadays, we select events to be reported to GDB in random, however that is not enough when many GDBserver internal events (not reported to GDB) are generated. GDBserver pulls all events out of kernel via waitpid, and leave them pending. When goes through threads which have pending events, GDBserver uses find_inferior to find the first thread which has pending event, and consumes it. Note that find_inferior always iterate threads in a fixed order. If multiple threads keep hitting GDBserver breakpoints, range stepping with single-step breakpoint for example, threads in the head of the thread list are more likely to be processed and threads in the tail are starved. This causes some timeout fails in gdb.threads/non-stop-fair-events.exp when range stepping is enabled on arm-linux. This patch fixes this issue by randomly selecting pending events. It adds a new function find_inferior_in_random, which iterates threads which have pending events randomly. gdb/gdbserver: 2016-10-27 Yao Qi <yao.qi@linaro.org> * inferiors.c (find_inferior_in_random): New function. * inferiors.h (find_inferior_in_random): Declare. * linux-low.c (linux_wait_for_event_filtered): Call find_inferior_in_random instead of find_inferior.
2016-10-27Remove single-step breakpoint for GDBserver internal eventYao Qi1-0/+5
This patch removes single-step breakpoints if the event is only GDBserver internal, IOW, isn't reported back to GDB. gdb/gdbserver: 2016-10-27 Yao Qi <yao.qi@linaro.org> * linux-low.c (linux_wait_1): If single-step breakpoints are inserted, remove them.
2016-10-26gdbserver: Leave already-vCont-resumed threads as they werePedro Alves1-0/+13
Currently GDB never sends more than one action per vCont packet, when connected in non-stop mode. A follow up patch will change that, and it exposed a gdbserver problem with the vCont handling. For example, this in non-stop mode: => vCont;s:p1.1;c <= OK Should be equivalent to: => vCont;s:p1.1 <= OK => vCont;c <= OK But gdbserver currently doesn't handle this. In the latter case, "vCont;c" makes gdbserver clobber the previous step request. This patch fixes that. Note the server side must ignore resume actions for the thread that has a pending %Stopped notification (and any other threads with events pending), until GDB acks the notification with vStopped. Otherwise, e.g., the following case is mishandled: #1 => g (or any other packet) #2 <= [registers] #3 <= %Stopped T05 thread:p1.2 #4 => vCont s:p1.1;c #5 <= OK Above, the server must not resume thread p1.2 when it processes the vCont. GDB can't know that p1.2 stopped until it acks the %Stopped notification. (Otherwise it wouldn't send a default "c" action.) (The vCont documentation already specifies this.) Finally, special care must also be given to handling fork/vfork events. A (v)fork event actually tells us that two processes stopped -- the parent and the child. Until we follow the fork, we must not resume the child. Therefore, if we have a pending fork follow, we must not send a global wildcard resume action (vCont;c). We can still send process-wide wildcards though. (The comments above will be added as code comments to gdb in a follow up patch.) gdb/gdbserver/ChangeLog: 2016-10-26 Pedro Alves <palves@redhat.com> * linux-low.c (handle_extended_wait): Link parent/child fork threads. (linux_wait_1): Unlink them. (linux_set_resume_request): Ignore resume requests for already-resumed and unhandled fork child threads. * linux-low.h (struct lwp_info) <fork_relative>: New field. * server.c (in_queued_stop_replies_ptid, in_queued_stop_replies): New functions. (handle_v_requests) <vCont>: Don't call require_running. * server.h (in_queued_stop_replies): New declaration.
2016-10-24[GDBserver] Fix conversion warningYao Qi1-0/+6
I got the following warning if I build GDBserver for aarch64_be-linux-gnu, git/gdb/gdbserver/linux-aarch64-low.c:1539:39: error: invalid conversion from 'void*' to 'uint32_t* {aka unsigned int*}' [-fpermissive] uint32_t *le_buf = xmalloc (byte_len); ^ The patch is to fix the warning. gdb/gdbserver: 2016-10-24 Yao Qi <yao.qi@linaro.org> PR server/20733 * linux-aarch64-low.c (append_insns): Cast the return value to 'uint32_t *'.
2016-10-10Share enum arm_breakpoint_kindsYao Qi1-0/+4
This patch shares "enum arm_breakpoint_kinds", and use ARM_BP_KIND_THUMB2 in GDB. gdb: 2016-10-10 Yao Qi <yao.qi@linaro.org> * arch/arm.h (enum arm_breakpoint_kinds): New. * arm-tdep.c (arm_remote_breakpoint_from_pc): Use ARM_BP_KIND_THUMB2. gdb/gdbserver: 2016-10-10 Yao Qi <yao.qi@linaro.org> * linux-aarch32-low.c (enum arm_breakpoint_kinds): Remove.
2016-10-06Consolidate API of target_supports_multi_processSergio Durigan Junior1-0/+7
This simple commit consolidates the API of target_supports_multi_process. Since both GDB and gdbserver use the same function prototype, all that was needed was to move create this prototype on gdb/target/target.h and turn the macros declared on gdb/{,gdbserver/}target.h into actual functions. Regtested (clean pass) on the BuildBot. gdb/ChangeLog: 2016-10-06 Sergio Durigan Junior <sergiodj@redhat.com> * target.c (target_supports_multi_process): New function, moved from... * target.h (target_supports_multi_process): ... here. Remove macro. * target/target.h (target_supports_multi_process): New prototype. gdb/gdbserver/ChangeLog: 2016-10-06 Sergio Durigan Junior <sergiodj@redhat.com> * target.c (target_supports_multi_process): New function, moved from... * target.h (target_supports_multi_process): ... here. Remove macro.
2016-10-05PR remote/20655 - small fix in handle_tracepoint_bkptsTom Tromey1-0/+6
handle_tracepoint_bkpts has two parallel "if"s. This changes the second one to check ipa_error_tracepoint, which seems to be what was intended. 2016-10-05 Tom Tromey <tom@tromey.com> PR remote/20655: * tracepoint.c (handle_tracepoint_bkpts): Check ipa_error_tracepoint, not ipa_stopping_tracepoint.
2016-10-05Update the path arm-*.xml files for aarch64Yao Qi1-0/+4
0a69eedb (Clean up the XML files for ARM) breaks the GDBserver build on aarch64 because some arm-*.xml files can't be found. This patch is to fix the build failure. gdb/gdbserver: 2016-10-05 Yao Qi <yao.qi@linaro.org> * configure.srv: Update the path of arm-*.xml files.
2016-10-05Clean up the XML files for ARMYao Qi1-0/+10
This patch is move features/arm-*.xml to features/arm/, and it is based on Terry's patch posted here https://sourceware.org/ml/gdb-patches/2014-06/msg00794.html One comment to Terry's patch is about losing "arm" prefix, and the new patch fixes this problem. gdb: 2016-10-05 Terry Guo <terry.guo@arm.com> Yao Qi <yao.qi@linaro.org> * arm-tdep.c: Adjust includes. * features/Makefile (WHICH): Add "arm/" directory to arm target descriptions. (XMLTOC): Likewise. (arm/arm-with-iwmmxt.dat): Adjust the path for dependencies. * features/arm-core.xml: Moved to ... * features/arm/arm-core.xml: ... it. * features/arm-fpa.xml: Moved to ... * features/arm/arm-fpa.xml: ... it. * features/arm-m-profile.xml: Moved to ... * features/arm/arm-m-profile.xm: ... it. * features/arm-vfpv2.xml: Moved to ... * features/arm/arm-vfpv2.xm: ... it. * features/arm-vfpv3.xml: Moved to ... * features/arm/arm-vfpv3.xml: ... it. * features/arm-with-iwmmxt.c: Moved to ... * features/arm/arm-with-iwmmxt.c: ... it. * features/arm-with-iwmmxt.xml: Moved to ... * features/arm/arm-with-iwmmxt.xml: ... it. * features/arm-with-m-fpa-layout.c: Moved to ... * features/arm/arm-with-m-fpa-layout.c: ... it. * features/arm-with-m-fpa-layout.xml: Moved to ... * features/arm/arm-with-m-fpa-layout.xml: ... it. * features/arm-with-m-vfp-d16.c: Moved to ... * features/arm/arm-with-m-vfp-d16.c: ... it. * features/arm-with-m-vfp-d16.xml: Moved to ... * features/arm/arm-with-m-vfp-d16.xml: ... it. * features/arm-with-m.c: Moved to ... * features/arm/arm-with-m.c: ... it. * features/arm-with-m.xml: Moved to ... * features/arm/arm-with-m.xm: ... it. * features/arm-with-neon.c: Moved to ... * features/arm/arm-with-neon.c: ... it. * features/arm-with-neon.xml: Moved to ... * features/arm/arm-with-neon.xml: ... it. * features/arm-with-vfpv2.c: Moved to ... * features/arm/arm-with-vfpv2.c: ... it. * features/arm-with-vfpv2.xml: Moved to ... * features/arm/arm-with-vfpv2.xml: ... it. * features/arm-with-vfpv3.c: Moved to ... * features/arm/arm-with-vfpv3.c: ... it. * features/arm-with-vfpv3.xml: Moved to ... * features/arm/arm-with-vfpv3.xml: ... it. * features/xscale-iwmmxt.xml: Moved to ... * features/arm/xscale-iwmmxt.xml: ... it. gdb/gdbserver: 2016-10-05 Terry Guo <terry.guo@arm.com> Yao Qi <yao.qi@linaro.org> * Makefile.in: Adjust the path of rules. * configure.srv: Update the path of xml files. * regformats/arm-with-iwmmxt.dat: Regenerated. * regformats/arm-with-neon.dat: Likewise. * regformats/arm-with-vfpv2.dat: Likewise. * regformats/arm-with-vfpv3.dat Likewise.
2016-09-30PR 20627: Use resume_stop to stop lwpYao Qi1-0/+6
Commit 049a8570 (Use target_continue{,_no_signal} instead of target_resume) replaces the code stopping lwp with target_continue_no_signal in target_stop_and_wait, like this, - resume_info.thread = ptid; - resume_info.kind = resume_stop; - resume_info.sig = GDB_SIGNAL_0; - (*the_target->resume) (&resume_info, 1); + target_continue_no_signal (ptid); the replacement is not equivalent, and it causes PR 20627. This patch is just to revert that change. Regression testing it on x86_64-linux. gdb/gdbserver: 2016-09-30 Yao Qi <yao.qi@linaro.org> PR gdbserver/20627 * target.c (target_stop_and_wait): Don't call target_continue_no_signal, use resume_stop instead.
2016-09-26Call debug_exit in linux_wait_1Yao Qi1-0/+4
When I read the GDBserver debug message, I find the "entering" of linux_wait_1 doesn't match the "existing" of linux_wait_1. Looks we don't call debug_exit somewhere in linux_wait_1 on return. gdb/gdbserver: 2016-09-26 Yao Qi <yao.qi@linaro.org> * linux-low.c (linux_wait_1): Call debug_exit.
2016-09-23gdb: Replace operator new / operator new[]Pedro Alves1-0/+6
If xmalloc fails allocating memory, usually because something tried a huge allocation, like xmalloc(-1) or some such, GDB asks the user what to do: .../src/gdb/utils.c:1079: internal-error: virtual memory exhausted. A problem internal to GDB has been detected, further debugging may prove unreliable. Quit this debugging session? (y or n) If the user says "n", that throws a QUIT exception, which is caught by one of the multiple CATCH(RETURN_MASK_ALL) blocks somewhere up the stack. The default implementations of operator new / operator new[] call malloc directly, and on memory allocation failure throw std::bad_alloc. Currently, if that happens, since nothing catches it, the exception escapes out of main, and GDB aborts from unhandled exception. This patch replaces the default operator new variants with versions that, just like xmalloc: #1 - Raise an internal-error on memory allocation failure. #2 - Throw a QUIT gdb_exception, so that the exact same CATCH blocks continue handling memory allocation problems. A minor complication of #2 is that operator new can _only_ throw std::bad_alloc, or something that extends it: void* operator new (std::size_t size) throw (std::bad_alloc); That means that if we let a gdb QUIT exception escape from within operator new, the C++ runtime aborts due to unexpected exception thrown. So to bridge the gap, this patch adds a new gdb_quit_bad_alloc exception type that inherits both std::bad_alloc and gdb_exception, and throws _that_. If we decide that we should be catching memory allocation errors in fewer places than all the places we currently catch them (everywhere we use RETURN_MASK_ALL currently), then we could change operator new to throw plain std::bad_alloc then. But I'm considering such a change as separate matter from this one -- it'd make sense to do the same to xmalloc at the same time, for instance. Meanwhile, this allows using new/new[] instead of xmalloc/XNEW/etc. without losing the "virtual memory exhausted" internal-error safeguard. Tested on x86_64 Fedora 23. gdb/ChangeLog: 2016-09-23 Pedro Alves <palves@redhat.com> * Makefile.in (SFILES): Add common/new-op.c. (COMMON_OBS): Add common/new-op.o. (new-op.o): New rule. * common/common-exceptions.h: Include <new>. (struct gdb_quit_bad_alloc): New type. * common/new-op.c: New file. gdb/gdbserver/ChangeLog: 2016-09-23 Pedro Alves <palves@redhat.com> * Makefile.in (SFILES): Add common/new-op.c. (OBS): Add common/new-op.o. (new-op.o): New rule.
2016-09-21Update and add .gitignore'sSimon Marchi1-0/+4
This patch adds a bunch of generated files to gdb's gitignore files. There are still a bunch of "stamp" files that are not ignored, but I think the rule for them should be put in the top-level gitignore. Users and developers are encouraged to build out-of-tree, but some people prefer the simplicity to build in-tree, so it should be useful for them. gdb/ChangeLog: * .gitignore: Ignore more files. * data-directory/.gitignore: Likewise. gdb/doc/ChangeLog: * .gitignore: New file. gdb/gdbserver/ChangeLog: * .gitinore: Ignore more files. gdb/testsuite/ChangeLog: * .gitignore: New file.
2016-09-21Keep reserved bits in CPSR on writeYao Qi1-0/+5
In patch https://sourceware.org/ml/gdb-patches/2016-04/msg00529.html I cleared reserved bits when reading CPSR. It makes a problem that these bits (zero) are written back to kernel through ptrace, and it changes the state of the processor on some recent kernel, which is unexpected. In this patch, I keep these reserved bits when write CPSR back to hardware. gdb: 2016-09-21 Yao Qi <yao.qi@linaro.org> * aarch32-linux-nat.c (aarch32_gp_regcache_collect): Keep bits 20 to 23. gdb/gdbserver: 2016-09-21 Yao Qi <yao.qi@linaro.org> * linux-aarch32-low.c (arm_fill_gregset): Keep bits 20 to 23.
2016-09-19Consolidate target_mourn_inferior between GDB and gdbserverSergio Durigan Junior1-0/+9
This patch consolidates the API of target_mourn_inferior between GDB and gdbserver, in my continuing efforts to make sharing the fork_inferior function possible between both. GDB's version of the function did not care about the inferior's ptid being mourned, but gdbserver's needed to know this information. Since it actually makes sense to pass the ptid as an argument, instead of depending on a global value directly (which GDB's version did), I decided to make the generic API to accept it. I then went on and extended all calls being made on GDB to include a ptid argument (which ended up being inferior_ptid most of the times, anyway), and now we have a more sane interface. On GDB's side, after talking to Pedro a bit about it, we decided that just an assertion to make sure that the ptid being passed is equal to inferior_ptid would be enough for now, on the GDB side. We can remove the assertion and perform more operations later if we ever pass anything different than inferior_ptid. Regression tested on our BuildBot, everything OK. I'd appreciate a special look at gdb/windows-nat.c's modification because I wasn't really sure what to do there. It seemed to me that maybe I should build a ptid out of the process information there, but then I am almost sure the assertion on GDB's side would trigger. gdb/ChangeLog: 2016-09-19 Sergio Durigan Junior <sergiodj@redhat.com> * darwin-nat.c (darwin_kill_inferior): Adjusting call to target_mourn_inferior to include ptid_t argument. * fork-child.c (startup_inferior): Likewise. * gnu-nat.c (gnu_kill_inferior): Likewise. * inf-ptrace.c (inf_ptrace_kill): Likewise. * infrun.c (handle_inferior_event_1): Likewise. * linux-nat.c (linux_nat_attach): Likewise. (linux_nat_kill): Likewise. * nto-procfs.c (interrupt_query): Likewise. (procfs_interrupt): Likewise. (procfs_kill_inferior): Likewise. * procfs.c (procfs_kill_inferior): Likewise. * record.c (record_mourn_inferior): Likewise. * remote-sim.c (gdbsim_kill): Likewise. * remote.c (remote_detach_1): Likewise. (remote_kill): Likewise. * target.c (target_mourn_inferior): Change declaration to accept new ptid_t argument; use gdb_assert on it. * target.h (target_mourn_inferior): Move function prototype from here... * target/target.h (target_mourn_inferior): ... to here. Adjust it to accept new ptid_t argument. * windows-nat.c (get_windows_debug_event): Adjusting call to target_mourn_inferior to include ptid_t argument. gdb/gdbserver/ChangeLog: 2016-09-19 Sergio Durigan Junior <sergiodj@redhat.com> * server.c (start_inferior): Call target_mourn_inferior instead of mourn_inferior; pass ptid_t argument to it. (resume): Likewise. (handle_target_event): Likewise. * target.c (target_mourn_inferior): New function. * target.h (mourn_inferior): Delete macro.
2016-09-16linux-nat: Add function lwp_is_steppingAndreas Arnez1-0/+4
Add the function lwp_is_stepping which indicates whether the given LWP is currently single-stepping. This is a common interface, usable from native GDB as well as from gdbserver. gdb/gdbserver/ChangeLog: * linux-low.c (lwp_is_stepping): New function. gdb/ChangeLog: * nat/linux-nat.h (lwp_is_stepping): New declaration. * linux-nat.c (lwp_is_stepping): New function.
2016-09-13Fix for gdb.server/non-existing-program.exp test caseCarl E. Love1-0/+6
The last commit was supposed to have the reference to ptrace () removed. The patch didn't get updated correctly before the commit. This commit fixes the comment as requested gdbserver/ChangeLog 2016-09-06 Carl Love <cel@us.ibm.com> * server.c (start_inferior): Fixed comment, requested comment change didn't get updated correctly. Removed reference to ptrace () call as it is only true on Linux systems.
2016-09-13Fix for gdb.server/non-existing-program.exp test caseCarl E. Love1-0/+6
The test checks to make sure GDB exits cleanly if there is no valid target binary. Currently, ppc and S390 fail on this test. The function target_post_create_inferior () calls linux_post_create_inferior () which calls the architecture specific functions s390_arch_setup () and ppc_arch_setup () which make ptrace calls to access the architecture specific registers. These ptrace calls fail because the process does not exist causing GDB to exit on error. This patch checks to see if the initial ptrace (PTRACE_TRACEME, ...) call returned a status of TARGET_WAITKIND_EXITED indicating the target has already exited. If the target has exited, then the target_post_create_inferior () is not called since there is no inferior to be setup. The test to see if the initial ptrace call succeeded is done after the ptrace (PTRACE_TRACEME, ...) call and the wait for the inferior process to stop, assuming it exists, has occurred. The patch has been tested on X86 64-bit, ppc64 and s390. If fixes the test failures on ppc64 and s390. The test does not fail on X86 64-bit. The patch does not introduce any additional regression failures on any of these three platforms. gdbserver/ChangeLog 2016-09-06 Carl Love <cel@us.ibm.com> * server.c (start_inferior): Do not call function target_post_create_inferior () if the inferior process has already exited.
2016-09-05gdb/: Require a C++ compilerPedro Alves1-0/+9
This removes all support for building gdb & gdbserver with a C compiler from gdb & gdbserver's build machinery. gdb/ChangeLog: 2016-09-05 Pedro Alves <palves@redhat.com> * NEWS: Mention that a C++ compiler is now required. * Makefile.in (COMPILER, COMPILER_CFLAGS): Remove. (COMPILE.pre, CC_LD): Use CXX directly. (INTERNAL_CFLAGS_BASE): Use CXXFLAGS directly. * acinclude.m4: Don't include build-with-cxx.m4. * build-with-cxx.m4: Delete file. * configure.ac: Remove GDB_AC_BUILD_WITH_CXX call. * warning.m4: Assume $enable_build_with_cxx is yes. * configure: Regenerate. gdb/gdbserver/ChangeLog: 2016-09-05 Pedro Alves <palves@redhat.com> * Makefile.in (COMPILER, COMPILER_CFLAGS): Remove. (COMPILE.pre, CC_LD): Use CXX directly. (INTERNAL_CFLAGS_BASE): Use CXXFLAGS directly. * acinclude.m4: Don't include build-with-cxx.m4. * configure.ac: Remove GDB_AC_BUILD_WITH_CXX call. * configure: Regenerate.
2016-09-03Removed redundant line remote-utils.cAkash Trehan1-0/+6
2016-09-02 Akash Trehan <akash.trehan123@gmail.com> gdb/gdbserver/ChangeLog: PR gdb/19495 * remote-utils.c (relocate_instruction): Remove redundant strcpy() call writing data to own_buf.
2016-09-01Share target_wait prototype between GDB and gdbserverSergio Durigan Junior1-0/+6
This commit moves the target_wait prototype from the GDB-specific target.h header to the common target/target.h header. Then, it creates a compatible implementation of target_wait on gdbserver using the_target->wait, and adjusts the (only) caller (mywait function). Pretty straightforward, no regressions introduced. gdb/gdbserver/ChangeLog: 2016-09-01 Sergio Durigan Junior <sergiodj@redhat.com> * target.c (mywait): Call target_wait instead of the_target->wait. (target_wait): New function. gdb/ChangeLog: 2016-09-01 Sergio Durigan Junior <sergiodj@redhat.com> * target.c (target_wait): Mention that the function's prototype can be found at target/target.h. * target.h (target_wait): Move prototype from here... * target/target.h (target_wait): ... to here.
2016-09-01Use target_continue{,_no_signal} instead of target_resumeSergio Durigan Junior1-0/+9
This commit implements a new function, target_continue, on top of the target_resume function. Then, it replaces all calls to target_resume by calls to target_continue or to the already existing target_continue_no_signal. This is one of the (many) necessary steps needed to consolidate the target interface between GDB and gdbserver. In particular, I am interested in the impact this change will have on the unification of the fork_inferior function (which I have been working on). Tested on the BuildBot, no regressions introduced. gdb/gdbserver/ChangeLog: 2016-09-31 Sergio Durigan Junior <sergiodj@redhat.com> * server.c (start_inferior): New variable 'ptid'. Replace calls to the_target->resume by target_continue{,_no_signal}, depending on the case. * target.c (target_stop_and_wait): Call target_continue_no_signal instead of the_target->resume. (target_continue): New function. gdb/ChangeLog: 2016-09-31 Sergio Durigan Junior <sergiodj@redhat.com> * fork-child.c (startup_inferior): Replace calls to target_resume by target_continue{,_no_signal}, depending on the case. * linux-nat.c (cleanup_target_stop): Call target_continue_no_signal instead of target_resume. * procfs.c (procfs_wait): Likewise. * target.c (target_continue): New function. * target/target.h (target_continue): New prototype.
2016-08-31Fix lwp_suspend/unsuspend imbalance in linux_wait_1Antoine Tremblay1-0/+4
This patch fixes imbalanced lwp_suspend/unsuspend calls caused by the premature choosing of another event for fairness. select_event_lwp would switch the event before a call to unsuspend_all_lwps, thus it would be called with the wrong event. This caused an assertion failure: unsuspend LWP xx, suspended=-1 when testing gdb.threads/non-stop-fair-events.exp with ARM range stepping in GDBServer. This patch moves the switch of event after the unsuspend/unstop calls. No regressions, tested on ubuntu 14.04 ARMv7 and x86. With gdbserver-native. gdb/gdbserver/ChangeLog: * linux-low.c (linux_wait_1): Move event switch after unsuspend_lwps.
2016-08-25Sync proc_service definition with GLIBCAdhemerval Zanella1-0/+15
GLIBC BZ#20311 [1] proc_service.h install patch also remove 'const' attributes from ps_get_thread_area and comment #15 discuss why to remove the const attribute (basically since it a callback with the struct ps_prochandle owned by the client it should be able to modify it if it the case). On default build this is not the issue and current g++ does not trigger any issue with this mismatch declaration. However, on some bootstrap build configuration where gdbserver is build with gcc instead this triggers: error: conflicting types for 'ps_get_thread_area' This patch fixes it by syncing the declaration with GLIBC. [1] https://sourceware.org/bugzilla/show_bug.cgi?id=20311 gdb/ChangeLog: 2016-08-25 Adhemerval Zanella <adhemerval.zanella@linaro.org> * aarch64-linux-nat.c (ps_get_thread_area): Remove const from struct ps_prochandle. * amd64-linux-nat.c (ps_get_thread_area): Likewise. * arm-linux-nat.c (ps_get_thread_area): Likewise. * gdb_proc_service.h (ps_get_thread_area): Likewise. * i386-linux-nat.c (ps_get_thread_area): Likewise. * m68klinux-nat.c (ps_get_thread_area): Likewise. * mips-linux-nat.c (ps_get_thread_area): Likewise. * nat/aarch64-linux.c (aarch64_ps_get_thread_area): Likewise. * nat/aarch64-linux.h (aarch64_ps_get_thread_area): Likewise. * xtensa-linux-nat.c (ps_get_thread_area): Likewise. gdb/gdbserver/ChangeLog: 2016-08-25 Adhemerval Zanella <adhemerval.zanella@linaro.org> PR server/20491 * gdb_proc_service.h (ps_get_thread_area): Remove const from struct ps_prochandle. * linux-aarch64-low.c (ps_get_thread_area): Likewise. * linux-arm-low.c (ps_get_thread_area): Likewise. * linux-crisv32-low.c (ps_get_thread_area): Likewise. * linux-m68k-low.c (ps_get_thread_area): Likewise. * linux-mips-low.c (ps_get_thread_area): Likewise. * linux-nios2-low.c (ps_get_thread_area): Likewise. * linux-tic6x-low.c (ps_get_thread_area): Likewise. * linux-x86-low.c (ps_get_thread_area): Likewise. * linux-xtensa-low.c (ps_get_thread_area): Likewise.
2016-08-19x32: gdbserver's agent bytecode JIT: fix "call" emissionPedro Alves1-0/+4
Running fast tracepoint tests on x32 exposes a latent bug in the agent bytecode jitting. There's a code path that forgets to emit the call opcode... Whoops. Fixes a bunch of gdb.trace/trace-condition.exp FAILs, like: (gdb) continue Continuing. Thread 1 "trace-condition" received signal SIGSEGV, Segmentation fault. 0x7ffec016 in ?? () (gdb) FAIL: gdb.trace/trace-condition.exp: ftrace: $rip == *set_point: advance through tracing gdb/gdbserver/ChangeLog: 2016-08-19 Pedro Alves <palves@redhat.com> * linux-x86-low.c (amd64_emit_call): Emit missing call opcode.
2016-08-19x32: Avoid unsigned long when installing fast tracepoint jump padsPedro Alves1-0/+5
We're casting through unsigned long to write a 64-bit immediate operand of movabs (the comment said movl, but that was incorrect). The problem is that unsigned long is 32-bit on x32, so we were writing fewer bytes than necessary. Fix this by using an 8 byte memcpy like in other similar places in the function. gdb/gdbserver/ChangeLog: 2016-08-19 Pedro Alves <palves@redhat.com> * linux-x86-low.c (amd64_install_fast_tracepoint_jump_pad): Fix comment. Use memcpy instead of casting through unsigned long.
2016-08-19x32 Fast tracepoints: Customize jump pad addressPedro Alves1-0/+5
MAP_32BIT is ignored on x32, meaning the jump pad can end up somewhere between 2GB and 4GB, too far away from the executable for 5-byte relative jumps (JMP rel32). So on x32, try explicitly placing the jump pad near the middle of the available address space. gdb/gdbserver/ChangeLog: 2016-08-19 Pedro Alves <palves@redhat.com> * linux-amd64-ipa.c (alloc_jump_pad_buffer) [__ILP32__]: Try allocating around 0x80000000.
2016-08-19x32 Fast tracepoints: IPA target descriptionsPedro Alves1-0/+14
Building GDB for x32 fails building the IPA, with: .../src/gdb/gdbserver/linux-amd64-ipa.c: In function ‘const target_desc* get_ipa_tdesc(int)’: .../src/gdb/gdbserver/linux-amd64-ipa.c:182:14: error: ‘tdesc_amd64_avx_linux’ was not declared in this scope return tdesc_amd64_avx_linux; ^ .../src/gdb/gdbserver/linux-amd64-ipa.c:184:14: error: ‘tdesc_amd64_mpx_linux’ was not declared in this scope return tdesc_amd64_mpx_linux; ^ .../src/gdb/gdbserver/linux-amd64-ipa.c:186:14: error: ‘tdesc_amd64_avx_mpx_linux’ was not declared in this scope return tdesc_amd64_avx_mpx_linux; ^ [...] The problem is that the IPA is trying to use the 64-bit descriptions, when it should be using the x32 ones. gdb/gdbserver/ChangeLog: 2016-08-19 Pedro Alves <palves@redhat.com> PR gdb/20415 * Makefile.in (x32-linux-ipa.o, x32-avx-linux-ipa.o) (x32-avx512-linux-ipa.o): New rules. * configure.ac (x86_64-*-linux*): New x32 check. * configure.srv (ipa_x32_linux_regobj): New. (x86_64-*-linux*): Use $ipa_x32_linux_regobj if building for x32. * linux-amd64-ipa.c (get_ipa_tdesc) [__ILP32__]: Return x32 descriptions. (initialize_low_tracepoint) [__ILP32__]: Initialize x32 descriptions. * configure: Regenerate.
2016-08-09Fix PR gdb/18653: gdb disturbs inferior's inherited signal dispositionsPedro Alves1-0/+13
gdb's (or gdbserver's) own signal handling should not interfere with the signal dispositions their spawned children inherit. However, it currently does. For example, some paths in gdb cause SIGPIPE to be set to SIG_IGN, and as consequence, the child starts with SIGPIPE to set to SIG_IGN too, even though gdb was started with SIGPIPE set to SIG_DFL. This is because the exec family of functions does not reset the signal disposition of signals that are set to SIG_IGN: http://pubs.opengroup.org/onlinepubs/7908799/xsh/execve.html Signals set to the default action (SIG_DFL) in the calling process image are set to the default action in the new process image. Signals set to be ignored (SIG_IGN) by the calling process image are set to be ignored by the new process image. Signals set to be caught by the calling process image are set to the default action in the new process image (see <signal.h>). And neither does it reset signal masks or flags. In order to be transparent, when spawning new child processes to debug (with "run", etc.), reset signal actions and mask back to what was originally inherited from gdb/gdbserver's parent, just before execing the target program to debug. gdb/ChangeLog: 2016-08-09 Pedro Alves <palves@redhat.com> PR gdb/18653 * Makefile.in (SFILES): Add common/signals-state-save-restore.c. (HFILES_NO_SRCDIR): Add common/signals-state-save-restore.h. (COMMON_OBS): Add signals-state-save-restore.o. (signals-state-save-restore.o): New rule. * configure: Regenerate. * fork-child.c: Include "signals-state-save-restore.h". (fork_inferior): Call restore_original_signals_state. * main.c: Include "signals-state-save-restore.h". (captured_main): Call save_original_signals_state. * common/common.m4: Add sigaction to AC_CHECK_FUNCS checks. * common/signals-state-save-restore.c: New file. * common/signals-state-save-restore.h: New file. gdb/gdbserver/ChangeLog: 2016-08-09 Pedro Alves <palves@redhat.com> PR gdb/18653 * Makefile.in (OBS): Add signals-state-save-restore.o. (signals-state-save-restore.o): New rule. * config.in: Regenerate. * configure: Regenerate. * linux-low.c: Include "signals-state-save-restore.h". (linux_create_inferior): Call restore_original_signals_state. * server.c: Include "dispositions-save-restore.h". (captured_main): Call save_original_signals_state. gdb/testsuite/ChangeLog: 2016-08-09 Pedro Alves <palves@redhat.com> PR gdb/18653 * gdb.base/signals-state-child.c: New file. * gdb.base/signals-state-child.exp: New file. * gdb.gdb/selftest.exp (do_steps_and_nexts): Add new pattern.
2016-08-05gdb/configure --help: suggest --disable-build-with-cxx instead of --enable...Pedro Alves1-0/+4
We build by default with a C++ compiler, but "configure --help" still says "--enable-build-with-cxx", which hints that it is by default disabled. Update the --help text. gdb/ChangeLog: 2016-08-05 Pedro Alves <palves@redhat.com> * build-with-cxx.m4: Change help string to be in terms of --disable-build-with-cxx. * configure: Regenerate. gdb/gdbserver/ChangeLog: 2016-08-05 Pedro Alves <palves@redhat.com> * configure: Regenerate.
2016-08-04Quiet ptrace error ESRCH in regsets_fetch_inferior_registersYao Qi1-0/+5
When I run process-dies-while-detaching.exp with GDBserver, I see many warnings printed by GDBserver, ptrace(regsets_fetch_inferior_registers) PID=26183: No such process ptrace(regsets_fetch_inferior_registers) PID=26183: No such process ptrace(regsets_fetch_inferior_registers) PID=26184: No such process ptrace(regsets_fetch_inferior_registers) PID=26184: No such process regsets_fetch_inferior_registers is called when GDBserver resumes each lwp. #2 0x0000000000428260 in regsets_fetch_inferior_registers (regsets_info=0x4690d0 <aarch64_regsets_info>, regcache=0x31832020) at /home/yao/SourceCode/gnu/gdb/git/gdb/gdbserver/linux-low.c:5412 #3 0x00000000004070e8 in get_thread_regcache (thread=0x31832940, fetch=fetch@entry=1) at /home/yao/SourceCode/gnu/gdb/git/gdb/gdbserver/regcache.c:58 #4 0x0000000000429c40 in linux_resume_one_lwp_throw (info=<optimized out>, signal=0, step=0, lwp=0x31832830) at /home/yao/SourceCode/gnu/gdb/git/gdb/gdbserver/linux-low.c:4463 #5 linux_resume_one_lwp (lwp=0x31832830, step=<optimized out>, signal=<optimized out>, info=<optimized out>) at /home/yao/SourceCode/gnu/gdb/git/gdb/gdbserver/linux-low.c:4573 The is the case that threads are disappeared when GDB/GDBserver resumes them. We check errno for ESRCH, and don't print error messages, like what we are doing in regsets_store_inferior_registers. gdb/gdbserver: 2016-08-04 Yao Qi <yao.qi@linaro.org> * linux-low.c (regsets_fetch_inferior_registers): Check errno is ESRCH or not.
2016-08-02[GDBserver] Remove td_ta_event_addr td_ta_set_event and td_ta_event_getmsgYao Qi1-0/+8
As a result of this commit, 9b4c5f878ff39e04127a1ad95f6b3832afe6d278 (Remove support for thread events without PTRACE_EVENT_CLONE in GDBServer.) the last usage of td_ta_event_addr td_ta_set_event and td_ta_event_getmsg were removed. They are no longer used. This patch is to remove them. gdb/gdbserver: 2016-08-02 Yao Qi <yao.qi@linaro.org> * thread-db.c (struct thread_db) <td_ta_event_getmsg_p>: Remove. <td_ta_set_event_p, td_ta_event_addr_p>: Remove. (thread_db_load_search): Update. (try_thread_db_load_1): Don't look for td_ta_event_addr, td_ta_set_event and td_ta_event_getmsg.
2016-07-26Fix PR server/20414 - x32 gdbserver always crashes inferiorPedro Alves1-0/+7
Debugging an x32 process with an x32 gdbserver always results in: (gdb) c Continuing. Program received signal SIGSEGV, Segmentation fault. 0xf7de9600 in _dl_debug_state () from target:/libx32/ld-linux-x32.so.2 (gdb) Looking at the remote debug logs reveals the problem, here: Packet received: T05swbreak:;06:a0d4ffff00000000;07:b8d3ffff00000000;10:0096def701000000;thread:p7d7a.7d7a;core:1; ^^^^^^^^^^^^^^^^ The underlined value is the expedited value of RIP (in little endian). But notice that 01 in 0x01f7de9600, while gdb says the program stopped at 0xf7de9600. 0x01ffffffff is over 32 bits, which indicates that something wen't wrong somewhere in gdbserver. The problem turns out to be in gdbserver's x86_get_pc / x86_set_pc routines, where "unsigned long" is used assuming that it can fit a 64-bit value, while unsigned long is actually 32-bit on x32. The result is that collect_register_by_name / supply_register_by_name end up reading/writing random bytes off the stack. Fix this by using explicit uint64_t instead of unsigned long. For consistency, use uint32_t instead of unsigned int in the 32-bit paths. gdb/gdbserver/ChangeLog: 2016-07-26 Pedro Alves <palves@redhat.com> PR server/20414 * linux-x86-low.c (x86_get_pc, x86_set_pc): Use uint64_t instead of unsigned long for 64-bit registers and use uint32_t instead of unsigned int for 32-bit registers.
2016-07-26Fix PR gdb/20287 - x32 and "gdb_static_assert (sizeof (nat_siginfo_t) == ↵Pedro Alves1-0/+5
sizeof (siginfo_t))" Building an x32 gdb trips on a static assertion: In file included from .../src/gdb/common/common-defs.h:71:0, from .../src/gdb/nat/amd64-linux-siginfo.c:21: .../src/gdb/common/gdb_assert.h:26:66: error: size of array ‘never_defined_just_used_for_checking’ is negative extern int never_defined_just_used_for_checking[(expr) ? 1 : -1] ^ .../src/gdb/nat/amd64-linux-siginfo.c:113:1: note: in expansion of macro ‘gdb_static_assert’ gdb_static_assert (sizeof (nat_siginfo_t) == sizeof (siginfo_t)); ^ The problem is that the way nat_siginfo_t is defined, it can only match the host's siginfo_t object when gdb is built as a 64-bit program. Several bits of nat_siginfo_t are off: - nat_siginfo_t's _pad field's definition is: int _pad[((128 / sizeof (int)) - 4)]; while /usr/include/bits/siginfo.h has: # define __SI_MAX_SIZE 128 # if __WORDSIZE == 64 # define __SI_PAD_SIZE ((__SI_MAX_SIZE / sizeof (int)) - 4) # else # define __SI_PAD_SIZE ((__SI_MAX_SIZE / sizeof (int)) - 3) # endif and __WORDSIZE == 32 for x32. This is what causes the size of nat_siginfo_t to be wrong and the assertion to fail. - the nat_clock_t type is incorrect for 64-bit. We have this: /* For native 64-bit, clock_t in _sigchld is 64bit aligned at 4 bytes. */ typedef long __attribute__ ((__aligned__ (4))) nat_clock_t; however, /usr/include/bits/siginfo.h has: # if defined __x86_64__ && __WORDSIZE == 32 /* si_utime and si_stime must be 4 byte aligned for x32 to match the kernel. We align siginfo_t to 8 bytes so that si_utime and si_stime are actually aligned to 8 bytes since their offsets are multiple of 8 bytes. */ typedef __clock_t __attribute__ ((__aligned__ (4))) __sigchld_clock_t; # define __SI_ALIGNMENT __attribute__ ((__aligned__ (8))) # else typedef __clock_t __sigchld_clock_t; # define __SI_ALIGNMENT # endif So we're currently forcing 4-byte alignment on clock_t, when it should only be so for x32, not 64-bit. The fix: - Leaves nat_siginfo_t strictly for the 64-bit ABI. - Adds a new typedef for the siginfo type that ptrace uses (ptrace_siginfo_t). An x32 gdb always gets/sets an x32 siginfo_t type with PTRACE_GETSIGINFO/PTRACE_SETSIGINFO. - Uses this new ptrace_siginfo_t type instead of nat_siginfo_t as the intermediate conversion type. gdb/ChangeLog: 2016-07-26 Pedro Alves <palves@redhat.com> * amd64-linux-nat.c (amd64_linux_siginfo_fixup): Rename 'native' parameter to 'ptrace'. * nat/amd64-linux-siginfo.c (GDB_SI_SIZE): New define. (nat_uptr_t): New an unsigned long. (nat_clock_t): Remove attribute __aligned__. (struct nat_timeval): Delete. (nat_siginfo_t): Remove attribute __aligned__. (ptrace_siginfo_t): Define. (compat_siginfo_from_siginfo, siginfo_from_compat_siginfo) (compat_x32_siginfo_from_siginfo) (siginfo_from_compat_x32_siginfo): Make 'from' parameter const. Convert through a ptrace_siginfo_t instead of a nat_siginfo_t. Remove casts. (amd64_linux_siginfo_fixup_common): Rename 'native' parameter to 'ptrace'. Remove static assertions. (top level): New static assertions. gdb/gdbserver/ChangeLog: 2016-07-26 Pedro Alves <palves@redhat.com> * linux-x86-low.c (x86_siginfo_fixup): Rename 'native' parameter to 'ptrace'.
2016-07-21Add -Wunused-but-set-* to buildTom Tromey1-0/+4
This adds -Wunused-but-set-variable and -Wunused-but-set-parameter to configure. 2016-07-21 Tom Tromey <tom@tromey.com> * configure: Rebuild. * warning.m4 (AM_GDB_WARNINGS) <build_warnings>: Add -Wunused-but-set-parameter, -Wunused-but-set-variable. 2016-07-21 Tom Tromey <tom@tromey.com> * configure: Rebuild.
2016-07-21Fix cast to 'gdb_breakpoint *'Yao Qi1-0/+5
c-mode buildbot catches a build problem, gcc -g -O2 -I. -I../../../binutils-gdb/gdb/gdbserver -I../../../binutils-gdb/gdb/gdbserver/../common -I../../../binutils-gdb/gdb/gdbserver/../regformats -I../../../binutils-gdb/gdb/gdbserver/.. -I../../../binutils-gdb/gdb/gdbserver/../../include -I../../../binutils-gdb/gdb/gdbserver/../gnulib/import -Ibuild-gnulib-gdbserver/import -Wall -Wpointer-arith -Wno-unused -Wunused-value -Wunused-function -Wno-switch -Wno-char-subscripts -Wempty-body -Wpointer-sign -Wmissing-prototypes -Wdeclaration-after-statement -Wmissing-parameter-type -Wold-style-declaration -Wold-style-definition -Wformat-nonliteral -Wno-missing-prototypes -Werror -DGDBSERVER -c -o hostio.o -MT hostio.o -MMD -MP -MF .deps/hostio.Tpo ../../../binutils-gdb/gdb/gdbserver/hostio.c ../../../binutils-gdb/gdb/gdbserver/mem-break.c: In function find_gdb_breakpoint: ../../../binutils-gdb/gdb/gdbserver/mem-break.c:996:15: error: gdb_breakpoint undeclared (first use in this function) return (gdb_breakpoint *) bp; we should use 'struct gdb_breakpoint' rather than 'gdb_breakpoint'. Patch below fixes this. gdb/gdbserver: 2016-07-21 Yao Qi <yao.qi@linaro.org> * mem-break.c (find_gdb_breakpoint): Cast bp to 'struct gdb_breakpoint *' rather than 'gdb_breakpoint *'.
2016-07-21Support vCont s and S actions with software single stepYao Qi1-0/+5
GDBserver with software single step should be able to claim supporting vCont s and S actions, so that GDB knows the remote target can do single step. It doesn't matter to GDB that the single step in the remote target is done via hardware or software. gdb/gdbserver: 2016-07-21 Yao Qi <yao.qi@linaro.org> * server.c (handle_v_requests): Support s and S actions if target_supports_software_single_step return true.
2016-07-21Use reinsert_breakpoint for vCont;sYao Qi1-0/+11
This patch is to teach GDBserver using software single step to handle vCont;s. Simply speaking, if the thread's resume request is resume_step, install reinsert breakpoint at the next pcs when GDBserver is about to resume threads. These reinsert breakpoints of a thread are removed, when GDBserver gets an event from that thread and reports it back to GDB. gdb/gdbserver: 2016-07-21 Yao Qi <yao.qi@linaro.org> * linux-low.c (resume_stopped_resumed_lwps): If resume request is resume_step, call maybe_hw_step. (linux_wait_1): Stop all threads, remove reinsert breakpoints, and unstop them. (linux_resume_one_lwp_throw): Don't assert the thread has reinsert breakpoints or not. (proceed_one_lwp): If resume request is resume_step, install reinsert breakpoints and call maybe_hw_step.
2016-07-21Enqueue signal even when resuming threadsYao Qi1-0/+7
Nowadays, we only enqueue signal when we leave thread pending in linux_resume_one_thread. If lwp->resume->sig isn't zero (GDB wants to resume with signal), we pass lwp->resume->sig to linux_resume_one_lwp. In order to reduce the difference between resuming thread with signal and proceeding thread with signal, when we resume thread, we can enqueue signal too, and proceed thread. The signal will be consumed in linux_resume_one_lwp_throw from lwp->pending_signals. gdb/gdbserver: 2016-07-21 Yao Qi <yao.qi@linaro.org> * linux-low.c (proceed_one_lwp): Declare. (linux_resume_one_thread): Remove local variable 'step'. Lift code enqueue signal. Call proceed_one_lwp instead of linux_resume_one_lwp.
2016-07-21Use enqueue_pending_signal in linux_resume_one_threadYao Qi1-0/+5
gdb/gdbserver: 2016-07-21 Yao Qi <yao.qi@linaro.org> * linux-low.c (linux_resume_one_thread): Call enqueue_pending_signal.
2016-07-21Switch current_thread to lwp's thread in ↵Yao Qi1-0/+9
install_software_single_step_breakpoints install_software_single_step_breakpoints has parameter lwp, but still need to switch to current_thread. In order to simplify its caller, we do the current_thread save/restore inside install_software_single_step_breakpoints. gdb/gdbserver: 2016-07-21 Yao Qi <yao.qi@linaro.org> * gdbthread.h (make_cleanup_restore_current_thread): Declare. * inferiors.c (do_restore_current_thread_cleanup): New function. (make_cleanup_restore_current_thread): Likewise. * linux-low.c (install_software_single_step_breakpoints): Call make_cleanup_restore_current_thread. Switch current_thread to thread.
2016-07-21Make reinsert_breakpoint thread specificYao Qi1-0/+16
This patch makes reinsert_breakpoint thread specific, which means we insert and remove reinsert_breakpoint breakpoints for a specific thread. This motivation of this change is that I'll use reinsert_breakpoint for vCont;s on software single step target, so that GDBserver may insert one reinsert_breakpoint for one thread doing step-over, and insert one reinsert_breakpoint for another thread doing vCont;s. After the operation of one thread is finished, GDBserver must remove reinsert_breakpoint for that thread only. On the other hand, reinsert_breakpoint is used for step-over nowadays. GDBserver inserts reinsert_breakpoint, and wait only from the thread doing step-over. After the step-over is done, GDBserver removes the reinsert_breakpoint. If there is still any threads need step-over, do the same again until all threads are finished step-over. In other words, reinsert_breakpoint is globally thread specific, but in an implicit way. It is natural to make it explicitly thread specific. gdb/gdbserver: 2016-07-21 Yao Qi <yao.qi@linaro.org> * mem-break.c (struct reinsert_breakpoint) <ptid>: New field. (set_reinsert_breakpoint): New parameter ptid. Callers updated. (clone_one_breakpoint): Likewise. (delete_reinsert_breakpoints): Change parameter to thread. Callers updated. (has_reinsert_breakpoints): Likewise. (uninsert_reinsert_breakpoints): Likewise. (reinsert_reinsert_breakpoints): Likewise. * mem-break.h (set_reinsert_breakpoint): Update declaration. (delete_reinsert_breakpoints): Likewise. (reinsert_reinsert_breakpoints): Likewise. (uninsert_reinsert_breakpoints): Likewise. (has_reinsert_breakpoints): Likewise.
2016-07-21Refactor clone_all_breakpointsYao Qi1-0/+9
This patch is to change the interface of clone_all_breakpoints, from lists of breakpoints and raw_breakpoints to child thread and parent thread. I choose child thread to pass because we need the ptid of the child thread in the following patch. gdb/gdbserver: 2016-07-21 Yao Qi <yao.qi@linaro.org> * inferiors.c (get_thread_process): Make parameter const. * inferiors.h (get_thread_process): Update declaration. * mem-break.c (clone_all_breakpoints): Remove all parameters. Add new parameters child_thread and parent_thread. Callers updated. * mem-break.h (clone_all_breakpoints): Update declaration.
2016-07-21Create sub classes of 'struct breakpoint'Yao Qi1-0/+31
Nowadays, there are three types of breakpoint in GDBserver, - gdb breakpoints, - reinsert breakpoints, used for software single step, - other breakpoints, used for tracepoint, but we only have one 'struct breakpoint' for all of them. Some fields are only useful to one type of breakpoint. For example, cond_list and command_list are only used by gdb breakpoints, while handler is only used by other breakpoints. This patch changes 'struct breakpoint' to a base class, which has fields needed by all breakpoint types, also add three sub-classes to 'struct breakpoint' to these three types of breakpoints. gdb/gdbserver: 2016-07-21 Yao Qi <yao.qi@linaro.org> * mem-break.c (struct breakpoint) <cond_list>: Remove. <command_list, handler>: Remove. (struct gdb_breakpoint): New. (struct other_breakpoint): New. (struct reinsert_breakpoint): New. (is_gdb_breakpoint): New function. (any_persistent_commands): Update command_list if is_gdb_breakpoint returns true. (set_breakpoint): Create breakpoints according to their types. (find_gdb_breakpoint): Return 'struct gdb_breakpoint *'. (set_gdb_breakpoint_1): Likewise. (set_gdb_breakpoint): Likewise. (clear_breakpoint_conditions): Change parameter type to 'struct gdb_breakpoint *'. (clear_breakpoint_commands): Likewise. (clear_breakpoint_conditions_and_commands): Likewise. (add_condition_to_breakpoint): Likewise. (add_breakpoint_condition): Likewise. (add_commands_to_breakpoint): Likewise. (check_breakpoints): Check other_breakpoint. (clone_one_breakpoint): Clone breakpopint according to its type. * mem-break.h (struct gdb_breakpoint): Declare. (set_gdb_breakpoint): Update declaration. (clear_breakpoint_conditions_and_commands): Likewise. (add_breakpoint_condition): Likewise. (add_breakpoint_commands): Likewise. * server.c (process_point_options): Change parameter type to 'struct gdb_breakpoint *'.