aboutsummaryrefslogtreecommitdiff
path: root/gdb/gdbserver/ChangeLog
AgeCommit message (Collapse)AuthorFilesLines
2017-08-25gdbserver: Rename some functions, thread -> inferiorSimon Marchi1-0/+26
These functions apply to thread, and not inferiors (in the gdbserver sense, the abstraction for threads and processes, as in inferior_list). Therefore, it would make more sense if these functions were named with "thread" rather than "inferior". gdb/gdbserver/ChangeLog: * inferiors.h (inferior_target_data): Rename to ... (thread_target_data): ... this. (inferior_regcache_data): Rename to ... (thread_regcache_data): ... this. (set_inferior_regcache_data): Rename to ... (set_thread_regcache_data): ... this. * inferiors.c (inferior_target_data): Rename to ... (thread_target_data): ... this. (inferior_regcache_data): Rename to ... (thread_regcache_data): ... this. (set_inferior_regcache_data): Rename to ... (set_thread_regcache_data): ... this. (free_one_thread): Update. * linux-low.h (get_thread_lwp): Update. * regcache.c (get_thread_regcache): Update. (regcache_invalidate_thread): Update. (free_register_cache_thread): Update. * win32-i386-low.c (update_debug_registers_callback): Update. (win32_get_current_dr): Update. * win32-low.c (thread_rec): Update. (delete_thread_info): Update. (continue_one_thread): Update. (suspend_one_thread): Update.
2017-08-24Remove unused function set_inferior_target_dataSimon Marchi1-0/+5
The inferior (thread) target data is always set through add_thread. gdb/gdbserver/ChangeLog: * inferiors.c (set_inferior_target_data): Remove. * inferiors.h (set_inferior_target_data): Remove.
2017-08-18GDBserver self testsYao Qi1-0/+8
This patch uses GDB self test in GDBserver. The self tests are run if GDBserver is started with option --selftest. gdb: 2017-08-18 Yao Qi <yao.qi@linaro.org> * NEWS: Mention GDBserver's new option "--selftest". * Makefile.in (SFILES): Remove selftest.c, add common/selftest.c. * selftest.c: Move it to common/selftest.c. * selftest.h: Move it to common/selftest.h. * selftest-arch.c (reset): New function. (tests_with_arch): Call reset. gdb/gdbserver: 2017-08-18 Yao Qi <yao.qi@linaro.org> * Makefile.in (OBS): Add selftest.o. * configure.ac: AC_DEFINE GDB_SELF_TEST if $development. * configure, config.in: Re-generated. * server.c: Include common/sefltest.h. (captured_main): Handle option --selftest. gdb/testsuite: 2017-08-18 Yao Qi <yao.qi@linaro.org> * gdb.server/unittest.exp: New. gdb/doc: 2017-08-18 Yao Qi <yao.qi@linaro.org> * gdb.texinfo (Server): Document "--selftest".
2017-08-09Clean up x86 non-linux GDBserver target descriptionsYao Qi1-0/+14
In GDBserver, only tdesc_i386 and tdesc_amd64 are used. There is no point of generating these *.dat files (which are used to generate *.c files during GDBserver build.). gdb: 2017-08-09 Yao Qi <yao.qi@linaro.org> * features/Makefile (WHICH): Remove i386/ non-linux stuff. * regformats/i386/amd64-avx-avx512.dat: Remove. * regformats/i386/amd64-avx-mpx-avx512-pku.dat: Remove. * regformats/i386/amd64-avx-mpx.dat:Remove. * regformats/i386/amd64-avx.dat: Remove. * regformats/i386/amd64-mpx.dat: Remove. * regformats/i386/i386-avx-avx512.dat: Remove. * regformats/i386/i386-avx-mpx-avx512-pku.dat: Remove. * regformats/i386/i386-avx-mpx.dat: Remove. * regformats/i386/i386-mmx.dat: Remove. * regformats/i386/i386-mpx.dat: Remove. gdb/gdbserver: 2017-08-09 Yao Qi <yao.qi@linaro.org> * configure.srv (srv_i386_regobj): Remove i386-avx.o, i386-avx-avx512.o, i386-avx-mpx-avx512-pku.o, i386-mpx.o, i386-avx-mpx.o and i386-mmx.o. (srv_amd64_regobj): Remove amd64-avx.o, amd64-avx-avx512.o, amd64-avx-mpx-avx512-pku.o, amd64-mpx.o and amd64-avx-mpx.o. (srv_i386_xmlfiles): Remove i386/i386-avx.xml, i386/i386-avx-avx512.xml, i386/i386-avx-mpx-avx512-pku.xml, i386/i386-mpx.xml, i386/i386-avx-mpx.xml and i386/i386-mmx.xml. (srv_amd64_xmlfile):i386/amd64-avx.xml, i386/amd64-avx-avx512.xml, i386/amd64-avx-mpx-avx512-pku.xml, i386/amd64-mpx.xml, i386/amd64-avx-mpx.xml.
2017-08-09Remove x32 non-linux target descriptionsYao Qi1-0/+7
x32 non-linux target descriptions are not used in GDB or GDBserver. This patch removes them. gdb: 2017-08-09 Yao Qi <yao.qi@linaro.org> * amd64-tdep.h (tdesc_x32): Remove the declaration. * amd64-tdep.c: Don't include features/i386/x32*.c. (_initialize_amd64_tdep): Don't call initialize_tdesc_x32* functions. * features/Makefile (WHICH): Remove i386/x32, i386/x32-avx, and i386/x32-avx-avx512. (XMLTOC): Remove i386/x32-avx.xml, i386/x32-avx-avx512.xml, and i386/x32.xml. * features/i386/x32-avx-avx512.c: Removed. * features/i386/x32-avx-avx512.xml: Removed. * features/i386/x32-avx.c: Removed. * features/i386/x32-avx.xml: Removed. * features/i386/x32.c: Removed. * features/i386/x32.xml: Removed. * regformats/i386/x32-avx-avx512.dat: Removed. * regformats/i386/x32-avx.dat: Removed. * regformats/i386/x32.dat: Removed. gdb/gdbserver: 2017-08-09 Yao Qi <yao.qi@linaro.org> * configure.srv (srv_amd64_regobj): Remove x32.o, x32-avx.o and x32-avx-avx512.o. (srv_amd64_xmlfiles): Remove i386/x32.xml, i386/x32-avx.xml i386/x32-avx-avx512.xml.
2017-07-26Add enum for result of fast_tracepoint_collectingSimon Marchi1-0/+18
I got confused by the result value of fast_tracepoint_collecting, while it sounds like it would return true/false (whether the thread is collecting or not), it actually returns: 0: not collecting 1: in the jump pad, before the relocated instruction 2: in the jump pad, at or after the relocated instruction To avoid confusion, I think it would be nice to make it return an enum. If you can help find a shorter but still relavant name, it would be awesome. Otherwise, we'll go with that, fast_tpoint_collect_result, which is at least consistent with the existing fast_tpoint_collect_status. gdb/gdbserver/ChangeLog: * tracepoint.h (enum class fast_tpoint_collect_result): New enumeration. (fast_tracepoint_collecting): Change return type to fast_tpoint_collect_result. * tracepoint.c (fast_tracepoint_collecting): Likewise. * linux-low.h: Include tracepoint.h. (struct lwp_info) <collecting_fast_tracepoint>: Change type to fast_tpoint_collect_result. * linux-low.c (handle_tracepoints): Adjust. (linux_fast_tracepoint_collecting): Change return type to fast_tpoint_collect_result. (maybe_move_out_of_jump_pad, linux_wait_for_event_filtered, linux_wait_1, stuck_in_jump_pad_callback, lwp_signal_can_be_delivered, linux_resume_one_lwp_throw, proceed_one_lwp): Adjust to type change.
2017-07-10Re-indent the codeYao Qi1-0/+4
gdb/gdbserver: 2017-07-10 Yao Qi <yao.qi@linaro.org> * linux-x86-low.c (x86_linux_read_description): Re-indent the code.
2017-06-29Use target_desc fields expedite_regs and xmltarget ifndef IN_PROCESS_AGENTYao Qi1-0/+6
struct target_desc is used by both GDBserver and IPA, but fields expedite_regs and xmltarget are only used in GDBserver, so this patch wraps these two fields by ifndef IN_PROCESS_AGENT. This patch also changes regformats/regdat.sh to generate .c files in this way too. gdb/gdbserver: 2017-06-29 Yao Qi <yao.qi@linaro.org> * tdesc.h (struct target_desc) [IN_PROCESS_AGENT] <expedite_regs>: Remove. [IN_PROCESS_AGENT] <xmltarget>: Likewise. gdb: 2017-06-29 Yao Qi <yao.qi@linaro.org> * regformats/regdat.sh: Generate code with "ifndef IN_PROCESS_AGENT".
2017-06-20gdbserver/Makefile.in: Sort IPA_OBJSSimon Marchi1-0/+4
gdb/gdbserver/ChangeLog: * Makefile.in (IPA_OBJS): Sort and format one item per line.
2017-06-20C++ify gdb/common/environ.cSergio Durigan Junior1-0/+12
As part of the preparation necessary for my upcoming task, I'd like to propose that we turn gdb_environ into a class. The approach taken here is simple: the class gdb_environ contains everything that is needed to manipulate the environment variables. These variables are stored in an std::vector<char *>, which can be converted to a 'char **' and passed as argument to functions that need it. The usage has not changed much. As per Pedro's suggestion, this class uses a static factory method initialization. This means that when an instance is created, it is initially empty. When needed, it has to be initialized using the static method 'from_host_environ'. As mentioned before, this is a preparation for an upcoming work that I will be posting in the next few weeks or so. For that work, I'll probably create another data structure that will contain all the environment variables that were set by the user using the 'set environment' command, because I'll need access to them. This will be much easier with the class-ification of gdb_environ. As noted, this has been regression-tested with the new version of environ.exp and no regressions were found. gdb/ChangeLog: 2017-06-20 Sergio Durigan Junior <sergiodj@redhat.com> * Makefile.in (SUBDIR_UNITTESTS_SRCS): Add 'unittests/environ-selftests.c'. (SUBDIR_UNITTESTS_OBS): Add 'environ-selftests.o'. * charset.c (find_charset_names): Declare object 'iconv_env'. Update code to use 'iconv_env' object. Remove call to 'free_environ'. * common/environ.c: Include <utility>. (make_environ): Delete function. (free_environ): Delete function. (gdb_environ::clear): New function. (gdb_environ::operator=): New function. (gdb_environ::get): Likewise. (environ_vector): Delete function. (set_in_environ): Delete function. (gdb_environ::set): New function. (unset_in_environ): Delete function. (gdb_environ::unset): New function. (gdb_environ::envp): Likewise. * common/environ.h: Include <vector>. (struct gdb_environ): Delete; transform into... (class gdb_environ): ... this class. (free_environ): Delete prototype. (init_environ, get_in_environ, set_in_environ, unset_in_environ, environ_vector): Likewise. * infcmd.c (run_command_1): Update code to call 'envp' from 'gdb_environ' class. (environment_info): Update code to call methods from 'gdb_environ' class. (unset_environment_command): Likewise. (path_info): Likewise. (path_command): Likewise. * inferior.c (inferior::~inferior): Delete call to 'free_environ'. (inferior::inferior): Initialize 'environment' using the host's information. * inferior.h: Remove forward declaration of 'struct gdb_environ'. Include "environ.h". (class inferior) <environment>: Change type from 'struct gdb_environ' to 'gdb_environ'. * mi/mi-cmd-env.c (mi_cmd_env_path): Update code to call methods from 'gdb_environ' class. * solib.c (solib_find_1): Likewise * unittests/environ-selftests.c: New file. gdb/gdbserver/ChangeLog: 2017-06-20 Sergio Durigan Junior <sergiodj@redhat.com> * linux-low.c (linux_create_inferior): Adjust code to access the environment information via 'gdb_environ' class. * lynx-low.c (lynx_create_inferior): Likewise. * server.c (our_environ): Make it an instance of 'gdb_environ'. (get_environ): Return a pointer to 'our_environ'. (captured_main): Initialize 'our_environ'. * server.h (get_environ): Adjust prototype. * spu-low.c (spu_create_inferior): Adjust code to access the environment information via 'gdb_environ' class.
2017-06-17linux-low: Remove usage of "register" keywordSimon Marchi1-0/+5
AFAIK, the register keyword is not relevant today, and clang complains about it: /home/emaisin/src/binutils-gdb/gdb/gdbserver/linux-low.c:5873:3: error: 'register' storage class specifier is deprecated and incompatible with C++1z [-Werror,-Wdeprecated-register] register PTRACE_XFER_TYPE *buffer; ^~~~~~~~~ I think we can safely remove it. gdb/gdbserver/ChangeLog: * linux-low.c (linux_read_memory, linux_write_memory): Remove usage of "register" keyword.
2017-06-17gdb: Add -Wno-mismatched-tagsSimon Marchi1-0/+4
clang complains that for some types, we use both the class and struct keywords in different places. It's not really a problem, so I think we can safely turn this warning off. gdb/ChangeLog: * configure: Re-generate. * warning.m4 (build_warnings): Add -Wno-mismatched-tags. gdb/gdbserver/ChangeLog: * configure: Re-generate.
2017-06-17gdb: Use -Werror when checking for (un)supported warning flagsSimon Marchi1-0/+4
In warning.m4, we pass all the warning flags one by one to the compiler to test if they are supported by this particular compiler. If the compiler exits with an error, we conclude that this warning flag is not supported and exclude it. This allows us to use warning flags without having to worry about which versions of which compilers support each flag. clang, by default, only emits a warning if an unknown flag is passed: warning: unknown warning option '-Wfoo' [-Wunknown-warning-option] The result is that we think that all the warning flags we use are supported by clang (they are not), and the compilation fails later when building with -Werror, since the aforementioned warning becomes an error. The fix is to also pass -Werror when probing for supported flags, then we'll correctly get an error when using an unknown warning, and we'll exclude it: error: unknown warning option '-Wfoo' [-Werror,-Wunknown-warning-option] I am not sure why there is a change in a random comment in gdbserver/configure, but I suppose it's a leftfover from a previous patch, so I included it. gdb/ChangeLog: * configure: Re-generate. * warning.m4: Pass -Werror to compiler when checking for supported warning flags. gdb/gdbserver/ChangeLog: * configure: Re-generate.
2017-06-17gdb: Pass -x c++ to the compilerSimon Marchi1-0/+4
Because we are compiling .c files containing C++ code, clang++ complains with: clang: error: treating 'c' input as 'c++' when in C++ mode, this behavior is deprecated If renaming all the source files to .cpp is out of the question, an alternative is to pass "-x c++" to convince the compiler that we are really compiling C++. It works fine with GCC too. gdb/ChangeLog: * Makefile.in (COMPILE.pre): Add "-x c++". gdb/gdbserver/ChangeLog: * Makefile.in (COMPILE.pre): Add "-x c++".
2017-06-09Include <signal.h> on gdbserver/fork-child.c (and fix regressions)Sergio Durigan Junior1-0/+4
Hi, This is another obvious patch that fixes a thinko from my previous startup-with-shell series. We should conditionally include <signal.h> on gdb/gdbserver/fork-child.c because gdbserver will be putting the inferior's terminal on the correct mode after the call to fork_inferior, and for that it needs to ignore SIGTTOU. This patch fixes a bunch of regressions happening on AArch64 that were reported by Yao. gdb/gdbserver/ChangeLog: 2017-06-09 Sergio Durigan Junior <sergiodj@redhat.com> * fork-child.c: Conditionally include <signal.h>.
2017-06-07Implement proper "startup-with-shell" support on gdbserverSergio Durigan Junior1-0/+12
This patch implements the proper support for the "startup-with-shell" feature on gdbserver. A new packet is added, QStartupWithShell, and it is sent on initialization. If the host sends a "QStartupWithShell:1", it means the inferior shall be started using a shell. If the host sends a "QStartupWithShell:0", it means the inferior shall be started without using a shell. Any other value is considered an error. There is no way to remotely set the shell that will be used by the target to start the inferior. In order to do that, the user must start gdbserver while providing a shell via the $SHELL environment variable. The same is true for the host side. The "set startup-with-shell" setting from the host side is used to decide whether to start the remote inferior using a shell. This same setting is also used to decide whether to use a shell to start the host inferior; this means that it is not really possible to start the inferior using different mechanisms on target and host. A documentation patch is included, along with a new testcase for the feature. gdb/ChangeLog: 2017-06-07 Sergio Durigan Junior <sergiodj@redhat.com> * NEWS (Changes since GDB 8.0): Announce that GDBserver is now able to start inferiors using a shell. (New remote packets): Announce new packet "QStartupWithShell". * remote.c: Add PACKET_QStartupWithShell. (extended_remote_create_inferior): Handle new PACKET_QStartupWithShell. (remote_protocol_features) <QStartupWithShell>: New entry for PACKET_QStartupWithShell. (_initialize_remote): Call "add_packet_config_cmd" for QStartupShell. gdb/gdbserver/ChangeLog: 2017-06-07 Sergio Durigan Junior <sergiodj@redhat.com> * server.c (handle_general_set): Handle new packet "QStartupWithShell". (handle_query): Add "QStartupWithShell" to the list of supported packets. (gdbserver_usage): Add help text explaining the new "--startup-with-shell" and "--no-startup-with-shell" CLI options. (captured_main): Recognize and act upon the presence of the new CLI options. gdb/testsuite/ChangeLog: 2017-06-07 Sergio Durigan Junior <sergiodj@redhat.com> * gdb.base/startup-with-shell.c: New file. * gdb.base/startup-with-shell.exp: Likewise. gdb/doc/ChangeLog: 2017-06-07 Sergio Durigan Junior <sergiodj@redhat.com> * gdb.texinfo (Starting) <startup-with-shell>: Add @anchor. (Connecting) <Remote Packet>: Add "startup-with-shell" and "QStartupWithShell" to the table. (Remote Protocol) <QStartupWithShell>: New item, explaining the packet.
2017-06-07Share fork_inferior et al with gdbserverSergio Durigan Junior1-0/+69
This is the most important (and the biggest, sorry) patch of the series. It moves fork_inferior from gdb/fork-child.c to nat/fork-inferior.c and makes all the necessary adjustments to both GDB and gdbserver to make sure everything works OK. There is no "most important change" with this patch; all changes are made in a progressive way, making sure that gdbserver had the necessary features while not breaking GDB at the same time. I decided to go ahead and implement a partial support for starting the inferior with a shell on gdbserver, although the full feature comes in the next patch. The user won't have the option to disable the startup-with-shell, and also won't be able to change which shell gdbserver will use (other than setting the $SHELL environment variable, that is). Everything is working as expected, and no regressions were present during the tests. gdb/ChangeLog: 2017-06-07 Sergio Durigan Junior <sergiodj@redhat.com> Pedro Alves <palves@redhat.com> * Makefile.in (HFILES_NO_SRCDIR): Add "common/common-inferior.h" and "nat/fork-inferior.h". * common/common-inferior.h: New file, with contents from "gdb/inferior.h". * commom/common-utils.c: Include "common-utils.h". (stringify_argv): New function. * common/common-utils.h (stringify_argv): New prototype. * configure.nat: Add "fork-inferior.o" as a dependency for "*linux*", "fbsd*" and "nbsd*" hosts. * corefile.c (get_exec_file): Update comment. * darwin-nat.c (darwin_ptrace_him): Call "gdb_startup_inferior" instead of "startup_inferior". (darwin_create_inferior): Call "add_thread_silent" after "fork_inferior". * fork-child.c: Cleanup unnecessary includes. (SHELL_FILE): Move to "common/common-fork-child.c". (environ): Likewise. (exec_wrapper): Initialize. (get_exec_wrapper): New function. (breakup_args): Move to "common/common-fork-child.c"; rename to "breakup_args_for_exec". (escape_bang_in_quoted_argument): Move to "common/common-fork-child.c". (saved_ui): New variable. (prefork_hook): New function. (postfork_hook): Likewise. (postfork_child_hook): Likewise. (gdb_startup_inferior): Likewise. (fork_inferior): Move to "common/common-fork-child.c". Update function to support gdbserver. (startup_inferior): Likewise. * gdbcore.h (get_exec_file): Remove declaration. * gnu-nat.c (gnu_create_inferior): Call "gdb_startup_inferior" instead of "startup_inferior". Call "add_thread_silent" after "fork_inferior". * inf-ptrace.c: Include "nat/fork-inferior.h" and "utils.h". (inf_ptrace_create_inferior): Call "gdb_startup_inferior" instead of "startup_inferior". Call "add_thread_silent" after "fork_inferior". * inferior.h: Include "common-inferior.h". (trace_start_error): Move to "common/common-utils.h". (trace_start_error_with_name): Likewise. (fork_inferior): Move prototype to "nat/fork-inferior.h". (startup_inferior): Likewise. (gdb_startup_inferior): New prototype. * nat/fork-inferior.c: New file, with contents from "fork-child.c". * nat/fork-inferior.h: New file. * procfs.c (procfs_init_inferior): Call "gdb_startup_inferior" instead of "startup_inferior". Call "add_thread_silent" after "fork_inferior". * target.h (target_terminal_init): Move prototype to "target/target.h". (target_terminal_inferior): Likewise. (target_terminal_ours): Likewise. * target/target.h (target_terminal_init): New prototype, moved from "target.h". (target_terminal_inferior): Likewise. (target_terminal_ours): Likewise. * utils.c (gdb_flush_out_err): New function. gdb/gdbserver/ChangeLog: 2017-06-07 Sergio Durigan Junior <sergiodj@redhat.com> Pedro Alves <palves@redhat.com> * Makefile.in (SFILES): Add "nat/fork-inferior.o". * configure: Regenerate. * configure.srv (srv_linux_obj): Add "fork-child.o" and "fork-inferior.o". (i[34567]86-*-lynxos*): Likewise. (spu*-*-*): Likewise. * fork-child.c: New file. * linux-low.c: Include "common-inferior.h", "nat/fork-inferior.h" and "environ.h". (linux_ptrace_fun): New function. (linux_create_inferior): Adjust function prototype to reflect change on "target.h". Adjust function code to use "fork_inferior". (linux_request_interrupt): Delete "signal_pid". * lynx-low.c: Include "common-inferior.h" and "nat/fork-inferior.h". (lynx_ptrace_fun): New function. (lynx_create_inferior): Adjust function prototype to reflect change on "target.h". Adjust function code to use "fork_inferior". * nto-low.c (nto_create_inferior): Adjust function prototype and code to reflect change on "target.h". Update comments. * server.c: Include "common-inferior.h", "nat/fork-inferior.h", "common-terminal.h" and "environ.h". (terminal_fd): Moved to fork-child.c. (old_foreground_pgrp): Likewise. (restore_old_foreground_pgrp): Likewise. (last_status): Make it global. (last_ptid): Likewise. (our_environ): New variable. (startup_with_shell): Likewise. (program_name): Likewise. (program_argv): Rename to... (program_args): ...this. (wrapper_argv): New variable. (start_inferior): Delete function. (get_exec_wrapper): New function. (get_exec_file): Likewise. (get_environ): Likewise. (prefork_hook): Likewise. (post_fork_inferior): Likewise. (postfork_hook): Likewise. (postfork_child_hook): Likewise. (handle_v_run): Update code to deal with arguments coming from the remote host. Update calls from "start_inferior" to "create_inferior". (captured_main): Likewise. Initialize environment variable. Call "have_job_control". * server.h (post_fork_inferior): New prototype. (get_environ): Likewise. (last_status): Declare. (last_ptid): Likewise. (signal_pid): Likewise. * spu-low.c: Include "common-inferior.h" and "nat/fork-inferior.h". (spu_ptrace_fun): New function. (spu_create_inferior): Adjust function prototype to reflect change on "target.h". Adjust function code to use "fork_inferior". * target.c (target_terminal_init): New function. (target_terminal_inferior): Likewise. (target_terminal_ours): Likewise. * target.h: Include <vector>. (struct target_ops) <create_inferior>: Update prototype. (create_inferior): Update macro. * utils.c (gdb_flush_out_err): New function. * win32-low.c (win32_create_inferior): Adjust function prototype and code to reflect change on "target.h". gdb/testsuite/ChangeLog: 2017-06-07 Sergio Durigan Junior <sergiodj@redhat.com> * gdb.server/non-existing-program.exp: Update regex in order to reflect the fact that gdbserver is now using fork_inferior (with a shell) to startup the inferior.
2017-06-07Share parts of gdb/gdbthread.h with gdbserverSergio Durigan Junior1-0/+4
GDB and gdbserver now share 'switch_to_thread' because of fork_inferior. To make things clear, I created a new file name common/common-gdbthread.h, and left the implementation specific to each part. gdb/ChangeLog: 2017-06-07 Sergio Durigan Junior <sergiodj@redhat.com> * Makefile.in (HFILES_NO_SRCDIR): Add "common/common-gdbthread.h". * common/common-gdbthread.h: New file, with parts from "gdb/gdbthread.h". * gdbthread.h: Include "common-gdbthread.h". (switch_to_thread): Moved to "common/common-gdbthread.h". gdb/gdbserver/ChangeLog: 2017-06-07 Sergio Durigan Junior <sergiodj@redhat.com> * inferiors.c (switch_to_thread): New function.
2017-06-07Move parts of inferior job control to common/Sergio Durigan Junior1-0/+5
This commit moves a few bits responsible for dealing with inferior job control from GDB to common/, which makes them available to gdbserver. This is necessary for the upcoming patches that will share fork_inferior et al between GDB and gdbserver. We move some parts of gdb/terminal.h to gdb/common/common-terminal.h, especifically the code that checks terminal features and that are used to set job_control accordingly. After sharing parts of gdb/terminal.h, we also to share the two functions on gdb/inflow.c that are going to be needed by the fork_inferior rework. They are 'gdb_setpgid' and the new 'have_job_control'. I've also taken the opportunity to give a more meaningful name to "inflow.c" on common/. Now it is called "job-control.c" (thanks Pedro for the suggestion). gdb/ChangeLog: 2017-06-07 Sergio Durigan Junior <sergiodj@redhat.com> * Makefile.in (SFILES): Add "common/job-control.c". (HFILES_NO_SRCDIR): Add "common/job-control.h". (COMMON_OBS): Add "job-control.o". * common/job-control.c: New file, with contents from "gdb/inflow.c". * common/job-control.h: New file, with contents from "terminal.h". * fork-child.c: Include "job-control.h". * inflow.c: Include "job-control.h". (gdb_setpgid): Move to "common/common-inflow.c". (_initialize_inflow): Move setting of "job_control" to "handle_job_control". * terminal.h (job_control): Moved to "common/common-terminal.h". (gdb_setpgid): Likewise. * top.c: Include "job_control.h". * utils.c: Likewise. (job_control): Moved to "job-control.c". gdb/gdbserver/ChangeLog: 2017-06-07 Sergio Durigan Junior <sergiodj@redhat.com> * Makefile.in (SFILE): Add "common/job-control.c". (OBS): Add "job-control.o".
2017-05-06Introduce "gdb/configure.nat" (and delete "gdb/config/*/*.mh" files)Sergio Durigan Junior1-0/+4
Due to my ongoing work to make it possible for gdbserver to start the inferior using the shell, I had to share the fork_inferior function under the "nat/" directory. In order to do that, I created a new file and put the function there; however, this meant that I now had to update some of the *.mh files (under "gdb/config") and add the new file as a dependency to be built natively. Bleh... After talking a bit to Pedro about this, the idea came up to write a new "gdb/configure.nat" file, a la "gdb/configure.tgt", which would concentrate all of the native settings for each host/system. I decided to tackle this issue. The patch is simple. All of the previous Makefile variables that were being declared inside the *.mh files are now inside "gdb/Makefile.in", and "gdb/configure" is responsible for AC_SUBST'ing them. The definitions of these variables were put inside "gdb/configure.nat", so now they're shell variables. For excerpts of Makefile code, one must create a file under "gdb/config/${gdb_cpu_host}" and reference it on the "nat_extra_makefile_frag" variable. It should now be easier to update the native dependencies of hosts in this single file. This has been tested on x86_64 without regressions. gdb/ChangeLog: 2017-05-06 Sergio Durigan Junior <sergiodj@redhat.com> * Makefile.in: Remove "@host_makefile_frag@". Add variables NAT_FILE, NATDEPFILES, NAT_CDEPS, LOADLIBES, MH_CFLAGS, XM_CLIBS, NAT_GENERATED_FILES, HAVE_NATIVE_GCORE_HOST. Add "@nat_extra_makefile_frag@". (Makefile): Remove dependency on "@frags@". ($(GNULIB_BUILDDIR)/Makefile): Likewise. (data-directory/Makefile): Likewise. * config/aarch64/linux.mh: Deleted; moved contents to "gdb/configure.nat". * config/alpha/alpha-linux.mh: Likewise. * config/alpha/nbsd.mh: Likewise. * config/arm/linux.mh: Likewise. * config/arm/nbsdelf.mh: Likewise. * config/i386/cygwin.mh: Likewise. * config/i386/cygwin64.mh: Likewise. * config/i386/darwin.mh: Likewise. * config/i386/fbsd.mh: Likewise. * config/i386/fbsd64.mh: Likewise. * config/i386/go32.mh: Likewise. * config/i386/i386gnu.mh: Likewise. * config/i386/i386sol2.mh: Likewise. * config/i386/linux.mh: Likewise. * config/i386/linux64.mh: Likewise. * config/i386/mingw.mh: Likewise. * config/i386/mingw64.mh: Likewise. * config/i386/nbsd64.mh: Likewise. * config/i386/nbsdelf.mh: Likewise. * config/i386/nto.mh: Likewise. * config/i386/obsd.mh: Likewise. * config/i386/obsd64.mh: Likewise. * config/i386/sol2-64.mh: Likewise. * config/ia64/linux.mh: Likewise. * config/m32r/linux.mh: Likewise. * config/m68k/linux.mh: Likewise. * config/m68k/nbsdelf.mh: Likewise. * config/m68k/obsd.mh: Likewise. * config/m88k/obsd.mh: Likewise. * config/mips/fbsd.mh: Likewise. * config/mips/linux.mh: Likewise. * config/mips/nbsd.mh: Likewise. * config/mips/obsd64.mh: Likewise. * config/pa/linux.mh: Likewise. * config/pa/nbsd.mh: Likewise. * config/pa/obsd.mh: Likewise. * config/powerpc/aix.mh: Likewise. * config/powerpc/fbsd.mh: Likewise. * config/powerpc/linux.mh: Likewise. * config/powerpc/nbsd.mh: Likewise. * config/powerpc/obsd.mh: Likewise. * config/powerpc/ppc64-linux.mh: Likewise. * config/powerpc/spu-linux.mh: Likewise. * config/s390/linux.mh: Likewise. * config/sh/nbsd.mh: Likewise. * config/sparc/fbsd.mh: Likewise. * config/sparc/linux.mh: Likewise. * config/sparc/linux64.mh: Likewise. * config/sparc/nbsd64.mh: Likewise. * config/sparc/nbsdelf.mh: Likewise. * config/sparc/obsd64.mh: Likewise. * config/sparc/sol2.mh: Likewise. * config/tilegx/linux.mh: Likewise. * config/vax/nbsdelf.mh: Likewise. * config/vax/obsd.mh: Likewise. * config/xtensa/linux.mh: Likewise. * config/i386/i386gnu.mn: New file, with excerpts from "config/i386/i386gnu.mh". * configure: Regenerate. * configure.ac: Rewrite code to use "gdb/configure.nat" instead of *.mh files under "gdb/config". * configure.nat: New file, with contents from the "gdb/config/*/*.mh" files. gdb/doc/ChangeLog: 2017-05-06 Sergio Durigan Junior <sergiodj@redhat.com> * Makefile: Remove "@host_makefile_frag@".
2017-05-05gdb: Disable -Werror for -Wmaybe-uninitializedPedro Alves1-0/+4
Newer GCCs are triggering false-positive -Wmaybe-uninitialized warnings around code that uses gdb::optional: https://sourceware.org/ml/gdb-patches/2017-05/msg00118.html Using std::optional wouldn't help, it triggers the same warnings: https://gcc.gnu.org/bugzilla/show_bug.cgi?id=80635 Initializing the variables to quiet the warning would defeat the purpose of gdb::optional. Making the optional ctor memset its storage would be a pessimization. Wrapping gdb::optional's internals with "#pragma GCC diagnostic push/ignored/pop" doesn't work, we'd have to wrap uses of gdb::optional instead, which I think would get unwieldy and ugly as we start using gdb::optional more and more. The -Wmaybe-uninitialized warning is documented as producing false positives (unlike -Wuninialized), so until we find a better workaround, disable -Werror for this warning. You'll still see the warning when building gdb, but it won't cause a build failure. Tested by building with gcc 4.8.5, 5.3.1, and gcc trunk (20170428). gdb/ChangeLog: 2017-05-05 Pedro Alves <palves@redhat.com> * warning.m4 (build_warnings): Add -Wno-error=maybe-uninitialized. * configure: Regenerate. gdb/gdbserver/ChangeLog: 2017-05-05 Pedro Alves <palves@redhat.com> * configure: Regenerate.
2017-05-03Regenerate gdb/{,gdbserver/}configure (for commit ↵Sergio Durigan Junior1-0/+4
be628ab814f1c90e185d7482d27aa8a991ab5837) On commit be628ab814f1c90e185d7482d27aa8a991ab5837, both common/common.m4 was modified in order to check for the presence of 'termios.h', 'termio.h' and 'sgtty.h'. However, I forgot to regenerate both gdb/configure and gdb/gdbserver/configure. This commit does that. gdb/ChangeLog: 2017-05-03 Sergio Durigan Junior <sergiodj@redhat.com> * configure: Regenerate. gdb/gdbserver/ChangeLog: 2017-05-03 Sergio Durigan Junior <sergiodj@redhat.com> * configure: Regenerate.
2017-05-02Change return type of gdbarch_software_single_step to vector<CORE_ADDR>Simon Marchi1-0/+10
This is a relatively straightforward patch that changes gdbarch_software_single_step so it returns an std::vector<CORE_ADDR> instead of a VEC (CORE_ADDR). gdb/ChangeLog: * gdbarch.sh (software_single_step): Change return type to std::vector<CORE_ADDR>. * gdbarch.c, gdbarch.h: Re-generate. * arch/arm-get-next-pcs.c (thumb_deal_with_atomic_sequence_raw): Adjust. (arm_deal_with_atomic_sequence_raw): Adjust. (thumb_get_next_pcs_raw): Adjust. (arm_get_next_pcs_raw): Adjust. (arm_get_next_pcs): Adjust. * arch/arm-get-next-pcs.h (arm_get_next_pcs): Adjust. * aarch64-tdep.c (aarch64_software_single_step): Adjust. * alpha-tdep.c (alpha_deal_with_atomic_sequence): Adjust. (alpha_software_single_step): Adjust. * alpha-tdep.h (alpha_software_single_step): Adjust. * arm-linux-tdep.c (arm_linux_software_single_step): Adjust. * arm-tdep.c (arm_software_single_step): Adjust. (arm_breakpoint_kind_from_current_state): Adjust. * arm-tdep.h (arm_software_single_step): Adjust. * breakpoint.c (insert_single_step_breakpoint): Adjust. * cris-tdep.c (cris_software_single_step): Adjust. * mips-tdep.c (mips_deal_with_atomic_sequence): Adjust. (micromips_deal_with_atomic_sequence): Adjust. (deal_with_atomic_sequence): Adjust. (mips_software_single_step): Adjust. * mips-tdep.h (mips_software_single_step): Adjust. * moxie-tdep.c (moxie_software_single_step): Adjust. * nios2-tdep.c (nios2_software_single_step): Adjust. * ppc-tdep.h (ppc_deal_with_atomic_sequence): Adjust. * rs6000-aix-tdep.c (rs6000_software_single_step): Adjust. * rs6000-tdep.c (ppc_deal_with_atomic_sequence): Adjust. * s390-linux-tdep.c (s390_software_single_step): Adjust. * sparc-tdep.c (sparc_software_single_step): Adjust. * spu-tdep.c (spu_software_single_step): Adjust. * tic6x-tdep.c (tic6x_software_single_step): Adjust. gdb/gdbserver/ChangeLog: * linux-arm-low.c (arm_gdbserver_get_next_pcs): Adjust to software_single_step change of return type to std::vector<CORE_ADDR>. * linux-low.c (install_software_single_step_breakpoints): Likewise. * linux-low.h (install_software_single_step_breakpoints): Likewise.
2017-04-12Create gdb_termios.h (and cleanup gdb/{,gdbserver/}terminal.h)Sergio Durigan Junior1-0/+6
As requested, I'm sending this as a separate patch because it is ready to be included as-is. The idea here is that both gdb/terminal.h and gdb/gdbserver/terminal.h share the same code, which is responsible for setting a bunch of defines on based on the presence of termios.h and a few other headers. This simple patch just moves this common code to common/gdb_termios.h and makes the necessary adjustments on both GDB and gdbserver so that they can use this new header. It also implements the some header checks on common/common.m4. As a bonus, gdb/gdbserver/terminal.h can be removed because it's now empty. Built on x86_64, no regressions found. gdb/ChangeLog: 2017-04-12 Sergio Durigan Junior <sergiodj@redhat.com> * Makefile.in (HFILES_NO_SRCDIR): Add "common/gdb_termios.h". * common/common.m4: Check headers 'termios.h', 'termio.h' and 'sgtty.h'. * common/gdb_termios.h: New file, with parts of "terminal.h". * inflow.c: Include "gdb_termios.h". * ser-unix.c: Include "gdb_termios.h". * terminal.h: Move terminal-related defines to "common/gdb_termios.h". gdb/gdbserver/ChangeLog: 2017-04-12 Sergio Durigan Junior <sergiodj@redhat.com> * remote-utils.c: Include "gdb_termios.h" instead of "terminal.h". * terminal.h: Delete file.
2017-04-12C++-fy and prepare for sharing fork_inferiorSergio Durigan Junior1-0/+9
As a preparation for the next patch, which will move fork_inferior from GDB to common/ (and therefore share it with gdbserver), it is interesting to convert a few functions to C++. This patch touches functions related to parsing command-line arguments to the inferior (see gdb/fork-child.c:breakup_args), the way the arguments are stored on fork_inferior (using std::vector instead of char **), and the code responsible for dealing with argv also on gdbserver. I've taken this opportunity and decided to constify a few arguments to fork_inferior/create_inferior as well, in order to make the code cleaner. And now, on gdbserver, we're using xstrdup everywhere and aren't checking for memory allocation failures anymore, as requested by Pedro: <https://sourceware.org/ml/gdb-patches/2017-03/msg00191.html> Message-Id: <025ebdb9-90d9-d54a-c055-57ed2406b812@redhat.com> Pedro Alves wrote: > On the "== NULL" check: IIUC, the old NULL check was there to > handle strdup returning NULL due to out-of-memory. > See NULL checks and comments further above in this function. > Now that you're using a std::vector, that doesn't work or make > sense any longer, since if push_back fails to allocate space for > its internal buffer (with operator new), our operator new replacement > (common/new-op.c) calls malloc_failure, which aborts gdbserver. > > Not sure it makes sense to handle out-of-memory specially in > the gdb/rsp-facing functions nowadays (maybe git blame/log/patch > submission for that code shows some guidelines). Maybe (or, probably) > it's OK to stop caring about it, but then we should consistently remove > left over code, by using xstrdup instead and remove the NULL checks. IMO this refactoring was very good to increase the readability of the code as well, because some parts of the argument handling were unnecessarily confusing before. gdb/ChangeLog: 2017-04-12 Sergio Durigan Junior <sergiodj@redhat.com> * common/common-utils.c (free_vector_argv): New function. * common/common-utils.h: Include <vector>. (free_vector_argv): New prototype. * darwin-nat.c (darwin_create_inferior): Rewrite function prototype in order to constify "exec_file" and accept a "std::string" for "allargs". * fork-child.c: Include <vector>. (breakup_args): Rewrite function, using C++. (fork_inferior): Rewrite function header, constify "exec_file_arg" and accept "std::string" for "allargs". Update the code to calculate "argv" based on "allargs". Update calls to "exec_fun" and "execvp". * gnu-nat.c (gnu_create_inferior): Rewrite function prototype in order to constify "exec_file" and accept a "std::string" for "allargs". * go32-nat.c (go32_create_inferior): Likewise. * inf-ptrace.c (inf_ptrace_create_inferior): Likewise. * infcmd.c (run_command_1): Constify "exec_file". Use "std::string" for inferior arguments. * inferior.h (fork_inferior): Update prototype. * linux-nat.c (linux_nat_create_inferior): Rewrite function prototype in order to constify "exec_file" and accept a "std::string" for "allargs". * nto-procfs.c (procfs_create_inferior): Likewise. * procfs.c (procfs_create_inferior): Likewise. * remote-sim.c (gdbsim_create_inferior): Likewise. * remote.c (extended_remote_run): Update code to accept "std::string" as argument. (extended_remote_create_inferior): Rewrite function prototype in order to constify "exec_file" and accept a "std::string" for "allargs". * rs6000-nat.c (super_create_inferior): Likewise. (rs6000_create_inferior): Likewise. * target.h (struct target_ops) <to_create_inferior>: Likewise. * windows-nat.c (windows_create_inferior): Likewise. gdb/gdbserver/ChangeLog: 2017-04-12 Sergio Durigan Junior <sergiodj@redhat.com> * server.c: Include <vector>. <program_argv, wrapper_argv>: Convert to std::vector. (start_inferior): Rewrite function to use C++. (handle_v_run): Likewise. Update code that calculates the argv based on the vRun packet; use C++. (captured_main): Likewise.
2017-04-06Class-ify ptid_tSimon Marchi1-0/+5
I grew a bit tired of using ptid_get_{lwp,pid,tid} and friends, so I decided to make it a bit easier to use by making it a proper class. The fields are now private, so it's not possible to change a ptid_t field by mistake. The new methods of ptid_t map to existing functions/practice like this: ptid_t (pid, lwp, tid) -> ptid_build (pid, lwp, tid) ptid_t (pid) -> pid_to_ptid (pid) ptid.is_pid () -> ptid_is_pid (ptid) ptid == other -> ptid_equal (ptid, other) ptid != other -> !ptid_equal (ptid, other) ptid.pid () -> ptid_get_pid (ptid) ptid.lwp_p () -> ptid_lwp_p (ptid) ptid.lwp () -> ptid_get_lwp (ptid) ptid.tid_p () -> ptid_tid_p (ptid) ptid.tid () -> ptid_get_tid (ptid) ptid.matches (filter) -> ptid_match (ptid, filter) I've replaced the implementation of the existing functions with calls to the new methods. People are encouraged to gradually switch to using the ptid_t methods instead of the functions (or we can change them all in one pass eventually). Also, I'm not sure if it's worth it (because of ptid_t's relatively small size), but I have made the functions and methods take ptid_t arguments by const reference instead of by value. gdb/ChangeLog: * common/ptid.h (struct ptid): Change to... (class ptid_t): ... this. <ptid_t>: New constructors. <pid, lwp_p, lwp, tid_p, tid, is_pid, operator==, operator!=, matches>: New methods. <make_null, make_minus_one>: New static methods. <pid>: Rename to... <m_pid>: ...this. <lwp>: Rename to... <m_lwp>: ...this. <tid>: Rename to... <m_tid>: ...this. (ptid_build, ptid_get_pid, ptid_get_lwp, ptid_get_tid, ptid_equal, ptid_is_pid, ptid_lwp_p, ptid_tid_p, ptid_match): Take ptid arguments as references, move comment to class ptid_t. * common/ptid.c (null_ptid, minus_one_ptid): Initialize with ptid_t static methods. (ptid_build, pid_to_ptid, ptid_get_pid, ptid_get_tid, ptid_equal, ptid_is_pid, ptid_lwp_p, ptid_tid_p, ptid_match): Take ptid arguments as references, implement using ptid_t methods. * unittests/ptid-selftests.c: New file. * Makefile.in (SUBDIR_UNITTESTS_SRCS): Add unittests/ptid-selftests.c. (SUBDIR_UNITTESTS_OBS): Add unittests/ptid-selftests.o. gdb/gdbserver/ChangeLog: * server.c (handle_v_cont): Initialize thread_resume::thread with null_ptid.
2017-04-05-Wwrite-strings: Remove -Wno-write-stringsPedro Alves1-0/+4
AFAIK GDB is now free from -Wwrite-strings warnings. A few warnings may be left behind in some host-specific code, but those should be few and easy to fix. gdb/ChangeLog: 2017-04-05 Pedro Alves <palves@redhat.com> * warning.m4 (build_warnings): Remove -Wno-write-strings. * configure: Regenerate. gdb/gdbserver/ChangeLog: 2017-04-05 Pedro Alves <palves@redhat.com> * configure: Regenerate.
2017-04-05-Wwrite-strings: The RestPedro Alves1-0/+5
This is the remainder boring constification that all looks more of less borderline obvious IMO. gdb/ChangeLog: 2017-04-05 Pedro Alves <palves@redhat.com> * ada-exp.y (yyerror): Constify. * ada-lang.c (bound_name, get_selections) (ada_variant_discrim_type) (ada_variant_discrim_name, ada_value_struct_elt) (ada_lookup_struct_elt_type, is_unchecked_variant) (ada_which_variant_applies, standard_exc, ada_get_next_arg) (catch_ada_exception_command_split) (catch_ada_assert_command_split, catch_assert_command) (ada_op_name): Constify. * ada-lang.h (ada_yyerror, get_selections) (ada_variant_discrim_name, ada_value_struct_elt): Constify. * arc-tdep.c (arc_print_frame_cache): Constify. * arm-tdep.c (arm_skip_stub): Constify. * ax-gdb.c (gen_binop, gen_struct_ref_recursive, gen_struct_ref) (gen_aggregate_elt_ref): Constify. * bcache.c (print_bcache_statistics): Constify. * bcache.h (print_bcache_statistics): Constify. * break-catch-throw.c (catch_exception_command_1): * breakpoint.c (struct ep_type_description::description): Constify. (add_solib_catchpoint): Constify. (catch_fork_command_1): Add cast. (add_catch_command): Constify. * breakpoint.h (add_catch_command, add_solib_catchpoint): Constify. * bsd-uthread.c (bsd_uthread_state): Constify. * buildsym.c (patch_subfile_names): Constify. * buildsym.h (next_symbol_text_func, patch_subfile_names): Constify. * c-exp.y (yyerror): Constify. (token::oper): Constify. * c-lang.h (c_yyerror, cp_print_class_member): Constify. * c-varobj.c (cplus_describe_child): Constify. * charset.c (find_charset_names): Add cast. (find_charset_names): Constify array and add const_cast. * cli/cli-cmds.c (complete_command, cd_command): Constify. (edit_command): Constify. * cli/cli-decode.c (lookup_cmd): Constify. * cli/cli-dump.c (dump_memory_command, dump_value_command): Constify. (struct dump_context): Constify. (add_dump_command, restore_command): Constify. * cli/cli-script.c (get_command_line): Constify. * cli/cli-script.h (get_command_line): Constify. * cli/cli-utils.c (check_for_argument): Constify. * cli/cli-utils.h (check_for_argument): Constify. * coff-pe-read.c (struct read_pe_section_data): Constify. * command.h (lookup_cmd): Constify. * common/print-utils.c (decimal2str): Constify. * completer.c (gdb_print_filename): Constify. * corefile.c (set_gnutarget): Constify. * cp-name-parser.y (yyerror): Constify. * cp-valprint.c (cp_print_class_member): Constify. * cris-tdep.c (cris_register_name, crisv32_register_name): Constify. * d-exp.y (yyerror): Constify. (struct token::oper): Constify. * d-lang.h (d_yyerror): Constify. * dbxread.c (struct header_file_location::name): Constify. (add_old_header_file, add_new_header_file, last_function_name) (dbx_next_symbol_text, add_bincl_to_list) (find_corresponding_bincl_psymtab, set_namestring) (find_stab_function_addr, read_dbx_symtab, start_psymtab) (dbx_end_psymtab, read_ofile_symtab, process_one_symbol): * defs.h (command_line_input, print_address_symbolic) (deprecated_readline_begin_hook): Constify. * dwarf2read.c (anonymous_struct_prefix, dwarf_bool_name): Constify. * event-top.c (handle_line_of_input): Constify and add cast. * exceptions.c (catch_errors): Constify. * exceptions.h (catch_errors): Constify. * expprint.c (print_subexp_standard, op_string, op_name) (op_name_standard, dump_raw_expression, dump_raw_expression): * expression.h (op_name, op_string, dump_raw_expression): Constify. * f-exp.y (yyerror): Constify. (struct token::oper): Constify. (struct f77_boolean_val::name): Constify. * f-lang.c (f_word_break_characters): Constify. * f-lang.h (f_yyerror): Constify. * fork-child.c (fork_inferior): Add cast. * frv-tdep.c (struct gdbarch_tdep::register_names): Constify. (new_variant): Constify. * gdbarch.sh (pstring_ptr, pstring_list): Constify. * gdbarch.c: Regenerate. * gdbcore.h (set_gnutarget): Constify. * go-exp.y (yyerror): Constify. (token::oper): Constify. * go-lang.h (go_yyerror): Constify. * go32-nat.c (go32_sysinfo): Constify. * guile/scm-breakpoint.c (gdbscm_breakpoint_expression): Constify. * guile/scm-cmd.c (cmdscm_function): Constify. * guile/scm-param.c (pascm_param_value): Constify. * h8300-tdep.c (h8300_register_name, h8300s_register_name) (h8300sx_register_name): Constify. * hppa-tdep.c (hppa32_register_name, hppa64_register_name): Constify. * ia64-tdep.c (ia64_register_names): Constify. * infcmd.c (construct_inferior_arguments): Constify. (path_command, attach_post_wait): Constify. * language.c (show_range_command, show_case_command) (unk_lang_error): Constify. * language.h (language_defn::la_error) (language_defn::la_name_of_this): Constify. * linespec.c (decode_line_2): Constify. * linux-thread-db.c (thread_db_err_str): Constify. * lm32-tdep.c (lm32_register_name): Constify. * m2-exp.y (yyerror): Constify. * m2-lang.h (m2_yyerror): Constify. * m32r-tdep.c (m32r_register_names): Constify and make static. * m68hc11-tdep.c (m68hc11_register_names): Constify. * m88k-tdep.c (m88k_register_name): Constify. * macroexp.c (appendmem): Constify. * mdebugread.c (fdr_name, add_data_symbol, parse_type) (upgrade_type, parse_external, parse_partial_symbols) (mdebug_next_symbol_text, cross_ref, mylookup_symbol, new_psymtab) (new_symbol): Constify. * memattr.c (mem_info_command): Constify. * mep-tdep.c (register_name_from_keyword): Constify. * mi/mi-cmd-env.c (mi_cmd_env_path, _initialize_mi_cmd_env): Constify. * mi/mi-cmd-stack.c (list_args_or_locals): Constify. * mi/mi-cmd-var.c (mi_cmd_var_show_attributes): Constify. * mi/mi-main.c (captured_mi_execute_command): Constify and add cast. (mi_execute_async_cli_command): Constify. * mips-tdep.c (mips_register_name): Constify. * mn10300-tdep.c (register_name, mn10300_generic_register_name) (am33_register_name, am33_2_register_name) * moxie-tdep.c (moxie_register_names): Constify. * nat/linux-osdata.c (osdata_type): Constify fields. * nto-tdep.c (nto_parse_redirection): Constify. * objc-lang.c (lookup_struct_typedef, lookup_objc_class) (lookup_child_selector): Constify. (objc_methcall::name): Constify. * objc-lang.h (lookup_objc_class, lookup_child_selector) (lookup_struct_typedef): Constify. * objfiles.c (pc_in_section): Constify. * objfiles.h (pc_in_section): Constify. * p-exp.y (struct token::oper): Constify. (yyerror): Constify. * p-lang.h (pascal_yyerror): Constify. * parser-defs.h (op_name_standard): Constify. (op_print::string): Constify. (exp_descriptor::op_name): Constify. * printcmd.c (print_address_symbolic): Constify. * psymtab.c (print_partial_symbols): Constify. * python/py-breakpoint.c (stop_func): Constify. (bppy_get_expression): Constify. * python/py-cmd.c (cmdpy_completer::name): Constify. (cmdpy_function): Constify. * python/py-event.c (evpy_add_attribute) (gdbpy_initialize_event_generic): Constify. * python/py-event.h (evpy_add_attribute) (gdbpy_initialize_event_generic): Constify. * python/py-evts.c (add_new_registry): Constify. * python/py-finishbreakpoint.c (outofscope_func): Constify. * python/py-framefilter.c (get_py_iter_from_func): Constify. * python/py-inferior.c (get_buffer): Add cast. * python/py-param.c (parm_constant::name): Constify. * python/py-unwind.c (fprint_frame_id): Constify. * python/python.c (gdbpy_parameter_value): Constify. * remote-fileio.c (remote_fio_func_map): Make 'name' const. * remote.c (memory_packet_config::name): Constify. (show_packet_config_cmd, remote_write_bytes) (remote_buffer_add_string): * reverse.c (exec_reverse_once): Constify. * rs6000-tdep.c (variant::name, variant::description): Constify. * rust-exp.y (rustyyerror): Constify. * rust-lang.c (rust_op_name): Constify. * rust-lang.h (rustyyerror): Constify. * serial.h (serial_ops::name): Constify. * sh-tdep.c (sh_sh_register_name, sh_sh3_register_name) (sh_sh3e_register_name, sh_sh2e_register_name) (sh_sh2a_register_name, sh_sh2a_nofpu_register_name) (sh_sh_dsp_register_name, sh_sh3_dsp_register_name) (sh_sh4_register_name, sh_sh4_nofpu_register_name) (sh_sh4al_dsp_register_name): Constify. * sh64-tdep.c (sh64_register_name): Constify. * solib-darwin.c (lookup_symbol_from_bfd): Constify. * spu-tdep.c (spu_register_name, info_spu_dma_cmdlist): Constify. * stabsread.c (patch_block_stabs, read_type_number) (ref_map::stabs, ref_add, process_reference) (symbol_reference_defined, define_symbol, define_symbol) (error_type, read_type, read_member_functions, read_cpp_abbrev) (read_one_struct_field, read_struct_fields, read_baseclasses) (read_tilde_fields, read_struct_type, read_array_type) (read_enum_type, read_sun_builtin_type, read_sun_floating_type) (read_huge_number, read_range_type, read_args, common_block_start) (find_name_end): Constify. * stabsread.h (common_block_start, define_symbol) (process_one_symbol, symbol_reference_defined, ref_add): * symfile.c (get_section_index, add_symbol_file_command): * symfile.h (get_section_index): Constify. * target-descriptions.c (tdesc_type::name): Constify. (tdesc_free_type): Add cast. * target.c (find_default_run_target): (add_deprecated_target_alias, find_default_run_target) (target_announce_detach): Constify. (do_option): Constify. * target.h (add_deprecated_target_alias): Constify. * thread.c (print_thread_info_1): Constify. * top.c (deprecated_readline_begin_hook, command_line_input): Constify. (init_main): Add casts. * top.h (handle_line_of_input): Constify. * tracefile-tfile.c (tfile_write_uploaded_tsv): Constify. * tracepoint.c (tvariables_info_1, trace_status_mi): Constify. (tfind_command): Rename to ... (tfind_command_1): ... this and constify. (tfind_command): New function. (tfind_end_command, tfind_start_command): Adjust. (encode_source_string): Constify. * tracepoint.h (encode_source_string): Constify. * tui/tui-data.c (tui_partial_win_by_name): Constify. * tui/tui-data.h (tui_partial_win_by_name): Constify. * tui/tui-source.c (tui_set_source_content_nil): Constify. * tui/tui-source.h (tui_set_source_content_nil): Constify. * tui/tui-win.c (parse_scrolling_args): Constify. * tui/tui-windata.c (tui_erase_data_content): Constify. * tui/tui-windata.h (tui_erase_data_content): Constify. * tui/tui-winsource.c (tui_erase_source_content): Constify. * tui/tui.c (tui_enable): Add cast. * utils.c (defaulted_query): Constify. (init_page_info): Add cast. (puts_debug, subset_compare): Constify. * utils.h (subset_compare): Constify. * varobj.c (varobj_format_string): Constify. * varobj.h (varobj_format_string): Constify. * vax-tdep.c (vax_register_name): Constify. * windows-nat.c (windows_detach): Constify. * xcoffread.c (process_linenos, xcoff_next_symbol_text): Constify. * xml-support.c (gdb_xml_end_element): Constify. * xml-tdesc.c (tdesc_start_reg): Constify. * xstormy16-tdep.c (xstormy16_register_name): Constify. * xtensa-tdep.c (xtensa_find_register_by_name): Constify. * xtensa-tdep.h (xtensa_register_t::name): Constify. gdb/gdbserver/ChangeLog: 2017-04-05 Pedro Alves <palves@redhat.com> * gdbreplay.c (sync_error): Constify. * linux-x86-low.c (push_opcode): Constify.
2017-04-05-Wwrite-strings: gdbserver/win32-low.c and TARGET_WAITKIND_EXECDPedro Alves1-0/+6
src/gdb/gdbserver/win32-low.c:1499:39: error: ISO C++ forbids converting a string constant to 'char*' [-Werror=write-strings] ourstatus->value.execd_pathname = "Main executable"; ^ This reporting via TARGET_WAITKIND_EXECD it's totally unnecessary. get_child_debug_event returns a TARGET_WAITKIND_SPURIOUS by default, which works just as well here, and is what the equivalent code in gdb/windows-nat.c does too. gdb/gdbserver/ChangeLog: 2017-04-05 Pedro Alves <palves@redhat.com> * win32-low.c (get_child_debug_event) <CREATE_PROCESS_DEBUG_EVENT>: Don't report TARGET_WAITKIND_EXECD. Report TARGET_WAITKIND_SPURIOUS instead.
2017-04-05-Wwrite-strings: gdbserver's 'port' parsingPedro Alves1-0/+6
-Wwrite-strings flags this assignment as requiring a cast: port = STDIO_CONNECTION_NAME; because 'port' is a "char *", and STDIO_CONNECTION_NAME is a string literal. gdb/gdbserver/ChangeLog: 2017-04-05 Pedro Alves <palves@redhat.com> * remote-utils.c (remote_prepare, remote_open): Constify. * remote-utils.h (remote_prepare, remote_open): Constify. * server.c (captured_main): Constify 'port' handling.
2017-04-04gdbserver: Clear .deps on cleanSimon Marchi1-0/+4
In some situations, the dependency tracking files in .deps can refer to source files that were removed or renamed, leading to errors like: make: *** No rule to make target `version.c', needed by `version.o'. Stop. This patch makes the clean target clear the .deps directory, which gives the user a chance to recover from the error wihtout knowing about the internals of the build system. It is already done for GDB. See here for more details: https://sourceware.org/ml/gdb-patches/2009-03/msg00000.html gdb/gdbserver/ChangeLog: * Makefile.in (clean): Clear .deps.
2017-03-31gdbserver: Suffix generated C files with -generatedSimon Marchi1-0/+12
I noticed that there were some missing files in gdbserver's gitignore (some generated register format .c files). Of course the easy fix would be to add those files to .gitignore, but I think we can do a better job, so that we don't have to worry about adding generated files to .gitignore or the clean Makefile target. I suggest naming all generated source files -generated.c. This way, we can use a single rule in .gitignore and do a "rm -f *-generated.c" to clean them up. New in v2: - Don't rename version.o and xml-builtin.o gdb/gdbserver/ChangeLog: * .gitignore: Remove generated files, replace with wildcard. * (clean): Replace removal of generated files with wildcard. (version.c): Replace with... (version-generated.c): ...this. (xml-builtin.c): Replace with... (xml-builtin-generated.c): ...this. (%-ipa.o: %-generated.c, %.o: %-generated.c): New rules. (%.c: *regformats*): Replace with... (%-generated.c: *regformats*): ...this.
2017-03-27gdbserver: xtensa: support THREADPTR registerMax Filippov1-0/+8
Provide aceess to the THREADPTR register to remote gdb. gdb/gdbserver/ 2017-03-27 Max Filippov <jcmvbkbc@gmail.com> * linux-xtensa-low.c (regnum::R_THREADPTR): New enum member. (xtensa_fill_gregset): Call collect_register_by_name for threadptr register. (xtensa_store_gregset): Call supply_register_by_name for threadptr register.
2017-03-27gdbserver: xtensa: add call0 supportMax Filippov1-0/+7
Correctly handle a0- registers on requests from remote gdb. This fixes 'Register 1 is not available' and subsequent assertion in the remote gdb connecting to the gdbserver: 'findvar.c:291: internal-error: value_of_register_lazy: Assertion `frame_id_p(get_frame_id (frame))' failed.' The register structure is the same for windowed and call0 ABIs because currently linux kernel internally requires windowed registers, so they are always present. gdb/gdbserver/ 2017-03-27 Max Filippov <jcmvbkbc@gmail.com> * linux-xtensa-low.c (xtensa_fill_gregset): Call collect_register for all registers in a0_regnum..a0_regnum + C0_NREGS range. (xtensa_store_gregset): Call supply_register for all registers in a0_regnum..a0_regnum + C0_NREGS range.
2017-03-13gdbserver: Use pattern rule for the remaining %-ipa.o objectsSimon Marchi1-0/+10
gdb/gdbserver/ChangeLog: * Makefile.in (%-ipa.o: %-ipa.c): New rule. (ax-ipa.o: ax.c): Remove. (linux-i386-ipa.o: linux-i386-ipa.c): Remove. (linux-amd64-ipa.o: linux-amd64-ipa.c): Remove. (linux-aarch64-ipa.o: linux-aarch64-ipa.c): Remove. (linux-s390-ipa.o: linux-s390-ipa.c): Remove. (linux-ppc-ipa.o: linux-ppc-ipa.c): Remove.
2017-03-13gdbserver: Use pattern rule for IPA objects from common/Simon Marchi1-0/+9
gdb/gdbserver/ChangeLog: * Makefile.in (%-ipa.o: ../common/%.c): New rule. (print-utils-ipa.o: ../common/print-utils.c): Remove. (rsp-low-ipa.o: ../common/rsp-low.c): Remove. (errors-ipa.o: ../common/errors.c): Remove. (format-ipa.o: ../common/format.c): Remove. (common-utils-ipa.o: ../common/common-utils.c): Remove.
2017-03-13gdbserver: Use pattern rule for IPA objects from gdbserver/Simon Marchi1-0/+56
gdb/gdbserver/ChangeLog: * Makefile.in (%-ipa.o: %.c): New rule. (tracepoint-ipa.o: tracepoint.c): Remove. (utils-ipa.o: utils.c): Remove. (remote-utils-ipa.o: remote-utils.c): Remove. (regcache-ipa.o: regcache.c): Remove. (i386-linux-ipa.o: i386-linux.c): Remove. (i386-mmx-linux-ipa.o: i386-mmx-linux.c): Remove. (i386-avx-linux-ipa.o: i386-avx-linux.c): Remove. (i386-mpx-linux-ipa.o: i386-mpx-linux.c): Remove. (i386-avx-mpx-linux-ipa.o: i386-avx-mpx-linux.c): Remove. (i386-avx-avx512-linux-ipa.o: i386-avx-avx512-linux.c): Remove. (i386-avx-mpx-avx512-pku-linux-ipa.o: i386-avx-mpx-avx512-pku-linux.c): Remove. (amd64-linux-ipa.o: amd64-linux.c): Remove. (amd64-avx-linux-ipa.o: amd64-avx-linux.c): Remove. (amd64-mpx-linux-ipa.o: amd64-mpx-linux.c): Remove. (amd64-avx-mpx-linux-ipa.o: amd64-avx-mpx-linux.c): Remove. (amd64-avx-avx512-linux-ipa.o: amd64-avx-avx512-linux.c): Remove. (amd64-avx-mpx-avx512-pku-linux-ipa.o: amd64-avx-mpx-avx512-pku-linux.c): Remove. (aarch64-ipa.o: aarch64.c): Remove. (s390-linux32-ipa.o: s390-linux32.c): Remove. (s390-linux32v1-ipa.o: s390-linux32v1.c): Remove. (s390-linux32v2-ipa.o: s390-linux32v2.c): Remove. (s390-linux64-ipa.o: s390-linux64.c): Remove. (s390-linux64v1-ipa.o: s390-linux64v1.c): Remove. (s390-linux64v2-ipa.o: s390-linux64v2.c): Remove. (s390-te-linux64-ipa.o: s390-te-linux64.c): Remove. (s390-vx-linux64-ipa.o: s390-vx-linux64.c): Remove. (s390-tevx-linux64-ipa.o: s390-tevx-linux64.c): Remove. (s390x-linux64-ipa.o: s390x-linux64.c): Remove. (s390x-linux64v1-ipa.o: s390x-linux64v1.c): Remove. (s390x-linux64v2-ipa.o: s390x-linux64v2.c): Remove. (s390x-te-linux64-ipa.o: s390x-te-linux64.c): Remove. (s390x-vx-linux64-ipa.o: s390x-vx-linux64.c): Remove. (s390x-tevx-linux64-ipa.o: s390x-tevx-linux64.c): Remove. (powerpc-32l-ipa.o: powerpc-32l.c): Remove. (powerpc-altivec32l-ipa.o: powerpc-altivec32l.c): Remove. (powerpc-cell32l-ipa.o: powerpc-cell32l.c): Remove. (powerpc-vsx32l-ipa.o: powerpc-vsx32l.c): Remove. (powerpc-isa205-32l-ipa.o: powerpc-isa205-32l.c): Remove. (powerpc-isa205-altivec32l-ipa.o: powerpc-isa205-altivec32l.c): Remove. (powerpc-isa205-vsx32l-ipa.o: powerpc-isa205-vsx32l.c): Remove. (powerpc-e500l-ipa.o: powerpc-e500l.c): Remove. (powerpc-64l-ipa.o: powerpc-64l.c): Remove. (powerpc-altivec64l-ipa.o: powerpc-altivec64l.c): Remove. (powerpc-cell64l-ipa.o: powerpc-cell64l.c): Remove. (powerpc-vsx64l-ipa.o: powerpc-vsx64l.c): Remove. (powerpc-isa205-64l-ipa.o: powerpc-isa205-64l.c): Remove. (powerpc-isa205-altivec64l-ipa.o: powerpc-isa205-altivec64l.c): Remove. (powerpc-isa205-vsx64l-ipa.o: powerpc-isa205-vsx64l.c): Remove. (tdesc-ipa.o: tdesc.c): Remove. (x32-linux-ipa.o: x32-linux.c): Remove. (x32-avx-linux-ipa.o: x32-avx-linux.c): Remove. (x32-avx512-linux-ipa.o: x32-avx512-linux.c): Remove.
2017-03-13gdbserver: Use pattern rule for objects from arch/Simon Marchi1-0/+8
gdb/gdbserver/ChangeLog: * Makefile.in (%.o: ../arch/%.c): New rule. (arm.o: ../arch/arm.c): Remove. (arm-linux.o: ../arch/arm-linux.c): Remove. (arm-get-next-pcs.o: ../arch/arm-get-next-pcs.c): Remove. (aarch64-insn.o: ../arch/aarch64-insn.c): Remove.
2017-03-13gdbserver: Use pattern rule for objects from nat/Simon Marchi1-0/+19
gdb/gdbserver/ChangeLog: * Makefile.in (%.o: ../nat/%.c): New rule. (x86-dregs.o: ../nat/x86-dregs.c): Remove. (amd64-linux-siginfo.o: ../nat/amd64-linux-siginfo.c): Remove. (linux-btrace.o: ../nat/linux-btrace.c): Remove. (linux-osdata.o: ../nat/linux-osdata.c): Remove. (linux-procfs.o: ../nat/linux-procfs.c): Remove. (linux-ptrace.o: ../nat/linux-ptrace.c): Remove. (linux-waitpid.o: ../nat/linux-waitpid.c): Remove. (mips-linux-watch.o: ../nat/mips-linux-watch.c): Remove. (ppc-linux.o: ../nat/ppc-linux.c): Remove. (linux-personality.o: ../nat/linux-personality.c): Remove. (aarch64-linux-hw-point.o: ../nat/aarch64-linux-hw-point.c): Remove. (aarch64-linux.o: ../nat/aarch64-linux.c): Remove. (x86-linux.o: ../nat/x86-linux.c): Remove. (x86-linux-dregs.o: ../nat/x86-linux-dregs.c): Remove. (linux-namespaces.o: ../nat/linux-namespaces.c): Remove.
2017-03-13gdbserver: Use pattern rule for objects from common/Simon Marchi1-0/+28
gdb/gdbserver/ChangeLog: * Makefile.in (%.o: ../common/%.c): New rule. (signals.o: ../common/signals.c): Remove. (print-utils.o: ../common/print-utils.c): Remove. (rsp-low.o: ../common/rsp-low.c): Remove. (common-utils.o: ../common/common-utils.c): Remove. (posix-strerror.o: ../common/posix-strerror.c): Remove. (mingw-strerror.o: ../common/mingw-strerror.c): Remove. (vec.o: ../common/vec.c): Remove. (gdb_vecs.o: ../common/gdb_vecs.c): Remove. (xml-utils.o: ../common/xml-utils.c): Remove. (ptid.o: ../common/ptid.c): Remove. (buffer.o: ../common/buffer.c): Remove. (format.o: ../common/format.c): Remove. (filestuff.o: ../common/filestuff.c): Remove. (agent.o: ../common/agent.c): Remove. (errors.o: ../common/errors.c): Remove. (environ.o: ../common/environ.c): Remove. (common-debug.o: ../common/common-debug.c): Remove. (cleanups.o: ../common/cleanups.c): Remove. (common-exceptions.o: ../common/common-exceptions.c): Remove. (fileio.o: ../common/fileio.c): Remove. (common-regcache.o: ../common/common-regcache.c): Remove. (signals-state-save-restore.o: ../common/signals-state-save-restore.c): Remove. (new-op.o: ../common/new-op.c): Remove. (btrace-common.o: ../common/btrace-common.c): Remove.
2017-03-13gdbserver: Use pattern rule for objects from target/Simon Marchi1-0/+5
gdb/gdbserver/ChangeLog: * Makefile.in (%.o: ../target/%.c): New rule. (waitstatus.o: ../target/waitstatus.c): Remove.
2017-03-13gdbserver: Use pattern rule for regformats source file generationSimon Marchi1-0/+98
gdb/gdbserver/ChangeLog: * Makefile.in (%.c: ../regformats/%.dat, (%.c: ../regformats/arm/%.dat, (%.c: ../regformats/i386/%.dat, (%.c: ../regformats/rs6000/%.dat): New rules. (aarch64.c): Remove. (reg-arm.c): Remove. (arm-with-iwmmxt.c): Remove. (arm-with-vfpv2.c): Remove. (arm-with-vfpv3.c): Remove. (arm-with-neon.c): Remove. (reg-bfin.c): Remove. (reg-cris.c): Remove. (reg-crisv32.c): Remove. (i386.c): Remove. (i386-linux.c): Remove. (i386-avx.c): Remove. (i386-avx-linux.c): Remove. (i386-avx-avx512.c): Remove. (i386-avx-avx512-linux.c): Remove. (i386-mpx.c): Remove. (i386-mpx-linux.c): Remove. (i386-avx-mpx-avx512-pku.c): Remove. (i386-avx-mpx-avx512-pku-linux.c): Remove. (i386-avx-mpx.c): Remove. (i386-avx-mpx-linux.c): Remove. (i386-mmx.c): Remove. (i386-mmx-linux.c): Remove. (reg-ia64.c): Remove. (reg-m32r.c): Remove. (reg-m68k.c): Remove. (reg-cf.c): Remove. (mips-linux.c): Remove. (mips-dsp-linux.c): Remove. (mips64-linux.c): Remove. (mips64-dsp-linux.c): Remove. (nios2-linux.c): Remove. (powerpc-32.c): Remove. (powerpc-32l.c): Remove. (powerpc-altivec32l.c): Remove. (powerpc-cell32l.c): Remove. (powerpc-vsx32l.c): Remove. (powerpc-isa205-32l.c): Remove. (powerpc-isa205-altivec32l.c): Remove. (powerpc-isa205-vsx32l.c): Remove. (powerpc-e500l.c): Remove. (powerpc-64l.c): Remove. (powerpc-altivec64l.c): Remove. (powerpc-cell64l.c): Remove. (powerpc-vsx64l.c): Remove. (powerpc-isa205-64l.c): Remove. (powerpc-isa205-altivec64l.c): Remove. (powerpc-isa205-vsx64l.c): Remove. (s390-linux32.c): Remove. (s390-linux32v1.c): Remove. (s390-linux32v2.c): Remove. (s390-linux64.c): Remove. (s390-linux64v1.c): Remove. (s390-linux64v2.c): Remove. (s390-te-linux64.c): Remove. (s390-vx-linux64.c): Remove. (s390-tevx-linux64.c): Remove. (s390x-linux64.c): Remove. (s390x-linux64v1.c): Remove. (s390x-linux64v2.c): Remove. (s390x-te-linux64.c): Remove. (s390x-vx-linux64.c): Remove. (s390x-tevx-linux64.c): Remove. (tic6x-c64xp-linux.c): Remove. (tic6x-c64x-linux.c): Remove. (tic6x-c62x-linux.c): Remove. (reg-sh.c): Remove. (reg-sparc64.c): Remove. (reg-spu.c): Remove. (amd64.c): Remove. (amd64-linux.c): Remove. (amd64-avx.c): Remove. (amd64-avx-linux.c): Remove. (amd64-avx-avx512.c): Remove. (amd64-avx-avx512-linux.c): Remove. (amd64-mpx.c): Remove. (amd64-mpx-linux.c): Remove. (amd64-avx-mpx-avx512-pku.c): Remove. (amd64-avx-mpx-avx512-pku-linux.c): Remove. (amd64-avx-mpx.c): Remove. (amd64-avx-mpx-linux.c): Remove. (x32.c): Remove. (x32-linux.c): Remove. (x32-avx.c): Remove. (x32-avx-linux.c): Remove. (x32-avx-avx512.c): Remove. (x32-avx-avx512-linux.c): Remove. (reg-xtensa.c): Remove. (reg-tilegx.c): Remove. (reg-tilegx32.c): Remove.
2017-03-07Share gdb/environ.[ch] with gdbserverSergio Durigan Junior1-0/+5
We will need access to the environment functions when we share fork_inferior between GDB and gdbserver, therefore we simply make the API on gdb/environ.[ch] available on common/. No extra adjustments are needed to make it compile on gdbserver. gdb/ChangeLog: 2017-03-07 Sergio Durigan Junior <sergiodj@redhat.com> * Makefile.in (SFILES): Replace "environ.c" with "common/environ.c". (HFILES_NO_SRCDIR): Likewise, for "environ.h". * environ.c: Include "common-defs.h" instead of "defs.h. Moved to... * common/environ.c: ... here. * environ.h: Moved to... * common/environ.h: ... here. gdb/gdbserver/ChangeLog: 2017-03-07 Sergio Durigan Junior <sergiodj@redhat.com> * Makefile.in (SFILES): Add "common/environ.c". (OBJS): Add "common/environ.h".
2017-01-27gdbserver-amd64: add HAVE_STRUCT_USER_REGS_STRUCT_(GS|FS)_BASE for gdbserver.Walfred Tedeschi1-0/+7
The macros mentioned in the title were set only for GDB. In gdbserver they were not set until now. To align the code in GDB and gdbserver these macros are also added into gdbserver, enabling read and write of gs_base and fs_base registers from the system in new and old kernels. 2017-01-27 Walfred Tedeschi <walfred.tedeschi@intel.com> gdb/gdbserver/ChangeLog: * configure.ac: Check if the fs_base and gs_base members of `struct user_regs_struct' exist. * config.in: Regenerated. * configure: Likewise.
2017-01-09Fix inferior memory reading in GDBServer for arm/aarch32Antoine Tremblay1-0/+7
Before this patch, some functions would read the inferior memory with (*the_target)->read_memory, which returns the raw memory, rather than the shadowed memory. This is wrong since these functions do not expect to read a breakpoint instruction and can lead to invalid behavior. Use of raw memory in get_next_pcs_read_memory_unsigned_integer for example could lead to get_next_pc returning an invalid pc. Here's how this would happen: In non-stop: the user issues: thread 1 step& thread 2 step& thread 3 step& In a similar way as non-stop-fair-events.exp (threads are looping). GDBServer: linux_resume is called GDBServer has pending events, threads are not resumed and single-step breakpoint for thread 1 not installed. linux_wait_1 is called with a pending event on thread 2 at pc A GDBServer handles the event and calls proceed_all_lwps This calls proceed_one_lwp and installs single-step breakpoints on all the threads that need one. Now since thread 1 needs to install a single-step breakpoint and is at pc B (different than thread 2), a step-over is not initiated and get_next_pc is called to figure out the next instruction from pc B. However it may just be that thread 3 as a single step breakpoint at pc B. And thus get_next_pc fails. This situation is tested with non-stop-fair-events.exp. In other words, single-step breakpoints are installed in proceed_one_lwp for each thread. GDBserver proceeds two threads for resume_step, as requested by GDB, and the thread proceeded later may see the single-step breakpoints installed for the thread proceeded just now. Tested on gdbserver-native/-m{thumb,arm} no regressions. gdb/gdbserver/ChangeLog: * linux-aarch32-low.c (arm_breakpoint_kind_from_pc): Use target_read_memory. * linux-arm-low.c (get_next_pcs_read_memory_unsigned_integer): Likewise. (get_next_pcs_syscall_next_pc): Likewise.
2016-12-23Fix incorrect reference to source filesLuis Machado1-0/+5
gdb/gdbserver/ChangeLog: 2016-12-23 Luis Machado <lgustavo@codesourcery.com> * win32-i386-low.c: Fix incorrect reference to a couple source files. * nto-x86-low.c: Likewise.
2016-11-30Makefiles: Disable suffix rules and implicit rulesSimon Marchi1-0/+4
Since we don't use suffix rules nor implicit rules in gdb, we can disable them. The advantage is a slightly faster make [1]. Here are some numbers about the speedup. I ran this on my trusty old Intel Q6600, so the time numbers are probably higher than what you'd get on any recent hardware. I ran "make" in the gdb/ directory of an already built repository (configured with --enable-targets=all). I recorded the time of execution (average of 5). I then ran "make -d" and recorded the number of printed lines, which gives a rough idea of the number of operations done. I compared the following configurations, to see the impact of both the empty .SUFFIXES target and the empty pattern rules, as well as running "make -r", which can be considered the "ideal" case. A - baseline B - baseline + .SUFFIXES C - baseline + pattern rules D - baseline + .SUFFIXES + pattern rules E - baseline + make -r config | time (s) | "make -d" ----------------------------- A | 5.74 | 2396643 B | 1.19 | 298469 C | 2.81 | 1266573 D | 1.13 | 245489 E | 1.01 | 163914 We can see that the empty .SUFFIXES target has a bigger impact than the empty pattern rules, but still it doesn't hurt to disable the implicit pattern rules as well. There are still some mentions of implicit rules I can't get rid of in the "make -d" output. For example, it's trying to build .c files from .w files: Looking for an implicit rule for '/home/simark/src/binutils-gdb/gdb/infrun.c'. Trying pattern rule with stem 'infrun'. Trying implicit prerequisite '/home/simark/src/binutils-gdb/gdb/infrun.w'. and trying to build Makefile.in from a bunch of extensions: Looking for an implicit rule for 'Makefile.in'. Trying pattern rule with stem 'Makefile.in'. Trying implicit prerequisite 'Makefile.in.o'. Trying pattern rule with stem 'Makefile.in'. Trying implicit prerequisite 'Makefile.in.c'. Trying pattern rule with stem 'Makefile.in'. Trying implicit prerequisite 'Makefile.in.cc'. ... many more ... If somebody knows how to disable them, we can do it, but at this point the returns are minimal, so it is not that important. I verified that both in-tree and out-of-tree builds work. [1] Switching from explicit rules to pattern rules for files in subdirectories actually made it slower, so this is kind of a way to redeem myself. But it the end it's faster than it was previously, so it was all worth it. :) gdb/ChangeLog: * disable-implicit-rules.mk: New file. * Makefile.in: Include disable-implicit-rules.mk. * data-directory/Makefile.in: Likewise. * gnulib/Makefile.in: Likewise. gdb/doc/ChangeLog: * Makefile.in: Likewise. gdb/gdbserver/ChangeLog: * Makefile.in: Include disable-implicit-rules.mk. gdb/testsuite/ChangeLog: * Makefile.in: Include disable-implicit-rules.mk.
2016-11-23gdb: Use C++11 std::chronoPedro Alves1-0/+9
This patch fixes a few problems with GDB's time handling. #1 - It avoids problems with gnulib's C++ namespace support On MinGW, the struct timeval that should be passed to gnulib's gettimeofday replacement is incompatible with libiberty's timeval_sub/timeval_add. That's because gnulib also replaces "struct timeval" with its own definition, while libiberty expects the system's. E.g., in code like this: gettimeofday (&prompt_ended, NULL); timeval_sub (&prompt_delta, &prompt_ended, &prompt_started); timeval_add (&prompt_for_continue_wait_time, &prompt_for_continue_wait_time, &prompt_delta); That's currently handled in gdb by not using gnulib's gettimeofday at all (see common/gdb_sys_time.h), but that #undef hack won't work with if/when we enable gnulib's C++ namespace support, because that mode adds compile time warnings for uses of ::gettimeofday, which are hard errors with -Werror. #2 - But there's an elephant in the room: gettimeofday is not monotonic... We're using it to: a) check how long functions take, for performance analysis b) compute when in the future to fire events in the event-loop c) print debug timestamps But that's exactly what gettimeofday is NOT meant for. Straight from the man page: ~~~ The time returned by gettimeofday() is affected by discontinuous jumps in the system time (e.g., if the system administrator manually changes the system time). If you need a monotonically increasing clock, see clock_gettime(2). ~~~ std::chrono (part of the C++11 standard library) has a monotonic clock exactly for such purposes (std::chrono::steady_clock). This commit switches to use that instead of gettimeofday, fixing all the issues mentioned above. gdb/ChangeLog: 2016-11-23 Pedro Alves <palves@redhat.com> * Makefile.in (SFILES): Add common/run-time-clock.c. (HFILES_NO_SRCDIR): Add common/run-time-clock.h. (COMMON_OBS): Add run-time-clock.o. * common/run-time-clock.c, common/run-time-clock.h: New files. * defs.h (struct timeval, print_transfer_performance): Delete declarations. * event-loop.c (struct gdb_timer) <when>: Now a std::chrono::steady_clock::time_point. (create_timer): use std::chrono::steady_clock instead of gettimeofday. Use new instead of malloc. (delete_timer): Use delete instead of xfree. (duration_cast_timeval): New. (update_wait_timeout): Use std::chrono::steady_clock instead of gettimeofday. * maint.c: Include <chrono> instead of "gdb_sys_time.h", <time.h> and "timeval-utils.h". (scoped_command_stats::~scoped_command_stats) (scoped_command_stats::scoped_command_stats): Use std::chrono::steady_clock instead of gettimeofday. Use user_cpu_time_clock instead of get_run_time. * maint.h: Include "run-time-clock.h" and <chrono>. (scoped_command_stats): <m_start_cpu_time>: Now a user_cpu_time_clock::time_point. <m_start_wall_time>: Now a std::chrono::steady_clock::time_point. * mi/mi-main.c: Include "run-time-clock.h" and <chrono> instead of "gdb_sys_time.h" and <sys/resource.h>. (rusage): Delete. (mi_execute_command): Use new instead of XNEW. (mi_load_progress): Use std::chrono::steady_clock instead of gettimeofday. (timestamp): Rewrite in terms of std::chrono::steady_clock, user_cpu_time_clock and system_cpu_time_clock. (timeval_diff): Delete. (print_diff): Adjust to use std::chrono::steady_clock, user_cpu_time_clock and system_cpu_time_clock. * mi/mi-parse.h: Include "run-time-clock.h" and <chrono> instead of "gdb_sys_time.h". (struct mi_timestamp): Change fields types to std::chrono::steady_clock::time_point, user_cpu_time_clock::time and system_cpu_time_clock::time_point, instead of struct timeval. * symfile.c: Include <chrono> instead of <time.h> and "gdb_sys_time.h". (struct time_range): New. (generic_load): Use std::chrono::steady_clock instead of gettimeofday. (print_transfer_performance): Replace timeval parameters with a std::chrono::steady_clock::duration parameter. Adjust. * utils.c: Include <chrono> instead of "timeval-utils.h", "gdb_sys_time.h", and <time.h>. (prompt_for_continue_wait_time): Now a std::chrono::steady_clock::duration. (defaulted_query, prompt_for_continue): Use std::chrono::steady_clock instead of gettimeofday/timeval_sub/timeval_add. (reset_prompt_for_continue_wait_time): Use std::chrono::steady_clock::duration instead of struct timeval. (get_prompt_for_continue_wait_time): Return a std::chrono::steady_clock::duration instead of struct timeval. (vfprintf_unfiltered): Use std::chrono::steady_clock instead of gettimeofday. Use std::string. Use '.' instead of ':'. * utils.h: Include <chrono>. (get_prompt_for_continue_wait_time): Return a std::chrono::steady_clock::duration instead of struct timeval. gdb/gdbserver/ChangeLog: 2016-11-23 Pedro Alves <palves@redhat.com> * debug.c: Include <chrono> instead of "gdb_sys_time.h". (debug_vprintf): Use std::chrono::steady_clock instead of gettimeofday. Use '.' instead of ':'. * tracepoint.c: Include <chrono> instead of "gdb_sys_time.h". (get_timestamp): Use std::chrono::steady_clock instead of gettimeofday.
2016-11-23Minor formatting fixups in MakefilesSimon Marchi1-0/+4
Mostly some whitespace changes to make things a bit more consistent. gdb/ChangeLog: * Makefile.in: Fix whitespace formatting. gdb/gdbserver/ChangeLog: * Makefile.in: Fix whitespace formatting.
2016-11-23Makefiles: Flatten and sort file listsSimon Marchi1-0/+5
I find the big file lists in the Makefiles a bit ugly and not very practical. Since there are multiple filenames on each line (as much as fits in 80 columns), it's not easy to add, remove or change a name in the middle. As a result, we have a mix of long and short lines in no particular order (ALL_TARGET_OBS is a good example). I therefore suggest flattening the lists (one name per line) and keeping them in alphabetical order. The diffs will be much clearer and merge conflicts will be easier to resolve. A nice (IMO) side-effect I observed is that the files are compiled alphabetically by make, so it gives a rough idea of the progress of the build. I added a comment in gdb/Makefile.in to mention to keep the file lists ordered, and gave the general guidelines on what order to respect. I added a comment in other Makefiles which refers to gdb/Makefile.in, to avoid duplication. Running the patch through the buildbot found that gdb.base/default.exp started to fail. The languages in the error message shown when typing "set language" have changed order. We could probably improve gdb so that it prints them in a stable order, regardless of the order of the object list passed to the linked, but just fixing the test is easier for now. New in v2: - Change ordering style, directories go at the end. - Cleanup gdbserver's and data-directory's Makefile as well. - Add comments at top of Makefiles about the ordering. - Remove wrong trailing backslahes. - Fix test gdb.base/default.exp. gdb/ChangeLog: * Makefile.in: Add comment about file lists ordering. (SUBDIR_CLI_OBS, SUBDIR_CLI_SRCS, SUBDIR_MI_OBS, SUBDIR_MI_SRCS, SUBDIR_TUI_OBS, SUBDIR_TUI_SRCS, SUBDIR_GCC_COMPILE_OBS, SUBDIR_GCC_COMPILE_SRCS, SUBDIR_GUILE_OBS, SUBDIR_GUILE_SRCS, SUBDIR_PYTHON_OBS, SUBDIR_PYTHON_SRCS, SUBDIR_GDBTK_OBS, SUBDIR_GDBTK_SRCS, XMLFILES, REMOTE_OBS, ALL_64_TARGET_OBS, ALL_TARGET_OBS, SFILES, HFILES_NO_SRCDIR, HFILES_WITH_SRCDIR, COMMON_OBS, YYFILES, YYOBJ, generated_files, ALLDEPFILES): Flatten list and order alphabetically. * data-directory/Makefile.in: Add comment about file lists ordering. (GEN_SYSCALLS_FILES, PYTHON_FILE_LIST): Flatten list and order alphabetically. gdb/gdbserver/ChangeLog: * Makefile.in (SFILES, OBS): Flatten list and order alphabetically. gdb/testsuite/ChangeLog: * gdb.base/default.exp: Fix output of "set language".