binutils-gdb/gdbserver/linux-low.h

898 lines
32 KiB
C
Raw Permalink Normal View History

/* Internal interfaces for the GNU/Linux specific target code for gdbserver.
Copyright (C) 2002-2020 Free Software Foundation, Inc.
This file is part of GDB.
This program is free software; you can redistribute it and/or modify
it under the terms of the GNU General Public License as published by
the Free Software Foundation; either version 3 of the License, or
(at your option) any later version.
This program is distributed in the hope that it will be useful,
but WITHOUT ANY WARRANTY; without even the implied warranty of
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
GNU General Public License for more details.
You should have received a copy of the GNU General Public License
along with this program. If not, see <http://www.gnu.org/licenses/>. */
Normalize include guards in gdb While working on my other scripts to deal with gdb headers, I noticed that some files were missing include guards. I wrote a script to add the missing ones, but found that using the obvious names for the guards ran into clashes -- for example, gdb/nat/linux-nat.h used "LINUX_NAT_H", but this was also the script's choice for gdb/linux-nat.h. So, I changed the script to normalize all include guards in gdb. This patch is the result. As usual the script is available here: https://github.com/tromey/gdb-refactoring-scripts Tested by rebuilding; I also ran it through "Fedora-x86_64-m64" on the buildbot. gdb/ChangeLog 2019-02-07 Tom Tromey <tom@tromey.com> * yy-remap.h: Add include guard. * xtensa-tdep.h: Add include guard. * xcoffread.h: Rename include guard. * varobj-iter.h: Add include guard. * tui/tui.h: Rename include guard. * tui/tui-winsource.h: Rename include guard. * tui/tui-wingeneral.h: Rename include guard. * tui/tui-windata.h: Rename include guard. * tui/tui-win.h: Rename include guard. * tui/tui-stack.h: Rename include guard. * tui/tui-source.h: Rename include guard. * tui/tui-regs.h: Rename include guard. * tui/tui-out.h: Rename include guard. * tui/tui-layout.h: Rename include guard. * tui/tui-io.h: Rename include guard. * tui/tui-hooks.h: Rename include guard. * tui/tui-file.h: Rename include guard. * tui/tui-disasm.h: Rename include guard. * tui/tui-data.h: Rename include guard. * tui/tui-command.h: Rename include guard. * tic6x-tdep.h: Add include guard. * target/waitstatus.h: Rename include guard. * target/wait.h: Rename include guard. * target/target.h: Rename include guard. * target/resume.h: Rename include guard. * target-float.h: Rename include guard. * stabsread.h: Add include guard. * rs6000-tdep.h: Add include guard. * riscv-fbsd-tdep.h: Add include guard. * regformats/regdef.h: Rename include guard. * record.h: Rename include guard. * python/python.h: Rename include guard. * python/python-internal.h: Rename include guard. * python/py-stopevent.h: Rename include guard. * python/py-ref.h: Rename include guard. * python/py-record.h: Rename include guard. * python/py-record-full.h: Rename include guard. * python/py-record-btrace.h: Rename include guard. * python/py-instruction.h: Rename include guard. * python/py-events.h: Rename include guard. * python/py-event.h: Rename include guard. * procfs.h: Add include guard. * proc-utils.h: Add include guard. * p-lang.h: Add include guard. * or1k-tdep.h: Rename include guard. * observable.h: Rename include guard. * nto-tdep.h: Rename include guard. * nat/x86-linux.h: Rename include guard. * nat/x86-linux-dregs.h: Rename include guard. * nat/x86-gcc-cpuid.h: Add include guard. * nat/x86-dregs.h: Rename include guard. * nat/x86-cpuid.h: Rename include guard. * nat/ppc-linux.h: Rename include guard. * nat/mips-linux-watch.h: Rename include guard. * nat/linux-waitpid.h: Rename include guard. * nat/linux-ptrace.h: Rename include guard. * nat/linux-procfs.h: Rename include guard. * nat/linux-osdata.h: Rename include guard. * nat/linux-nat.h: Rename include guard. * nat/linux-namespaces.h: Rename include guard. * nat/linux-btrace.h: Rename include guard. * nat/glibc_thread_db.h: Rename include guard. * nat/gdb_thread_db.h: Rename include guard. * nat/gdb_ptrace.h: Rename include guard. * nat/fork-inferior.h: Rename include guard. * nat/amd64-linux-siginfo.h: Rename include guard. * nat/aarch64-sve-linux-sigcontext.h: Rename include guard. * nat/aarch64-sve-linux-ptrace.h: Rename include guard. * nat/aarch64-linux.h: Rename include guard. * nat/aarch64-linux-hw-point.h: Rename include guard. * mn10300-tdep.h: Add include guard. * mips-linux-tdep.h: Add include guard. * mi/mi-parse.h: Rename include guard. * mi/mi-out.h: Rename include guard. * mi/mi-main.h: Rename include guard. * mi/mi-interp.h: Rename include guard. * mi/mi-getopt.h: Rename include guard. * mi/mi-console.h: Rename include guard. * mi/mi-common.h: Rename include guard. * mi/mi-cmds.h: Rename include guard. * mi/mi-cmd-break.h: Rename include guard. * m2-lang.h: Add include guard. * location.h: Rename include guard. * linux-record.h: Rename include guard. * linux-nat.h: Add include guard. * linux-fork.h: Add include guard. * i386-darwin-tdep.h: Rename include guard. * hppa-linux-offsets.h: Add include guard. * guile/guile.h: Rename include guard. * guile/guile-internal.h: Rename include guard. * gnu-nat.h: Rename include guard. * gdb-stabs.h: Rename include guard. * frv-tdep.h: Add include guard. * f-lang.h: Add include guard. * event-loop.h: Add include guard. * darwin-nat.h: Rename include guard. * cp-abi.h: Rename include guard. * config/sparc/nm-sol2.h: Rename include guard. * config/nm-nto.h: Rename include guard. * config/nm-linux.h: Add include guard. * config/i386/nm-i386gnu.h: Rename include guard. * config/djgpp/nl_types.h: Rename include guard. * config/djgpp/langinfo.h: Rename include guard. * compile/gcc-cp-plugin.h: Add include guard. * compile/gcc-c-plugin.h: Add include guard. * compile/compile.h: Rename include guard. * compile/compile-object-run.h: Rename include guard. * compile/compile-object-load.h: Rename include guard. * compile/compile-internal.h: Rename include guard. * compile/compile-cplus.h: Rename include guard. * compile/compile-c.h: Rename include guard. * common/xml-utils.h: Rename include guard. * common/x86-xstate.h: Rename include guard. * common/version.h: Rename include guard. * common/vec.h: Rename include guard. * common/tdesc.h: Rename include guard. * common/selftest.h: Rename include guard. * common/scoped_restore.h: Rename include guard. * common/scoped_mmap.h: Rename include guard. * common/scoped_fd.h: Rename include guard. * common/safe-iterator.h: Rename include guard. * common/run-time-clock.h: Rename include guard. * common/refcounted-object.h: Rename include guard. * common/queue.h: Rename include guard. * common/ptid.h: Rename include guard. * common/print-utils.h: Rename include guard. * common/preprocessor.h: Rename include guard. * common/pathstuff.h: Rename include guard. * common/observable.h: Rename include guard. * common/netstuff.h: Rename include guard. * common/job-control.h: Rename include guard. * common/host-defs.h: Rename include guard. * common/gdb_wait.h: Rename include guard. * common/gdb_vecs.h: Rename include guard. * common/gdb_unlinker.h: Rename include guard. * common/gdb_unique_ptr.h: Rename include guard. * common/gdb_tilde_expand.h: Rename include guard. * common/gdb_sys_time.h: Rename include guard. * common/gdb_string_view.h: Rename include guard. * common/gdb_splay_tree.h: Rename include guard. * common/gdb_setjmp.h: Rename include guard. * common/gdb_ref_ptr.h: Rename include guard. * common/gdb_optional.h: Rename include guard. * common/gdb_locale.h: Rename include guard. * common/gdb_assert.h: Rename include guard. * common/filtered-iterator.h: Rename include guard. * common/filestuff.h: Rename include guard. * common/fileio.h: Rename include guard. * common/environ.h: Rename include guard. * common/common-utils.h: Rename include guard. * common/common-types.h: Rename include guard. * common/common-regcache.h: Rename include guard. * common/common-inferior.h: Rename include guard. * common/common-gdbthread.h: Rename include guard. * common/common-exceptions.h: Rename include guard. * common/common-defs.h: Rename include guard. * common/common-debug.h: Rename include guard. * common/cleanups.h: Rename include guard. * common/buffer.h: Rename include guard. * common/btrace-common.h: Rename include guard. * common/break-common.h: Rename include guard. * cli/cli-utils.h: Rename include guard. * cli/cli-style.h: Rename include guard. * cli/cli-setshow.h: Rename include guard. * cli/cli-script.h: Rename include guard. * cli/cli-interp.h: Rename include guard. * cli/cli-decode.h: Rename include guard. * cli/cli-cmds.h: Rename include guard. * charset-list.h: Add include guard. * buildsym-legacy.h: Rename include guard. * bfin-tdep.h: Add include guard. * ax.h: Rename include guard. * arm-linux-tdep.h: Add include guard. * arm-fbsd-tdep.h: Add include guard. * arch/xtensa.h: Rename include guard. * arch/tic6x.h: Add include guard. * arch/i386.h: Add include guard. * arch/arm.h: Rename include guard. * arch/arm-linux.h: Rename include guard. * arch/arm-get-next-pcs.h: Rename include guard. * arch/amd64.h: Add include guard. * arch/aarch64-insn.h: Rename include guard. * arch-utils.h: Rename include guard. * annotate.h: Add include guard. * amd64-darwin-tdep.h: Rename include guard. * aarch64-linux-tdep.h: Add include guard. * aarch64-fbsd-tdep.h: Add include guard. * aarch32-linux-nat.h: Add include guard. gdb/gdbserver/ChangeLog 2019-02-07 Tom Tromey <tom@tromey.com> * x86-tdesc.h: Rename include guard. * x86-low.h: Add include guard. * wincecompat.h: Rename include guard. * win32-low.h: Add include guard. * utils.h: Rename include guard. * tracepoint.h: Rename include guard. * tdesc.h: Rename include guard. * target.h: Rename include guard. * server.h: Rename include guard. * remote-utils.h: Rename include guard. * regcache.h: Rename include guard. * nto-low.h: Rename include guard. * notif.h: Add include guard. * mem-break.h: Rename include guard. * lynx-low.h: Add include guard. * linux-x86-tdesc.h: Add include guard. * linux-s390-tdesc.h: Add include guard. * linux-ppc-tdesc-init.h: Add include guard. * linux-low.h: Add include guard. * linux-aarch64-tdesc.h: Add include guard. * linux-aarch32-low.h: Add include guard. * inferiors.h: Rename include guard. * i387-fp.h: Rename include guard. * hostio.h: Rename include guard. * gdbthread.h: Rename include guard. * gdb_proc_service.h: Rename include guard. * event-loop.h: Rename include guard. * dll.h: Rename include guard. * debug.h: Rename include guard. * ax.h: Rename include guard.
2019-01-27 20:51:36 +01:00
#ifndef GDBSERVER_LINUX_LOW_H
#define GDBSERVER_LINUX_LOW_H
#include "nat/linux-nat.h"
Move shared native target specific code to gdb/nat https://sourceware.org/gdb/wiki/Common describes the following directory structure: gdb/nat/ Native target backend files. Code that interfaces with the host debug API. E.g., ptrace code, Windows debug API code, procfs code should go here. gdb/target/ Host-independent, target vector specific code (target_ops). gdb/common/ All other shared code. This commit moves all native target backend files currently in gdb/common to gdb/nat. gdb/ 2014-06-20 Gary Benson <gbenson@redhat.com> * common/gdb_thread_db.h: Moved to nat. All includes updated. * common/glibc_thread_db.h: Likewise. * common/i386-cpuid.h: Likewise. * common/i386-gcc-cpuid.h: Likewise. * common/linux-btrace.h: Likewise. * common/linux-osdata.h: Likewise. * common/linux-procfs.h: Likewise. * common/linux-ptrace.h: Likewise. * common/mips-linux-watch.h: Likewise. * common/linux-btrace.c: Moved to nat. * common/linux-osdata.c: Likewise. * common/linux-procfs.c: Likewise. * common/linux-ptrace.c: Likewise. * common/mips-linux-watch.c: Likewise. * nat/gdb_thread_db.h: Moved from common. * nat/glibc_thread_db.h: Likewise. * nat/i386-cpuid.h: Likewise. * nat/i386-gcc-cpuid.h: Likewise. * nat/linux-btrace.c: Likewise. * nat/linux-btrace.h: Likewise. * nat/linux-osdata.c: Likewise. * nat/linux-osdata.h: Likewise. * nat/linux-procfs.c: Likewise. * nat/linux-procfs.h: Likewise. * nat/linux-ptrace.c: Likewise. * nat/linux-ptrace.h: Likewise. * nat/mips-linux-watch.c: Likewise. * nat/mips-linux-watch.h: Likewise. * Makefile.in (HFILES_NO_SRCDIR): Reflect new locations. (object file files): Reordered. * gdb/copyright.py (EXCLUDE_LIST): Reflect new location of glibc_thread_db.h. gdb/gdbserver/ 2014-06-20 Gary Benson <gbenson@redhat.com> * Makefile.in (SFILES): Update locations for files moved from common to nat. (object file files): Reordered. gdb/testsuite/ 2014-06-20 Gary Benson <gbenson@redhat.com> * gdb.arch/i386-avx.exp: Fix include file location. * gdb.arch/i386-sse.exp: Likewise.
2014-06-19 15:46:38 +02:00
#include "nat/gdb_thread_db.h"
#include <signal.h>
#include "gdbthread.h"
2009-04-01 Pedro Alves <pedro@codesourcery.com> Implement the multiprocess extensions, and add linux multiprocess support. * server.h (ULONGEST): Declare. (struct ptid, ptid_t): New. (minus_one_ptid, null_ptid): Declare. (ptid_build, pid_to_ptid, ptid_get_pid, ptid_get_lwp) (ptid_get_tid, ptid_equal, ptid_is_pid): Declare. (struct inferior_list_entry): Change `id' type from unsigned from to ptid_t. (struct sym_cache, struct breakpoint, struct process_info_private): Forward declare. (struct process_info): Declare. (current_process): Declare. (all_processes): Declare. (initialize_inferiors): Declare. (add_thread): Adjust to use ptid_t. (thread_id_to_gdb_id, thread_to_gdb_id, gdb_id_to_thread_id): Ditto. (add_process, remove_process, find_thread_pid): Declare. (find_inferior_id): Adjust to use ptid_t. (cont_thread, general_thread, step_thread): Change type to ptid_t. (multi_process): Declare. (push_event): Adjust to use ptid_t. (read_ptid, write_ptid): Declare. (prepare_resume_reply): Adjust to use ptid_t. (clear_symbol_cache): Declare. * inferiors.c (all_processes): New. (null_ptid, minus_one_ptid): New. (ptid_build, pid_to_ptid, ptid_get_pid, ptid_get_lwp) (ptid_get_tid, ptid_equal, ptid_is_pid): New. (add_thread): Change unsigned long to ptid. Remove gdb_id parameter. Adjust. (thread_id_to_gdb_id, thread_to_gdb_id): Change unsigned long to ptid. (gdb_id_to_thread): Rename to ... (find_thread_pid): ... this. Change unsigned long to ptid. (gdb_id_to_thread_id, find_inferior_id): Change unsigned long to ptid. (loaded_dll, pull_pid_from_list): Adjust. (add_process, remove_process, find_process_pid) (get_thread_process, current_process, initialize_inferiors): New. * target.h (struct thread_resume) <thread>: Change type to ptid_t. (struct target_waitstatus) <related_pid>: Ditto. (struct target_ops) <kill, detach>: Add `pid' argument. Change return type to int. (struct target_ops) <join>: Add `pid' argument. (struct target_ops) <thread_alive>: Change pid's type to ptid_t. (struct target_ops) <wait>: Add `ptid' field. Change return type to ptid. (kill_inferior, detach_inferior, join_inferior): Add `pid' argument. (mywait): Add `ptid' argument. Change return type to ptid_t. (target_pid_to_str): Declare. * target.c (set_desired_inferior): Adjust to use ptids. (mywait): Add new `ptid' argument. Adjust. (target_pid_to_str): New. * mem-break.h (free_all_breakpoints): Declare. * mem-break.c (breakpoints): Delelete. (set_breakpoint_at, delete_breakpoint, find_breakpoint_at) (check_mem_read, check_mem_write, delete_all_breakpoints): Adjust to use per-process breakpoint list. (free_all_breakpoints): New. * remote-utils.c (struct sym_cache) <name>: Drop `const'. (symbol_cache, all_symbols_looked_up): Delete. (hexchars): New. (ishex, unpack_varlen_hex, write_ptid, hex_or_minus_one, read_ptid): New. (prepare_resume_reply): Change ptid argument's type from unsigned long to ptid_t. Adjust. Implement W;process and X;process. (free_sym_cache, clear_symbol_cache): New. (look_up_one_symbol): Adjust to per-process symbol cache. * * server.c (cont_thread, general_thread, step_thread): Change type to ptid_t. (attached): Delete. (multi_process): New. (last_ptid): Change type to ptid_t. (struct vstop_notif) <ptid>: Change type to ptid_t. (queue_stop_reply, push_event): Change `ptid' argument's type to ptid_t. (discard_queued_stop_replies): Add `pid' argument. (start_inferior): Adjust to use ptids. Adjust to mywait interface changes. Don't reference the `attached' global. (attach_inferior): Adjust to mywait interface changes. (handle_query): Adjust to use ptids. Parse GDB's qSupported features. Handle and report "multiprocess+". Handle "qAttached:PID". (handle_v_cont): Adjust to use ptids. Adjust to mywait interface changes. (handle_v_kill): New. (handle_v_stopped): Adjust to use target_pid_to_str. (handle_v_requests): Allow multiple attaches and runs when multiprocess extensions are in effect. Handle "vKill". (myresume): Adjust to use ptids. (queue_stop_reply_callback): Add `arg' parameter. Handle it. (handle_status): Adjust to discard_queued_stop_replies interface change. (first_thread_of, kill_inferior_callback) (detach_or_kill_inferior_callback, join_inferiors_callback): New. (main): Call initialize_inferiors. Adjust to use ptids, killing and detaching from all inferiors. Handle multiprocess packet variants. * linux-low.h: Include gdb_proc_service.h. (struct process_info_private): New. (struct linux_target_ops) <pid_of>: Use ptid_get_pid. <lwpid_of>: Use ptid_get_lwp. (get_lwp_thread): Adjust. (struct lwp_info): Add `dead' member. (find_lwp_pid): Declare. * linux-low.c (thread_db_active): Delete. (new_inferior): Adjust comment. (inferior_pid): Delete. (linux_add_process): New. (handle_extended_wait): Adjust. (add_lwp): Change unsigned long to ptid. (linux_create_inferior): Add process to processes table. Adjust to use ptids. Don't set new_inferior here. (linux_attach_lwp): Rename to ... (linux_attach_lwp_1): ... this. Add `initial' argument. Handle it. Adjust to use ptids. (linux_attach_lwp): New. (linux_attach): Add process to processes table. Don't set new_inferior here. (struct counter): New. (second_thread_of_pid_p, last_thread_of_process_p): New. (linux_kill_one_lwp): Add `args' parameter. Handle it. Adjust to multiple processes. (linux_kill): Add `pid' argument. Handle it. Adjust to multiple processes. Remove process from process table. (linux_detach_one_lwp): Add `args' parameter. Handle it. Adjust to multiple processes. (any_thread_of): New. (linux_detach): Add `pid' argument, and handle it. Remove process from processes table. (linux_join): Add `pid' argument. Handle it. (linux_thread_alive): Change unsighed long argument to ptid_t. Consider dead lwps as not being alive. (status_pending_p): Rename `dummy' argument to `arg'. Filter out threads we're not interested in. (same_lwp, find_lwp_pid): New. (linux_wait_for_lwp): Change `pid' argument's type from int to ptid_t. Adjust. (linux_wait_for_event): Rename to ... (linux_wait_for_event_1): ... this. Change `pid' argument's type from int to ptid_t. Adjust. (linux_wait_for_event): New. (linux_wait_1): Add `ptid' argument. Change return type to ptid_t. Adjust. Use last_thread_of_process_p. Remove processes that exit from the process table. (linux_wait): Add `ptid' argument. Change return type to ptid_t. Adjust. (mark_lwp_dead): New. (wait_for_sigstop): Adjust to use ptids. If a process exits while stopping all threads, mark its main lwp as dead. (linux_set_resume_request, linux_resume_one_thread): Adjust to use ptids. (fetch_register, usr_store_inferior_registers) (regsets_fetch_inferior_registers) (regsets_store_inferior_registers, linux_read_memory) (linux_write_memory): Inline `inferior_pid'. (linux_look_up_symbols): Adjust to use per-process `thread_db_active'. (linux_request_interrupt): Adjust to use ptids. (linux_read_auxv): Inline `inferior_pid'. (initialize_low): Don't reference thread_db_active. * gdb_proc_service.h (struct ps_prochandle) <pid>: Remove. * proc-service.c (ps_lgetregs): Use find_lwp_pid. (ps_getpid): Return the pid of the current inferior. * thread-db.c (proc_handle, thread_agent): Delete. (thread_db_create_event, thread_db_enable_reporting): Adjust to per-process data. (find_one_thread): Change argument type to ptid_t. Adjust to per-process data. (maybe_attach_thread): Adjust to per-process data and ptids. (thread_db_find_new_threads): Ditto. (thread_db_init): Ditto. * spu-low.c (spu_create_inferior, spu_attach): Add process to processes table. Adjust to use ptids. (spu_kill, spu_detach): Adjust interface. Remove process from processes table. (spu_join, spu_thread_alive): Adjust interface. (spu_wait): Adjust interface. Remove process from processes table. Adjust to use ptids. * win32-low.c (current_inferior_tid): Delete. (current_inferior_ptid): New. (debug_event_ptid): New. (thread_rec): Take a ptid. Adjust. (child_add_thread): Add `pid' argument. Adjust to use ptids. (child_delete_thread): Ditto. (do_initial_child_stuff): Add `attached' argument. Add process to processes table. (child_fetch_inferior_registers, child_store_inferior_registers): Adjust. (win32_create_inferior): Pass 0 to do_initial_child_stuff. (win32_attach): Pass 1 to do_initial_child_stuff. (win32_kill): Adjust interface. Remove process from processes table. (win32_detach): Ditto. (win32_join): Adjust interface. (win32_thread_alive): Take a ptid. (win32_resume): Adjust to use ptids. (get_child_debug_event): Ditto. (win32_wait): Adjust interface. Remove exiting process from processes table.
2009-04-02 00:50:24 +02:00
#include "gdb_proc_service.h"
Unify ptrace options discovery code and make both GDB and gdbserver use it. gdb/ * Makefile.in (HFILES_NO_SRCDIR): Add nat/linux-nat.h and nat/linux-waitpid.h. (linux-waitpid.o): New object file rule. * common/linux-ptrace.c: Include nat/linux-waitpid.h. (current_ptrace_options): Moved from linux-nat.c. (linux_ptrace_test_ret_to_nx): Use type casts for ptrace parameters. (linux_fork_to_function): New function. (linux_grandchild_function): Likewise. (linux_child_function): Likewise. (linux_check_ptrace_features): New function, heavily based on linux-nat.c:linux_test_for_tracefork. (linux_enable_event_reporting): New function. (ptrace_supports_feature): Likewise. (linux_supports_tracefork): Likewise. (linux_supports_traceclone): Likewise. (linux_supports_tracevforkdone): Likewise. (linux_supports_tracesysgood): Likewise. * common/linux-ptrace.h (HAS_NOMMU): Moved from gdbserver/linux-low.c. (linux_enable_event_reporting): New declaration. (linux_supports_tracefork): Likewise. (linux_supports_traceclone): Likewise. (linux_supports_tracevforkdone): Likewise. (linux_supports_tracesysgood): Likewise. * config.in (PTRACE_TYPE_ARG4): Regenerate. * config/aarch64/linux.mh (NATDEPFILES): Add linux-waitpid.o. * config/alpha/alpha-linux.mh (NATDEPFILES): Likewise. * config/arm/linux.mh (NATDEPFILES): Likewise. * config/i386/linux.mh (NATDEPFILES): Likewise. * config/i386/linux64.mh (NATDEPFILES): Likewise. * config/ia64/linux.mh (NATDEPFILES): Likewise. * config/m32r/linux.mh (NATDEPFILES): Likewise. * config/m68k/linux.mh (NATDEPFILES): Likewise. * config/mips/linux.mh (NATDEPFILES): Likewise. * config/pa/linux.mh (NATDEPFILES): Likewise.. * config/powerpc/linux.mh (NATDEPFILES): Likewise.. * config/powerpc/ppc64-linux.mh (NATDEPFILES): Likewise. * config/powerpc/spu-linux.mh (NATDEPFILES): Likewise. * config/sparc/linux.mh (NATDEPFILES): Likewise. * config/sparc/linux64.mh (NATDEPFILES): Likewise. * config/tilegx/linux.mh (NATDEPFILES): Likewise. * config/xtensa/linux.mh (NATDEPFILES): Likewise. * configure.ac (AC_CACHE_CHECK): Add void * to the list of ptrace's 4th argument's types. Check the type of PTRACE_TYPE_ARG4. * configure: Regenerate. * linux-nat.c: Include nat/linux-nat.h and nat/linux-waitpid.h. (SYSCALL_SIGTRAP): Moved to nat/linux-nat.h. (linux_supports_tracefork_flag): Remove. (linux_supports_tracesysgood_flag): Likewise. (linux_supports_tracevforkdone_flag): Likewise. (current_ptrace_options): Moved to common/linux-ptrace.c. (linux_tracefork_child): Remove. (my_waitpid): Remove. (linux_test_for_tracefork): Renamed to linux_check_ptrace_features and moved to common/linux-ptrace.c. (linux_test_for_tracesysgood): Remove. (linux_supports_tracesysgood): Remove. (linux_supports_tracefork): Remove. (linux_supports_tracevforkdone): Remove. (linux_enable_tracesysgood): Remove. (linux_enable_event_reporting): Remove. (linux_init_ptrace): New function. (linux_child_post_attach): Call linux_init_ptrace. (linux_child_post_startup_inferior): Call linux_init_ptrace. (linux_child_follow_fork): Call linux_supports_tracefork and linux_supports_tracevforkdone. (linux_child_insert_fork_catchpoint): Call linux_supports_tracefork. (linux_child_insert_vfork_catchpoint): Likewise. (linux_child_set_syscall_catchpoint): Call linux_supports_tracesysgood. (lin_lwp_attach_lwp): Call linux_supports_tracefork. * nat/linux-nat.h: New file. * nat/linux-waitpid.c: New file. * nat/linux-waitpid.h: New file. gdb/gdbserver/ * Makefile.in: Explain why ../target and ../nat are not listed as include file search paths. (linux-waitpid.o): New object file rule. * configure.srv (srv_native_linux_obj): New variable. Replace all occurrences of linux native object files with $srv_native_linux_obj. * linux-low.c: Include nat/linux-nat.h and nat/linux-waitpid.h. (HAS_NOMMU): Move defining logic to common/linux-ptrace.c. (linux_enable_event_reporting): Remove declaration. (my_waitpid): Moved to common/linux-waitpid.c. (linux_wait_for_event): Pass ptid when calling linux_enable_event_reporting. (linux_supports_tracefork_flag): Remove. (linux_enable_event_reporting): Likewise. (linux_tracefork_grandchild): Remove. (STACK_SIZE): Moved to common/linux-ptrace.c. (linux_tracefork_child): Remove. (linux_test_for_tracefork): Remove. (linux_look_up_symbols): Call linux_supports_traceclone. (initialize_low): Remove call to linux_test_for_tracefork. * linux-low.h (PTRACE_TYPE_ARG3): Move to common/linux-ptrace.h. (PTRACE_TYPE_ARG4): Likewise. Include linux-ptrace.h.
2013-08-23 01:46:30 +02:00
/* Included for ptrace type definitions. */
Move shared native target specific code to gdb/nat https://sourceware.org/gdb/wiki/Common describes the following directory structure: gdb/nat/ Native target backend files. Code that interfaces with the host debug API. E.g., ptrace code, Windows debug API code, procfs code should go here. gdb/target/ Host-independent, target vector specific code (target_ops). gdb/common/ All other shared code. This commit moves all native target backend files currently in gdb/common to gdb/nat. gdb/ 2014-06-20 Gary Benson <gbenson@redhat.com> * common/gdb_thread_db.h: Moved to nat. All includes updated. * common/glibc_thread_db.h: Likewise. * common/i386-cpuid.h: Likewise. * common/i386-gcc-cpuid.h: Likewise. * common/linux-btrace.h: Likewise. * common/linux-osdata.h: Likewise. * common/linux-procfs.h: Likewise. * common/linux-ptrace.h: Likewise. * common/mips-linux-watch.h: Likewise. * common/linux-btrace.c: Moved to nat. * common/linux-osdata.c: Likewise. * common/linux-procfs.c: Likewise. * common/linux-ptrace.c: Likewise. * common/mips-linux-watch.c: Likewise. * nat/gdb_thread_db.h: Moved from common. * nat/glibc_thread_db.h: Likewise. * nat/i386-cpuid.h: Likewise. * nat/i386-gcc-cpuid.h: Likewise. * nat/linux-btrace.c: Likewise. * nat/linux-btrace.h: Likewise. * nat/linux-osdata.c: Likewise. * nat/linux-osdata.h: Likewise. * nat/linux-procfs.c: Likewise. * nat/linux-procfs.h: Likewise. * nat/linux-ptrace.c: Likewise. * nat/linux-ptrace.h: Likewise. * nat/mips-linux-watch.c: Likewise. * nat/mips-linux-watch.h: Likewise. * Makefile.in (HFILES_NO_SRCDIR): Reflect new locations. (object file files): Reordered. * gdb/copyright.py (EXCLUDE_LIST): Reflect new location of glibc_thread_db.h. gdb/gdbserver/ 2014-06-20 Gary Benson <gbenson@redhat.com> * Makefile.in (SFILES): Update locations for files moved from common to nat. (object file files): Reordered. gdb/testsuite/ 2014-06-20 Gary Benson <gbenson@redhat.com> * gdb.arch/i386-avx.exp: Fix include file location. * gdb.arch/i386-sse.exp: Likewise.
2014-06-19 15:46:38 +02:00
#include "nat/linux-ptrace.h"
#include "target/waitstatus.h" /* For enum target_stop_reason. */
#include "tracepoint.h"
Unify ptrace options discovery code and make both GDB and gdbserver use it. gdb/ * Makefile.in (HFILES_NO_SRCDIR): Add nat/linux-nat.h and nat/linux-waitpid.h. (linux-waitpid.o): New object file rule. * common/linux-ptrace.c: Include nat/linux-waitpid.h. (current_ptrace_options): Moved from linux-nat.c. (linux_ptrace_test_ret_to_nx): Use type casts for ptrace parameters. (linux_fork_to_function): New function. (linux_grandchild_function): Likewise. (linux_child_function): Likewise. (linux_check_ptrace_features): New function, heavily based on linux-nat.c:linux_test_for_tracefork. (linux_enable_event_reporting): New function. (ptrace_supports_feature): Likewise. (linux_supports_tracefork): Likewise. (linux_supports_traceclone): Likewise. (linux_supports_tracevforkdone): Likewise. (linux_supports_tracesysgood): Likewise. * common/linux-ptrace.h (HAS_NOMMU): Moved from gdbserver/linux-low.c. (linux_enable_event_reporting): New declaration. (linux_supports_tracefork): Likewise. (linux_supports_traceclone): Likewise. (linux_supports_tracevforkdone): Likewise. (linux_supports_tracesysgood): Likewise. * config.in (PTRACE_TYPE_ARG4): Regenerate. * config/aarch64/linux.mh (NATDEPFILES): Add linux-waitpid.o. * config/alpha/alpha-linux.mh (NATDEPFILES): Likewise. * config/arm/linux.mh (NATDEPFILES): Likewise. * config/i386/linux.mh (NATDEPFILES): Likewise. * config/i386/linux64.mh (NATDEPFILES): Likewise. * config/ia64/linux.mh (NATDEPFILES): Likewise. * config/m32r/linux.mh (NATDEPFILES): Likewise. * config/m68k/linux.mh (NATDEPFILES): Likewise. * config/mips/linux.mh (NATDEPFILES): Likewise. * config/pa/linux.mh (NATDEPFILES): Likewise.. * config/powerpc/linux.mh (NATDEPFILES): Likewise.. * config/powerpc/ppc64-linux.mh (NATDEPFILES): Likewise. * config/powerpc/spu-linux.mh (NATDEPFILES): Likewise. * config/sparc/linux.mh (NATDEPFILES): Likewise. * config/sparc/linux64.mh (NATDEPFILES): Likewise. * config/tilegx/linux.mh (NATDEPFILES): Likewise. * config/xtensa/linux.mh (NATDEPFILES): Likewise. * configure.ac (AC_CACHE_CHECK): Add void * to the list of ptrace's 4th argument's types. Check the type of PTRACE_TYPE_ARG4. * configure: Regenerate. * linux-nat.c: Include nat/linux-nat.h and nat/linux-waitpid.h. (SYSCALL_SIGTRAP): Moved to nat/linux-nat.h. (linux_supports_tracefork_flag): Remove. (linux_supports_tracesysgood_flag): Likewise. (linux_supports_tracevforkdone_flag): Likewise. (current_ptrace_options): Moved to common/linux-ptrace.c. (linux_tracefork_child): Remove. (my_waitpid): Remove. (linux_test_for_tracefork): Renamed to linux_check_ptrace_features and moved to common/linux-ptrace.c. (linux_test_for_tracesysgood): Remove. (linux_supports_tracesysgood): Remove. (linux_supports_tracefork): Remove. (linux_supports_tracevforkdone): Remove. (linux_enable_tracesysgood): Remove. (linux_enable_event_reporting): Remove. (linux_init_ptrace): New function. (linux_child_post_attach): Call linux_init_ptrace. (linux_child_post_startup_inferior): Call linux_init_ptrace. (linux_child_follow_fork): Call linux_supports_tracefork and linux_supports_tracevforkdone. (linux_child_insert_fork_catchpoint): Call linux_supports_tracefork. (linux_child_insert_vfork_catchpoint): Likewise. (linux_child_set_syscall_catchpoint): Call linux_supports_tracesysgood. (lin_lwp_attach_lwp): Call linux_supports_tracefork. * nat/linux-nat.h: New file. * nat/linux-waitpid.c: New file. * nat/linux-waitpid.h: New file. gdb/gdbserver/ * Makefile.in: Explain why ../target and ../nat are not listed as include file search paths. (linux-waitpid.o): New object file rule. * configure.srv (srv_native_linux_obj): New variable. Replace all occurrences of linux native object files with $srv_native_linux_obj. * linux-low.c: Include nat/linux-nat.h and nat/linux-waitpid.h. (HAS_NOMMU): Move defining logic to common/linux-ptrace.c. (linux_enable_event_reporting): Remove declaration. (my_waitpid): Moved to common/linux-waitpid.c. (linux_wait_for_event): Pass ptid when calling linux_enable_event_reporting. (linux_supports_tracefork_flag): Remove. (linux_enable_event_reporting): Likewise. (linux_tracefork_grandchild): Remove. (STACK_SIZE): Moved to common/linux-ptrace.c. (linux_tracefork_child): Remove. (linux_test_for_tracefork): Remove. (linux_look_up_symbols): Call linux_supports_traceclone. (initialize_low): Remove call to linux_test_for_tracefork. * linux-low.h (PTRACE_TYPE_ARG3): Move to common/linux-ptrace.h. (PTRACE_TYPE_ARG4): Likewise. Include linux-ptrace.h.
2013-08-23 01:46:30 +02:00
gdbserver/linux-low: use std::list to store pending signals Use std::list to store pending signals instead of a manually-managed linked list. This is a refactoring. In the existing code, pending signals are kept in a manually-created linked list with "prev" pointers. A new pending signal is thus inserted to the beginning of the list. When consuming, GDB goes until the end of the list, following the "prev" pointers, and processes the final item. With this patch, a new item is added to the end of the list and the item at the front of the list is consumed. In other words, the list elements used to be stored in reverse order; with this patch, they are stored in their order of arrival. This causes a change in the debug messages that print the pending signals. Otherwise, no behavioral change is expected. gdbserver/ChangeLog: 2020-06-22 Tankut Baris Aktemur <tankut.baris.aktemur@intel.com> Use std::list to stop pending signal instead of manually-created linked list. * linux-low.h: Include <list>. (struct pending_signal): Move here from linux-low.cc. (struct lwp_info) <pending_signals> <pending_signals_to_report>: Update the type. * linux-low.cc (struct pending_signals): Remove. (linux_process_target::delete_lwp) (linux_process_target::add_lwp) (enqueue_one_deferred_signal) (dequeue_one_deferred_signal) (enqueue_pending_signal) (linux_process_target::resume_one_lwp_throw) (linux_process_target::thread_needs_step_over) (linux_process_target::resume_one_thread) (linux_process_target::proceed_one_lwp): Update the use of pending signal list.
2020-06-22 14:13:48 +02:00
#include <list>
#define PTRACE_XFER_TYPE long
#ifdef HAVE_LINUX_REGSETS
* regcache.h (struct thread_info): Forward declare. (struct regcache): New. (new_register_cache): Adjust prototype. (get_thread_regcache): Declare. (free_register_cache): Adjust prototype. (registers_to_string, registers_from_string): Ditto. (supply_register, supply_register_by_name, collect_register) (collect_register_as_string, collect_register_by_name): Ditto. * regcache.c (struct inferior_regcache_data): Delete. (get_regcache): Rename to ... (get_thread_regcache): ... this. Adjust. Switch inferior before fetching registers. (regcache_invalidate_one): Adjust. (regcache_invalidate): Fix prototype. (new_register_cache): Return the new register cache. (free_register_cache): Change prototype. (realloc_register_cache): Adjust. (registers_to_string): Change prototype to take a regcache. Adjust. (registers_from_string): Ditto. (register_data): Ditto. (supply_register): Ditto. (supply_register_by_name): Ditto. (collect_register): Ditto. (collect_register_as_string): Ditto. (collect_register_by_name): Ditto. * server.c (process_serial_event): Adjust. * linux-low.h (regset_fill_func, regset_store_func): Change prototype. (get_pc, set_pc, collect_ptrace_register, supply_ptrace_register): Change prototype. * linux-low.c (get_stop_pc): Adjust. (check_removed_breakpoint): Adjust. (linux_wait_for_event): Adjust. (linux_resume_one_lwp): Adjust. (fetch_register): Add regcache parameter. Adjust. (usr_store_inferior_registers): Ditto. (regsets_fetch_inferior_registers): Ditto. (regsets_store_inferior_registers): Ditto. (linux_fetch_registers, linux_store_registers): Ditto. * i387-fp.c (i387_cache_to_fsave): Change prototype to take a regcache. Adjust. (i387_fsave_to_cache, i387_cache_to_fxsave, i387_fxsave_to_cache): Ditto. * i387-fp.h (i387_cache_to_fsave, i387_fsave_to_cache): Change prototype to take a regcache. (i387_cache_to_fxsave, i387_fxsave_to_cache): Ditto. * remote-utils.c (convert_ascii_to_int, outreg) (prepare_resume_reply): Change prototype to take a regcache. Adjust. * target.h (struct target_ops) <fetch_registers, store_registers>: Change prototype to take a regcache. (fetch_inferior_registers, store_inferior_registers): Change prototype to take a regcache. Adjust. * proc-service.c (ps_lgetregs): Adjust. * linux-x86-low.c (x86_fill_gregset, x86_store_gregset) (x86_fill_fpregset, x86_store_fpregset, x86_fill_fpxregset) (x86_store_fpxregset, x86_get_pc, x86_set_pc): Change prototype to take a regcache. Adjust. * linux-arm-low.c (arm_fill_gregset, arm_store_gregset) (arm_fill_wmmxregset, arm_store_wmmxregset, arm_fill_vfpregset) (arm_store_vfpregset, arm_get_pc, arm_set_pc): (arm_breakpoint_at): Change prototype to take a regcache. Adjust. * linux-cris-low.c (cris_get_pc, cris_set_pc) (cris_cannot_fetch_register): (cris_breakpoint_at): Change prototype to take a regcache. Adjust. * linux-crisv32-low.c (cris_get_pc, cris_set_pc, cris_reinsert_addr, cris_write_data_breakpoint): Change prototype to take a regcache. Adjust. (cris_breakpoint_at, cris_insert_point, cris_remove_point): Adjust. * linux-m32r-low.c (m32r_get_pc, m32r_set_pc): Change prototype to take a regcache. Adjust. * linux-m68k-low.c (m68k_fill_gregset, m68k_store_gregset) (m68k_fill_fpregset, m68k_store_fpregset, m68k_get_pc, (m68k_set_pc): Change prototype to take a regcache. Adjust. * linux-mips-low.c (mips_get_pc): (mips_set_pc): Change prototype to take a regcache. Adjust. (mips_reinsert_addr): Adjust. (mips_collect_register): Change prototype to take a regcache. Adjust. (mips_supply_register): (mips_collect_register_32bit, mips_supply_register_32bit) (mips_fill_gregset, mips_store_gregset, mips_fill_fpregset) (mips_store_fpregset): Ditto. * linux-ppc-low.c (ppc_supply_ptrace_register, ppc_supply_ptrace_register): Ditto. (parse_spufs_run): Adjust. (ppc_get_pc, ppc_set_pc, ppc_fill_gregset, ppc_fill_vsxregset) (ppc_store_vsxregset, ppc_fill_vrregset, ppc_store_vrregset) (ppc_fill_evrregset, ppc_store_evrregset): Change prototype to take a regcache. Adjust. * linux-s390-low.c (s390_collect_ptrace_register) (s390_supply_ptrace_register, s390_fill_gregset, s390_get_pc) (s390_set_pc): Change prototype to take a regcache. Adjust. (s390_arch_setup): Adjust. * linux-sh-low.c (sh_get_pc, sh_breakpoint_at) (sh_fill_gregset): Change prototype to take a regcache. Adjust. * linux-sparc-low.c (sparc_fill_gregset_to_stack) (sparc_fill_gregset, sparc_store_gregset_from_stack) (sparc_store_gregset, sparc_get_pc): Change prototype to take a regcache. Adjust. (sparc_breakpoint_at): Adjust. * linux-xtensa-low.c (xtensa_fill_gregset): (xtensa_store_gregset): (xtensa_fill_xtregset, xtensa_store_xtregset, xtensa_get_pc) (xtensa_set_pc): Change prototype to take a regcache. Adjust. * nto-low.c (nto_fetch_registers, nto_store_registers): Change prototype to take a regcache. Adjust. * win32-arm-low.c (arm_fetch_inferior_register) (arm_store_inferior_register): Change prototype to take a regcache. Adjust. * win32-i386-low.c (i386_fetch_inferior_register) (i386_store_inferior_register): Change prototype to take a regcache. Adjust. * win32-low.c (child_fetch_inferior_registers) (child_store_inferior_registers): Change prototype to take a regcache. Adjust. (win32_wait): Adjust. (win32_fetch_inferior_registers): Change prototype to take a regcache. Adjust. (win32_store_inferior_registers): Adjust. * win32-low.h (struct win32_target_ops) <fetch_inferior_register, store_inferior_register>: Change prototype to take a regcache.
2010-01-20 23:55:38 +01:00
typedef void (*regset_fill_func) (struct regcache *, void *);
typedef void (*regset_store_func) (struct regcache *, const void *);
2002-06-11 Daniel Jacobowitz <drow@mvista.com> * gdbserver/thread-db.c: New file. * gdbserver/proc-service.c: New file. * gdbserver/acinclude.m4: New file. * gdbserver/Makefile.in: Add GDBSERVER_LIBS, gdb_proc_service_h, proc-service.o, and thread-db.o. (linux-low.o): Add USE_THREAD_DB. * gdbserver/acconfig.h: Add HAVE_PRGREGSET_T, HAVE_PRFPREGSET_T, HAVE_LWPID_T, HAVE_PSADDR_T, and PRFPREGSET_T_BROKEN. * gdbserver/aclocal.m4: Regenerated. * gdbserver/config.in: Regenerated. * gdbserver/configure: Regenerated. * gdbserver/configure.in: Check for proc_service.h, sys/procfs.h, thread_db.h, and linux/elf.h headrs. Check for lwpid_t, psaddr_t, prgregset_t, prfpregset_t, and PRFPREGSET_T_BROKEN. Introduce srv_thread_depfiles and USE_THREAD_DB. Check for -lthread_db and thread support. * gdbserver/configure.srv: Enable thread_db support for ARM, i386, MIPS, PowerPC, and SuperH. * gdbserver/i387-fp.c: Constify arguments. * gdbserver/i387-fp.h: Likewise. * gdbserver/inferiors.c: (struct thread_info): Renamed from `struct inferior_info'. Remove PID member. Use generic inferior list header. All uses updated. (inferiors, signal_pid): Removed. (all_threads): New variable. (get_thread): Define. (add_inferior_to_list): New function. (for_each_inferior): New function. (change_inferior_id): New function. (add_inferior): Removed. (remove_inferior): New function. (add_thread): New function. (free_one_thread): New function. (remove_thread): New function. (clear_inferiors): Use for_each_inferior and free_one_thread. (find_inferior): New function. (find_inferior_id): New function. (inferior_target_data): Update argument type. (set_inferior_target_data): Likewise. (inferior_regcache_data): Likewise. (set_inferior_regcache_data): Likewise. * gdbserver/linux-low.c (linux_bp_reinsert): Remove. (all_processes, stopping_threads, using_thrads) (struct pending_signals, debug_threads, pid_of): New. (inferior_pid): Replace with macro. (struct inferior_linux_data): Remove. (get_stop_pc, add_process): New functions. (linux_create_inferior): Restore SIGRTMIN+1 before calling exec. Use add_process and add_thread. (linux_attach_lwp): New function, based on old linux_attach. Use add_process and add_thread. Set stop_expected for new threads. (linux_attach): New function. (linux_kill_one_process): New function. (linux_kill): Kill all LWPs. (linux_thread_alive): Use find_inferior_id. (check_removed_breakpoints, status_pending_p): New functions. (linux_wait_for_process): Renamed from linux_wait_for_one_inferior. Update. Use WNOHANG. Wait for cloned processes also. Update process struct for the found process. (linux_wait_for_event): New function. (linux_wait): Use it. Support LWPs. (send_sigstop, wait_for_sigstop, stop_all_processes) (linux_resume_one_process, linux_continue_one_process): New functions. (linux_resume): Support LWPs. (REGISTER_RAW_SIZE): Remove. (fetch_register): Use register_size instead. Call supply_register. (usr_store_inferior_registers): Likewise. Call collect_register. Fix recursive case. (regsets_fetch_inferior_registers): Improve error message. (regsets_store_inferior_registers): Add debugging. (linux_look_up_symbols): Call thread_db_init if USE_THREAD_DB. (unstopped_p, linux_signal_pid): New functions. (linux_target_ops): Add linux_signal_pid. (linux_init_signals): New function. (initialize_low): Call it. Initialize using_threads. * gdbserver/regcache.c (inferior_regcache_data): Add valid flag. (get_regcache): Fetch registers lazily. Add fetch argument and update all callers. (regcache_invalidate_one, regcache_invalidate): New functions. (new_register_cache): Renamed from create_register_cache. Return the new regcache. (free_register_cache): Change argument to a void *. (registers_to_string, registers_from_string): Call get_regcache with fetch flag set. (register_data): Make static. Pass fetch flag to get_regcache. (supply_register): Call get_regcache with fetch flag clear. (collect_register): Call get_regcache with fetch flag set. (collect_register_as_string): New function. * gdbserver/regcache.h: Update. * gdbserver/remote-utils.c (putpkt): Flush after debug output and use stderr. Handle input interrupts while waiting for an ACK. (input_interrupt): Use signal_pid method. (getpkt): Flush after debug output and use stderr. (outreg): Use collect_register_as_string. (new_thread_notify, dead_thread_notify): New functions. (prepare_resume_reply): Check using_threads. Set thread_from_wait and general_thread. (look_up_one_symbol): Flush after debug output. * gdbserver/server.c (step_thread, server_waiting): New variables. (start_inferior): Don't use signal_pid. Update call to mywait. (attach_inferior): Update call to mywait. (handle_query): Handle qfThreadInfo and qsThreadInfo. (main): Don't fetch/store registers explicitly. Use set_desired_inferior. Support proposed ``Hs'' packet. Update calls to mywait. * gdbserver/server.h: Update. (struct inferior_list, struct_inferior_list_entry): New. * gdbserver/target.c (set_desired_inferior): New. (write_inferior_memory): Constify. (mywait): New function. * gdbserver/target.h: Update. (struct target_ops): New signal_pid method. (mywait): Removed macro, added prototype. * gdbserver/linux-low.h (regset_func): Removed. (regset_fill_func, regset_store_func): New. (enum regset_type): New. (struct regset_info): Add type field. Use new operation types. (struct linux_target_ops): stop_pc renamed to get_pc. Add decr_pc_after_break and breakpoint_at. (get_process, get_thread_proess, get_process_thread) (strut process_info, all_processes, linux_attach_lwp) (thread_db_init): New. * gdbserver/linux-arm-low.c (arm_get_pc, arm_set_pc, arm_breakpoint, arm_breakpoint_len, arm_breakpoint_at): New. (the_low_target): Add new members. * gdbserver/linux-i386-low.c (i386_store_gregset, i386_store_fpregset) (i386_store_fpxregset): Constify. (target_regsets): Add new kind identifier. (i386_get_pc): Renamed from i386_stop_pc. Simplify. (i386_set_pc): Add debugging. (i386_breakpoint_at): New function. (the_low_target): Add new members. * gdbserver/linux-mips-low.c (mips_get_pc, mips_set_pc) (mips_breakpoint, mips_breakpoint_len, mips_reinsert_addr) (mips_breakpoint_at): New. (the_low_target): Add new members. * gdbserver/linux-ppc-low.c (ppc_get_pc, ppc_set_pc) (ppc_breakpoint, ppc_breakpoint_len, ppc_breakpoint_at): New. (the_low_target): Add new members. * gdbserver/linux-sh-low.c (sh_get_pc, sh_set_pc) (sh_breakpoint, sh_breakpoint_len, sh_breakpoint_at): New. (the_low_target): Add new members. * gdbserver/linux-x86-64-low.c (target_regsets): Add new kind identifier.
2002-06-11 19:32:40 +02:00
enum regset_type {
GENERAL_REGS,
FP_REGS,
EXTENDED_REGS,
OPTIONAL_REGS, /* Do not error if the regset cannot be accessed. */
2002-06-11 Daniel Jacobowitz <drow@mvista.com> * gdbserver/thread-db.c: New file. * gdbserver/proc-service.c: New file. * gdbserver/acinclude.m4: New file. * gdbserver/Makefile.in: Add GDBSERVER_LIBS, gdb_proc_service_h, proc-service.o, and thread-db.o. (linux-low.o): Add USE_THREAD_DB. * gdbserver/acconfig.h: Add HAVE_PRGREGSET_T, HAVE_PRFPREGSET_T, HAVE_LWPID_T, HAVE_PSADDR_T, and PRFPREGSET_T_BROKEN. * gdbserver/aclocal.m4: Regenerated. * gdbserver/config.in: Regenerated. * gdbserver/configure: Regenerated. * gdbserver/configure.in: Check for proc_service.h, sys/procfs.h, thread_db.h, and linux/elf.h headrs. Check for lwpid_t, psaddr_t, prgregset_t, prfpregset_t, and PRFPREGSET_T_BROKEN. Introduce srv_thread_depfiles and USE_THREAD_DB. Check for -lthread_db and thread support. * gdbserver/configure.srv: Enable thread_db support for ARM, i386, MIPS, PowerPC, and SuperH. * gdbserver/i387-fp.c: Constify arguments. * gdbserver/i387-fp.h: Likewise. * gdbserver/inferiors.c: (struct thread_info): Renamed from `struct inferior_info'. Remove PID member. Use generic inferior list header. All uses updated. (inferiors, signal_pid): Removed. (all_threads): New variable. (get_thread): Define. (add_inferior_to_list): New function. (for_each_inferior): New function. (change_inferior_id): New function. (add_inferior): Removed. (remove_inferior): New function. (add_thread): New function. (free_one_thread): New function. (remove_thread): New function. (clear_inferiors): Use for_each_inferior and free_one_thread. (find_inferior): New function. (find_inferior_id): New function. (inferior_target_data): Update argument type. (set_inferior_target_data): Likewise. (inferior_regcache_data): Likewise. (set_inferior_regcache_data): Likewise. * gdbserver/linux-low.c (linux_bp_reinsert): Remove. (all_processes, stopping_threads, using_thrads) (struct pending_signals, debug_threads, pid_of): New. (inferior_pid): Replace with macro. (struct inferior_linux_data): Remove. (get_stop_pc, add_process): New functions. (linux_create_inferior): Restore SIGRTMIN+1 before calling exec. Use add_process and add_thread. (linux_attach_lwp): New function, based on old linux_attach. Use add_process and add_thread. Set stop_expected for new threads. (linux_attach): New function. (linux_kill_one_process): New function. (linux_kill): Kill all LWPs. (linux_thread_alive): Use find_inferior_id. (check_removed_breakpoints, status_pending_p): New functions. (linux_wait_for_process): Renamed from linux_wait_for_one_inferior. Update. Use WNOHANG. Wait for cloned processes also. Update process struct for the found process. (linux_wait_for_event): New function. (linux_wait): Use it. Support LWPs. (send_sigstop, wait_for_sigstop, stop_all_processes) (linux_resume_one_process, linux_continue_one_process): New functions. (linux_resume): Support LWPs. (REGISTER_RAW_SIZE): Remove. (fetch_register): Use register_size instead. Call supply_register. (usr_store_inferior_registers): Likewise. Call collect_register. Fix recursive case. (regsets_fetch_inferior_registers): Improve error message. (regsets_store_inferior_registers): Add debugging. (linux_look_up_symbols): Call thread_db_init if USE_THREAD_DB. (unstopped_p, linux_signal_pid): New functions. (linux_target_ops): Add linux_signal_pid. (linux_init_signals): New function. (initialize_low): Call it. Initialize using_threads. * gdbserver/regcache.c (inferior_regcache_data): Add valid flag. (get_regcache): Fetch registers lazily. Add fetch argument and update all callers. (regcache_invalidate_one, regcache_invalidate): New functions. (new_register_cache): Renamed from create_register_cache. Return the new regcache. (free_register_cache): Change argument to a void *. (registers_to_string, registers_from_string): Call get_regcache with fetch flag set. (register_data): Make static. Pass fetch flag to get_regcache. (supply_register): Call get_regcache with fetch flag clear. (collect_register): Call get_regcache with fetch flag set. (collect_register_as_string): New function. * gdbserver/regcache.h: Update. * gdbserver/remote-utils.c (putpkt): Flush after debug output and use stderr. Handle input interrupts while waiting for an ACK. (input_interrupt): Use signal_pid method. (getpkt): Flush after debug output and use stderr. (outreg): Use collect_register_as_string. (new_thread_notify, dead_thread_notify): New functions. (prepare_resume_reply): Check using_threads. Set thread_from_wait and general_thread. (look_up_one_symbol): Flush after debug output. * gdbserver/server.c (step_thread, server_waiting): New variables. (start_inferior): Don't use signal_pid. Update call to mywait. (attach_inferior): Update call to mywait. (handle_query): Handle qfThreadInfo and qsThreadInfo. (main): Don't fetch/store registers explicitly. Use set_desired_inferior. Support proposed ``Hs'' packet. Update calls to mywait. * gdbserver/server.h: Update. (struct inferior_list, struct_inferior_list_entry): New. * gdbserver/target.c (set_desired_inferior): New. (write_inferior_memory): Constify. (mywait): New function. * gdbserver/target.h: Update. (struct target_ops): New signal_pid method. (mywait): Removed macro, added prototype. * gdbserver/linux-low.h (regset_func): Removed. (regset_fill_func, regset_store_func): New. (enum regset_type): New. (struct regset_info): Add type field. Use new operation types. (struct linux_target_ops): stop_pc renamed to get_pc. Add decr_pc_after_break and breakpoint_at. (get_process, get_thread_proess, get_process_thread) (strut process_info, all_processes, linux_attach_lwp) (thread_db_init): New. * gdbserver/linux-arm-low.c (arm_get_pc, arm_set_pc, arm_breakpoint, arm_breakpoint_len, arm_breakpoint_at): New. (the_low_target): Add new members. * gdbserver/linux-i386-low.c (i386_store_gregset, i386_store_fpregset) (i386_store_fpxregset): Constify. (target_regsets): Add new kind identifier. (i386_get_pc): Renamed from i386_stop_pc. Simplify. (i386_set_pc): Add debugging. (i386_breakpoint_at): New function. (the_low_target): Add new members. * gdbserver/linux-mips-low.c (mips_get_pc, mips_set_pc) (mips_breakpoint, mips_breakpoint_len, mips_reinsert_addr) (mips_breakpoint_at): New. (the_low_target): Add new members. * gdbserver/linux-ppc-low.c (ppc_get_pc, ppc_set_pc) (ppc_breakpoint, ppc_breakpoint_len, ppc_breakpoint_at): New. (the_low_target): Add new members. * gdbserver/linux-sh-low.c (sh_get_pc, sh_set_pc) (sh_breakpoint, sh_breakpoint_len, sh_breakpoint_at): New. (the_low_target): Add new members. * gdbserver/linux-x86-64-low.c (target_regsets): Add new kind identifier.
2002-06-11 19:32:40 +02:00
};
/* The arch's regsets array initializer must be terminated with a NULL
regset. */
#define NULL_REGSET \
{ 0, 0, 0, -1, (enum regset_type) -1, NULL, NULL }
struct regset_info
{
int get_request, set_request;
Add x86 AVX support to gdbserver. 2010-04-07 H.J. Lu <hongjiu.lu@intel.com> * Makefile.in (clean): Updated. (i386-avx.o): New. (i386-avx.c): Likewise. (i386-avx-linux.o): Likewise. (i386-avx-linux.c): Likewise. (amd64-avx.o): Likewise. (amd64-avx.c): Likewise. (amd64-avx-linux.o): Likewise. (amd64-avx-linux.c): Likewise. * configure.srv (srv_i386_regobj): Add i386-avx.o. (srv_i386_linux_regobj): Add i386-avx-linux.o. (srv_amd64_regobj): Add amd64-avx.o. (srv_amd64_linux_regobj): Add amd64-avx-linux.o. (srv_i386_32bit_xmlfiles): Add i386/32bit-avx.xml. (srv_i386_64bit_xmlfiles): Add i386/64bit-avx.xml. (srv_i386_xmlfiles): Add i386/i386-avx.xml. (srv_amd64_xmlfiles): Add i386/amd64-avx.xml. (srv_i386_linux_xmlfiles): Add i386/i386-avx-linux.xml. (srv_amd64_linux_xmlfiles): Add i386/amd64-avx-linux.xml. * i387-fp.c: Include "i386-xstate.h". (i387_xsave): New. (i387_cache_to_xsave): Likewise. (i387_xsave_to_cache): Likewise. (x86_xcr0): Likewise. * i387-fp.h (i387_cache_to_xsave): Likewise. (i387_xsave_to_cache): Likewise. (x86_xcr0): Likewise. * linux-arm-low.c (target_regsets): Initialize nt_type to 0. * linux-crisv32-low.c (target_regsets): Likewise. * linux-m68k-low.c (target_regsets): Likewise. * linux-mips-low.c (target_regsets): Likewise. * linux-ppc-low.c (target_regsets): Likewise. * linux-s390-low.c (target_regsets): Likewise. * linux-sh-low.c (target_regsets): Likewise. * linux-sparc-low.c (target_regsets): Likewise. * linux-xtensa-low.c (target_regsets): Likewise. * linux-low.c: Include <sys/uio.h>. (regsets_fetch_inferior_registers): Support nt_type. (regsets_store_inferior_registers): Likewise. (linux_process_qsupported): New. (linux_target_ops): Add linux_process_qsupported. * linux-low.h (regset_info): Add nt_type. (linux_target_ops): Add process_qsupported. * linux-x86-low.c: Include "i386-xstate.h", "elf/common.h" and <sys/uio.h>. (init_registers_i386_avx_linux): New. (init_registers_amd64_avx_linux): Likewise. (xmltarget_i386_linux_no_xml): Likewise. (xmltarget_amd64_linux_no_xml): Likewise. (PTRACE_GETREGSET): Likewise. (PTRACE_SETREGSET): Likewise. (x86_fill_xstateregset): Likewise. (x86_store_xstateregset): Likewise. (use_xml): Likewise. (x86_linux_update_xmltarget): Likewise. (x86_linux_process_qsupported): Likewise. (target_regsets): Add NT_X86_XSTATE entry and Initialize nt_type. (x86_arch_setup): Don't call init_registers_amd64_linux nor init_registers_i386_linux here. Call x86_linux_update_xmltarget. (the_low_target): Add x86_linux_process_qsupported. * server.c (handle_query): Call target_process_qsupported. * target.h (target_ops): Add process_qsupported. (target_process_qsupported): New.
2010-04-07 20:49:46 +02:00
/* If NT_TYPE isn't 0, it will be passed to ptrace as the 3rd
argument and the 4th argument should be "const struct iovec *". */
int nt_type;
int size;
2002-06-11 Daniel Jacobowitz <drow@mvista.com> * gdbserver/thread-db.c: New file. * gdbserver/proc-service.c: New file. * gdbserver/acinclude.m4: New file. * gdbserver/Makefile.in: Add GDBSERVER_LIBS, gdb_proc_service_h, proc-service.o, and thread-db.o. (linux-low.o): Add USE_THREAD_DB. * gdbserver/acconfig.h: Add HAVE_PRGREGSET_T, HAVE_PRFPREGSET_T, HAVE_LWPID_T, HAVE_PSADDR_T, and PRFPREGSET_T_BROKEN. * gdbserver/aclocal.m4: Regenerated. * gdbserver/config.in: Regenerated. * gdbserver/configure: Regenerated. * gdbserver/configure.in: Check for proc_service.h, sys/procfs.h, thread_db.h, and linux/elf.h headrs. Check for lwpid_t, psaddr_t, prgregset_t, prfpregset_t, and PRFPREGSET_T_BROKEN. Introduce srv_thread_depfiles and USE_THREAD_DB. Check for -lthread_db and thread support. * gdbserver/configure.srv: Enable thread_db support for ARM, i386, MIPS, PowerPC, and SuperH. * gdbserver/i387-fp.c: Constify arguments. * gdbserver/i387-fp.h: Likewise. * gdbserver/inferiors.c: (struct thread_info): Renamed from `struct inferior_info'. Remove PID member. Use generic inferior list header. All uses updated. (inferiors, signal_pid): Removed. (all_threads): New variable. (get_thread): Define. (add_inferior_to_list): New function. (for_each_inferior): New function. (change_inferior_id): New function. (add_inferior): Removed. (remove_inferior): New function. (add_thread): New function. (free_one_thread): New function. (remove_thread): New function. (clear_inferiors): Use for_each_inferior and free_one_thread. (find_inferior): New function. (find_inferior_id): New function. (inferior_target_data): Update argument type. (set_inferior_target_data): Likewise. (inferior_regcache_data): Likewise. (set_inferior_regcache_data): Likewise. * gdbserver/linux-low.c (linux_bp_reinsert): Remove. (all_processes, stopping_threads, using_thrads) (struct pending_signals, debug_threads, pid_of): New. (inferior_pid): Replace with macro. (struct inferior_linux_data): Remove. (get_stop_pc, add_process): New functions. (linux_create_inferior): Restore SIGRTMIN+1 before calling exec. Use add_process and add_thread. (linux_attach_lwp): New function, based on old linux_attach. Use add_process and add_thread. Set stop_expected for new threads. (linux_attach): New function. (linux_kill_one_process): New function. (linux_kill): Kill all LWPs. (linux_thread_alive): Use find_inferior_id. (check_removed_breakpoints, status_pending_p): New functions. (linux_wait_for_process): Renamed from linux_wait_for_one_inferior. Update. Use WNOHANG. Wait for cloned processes also. Update process struct for the found process. (linux_wait_for_event): New function. (linux_wait): Use it. Support LWPs. (send_sigstop, wait_for_sigstop, stop_all_processes) (linux_resume_one_process, linux_continue_one_process): New functions. (linux_resume): Support LWPs. (REGISTER_RAW_SIZE): Remove. (fetch_register): Use register_size instead. Call supply_register. (usr_store_inferior_registers): Likewise. Call collect_register. Fix recursive case. (regsets_fetch_inferior_registers): Improve error message. (regsets_store_inferior_registers): Add debugging. (linux_look_up_symbols): Call thread_db_init if USE_THREAD_DB. (unstopped_p, linux_signal_pid): New functions. (linux_target_ops): Add linux_signal_pid. (linux_init_signals): New function. (initialize_low): Call it. Initialize using_threads. * gdbserver/regcache.c (inferior_regcache_data): Add valid flag. (get_regcache): Fetch registers lazily. Add fetch argument and update all callers. (regcache_invalidate_one, regcache_invalidate): New functions. (new_register_cache): Renamed from create_register_cache. Return the new regcache. (free_register_cache): Change argument to a void *. (registers_to_string, registers_from_string): Call get_regcache with fetch flag set. (register_data): Make static. Pass fetch flag to get_regcache. (supply_register): Call get_regcache with fetch flag clear. (collect_register): Call get_regcache with fetch flag set. (collect_register_as_string): New function. * gdbserver/regcache.h: Update. * gdbserver/remote-utils.c (putpkt): Flush after debug output and use stderr. Handle input interrupts while waiting for an ACK. (input_interrupt): Use signal_pid method. (getpkt): Flush after debug output and use stderr. (outreg): Use collect_register_as_string. (new_thread_notify, dead_thread_notify): New functions. (prepare_resume_reply): Check using_threads. Set thread_from_wait and general_thread. (look_up_one_symbol): Flush after debug output. * gdbserver/server.c (step_thread, server_waiting): New variables. (start_inferior): Don't use signal_pid. Update call to mywait. (attach_inferior): Update call to mywait. (handle_query): Handle qfThreadInfo and qsThreadInfo. (main): Don't fetch/store registers explicitly. Use set_desired_inferior. Support proposed ``Hs'' packet. Update calls to mywait. * gdbserver/server.h: Update. (struct inferior_list, struct_inferior_list_entry): New. * gdbserver/target.c (set_desired_inferior): New. (write_inferior_memory): Constify. (mywait): New function. * gdbserver/target.h: Update. (struct target_ops): New signal_pid method. (mywait): Removed macro, added prototype. * gdbserver/linux-low.h (regset_func): Removed. (regset_fill_func, regset_store_func): New. (enum regset_type): New. (struct regset_info): Add type field. Use new operation types. (struct linux_target_ops): stop_pc renamed to get_pc. Add decr_pc_after_break and breakpoint_at. (get_process, get_thread_proess, get_process_thread) (strut process_info, all_processes, linux_attach_lwp) (thread_db_init): New. * gdbserver/linux-arm-low.c (arm_get_pc, arm_set_pc, arm_breakpoint, arm_breakpoint_len, arm_breakpoint_at): New. (the_low_target): Add new members. * gdbserver/linux-i386-low.c (i386_store_gregset, i386_store_fpregset) (i386_store_fpxregset): Constify. (target_regsets): Add new kind identifier. (i386_get_pc): Renamed from i386_stop_pc. Simplify. (i386_set_pc): Add debugging. (i386_breakpoint_at): New function. (the_low_target): Add new members. * gdbserver/linux-mips-low.c (mips_get_pc, mips_set_pc) (mips_breakpoint, mips_breakpoint_len, mips_reinsert_addr) (mips_breakpoint_at): New. (the_low_target): Add new members. * gdbserver/linux-ppc-low.c (ppc_get_pc, ppc_set_pc) (ppc_breakpoint, ppc_breakpoint_len, ppc_breakpoint_at): New. (the_low_target): Add new members. * gdbserver/linux-sh-low.c (sh_get_pc, sh_set_pc) (sh_breakpoint, sh_breakpoint_len, sh_breakpoint_at): New. (the_low_target): Add new members. * gdbserver/linux-x86-64-low.c (target_regsets): Add new kind identifier.
2002-06-11 19:32:40 +02:00
enum regset_type type;
regset_fill_func fill_function;
regset_store_func store_function;
};
[GDBserver] Multi-process + multi-arch This patch makes GDBserver support multi-process + biarch. Currently, if you're debugging more than one process at once with a single gdbserver (in extended-remote mode), then all processes must have the same architecture (e.g., 64-bit vs 32-bit). Otherwise, you see this: Added inferior 2 [Switching to inferior 2 [<null>] (<noexec>)] Reading symbols from /home/pedro/gdb/tests/main32...done. Temporary breakpoint 2 at 0x4004cf: main. (2 locations) Starting program: /home/pedro/gdb/tests/main32 warning: Selected architecture i386 is not compatible with reported target architecture i386:x86-64 warning: Architecture rejected target-supplied description Remote 'g' packet reply is too long: 000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000090cfffff0000000000000000000000000000000000000000000000000000000000020000000000000000000000000000000000000000000000000000000000000000000000000000b042f7460000000000020000230000002b0000002b0000002b000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000007f03000000000000ffff0000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000801f00003b0000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000 ... etc, etc ... Even though the process was running a 32-bit program, GDBserver sent back to GDB a register set in 64-bit layout. A patch (http://sourceware.org/ml/gdb-patches/2012-11/msg00228.html) a while ago made GDB track a target_gdbarch per inferior, and as consequence, fetch a target description per-inferior. This patch is the GDBserver counterpart, that makes GDBserver keep track of each process'es XML target description and register layout. So in the example above, GDBserver will send the correct register set in 32-bit layout to GDB. A new "struct target_desc" object (tdesc for short) is added, that holds the target description and register layout information about each process. Each `struct process_info' holds a pointer to a target description. The regcache also gains a pointer to a target description, mainly for convenience, and parallel with GDB (and possible future support for programs that flip processor modes). The low target's arch_setup routines are responsible for setting the process'es correct tdesc. This isn't that much different to how things were done before, except that instead of detecting the inferior process'es architecture and calling the corresponding init_registers_FOO routine, which would change the regcache layout globals and recreate the threads' regcaches, the regcache.c globals are gone, and the init_registers_$BAR routines now each initialize a separate global struct target_desc object (one for each arch variant GDBserver supports), and so all the init_registers_$BAR routines that are built into GDBserver are called early at GDBserver startup time (similarly to how GDB handles its built-in target descriptions), and then the arch_setup routine is responsible for making process_info->tdesc point to one of these target description globals. The regcache module is all parameterized to get the regcache's layout from the tdesc object instead of the old register_bytes, etc. globals. The threads' regcaches are now created lazily. The old scheme where we created each of them when we added a new thread doesn't work anymore, because we add the main thread/lwp before we see it stop for the first time, and it is only when we see the thread stop for the first time that we have a chance of determining the inferior's architecture (through the_low_target.arch_setup). Therefore when we add the main thread we don't know which architecture/tdesc its regcache should have. This patch makes the gdb.multi/multi-arch.exp test now pass against (extended-remote) GDBserver. It currently fails, without this patch. The IPA also uses the regcache, so it gains a new global struct target_desc pointer, which points at the description of the process it is loaded in. Re. the linux-low.c & friends changes. Since the register map etc. may differ between processes (64-bit vs 32-bit) etc., the linux_target_ops num_regs, regmap and regset_bitmap data fields are no longer sufficient. A new method is added in their place that returns a pointer to a new struct that includes all info linux-low.c needs to access registers of the current inferior. The patch/discussion that originally introduced linux-low.c:disabled_regsets mentions that the disabled_regsets set may be different per mode (in a biarch setup), and indeed that is cleared whenever we start a new (first) inferior, so that global is moved as well behind the new `struct regs_info'. On the x86 side: I simply replaced the i387-fp.c:num_xmm_registers global with a check for 64-bit or 32-bit process, which is equivalent to how the global was set. This avoided coming up with some more general mechanism that would work for all targets that use this module (GNU/Linux, Windows, etc.). Tested: GNU/Linux IA64 GNU/Linux MIPS64 GNU/Linux PowerPC (Fedora 16) GNU/Linux s390x (Fedora 16) GNU/Linux sparc64 (Debian) GNU/Linux x86_64, -m64 and -m32 (Fedora 17) Cross built, and smoke tested: i686-w64-mingw32, under Wine. GNU/Linux TI C6x, by Yao Qi. Cross built but otherwise not tested: aarch64-linux-gnu arm-linux-gnu m68k-linux nios2-linux-gnu sh-linux-gnu spu tilegx-unknown-linux-gnu Completely untested: GNU/Linux Blackfin GNU/Linux CRIS GNU/Linux CRISv32 GNU/Linux TI Xtensa GNU/Linux M32R LynxOS QNX NTO gdb/gdbserver/ 2013-06-07 Pedro Alves <palves@redhat.com> * Makefile.in (OBS): Add tdesc.o. (IPA_OBJS): Add tdesc-ipa.o. (tdesc-ipa.o): New rule. * ax.c (gdb_eval_agent_expr): Adjust register_size call to new interface. * linux-low.c (new_inferior): Delete. (disabled_regsets, num_regsets): Delete. (linux_add_process): Adjust to set the new per-process new_inferior flag. (linux_detach_one_lwp): Adjust to call regcache_invalidate_thread. (linux_wait_for_lwp): Adjust. Only call arch_setup if the event was a stop. When calling arch_setup, switch the current inferior to the thread that got an event. (linux_resume_one_lwp): Adjust to call regcache_invalidate_thread. (regsets_fetch_inferior_registers) (regsets_store_inferior_registers): New regsets_info parameter. Adjust to use it. (linux_register_in_regsets): New regs_info parameter. Adjust to use it. (register_addr, fetch_register, store_register): New usrregs_info parameter. Adjust to use it. (usr_fetch_inferior_registers, usr_store_inferior_registers): New parameter regs_info. Adjust to use it. (linux_fetch_registers): Get the current inferior's regs_info, and adjust to use it. (linux_store_registers): Ditto. [HAVE_LINUX_REGSETS] (initialize_regsets_info): New. (initialize_low): Don't initialize the target_regsets here. Call initialize_low_arch. * linux-low.h (target_regsets): Delete declaration. (struct regsets_info): New. (struct usrregs_info): New. (struct regs_info): New. (struct process_info_private) <new_inferior>: New field. (struct linux_target_ops): Delete the num_regs, regmap, and regset_bitmap fields. New field regs_info. [HAVE_LINUX_REGSETS] (initialize_regsets_info): Declare. * i387-fp.c (num_xmm_registers): Delete. (i387_cache_to_fsave, i387_fsave_to_cache): Adjust find_regno calls to new interface. (i387_cache_to_fxsave, i387_cache_to_xsave, i387_fxsave_to_cache) (i387_xsave_to_cache): Adjust find_regno calls to new interface. Infer the number of xmm registers from the regcache's target description. * i387-fp.h (num_xmm_registers): Delete. * inferiors.c (add_thread): Don't install the thread's regcache here. * proc-service.c (gregset_info): Fetch the current inferior's regs_info. Adjust to use it. * regcache.c: Include tdesc.h. (register_bytes, reg_defs, num_registers) (gdbserver_expedite_regs): Delete. (get_thread_regcache): If the thread doesn't have a regcache yet, create one, instead of aborting gdbserver. (regcache_invalidate_one): Rename to ... (regcache_invalidate_thread): ... this. (regcache_invalidate_one): New. (regcache_invalidate): Only invalidate registers of the current process. (init_register_cache): Add target_desc parameter, and use it. (new_register_cache): Ditto. Assert the target description has a non zero registers_size. (regcache_cpy): Add assertions. Adjust. (realloc_register_cache, set_register_cache): Delete. (registers_to_string, registers_from_string): Adjust. (find_register_by_name, find_regno, find_register_by_number) (register_cache_size): Add target_desc parameter, and use it. (free_register_cache_thread, free_register_cache_thread_one) (regcache_release, register_cache_size): New. (register_size): Add target_desc parameter, and use it. (register_data, supply_register, supply_register_zeroed) (supply_regblock, supply_register_by_name, collect_register) (collect_register_as_string, collect_register_by_name): Adjust. * regcache.h (struct target_desc): Forward declare. (struct regcache) <tdesc>: New field. (init_register_cache, new_register_cache): Add target_desc parameter. (regcache_invalidate_thread): Declare. (regcache_invalidate_one): Delete declaration. (regcache_release): Declare. (find_register_by_number, register_cache_size, register_size) (find_regno): Add target_desc parameter. (gdbserver_expedite_regs, gdbserver_xmltarget): Delete declarations. * remote-utils.c: Include tdesc.h. (outreg, prepare_resume_reply): Adjust. * server.c: Include tdesc.h. (gdbserver_xmltarget): Delete declaration. (get_features_xml, process_serial_event): Adjust. * server.h [IN_PROCESS_AGENT] (struct target_desc): Forward declare. (struct process_info) <tdesc>: New field. (ipa_tdesc): Declare. * tdesc.c: New file. * tdesc.h: New file. * tracepoint.c: Include tdesc.h. [IN_PROCESS_AGENT] (ipa_tdesc): Define. (get_context_regcache): Adjust to pass ipa_tdesc down. (do_action_at_tracepoint): Adjust to get the register cache size from the context regcache's description. (traceframe_walk_blocks): Adjust to get the register cache size from the current trace frame's description. (traceframe_get_pc): Adjust to get current trace frame's description and pass it down. (gdb_collect): Adjust to get the register cache size from the IPA's description. * linux-amd64-ipa.c (tdesc_amd64_linux): Declare. (gdbserver_xmltarget): Delete. (initialize_low_tracepoint): Set the ipa's target description. * linux-i386-ipa.c (tdesc_i386_linux): Declare. (initialize_low_tracepoint): Set the ipa's target description. * linux-x86-low.c: Include tdesc.h. [__x86_64__] (is_64bit_tdesc): New. (ps_get_thread_area, x86_get_thread_area): Use it. (i386_cannot_store_register): Rename to ... (x86_cannot_store_register): ... this. Use is_64bit_tdesc. (i386_cannot_fetch_register): Rename to ... (x86_cannot_fetch_register): ... this. Use is_64bit_tdesc. (x86_fill_gregset, x86_store_gregset): Adjust register_size calls to new interface. (target_regsets): Rename to ... (x86_regsets): ... this. (x86_get_pc, x86_set_pc): Adjust register_size calls to new interface. (x86_siginfo_fixup): Use is_64bit_tdesc. [__x86_64__] (tdesc_amd64_linux, tdesc_amd64_avx_linux) (tdesc_x32_avx_linux, tdesc_x32_linux) (tdesc_i386_linux, tdesc_i386_mmx_linux, tdesc_i386_avx_linux): Declare. (x86_linux_update_xmltarget): Delete. (I386_LINUX_XSAVE_XCR0_OFFSET): Define. (have_ptrace_getfpxregs, have_ptrace_getregset): New. (AMD64_LINUX_USER64_CS): New. (x86_linux_read_description): New, based on x86_linux_update_xmltarget. (same_process_callback): New. (x86_arch_setup_process_callback): New. (x86_linux_update_xmltarget): New. (x86_regsets_info): New. (amd64_linux_regs_info): New. (i386_linux_usrregs_info): New. (i386_linux_regs_info): New. (x86_linux_regs_info): New. (x86_arch_setup): Reimplement. (x86_install_fast_tracepoint_jump_pad): Use is_64bit_tdesc. (x86_emit_ops): Ditto. (the_low_target): Adjust. Install x86_linux_regs_info, x86_cannot_fetch_register, and x86_cannot_store_register. (initialize_low_arch): New. * linux-ia64-low.c (tdesc_ia64): Declare. (ia64_fetch_register): Adjust. (ia64_usrregs_info, regs_info): New globals. (ia64_regs_info): New function. (the_low_target): Adjust. (initialize_low_arch): New function. * linux-sparc-low.c (tdesc_sparc64): Declare. (sparc_fill_gregset_to_stack, sparc_store_gregset_from_stack): Adjust. (sparc_arch_setup): New function. (sparc_regsets_info, sparc_usrregs_info, regs_info): New globals. (the_low_target): Adjust. (initialize_low_arch): New function. * linux-ppc-low.c (tdesc_powerpc_32l, tdesc_powerpc_altivec32l) (tdesc_powerpc_cell32l, tdesc_powerpc_vsx32l) (tdesc_powerpc_isa205_32l, tdesc_powerpc_isa205_altivec32l) (tdesc_powerpc_isa205_vsx32l, tdesc_powerpc_e500l) (tdesc_powerpc_64l, tdesc_powerpc_altivec64l) (tdesc_powerpc_cell64l, tdesc_powerpc_vsx64l) (tdesc_powerpc_isa205_64l, tdesc_powerpc_isa205_altivec64l) (tdesc_powerpc_isa205_vsx64l): Declare. (ppc_cannot_store_register, ppc_collect_ptrace_register) (ppc_supply_ptrace_register, parse_spufs_run, ppc_get_pc) (ppc_set_pc, ppc_get_hwcap): Adjust. (ppc_usrregs_info): Forward declare. (!__powerpc64__) ppc_regmap_adjusted: New global. (ppc_arch_setup): Adjust to the current process'es target description. (ppc_fill_vsxregset, ppc_store_vsxregset, ppc_fill_vrregset) (ppc_store_vrregset, ppc_fill_evrregset, ppc_store_evrregse) (ppc_store_evrregset): Adjust. (target_regsets): Rename to ... (ppc_regsets): ... this, and make static. (ppc_usrregs_info, ppc_regsets_info, regs_info): New globals. (ppc_regs_info): New function. (the_low_target): Adjust. (initialize_low_arch): New function. * linux-s390-low.c (tdesc_s390_linux32, tdesc_s390_linux32v1) (tdesc_s390_linux32v2, tdesc_s390_linux64, tdesc_s390_linux64v1) (tdesc_s390_linux64v2, tdesc_s390x_linux64, tdesc_s390x_linux64v1) (tdesc_s390x_linux64v2): Declare. (s390_collect_ptrace_register, s390_supply_ptrace_register) (s390_fill_gregset, s390_store_last_break): Adjust. (target_regsets): Rename to ... (s390_regsets): ... this, and make static. (s390_get_pc, s390_set_pc): Adjust. (s390_get_hwcap): New target_desc parameter, and use it. [__s390x__] (have_hwcap_s390_high_gprs): New global. (s390_arch_setup): Adjust to set the current process'es target description. Don't adjust the regmap. (s390_usrregs_info, s390_regsets_info, regs_info): New globals. [__s390x__] (s390_usrregs_info_3264, s390_regsets_info_3264) (regs_info_3264): New globals. (s390_regs_info): New function. (the_low_target): Adjust. (initialize_low_arch): New function. * linux-mips-low.c (tdesc_mips_linux, tdesc_mips_dsp_linux) (tdesc_mips64_linux, tdesc_mips64_dsp_linux): Declare. [__mips64] (init_registers_mips_linux) (init_registers_mips_dsp_linux): Delete defines. [__mips64] (tdesc_mips_linux, tdesc_mips_dsp_linux): New defines. (have_dsp): New global. (mips_read_description): New, based on mips_arch_setup. (mips_arch_setup): Reimplement. (get_usrregs_info): New function. (mips_cannot_fetch_register, mips_cannot_store_register) (mips_get_pc, mips_set_pc, mips_fill_gregset, mips_store_gregset) (mips_fill_fpregset, mips_store_fpregset): Adjust. (target_regsets): Rename to ... (mips_regsets): ... this, and make static. (mips_regsets_info, mips_dsp_usrregs_info, mips_usrregs_info) (dsp_regs_info, regs_info): New globals. (mips_regs_info): New function. (the_low_target): Adjust. (initialize_low_arch): New function. * linux-arm-low.c (tdesc_arm, tdesc_arm_with_iwmmxt) (tdesc_arm_with_vfpv2, tdesc_arm_with_vfpv3, tdesc_arm_with_neon): Declare. (arm_fill_vfpregset, arm_store_vfpregset): Adjust. (arm_read_description): New, with bits factored from arm_arch_setup. (arm_arch_setup): Reimplement. (target_regsets): Rename to ... (arm_regsets): ... this, and make static. (arm_regsets_info, arm_usrregs_info, regs_info): New globals. (arm_regs_info): New function. (the_low_target): Adjust. (initialize_low_arch): New function. * linux-m68k-low.c (tdesc_m68k): Declare. (target_regsets): Rename to ... (m68k_regsets): ... this, and make static. (m68k_regsets_info, m68k_usrregs_info, regs_info): New globals. (m68k_regs_info): New function. (m68k_arch_setup): New function. (the_low_target): Adjust. (initialize_low_arch): New function. * linux-sh-low.c (tdesc_sharch): Declare. (target_regsets): Rename to ... (sh_regsets): ... this, and make static. (sh_regsets_info, sh_usrregs_info, regs_info): New globals. (sh_regs_info, sh_arch_setup): New functions. (the_low_target): Adjust. (initialize_low_arch): New function. * linux-bfin-low.c (tdesc_bfin): Declare. (bfin_arch_setup): New function. (bfin_usrregs_info, regs_info): New globals. (bfin_regs_info): New function. (the_low_target): Adjust. (initialize_low_arch): New function. * linux-cris-low.c (tdesc_cris): Declare. (cris_arch_setup): New function. (cris_usrregs_info, regs_info): New globals. (cris_regs_info): New function. (the_low_target): Adjust. (initialize_low_arch): New function. * linux-cris-low.c (tdesc_crisv32): Declare. (cris_arch_setup): New function. (cris_regsets_info, cris_usrregs_info, regs_info): New globals. (cris_regs_info): New function. (the_low_target): Adjust. (initialize_low_arch): New function. * linux-m32r-low.c (tdesc_m32r): Declare. (m32r_arch_setup): New function. (m32r_usrregs_info, regs_info): New globals. (m32r_regs_info): Adjust. (initialize_low_arch): New function. * linux-tic6x-low.c (tdesc_tic6x_c64xp_linux) (tdesc_tic6x_c64x_linux, tdesc_tic6x_c62x_linux): Declare. (tic6x_usrregs_info): Forward declare. (tic6x_read_description): New function, based on ... (tic6x_arch_setup): ... this. Reimplement. (target_regsets): Rename to ... (tic6x_regsets): ... this, and make static. (tic6x_regsets_info, tic6x_usrregs_info, regs_info): New globals. (tic6x_regs_info): New function. (the_low_target): Adjust. (initialize_low_arch): New function. * linux-xtensa-low.c (tdesc_xtensa): Declare. (xtensa_fill_gregset, xtensa_store_gregset): Adjust. (target_regsets): Rename to ... (xtensa_regsets): ... this, and make static. (xtensa_regsets_info, xtensa_usrregs_info, regs_info): New globals. (xtensa_arch_setup, xtensa_regs_info): New functions. (the_low_target): Adjust. (initialize_low_arch): New function. * linux-nios2-low.c (tdesc_nios2_linux): Declare. (nios2_arch_setup): Set the current process'es tdesc. (target_regsets): Rename to ... (nios2_regsets): ... this. (nios2_regsets_info, nios2_usrregs_info, regs_info): New globals. (nios2_regs_info): New function. (the_low_target): Adjust. (initialize_low_arch): New function. * linux-aarch64-low.c (tdesc_aarch64): Declare. (aarch64_arch_setup): Set the current process'es tdesc. (target_regsets): Rename to ... (aarch64_regsets): ... this. (aarch64_regsets_info, aarch64_usrregs_info, regs_info): New globals. (aarch64_regs_info): New function. (the_low_target): Adjust. (initialize_low_arch): New function. * linux-tile-low.c (tdesc_tilegx, tdesc_tilegx32): Declare globals. (target_regsets): Rename to ... (tile_regsets): ... this. (tile_regsets_info, tile_usrregs_info, regs_info): New globals. (tile_regs_info): New function. (tile_arch_setup): Set the current process'es tdesc. (the_low_target): Adjust. (initialize_low_arch): New function. * spu-low.c (tdesc_spu): Declare. (spu_create_inferior, spu_attach): Set the new process'es tdesc. * win32-arm-low.c (tdesc_arm): Declare. (arm_arch_setup): New function. (the_low_target): Install arm_arch_setup instead of init_registers_arm. * win32-i386-low.c (tdesc_i386, tdesc_amd64): Declare. (init_windows_x86): Rename to ... (i386_arch_setup): ... this. Set `win32_tdesc'. (the_low_target): Adjust. * win32-low.c (win32_tdesc): New global. (child_add_thread): Don't create the thread cache here. (do_initial_child_stuff): Set the new process'es tdesc. * win32-low.h (struct target_desc): Forward declare. (win32_tdesc): Declare. * lynx-i386-low.c (tdesc_i386): Declare global. (lynx_i386_arch_setup): Set `lynx_tdesc'. * lynx-low.c (lynx_tdesc): New global. (lynx_add_process): Set the new process'es tdesc. * lynx-low.h (struct target_desc): Forward declare. (lynx_tdesc): Declare global. * lynx-ppc-low.c (tdesc_powerpc_32): Declare global. (lynx_ppc_arch_setup): Set `lynx_tdesc'. * nto-low.c (nto_tdesc): New global. (do_attach): Set the new process'es tdesc. * nto-low.h (struct target_desc): Forward declare. (nto_tdesc): Declare. * nto-x86-low.c (tdesc_i386): Declare. (nto_x86_arch_setup): Set `nto_tdesc'. gdb/ 2013-06-07 Pedro Alves <palves@redhat.com> * regformats/regdat.sh: Output #include tdesc.h. Make globals static. Output a global target description pointer. (init_registers_${name}): Adjust to initialize a target description structure.
2013-06-07 12:46:59 +02:00
/* Aggregation of all the supported regsets of a given
architecture/mode. */
struct regsets_info
{
/* The regsets array. */
struct regset_info *regsets;
/* The number of regsets in the REGSETS array. */
int num_regsets;
/* If we get EIO on a regset, do not try it again. Note the set of
supported regsets may depend on processor mode on biarch
machines. This is a (lazily allocated) array holding one boolean
byte (0/1) per regset, with each element corresponding to the
regset in the REGSETS array above at the same offset. */
[GDBserver] Multi-process + multi-arch This patch makes GDBserver support multi-process + biarch. Currently, if you're debugging more than one process at once with a single gdbserver (in extended-remote mode), then all processes must have the same architecture (e.g., 64-bit vs 32-bit). Otherwise, you see this: Added inferior 2 [Switching to inferior 2 [<null>] (<noexec>)] Reading symbols from /home/pedro/gdb/tests/main32...done. Temporary breakpoint 2 at 0x4004cf: main. (2 locations) Starting program: /home/pedro/gdb/tests/main32 warning: Selected architecture i386 is not compatible with reported target architecture i386:x86-64 warning: Architecture rejected target-supplied description Remote 'g' packet reply is too long: 000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000090cfffff0000000000000000000000000000000000000000000000000000000000020000000000000000000000000000000000000000000000000000000000000000000000000000b042f7460000000000020000230000002b0000002b0000002b000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000007f03000000000000ffff0000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000801f00003b0000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000 ... etc, etc ... Even though the process was running a 32-bit program, GDBserver sent back to GDB a register set in 64-bit layout. A patch (http://sourceware.org/ml/gdb-patches/2012-11/msg00228.html) a while ago made GDB track a target_gdbarch per inferior, and as consequence, fetch a target description per-inferior. This patch is the GDBserver counterpart, that makes GDBserver keep track of each process'es XML target description and register layout. So in the example above, GDBserver will send the correct register set in 32-bit layout to GDB. A new "struct target_desc" object (tdesc for short) is added, that holds the target description and register layout information about each process. Each `struct process_info' holds a pointer to a target description. The regcache also gains a pointer to a target description, mainly for convenience, and parallel with GDB (and possible future support for programs that flip processor modes). The low target's arch_setup routines are responsible for setting the process'es correct tdesc. This isn't that much different to how things were done before, except that instead of detecting the inferior process'es architecture and calling the corresponding init_registers_FOO routine, which would change the regcache layout globals and recreate the threads' regcaches, the regcache.c globals are gone, and the init_registers_$BAR routines now each initialize a separate global struct target_desc object (one for each arch variant GDBserver supports), and so all the init_registers_$BAR routines that are built into GDBserver are called early at GDBserver startup time (similarly to how GDB handles its built-in target descriptions), and then the arch_setup routine is responsible for making process_info->tdesc point to one of these target description globals. The regcache module is all parameterized to get the regcache's layout from the tdesc object instead of the old register_bytes, etc. globals. The threads' regcaches are now created lazily. The old scheme where we created each of them when we added a new thread doesn't work anymore, because we add the main thread/lwp before we see it stop for the first time, and it is only when we see the thread stop for the first time that we have a chance of determining the inferior's architecture (through the_low_target.arch_setup). Therefore when we add the main thread we don't know which architecture/tdesc its regcache should have. This patch makes the gdb.multi/multi-arch.exp test now pass against (extended-remote) GDBserver. It currently fails, without this patch. The IPA also uses the regcache, so it gains a new global struct target_desc pointer, which points at the description of the process it is loaded in. Re. the linux-low.c & friends changes. Since the register map etc. may differ between processes (64-bit vs 32-bit) etc., the linux_target_ops num_regs, regmap and regset_bitmap data fields are no longer sufficient. A new method is added in their place that returns a pointer to a new struct that includes all info linux-low.c needs to access registers of the current inferior. The patch/discussion that originally introduced linux-low.c:disabled_regsets mentions that the disabled_regsets set may be different per mode (in a biarch setup), and indeed that is cleared whenever we start a new (first) inferior, so that global is moved as well behind the new `struct regs_info'. On the x86 side: I simply replaced the i387-fp.c:num_xmm_registers global with a check for 64-bit or 32-bit process, which is equivalent to how the global was set. This avoided coming up with some more general mechanism that would work for all targets that use this module (GNU/Linux, Windows, etc.). Tested: GNU/Linux IA64 GNU/Linux MIPS64 GNU/Linux PowerPC (Fedora 16) GNU/Linux s390x (Fedora 16) GNU/Linux sparc64 (Debian) GNU/Linux x86_64, -m64 and -m32 (Fedora 17) Cross built, and smoke tested: i686-w64-mingw32, under Wine. GNU/Linux TI C6x, by Yao Qi. Cross built but otherwise not tested: aarch64-linux-gnu arm-linux-gnu m68k-linux nios2-linux-gnu sh-linux-gnu spu tilegx-unknown-linux-gnu Completely untested: GNU/Linux Blackfin GNU/Linux CRIS GNU/Linux CRISv32 GNU/Linux TI Xtensa GNU/Linux M32R LynxOS QNX NTO gdb/gdbserver/ 2013-06-07 Pedro Alves <palves@redhat.com> * Makefile.in (OBS): Add tdesc.o. (IPA_OBJS): Add tdesc-ipa.o. (tdesc-ipa.o): New rule. * ax.c (gdb_eval_agent_expr): Adjust register_size call to new interface. * linux-low.c (new_inferior): Delete. (disabled_regsets, num_regsets): Delete. (linux_add_process): Adjust to set the new per-process new_inferior flag. (linux_detach_one_lwp): Adjust to call regcache_invalidate_thread. (linux_wait_for_lwp): Adjust. Only call arch_setup if the event was a stop. When calling arch_setup, switch the current inferior to the thread that got an event. (linux_resume_one_lwp): Adjust to call regcache_invalidate_thread. (regsets_fetch_inferior_registers) (regsets_store_inferior_registers): New regsets_info parameter. Adjust to use it. (linux_register_in_regsets): New regs_info parameter. Adjust to use it. (register_addr, fetch_register, store_register): New usrregs_info parameter. Adjust to use it. (usr_fetch_inferior_registers, usr_store_inferior_registers): New parameter regs_info. Adjust to use it. (linux_fetch_registers): Get the current inferior's regs_info, and adjust to use it. (linux_store_registers): Ditto. [HAVE_LINUX_REGSETS] (initialize_regsets_info): New. (initialize_low): Don't initialize the target_regsets here. Call initialize_low_arch. * linux-low.h (target_regsets): Delete declaration. (struct regsets_info): New. (struct usrregs_info): New. (struct regs_info): New. (struct process_info_private) <new_inferior>: New field. (struct linux_target_ops): Delete the num_regs, regmap, and regset_bitmap fields. New field regs_info. [HAVE_LINUX_REGSETS] (initialize_regsets_info): Declare. * i387-fp.c (num_xmm_registers): Delete. (i387_cache_to_fsave, i387_fsave_to_cache): Adjust find_regno calls to new interface. (i387_cache_to_fxsave, i387_cache_to_xsave, i387_fxsave_to_cache) (i387_xsave_to_cache): Adjust find_regno calls to new interface. Infer the number of xmm registers from the regcache's target description. * i387-fp.h (num_xmm_registers): Delete. * inferiors.c (add_thread): Don't install the thread's regcache here. * proc-service.c (gregset_info): Fetch the current inferior's regs_info. Adjust to use it. * regcache.c: Include tdesc.h. (register_bytes, reg_defs, num_registers) (gdbserver_expedite_regs): Delete. (get_thread_regcache): If the thread doesn't have a regcache yet, create one, instead of aborting gdbserver. (regcache_invalidate_one): Rename to ... (regcache_invalidate_thread): ... this. (regcache_invalidate_one): New. (regcache_invalidate): Only invalidate registers of the current process. (init_register_cache): Add target_desc parameter, and use it. (new_register_cache): Ditto. Assert the target description has a non zero registers_size. (regcache_cpy): Add assertions. Adjust. (realloc_register_cache, set_register_cache): Delete. (registers_to_string, registers_from_string): Adjust. (find_register_by_name, find_regno, find_register_by_number) (register_cache_size): Add target_desc parameter, and use it. (free_register_cache_thread, free_register_cache_thread_one) (regcache_release, register_cache_size): New. (register_size): Add target_desc parameter, and use it. (register_data, supply_register, supply_register_zeroed) (supply_regblock, supply_register_by_name, collect_register) (collect_register_as_string, collect_register_by_name): Adjust. * regcache.h (struct target_desc): Forward declare. (struct regcache) <tdesc>: New field. (init_register_cache, new_register_cache): Add target_desc parameter. (regcache_invalidate_thread): Declare. (regcache_invalidate_one): Delete declaration. (regcache_release): Declare. (find_register_by_number, register_cache_size, register_size) (find_regno): Add target_desc parameter. (gdbserver_expedite_regs, gdbserver_xmltarget): Delete declarations. * remote-utils.c: Include tdesc.h. (outreg, prepare_resume_reply): Adjust. * server.c: Include tdesc.h. (gdbserver_xmltarget): Delete declaration. (get_features_xml, process_serial_event): Adjust. * server.h [IN_PROCESS_AGENT] (struct target_desc): Forward declare. (struct process_info) <tdesc>: New field. (ipa_tdesc): Declare. * tdesc.c: New file. * tdesc.h: New file. * tracepoint.c: Include tdesc.h. [IN_PROCESS_AGENT] (ipa_tdesc): Define. (get_context_regcache): Adjust to pass ipa_tdesc down. (do_action_at_tracepoint): Adjust to get the register cache size from the context regcache's description. (traceframe_walk_blocks): Adjust to get the register cache size from the current trace frame's description. (traceframe_get_pc): Adjust to get current trace frame's description and pass it down. (gdb_collect): Adjust to get the register cache size from the IPA's description. * linux-amd64-ipa.c (tdesc_amd64_linux): Declare. (gdbserver_xmltarget): Delete. (initialize_low_tracepoint): Set the ipa's target description. * linux-i386-ipa.c (tdesc_i386_linux): Declare. (initialize_low_tracepoint): Set the ipa's target description. * linux-x86-low.c: Include tdesc.h. [__x86_64__] (is_64bit_tdesc): New. (ps_get_thread_area, x86_get_thread_area): Use it. (i386_cannot_store_register): Rename to ... (x86_cannot_store_register): ... this. Use is_64bit_tdesc. (i386_cannot_fetch_register): Rename to ... (x86_cannot_fetch_register): ... this. Use is_64bit_tdesc. (x86_fill_gregset, x86_store_gregset): Adjust register_size calls to new interface. (target_regsets): Rename to ... (x86_regsets): ... this. (x86_get_pc, x86_set_pc): Adjust register_size calls to new interface. (x86_siginfo_fixup): Use is_64bit_tdesc. [__x86_64__] (tdesc_amd64_linux, tdesc_amd64_avx_linux) (tdesc_x32_avx_linux, tdesc_x32_linux) (tdesc_i386_linux, tdesc_i386_mmx_linux, tdesc_i386_avx_linux): Declare. (x86_linux_update_xmltarget): Delete. (I386_LINUX_XSAVE_XCR0_OFFSET): Define. (have_ptrace_getfpxregs, have_ptrace_getregset): New. (AMD64_LINUX_USER64_CS): New. (x86_linux_read_description): New, based on x86_linux_update_xmltarget. (same_process_callback): New. (x86_arch_setup_process_callback): New. (x86_linux_update_xmltarget): New. (x86_regsets_info): New. (amd64_linux_regs_info): New. (i386_linux_usrregs_info): New. (i386_linux_regs_info): New. (x86_linux_regs_info): New. (x86_arch_setup): Reimplement. (x86_install_fast_tracepoint_jump_pad): Use is_64bit_tdesc. (x86_emit_ops): Ditto. (the_low_target): Adjust. Install x86_linux_regs_info, x86_cannot_fetch_register, and x86_cannot_store_register. (initialize_low_arch): New. * linux-ia64-low.c (tdesc_ia64): Declare. (ia64_fetch_register): Adjust. (ia64_usrregs_info, regs_info): New globals. (ia64_regs_info): New function. (the_low_target): Adjust. (initialize_low_arch): New function. * linux-sparc-low.c (tdesc_sparc64): Declare. (sparc_fill_gregset_to_stack, sparc_store_gregset_from_stack): Adjust. (sparc_arch_setup): New function. (sparc_regsets_info, sparc_usrregs_info, regs_info): New globals. (the_low_target): Adjust. (initialize_low_arch): New function. * linux-ppc-low.c (tdesc_powerpc_32l, tdesc_powerpc_altivec32l) (tdesc_powerpc_cell32l, tdesc_powerpc_vsx32l) (tdesc_powerpc_isa205_32l, tdesc_powerpc_isa205_altivec32l) (tdesc_powerpc_isa205_vsx32l, tdesc_powerpc_e500l) (tdesc_powerpc_64l, tdesc_powerpc_altivec64l) (tdesc_powerpc_cell64l, tdesc_powerpc_vsx64l) (tdesc_powerpc_isa205_64l, tdesc_powerpc_isa205_altivec64l) (tdesc_powerpc_isa205_vsx64l): Declare. (ppc_cannot_store_register, ppc_collect_ptrace_register) (ppc_supply_ptrace_register, parse_spufs_run, ppc_get_pc) (ppc_set_pc, ppc_get_hwcap): Adjust. (ppc_usrregs_info): Forward declare. (!__powerpc64__) ppc_regmap_adjusted: New global. (ppc_arch_setup): Adjust to the current process'es target description. (ppc_fill_vsxregset, ppc_store_vsxregset, ppc_fill_vrregset) (ppc_store_vrregset, ppc_fill_evrregset, ppc_store_evrregse) (ppc_store_evrregset): Adjust. (target_regsets): Rename to ... (ppc_regsets): ... this, and make static. (ppc_usrregs_info, ppc_regsets_info, regs_info): New globals. (ppc_regs_info): New function. (the_low_target): Adjust. (initialize_low_arch): New function. * linux-s390-low.c (tdesc_s390_linux32, tdesc_s390_linux32v1) (tdesc_s390_linux32v2, tdesc_s390_linux64, tdesc_s390_linux64v1) (tdesc_s390_linux64v2, tdesc_s390x_linux64, tdesc_s390x_linux64v1) (tdesc_s390x_linux64v2): Declare. (s390_collect_ptrace_register, s390_supply_ptrace_register) (s390_fill_gregset, s390_store_last_break): Adjust. (target_regsets): Rename to ... (s390_regsets): ... this, and make static. (s390_get_pc, s390_set_pc): Adjust. (s390_get_hwcap): New target_desc parameter, and use it. [__s390x__] (have_hwcap_s390_high_gprs): New global. (s390_arch_setup): Adjust to set the current process'es target description. Don't adjust the regmap. (s390_usrregs_info, s390_regsets_info, regs_info): New globals. [__s390x__] (s390_usrregs_info_3264, s390_regsets_info_3264) (regs_info_3264): New globals. (s390_regs_info): New function. (the_low_target): Adjust. (initialize_low_arch): New function. * linux-mips-low.c (tdesc_mips_linux, tdesc_mips_dsp_linux) (tdesc_mips64_linux, tdesc_mips64_dsp_linux): Declare. [__mips64] (init_registers_mips_linux) (init_registers_mips_dsp_linux): Delete defines. [__mips64] (tdesc_mips_linux, tdesc_mips_dsp_linux): New defines. (have_dsp): New global. (mips_read_description): New, based on mips_arch_setup. (mips_arch_setup): Reimplement. (get_usrregs_info): New function. (mips_cannot_fetch_register, mips_cannot_store_register) (mips_get_pc, mips_set_pc, mips_fill_gregset, mips_store_gregset) (mips_fill_fpregset, mips_store_fpregset): Adjust. (target_regsets): Rename to ... (mips_regsets): ... this, and make static. (mips_regsets_info, mips_dsp_usrregs_info, mips_usrregs_info) (dsp_regs_info, regs_info): New globals. (mips_regs_info): New function. (the_low_target): Adjust. (initialize_low_arch): New function. * linux-arm-low.c (tdesc_arm, tdesc_arm_with_iwmmxt) (tdesc_arm_with_vfpv2, tdesc_arm_with_vfpv3, tdesc_arm_with_neon): Declare. (arm_fill_vfpregset, arm_store_vfpregset): Adjust. (arm_read_description): New, with bits factored from arm_arch_setup. (arm_arch_setup): Reimplement. (target_regsets): Rename to ... (arm_regsets): ... this, and make static. (arm_regsets_info, arm_usrregs_info, regs_info): New globals. (arm_regs_info): New function. (the_low_target): Adjust. (initialize_low_arch): New function. * linux-m68k-low.c (tdesc_m68k): Declare. (target_regsets): Rename to ... (m68k_regsets): ... this, and make static. (m68k_regsets_info, m68k_usrregs_info, regs_info): New globals. (m68k_regs_info): New function. (m68k_arch_setup): New function. (the_low_target): Adjust. (initialize_low_arch): New function. * linux-sh-low.c (tdesc_sharch): Declare. (target_regsets): Rename to ... (sh_regsets): ... this, and make static. (sh_regsets_info, sh_usrregs_info, regs_info): New globals. (sh_regs_info, sh_arch_setup): New functions. (the_low_target): Adjust. (initialize_low_arch): New function. * linux-bfin-low.c (tdesc_bfin): Declare. (bfin_arch_setup): New function. (bfin_usrregs_info, regs_info): New globals. (bfin_regs_info): New function. (the_low_target): Adjust. (initialize_low_arch): New function. * linux-cris-low.c (tdesc_cris): Declare. (cris_arch_setup): New function. (cris_usrregs_info, regs_info): New globals. (cris_regs_info): New function. (the_low_target): Adjust. (initialize_low_arch): New function. * linux-cris-low.c (tdesc_crisv32): Declare. (cris_arch_setup): New function. (cris_regsets_info, cris_usrregs_info, regs_info): New globals. (cris_regs_info): New function. (the_low_target): Adjust. (initialize_low_arch): New function. * linux-m32r-low.c (tdesc_m32r): Declare. (m32r_arch_setup): New function. (m32r_usrregs_info, regs_info): New globals. (m32r_regs_info): Adjust. (initialize_low_arch): New function. * linux-tic6x-low.c (tdesc_tic6x_c64xp_linux) (tdesc_tic6x_c64x_linux, tdesc_tic6x_c62x_linux): Declare. (tic6x_usrregs_info): Forward declare. (tic6x_read_description): New function, based on ... (tic6x_arch_setup): ... this. Reimplement. (target_regsets): Rename to ... (tic6x_regsets): ... this, and make static. (tic6x_regsets_info, tic6x_usrregs_info, regs_info): New globals. (tic6x_regs_info): New function. (the_low_target): Adjust. (initialize_low_arch): New function. * linux-xtensa-low.c (tdesc_xtensa): Declare. (xtensa_fill_gregset, xtensa_store_gregset): Adjust. (target_regsets): Rename to ... (xtensa_regsets): ... this, and make static. (xtensa_regsets_info, xtensa_usrregs_info, regs_info): New globals. (xtensa_arch_setup, xtensa_regs_info): New functions. (the_low_target): Adjust. (initialize_low_arch): New function. * linux-nios2-low.c (tdesc_nios2_linux): Declare. (nios2_arch_setup): Set the current process'es tdesc. (target_regsets): Rename to ... (nios2_regsets): ... this. (nios2_regsets_info, nios2_usrregs_info, regs_info): New globals. (nios2_regs_info): New function. (the_low_target): Adjust. (initialize_low_arch): New function. * linux-aarch64-low.c (tdesc_aarch64): Declare. (aarch64_arch_setup): Set the current process'es tdesc. (target_regsets): Rename to ... (aarch64_regsets): ... this. (aarch64_regsets_info, aarch64_usrregs_info, regs_info): New globals. (aarch64_regs_info): New function. (the_low_target): Adjust. (initialize_low_arch): New function. * linux-tile-low.c (tdesc_tilegx, tdesc_tilegx32): Declare globals. (target_regsets): Rename to ... (tile_regsets): ... this. (tile_regsets_info, tile_usrregs_info, regs_info): New globals. (tile_regs_info): New function. (tile_arch_setup): Set the current process'es tdesc. (the_low_target): Adjust. (initialize_low_arch): New function. * spu-low.c (tdesc_spu): Declare. (spu_create_inferior, spu_attach): Set the new process'es tdesc. * win32-arm-low.c (tdesc_arm): Declare. (arm_arch_setup): New function. (the_low_target): Install arm_arch_setup instead of init_registers_arm. * win32-i386-low.c (tdesc_i386, tdesc_amd64): Declare. (init_windows_x86): Rename to ... (i386_arch_setup): ... this. Set `win32_tdesc'. (the_low_target): Adjust. * win32-low.c (win32_tdesc): New global. (child_add_thread): Don't create the thread cache here. (do_initial_child_stuff): Set the new process'es tdesc. * win32-low.h (struct target_desc): Forward declare. (win32_tdesc): Declare. * lynx-i386-low.c (tdesc_i386): Declare global. (lynx_i386_arch_setup): Set `lynx_tdesc'. * lynx-low.c (lynx_tdesc): New global. (lynx_add_process): Set the new process'es tdesc. * lynx-low.h (struct target_desc): Forward declare. (lynx_tdesc): Declare global. * lynx-ppc-low.c (tdesc_powerpc_32): Declare global. (lynx_ppc_arch_setup): Set `lynx_tdesc'. * nto-low.c (nto_tdesc): New global. (do_attach): Set the new process'es tdesc. * nto-low.h (struct target_desc): Forward declare. (nto_tdesc): Declare. * nto-x86-low.c (tdesc_i386): Declare. (nto_x86_arch_setup): Set `nto_tdesc'. gdb/ 2013-06-07 Pedro Alves <palves@redhat.com> * regformats/regdat.sh: Output #include tdesc.h. Make globals static. Output a global target description pointer. (init_registers_${name}): Adjust to initialize a target description structure.
2013-06-07 12:46:59 +02:00
char *disabled_regsets;
};
#endif
/* Mapping between the general-purpose registers in `struct user'
format and GDB's register array layout. */
struct usrregs_info
{
/* The number of registers accessible. */
int num_regs;
/* The registers map. */
int *regmap;
};
/* All info needed to access an architecture/mode's registers. */
struct regs_info
{
/* Regset support bitmap: 1 for registers that are transferred as a part
of a regset, 0 for ones that need to be handled individually. This
can be NULL if all registers are transferred with regsets or regsets
are not supported. */
unsigned char *regset_bitmap;
/* Info used when accessing registers with PTRACE_PEEKUSER /
PTRACE_POKEUSER. This can be NULL if all registers are
transferred with regsets .*/
struct usrregs_info *usrregs;
#ifdef HAVE_LINUX_REGSETS
/* Info used when accessing registers with regsets. */
struct regsets_info *regsets_info;
#endif
[GDBserver] Multi-process + multi-arch This patch makes GDBserver support multi-process + biarch. Currently, if you're debugging more than one process at once with a single gdbserver (in extended-remote mode), then all processes must have the same architecture (e.g., 64-bit vs 32-bit). Otherwise, you see this: Added inferior 2 [Switching to inferior 2 [<null>] (<noexec>)] Reading symbols from /home/pedro/gdb/tests/main32...done. Temporary breakpoint 2 at 0x4004cf: main. (2 locations) Starting program: /home/pedro/gdb/tests/main32 warning: Selected architecture i386 is not compatible with reported target architecture i386:x86-64 warning: Architecture rejected target-supplied description Remote 'g' packet reply is too long: 000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000090cfffff0000000000000000000000000000000000000000000000000000000000020000000000000000000000000000000000000000000000000000000000000000000000000000b042f7460000000000020000230000002b0000002b0000002b000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000007f03000000000000ffff0000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000801f00003b0000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000 ... etc, etc ... Even though the process was running a 32-bit program, GDBserver sent back to GDB a register set in 64-bit layout. A patch (http://sourceware.org/ml/gdb-patches/2012-11/msg00228.html) a while ago made GDB track a target_gdbarch per inferior, and as consequence, fetch a target description per-inferior. This patch is the GDBserver counterpart, that makes GDBserver keep track of each process'es XML target description and register layout. So in the example above, GDBserver will send the correct register set in 32-bit layout to GDB. A new "struct target_desc" object (tdesc for short) is added, that holds the target description and register layout information about each process. Each `struct process_info' holds a pointer to a target description. The regcache also gains a pointer to a target description, mainly for convenience, and parallel with GDB (and possible future support for programs that flip processor modes). The low target's arch_setup routines are responsible for setting the process'es correct tdesc. This isn't that much different to how things were done before, except that instead of detecting the inferior process'es architecture and calling the corresponding init_registers_FOO routine, which would change the regcache layout globals and recreate the threads' regcaches, the regcache.c globals are gone, and the init_registers_$BAR routines now each initialize a separate global struct target_desc object (one for each arch variant GDBserver supports), and so all the init_registers_$BAR routines that are built into GDBserver are called early at GDBserver startup time (similarly to how GDB handles its built-in target descriptions), and then the arch_setup routine is responsible for making process_info->tdesc point to one of these target description globals. The regcache module is all parameterized to get the regcache's layout from the tdesc object instead of the old register_bytes, etc. globals. The threads' regcaches are now created lazily. The old scheme where we created each of them when we added a new thread doesn't work anymore, because we add the main thread/lwp before we see it stop for the first time, and it is only when we see the thread stop for the first time that we have a chance of determining the inferior's architecture (through the_low_target.arch_setup). Therefore when we add the main thread we don't know which architecture/tdesc its regcache should have. This patch makes the gdb.multi/multi-arch.exp test now pass against (extended-remote) GDBserver. It currently fails, without this patch. The IPA also uses the regcache, so it gains a new global struct target_desc pointer, which points at the description of the process it is loaded in. Re. the linux-low.c & friends changes. Since the register map etc. may differ between processes (64-bit vs 32-bit) etc., the linux_target_ops num_regs, regmap and regset_bitmap data fields are no longer sufficient. A new method is added in their place that returns a pointer to a new struct that includes all info linux-low.c needs to access registers of the current inferior. The patch/discussion that originally introduced linux-low.c:disabled_regsets mentions that the disabled_regsets set may be different per mode (in a biarch setup), and indeed that is cleared whenever we start a new (first) inferior, so that global is moved as well behind the new `struct regs_info'. On the x86 side: I simply replaced the i387-fp.c:num_xmm_registers global with a check for 64-bit or 32-bit process, which is equivalent to how the global was set. This avoided coming up with some more general mechanism that would work for all targets that use this module (GNU/Linux, Windows, etc.). Tested: GNU/Linux IA64 GNU/Linux MIPS64 GNU/Linux PowerPC (Fedora 16) GNU/Linux s390x (Fedora 16) GNU/Linux sparc64 (Debian) GNU/Linux x86_64, -m64 and -m32 (Fedora 17) Cross built, and smoke tested: i686-w64-mingw32, under Wine. GNU/Linux TI C6x, by Yao Qi. Cross built but otherwise not tested: aarch64-linux-gnu arm-linux-gnu m68k-linux nios2-linux-gnu sh-linux-gnu spu tilegx-unknown-linux-gnu Completely untested: GNU/Linux Blackfin GNU/Linux CRIS GNU/Linux CRISv32 GNU/Linux TI Xtensa GNU/Linux M32R LynxOS QNX NTO gdb/gdbserver/ 2013-06-07 Pedro Alves <palves@redhat.com> * Makefile.in (OBS): Add tdesc.o. (IPA_OBJS): Add tdesc-ipa.o. (tdesc-ipa.o): New rule. * ax.c (gdb_eval_agent_expr): Adjust register_size call to new interface. * linux-low.c (new_inferior): Delete. (disabled_regsets, num_regsets): Delete. (linux_add_process): Adjust to set the new per-process new_inferior flag. (linux_detach_one_lwp): Adjust to call regcache_invalidate_thread. (linux_wait_for_lwp): Adjust. Only call arch_setup if the event was a stop. When calling arch_setup, switch the current inferior to the thread that got an event. (linux_resume_one_lwp): Adjust to call regcache_invalidate_thread. (regsets_fetch_inferior_registers) (regsets_store_inferior_registers): New regsets_info parameter. Adjust to use it. (linux_register_in_regsets): New regs_info parameter. Adjust to use it. (register_addr, fetch_register, store_register): New usrregs_info parameter. Adjust to use it. (usr_fetch_inferior_registers, usr_store_inferior_registers): New parameter regs_info. Adjust to use it. (linux_fetch_registers): Get the current inferior's regs_info, and adjust to use it. (linux_store_registers): Ditto. [HAVE_LINUX_REGSETS] (initialize_regsets_info): New. (initialize_low): Don't initialize the target_regsets here. Call initialize_low_arch. * linux-low.h (target_regsets): Delete declaration. (struct regsets_info): New. (struct usrregs_info): New. (struct regs_info): New. (struct process_info_private) <new_inferior>: New field. (struct linux_target_ops): Delete the num_regs, regmap, and regset_bitmap fields. New field regs_info. [HAVE_LINUX_REGSETS] (initialize_regsets_info): Declare. * i387-fp.c (num_xmm_registers): Delete. (i387_cache_to_fsave, i387_fsave_to_cache): Adjust find_regno calls to new interface. (i387_cache_to_fxsave, i387_cache_to_xsave, i387_fxsave_to_cache) (i387_xsave_to_cache): Adjust find_regno calls to new interface. Infer the number of xmm registers from the regcache's target description. * i387-fp.h (num_xmm_registers): Delete. * inferiors.c (add_thread): Don't install the thread's regcache here. * proc-service.c (gregset_info): Fetch the current inferior's regs_info. Adjust to use it. * regcache.c: Include tdesc.h. (register_bytes, reg_defs, num_registers) (gdbserver_expedite_regs): Delete. (get_thread_regcache): If the thread doesn't have a regcache yet, create one, instead of aborting gdbserver. (regcache_invalidate_one): Rename to ... (regcache_invalidate_thread): ... this. (regcache_invalidate_one): New. (regcache_invalidate): Only invalidate registers of the current process. (init_register_cache): Add target_desc parameter, and use it. (new_register_cache): Ditto. Assert the target description has a non zero registers_size. (regcache_cpy): Add assertions. Adjust. (realloc_register_cache, set_register_cache): Delete. (registers_to_string, registers_from_string): Adjust. (find_register_by_name, find_regno, find_register_by_number) (register_cache_size): Add target_desc parameter, and use it. (free_register_cache_thread, free_register_cache_thread_one) (regcache_release, register_cache_size): New. (register_size): Add target_desc parameter, and use it. (register_data, supply_register, supply_register_zeroed) (supply_regblock, supply_register_by_name, collect_register) (collect_register_as_string, collect_register_by_name): Adjust. * regcache.h (struct target_desc): Forward declare. (struct regcache) <tdesc>: New field. (init_register_cache, new_register_cache): Add target_desc parameter. (regcache_invalidate_thread): Declare. (regcache_invalidate_one): Delete declaration. (regcache_release): Declare. (find_register_by_number, register_cache_size, register_size) (find_regno): Add target_desc parameter. (gdbserver_expedite_regs, gdbserver_xmltarget): Delete declarations. * remote-utils.c: Include tdesc.h. (outreg, prepare_resume_reply): Adjust. * server.c: Include tdesc.h. (gdbserver_xmltarget): Delete declaration. (get_features_xml, process_serial_event): Adjust. * server.h [IN_PROCESS_AGENT] (struct target_desc): Forward declare. (struct process_info) <tdesc>: New field. (ipa_tdesc): Declare. * tdesc.c: New file. * tdesc.h: New file. * tracepoint.c: Include tdesc.h. [IN_PROCESS_AGENT] (ipa_tdesc): Define. (get_context_regcache): Adjust to pass ipa_tdesc down. (do_action_at_tracepoint): Adjust to get the register cache size from the context regcache's description. (traceframe_walk_blocks): Adjust to get the register cache size from the current trace frame's description. (traceframe_get_pc): Adjust to get current trace frame's description and pass it down. (gdb_collect): Adjust to get the register cache size from the IPA's description. * linux-amd64-ipa.c (tdesc_amd64_linux): Declare. (gdbserver_xmltarget): Delete. (initialize_low_tracepoint): Set the ipa's target description. * linux-i386-ipa.c (tdesc_i386_linux): Declare. (initialize_low_tracepoint): Set the ipa's target description. * linux-x86-low.c: Include tdesc.h. [__x86_64__] (is_64bit_tdesc): New. (ps_get_thread_area, x86_get_thread_area): Use it. (i386_cannot_store_register): Rename to ... (x86_cannot_store_register): ... this. Use is_64bit_tdesc. (i386_cannot_fetch_register): Rename to ... (x86_cannot_fetch_register): ... this. Use is_64bit_tdesc. (x86_fill_gregset, x86_store_gregset): Adjust register_size calls to new interface. (target_regsets): Rename to ... (x86_regsets): ... this. (x86_get_pc, x86_set_pc): Adjust register_size calls to new interface. (x86_siginfo_fixup): Use is_64bit_tdesc. [__x86_64__] (tdesc_amd64_linux, tdesc_amd64_avx_linux) (tdesc_x32_avx_linux, tdesc_x32_linux) (tdesc_i386_linux, tdesc_i386_mmx_linux, tdesc_i386_avx_linux): Declare. (x86_linux_update_xmltarget): Delete. (I386_LINUX_XSAVE_XCR0_OFFSET): Define. (have_ptrace_getfpxregs, have_ptrace_getregset): New. (AMD64_LINUX_USER64_CS): New. (x86_linux_read_description): New, based on x86_linux_update_xmltarget. (same_process_callback): New. (x86_arch_setup_process_callback): New. (x86_linux_update_xmltarget): New. (x86_regsets_info): New. (amd64_linux_regs_info): New. (i386_linux_usrregs_info): New. (i386_linux_regs_info): New. (x86_linux_regs_info): New. (x86_arch_setup): Reimplement. (x86_install_fast_tracepoint_jump_pad): Use is_64bit_tdesc. (x86_emit_ops): Ditto. (the_low_target): Adjust. Install x86_linux_regs_info, x86_cannot_fetch_register, and x86_cannot_store_register. (initialize_low_arch): New. * linux-ia64-low.c (tdesc_ia64): Declare. (ia64_fetch_register): Adjust. (ia64_usrregs_info, regs_info): New globals. (ia64_regs_info): New function. (the_low_target): Adjust. (initialize_low_arch): New function. * linux-sparc-low.c (tdesc_sparc64): Declare. (sparc_fill_gregset_to_stack, sparc_store_gregset_from_stack): Adjust. (sparc_arch_setup): New function. (sparc_regsets_info, sparc_usrregs_info, regs_info): New globals. (the_low_target): Adjust. (initialize_low_arch): New function. * linux-ppc-low.c (tdesc_powerpc_32l, tdesc_powerpc_altivec32l) (tdesc_powerpc_cell32l, tdesc_powerpc_vsx32l) (tdesc_powerpc_isa205_32l, tdesc_powerpc_isa205_altivec32l) (tdesc_powerpc_isa205_vsx32l, tdesc_powerpc_e500l) (tdesc_powerpc_64l, tdesc_powerpc_altivec64l) (tdesc_powerpc_cell64l, tdesc_powerpc_vsx64l) (tdesc_powerpc_isa205_64l, tdesc_powerpc_isa205_altivec64l) (tdesc_powerpc_isa205_vsx64l): Declare. (ppc_cannot_store_register, ppc_collect_ptrace_register) (ppc_supply_ptrace_register, parse_spufs_run, ppc_get_pc) (ppc_set_pc, ppc_get_hwcap): Adjust. (ppc_usrregs_info): Forward declare. (!__powerpc64__) ppc_regmap_adjusted: New global. (ppc_arch_setup): Adjust to the current process'es target description. (ppc_fill_vsxregset, ppc_store_vsxregset, ppc_fill_vrregset) (ppc_store_vrregset, ppc_fill_evrregset, ppc_store_evrregse) (ppc_store_evrregset): Adjust. (target_regsets): Rename to ... (ppc_regsets): ... this, and make static. (ppc_usrregs_info, ppc_regsets_info, regs_info): New globals. (ppc_regs_info): New function. (the_low_target): Adjust. (initialize_low_arch): New function. * linux-s390-low.c (tdesc_s390_linux32, tdesc_s390_linux32v1) (tdesc_s390_linux32v2, tdesc_s390_linux64, tdesc_s390_linux64v1) (tdesc_s390_linux64v2, tdesc_s390x_linux64, tdesc_s390x_linux64v1) (tdesc_s390x_linux64v2): Declare. (s390_collect_ptrace_register, s390_supply_ptrace_register) (s390_fill_gregset, s390_store_last_break): Adjust. (target_regsets): Rename to ... (s390_regsets): ... this, and make static. (s390_get_pc, s390_set_pc): Adjust. (s390_get_hwcap): New target_desc parameter, and use it. [__s390x__] (have_hwcap_s390_high_gprs): New global. (s390_arch_setup): Adjust to set the current process'es target description. Don't adjust the regmap. (s390_usrregs_info, s390_regsets_info, regs_info): New globals. [__s390x__] (s390_usrregs_info_3264, s390_regsets_info_3264) (regs_info_3264): New globals. (s390_regs_info): New function. (the_low_target): Adjust. (initialize_low_arch): New function. * linux-mips-low.c (tdesc_mips_linux, tdesc_mips_dsp_linux) (tdesc_mips64_linux, tdesc_mips64_dsp_linux): Declare. [__mips64] (init_registers_mips_linux) (init_registers_mips_dsp_linux): Delete defines. [__mips64] (tdesc_mips_linux, tdesc_mips_dsp_linux): New defines. (have_dsp): New global. (mips_read_description): New, based on mips_arch_setup. (mips_arch_setup): Reimplement. (get_usrregs_info): New function. (mips_cannot_fetch_register, mips_cannot_store_register) (mips_get_pc, mips_set_pc, mips_fill_gregset, mips_store_gregset) (mips_fill_fpregset, mips_store_fpregset): Adjust. (target_regsets): Rename to ... (mips_regsets): ... this, and make static. (mips_regsets_info, mips_dsp_usrregs_info, mips_usrregs_info) (dsp_regs_info, regs_info): New globals. (mips_regs_info): New function. (the_low_target): Adjust. (initialize_low_arch): New function. * linux-arm-low.c (tdesc_arm, tdesc_arm_with_iwmmxt) (tdesc_arm_with_vfpv2, tdesc_arm_with_vfpv3, tdesc_arm_with_neon): Declare. (arm_fill_vfpregset, arm_store_vfpregset): Adjust. (arm_read_description): New, with bits factored from arm_arch_setup. (arm_arch_setup): Reimplement. (target_regsets): Rename to ... (arm_regsets): ... this, and make static. (arm_regsets_info, arm_usrregs_info, regs_info): New globals. (arm_regs_info): New function. (the_low_target): Adjust. (initialize_low_arch): New function. * linux-m68k-low.c (tdesc_m68k): Declare. (target_regsets): Rename to ... (m68k_regsets): ... this, and make static. (m68k_regsets_info, m68k_usrregs_info, regs_info): New globals. (m68k_regs_info): New function. (m68k_arch_setup): New function. (the_low_target): Adjust. (initialize_low_arch): New function. * linux-sh-low.c (tdesc_sharch): Declare. (target_regsets): Rename to ... (sh_regsets): ... this, and make static. (sh_regsets_info, sh_usrregs_info, regs_info): New globals. (sh_regs_info, sh_arch_setup): New functions. (the_low_target): Adjust. (initialize_low_arch): New function. * linux-bfin-low.c (tdesc_bfin): Declare. (bfin_arch_setup): New function. (bfin_usrregs_info, regs_info): New globals. (bfin_regs_info): New function. (the_low_target): Adjust. (initialize_low_arch): New function. * linux-cris-low.c (tdesc_cris): Declare. (cris_arch_setup): New function. (cris_usrregs_info, regs_info): New globals. (cris_regs_info): New function. (the_low_target): Adjust. (initialize_low_arch): New function. * linux-cris-low.c (tdesc_crisv32): Declare. (cris_arch_setup): New function. (cris_regsets_info, cris_usrregs_info, regs_info): New globals. (cris_regs_info): New function. (the_low_target): Adjust. (initialize_low_arch): New function. * linux-m32r-low.c (tdesc_m32r): Declare. (m32r_arch_setup): New function. (m32r_usrregs_info, regs_info): New globals. (m32r_regs_info): Adjust. (initialize_low_arch): New function. * linux-tic6x-low.c (tdesc_tic6x_c64xp_linux) (tdesc_tic6x_c64x_linux, tdesc_tic6x_c62x_linux): Declare. (tic6x_usrregs_info): Forward declare. (tic6x_read_description): New function, based on ... (tic6x_arch_setup): ... this. Reimplement. (target_regsets): Rename to ... (tic6x_regsets): ... this, and make static. (tic6x_regsets_info, tic6x_usrregs_info, regs_info): New globals. (tic6x_regs_info): New function. (the_low_target): Adjust. (initialize_low_arch): New function. * linux-xtensa-low.c (tdesc_xtensa): Declare. (xtensa_fill_gregset, xtensa_store_gregset): Adjust. (target_regsets): Rename to ... (xtensa_regsets): ... this, and make static. (xtensa_regsets_info, xtensa_usrregs_info, regs_info): New globals. (xtensa_arch_setup, xtensa_regs_info): New functions. (the_low_target): Adjust. (initialize_low_arch): New function. * linux-nios2-low.c (tdesc_nios2_linux): Declare. (nios2_arch_setup): Set the current process'es tdesc. (target_regsets): Rename to ... (nios2_regsets): ... this. (nios2_regsets_info, nios2_usrregs_info, regs_info): New globals. (nios2_regs_info): New function. (the_low_target): Adjust. (initialize_low_arch): New function. * linux-aarch64-low.c (tdesc_aarch64): Declare. (aarch64_arch_setup): Set the current process'es tdesc. (target_regsets): Rename to ... (aarch64_regsets): ... this. (aarch64_regsets_info, aarch64_usrregs_info, regs_info): New globals. (aarch64_regs_info): New function. (the_low_target): Adjust. (initialize_low_arch): New function. * linux-tile-low.c (tdesc_tilegx, tdesc_tilegx32): Declare globals. (target_regsets): Rename to ... (tile_regsets): ... this. (tile_regsets_info, tile_usrregs_info, regs_info): New globals. (tile_regs_info): New function. (tile_arch_setup): Set the current process'es tdesc. (the_low_target): Adjust. (initialize_low_arch): New function. * spu-low.c (tdesc_spu): Declare. (spu_create_inferior, spu_attach): Set the new process'es tdesc. * win32-arm-low.c (tdesc_arm): Declare. (arm_arch_setup): New function. (the_low_target): Install arm_arch_setup instead of init_registers_arm. * win32-i386-low.c (tdesc_i386, tdesc_amd64): Declare. (init_windows_x86): Rename to ... (i386_arch_setup): ... this. Set `win32_tdesc'. (the_low_target): Adjust. * win32-low.c (win32_tdesc): New global. (child_add_thread): Don't create the thread cache here. (do_initial_child_stuff): Set the new process'es tdesc. * win32-low.h (struct target_desc): Forward declare. (win32_tdesc): Declare. * lynx-i386-low.c (tdesc_i386): Declare global. (lynx_i386_arch_setup): Set `lynx_tdesc'. * lynx-low.c (lynx_tdesc): New global. (lynx_add_process): Set the new process'es tdesc. * lynx-low.h (struct target_desc): Forward declare. (lynx_tdesc): Declare global. * lynx-ppc-low.c (tdesc_powerpc_32): Declare global. (lynx_ppc_arch_setup): Set `lynx_tdesc'. * nto-low.c (nto_tdesc): New global. (do_attach): Set the new process'es tdesc. * nto-low.h (struct target_desc): Forward declare. (nto_tdesc): Declare. * nto-x86-low.c (tdesc_i386): Declare. (nto_x86_arch_setup): Set `nto_tdesc'. gdb/ 2013-06-07 Pedro Alves <palves@redhat.com> * regformats/regdat.sh: Output #include tdesc.h. Make globals static. Output a global target description pointer. (init_registers_${name}): Adjust to initialize a target description structure.
2013-06-07 12:46:59 +02:00
};
2002-04-09 Daniel Jacobowitz <drow@mvista.com> * linux-low.h: Remove obsolete prototypes. (struct linux_target_ops): New. (extern the_low_target): New. * linux-low.c (num_regs, regmap): Remove declarations. (register_addr): Use the_low_target explicitly. (fetch_register): Likewise. (usr_fetch_inferior_registers): Likewise. (usr_store_inferior_registers): Likewise. * linux-arm-low.c (num_regs): Remove. (arm_num_regs): Define. (arm_regmap): Renamed from regmap, made static. (arm_cannot_fetch_register): Renamed from cannot_fetch_register, made static. (arm_cannot_store_register): Renamed from cannot_store_register, made static. (the_low_target): New. * linux-i386-low.c (num_regs): Remove. (i386_num_regs): Define. (i386_regmap): Renamed from regmap, made static. (i386_cannot_fetch_register): Renamed from cannot_fetch_register, made static. (i386_cannot_store_register): Renamed from cannot_store_register, made static. (the_low_target): New. * linux-ia64-low.c (num_regs): Remove. (ia64_num_regs): Define. (ia64_regmap): Renamed from regmap, made static. (ia64_cannot_fetch_register): Renamed from cannot_fetch_register, made static. (ia64_cannot_store_register): Renamed from cannot_store_register, made static. (the_low_target): New. * linux-m68k-low.c (num_regs): Remove. (m68k_num_regs): Define. (m68k_regmap): Renamed from regmap, made static. (m68k_cannot_fetch_register): Renamed from cannot_fetch_register, made static. (m68k_cannot_store_register): Renamed from cannot_store_register, made static. (the_low_target): New. * linux-mips-low.c (num_regs): Remove. (mips_num_regs): Define. (mips_regmap): Renamed from regmap, made static. (mips_cannot_fetch_register): Renamed from cannot_fetch_register, made static. (mips_cannot_store_register): Renamed from cannot_store_register, made static. (the_low_target): New. * linux-ppc-low.c (num_regs): Remove. (ppc_num_regs): Define. (ppc_regmap): Renamed from regmap, made static. (ppc_cannot_fetch_register): Renamed from cannot_fetch_register, made static. (ppc_cannot_store_register): Renamed from cannot_store_register, made static. (the_low_target): New. * linux-s390-low.c (num_regs): Remove. (s390_num_regs): Define. (s390_regmap): Renamed from regmap, made static. (s390_cannot_fetch_register): Renamed from cannot_fetch_register, made static. (s390_cannot_store_register): Renamed from cannot_store_register, made static. (the_low_target): New. * linux-sh-low.c (num_regs): Remove. (sh_num_regs): Define. (sh_regmap): Renamed from regmap, made static. (sh_cannot_fetch_register): Renamed from cannot_fetch_register, made static. (sh_cannot_store_register): Renamed from cannot_store_register, made static. (the_low_target): New. * linux-x86-64-low.c (x86_64_regmap): Renamed from regmap. (the_low_target): New.
2002-04-10 00:44:43 +02:00
2009-04-01 Pedro Alves <pedro@codesourcery.com> Implement the multiprocess extensions, and add linux multiprocess support. * server.h (ULONGEST): Declare. (struct ptid, ptid_t): New. (minus_one_ptid, null_ptid): Declare. (ptid_build, pid_to_ptid, ptid_get_pid, ptid_get_lwp) (ptid_get_tid, ptid_equal, ptid_is_pid): Declare. (struct inferior_list_entry): Change `id' type from unsigned from to ptid_t. (struct sym_cache, struct breakpoint, struct process_info_private): Forward declare. (struct process_info): Declare. (current_process): Declare. (all_processes): Declare. (initialize_inferiors): Declare. (add_thread): Adjust to use ptid_t. (thread_id_to_gdb_id, thread_to_gdb_id, gdb_id_to_thread_id): Ditto. (add_process, remove_process, find_thread_pid): Declare. (find_inferior_id): Adjust to use ptid_t. (cont_thread, general_thread, step_thread): Change type to ptid_t. (multi_process): Declare. (push_event): Adjust to use ptid_t. (read_ptid, write_ptid): Declare. (prepare_resume_reply): Adjust to use ptid_t. (clear_symbol_cache): Declare. * inferiors.c (all_processes): New. (null_ptid, minus_one_ptid): New. (ptid_build, pid_to_ptid, ptid_get_pid, ptid_get_lwp) (ptid_get_tid, ptid_equal, ptid_is_pid): New. (add_thread): Change unsigned long to ptid. Remove gdb_id parameter. Adjust. (thread_id_to_gdb_id, thread_to_gdb_id): Change unsigned long to ptid. (gdb_id_to_thread): Rename to ... (find_thread_pid): ... this. Change unsigned long to ptid. (gdb_id_to_thread_id, find_inferior_id): Change unsigned long to ptid. (loaded_dll, pull_pid_from_list): Adjust. (add_process, remove_process, find_process_pid) (get_thread_process, current_process, initialize_inferiors): New. * target.h (struct thread_resume) <thread>: Change type to ptid_t. (struct target_waitstatus) <related_pid>: Ditto. (struct target_ops) <kill, detach>: Add `pid' argument. Change return type to int. (struct target_ops) <join>: Add `pid' argument. (struct target_ops) <thread_alive>: Change pid's type to ptid_t. (struct target_ops) <wait>: Add `ptid' field. Change return type to ptid. (kill_inferior, detach_inferior, join_inferior): Add `pid' argument. (mywait): Add `ptid' argument. Change return type to ptid_t. (target_pid_to_str): Declare. * target.c (set_desired_inferior): Adjust to use ptids. (mywait): Add new `ptid' argument. Adjust. (target_pid_to_str): New. * mem-break.h (free_all_breakpoints): Declare. * mem-break.c (breakpoints): Delelete. (set_breakpoint_at, delete_breakpoint, find_breakpoint_at) (check_mem_read, check_mem_write, delete_all_breakpoints): Adjust to use per-process breakpoint list. (free_all_breakpoints): New. * remote-utils.c (struct sym_cache) <name>: Drop `const'. (symbol_cache, all_symbols_looked_up): Delete. (hexchars): New. (ishex, unpack_varlen_hex, write_ptid, hex_or_minus_one, read_ptid): New. (prepare_resume_reply): Change ptid argument's type from unsigned long to ptid_t. Adjust. Implement W;process and X;process. (free_sym_cache, clear_symbol_cache): New. (look_up_one_symbol): Adjust to per-process symbol cache. * * server.c (cont_thread, general_thread, step_thread): Change type to ptid_t. (attached): Delete. (multi_process): New. (last_ptid): Change type to ptid_t. (struct vstop_notif) <ptid>: Change type to ptid_t. (queue_stop_reply, push_event): Change `ptid' argument's type to ptid_t. (discard_queued_stop_replies): Add `pid' argument. (start_inferior): Adjust to use ptids. Adjust to mywait interface changes. Don't reference the `attached' global. (attach_inferior): Adjust to mywait interface changes. (handle_query): Adjust to use ptids. Parse GDB's qSupported features. Handle and report "multiprocess+". Handle "qAttached:PID". (handle_v_cont): Adjust to use ptids. Adjust to mywait interface changes. (handle_v_kill): New. (handle_v_stopped): Adjust to use target_pid_to_str. (handle_v_requests): Allow multiple attaches and runs when multiprocess extensions are in effect. Handle "vKill". (myresume): Adjust to use ptids. (queue_stop_reply_callback): Add `arg' parameter. Handle it. (handle_status): Adjust to discard_queued_stop_replies interface change. (first_thread_of, kill_inferior_callback) (detach_or_kill_inferior_callback, join_inferiors_callback): New. (main): Call initialize_inferiors. Adjust to use ptids, killing and detaching from all inferiors. Handle multiprocess packet variants. * linux-low.h: Include gdb_proc_service.h. (struct process_info_private): New. (struct linux_target_ops) <pid_of>: Use ptid_get_pid. <lwpid_of>: Use ptid_get_lwp. (get_lwp_thread): Adjust. (struct lwp_info): Add `dead' member. (find_lwp_pid): Declare. * linux-low.c (thread_db_active): Delete. (new_inferior): Adjust comment. (inferior_pid): Delete. (linux_add_process): New. (handle_extended_wait): Adjust. (add_lwp): Change unsigned long to ptid. (linux_create_inferior): Add process to processes table. Adjust to use ptids. Don't set new_inferior here. (linux_attach_lwp): Rename to ... (linux_attach_lwp_1): ... this. Add `initial' argument. Handle it. Adjust to use ptids. (linux_attach_lwp): New. (linux_attach): Add process to processes table. Don't set new_inferior here. (struct counter): New. (second_thread_of_pid_p, last_thread_of_process_p): New. (linux_kill_one_lwp): Add `args' parameter. Handle it. Adjust to multiple processes. (linux_kill): Add `pid' argument. Handle it. Adjust to multiple processes. Remove process from process table. (linux_detach_one_lwp): Add `args' parameter. Handle it. Adjust to multiple processes. (any_thread_of): New. (linux_detach): Add `pid' argument, and handle it. Remove process from processes table. (linux_join): Add `pid' argument. Handle it. (linux_thread_alive): Change unsighed long argument to ptid_t. Consider dead lwps as not being alive. (status_pending_p): Rename `dummy' argument to `arg'. Filter out threads we're not interested in. (same_lwp, find_lwp_pid): New. (linux_wait_for_lwp): Change `pid' argument's type from int to ptid_t. Adjust. (linux_wait_for_event): Rename to ... (linux_wait_for_event_1): ... this. Change `pid' argument's type from int to ptid_t. Adjust. (linux_wait_for_event): New. (linux_wait_1): Add `ptid' argument. Change return type to ptid_t. Adjust. Use last_thread_of_process_p. Remove processes that exit from the process table. (linux_wait): Add `ptid' argument. Change return type to ptid_t. Adjust. (mark_lwp_dead): New. (wait_for_sigstop): Adjust to use ptids. If a process exits while stopping all threads, mark its main lwp as dead. (linux_set_resume_request, linux_resume_one_thread): Adjust to use ptids. (fetch_register, usr_store_inferior_registers) (regsets_fetch_inferior_registers) (regsets_store_inferior_registers, linux_read_memory) (linux_write_memory): Inline `inferior_pid'. (linux_look_up_symbols): Adjust to use per-process `thread_db_active'. (linux_request_interrupt): Adjust to use ptids. (linux_read_auxv): Inline `inferior_pid'. (initialize_low): Don't reference thread_db_active. * gdb_proc_service.h (struct ps_prochandle) <pid>: Remove. * proc-service.c (ps_lgetregs): Use find_lwp_pid. (ps_getpid): Return the pid of the current inferior. * thread-db.c (proc_handle, thread_agent): Delete. (thread_db_create_event, thread_db_enable_reporting): Adjust to per-process data. (find_one_thread): Change argument type to ptid_t. Adjust to per-process data. (maybe_attach_thread): Adjust to per-process data and ptids. (thread_db_find_new_threads): Ditto. (thread_db_init): Ditto. * spu-low.c (spu_create_inferior, spu_attach): Add process to processes table. Adjust to use ptids. (spu_kill, spu_detach): Adjust interface. Remove process from processes table. (spu_join, spu_thread_alive): Adjust interface. (spu_wait): Adjust interface. Remove process from processes table. Adjust to use ptids. * win32-low.c (current_inferior_tid): Delete. (current_inferior_ptid): New. (debug_event_ptid): New. (thread_rec): Take a ptid. Adjust. (child_add_thread): Add `pid' argument. Adjust to use ptids. (child_delete_thread): Ditto. (do_initial_child_stuff): Add `attached' argument. Add process to processes table. (child_fetch_inferior_registers, child_store_inferior_registers): Adjust. (win32_create_inferior): Pass 0 to do_initial_child_stuff. (win32_attach): Pass 1 to do_initial_child_stuff. (win32_kill): Adjust interface. Remove process from processes table. (win32_detach): Ditto. (win32_join): Adjust interface. (win32_thread_alive): Take a ptid. (win32_resume): Adjust to use ptids. (get_child_debug_event): Ditto. (win32_wait): Adjust interface. Remove exiting process from processes table.
2009-04-02 00:50:24 +02:00
struct process_info_private
{
Add h/w watchpoint support to x86-linux, win32-i386. * Makefile.in (SFILES): Add i386-low.c (i386_low_h): Define. (i386-low.o): Add dependencies. (linux-x86-low.o): Add i386-low.h dependency. (win32-i386-low.o): Ditto. * i386-low.c: New file. * i386-low.h: New file. * configure.srv (i[34567]86-*-cygwin*): Add i386-low.o to srv_tgtobj. (i[34567]86-*-linux*, i[34567]86-*-mingw*, x86_64-*-linux*): Ditto. * linux-low.c (linux_add_process): Initialize arch_private. (linux_remove_process): Free arch_private. (add_lwp): Initialize arch_private. (delete_lwp): Free arch_private. (linux_resume_one_lwp): Call the_low_target.prepare_to_resume if provided. * linux-low.h (process_info_private): New member arch_private. (lwp_info): New member arch_private. (linux_target_ops): New members new_process, new_thread, prepare_to_resume. (ptid_of): New macro. * linux-x86-low.c: Include stddef.h, i386-low.h. (arch_process_info): New struct. (arch_lwp_info): New struct. (x86_linux_dr_get, x86_linux_dr_set): New functions. (i386_dr_low_set_addr, i386_dr_low_set_control): New functions. (i386_dr_low_get_status): New function. (x86_insert_point, x86_remove_point): New functions. (x86_stopped_by_watchpoint): New function. (x86_stopped_data_address): New function. (x86_linux_new_process, x86_linux_new_thread): New functions. (x86_linux_prepare_to_resume): New function. (the_low_target): Add entries for insert_point, remove_point, stopped_by_watchpoint, stopped_data_address, new_process, new_thread, prepare_to_resume. * server.c (debug_hw_points): New global. (monitor_show_help): Document set debug-hw-points. (handle_query): Process "set debug-hw-points". * server.h (debug_hw_points): Declare. (paddress): Declare. * utils.c (NUMCELLS, CELLSIZE): New macros. (get_sell, xsnprintf, paddress): New functions. * win32-arm-low.c (the_low_target): Add entries for insert_point, remove_point, stopped_by_watchpoint, stopped_data_address. * win32-i386-low.c: Include i386-low.h. (debug_reg_state): Replaces dr. (i386_dr_low_set_addr, i386_dr_low_set_control): New functions. (i386_dr_low_get_status): New function. (i386_insert_point, i386_remove_point): New functions. (i386_stopped_by_watchpoint): New function. (i386_stopped_data_address): New function. (i386_initial_stuff): Update. (get_thread_context,set_thread_context,i386_thread_added): Update. (the_low_target): Add entries for insert_point, remove_point, stopped_by_watchpoint, stopped_data_address. * win32-low.c (win32_insert_watchpoint): New function. (win32_remove_watchpoint): New function. (win32_stopped_by_watchpoint): New function. (win32_stopped_data_address): New function. (win32_target_ops): Add entries for insert_watchpoint, remove_watchpoint, stopped_by_watchpoint, stopped_data_address. * win32-low.h (win32_target_ops): New members insert_point, remove_point, stopped_by_watchpoint, stopped_data_address.
2009-06-30 18:35:25 +02:00
/* Arch-specific additions. */
struct arch_process_info *arch_private;
/* libthread_db-specific additions. Not NULL if this process has loaded
thread_db, and it is active. */
struct thread_db *thread_db;
gdb/ * Makefile.in (XMLFILES): Add library-list-svr4.dtd. * features/library-list-svr4.dtd: New file. * remote.c (PACKET_qXfer_libraries_svr4): New. (remote_protocol_features): new entry for PACKET_qXfer_libraries_svr4. (remote_xfer_partial): Handle TARGET_OBJECT_LIBRARIES_SVR4. * solib-svr4.c (struct svr4_library_list): New. [HAVE_LIBEXPAT]: Include xml-support.h. [HAVE_LIBEXPAT] (svr4_library_list_start_library) [HAVE_LIBEXPAT] (svr4_library_list_start_list, svr4_library_attributes) [HAVE_LIBEXPAT] (svr4_library_list_children) [HAVE_LIBEXPAT] (svr4_library_list_attributes) [HAVE_LIBEXPAT] (svr4_library_list_elements, svr4_parse_libraries) [HAVE_LIBEXPAT] (svr4_current_sos_via_xfer_libraries) [!HAVE_LIBEXPAT] (svr4_current_sos_via_xfer_libraries): New. (svr4_read_so_list): Extend the corruption message by addresses. (svr4_current_sos): New variable library_list, call svr4_current_sos_via_xfer_libraries. * target.h (enum target_object): New TARGET_OBJECT_LIBRARIES_SVR4. gdb/gdbserver/ * linux-low.c (get_phdr_phnum_from_proc_auxv, get_dynamic, get_r_debug) (read_one_ptr, struct link_map_offsets, linux_qxfer_libraries_svr4): New. (struct linux_target_ops): Install linux_qxfer_libraries_svr4. * linux-low.h (struct process_info_private): New member r_debug. * server.c (handle_qxfer_libraries): Call the_target->qxfer_libraries_svr4. (handle_qxfer_libraries_svr4): New function. (qxfer_packets): New entry "libraries-svr4". (handle_query): Check QXFER_LIBRARIES_SVR4 and report libraries-svr4. * target.h (struct target_ops): New member qxfer_libraries_svr4. * remote.c (remote_xfer_partial): Call add_packet_config_cmd for PACKET_qXfer_libraries_svr4. gdb/doc/ * gdb.texinfo (Requirements, Remote Protocol): Reference also `Library List Format for SVR4 Targets'. (General Query Packets): New item qXfer:libraries-svr4:read. (Library List Format for SVR4 Targets): New node. gdb/testsuite/ * gdb.base/solib-corrupted.exp: Suppress test on is_remote target. (corrupted list): Adjust the expectation.
2011-12-02 23:26:54 +01:00
/* &_r_debug. 0 if not yet determined. -1 if no PT_DYNAMIC in Phdrs. */
CORE_ADDR r_debug;
2009-04-01 Pedro Alves <pedro@codesourcery.com> Implement the multiprocess extensions, and add linux multiprocess support. * server.h (ULONGEST): Declare. (struct ptid, ptid_t): New. (minus_one_ptid, null_ptid): Declare. (ptid_build, pid_to_ptid, ptid_get_pid, ptid_get_lwp) (ptid_get_tid, ptid_equal, ptid_is_pid): Declare. (struct inferior_list_entry): Change `id' type from unsigned from to ptid_t. (struct sym_cache, struct breakpoint, struct process_info_private): Forward declare. (struct process_info): Declare. (current_process): Declare. (all_processes): Declare. (initialize_inferiors): Declare. (add_thread): Adjust to use ptid_t. (thread_id_to_gdb_id, thread_to_gdb_id, gdb_id_to_thread_id): Ditto. (add_process, remove_process, find_thread_pid): Declare. (find_inferior_id): Adjust to use ptid_t. (cont_thread, general_thread, step_thread): Change type to ptid_t. (multi_process): Declare. (push_event): Adjust to use ptid_t. (read_ptid, write_ptid): Declare. (prepare_resume_reply): Adjust to use ptid_t. (clear_symbol_cache): Declare. * inferiors.c (all_processes): New. (null_ptid, minus_one_ptid): New. (ptid_build, pid_to_ptid, ptid_get_pid, ptid_get_lwp) (ptid_get_tid, ptid_equal, ptid_is_pid): New. (add_thread): Change unsigned long to ptid. Remove gdb_id parameter. Adjust. (thread_id_to_gdb_id, thread_to_gdb_id): Change unsigned long to ptid. (gdb_id_to_thread): Rename to ... (find_thread_pid): ... this. Change unsigned long to ptid. (gdb_id_to_thread_id, find_inferior_id): Change unsigned long to ptid. (loaded_dll, pull_pid_from_list): Adjust. (add_process, remove_process, find_process_pid) (get_thread_process, current_process, initialize_inferiors): New. * target.h (struct thread_resume) <thread>: Change type to ptid_t. (struct target_waitstatus) <related_pid>: Ditto. (struct target_ops) <kill, detach>: Add `pid' argument. Change return type to int. (struct target_ops) <join>: Add `pid' argument. (struct target_ops) <thread_alive>: Change pid's type to ptid_t. (struct target_ops) <wait>: Add `ptid' field. Change return type to ptid. (kill_inferior, detach_inferior, join_inferior): Add `pid' argument. (mywait): Add `ptid' argument. Change return type to ptid_t. (target_pid_to_str): Declare. * target.c (set_desired_inferior): Adjust to use ptids. (mywait): Add new `ptid' argument. Adjust. (target_pid_to_str): New. * mem-break.h (free_all_breakpoints): Declare. * mem-break.c (breakpoints): Delelete. (set_breakpoint_at, delete_breakpoint, find_breakpoint_at) (check_mem_read, check_mem_write, delete_all_breakpoints): Adjust to use per-process breakpoint list. (free_all_breakpoints): New. * remote-utils.c (struct sym_cache) <name>: Drop `const'. (symbol_cache, all_symbols_looked_up): Delete. (hexchars): New. (ishex, unpack_varlen_hex, write_ptid, hex_or_minus_one, read_ptid): New. (prepare_resume_reply): Change ptid argument's type from unsigned long to ptid_t. Adjust. Implement W;process and X;process. (free_sym_cache, clear_symbol_cache): New. (look_up_one_symbol): Adjust to per-process symbol cache. * * server.c (cont_thread, general_thread, step_thread): Change type to ptid_t. (attached): Delete. (multi_process): New. (last_ptid): Change type to ptid_t. (struct vstop_notif) <ptid>: Change type to ptid_t. (queue_stop_reply, push_event): Change `ptid' argument's type to ptid_t. (discard_queued_stop_replies): Add `pid' argument. (start_inferior): Adjust to use ptids. Adjust to mywait interface changes. Don't reference the `attached' global. (attach_inferior): Adjust to mywait interface changes. (handle_query): Adjust to use ptids. Parse GDB's qSupported features. Handle and report "multiprocess+". Handle "qAttached:PID". (handle_v_cont): Adjust to use ptids. Adjust to mywait interface changes. (handle_v_kill): New. (handle_v_stopped): Adjust to use target_pid_to_str. (handle_v_requests): Allow multiple attaches and runs when multiprocess extensions are in effect. Handle "vKill". (myresume): Adjust to use ptids. (queue_stop_reply_callback): Add `arg' parameter. Handle it. (handle_status): Adjust to discard_queued_stop_replies interface change. (first_thread_of, kill_inferior_callback) (detach_or_kill_inferior_callback, join_inferiors_callback): New. (main): Call initialize_inferiors. Adjust to use ptids, killing and detaching from all inferiors. Handle multiprocess packet variants. * linux-low.h: Include gdb_proc_service.h. (struct process_info_private): New. (struct linux_target_ops) <pid_of>: Use ptid_get_pid. <lwpid_of>: Use ptid_get_lwp. (get_lwp_thread): Adjust. (struct lwp_info): Add `dead' member. (find_lwp_pid): Declare. * linux-low.c (thread_db_active): Delete. (new_inferior): Adjust comment. (inferior_pid): Delete. (linux_add_process): New. (handle_extended_wait): Adjust. (add_lwp): Change unsigned long to ptid. (linux_create_inferior): Add process to processes table. Adjust to use ptids. Don't set new_inferior here. (linux_attach_lwp): Rename to ... (linux_attach_lwp_1): ... this. Add `initial' argument. Handle it. Adjust to use ptids. (linux_attach_lwp): New. (linux_attach): Add process to processes table. Don't set new_inferior here. (struct counter): New. (second_thread_of_pid_p, last_thread_of_process_p): New. (linux_kill_one_lwp): Add `args' parameter. Handle it. Adjust to multiple processes. (linux_kill): Add `pid' argument. Handle it. Adjust to multiple processes. Remove process from process table. (linux_detach_one_lwp): Add `args' parameter. Handle it. Adjust to multiple processes. (any_thread_of): New. (linux_detach): Add `pid' argument, and handle it. Remove process from processes table. (linux_join): Add `pid' argument. Handle it. (linux_thread_alive): Change unsighed long argument to ptid_t. Consider dead lwps as not being alive. (status_pending_p): Rename `dummy' argument to `arg'. Filter out threads we're not interested in. (same_lwp, find_lwp_pid): New. (linux_wait_for_lwp): Change `pid' argument's type from int to ptid_t. Adjust. (linux_wait_for_event): Rename to ... (linux_wait_for_event_1): ... this. Change `pid' argument's type from int to ptid_t. Adjust. (linux_wait_for_event): New. (linux_wait_1): Add `ptid' argument. Change return type to ptid_t. Adjust. Use last_thread_of_process_p. Remove processes that exit from the process table. (linux_wait): Add `ptid' argument. Change return type to ptid_t. Adjust. (mark_lwp_dead): New. (wait_for_sigstop): Adjust to use ptids. If a process exits while stopping all threads, mark its main lwp as dead. (linux_set_resume_request, linux_resume_one_thread): Adjust to use ptids. (fetch_register, usr_store_inferior_registers) (regsets_fetch_inferior_registers) (regsets_store_inferior_registers, linux_read_memory) (linux_write_memory): Inline `inferior_pid'. (linux_look_up_symbols): Adjust to use per-process `thread_db_active'. (linux_request_interrupt): Adjust to use ptids. (linux_read_auxv): Inline `inferior_pid'. (initialize_low): Don't reference thread_db_active. * gdb_proc_service.h (struct ps_prochandle) <pid>: Remove. * proc-service.c (ps_lgetregs): Use find_lwp_pid. (ps_getpid): Return the pid of the current inferior. * thread-db.c (proc_handle, thread_agent): Delete. (thread_db_create_event, thread_db_enable_reporting): Adjust to per-process data. (find_one_thread): Change argument type to ptid_t. Adjust to per-process data. (maybe_attach_thread): Adjust to per-process data and ptids. (thread_db_find_new_threads): Ditto. (thread_db_init): Ditto. * spu-low.c (spu_create_inferior, spu_attach): Add process to processes table. Adjust to use ptids. (spu_kill, spu_detach): Adjust interface. Remove process from processes table. (spu_join, spu_thread_alive): Adjust interface. (spu_wait): Adjust interface. Remove process from processes table. Adjust to use ptids. * win32-low.c (current_inferior_tid): Delete. (current_inferior_ptid): New. (debug_event_ptid): New. (thread_rec): Take a ptid. Adjust. (child_add_thread): Add `pid' argument. Adjust to use ptids. (child_delete_thread): Ditto. (do_initial_child_stuff): Add `attached' argument. Add process to processes table. (child_fetch_inferior_registers, child_store_inferior_registers): Adjust. (win32_create_inferior): Pass 0 to do_initial_child_stuff. (win32_attach): Pass 1 to do_initial_child_stuff. (win32_kill): Adjust interface. Remove process from processes table. (win32_detach): Ditto. (win32_join): Adjust interface. (win32_thread_alive): Take a ptid. (win32_resume): Adjust to use ptids. (get_child_debug_event): Ditto. (win32_wait): Adjust interface. Remove exiting process from processes table.
2009-04-02 00:50:24 +02:00
};
Add h/w watchpoint support to x86-linux, win32-i386. * Makefile.in (SFILES): Add i386-low.c (i386_low_h): Define. (i386-low.o): Add dependencies. (linux-x86-low.o): Add i386-low.h dependency. (win32-i386-low.o): Ditto. * i386-low.c: New file. * i386-low.h: New file. * configure.srv (i[34567]86-*-cygwin*): Add i386-low.o to srv_tgtobj. (i[34567]86-*-linux*, i[34567]86-*-mingw*, x86_64-*-linux*): Ditto. * linux-low.c (linux_add_process): Initialize arch_private. (linux_remove_process): Free arch_private. (add_lwp): Initialize arch_private. (delete_lwp): Free arch_private. (linux_resume_one_lwp): Call the_low_target.prepare_to_resume if provided. * linux-low.h (process_info_private): New member arch_private. (lwp_info): New member arch_private. (linux_target_ops): New members new_process, new_thread, prepare_to_resume. (ptid_of): New macro. * linux-x86-low.c: Include stddef.h, i386-low.h. (arch_process_info): New struct. (arch_lwp_info): New struct. (x86_linux_dr_get, x86_linux_dr_set): New functions. (i386_dr_low_set_addr, i386_dr_low_set_control): New functions. (i386_dr_low_get_status): New function. (x86_insert_point, x86_remove_point): New functions. (x86_stopped_by_watchpoint): New function. (x86_stopped_data_address): New function. (x86_linux_new_process, x86_linux_new_thread): New functions. (x86_linux_prepare_to_resume): New function. (the_low_target): Add entries for insert_point, remove_point, stopped_by_watchpoint, stopped_data_address, new_process, new_thread, prepare_to_resume. * server.c (debug_hw_points): New global. (monitor_show_help): Document set debug-hw-points. (handle_query): Process "set debug-hw-points". * server.h (debug_hw_points): Declare. (paddress): Declare. * utils.c (NUMCELLS, CELLSIZE): New macros. (get_sell, xsnprintf, paddress): New functions. * win32-arm-low.c (the_low_target): Add entries for insert_point, remove_point, stopped_by_watchpoint, stopped_data_address. * win32-i386-low.c: Include i386-low.h. (debug_reg_state): Replaces dr. (i386_dr_low_set_addr, i386_dr_low_set_control): New functions. (i386_dr_low_get_status): New function. (i386_insert_point, i386_remove_point): New functions. (i386_stopped_by_watchpoint): New function. (i386_stopped_data_address): New function. (i386_initial_stuff): Update. (get_thread_context,set_thread_context,i386_thread_added): Update. (the_low_target): Add entries for insert_point, remove_point, stopped_by_watchpoint, stopped_data_address. * win32-low.c (win32_insert_watchpoint): New function. (win32_remove_watchpoint): New function. (win32_stopped_by_watchpoint): New function. (win32_stopped_data_address): New function. (win32_target_ops): Add entries for insert_watchpoint, remove_watchpoint, stopped_by_watchpoint, stopped_data_address. * win32-low.h (win32_target_ops): New members insert_point, remove_point, stopped_by_watchpoint, stopped_data_address.
2009-06-30 18:35:25 +02:00
struct lwp_info;
gdbserver: start turning the target ops vector into a class This is the beginning of a series of patches where the goal is to turn the target ops vector into a class and all the target op function pointers into methods of this class. Currently, the target ops is a struct of function pointers. At the end of the series, it becomes a class with methods, and the existing low target definitions become subclasses. That is, we end up with the following class hierarchy: process_stratum_target ^ |-- linux-low |-- lynx-low |-- nto-low |-- win32-low process_stratum_target either defines the default behavior for the target ops or leaves them as pure virtual for the subclasses to override. The transformation is done by first introducing a helper class, called 'process_target', that is initially empty. An instance of this class is added to the end of the current target ops vector. This new field is called 'pt'. We will gradually carry target ops to the new class, one by one, whereas the invocation of the target op will be converted to a method call on 'pt'. For instance, target op 'attach' is currently invoked as (*the_target->attach) (args) After moving 'attach' as a method to 'process_target', it will be invoked as the_target->pt->attach (args) In this process, the concrete target vector definitions (e.g. linux-low, win32-low, nto-low, etc.) are turned into derived classes of 'process_target', so that they can either inherit the default behavior of the target ops or can override the method. We prefer to make this transition gradually rather than in a single giant patch, to yield bite-size patches. The goal is that after each patch gdbserver will still be buildable and testable. The general rule of thumb when converting a target op to a method is this: (1) If the function call is protected with a NULL-check with an obvious default behavior, simply implement that default behavior in the base class (e.g.: supports_non_stop). (2) If there is no NULL-check guard, the method becomes pure virtual, and the derived targets are required to implement the method (e.g.: attach). (3) If there is a NULL-check but no apparent default behavior, or if the NULL-check is utilized to populate a feature support packet, introduce a 'supports_XYZ' method (e.g.: pid_to_exec_file). The overall strategy is to preserve the existing behavior as much as possible. When we're done moving all the target ops into 'process_target', the target op vector will contain nothing but the field 'pt'. At that point, the auxiliary class 'process_target' will simply meld into 'process_stratum_target' and the method calls of the form 'the_target->pt->xyz' will be turned into 'the_target->xyz'. The "linux-low" target has been built and reg-tested on X86_64 Linux (Ubuntu). The "win32-low" target has been built (but not tested) via cross-compilation to a x86_64-w64-mingw32 target. The "lynx-low" and "nto-low" targets were neither built nor tested. gdbserver/ChangeLog: 2020-02-20 Tankut Baris Aktemur <tankut.baris.aktemur@intel.com> * target.h (class process_target): New class definition. (struct process_stratum_target) <pt>: New field with type 'process_target*'. * linux-low.h (class linux_process_target): Define as a derived class of 'process_target'. * linux-low.cc (linux_target_ops): Add a linux_process_target* as the 'pt' field. * lynx-low.h (class lynx_process_target): Define as a derived class of 'process_target'. * lynx-low.cc (lynx_target_ops): Add a lynx_process_target* as the 'pt' field. * nto-low.h (class nto_process_target): Define as a derived class of 'process_target'. * nto-low.cc (nto_target_ops): Add an nto_process_target* as the 'pt' field. * win32-low.h (class win32_process_target): Define as a derived class of 'process_target'. * win32-low.cc (win32_target_ops): Add a win32_process_target* as the 'pt' field.
2020-02-17 16:11:50 +01:00
/* Target ops definitions for a Linux target. */
gdbserver: finish turning the target ops vector into a class Now that 'process_stratum_target' has a single field left, namely 'pt' of type 'process_target', and that all the requests to a 'process_stratum_target' are forwarded to 'pt', meld the 'process_target' class into 'process_stratum_target'. This essentially means 1. All the references of the form 'the_target->pt' become 'the_target'. 2. All the uses of the name 'process_target' become 'process_stratum_target'. 3. The platform-specific target op vectors (e.g. linux_target_ops) are removed and instances of their "process target" classes are used instead. gdbserver/ChangeLog: 2020-02-20 Tankut Baris Aktemur <tankut.baris.aktemur@intel.com> * target.h (struct process_stratum_target): Remove. (class process_target): Rename to ... (class process_stratum_target): ... this. * linux-low.h (class linux_process_target): Derive from 'process_stratum_target'. * linux-low.cc (linux_target_ops): Remove. (initialize_low): Set the_target to the singleton instance of linux_process_target. * lynx-low.h (class lynx_process_target): Derive from 'process_stratum_target'. * lynx-low.cc (lynx_target_ops): Remove. (initialize_low): Set the_target to the singleton instance of lynx_process_target. * nto-low.h (class nto_process_target): Derive from 'process_stratum_target'. * nto-low.cc (nto_target_ops): Remove. (initialize_low): Set the_target to the singleton instance of nto_process_target. * win32-low.h (class win32_process_target): Derive from 'process_stratum_target'. * win32-low.cc (win32_target_ops): Remove. (initialize_low): Set the_target to the singleton instance of win32_process_target. Replace 'the_target->pt' with 'the_target' in the uses below. * hostio.cc (hostio_error) (handle_setfs) (handle_open) (handle_unlink) (handle_readlink) * linux-aarch32-low.cc (arm_breakpoint_at) * linux-aarch64-low.cc (aarch64_breakpoint_at) * linux-arm-low.cc (arm_sigreturn_next_pc) (arm_get_hwcap) (arm_get_syscall_trapinfo) * linux-cris-low.cc (cris_breakpoint_at) * linux-crisv32-low.cc (cris_breakpoint_at) * linux-low.cc (handle_extended_wait) (linux_wait_1) (linux_read_memory) (linux_process_target::breakpoint_kind_from_pc) (linux_get_auxv) * linux-m32r-low.cc (m32r_breakpoint_at) * linux-mips-low.cc (mips_breakpoint_at) * linux-nios2-low.cc (nios2_breakpoint_at) * linux-ppc-low.cc (ppc_breakpoint_at) * linux-s390-low.cc (s390_get_hwcap) * linux-sh-low.cc (sh_breakpoint_at) * linux-sparc-low.cc (sparc_fill_gregset_to_stack) (sparc_store_gregset_from_stack) (sparc_breakpoint_at) * linux-tic6x-low.cc (tic6x_breakpoint_at) * linux-tile-low.cc (tile_breakpoint_at) * linux-x86-low.cc (x86_breakpoint_at) * linux-xtensa-low.cc (xtensa_breakpoint_at) * mem-break.cc (bp_size) (bp_opcode) (insert_memory_breakpoint) (set_raw_breakpoint_at) (delete_raw_breakpoint) (z_type_supported) (uninsert_raw_breakpoint) (reinsert_raw_breakpoint) (validate_inserted_breakpoint) * regcache.cc (regcache_read_pc) (regcache_write_pc) * remote-utils.cc (putpkt_binary_1) (input_interrupt) (getpkt) (prepare_resume_reply) * server.cc (handle_general_set) (handle_detach) (handle_qxfer_auxv) (handle_qxfer_exec_file) (handle_qxfer_libraries_svr4) (handle_qxfer_osdata) (handle_qxfer_siginfo) (handle_qxfer_fdpic) (handle_query) (resume) (handle_v_requests) (queue_stop_reply_callback) (captured_main) * target.cc (prepare_to_access_memory) (done_accessing_memory) (read_inferior_memory) (target_write_memory) (target_stop_and_wait) (target_wait) (target_mourn_inferior) (target_continue_no_signal) (target_continue) (target_supports_multi_process) (kill_inferior) * target.h (target_create_inferior) (target_post_create_inferior) (myattach) (target_supports_fork_events) (target_supports_vfork_events) (target_supports_exec_events) (target_handle_new_gdb_connection) (detach_inferior) (mythread_alive) (fetch_inferior_registers) (store_inferior_registers) (join_inferior) (target_supports_non_stop) (target_async) (target_process_qsupported) (target_supports_catch_syscall) (target_get_ipa_tdesc_idx) (target_supports_tracepoints) (target_supports_fast_tracepoints) (target_get_min_fast_tracepoint_insn_len) (target_thread_stopped) (target_pause_all) (target_unpause_all) (target_stabilize_threads) (target_install_fast_tracepoint_jump_pad) (target_emit_ops) (target_supports_disable_randomization) (target_supports_agent) (target_enable_btrace) (target_disable_btrace) (target_read_btrace) (target_read_btrace_conf) (target_supports_range_stepping) (target_supports_stopped_by_sw_breakpoint) (target_stopped_by_sw_breakpoint) (target_supports_stopped_by_hw_breakpoint) (target_supports_hardware_single_step) (target_stopped_by_hw_breakpoint) (target_breakpoint_kind_from_pc) (target_breakpoint_kind_from_current_state) (target_supports_software_single_step) (target_core_of_thread) (target_thread_name) (target_thread_handle) * win32-low.cc (do_initial_child_stuff) Rename target op default definitions listed below. * target.cc (process_target::post_create_inferior): Rename as ... (process_stratum_target::post_create_inferior): ... this. (process_target::prepare_to_access_memory): Rename as ... (process_stratum_target::prepare_to_access_memory): ... this. (process_target::done_accessing_memory): Rename as ... (process_stratum_target::done_accessing_memory): ... this. (process_target::look_up_symbols): Rename as ... (process_stratum_target::look_up_symbols): ... this. (process_target::supports_read_auxv): Rename as ... (process_stratum_target::supports_read_auxv): ... this. (process_target::read_auxv): Rename as ... (process_stratum_target::read_auxv): ... this. (process_target::supports_z_point_type): Rename as ... (process_stratum_target::supports_z_point_type): ... this. (process_target::insert_point): Rename as ... (process_stratum_target::insert_point): ... this. (process_target::remove_point): Rename as ... (process_stratum_target::remove_point): ... this. (process_target::stopped_by_sw_breakpoint): Rename as ... (process_stratum_target::stopped_by_sw_breakpoint): ... this. (process_target::supports_stopped_by_sw_breakpoint): Rename as ... (process_stratum_target::supports_stopped_by_sw_breakpoint): ... this. (process_target::stopped_by_hw_breakpoint): Rename as ... (process_stratum_target::stopped_by_hw_breakpoint): ... this. (process_target::supports_stopped_by_hw_breakpoint): Rename as ... (process_stratum_target::supports_stopped_by_hw_breakpoint): ... this. (process_target::supports_hardware_single_step): Rename as ... (process_stratum_target::supports_hardware_single_step): ... this. (process_target::stopped_by_watchpoint): Rename as ... (process_stratum_target::stopped_by_watchpoint): ... this. (process_target::stopped_data_address): Rename as ... (process_stratum_target::stopped_data_address): ... this. (process_target::supports_read_offsets): Rename as ... (process_stratum_target::supports_read_offsets): ... this. (process_target::read_offsets): Rename as ... (process_stratum_target::read_offsets): ... this. (process_target::supports_get_tls_address): Rename as ... (process_stratum_target::supports_get_tls_address): ... this. (process_target::get_tls_address): Rename as ... (process_stratum_target::get_tls_address): ... this. (process_target::hostio_last_error): Rename as ... (process_stratum_target::hostio_last_error): ... this. (process_target::supports_qxfer_osdata): Rename as ... (process_stratum_target::supports_qxfer_osdata): ... this. (process_target::qxfer_osdata): Rename as ... (process_stratum_target::qxfer_osdata): ... this. (process_target::supports_qxfer_siginfo): Rename as ... (process_stratum_target::supports_qxfer_siginfo): ... this. (process_target::qxfer_siginfo): Rename as ... (process_stratum_target::qxfer_siginfo): ... this. (process_target::supports_non_stop): Rename as ... (process_stratum_target::supports_non_stop): ... this. (process_target::async): Rename as ... (process_stratum_target::async): ... this. (process_target::start_non_stop): Rename as ... (process_stratum_target::start_non_stop): ... this. (process_target::supports_multi_process): Rename as ... (process_stratum_target::supports_multi_process): ... this. (process_target::supports_fork_events): Rename as ... (process_stratum_target::supports_fork_events): ... this. (process_target::supports_vfork_events): Rename as ... (process_stratum_target::supports_vfork_events): ... this. (process_target::supports_exec_events): Rename as ... (process_stratum_target::supports_exec_events): ... this. (process_target::handle_new_gdb_connection): Rename as ... (process_stratum_target::handle_new_gdb_connection): ... this. (process_target::handle_monitor_command): Rename as ... (process_stratum_target::handle_monitor_command): ... this. (process_target::core_of_thread): Rename as ... (process_stratum_target::core_of_thread): ... this. (process_target::supports_read_loadmap): Rename as ... (process_stratum_target::supports_read_loadmap): ... this. (process_target::read_loadmap): Rename as ... (process_stratum_target::read_loadmap): ... this. (process_target::process_qsupported): Rename as ... (process_stratum_target::process_qsupported): ... this. (process_target::supports_tracepoints): Rename as ... (process_stratum_target::supports_tracepoints): ... this. (process_target::read_pc): Rename as ... (process_stratum_target::read_pc): ... this. (process_target::write_pc): Rename as ... (process_stratum_target::write_pc): ... this. (process_target::supports_thread_stopped): Rename as ... (process_stratum_target::supports_thread_stopped): ... this. (process_target::thread_stopped): Rename as ... (process_stratum_target::thread_stopped): ... this. (process_target::supports_get_tib_address): Rename as ... (process_stratum_target::supports_get_tib_address): ... this. (process_target::get_tib_address): Rename as ... (process_stratum_target::get_tib_address): ... this. (process_target::pause_all): Rename as ... (process_stratum_target::pause_all): ... this. (process_target::unpause_all): Rename as ... (process_stratum_target::unpause_all): ... this. (process_target::stabilize_threads): Rename as ... (process_stratum_target::stabilize_threads): ... this. (process_target::supports_fast_tracepoints): Rename as ... (process_stratum_target::supports_fast_tracepoints): ... this. (process_target::get_min_fast_tracepoint_insn_len): Rename as ... (process_stratum_target::get_min_fast_tracepoint_insn_len): ... this. (process_target::emit_ops): Rename as ... (process_stratum_target::emit_ops): ... this. (process_target::supports_disable_randomization): Rename as ... (process_stratum_target::supports_disable_randomization): ... this. (process_target::supports_qxfer_libraries_svr4): Rename as ... (process_stratum_target::supports_qxfer_libraries_svr4): ... this. (process_target::qxfer_libraries_svr4): Rename as ... (process_stratum_target::qxfer_libraries_svr4): ... this. (process_target::supports_agent): Rename as ... (process_stratum_target::supports_agent): ... this. (process_target::enable_btrace): Rename as ... (process_stratum_target::enable_btrace): ... this. (process_target::disable_btrace): Rename as ... (process_stratum_target::disable_btrace): ... this. (process_target::read_btrace): Rename as ... (process_stratum_target::read_btrace): ... this. (process_target::read_btrace_conf): Rename as ... (process_stratum_target::read_btrace_conf): ... this. (process_target::supports_range_stepping): Rename as ... (process_stratum_target::supports_range_stepping): ... this. (process_target::supports_pid_to_exec_file): Rename as ... (process_stratum_target::supports_pid_to_exec_file): ... this. (process_target::pid_to_exec_file): Rename as ... (process_stratum_target::pid_to_exec_file): ... this. (process_target::supports_multifs): Rename as ... (process_stratum_target::supports_multifs): ... this. (process_target::multifs_open): Rename as ... (process_stratum_target::multifs_open): ... this. (process_target::multifs_unlink): Rename as ... (process_stratum_target::multifs_unlink): ... this. (process_target::multifs_readlink): Rename as ... (process_stratum_target::multifs_readlink): ... this. (process_target::breakpoint_kind_from_pc): Rename as ... (process_stratum_target::breakpoint_kind_from_pc): ... this. (process_target::breakpoint_kind_from_current_state): Rename as ... (process_stratum_target::breakpoint_kind_from_current_state): ... this. (process_target::thread_name): Rename as ... (process_stratum_target::thread_name): ... this. (process_target::thread_handle): Rename as ... (process_stratum_target::thread_handle): ... this. (process_target::supports_software_single_step): Rename as ... (process_stratum_target::supports_software_single_step): ... this. (process_target::supports_catch_syscall): Rename as ... (process_stratum_target::supports_catch_syscall): ... this. (process_target::get_ipa_tdesc_idx): Rename as ... (process_stratum_target::get_ipa_tdesc_idx): ... this.
2020-02-17 16:12:04 +01:00
class linux_process_target : public process_stratum_target
gdbserver: start turning the target ops vector into a class This is the beginning of a series of patches where the goal is to turn the target ops vector into a class and all the target op function pointers into methods of this class. Currently, the target ops is a struct of function pointers. At the end of the series, it becomes a class with methods, and the existing low target definitions become subclasses. That is, we end up with the following class hierarchy: process_stratum_target ^ |-- linux-low |-- lynx-low |-- nto-low |-- win32-low process_stratum_target either defines the default behavior for the target ops or leaves them as pure virtual for the subclasses to override. The transformation is done by first introducing a helper class, called 'process_target', that is initially empty. An instance of this class is added to the end of the current target ops vector. This new field is called 'pt'. We will gradually carry target ops to the new class, one by one, whereas the invocation of the target op will be converted to a method call on 'pt'. For instance, target op 'attach' is currently invoked as (*the_target->attach) (args) After moving 'attach' as a method to 'process_target', it will be invoked as the_target->pt->attach (args) In this process, the concrete target vector definitions (e.g. linux-low, win32-low, nto-low, etc.) are turned into derived classes of 'process_target', so that they can either inherit the default behavior of the target ops or can override the method. We prefer to make this transition gradually rather than in a single giant patch, to yield bite-size patches. The goal is that after each patch gdbserver will still be buildable and testable. The general rule of thumb when converting a target op to a method is this: (1) If the function call is protected with a NULL-check with an obvious default behavior, simply implement that default behavior in the base class (e.g.: supports_non_stop). (2) If there is no NULL-check guard, the method becomes pure virtual, and the derived targets are required to implement the method (e.g.: attach). (3) If there is a NULL-check but no apparent default behavior, or if the NULL-check is utilized to populate a feature support packet, introduce a 'supports_XYZ' method (e.g.: pid_to_exec_file). The overall strategy is to preserve the existing behavior as much as possible. When we're done moving all the target ops into 'process_target', the target op vector will contain nothing but the field 'pt'. At that point, the auxiliary class 'process_target' will simply meld into 'process_stratum_target' and the method calls of the form 'the_target->pt->xyz' will be turned into 'the_target->xyz'. The "linux-low" target has been built and reg-tested on X86_64 Linux (Ubuntu). The "win32-low" target has been built (but not tested) via cross-compilation to a x86_64-w64-mingw32 target. The "lynx-low" and "nto-low" targets were neither built nor tested. gdbserver/ChangeLog: 2020-02-20 Tankut Baris Aktemur <tankut.baris.aktemur@intel.com> * target.h (class process_target): New class definition. (struct process_stratum_target) <pt>: New field with type 'process_target*'. * linux-low.h (class linux_process_target): Define as a derived class of 'process_target'. * linux-low.cc (linux_target_ops): Add a linux_process_target* as the 'pt' field. * lynx-low.h (class lynx_process_target): Define as a derived class of 'process_target'. * lynx-low.cc (lynx_target_ops): Add a lynx_process_target* as the 'pt' field. * nto-low.h (class nto_process_target): Define as a derived class of 'process_target'. * nto-low.cc (nto_target_ops): Add an nto_process_target* as the 'pt' field. * win32-low.h (class win32_process_target): Define as a derived class of 'process_target'. * win32-low.cc (win32_target_ops): Add a win32_process_target* as the 'pt' field.
2020-02-17 16:11:50 +01:00
{
public:
int create_inferior (const char *program,
const std::vector<char *> &program_args) override;
void post_create_inferior () override;
int attach (unsigned long pid) override;
int kill (process_info *proc) override;
int detach (process_info *proc) override;
void mourn (process_info *proc) override;
void join (int pid) override;
bool thread_alive (ptid_t pid) override;
void resume (thread_resume *resume_info, size_t n) override;
ptid_t wait (ptid_t ptid, target_waitstatus *status,
int options) override;
gdbserver: turn target ops 'fetch_registers' and 'store_registers' into methods gdbserver/ChangeLog: 2020-02-20 Tankut Baris Aktemur <tankut.baris.aktemur@intel.com> Turn process_stratum_target's fetch_registers and store_registers ops into methods of process_target. * target.h (struct process_stratum_target): Remove the target ops. (class process_target): Add the target ops. (fetch_inferior_registers): Update the macro. (store_inferior_registers): Update the macro. Update the derived classes and callers below. * linux-low.cc (linux_target_ops): Update. (linux_fetch_registers): Turn into ... (linux_process_target::fetch_registers): ... this. (linux_store_registers): Turn into ... (linux_process_target::store_registers): ... this. * linux-low.h (class linux_process_target): Update. * lynx-low.cc (lynx_target_ops): Update. (lynx_fetch_registers): Turn into ... (lynx_process_target::fetch_registers): ... this. (lynx_store_registers): Turn into ... (lynx_process_target::store_registers): ... this. * lynx-low.h (class lynx_process_target): Update. * nto-low.cc (nto_target_ops): Update. (nto_fetch_registers): Turn into ... (nto_process_target::fetch_registers): ... this. (nto_store_registers): Turn into ... (nto_process_target::store_registers): ... this. * nto-low.h (class nto_process_target): Update. * win32-low.cc (win32_target_ops): Update. (win32_fetch_inferior_registers): Turn into ... (win32_process_target::fetch_registers): ... this. (win32_store_inferior_registers): Turn into ... (win32_process_target::store_registers): ... this. * win32-low.h (class win32_process_target): Update.
2020-02-17 16:11:53 +01:00
void fetch_registers (regcache *regcache, int regno) override;
void store_registers (regcache *regcache, int regno) override;
int prepare_to_access_memory () override;
void done_accessing_memory () override;
gdbserver: turn target ops 'read_memory' and 'write_memory' into methods gdbserver/ChangeLog: 2020-02-20 Tankut Baris Aktemur <tankut.baris.aktemur@intel.com> Turn process_stratum_target's read_memory and write_memory ops into methods of process_target. * target.h (struct process_stratum_target): Remove the target ops. (class process_target): Add the target ops. Update the derived classes and callers below. * linux-aarch32-low.cc (arm_breakpoint_at): Update. * linux-aarch64-low.cc (aarch64_breakpoint_at): Update. * linux-arm-low.cc (arm_sigreturn_next_pc): Update. (arm_get_syscall_trapinfo): Update. * linux-cris-low.cc (cris_breakpoint_at): Update. * linux-crisv32-low.cc (cris_breakpoint_at): Update. * linux-m32r-low.cc (m32r_breakpoint_at): Update. * linux-mips-low.cc (mips_breakpoint_at): Update. * linux-nios2-low.cc (nios2_breakpoint_at): Update. * linux-ppc-low.cc (ppc_breakpoint_at): Update. * linux-sh-low.cc (sh_breakpoint_at): Update. * linux-sparc-low.cc (sparc_fill_gregset_to_stack): Update. (sparc_store_gregset_from_stack): Update. (sparc_breakpoint_at): Update. * linux-tic6x-low.cc (tic6x_breakpoint_at): Update. * linux-tile-low.cc (tile_breakpoint_at): Update. * linux-x86-low.cc (x86_breakpoint_at): Update. * linux-xtensa-low.cc (xtensa_breakpoint_at): Update. * mem-brea.cc (insert_memory_breakpoint): Update. (validate_inserted_breakpoint): Update. * target.cc (read_inferior_memory): Update. (target_write_memory): Update. * linux-low.cc (linux_target_ops): Update. (linux_read_memory): Make a wrapper around the read_memory target op call. (linux_process_target::read_memory): Rename from linux_read_memory. (linux_write_memory): Turn into ... (linux_process_target::write_memory): ... this. * linux-low.h (class linux_process_target): Update. * lynx-low.cc (lynx_target_ops): Update. (lynx_read_memory): Turn into ... (lynx_process_target::read_memory): ... this. (lynx_write_memory): Turn into ... (lynx_process_target::write_memory): ... this. * lynx-low.h (class lynx_process_target): Update. * nto-low.cc (nto_target_ops): Update. (nto_read_memory): Turn into ... (nto_process_target::read_memory): ... this. (nto_write_memory): Turn into ... (nto_process_target::write_memory): ... this. * nto-low.h (class nto_process_target): Update. * win32-low.cc (win32_target_ops): Update. (win32_read_inferior_memory): Turn into ... (win32_process_target::read_memory): ... this. (win32_write_inferior_memory): Turn into ... (win32_process_target::write_memory): ... this. * win32-low.h (class win32_process_target): Update.
2020-02-17 16:11:53 +01:00
int read_memory (CORE_ADDR memaddr, unsigned char *myaddr,
int len) override;
int write_memory (CORE_ADDR memaddr, const unsigned char *myaddr,
int len) override;
void look_up_symbols () override;
void request_interrupt () override;
bool supports_read_auxv () override;
int read_auxv (CORE_ADDR offset, unsigned char *myaddr,
unsigned int len) override;
int insert_point (enum raw_bkpt_type type, CORE_ADDR addr,
int size, raw_breakpoint *bp) override;
int remove_point (enum raw_bkpt_type type, CORE_ADDR addr,
int size, raw_breakpoint *bp) override;
bool stopped_by_sw_breakpoint () override;
bool supports_stopped_by_sw_breakpoint () override;
bool stopped_by_hw_breakpoint () override;
bool supports_stopped_by_hw_breakpoint () override;
bool supports_hardware_single_step () override;
gdbserver: turn target ops 'stopped_by_watchpoint' and 'stopped_data_address' into methods gdbserver/ChangeLog: 2020-02-20 Tankut Baris Aktemur <tankut.baris.aktemur@intel.com> Turn process_stratum_target's stopped_by_watchpoint and stopped_data_address ops into methods of process_target. * target.h (struct process_stratum_target): Remove the target ops. (class process_target): Add the target ops. * target.cc (process_target::stopped_by_watchpoint): Define. (process_target::stopped_data_address): Define. Update the derived classes and callers below. * remote-utils.cc (prepare_resume_reply): Update. * linux-low.cc (linux_target_ops): Update. (linux_stopped_by_watchpoint): Turn into ... (linux_process_target::stopped_by_watchpoint): ... this. (linux_stopped_data_address): Turn into ... (linux_process_target::stopped_data_address): ... this. * linux-low.h (class linux_process_target): Update. * lynx-low.cc (lynx_target_ops): Update. * nto-low.cc (nto_target_ops): Update. (nto_stopped_by_watchpoint): Turn into ... (nto_process_target::stopped_by_watchpoint): ... this. (nto_stopped_data_address): Turn into ... (nto_process_target::stopped_data_address): ... this. * nto-low.h (class nto_process_target): Update. * win32-low.cc (win32_target_ops): Update. (win32_stopped_by_watchpoint): Turn into ... (win32_process_target::stopped_by_watchpoint): ... this. (win32_stopped_data_address): Turn into ... (win32_process_target::stopped_data_address): ... this. * win32-low.h (class win32_process_target): Update.
2020-02-17 16:11:55 +01:00
bool stopped_by_watchpoint () override;
CORE_ADDR stopped_data_address () override;
bool supports_read_offsets () override;
int read_offsets (CORE_ADDR *text, CORE_ADDR *data) override;
bool supports_get_tls_address () override;
int get_tls_address (thread_info *thread, CORE_ADDR offset,
CORE_ADDR load_module, CORE_ADDR *address) override;
bool supports_qxfer_osdata () override;
int qxfer_osdata (const char *annex, unsigned char *readbuf,
unsigned const char *writebuf,
CORE_ADDR offset, int len) override;
bool supports_qxfer_siginfo () override;
int qxfer_siginfo (const char *annex, unsigned char *readbuf,
unsigned const char *writebuf,
CORE_ADDR offset, int len) override;
bool supports_non_stop () override;
bool async (bool enable) override;
int start_non_stop (bool enable) override;
bool supports_multi_process () override;
bool supports_fork_events () override;
bool supports_vfork_events () override;
bool supports_exec_events () override;
void handle_new_gdb_connection () override;
int handle_monitor_command (char *mon) override;
int core_of_thread (ptid_t ptid) override;
#if defined PT_GETDSBT || defined PTRACE_GETFDPIC
bool supports_read_loadmap () override;
int read_loadmap (const char *annex, CORE_ADDR offset,
unsigned char *myaddr, unsigned int len) override;
#endif
CORE_ADDR read_pc (regcache *regcache) override;
void write_pc (regcache *regcache, CORE_ADDR pc) override;
bool supports_thread_stopped () override;
bool thread_stopped (thread_info *thread) override;
void pause_all (bool freeze) override;
void unpause_all (bool unfreeze) override;
void stabilize_threads () override;
2020-02-17 16:12:00 +01:00
bool supports_disable_randomization () override;
bool supports_qxfer_libraries_svr4 () override;
int qxfer_libraries_svr4 (const char *annex,
unsigned char *readbuf,
unsigned const char *writebuf,
CORE_ADDR offset, int len) override;
bool supports_agent () override;
#ifdef HAVE_LINUX_BTRACE
btrace_target_info *enable_btrace (ptid_t ptid,
const btrace_config *conf) override;
int disable_btrace (btrace_target_info *tinfo) override;
int read_btrace (btrace_target_info *tinfo, buffer *buf,
enum btrace_read_type type) override;
int read_btrace_conf (const btrace_target_info *tinfo,
buffer *buf) override;
#endif
bool supports_range_stepping () override;
bool supports_pid_to_exec_file () override;
char *pid_to_exec_file (int pid) override;
bool supports_multifs () override;
int multifs_open (int pid, const char *filename, int flags,
mode_t mode) override;
int multifs_unlink (int pid, const char *filename) override;
ssize_t multifs_readlink (int pid, const char *filename, char *buf,
size_t bufsiz) override;
gdbserver: turn breakpoint kind-related target ops into methods gdbserver/ChangeLog: 2020-02-20 Tankut Baris Aktemur <tankut.baris.aktemur@intel.com> Turn process_stratum_target's breakpoint_kind_from_pc, sw_breakpoint_from_kind, and breakpoint_kind_from_current_state ops into methods of process_target. * target.h (struct process_stratum_target): Remove the target op. (class process_target): Add the target op. (target_breakpoint_kind_from_pc): Update the macro. (target_breakpoint_kind_from_current_state): Update the macro. (default_breakpoint_kind_from_pc): Remove declaration. * target.cc (default_breakpoint_kind_from_pc): Turn into ... (process_target::breakpoint_kind_from_pc): ... this. (process_target::breakpoint_kind_from_current_state): Define. Update the derived classes and callers below. * mem-break.cc (bp_size): Update. (bp_opcode): Update. * linux-low.cc (linux_target_ops): Update. (linux_wait_1): Update. (linux_breakpoint_kind_from_pc): Turn into ... (linux_process_target::breakpoint_kind_from_pc): ... this. (linux_sw_breakpoint_from_kind): Turn into ... (linux_process_target::sw_breakpoint_from_kind): ... this. (linux_breakpoint_kind_from_current_state): Turn into ... (linux_process_target::breakpoint_kind_from_current_state): ... this. * linux-low.h (class linux_process_target): Update. * lynx-low.cc (lynx_target_ops): Update. (lynx_process_target::sw_breakpoint_from_kind): Define. * lynx-low.h (class lynx_process_target): Update. * nto-low.cc (nto_target_ops): Update. (nto_sw_breakpoint_from_kind): Turn into ... (nto_process_target::sw_breakpoint_from_kind): ... this. * nto-low.h (class nto_process_target): Update. * win32-low.cc (win32_target_ops): Update. (win32_sw_breakpoint_from_kind): Turn into ... (win32_process_target::sw_breakpoint_from_kind): ... this. * win32-low.h (class win32_process_target): Update.
2020-02-17 16:12:02 +01:00
const char *thread_name (ptid_t thread) override;
#if USE_THREAD_DB
bool thread_handle (ptid_t ptid, gdb_byte **handle,
int *handle_len) override;
#endif
bool supports_catch_syscall () override;
gdbserver/linux-low: turn 'regs_info' into a method gdbserver/ChangeLog: 2020-04-02 Tankut Baris Aktemur <tankut.baris.aktemur@intel.com> Turn the 'regs_info' linux target op into a method of linux_process_target. * linux-low.h (struct linux_target_ops) <regs_info>: Remove. (class linux_process_target) <get_regs_info>: Define. Update the callers below. * linux-low.cc (linux_process_target::fetch_registers) (linux_process_target::store_registers) * proc-service.cc (gregset_info) * linux-x86-low.cc (class x86_target) <get_regs_info>: Declare. (x86_linux_regs_info): Turn into ... (x86_target::get_regs_info): ...this. (the_low_target): Remove the op field. * linux-aarch64-low.cc (class aarch64_target) <get_regs_info>: Declare. (aarch64_regs_info): Turn into ... (aarch64_target::get_regs_info): ...this. (the_low_target): Remove the op field. * linux-arm-low.cc (class arm_target) <get_regs_info>: Declare. (arm_regs_info): Turn into ... (arm_target::get_regs_info): ...this. (the_low_target): Remove the op field. * linux-bfin-low.cc (class bfin_target) <get_regs_info>: Declare. (bfin_regs_info): Turn into ... (bfin_target::get_regs_info): ...this. (the_low_target): Remove the op field. * linux-cris-low.cc (class cris_target) <get_regs_info>: Declare. (cris_regs_info): Turn into ... (cris_target::get_regs_info): ...this. (the_low_target): Remove the op field. * linux-crisv32-low.cc (class crisv32_target) <get_regs_info>: Declare. (crisv32_regs_info): Turn into ... (crisv32_target::get_regs_info): ...this. (the_low_target): Remove the op field. * linux-ia64-low.cc (class ia64_target) <get_regs_info>: Declare. (ia64_regs_info): Turn into ... (ia64_target::get_regs_info): ...this. (the_low_target): Remove the op field. * linux-m32r-low.cc (class m32r_target) <get_regs_info>: Declare. (m32r_regs_info): Turn into ... (m32r_target::get_regs_info): ...this. (the_low_target): Remove the op field. * linux-m68k-low.cc (class m68k_target) <get_regs_info>: Declare. (m68k_regs_info): Turn into ... (m68k_target::get_regs_info): ...this. (the_low_target): Remove the op field. * linux-mips-low.cc (class mips_target) <get_regs_info>: Declare. (mips_regs_info): Turn into ... (mips_target::get_regs_info): ...this. (the_low_target): Remove the op field. (get_usrregs_info): Update the call to the op. * linux-nios2-low.cc (class nios2_target) <get_regs_info>: Declare. (nios2_regs_info): Turn into ... (nios2_target::get_regs_info): ...this. (the_low_target): Remove the op field. * linux-ppc-low.cc (class ppc_target) <get_regs_info>: Declare. (ppc_regs_info): Turn into ... (ppc_target::get_regs_info): ...this. (the_low_target): Remove the op field. * linux-riscv-low.cc (class riscv_target) <get_regs_info>: Declare. (riscv_regs_info): Turn into ... (riscv_target::get_regs_info): ...this. (the_low_target): Remove the op field. * linux-s390-low.cc (class s390_target) <get_regs_info>: Declare. (s390_regs_info): Turn into ... (s390_target::get_regs_info): ...this. (the_low_target): Remove the op field. (s390_collect_ptrace_register) (s390_supply_ptrace_register) (s390_fill_gregset): Update the call to the op. * linux-sh-low.cc (class sh_target) <get_regs_info>: Declare. (sh_regs_info): Turn into ... (sh_target::get_regs_info): ...this. (the_low_target): Remove the op field. * linux-sparc-low.cc (class sparc_target) <get_regs_info>: Declare. (sparc_regs_info): Turn into ... (sparc_target::get_regs_info): ...this. (the_low_target): Remove the op field. * linux-tic6x-low.cc (class tic6x_target) <get_regs_info>: Declare. (tic6x_regs_info): Turn into ... (tic6x_target::get_regs_info): ...this. (the_low_target): Remove the op field. * linux-tile-low.cc (class tile_target) <get_regs_info>: Declare. (tile_regs_info): Turn into ... (tile_target::get_regs_info): ...this. (the_low_target): Remove the op field. * linux-xtensa-low.cc (class xtensa_target) <get_regs_info>: Declare. (xtensa_regs_info): Turn into ... (xtensa_target::get_regs_info): ...this. (the_low_target): Remove the op field.
2020-04-02 15:11:23 +02:00
/* Return the information to access registers. This has public
visibility because proc-service uses it. */
virtual const regs_info *get_regs_info () = 0;
gdbserver/linux-low: turn some static functions into private methods gdbserver/ChangeLog: 2020-04-02 Tankut Baris Aktemur <tankut.baris.aktemur@intel.com> Turn some static functions in linux-low.cc into private methods of linux_process_target. * linux-low.cc (handle_extended_wait): Turn into ... (linux_process_target::handle_extended_wait): ...this. Call 'mourn' on 'this' object instead of 'the_target'. (maybe_move_out_of_jump_pad): Turn into... (linux_process_target::maybe_move_out_of_jump_pad): ...this. (linux_low_filter_event): Turn into... (linux_process_target::filter_event): ...this. (linux_wait_for_event_filtered): Turn into... (linux_process_target::wait_for_event_filtered): ...this. (linux_wait_for_event): Turn into... (linux_process_target::wait_for_event): ...this. (linux_wait_1): Turn into... (linux_process_target::wait_1): ...this. (wait_for_sigstop): Turn into... (linux_process_target::wait_for_sigstop): ...this. (move_out_of_jump_pad_callback): Turn into... (linux_process_target::move_out_of_jump_pad): ...this. (stop_all_lwps): Turn into... (linux_process_target::stop_all_lwps): ...this. (start_step_over): Turn into... (linux_process_target::start_step_over): ...this. (complete_ongoing_step_over): Turn into... (linux_process_target::complete_ongoing_step_over): ...this. (proceed_all_lwps): Turn into... (linux_process_target::proceed_all_lwps): ...this. (unstop_all_lwps): Turn into... (linux_process_target::unstop_all_lwps): ...this. * linux-low.h (class linux_process_target) <handle_extended_wait> <maybe_move_out_of_jump_pad> filter_event> <wait_for_event_filtered> <wait_for_event> <wait_1> <wait_for_sigstop> <move_out_of_jump_pad> <stop_all_lwps> <start_step_over> <complete_ongoing_step_over> <proceed_all_lwps> <unstop_all_lwps>: Declare. Update the callers below. * linux-low.cc (linux_process_target::attach): Update. (linux_process_target::stabilize_threads): Ditto. (linux_process_target::wait): Ditto.
2020-04-02 15:11:22 +02:00
private:
/* Handle a GNU/Linux extended wait response. If we see a clone,
fork, or vfork event, we need to add the new LWP to our list
(and return 0 so as not to report the trap to higher layers).
If we see an exec event, we will modify ORIG_EVENT_LWP to point
to a new LWP representing the new program. */
int handle_extended_wait (lwp_info **orig_event_lwp, int wstat);
/* Do low-level handling of the event, and check if we should go on
and pass it to caller code. Return the affected lwp if we are, or
NULL otherwise. */
lwp_info *filter_event (int lwpid, int wstat);
/* Wait for an event from child(ren) WAIT_PTID, and return any that
match FILTER_PTID (leaving others pending). The PTIDs can be:
minus_one_ptid, to specify any child; a pid PTID, specifying all
lwps of a thread group; or a PTID representing a single lwp. Store
the stop status through the status pointer WSTAT. OPTIONS is
passed to the waitpid call. Return 0 if no event was found and
OPTIONS contains WNOHANG. Return -1 if no unwaited-for children
was found. Return the PID of the stopped child otherwise. */
int wait_for_event_filtered (ptid_t wait_ptid, ptid_t filter_ptid,
int *wstatp, int options);
/* Wait for an event from child(ren) PTID. PTIDs can be:
minus_one_ptid, to specify any child; a pid PTID, specifying all
lwps of a thread group; or a PTID representing a single lwp. Store
the stop status through the status pointer WSTAT. OPTIONS is
passed to the waitpid call. Return 0 if no event was found and
OPTIONS contains WNOHANG. Return -1 if no unwaited-for children
was found. Return the PID of the stopped child otherwise. */
int wait_for_event (ptid_t ptid, int *wstatp, int options);
/* Wait for all children to stop for the SIGSTOPs we just queued. */
void wait_for_sigstop ();
/* Wait for process, returns status. */
ptid_t wait_1 (ptid_t ptid, target_waitstatus *ourstatus,
int target_options);
/* Stop all lwps that aren't stopped yet, except EXCEPT, if not NULL.
If SUSPEND, then also increase the suspend count of every LWP,
except EXCEPT. */
void stop_all_lwps (int suspend, lwp_info *except);
/* Stopped LWPs that the client wanted to be running, that don't have
pending statuses, are set to run again, except for EXCEPT, if not
NULL. This undoes a stop_all_lwps call. */
void unstop_all_lwps (int unsuspend, lwp_info *except);
/* Start a step-over operation on LWP. When LWP stopped at a
breakpoint, to make progress, we need to remove the breakpoint out
of the way. If we let other threads run while we do that, they may
pass by the breakpoint location and miss hitting it. To avoid
that, a step-over momentarily stops all threads while LWP is
single-stepped by either hardware or software while the breakpoint
is temporarily uninserted from the inferior. When the single-step
finishes, we reinsert the breakpoint, and let all threads that are
supposed to be running, run again. */
void start_step_over (lwp_info *lwp);
/* If there's a step over in progress, wait until all threads stop
(that is, until the stepping thread finishes its step), and
unsuspend all lwps. The stepping thread ends with its status
pending, which is processed later when we get back to processing
events. */
void complete_ongoing_step_over ();
gdbserver/linux-low: turn 'supports_hardware_single_step' into a method All the linux low targets except arm define the 'supports_hardware_single_step' op to return true. Hence, we override the method to return true in linux_process_target, and remove the definitions in all the linux low targets but arm. gdbserver/ChangeLog: 2020-04-02 Tankut Baris Aktemur <tankut.baris.aktemur@intel.com> Remove the 'supports_hardware_single_step' linux target op and override the process_stratum_target's op definition in linux_process_target to return true. * linux-low.h (struct linux_target_ops): Remove the op. (class linux_process_target) <finish_step_over> <maybe_hw_step>: Declare. * linux-low.cc (can_hardware_single_step): Remove. (maybe_hw_step): Turn into... (linux_process_target::maybe_hw_step): ...this. (finish_step_over): Turn into... (linux_process_target::finish_step_over): ...this. (linux_process_target::supports_hardware_single_step): Update to return true. Update the callers below. (linux_process_target::single_step) (linux_process_target::resume_one_lwp_throw) * linux-arm-low.cc (class arm_target) <supports_hardware_single_step>: Declare. (arm_supports_hardware_single_step): Turn into... (arm_target::supports_hardware_single_step): ...this. (the_low_target): Remove the op field. * linux-x86-low.cc (x86_supports_hardware_single_step): Remove. (the_low_target): Remove the op field. * linux-aarch64-low.cc (aarch64_supports_hardware_single_step): Remove. (the_low_target): Remove the op field. * linux-bfin-low.cc (bfin_supports_hardware_single_step): Remove. (the_low_target): Remove the op field. * linux-crisv32-low.cc (cris_supports_hardware_single_step): Remove. (the_low_target): Remove the op field. * linux-m32r-low.cc (m32r_supports_hardware_single_step): Remove. (the_low_target): Remove the op field. * linux-m68k-low.cc (m68k_supports_hardware_single_step): Remove. (the_low_target): Remove the op field. * linux-ppc-low.cc (ppc_supports_hardware_single_step): Remove. (the_low_target): Remove the op field. * linux-s390-low.cc (s390_supports_hardware_single_step): Remove. (the_low_target): Remove the op field. * linux-sh-low.cc (sh_supports_hardware_single_step): Remove. (the_low_target): Remove the op field. * linux-tic6x-low.cc (tic6x_supports_hardware_single_step): Remove. (the_low_target): Remove the op field. * linux-tile-low.cc (tile_supports_hardware_single_step): Remove. (the_low_target): Remove the op field. * linux-xtensa-low.cc (xtensa_supports_hardware_single_step): Remove. (the_low_target): Remove the op field.
2020-04-02 15:11:31 +02:00
/* Finish a step-over. Reinsert the breakpoint we had uninserted in
start_step_over, if still there, and delete any single-step
breakpoints we've set, on non hardware single-step targets.
Return true if step over finished. */
bool finish_step_over (lwp_info *lwp);
gdbserver/linux-low: turn some static functions into private methods gdbserver/ChangeLog: 2020-04-02 Tankut Baris Aktemur <tankut.baris.aktemur@intel.com> Turn some static functions in linux-low.cc into private methods of linux_process_target. * linux-low.cc (handle_extended_wait): Turn into ... (linux_process_target::handle_extended_wait): ...this. Call 'mourn' on 'this' object instead of 'the_target'. (maybe_move_out_of_jump_pad): Turn into... (linux_process_target::maybe_move_out_of_jump_pad): ...this. (linux_low_filter_event): Turn into... (linux_process_target::filter_event): ...this. (linux_wait_for_event_filtered): Turn into... (linux_process_target::wait_for_event_filtered): ...this. (linux_wait_for_event): Turn into... (linux_process_target::wait_for_event): ...this. (linux_wait_1): Turn into... (linux_process_target::wait_1): ...this. (wait_for_sigstop): Turn into... (linux_process_target::wait_for_sigstop): ...this. (move_out_of_jump_pad_callback): Turn into... (linux_process_target::move_out_of_jump_pad): ...this. (stop_all_lwps): Turn into... (linux_process_target::stop_all_lwps): ...this. (start_step_over): Turn into... (linux_process_target::start_step_over): ...this. (complete_ongoing_step_over): Turn into... (linux_process_target::complete_ongoing_step_over): ...this. (proceed_all_lwps): Turn into... (linux_process_target::proceed_all_lwps): ...this. (unstop_all_lwps): Turn into... (linux_process_target::unstop_all_lwps): ...this. * linux-low.h (class linux_process_target) <handle_extended_wait> <maybe_move_out_of_jump_pad> filter_event> <wait_for_event_filtered> <wait_for_event> <wait_1> <wait_for_sigstop> <move_out_of_jump_pad> <stop_all_lwps> <start_step_over> <complete_ongoing_step_over> <proceed_all_lwps> <unstop_all_lwps>: Declare. Update the callers below. * linux-low.cc (linux_process_target::attach): Update. (linux_process_target::stabilize_threads): Ditto. (linux_process_target::wait): Ditto.
2020-04-02 15:11:22 +02:00
/* When we finish a step-over, set threads running again. If there's
another thread that may need a step-over, now's the time to start
it. Eventually, we'll move all threads past their breakpoints. */
void proceed_all_lwps ();
/* The reason we resume in the caller, is because we want to be able
to pass lwp->status_pending as WSTAT, and we need to clear
status_pending_p before resuming, otherwise, resume_one_lwp
refuses to resume. */
bool maybe_move_out_of_jump_pad (lwp_info *lwp, int *wstat);
/* Move THREAD out of the jump pad. */
void move_out_of_jump_pad (thread_info *thread);
gdbserver/linux-low: start turning linux target ops into methods This is the beginning of a series of patches that convert the linux low targets into classes derived from linux_process_target. At the end of the series we obtain a class hierarchy that looks like this: process_stratum_target ^ | |-- linux_process_target ^ | |-- x86_target (defined in linux-x86-low) |-- aarch64_target (defined in linux-aarch64-low) |-- ppc_target (defined in linux-ppc-low) |-- ... In several cases, linux_process_target simply forwards a target op request to a corresponding linux_target_ops function. For these cases, the definition in linux_process_target will be removed and the definition will be left to the deriving linux low target class; using inheritance provides a nice and natural, object-oriented simplification in these cases. The series converts linux_target_ops into protected methods of linux_process_target one by one. Throughout the series, based on the needs, static functions defined in linux-low.cc are converted to private methods of linux_process_target as well. This is done either as separate patches or as integrated into a patch that convert a particular linux_target_op into a method. The series ends with the patch titled "gdbserver/linux-low: delete 'linux_target_ops' and 'the_low_target'". Built and regression-tested on x86_64-linux. The following linux low targets have been built (but not tested) via cross-compilation: aarch64, arm, m68k, mips, ppc, riscv, s390, sh, sparc. The other targets (bfin, cris, crisv32, ia64, m32r, nios2, tic6x, tile, xtensa) were neither built nor tested. gdbserver/ChangeLog: 2020-04-02 Tankut Baris Aktemur <tankut.baris.aktemur@intel.com> * linux-low.h (the_linux_target): New extern declaration. * linux-low.cc (initialize_low): Use 'the_linux_target' to set 'the_target'. (the_linux_target): Remove. * linux-x86-low.cc (class x86_target): New class. (the_x86_target): New static object. (the_linux_target): Define as pointer to the_x86_target. * linux-aarch64-low.cc (class aarch64_target): New class. (the_aarch64_target): New static object. (the_linux_target): Define as pointer to the_aarch64_target. * linux-arm-low.cc (class arm_target): New class. (the_arm_target): New static object. (the_linux_target): Define as pointer to the_arm_target. * linux-bfin-low.cc (class bfin_target): New class. (the_bfin_target): New static object. (the_linux_target): Define as pointer to the_bfin_target. * linux-cris-low.cc (class cris_target): New class. (the_cris_target): New static object. (the_linux_target): Define as pointer to the_cris_target. * linux-crisv32-low.cc (class crisv32_target): New class. (the_crisv32_target): New static object. (the_linux_target): Define as pointer to the_crisv32_target. * linux-ia64-low.cc (class ia64_target): New class. (the_ia64_target): New static object. (the_linux_target): Define as pointer to the_ia64_target. * linux-m32r-low.cc (class m32r_target): New class. (the_m32r_target): New static object. (the_linux_target): Define as pointer to the_m32r_target. * linux-m68k-low.cc (class m68k_target): New class. (the_m68k_target): New static object. (the_linux_target): Define as pointer to the_m68k_target. * linux-mips-low.cc (class mips_target): New class. (the_mips_target): New static object. (the_linux_target): Define as pointer to the_mips_target. * linux-nios2-low.cc (class nios2_target): New class. (the_nios2_target): New static object. (the_linux_target): Define as pointer to the_nios2_target. * linux-ppc-low.cc (class ppc_target): New class. (the_ppc_target): New static object. (the_linux_target): Define as pointer to the_ppc_target. * linux-riscv-low.cc (class riscv_target): New class. (the_riscv_target): New static object. (the_linux_target): Define as pointer to the_riscv_target. * linux-s390-low.cc (class s390_target): New class. (the_s390_target): New static object. (the_linux_target): Define as pointer to the_s390_target. * linux-sh-low.cc (class sh_target): New class. (the_sh_target): New static object. (the_linux_target): Define as pointer to the_sh_target. * linux-sparc-low.cc (class sparc_target): New class. (the_sparc_target): New static object. (the_linux_target): Define as pointer to the_sparc_target. * linux-tic6x-low.cc (class tic6x_target): New class. (the_tic6x_target): New static object. (the_linux_target): Define as pointer to the_tic6x_target. * linux-tile-low.cc (class tile_target): New class. (the_tile_target): New static object. (the_linux_target): Define as pointer to the_tile_target. * linux-xtensa-low.cc (class xtensa_target): New class. (the_xtensa_target): New static object. (the_linux_target): Define as pointer to the_xtensa_target.
2020-04-02 15:11:23 +02:00
gdbserver/linux-low: turn 'arch_setup' into a method gdbserver/ChangeLog: 2020-04-02 Tankut Baris Aktemur <tankut.baris.aktemur@intel.com> Turn the 'arch_setup' linux target op into a method of linux_process_target. * linux-low.h (struct linux_target_ops) <arch_setup>: Delete. (class linux_process_target) <arch_setup_thread> <low_arch_setup>: New declarations. * linux-low.cc (linux_arch_setup): Delete. (linux_arch_setup_thread): Turn into... (linux_process_target::arch_setup_thread): ... this. Update the callers below. (linux_process_target::handle_extended_wait) (linux_process_target::post_create_inferior) (linux_process_target::filter_event) * linux-x86-low.cc (class x86_target) <low_arch_setup>: New declaration. (x86_linux_update_xmltarget): Turn into... (x86_target::update_xmltarget): ...this. (x86_linux_process_qsupported): Update the call to x86_linux_update_xmltarget. (x86_arch_setup): Turn into ... (x86_target::low_arch_setup): ...this. (the_low_target): Remove the op field. * linux-aarch64-low.cc (class aarch64_target) <low_arch_setup>: New declaration. (aarch64_arch_setup): Turn into ... (aarch64_target::low_arch_setup): ...this. (the_low_target): Remove the op field. * linux-arm-low.cc (class arm_target) <low_arch_setup>: New declaration. (arm_arch_setup): Turn into ... (arm_target::low_arch_setup): ...this. (the_low_target): Remove the op field. * linux-bfin-low.cc (class bfin_target) <low_arch_setup>: New declaration. (bfin_arch_setup): Turn into ... (bfin_target::low_arch_setup): ...this. (the_low_target): Remove the op field. * linux-cris-low.cc (class cris_target) <low_arch_setup>: New declaration. (cris_arch_setup): Turn into ... (cris_target::low_arch_setup): ...this. (the_low_target): Remove the op field. * linux-crisv32-low.cc (class crisv32_target) <low_arch_setup>: New declaration. (crisv32_arch_setup): Turn into ... (crisv32_target::low_arch_setup): ...this. (the_low_target): Remove the op field. * linux-ia64-low.cc (class ia64_target) <low_arch_setup>: New declaration. (ia64_arch_setup): Turn into ... (ia64_target::low_arch_setup): ...this. (the_low_target): Remove the op field. * linux-m32r-low.cc (class m32r_target) <low_arch_setup>: New declaration. (m32r_arch_setup): Turn into ... (m32r_target::low_arch_setup): ...this. (the_low_target): Remove the op field. * linux-m68k-low.cc (class m68k_target) <low_arch_setup>: New declaration. (m68k_arch_setup): Turn into ... (m68k_target::low_arch_setup): ...this. (the_low_target): Remove the op field. * linux-mips-low.cc (class mips_target) <low_arch_setup>: New declaration. (mips_arch_setup): Turn into ... (mips_target::low_arch_setup): ...this. (the_low_target): Remove the op field. * linux-nios2-low.cc (class nios2_target) <low_arch_setup>: New declaration. (nios2_arch_setup): Turn into ... (nios2_target::low_arch_setup): ...this. (the_low_target): Remove the op field. * linux-ppc-low.cc (class ppc_target) <low_arch_setup>: New declaration. (ppc_arch_setup): Turn into ... (ppc_target::low_arch_setup): ...this. (the_low_target): Remove the op field. * linux-riscv-low.cc (class riscv_target) <low_arch_setup>: New declaration. (riscv_arch_setup): Turn into ... (riscv_target::low_arch_setup): ...this. (the_low_target): Remove the op field. * linux-s390-low.cc (class s390_target) <low_arch_setup>: New declaration. (s390_arch_setup): Turn into ... (s390_target::low_arch_setup): ...this. (the_low_target): Remove the op field. * linux-sh-low.cc (class sh_target) <low_arch_setup>: New declaration. (sh_arch_setup): Turn into ... (sh_target::low_arch_setup): ...this. (the_low_target): Remove the op field. * linux-sparc-low.cc (class sparc_target) <low_arch_setup>: New declaration. (sparc_arch_setup): Turn into ... (sparc_target::low_arch_setup): ...this. (the_low_target): Remove the op field. * linux-tic6x-low.cc (class tic6x_target) <low_arch_setup>: New declaration. (tic6x_arch_setup): Turn into ... (tic6x_target::low_arch_setup): ...this. (the_low_target): Remove the op field. * linux-tile-low.cc (class tile_target) <low_arch_setup>: New declaration. (tile_arch_setup): Turn into ... (tile_target::low_arch_setup): ...this. (the_low_target): Remove the op field. * linux-xtensa-low.cc (class xtensa_target) <low_arch_setup>: New declaration. (xtensa_arch_setup): Turn into ... (xtensa_target::low_arch_setup): ...this. (the_low_target): Remove the op field.
2020-04-02 15:11:23 +02:00
/* Call low_arch_setup on THREAD. */
void arch_setup_thread (thread_info *thread);
gdbserver/linux-low: turn 'cannot_{fetch/store}_register' into methods gdbserver/ChangeLog: 2020-04-02 Tankut Baris Aktemur <tankut.baris.aktemur@intel.com> Turn the 'cannot_fetch_register' and 'cannot_store_register' linux target ops into methods of linux_process_target. * linux-low.h (struct linux_target_ops): Remove the low target ops. (class linux_process_target) <fetch_register> <store_register> <usr_fetch_inferior_registers> <usr_store_inferior_registers> <low_cannot_fetch_register> <low_cannot_fetch_register> Declare. * linux-low.cc (fetch_register): Turn into... (linux_process_target::fetch_register): ...this. (store_register): Turn into ... (linux_process_target::store_register): ...this. (usr_fetch_inferior_registers): Turn into... (linux_process_target::usr_fetch_inferior_registers): ...this. (usr_store_inferior_registers): Turn into... (linux_process_target::usr_store_inferior_registers): ...this. * linux-x86-low.cc (class x86_target) <low_cannot_fetch_register> <low_cannot_store_register>: Declare. (x86_cannot_store_register): Turn into... (x86_target::low_cannot_store_register): ...this. (x86_cannot_fetch_register): Turn into... (x86_target::low_cannot_fetch_register): ...this. (the_low_target): Remove the target op fields. * linux-aarch64-low.cc (class aarch64_target) <low_cannot_fetch_register> <low_cannot_store_register>: Declare. (aarch64_target::low_cannot_fetch_register) (aarch64_target::low_cannot_store_register): Define. (the_low_target): Remove the op fields. * linux-arm-low.cc (class arm_target) <low_cannot_fetch_register> <low_cannot_store_register>: Declare. (arm_cannot_fetch_register): Turn into... (arm_target::low_cannot_fetch_register): ...this. (arm_cannot_store_register): Turn into... (arm_target::low_cannot_store_register): ...this. (the_low_target): Remove the op fields. * linux-bfin-low.cc (class bfin_target) <low_cannot_fetch_register> <low_cannot_store_register>: Declare. (bfin_cannot_fetch_register): Turn into... (bfin_target::low_cannot_fetch_register): ...this. (bfin_cannot_store_register): Turn into... (bfin_target::low_cannot_store_register): ...this. (the_low_target): Remove the op fields. * linux-cris-low.cc (class cris_target) <low_cannot_fetch_register> <low_cannot_store_register>: Declare. (cris_cannot_fetch_register): Turn into... (cris_target::low_cannot_fetch_register): ...this. (cris_cannot_store_register): Turn into... (cris_target::low_cannot_store_register): ...this. (the_low_target): Remove the op fields. * linux-crisv32-low.cc (class crisv32_target) <low_cannot_fetch_register> <low_cannot_store_register>: Declare. (crisv32_target::low_cannot_fetch_register) (crisv32_target::low_cannot_store_register): Define. (the_low_target): Remove the op fields. * linux-ia64-low.cc (class ia64_target) <low_cannot_fetch_register> <low_cannot_store_register>: Declare. (ia64_cannot_fetch_register): Turn into... (ia64_target::low_cannot_fetch_register): ...this. (ia64_cannot_store_register): Turn into... (ia64_target::low_cannot_store_register): ...this. (the_low_target): Remove the op fields. * linux-m32r-low.cc (class m32r_target) <low_cannot_fetch_register> <low_cannot_store_register>: Declare. (m32r_cannot_fetch_register): Turn into... (m32r_target::low_cannot_fetch_register): ...this. (m32r_cannot_store_register): Turn into... (m32r_target::low_cannot_store_register): ...this. (the_low_target): Remove the op fields. * linux-m68k-low.cc (class m68k_target) <low_cannot_fetch_register> <low_cannot_store_register>: Declare. (m68k_cannot_fetch_register): Turn into... (m68k_target::low_cannot_fetch_register): ...this. (m68k_cannot_store_register): Turn into... (m68k_target::low_cannot_store_register): ...this. (the_low_target): Remove the op fields. * linux-mips-low.cc (class mips_target) <low_cannot_fetch_register> <low_cannot_store_register>: Declare. (mips_cannot_fetch_register): Turn into... (mips_target::low_cannot_fetch_register): ...this. (mips_cannot_store_register): Turn into... (mips_target::low_cannot_store_register): ...this. (get_usrregs_info): Inline at the call sites in low_cannot_fetch_register and low_cannot_store_register, and remove. (the_low_target): Remove the op fields. * linux-nios2-low.cc (class nios2_target) <low_cannot_fetch_register> <low_cannot_store_register>: Declare. (nios2_cannot_fetch_register): Turn into... (nios2_target::low_cannot_fetch_register): ...this. (nios2_cannot_store_register): Turn into... (nios2_target::low_cannot_store_register): ...this. (the_low_target): Remove the op fields. * linux-ppc-low.cc (class ppc_target) <low_cannot_fetch_register> <low_cannot_store_register>: Declare. (ppc_cannot_fetch_register): Turn into... (ppc_target::low_cannot_fetch_register): ...this. (ppc_cannot_store_register): Turn into... (ppc_target::low_cannot_store_register): ...this. (the_low_target): Remove the op fields. * linux-riscv-low.cc (class riscv_target) <low_cannot_fetch_register> <low_cannot_store_register>: Declare. (riscv_target::low_cannot_fetch_register) (riscv_target::low_cannot_store_register): Define. (the_low_target): Remove the op fields. * linux-s390-low.cc (class s390_target) <low_cannot_fetch_register> <low_cannot_store_register>: Declare. (s390_cannot_fetch_register): Turn into... (s390_target::low_cannot_fetch_register): ...this. (s390_cannot_store_register): Turn into... (s390_target::low_cannot_store_register): ...this. (the_low_target): Remove the op fields. * linux-sh-low.cc (class sh_target) <low_cannot_fetch_register> <low_cannot_store_register>: Declare. (sh_cannot_fetch_register): Turn into... (sh_target::low_cannot_fetch_register): ...this. (sh_cannot_store_register): Turn into... (sh_target::low_cannot_store_register): ...this. (the_low_target): Remove the op fields. * linux-sparc-low.cc (class sparc_target) <low_cannot_fetch_register> <low_cannot_store_register>: Declare. (sparc_cannot_fetch_register): Turn into... (sparc_target::low_cannot_fetch_register): ...this. (sparc_cannot_store_register): Turn into... (sparc_target::low_cannot_store_register): ...this. (the_low_target): Remove the op fields. * linux-tic6x-low.cc (class tic6x_target) <low_cannot_fetch_register> <low_cannot_store_register>: Declare. (tic6x_cannot_fetch_register): Turn into... (tic6x_target::low_cannot_fetch_register): ...this. (tic6x_cannot_store_register): Turn into... (tic6x_target::low_cannot_store_register): ...this. (the_low_target): Remove the op fields. * linux-tile-low.cc (class tile_target) <low_cannot_fetch_register> <low_cannot_store_register>: Declare. (tile_cannot_fetch_register): Turn into... (tile_target::low_cannot_fetch_register): ...this. (tile_cannot_store_register): Turn into... (tile_target::low_cannot_store_register): ...this. (the_low_target): Remove the op fields. * linux-xtensa-low.cc (class xtensa_target) <low_cannot_fetch_register> <low_cannot_store_register>: Declare. (xtensa_target::low_cannot_fetch_register) (xtensa_target::low_cannot_store_register): Define. (the_low_target): Remove the op fields.
2020-04-02 15:11:24 +02:00
#ifdef HAVE_LINUX_USRREGS
/* Fetch one register. */
void fetch_register (const usrregs_info *usrregs, regcache *regcache,
int regno);
/* Store one register. */
void store_register (const usrregs_info *usrregs, regcache *regcache,
int regno);
#endif
/* Fetch all registers, or just one, from the child process.
If REGNO is -1, do this for all registers, skipping any that are
assumed to have been retrieved by regsets_fetch_inferior_registers,
unless ALL is non-zero.
Otherwise, REGNO specifies which register (so we can save time). */
void usr_fetch_inferior_registers (const regs_info *regs_info,
regcache *regcache, int regno, int all);
/* Store our register values back into the inferior.
If REGNO is -1, do this for all registers, skipping any that are
assumed to have been saved by regsets_store_inferior_registers,
unless ALL is non-zero.
Otherwise, REGNO specifies which register (so we can save time). */
void usr_store_inferior_registers (const regs_info *regs_info,
regcache *regcache, int regno, int all);
gdbserver/linux-low: turn some more static functions into private methods gdbserver/ChangeLog: 2020-04-02 Tankut Baris Aktemur <tankut.baris.aktemur@intel.com> Turn some more static methods in linux-low into private methods of linux_process_target. * linux-low.cc (get_pc): Turn into... (linux_process_target::get_pc): ...this. (save_stop_reason): Turn into... (linux_process_target::save_stop_reason): ...this. (thread_still_has_status_pending_p): Turn into... (linux_process_target::thread_still_has_status_pending): ...this. (status_pending_p_callback): Turn into... (linux_process_target::status_pending_p_callback): ...this. (resume_stopped_resumed_lwps): Turn into... (linux_process_target::resume_stopped_resumed_lwps): ...this. (install_software_single_step_breakpoints): Turn into... (linux_process_target::install_software_single_step_breakpoints): ...this. (single_step): Turn into... (linux_process_target::single_step): ...this. (linux_resume_one_lwp_throw): Turn into... (linux_process_target::resume_one_lwp_throw): ...this. (linux_resume_one_lwp): Turn into... (linux_process_target::resume_one_lwp): ...this. (resume_status_pending_p): Turn into... (linux_process_target::resume_status_pending): ...this. (need_step_over_p): Turn into... (linux_process_target::thread_needs_step_over): ...this. (linux_resume_one_thread): Turn into... (linux_process_target::resume_one_thread): ...this. (proceed_one_lwp): Turn into... (linux_process_target::proceed_one_lwp): ...this. (unsuspend_and_proceed_one_lwp): Turn into... (linux_process_target::unsuspend_and_proceed_one_lwp): ...this. Update the calls/references to the above functions below. (linux_process_target::handle_extended_wait) (linux_process_target::filter_event) (linux_process_target::wait_for_event_filtered) (linux_process_target::wait_1) (linux_process_target::move_out_of_jump_pad) (linux_process_target::start_step_over) (linux_process_target::resume) (linux_process_target::proceed_all_lwps) (regsets_store_inferior_registers) (linux_process_target::store_register) * linux-low.h (class linux_process_target) <get_pc> <save_stop_reason> <thread_still_has_status_pending> <status_pending_p_callback> <resume_stopped_resumed_lwps> <install_software_single_step_breakpoints> <single_step> <resume_one_lwp_throw> <resume_one_lwp> <resume_status_pending> <thread_needs_step_over> <resume_one_thread> <proceed_one_lwp> <unsuspend_and_proceed_one_lwp>: Declare.
2020-04-02 15:11:24 +02:00
/* Return the PC as read from the regcache of LWP, without any
adjustment. */
CORE_ADDR get_pc (lwp_info *lwp);
/* Called when the LWP stopped for a signal/trap. If it stopped for a
trap check what caused it (breakpoint, watchpoint, trace, etc.),
and save the result in the LWP's stop_reason field. If it stopped
for a breakpoint, decrement the PC if necessary on the lwp's
architecture. Returns true if we now have the LWP's stop PC. */
bool save_stop_reason (lwp_info *lwp);
/* Resume execution of LWP. If STEP is nonzero, single-step it. If
SIGNAL is nonzero, give it that signal. */
void resume_one_lwp_throw (lwp_info *lwp, int step, int signal,
siginfo_t *info);
/* Like resume_one_lwp_throw, but no error is thrown if the LWP
disappears while we try to resume it. */
void resume_one_lwp (lwp_info *lwp, int step, int signal, siginfo_t *info);
/* This function is called once per thread. We check the thread's
last resume request, which will tell us whether to resume, step, or
leave the thread stopped. Any signal the client requested to be
delivered has already been enqueued at this point.
If any thread that GDB wants running is stopped at an internal
breakpoint that needs stepping over, we start a step-over operation
on that particular thread, and leave all others stopped. */
void proceed_one_lwp (thread_info *thread, lwp_info *except);
/* This function is called once per thread. We check the thread's
resume request, which will tell us whether to resume, step, or
leave the thread stopped; and what signal, if any, it should be
sent.
For threads which we aren't explicitly told otherwise, we preserve
the stepping flag; this is used for stepping over gdbserver-placed
breakpoints.
If pending_flags was set in any thread, we queue any needed
signals, since we won't actually resume. We already have a pending
event to report, so we don't need to preserve any step requests;
they should be re-issued if necessary. */
void resume_one_thread (thread_info *thread, bool leave_all_stopped);
/* Return true if this lwp has an interesting status pending. */
bool status_pending_p_callback (thread_info *thread, ptid_t ptid);
/* Resume LWPs that are currently stopped without any pending status
to report, but are resumed from the core's perspective. */
void resume_stopped_resumed_lwps (thread_info *thread);
/* Unsuspend THREAD, except EXCEPT, and proceed. */
void unsuspend_and_proceed_one_lwp (thread_info *thread, lwp_info *except);
/* Return true if this lwp still has an interesting status pending.
If not (e.g., it had stopped for a breakpoint that is gone), return
false. */
bool thread_still_has_status_pending (thread_info *thread);
/* Return true if this lwp is to-be-resumed and has an interesting
status pending. */
bool resume_status_pending (thread_info *thread);
/* Return true if this lwp that GDB wants running is stopped at an
internal breakpoint that we need to step over. It assumes that
any required STOP_PC adjustment has already been propagated to
the inferior's regcache. */
bool thread_needs_step_over (thread_info *thread);
/* Single step via hardware or software single step.
Return 1 if hardware single stepping, 0 if software single stepping
or can't single step. */
int single_step (lwp_info* lwp);
gdbserver/linux-low: turn 'supports_hardware_single_step' into a method All the linux low targets except arm define the 'supports_hardware_single_step' op to return true. Hence, we override the method to return true in linux_process_target, and remove the definitions in all the linux low targets but arm. gdbserver/ChangeLog: 2020-04-02 Tankut Baris Aktemur <tankut.baris.aktemur@intel.com> Remove the 'supports_hardware_single_step' linux target op and override the process_stratum_target's op definition in linux_process_target to return true. * linux-low.h (struct linux_target_ops): Remove the op. (class linux_process_target) <finish_step_over> <maybe_hw_step>: Declare. * linux-low.cc (can_hardware_single_step): Remove. (maybe_hw_step): Turn into... (linux_process_target::maybe_hw_step): ...this. (finish_step_over): Turn into... (linux_process_target::finish_step_over): ...this. (linux_process_target::supports_hardware_single_step): Update to return true. Update the callers below. (linux_process_target::single_step) (linux_process_target::resume_one_lwp_throw) * linux-arm-low.cc (class arm_target) <supports_hardware_single_step>: Declare. (arm_supports_hardware_single_step): Turn into... (arm_target::supports_hardware_single_step): ...this. (the_low_target): Remove the op field. * linux-x86-low.cc (x86_supports_hardware_single_step): Remove. (the_low_target): Remove the op field. * linux-aarch64-low.cc (aarch64_supports_hardware_single_step): Remove. (the_low_target): Remove the op field. * linux-bfin-low.cc (bfin_supports_hardware_single_step): Remove. (the_low_target): Remove the op field. * linux-crisv32-low.cc (cris_supports_hardware_single_step): Remove. (the_low_target): Remove the op field. * linux-m32r-low.cc (m32r_supports_hardware_single_step): Remove. (the_low_target): Remove the op field. * linux-m68k-low.cc (m68k_supports_hardware_single_step): Remove. (the_low_target): Remove the op field. * linux-ppc-low.cc (ppc_supports_hardware_single_step): Remove. (the_low_target): Remove the op field. * linux-s390-low.cc (s390_supports_hardware_single_step): Remove. (the_low_target): Remove the op field. * linux-sh-low.cc (sh_supports_hardware_single_step): Remove. (the_low_target): Remove the op field. * linux-tic6x-low.cc (tic6x_supports_hardware_single_step): Remove. (the_low_target): Remove the op field. * linux-tile-low.cc (tile_supports_hardware_single_step): Remove. (the_low_target): Remove the op field. * linux-xtensa-low.cc (xtensa_supports_hardware_single_step): Remove. (the_low_target): Remove the op field.
2020-04-02 15:11:31 +02:00
/* Return true if THREAD is doing hardware single step. */
bool maybe_hw_step (thread_info *thread);
gdbserver/linux-low: turn some more static functions into private methods gdbserver/ChangeLog: 2020-04-02 Tankut Baris Aktemur <tankut.baris.aktemur@intel.com> Turn some more static methods in linux-low into private methods of linux_process_target. * linux-low.cc (get_pc): Turn into... (linux_process_target::get_pc): ...this. (save_stop_reason): Turn into... (linux_process_target::save_stop_reason): ...this. (thread_still_has_status_pending_p): Turn into... (linux_process_target::thread_still_has_status_pending): ...this. (status_pending_p_callback): Turn into... (linux_process_target::status_pending_p_callback): ...this. (resume_stopped_resumed_lwps): Turn into... (linux_process_target::resume_stopped_resumed_lwps): ...this. (install_software_single_step_breakpoints): Turn into... (linux_process_target::install_software_single_step_breakpoints): ...this. (single_step): Turn into... (linux_process_target::single_step): ...this. (linux_resume_one_lwp_throw): Turn into... (linux_process_target::resume_one_lwp_throw): ...this. (linux_resume_one_lwp): Turn into... (linux_process_target::resume_one_lwp): ...this. (resume_status_pending_p): Turn into... (linux_process_target::resume_status_pending): ...this. (need_step_over_p): Turn into... (linux_process_target::thread_needs_step_over): ...this. (linux_resume_one_thread): Turn into... (linux_process_target::resume_one_thread): ...this. (proceed_one_lwp): Turn into... (linux_process_target::proceed_one_lwp): ...this. (unsuspend_and_proceed_one_lwp): Turn into... (linux_process_target::unsuspend_and_proceed_one_lwp): ...this. Update the calls/references to the above functions below. (linux_process_target::handle_extended_wait) (linux_process_target::filter_event) (linux_process_target::wait_for_event_filtered) (linux_process_target::wait_1) (linux_process_target::move_out_of_jump_pad) (linux_process_target::start_step_over) (linux_process_target::resume) (linux_process_target::proceed_all_lwps) (regsets_store_inferior_registers) (linux_process_target::store_register) * linux-low.h (class linux_process_target) <get_pc> <save_stop_reason> <thread_still_has_status_pending> <status_pending_p_callback> <resume_stopped_resumed_lwps> <install_software_single_step_breakpoints> <single_step> <resume_one_lwp_throw> <resume_one_lwp> <resume_status_pending> <thread_needs_step_over> <resume_one_thread> <proceed_one_lwp> <unsuspend_and_proceed_one_lwp>: Declare.
2020-04-02 15:11:24 +02:00
/* Install breakpoints for software single stepping. */
void install_software_single_step_breakpoints (lwp_info *lwp);
gdbserver/linux-low: turn watchpoint ops into methods gdbserver/ChangeLog: 2020-04-02 Tankut Baris Aktemur <tankut.baris.aktemur@intel.com> Turn the 'stopped_by_watchpoint' and 'stopped_data_address' linux target ops into methods of linux_process_target. * linux-low.h (struct linux_target_ops): Remove the ops. (class linux_process_target) <check_stopped_by_watchpoint> <low_stopped_by_watchpoint> <low_stopped_data_address>: Declare. * linux-low.cc (check_stopped_by_watchpoint): Turn into... (linux_process_target::check_stopped_by_watchpoint): ...this. (linux_process_target::low_stopped_by_watchpoint): Define. (linux_process_target::low_stopped_data_address): Define. * linux-x86-low.cc (class x86_target) <low_stopped_by_watchpoint> <low_stopped_data_address>: Declare. (x86_stopped_by_watchpoint): Turn into... (x86_target::low_stopped_by_watchpoint): ...this. (x86_stopped_data_address): Turn into... (x86_target::low_stopped_data_address): ...this. (the_low_target): Remove the op fields. * linux-aarch64-low.cc (class aarch64_target) <low_stopped_by_watchpoint> <low_stopped_data_address>: Declare. (aarch64_stopped_by_watchpoint): Turn into... (aarch64_target::low_stopped_by_watchpoint): ...this. (aarch64_stopped_data_address): Turn into... (aarch64_target::low_stopped_data_address): ...this. (the_low_target): Remove the op fields. * linux-arm-low.cc (class arm_target) <low_stopped_by_watchpoint> <low_stopped_data_address>: Declare. (arm_stopped_by_watchpoint): Turn into... (arm_target::low_stopped_by_watchpoint): ...this. (arm_stopped_data_address): Turn into... (arm_target::low_stopped_data_address): ...this. (the_low_target): Remove the op fields. * linux-crisv32-low.cc (class crisv32_target) <low_stopped_by_watchpoint> <low_stopped_data_address>: Declare. (cris_stopped_by_watchpoint): Turn into... (crisv32_target::low_stopped_by_watchpoint): ...this. (cris_stopped_data_address): Turn into... (crisv32_target::low_stopped_data_address): ...this. (the_low_target): Remove the op fields. * linux-mips-low.cc (class mips_target) <low_stopped_by_watchpoint> <low_stopped_data_address>: Declare. (mips_stopped_by_watchpoint): Turn into... (mips_target::low_stopped_by_watchpoint): ...this. (mips_stopped_data_address): Turn into... (mips_target::low_stopped_data_address): ...this. (the_low_target): Remove the op fields. * linux-bfin-low.cc (the_low_target): Remove the op fields. * linux-m32r-low.cc (the_low_target): Ditto. * linux-m68k-low.cc (the_low_target): Ditto. * linux-ppc-low.cc (the_low_target): Ditto. * linux-s390-low.cc (the_low_target): Ditto. * linux-sh-low.cc (the_low_target): Ditto. * linux-sparc-low.cc (the_low_target): Ditto. * linux-tic6x-low.cc (the_low_target): Ditto. * linux-tile-low.cc (the_low_target): Ditto. * linux-xtensa-low.cc (the_low_target): Ditto.
2020-04-02 15:11:27 +02:00
/* Fetch the possibly triggered data watchpoint info and store it in
CHILD.
On some archs, like x86, that use debug registers to set
watchpoints, it's possible that the way to know which watched
address trapped, is to check the register that is used to select
which address to watch. Problem is, between setting the watchpoint
and reading back which data address trapped, the user may change
the set of watchpoints, and, as a consequence, GDB changes the
debug registers in the inferior. To avoid reading back a stale
stopped-data-address when that happens, we cache in LP the fact
that a watchpoint trapped, and the corresponding data address, as
soon as we see CHILD stop with a SIGTRAP. If GDB changes the debug
registers meanwhile, we have the cached data we can rely on. */
bool check_stopped_by_watchpoint (lwp_info *child);
/* Convert a native/host siginfo object, into/from the siginfo in the
layout of the inferiors' architecture. */
void siginfo_fixup (siginfo_t *siginfo, gdb_byte *inf_siginfo,
int direction);
gdbserver/linux-low: turn process/thread addition/deletion ops into methods gdbserver/ChangeLog: 2020-04-02 Tankut Baris Aktemur <tankut.baris.aktemur@intel.com> Turn the 'new_process', 'delete_process', 'new_thread', 'delete_thread', and 'new_fork' linux target ops into methods of linux_process_target. * linux-low.h (struct linux_target_ops): Remove the ops. (class linux_process_target) <add_linux_process> <add_lwp> <delete_lwp> <attach_lwp> <detach_one_lwp> <check_zombie_leaders> <filter_exit_event> <low_new_process> <low_delete_process> <low_new_thread> <low_delete_thread> <low_new_fork>: Declare. * linux-low.cc (delete_lwp): Turn into... (linux_process_target::delete_lwp): ...this. (linux_process_target::low_delete_thread): Define. (linux_add_process): Turn into... (linux_process_target::add_linux_process): ...this. (linux_process_target::low_new_process): Define. (linux_process_target::low_delete_process): Define. (linux_process_target::low_new_fork): Define. (add_lwp): Turn into... (linux_process_target::add_lwp): ...this. (linux_process_target::low_new_thread): Define. (linux_attach_lwp): Turn into... (linux_process_target::attach_lwp): ...this. (linux_detach_one_lwp): Turn into... (linux_process_target::detach_one_lwp): ...this. (linux_detach_lwp_callback): Remove and inline... (linux_process_target::detach): ...here. (check_zombie_leaders): Turn into... (linux_process_target::check_zombie_leaders): ...this. (filter_exit_event): Turn into... (linux_process_target::filter_exit_event): ...this. Update the callers below. (linux_process_target::handle_extended_wait) (linux_process_target::create_inferior) (attach_proc_task_lwp_callback) (linux_process_target::attach) (linux_process_target::detach) (linux_process_target::mourn) * thread-db.cc (attach_thread) * linux-x86-low.cc (class x86_target) <low_new_process> <low_delete_process> <low_new_thread> <low_delete_thread> <low_new_fork>: Declare. (x86_linux_new_process): Turn into... (x86_target::low_new_process): ...this. (x86_linux_delete_process): Turn into... (x86_target::low_delete_process): ...this. (x86_target::low_new_thread): Define. (x86_target::low_delete_thread): Define. (x86_linux_new_fork): Turn into... (x86_target::low_new_fork): ...this. (the_low_target): Remove the op fields. * linux-aarch64-low.cc (class aarch64_target) <low_new_process> <low_delete_process> <low_new_thread> <low_delete_thread> <low_new_fork>: Declare. (aarch64_linux_new_process): Turn into... (aarch64_target::low_new_process): ...this. (aarch64_linux_delete_process): Turn into... (aarch64_target::low_delete_process): ...this. (aarch64_target::low_new_thread): Define. (aarch64_target::low_delete_thread): Define. (aarch64_linux_new_fork): Turn into... (aarch64_target::low_new_fork): ...this. (the_low_target): Remove the op fields. * linux-arm-low.cc (class arm_target) <low_new_process> <low_delete_process> <low_new_thread> <low_delete_thread> <low_new_fork>: Declare. (arm_new_process): Turn into... (arm_target::low_new_process): ...this. (arm_delete_process): Turn into... (arm_target::low_delete_process): ...this. (arm_new_thread): Turn into... (arm_target::low_new_thread): ...this. (arm_delete_thread): Turn into... (arm_target::low_delete_thread): ...this. (arm_new_fork): Turn into... (arm_target::low_new_fork): ...this. (the_low_target): Remove the op fields. * linux-mips-low.cc (class mips_target) <low_new_process> <low_delete_process> <low_new_thread> <low_delete_thread> <low_new_fork>: Declare. (mips_linux_new_process): Turn into... (mips_target::low_new_process): ...this. (mips_linux_delete_process): Turn into... (mips_target::low_delete_process): ...this. (mips_linux_new_thread): Turn into... (mips_target::low_new_thread): ...this. (mips_linux_delete_thread): Turn into... (mips_target::low_delete_thread): ...this. (mips_linux_new_fork): Turn into... (mips_target::low_new_fork): ...this. (the_low_target): Remove the op fields. * linux-bfin-low.cc (the_low_target): Remove the op fields. * linux-crisv32-low.cc (the_low_target): Ditto. * linux-m32r-low.cc (the_low_target): Ditto. * linux-m68k-low.cc (the_low_target): Ditto. * linux-ppc-low.cc (the_low_target): Ditto. * linux-s390-low.cc (the_low_target): Ditto. * linux-sh-low.cc (the_low_target): Ditto. * linux-tic6x-low.cc (the_low_target): Ditto. * linux-tile-low.cc (the_low_target): Ditto. * linux-xtensa-low.cc (the_low_target): Ditto.
2020-04-02 15:11:28 +02:00
/* Add a process to the common process list, and set its private
data. */
process_info *add_linux_process (int pid, int attached);
/* Add a new thread. */
lwp_info *add_lwp (ptid_t ptid);
/* Delete a thread. */
void delete_lwp (lwp_info *lwp);
public: /* Make this public because it's used from outside. */
/* Attach to an inferior process. Returns 0 on success, ERRNO on
error. */
int attach_lwp (ptid_t ptid);
private: /* Back to private. */
/* Detach from LWP. */
void detach_one_lwp (lwp_info *lwp);
/* Detect zombie thread group leaders, and "exit" them. We can't
reap their exits until all other threads in the group have
exited. */
void check_zombie_leaders ();
/* Convenience function that is called when the kernel reports an exit
event. This decides whether to report the event to GDB as a
process exit event, a thread exit event, or to suppress the
event. */
ptid_t filter_exit_event (lwp_info *event_child,
target_waitstatus *ourstatus);
gdbserver/linux-low: turn 'get_thread_area' into a method gdbserver/ChangeLog: 2020-04-02 Tankut Baris Aktemur <tankut.baris.aktemur@intel.com> Turn the 'get_thread_area' linux target op into a method of process_stratum_target. * linux-low.h (struct linux_target_ops): Remove the op. (class linux_process_target) <stuck_in_jump_pad> <linux_fast_tracepoint_collecting> <low_get_thread_area>: Declare. * linux-low.cc (supports_fast_tracepoints): Remove. (linux_fast_tracepoint_collecting): Turn into... (linux_process_target::linux_fast_tracepoint_collecting): ...this. (linux_process_target::low_get_thread_area): Define. (stuck_in_jump_pad_callback): Turn into... (linux_process_target::stuck_in_jump_pad): ...this. Update the caller below. (linux_process_target::stabilize_threads) * linux-x86-low.cc (class x86_target) <low_get_thread_area>: Declare. (x86_get_thread_area): Turn into... (x86_target::low_get_thread_area): ...this. (the_low_target): Remove the op field. * linux-aarch64-low.cc (class aarch64_target) <low_get_thread_area>: Declare. (aarch64_get_thread_area): Turn into... (aarch64_target::low_get_thread_area): ...this. (the_low_target): Remove the op field. * linux-ppc-low.cc (class ppc_target) <low_get_thread_area>: Declare. (ppc_get_thread_area): Turn into... (ppc_target::low_get_thread_area): ...this. (the_low_target): Remove the op field. * linux-s390-low.cc (class s390_target) <low_get_thread_area>: Declare. (s390_get_thread_area): Turn into... (s390_target::low_get_thread_area): ...this. (the_low_target): Remove the op field. * linux-arm-low.cc (the_low_target): Remove the op field. * linux-bfin-low.cc (the_low_target): Ditto. * linux-crisv32-low.cc (the_low_target): Ditto. * linux-m32r-low.cc (the_low_target): Ditto. * linux-m68k-low.cc (the_low_target): Ditto. * linux-sh-low.cc (the_low_target): Ditto. * linux-tic6x-low.cc (the_low_target): Ditto. * linux-tile-low.cc (the_low_target): Ditto. * linux-xtensa-low.cc (the_low_target): Ditto.
2020-04-02 15:11:30 +02:00
/* Returns true if THREAD is stopped in a jump pad, and we can't
move it out, because we need to report the stop event to GDB. For
example, if the user puts a breakpoint in the jump pad, it's
because she wants to debug it. */
bool stuck_in_jump_pad (thread_info *thread);
/* Convenience wrapper. Returns information about LWP's fast tracepoint
collection status. */
fast_tpoint_collect_result linux_fast_tracepoint_collecting
(lwp_info *lwp, fast_tpoint_collect_status *status);
gdbserver/linux-low: turn 'get_syscall_trapinfo' into a method gdbserver/ChangeLog: 2020-04-02 Tankut Baris Aktemur <tankut.baris.aktemur@intel.com> Turn the 'get_syscall_trapinfo' linux target op into a method of process_stratum_target. * linux-low.h (struct linux_target_ops): Remove the op. (class linux_process_target) <get_syscall_trapinfo> <gdb_catch_this_syscall> <low_supports_catch_syscall> <low_get_syscall_trapinfo>: Declare. * linux-low.cc (get_syscall_trapinfo): Turn into... (linux_process_target::get_syscall_trapinfo): ...this. (linux_process_target::low_get_syscall_trapinfo): Define. (gdb_catch_this_syscall_p): Turn into... (linux_process_target::gdb_catch_this_syscall): ...this. (linux_process_target::low_supports_catch_syscall): Define. Update the callers below. (linux_process_target::wait_1) (linux_process_target::supports_catch_syscall) * linux-x86-low.cc (class x86_target) <low_supports_catch_syscall> <low_get_syscall_trapinfo>: Declare. (x86_target::low_supports_catch_syscall): Define. (x86_get_syscall_trapinfo): Turn into... (x86_target::low_get_syscall_trapinfo): ...this. (the_low_target): Remove the op field. * linux-aarch64-low.cc (class aarch64_target) <low_supports_catch_syscall> <low_get_syscall_trapinfo>: Declare. (aarch64_target::low_supports_catch_syscall): Define. (aarch64_get_syscall_trapinfo): Turn into... (aarch64_target::low_get_syscall_trapinfo): ...this. (the_low_target): Remove the op field. * linux-arm-low.cc (class arm_target) <low_supports_catch_syscall> <low_get_syscall_trapinfo>: Declare. (arm_target::low_supports_catch_syscall): Define. (arm_get_syscall_trapinfo): Turn into... (arm_target::low_get_syscall_trapinfo): ...this. (the_low_target): Remove the op field. * linux-ppc-low.cc (the_low_target): Remove the op field. * linux-s390-low.cc (the_low_target): Remove the op field.
2020-04-02 15:11:31 +02:00
/* This function should only be called if LWP got a SYSCALL_SIGTRAP.
Fill *SYSNO with the syscall nr trapped. */
void get_syscall_trapinfo (lwp_info *lwp, int *sysno);
/* Returns true if GDB is interested in the event_child syscall.
Only to be called when stopped reason is SYSCALL_SIGTRAP. */
bool gdb_catch_this_syscall (lwp_info *event_child);
gdbserver/linux-low: start turning linux target ops into methods This is the beginning of a series of patches that convert the linux low targets into classes derived from linux_process_target. At the end of the series we obtain a class hierarchy that looks like this: process_stratum_target ^ | |-- linux_process_target ^ | |-- x86_target (defined in linux-x86-low) |-- aarch64_target (defined in linux-aarch64-low) |-- ppc_target (defined in linux-ppc-low) |-- ... In several cases, linux_process_target simply forwards a target op request to a corresponding linux_target_ops function. For these cases, the definition in linux_process_target will be removed and the definition will be left to the deriving linux low target class; using inheritance provides a nice and natural, object-oriented simplification in these cases. The series converts linux_target_ops into protected methods of linux_process_target one by one. Throughout the series, based on the needs, static functions defined in linux-low.cc are converted to private methods of linux_process_target as well. This is done either as separate patches or as integrated into a patch that convert a particular linux_target_op into a method. The series ends with the patch titled "gdbserver/linux-low: delete 'linux_target_ops' and 'the_low_target'". Built and regression-tested on x86_64-linux. The following linux low targets have been built (but not tested) via cross-compilation: aarch64, arm, m68k, mips, ppc, riscv, s390, sh, sparc. The other targets (bfin, cris, crisv32, ia64, m32r, nios2, tic6x, tile, xtensa) were neither built nor tested. gdbserver/ChangeLog: 2020-04-02 Tankut Baris Aktemur <tankut.baris.aktemur@intel.com> * linux-low.h (the_linux_target): New extern declaration. * linux-low.cc (initialize_low): Use 'the_linux_target' to set 'the_target'. (the_linux_target): Remove. * linux-x86-low.cc (class x86_target): New class. (the_x86_target): New static object. (the_linux_target): Define as pointer to the_x86_target. * linux-aarch64-low.cc (class aarch64_target): New class. (the_aarch64_target): New static object. (the_linux_target): Define as pointer to the_aarch64_target. * linux-arm-low.cc (class arm_target): New class. (the_arm_target): New static object. (the_linux_target): Define as pointer to the_arm_target. * linux-bfin-low.cc (class bfin_target): New class. (the_bfin_target): New static object. (the_linux_target): Define as pointer to the_bfin_target. * linux-cris-low.cc (class cris_target): New class. (the_cris_target): New static object. (the_linux_target): Define as pointer to the_cris_target. * linux-crisv32-low.cc (class crisv32_target): New class. (the_crisv32_target): New static object. (the_linux_target): Define as pointer to the_crisv32_target. * linux-ia64-low.cc (class ia64_target): New class. (the_ia64_target): New static object. (the_linux_target): Define as pointer to the_ia64_target. * linux-m32r-low.cc (class m32r_target): New class. (the_m32r_target): New static object. (the_linux_target): Define as pointer to the_m32r_target. * linux-m68k-low.cc (class m68k_target): New class. (the_m68k_target): New static object. (the_linux_target): Define as pointer to the_m68k_target. * linux-mips-low.cc (class mips_target): New class. (the_mips_target): New static object. (the_linux_target): Define as pointer to the_mips_target. * linux-nios2-low.cc (class nios2_target): New class. (the_nios2_target): New static object. (the_linux_target): Define as pointer to the_nios2_target. * linux-ppc-low.cc (class ppc_target): New class. (the_ppc_target): New static object. (the_linux_target): Define as pointer to the_ppc_target. * linux-riscv-low.cc (class riscv_target): New class. (the_riscv_target): New static object. (the_linux_target): Define as pointer to the_riscv_target. * linux-s390-low.cc (class s390_target): New class. (the_s390_target): New static object. (the_linux_target): Define as pointer to the_s390_target. * linux-sh-low.cc (class sh_target): New class. (the_sh_target): New static object. (the_linux_target): Define as pointer to the_sh_target. * linux-sparc-low.cc (class sparc_target): New class. (the_sparc_target): New static object. (the_linux_target): Define as pointer to the_sparc_target. * linux-tic6x-low.cc (class tic6x_target): New class. (the_tic6x_target): New static object. (the_linux_target): Define as pointer to the_tic6x_target. * linux-tile-low.cc (class tile_target): New class. (the_tile_target): New static object. (the_linux_target): Define as pointer to the_tile_target. * linux-xtensa-low.cc (class xtensa_target): New class. (the_xtensa_target): New static object. (the_linux_target): Define as pointer to the_xtensa_target.
2020-04-02 15:11:23 +02:00
protected:
/* The architecture-specific "low" methods are listed below. */
gdbserver/linux-low: turn 'arch_setup' into a method gdbserver/ChangeLog: 2020-04-02 Tankut Baris Aktemur <tankut.baris.aktemur@intel.com> Turn the 'arch_setup' linux target op into a method of linux_process_target. * linux-low.h (struct linux_target_ops) <arch_setup>: Delete. (class linux_process_target) <arch_setup_thread> <low_arch_setup>: New declarations. * linux-low.cc (linux_arch_setup): Delete. (linux_arch_setup_thread): Turn into... (linux_process_target::arch_setup_thread): ... this. Update the callers below. (linux_process_target::handle_extended_wait) (linux_process_target::post_create_inferior) (linux_process_target::filter_event) * linux-x86-low.cc (class x86_target) <low_arch_setup>: New declaration. (x86_linux_update_xmltarget): Turn into... (x86_target::update_xmltarget): ...this. (x86_linux_process_qsupported): Update the call to x86_linux_update_xmltarget. (x86_arch_setup): Turn into ... (x86_target::low_arch_setup): ...this. (the_low_target): Remove the op field. * linux-aarch64-low.cc (class aarch64_target) <low_arch_setup>: New declaration. (aarch64_arch_setup): Turn into ... (aarch64_target::low_arch_setup): ...this. (the_low_target): Remove the op field. * linux-arm-low.cc (class arm_target) <low_arch_setup>: New declaration. (arm_arch_setup): Turn into ... (arm_target::low_arch_setup): ...this. (the_low_target): Remove the op field. * linux-bfin-low.cc (class bfin_target) <low_arch_setup>: New declaration. (bfin_arch_setup): Turn into ... (bfin_target::low_arch_setup): ...this. (the_low_target): Remove the op field. * linux-cris-low.cc (class cris_target) <low_arch_setup>: New declaration. (cris_arch_setup): Turn into ... (cris_target::low_arch_setup): ...this. (the_low_target): Remove the op field. * linux-crisv32-low.cc (class crisv32_target) <low_arch_setup>: New declaration. (crisv32_arch_setup): Turn into ... (crisv32_target::low_arch_setup): ...this. (the_low_target): Remove the op field. * linux-ia64-low.cc (class ia64_target) <low_arch_setup>: New declaration. (ia64_arch_setup): Turn into ... (ia64_target::low_arch_setup): ...this. (the_low_target): Remove the op field. * linux-m32r-low.cc (class m32r_target) <low_arch_setup>: New declaration. (m32r_arch_setup): Turn into ... (m32r_target::low_arch_setup): ...this. (the_low_target): Remove the op field. * linux-m68k-low.cc (class m68k_target) <low_arch_setup>: New declaration. (m68k_arch_setup): Turn into ... (m68k_target::low_arch_setup): ...this. (the_low_target): Remove the op field. * linux-mips-low.cc (class mips_target) <low_arch_setup>: New declaration. (mips_arch_setup): Turn into ... (mips_target::low_arch_setup): ...this. (the_low_target): Remove the op field. * linux-nios2-low.cc (class nios2_target) <low_arch_setup>: New declaration. (nios2_arch_setup): Turn into ... (nios2_target::low_arch_setup): ...this. (the_low_target): Remove the op field. * linux-ppc-low.cc (class ppc_target) <low_arch_setup>: New declaration. (ppc_arch_setup): Turn into ... (ppc_target::low_arch_setup): ...this. (the_low_target): Remove the op field. * linux-riscv-low.cc (class riscv_target) <low_arch_setup>: New declaration. (riscv_arch_setup): Turn into ... (riscv_target::low_arch_setup): ...this. (the_low_target): Remove the op field. * linux-s390-low.cc (class s390_target) <low_arch_setup>: New declaration. (s390_arch_setup): Turn into ... (s390_target::low_arch_setup): ...this. (the_low_target): Remove the op field. * linux-sh-low.cc (class sh_target) <low_arch_setup>: New declaration. (sh_arch_setup): Turn into ... (sh_target::low_arch_setup): ...this. (the_low_target): Remove the op field. * linux-sparc-low.cc (class sparc_target) <low_arch_setup>: New declaration. (sparc_arch_setup): Turn into ... (sparc_target::low_arch_setup): ...this. (the_low_target): Remove the op field. * linux-tic6x-low.cc (class tic6x_target) <low_arch_setup>: New declaration. (tic6x_arch_setup): Turn into ... (tic6x_target::low_arch_setup): ...this. (the_low_target): Remove the op field. * linux-tile-low.cc (class tile_target) <low_arch_setup>: New declaration. (tile_arch_setup): Turn into ... (tile_target::low_arch_setup): ...this. (the_low_target): Remove the op field. * linux-xtensa-low.cc (class xtensa_target) <low_arch_setup>: New declaration. (xtensa_arch_setup): Turn into ... (xtensa_target::low_arch_setup): ...this. (the_low_target): Remove the op field.
2020-04-02 15:11:23 +02:00
/* Architecture-specific setup for the current thread. */
virtual void low_arch_setup () = 0;
gdbserver/linux-low: turn 'cannot_{fetch/store}_register' into methods gdbserver/ChangeLog: 2020-04-02 Tankut Baris Aktemur <tankut.baris.aktemur@intel.com> Turn the 'cannot_fetch_register' and 'cannot_store_register' linux target ops into methods of linux_process_target. * linux-low.h (struct linux_target_ops): Remove the low target ops. (class linux_process_target) <fetch_register> <store_register> <usr_fetch_inferior_registers> <usr_store_inferior_registers> <low_cannot_fetch_register> <low_cannot_fetch_register> Declare. * linux-low.cc (fetch_register): Turn into... (linux_process_target::fetch_register): ...this. (store_register): Turn into ... (linux_process_target::store_register): ...this. (usr_fetch_inferior_registers): Turn into... (linux_process_target::usr_fetch_inferior_registers): ...this. (usr_store_inferior_registers): Turn into... (linux_process_target::usr_store_inferior_registers): ...this. * linux-x86-low.cc (class x86_target) <low_cannot_fetch_register> <low_cannot_store_register>: Declare. (x86_cannot_store_register): Turn into... (x86_target::low_cannot_store_register): ...this. (x86_cannot_fetch_register): Turn into... (x86_target::low_cannot_fetch_register): ...this. (the_low_target): Remove the target op fields. * linux-aarch64-low.cc (class aarch64_target) <low_cannot_fetch_register> <low_cannot_store_register>: Declare. (aarch64_target::low_cannot_fetch_register) (aarch64_target::low_cannot_store_register): Define. (the_low_target): Remove the op fields. * linux-arm-low.cc (class arm_target) <low_cannot_fetch_register> <low_cannot_store_register>: Declare. (arm_cannot_fetch_register): Turn into... (arm_target::low_cannot_fetch_register): ...this. (arm_cannot_store_register): Turn into... (arm_target::low_cannot_store_register): ...this. (the_low_target): Remove the op fields. * linux-bfin-low.cc (class bfin_target) <low_cannot_fetch_register> <low_cannot_store_register>: Declare. (bfin_cannot_fetch_register): Turn into... (bfin_target::low_cannot_fetch_register): ...this. (bfin_cannot_store_register): Turn into... (bfin_target::low_cannot_store_register): ...this. (the_low_target): Remove the op fields. * linux-cris-low.cc (class cris_target) <low_cannot_fetch_register> <low_cannot_store_register>: Declare. (cris_cannot_fetch_register): Turn into... (cris_target::low_cannot_fetch_register): ...this. (cris_cannot_store_register): Turn into... (cris_target::low_cannot_store_register): ...this. (the_low_target): Remove the op fields. * linux-crisv32-low.cc (class crisv32_target) <low_cannot_fetch_register> <low_cannot_store_register>: Declare. (crisv32_target::low_cannot_fetch_register) (crisv32_target::low_cannot_store_register): Define. (the_low_target): Remove the op fields. * linux-ia64-low.cc (class ia64_target) <low_cannot_fetch_register> <low_cannot_store_register>: Declare. (ia64_cannot_fetch_register): Turn into... (ia64_target::low_cannot_fetch_register): ...this. (ia64_cannot_store_register): Turn into... (ia64_target::low_cannot_store_register): ...this. (the_low_target): Remove the op fields. * linux-m32r-low.cc (class m32r_target) <low_cannot_fetch_register> <low_cannot_store_register>: Declare. (m32r_cannot_fetch_register): Turn into... (m32r_target::low_cannot_fetch_register): ...this. (m32r_cannot_store_register): Turn into... (m32r_target::low_cannot_store_register): ...this. (the_low_target): Remove the op fields. * linux-m68k-low.cc (class m68k_target) <low_cannot_fetch_register> <low_cannot_store_register>: Declare. (m68k_cannot_fetch_register): Turn into... (m68k_target::low_cannot_fetch_register): ...this. (m68k_cannot_store_register): Turn into... (m68k_target::low_cannot_store_register): ...this. (the_low_target): Remove the op fields. * linux-mips-low.cc (class mips_target) <low_cannot_fetch_register> <low_cannot_store_register>: Declare. (mips_cannot_fetch_register): Turn into... (mips_target::low_cannot_fetch_register): ...this. (mips_cannot_store_register): Turn into... (mips_target::low_cannot_store_register): ...this. (get_usrregs_info): Inline at the call sites in low_cannot_fetch_register and low_cannot_store_register, and remove. (the_low_target): Remove the op fields. * linux-nios2-low.cc (class nios2_target) <low_cannot_fetch_register> <low_cannot_store_register>: Declare. (nios2_cannot_fetch_register): Turn into... (nios2_target::low_cannot_fetch_register): ...this. (nios2_cannot_store_register): Turn into... (nios2_target::low_cannot_store_register): ...this. (the_low_target): Remove the op fields. * linux-ppc-low.cc (class ppc_target) <low_cannot_fetch_register> <low_cannot_store_register>: Declare. (ppc_cannot_fetch_register): Turn into... (ppc_target::low_cannot_fetch_register): ...this. (ppc_cannot_store_register): Turn into... (ppc_target::low_cannot_store_register): ...this. (the_low_target): Remove the op fields. * linux-riscv-low.cc (class riscv_target) <low_cannot_fetch_register> <low_cannot_store_register>: Declare. (riscv_target::low_cannot_fetch_register) (riscv_target::low_cannot_store_register): Define. (the_low_target): Remove the op fields. * linux-s390-low.cc (class s390_target) <low_cannot_fetch_register> <low_cannot_store_register>: Declare. (s390_cannot_fetch_register): Turn into... (s390_target::low_cannot_fetch_register): ...this. (s390_cannot_store_register): Turn into... (s390_target::low_cannot_store_register): ...this. (the_low_target): Remove the op fields. * linux-sh-low.cc (class sh_target) <low_cannot_fetch_register> <low_cannot_store_register>: Declare. (sh_cannot_fetch_register): Turn into... (sh_target::low_cannot_fetch_register): ...this. (sh_cannot_store_register): Turn into... (sh_target::low_cannot_store_register): ...this. (the_low_target): Remove the op fields. * linux-sparc-low.cc (class sparc_target) <low_cannot_fetch_register> <low_cannot_store_register>: Declare. (sparc_cannot_fetch_register): Turn into... (sparc_target::low_cannot_fetch_register): ...this. (sparc_cannot_store_register): Turn into... (sparc_target::low_cannot_store_register): ...this. (the_low_target): Remove the op fields. * linux-tic6x-low.cc (class tic6x_target) <low_cannot_fetch_register> <low_cannot_store_register>: Declare. (tic6x_cannot_fetch_register): Turn into... (tic6x_target::low_cannot_fetch_register): ...this. (tic6x_cannot_store_register): Turn into... (tic6x_target::low_cannot_store_register): ...this. (the_low_target): Remove the op fields. * linux-tile-low.cc (class tile_target) <low_cannot_fetch_register> <low_cannot_store_register>: Declare. (tile_cannot_fetch_register): Turn into... (tile_target::low_cannot_fetch_register): ...this. (tile_cannot_store_register): Turn into... (tile_target::low_cannot_store_register): ...this. (the_low_target): Remove the op fields. * linux-xtensa-low.cc (class xtensa_target) <low_cannot_fetch_register> <low_cannot_store_register>: Declare. (xtensa_target::low_cannot_fetch_register) (xtensa_target::low_cannot_store_register): Define. (the_low_target): Remove the op fields.
2020-04-02 15:11:24 +02:00
/* Return false if we can fetch/store the register, true if we cannot
fetch/store the register. */
virtual bool low_cannot_fetch_register (int regno) = 0;
virtual bool low_cannot_store_register (int regno) = 0;
gdbserver/linux-low: turn 'fetch_register' into a method gdbserver/ChangeLog: 2020-04-02 Tankut Baris Aktemur <tankut.baris.aktemur@intel.com> Turn the 'fetch_register' linux target op into a method of linux_process_target. * linux-low.h (struct linux_target_ops) <fetch_register>: Remove. (class linux_process_target) <low_fetch_register>: Declare. * linux-x86-low.cc (the_low_target) * linux-aarch64-low.cc (the_low_target) * linux-arm-low.cc (the_low_target) * linux-bfin-low.cc (the_low_target) * linux-cris-low.cc (the_low_target) * linux-crisv32-low.cc (the_low_target) * linux-m32r-low.cc (the_low_target) * linux-m68k-low.cc (the_low_target) * linux-nios2-low.cc (the_low_target) * linux-ppc-low.cc (the_low_target) * linux-s390-low.cc (the_low_target) * linux-sh-low.cc (the_low_target) * linux-sparc-low.cc (the_low_target) * linux-tic6x-low.cc (the_low_target) * linux-tile-low.cc (the_low_target) * linux-xtensa-low.cc (the_low_target): Remove the op field. * linux-ia64-low.cc (class ia64_target) <low_fetch_register>: Declare. (ia64_fetch_register): Turn into... (ia64_target::low_fetch_register): ...this. (the_low_target): Remove the op field. * linux-mips-low.cc (class mips_target) <low_fetch_register>: Declare. (mips_fetch_register): Turn into... (mips_target::low_fetch_register): ...this. (the_low_target): Remove the op field. * linux-riscv-low.cc (class riscv_target) <low_fetch_register>: Declare. (riscv_fetch_register): Turn into... (riscv_target::low_fetch_register): ...this. (the_low_target): Remove the op field. Update the callers below. * linux-low.cc (linux_process_target::fetch_registers) (linux_process_target::low_fetch_register)
2020-04-02 15:11:24 +02:00
/* Hook to fetch a register in some non-standard way. Used for
example by backends that have read-only registers with hardcoded
values (e.g., IA64's gr0/fr0/fr1). Returns true if register
REGNO was supplied, false if not, and we should fallback to the
standard ptrace methods. */
virtual bool low_fetch_register (regcache *regcache, int regno);
gdbserver/linux-low: turn 'get_pc' and 'set_pc' into methods gdbserver/ChangeLog: 2020-04-02 Tankut Baris Aktemur <tankut.baris.aktemur@intel.com> Turn the 'get_pc' and 'set_pc' linux target ops into methods of linux_process_target. * linux-low.h (struct linux_target_ops): Remove the ops. (class linux_process_target) <low_supports_breakpoints> <low_get_pc> <low_set_pc>: Declare. * linux-low.cc (supports_breakpoints): Turn into... (linux_process_target::low_supports_breakpoints): ...this. (linux_process_target::low_get_pc): Define. (linux_process_target::low_set_pc): Define. Update the callers below. (linux_process_target::get_pc) (linux_process_target::save_stop_reason) (linux_process_target::maybe_move_out_of_jump_pad) (linux_process_target::wait_1) (linux_process_target::resume_one_lwp_throw) (linux_process_target::resume) (linux_process_target::proceed_all_lwps) (linux_process_target::read_pc) (linux_process_target::write_pc) * linux-x86-low.cc (class linux_process_target) <low_supports_breakpoints> <low_get_pc> <low_set_pc>: Declare. (x86_target::low_supports_breakpoints): Define. (x86_get_pc): Turn into... (x86_target::low_get_pc): ...this. (x86_set_pc): Turn into... (x86_target::low_set_pc): ...this. (the_low_target): Remove the op fields. * linux-arm-low.cc (class arm_target) <low_supports_breakpoints> <low_get_pc> <low_set_pc>: Declare. (arm_target::low_supports_breakpoints) (arm_target::low_get_pc) (arm_target::low_set_pc): Define. (the_low_target): Remove the op fields. * linux-bfin-low.cc (class bfin_target) <low_supports_breakpoints> <low_get_pc> <low_set_pc>: Declare. (bfin_target::low_supports_breakpoints) (bfin_target::low_get_pc) (bfin_target::low_set_pc): Define. (the_low_target): Remove the op fields. * linux-cris-low.cc (class cris_target) <low_supports_breakpoints> <low_get_pc> <low_set_pc>: Declare. (cris_target::low_supports_breakpoints) (cris_target::low_get_pc) (cris_target::low_set_pc): Define. (the_low_target): Remove the op fields. * linux-crisv32-low.cc (class crisv32_target) <low_supports_breakpoints> <low_get_pc> <low_set_pc>: Declare. (crisv32_target::low_supports_breakpoints) (crisv32_target::low_get_pc) (crisv32_target::low_set_pc): Define. (the_low_target): Remove the op fields. * linux-m32r-low.cc (class m32r_target) <low_supports_breakpoints> <low_get_pc> <low_set_pc>: Declare. (m32r_target::low_supports_breakpoints) (m32r_target::low_get_pc) (m32r_target::low_set_pc): Define. (the_low_target): Remove the op fields. * linux-m68k-low.cc (class m68k_target) <low_supports_breakpoints> <low_get_pc> <low_set_pc>: Declare. (m68k_target::low_supports_breakpoints) (m68k_target::low_get_pc) (m68k_target::low_set_pc): Define. (the_low_target): Remove the op fields. * linux-nios2-low.cc (class nios2_target) <low_supports_breakpoints> <low_get_pc> <low_set_pc>: Declare. (nios2_target::low_supports_breakpoints) (nios2_target::low_get_pc) (nios2_target::low_set_pc): Define. (the_low_target): Remove the op fields. * linux-sh-low.cc (class sh_target) <low_supports_breakpoints> <low_get_pc> <low_set_pc>: Declare. (sh_target::low_supports_breakpoints) (sh_target::low_get_pc) (sh_target::low_set_pc): Define. (the_low_target): Remove the op fields. * linux-xtensa-low.cc (class xtensa_target) <low_supports_breakpoints> <low_get_pc> <low_set_pc>: Declare. (xtensa_target::low_supports_breakpoints) (xtensa_target::low_get_pc) (xtensa_target::low_set_pc): Define. (the_low_target): Remove the op fields. * linux-sparc-low.cc (class sparc_target) <low_supports_breakpoints> <low_get_pc>: Declare. (sparc_target::low_supports_breakpoints) (sparc_target::low_get_pc): Define. (the_low_target): Remove the op fields. * linux-tile-low.cc (class tile_target) <low_supports_breakpoints> <low_get_pc> <low_set_pc>: Declare. (tile_target::low_supports_breakpoints) (tile_target::low_get_pc) (tile_target::low_set_pc): Define. (the_low_target): Remove the op fields. * linux-aarch64-low.cc (class aarch64_target) <low_supports_breakpoints> <low_get_pc> <low_set_pc>: Declare. (aarch64_target::low_supports_breakpoints): Define. (aarch64_get_pc): Turn into... (aarch64_target::low_get_pc): ...this. (aarch64_set_pc): Turn into... (aarch64_target::low_set_pc): ...this. (the_low_target): Remove the op fields. * linux-mips-low.cc (class mips_target) <low_supports_breakpoints> <low_get_pc> <low_set_pc>: Declare. (mips_target::low_supports_breakpoints): Define. (mips_get_pc): Turn into... (mips_target::low_get_pc): ...this. (mips_set_pc): Turn into... (mips_target::low_set_pc): ...this. (the_low_target): Remove the op fields. * linux-ppc-low.cc (class ppc_target) <low_supports_breakpoints> <low_get_pc> <low_set_pc>: Declare. (ppc_target::low_supports_breakpoints): Define. (ppc_get_pc): Turn into... (ppc_target::low_get_pc): ...this. (ppc_set_pc): Turn into... (ppc_target::low_set_pc): ...this. (the_low_target): Remove the op fields. * linux-riscv-low.cc (class riscv_target) <low_supports_breakpoints> <low_get_pc> <low_set_pc>: Declare. (riscv_target::low_supports_breakpoints): Define. (riscv_get_pc): Turn into... (riscv_target::low_get_pc): ...this. (riscv_set_pc): Turn into... (riscv_target::low_set_pc): ...this. (the_low_target): Remove the op fields. * linux-s390-low.cc (class s390_target) <low_supports_breakpoints> <low_get_pc> <low_set_pc>: Declare. (s390_target::low_supports_breakpoints): Define. (s390_get_pc): Turn into... (s390_target::low_get_pc): ...this. (s390_set_pc): Turn into... (s390_target::low_set_pc): ...this. (the_low_target): Remove the op fields. * linux-tic6x-low.cc (class tic6x_target) <low_supports_breakpoints> <low_get_pc> <low_set_pc>: Declare. (tic6x_target::low_supports_breakpoints): Define. (tic6x_get_pc): Turn into... (tic6x_target::low_get_pc): ...this. (tic6x_set_pc): Turn into... (tic6x_target::low_set_pc): ...this. (the_low_target): Remove the op fields.
2020-04-02 15:11:24 +02:00
/* Return true if breakpoints are supported. Such targets must
implement the GET_PC and SET_PC methods. */
virtual bool low_supports_breakpoints ();
virtual CORE_ADDR low_get_pc (regcache *regcache);
virtual void low_set_pc (regcache *regcache, CORE_ADDR newpc);
gdbserver/linux-low: turn 'supports_software_single_step' and 'get_next_pcs' into methods gdbserver/ChangeLog: 2020-04-02 Tankut Baris Aktemur <tankut.baris.aktemur@intel.com> Remove the 'supports_software_single_step' linux target op and let the concrete linux target define it by overriding the op in process_stratum_target. Turn the 'get_next_pcs' linux target op into a method of linux_process_target. * linux-low.h (struct linux_target_ops): Remove the ops. (class linux_process_target) <supports_software_single_step>: Remove. <low_get_next_pcs>: Declare. * linux-low.cc (can_software_single_step): Remove. (linux_process_target::low_get_next_pcs): Define. (linux_process_target::supports_software_single_step): Remove. Update the callers below. (linux_process_target::handle_extended_wait) (linux_process_target::wait_1) (linux_process_target::install_software_single_step_breakpoints) (linux_process_target::single_step) (linux_process_target::thread_needs_step_over) (linux_process_target::proceed_one_lwp) (linux_process_target::supports_range_stepping) * linux-x86-low.cc (the_low_target): Remove the op field. * linux-aarch64-low.cc (the_low_target): Ditto. * linux-bfin-low.cc (the_low_target): Ditto. * linux-cris-low.cc (the_low_target): Ditto. * linux-crisv32-low.cc (the_low_target): Ditto. * linux-m32r-low.cc (the_low_target): Ditto. * linux-m68k-low.cc (the_low_target): Ditto. * linux-mips-low.cc (the_low_target): Ditto. * linux-nios2-low.cc (the_low_target): Ditto. * linux-ppc-low.cc (the_low_target): Ditto. * linux-riscv-low.cc (the_low_target): Ditto. * linux-s390-low.cc (the_low_target): Ditto. * linux-sh-low.cc (the_low_target): Ditto. * linux-sparc-low.cc (the_low_target): Ditto. * linux-tic6x-low.cc (the_low_target): Ditto. * linux-tile-low.cc (the_low_target): Ditto. * linux-xtensa-low.cc (the_low_target): Ditto. * linux-arm-low.cc (class arm_target) <low_get_next_pcs> <supports_software_single_step>: Declare. (arm_target::supports_software_single_step): Define. (arm_gdbserver_get_next_pcs): Turn into... (arm_target::low_get_next_pcs): ...this. (the_low_target): Remove the op field.
2020-04-02 15:11:26 +02:00
/* Find the next possible PCs after the current instruction executes.
Targets that override this method should also override
'supports_software_single_step' to return true. */
virtual std::vector<CORE_ADDR> low_get_next_pcs (regcache *regcache);
gdbserver/linux-low: turn the 'decr_pc_after_break' field into a method gdbserver/ChangeLog: 2020-04-02 Tankut Baris Aktemur <tankut.baris.aktemur@intel.com> Turn the 'decr_pc_after_break' linux_target_ops field into a method of linux_process_target. * linux-low.h (struct linux_target_ops) <decr_pc_after_break>: Remove. (class linux_process_target) <low_decr_pc_after_break>: New method declaration. * linux-low.cc (linux_process_target::low_decr_pc_after_break): New method implementation. Update the users below. (linux_process_target::save_stop_reason) (linux_process_target::wait_1) * linux-x86-low.cc (class x86_target) <low_decr_pc_after_break>: New declaration. (x86_target::low_decr_pc_after_break): New method implementation. (the_low_target): Remove the field. * linux-bfin-low.cc (class bfin_target) <low_decr_pc_after_break>: New declaration. (bfin_target::low_decr_pc_after_break): New method implementation. (the_low_target): Remove the field. * linux-m68k-low.cc (class m68k_target) <low_decr_pc_after_break>: New declaration. (m68k_target::low_decr_pc_after_break): New method implementation. (the_low_target): Remove the field. * linux-s390-low.cc (class s390_target) <low_decr_pc_after_break>: New declaration. (s390_target::low_decr_pc_after_break): New method implementation. (the_low_target): Remove the field. * linux-aarch64-low.cc (the_low_target): Remove the field. * linux-arm-low.cc (the_low_target): Remove the field. * linux-cris-low.cc (the_low_target): Remove the field. * linux-crisv32-low.cc (the_low_target): Remove the field. * linux-m32r-low.cc (the_low_target): Remove the field. * linux-mips-low.cc (the_low_target): Remove the field. * linux-nios2-low.cc (the_low_target): Remove the field. * linux-ppc-low.cc (the_low_target): Remove the field. * linux-riscv-low.cc (the_low_target): Remove the field. * linux-sh-low.cc (the_low_target): Remove the field. * linux-sparc-low.cc (the_low_target): Remove the field. * linux-tic6x-low.cc (the_low_target): Remove the field. * linux-tile-low.cc (the_low_target): Remove the field. * linux-xtensa-low.cc (the_low_target): Remove the field.
2020-04-02 15:11:26 +02:00
gdbserver/linux-low: turn 'breakpoint_at' into a method gdbserver/ChangeLog: 2020-04-02 Tankut Baris Aktemur <tankut.baris.aktemur@intel.com> Turn the 'breakpoint_at' linux target op into a method of linux_process_target. * linux-low.h (struct linux_target_ops): Remove the op. (class linux_process_target) <low_breakpoint_at>: Declare. Update the callers below: * linux-low.cc (linux_process_target::save_stop_reason) (linux_process_target::thread_still_has_status_pending) (linux_process_target::wait_1) * linux-x86-low.cc (class x86_target) <low_breakpoint_at>: Declare. (x86_breakpoint_at): Turn into... (x86_target::low_breakpoint_at): ...this. (the_low_target): Remove the op field. * linux-aarch64-low.cc (class aarch64_target) <low_breakpoint_at>: Declare. (aarch64_breakpoint_at): Turn into... (aarch64_target::low_breakpoint_at): ...this. (the_low_target): Remove the op field. * linux-arm-low.cc (class arm_target) <low_breakpoint_at>: Declare. (arm_target::low_breakpoint_at): Define. (the_low_target): Remove the op field. * linux-bfin-low.cc (class bfin_target) <low_breakpoint_at>: Declare. (bfin_breakpoint_at): Turn into... (bfin_target::low_breakpoint_at): ...this. (the_low_target): Remove the op field. * linux-cris-low.cc (class cris_target) <low_breakpoint_at>: Declare. (cris_breakpoint_at): Turn into... (cris_target::low_breakpoint_at): ...this. (the_low_target): Remove the op field. * linux-crisv32-low.cc (class crisv32_target) <low_breakpoint_at>: Declare. (crisv32_breakpoint_at): Turn into... (crisv32_target::low_breakpoint_at): ...this. (the_low_target): Remove the op field. * linux-ia64-low.cc (class ia64_target) <low_breakpoint_at>: Declare. (ia64_target::low_breakpoint_at): Define. * linux-m32r-low.cc (class m32r_target) <low_breakpoint_at>: Declare. (m32r_breakpoint_at): Turn into... (m32r_target::low_breakpoint_at): ...this. (the_low_target): Remove the op field. * linux-m68k-low.cc (class m68k_target) <low_breakpoint_at>: Declare. (m68k_breakpoint_at): Turn into... (m68k_target::low_breakpoint_at): ...this. (the_low_target): Remove the op field. * linux-mips-low.cc (class mips_target) <low_breakpoint_at>: Declare. (mips_breakpoint_at): Turn into... (mips_target::low_breakpoint_at): ...this. (the_low_target): Remove the op field. * linux-nios2-low.cc (class nios2_target) <low_breakpoint_at>: Declare. (nios2_breakpoint_at): Turn into... (nios2_target::low_breakpoint_at): ...this. (the_low_target): Remove the op field. * linux-ppc-low.cc (class ppc_target) <low_breakpoint_at>: Declare. (ppc_breakpoint_at): Turn into... (ppc_target::low_breakpoint_at): ...this. (the_low_target): Remove the op field. * linux-riscv-low.cc (class riscv_target) <low_breakpoint_at>: Declare. (riscv_breakpoint_at): Turn into... (riscv_target::low_breakpoint_at): ...this. (the_low_target): Remove the op field. * linux-s390-low.cc (class s390_target) <low_breakpoint_at>: Declare. (s390_breakpoint_at): Turn into... (s390_target::low_breakpoint_at): ...this. (the_low_target): Remove the op field. * linux-sh-low.cc (class sh_target) <low_breakpoint_at>: Declare. (sh_breakpoint_at): Turn into... (sh_target::low_breakpoint_at): ...this. (the_low_target): Remove the op field. * linux-sparc-low.cc (class sparc_target) <low_breakpoint_at>: Declare. (sparc_breakpoint_at): Turn into... (sparc_target::low_breakpoint_at): ...this. (the_low_target): Remove the op field. * linux-tic6x-low.cc (class tic6x_target) <low_breakpoint_at>: Declare. (tic6x_breakpoint_at): Turn into... (tic6x_target::low_breakpoint_at): ...this. (the_low_target): Remove the op field. * linux-tile-low.cc (class tile_target) <low_breakpoint_at>: Declare. (tile_breakpoint_at): Turn into... (tile_target::low_breakpoint_at): ...this. (the_low_target): Remove the op field. * linux-xtensa-low.cc (class xtensa_target) <low_breakpoint_at>: Declare. (xtensa_breakpoint_at): Turn into... (xtensa_target::low_breakpoint_at): ...this. (the_low_target): Remove the op field.
2020-04-02 15:11:26 +02:00
/* Return true if there is a breakpoint at PC. */
virtual bool low_breakpoint_at (CORE_ADDR pc) = 0;
gdbserver/linux-low: turn 'insert_point' and 'remove_point' into methods gdbserver/ChangeLog: 2020-04-02 Tankut Baris Aktemur <tankut.baris.aktemur@intel.com> Turn the 'insert_point' and 'remove_point' linux target ops into methods of linux_process_target. * linux-low.h (struct linux_target_ops): Remove the ops. (class linux_process_target) <low_insert_point> <low_remove_point>: Declare. * linux-low.cc (linux_process_target::low_insert_point) (linux_process_target::low_remove_point): Define. (linux_process_target::insert_point) (linux_process_target::remove_point): Update for calls to low_insert_point and low_remove_point. * linux-x86-low.cc (class x86_target) <low_insert_point> <low_remove_point>: Declare. (x86_insert_point): Turn into... (x86_target::low_insert_point): ...this. (x86_remove_point): Turn into... (x86_target::low_remove_point): ...this. (the_low_target): Remove the op fields. * linux-aarch64-low.cc (class aarch64_target) <low_insert_point> <low_remove_point>: Declare. (aarch64_insert_point): Turn into... (aarch64_target::low_insert_point): ...this. (aarch64_remove_point): Turn into... (aarch64_target::low_remove_point): ...this. (the_low_target): Remove the op fields. * linux-arm-low.cc (class arm_target) <low_insert_point> <low_remove_point>: Declare. (arm_insert_point): Turn into... (arm_target::low_insert_point): ...this. (arm_remove_point): Turn into... (arm_target::low_remove_point): ...this. (the_low_target): Remove the op fields. * linux-crisv32-low.cc (class crisv32_target) <low_insert_point> <low_remove_point>: Declare. (crisv32_insert_point): Turn into... (crisv32_target::low_insert_point): ...this. (crisv32_remove_point): Turn into... (crisv32_target::low_remove_point): ...this. (the_low_target): Remove the op fields. * linux-mips-low.cc (class mips_target) <low_insert_point> <low_remove_point>: Declare. (mips_insert_point): Turn into... (mips_target::low_insert_point): ...this. (mips_remove_point): Turn into... (mips_target::low_remove_point): ...this. (the_low_target): Remove the op fields. * linux-ppc-low.cc (class ppc_target) <low_insert_point> <low_remove_point>: Declare. (ppc_insert_point): Turn into... (ppc_target::low_insert_point): ...this. (ppc_remove_point): Turn into... (ppc_target::low_remove_point): ...this. (the_low_target): Remove the op fields. * linux-bfin-low.cc (the_low_target): Remove the op fields. * linux-m32r-low.cc (the_low_target): Ditto. * linux-m68k-low.cc (the_low_target): Ditto. * linux-s390-low.cc (the_low_target): Ditto. * linux-sh-low.cc (the_low_target): Ditto. * linux-sparc-low.cc (the_low_target): Ditto. * linux-tic6x-low.cc (the_low_target): Ditto. * linux-tile-low.cc (the_low_target): Ditto. * linux-xtensa-low.cc (the_low_target): Ditto.
2020-04-02 15:11:27 +02:00
/* Breakpoint and watchpoint related functions. See target.h for
comments. */
virtual int low_insert_point (raw_bkpt_type type, CORE_ADDR addr,
int size, raw_breakpoint *bp);
virtual int low_remove_point (raw_bkpt_type type, CORE_ADDR addr,
int size, raw_breakpoint *bp);
gdbserver/linux-low: turn watchpoint ops into methods gdbserver/ChangeLog: 2020-04-02 Tankut Baris Aktemur <tankut.baris.aktemur@intel.com> Turn the 'stopped_by_watchpoint' and 'stopped_data_address' linux target ops into methods of linux_process_target. * linux-low.h (struct linux_target_ops): Remove the ops. (class linux_process_target) <check_stopped_by_watchpoint> <low_stopped_by_watchpoint> <low_stopped_data_address>: Declare. * linux-low.cc (check_stopped_by_watchpoint): Turn into... (linux_process_target::check_stopped_by_watchpoint): ...this. (linux_process_target::low_stopped_by_watchpoint): Define. (linux_process_target::low_stopped_data_address): Define. * linux-x86-low.cc (class x86_target) <low_stopped_by_watchpoint> <low_stopped_data_address>: Declare. (x86_stopped_by_watchpoint): Turn into... (x86_target::low_stopped_by_watchpoint): ...this. (x86_stopped_data_address): Turn into... (x86_target::low_stopped_data_address): ...this. (the_low_target): Remove the op fields. * linux-aarch64-low.cc (class aarch64_target) <low_stopped_by_watchpoint> <low_stopped_data_address>: Declare. (aarch64_stopped_by_watchpoint): Turn into... (aarch64_target::low_stopped_by_watchpoint): ...this. (aarch64_stopped_data_address): Turn into... (aarch64_target::low_stopped_data_address): ...this. (the_low_target): Remove the op fields. * linux-arm-low.cc (class arm_target) <low_stopped_by_watchpoint> <low_stopped_data_address>: Declare. (arm_stopped_by_watchpoint): Turn into... (arm_target::low_stopped_by_watchpoint): ...this. (arm_stopped_data_address): Turn into... (arm_target::low_stopped_data_address): ...this. (the_low_target): Remove the op fields. * linux-crisv32-low.cc (class crisv32_target) <low_stopped_by_watchpoint> <low_stopped_data_address>: Declare. (cris_stopped_by_watchpoint): Turn into... (crisv32_target::low_stopped_by_watchpoint): ...this. (cris_stopped_data_address): Turn into... (crisv32_target::low_stopped_data_address): ...this. (the_low_target): Remove the op fields. * linux-mips-low.cc (class mips_target) <low_stopped_by_watchpoint> <low_stopped_data_address>: Declare. (mips_stopped_by_watchpoint): Turn into... (mips_target::low_stopped_by_watchpoint): ...this. (mips_stopped_data_address): Turn into... (mips_target::low_stopped_data_address): ...this. (the_low_target): Remove the op fields. * linux-bfin-low.cc (the_low_target): Remove the op fields. * linux-m32r-low.cc (the_low_target): Ditto. * linux-m68k-low.cc (the_low_target): Ditto. * linux-ppc-low.cc (the_low_target): Ditto. * linux-s390-low.cc (the_low_target): Ditto. * linux-sh-low.cc (the_low_target): Ditto. * linux-sparc-low.cc (the_low_target): Ditto. * linux-tic6x-low.cc (the_low_target): Ditto. * linux-tile-low.cc (the_low_target): Ditto. * linux-xtensa-low.cc (the_low_target): Ditto.
2020-04-02 15:11:27 +02:00
virtual bool low_stopped_by_watchpoint ();
virtual CORE_ADDR low_stopped_data_address ();
gdbserver/linux-low: turn '{collect, supply}_ptrace_register' into methods gdbserver/ChangeLog: 2020-04-02 Tankut Baris Aktemur <tankut.baris.aktemur@intel.com> Turn the 'collect_ptrace_register' and 'supply_ptrace_register' linux target ops into methods of linux_process_target. * linux-low.h (struct linux_target_ops): Remove the ops. (class linux_process_target) <low_collect_ptrace_register> <low_store_ptrace_register>: Declare. * linux-low.cc (linux_process_target::low_collect_ptrace_register) (linux_process_target::low_supply_ptrace_register): Define. Update the callers below. (linux_process_target::fetch_register) (linux_process_target::store_register) * linux-x86-low.cc (the_low_target): Remove the op fields. * linux-aarch64-low.cc (the_low_target): Ditto. * linux-arm-low.cc (the_low_target): Ditto. * linux-bfin-low.cc (the_low_target): Ditto. * linux-crisv32-low.cc (the_low_target): Ditto. * linux-m32r-low.cc (the_low_target): Ditto. * linux-m68k-low.cc (the_low_target): Ditto. * linux-sh-low.cc (the_low_target): Ditto. * linux-sparc-low.cc (the_low_target): Ditto. * linux-tic6x-low.cc (the_low_target): Ditto. * linux-tile-low.cc (the_low_target): Ditto. * linux-xtensa-low.cc (the_low_target): Ditto. * linux-mips-low.cc (class mips_target) <low_collect_ptrace_register> <low_supply_ptrace_register>: Declare. (mips_collect_ptrace_register): Turn into ... (mips_target::low_collect_ptrace_register): ...this. (mips_supply_ptrace_register): Turn into... (mips_target::low_supply_ptrace_register): ...this. (the_low_target): Remove the op fields. * linux-ppc-low.cc (class ppc_target) <low_collect_ptrace_register> <low_supply_ptrace_register>: Declare. (ppc_collect_ptrace_register): Turn into ... (ppc_target::low_collect_ptrace_register): ...this. (ppc_supply_ptrace_register): Turn into ... (ppc_target::low_supply_ptrace_register): ...this. (ppc_fill_gregset): Update for the calls to low_collect_ptrace_register. (the_low_target): Remove the op fields. * linux-s390-low.cc (class s390_target) <low_collect_ptrace_register> <low_supply_ptrace_register>: Declare. (s390_collect_ptrace_register): Turn into ... (s390_target::low_collect_ptrace_register): ...this. (s390_supply_ptrace_register): Turn into ... (s390_target::low_supply_ptrace_register): ...this. (s390_fill_gregset): Update for the calls to low_collect_ptrace_register. (the_low_target): Remove the op fields.
2020-04-02 15:11:28 +02:00
/* Hooks to reformat register data for PEEKUSR/POKEUSR (in particular
for registers smaller than an xfer unit). */
virtual void low_collect_ptrace_register (regcache *regcache, int regno,
char *buf);
virtual void low_supply_ptrace_register (regcache *regcache, int regno,
const char *buf);
/* Hook to convert from target format to ptrace format and back.
Returns true if any conversion was done; false otherwise.
If DIRECTION is 1, then copy from INF to NATIVE.
If DIRECTION is 0, copy from NATIVE to INF. */
virtual bool low_siginfo_fixup (siginfo_t *native, gdb_byte *inf,
int direction);
gdbserver/linux-low: turn process/thread addition/deletion ops into methods gdbserver/ChangeLog: 2020-04-02 Tankut Baris Aktemur <tankut.baris.aktemur@intel.com> Turn the 'new_process', 'delete_process', 'new_thread', 'delete_thread', and 'new_fork' linux target ops into methods of linux_process_target. * linux-low.h (struct linux_target_ops): Remove the ops. (class linux_process_target) <add_linux_process> <add_lwp> <delete_lwp> <attach_lwp> <detach_one_lwp> <check_zombie_leaders> <filter_exit_event> <low_new_process> <low_delete_process> <low_new_thread> <low_delete_thread> <low_new_fork>: Declare. * linux-low.cc (delete_lwp): Turn into... (linux_process_target::delete_lwp): ...this. (linux_process_target::low_delete_thread): Define. (linux_add_process): Turn into... (linux_process_target::add_linux_process): ...this. (linux_process_target::low_new_process): Define. (linux_process_target::low_delete_process): Define. (linux_process_target::low_new_fork): Define. (add_lwp): Turn into... (linux_process_target::add_lwp): ...this. (linux_process_target::low_new_thread): Define. (linux_attach_lwp): Turn into... (linux_process_target::attach_lwp): ...this. (linux_detach_one_lwp): Turn into... (linux_process_target::detach_one_lwp): ...this. (linux_detach_lwp_callback): Remove and inline... (linux_process_target::detach): ...here. (check_zombie_leaders): Turn into... (linux_process_target::check_zombie_leaders): ...this. (filter_exit_event): Turn into... (linux_process_target::filter_exit_event): ...this. Update the callers below. (linux_process_target::handle_extended_wait) (linux_process_target::create_inferior) (attach_proc_task_lwp_callback) (linux_process_target::attach) (linux_process_target::detach) (linux_process_target::mourn) * thread-db.cc (attach_thread) * linux-x86-low.cc (class x86_target) <low_new_process> <low_delete_process> <low_new_thread> <low_delete_thread> <low_new_fork>: Declare. (x86_linux_new_process): Turn into... (x86_target::low_new_process): ...this. (x86_linux_delete_process): Turn into... (x86_target::low_delete_process): ...this. (x86_target::low_new_thread): Define. (x86_target::low_delete_thread): Define. (x86_linux_new_fork): Turn into... (x86_target::low_new_fork): ...this. (the_low_target): Remove the op fields. * linux-aarch64-low.cc (class aarch64_target) <low_new_process> <low_delete_process> <low_new_thread> <low_delete_thread> <low_new_fork>: Declare. (aarch64_linux_new_process): Turn into... (aarch64_target::low_new_process): ...this. (aarch64_linux_delete_process): Turn into... (aarch64_target::low_delete_process): ...this. (aarch64_target::low_new_thread): Define. (aarch64_target::low_delete_thread): Define. (aarch64_linux_new_fork): Turn into... (aarch64_target::low_new_fork): ...this. (the_low_target): Remove the op fields. * linux-arm-low.cc (class arm_target) <low_new_process> <low_delete_process> <low_new_thread> <low_delete_thread> <low_new_fork>: Declare. (arm_new_process): Turn into... (arm_target::low_new_process): ...this. (arm_delete_process): Turn into... (arm_target::low_delete_process): ...this. (arm_new_thread): Turn into... (arm_target::low_new_thread): ...this. (arm_delete_thread): Turn into... (arm_target::low_delete_thread): ...this. (arm_new_fork): Turn into... (arm_target::low_new_fork): ...this. (the_low_target): Remove the op fields. * linux-mips-low.cc (class mips_target) <low_new_process> <low_delete_process> <low_new_thread> <low_delete_thread> <low_new_fork>: Declare. (mips_linux_new_process): Turn into... (mips_target::low_new_process): ...this. (mips_linux_delete_process): Turn into... (mips_target::low_delete_process): ...this. (mips_linux_new_thread): Turn into... (mips_target::low_new_thread): ...this. (mips_linux_delete_thread): Turn into... (mips_target::low_delete_thread): ...this. (mips_linux_new_fork): Turn into... (mips_target::low_new_fork): ...this. (the_low_target): Remove the op fields. * linux-bfin-low.cc (the_low_target): Remove the op fields. * linux-crisv32-low.cc (the_low_target): Ditto. * linux-m32r-low.cc (the_low_target): Ditto. * linux-m68k-low.cc (the_low_target): Ditto. * linux-ppc-low.cc (the_low_target): Ditto. * linux-s390-low.cc (the_low_target): Ditto. * linux-sh-low.cc (the_low_target): Ditto. * linux-tic6x-low.cc (the_low_target): Ditto. * linux-tile-low.cc (the_low_target): Ditto. * linux-xtensa-low.cc (the_low_target): Ditto.
2020-04-02 15:11:28 +02:00
/* Hook to call when a new process is created or attached to.
If extra per-process architecture-specific data is needed,
allocate it here. */
virtual arch_process_info *low_new_process ();
/* Hook to call when a process is being deleted. If extra per-process
architecture-specific data is needed, delete it here. */
virtual void low_delete_process (arch_process_info *info);
/* Hook to call when a new thread is detected.
If extra per-thread architecture-specific data is needed,
allocate it here. */
virtual void low_new_thread (lwp_info *);
/* Hook to call when a thread is being deleted. If extra per-thread
architecture-specific data is needed, delete it here. */
virtual void low_delete_thread (arch_lwp_info *);
/* Hook to call, if any, when a new fork is attached. */
virtual void low_new_fork (process_info *parent, process_info *child);
gdbserver/linux-low: turn 'prepare_to_resume' into a method gdbserver/ChangeLog: 2020-04-02 Tankut Baris Aktemur <tankut.baris.aktemur@intel.com> Turn the 'prepare_to_resume' linux target op into a method of linux_process_target. * linux-low.h (struct linux_target_ops): Remove the op. (class linux_process_target) <low_prepare_to_resume>: Declare. * linux-low.cc (linux_process_target::low_prepare_to_resume): Define. Update the callers below: (linux_process_target::resume_one_lwp_throw) (linux_process_target::low_prepare_to_resume) * linux-x86-low.cc (class x86_target) <low_prepare_to_resume>: Declare. (x86_target::low_prepare_to_resume): Define. (the_low_target): Remove the op field. * linux-aarch64-low.cc (class aarch64_target) <low_prepare_to_resume>: Declare. (aarch64_target::low_prepare_to_resume): Define. (the_low_target): Remove the op field. * linux-arm-low.cc (class arm_target) <low_prepare_to_resume>: Declare. (arm_prepare_to_resume): Turn into... (arm_target::low_prepare_to_resume): ...this. (the_low_target): Remove the op field. * linux-mips-low.cc (class mips_target) <low_prepare_to_resume>: Declare. (mips_linux_prepare_to_resume): Turn into... (mips_target::low_prepare_to_resume): ...this. (the_low_target): Remove the op field. * linux-bfin-low.cc (the_low_target): Remove the op field. * linux-crisv32-low.cc (the_low_target): Ditto. * linux-m32r-low.cc (the_low_target): Ditto. * linux-m68k-low.cc (the_low_target): Ditto. * linux-ppc-low.cc (the_low_target): Ditto. * linux-s390-low.cc (the_low_target): Ditto. * linux-sh-low.cc (the_low_target): Ditto. * linux-tic6x-low.cc (the_low_target): Ditto. * linux-tile-low.cc (the_low_target): Ditto. * linux-xtensa-low.cc (the_low_target): Ditto.
2020-04-02 15:11:29 +02:00
/* Hook to call prior to resuming a thread. */
virtual void low_prepare_to_resume (lwp_info *lwp);
gdbserver/linux-low: turn 'get_thread_area' into a method gdbserver/ChangeLog: 2020-04-02 Tankut Baris Aktemur <tankut.baris.aktemur@intel.com> Turn the 'get_thread_area' linux target op into a method of process_stratum_target. * linux-low.h (struct linux_target_ops): Remove the op. (class linux_process_target) <stuck_in_jump_pad> <linux_fast_tracepoint_collecting> <low_get_thread_area>: Declare. * linux-low.cc (supports_fast_tracepoints): Remove. (linux_fast_tracepoint_collecting): Turn into... (linux_process_target::linux_fast_tracepoint_collecting): ...this. (linux_process_target::low_get_thread_area): Define. (stuck_in_jump_pad_callback): Turn into... (linux_process_target::stuck_in_jump_pad): ...this. Update the caller below. (linux_process_target::stabilize_threads) * linux-x86-low.cc (class x86_target) <low_get_thread_area>: Declare. (x86_get_thread_area): Turn into... (x86_target::low_get_thread_area): ...this. (the_low_target): Remove the op field. * linux-aarch64-low.cc (class aarch64_target) <low_get_thread_area>: Declare. (aarch64_get_thread_area): Turn into... (aarch64_target::low_get_thread_area): ...this. (the_low_target): Remove the op field. * linux-ppc-low.cc (class ppc_target) <low_get_thread_area>: Declare. (ppc_get_thread_area): Turn into... (ppc_target::low_get_thread_area): ...this. (the_low_target): Remove the op field. * linux-s390-low.cc (class s390_target) <low_get_thread_area>: Declare. (s390_get_thread_area): Turn into... (s390_target::low_get_thread_area): ...this. (the_low_target): Remove the op field. * linux-arm-low.cc (the_low_target): Remove the op field. * linux-bfin-low.cc (the_low_target): Ditto. * linux-crisv32-low.cc (the_low_target): Ditto. * linux-m32r-low.cc (the_low_target): Ditto. * linux-m68k-low.cc (the_low_target): Ditto. * linux-sh-low.cc (the_low_target): Ditto. * linux-tic6x-low.cc (the_low_target): Ditto. * linux-tile-low.cc (the_low_target): Ditto. * linux-xtensa-low.cc (the_low_target): Ditto.
2020-04-02 15:11:30 +02:00
/* Fill ADDRP with the thread area address of LWPID. Returns 0 on
success, -1 on failure. */
virtual int low_get_thread_area (int lwpid, CORE_ADDR *addrp);
/* Returns true if the low target supports range stepping. */
virtual bool low_supports_range_stepping ();
gdbserver/linux-low: turn 'get_syscall_trapinfo' into a method gdbserver/ChangeLog: 2020-04-02 Tankut Baris Aktemur <tankut.baris.aktemur@intel.com> Turn the 'get_syscall_trapinfo' linux target op into a method of process_stratum_target. * linux-low.h (struct linux_target_ops): Remove the op. (class linux_process_target) <get_syscall_trapinfo> <gdb_catch_this_syscall> <low_supports_catch_syscall> <low_get_syscall_trapinfo>: Declare. * linux-low.cc (get_syscall_trapinfo): Turn into... (linux_process_target::get_syscall_trapinfo): ...this. (linux_process_target::low_get_syscall_trapinfo): Define. (gdb_catch_this_syscall_p): Turn into... (linux_process_target::gdb_catch_this_syscall): ...this. (linux_process_target::low_supports_catch_syscall): Define. Update the callers below. (linux_process_target::wait_1) (linux_process_target::supports_catch_syscall) * linux-x86-low.cc (class x86_target) <low_supports_catch_syscall> <low_get_syscall_trapinfo>: Declare. (x86_target::low_supports_catch_syscall): Define. (x86_get_syscall_trapinfo): Turn into... (x86_target::low_get_syscall_trapinfo): ...this. (the_low_target): Remove the op field. * linux-aarch64-low.cc (class aarch64_target) <low_supports_catch_syscall> <low_get_syscall_trapinfo>: Declare. (aarch64_target::low_supports_catch_syscall): Define. (aarch64_get_syscall_trapinfo): Turn into... (aarch64_target::low_get_syscall_trapinfo): ...this. (the_low_target): Remove the op field. * linux-arm-low.cc (class arm_target) <low_supports_catch_syscall> <low_get_syscall_trapinfo>: Declare. (arm_target::low_supports_catch_syscall): Define. (arm_get_syscall_trapinfo): Turn into... (arm_target::low_get_syscall_trapinfo): ...this. (the_low_target): Remove the op field. * linux-ppc-low.cc (the_low_target): Remove the op field. * linux-s390-low.cc (the_low_target): Remove the op field.
2020-04-02 15:11:31 +02:00
/* Return true if the target supports catch syscall. Such targets
override the low_get_syscall_trapinfo method below. */
virtual bool low_supports_catch_syscall ();
/* Fill *SYSNO with the syscall nr trapped. Only to be called when
inferior is stopped due to SYSCALL_SIGTRAP. */
virtual void low_get_syscall_trapinfo (regcache *regcache, int *sysno);
gdbserver/linux-low: turn the 'decr_pc_after_break' field into a method gdbserver/ChangeLog: 2020-04-02 Tankut Baris Aktemur <tankut.baris.aktemur@intel.com> Turn the 'decr_pc_after_break' linux_target_ops field into a method of linux_process_target. * linux-low.h (struct linux_target_ops) <decr_pc_after_break>: Remove. (class linux_process_target) <low_decr_pc_after_break>: New method declaration. * linux-low.cc (linux_process_target::low_decr_pc_after_break): New method implementation. Update the users below. (linux_process_target::save_stop_reason) (linux_process_target::wait_1) * linux-x86-low.cc (class x86_target) <low_decr_pc_after_break>: New declaration. (x86_target::low_decr_pc_after_break): New method implementation. (the_low_target): Remove the field. * linux-bfin-low.cc (class bfin_target) <low_decr_pc_after_break>: New declaration. (bfin_target::low_decr_pc_after_break): New method implementation. (the_low_target): Remove the field. * linux-m68k-low.cc (class m68k_target) <low_decr_pc_after_break>: New declaration. (m68k_target::low_decr_pc_after_break): New method implementation. (the_low_target): Remove the field. * linux-s390-low.cc (class s390_target) <low_decr_pc_after_break>: New declaration. (s390_target::low_decr_pc_after_break): New method implementation. (the_low_target): Remove the field. * linux-aarch64-low.cc (the_low_target): Remove the field. * linux-arm-low.cc (the_low_target): Remove the field. * linux-cris-low.cc (the_low_target): Remove the field. * linux-crisv32-low.cc (the_low_target): Remove the field. * linux-m32r-low.cc (the_low_target): Remove the field. * linux-mips-low.cc (the_low_target): Remove the field. * linux-nios2-low.cc (the_low_target): Remove the field. * linux-ppc-low.cc (the_low_target): Remove the field. * linux-riscv-low.cc (the_low_target): Remove the field. * linux-sh-low.cc (the_low_target): Remove the field. * linux-sparc-low.cc (the_low_target): Remove the field. * linux-tic6x-low.cc (the_low_target): Remove the field. * linux-tile-low.cc (the_low_target): Remove the field. * linux-xtensa-low.cc (the_low_target): Remove the field.
2020-04-02 15:11:26 +02:00
/* How many bytes the PC should be decremented after a break. */
virtual int low_decr_pc_after_break ();
gdbserver: start turning the target ops vector into a class This is the beginning of a series of patches where the goal is to turn the target ops vector into a class and all the target op function pointers into methods of this class. Currently, the target ops is a struct of function pointers. At the end of the series, it becomes a class with methods, and the existing low target definitions become subclasses. That is, we end up with the following class hierarchy: process_stratum_target ^ |-- linux-low |-- lynx-low |-- nto-low |-- win32-low process_stratum_target either defines the default behavior for the target ops or leaves them as pure virtual for the subclasses to override. The transformation is done by first introducing a helper class, called 'process_target', that is initially empty. An instance of this class is added to the end of the current target ops vector. This new field is called 'pt'. We will gradually carry target ops to the new class, one by one, whereas the invocation of the target op will be converted to a method call on 'pt'. For instance, target op 'attach' is currently invoked as (*the_target->attach) (args) After moving 'attach' as a method to 'process_target', it will be invoked as the_target->pt->attach (args) In this process, the concrete target vector definitions (e.g. linux-low, win32-low, nto-low, etc.) are turned into derived classes of 'process_target', so that they can either inherit the default behavior of the target ops or can override the method. We prefer to make this transition gradually rather than in a single giant patch, to yield bite-size patches. The goal is that after each patch gdbserver will still be buildable and testable. The general rule of thumb when converting a target op to a method is this: (1) If the function call is protected with a NULL-check with an obvious default behavior, simply implement that default behavior in the base class (e.g.: supports_non_stop). (2) If there is no NULL-check guard, the method becomes pure virtual, and the derived targets are required to implement the method (e.g.: attach). (3) If there is a NULL-check but no apparent default behavior, or if the NULL-check is utilized to populate a feature support packet, introduce a 'supports_XYZ' method (e.g.: pid_to_exec_file). The overall strategy is to preserve the existing behavior as much as possible. When we're done moving all the target ops into 'process_target', the target op vector will contain nothing but the field 'pt'. At that point, the auxiliary class 'process_target' will simply meld into 'process_stratum_target' and the method calls of the form 'the_target->pt->xyz' will be turned into 'the_target->xyz'. The "linux-low" target has been built and reg-tested on X86_64 Linux (Ubuntu). The "win32-low" target has been built (but not tested) via cross-compilation to a x86_64-w64-mingw32 target. The "lynx-low" and "nto-low" targets were neither built nor tested. gdbserver/ChangeLog: 2020-02-20 Tankut Baris Aktemur <tankut.baris.aktemur@intel.com> * target.h (class process_target): New class definition. (struct process_stratum_target) <pt>: New field with type 'process_target*'. * linux-low.h (class linux_process_target): Define as a derived class of 'process_target'. * linux-low.cc (linux_target_ops): Add a linux_process_target* as the 'pt' field. * lynx-low.h (class lynx_process_target): Define as a derived class of 'process_target'. * lynx-low.cc (lynx_target_ops): Add a lynx_process_target* as the 'pt' field. * nto-low.h (class nto_process_target): Define as a derived class of 'process_target'. * nto-low.cc (nto_target_ops): Add an nto_process_target* as the 'pt' field. * win32-low.h (class win32_process_target): Define as a derived class of 'process_target'. * win32-low.cc (win32_target_ops): Add a win32_process_target* as the 'pt' field.
2020-02-17 16:11:50 +01:00
};
gdbserver/linux-low: start turning linux target ops into methods This is the beginning of a series of patches that convert the linux low targets into classes derived from linux_process_target. At the end of the series we obtain a class hierarchy that looks like this: process_stratum_target ^ | |-- linux_process_target ^ | |-- x86_target (defined in linux-x86-low) |-- aarch64_target (defined in linux-aarch64-low) |-- ppc_target (defined in linux-ppc-low) |-- ... In several cases, linux_process_target simply forwards a target op request to a corresponding linux_target_ops function. For these cases, the definition in linux_process_target will be removed and the definition will be left to the deriving linux low target class; using inheritance provides a nice and natural, object-oriented simplification in these cases. The series converts linux_target_ops into protected methods of linux_process_target one by one. Throughout the series, based on the needs, static functions defined in linux-low.cc are converted to private methods of linux_process_target as well. This is done either as separate patches or as integrated into a patch that convert a particular linux_target_op into a method. The series ends with the patch titled "gdbserver/linux-low: delete 'linux_target_ops' and 'the_low_target'". Built and regression-tested on x86_64-linux. The following linux low targets have been built (but not tested) via cross-compilation: aarch64, arm, m68k, mips, ppc, riscv, s390, sh, sparc. The other targets (bfin, cris, crisv32, ia64, m32r, nios2, tic6x, tile, xtensa) were neither built nor tested. gdbserver/ChangeLog: 2020-04-02 Tankut Baris Aktemur <tankut.baris.aktemur@intel.com> * linux-low.h (the_linux_target): New extern declaration. * linux-low.cc (initialize_low): Use 'the_linux_target' to set 'the_target'. (the_linux_target): Remove. * linux-x86-low.cc (class x86_target): New class. (the_x86_target): New static object. (the_linux_target): Define as pointer to the_x86_target. * linux-aarch64-low.cc (class aarch64_target): New class. (the_aarch64_target): New static object. (the_linux_target): Define as pointer to the_aarch64_target. * linux-arm-low.cc (class arm_target): New class. (the_arm_target): New static object. (the_linux_target): Define as pointer to the_arm_target. * linux-bfin-low.cc (class bfin_target): New class. (the_bfin_target): New static object. (the_linux_target): Define as pointer to the_bfin_target. * linux-cris-low.cc (class cris_target): New class. (the_cris_target): New static object. (the_linux_target): Define as pointer to the_cris_target. * linux-crisv32-low.cc (class crisv32_target): New class. (the_crisv32_target): New static object. (the_linux_target): Define as pointer to the_crisv32_target. * linux-ia64-low.cc (class ia64_target): New class. (the_ia64_target): New static object. (the_linux_target): Define as pointer to the_ia64_target. * linux-m32r-low.cc (class m32r_target): New class. (the_m32r_target): New static object. (the_linux_target): Define as pointer to the_m32r_target. * linux-m68k-low.cc (class m68k_target): New class. (the_m68k_target): New static object. (the_linux_target): Define as pointer to the_m68k_target. * linux-mips-low.cc (class mips_target): New class. (the_mips_target): New static object. (the_linux_target): Define as pointer to the_mips_target. * linux-nios2-low.cc (class nios2_target): New class. (the_nios2_target): New static object. (the_linux_target): Define as pointer to the_nios2_target. * linux-ppc-low.cc (class ppc_target): New class. (the_ppc_target): New static object. (the_linux_target): Define as pointer to the_ppc_target. * linux-riscv-low.cc (class riscv_target): New class. (the_riscv_target): New static object. (the_linux_target): Define as pointer to the_riscv_target. * linux-s390-low.cc (class s390_target): New class. (the_s390_target): New static object. (the_linux_target): Define as pointer to the_s390_target. * linux-sh-low.cc (class sh_target): New class. (the_sh_target): New static object. (the_linux_target): Define as pointer to the_sh_target. * linux-sparc-low.cc (class sparc_target): New class. (the_sparc_target): New static object. (the_linux_target): Define as pointer to the_sparc_target. * linux-tic6x-low.cc (class tic6x_target): New class. (the_tic6x_target): New static object. (the_linux_target): Define as pointer to the_tic6x_target. * linux-tile-low.cc (class tile_target): New class. (the_tile_target): New static object. (the_linux_target): Define as pointer to the_tile_target. * linux-xtensa-low.cc (class xtensa_target): New class. (the_xtensa_target): New static object. (the_linux_target): Define as pointer to the_xtensa_target.
2020-04-02 15:11:23 +02:00
extern linux_process_target *the_linux_target;
#define get_thread_lwp(thr) ((struct lwp_info *) (thread_target_data (thr)))
#define get_lwp_thread(lwp) ((lwp)->thread)
2002-06-11 Daniel Jacobowitz <drow@mvista.com> * gdbserver/thread-db.c: New file. * gdbserver/proc-service.c: New file. * gdbserver/acinclude.m4: New file. * gdbserver/Makefile.in: Add GDBSERVER_LIBS, gdb_proc_service_h, proc-service.o, and thread-db.o. (linux-low.o): Add USE_THREAD_DB. * gdbserver/acconfig.h: Add HAVE_PRGREGSET_T, HAVE_PRFPREGSET_T, HAVE_LWPID_T, HAVE_PSADDR_T, and PRFPREGSET_T_BROKEN. * gdbserver/aclocal.m4: Regenerated. * gdbserver/config.in: Regenerated. * gdbserver/configure: Regenerated. * gdbserver/configure.in: Check for proc_service.h, sys/procfs.h, thread_db.h, and linux/elf.h headrs. Check for lwpid_t, psaddr_t, prgregset_t, prfpregset_t, and PRFPREGSET_T_BROKEN. Introduce srv_thread_depfiles and USE_THREAD_DB. Check for -lthread_db and thread support. * gdbserver/configure.srv: Enable thread_db support for ARM, i386, MIPS, PowerPC, and SuperH. * gdbserver/i387-fp.c: Constify arguments. * gdbserver/i387-fp.h: Likewise. * gdbserver/inferiors.c: (struct thread_info): Renamed from `struct inferior_info'. Remove PID member. Use generic inferior list header. All uses updated. (inferiors, signal_pid): Removed. (all_threads): New variable. (get_thread): Define. (add_inferior_to_list): New function. (for_each_inferior): New function. (change_inferior_id): New function. (add_inferior): Removed. (remove_inferior): New function. (add_thread): New function. (free_one_thread): New function. (remove_thread): New function. (clear_inferiors): Use for_each_inferior and free_one_thread. (find_inferior): New function. (find_inferior_id): New function. (inferior_target_data): Update argument type. (set_inferior_target_data): Likewise. (inferior_regcache_data): Likewise. (set_inferior_regcache_data): Likewise. * gdbserver/linux-low.c (linux_bp_reinsert): Remove. (all_processes, stopping_threads, using_thrads) (struct pending_signals, debug_threads, pid_of): New. (inferior_pid): Replace with macro. (struct inferior_linux_data): Remove. (get_stop_pc, add_process): New functions. (linux_create_inferior): Restore SIGRTMIN+1 before calling exec. Use add_process and add_thread. (linux_attach_lwp): New function, based on old linux_attach. Use add_process and add_thread. Set stop_expected for new threads. (linux_attach): New function. (linux_kill_one_process): New function. (linux_kill): Kill all LWPs. (linux_thread_alive): Use find_inferior_id. (check_removed_breakpoints, status_pending_p): New functions. (linux_wait_for_process): Renamed from linux_wait_for_one_inferior. Update. Use WNOHANG. Wait for cloned processes also. Update process struct for the found process. (linux_wait_for_event): New function. (linux_wait): Use it. Support LWPs. (send_sigstop, wait_for_sigstop, stop_all_processes) (linux_resume_one_process, linux_continue_one_process): New functions. (linux_resume): Support LWPs. (REGISTER_RAW_SIZE): Remove. (fetch_register): Use register_size instead. Call supply_register. (usr_store_inferior_registers): Likewise. Call collect_register. Fix recursive case. (regsets_fetch_inferior_registers): Improve error message. (regsets_store_inferior_registers): Add debugging. (linux_look_up_symbols): Call thread_db_init if USE_THREAD_DB. (unstopped_p, linux_signal_pid): New functions. (linux_target_ops): Add linux_signal_pid. (linux_init_signals): New function. (initialize_low): Call it. Initialize using_threads. * gdbserver/regcache.c (inferior_regcache_data): Add valid flag. (get_regcache): Fetch registers lazily. Add fetch argument and update all callers. (regcache_invalidate_one, regcache_invalidate): New functions. (new_register_cache): Renamed from create_register_cache. Return the new regcache. (free_register_cache): Change argument to a void *. (registers_to_string, registers_from_string): Call get_regcache with fetch flag set. (register_data): Make static. Pass fetch flag to get_regcache. (supply_register): Call get_regcache with fetch flag clear. (collect_register): Call get_regcache with fetch flag set. (collect_register_as_string): New function. * gdbserver/regcache.h: Update. * gdbserver/remote-utils.c (putpkt): Flush after debug output and use stderr. Handle input interrupts while waiting for an ACK. (input_interrupt): Use signal_pid method. (getpkt): Flush after debug output and use stderr. (outreg): Use collect_register_as_string. (new_thread_notify, dead_thread_notify): New functions. (prepare_resume_reply): Check using_threads. Set thread_from_wait and general_thread. (look_up_one_symbol): Flush after debug output. * gdbserver/server.c (step_thread, server_waiting): New variables. (start_inferior): Don't use signal_pid. Update call to mywait. (attach_inferior): Update call to mywait. (handle_query): Handle qfThreadInfo and qsThreadInfo. (main): Don't fetch/store registers explicitly. Use set_desired_inferior. Support proposed ``Hs'' packet. Update calls to mywait. * gdbserver/server.h: Update. (struct inferior_list, struct_inferior_list_entry): New. * gdbserver/target.c (set_desired_inferior): New. (write_inferior_memory): Constify. (mywait): New function. * gdbserver/target.h: Update. (struct target_ops): New signal_pid method. (mywait): Removed macro, added prototype. * gdbserver/linux-low.h (regset_func): Removed. (regset_fill_func, regset_store_func): New. (enum regset_type): New. (struct regset_info): Add type field. Use new operation types. (struct linux_target_ops): stop_pc renamed to get_pc. Add decr_pc_after_break and breakpoint_at. (get_process, get_thread_proess, get_process_thread) (strut process_info, all_processes, linux_attach_lwp) (thread_db_init): New. * gdbserver/linux-arm-low.c (arm_get_pc, arm_set_pc, arm_breakpoint, arm_breakpoint_len, arm_breakpoint_at): New. (the_low_target): Add new members. * gdbserver/linux-i386-low.c (i386_store_gregset, i386_store_fpregset) (i386_store_fpxregset): Constify. (target_regsets): Add new kind identifier. (i386_get_pc): Renamed from i386_stop_pc. Simplify. (i386_set_pc): Add debugging. (i386_breakpoint_at): New function. (the_low_target): Add new members. * gdbserver/linux-mips-low.c (mips_get_pc, mips_set_pc) (mips_breakpoint, mips_breakpoint_len, mips_reinsert_addr) (mips_breakpoint_at): New. (the_low_target): Add new members. * gdbserver/linux-ppc-low.c (ppc_get_pc, ppc_set_pc) (ppc_breakpoint, ppc_breakpoint_len, ppc_breakpoint_at): New. (the_low_target): Add new members. * gdbserver/linux-sh-low.c (sh_get_pc, sh_set_pc) (sh_breakpoint, sh_breakpoint_len, sh_breakpoint_at): New. (the_low_target): Add new members. * gdbserver/linux-x86-64-low.c (target_regsets): Add new kind identifier.
2002-06-11 19:32:40 +02:00
gdbserver/linux-low: use std::list to store pending signals Use std::list to store pending signals instead of a manually-managed linked list. This is a refactoring. In the existing code, pending signals are kept in a manually-created linked list with "prev" pointers. A new pending signal is thus inserted to the beginning of the list. When consuming, GDB goes until the end of the list, following the "prev" pointers, and processes the final item. With this patch, a new item is added to the end of the list and the item at the front of the list is consumed. In other words, the list elements used to be stored in reverse order; with this patch, they are stored in their order of arrival. This causes a change in the debug messages that print the pending signals. Otherwise, no behavioral change is expected. gdbserver/ChangeLog: 2020-06-22 Tankut Baris Aktemur <tankut.baris.aktemur@intel.com> Use std::list to stop pending signal instead of manually-created linked list. * linux-low.h: Include <list>. (struct pending_signal): Move here from linux-low.cc. (struct lwp_info) <pending_signals> <pending_signals_to_report>: Update the type. * linux-low.cc (struct pending_signals): Remove. (linux_process_target::delete_lwp) (linux_process_target::add_lwp) (enqueue_one_deferred_signal) (dequeue_one_deferred_signal) (enqueue_pending_signal) (linux_process_target::resume_one_lwp_throw) (linux_process_target::thread_needs_step_over) (linux_process_target::resume_one_thread) (linux_process_target::proceed_one_lwp): Update the use of pending signal list.
2020-06-22 14:13:48 +02:00
/* Information about a signal that is to be delivered to a thread. */
struct pending_signal
{
pending_signal (int signal)
: signal {signal}
{};
int signal;
siginfo_t info;
};
Remove all_lwps global. * inferiors.h (ptid_of): Move here from linux-low.h. (pid_of, lwpid_of): Ditto. * linux-aarch64-low.c (debug_reg_change_callback): Update, "entry" parameter is a struct thread_info * now. (aarch64_notify_debug_reg_change): Fetch pid from current_inferior directly. Pass &all_threads to find_inferior instead of &all_lwps. (aarch64_stopped_data_address): Fetch lwpid from current_inferior directly. (aarch64_linux_prepare_to_resume): Fetch ptid from thread. (aarch64_arch_setup): Fetch lwpid from current_inferior directly. * linux-arm-low.c (update_registers_callback): Update, "entry" parameter is a struct thread_info * now. Fetch lwpid from current_inferior directly. (arm_insert_point): Pass &all_threads to find_inferior instead of &all_lwps. (arm_remove_point): Ditto. (arm_stopped_by_watchpoint): Fetch lwp from current_inferior. (arm_prepare_to_resume): Fetch pid from thread. (arm_read_description): Fetch lwpid from current_inferior directly. * linux-low.c (all_lwps): Delete. (delete_lwp): Delete call to remove_inferior. (handle_extended_wait): Fetch lwpid from thread. (add_lwp): Don't set lwp->entry.id. Remove call to add_inferior_to_list. (linux_attach_lwp_1): Fetch pid from current_inferior directly. (linux_kill_one_lwp): Fetch ptid,lwpid from thread. (kill_one_lwp_callback): Ditto. (linux_kill): Don't dereference NULL pointer. Fetch ptid,lwpid from thread. (get_detach_signal): Fetch ptid from thread. (linux_detach_one_lwp): Fetch ptid,lwpid from thread. Simplify call to regcache_invalidate_thread. (delete_lwp_callback): Update, "entry" parameter is a struct thread_info * now. Fetch pid from thread. (linux_mourn): Pass &all_threads to find_inferior instead of &all_lwps. (status_pending_p_callback): Update, "entry" parameter is a struct thread_info * now. Fetch ptid from thread. (find_lwp_pid): Update, "entry" parameter is a struct thread_info * now. (linux_wait_for_lwp): Fetch pid from thread. (linux_fast_tracepoint_collecting): Fetch lwpid from thread. (maybe_move_out_of_jump_pad): Fetch lwpid from current_inferior. (enqueue_one_deferred_signal): Fetch lwpid from thread. (dequeue_one_deferred_signal): Ditto. (cancel_breakpoint): Fetch ptid from current_inferior. (linux_wait_for_event): Pass &all_threads to find_inferior, not &all_lwps. Fetch ptid, lwpid from thread. (count_events_callback): Update, "entry" parameter is a struct thread_info * now. (select_singlestep_lwp_callback): Ditto. (select_event_lwp_callback): Ditto. (cancel_breakpoints_callback): Ditto. (linux_cancel_breakpoints): Pass &all_threads to find_inferior, not &all_lwps. (select_event_lwp): Ditto. Fetch ptid from event_thread. (unsuspend_one_lwp): Update, "entry" parameter is a struct thread_info * now. (unsuspend_all_lwps): Pass &all_threads to find_inferior, not &all_lwps. (linux_stabilize_threads): Ditto. And for for_each_inferior. Fetch lwpid from thread, not lwp. (linux_wait_1): Fetch ptid, lwpid from current_inferior. Pass &all_threads to find_inferior, not &all_lwps. (send_sigstop): Fetch lwpid from thread, not lwp. (send_sigstop_callback): Update, "entry" parameter is a struct thread_info * now. (suspend_and_send_sigstop_callback): Ditto. (wait_for_sigstop): Ditto. Fetch ptid, lwpid from thread, lwp. (stuck_in_jump_pad_callback): Update, "entry" parameter is a struct thread_info * now. (move_out_of_jump_pad_callback): Ditto. Fetch ptid, lwpid from thread, lwp. (lwp_running): Update, "entry" parameter is a struct thread_info * now. (stop_all_lwps): Fetch ptid from thread. Pass &all_threads to find_inferior, for_each_inferior, not &all_lwps. (linux_resume_one_lwp): Fetch lwpid from thread. (linux_set_resume_request): Update, "entry" parameter is a struct thread_info * now. Fetch pid, lwpid from thread. (resume_status_pending_p): Update, "entry" parameter is a struct thread_info * now. (need_step_over_p): Ditto. Fetch lwpid from thread. (start_step_over): Fetch lwpid from thread. (linux_resume_one_thread): Update, "entry" parameter is a struct thread_info * now. Fetch lwpid from thread. (linux_resume): Pass &all_threads to find_inferior, not &all_lwps. (proceed_one_lwp): Update, "entry" parameter is a struct thread_info * now. Fetch lwpid from thread. (unsuspend_and_proceed_one_lwp): Update, "entry" parameter is a struct thread_info * now. (proceed_all_lwps): Pass &all_threads to find_inferior, not &all_lwps. (unstop_all_lwps): Ditto. Fetch lwpid from thread. (regsets_fetch_inferior_registers): Fetch lwpid from current_inferior directly. (regsets_store_inferior_registers): Ditto. (fetch_register, store_register): Ditto. (linux_read_memory, linux_write_memory): Ditto. (linux_request_interrupt): Ditto. (linux_read_auxv): Ditto. (linux_xfer_siginfo): Ditto. (linux_qxfer_spu): Ditto. (linux_qxfer_libraries_svr4): Ditto. * linux-low.h (ptid_of, pid_of, lwpid_of): Delete, moved to inferiors.h. (get_lwp): Delete. (get_thread_lwp): Update. (struct lwp_info): Delete member "entry". Simplify comment for member "thread". (all_lwps): Delete. * linux-mips-low.c (mips_read_description): Fetch lwpid from current_inferior directly. (update_watch_registers_callback): Update, "entry" parameter is a struct thread_info * now. Fetch pid from thread. (mips_linux_prepare_to_resume): Fetch ptid from thread. (mips_insert_point): Fetch lwpid from current_inferior. Pass &all_threads to find_inferior, not &all_lwps. (mips_remove_point): Pass &all_threads to find_inferior, not &all_lwps. (mips_stopped_by_watchpoint): Fetch lwpid from current_inferior directly. (mips_stopped_data_address): Ditto. * linux-s390-low.c (s390_arch_setup): Fetch pid from current_inferior directly. * linux-tile-low.c (tile_arch_setup): Ditto. * linux-x86-low.c (x86_get_thread_area): Fetch lwpid from thread. (update_debug_registers_callback): Update, "entry" parameter is a struct thread_info * now. Fetch pid from thread. (i386_dr_low_set_addr): Fetch pid from current_inferior directly. Pass &all_threads to find_inferior, not &all_lwps. (i386_dr_low_get_addr): Fetch ptid from current_inferior directly. (i386_dr_low_set_control): Fetch pid from current_inferior directly. Pass &all_threads to find_inferior, not &all_lwps. (i386_dr_low_get_control): Fetch ptid from current_inferior directly. (i386_dr_low_get_status): Ditto. (x86_linux_prepare_to_resume): Fetch ptid from thread. (x86_siginfo_fixup): Fetch lwpid from current_inferior directly. (x86_linux_read_description): Ditto. * proc-service.c (ps_getpid): Fetch pid from current_inferior directly.
2014-02-20 21:23:26 +01:00
/* This struct is recorded in the target_data field of struct thread_info.
On linux ``all_threads'' is keyed by the LWP ID, which we use as the
GDB protocol representation of the thread ID. Threads also have
a "process ID" (poorly named) which is (presently) the same as the
LWP ID.
There is also ``all_processes'' is keyed by the "overall process ID",
which GNU/Linux calls tgid, "thread group ID". */
Rename "process" to "lwp" throughout. * linux-low.c (all_processes): Rename to... (all_lwps): ... this. (inferior_pid, handle_extended_wait, get_stop_pc): Adjust. (add_process): Rename to ... (add_lwp): ... this. Adjust. (linux_create_inferior): Adjust. (linux_attach_lwp): Adjust. (linux_attach): Adjust. (linux_kill_one_process): Rename to ... (linux_kill_one_lwp): ... this. Adjust. (linux_kill): Adjust. (linux_detach_one_process): Rename to ... (linux_detach_one_lwp): ... this. Adjust. (linux_detach): Adjust. (check_removed_breakpoint): Adjust. (status_pending_p): Adjust. (linux_wait_for_process): Rename to ... (linux_wait_for_lwp): ... this. Adjust. (linux_wait_for_event): Adjust. (send_sigstop): Adjust. (wait_for_sigstop): Adjust. (stop_all_processes): Rename to ... (stop_all_lwps): ... this. (linux_resume_one_process): Rename to ... (linux_resume_one_lwp): ... this. Adjust. (linux_set_resume_request, linux_continue_one_thread) (linux_queue_one_thread, resume_status_pending_p) (usr_store_inferior_registers, regsets_store_inferior_registers) (linux_request_interrupt, linux_read_offsets, linux_xfer_siginfo): Adjust. * linux-low.h (get_process): Rename to ... (get_lwp): ... this. Adjust. (get_thread_process): Rename to ... (get_thread_lwp): ... this. Adjust. (get_process_thread): Rename to ... (get_lwp_thread): ... this. Adjust. (struct process_info): Rename to ... (struct lwp_info): ... this. (all_processes): Rename to ... (all_lwps): ... this. * proc-service.c (ps_lgetregs): Adjust. * thread-db.c (thread_db_create_event, find_one_thread) (maybe_attach_thread, thread_db_get_tls_address): Adjust.
2009-03-17 21:25:35 +01:00
struct lwp_info
2002-06-11 Daniel Jacobowitz <drow@mvista.com> * gdbserver/thread-db.c: New file. * gdbserver/proc-service.c: New file. * gdbserver/acinclude.m4: New file. * gdbserver/Makefile.in: Add GDBSERVER_LIBS, gdb_proc_service_h, proc-service.o, and thread-db.o. (linux-low.o): Add USE_THREAD_DB. * gdbserver/acconfig.h: Add HAVE_PRGREGSET_T, HAVE_PRFPREGSET_T, HAVE_LWPID_T, HAVE_PSADDR_T, and PRFPREGSET_T_BROKEN. * gdbserver/aclocal.m4: Regenerated. * gdbserver/config.in: Regenerated. * gdbserver/configure: Regenerated. * gdbserver/configure.in: Check for proc_service.h, sys/procfs.h, thread_db.h, and linux/elf.h headrs. Check for lwpid_t, psaddr_t, prgregset_t, prfpregset_t, and PRFPREGSET_T_BROKEN. Introduce srv_thread_depfiles and USE_THREAD_DB. Check for -lthread_db and thread support. * gdbserver/configure.srv: Enable thread_db support for ARM, i386, MIPS, PowerPC, and SuperH. * gdbserver/i387-fp.c: Constify arguments. * gdbserver/i387-fp.h: Likewise. * gdbserver/inferiors.c: (struct thread_info): Renamed from `struct inferior_info'. Remove PID member. Use generic inferior list header. All uses updated. (inferiors, signal_pid): Removed. (all_threads): New variable. (get_thread): Define. (add_inferior_to_list): New function. (for_each_inferior): New function. (change_inferior_id): New function. (add_inferior): Removed. (remove_inferior): New function. (add_thread): New function. (free_one_thread): New function. (remove_thread): New function. (clear_inferiors): Use for_each_inferior and free_one_thread. (find_inferior): New function. (find_inferior_id): New function. (inferior_target_data): Update argument type. (set_inferior_target_data): Likewise. (inferior_regcache_data): Likewise. (set_inferior_regcache_data): Likewise. * gdbserver/linux-low.c (linux_bp_reinsert): Remove. (all_processes, stopping_threads, using_thrads) (struct pending_signals, debug_threads, pid_of): New. (inferior_pid): Replace with macro. (struct inferior_linux_data): Remove. (get_stop_pc, add_process): New functions. (linux_create_inferior): Restore SIGRTMIN+1 before calling exec. Use add_process and add_thread. (linux_attach_lwp): New function, based on old linux_attach. Use add_process and add_thread. Set stop_expected for new threads. (linux_attach): New function. (linux_kill_one_process): New function. (linux_kill): Kill all LWPs. (linux_thread_alive): Use find_inferior_id. (check_removed_breakpoints, status_pending_p): New functions. (linux_wait_for_process): Renamed from linux_wait_for_one_inferior. Update. Use WNOHANG. Wait for cloned processes also. Update process struct for the found process. (linux_wait_for_event): New function. (linux_wait): Use it. Support LWPs. (send_sigstop, wait_for_sigstop, stop_all_processes) (linux_resume_one_process, linux_continue_one_process): New functions. (linux_resume): Support LWPs. (REGISTER_RAW_SIZE): Remove. (fetch_register): Use register_size instead. Call supply_register. (usr_store_inferior_registers): Likewise. Call collect_register. Fix recursive case. (regsets_fetch_inferior_registers): Improve error message. (regsets_store_inferior_registers): Add debugging. (linux_look_up_symbols): Call thread_db_init if USE_THREAD_DB. (unstopped_p, linux_signal_pid): New functions. (linux_target_ops): Add linux_signal_pid. (linux_init_signals): New function. (initialize_low): Call it. Initialize using_threads. * gdbserver/regcache.c (inferior_regcache_data): Add valid flag. (get_regcache): Fetch registers lazily. Add fetch argument and update all callers. (regcache_invalidate_one, regcache_invalidate): New functions. (new_register_cache): Renamed from create_register_cache. Return the new regcache. (free_register_cache): Change argument to a void *. (registers_to_string, registers_from_string): Call get_regcache with fetch flag set. (register_data): Make static. Pass fetch flag to get_regcache. (supply_register): Call get_regcache with fetch flag clear. (collect_register): Call get_regcache with fetch flag set. (collect_register_as_string): New function. * gdbserver/regcache.h: Update. * gdbserver/remote-utils.c (putpkt): Flush after debug output and use stderr. Handle input interrupts while waiting for an ACK. (input_interrupt): Use signal_pid method. (getpkt): Flush after debug output and use stderr. (outreg): Use collect_register_as_string. (new_thread_notify, dead_thread_notify): New functions. (prepare_resume_reply): Check using_threads. Set thread_from_wait and general_thread. (look_up_one_symbol): Flush after debug output. * gdbserver/server.c (step_thread, server_waiting): New variables. (start_inferior): Don't use signal_pid. Update call to mywait. (attach_inferior): Update call to mywait. (handle_query): Handle qfThreadInfo and qsThreadInfo. (main): Don't fetch/store registers explicitly. Use set_desired_inferior. Support proposed ``Hs'' packet. Update calls to mywait. * gdbserver/server.h: Update. (struct inferior_list, struct_inferior_list_entry): New. * gdbserver/target.c (set_desired_inferior): New. (write_inferior_memory): Constify. (mywait): New function. * gdbserver/target.h: Update. (struct target_ops): New signal_pid method. (mywait): Removed macro, added prototype. * gdbserver/linux-low.h (regset_func): Removed. (regset_fill_func, regset_store_func): New. (enum regset_type): New. (struct regset_info): Add type field. Use new operation types. (struct linux_target_ops): stop_pc renamed to get_pc. Add decr_pc_after_break and breakpoint_at. (get_process, get_thread_proess, get_process_thread) (strut process_info, all_processes, linux_attach_lwp) (thread_db_init): New. * gdbserver/linux-arm-low.c (arm_get_pc, arm_set_pc, arm_breakpoint, arm_breakpoint_len, arm_breakpoint_at): New. (the_low_target): Add new members. * gdbserver/linux-i386-low.c (i386_store_gregset, i386_store_fpregset) (i386_store_fpxregset): Constify. (target_regsets): Add new kind identifier. (i386_get_pc): Renamed from i386_stop_pc. Simplify. (i386_set_pc): Add debugging. (i386_breakpoint_at): New function. (the_low_target): Add new members. * gdbserver/linux-mips-low.c (mips_get_pc, mips_set_pc) (mips_breakpoint, mips_breakpoint_len, mips_reinsert_addr) (mips_breakpoint_at): New. (the_low_target): Add new members. * gdbserver/linux-ppc-low.c (ppc_get_pc, ppc_set_pc) (ppc_breakpoint, ppc_breakpoint_len, ppc_breakpoint_at): New. (the_low_target): Add new members. * gdbserver/linux-sh-low.c (sh_get_pc, sh_set_pc) (sh_breakpoint, sh_breakpoint_len, sh_breakpoint_at): New. (the_low_target): Add new members. * gdbserver/linux-x86-64-low.c (target_regsets): Add new kind identifier.
2002-06-11 19:32:40 +02:00
{
Remove all_lwps global. * inferiors.h (ptid_of): Move here from linux-low.h. (pid_of, lwpid_of): Ditto. * linux-aarch64-low.c (debug_reg_change_callback): Update, "entry" parameter is a struct thread_info * now. (aarch64_notify_debug_reg_change): Fetch pid from current_inferior directly. Pass &all_threads to find_inferior instead of &all_lwps. (aarch64_stopped_data_address): Fetch lwpid from current_inferior directly. (aarch64_linux_prepare_to_resume): Fetch ptid from thread. (aarch64_arch_setup): Fetch lwpid from current_inferior directly. * linux-arm-low.c (update_registers_callback): Update, "entry" parameter is a struct thread_info * now. Fetch lwpid from current_inferior directly. (arm_insert_point): Pass &all_threads to find_inferior instead of &all_lwps. (arm_remove_point): Ditto. (arm_stopped_by_watchpoint): Fetch lwp from current_inferior. (arm_prepare_to_resume): Fetch pid from thread. (arm_read_description): Fetch lwpid from current_inferior directly. * linux-low.c (all_lwps): Delete. (delete_lwp): Delete call to remove_inferior. (handle_extended_wait): Fetch lwpid from thread. (add_lwp): Don't set lwp->entry.id. Remove call to add_inferior_to_list. (linux_attach_lwp_1): Fetch pid from current_inferior directly. (linux_kill_one_lwp): Fetch ptid,lwpid from thread. (kill_one_lwp_callback): Ditto. (linux_kill): Don't dereference NULL pointer. Fetch ptid,lwpid from thread. (get_detach_signal): Fetch ptid from thread. (linux_detach_one_lwp): Fetch ptid,lwpid from thread. Simplify call to regcache_invalidate_thread. (delete_lwp_callback): Update, "entry" parameter is a struct thread_info * now. Fetch pid from thread. (linux_mourn): Pass &all_threads to find_inferior instead of &all_lwps. (status_pending_p_callback): Update, "entry" parameter is a struct thread_info * now. Fetch ptid from thread. (find_lwp_pid): Update, "entry" parameter is a struct thread_info * now. (linux_wait_for_lwp): Fetch pid from thread. (linux_fast_tracepoint_collecting): Fetch lwpid from thread. (maybe_move_out_of_jump_pad): Fetch lwpid from current_inferior. (enqueue_one_deferred_signal): Fetch lwpid from thread. (dequeue_one_deferred_signal): Ditto. (cancel_breakpoint): Fetch ptid from current_inferior. (linux_wait_for_event): Pass &all_threads to find_inferior, not &all_lwps. Fetch ptid, lwpid from thread. (count_events_callback): Update, "entry" parameter is a struct thread_info * now. (select_singlestep_lwp_callback): Ditto. (select_event_lwp_callback): Ditto. (cancel_breakpoints_callback): Ditto. (linux_cancel_breakpoints): Pass &all_threads to find_inferior, not &all_lwps. (select_event_lwp): Ditto. Fetch ptid from event_thread. (unsuspend_one_lwp): Update, "entry" parameter is a struct thread_info * now. (unsuspend_all_lwps): Pass &all_threads to find_inferior, not &all_lwps. (linux_stabilize_threads): Ditto. And for for_each_inferior. Fetch lwpid from thread, not lwp. (linux_wait_1): Fetch ptid, lwpid from current_inferior. Pass &all_threads to find_inferior, not &all_lwps. (send_sigstop): Fetch lwpid from thread, not lwp. (send_sigstop_callback): Update, "entry" parameter is a struct thread_info * now. (suspend_and_send_sigstop_callback): Ditto. (wait_for_sigstop): Ditto. Fetch ptid, lwpid from thread, lwp. (stuck_in_jump_pad_callback): Update, "entry" parameter is a struct thread_info * now. (move_out_of_jump_pad_callback): Ditto. Fetch ptid, lwpid from thread, lwp. (lwp_running): Update, "entry" parameter is a struct thread_info * now. (stop_all_lwps): Fetch ptid from thread. Pass &all_threads to find_inferior, for_each_inferior, not &all_lwps. (linux_resume_one_lwp): Fetch lwpid from thread. (linux_set_resume_request): Update, "entry" parameter is a struct thread_info * now. Fetch pid, lwpid from thread. (resume_status_pending_p): Update, "entry" parameter is a struct thread_info * now. (need_step_over_p): Ditto. Fetch lwpid from thread. (start_step_over): Fetch lwpid from thread. (linux_resume_one_thread): Update, "entry" parameter is a struct thread_info * now. Fetch lwpid from thread. (linux_resume): Pass &all_threads to find_inferior, not &all_lwps. (proceed_one_lwp): Update, "entry" parameter is a struct thread_info * now. Fetch lwpid from thread. (unsuspend_and_proceed_one_lwp): Update, "entry" parameter is a struct thread_info * now. (proceed_all_lwps): Pass &all_threads to find_inferior, not &all_lwps. (unstop_all_lwps): Ditto. Fetch lwpid from thread. (regsets_fetch_inferior_registers): Fetch lwpid from current_inferior directly. (regsets_store_inferior_registers): Ditto. (fetch_register, store_register): Ditto. (linux_read_memory, linux_write_memory): Ditto. (linux_request_interrupt): Ditto. (linux_read_auxv): Ditto. (linux_xfer_siginfo): Ditto. (linux_qxfer_spu): Ditto. (linux_qxfer_libraries_svr4): Ditto. * linux-low.h (ptid_of, pid_of, lwpid_of): Delete, moved to inferiors.h. (get_lwp): Delete. (get_thread_lwp): Update. (struct lwp_info): Delete member "entry". Simplify comment for member "thread". (all_lwps): Delete. * linux-mips-low.c (mips_read_description): Fetch lwpid from current_inferior directly. (update_watch_registers_callback): Update, "entry" parameter is a struct thread_info * now. Fetch pid from thread. (mips_linux_prepare_to_resume): Fetch ptid from thread. (mips_insert_point): Fetch lwpid from current_inferior. Pass &all_threads to find_inferior, not &all_lwps. (mips_remove_point): Pass &all_threads to find_inferior, not &all_lwps. (mips_stopped_by_watchpoint): Fetch lwpid from current_inferior directly. (mips_stopped_data_address): Ditto. * linux-s390-low.c (s390_arch_setup): Fetch pid from current_inferior directly. * linux-tile-low.c (tile_arch_setup): Ditto. * linux-x86-low.c (x86_get_thread_area): Fetch lwpid from thread. (update_debug_registers_callback): Update, "entry" parameter is a struct thread_info * now. Fetch pid from thread. (i386_dr_low_set_addr): Fetch pid from current_inferior directly. Pass &all_threads to find_inferior, not &all_lwps. (i386_dr_low_get_addr): Fetch ptid from current_inferior directly. (i386_dr_low_set_control): Fetch pid from current_inferior directly. Pass &all_threads to find_inferior, not &all_lwps. (i386_dr_low_get_control): Fetch ptid from current_inferior directly. (i386_dr_low_get_status): Ditto. (x86_linux_prepare_to_resume): Fetch ptid from thread. (x86_siginfo_fixup): Fetch lwpid from current_inferior directly. (x86_linux_read_description): Ditto. * proc-service.c (ps_getpid): Fetch pid from current_inferior directly.
2014-02-20 21:23:26 +01:00
/* Backlink to the parent object. */
struct thread_info *thread;
/* If this flag is set, the next SIGSTOP will be ignored (the
process will be immediately resumed). This means that either we
sent the SIGSTOP to it ourselves and got some other pending event
(so the SIGSTOP is still pending), or that we stopped the
inferior implicitly via PTRACE_ATTACH and have not waited for it
yet. */
2002-06-11 Daniel Jacobowitz <drow@mvista.com> * gdbserver/thread-db.c: New file. * gdbserver/proc-service.c: New file. * gdbserver/acinclude.m4: New file. * gdbserver/Makefile.in: Add GDBSERVER_LIBS, gdb_proc_service_h, proc-service.o, and thread-db.o. (linux-low.o): Add USE_THREAD_DB. * gdbserver/acconfig.h: Add HAVE_PRGREGSET_T, HAVE_PRFPREGSET_T, HAVE_LWPID_T, HAVE_PSADDR_T, and PRFPREGSET_T_BROKEN. * gdbserver/aclocal.m4: Regenerated. * gdbserver/config.in: Regenerated. * gdbserver/configure: Regenerated. * gdbserver/configure.in: Check for proc_service.h, sys/procfs.h, thread_db.h, and linux/elf.h headrs. Check for lwpid_t, psaddr_t, prgregset_t, prfpregset_t, and PRFPREGSET_T_BROKEN. Introduce srv_thread_depfiles and USE_THREAD_DB. Check for -lthread_db and thread support. * gdbserver/configure.srv: Enable thread_db support for ARM, i386, MIPS, PowerPC, and SuperH. * gdbserver/i387-fp.c: Constify arguments. * gdbserver/i387-fp.h: Likewise. * gdbserver/inferiors.c: (struct thread_info): Renamed from `struct inferior_info'. Remove PID member. Use generic inferior list header. All uses updated. (inferiors, signal_pid): Removed. (all_threads): New variable. (get_thread): Define. (add_inferior_to_list): New function. (for_each_inferior): New function. (change_inferior_id): New function. (add_inferior): Removed. (remove_inferior): New function. (add_thread): New function. (free_one_thread): New function. (remove_thread): New function. (clear_inferiors): Use for_each_inferior and free_one_thread. (find_inferior): New function. (find_inferior_id): New function. (inferior_target_data): Update argument type. (set_inferior_target_data): Likewise. (inferior_regcache_data): Likewise. (set_inferior_regcache_data): Likewise. * gdbserver/linux-low.c (linux_bp_reinsert): Remove. (all_processes, stopping_threads, using_thrads) (struct pending_signals, debug_threads, pid_of): New. (inferior_pid): Replace with macro. (struct inferior_linux_data): Remove. (get_stop_pc, add_process): New functions. (linux_create_inferior): Restore SIGRTMIN+1 before calling exec. Use add_process and add_thread. (linux_attach_lwp): New function, based on old linux_attach. Use add_process and add_thread. Set stop_expected for new threads. (linux_attach): New function. (linux_kill_one_process): New function. (linux_kill): Kill all LWPs. (linux_thread_alive): Use find_inferior_id. (check_removed_breakpoints, status_pending_p): New functions. (linux_wait_for_process): Renamed from linux_wait_for_one_inferior. Update. Use WNOHANG. Wait for cloned processes also. Update process struct for the found process. (linux_wait_for_event): New function. (linux_wait): Use it. Support LWPs. (send_sigstop, wait_for_sigstop, stop_all_processes) (linux_resume_one_process, linux_continue_one_process): New functions. (linux_resume): Support LWPs. (REGISTER_RAW_SIZE): Remove. (fetch_register): Use register_size instead. Call supply_register. (usr_store_inferior_registers): Likewise. Call collect_register. Fix recursive case. (regsets_fetch_inferior_registers): Improve error message. (regsets_store_inferior_registers): Add debugging. (linux_look_up_symbols): Call thread_db_init if USE_THREAD_DB. (unstopped_p, linux_signal_pid): New functions. (linux_target_ops): Add linux_signal_pid. (linux_init_signals): New function. (initialize_low): Call it. Initialize using_threads. * gdbserver/regcache.c (inferior_regcache_data): Add valid flag. (get_regcache): Fetch registers lazily. Add fetch argument and update all callers. (regcache_invalidate_one, regcache_invalidate): New functions. (new_register_cache): Renamed from create_register_cache. Return the new regcache. (free_register_cache): Change argument to a void *. (registers_to_string, registers_from_string): Call get_regcache with fetch flag set. (register_data): Make static. Pass fetch flag to get_regcache. (supply_register): Call get_regcache with fetch flag clear. (collect_register): Call get_regcache with fetch flag set. (collect_register_as_string): New function. * gdbserver/regcache.h: Update. * gdbserver/remote-utils.c (putpkt): Flush after debug output and use stderr. Handle input interrupts while waiting for an ACK. (input_interrupt): Use signal_pid method. (getpkt): Flush after debug output and use stderr. (outreg): Use collect_register_as_string. (new_thread_notify, dead_thread_notify): New functions. (prepare_resume_reply): Check using_threads. Set thread_from_wait and general_thread. (look_up_one_symbol): Flush after debug output. * gdbserver/server.c (step_thread, server_waiting): New variables. (start_inferior): Don't use signal_pid. Update call to mywait. (attach_inferior): Update call to mywait. (handle_query): Handle qfThreadInfo and qsThreadInfo. (main): Don't fetch/store registers explicitly. Use set_desired_inferior. Support proposed ``Hs'' packet. Update calls to mywait. * gdbserver/server.h: Update. (struct inferior_list, struct_inferior_list_entry): New. * gdbserver/target.c (set_desired_inferior): New. (write_inferior_memory): Constify. (mywait): New function. * gdbserver/target.h: Update. (struct target_ops): New signal_pid method. (mywait): Removed macro, added prototype. * gdbserver/linux-low.h (regset_func): Removed. (regset_fill_func, regset_store_func): New. (enum regset_type): New. (struct regset_info): Add type field. Use new operation types. (struct linux_target_ops): stop_pc renamed to get_pc. Add decr_pc_after_break and breakpoint_at. (get_process, get_thread_proess, get_process_thread) (strut process_info, all_processes, linux_attach_lwp) (thread_db_init): New. * gdbserver/linux-arm-low.c (arm_get_pc, arm_set_pc, arm_breakpoint, arm_breakpoint_len, arm_breakpoint_at): New. (the_low_target): Add new members. * gdbserver/linux-i386-low.c (i386_store_gregset, i386_store_fpregset) (i386_store_fpxregset): Constify. (target_regsets): Add new kind identifier. (i386_get_pc): Renamed from i386_stop_pc. Simplify. (i386_set_pc): Add debugging. (i386_breakpoint_at): New function. (the_low_target): Add new members. * gdbserver/linux-mips-low.c (mips_get_pc, mips_set_pc) (mips_breakpoint, mips_breakpoint_len, mips_reinsert_addr) (mips_breakpoint_at): New. (the_low_target): Add new members. * gdbserver/linux-ppc-low.c (ppc_get_pc, ppc_set_pc) (ppc_breakpoint, ppc_breakpoint_len, ppc_breakpoint_at): New. (the_low_target): Add new members. * gdbserver/linux-sh-low.c (sh_get_pc, sh_set_pc) (sh_breakpoint, sh_breakpoint_len, sh_breakpoint_at): New. (the_low_target): Add new members. * gdbserver/linux-x86-64-low.c (target_regsets): Add new kind identifier.
2002-06-11 19:32:40 +02:00
int stop_expected;
Teach linux gdbserver to step-over-breakpoints. * linux-low.c (can_hardware_single_step): New. (supports_breakpoints): New. (handle_extended_wait): If stopping threads, read the stop pc of the new cloned LWP. (get_pc): New. (get_stop_pc): Add `lwp' parameter. Handle it. Bail out if the low target doesn't support retrieving the PC. (add_lwp): Set last_resume_kind to resume_continue. (linux_attach_lwp_1): Adjust comments. Always set stop_expected. (linux_attach): Don't clear stop_expected. Set the lwp's last_resume_kind to resume_stop. (linux_detach_one_lwp): Don't check for removed breakpoints. (check_removed_breakpoint): Delete. (status_pending_p): Rename to ... (status_pending_p_callback): ... this. Don't check for removed breakpoints. Don't consider threads that are stopped from GDB's perspective. (linux_wait_for_lwp): Always read the stop_pc here. (cancel_breakpoint): New. (step_over_bkpt): New global. (linux_wait_for_event_1): Implement stepping over breakpoints. (gdb_wants_lwp_stopped): New. (gdb_wants_all_stopped): New. (linux_wait_1): Tag threads as gdb-wants-stopped. Cancel finished single-step traps here. Store the thread's last reported target wait status. (send_sigstop): Don't clear stop_expected. Always set it, instead. (mark_lwp_dead): Remove reference to pending_is_breakpoint. (cancel_finished_single_step): New. (cancel_finished_single_steps): New. (wait_for_sigstop): Don't cancel finished single-step traps here. (linux_resume_one_lwp): Don't check for removed breakpoints. Don't set `step' on non-hardware step archs. (linux_set_resume_request): Ignore resume_stop requests if already stopping or stopped. Set the lwp's last_resume_kind. (resume_status_pending_p): Don't check for removed breakpoints. (need_step_over_p): New. (start_step_over): New. (finish_step_over): New. (linux_resume_one_thread): Always queue a sigstop for resume_stop requests. Clear the thread's last reported target waitstatus. Don't use the `suspended' flag. Don't consider pending breakpoints. (linux_resume): Start a step-over if necessary. (proceed_one_lwp): New. (proceed_all_lwps): New. (unstop_all_lwps): New. * linux-low.h (struct lwp_info): Rewrite comment for the `suspended' flag. Add the `stop_pc' field. Delete the `pending_stop_pc' field. Tweak the `stepping' flag's comment. Add `'last_resume_kind' and `need_step_over' fields. * inferiors.c (struct thread_info): Delete, moved elsewhere. * mem-break.c (struct breakpoint): Delete `reinserting' flag. Delete `breakpoint_to_reinsert' field. New flag `inserted'. (set_raw_breakpoint_at): New. (set_breakpoint_at): Rewrite to use it. (reinsert_breakpoint_handler): Delete. (set_reinsert_breakpoint): New. (reinsert_breakpoint_by_bp): Delete. (delete_reinsert_breakpoints): New. (uninsert_breakpoint): Rewrite. (uninsert_breakpoints_at): New. (reinsert_breakpoint): Rewrite. (reinsert_breakpoints_at): New. (check_breakpoints): Rewrite. (breakpoint_here): New. (breakpoint_inserted_here): New. (check_mem_read): Adjust. * mem-break.h (breakpoints_supported, breakpoint_here) (breakpoint_inserted_here, set_reinsert_breakpoint): Declare. (reinsert_breakpoint_by_bp): Delete declaration. (delete_reinsert_breakpoints): Declare. (reinsert_breakpoint): Delete declaration. (reinsert_breakpoints_at): Declare. (uninsert_breakpoint): Delete declaration. (uninsert_breakpoints_at): Declare. (check_breakpoints): Adjust prototype. * server.h: Adjust include order. (struct thread_info): Declare here. Add a `last_status' field.
2010-03-24 01:05:03 +01:00
/* When this is true, we shall not try to resume this thread, even
if last_resume_kind isn't resume_stop. */
Non-stop mode support. * server.h (non_stop): Declare. (gdb_client_data, handler_func): Declare. (delete_file_handler, add_file_handler, start_event_loop): Declare. (handle_serial_event, handle_target_event, push_event) (putpkt_notif): Declare. * target.h (enum resume_kind): New. (struct thread_resume): Replace `step' field by `kind' field. (TARGET_WNOHANG): Define. (struct target_ops) <wait>: Add `options' argument. <supports_non_stop, async, start_non_stop>: New fields. (target_supports_non_stop, target_async): New. (start_non_stop): Declare. (mywait): Add `options' argument. * target.c (mywait): Add `options' argument. Print child exit notifications here. (start_non_stop): New. * server.c (non_stop, own_buf, mem_buf): New globals. (struct vstop_notif): New. (notif_queue): New global. (queue_stop_reply, push_event, discard_queued_stop_replies) (send_next_stop_reply): New. (start_inferior): Adjust to use resume_kind. Adjust to mywait interface changes. (attach_inferior): In non-stop mode, don't wait for the target here. (handle_general_set): Handle QNonStop. (handle_query): When handling qC, return the current general thread, instead of the first thread of the list. (handle_query): If the backend supports non-stop mode, include QNonStop+ in the qSupported query response. (handle_v_cont): Adjust to use resume_kind. Handle resume_stop and non-stop mode. (handle_v_attach, handle_v_run): Handle non-stop mode. (handle_v_stopped): New. (handle_v_requests): Report support for vCont;t. Handle vStopped. (myresume): Adjust to use resume_kind. Handle non-stop. (queue_stop_reply_callback): New. (handle_status): Handle non-stop mode. (main): Clear non_stop flag on reconnection. Use the event-loop. Refactor serial protocol handling from here ... (process_serial_event): ... to this new function. When GDB selects any thread, select one here. In non-stop mode, wait until GDB acks all pending events before exiting. (handle_serial_event, handle_target_event): New. * remote-utils.c (remote_open): Install remote_desc in the event loop. (remote_close): Remove remote_desc from the event loop. (putpkt_binary): Rename to... (putpkt_binary_1): ... this. Add `is_notic' argument. Handle it. (putpkt_binary): New as wrapper around putpkt_binary_1. (putpkt_notif): New. (prepare_resume_reply): In non-stop mode, don't change the general_thread. * event-loop.c: New. * Makefile.in (OBJ): Add event-loop.o. (event-loop.o): New rule. * linux-low.h (pid_of): Moved here. (lwpid_of): New. (get_lwp_thread): Use lwpid_of. (struct lwp_info): Delete `lwpid' field. Add `suspended' field. * linux-low.c (pid_of): Delete. (inferior_pid): Use lwpid_of. (linux_event_pipe): New. (target_is_async_p): New. (delete_lwp): New. (handle_extended_wait): Use lwpid_of. (add_lwp): Don't set lwpid field. (linux_attach_lwp): Adjust debug output. Use lwpid_of. (linux_kill_one_lwp): If killing a running lwp, stop it first. Use lwpid_of. Adjust to linux_wait_for_event interface changes. (linux_detach_one_lwp): If detaching from a running lwp, stop it first. Adjust to linux_wait_for_event interface changes. Use lwpid_of. (linux_detach): Don't delete the main lwp here. (linux_join): Use my_waitpid. Avoid signal_pid. Use lwpid_of. (status_pending_p): Don't consider explicitly suspended lwps. (linux_wait_for_lwp): Take an integer pid instead of a lwp_info pointer. Add OPTIONS argument. Change return type to int. Use my_waitpid instead of sleeping. Handle WNOHANG. Use lwpid_of. (linux_wait_for_event): Take an integer pid instead of a lwp_info pointer. Add status pointer argument. Return a pid instead of a status. Use lwpid_of. Adjust to linux_wait_for_lwp interface changes. In non-stop mode, don't switch to a random thread. (linux_wait): Rename to... (linux_wait_1): ... this. Add target_options argument, and handle it. Adjust to use resume_kind. Use lwpid_of. In non-stop mode, don't handle the continue thread. Handle TARGET_WNOHANG. Merge clean exit and signal exit code. Don't stop all threads in non-stop mode. In all-stop mode, only stop all threads when reporting a stop to GDB. Handle explicit thread stop requests. (async_file_flush, async_file_mark): New. (linux_wait): New. (send_sigstop): Use lwpid_of. (wait_for_sigstop): Use lwpid_of. Adjust to linux_wait_for_event interface changes. In non-stop mode, don't switch to a random thread. (linux_resume_one_lwp): Use lwpid_of. (linux_continue_one_thread, linux_queue_one_thread): Merge into ... (linux_resume_one_thread): ... this. Handle resume_stop. In non-stop mode, don't look for pending flag in all threads. (resume_status_pending_p): Don't consider explicitly suspended threads. (my_waitpid): Reimplement. Emulate __WALL. (linux_request_interrupt, linux_read_offsets, linux_xfer_siginfo): Use lwpid_of. (sigchld_handler, linux_supports_non_stop, linux_async) (linux_start_non_stop): New. (linux_target_ops): Register linux_supports_non_stop, linux_async and linux_start_non_stop. (initialize_low): Install SIGCHLD handler. * thread-db.c (thread_db_create_event, find_one_thread) (thread_db_get_tls_address): Use lwpid_of. * win32-low.c (win32_detach): Adjust to use resume_kind. (win32_wait): Add `options' argument. * spu-low.c (spu_resume): Adjust to use resume_kind. (spu_wait): Add `options' argument.
2009-04-02 00:48:05 +02:00
int suspended;
/* If this flag is set, the lwp is known to be stopped right now (stop
2002-06-11 Daniel Jacobowitz <drow@mvista.com> * gdbserver/thread-db.c: New file. * gdbserver/proc-service.c: New file. * gdbserver/acinclude.m4: New file. * gdbserver/Makefile.in: Add GDBSERVER_LIBS, gdb_proc_service_h, proc-service.o, and thread-db.o. (linux-low.o): Add USE_THREAD_DB. * gdbserver/acconfig.h: Add HAVE_PRGREGSET_T, HAVE_PRFPREGSET_T, HAVE_LWPID_T, HAVE_PSADDR_T, and PRFPREGSET_T_BROKEN. * gdbserver/aclocal.m4: Regenerated. * gdbserver/config.in: Regenerated. * gdbserver/configure: Regenerated. * gdbserver/configure.in: Check for proc_service.h, sys/procfs.h, thread_db.h, and linux/elf.h headrs. Check for lwpid_t, psaddr_t, prgregset_t, prfpregset_t, and PRFPREGSET_T_BROKEN. Introduce srv_thread_depfiles and USE_THREAD_DB. Check for -lthread_db and thread support. * gdbserver/configure.srv: Enable thread_db support for ARM, i386, MIPS, PowerPC, and SuperH. * gdbserver/i387-fp.c: Constify arguments. * gdbserver/i387-fp.h: Likewise. * gdbserver/inferiors.c: (struct thread_info): Renamed from `struct inferior_info'. Remove PID member. Use generic inferior list header. All uses updated. (inferiors, signal_pid): Removed. (all_threads): New variable. (get_thread): Define. (add_inferior_to_list): New function. (for_each_inferior): New function. (change_inferior_id): New function. (add_inferior): Removed. (remove_inferior): New function. (add_thread): New function. (free_one_thread): New function. (remove_thread): New function. (clear_inferiors): Use for_each_inferior and free_one_thread. (find_inferior): New function. (find_inferior_id): New function. (inferior_target_data): Update argument type. (set_inferior_target_data): Likewise. (inferior_regcache_data): Likewise. (set_inferior_regcache_data): Likewise. * gdbserver/linux-low.c (linux_bp_reinsert): Remove. (all_processes, stopping_threads, using_thrads) (struct pending_signals, debug_threads, pid_of): New. (inferior_pid): Replace with macro. (struct inferior_linux_data): Remove. (get_stop_pc, add_process): New functions. (linux_create_inferior): Restore SIGRTMIN+1 before calling exec. Use add_process and add_thread. (linux_attach_lwp): New function, based on old linux_attach. Use add_process and add_thread. Set stop_expected for new threads. (linux_attach): New function. (linux_kill_one_process): New function. (linux_kill): Kill all LWPs. (linux_thread_alive): Use find_inferior_id. (check_removed_breakpoints, status_pending_p): New functions. (linux_wait_for_process): Renamed from linux_wait_for_one_inferior. Update. Use WNOHANG. Wait for cloned processes also. Update process struct for the found process. (linux_wait_for_event): New function. (linux_wait): Use it. Support LWPs. (send_sigstop, wait_for_sigstop, stop_all_processes) (linux_resume_one_process, linux_continue_one_process): New functions. (linux_resume): Support LWPs. (REGISTER_RAW_SIZE): Remove. (fetch_register): Use register_size instead. Call supply_register. (usr_store_inferior_registers): Likewise. Call collect_register. Fix recursive case. (regsets_fetch_inferior_registers): Improve error message. (regsets_store_inferior_registers): Add debugging. (linux_look_up_symbols): Call thread_db_init if USE_THREAD_DB. (unstopped_p, linux_signal_pid): New functions. (linux_target_ops): Add linux_signal_pid. (linux_init_signals): New function. (initialize_low): Call it. Initialize using_threads. * gdbserver/regcache.c (inferior_regcache_data): Add valid flag. (get_regcache): Fetch registers lazily. Add fetch argument and update all callers. (regcache_invalidate_one, regcache_invalidate): New functions. (new_register_cache): Renamed from create_register_cache. Return the new regcache. (free_register_cache): Change argument to a void *. (registers_to_string, registers_from_string): Call get_regcache with fetch flag set. (register_data): Make static. Pass fetch flag to get_regcache. (supply_register): Call get_regcache with fetch flag clear. (collect_register): Call get_regcache with fetch flag set. (collect_register_as_string): New function. * gdbserver/regcache.h: Update. * gdbserver/remote-utils.c (putpkt): Flush after debug output and use stderr. Handle input interrupts while waiting for an ACK. (input_interrupt): Use signal_pid method. (getpkt): Flush after debug output and use stderr. (outreg): Use collect_register_as_string. (new_thread_notify, dead_thread_notify): New functions. (prepare_resume_reply): Check using_threads. Set thread_from_wait and general_thread. (look_up_one_symbol): Flush after debug output. * gdbserver/server.c (step_thread, server_waiting): New variables. (start_inferior): Don't use signal_pid. Update call to mywait. (attach_inferior): Update call to mywait. (handle_query): Handle qfThreadInfo and qsThreadInfo. (main): Don't fetch/store registers explicitly. Use set_desired_inferior. Support proposed ``Hs'' packet. Update calls to mywait. * gdbserver/server.h: Update. (struct inferior_list, struct_inferior_list_entry): New. * gdbserver/target.c (set_desired_inferior): New. (write_inferior_memory): Constify. (mywait): New function. * gdbserver/target.h: Update. (struct target_ops): New signal_pid method. (mywait): Removed macro, added prototype. * gdbserver/linux-low.h (regset_func): Removed. (regset_fill_func, regset_store_func): New. (enum regset_type): New. (struct regset_info): Add type field. Use new operation types. (struct linux_target_ops): stop_pc renamed to get_pc. Add decr_pc_after_break and breakpoint_at. (get_process, get_thread_proess, get_process_thread) (strut process_info, all_processes, linux_attach_lwp) (thread_db_init): New. * gdbserver/linux-arm-low.c (arm_get_pc, arm_set_pc, arm_breakpoint, arm_breakpoint_len, arm_breakpoint_at): New. (the_low_target): Add new members. * gdbserver/linux-i386-low.c (i386_store_gregset, i386_store_fpregset) (i386_store_fpxregset): Constify. (target_regsets): Add new kind identifier. (i386_get_pc): Renamed from i386_stop_pc. Simplify. (i386_set_pc): Add debugging. (i386_breakpoint_at): New function. (the_low_target): Add new members. * gdbserver/linux-mips-low.c (mips_get_pc, mips_set_pc) (mips_breakpoint, mips_breakpoint_len, mips_reinsert_addr) (mips_breakpoint_at): New. (the_low_target): Add new members. * gdbserver/linux-ppc-low.c (ppc_get_pc, ppc_set_pc) (ppc_breakpoint, ppc_breakpoint_len, ppc_breakpoint_at): New. (the_low_target): Add new members. * gdbserver/linux-sh-low.c (sh_get_pc, sh_set_pc) (sh_breakpoint, sh_breakpoint_len, sh_breakpoint_at): New. (the_low_target): Add new members. * gdbserver/linux-x86-64-low.c (target_regsets): Add new kind identifier.
2002-06-11 19:32:40 +02:00
event already received in a wait()). */
int stopped;
Implement 'catch syscall' for gdbserver This adds a new QCatchSyscalls packet to enable 'catch syscall', and new stop reasons "syscall_entry" and "syscall_return" for those events. It is currently only supported on Linux x86 and x86_64. gdb/ChangeLog: 2016-01-12 Josh Stone <jistone@redhat.com> Philippe Waroquiers <philippe.waroquiers@skynet.be> * NEWS (Changes since GDB 7.10): Mention QCatchSyscalls and the syscall_entry and syscall_return stop reasons. Mention GDB support for remote catch syscall. * remote.c (PACKET_QCatchSyscalls): New enum. (remote_set_syscall_catchpoint): New function. (remote_protocol_features): New element for QCatchSyscalls. (remote_parse_stop_reply): Parse syscall_entry/return stops. (init_remote_ops): Install remote_set_syscall_catchpoint. (_initialize_remote): Config QCatchSyscalls. * linux-nat.h (struct lwp_info) <syscall_state>: Comment typo. gdb/doc/ChangeLog: 2016-01-12 Josh Stone <jistone@redhat.com> Philippe Waroquiers <philippe.waroquiers@skynet.be> * gdb.texinfo (Remote Configuration): List the QCatchSyscalls packet. (Stop Reply Packets): List the syscall entry and return stop reasons. (General Query Packets): Describe QCatchSyscalls, and add it to the table and the detailed list of stub features. gdb/gdbserver/ChangeLog: 2016-01-12 Josh Stone <jistone@redhat.com> Philippe Waroquiers <philippe.waroquiers@skynet.be> * inferiors.h: Include "gdb_vecs.h". (struct process_info): Add syscalls_to_catch. * inferiors.c (remove_process): Free syscalls_to_catch. * remote-utils.c (prepare_resume_reply): Report syscall_entry and syscall_return stops. * server.h (UNKNOWN_SYSCALL, ANY_SYSCALL): Define. * server.c (handle_general_set): Handle QCatchSyscalls. (handle_query): Report support for QCatchSyscalls. * target.h (struct target_ops): Add supports_catch_syscall. (target_supports_catch_syscall): New macro. * linux-low.h (struct linux_target_ops): Add get_syscall_trapinfo. (struct lwp_info): Add syscall_state. * linux-low.c (handle_extended_wait): Mark syscall_state as an entry. Maintain syscall_state and syscalls_to_catch across exec. (get_syscall_trapinfo): New function, proxy to the_low_target. (linux_low_ptrace_options): Enable PTRACE_O_TRACESYSGOOD. (linux_low_filter_event): Toggle syscall_state entry/return for syscall traps, and set it ignored for all others. (gdb_catching_syscalls_p): New function. (gdb_catch_this_syscall_p): New function. (linux_wait_1): Handle SYSCALL_SIGTRAP. (linux_resume_one_lwp_throw): Add PTRACE_SYSCALL possibility. (linux_supports_catch_syscall): New function. (linux_target_ops): Install it. * linux-x86-low.c (x86_get_syscall_trapinfo): New function. (the_low_target): Install it. gdb/testsuite/ChangeLog: 2016-01-12 Josh Stone <jistone@redhat.com> Philippe Waroquiers <philippe.waroquiers@skynet.be> * gdb.base/catch-syscall.c (do_execve): New variable. (main): Conditionally trigger an execve. * gdb.base/catch-syscall.exp: Enable testing for remote targets. (test_catch_syscall_execve): New, check entry/return across execve. (do_syscall_tests): Call test_catch_syscall_execve.
2016-01-12 21:27:27 +01:00
/* Signal whether we are in a SYSCALL_ENTRY or
in a SYSCALL_RETURN event.
Values:
- TARGET_WAITKIND_SYSCALL_ENTRY
- TARGET_WAITKIND_SYSCALL_RETURN */
enum target_waitkind syscall_state;
Non-stop mode support. * server.h (non_stop): Declare. (gdb_client_data, handler_func): Declare. (delete_file_handler, add_file_handler, start_event_loop): Declare. (handle_serial_event, handle_target_event, push_event) (putpkt_notif): Declare. * target.h (enum resume_kind): New. (struct thread_resume): Replace `step' field by `kind' field. (TARGET_WNOHANG): Define. (struct target_ops) <wait>: Add `options' argument. <supports_non_stop, async, start_non_stop>: New fields. (target_supports_non_stop, target_async): New. (start_non_stop): Declare. (mywait): Add `options' argument. * target.c (mywait): Add `options' argument. Print child exit notifications here. (start_non_stop): New. * server.c (non_stop, own_buf, mem_buf): New globals. (struct vstop_notif): New. (notif_queue): New global. (queue_stop_reply, push_event, discard_queued_stop_replies) (send_next_stop_reply): New. (start_inferior): Adjust to use resume_kind. Adjust to mywait interface changes. (attach_inferior): In non-stop mode, don't wait for the target here. (handle_general_set): Handle QNonStop. (handle_query): When handling qC, return the current general thread, instead of the first thread of the list. (handle_query): If the backend supports non-stop mode, include QNonStop+ in the qSupported query response. (handle_v_cont): Adjust to use resume_kind. Handle resume_stop and non-stop mode. (handle_v_attach, handle_v_run): Handle non-stop mode. (handle_v_stopped): New. (handle_v_requests): Report support for vCont;t. Handle vStopped. (myresume): Adjust to use resume_kind. Handle non-stop. (queue_stop_reply_callback): New. (handle_status): Handle non-stop mode. (main): Clear non_stop flag on reconnection. Use the event-loop. Refactor serial protocol handling from here ... (process_serial_event): ... to this new function. When GDB selects any thread, select one here. In non-stop mode, wait until GDB acks all pending events before exiting. (handle_serial_event, handle_target_event): New. * remote-utils.c (remote_open): Install remote_desc in the event loop. (remote_close): Remove remote_desc from the event loop. (putpkt_binary): Rename to... (putpkt_binary_1): ... this. Add `is_notic' argument. Handle it. (putpkt_binary): New as wrapper around putpkt_binary_1. (putpkt_notif): New. (prepare_resume_reply): In non-stop mode, don't change the general_thread. * event-loop.c: New. * Makefile.in (OBJ): Add event-loop.o. (event-loop.o): New rule. * linux-low.h (pid_of): Moved here. (lwpid_of): New. (get_lwp_thread): Use lwpid_of. (struct lwp_info): Delete `lwpid' field. Add `suspended' field. * linux-low.c (pid_of): Delete. (inferior_pid): Use lwpid_of. (linux_event_pipe): New. (target_is_async_p): New. (delete_lwp): New. (handle_extended_wait): Use lwpid_of. (add_lwp): Don't set lwpid field. (linux_attach_lwp): Adjust debug output. Use lwpid_of. (linux_kill_one_lwp): If killing a running lwp, stop it first. Use lwpid_of. Adjust to linux_wait_for_event interface changes. (linux_detach_one_lwp): If detaching from a running lwp, stop it first. Adjust to linux_wait_for_event interface changes. Use lwpid_of. (linux_detach): Don't delete the main lwp here. (linux_join): Use my_waitpid. Avoid signal_pid. Use lwpid_of. (status_pending_p): Don't consider explicitly suspended lwps. (linux_wait_for_lwp): Take an integer pid instead of a lwp_info pointer. Add OPTIONS argument. Change return type to int. Use my_waitpid instead of sleeping. Handle WNOHANG. Use lwpid_of. (linux_wait_for_event): Take an integer pid instead of a lwp_info pointer. Add status pointer argument. Return a pid instead of a status. Use lwpid_of. Adjust to linux_wait_for_lwp interface changes. In non-stop mode, don't switch to a random thread. (linux_wait): Rename to... (linux_wait_1): ... this. Add target_options argument, and handle it. Adjust to use resume_kind. Use lwpid_of. In non-stop mode, don't handle the continue thread. Handle TARGET_WNOHANG. Merge clean exit and signal exit code. Don't stop all threads in non-stop mode. In all-stop mode, only stop all threads when reporting a stop to GDB. Handle explicit thread stop requests. (async_file_flush, async_file_mark): New. (linux_wait): New. (send_sigstop): Use lwpid_of. (wait_for_sigstop): Use lwpid_of. Adjust to linux_wait_for_event interface changes. In non-stop mode, don't switch to a random thread. (linux_resume_one_lwp): Use lwpid_of. (linux_continue_one_thread, linux_queue_one_thread): Merge into ... (linux_resume_one_thread): ... this. Handle resume_stop. In non-stop mode, don't look for pending flag in all threads. (resume_status_pending_p): Don't consider explicitly suspended threads. (my_waitpid): Reimplement. Emulate __WALL. (linux_request_interrupt, linux_read_offsets, linux_xfer_siginfo): Use lwpid_of. (sigchld_handler, linux_supports_non_stop, linux_async) (linux_start_non_stop): New. (linux_target_ops): Register linux_supports_non_stop, linux_async and linux_start_non_stop. (initialize_low): Install SIGCHLD handler. * thread-db.c (thread_db_create_event, find_one_thread) (thread_db_get_tls_address): Use lwpid_of. * win32-low.c (win32_detach): Adjust to use resume_kind. (win32_wait): Add `options' argument. * spu-low.c (spu_resume): Adjust to use resume_kind. (spu_wait): Add `options' argument.
2009-04-02 00:48:05 +02:00
/* When stopped is set, the last wait status recorded for this lwp. */
int last_status;
Linux gdbserver confused when event randomization picks process exit event The tail end of linux_wait_1 isn't expecting that the select_event_lwp machinery can pick a whole-process exit event to report to GDB. When that happens, both gdb and gdbserver end up quite confused: ... (gdb) [Thread 24971.24971] #1 stopped. 0x0000003615a011f0 in ?? () c& Continuing. (gdb) [New Thread 24971.24981] [New Thread 24983.24983] [New Thread 24971.24982] [Thread 24983.24983] #3 stopped. 0x0000003615ebc7cc in __libc_fork () at ../nptl/sysdeps/unix/sysv/linux/fork.c:130 130 pid = ARCH_FORK (); [New Thread 24984.24984] Error in re-setting breakpoint -16: PC register is not available Error in re-setting breakpoint -17: PC register is not available Error in re-setting breakpoint -18: PC register is not available Error in re-setting breakpoint -19: PC register is not available Error in re-setting breakpoint -24: PC register is not available Error in re-setting breakpoint -25: PC register is not available Error in re-setting breakpoint -26: PC register is not available Error in re-setting breakpoint -27: PC register is not available Error in re-setting breakpoint -28: PC register is not available Error in re-setting breakpoint -29: PC register is not available Error in re-setting breakpoint -30: PC register is not available PC register is not available (gdb) gdb/gdbserver/ChangeLog: 2015-08-06 Pedro Alves <palves@redhat.com> * linux-low.c (add_lwp): Set waitstatus to TARGET_WAITKIND_IGNORE. (linux_thread_alive): Use lwp_is_marked_dead. (extended_event_reported): Delete. (linux_wait_1): Check if waitstatus is TARGET_WAITKIND_IGNORE instead of extended_event_reported. (mark_lwp_dead): Don't set the 'dead' flag. Store the waitstatus as well. (lwp_is_marked_dead): New function. (lwp_running): Use lwp_is_marked_dead. * linux-low.h: Delete 'dead' field, and update 'waitstatus's comment.
2015-08-06 11:30:17 +02:00
/* If WAITSTATUS->KIND != TARGET_WAITKIND_IGNORE, the waitstatus for
this LWP's last event, to pass to GDB without any further
processing. This is used to store extended ptrace event
information or exit status until it can be reported to GDB. */
Extended-remote Linux follow fork This patch implements basic support for follow-fork and detach-on-fork on extended-remote Linux targets. Only 'fork' is supported in this patch; 'vfork' support is added n a subsequent patch. This patch depends on the previous patches in the patch series. Sufficient extended-remote functionality has been implemented here to pass gdb.base/multi-forks.exp, as well as gdb.base/foll-fork.exp with the catchpoint tests commented out. Some other fork tests fail with this patch because it doesn't provide the architecture support needed for watchpoint inheritance or fork catchpoints. The implementation follows the same general structure as for the native implementation as much as possible. This implementation includes: * enabling fork events in linux-low.c in initialize_low and linux_enable_extended_features * handling fork events in gdbserver/linux-low.c:handle_extended_wait - when a fork event occurs in gdbserver, we must do the full creation of the new process, thread, lwp, and breakpoint lists. This is required whether or not the new child is destined to be detached-on-fork, because GDB will make target calls that require all the structures. In particular we need the breakpoint lists in order to remove the breakpoints from a detaching child. If we are not detaching the child we will need all these structures anyway. - as part of this event handling we store the target_waitstatus in a new member of the parent lwp_info structure, 'waitstatus'. This is used to store extended event information for reporting to GDB. - handle_extended_wait is given a return value, denoting whether the handled event should be reported to GDB. Previously it had only handled clone events, which were never reported. * using a new predicate in gdbserver to control handling of the fork event (and eventually all extended events) in linux_wait_1. The predicate, extended_event_reported, checks a target_waitstatus.kind for an extended ptrace event. * implementing a new RSP 'T' Stop Reply Packet stop reason: "fork", in gdbserver/remote-utils.c and remote.c. * implementing new target and RSP support for target_follow_fork with target extended-remote. (The RSP components were actually defined in patch 1, but they see their first use here). - remote target routine remote_follow_fork, which just sends the 'D;pid' detach packet to detach the new fork child cleanly. We can't just call target_detach because the data structures for the forked child have not been allocated on the host side. Tested on x64 Ubuntu Lucid, native, remote, extended-remote. gdb/gdbserver/ChangeLog: * linux-low.c (handle_extended_wait): Implement return value, rename argument 'event_child' to 'event_lwp', handle PTRACE_EVENT_FORK, call internal_error for unrecognized event. (linux_low_ptrace_options): New function. (linux_low_filter_event): Call linux_low_ptrace_options, use different argument fo linux_enable_event_reporting, use return value from handle_extended_wait. (extended_event_reported): New function. (linux_wait_1): Call extended_event_reported and set status to report fork events. (linux_write_memory): Add pid to debug message. (reset_lwp_ptrace_options_callback): New function. (linux_handle_new_gdb_connection): New function. (linux_target_ops): Initialize new structure member. * linux-low.h (struct lwp_info) <waitstatus>: New member. * lynx-low.c: Initialize new structure member. * remote-utils.c (prepare_resume_reply): Implement stop reason "fork" for "T" stop message. * server.c (handle_query): Call handle_new_gdb_connection. * server.h (report_fork_events): Declare global flag. * target.h (struct target_ops) <handle_new_gdb_connection>: New member. (target_handle_new_gdb_connection): New macro. * win32-low.c: Initialize new structure member. gdb/ChangeLog: * linux-nat.c (linux_nat_ptrace_options): New function. (linux_init_ptrace, wait_lwp, linux_nat_filter_event): Call linux_nat_ptrace_options and use different argument to linux_enable_event_reporting. (_initialize_linux_nat): Delete call to linux_ptrace_set_additional_flags. * nat/linux-ptrace.c (current_ptrace_options): Rename to supported_ptrace_options. (additional_flags): Delete variable. (linux_check_ptrace_features): Use supported_ptrace_options. (linux_test_for_tracesysgood, linux_test_for_tracefork): Likewise, and remove additional_flags check. (linux_enable_event_reporting): Change 'attached' argument to 'options'. Use supported_ptrace_options. (ptrace_supports_feature): Change comment. Use supported_ptrace_options. (linux_ptrace_set_additional_flags): Delete function. * nat/linux-ptrace.h (linux_ptrace_set_additional_flags): Delete function prototype. * remote.c (remote_fork_event_p): New function. (remote_detach_pid): New function. (remote_detach_1): Call remote_detach_pid, don't mourn inferior if doing detach-on-fork. (remote_follow_fork): New function. (remote_parse_stop_reply): Handle new "T" stop reason "fork". (remote_pid_to_str): Print "process" strings for pid/0/0 ptids. (init_extended_remote_ops): Initialize to_follow_fork.
2015-05-12 18:52:43 +02:00
struct target_waitstatus waitstatus;
gdbserver: Leave already-vCont-resumed threads as they were 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-26 17:17:25 +02:00
/* A pointer to the fork child/parent relative. Valid only while
the parent fork event is not reported to higher layers. Used to
avoid wildcard vCont actions resuming a fork child before GDB is
notified about the parent's fork event. */
struct lwp_info *fork_relative;
[gdbserver] linux-low.c: better starvation avoidance, handle non-stop mode too This patch applies the same starvation avoidance improvements of the previous patch to the Linux gdbserver side. Without this, the test added by the following commit (gdb.threads/non-stop-fair-events.exp) always fails with time outs. gdb/gdbserver/ 2015-01-09 Pedro Alves <palves@redhat.com> * linux-low.c (step_over_bkpt): Move higher up in the file. (handle_extended_wait): Don't store the stop_pc here. (get_stop_pc): Adjust comments and rename to ... (check_stopped_by_breakpoint): ... this. Record whether the LWP stopped for a software breakpoint or hardware breakpoint. (thread_still_has_status_pending_p): New function. (status_pending_p_callback): Use thread_still_has_status_pending_p. If the event is no longer interesting, resume the LWP. (handle_tracepoints): Add assert. (maybe_move_out_of_jump_pad): Remove cancel_breakpoints call. (wstatus_maybe_breakpoint): New function. (cancel_breakpoint): Delete function. (check_stopped_by_watchpoint): New function, factored out from linux_low_filter_event. (lp_status_maybe_breakpoint): Delete function. (linux_low_filter_event): Remove filter_ptid argument. Leave thread group exits pending here. Store the LWP's stop PC. Always leave events pending. (linux_wait_for_event_filtered): Pull all events out of the kernel, and leave them all pending. (count_events_callback, select_event_lwp_callback): Consider all events. (cancel_breakpoints_callback, linux_cancel_breakpoints): Delete. (select_event_lwp): Only give preference to the stepping LWP in all-stop mode. Adjust comments. (ignore_event): New function. (linux_wait_1): Delete 'retry' label. Use ignore_event. Remove references to cancel_breakpoints. Adjust to renames. Also give equal priority to all LWPs that have had events in non-stop mode. If reporting a software breakpoint event, unadjust the LWP's PC. (linux_wait): If linux_wait_1 returned an ignored event, retry. (stuck_in_jump_pad_callback, move_out_of_jump_pad_callback): Adjust. (linux_resume_one_lwp): Store the LWP's PC. Adjust. (resume_status_pending_p): Use thread_still_has_status_pending_p. (linux_stopped_by_watchpoint): Adjust. (linux_target_ops): Remove reference to linux_cancel_breakpoints. * linux-low.h (enum lwp_stop_reason): New. (struct lwp_info) <stop_pc>: Adjust comment. <stopped_by_watchpoint>: Delete field. <stop_reason>: New field. * linux-x86-low.c (x86_linux_prepare_to_resume): Adjust. * mem-break.c (software_breakpoint_inserted_here) (hardware_breakpoint_inserted_here): New function. * mem-break.h (software_breakpoint_inserted_here) (hardware_breakpoint_inserted_here): Declare. * target.h (struct target_ops) <cancel_breakpoints>: Remove field. (cancel_breakpoints): Delete. * tracepoint.c (clear_installed_tracepoints, stop_tracing) (upload_fast_traceframes): Remove references to cancel_breakpoints.
2014-12-29 20:41:07 +01:00
/* When stopped is set, this is where the lwp last stopped, with
decr_pc_after_break already accounted for. If the LWP is
running, this is the address at which the lwp was resumed. */
Teach linux gdbserver to step-over-breakpoints. * linux-low.c (can_hardware_single_step): New. (supports_breakpoints): New. (handle_extended_wait): If stopping threads, read the stop pc of the new cloned LWP. (get_pc): New. (get_stop_pc): Add `lwp' parameter. Handle it. Bail out if the low target doesn't support retrieving the PC. (add_lwp): Set last_resume_kind to resume_continue. (linux_attach_lwp_1): Adjust comments. Always set stop_expected. (linux_attach): Don't clear stop_expected. Set the lwp's last_resume_kind to resume_stop. (linux_detach_one_lwp): Don't check for removed breakpoints. (check_removed_breakpoint): Delete. (status_pending_p): Rename to ... (status_pending_p_callback): ... this. Don't check for removed breakpoints. Don't consider threads that are stopped from GDB's perspective. (linux_wait_for_lwp): Always read the stop_pc here. (cancel_breakpoint): New. (step_over_bkpt): New global. (linux_wait_for_event_1): Implement stepping over breakpoints. (gdb_wants_lwp_stopped): New. (gdb_wants_all_stopped): New. (linux_wait_1): Tag threads as gdb-wants-stopped. Cancel finished single-step traps here. Store the thread's last reported target wait status. (send_sigstop): Don't clear stop_expected. Always set it, instead. (mark_lwp_dead): Remove reference to pending_is_breakpoint. (cancel_finished_single_step): New. (cancel_finished_single_steps): New. (wait_for_sigstop): Don't cancel finished single-step traps here. (linux_resume_one_lwp): Don't check for removed breakpoints. Don't set `step' on non-hardware step archs. (linux_set_resume_request): Ignore resume_stop requests if already stopping or stopped. Set the lwp's last_resume_kind. (resume_status_pending_p): Don't check for removed breakpoints. (need_step_over_p): New. (start_step_over): New. (finish_step_over): New. (linux_resume_one_thread): Always queue a sigstop for resume_stop requests. Clear the thread's last reported target waitstatus. Don't use the `suspended' flag. Don't consider pending breakpoints. (linux_resume): Start a step-over if necessary. (proceed_one_lwp): New. (proceed_all_lwps): New. (unstop_all_lwps): New. * linux-low.h (struct lwp_info): Rewrite comment for the `suspended' flag. Add the `stop_pc' field. Delete the `pending_stop_pc' field. Tweak the `stepping' flag's comment. Add `'last_resume_kind' and `need_step_over' fields. * inferiors.c (struct thread_info): Delete, moved elsewhere. * mem-break.c (struct breakpoint): Delete `reinserting' flag. Delete `breakpoint_to_reinsert' field. New flag `inserted'. (set_raw_breakpoint_at): New. (set_breakpoint_at): Rewrite to use it. (reinsert_breakpoint_handler): Delete. (set_reinsert_breakpoint): New. (reinsert_breakpoint_by_bp): Delete. (delete_reinsert_breakpoints): New. (uninsert_breakpoint): Rewrite. (uninsert_breakpoints_at): New. (reinsert_breakpoint): Rewrite. (reinsert_breakpoints_at): New. (check_breakpoints): Rewrite. (breakpoint_here): New. (breakpoint_inserted_here): New. (check_mem_read): Adjust. * mem-break.h (breakpoints_supported, breakpoint_here) (breakpoint_inserted_here, set_reinsert_breakpoint): Declare. (reinsert_breakpoint_by_bp): Delete declaration. (delete_reinsert_breakpoints): Declare. (reinsert_breakpoint): Delete declaration. (reinsert_breakpoints_at): Declare. (uninsert_breakpoint): Delete declaration. (uninsert_breakpoints_at): Declare. (check_breakpoints): Adjust prototype. * server.h: Adjust include order. (struct thread_info): Declare here. Add a `last_status' field.
2010-03-24 01:05:03 +01:00
CORE_ADDR stop_pc;
2002-06-11 Daniel Jacobowitz <drow@mvista.com> * gdbserver/thread-db.c: New file. * gdbserver/proc-service.c: New file. * gdbserver/acinclude.m4: New file. * gdbserver/Makefile.in: Add GDBSERVER_LIBS, gdb_proc_service_h, proc-service.o, and thread-db.o. (linux-low.o): Add USE_THREAD_DB. * gdbserver/acconfig.h: Add HAVE_PRGREGSET_T, HAVE_PRFPREGSET_T, HAVE_LWPID_T, HAVE_PSADDR_T, and PRFPREGSET_T_BROKEN. * gdbserver/aclocal.m4: Regenerated. * gdbserver/config.in: Regenerated. * gdbserver/configure: Regenerated. * gdbserver/configure.in: Check for proc_service.h, sys/procfs.h, thread_db.h, and linux/elf.h headrs. Check for lwpid_t, psaddr_t, prgregset_t, prfpregset_t, and PRFPREGSET_T_BROKEN. Introduce srv_thread_depfiles and USE_THREAD_DB. Check for -lthread_db and thread support. * gdbserver/configure.srv: Enable thread_db support for ARM, i386, MIPS, PowerPC, and SuperH. * gdbserver/i387-fp.c: Constify arguments. * gdbserver/i387-fp.h: Likewise. * gdbserver/inferiors.c: (struct thread_info): Renamed from `struct inferior_info'. Remove PID member. Use generic inferior list header. All uses updated. (inferiors, signal_pid): Removed. (all_threads): New variable. (get_thread): Define. (add_inferior_to_list): New function. (for_each_inferior): New function. (change_inferior_id): New function. (add_inferior): Removed. (remove_inferior): New function. (add_thread): New function. (free_one_thread): New function. (remove_thread): New function. (clear_inferiors): Use for_each_inferior and free_one_thread. (find_inferior): New function. (find_inferior_id): New function. (inferior_target_data): Update argument type. (set_inferior_target_data): Likewise. (inferior_regcache_data): Likewise. (set_inferior_regcache_data): Likewise. * gdbserver/linux-low.c (linux_bp_reinsert): Remove. (all_processes, stopping_threads, using_thrads) (struct pending_signals, debug_threads, pid_of): New. (inferior_pid): Replace with macro. (struct inferior_linux_data): Remove. (get_stop_pc, add_process): New functions. (linux_create_inferior): Restore SIGRTMIN+1 before calling exec. Use add_process and add_thread. (linux_attach_lwp): New function, based on old linux_attach. Use add_process and add_thread. Set stop_expected for new threads. (linux_attach): New function. (linux_kill_one_process): New function. (linux_kill): Kill all LWPs. (linux_thread_alive): Use find_inferior_id. (check_removed_breakpoints, status_pending_p): New functions. (linux_wait_for_process): Renamed from linux_wait_for_one_inferior. Update. Use WNOHANG. Wait for cloned processes also. Update process struct for the found process. (linux_wait_for_event): New function. (linux_wait): Use it. Support LWPs. (send_sigstop, wait_for_sigstop, stop_all_processes) (linux_resume_one_process, linux_continue_one_process): New functions. (linux_resume): Support LWPs. (REGISTER_RAW_SIZE): Remove. (fetch_register): Use register_size instead. Call supply_register. (usr_store_inferior_registers): Likewise. Call collect_register. Fix recursive case. (regsets_fetch_inferior_registers): Improve error message. (regsets_store_inferior_registers): Add debugging. (linux_look_up_symbols): Call thread_db_init if USE_THREAD_DB. (unstopped_p, linux_signal_pid): New functions. (linux_target_ops): Add linux_signal_pid. (linux_init_signals): New function. (initialize_low): Call it. Initialize using_threads. * gdbserver/regcache.c (inferior_regcache_data): Add valid flag. (get_regcache): Fetch registers lazily. Add fetch argument and update all callers. (regcache_invalidate_one, regcache_invalidate): New functions. (new_register_cache): Renamed from create_register_cache. Return the new regcache. (free_register_cache): Change argument to a void *. (registers_to_string, registers_from_string): Call get_regcache with fetch flag set. (register_data): Make static. Pass fetch flag to get_regcache. (supply_register): Call get_regcache with fetch flag clear. (collect_register): Call get_regcache with fetch flag set. (collect_register_as_string): New function. * gdbserver/regcache.h: Update. * gdbserver/remote-utils.c (putpkt): Flush after debug output and use stderr. Handle input interrupts while waiting for an ACK. (input_interrupt): Use signal_pid method. (getpkt): Flush after debug output and use stderr. (outreg): Use collect_register_as_string. (new_thread_notify, dead_thread_notify): New functions. (prepare_resume_reply): Check using_threads. Set thread_from_wait and general_thread. (look_up_one_symbol): Flush after debug output. * gdbserver/server.c (step_thread, server_waiting): New variables. (start_inferior): Don't use signal_pid. Update call to mywait. (attach_inferior): Update call to mywait. (handle_query): Handle qfThreadInfo and qsThreadInfo. (main): Don't fetch/store registers explicitly. Use set_desired_inferior. Support proposed ``Hs'' packet. Update calls to mywait. * gdbserver/server.h: Update. (struct inferior_list, struct_inferior_list_entry): New. * gdbserver/target.c (set_desired_inferior): New. (write_inferior_memory): Constify. (mywait): New function. * gdbserver/target.h: Update. (struct target_ops): New signal_pid method. (mywait): Removed macro, added prototype. * gdbserver/linux-low.h (regset_func): Removed. (regset_fill_func, regset_store_func): New. (enum regset_type): New. (struct regset_info): Add type field. Use new operation types. (struct linux_target_ops): stop_pc renamed to get_pc. Add decr_pc_after_break and breakpoint_at. (get_process, get_thread_proess, get_process_thread) (strut process_info, all_processes, linux_attach_lwp) (thread_db_init): New. * gdbserver/linux-arm-low.c (arm_get_pc, arm_set_pc, arm_breakpoint, arm_breakpoint_len, arm_breakpoint_at): New. (the_low_target): Add new members. * gdbserver/linux-i386-low.c (i386_store_gregset, i386_store_fpregset) (i386_store_fpxregset): Constify. (target_regsets): Add new kind identifier. (i386_get_pc): Renamed from i386_stop_pc. Simplify. (i386_set_pc): Add debugging. (i386_breakpoint_at): New function. (the_low_target): Add new members. * gdbserver/linux-mips-low.c (mips_get_pc, mips_set_pc) (mips_breakpoint, mips_breakpoint_len, mips_reinsert_addr) (mips_breakpoint_at): New. (the_low_target): Add new members. * gdbserver/linux-ppc-low.c (ppc_get_pc, ppc_set_pc) (ppc_breakpoint, ppc_breakpoint_len, ppc_breakpoint_at): New. (the_low_target): Add new members. * gdbserver/linux-sh-low.c (sh_get_pc, sh_set_pc) (sh_breakpoint, sh_breakpoint_len, sh_breakpoint_at): New. (the_low_target): Add new members. * gdbserver/linux-x86-64-low.c (target_regsets): Add new kind identifier.
2002-06-11 19:32:40 +02:00
/* If this flag is set, STATUS_PENDING is a waitstatus that has not yet
been reported. */
int status_pending_p;
int status_pending;
[gdbserver] linux-low.c: better starvation avoidance, handle non-stop mode too This patch applies the same starvation avoidance improvements of the previous patch to the Linux gdbserver side. Without this, the test added by the following commit (gdb.threads/non-stop-fair-events.exp) always fails with time outs. gdb/gdbserver/ 2015-01-09 Pedro Alves <palves@redhat.com> * linux-low.c (step_over_bkpt): Move higher up in the file. (handle_extended_wait): Don't store the stop_pc here. (get_stop_pc): Adjust comments and rename to ... (check_stopped_by_breakpoint): ... this. Record whether the LWP stopped for a software breakpoint or hardware breakpoint. (thread_still_has_status_pending_p): New function. (status_pending_p_callback): Use thread_still_has_status_pending_p. If the event is no longer interesting, resume the LWP. (handle_tracepoints): Add assert. (maybe_move_out_of_jump_pad): Remove cancel_breakpoints call. (wstatus_maybe_breakpoint): New function. (cancel_breakpoint): Delete function. (check_stopped_by_watchpoint): New function, factored out from linux_low_filter_event. (lp_status_maybe_breakpoint): Delete function. (linux_low_filter_event): Remove filter_ptid argument. Leave thread group exits pending here. Store the LWP's stop PC. Always leave events pending. (linux_wait_for_event_filtered): Pull all events out of the kernel, and leave them all pending. (count_events_callback, select_event_lwp_callback): Consider all events. (cancel_breakpoints_callback, linux_cancel_breakpoints): Delete. (select_event_lwp): Only give preference to the stepping LWP in all-stop mode. Adjust comments. (ignore_event): New function. (linux_wait_1): Delete 'retry' label. Use ignore_event. Remove references to cancel_breakpoints. Adjust to renames. Also give equal priority to all LWPs that have had events in non-stop mode. If reporting a software breakpoint event, unadjust the LWP's PC. (linux_wait): If linux_wait_1 returned an ignored event, retry. (stuck_in_jump_pad_callback, move_out_of_jump_pad_callback): Adjust. (linux_resume_one_lwp): Store the LWP's PC. Adjust. (resume_status_pending_p): Use thread_still_has_status_pending_p. (linux_stopped_by_watchpoint): Adjust. (linux_target_ops): Remove reference to linux_cancel_breakpoints. * linux-low.h (enum lwp_stop_reason): New. (struct lwp_info) <stop_pc>: Adjust comment. <stopped_by_watchpoint>: Delete field. <stop_reason>: New field. * linux-x86-low.c (x86_linux_prepare_to_resume): Adjust. * mem-break.c (software_breakpoint_inserted_here) (hardware_breakpoint_inserted_here): New function. * mem-break.h (software_breakpoint_inserted_here) (hardware_breakpoint_inserted_here): Declare. * target.h (struct target_ops) <cancel_breakpoints>: Remove field. (cancel_breakpoints): Delete. * tracepoint.c (clear_installed_tracepoints, stop_tracing) (upload_fast_traceframes): Remove references to cancel_breakpoints.
2014-12-29 20:41:07 +01:00
/* The reason the LWP last stopped, if we need to track it
(breakpoint, watchpoint, etc.) */
enum target_stop_reason stop_reason;
/* On architectures where it is possible to know the data address of
a triggered watchpoint, STOPPED_DATA_ADDRESS is non-zero, and
contains such data address. Only valid if STOPPED_BY_WATCHPOINT
is true. */
CORE_ADDR stopped_data_address;
2002-06-11 Daniel Jacobowitz <drow@mvista.com> * gdbserver/thread-db.c: New file. * gdbserver/proc-service.c: New file. * gdbserver/acinclude.m4: New file. * gdbserver/Makefile.in: Add GDBSERVER_LIBS, gdb_proc_service_h, proc-service.o, and thread-db.o. (linux-low.o): Add USE_THREAD_DB. * gdbserver/acconfig.h: Add HAVE_PRGREGSET_T, HAVE_PRFPREGSET_T, HAVE_LWPID_T, HAVE_PSADDR_T, and PRFPREGSET_T_BROKEN. * gdbserver/aclocal.m4: Regenerated. * gdbserver/config.in: Regenerated. * gdbserver/configure: Regenerated. * gdbserver/configure.in: Check for proc_service.h, sys/procfs.h, thread_db.h, and linux/elf.h headrs. Check for lwpid_t, psaddr_t, prgregset_t, prfpregset_t, and PRFPREGSET_T_BROKEN. Introduce srv_thread_depfiles and USE_THREAD_DB. Check for -lthread_db and thread support. * gdbserver/configure.srv: Enable thread_db support for ARM, i386, MIPS, PowerPC, and SuperH. * gdbserver/i387-fp.c: Constify arguments. * gdbserver/i387-fp.h: Likewise. * gdbserver/inferiors.c: (struct thread_info): Renamed from `struct inferior_info'. Remove PID member. Use generic inferior list header. All uses updated. (inferiors, signal_pid): Removed. (all_threads): New variable. (get_thread): Define. (add_inferior_to_list): New function. (for_each_inferior): New function. (change_inferior_id): New function. (add_inferior): Removed. (remove_inferior): New function. (add_thread): New function. (free_one_thread): New function. (remove_thread): New function. (clear_inferiors): Use for_each_inferior and free_one_thread. (find_inferior): New function. (find_inferior_id): New function. (inferior_target_data): Update argument type. (set_inferior_target_data): Likewise. (inferior_regcache_data): Likewise. (set_inferior_regcache_data): Likewise. * gdbserver/linux-low.c (linux_bp_reinsert): Remove. (all_processes, stopping_threads, using_thrads) (struct pending_signals, debug_threads, pid_of): New. (inferior_pid): Replace with macro. (struct inferior_linux_data): Remove. (get_stop_pc, add_process): New functions. (linux_create_inferior): Restore SIGRTMIN+1 before calling exec. Use add_process and add_thread. (linux_attach_lwp): New function, based on old linux_attach. Use add_process and add_thread. Set stop_expected for new threads. (linux_attach): New function. (linux_kill_one_process): New function. (linux_kill): Kill all LWPs. (linux_thread_alive): Use find_inferior_id. (check_removed_breakpoints, status_pending_p): New functions. (linux_wait_for_process): Renamed from linux_wait_for_one_inferior. Update. Use WNOHANG. Wait for cloned processes also. Update process struct for the found process. (linux_wait_for_event): New function. (linux_wait): Use it. Support LWPs. (send_sigstop, wait_for_sigstop, stop_all_processes) (linux_resume_one_process, linux_continue_one_process): New functions. (linux_resume): Support LWPs. (REGISTER_RAW_SIZE): Remove. (fetch_register): Use register_size instead. Call supply_register. (usr_store_inferior_registers): Likewise. Call collect_register. Fix recursive case. (regsets_fetch_inferior_registers): Improve error message. (regsets_store_inferior_registers): Add debugging. (linux_look_up_symbols): Call thread_db_init if USE_THREAD_DB. (unstopped_p, linux_signal_pid): New functions. (linux_target_ops): Add linux_signal_pid. (linux_init_signals): New function. (initialize_low): Call it. Initialize using_threads. * gdbserver/regcache.c (inferior_regcache_data): Add valid flag. (get_regcache): Fetch registers lazily. Add fetch argument and update all callers. (regcache_invalidate_one, regcache_invalidate): New functions. (new_register_cache): Renamed from create_register_cache. Return the new regcache. (free_register_cache): Change argument to a void *. (registers_to_string, registers_from_string): Call get_regcache with fetch flag set. (register_data): Make static. Pass fetch flag to get_regcache. (supply_register): Call get_regcache with fetch flag clear. (collect_register): Call get_regcache with fetch flag set. (collect_register_as_string): New function. * gdbserver/regcache.h: Update. * gdbserver/remote-utils.c (putpkt): Flush after debug output and use stderr. Handle input interrupts while waiting for an ACK. (input_interrupt): Use signal_pid method. (getpkt): Flush after debug output and use stderr. (outreg): Use collect_register_as_string. (new_thread_notify, dead_thread_notify): New functions. (prepare_resume_reply): Check using_threads. Set thread_from_wait and general_thread. (look_up_one_symbol): Flush after debug output. * gdbserver/server.c (step_thread, server_waiting): New variables. (start_inferior): Don't use signal_pid. Update call to mywait. (attach_inferior): Update call to mywait. (handle_query): Handle qfThreadInfo and qsThreadInfo. (main): Don't fetch/store registers explicitly. Use set_desired_inferior. Support proposed ``Hs'' packet. Update calls to mywait. * gdbserver/server.h: Update. (struct inferior_list, struct_inferior_list_entry): New. * gdbserver/target.c (set_desired_inferior): New. (write_inferior_memory): Constify. (mywait): New function. * gdbserver/target.h: Update. (struct target_ops): New signal_pid method. (mywait): Removed macro, added prototype. * gdbserver/linux-low.h (regset_func): Removed. (regset_fill_func, regset_store_func): New. (enum regset_type): New. (struct regset_info): Add type field. Use new operation types. (struct linux_target_ops): stop_pc renamed to get_pc. Add decr_pc_after_break and breakpoint_at. (get_process, get_thread_proess, get_process_thread) (strut process_info, all_processes, linux_attach_lwp) (thread_db_init): New. * gdbserver/linux-arm-low.c (arm_get_pc, arm_set_pc, arm_breakpoint, arm_breakpoint_len, arm_breakpoint_at): New. (the_low_target): Add new members. * gdbserver/linux-i386-low.c (i386_store_gregset, i386_store_fpregset) (i386_store_fpxregset): Constify. (target_regsets): Add new kind identifier. (i386_get_pc): Renamed from i386_stop_pc. Simplify. (i386_set_pc): Add debugging. (i386_breakpoint_at): New function. (the_low_target): Add new members. * gdbserver/linux-mips-low.c (mips_get_pc, mips_set_pc) (mips_breakpoint, mips_breakpoint_len, mips_reinsert_addr) (mips_breakpoint_at): New. (the_low_target): Add new members. * gdbserver/linux-ppc-low.c (ppc_get_pc, ppc_set_pc) (ppc_breakpoint, ppc_breakpoint_len, ppc_breakpoint_at): New. (the_low_target): Add new members. * gdbserver/linux-sh-low.c (sh_get_pc, sh_set_pc) (sh_breakpoint, sh_breakpoint_len, sh_breakpoint_at): New. (the_low_target): Add new members. * gdbserver/linux-x86-64-low.c (target_regsets): Add new kind identifier.
2002-06-11 19:32:40 +02:00
/* If this is non-zero, it is a breakpoint to be reinserted at our next
stop (SIGTRAP stops only). */
CORE_ADDR bp_reinsert;
Teach linux gdbserver to step-over-breakpoints. * linux-low.c (can_hardware_single_step): New. (supports_breakpoints): New. (handle_extended_wait): If stopping threads, read the stop pc of the new cloned LWP. (get_pc): New. (get_stop_pc): Add `lwp' parameter. Handle it. Bail out if the low target doesn't support retrieving the PC. (add_lwp): Set last_resume_kind to resume_continue. (linux_attach_lwp_1): Adjust comments. Always set stop_expected. (linux_attach): Don't clear stop_expected. Set the lwp's last_resume_kind to resume_stop. (linux_detach_one_lwp): Don't check for removed breakpoints. (check_removed_breakpoint): Delete. (status_pending_p): Rename to ... (status_pending_p_callback): ... this. Don't check for removed breakpoints. Don't consider threads that are stopped from GDB's perspective. (linux_wait_for_lwp): Always read the stop_pc here. (cancel_breakpoint): New. (step_over_bkpt): New global. (linux_wait_for_event_1): Implement stepping over breakpoints. (gdb_wants_lwp_stopped): New. (gdb_wants_all_stopped): New. (linux_wait_1): Tag threads as gdb-wants-stopped. Cancel finished single-step traps here. Store the thread's last reported target wait status. (send_sigstop): Don't clear stop_expected. Always set it, instead. (mark_lwp_dead): Remove reference to pending_is_breakpoint. (cancel_finished_single_step): New. (cancel_finished_single_steps): New. (wait_for_sigstop): Don't cancel finished single-step traps here. (linux_resume_one_lwp): Don't check for removed breakpoints. Don't set `step' on non-hardware step archs. (linux_set_resume_request): Ignore resume_stop requests if already stopping or stopped. Set the lwp's last_resume_kind. (resume_status_pending_p): Don't check for removed breakpoints. (need_step_over_p): New. (start_step_over): New. (finish_step_over): New. (linux_resume_one_thread): Always queue a sigstop for resume_stop requests. Clear the thread's last reported target waitstatus. Don't use the `suspended' flag. Don't consider pending breakpoints. (linux_resume): Start a step-over if necessary. (proceed_one_lwp): New. (proceed_all_lwps): New. (unstop_all_lwps): New. * linux-low.h (struct lwp_info): Rewrite comment for the `suspended' flag. Add the `stop_pc' field. Delete the `pending_stop_pc' field. Tweak the `stepping' flag's comment. Add `'last_resume_kind' and `need_step_over' fields. * inferiors.c (struct thread_info): Delete, moved elsewhere. * mem-break.c (struct breakpoint): Delete `reinserting' flag. Delete `breakpoint_to_reinsert' field. New flag `inserted'. (set_raw_breakpoint_at): New. (set_breakpoint_at): Rewrite to use it. (reinsert_breakpoint_handler): Delete. (set_reinsert_breakpoint): New. (reinsert_breakpoint_by_bp): Delete. (delete_reinsert_breakpoints): New. (uninsert_breakpoint): Rewrite. (uninsert_breakpoints_at): New. (reinsert_breakpoint): Rewrite. (reinsert_breakpoints_at): New. (check_breakpoints): Rewrite. (breakpoint_here): New. (breakpoint_inserted_here): New. (check_mem_read): Adjust. * mem-break.h (breakpoints_supported, breakpoint_here) (breakpoint_inserted_here, set_reinsert_breakpoint): Declare. (reinsert_breakpoint_by_bp): Delete declaration. (delete_reinsert_breakpoints): Declare. (reinsert_breakpoint): Delete declaration. (reinsert_breakpoints_at): Declare. (uninsert_breakpoint): Delete declaration. (uninsert_breakpoints_at): Declare. (check_breakpoints): Adjust prototype. * server.h: Adjust include order. (struct thread_info): Declare here. Add a `last_status' field.
2010-03-24 01:05:03 +01:00
/* If this flag is set, the last continue operation at the ptrace
level on this process was a single-step. */
2002-06-11 Daniel Jacobowitz <drow@mvista.com> * gdbserver/thread-db.c: New file. * gdbserver/proc-service.c: New file. * gdbserver/acinclude.m4: New file. * gdbserver/Makefile.in: Add GDBSERVER_LIBS, gdb_proc_service_h, proc-service.o, and thread-db.o. (linux-low.o): Add USE_THREAD_DB. * gdbserver/acconfig.h: Add HAVE_PRGREGSET_T, HAVE_PRFPREGSET_T, HAVE_LWPID_T, HAVE_PSADDR_T, and PRFPREGSET_T_BROKEN. * gdbserver/aclocal.m4: Regenerated. * gdbserver/config.in: Regenerated. * gdbserver/configure: Regenerated. * gdbserver/configure.in: Check for proc_service.h, sys/procfs.h, thread_db.h, and linux/elf.h headrs. Check for lwpid_t, psaddr_t, prgregset_t, prfpregset_t, and PRFPREGSET_T_BROKEN. Introduce srv_thread_depfiles and USE_THREAD_DB. Check for -lthread_db and thread support. * gdbserver/configure.srv: Enable thread_db support for ARM, i386, MIPS, PowerPC, and SuperH. * gdbserver/i387-fp.c: Constify arguments. * gdbserver/i387-fp.h: Likewise. * gdbserver/inferiors.c: (struct thread_info): Renamed from `struct inferior_info'. Remove PID member. Use generic inferior list header. All uses updated. (inferiors, signal_pid): Removed. (all_threads): New variable. (get_thread): Define. (add_inferior_to_list): New function. (for_each_inferior): New function. (change_inferior_id): New function. (add_inferior): Removed. (remove_inferior): New function. (add_thread): New function. (free_one_thread): New function. (remove_thread): New function. (clear_inferiors): Use for_each_inferior and free_one_thread. (find_inferior): New function. (find_inferior_id): New function. (inferior_target_data): Update argument type. (set_inferior_target_data): Likewise. (inferior_regcache_data): Likewise. (set_inferior_regcache_data): Likewise. * gdbserver/linux-low.c (linux_bp_reinsert): Remove. (all_processes, stopping_threads, using_thrads) (struct pending_signals, debug_threads, pid_of): New. (inferior_pid): Replace with macro. (struct inferior_linux_data): Remove. (get_stop_pc, add_process): New functions. (linux_create_inferior): Restore SIGRTMIN+1 before calling exec. Use add_process and add_thread. (linux_attach_lwp): New function, based on old linux_attach. Use add_process and add_thread. Set stop_expected for new threads. (linux_attach): New function. (linux_kill_one_process): New function. (linux_kill): Kill all LWPs. (linux_thread_alive): Use find_inferior_id. (check_removed_breakpoints, status_pending_p): New functions. (linux_wait_for_process): Renamed from linux_wait_for_one_inferior. Update. Use WNOHANG. Wait for cloned processes also. Update process struct for the found process. (linux_wait_for_event): New function. (linux_wait): Use it. Support LWPs. (send_sigstop, wait_for_sigstop, stop_all_processes) (linux_resume_one_process, linux_continue_one_process): New functions. (linux_resume): Support LWPs. (REGISTER_RAW_SIZE): Remove. (fetch_register): Use register_size instead. Call supply_register. (usr_store_inferior_registers): Likewise. Call collect_register. Fix recursive case. (regsets_fetch_inferior_registers): Improve error message. (regsets_store_inferior_registers): Add debugging. (linux_look_up_symbols): Call thread_db_init if USE_THREAD_DB. (unstopped_p, linux_signal_pid): New functions. (linux_target_ops): Add linux_signal_pid. (linux_init_signals): New function. (initialize_low): Call it. Initialize using_threads. * gdbserver/regcache.c (inferior_regcache_data): Add valid flag. (get_regcache): Fetch registers lazily. Add fetch argument and update all callers. (regcache_invalidate_one, regcache_invalidate): New functions. (new_register_cache): Renamed from create_register_cache. Return the new regcache. (free_register_cache): Change argument to a void *. (registers_to_string, registers_from_string): Call get_regcache with fetch flag set. (register_data): Make static. Pass fetch flag to get_regcache. (supply_register): Call get_regcache with fetch flag clear. (collect_register): Call get_regcache with fetch flag set. (collect_register_as_string): New function. * gdbserver/regcache.h: Update. * gdbserver/remote-utils.c (putpkt): Flush after debug output and use stderr. Handle input interrupts while waiting for an ACK. (input_interrupt): Use signal_pid method. (getpkt): Flush after debug output and use stderr. (outreg): Use collect_register_as_string. (new_thread_notify, dead_thread_notify): New functions. (prepare_resume_reply): Check using_threads. Set thread_from_wait and general_thread. (look_up_one_symbol): Flush after debug output. * gdbserver/server.c (step_thread, server_waiting): New variables. (start_inferior): Don't use signal_pid. Update call to mywait. (attach_inferior): Update call to mywait. (handle_query): Handle qfThreadInfo and qsThreadInfo. (main): Don't fetch/store registers explicitly. Use set_desired_inferior. Support proposed ``Hs'' packet. Update calls to mywait. * gdbserver/server.h: Update. (struct inferior_list, struct_inferior_list_entry): New. * gdbserver/target.c (set_desired_inferior): New. (write_inferior_memory): Constify. (mywait): New function. * gdbserver/target.h: Update. (struct target_ops): New signal_pid method. (mywait): Removed macro, added prototype. * gdbserver/linux-low.h (regset_func): Removed. (regset_fill_func, regset_store_func): New. (enum regset_type): New. (struct regset_info): Add type field. Use new operation types. (struct linux_target_ops): stop_pc renamed to get_pc. Add decr_pc_after_break and breakpoint_at. (get_process, get_thread_proess, get_process_thread) (strut process_info, all_processes, linux_attach_lwp) (thread_db_init): New. * gdbserver/linux-arm-low.c (arm_get_pc, arm_set_pc, arm_breakpoint, arm_breakpoint_len, arm_breakpoint_at): New. (the_low_target): Add new members. * gdbserver/linux-i386-low.c (i386_store_gregset, i386_store_fpregset) (i386_store_fpxregset): Constify. (target_regsets): Add new kind identifier. (i386_get_pc): Renamed from i386_stop_pc. Simplify. (i386_set_pc): Add debugging. (i386_breakpoint_at): New function. (the_low_target): Add new members. * gdbserver/linux-mips-low.c (mips_get_pc, mips_set_pc) (mips_breakpoint, mips_breakpoint_len, mips_reinsert_addr) (mips_breakpoint_at): New. (the_low_target): Add new members. * gdbserver/linux-ppc-low.c (ppc_get_pc, ppc_set_pc) (ppc_breakpoint, ppc_breakpoint_len, ppc_breakpoint_at): New. (the_low_target): Add new members. * gdbserver/linux-sh-low.c (sh_get_pc, sh_set_pc) (sh_breakpoint, sh_breakpoint_len, sh_breakpoint_at): New. (the_low_target): Add new members. * gdbserver/linux-x86-64-low.c (target_regsets): Add new kind identifier.
2002-06-11 19:32:40 +02:00
int stepping;
range stepping: gdbserver (x86 GNU/Linux) This patch adds support for range stepping to GDBserver, teaching it about vCont;r. It'd be easy to enable this for all hardware single-step targets without needing the linux_target_ops hook, however, at least PPC needs special care, due to the fact that PPC atomic sequences can't be hardware single-stepped through, a thing which GDBserver doesn't know about. So this leaves the support limited to x86/x86_64. gdb/ 2013-05-23 Pedro Alves <palves@redhat.com> * NEWS: Mention GDBserver range stepping support. gdb/gdbserver/ 2013-05-23 Yao Qi <yao@codesourcery.com> Pedro Alves <palves@redhat.com> * linux-low.c (lwp_in_step_range): New function. (linux_wait_1): If the thread was range stepping and stopped outside the stepping range, report the stop to GDB. Otherwise, continue stepping. Add range stepping debug output. (linux_set_resume_request): Copy the step range from the resume request to the lwp. (linux_supports_range_stepping): New. (linux_target_ops) <supports_range_stepping>: Set to linux_supports_range_stepping. * linux-low.h (struct linux_target_ops) <supports_range_stepping>: New field. (struct lwp_info) <step_range_start, step_range_end>: New fields. * linux-x86-low.c (x86_supports_range_stepping): New. (the_low_target) <supports_range_stepping>: Set to x86_supports_range_stepping. * server.c (handle_v_cont): Handle 'r' action. (handle_v_requests): Append ";r" if the target supports range stepping. * target.h (struct thread_resume) <step_range_start, step_range_end>: New fields. (struct target_ops) <supports_range_stepping>: New field. (target_supports_range_stepping): New macro.
2013-05-23 19:17:50 +02:00
/* Range to single step within. This is a copy of the step range
passed along the last resume request. See 'struct
thread_resume'. */
CORE_ADDR step_range_start; /* Inclusive */
CORE_ADDR step_range_end; /* Exclusive */
/* If this flag is set, we need to set the event request flags the
next time we see this LWP stop. */
int must_set_ptrace_flags;
gdbserver/linux-low: use std::list to store pending signals Use std::list to store pending signals instead of a manually-managed linked list. This is a refactoring. In the existing code, pending signals are kept in a manually-created linked list with "prev" pointers. A new pending signal is thus inserted to the beginning of the list. When consuming, GDB goes until the end of the list, following the "prev" pointers, and processes the final item. With this patch, a new item is added to the end of the list and the item at the front of the list is consumed. In other words, the list elements used to be stored in reverse order; with this patch, they are stored in their order of arrival. This causes a change in the debug messages that print the pending signals. Otherwise, no behavioral change is expected. gdbserver/ChangeLog: 2020-06-22 Tankut Baris Aktemur <tankut.baris.aktemur@intel.com> Use std::list to stop pending signal instead of manually-created linked list. * linux-low.h: Include <list>. (struct pending_signal): Move here from linux-low.cc. (struct lwp_info) <pending_signals> <pending_signals_to_report>: Update the type. * linux-low.cc (struct pending_signals): Remove. (linux_process_target::delete_lwp) (linux_process_target::add_lwp) (enqueue_one_deferred_signal) (dequeue_one_deferred_signal) (enqueue_pending_signal) (linux_process_target::resume_one_lwp_throw) (linux_process_target::thread_needs_step_over) (linux_process_target::resume_one_thread) (linux_process_target::proceed_one_lwp): Update the use of pending signal list.
2020-06-22 14:13:48 +02:00
/* A chain of signals that need to be delivered to this process. */
std::list<pending_signal> pending_signals;
/* A link used when resuming. It is initialized from the resume request,
Rename "process" to "lwp" throughout. * linux-low.c (all_processes): Rename to... (all_lwps): ... this. (inferior_pid, handle_extended_wait, get_stop_pc): Adjust. (add_process): Rename to ... (add_lwp): ... this. Adjust. (linux_create_inferior): Adjust. (linux_attach_lwp): Adjust. (linux_attach): Adjust. (linux_kill_one_process): Rename to ... (linux_kill_one_lwp): ... this. Adjust. (linux_kill): Adjust. (linux_detach_one_process): Rename to ... (linux_detach_one_lwp): ... this. Adjust. (linux_detach): Adjust. (check_removed_breakpoint): Adjust. (status_pending_p): Adjust. (linux_wait_for_process): Rename to ... (linux_wait_for_lwp): ... this. Adjust. (linux_wait_for_event): Adjust. (send_sigstop): Adjust. (wait_for_sigstop): Adjust. (stop_all_processes): Rename to ... (stop_all_lwps): ... this. (linux_resume_one_process): Rename to ... (linux_resume_one_lwp): ... this. Adjust. (linux_set_resume_request, linux_continue_one_thread) (linux_queue_one_thread, resume_status_pending_p) (usr_store_inferior_registers, regsets_store_inferior_registers) (linux_request_interrupt, linux_read_offsets, linux_xfer_siginfo): Adjust. * linux-low.h (get_process): Rename to ... (get_lwp): ... this. Adjust. (get_thread_process): Rename to ... (get_thread_lwp): ... this. Adjust. (get_process_thread): Rename to ... (get_lwp_thread): ... this. Adjust. (struct process_info): Rename to ... (struct lwp_info): ... this. (all_processes): Rename to ... (all_lwps): ... this. * proc-service.c (ps_lgetregs): Adjust. * thread-db.c (thread_db_create_event, find_one_thread) (maybe_attach_thread, thread_db_get_tls_address): Adjust.
2009-03-17 21:25:35 +01:00
and then processed and cleared in linux_resume_one_lwp. */
struct thread_resume *resume;
/* Information bout this lwp's fast tracepoint collection status (is it
currently stopped in the jump pad, and if so, before or at/after the
relocated instruction). Normally, we won't care about this, but we will
if a signal arrives to this lwp while it is collecting. */
fast_tpoint_collect_result collecting_fast_tracepoint;
gdb/gdbserver/ 2010-06-01 Pedro Alves <pedro@codesourcery.com> Stan Shebs <stan@codesourcery.com> * Makefile.in (IPA_DEPFILES, extra_libraries): New. (all): Depend on $(extra_libraries). (install-only): Install the IPA. (IPA_OBJS, IPA_LIB): New. (clean): Remove the IPA lib. (IPAGENT_CFLAGS): New. (tracepoint-ipa.o, utils-ipa.o, remote-utils-ipa.o) (regcache-ipa.o, i386-linux-ipa.o, linux-i386-ipa.o) (linux-amd64-ipa.o, amd64-linux-ipa.o): New rules. * linux-amd64-ipa.c, linux-i386-ipa.c: New files. * configure.ac: Check for atomic builtins support in the compiler. (IPA_DEPFILES, extra_libraries): Define. * configure.srv (ipa_obj): Add description. (ipa_i386_linux_regobj, ipa_amd64_linux_regobj): Define. (i[34567]86-*-linux*): Set ipa_obj. (x86_64-*-linux*): Set ipa_obj. * linux-low.c (stabilizing_threads): New. (supports_fast_tracepoints): New. (linux_detach): Stabilize threads before detaching. (handle_tracepoints): Handle internal tracing breakpoints. Assert the lwp is either not stabilizing, or is moving out of a jump pad. (linux_fast_tracepoint_collecting): New. (maybe_move_out_of_jump_pad): New. (enqueue_one_deferred_signal): New. (dequeue_one_deferred_signal): New. (linux_wait_for_event_1): If moving out of a jump pad, defer pending signals to later. (linux_stabilize_threads): New. (linux_wait_1): Check if threads need moving out of jump pads, and do it if so. (stuck_in_jump_pad_callback): New. (move_out_of_jump_pad_callback): New. (lwp_running): New. (linux_resume_one_lwp): Handle moving out of jump pads. (linux_set_resume_request): Dequeue deferred signals. (need_step_over_p): Also step over fast tracepoint jumps. (start_step_over): Also uninsert fast tracepoint jumps. (finish_step_over): Also reinsert fast tracepoint jumps. (linux_install_fast_tracepoint_jump): New. (linux_target_ops): Install linux_stabilize_threads and linux_install_fast_tracepoint_jump_pad. * linux-low.h (linux_target_ops) <get_thread_area, install_fast_tracepoint_jump_pad>: New fields. (struct lwp_info) <collecting_fast_tracepoint, pending_signals_to_report, exit_jump_pad_bkpt>: New fields. (linux_get_thread_area): Declare. * linux-x86-low.c (jump_insn): New. (x86_get_thread_area): New. (append_insns): New. (push_opcode): New. (amd64_install_fast_tracepoint_jump_pad): New. (i386_install_fast_tracepoint_jump_pad): New. (x86_install_fast_tracepoint_jump_pad): New. (the_low_target): Install x86_get_thread_area and x86_install_fast_tracepoint_jump_pad. * mem-break.c (set_raw_breakpoint_at): Use read_inferior_memory. (struct fast_tracepoint_jump): New. (fast_tracepoint_jump_insn): New. (fast_tracepoint_jump_shadow): New. (find_fast_tracepoint_jump_at): New. (fast_tracepoint_jump_here): New. (delete_fast_tracepoint_jump): New. (set_fast_tracepoint_jump): New. (uninsert_fast_tracepoint_jumps_at): New. (reinsert_fast_tracepoint_jumps_at): New. (set_breakpoint_at): Use write_inferior_memory. (uninsert_raw_breakpoint): Use write_inferior_memory. (check_mem_read): Mask out fast tracepoint jumps. (check_mem_write): Mask out fast tracepoint jumps. * mem-break.h (struct fast_tracepoint_jump): Forward declare. (set_fast_tracepoint_jump): Declare. (delete_fast_tracepoint_jump) (fast_tracepoint_jump_here, uninsert_fast_tracepoint_jumps_at) (reinsert_fast_tracepoint_jumps_at): Declare. * regcache.c: Don't compile many functions when building the in-process agent library. (init_register_cache) [IN_PROCESS_AGENT]: Don't allow allocating the register buffer in the heap. (free_register_cache): If the register buffer isn't owned by the regcache, don't free it. (set_register_cache) [IN_PROCESS_AGENT]: Don't re-alocate pre-existing register caches. * remote-utils.c (convert_int_to_ascii): Constify `from' parameter type. (convert_ascii_to_int): : Constify `from' parameter type. (decode_M_packet, decode_X_packet): Replace the `to' parameter by a `to_p' pointer to pointer parameter. If TO_P is NULL, malloc the needed buffer in-place. (relocate_instruction): New. * server.c (handle_query) <qSymbols>: If the target supports tracepoints, give it a chance of looking up symbols. Report support for fast tracepoints. (handle_status): Stabilize threads. (process_serial_event): Adjust. * server.h (struct fast_tracepoint_jump): Forward declare. (struct process_info) <fast_tracepoint_jumps>: New field. (convert_ascii_to_int, convert_int_to_ascii): Adjust. (decode_X_packet, decode_M_packet): Adjust. (relocate_instruction): Declare. (in_process_agent_loaded): Declare. (tracepoint_look_up_symbols): Declare. (struct fast_tpoint_collect_status): Declare. (fast_tracepoint_collecting): Declare. (force_unlock_trace_buffer): Declare. (handle_tracepoint_bkpts): Declare. (initialize_low_tracepoint) (supply_fast_tracepoint_registers) [IN_PROCESS_AGENT]: Declare. * target.h (struct target_ops) <stabilize_threads, install_fast_tracepoint_jump_pad>: New fields. (stabilize_threads, install_fast_tracepoint_jump_pad): New. * tracepoint.c [HAVE_MALLOC_H]: Include malloc.h. [HAVE_STDINT_H]: Include stdint.h. (trace_debug_1): Rename to ... (trace_vdebug): ... this. (trace_debug): Rename to ... (trace_debug_1): ... this. Add `level' parameter. (trace_debug): New. (ATTR_USED, ATTR_NOINLINE): New. (IP_AGENT_EXPORT): New. (gdb_tp_heap_buffer, gdb_jump_pad_buffer, gdb_jump_pad_buffer_end) (collecting, gdb_collect, stop_tracing, flush_trace_buffer) (about_to_request_buffer_space, trace_buffer_is_full) (stopping_tracepoint, expr_eval_result, error_tracepoint) (tracepoints, tracing, trace_buffer_ctrl, trace_buffer_ctrl_curr) (trace_buffer_lo, trace_buffer_hi, traceframe_read_count) (traceframe_write_count, traceframes_created) (trace_state_variables) New renaming defines. (struct ipa_sym_addresses): New. (STRINGIZE_1, STRINGIZE, IPA_SYM): New. (symbol_list): New. (ipa_sym_addrs): New. (all_tracepoint_symbols_looked_up): New. (in_process_agent_loaded): New. (write_e_ipa_not_loaded): New. (maybe_write_ipa_not_loaded): New. (tracepoint_look_up_symbols): New. (debug_threads) [IN_PROCESS_AGENT]: New. (read_inferior_memory) [IN_PROCESS_AGENT]: New. (UNKNOWN_SIDE_EFFECTS): New. (stop_tracing): New. (flush_trace_buffer): New. (stop_tracing_bkpt): New. (flush_trace_buffer_bkpt): New. (read_inferior_integer): New. (read_inferior_uinteger): New. (read_inferior_data_pointer): New. (write_inferior_data_pointer): New. (write_inferior_integer): New. (write_inferior_uinteger): New. (struct collect_static_trace_data_action): Delete. (enum tracepoint_type): New. (struct tracepoint) <type>: New field `type'. <actions_str, step_actions, step_actions_str>: Only include in GDBserver. <orig_size, obj_addr_on_target, adjusted_insn_addr> <adjusted_insn_addr_end, jump_pad, jump_pad_end>: New fields. (tracepoints): Use IP_AGENT_EXPORT. (last_tracepoint): Don't include in the IPA. (stopping_tracepoint): Use IP_AGENT_EXPORT. (trace_buffer_is_full): Use IP_AGENT_EXPORT. (alloced_trace_state_variables): New. (trace_state_variables): Use IP_AGENT_EXPORT. (traceframe_t): Delete unused variable. (circular_trace_buffer): Don't include in the IPA. (trace_buffer_start): Delete. (struct trace_buffer_control): New. (trace_buffer_free): Delete. (struct ipa_trace_buffer_control): New. (GDBSERVER_FLUSH_COUNT_MASK, GDBSERVER_FLUSH_COUNT_MASK_PREV) (GDBSERVER_FLUSH_COUNT_MASK_CURR, GDBSERVER_UPDATED_FLUSH_COUNT_BIT): New. (trace_buffer_ctrl): New. (TRACE_BUFFER_CTRL_CURR): New. (trace_buffer_start, trace_buffer_free, trace_buffer_end_free): Reimplement as macros. (trace_buffer_wrap): Delete. (traceframe_write_count, traceframe_read_count) (traceframes_created, tracing): Use IP_AGENT_EXPORT. (struct tracepoint_hit_ctx) <type>: New field. (struct fast_tracepoint_ctx): New. (memory_barrier): New. (cmpxchg): New. (record_tracepoint_error): Update atomically in the IPA. (clear_inferior_trace_buffer): New. (about_to_request_buffer_space): New. (trace_buffer_alloc): Handle GDBserver and inferior simulatenous updating the same buffer. (add_tracepoint): Default the tracepoint's type to trap tracepoint, and orig_size to -1. (get_trace_state_variable) [IN_PROCESS_AGENT]: Handle allocated internal variables. (create_trace_state_variable): New parameter `gdb'. Handle it. (clear_installed_tracepoints): Clear fast tracepoint jumps. (cmd_qtdp): Handle fast tracepoints. (cmd_qtdv): Adjust. (max_jump_pad_size): New. (gdb_jump_pad_head): New. (get_jump_space_head): New. (claim_jump_space): New. (sort_tracepoints): New. (MAX_JUMP_SIZE): New. (cmd_qtstart): Handle fast tracepoints. Sync tracepoints with the IPA. (stop_tracing) [IN_PROCESS_AGENT]: Don't include the tdisconnected support. Upload fast traceframes, and delete internal IPA breakpoints. (stop_tracing_handler): New. (flush_trace_buffer_handler): New. (cmd_qtstop): Upload fast tracepoints. (response_tracepoint): Handle fast tracepoints. (tracepoint_finished_step): Upload fast traceframes. Set the tracepoint hit context's tracepoint type. (handle_tracepoint_bkpts): New. (tracepoint_was_hit): Set the tracepoint hit context's tracepoint type. Add comment about fast tracepoints. (collect_data_at_tracepoint) [IN_PROCESS_AGENT]: Don't access the non-existing action_str field. (get_context_regcache): Handle fast tracepoints. (do_action_at_tracepoint) [!IN_PROCESS_AGENT]: Don't write the PC to the regcache. (fast_tracepoint_from_jump_pad_address): New. (fast_tracepoint_from_ipa_tpoint_address): New. (collecting_t): New. (force_unlock_trace_buffer): New. (fast_tracepoint_collecting): New. (collecting): New. (gdb_collect): New. (write_inferior_data_ptr): New. (target_tp_heap): New. (target_malloc): New. (download_agent_expr): New. (UALIGN): New. (download_tracepoints): New. (download_trace_state_variables): New. (upload_fast_traceframes): New. (IPA_FIRST_TRACEFRAME): New. (IPA_NEXT_TRACEFRAME_1): New. (IPA_NEXT_TRACEFRAME): New. [IN_PROCESS_AGENT]: Include sys/mman.h and fcntl.h. [IN_PROCESS_AGENT] (gdb_tp_heap_buffer, gdb_jump_pad_buffer) (gdb_jump_pad_buffer_end): New. [IN_PROCESS_AGENT] (initialize_tracepoint_ftlib): New. (initialize_tracepoint): Adjust. [IN_PROCESS_AGENT]: Allocate the IPA heap, and jump pad scratch buffer. Initialize the low module. * utils.c (PREFIX, TOOLNAME): New. (malloc_failure): Use PREFIX. (error): In the IPA, an error causes an exit. (fatal, warning): Use PREFIX. (internal_error): Use TOOLNAME. (NUMCELLS): Increase to 10. * configure, config.in: Regenerate. gdb/ 2010-06-01 Pedro Alves <pedro@codesourcery.com> * NEWS: Mention gdbserver fast tracepoints support. gdb/doc/ 2010-06-01 Pedro Alves <pedro@codesourcery.com> * gdb.texinfo (Set Tracepoints): Mention tracepoints support in gdbserver, and add cross reference. (Tracepoints support in gdbserver): New subsection.
2010-06-01 15:20:52 +02:00
gdbserver/linux-low: use std::list to store pending signals Use std::list to store pending signals instead of a manually-managed linked list. This is a refactoring. In the existing code, pending signals are kept in a manually-created linked list with "prev" pointers. A new pending signal is thus inserted to the beginning of the list. When consuming, GDB goes until the end of the list, following the "prev" pointers, and processes the final item. With this patch, a new item is added to the end of the list and the item at the front of the list is consumed. In other words, the list elements used to be stored in reverse order; with this patch, they are stored in their order of arrival. This causes a change in the debug messages that print the pending signals. Otherwise, no behavioral change is expected. gdbserver/ChangeLog: 2020-06-22 Tankut Baris Aktemur <tankut.baris.aktemur@intel.com> Use std::list to stop pending signal instead of manually-created linked list. * linux-low.h: Include <list>. (struct pending_signal): Move here from linux-low.cc. (struct lwp_info) <pending_signals> <pending_signals_to_report>: Update the type. * linux-low.cc (struct pending_signals): Remove. (linux_process_target::delete_lwp) (linux_process_target::add_lwp) (enqueue_one_deferred_signal) (dequeue_one_deferred_signal) (enqueue_pending_signal) (linux_process_target::resume_one_lwp_throw) (linux_process_target::thread_needs_step_over) (linux_process_target::resume_one_thread) (linux_process_target::proceed_one_lwp): Update the use of pending signal list.
2020-06-22 14:13:48 +02:00
/* A chain of signals that need to be reported to GDB. These were
deferred because the thread was doing a fast tracepoint collect
when they arrived. */
std::list<pending_signal> pending_signals_to_report;
gdb/gdbserver/ 2010-06-01 Pedro Alves <pedro@codesourcery.com> Stan Shebs <stan@codesourcery.com> * Makefile.in (IPA_DEPFILES, extra_libraries): New. (all): Depend on $(extra_libraries). (install-only): Install the IPA. (IPA_OBJS, IPA_LIB): New. (clean): Remove the IPA lib. (IPAGENT_CFLAGS): New. (tracepoint-ipa.o, utils-ipa.o, remote-utils-ipa.o) (regcache-ipa.o, i386-linux-ipa.o, linux-i386-ipa.o) (linux-amd64-ipa.o, amd64-linux-ipa.o): New rules. * linux-amd64-ipa.c, linux-i386-ipa.c: New files. * configure.ac: Check for atomic builtins support in the compiler. (IPA_DEPFILES, extra_libraries): Define. * configure.srv (ipa_obj): Add description. (ipa_i386_linux_regobj, ipa_amd64_linux_regobj): Define. (i[34567]86-*-linux*): Set ipa_obj. (x86_64-*-linux*): Set ipa_obj. * linux-low.c (stabilizing_threads): New. (supports_fast_tracepoints): New. (linux_detach): Stabilize threads before detaching. (handle_tracepoints): Handle internal tracing breakpoints. Assert the lwp is either not stabilizing, or is moving out of a jump pad. (linux_fast_tracepoint_collecting): New. (maybe_move_out_of_jump_pad): New. (enqueue_one_deferred_signal): New. (dequeue_one_deferred_signal): New. (linux_wait_for_event_1): If moving out of a jump pad, defer pending signals to later. (linux_stabilize_threads): New. (linux_wait_1): Check if threads need moving out of jump pads, and do it if so. (stuck_in_jump_pad_callback): New. (move_out_of_jump_pad_callback): New. (lwp_running): New. (linux_resume_one_lwp): Handle moving out of jump pads. (linux_set_resume_request): Dequeue deferred signals. (need_step_over_p): Also step over fast tracepoint jumps. (start_step_over): Also uninsert fast tracepoint jumps. (finish_step_over): Also reinsert fast tracepoint jumps. (linux_install_fast_tracepoint_jump): New. (linux_target_ops): Install linux_stabilize_threads and linux_install_fast_tracepoint_jump_pad. * linux-low.h (linux_target_ops) <get_thread_area, install_fast_tracepoint_jump_pad>: New fields. (struct lwp_info) <collecting_fast_tracepoint, pending_signals_to_report, exit_jump_pad_bkpt>: New fields. (linux_get_thread_area): Declare. * linux-x86-low.c (jump_insn): New. (x86_get_thread_area): New. (append_insns): New. (push_opcode): New. (amd64_install_fast_tracepoint_jump_pad): New. (i386_install_fast_tracepoint_jump_pad): New. (x86_install_fast_tracepoint_jump_pad): New. (the_low_target): Install x86_get_thread_area and x86_install_fast_tracepoint_jump_pad. * mem-break.c (set_raw_breakpoint_at): Use read_inferior_memory. (struct fast_tracepoint_jump): New. (fast_tracepoint_jump_insn): New. (fast_tracepoint_jump_shadow): New. (find_fast_tracepoint_jump_at): New. (fast_tracepoint_jump_here): New. (delete_fast_tracepoint_jump): New. (set_fast_tracepoint_jump): New. (uninsert_fast_tracepoint_jumps_at): New. (reinsert_fast_tracepoint_jumps_at): New. (set_breakpoint_at): Use write_inferior_memory. (uninsert_raw_breakpoint): Use write_inferior_memory. (check_mem_read): Mask out fast tracepoint jumps. (check_mem_write): Mask out fast tracepoint jumps. * mem-break.h (struct fast_tracepoint_jump): Forward declare. (set_fast_tracepoint_jump): Declare. (delete_fast_tracepoint_jump) (fast_tracepoint_jump_here, uninsert_fast_tracepoint_jumps_at) (reinsert_fast_tracepoint_jumps_at): Declare. * regcache.c: Don't compile many functions when building the in-process agent library. (init_register_cache) [IN_PROCESS_AGENT]: Don't allow allocating the register buffer in the heap. (free_register_cache): If the register buffer isn't owned by the regcache, don't free it. (set_register_cache) [IN_PROCESS_AGENT]: Don't re-alocate pre-existing register caches. * remote-utils.c (convert_int_to_ascii): Constify `from' parameter type. (convert_ascii_to_int): : Constify `from' parameter type. (decode_M_packet, decode_X_packet): Replace the `to' parameter by a `to_p' pointer to pointer parameter. If TO_P is NULL, malloc the needed buffer in-place. (relocate_instruction): New. * server.c (handle_query) <qSymbols>: If the target supports tracepoints, give it a chance of looking up symbols. Report support for fast tracepoints. (handle_status): Stabilize threads. (process_serial_event): Adjust. * server.h (struct fast_tracepoint_jump): Forward declare. (struct process_info) <fast_tracepoint_jumps>: New field. (convert_ascii_to_int, convert_int_to_ascii): Adjust. (decode_X_packet, decode_M_packet): Adjust. (relocate_instruction): Declare. (in_process_agent_loaded): Declare. (tracepoint_look_up_symbols): Declare. (struct fast_tpoint_collect_status): Declare. (fast_tracepoint_collecting): Declare. (force_unlock_trace_buffer): Declare. (handle_tracepoint_bkpts): Declare. (initialize_low_tracepoint) (supply_fast_tracepoint_registers) [IN_PROCESS_AGENT]: Declare. * target.h (struct target_ops) <stabilize_threads, install_fast_tracepoint_jump_pad>: New fields. (stabilize_threads, install_fast_tracepoint_jump_pad): New. * tracepoint.c [HAVE_MALLOC_H]: Include malloc.h. [HAVE_STDINT_H]: Include stdint.h. (trace_debug_1): Rename to ... (trace_vdebug): ... this. (trace_debug): Rename to ... (trace_debug_1): ... this. Add `level' parameter. (trace_debug): New. (ATTR_USED, ATTR_NOINLINE): New. (IP_AGENT_EXPORT): New. (gdb_tp_heap_buffer, gdb_jump_pad_buffer, gdb_jump_pad_buffer_end) (collecting, gdb_collect, stop_tracing, flush_trace_buffer) (about_to_request_buffer_space, trace_buffer_is_full) (stopping_tracepoint, expr_eval_result, error_tracepoint) (tracepoints, tracing, trace_buffer_ctrl, trace_buffer_ctrl_curr) (trace_buffer_lo, trace_buffer_hi, traceframe_read_count) (traceframe_write_count, traceframes_created) (trace_state_variables) New renaming defines. (struct ipa_sym_addresses): New. (STRINGIZE_1, STRINGIZE, IPA_SYM): New. (symbol_list): New. (ipa_sym_addrs): New. (all_tracepoint_symbols_looked_up): New. (in_process_agent_loaded): New. (write_e_ipa_not_loaded): New. (maybe_write_ipa_not_loaded): New. (tracepoint_look_up_symbols): New. (debug_threads) [IN_PROCESS_AGENT]: New. (read_inferior_memory) [IN_PROCESS_AGENT]: New. (UNKNOWN_SIDE_EFFECTS): New. (stop_tracing): New. (flush_trace_buffer): New. (stop_tracing_bkpt): New. (flush_trace_buffer_bkpt): New. (read_inferior_integer): New. (read_inferior_uinteger): New. (read_inferior_data_pointer): New. (write_inferior_data_pointer): New. (write_inferior_integer): New. (write_inferior_uinteger): New. (struct collect_static_trace_data_action): Delete. (enum tracepoint_type): New. (struct tracepoint) <type>: New field `type'. <actions_str, step_actions, step_actions_str>: Only include in GDBserver. <orig_size, obj_addr_on_target, adjusted_insn_addr> <adjusted_insn_addr_end, jump_pad, jump_pad_end>: New fields. (tracepoints): Use IP_AGENT_EXPORT. (last_tracepoint): Don't include in the IPA. (stopping_tracepoint): Use IP_AGENT_EXPORT. (trace_buffer_is_full): Use IP_AGENT_EXPORT. (alloced_trace_state_variables): New. (trace_state_variables): Use IP_AGENT_EXPORT. (traceframe_t): Delete unused variable. (circular_trace_buffer): Don't include in the IPA. (trace_buffer_start): Delete. (struct trace_buffer_control): New. (trace_buffer_free): Delete. (struct ipa_trace_buffer_control): New. (GDBSERVER_FLUSH_COUNT_MASK, GDBSERVER_FLUSH_COUNT_MASK_PREV) (GDBSERVER_FLUSH_COUNT_MASK_CURR, GDBSERVER_UPDATED_FLUSH_COUNT_BIT): New. (trace_buffer_ctrl): New. (TRACE_BUFFER_CTRL_CURR): New. (trace_buffer_start, trace_buffer_free, trace_buffer_end_free): Reimplement as macros. (trace_buffer_wrap): Delete. (traceframe_write_count, traceframe_read_count) (traceframes_created, tracing): Use IP_AGENT_EXPORT. (struct tracepoint_hit_ctx) <type>: New field. (struct fast_tracepoint_ctx): New. (memory_barrier): New. (cmpxchg): New. (record_tracepoint_error): Update atomically in the IPA. (clear_inferior_trace_buffer): New. (about_to_request_buffer_space): New. (trace_buffer_alloc): Handle GDBserver and inferior simulatenous updating the same buffer. (add_tracepoint): Default the tracepoint's type to trap tracepoint, and orig_size to -1. (get_trace_state_variable) [IN_PROCESS_AGENT]: Handle allocated internal variables. (create_trace_state_variable): New parameter `gdb'. Handle it. (clear_installed_tracepoints): Clear fast tracepoint jumps. (cmd_qtdp): Handle fast tracepoints. (cmd_qtdv): Adjust. (max_jump_pad_size): New. (gdb_jump_pad_head): New. (get_jump_space_head): New. (claim_jump_space): New. (sort_tracepoints): New. (MAX_JUMP_SIZE): New. (cmd_qtstart): Handle fast tracepoints. Sync tracepoints with the IPA. (stop_tracing) [IN_PROCESS_AGENT]: Don't include the tdisconnected support. Upload fast traceframes, and delete internal IPA breakpoints. (stop_tracing_handler): New. (flush_trace_buffer_handler): New. (cmd_qtstop): Upload fast tracepoints. (response_tracepoint): Handle fast tracepoints. (tracepoint_finished_step): Upload fast traceframes. Set the tracepoint hit context's tracepoint type. (handle_tracepoint_bkpts): New. (tracepoint_was_hit): Set the tracepoint hit context's tracepoint type. Add comment about fast tracepoints. (collect_data_at_tracepoint) [IN_PROCESS_AGENT]: Don't access the non-existing action_str field. (get_context_regcache): Handle fast tracepoints. (do_action_at_tracepoint) [!IN_PROCESS_AGENT]: Don't write the PC to the regcache. (fast_tracepoint_from_jump_pad_address): New. (fast_tracepoint_from_ipa_tpoint_address): New. (collecting_t): New. (force_unlock_trace_buffer): New. (fast_tracepoint_collecting): New. (collecting): New. (gdb_collect): New. (write_inferior_data_ptr): New. (target_tp_heap): New. (target_malloc): New. (download_agent_expr): New. (UALIGN): New. (download_tracepoints): New. (download_trace_state_variables): New. (upload_fast_traceframes): New. (IPA_FIRST_TRACEFRAME): New. (IPA_NEXT_TRACEFRAME_1): New. (IPA_NEXT_TRACEFRAME): New. [IN_PROCESS_AGENT]: Include sys/mman.h and fcntl.h. [IN_PROCESS_AGENT] (gdb_tp_heap_buffer, gdb_jump_pad_buffer) (gdb_jump_pad_buffer_end): New. [IN_PROCESS_AGENT] (initialize_tracepoint_ftlib): New. (initialize_tracepoint): Adjust. [IN_PROCESS_AGENT]: Allocate the IPA heap, and jump pad scratch buffer. Initialize the low module. * utils.c (PREFIX, TOOLNAME): New. (malloc_failure): Use PREFIX. (error): In the IPA, an error causes an exit. (fatal, warning): Use PREFIX. (internal_error): Use TOOLNAME. (NUMCELLS): Increase to 10. * configure, config.in: Regenerate. gdb/ 2010-06-01 Pedro Alves <pedro@codesourcery.com> * NEWS: Mention gdbserver fast tracepoints support. gdb/doc/ 2010-06-01 Pedro Alves <pedro@codesourcery.com> * gdb.texinfo (Set Tracepoints): Mention tracepoints support in gdbserver, and add cross reference. (Tracepoints support in gdbserver): New subsection.
2010-06-01 15:20:52 +02:00
/* When collecting_fast_tracepoint is first found to be 1, we insert
a exit-jump-pad-quickly breakpoint. This is it. */
struct breakpoint *exit_jump_pad_bkpt;
Fix remaining GDBserver issues with !HAVE_THREAD_DB_H. The previous patches are still not sufficient to build gdbserver with our copy of thread_db.h. ../../../src/gdb/gdbserver/thread-db.c: In function ‘find_one_thread’: ../../../src/gdb/gdbserver/thread-db.c:316:6: error: ‘struct lwp_info’ has no member named ‘th’ ../../../src/gdb/gdbserver/thread-db.c: In function ‘attach_thread’: ../../../src/gdb/gdbserver/thread-db.c:341:6: error: ‘struct lwp_info’ has no member named ‘th’ ../../../src/gdb/gdbserver/thread-db.c: In function ‘thread_db_get_tls_address’: ../../../src/gdb/gdbserver/thread-db.c:514:47: error: ‘struct lwp_info’ has no member named ‘th’ make: *** [thread-db.o] Error 1 First, linux-low.h is including <thread_db.h> directly instead of our gdb_thread_db.h, although thread-db.c includes the latter. Then the 'th' field of struct lwp_info is only defined if HAVE_THREAD_DB_H is defined, which is not true if we're using our replacement copy of thread_db.h. We have a USE_THREAD_DB symbol defined if we're building thread-db.c that's ideal for this, however, it's currently only defined when compiling linux-low.c (through a Makefile rule). The patch makes it defined when compiling any file. gdb/gdbserver/ 2013-04-16 Pedro Alves <palves@redhat.com> * Makefile.in (INTERNAL_CFLAGS): Add @USE_THREAD_DB@. (linux-low.o): Delete rule. * linux-low.h: Always include "gdb_thread_db.h" instead of conditionally including thread_db.h. (struct lwp_info) <th>: Guard with #ifdef USE_THREAD_DB instead of HAVE_THREAD_DB_H.
2013-04-16 20:20:40 +02:00
#ifdef USE_THREAD_DB
int thread_known;
* inferiors.c (change_inferior_id): Delete. (add_pid_to_list, pull_pid_from_list): New. * linux-low.c (PTRACE_SETOPTIONS, PTRACE_GETEVENTMSG) (PTRACE_O_TRACESYSGOOD, PTRACE_O_TRACEFORK, PTRACE_O_TRACEVFORK) (PTRACE_O_TRACECLONE, PTRACE_O_TRACEEXEC, PTRACE_O_TRACEVFORKDONE) (PTRACE_O_TRACEEXIT, PTRACE_EVENT_FORK, PTRACE_EVENT_VFORK) (PTRACE_EVENT_CLONE, PTRACE_EVENT_EXEC, PTRACE_EVENT_VFORK_DONE) (PTRACE_EVENT_EXIT, __WALL): Provide default definitions. (stopped_pids, thread_db_active, must_set_ptrace_flags): New variables. (using_threads): Always set to 1. (handle_extended_wait): New. (add_process): Do not set TID. (linux_create_inferior): Set must_set_ptrace_flags. (linux_attach_lwp): Remove TID argument. Do not check using_threads. Use PTRACE_SETOPTIONS. Call new_thread_notify. Update all callers. (linux_thread_alive): Rename TID argument to LWPID. (linux_wait_for_process): Handle unknown processes. Do not use TID. (linux_wait_for_event): Do not use TID or check using_threads. Update call to dead_thread_notify. Call handle_extended_wait. (linux_create_inferior): Use PTRACE_SETOPTIONS. (send_sigstop): Delete sigstop_sent. (wait_for_sigstop): Avoid TID. (linux_supports_tracefork_flag, linux_tracefork_child, my_waitpid) (linux_test_for_tracefork): New. (linux_lookup_signals): Use thread_db_active and linux_supports_tracefork_flag. (initialize_low): Use thread_db_active and linux_test_for_tracefork. * linux-low.h (get_process_thread): Avoid TID. (struct process_ifo): Move thread_known and tid to the end. Remove sigstop_sent. (linux_attach_lwp, thread_db_init): Update prototypes. * server.h (change_inferior_id): Delete prototype. (add_pid_to_list, pull_pid_from_list): New prototypes. * thread-db.c (thread_db_use_events): New. (find_first_thread): Rename to... (find_one_thread): ...this. Update callers and messages. Do not call fatal. Check thread_db_use_events. Do not call change_inferior_id or new_thread_notify. (maybe_attach_thread): Update. Do not call new_thread_notify. (thread_db_init): Set thread_db_use_events. Check use_events. * utils.c (fatal, warning): Correct message prefix.
2007-10-23 22:05:03 +02:00
/* The thread handle, used for e.g. TLS access. Only valid if
THREAD_KNOWN is set. */
td_thrhandle_t th;
Add thread_handle_to_thread_info support for remote targets This patch adds support to remote targets for converting a thread handle to a thread_info struct pointer. A thread handle is fetched via a "handle" attribute which has been added to the qXfer:threads:read query packet. An implementation is provided in gdbserver for targets using the Linux kernel. gdb/gdbserver/ChangeLog: * linux-low.h (struct lwp_info): Add new field, thread_handle. (thread_db_thread_handle): Declare. * linux-low.c (linux_target_ops): Initialize thread_handle. * server.c (handle_qxfer_threads_worker): Add support for "handle" attribute. * target.h (struct target_ops): Add new function pointer, thread_handle. (target_thread_handle): Define. * thread-db.c (find_one_thread, attach_thread): Set thread_handle field in lwp. (thread_db_thread_handle): New function. gdb/ChangeLog: * remote.c (vector): Include. (struct private_thread_info): Add field, thread_handle. (free_private_thread_info): Deallocate storage associated with thread handle. (get_private_info_thread): Initialize `thread_handle' field. (struct thread_item): Add field, thread_handle. (clear_threads_listing_context): Deallocate storage associated with thread handle. (start_thread): Add support for "handle" attribute. (thread_attributes): Add "handle". (remote_get_threads_with_qthreadinfo): Initialize thread_handle field. (remote_update_thread_list): Update thread_handle. (remote_thread_handle_to_thread_info): New function. (init_remote_ops): Initialize to_thread_handle_to_thread_info.
2017-04-05 01:17:05 +02:00
/* The pthread_t handle. */
thread_t thread_handle;
#endif
Add h/w watchpoint support to x86-linux, win32-i386. * Makefile.in (SFILES): Add i386-low.c (i386_low_h): Define. (i386-low.o): Add dependencies. (linux-x86-low.o): Add i386-low.h dependency. (win32-i386-low.o): Ditto. * i386-low.c: New file. * i386-low.h: New file. * configure.srv (i[34567]86-*-cygwin*): Add i386-low.o to srv_tgtobj. (i[34567]86-*-linux*, i[34567]86-*-mingw*, x86_64-*-linux*): Ditto. * linux-low.c (linux_add_process): Initialize arch_private. (linux_remove_process): Free arch_private. (add_lwp): Initialize arch_private. (delete_lwp): Free arch_private. (linux_resume_one_lwp): Call the_low_target.prepare_to_resume if provided. * linux-low.h (process_info_private): New member arch_private. (lwp_info): New member arch_private. (linux_target_ops): New members new_process, new_thread, prepare_to_resume. (ptid_of): New macro. * linux-x86-low.c: Include stddef.h, i386-low.h. (arch_process_info): New struct. (arch_lwp_info): New struct. (x86_linux_dr_get, x86_linux_dr_set): New functions. (i386_dr_low_set_addr, i386_dr_low_set_control): New functions. (i386_dr_low_get_status): New function. (x86_insert_point, x86_remove_point): New functions. (x86_stopped_by_watchpoint): New function. (x86_stopped_data_address): New function. (x86_linux_new_process, x86_linux_new_thread): New functions. (x86_linux_prepare_to_resume): New function. (the_low_target): Add entries for insert_point, remove_point, stopped_by_watchpoint, stopped_data_address, new_process, new_thread, prepare_to_resume. * server.c (debug_hw_points): New global. (monitor_show_help): Document set debug-hw-points. (handle_query): Process "set debug-hw-points". * server.h (debug_hw_points): Declare. (paddress): Declare. * utils.c (NUMCELLS, CELLSIZE): New macros. (get_sell, xsnprintf, paddress): New functions. * win32-arm-low.c (the_low_target): Add entries for insert_point, remove_point, stopped_by_watchpoint, stopped_data_address. * win32-i386-low.c: Include i386-low.h. (debug_reg_state): Replaces dr. (i386_dr_low_set_addr, i386_dr_low_set_control): New functions. (i386_dr_low_get_status): New function. (i386_insert_point, i386_remove_point): New functions. (i386_stopped_by_watchpoint): New function. (i386_stopped_data_address): New function. (i386_initial_stuff): Update. (get_thread_context,set_thread_context,i386_thread_added): Update. (the_low_target): Add entries for insert_point, remove_point, stopped_by_watchpoint, stopped_data_address. * win32-low.c (win32_insert_watchpoint): New function. (win32_remove_watchpoint): New function. (win32_stopped_by_watchpoint): New function. (win32_stopped_data_address): New function. (win32_target_ops): Add entries for insert_watchpoint, remove_watchpoint, stopped_by_watchpoint, stopped_data_address. * win32-low.h (win32_target_ops): New members insert_point, remove_point, stopped_by_watchpoint, stopped_data_address.
2009-06-30 18:35:25 +02:00
/* Arch-specific additions. */
struct arch_lwp_info *arch_private;
2002-06-11 Daniel Jacobowitz <drow@mvista.com> * gdbserver/thread-db.c: New file. * gdbserver/proc-service.c: New file. * gdbserver/acinclude.m4: New file. * gdbserver/Makefile.in: Add GDBSERVER_LIBS, gdb_proc_service_h, proc-service.o, and thread-db.o. (linux-low.o): Add USE_THREAD_DB. * gdbserver/acconfig.h: Add HAVE_PRGREGSET_T, HAVE_PRFPREGSET_T, HAVE_LWPID_T, HAVE_PSADDR_T, and PRFPREGSET_T_BROKEN. * gdbserver/aclocal.m4: Regenerated. * gdbserver/config.in: Regenerated. * gdbserver/configure: Regenerated. * gdbserver/configure.in: Check for proc_service.h, sys/procfs.h, thread_db.h, and linux/elf.h headrs. Check for lwpid_t, psaddr_t, prgregset_t, prfpregset_t, and PRFPREGSET_T_BROKEN. Introduce srv_thread_depfiles and USE_THREAD_DB. Check for -lthread_db and thread support. * gdbserver/configure.srv: Enable thread_db support for ARM, i386, MIPS, PowerPC, and SuperH. * gdbserver/i387-fp.c: Constify arguments. * gdbserver/i387-fp.h: Likewise. * gdbserver/inferiors.c: (struct thread_info): Renamed from `struct inferior_info'. Remove PID member. Use generic inferior list header. All uses updated. (inferiors, signal_pid): Removed. (all_threads): New variable. (get_thread): Define. (add_inferior_to_list): New function. (for_each_inferior): New function. (change_inferior_id): New function. (add_inferior): Removed. (remove_inferior): New function. (add_thread): New function. (free_one_thread): New function. (remove_thread): New function. (clear_inferiors): Use for_each_inferior and free_one_thread. (find_inferior): New function. (find_inferior_id): New function. (inferior_target_data): Update argument type. (set_inferior_target_data): Likewise. (inferior_regcache_data): Likewise. (set_inferior_regcache_data): Likewise. * gdbserver/linux-low.c (linux_bp_reinsert): Remove. (all_processes, stopping_threads, using_thrads) (struct pending_signals, debug_threads, pid_of): New. (inferior_pid): Replace with macro. (struct inferior_linux_data): Remove. (get_stop_pc, add_process): New functions. (linux_create_inferior): Restore SIGRTMIN+1 before calling exec. Use add_process and add_thread. (linux_attach_lwp): New function, based on old linux_attach. Use add_process and add_thread. Set stop_expected for new threads. (linux_attach): New function. (linux_kill_one_process): New function. (linux_kill): Kill all LWPs. (linux_thread_alive): Use find_inferior_id. (check_removed_breakpoints, status_pending_p): New functions. (linux_wait_for_process): Renamed from linux_wait_for_one_inferior. Update. Use WNOHANG. Wait for cloned processes also. Update process struct for the found process. (linux_wait_for_event): New function. (linux_wait): Use it. Support LWPs. (send_sigstop, wait_for_sigstop, stop_all_processes) (linux_resume_one_process, linux_continue_one_process): New functions. (linux_resume): Support LWPs. (REGISTER_RAW_SIZE): Remove. (fetch_register): Use register_size instead. Call supply_register. (usr_store_inferior_registers): Likewise. Call collect_register. Fix recursive case. (regsets_fetch_inferior_registers): Improve error message. (regsets_store_inferior_registers): Add debugging. (linux_look_up_symbols): Call thread_db_init if USE_THREAD_DB. (unstopped_p, linux_signal_pid): New functions. (linux_target_ops): Add linux_signal_pid. (linux_init_signals): New function. (initialize_low): Call it. Initialize using_threads. * gdbserver/regcache.c (inferior_regcache_data): Add valid flag. (get_regcache): Fetch registers lazily. Add fetch argument and update all callers. (regcache_invalidate_one, regcache_invalidate): New functions. (new_register_cache): Renamed from create_register_cache. Return the new regcache. (free_register_cache): Change argument to a void *. (registers_to_string, registers_from_string): Call get_regcache with fetch flag set. (register_data): Make static. Pass fetch flag to get_regcache. (supply_register): Call get_regcache with fetch flag clear. (collect_register): Call get_regcache with fetch flag set. (collect_register_as_string): New function. * gdbserver/regcache.h: Update. * gdbserver/remote-utils.c (putpkt): Flush after debug output and use stderr. Handle input interrupts while waiting for an ACK. (input_interrupt): Use signal_pid method. (getpkt): Flush after debug output and use stderr. (outreg): Use collect_register_as_string. (new_thread_notify, dead_thread_notify): New functions. (prepare_resume_reply): Check using_threads. Set thread_from_wait and general_thread. (look_up_one_symbol): Flush after debug output. * gdbserver/server.c (step_thread, server_waiting): New variables. (start_inferior): Don't use signal_pid. Update call to mywait. (attach_inferior): Update call to mywait. (handle_query): Handle qfThreadInfo and qsThreadInfo. (main): Don't fetch/store registers explicitly. Use set_desired_inferior. Support proposed ``Hs'' packet. Update calls to mywait. * gdbserver/server.h: Update. (struct inferior_list, struct_inferior_list_entry): New. * gdbserver/target.c (set_desired_inferior): New. (write_inferior_memory): Constify. (mywait): New function. * gdbserver/target.h: Update. (struct target_ops): New signal_pid method. (mywait): Removed macro, added prototype. * gdbserver/linux-low.h (regset_func): Removed. (regset_fill_func, regset_store_func): New. (enum regset_type): New. (struct regset_info): Add type field. Use new operation types. (struct linux_target_ops): stop_pc renamed to get_pc. Add decr_pc_after_break and breakpoint_at. (get_process, get_thread_proess, get_process_thread) (strut process_info, all_processes, linux_attach_lwp) (thread_db_init): New. * gdbserver/linux-arm-low.c (arm_get_pc, arm_set_pc, arm_breakpoint, arm_breakpoint_len, arm_breakpoint_at): New. (the_low_target): Add new members. * gdbserver/linux-i386-low.c (i386_store_gregset, i386_store_fpregset) (i386_store_fpxregset): Constify. (target_regsets): Add new kind identifier. (i386_get_pc): Renamed from i386_stop_pc. Simplify. (i386_set_pc): Add debugging. (i386_breakpoint_at): New function. (the_low_target): Add new members. * gdbserver/linux-mips-low.c (mips_get_pc, mips_set_pc) (mips_breakpoint, mips_breakpoint_len, mips_reinsert_addr) (mips_breakpoint_at): New. (the_low_target): Add new members. * gdbserver/linux-ppc-low.c (ppc_get_pc, ppc_set_pc) (ppc_breakpoint, ppc_breakpoint_len, ppc_breakpoint_at): New. (the_low_target): Add new members. * gdbserver/linux-sh-low.c (sh_get_pc, sh_set_pc) (sh_breakpoint, sh_breakpoint_len, sh_breakpoint_at): New. (the_low_target): Add new members. * gdbserver/linux-x86-64-low.c (target_regsets): Add new kind identifier.
2002-06-11 19:32:40 +02:00
};
int linux_pid_exe_is_elf_64_file (int pid, unsigned int *machine);
PR server/16255: gdbserver cannot attach to a second inferior that is multi-threaded. On Linux, we need to explicitly ptrace attach to all lwps of a process. Because GDB might not be connected yet when an attach is requested, and thus it may not be possible to activate thread_db, as that requires access to symbols (IOW, gdbserver --attach), a while ago we make linux_attach loop over the lwps as listed by /proc/PID/task to find the lwps to attach to. linux_attach_lwp_1 has: ... if (initial) /* If lwp is the tgid, we handle adding existing threads later. Otherwise we just add lwp without bothering about any other threads. */ ptid = ptid_build (lwpid, lwpid, 0); else { /* Note that extracting the pid from the current inferior is safe, since we're always called in the context of the same process as this new thread. */ int pid = pid_of (current_inferior); ptid = ptid_build (pid, lwpid, 0); } That "safe" comment referred to linux_attach_lwp being called by thread-db.c. But this was clearly missed when a new call to linux_attach_lwp_1 was added to linux_attach. As a result, current_inferior will be set to some random process, and non-initial lwps of the second inferior get assigned the pid of the wrong inferior. E.g., in the case of attaching to two inferiors, for the second inferior (and so on), non-initial lwps of the second inferior get assigned the pid of the first inferior. This doesn't trigger on the first inferior, when current_inferior is NULL, add_thread switches the current inferior to the newly added thread. Rather than making linux_attach switch current_inferior temporarily (thus avoiding further reliance on global state), or making linux_attach_lwp_1 get the tgid from /proc, which add extra syscalls, and will be wrong in case of the user having originally attached directly to a non-tgid lwp, and then that lwp spawning new clones (the ptid.pid field of further new clones should be the same as the original lwp's pid, which is not the tgid), we note that callers of linux_attach_lwp/linux_attach_lwp_1 always have the right pid handy already, so they can pass it down along with the lwpid. The only other reason for the "initial" parameter is to error out instead of warn in case of attach failure, when we're first attaching to a process. There are only three callers of linux_attach_lwp/linux_attach_lwp_1, and each wants to print a different warn/error string, so we can just move the error/warn out of linux_attach_lwp_1 to the callers, thus getting rid of the "initial" parameter. There really nothing gdbserver-specific about attaching to two threaded processes, so this adds a new test under gdb.multi/. The test passes cleanly against the native GNU/Linux target, but fails/triggers the bug against GDBserver (before the patch), with the native-extended-remote board (as plain remote doesn't support multi-process). Tested on x86_64 Fedora 17, with the native-extended-gdbserver board. gdb/gdbserver/ 2014-04-25 Pedro Alves <palves@redhat.com> PR server/16255 * linux-low.c (linux_attach_fail_reason_string): New function. (linux_attach_lwp): Delete. (linux_attach_lwp_1): Rename to ... (linux_attach_lwp): ... this. Take a ptid instead of a pid as argument. Remove "initial" parameter. Return int instead of void. Don't error or warn here. (linux_attach): Adjust to call linux_attach_lwp. Call error on failure to attach to the tgid. Call warning when failing to attach to an lwp. * linux-low.h (linux_attach_lwp): Take a ptid instead of a pid as argument. Remove "initial" parameter. Return int instead of void. Don't error or warn here. (linux_attach_fail_reason_string): New declaration. * thread-db.c (attach_thread): Adjust to linux_attach_lwp's interface change. Use linux_attach_fail_reason_string. gdb/ 2014-04-25 Pedro Alves <palves@redhat.com> PR server/16255 * common/linux-ptrace.c (linux_ptrace_attach_warnings): Rename to ... (linux_ptrace_attach_fail_reason): ... this. Remove "warning: " and newline from built string. * common/linux-ptrace.h (linux_ptrace_attach_warnings): Rename to ... (linux_ptrace_attach_fail_reason): ... this. * linux-nat.c (linux_nat_attach): Adjust to use linux_ptrace_attach_fail_reason. gdb/testsuite/ 2014-04-25 Simon Marchi <simon.marchi@ericsson.com> Pedro Alves <palves@redhat.com> PR server/16255 * gdb.multi/multi-attach.c: New file. * gdb.multi/multi-attach.exp: New file.
2014-04-25 20:07:33 +02:00
/* Attach to PTID. Returns 0 on success, non-zero otherwise (an
errno). */
int linux_attach_lwp (ptid_t ptid);
struct lwp_info *find_lwp_pid (ptid_t ptid);
/* For linux_stop_lwp see nat/linux-nat.h. */
2002-06-11 Daniel Jacobowitz <drow@mvista.com> * gdbserver/thread-db.c: New file. * gdbserver/proc-service.c: New file. * gdbserver/acinclude.m4: New file. * gdbserver/Makefile.in: Add GDBSERVER_LIBS, gdb_proc_service_h, proc-service.o, and thread-db.o. (linux-low.o): Add USE_THREAD_DB. * gdbserver/acconfig.h: Add HAVE_PRGREGSET_T, HAVE_PRFPREGSET_T, HAVE_LWPID_T, HAVE_PSADDR_T, and PRFPREGSET_T_BROKEN. * gdbserver/aclocal.m4: Regenerated. * gdbserver/config.in: Regenerated. * gdbserver/configure: Regenerated. * gdbserver/configure.in: Check for proc_service.h, sys/procfs.h, thread_db.h, and linux/elf.h headrs. Check for lwpid_t, psaddr_t, prgregset_t, prfpregset_t, and PRFPREGSET_T_BROKEN. Introduce srv_thread_depfiles and USE_THREAD_DB. Check for -lthread_db and thread support. * gdbserver/configure.srv: Enable thread_db support for ARM, i386, MIPS, PowerPC, and SuperH. * gdbserver/i387-fp.c: Constify arguments. * gdbserver/i387-fp.h: Likewise. * gdbserver/inferiors.c: (struct thread_info): Renamed from `struct inferior_info'. Remove PID member. Use generic inferior list header. All uses updated. (inferiors, signal_pid): Removed. (all_threads): New variable. (get_thread): Define. (add_inferior_to_list): New function. (for_each_inferior): New function. (change_inferior_id): New function. (add_inferior): Removed. (remove_inferior): New function. (add_thread): New function. (free_one_thread): New function. (remove_thread): New function. (clear_inferiors): Use for_each_inferior and free_one_thread. (find_inferior): New function. (find_inferior_id): New function. (inferior_target_data): Update argument type. (set_inferior_target_data): Likewise. (inferior_regcache_data): Likewise. (set_inferior_regcache_data): Likewise. * gdbserver/linux-low.c (linux_bp_reinsert): Remove. (all_processes, stopping_threads, using_thrads) (struct pending_signals, debug_threads, pid_of): New. (inferior_pid): Replace with macro. (struct inferior_linux_data): Remove. (get_stop_pc, add_process): New functions. (linux_create_inferior): Restore SIGRTMIN+1 before calling exec. Use add_process and add_thread. (linux_attach_lwp): New function, based on old linux_attach. Use add_process and add_thread. Set stop_expected for new threads. (linux_attach): New function. (linux_kill_one_process): New function. (linux_kill): Kill all LWPs. (linux_thread_alive): Use find_inferior_id. (check_removed_breakpoints, status_pending_p): New functions. (linux_wait_for_process): Renamed from linux_wait_for_one_inferior. Update. Use WNOHANG. Wait for cloned processes also. Update process struct for the found process. (linux_wait_for_event): New function. (linux_wait): Use it. Support LWPs. (send_sigstop, wait_for_sigstop, stop_all_processes) (linux_resume_one_process, linux_continue_one_process): New functions. (linux_resume): Support LWPs. (REGISTER_RAW_SIZE): Remove. (fetch_register): Use register_size instead. Call supply_register. (usr_store_inferior_registers): Likewise. Call collect_register. Fix recursive case. (regsets_fetch_inferior_registers): Improve error message. (regsets_store_inferior_registers): Add debugging. (linux_look_up_symbols): Call thread_db_init if USE_THREAD_DB. (unstopped_p, linux_signal_pid): New functions. (linux_target_ops): Add linux_signal_pid. (linux_init_signals): New function. (initialize_low): Call it. Initialize using_threads. * gdbserver/regcache.c (inferior_regcache_data): Add valid flag. (get_regcache): Fetch registers lazily. Add fetch argument and update all callers. (regcache_invalidate_one, regcache_invalidate): New functions. (new_register_cache): Renamed from create_register_cache. Return the new regcache. (free_register_cache): Change argument to a void *. (registers_to_string, registers_from_string): Call get_regcache with fetch flag set. (register_data): Make static. Pass fetch flag to get_regcache. (supply_register): Call get_regcache with fetch flag clear. (collect_register): Call get_regcache with fetch flag set. (collect_register_as_string): New function. * gdbserver/regcache.h: Update. * gdbserver/remote-utils.c (putpkt): Flush after debug output and use stderr. Handle input interrupts while waiting for an ACK. (input_interrupt): Use signal_pid method. (getpkt): Flush after debug output and use stderr. (outreg): Use collect_register_as_string. (new_thread_notify, dead_thread_notify): New functions. (prepare_resume_reply): Check using_threads. Set thread_from_wait and general_thread. (look_up_one_symbol): Flush after debug output. * gdbserver/server.c (step_thread, server_waiting): New variables. (start_inferior): Don't use signal_pid. Update call to mywait. (attach_inferior): Update call to mywait. (handle_query): Handle qfThreadInfo and qsThreadInfo. (main): Don't fetch/store registers explicitly. Use set_desired_inferior. Support proposed ``Hs'' packet. Update calls to mywait. * gdbserver/server.h: Update. (struct inferior_list, struct_inferior_list_entry): New. * gdbserver/target.c (set_desired_inferior): New. (write_inferior_memory): Constify. (mywait): New function. * gdbserver/target.h: Update. (struct target_ops): New signal_pid method. (mywait): Removed macro, added prototype. * gdbserver/linux-low.h (regset_func): Removed. (regset_fill_func, regset_store_func): New. (enum regset_type): New. (struct regset_info): Add type field. Use new operation types. (struct linux_target_ops): stop_pc renamed to get_pc. Add decr_pc_after_break and breakpoint_at. (get_process, get_thread_proess, get_process_thread) (strut process_info, all_processes, linux_attach_lwp) (thread_db_init): New. * gdbserver/linux-arm-low.c (arm_get_pc, arm_set_pc, arm_breakpoint, arm_breakpoint_len, arm_breakpoint_at): New. (the_low_target): Add new members. * gdbserver/linux-i386-low.c (i386_store_gregset, i386_store_fpregset) (i386_store_fpxregset): Constify. (target_regsets): Add new kind identifier. (i386_get_pc): Renamed from i386_stop_pc. Simplify. (i386_set_pc): Add debugging. (i386_breakpoint_at): New function. (the_low_target): Add new members. * gdbserver/linux-mips-low.c (mips_get_pc, mips_set_pc) (mips_breakpoint, mips_breakpoint_len, mips_reinsert_addr) (mips_breakpoint_at): New. (the_low_target): Add new members. * gdbserver/linux-ppc-low.c (ppc_get_pc, ppc_set_pc) (ppc_breakpoint, ppc_breakpoint_len, ppc_breakpoint_at): New. (the_low_target): Add new members. * gdbserver/linux-sh-low.c (sh_get_pc, sh_set_pc) (sh_breakpoint, sh_breakpoint_len, sh_breakpoint_at): New. (the_low_target): Add new members. * gdbserver/linux-x86-64-low.c (target_regsets): Add new kind identifier.
2002-06-11 19:32:40 +02:00
[GDBserver] Multi-process + multi-arch This patch makes GDBserver support multi-process + biarch. Currently, if you're debugging more than one process at once with a single gdbserver (in extended-remote mode), then all processes must have the same architecture (e.g., 64-bit vs 32-bit). Otherwise, you see this: Added inferior 2 [Switching to inferior 2 [<null>] (<noexec>)] Reading symbols from /home/pedro/gdb/tests/main32...done. Temporary breakpoint 2 at 0x4004cf: main. (2 locations) Starting program: /home/pedro/gdb/tests/main32 warning: Selected architecture i386 is not compatible with reported target architecture i386:x86-64 warning: Architecture rejected target-supplied description Remote 'g' packet reply is too long: 000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000090cfffff0000000000000000000000000000000000000000000000000000000000020000000000000000000000000000000000000000000000000000000000000000000000000000b042f7460000000000020000230000002b0000002b0000002b000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000007f03000000000000ffff0000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000801f00003b0000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000 ... etc, etc ... Even though the process was running a 32-bit program, GDBserver sent back to GDB a register set in 64-bit layout. A patch (http://sourceware.org/ml/gdb-patches/2012-11/msg00228.html) a while ago made GDB track a target_gdbarch per inferior, and as consequence, fetch a target description per-inferior. This patch is the GDBserver counterpart, that makes GDBserver keep track of each process'es XML target description and register layout. So in the example above, GDBserver will send the correct register set in 32-bit layout to GDB. A new "struct target_desc" object (tdesc for short) is added, that holds the target description and register layout information about each process. Each `struct process_info' holds a pointer to a target description. The regcache also gains a pointer to a target description, mainly for convenience, and parallel with GDB (and possible future support for programs that flip processor modes). The low target's arch_setup routines are responsible for setting the process'es correct tdesc. This isn't that much different to how things were done before, except that instead of detecting the inferior process'es architecture and calling the corresponding init_registers_FOO routine, which would change the regcache layout globals and recreate the threads' regcaches, the regcache.c globals are gone, and the init_registers_$BAR routines now each initialize a separate global struct target_desc object (one for each arch variant GDBserver supports), and so all the init_registers_$BAR routines that are built into GDBserver are called early at GDBserver startup time (similarly to how GDB handles its built-in target descriptions), and then the arch_setup routine is responsible for making process_info->tdesc point to one of these target description globals. The regcache module is all parameterized to get the regcache's layout from the tdesc object instead of the old register_bytes, etc. globals. The threads' regcaches are now created lazily. The old scheme where we created each of them when we added a new thread doesn't work anymore, because we add the main thread/lwp before we see it stop for the first time, and it is only when we see the thread stop for the first time that we have a chance of determining the inferior's architecture (through the_low_target.arch_setup). Therefore when we add the main thread we don't know which architecture/tdesc its regcache should have. This patch makes the gdb.multi/multi-arch.exp test now pass against (extended-remote) GDBserver. It currently fails, without this patch. The IPA also uses the regcache, so it gains a new global struct target_desc pointer, which points at the description of the process it is loaded in. Re. the linux-low.c & friends changes. Since the register map etc. may differ between processes (64-bit vs 32-bit) etc., the linux_target_ops num_regs, regmap and regset_bitmap data fields are no longer sufficient. A new method is added in their place that returns a pointer to a new struct that includes all info linux-low.c needs to access registers of the current inferior. The patch/discussion that originally introduced linux-low.c:disabled_regsets mentions that the disabled_regsets set may be different per mode (in a biarch setup), and indeed that is cleared whenever we start a new (first) inferior, so that global is moved as well behind the new `struct regs_info'. On the x86 side: I simply replaced the i387-fp.c:num_xmm_registers global with a check for 64-bit or 32-bit process, which is equivalent to how the global was set. This avoided coming up with some more general mechanism that would work for all targets that use this module (GNU/Linux, Windows, etc.). Tested: GNU/Linux IA64 GNU/Linux MIPS64 GNU/Linux PowerPC (Fedora 16) GNU/Linux s390x (Fedora 16) GNU/Linux sparc64 (Debian) GNU/Linux x86_64, -m64 and -m32 (Fedora 17) Cross built, and smoke tested: i686-w64-mingw32, under Wine. GNU/Linux TI C6x, by Yao Qi. Cross built but otherwise not tested: aarch64-linux-gnu arm-linux-gnu m68k-linux nios2-linux-gnu sh-linux-gnu spu tilegx-unknown-linux-gnu Completely untested: GNU/Linux Blackfin GNU/Linux CRIS GNU/Linux CRISv32 GNU/Linux TI Xtensa GNU/Linux M32R LynxOS QNX NTO gdb/gdbserver/ 2013-06-07 Pedro Alves <palves@redhat.com> * Makefile.in (OBS): Add tdesc.o. (IPA_OBJS): Add tdesc-ipa.o. (tdesc-ipa.o): New rule. * ax.c (gdb_eval_agent_expr): Adjust register_size call to new interface. * linux-low.c (new_inferior): Delete. (disabled_regsets, num_regsets): Delete. (linux_add_process): Adjust to set the new per-process new_inferior flag. (linux_detach_one_lwp): Adjust to call regcache_invalidate_thread. (linux_wait_for_lwp): Adjust. Only call arch_setup if the event was a stop. When calling arch_setup, switch the current inferior to the thread that got an event. (linux_resume_one_lwp): Adjust to call regcache_invalidate_thread. (regsets_fetch_inferior_registers) (regsets_store_inferior_registers): New regsets_info parameter. Adjust to use it. (linux_register_in_regsets): New regs_info parameter. Adjust to use it. (register_addr, fetch_register, store_register): New usrregs_info parameter. Adjust to use it. (usr_fetch_inferior_registers, usr_store_inferior_registers): New parameter regs_info. Adjust to use it. (linux_fetch_registers): Get the current inferior's regs_info, and adjust to use it. (linux_store_registers): Ditto. [HAVE_LINUX_REGSETS] (initialize_regsets_info): New. (initialize_low): Don't initialize the target_regsets here. Call initialize_low_arch. * linux-low.h (target_regsets): Delete declaration. (struct regsets_info): New. (struct usrregs_info): New. (struct regs_info): New. (struct process_info_private) <new_inferior>: New field. (struct linux_target_ops): Delete the num_regs, regmap, and regset_bitmap fields. New field regs_info. [HAVE_LINUX_REGSETS] (initialize_regsets_info): Declare. * i387-fp.c (num_xmm_registers): Delete. (i387_cache_to_fsave, i387_fsave_to_cache): Adjust find_regno calls to new interface. (i387_cache_to_fxsave, i387_cache_to_xsave, i387_fxsave_to_cache) (i387_xsave_to_cache): Adjust find_regno calls to new interface. Infer the number of xmm registers from the regcache's target description. * i387-fp.h (num_xmm_registers): Delete. * inferiors.c (add_thread): Don't install the thread's regcache here. * proc-service.c (gregset_info): Fetch the current inferior's regs_info. Adjust to use it. * regcache.c: Include tdesc.h. (register_bytes, reg_defs, num_registers) (gdbserver_expedite_regs): Delete. (get_thread_regcache): If the thread doesn't have a regcache yet, create one, instead of aborting gdbserver. (regcache_invalidate_one): Rename to ... (regcache_invalidate_thread): ... this. (regcache_invalidate_one): New. (regcache_invalidate): Only invalidate registers of the current process. (init_register_cache): Add target_desc parameter, and use it. (new_register_cache): Ditto. Assert the target description has a non zero registers_size. (regcache_cpy): Add assertions. Adjust. (realloc_register_cache, set_register_cache): Delete. (registers_to_string, registers_from_string): Adjust. (find_register_by_name, find_regno, find_register_by_number) (register_cache_size): Add target_desc parameter, and use it. (free_register_cache_thread, free_register_cache_thread_one) (regcache_release, register_cache_size): New. (register_size): Add target_desc parameter, and use it. (register_data, supply_register, supply_register_zeroed) (supply_regblock, supply_register_by_name, collect_register) (collect_register_as_string, collect_register_by_name): Adjust. * regcache.h (struct target_desc): Forward declare. (struct regcache) <tdesc>: New field. (init_register_cache, new_register_cache): Add target_desc parameter. (regcache_invalidate_thread): Declare. (regcache_invalidate_one): Delete declaration. (regcache_release): Declare. (find_register_by_number, register_cache_size, register_size) (find_regno): Add target_desc parameter. (gdbserver_expedite_regs, gdbserver_xmltarget): Delete declarations. * remote-utils.c: Include tdesc.h. (outreg, prepare_resume_reply): Adjust. * server.c: Include tdesc.h. (gdbserver_xmltarget): Delete declaration. (get_features_xml, process_serial_event): Adjust. * server.h [IN_PROCESS_AGENT] (struct target_desc): Forward declare. (struct process_info) <tdesc>: New field. (ipa_tdesc): Declare. * tdesc.c: New file. * tdesc.h: New file. * tracepoint.c: Include tdesc.h. [IN_PROCESS_AGENT] (ipa_tdesc): Define. (get_context_regcache): Adjust to pass ipa_tdesc down. (do_action_at_tracepoint): Adjust to get the register cache size from the context regcache's description. (traceframe_walk_blocks): Adjust to get the register cache size from the current trace frame's description. (traceframe_get_pc): Adjust to get current trace frame's description and pass it down. (gdb_collect): Adjust to get the register cache size from the IPA's description. * linux-amd64-ipa.c (tdesc_amd64_linux): Declare. (gdbserver_xmltarget): Delete. (initialize_low_tracepoint): Set the ipa's target description. * linux-i386-ipa.c (tdesc_i386_linux): Declare. (initialize_low_tracepoint): Set the ipa's target description. * linux-x86-low.c: Include tdesc.h. [__x86_64__] (is_64bit_tdesc): New. (ps_get_thread_area, x86_get_thread_area): Use it. (i386_cannot_store_register): Rename to ... (x86_cannot_store_register): ... this. Use is_64bit_tdesc. (i386_cannot_fetch_register): Rename to ... (x86_cannot_fetch_register): ... this. Use is_64bit_tdesc. (x86_fill_gregset, x86_store_gregset): Adjust register_size calls to new interface. (target_regsets): Rename to ... (x86_regsets): ... this. (x86_get_pc, x86_set_pc): Adjust register_size calls to new interface. (x86_siginfo_fixup): Use is_64bit_tdesc. [__x86_64__] (tdesc_amd64_linux, tdesc_amd64_avx_linux) (tdesc_x32_avx_linux, tdesc_x32_linux) (tdesc_i386_linux, tdesc_i386_mmx_linux, tdesc_i386_avx_linux): Declare. (x86_linux_update_xmltarget): Delete. (I386_LINUX_XSAVE_XCR0_OFFSET): Define. (have_ptrace_getfpxregs, have_ptrace_getregset): New. (AMD64_LINUX_USER64_CS): New. (x86_linux_read_description): New, based on x86_linux_update_xmltarget. (same_process_callback): New. (x86_arch_setup_process_callback): New. (x86_linux_update_xmltarget): New. (x86_regsets_info): New. (amd64_linux_regs_info): New. (i386_linux_usrregs_info): New. (i386_linux_regs_info): New. (x86_linux_regs_info): New. (x86_arch_setup): Reimplement. (x86_install_fast_tracepoint_jump_pad): Use is_64bit_tdesc. (x86_emit_ops): Ditto. (the_low_target): Adjust. Install x86_linux_regs_info, x86_cannot_fetch_register, and x86_cannot_store_register. (initialize_low_arch): New. * linux-ia64-low.c (tdesc_ia64): Declare. (ia64_fetch_register): Adjust. (ia64_usrregs_info, regs_info): New globals. (ia64_regs_info): New function. (the_low_target): Adjust. (initialize_low_arch): New function. * linux-sparc-low.c (tdesc_sparc64): Declare. (sparc_fill_gregset_to_stack, sparc_store_gregset_from_stack): Adjust. (sparc_arch_setup): New function. (sparc_regsets_info, sparc_usrregs_info, regs_info): New globals. (the_low_target): Adjust. (initialize_low_arch): New function. * linux-ppc-low.c (tdesc_powerpc_32l, tdesc_powerpc_altivec32l) (tdesc_powerpc_cell32l, tdesc_powerpc_vsx32l) (tdesc_powerpc_isa205_32l, tdesc_powerpc_isa205_altivec32l) (tdesc_powerpc_isa205_vsx32l, tdesc_powerpc_e500l) (tdesc_powerpc_64l, tdesc_powerpc_altivec64l) (tdesc_powerpc_cell64l, tdesc_powerpc_vsx64l) (tdesc_powerpc_isa205_64l, tdesc_powerpc_isa205_altivec64l) (tdesc_powerpc_isa205_vsx64l): Declare. (ppc_cannot_store_register, ppc_collect_ptrace_register) (ppc_supply_ptrace_register, parse_spufs_run, ppc_get_pc) (ppc_set_pc, ppc_get_hwcap): Adjust. (ppc_usrregs_info): Forward declare. (!__powerpc64__) ppc_regmap_adjusted: New global. (ppc_arch_setup): Adjust to the current process'es target description. (ppc_fill_vsxregset, ppc_store_vsxregset, ppc_fill_vrregset) (ppc_store_vrregset, ppc_fill_evrregset, ppc_store_evrregse) (ppc_store_evrregset): Adjust. (target_regsets): Rename to ... (ppc_regsets): ... this, and make static. (ppc_usrregs_info, ppc_regsets_info, regs_info): New globals. (ppc_regs_info): New function. (the_low_target): Adjust. (initialize_low_arch): New function. * linux-s390-low.c (tdesc_s390_linux32, tdesc_s390_linux32v1) (tdesc_s390_linux32v2, tdesc_s390_linux64, tdesc_s390_linux64v1) (tdesc_s390_linux64v2, tdesc_s390x_linux64, tdesc_s390x_linux64v1) (tdesc_s390x_linux64v2): Declare. (s390_collect_ptrace_register, s390_supply_ptrace_register) (s390_fill_gregset, s390_store_last_break): Adjust. (target_regsets): Rename to ... (s390_regsets): ... this, and make static. (s390_get_pc, s390_set_pc): Adjust. (s390_get_hwcap): New target_desc parameter, and use it. [__s390x__] (have_hwcap_s390_high_gprs): New global. (s390_arch_setup): Adjust to set the current process'es target description. Don't adjust the regmap. (s390_usrregs_info, s390_regsets_info, regs_info): New globals. [__s390x__] (s390_usrregs_info_3264, s390_regsets_info_3264) (regs_info_3264): New globals. (s390_regs_info): New function. (the_low_target): Adjust. (initialize_low_arch): New function. * linux-mips-low.c (tdesc_mips_linux, tdesc_mips_dsp_linux) (tdesc_mips64_linux, tdesc_mips64_dsp_linux): Declare. [__mips64] (init_registers_mips_linux) (init_registers_mips_dsp_linux): Delete defines. [__mips64] (tdesc_mips_linux, tdesc_mips_dsp_linux): New defines. (have_dsp): New global. (mips_read_description): New, based on mips_arch_setup. (mips_arch_setup): Reimplement. (get_usrregs_info): New function. (mips_cannot_fetch_register, mips_cannot_store_register) (mips_get_pc, mips_set_pc, mips_fill_gregset, mips_store_gregset) (mips_fill_fpregset, mips_store_fpregset): Adjust. (target_regsets): Rename to ... (mips_regsets): ... this, and make static. (mips_regsets_info, mips_dsp_usrregs_info, mips_usrregs_info) (dsp_regs_info, regs_info): New globals. (mips_regs_info): New function. (the_low_target): Adjust. (initialize_low_arch): New function. * linux-arm-low.c (tdesc_arm, tdesc_arm_with_iwmmxt) (tdesc_arm_with_vfpv2, tdesc_arm_with_vfpv3, tdesc_arm_with_neon): Declare. (arm_fill_vfpregset, arm_store_vfpregset): Adjust. (arm_read_description): New, with bits factored from arm_arch_setup. (arm_arch_setup): Reimplement. (target_regsets): Rename to ... (arm_regsets): ... this, and make static. (arm_regsets_info, arm_usrregs_info, regs_info): New globals. (arm_regs_info): New function. (the_low_target): Adjust. (initialize_low_arch): New function. * linux-m68k-low.c (tdesc_m68k): Declare. (target_regsets): Rename to ... (m68k_regsets): ... this, and make static. (m68k_regsets_info, m68k_usrregs_info, regs_info): New globals. (m68k_regs_info): New function. (m68k_arch_setup): New function. (the_low_target): Adjust. (initialize_low_arch): New function. * linux-sh-low.c (tdesc_sharch): Declare. (target_regsets): Rename to ... (sh_regsets): ... this, and make static. (sh_regsets_info, sh_usrregs_info, regs_info): New globals. (sh_regs_info, sh_arch_setup): New functions. (the_low_target): Adjust. (initialize_low_arch): New function. * linux-bfin-low.c (tdesc_bfin): Declare. (bfin_arch_setup): New function. (bfin_usrregs_info, regs_info): New globals. (bfin_regs_info): New function. (the_low_target): Adjust. (initialize_low_arch): New function. * linux-cris-low.c (tdesc_cris): Declare. (cris_arch_setup): New function. (cris_usrregs_info, regs_info): New globals. (cris_regs_info): New function. (the_low_target): Adjust. (initialize_low_arch): New function. * linux-cris-low.c (tdesc_crisv32): Declare. (cris_arch_setup): New function. (cris_regsets_info, cris_usrregs_info, regs_info): New globals. (cris_regs_info): New function. (the_low_target): Adjust. (initialize_low_arch): New function. * linux-m32r-low.c (tdesc_m32r): Declare. (m32r_arch_setup): New function. (m32r_usrregs_info, regs_info): New globals. (m32r_regs_info): Adjust. (initialize_low_arch): New function. * linux-tic6x-low.c (tdesc_tic6x_c64xp_linux) (tdesc_tic6x_c64x_linux, tdesc_tic6x_c62x_linux): Declare. (tic6x_usrregs_info): Forward declare. (tic6x_read_description): New function, based on ... (tic6x_arch_setup): ... this. Reimplement. (target_regsets): Rename to ... (tic6x_regsets): ... this, and make static. (tic6x_regsets_info, tic6x_usrregs_info, regs_info): New globals. (tic6x_regs_info): New function. (the_low_target): Adjust. (initialize_low_arch): New function. * linux-xtensa-low.c (tdesc_xtensa): Declare. (xtensa_fill_gregset, xtensa_store_gregset): Adjust. (target_regsets): Rename to ... (xtensa_regsets): ... this, and make static. (xtensa_regsets_info, xtensa_usrregs_info, regs_info): New globals. (xtensa_arch_setup, xtensa_regs_info): New functions. (the_low_target): Adjust. (initialize_low_arch): New function. * linux-nios2-low.c (tdesc_nios2_linux): Declare. (nios2_arch_setup): Set the current process'es tdesc. (target_regsets): Rename to ... (nios2_regsets): ... this. (nios2_regsets_info, nios2_usrregs_info, regs_info): New globals. (nios2_regs_info): New function. (the_low_target): Adjust. (initialize_low_arch): New function. * linux-aarch64-low.c (tdesc_aarch64): Declare. (aarch64_arch_setup): Set the current process'es tdesc. (target_regsets): Rename to ... (aarch64_regsets): ... this. (aarch64_regsets_info, aarch64_usrregs_info, regs_info): New globals. (aarch64_regs_info): New function. (the_low_target): Adjust. (initialize_low_arch): New function. * linux-tile-low.c (tdesc_tilegx, tdesc_tilegx32): Declare globals. (target_regsets): Rename to ... (tile_regsets): ... this. (tile_regsets_info, tile_usrregs_info, regs_info): New globals. (tile_regs_info): New function. (tile_arch_setup): Set the current process'es tdesc. (the_low_target): Adjust. (initialize_low_arch): New function. * spu-low.c (tdesc_spu): Declare. (spu_create_inferior, spu_attach): Set the new process'es tdesc. * win32-arm-low.c (tdesc_arm): Declare. (arm_arch_setup): New function. (the_low_target): Install arm_arch_setup instead of init_registers_arm. * win32-i386-low.c (tdesc_i386, tdesc_amd64): Declare. (init_windows_x86): Rename to ... (i386_arch_setup): ... this. Set `win32_tdesc'. (the_low_target): Adjust. * win32-low.c (win32_tdesc): New global. (child_add_thread): Don't create the thread cache here. (do_initial_child_stuff): Set the new process'es tdesc. * win32-low.h (struct target_desc): Forward declare. (win32_tdesc): Declare. * lynx-i386-low.c (tdesc_i386): Declare global. (lynx_i386_arch_setup): Set `lynx_tdesc'. * lynx-low.c (lynx_tdesc): New global. (lynx_add_process): Set the new process'es tdesc. * lynx-low.h (struct target_desc): Forward declare. (lynx_tdesc): Declare global. * lynx-ppc-low.c (tdesc_powerpc_32): Declare global. (lynx_ppc_arch_setup): Set `lynx_tdesc'. * nto-low.c (nto_tdesc): New global. (do_attach): Set the new process'es tdesc. * nto-low.h (struct target_desc): Forward declare. (nto_tdesc): Declare. * nto-x86-low.c (tdesc_i386): Declare. (nto_x86_arch_setup): Set `nto_tdesc'. gdb/ 2013-06-07 Pedro Alves <palves@redhat.com> * regformats/regdat.sh: Output #include tdesc.h. Make globals static. Output a global target description pointer. (init_registers_${name}): Adjust to initialize a target description structure.
2013-06-07 12:46:59 +02:00
#ifdef HAVE_LINUX_REGSETS
void initialize_regsets_info (struct regsets_info *regsets_info);
#endif
void initialize_low_arch (void);
Replace some $ARCH_{get,set}_pc with linux_{get,set}_pc_32bit This patch adds a pair of new functions linux_get_pc_32bit and linux_set_pc_32bit which get and set 32-bit register "pc" from regcache. This function can be used some targets and these own $ARCH_{get,set}_pc are replaced by linux_{get,set}_pc_32bit respectively. This patch touches many targets, but I only have arm board to test and no regression. I also rebuilt nios2-linux GDBserver. If it is right to go, I'll post the 64-bit counterpart later. gdb/gdbserver: 2016-01-18 Yao Qi <yao.qi@linaro.org> * linux-arm-low.c (debug_threads): Remove declaration. (arm_get_pc, arm_set_pc): Remove. (the_low_target): Use linux_get_pc_32bit and linux_set_pc_32bit. * linux-bfin-low.c (bfin_get_pc, bfin_set_pc): Remove. (the_low_target): Use linux_get_pc_32bit and linux_set_pc_32bit. * linux-cris-low.c (debug_threads): Remove declaration. (cris_get_pc, cris_set_pc,): Remove. (the_low_target): Use linux_get_pc_32bit and linux_set_pc_32bit. * linux-crisv32-low.c (debug_threads): Remove declaration. (cris_get_pc, cris_set_pc): Remove. (the_low_target): Use linux_get_pc_32bit and linux_set_pc_32bit. * linux-low.c: Include inttypes.h. (linux_get_pc_32bit, linux_set_pc_32bit): New functions. * linux-low.h (linux_get_pc_32bit, linux_set_pc_32bit): Declare. * linux-m32r-low.c (m32r_get_pc, m32r_set_pc): Remove. (the_low_target): Use linux_get_pc_32bit and linux_set_pc_32bit. * linux-m68k-low.c (m68k_get_pc, m68k_set_pc): Remove. (the_low_target): Use linux_get_pc_32bit and linux_set_pc_32bit. * linux-nios2-low.c (nios2_get_pc, nios2_set_pc): Remove. (the_low_target): Use linux_get_pc_32bit and linux_set_pc_32bit. * linux-sh-low.c (sh_get_pc, sh_set_pc): Remove. (the_low_target): Use linux_get_pc_32bit and linux_set_pc_32bit. * linux-xtensa-low.c (xtensa_get_pc, xtensa_set_pc): Remove. (the_low_target): Use linux_get_pc_32bit and linux_set_pc_32bit.
2016-01-18 15:49:50 +01:00
void linux_set_pc_32bit (struct regcache *regcache, CORE_ADDR pc);
CORE_ADDR linux_get_pc_32bit (struct regcache *regcache);
void linux_set_pc_64bit (struct regcache *regcache, CORE_ADDR pc);
CORE_ADDR linux_get_pc_64bit (struct regcache *regcache);
/* From thread-db.c */
Remove support for thread events without PTRACE_EVENT_CLONE in GDBServer. This patch removes support for thread events if PTRACE_EVENT_CLONE is not supported in GDBServer. Before, on systems that did not support PTRACE_EVENT_CLONE, both GDB and GDBServer coordinated with libthread_db.so to insert breakpoints at magic locations in libpthread.so, in order to break at thread creation and thread death. Simple software single stepping support was implemented to step over these breakpoints in case there was no hardware single stepping support. However, these simple software single stepping implementations were not fit for any other use as discussed in : https://sourceware.org/ml/gdb-patches/2015-04/msg01110.html These too simple implementations conflict with ongoing work to make proper implementations of software single stepping in GDBServer. The problem is that if some implementations are correct and others are not and only there for the thread magic breakpoint, we can't enable features based solely software single step support since some would be broken. To keep the incorrect implementations and allow the new proper ones at the same time we would need to implement fallback code and it quickly becomes ugly and confusing with multiple checks for legacy software single step or proper software single step. However, PTRACE_EVENT_CLONE was first introduced in Linux 2.5.46, released in November 2002. So I think it's reasonable to just remove support for kernels that don't support PTRACE_EVENT_CLONE, and sidestep the libthread_db breakpoints issues entirely. This thread on the mailling list discusses the issue : https://sourceware.org/ml/gdb/2015-10/msg00078.html No regressions, tested on ubuntu 14.04 ARMv7 and x86. With gdbserver-{native,extended} / { -marm -mthumb } gdb/gdbserver/ChangeLog: * linux-low.c (linux_look_up_symbols): Don't call linux_supports_traceclone. * linux-low.h (thread_db_init): Remove use_events argument. * thread-db.c (thread_db_use_event): Remove global variable. (struct thread_db) <td_thr_event_enable_p>: Remove field. (struct thread_db) <td_create_bp>: Remove field. (thread_db_create_event): Remove function. (thread_db_enable_reporting): Likewise. (find_one_thread): Don't check for thread_db_use_events. (attach_thread): Likewise. (thread_db_load_search): Remove td_thr_event_enable_p initialization. (try_thread_db_load_1): Don't check for thread_db_use_events. (thread_db_init): Remove use_events argument and thread events handling. (remove_thread_event_breakpoints): Remove function. (thread_db_detach): Remove call to remove_thred_event_breakpoints.
2015-11-19 17:29:10 +01:00
int thread_db_init (void);
GDBserver disconnected tracing support. * linux-low.c (linux_remove_process): Delete. (add_lwp): Don't set last_resume_kind here. (linux_kill): Use `mourn'. (linux_detach): Use `thread_db_detach', and `mourn'. (linux_mourn): New. (linux_attach_lwp_1): Adjust comment. (linux_attach): last_resume_kind moved the thread_info; adjust. (status_pending_p_callback): Adjust. (linux_wait_for_event_1): Adjust. (count_events_callback, select_singlestep_lwp_callback) (select_event_lwp_callback, cancel_breakpoints_callback) (db_wants_lwp_stopped, linux_wait_1, need_step_over_p) (proceed_one_lwp): Adjust. (linux_async): Add debug output. (linux_thread_stopped): New. (linux_pause_all): New. (linux_target_ops): Install linux_mourn, linux_thread_stopped and linux_pause_all. * linux-low.h (struct lwp_info): Delete last_resume_kind field. (thread_db_free): Delete declaration. (thread_db_detach, thread_db_mourn): Declare. * thread-db.c (thread_db_init): Use thread_db_mourn. (thread_db_free): Delete, split in two. (disable_thread_event_reporting): New. (thread_db_detach): New. (thread_db_mourn): New. * server.h (struct thread_info) <last_resume_kind>: New field. <attached>: Add comment. <gdb_detached>: New field. (handler_func): Change return type to int. (handle_serial_event, handle_target_event): Ditto. (gdb_connected): Declare. (tracing): Delete. (disconnected_tracing): Declare. (stop_tracing): Declare. * server.c (handle_query) <qSupported>: Report support for disconnected tracing. (queue_stop_reply_callback): Account for running threads. (gdb_wants_thread_stopped): New. (gdb_wants_all_threads_stopped): New. (gdb_reattached_process): New. (handle_status): Clear the `gdb_detached' flag of all processes. In all-stop, stop all threads. (main): Be sure to leave tfind mode. Handle disconnected tracing. (process_serial_event): If the remote connection breaks, or if an exit was forced with "monitor exit", force an event loop exit. Handle disconnected tracing on detach. (handle_serial_event): Adjust. (handle_target_event): If GDB isn't connected, forward events back to the inferior, unless the last process exited, in which case, exit gdbserver. Adjust interface. * remote-utils.c (remote_open): Don't block in accept. Instead register an event loop source on the listen socket file descriptor. Refactor bits into ... (listen_desc): ... this new global. (gdb_connected): ... this new function. (enable_async_notification): ... this new function. (handle_accept_event): ... this new function. (remote_close): Clear remote_desc. * inferiors.c (add_thread): Set the new thread's last_resume_kind. * target.h (struct target_ops) <mourn, thread_stopped, pause_all>: New fields. (mourn_inferior): Define. (target_process_qsupported): Avoid the dangling else problem. (thread_stopped): Define. (pause_all): Define. (target_waitstatus_to_string): Declare. * target.c (target_waitstatus_to_string): New. * tracepoint.c (tracing): Make extern. (disconnected_tracing): New. (stop_tracing): Make extern. Handle tracing stops due to GDB disconnecting. (cmd_qtdisconnected): New. (cmd_qtstatus): Report disconnected tracing status in trace reply. (handle_tracepoint_general_set): Handle QTDisconnected. * event-loop.c (event_handler_func): Change return type to int. (process_event): Bail out if the event handler wants the event loop to stop. (handle_file_event): Ditto. (start_event_loop): Bail out if the event handler wants the event loop to stop. * nto-low.c (nto_target_ops): Adjust. * spu-low.c (spu_wait): Don't remove the process here. (spu_target_ops): Adjust. * win32-low.c (win32_wait): Don't remove the process here. (win32_target_ops): Adjust.
2010-04-11 18:33:56 +02:00
void thread_db_detach (struct process_info *);
void thread_db_mourn (struct process_info *);
int thread_db_handle_monitor_command (char *);
int thread_db_get_tls_address (struct thread_info *thread, CORE_ADDR offset,
CORE_ADDR load_module, CORE_ADDR *address);
int thread_db_look_up_one_symbol (const char *name, CORE_ADDR *addrp);
/* Called from linux-low.c when a clone event is detected. Upon entry,
both the clone and the parent should be stopped. This function does
whatever is required have the clone under thread_db's control. */
void thread_db_notice_clone (struct thread_info *parent_thr, ptid_t child_ptid);
Add thread_handle_to_thread_info support for remote targets This patch adds support to remote targets for converting a thread handle to a thread_info struct pointer. A thread handle is fetched via a "handle" attribute which has been added to the qXfer:threads:read query packet. An implementation is provided in gdbserver for targets using the Linux kernel. gdb/gdbserver/ChangeLog: * linux-low.h (struct lwp_info): Add new field, thread_handle. (thread_db_thread_handle): Declare. * linux-low.c (linux_target_ops): Initialize thread_handle. * server.c (handle_qxfer_threads_worker): Add support for "handle" attribute. * target.h (struct target_ops): Add new function pointer, thread_handle. (target_thread_handle): Define. * thread-db.c (find_one_thread, attach_thread): Set thread_handle field in lwp. (thread_db_thread_handle): New function. gdb/ChangeLog: * remote.c (vector): Include. (struct private_thread_info): Add field, thread_handle. (free_private_thread_info): Deallocate storage associated with thread handle. (get_private_info_thread): Initialize `thread_handle' field. (struct thread_item): Add field, thread_handle. (clear_threads_listing_context): Deallocate storage associated with thread handle. (start_thread): Add support for "handle" attribute. (thread_attributes): Add "handle". (remote_get_threads_with_qthreadinfo): Initialize thread_handle field. (remote_update_thread_list): Update thread_handle. (remote_thread_handle_to_thread_info): New function. (init_remote_ops): Initialize to_thread_handle_to_thread_info.
2017-04-05 01:17:05 +02:00
bool thread_db_thread_handle (ptid_t ptid, gdb_byte **handle, int *handle_len);
extern int have_ptrace_getregset;
Normalize include guards in gdb While working on my other scripts to deal with gdb headers, I noticed that some files were missing include guards. I wrote a script to add the missing ones, but found that using the obvious names for the guards ran into clashes -- for example, gdb/nat/linux-nat.h used "LINUX_NAT_H", but this was also the script's choice for gdb/linux-nat.h. So, I changed the script to normalize all include guards in gdb. This patch is the result. As usual the script is available here: https://github.com/tromey/gdb-refactoring-scripts Tested by rebuilding; I also ran it through "Fedora-x86_64-m64" on the buildbot. gdb/ChangeLog 2019-02-07 Tom Tromey <tom@tromey.com> * yy-remap.h: Add include guard. * xtensa-tdep.h: Add include guard. * xcoffread.h: Rename include guard. * varobj-iter.h: Add include guard. * tui/tui.h: Rename include guard. * tui/tui-winsource.h: Rename include guard. * tui/tui-wingeneral.h: Rename include guard. * tui/tui-windata.h: Rename include guard. * tui/tui-win.h: Rename include guard. * tui/tui-stack.h: Rename include guard. * tui/tui-source.h: Rename include guard. * tui/tui-regs.h: Rename include guard. * tui/tui-out.h: Rename include guard. * tui/tui-layout.h: Rename include guard. * tui/tui-io.h: Rename include guard. * tui/tui-hooks.h: Rename include guard. * tui/tui-file.h: Rename include guard. * tui/tui-disasm.h: Rename include guard. * tui/tui-data.h: Rename include guard. * tui/tui-command.h: Rename include guard. * tic6x-tdep.h: Add include guard. * target/waitstatus.h: Rename include guard. * target/wait.h: Rename include guard. * target/target.h: Rename include guard. * target/resume.h: Rename include guard. * target-float.h: Rename include guard. * stabsread.h: Add include guard. * rs6000-tdep.h: Add include guard. * riscv-fbsd-tdep.h: Add include guard. * regformats/regdef.h: Rename include guard. * record.h: Rename include guard. * python/python.h: Rename include guard. * python/python-internal.h: Rename include guard. * python/py-stopevent.h: Rename include guard. * python/py-ref.h: Rename include guard. * python/py-record.h: Rename include guard. * python/py-record-full.h: Rename include guard. * python/py-record-btrace.h: Rename include guard. * python/py-instruction.h: Rename include guard. * python/py-events.h: Rename include guard. * python/py-event.h: Rename include guard. * procfs.h: Add include guard. * proc-utils.h: Add include guard. * p-lang.h: Add include guard. * or1k-tdep.h: Rename include guard. * observable.h: Rename include guard. * nto-tdep.h: Rename include guard. * nat/x86-linux.h: Rename include guard. * nat/x86-linux-dregs.h: Rename include guard. * nat/x86-gcc-cpuid.h: Add include guard. * nat/x86-dregs.h: Rename include guard. * nat/x86-cpuid.h: Rename include guard. * nat/ppc-linux.h: Rename include guard. * nat/mips-linux-watch.h: Rename include guard. * nat/linux-waitpid.h: Rename include guard. * nat/linux-ptrace.h: Rename include guard. * nat/linux-procfs.h: Rename include guard. * nat/linux-osdata.h: Rename include guard. * nat/linux-nat.h: Rename include guard. * nat/linux-namespaces.h: Rename include guard. * nat/linux-btrace.h: Rename include guard. * nat/glibc_thread_db.h: Rename include guard. * nat/gdb_thread_db.h: Rename include guard. * nat/gdb_ptrace.h: Rename include guard. * nat/fork-inferior.h: Rename include guard. * nat/amd64-linux-siginfo.h: Rename include guard. * nat/aarch64-sve-linux-sigcontext.h: Rename include guard. * nat/aarch64-sve-linux-ptrace.h: Rename include guard. * nat/aarch64-linux.h: Rename include guard. * nat/aarch64-linux-hw-point.h: Rename include guard. * mn10300-tdep.h: Add include guard. * mips-linux-tdep.h: Add include guard. * mi/mi-parse.h: Rename include guard. * mi/mi-out.h: Rename include guard. * mi/mi-main.h: Rename include guard. * mi/mi-interp.h: Rename include guard. * mi/mi-getopt.h: Rename include guard. * mi/mi-console.h: Rename include guard. * mi/mi-common.h: Rename include guard. * mi/mi-cmds.h: Rename include guard. * mi/mi-cmd-break.h: Rename include guard. * m2-lang.h: Add include guard. * location.h: Rename include guard. * linux-record.h: Rename include guard. * linux-nat.h: Add include guard. * linux-fork.h: Add include guard. * i386-darwin-tdep.h: Rename include guard. * hppa-linux-offsets.h: Add include guard. * guile/guile.h: Rename include guard. * guile/guile-internal.h: Rename include guard. * gnu-nat.h: Rename include guard. * gdb-stabs.h: Rename include guard. * frv-tdep.h: Add include guard. * f-lang.h: Add include guard. * event-loop.h: Add include guard. * darwin-nat.h: Rename include guard. * cp-abi.h: Rename include guard. * config/sparc/nm-sol2.h: Rename include guard. * config/nm-nto.h: Rename include guard. * config/nm-linux.h: Add include guard. * config/i386/nm-i386gnu.h: Rename include guard. * config/djgpp/nl_types.h: Rename include guard. * config/djgpp/langinfo.h: Rename include guard. * compile/gcc-cp-plugin.h: Add include guard. * compile/gcc-c-plugin.h: Add include guard. * compile/compile.h: Rename include guard. * compile/compile-object-run.h: Rename include guard. * compile/compile-object-load.h: Rename include guard. * compile/compile-internal.h: Rename include guard. * compile/compile-cplus.h: Rename include guard. * compile/compile-c.h: Rename include guard. * common/xml-utils.h: Rename include guard. * common/x86-xstate.h: Rename include guard. * common/version.h: Rename include guard. * common/vec.h: Rename include guard. * common/tdesc.h: Rename include guard. * common/selftest.h: Rename include guard. * common/scoped_restore.h: Rename include guard. * common/scoped_mmap.h: Rename include guard. * common/scoped_fd.h: Rename include guard. * common/safe-iterator.h: Rename include guard. * common/run-time-clock.h: Rename include guard. * common/refcounted-object.h: Rename include guard. * common/queue.h: Rename include guard. * common/ptid.h: Rename include guard. * common/print-utils.h: Rename include guard. * common/preprocessor.h: Rename include guard. * common/pathstuff.h: Rename include guard. * common/observable.h: Rename include guard. * common/netstuff.h: Rename include guard. * common/job-control.h: Rename include guard. * common/host-defs.h: Rename include guard. * common/gdb_wait.h: Rename include guard. * common/gdb_vecs.h: Rename include guard. * common/gdb_unlinker.h: Rename include guard. * common/gdb_unique_ptr.h: Rename include guard. * common/gdb_tilde_expand.h: Rename include guard. * common/gdb_sys_time.h: Rename include guard. * common/gdb_string_view.h: Rename include guard. * common/gdb_splay_tree.h: Rename include guard. * common/gdb_setjmp.h: Rename include guard. * common/gdb_ref_ptr.h: Rename include guard. * common/gdb_optional.h: Rename include guard. * common/gdb_locale.h: Rename include guard. * common/gdb_assert.h: Rename include guard. * common/filtered-iterator.h: Rename include guard. * common/filestuff.h: Rename include guard. * common/fileio.h: Rename include guard. * common/environ.h: Rename include guard. * common/common-utils.h: Rename include guard. * common/common-types.h: Rename include guard. * common/common-regcache.h: Rename include guard. * common/common-inferior.h: Rename include guard. * common/common-gdbthread.h: Rename include guard. * common/common-exceptions.h: Rename include guard. * common/common-defs.h: Rename include guard. * common/common-debug.h: Rename include guard. * common/cleanups.h: Rename include guard. * common/buffer.h: Rename include guard. * common/btrace-common.h: Rename include guard. * common/break-common.h: Rename include guard. * cli/cli-utils.h: Rename include guard. * cli/cli-style.h: Rename include guard. * cli/cli-setshow.h: Rename include guard. * cli/cli-script.h: Rename include guard. * cli/cli-interp.h: Rename include guard. * cli/cli-decode.h: Rename include guard. * cli/cli-cmds.h: Rename include guard. * charset-list.h: Add include guard. * buildsym-legacy.h: Rename include guard. * bfin-tdep.h: Add include guard. * ax.h: Rename include guard. * arm-linux-tdep.h: Add include guard. * arm-fbsd-tdep.h: Add include guard. * arch/xtensa.h: Rename include guard. * arch/tic6x.h: Add include guard. * arch/i386.h: Add include guard. * arch/arm.h: Rename include guard. * arch/arm-linux.h: Rename include guard. * arch/arm-get-next-pcs.h: Rename include guard. * arch/amd64.h: Add include guard. * arch/aarch64-insn.h: Rename include guard. * arch-utils.h: Rename include guard. * annotate.h: Add include guard. * amd64-darwin-tdep.h: Rename include guard. * aarch64-linux-tdep.h: Add include guard. * aarch64-fbsd-tdep.h: Add include guard. * aarch32-linux-nat.h: Add include guard. gdb/gdbserver/ChangeLog 2019-02-07 Tom Tromey <tom@tromey.com> * x86-tdesc.h: Rename include guard. * x86-low.h: Add include guard. * wincecompat.h: Rename include guard. * win32-low.h: Add include guard. * utils.h: Rename include guard. * tracepoint.h: Rename include guard. * tdesc.h: Rename include guard. * target.h: Rename include guard. * server.h: Rename include guard. * remote-utils.h: Rename include guard. * regcache.h: Rename include guard. * nto-low.h: Rename include guard. * notif.h: Add include guard. * mem-break.h: Rename include guard. * lynx-low.h: Add include guard. * linux-x86-tdesc.h: Add include guard. * linux-s390-tdesc.h: Add include guard. * linux-ppc-tdesc-init.h: Add include guard. * linux-low.h: Add include guard. * linux-aarch64-tdesc.h: Add include guard. * linux-aarch32-low.h: Add include guard. * inferiors.h: Rename include guard. * i387-fp.h: Rename include guard. * hostio.h: Rename include guard. * gdbthread.h: Rename include guard. * gdb_proc_service.h: Rename include guard. * event-loop.h: Rename include guard. * dll.h: Rename include guard. * debug.h: Rename include guard. * ax.h: Rename include guard.
2019-01-27 20:51:36 +01:00
/* Search for the value with type MATCH in the auxv vector with
entries of length WORDSIZE bytes. If found, store the value in
*VALP and return 1. If not found or if there is an error, return
0. */
int linux_get_auxv (int wordsize, CORE_ADDR match,
CORE_ADDR *valp);
/* Fetch the AT_HWCAP entry from the auxv vector, where entries are length
WORDSIZE. If no entry was found, return zero. */
CORE_ADDR linux_get_hwcap (int wordsize);
/* Fetch the AT_HWCAP2 entry from the auxv vector, where entries are length
WORDSIZE. If no entry was found, return zero. */
CORE_ADDR linux_get_hwcap2 (int wordsize);
Normalize include guards in gdb While working on my other scripts to deal with gdb headers, I noticed that some files were missing include guards. I wrote a script to add the missing ones, but found that using the obvious names for the guards ran into clashes -- for example, gdb/nat/linux-nat.h used "LINUX_NAT_H", but this was also the script's choice for gdb/linux-nat.h. So, I changed the script to normalize all include guards in gdb. This patch is the result. As usual the script is available here: https://github.com/tromey/gdb-refactoring-scripts Tested by rebuilding; I also ran it through "Fedora-x86_64-m64" on the buildbot. gdb/ChangeLog 2019-02-07 Tom Tromey <tom@tromey.com> * yy-remap.h: Add include guard. * xtensa-tdep.h: Add include guard. * xcoffread.h: Rename include guard. * varobj-iter.h: Add include guard. * tui/tui.h: Rename include guard. * tui/tui-winsource.h: Rename include guard. * tui/tui-wingeneral.h: Rename include guard. * tui/tui-windata.h: Rename include guard. * tui/tui-win.h: Rename include guard. * tui/tui-stack.h: Rename include guard. * tui/tui-source.h: Rename include guard. * tui/tui-regs.h: Rename include guard. * tui/tui-out.h: Rename include guard. * tui/tui-layout.h: Rename include guard. * tui/tui-io.h: Rename include guard. * tui/tui-hooks.h: Rename include guard. * tui/tui-file.h: Rename include guard. * tui/tui-disasm.h: Rename include guard. * tui/tui-data.h: Rename include guard. * tui/tui-command.h: Rename include guard. * tic6x-tdep.h: Add include guard. * target/waitstatus.h: Rename include guard. * target/wait.h: Rename include guard. * target/target.h: Rename include guard. * target/resume.h: Rename include guard. * target-float.h: Rename include guard. * stabsread.h: Add include guard. * rs6000-tdep.h: Add include guard. * riscv-fbsd-tdep.h: Add include guard. * regformats/regdef.h: Rename include guard. * record.h: Rename include guard. * python/python.h: Rename include guard. * python/python-internal.h: Rename include guard. * python/py-stopevent.h: Rename include guard. * python/py-ref.h: Rename include guard. * python/py-record.h: Rename include guard. * python/py-record-full.h: Rename include guard. * python/py-record-btrace.h: Rename include guard. * python/py-instruction.h: Rename include guard. * python/py-events.h: Rename include guard. * python/py-event.h: Rename include guard. * procfs.h: Add include guard. * proc-utils.h: Add include guard. * p-lang.h: Add include guard. * or1k-tdep.h: Rename include guard. * observable.h: Rename include guard. * nto-tdep.h: Rename include guard. * nat/x86-linux.h: Rename include guard. * nat/x86-linux-dregs.h: Rename include guard. * nat/x86-gcc-cpuid.h: Add include guard. * nat/x86-dregs.h: Rename include guard. * nat/x86-cpuid.h: Rename include guard. * nat/ppc-linux.h: Rename include guard. * nat/mips-linux-watch.h: Rename include guard. * nat/linux-waitpid.h: Rename include guard. * nat/linux-ptrace.h: Rename include guard. * nat/linux-procfs.h: Rename include guard. * nat/linux-osdata.h: Rename include guard. * nat/linux-nat.h: Rename include guard. * nat/linux-namespaces.h: Rename include guard. * nat/linux-btrace.h: Rename include guard. * nat/glibc_thread_db.h: Rename include guard. * nat/gdb_thread_db.h: Rename include guard. * nat/gdb_ptrace.h: Rename include guard. * nat/fork-inferior.h: Rename include guard. * nat/amd64-linux-siginfo.h: Rename include guard. * nat/aarch64-sve-linux-sigcontext.h: Rename include guard. * nat/aarch64-sve-linux-ptrace.h: Rename include guard. * nat/aarch64-linux.h: Rename include guard. * nat/aarch64-linux-hw-point.h: Rename include guard. * mn10300-tdep.h: Add include guard. * mips-linux-tdep.h: Add include guard. * mi/mi-parse.h: Rename include guard. * mi/mi-out.h: Rename include guard. * mi/mi-main.h: Rename include guard. * mi/mi-interp.h: Rename include guard. * mi/mi-getopt.h: Rename include guard. * mi/mi-console.h: Rename include guard. * mi/mi-common.h: Rename include guard. * mi/mi-cmds.h: Rename include guard. * mi/mi-cmd-break.h: Rename include guard. * m2-lang.h: Add include guard. * location.h: Rename include guard. * linux-record.h: Rename include guard. * linux-nat.h: Add include guard. * linux-fork.h: Add include guard. * i386-darwin-tdep.h: Rename include guard. * hppa-linux-offsets.h: Add include guard. * guile/guile.h: Rename include guard. * guile/guile-internal.h: Rename include guard. * gnu-nat.h: Rename include guard. * gdb-stabs.h: Rename include guard. * frv-tdep.h: Add include guard. * f-lang.h: Add include guard. * event-loop.h: Add include guard. * darwin-nat.h: Rename include guard. * cp-abi.h: Rename include guard. * config/sparc/nm-sol2.h: Rename include guard. * config/nm-nto.h: Rename include guard. * config/nm-linux.h: Add include guard. * config/i386/nm-i386gnu.h: Rename include guard. * config/djgpp/nl_types.h: Rename include guard. * config/djgpp/langinfo.h: Rename include guard. * compile/gcc-cp-plugin.h: Add include guard. * compile/gcc-c-plugin.h: Add include guard. * compile/compile.h: Rename include guard. * compile/compile-object-run.h: Rename include guard. * compile/compile-object-load.h: Rename include guard. * compile/compile-internal.h: Rename include guard. * compile/compile-cplus.h: Rename include guard. * compile/compile-c.h: Rename include guard. * common/xml-utils.h: Rename include guard. * common/x86-xstate.h: Rename include guard. * common/version.h: Rename include guard. * common/vec.h: Rename include guard. * common/tdesc.h: Rename include guard. * common/selftest.h: Rename include guard. * common/scoped_restore.h: Rename include guard. * common/scoped_mmap.h: Rename include guard. * common/scoped_fd.h: Rename include guard. * common/safe-iterator.h: Rename include guard. * common/run-time-clock.h: Rename include guard. * common/refcounted-object.h: Rename include guard. * common/queue.h: Rename include guard. * common/ptid.h: Rename include guard. * common/print-utils.h: Rename include guard. * common/preprocessor.h: Rename include guard. * common/pathstuff.h: Rename include guard. * common/observable.h: Rename include guard. * common/netstuff.h: Rename include guard. * common/job-control.h: Rename include guard. * common/host-defs.h: Rename include guard. * common/gdb_wait.h: Rename include guard. * common/gdb_vecs.h: Rename include guard. * common/gdb_unlinker.h: Rename include guard. * common/gdb_unique_ptr.h: Rename include guard. * common/gdb_tilde_expand.h: Rename include guard. * common/gdb_sys_time.h: Rename include guard. * common/gdb_string_view.h: Rename include guard. * common/gdb_splay_tree.h: Rename include guard. * common/gdb_setjmp.h: Rename include guard. * common/gdb_ref_ptr.h: Rename include guard. * common/gdb_optional.h: Rename include guard. * common/gdb_locale.h: Rename include guard. * common/gdb_assert.h: Rename include guard. * common/filtered-iterator.h: Rename include guard. * common/filestuff.h: Rename include guard. * common/fileio.h: Rename include guard. * common/environ.h: Rename include guard. * common/common-utils.h: Rename include guard. * common/common-types.h: Rename include guard. * common/common-regcache.h: Rename include guard. * common/common-inferior.h: Rename include guard. * common/common-gdbthread.h: Rename include guard. * common/common-exceptions.h: Rename include guard. * common/common-defs.h: Rename include guard. * common/common-debug.h: Rename include guard. * common/cleanups.h: Rename include guard. * common/buffer.h: Rename include guard. * common/btrace-common.h: Rename include guard. * common/break-common.h: Rename include guard. * cli/cli-utils.h: Rename include guard. * cli/cli-style.h: Rename include guard. * cli/cli-setshow.h: Rename include guard. * cli/cli-script.h: Rename include guard. * cli/cli-interp.h: Rename include guard. * cli/cli-decode.h: Rename include guard. * cli/cli-cmds.h: Rename include guard. * charset-list.h: Add include guard. * buildsym-legacy.h: Rename include guard. * bfin-tdep.h: Add include guard. * ax.h: Rename include guard. * arm-linux-tdep.h: Add include guard. * arm-fbsd-tdep.h: Add include guard. * arch/xtensa.h: Rename include guard. * arch/tic6x.h: Add include guard. * arch/i386.h: Add include guard. * arch/arm.h: Rename include guard. * arch/arm-linux.h: Rename include guard. * arch/arm-get-next-pcs.h: Rename include guard. * arch/amd64.h: Add include guard. * arch/aarch64-insn.h: Rename include guard. * arch-utils.h: Rename include guard. * annotate.h: Add include guard. * amd64-darwin-tdep.h: Rename include guard. * aarch64-linux-tdep.h: Add include guard. * aarch64-fbsd-tdep.h: Add include guard. * aarch32-linux-nat.h: Add include guard. gdb/gdbserver/ChangeLog 2019-02-07 Tom Tromey <tom@tromey.com> * x86-tdesc.h: Rename include guard. * x86-low.h: Add include guard. * wincecompat.h: Rename include guard. * win32-low.h: Add include guard. * utils.h: Rename include guard. * tracepoint.h: Rename include guard. * tdesc.h: Rename include guard. * target.h: Rename include guard. * server.h: Rename include guard. * remote-utils.h: Rename include guard. * regcache.h: Rename include guard. * nto-low.h: Rename include guard. * notif.h: Add include guard. * mem-break.h: Rename include guard. * lynx-low.h: Add include guard. * linux-x86-tdesc.h: Add include guard. * linux-s390-tdesc.h: Add include guard. * linux-ppc-tdesc-init.h: Add include guard. * linux-low.h: Add include guard. * linux-aarch64-tdesc.h: Add include guard. * linux-aarch32-low.h: Add include guard. * inferiors.h: Rename include guard. * i387-fp.h: Rename include guard. * hostio.h: Rename include guard. * gdbthread.h: Rename include guard. * gdb_proc_service.h: Rename include guard. * event-loop.h: Rename include guard. * dll.h: Rename include guard. * debug.h: Rename include guard. * ax.h: Rename include guard.
2019-01-27 20:51:36 +01:00
#endif /* GDBSERVER_LINUX_LOW_H */