binutils-gdb/gdb/amd64-linux-nat.c

1256 lines
32 KiB
C
Raw Normal View History

2002-02-24 23:14:33 +01:00
/* Native-dependent code for GNU/Linux x86-64.
2002-01-19 04:32:43 +01:00
Copyright (C) 2001-2014 Free Software Foundation, Inc.
Contributed by Jiri Smid, SuSE Labs.
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/>. */
#include "defs.h"
#include "inferior.h"
#include "gdbcore.h"
#include "regcache.h"
Support amd64 AVX. gdb/ 2010-04-07 H.J. Lu <hongjiu.lu@intel.com> * amd64-linux-nat.c: Include "regset.h", "elf/common.h", <sys/uio.h> and "i386-xstate.h". (PTRACE_GETREGSET): New. (PTRACE_SETREGSET): Likewise. (have_ptrace_getregset): Likewise. (amd64_linux_gregset64_reg_offset): Include 16 upper YMM registers. (amd64_linux_gregset32_reg_offset): Include 8 upper YMM registers. (amd64_linux_fetch_inferior_registers): Support PTRACE_GETFPREGS. (amd64_linux_store_inferior_registers): Likewise. (amd64_linux_read_description): Check and enable AVX target descriptions. * amd64-linux-tdep.c: Include "regset.h", "i386-linux-tdep.h" and "features/i386/amd64-avx-linux.c". (amd64_linux_regset_sections): New. (amd64_linux_core_read_description): Check and enable AVX target description. (amd64_linux_init_abi): Set xsave_xcr0_offset. Call set_gdbarch_core_regset_sections. (_initialize_amd64_linux_tdep): Call initialize_tdesc_amd64_avx_linux. * amd64-linux-tdep.h (AMD64_LINUX_ORIG_RAX_REGNUM): Replace AMD64_MXCSR_REGNUM with AMD64_YMM15H_REGNUM. (tdesc_amd64_avx_linux): New. (amd64_linux_update_xstateregset): Likewise. * amd64-tdep.c: Include "features/i386/amd64-avx.c". (amd64_ymm_names): New. (amd64_ymmh_names): Likewise. (amd64_register_name): Likewise. (amd64_supply_xstateregset): Likewise. (amd64_collect_xstateregset): Likewise. (amd64_supply_xsave): Likewise. (amd64_collect_xsave): Likewise. (AMD64_NUM_REGS): Removed. (amd64_dwarf_reg_to_regnum): Return %ymmN register number for %xmmN if AVX is available. (amd64_pseudo_register_name): Support pseudo YMM registers. (amd64_regset_from_core_section): Support .reg-xstate section. (amd64_init_abi): Set ymmh_register_names, num_ymm_regs and ymm0h_regnum. Call set_gdbarch_register_name. (amd64_init_abi): Call initialize_tdesc_amd64_avx. * amd64-tdep.h (amd64_regnum): Add AMD64_YMM0H_REGNUM and AMD64_YMM15H_REGNUM. (AMD64_NUM_REGS): New. (amd64_supply_xsave): Likewise. (amd64_collect_xsave): Likewise. (amd64_register_name): Removed. (amd64_register_type): Likewise. gdb/testsuite/ 2010-04-07 H.J. Lu <hongjiu.lu@intel.com> * gdb.arch/i386-avx.c: New. * gdb.arch/i386-avx.exp: Likewise. * gdb.arch/i386-cpuid.h: Updated from gcc 4.4.
2010-04-07 20:46:50 +02:00
#include "regset.h"
#include "linux-nat.h"
#include "amd64-linux-tdep.h"
#include "linux-btrace.h"
#include "btrace.h"
* x86-64-tdep.h (x86_64_num_regs, x86_64_num_gregs): Remove variable declarations. (x86_64_register_number, x86_64_register_name): Remove prototypes. (x86_64_linux_frame_saved_pc, x86_64_linux+saved_pc_after_call, x86_64_linux_in_sigtramp, x86_64_linux_frame_chain, x86_64_init_frame_pc, x86_64_init_frame_pc, x86_64_function_has_prologue): Remove prototypes. (X86_64_NUM_GREGS): New define. (x86_64_supply_fxsave, x86_64_fill_fxsave): New prototypes. * x86-64-tdep.c: Don't include "dwarf2cfi.h". Include "dummy_frame.h", "frame.h", "frame-base.h", "frame-unwind.h". (RAX_REGNUM, RDX_REGNUM, RDI_REGNUM, EFLAGS_REGNUM, ST0_REGNUM, XMM1_REGNUM): Remove defines. (X86_64_RAX_REGNUM, X86_64_RDX_REGNUM, X86_64_RDI_REGNUM, X86_64_RBP_REGNUM, X86_64_RSP_REGNUM, X86_64_RIP_REGNUM, X86_64_EFLAGS_REGNUM, X86_64_ST0_REGNUM, X86_64_XMM0_REGNUM, X86_64_XMM1_REGNUM): New defines. (struct x86_64_register_info): Renamed from `struct register_info'. Remove `size' member. (x86_64_register_info_table): Remove variable. (x86_64_register_info): New variable. (X86_64_NUM_REGS): New define. (X86_64_NUM_GREGS): Remove define. (x86_64_num_regs, x86_64_num_gregs): Remove variables. (x86_64_dwarf2gdb_regno_map, x86_64_dwarf2gdb_regno_map_length): Remove variables. (x86_54_dwarf2_reg_to_regnum): Remove function. (x86_64_dwarf_regmap, x86_64_dwarf_regmap_len): New variables. (x86_64_dwarf_reg_to_regnum): New function. (x86_64_register_name): Rewrite. (x86_64_register_raw_size): Remove function. (x86_64_register_byte_table): Remove variable. (x86_64_register_byte): Remove function. (x86_64_register_virtual_type): Remove function. (x86_64_register_type): New function. (x86_64_register_convertible, x86_64_register_convert_to_virtual, x86_64_register_convert_to_raw): Remove functions. (x86_64_push_return_address, x86_64_pop_frame): Remove functon. (x86_64_use_struct_convention): Make static. Adjust for renamed defines. (x86_64_frame_init_saved_regs): Remove function. (x86_64_push_arguments): Make static. Change to accept a regcache as argument. (x86_64_store_return_value, x86_64_extract_return_value): Make static. Rewrite based on i386 counterparts. (x86_64_push_dummy_call): New function. (X86_64_NUM_SAVED_REGS): New define. (x86_64_register_number): Remove function. (x86_64_store_struct_return): Remove function. (x86_64_frameless_function_invocation, x86_64_function_has_prologue): Remove functions. (PROLOG_BUFSIZE): Remove define. (struct x86_64_frame_cache): New structure. (x86_64_alloc_frame_cache, x86_64_analyze_prologue, x86_64_frame_cache, x86_64_frame_this_id, x86_64_frame_prev_register, x86_64_frame_p, x86_64_sigtramp_frame_cache, x86_64_sigtramp_frame_this_id, x86_64_sigtramp_frame_prev_register, x86_sigtramp_frame_p): New functions. (x86_64_frame_unwind, x86_64_sigtramp_frame_unwind): New variables. (x86_64_skip_prologue): Rewrite in terms of x86_64_analyze_prologue. (x86_64_frame_base_address): New function. (x86_64_frame_base): New variable. (x86_64_save_dummy_frame_tos, x86_64_unwind_dummy_id): Rewrite. (x86_64_init_abi): Set register_type and push_dummy_call. Don't set deprecated_fp_regnum, deprecated_register_size, deprecated_register_bytes, register_raw_size, register_byte, register_virtual_type, register_convertiable, register_convert_to_virtual, convert_to_raw, deprecated_get_saved_register, deprecated_target_read_fp, deprecated_push_arguments, deprecated_push_return_address, deprecated_pop_frame, deprecated_store_struct_return, deprecated_frame_init_saved_regs, deprecated_frame_chain, frameless_function_invocation, deprecated_frame_saved_pc, deprecated_saved_pc_after_call, frame_num_args, pc_in_sigtramp, dwarf2_build_frame_info, deprecated_init_extra_frame_info, deprecated_init_frame_pc and virtual_frame_pointer. Call frame_unwind_append_predicate to register x86_64_sigtramp_frame_p and x86_64_frame_p. Call frame_base_set_default to register x86_64_frame_base. (I387_FISEG_REGNUM, I387_FOSEG_REGNUM): New defines. (x86_64_supply_fxsave, x86_64_fill_fxsave): New functions. (_initialize_x86_64_tdep): Remove function. * x86-64-linux-tdep.c: Don't include "dwarf2cfi.h". (LINUX_SIGINFO_SIZE, LINUX_UCONTEXT_SIGCONTEXT_OFFSET, LINUX_SIGCONTEXT_PC_OFFSET, LINUX_SIGCONTEXT_FP_OFFSET): Don't define. (X86_64_LINUX_UCONTEXT_SIGCONTEXT_OFFSET): Define. (x86_64_linux_sigcontext_addr): Rewrite. (x86_64_linux_sigtramp_saved_pc, x86_64_linux_saved_pc_after_call, x86_64_linux_frame_saved_pc): Remove functions. (x86_64_linux_pc_in_sigtramp): Renamed from x86_64_linux_in_sigtramp. Try harder to recognize a signal trampoline. (x86_64_linux_frame_chain, x86_64_init_frame_pc): Remove_functions. (x86_64_linux_init_abi): Set pc_in_sigtramp. Initialize TDEP->sigcontext_addr, TDEP->sc_pc_offset and TDEP->sc_sp_offset. * x86-64-linux-nat.c: Sync with i386-linux-tdep.c. (x86_64_regmap): Rename to regmap. (GETREGS_SUPPLIES): Use X86_64_NUM_GREGS instead of x86_64_num_gregs. (supply_gregset, fill_gregset): Likewise. Use regmap instead of x86_64_regmap. (x86_64_fxsave_offset): Remove function. (supply_fpregset): Simply call x86_64_supply_fxsave. (fill_fpregset): Simply call x86_64_fill_fxsave. (fetch_inferior_registers, store_inferior_registers): Avoid asignment in if-statement. (LINUX_SYSCALL_LEN, LINUX_SYSCALL_REGNUM, SYS_Sigreturn, SYS_rt_sigreturn, LINUX_SIGCONTEXT_EFLAGS_OFFSET, LINUX_UCONTEXT_SIGCONTEXT_OFFSET): Remove defines. (fetch_core_registers): Remove function. (linux_elf_core_fns): Remove. (offsetoff): Don't define. (_initialize_x86_64_linux_nat, kernel_u_size): Remove functions. * config/i386/x86-64linux.mt (TDEPFILES): Add i386-linux-tdep.o. * config/i386/x86-64linux.mh (NATDEPFILES): Remove core-aout.o, add core-regset.o. * config/i386/nm-x86-64linux.h: Use NM_X86_64_LINUX_H for protection against multiple includes instead of NM_X86_64_h. Add various comments. Include "config/nm-linux.h". Don't include <signal.h>. (REGISTER_U_ADDR, KERNEL_U_SIZE, U_REGS_OFFSET, KERN_U_ADDR, GET_THREAD_SIGNALS): Remove defines. (x86_64_register_u_addr, kernel_u_size, lin_thread_get_thread_signals): Remove prototypes. (PTRACE_ARG3_TYPE, PTRACE_XFER_TYPE): Define to `long'. [HAVE_LINK_H]: Don't include "solib.h". [HAVE_LINK_H] (SVR4_SHARED_LIBS): Remove define. * config/i386/tm-x86-64linux.h: Fix comments. * Makefile.in (x86-64-linux-nat.o, x86_64-linux-tdep.o, x86-64-tdep.o): Update dependencies.
2003-05-31 10:15:38 +02:00
#include "gdb_assert.h"
remove gdb_string.h This removes gdb_string.h. This patch is purely mechanical. I created it by running the two commands: git rm common/gdb_string.h perl -pi -e's/"gdb_string.h"/<string.h>/;' *.[chyl] */*.[chyl] 2013-11-18 Tom Tromey <tromey@redhat.com> * common/gdb_string.h: Remove. * aarch64-tdep.c: Use string.h, not gdb_string.h. * ada-exp.y: Use string.h, not gdb_string.h. * ada-lang.c: Use string.h, not gdb_string.h. * ada-lex.l: Use string.h, not gdb_string.h. * ada-typeprint.c: Use string.h, not gdb_string.h. * ada-valprint.c: Use string.h, not gdb_string.h. * aix-thread.c: Use string.h, not gdb_string.h. * alpha-linux-tdep.c: Use string.h, not gdb_string.h. * alpha-mdebug-tdep.c: Use string.h, not gdb_string.h. * alpha-nat.c: Use string.h, not gdb_string.h. * alpha-osf1-tdep.c: Use string.h, not gdb_string.h. * alpha-tdep.c: Use string.h, not gdb_string.h. * alphanbsd-tdep.c: Use string.h, not gdb_string.h. * amd64-dicos-tdep.c: Use string.h, not gdb_string.h. * amd64-linux-nat.c: Use string.h, not gdb_string.h. * amd64-linux-tdep.c: Use string.h, not gdb_string.h. * amd64-nat.c: Use string.h, not gdb_string.h. * amd64-sol2-tdep.c: Use string.h, not gdb_string.h. * amd64fbsd-tdep.c: Use string.h, not gdb_string.h. * amd64obsd-tdep.c: Use string.h, not gdb_string.h. * arch-utils.c: Use string.h, not gdb_string.h. * arm-linux-nat.c: Use string.h, not gdb_string.h. * arm-linux-tdep.c: Use string.h, not gdb_string.h. * arm-tdep.c: Use string.h, not gdb_string.h. * arm-wince-tdep.c: Use string.h, not gdb_string.h. * armbsd-tdep.c: Use string.h, not gdb_string.h. * armnbsd-nat.c: Use string.h, not gdb_string.h. * armnbsd-tdep.c: Use string.h, not gdb_string.h. * armobsd-tdep.c: Use string.h, not gdb_string.h. * avr-tdep.c: Use string.h, not gdb_string.h. * ax-gdb.c: Use string.h, not gdb_string.h. * ax-general.c: Use string.h, not gdb_string.h. * bcache.c: Use string.h, not gdb_string.h. * bfin-tdep.c: Use string.h, not gdb_string.h. * breakpoint.c: Use string.h, not gdb_string.h. * build-id.c: Use string.h, not gdb_string.h. * buildsym.c: Use string.h, not gdb_string.h. * c-exp.y: Use string.h, not gdb_string.h. * c-lang.c: Use string.h, not gdb_string.h. * c-typeprint.c: Use string.h, not gdb_string.h. * c-valprint.c: Use string.h, not gdb_string.h. * charset.c: Use string.h, not gdb_string.h. * cli-out.c: Use string.h, not gdb_string.h. * cli/cli-cmds.c: Use string.h, not gdb_string.h. * cli/cli-decode.c: Use string.h, not gdb_string.h. * cli/cli-dump.c: Use string.h, not gdb_string.h. * cli/cli-interp.c: Use string.h, not gdb_string.h. * cli/cli-logging.c: Use string.h, not gdb_string.h. * cli/cli-script.c: Use string.h, not gdb_string.h. * cli/cli-setshow.c: Use string.h, not gdb_string.h. * cli/cli-utils.c: Use string.h, not gdb_string.h. * coffread.c: Use string.h, not gdb_string.h. * common/common-utils.c: Use string.h, not gdb_string.h. * common/filestuff.c: Use string.h, not gdb_string.h. * common/linux-procfs.c: Use string.h, not gdb_string.h. * common/linux-ptrace.c: Use string.h, not gdb_string.h. * common/signals.c: Use string.h, not gdb_string.h. * common/vec.h: Use string.h, not gdb_string.h. * core-regset.c: Use string.h, not gdb_string.h. * corefile.c: Use string.h, not gdb_string.h. * corelow.c: Use string.h, not gdb_string.h. * cp-abi.c: Use string.h, not gdb_string.h. * cp-support.c: Use string.h, not gdb_string.h. * cp-valprint.c: Use string.h, not gdb_string.h. * cris-tdep.c: Use string.h, not gdb_string.h. * d-lang.c: Use string.h, not gdb_string.h. * dbxread.c: Use string.h, not gdb_string.h. * dcache.c: Use string.h, not gdb_string.h. * demangle.c: Use string.h, not gdb_string.h. * dicos-tdep.c: Use string.h, not gdb_string.h. * disasm.c: Use string.h, not gdb_string.h. * doublest.c: Use string.h, not gdb_string.h. * dsrec.c: Use string.h, not gdb_string.h. * dummy-frame.c: Use string.h, not gdb_string.h. * dwarf2-frame.c: Use string.h, not gdb_string.h. * dwarf2loc.c: Use string.h, not gdb_string.h. * dwarf2read.c: Use string.h, not gdb_string.h. * elfread.c: Use string.h, not gdb_string.h. * environ.c: Use string.h, not gdb_string.h. * eval.c: Use string.h, not gdb_string.h. * event-loop.c: Use string.h, not gdb_string.h. * exceptions.c: Use string.h, not gdb_string.h. * exec.c: Use string.h, not gdb_string.h. * expprint.c: Use string.h, not gdb_string.h. * f-exp.y: Use string.h, not gdb_string.h. * f-lang.c: Use string.h, not gdb_string.h. * f-typeprint.c: Use string.h, not gdb_string.h. * f-valprint.c: Use string.h, not gdb_string.h. * fbsd-nat.c: Use string.h, not gdb_string.h. * findcmd.c: Use string.h, not gdb_string.h. * findvar.c: Use string.h, not gdb_string.h. * fork-child.c: Use string.h, not gdb_string.h. * frame.c: Use string.h, not gdb_string.h. * frv-linux-tdep.c: Use string.h, not gdb_string.h. * frv-tdep.c: Use string.h, not gdb_string.h. * gdb.c: Use string.h, not gdb_string.h. * gdb_bfd.c: Use string.h, not gdb_string.h. * gdbarch.c: Use string.h, not gdb_string.h. * gdbtypes.c: Use string.h, not gdb_string.h. * gnu-nat.c: Use string.h, not gdb_string.h. * gnu-v2-abi.c: Use string.h, not gdb_string.h. * gnu-v3-abi.c: Use string.h, not gdb_string.h. * go-exp.y: Use string.h, not gdb_string.h. * go-lang.c: Use string.h, not gdb_string.h. * go32-nat.c: Use string.h, not gdb_string.h. * hppa-hpux-tdep.c: Use string.h, not gdb_string.h. * hppa-linux-nat.c: Use string.h, not gdb_string.h. * hppanbsd-tdep.c: Use string.h, not gdb_string.h. * hppaobsd-tdep.c: Use string.h, not gdb_string.h. * i386-cygwin-tdep.c: Use string.h, not gdb_string.h. * i386-dicos-tdep.c: Use string.h, not gdb_string.h. * i386-linux-nat.c: Use string.h, not gdb_string.h. * i386-linux-tdep.c: Use string.h, not gdb_string.h. * i386-nto-tdep.c: Use string.h, not gdb_string.h. * i386-sol2-tdep.c: Use string.h, not gdb_string.h. * i386-tdep.c: Use string.h, not gdb_string.h. * i386bsd-tdep.c: Use string.h, not gdb_string.h. * i386gnu-nat.c: Use string.h, not gdb_string.h. * i386nbsd-tdep.c: Use string.h, not gdb_string.h. * i386obsd-tdep.c: Use string.h, not gdb_string.h. * i387-tdep.c: Use string.h, not gdb_string.h. * ia64-libunwind-tdep.c: Use string.h, not gdb_string.h. * ia64-linux-nat.c: Use string.h, not gdb_string.h. * inf-child.c: Use string.h, not gdb_string.h. * inf-ptrace.c: Use string.h, not gdb_string.h. * inf-ttrace.c: Use string.h, not gdb_string.h. * infcall.c: Use string.h, not gdb_string.h. * infcmd.c: Use string.h, not gdb_string.h. * inflow.c: Use string.h, not gdb_string.h. * infrun.c: Use string.h, not gdb_string.h. * interps.c: Use string.h, not gdb_string.h. * iq2000-tdep.c: Use string.h, not gdb_string.h. * irix5-nat.c: Use string.h, not gdb_string.h. * jv-exp.y: Use string.h, not gdb_string.h. * jv-lang.c: Use string.h, not gdb_string.h. * jv-typeprint.c: Use string.h, not gdb_string.h. * jv-valprint.c: Use string.h, not gdb_string.h. * language.c: Use string.h, not gdb_string.h. * linux-fork.c: Use string.h, not gdb_string.h. * linux-nat.c: Use string.h, not gdb_string.h. * lm32-tdep.c: Use string.h, not gdb_string.h. * m2-exp.y: Use string.h, not gdb_string.h. * m2-typeprint.c: Use string.h, not gdb_string.h. * m32c-tdep.c: Use string.h, not gdb_string.h. * m32r-linux-nat.c: Use string.h, not gdb_string.h. * m32r-linux-tdep.c: Use string.h, not gdb_string.h. * m32r-rom.c: Use string.h, not gdb_string.h. * m32r-tdep.c: Use string.h, not gdb_string.h. * m68hc11-tdep.c: Use string.h, not gdb_string.h. * m68k-tdep.c: Use string.h, not gdb_string.h. * m68kbsd-tdep.c: Use string.h, not gdb_string.h. * m68klinux-nat.c: Use string.h, not gdb_string.h. * m68klinux-tdep.c: Use string.h, not gdb_string.h. * m88k-tdep.c: Use string.h, not gdb_string.h. * macrocmd.c: Use string.h, not gdb_string.h. * main.c: Use string.h, not gdb_string.h. * mdebugread.c: Use string.h, not gdb_string.h. * mem-break.c: Use string.h, not gdb_string.h. * memattr.c: Use string.h, not gdb_string.h. * memory-map.c: Use string.h, not gdb_string.h. * mep-tdep.c: Use string.h, not gdb_string.h. * mi/mi-cmd-break.c: Use string.h, not gdb_string.h. * mi/mi-cmd-disas.c: Use string.h, not gdb_string.h. * mi/mi-cmd-env.c: Use string.h, not gdb_string.h. * mi/mi-cmd-stack.c: Use string.h, not gdb_string.h. * mi/mi-cmd-var.c: Use string.h, not gdb_string.h. * mi/mi-cmds.c: Use string.h, not gdb_string.h. * mi/mi-console.c: Use string.h, not gdb_string.h. * mi/mi-getopt.c: Use string.h, not gdb_string.h. * mi/mi-interp.c: Use string.h, not gdb_string.h. * mi/mi-main.c: Use string.h, not gdb_string.h. * mi/mi-parse.c: Use string.h, not gdb_string.h. * microblaze-rom.c: Use string.h, not gdb_string.h. * microblaze-tdep.c: Use string.h, not gdb_string.h. * mingw-hdep.c: Use string.h, not gdb_string.h. * minidebug.c: Use string.h, not gdb_string.h. * minsyms.c: Use string.h, not gdb_string.h. * mips-irix-tdep.c: Use string.h, not gdb_string.h. * mips-linux-tdep.c: Use string.h, not gdb_string.h. * mips-tdep.c: Use string.h, not gdb_string.h. * mips64obsd-tdep.c: Use string.h, not gdb_string.h. * mipsnbsd-tdep.c: Use string.h, not gdb_string.h. * mipsread.c: Use string.h, not gdb_string.h. * mn10300-linux-tdep.c: Use string.h, not gdb_string.h. * mn10300-tdep.c: Use string.h, not gdb_string.h. * monitor.c: Use string.h, not gdb_string.h. * moxie-tdep.c: Use string.h, not gdb_string.h. * mt-tdep.c: Use string.h, not gdb_string.h. * nbsd-tdep.c: Use string.h, not gdb_string.h. * nios2-linux-tdep.c: Use string.h, not gdb_string.h. * nto-procfs.c: Use string.h, not gdb_string.h. * nto-tdep.c: Use string.h, not gdb_string.h. * objc-lang.c: Use string.h, not gdb_string.h. * objfiles.c: Use string.h, not gdb_string.h. * opencl-lang.c: Use string.h, not gdb_string.h. * osabi.c: Use string.h, not gdb_string.h. * osdata.c: Use string.h, not gdb_string.h. * p-exp.y: Use string.h, not gdb_string.h. * p-lang.c: Use string.h, not gdb_string.h. * p-typeprint.c: Use string.h, not gdb_string.h. * parse.c: Use string.h, not gdb_string.h. * posix-hdep.c: Use string.h, not gdb_string.h. * ppc-linux-nat.c: Use string.h, not gdb_string.h. * ppc-sysv-tdep.c: Use string.h, not gdb_string.h. * ppcfbsd-tdep.c: Use string.h, not gdb_string.h. * ppcnbsd-tdep.c: Use string.h, not gdb_string.h. * ppcobsd-tdep.c: Use string.h, not gdb_string.h. * printcmd.c: Use string.h, not gdb_string.h. * procfs.c: Use string.h, not gdb_string.h. * prologue-value.c: Use string.h, not gdb_string.h. * python/py-auto-load.c: Use string.h, not gdb_string.h. * python/py-gdb-readline.c: Use string.h, not gdb_string.h. * ravenscar-thread.c: Use string.h, not gdb_string.h. * regcache.c: Use string.h, not gdb_string.h. * registry.c: Use string.h, not gdb_string.h. * remote-fileio.c: Use string.h, not gdb_string.h. * remote-m32r-sdi.c: Use string.h, not gdb_string.h. * remote-mips.c: Use string.h, not gdb_string.h. * remote-sim.c: Use string.h, not gdb_string.h. * remote.c: Use string.h, not gdb_string.h. * reverse.c: Use string.h, not gdb_string.h. * rs6000-aix-tdep.c: Use string.h, not gdb_string.h. * ser-base.c: Use string.h, not gdb_string.h. * ser-go32.c: Use string.h, not gdb_string.h. * ser-mingw.c: Use string.h, not gdb_string.h. * ser-pipe.c: Use string.h, not gdb_string.h. * ser-tcp.c: Use string.h, not gdb_string.h. * ser-unix.c: Use string.h, not gdb_string.h. * serial.c: Use string.h, not gdb_string.h. * sh-tdep.c: Use string.h, not gdb_string.h. * sh64-tdep.c: Use string.h, not gdb_string.h. * shnbsd-tdep.c: Use string.h, not gdb_string.h. * skip.c: Use string.h, not gdb_string.h. * sol-thread.c: Use string.h, not gdb_string.h. * solib-dsbt.c: Use string.h, not gdb_string.h. * solib-frv.c: Use string.h, not gdb_string.h. * solib-osf.c: Use string.h, not gdb_string.h. * solib-spu.c: Use string.h, not gdb_string.h. * solib-target.c: Use string.h, not gdb_string.h. * solib.c: Use string.h, not gdb_string.h. * somread.c: Use string.h, not gdb_string.h. * source.c: Use string.h, not gdb_string.h. * sparc-nat.c: Use string.h, not gdb_string.h. * sparc-sol2-tdep.c: Use string.h, not gdb_string.h. * sparc-tdep.c: Use string.h, not gdb_string.h. * sparc64-tdep.c: Use string.h, not gdb_string.h. * sparc64fbsd-tdep.c: Use string.h, not gdb_string.h. * sparc64nbsd-tdep.c: Use string.h, not gdb_string.h. * sparcnbsd-tdep.c: Use string.h, not gdb_string.h. * spu-linux-nat.c: Use string.h, not gdb_string.h. * spu-multiarch.c: Use string.h, not gdb_string.h. * spu-tdep.c: Use string.h, not gdb_string.h. * stabsread.c: Use string.h, not gdb_string.h. * stack.c: Use string.h, not gdb_string.h. * std-regs.c: Use string.h, not gdb_string.h. * symfile.c: Use string.h, not gdb_string.h. * symmisc.c: Use string.h, not gdb_string.h. * symtab.c: Use string.h, not gdb_string.h. * target.c: Use string.h, not gdb_string.h. * thread.c: Use string.h, not gdb_string.h. * tilegx-linux-nat.c: Use string.h, not gdb_string.h. * tilegx-tdep.c: Use string.h, not gdb_string.h. * top.c: Use string.h, not gdb_string.h. * tracepoint.c: Use string.h, not gdb_string.h. * tui/tui-command.c: Use string.h, not gdb_string.h. * tui/tui-data.c: Use string.h, not gdb_string.h. * tui/tui-disasm.c: Use string.h, not gdb_string.h. * tui/tui-file.c: Use string.h, not gdb_string.h. * tui/tui-layout.c: Use string.h, not gdb_string.h. * tui/tui-out.c: Use string.h, not gdb_string.h. * tui/tui-regs.c: Use string.h, not gdb_string.h. * tui/tui-source.c: Use string.h, not gdb_string.h. * tui/tui-stack.c: Use string.h, not gdb_string.h. * tui/tui-win.c: Use string.h, not gdb_string.h. * tui/tui-windata.c: Use string.h, not gdb_string.h. * tui/tui-winsource.c: Use string.h, not gdb_string.h. * typeprint.c: Use string.h, not gdb_string.h. * ui-file.c: Use string.h, not gdb_string.h. * ui-out.c: Use string.h, not gdb_string.h. * user-regs.c: Use string.h, not gdb_string.h. * utils.c: Use string.h, not gdb_string.h. * v850-tdep.c: Use string.h, not gdb_string.h. * valarith.c: Use string.h, not gdb_string.h. * valops.c: Use string.h, not gdb_string.h. * valprint.c: Use string.h, not gdb_string.h. * value.c: Use string.h, not gdb_string.h. * varobj.c: Use string.h, not gdb_string.h. * vax-tdep.c: Use string.h, not gdb_string.h. * vaxnbsd-tdep.c: Use string.h, not gdb_string.h. * vaxobsd-tdep.c: Use string.h, not gdb_string.h. * windows-nat.c: Use string.h, not gdb_string.h. * xcoffread.c: Use string.h, not gdb_string.h. * xml-support.c: Use string.h, not gdb_string.h. * xstormy16-tdep.c: Use string.h, not gdb_string.h. * xtensa-linux-nat.c: Use string.h, not gdb_string.h.
2013-11-06 15:14:23 +01:00
#include <string.h>
Support amd64 AVX. gdb/ 2010-04-07 H.J. Lu <hongjiu.lu@intel.com> * amd64-linux-nat.c: Include "regset.h", "elf/common.h", <sys/uio.h> and "i386-xstate.h". (PTRACE_GETREGSET): New. (PTRACE_SETREGSET): Likewise. (have_ptrace_getregset): Likewise. (amd64_linux_gregset64_reg_offset): Include 16 upper YMM registers. (amd64_linux_gregset32_reg_offset): Include 8 upper YMM registers. (amd64_linux_fetch_inferior_registers): Support PTRACE_GETFPREGS. (amd64_linux_store_inferior_registers): Likewise. (amd64_linux_read_description): Check and enable AVX target descriptions. * amd64-linux-tdep.c: Include "regset.h", "i386-linux-tdep.h" and "features/i386/amd64-avx-linux.c". (amd64_linux_regset_sections): New. (amd64_linux_core_read_description): Check and enable AVX target description. (amd64_linux_init_abi): Set xsave_xcr0_offset. Call set_gdbarch_core_regset_sections. (_initialize_amd64_linux_tdep): Call initialize_tdesc_amd64_avx_linux. * amd64-linux-tdep.h (AMD64_LINUX_ORIG_RAX_REGNUM): Replace AMD64_MXCSR_REGNUM with AMD64_YMM15H_REGNUM. (tdesc_amd64_avx_linux): New. (amd64_linux_update_xstateregset): Likewise. * amd64-tdep.c: Include "features/i386/amd64-avx.c". (amd64_ymm_names): New. (amd64_ymmh_names): Likewise. (amd64_register_name): Likewise. (amd64_supply_xstateregset): Likewise. (amd64_collect_xstateregset): Likewise. (amd64_supply_xsave): Likewise. (amd64_collect_xsave): Likewise. (AMD64_NUM_REGS): Removed. (amd64_dwarf_reg_to_regnum): Return %ymmN register number for %xmmN if AVX is available. (amd64_pseudo_register_name): Support pseudo YMM registers. (amd64_regset_from_core_section): Support .reg-xstate section. (amd64_init_abi): Set ymmh_register_names, num_ymm_regs and ymm0h_regnum. Call set_gdbarch_register_name. (amd64_init_abi): Call initialize_tdesc_amd64_avx. * amd64-tdep.h (amd64_regnum): Add AMD64_YMM0H_REGNUM and AMD64_YMM15H_REGNUM. (AMD64_NUM_REGS): New. (amd64_supply_xsave): Likewise. (amd64_collect_xsave): Likewise. (amd64_register_name): Removed. (amd64_register_type): Likewise. gdb/testsuite/ 2010-04-07 H.J. Lu <hongjiu.lu@intel.com> * gdb.arch/i386-avx.c: New. * gdb.arch/i386-avx.exp: Likewise. * gdb.arch/i386-cpuid.h: Updated from gcc 4.4.
2010-04-07 20:46:50 +02:00
#include "elf/common.h"
#include <sys/uio.h>
#include <sys/ptrace.h>
#include <sys/debugreg.h>
#include <sys/syscall.h>
#include <sys/procfs.h>
#include <sys/user.h>
#include <asm/prctl.h>
/* FIXME ezannoni-2003-07-09: we need <sys/reg.h> to be included after
<asm/ptrace.h> because the latter redefines FS and GS for no apparent
reason, and those definitions don't match the ones that libpthread_db
uses, which come from <sys/reg.h>. */
2011-01-07 Michael Snyder <msnyder@vmware.com> * ada-lang.c: Comment cleanup, mostly periods and spaces. * ada-lang.h: Ditto. * ada-tasks.c: Ditto. * ada-valprint.c: Ditto. * aix-threads.c: Ditto. * alpha-linux-nat.c: Ditto. * alpha-linux-tdep.c: Ditto. * alpha-mdebug-tdep.c: Ditto. * alpha-nat.c: Ditto. * alpha-osf1-tdep.c: Ditto. * alpha-tdep.c: Ditto. * alphabsd-nat.c: Ditto. * alphabsd-tdep.c: Ditto. * amd64-darwin-tdep.c: Ditto. * amd64-linux-nat.c: Ditto. * amd64-linux-tdep.c: Ditto. * amd64-sol2-tdep.c: Ditto. * amd64-tdep.c: Ditto. * amd64-fbsd-tdep.c: Ditto. * amd64-nbsd-tdep.c: Ditto. * amd64-obsd-tdep.c: Ditto. * amd64-linux-nat.c: Ditto. * amd64-linux-tdep.c: Ditto. * arm-tdep.c: Ditto. * arm-tdep.h: Ditto. * armnbsd-nat.c: Ditto. * avr-tdep.c: Ditto. * bfin-tdep.c: Ditto. * bsd-kvm.c: Ditto. * c-typeprintc: Ditto. * c-valprint.c: Ditto. * coff-pe-read.h: Ditto. * coffreead.c: Ditto. * cris-tdep.c: Ditto. * d-lang.c: Ditto. * darwin-nat-info.c: Ditto. * darwin-nat.c: Ditto. * dbug-rom.c: Ditto. * dbxread.c: Ditto. * dcache.c: Ditto. * dcache.h: Ditto. * dec-thread.c: Ditto. * defs.h: Ditto. * demangle.c: Ditto. * dicos-tdep.c: Ditto. * dictionary.c: Ditto. * dictionary.h: Ditto. * dink32-rom.c: Ditto. * disasm.c: Ditto. * doublest.c: Ditto. * dsrec.c: Ditto. * dummy-frame.c: Ditto. * dwarf2-frame.c: Ditto. * dwarf2expr.c: Ditto. * dwarf2loc.c: Ditto. * dwarf2read.c: Ditto. * elfread.c: Ditto. * environ.c: Ditto. * eval.c: Ditto. * event-top.h: Ditto. * exceptions.c: Ditto. * exceptions.h: Ditto. * exec.c: Ditto. * expprint.c: Ditto. * expression.h: Ditto. * f-exp.y: Ditto. * f-lang.c: Ditto. * f-lang.h: Ditto. * f-typeprint.c: Ditto. * f-valprint.c: Ditto. * fbsd-nat.c: Ditto. * findvar.c: Ditto. * fork-child.c: Ditto. * frame.c: Ditto. * frame.h: Ditto. * frv-linux-tdep.c: Ditto. * frv-tdep.c: Ditto. * gcore.c: Ditto. * gdb-stabs.h: Ditto. * gdb_assert.h: Ditto. * gdb_string.h: Ditto. * gdb_thread_db.h: Ditto. * gdb_wait.h: Ditto. * gdbarch.sh: Ditto. * gdbcore.h: Ditto. * gdbthread.h: Ditto. * gdbtypes.c: Ditto. * gdbtypes.h: Ditto. * gnu-nat.c: Ditto. * gnu-nat.h: Ditto. * gnu-v2-abi.c: Ditto. * gnu-v3-abi.c: Ditto. * go32-nat.c: Ditto. * gdbarch.c: Regenerate. * gdbarch.h: Regenerate.
2011-01-07 20:36:19 +01:00
/* ezannoni-2003-07-09: I think this is fixed. The extraneous defs have
been removed from ptrace.h in the kernel. However, better safe than
sorry. */
#include <asm/ptrace.h>
#include <sys/reg.h>
#include "gdb_proc_service.h"
* x86-64-tdep.h (x86_64_num_regs, x86_64_num_gregs): Remove variable declarations. (x86_64_register_number, x86_64_register_name): Remove prototypes. (x86_64_linux_frame_saved_pc, x86_64_linux+saved_pc_after_call, x86_64_linux_in_sigtramp, x86_64_linux_frame_chain, x86_64_init_frame_pc, x86_64_init_frame_pc, x86_64_function_has_prologue): Remove prototypes. (X86_64_NUM_GREGS): New define. (x86_64_supply_fxsave, x86_64_fill_fxsave): New prototypes. * x86-64-tdep.c: Don't include "dwarf2cfi.h". Include "dummy_frame.h", "frame.h", "frame-base.h", "frame-unwind.h". (RAX_REGNUM, RDX_REGNUM, RDI_REGNUM, EFLAGS_REGNUM, ST0_REGNUM, XMM1_REGNUM): Remove defines. (X86_64_RAX_REGNUM, X86_64_RDX_REGNUM, X86_64_RDI_REGNUM, X86_64_RBP_REGNUM, X86_64_RSP_REGNUM, X86_64_RIP_REGNUM, X86_64_EFLAGS_REGNUM, X86_64_ST0_REGNUM, X86_64_XMM0_REGNUM, X86_64_XMM1_REGNUM): New defines. (struct x86_64_register_info): Renamed from `struct register_info'. Remove `size' member. (x86_64_register_info_table): Remove variable. (x86_64_register_info): New variable. (X86_64_NUM_REGS): New define. (X86_64_NUM_GREGS): Remove define. (x86_64_num_regs, x86_64_num_gregs): Remove variables. (x86_64_dwarf2gdb_regno_map, x86_64_dwarf2gdb_regno_map_length): Remove variables. (x86_54_dwarf2_reg_to_regnum): Remove function. (x86_64_dwarf_regmap, x86_64_dwarf_regmap_len): New variables. (x86_64_dwarf_reg_to_regnum): New function. (x86_64_register_name): Rewrite. (x86_64_register_raw_size): Remove function. (x86_64_register_byte_table): Remove variable. (x86_64_register_byte): Remove function. (x86_64_register_virtual_type): Remove function. (x86_64_register_type): New function. (x86_64_register_convertible, x86_64_register_convert_to_virtual, x86_64_register_convert_to_raw): Remove functions. (x86_64_push_return_address, x86_64_pop_frame): Remove functon. (x86_64_use_struct_convention): Make static. Adjust for renamed defines. (x86_64_frame_init_saved_regs): Remove function. (x86_64_push_arguments): Make static. Change to accept a regcache as argument. (x86_64_store_return_value, x86_64_extract_return_value): Make static. Rewrite based on i386 counterparts. (x86_64_push_dummy_call): New function. (X86_64_NUM_SAVED_REGS): New define. (x86_64_register_number): Remove function. (x86_64_store_struct_return): Remove function. (x86_64_frameless_function_invocation, x86_64_function_has_prologue): Remove functions. (PROLOG_BUFSIZE): Remove define. (struct x86_64_frame_cache): New structure. (x86_64_alloc_frame_cache, x86_64_analyze_prologue, x86_64_frame_cache, x86_64_frame_this_id, x86_64_frame_prev_register, x86_64_frame_p, x86_64_sigtramp_frame_cache, x86_64_sigtramp_frame_this_id, x86_64_sigtramp_frame_prev_register, x86_sigtramp_frame_p): New functions. (x86_64_frame_unwind, x86_64_sigtramp_frame_unwind): New variables. (x86_64_skip_prologue): Rewrite in terms of x86_64_analyze_prologue. (x86_64_frame_base_address): New function. (x86_64_frame_base): New variable. (x86_64_save_dummy_frame_tos, x86_64_unwind_dummy_id): Rewrite. (x86_64_init_abi): Set register_type and push_dummy_call. Don't set deprecated_fp_regnum, deprecated_register_size, deprecated_register_bytes, register_raw_size, register_byte, register_virtual_type, register_convertiable, register_convert_to_virtual, convert_to_raw, deprecated_get_saved_register, deprecated_target_read_fp, deprecated_push_arguments, deprecated_push_return_address, deprecated_pop_frame, deprecated_store_struct_return, deprecated_frame_init_saved_regs, deprecated_frame_chain, frameless_function_invocation, deprecated_frame_saved_pc, deprecated_saved_pc_after_call, frame_num_args, pc_in_sigtramp, dwarf2_build_frame_info, deprecated_init_extra_frame_info, deprecated_init_frame_pc and virtual_frame_pointer. Call frame_unwind_append_predicate to register x86_64_sigtramp_frame_p and x86_64_frame_p. Call frame_base_set_default to register x86_64_frame_base. (I387_FISEG_REGNUM, I387_FOSEG_REGNUM): New defines. (x86_64_supply_fxsave, x86_64_fill_fxsave): New functions. (_initialize_x86_64_tdep): Remove function. * x86-64-linux-tdep.c: Don't include "dwarf2cfi.h". (LINUX_SIGINFO_SIZE, LINUX_UCONTEXT_SIGCONTEXT_OFFSET, LINUX_SIGCONTEXT_PC_OFFSET, LINUX_SIGCONTEXT_FP_OFFSET): Don't define. (X86_64_LINUX_UCONTEXT_SIGCONTEXT_OFFSET): Define. (x86_64_linux_sigcontext_addr): Rewrite. (x86_64_linux_sigtramp_saved_pc, x86_64_linux_saved_pc_after_call, x86_64_linux_frame_saved_pc): Remove functions. (x86_64_linux_pc_in_sigtramp): Renamed from x86_64_linux_in_sigtramp. Try harder to recognize a signal trampoline. (x86_64_linux_frame_chain, x86_64_init_frame_pc): Remove_functions. (x86_64_linux_init_abi): Set pc_in_sigtramp. Initialize TDEP->sigcontext_addr, TDEP->sc_pc_offset and TDEP->sc_sp_offset. * x86-64-linux-nat.c: Sync with i386-linux-tdep.c. (x86_64_regmap): Rename to regmap. (GETREGS_SUPPLIES): Use X86_64_NUM_GREGS instead of x86_64_num_gregs. (supply_gregset, fill_gregset): Likewise. Use regmap instead of x86_64_regmap. (x86_64_fxsave_offset): Remove function. (supply_fpregset): Simply call x86_64_supply_fxsave. (fill_fpregset): Simply call x86_64_fill_fxsave. (fetch_inferior_registers, store_inferior_registers): Avoid asignment in if-statement. (LINUX_SYSCALL_LEN, LINUX_SYSCALL_REGNUM, SYS_Sigreturn, SYS_rt_sigreturn, LINUX_SIGCONTEXT_EFLAGS_OFFSET, LINUX_UCONTEXT_SIGCONTEXT_OFFSET): Remove defines. (fetch_core_registers): Remove function. (linux_elf_core_fns): Remove. (offsetoff): Don't define. (_initialize_x86_64_linux_nat, kernel_u_size): Remove functions. * config/i386/x86-64linux.mt (TDEPFILES): Add i386-linux-tdep.o. * config/i386/x86-64linux.mh (NATDEPFILES): Remove core-aout.o, add core-regset.o. * config/i386/nm-x86-64linux.h: Use NM_X86_64_LINUX_H for protection against multiple includes instead of NM_X86_64_h. Add various comments. Include "config/nm-linux.h". Don't include <signal.h>. (REGISTER_U_ADDR, KERNEL_U_SIZE, U_REGS_OFFSET, KERN_U_ADDR, GET_THREAD_SIGNALS): Remove defines. (x86_64_register_u_addr, kernel_u_size, lin_thread_get_thread_signals): Remove prototypes. (PTRACE_ARG3_TYPE, PTRACE_XFER_TYPE): Define to `long'. [HAVE_LINK_H]: Don't include "solib.h". [HAVE_LINK_H] (SVR4_SHARED_LIBS): Remove define. * config/i386/tm-x86-64linux.h: Fix comments. * Makefile.in (x86-64-linux-nat.o, x86_64-linux-tdep.o, x86-64-tdep.o): Update dependencies.
2003-05-31 10:15:38 +02:00
/* Prototypes for supply_gregset etc. */
#include "gregset.h"
* amd64-tdep.h: Renamed from x86-64-tdep.h. * amd64-tdep.c: Renamed from x86-64-tdep.c. Include "amd64-tdep.h" instead of "x86-64-tdep.h". * amd64-nat.c: Include "amd64-tdep.h" instead of "x86-64-tdep.h". * amd64-linux-tdep.h: Renamed from x86-64-linux.h. * amd64-linux-tdep.c: Renamed from x86-64-linux-tdep.c. Include "amd64-tdep.h" and "amd64-linux-tdep.h" instead of "x86-64-tdep.h" and "x86-64-tdep.c". * amd64-linux-nat.c: Renamed from x86-64-linux-nat.c. Include "amd64-tdep.h" and "amd64-linux-tdep.h" instead of "x86-64-tdep.h" and "x86-64-tdep.c". * amd64bsd-nat.c: Update copyright year. Include "amd64-tdep.h" instead of "x86-64-tdep.h". * amd64fbsd-tdep.c: Include "amd64-tdep.h" instead of "x86-64-tdep.h". * amd64fbsd-nat.c: Include "amd64-tdep.h" instead of "x86-64-tdep.h". * amd64nbsd-tdep.c: Include "amd64-tdep.h" instead of "x86-64-tdep.h". * amd64nbsd-nat.c: Include "amd64-tdep.h" instead of "x86-64-tdep.h". * amd64obsd-tdep.c: Include "amd64-tdep.h" instead of "x86-64-tdep.h". * amd64obsd-nat.c: Include "amd64-tdep.h" instead of "x86-64-tdep.h". * configure.host: (x86_64-*-linux*): Set gdb_target to linux64. * configure.tgt (x86_64-*-linux*): Set gdb_target to linux64. * Makefile.in (amd64_linux_tdep_h): Renamed from x86_64_linux_tdep_h. (amd64_tdep_h): Renamed from x86_64_tdep_h. (amd64bsd-nat.o, amd64fbsd-nat.o, amd64fbsd-tdep.o, amd64-nat.o) (amd64nbsd-nat.o, amd64nbsd-tdep.o, amd64obsd-nat.o) (amd64obsd-tdep.o): Update dependencies. (amd64-tdep.o, amd64-linux-nat.o, amd64-linux-tdep.o): New dependencies. (x86-64-linux-nat.o, x86-64-linux-tdep.o, x86-64-tdep.o): Remove dependencies. (ALLDEPFILES): Add amd64-tdep.c, amd64obsd-nat.c, amd64obsd-nat.c, amd64-linux-nat.c amd64-linux-tdep.c. * config/i386/tm-linux64.h: Renamed from tm-x86-64linux.h * config/i386/nm-linux64.h: Renamed from nm-x86-64linux.h. * config/i386/linux64.mt: Renamed from x86-64linux.mt. (TDEPFILES): Replace x86-64-tdep.o and x86-64-linux-tdep.o with amd64-tdep.o and amd64-linux-tdep.o. (TM_FILE): Set to tm-linux64.h. * config/i386/linux64.mh: Renamed from x86-64linux.mh. (NAT_FILE): Set to nm-linux64.h. (NATDEPFILES): Replace x86-64-linux-nat.o with amd64-linux-nat.o. * config/i386/fbsd64.mt (TDEPFILES): Replace x86-64-tdep.o with amd64-tdep.o. * config/i386/nbsd64.mt (TDEPFILES): Replace x86-64-tdep.o with amd64-tdep.o. * config/i386/obsd64.mt (TDEPFILES): Replace x86-64-tdep.o with amd64-tdep.o.
2004-02-25 21:45:31 +01:00
#include "amd64-tdep.h"
#include "i386-linux-tdep.h"
#include "amd64-nat.h"
Remove all i386 debug register low level macros in config nm files. (I386_DR_LOW_SET_ADDR, I386_DR_LOW_RESET_ADDR): Remove. (I386_DR_LOW_GET_STATUS, I386_DR_LOW_SET_CONTROL): Remove. (I386_USE_GENERIC_WATCHPOIINTS): Remove. * i386-nat.h: New file (adapted from config/i386/nm-i386.h). (struct i386_dr_low_type): New type. (i386_dr_low): New global variable. * i386-nat.c (TARGET_HAS_DR_LEN_8): Update macro. (i386_insert_aligned_watchpoint): Replace i386 dr low macros by i386_dr_low struct variable fields. (i386_remove_aligned_watchpoint): Likewise. (i386_stopped_data_address): Likewise. (i386_stopped_by_hwbp): Likewise. (show_debug_regs_command_added): New static variable. (add_show_debug_regs_command): New static function. (i386_use_watchpoints): Call add_show_debug_regs_command if not done. (i386_set_debug_register_length): New function. (_initialize_i386_nat): Delete. * amd64-linux-nat.c: Include "i386-nat.h". (amd64_linux_dr_set_control): Change to static. (amd64_linux_dr_get_status): Change to static. (amd64_linux_dr_set_addr,amd64_linux_dr_reset_addr): Likewise. (_initialize_amd64_linux_nat): Set i386_dr_low variable fields. * go32-nat.c: Include "i386-nat.h". (go32_set_addr): Change to static. (go32_set_dr7): Change to static. Change arg type to unisgned long. (go32_get_dr6): Change to static. Change return type to unisnged long. (init_go32_ops): Set i386_dr_low variable fields. * i386-linux-nat.c: Include "i386-nat.h". (i386_linux_dr_set_control, i386_linux_dr_get_status): Change to static. (i386_linux_dr_set_addr, i386_linux_dr_reset_addr): Idem. (_initialize_i386_linux_nat): Set i386_dr_low variable fields. * i386bsd-nat.h: Declare functions used for i386_dr_low fields in i386fbsd-nat.c. * i386fbsd-nat.c: Include "i386-nat.h". (_initialize_i386fbsd_nat): Set i386_dr_low variable fields. * windows-nat.c: Include "i386-nat.h". (cygwin_set_dr, cygwin_get_dr6, cygwin_set_dr7): Add prototypes. Change to static. (cygwin_get_dr6): Change return type to unisnged long. (cygwin_set_dr7): Change arg type to unisgned long. (init_windows_ops): Set i386_dr_low function fields. * amd64-windows-nat.c (_initialize_amd64_windows_nat): Call i386_set_debug_register_length. * i386-windows-nat.c (_initialize_i386_windows_nat): Likewise. * config/i386/nm-cygwin.h: Remove all I386_* macros. * config/i386/nm-cygwin64.h: Likewise. * config/i386/nm-fbsd.h: Likewise. * config/i386/nm-linux.h: Likewise. * config/i386/nm-i386.h: Remove completely. * config/i386/nm-go32.h: Remove completely. * config/i386/nm-linux64.h: Remove completely. * config/i386/go32.mh (NAT_FILE): Remove entry. * config/i386/linux64.h (NAT_FILE): Change to config/nm-linux.h.
2009-05-14 11:37:00 +02:00
#include "i386-nat.h"
Support amd64 AVX. gdb/ 2010-04-07 H.J. Lu <hongjiu.lu@intel.com> * amd64-linux-nat.c: Include "regset.h", "elf/common.h", <sys/uio.h> and "i386-xstate.h". (PTRACE_GETREGSET): New. (PTRACE_SETREGSET): Likewise. (have_ptrace_getregset): Likewise. (amd64_linux_gregset64_reg_offset): Include 16 upper YMM registers. (amd64_linux_gregset32_reg_offset): Include 8 upper YMM registers. (amd64_linux_fetch_inferior_registers): Support PTRACE_GETFPREGS. (amd64_linux_store_inferior_registers): Likewise. (amd64_linux_read_description): Check and enable AVX target descriptions. * amd64-linux-tdep.c: Include "regset.h", "i386-linux-tdep.h" and "features/i386/amd64-avx-linux.c". (amd64_linux_regset_sections): New. (amd64_linux_core_read_description): Check and enable AVX target description. (amd64_linux_init_abi): Set xsave_xcr0_offset. Call set_gdbarch_core_regset_sections. (_initialize_amd64_linux_tdep): Call initialize_tdesc_amd64_avx_linux. * amd64-linux-tdep.h (AMD64_LINUX_ORIG_RAX_REGNUM): Replace AMD64_MXCSR_REGNUM with AMD64_YMM15H_REGNUM. (tdesc_amd64_avx_linux): New. (amd64_linux_update_xstateregset): Likewise. * amd64-tdep.c: Include "features/i386/amd64-avx.c". (amd64_ymm_names): New. (amd64_ymmh_names): Likewise. (amd64_register_name): Likewise. (amd64_supply_xstateregset): Likewise. (amd64_collect_xstateregset): Likewise. (amd64_supply_xsave): Likewise. (amd64_collect_xsave): Likewise. (AMD64_NUM_REGS): Removed. (amd64_dwarf_reg_to_regnum): Return %ymmN register number for %xmmN if AVX is available. (amd64_pseudo_register_name): Support pseudo YMM registers. (amd64_regset_from_core_section): Support .reg-xstate section. (amd64_init_abi): Set ymmh_register_names, num_ymm_regs and ymm0h_regnum. Call set_gdbarch_register_name. (amd64_init_abi): Call initialize_tdesc_amd64_avx. * amd64-tdep.h (amd64_regnum): Add AMD64_YMM0H_REGNUM and AMD64_YMM15H_REGNUM. (AMD64_NUM_REGS): New. (amd64_supply_xsave): Likewise. (amd64_collect_xsave): Likewise. (amd64_register_name): Removed. (amd64_register_type): Likewise. gdb/testsuite/ 2010-04-07 H.J. Lu <hongjiu.lu@intel.com> * gdb.arch/i386-avx.c: New. * gdb.arch/i386-avx.exp: Likewise. * gdb.arch/i386-cpuid.h: Updated from gcc 4.4.
2010-04-07 20:46:50 +02:00
#include "i386-xstate.h"
#ifndef PTRACE_GETREGSET
#define PTRACE_GETREGSET 0x4204
#endif
#ifndef PTRACE_SETREGSET
#define PTRACE_SETREGSET 0x4205
#endif
gdb/ 2011-12-14 Pedro Alves <pedro@codesourcery.com> PR threads/10729 * linux-nat.c (linux_nat_new_thread): Change parameter to an lwp pointer. (linux_nat_prepare_to_resume): New global. (lwp_free): New. (purge_lwp_list): Use it. (add_lwp): Call linux_nat_new_thread even on the first LWP. Adjust to interface change. (delete_lwp): Call lwp_free instead of xfree. (detach_callback, linux_nat_detach, resume_lwp, linux_nat_resume) (linux_handle_syscall_trap, linux_handle_extended_wait) (linux_nat_filter_event, resume_stopped_resumed_lwps): Call linux_nat_prepare_to_resume before resuming. (linux_stop_lwp): New. (linux_nat_set_new_thread): Adjust. (linux_nat_set_prepare_to_resume): New. * linux-nat.h (struct arch_lwp_info): Forward declare. (struct lwp_info) <arch_private>: New field. (linux_stop_lwp): Declare. (linux_nat_set_new_thread): Adjust. (linux_nat_set_prepare_to_resume): New. * i386-nat.c (DR_NADDR, DR_STATUS, DR_CONTROL) (struct i386_debug_reg_state): Move to i386-nat.h. (dr_mirror): Comment. (i386_debug_reg_state): New. (i386_update_inferior_debug_regs): Simplify. (i386_stopped_data_address): Use the debug register state from the inferior, not from the local cache. * i386-nat.h (struct i386_dr_low_type): Delete reset_addr and unset_status fields. New get_addr and get_control fields. (DR_FIRSTADDR, DR_LASTADDR, DR_CONTROL): Moved from i386-nat.c. (DR_NADDR, DR_STATUS): New. (struct i386_debug_reg_state): Moved from i386-nat.c. * amd64-linux-nat.c (struct arch_lwp_info): New. (amd64_linux_dr): Delete global. (amd64_linux_dr_get_addr): New. (amd64_linux_dr_get_control): New. (amd64_linux_dr_unset_status): Delete. (amd64_linux_dr_set_addr): Reimplement. (amd64_linux_dr_reset_addr): Delete. (update_debug_registers_callback): New. (amd64_linux_dr_set_control): Reimplement. (amd64_linux_dr_set_addr): Reimplement. (amd64_linux_prepare_to_resume): New. (amd64_linux_new_thread): Change parameter to an lwp pointer. Reimplement. (_initialize_amd64_linux_nat): No longer install i386_dr_low.reset_addr and i386_dr_low.unset_status. Install amd64_linux_dr_get_control as i386_dr_low.get_control. Install amd64_linux_dr_get_addr as i386_dr_low.get_addr. Install amd64_linux_prepare_to_resume. * i386-linux-nat.c (DR_FIRSTADDR, DR_LASTADDR, DR_STATUS) (DR_CONTROL): Delete. (struct arch_lwp_info): New. (i386_linux_dr): Delete global. (i386_linux_dr_set_control): Reimplement. (i386_linux_dr_get_addr): New. (i386_linux_dr_set_addr): Reimplement. (i386_linux_dr_get_control): New. (update_debug_registers_callback): New. (i386_linux_dr_unset_status): Delete. (i386_linux_dr_set_addr): Reimplement. (i386_linux_prepare_to_resume): New. (i386_linux_new_thread): Change parameter to an lwp pointer. Reimplement. (_initialize_i386_linux_nat): No longer install i386_dr_low.reset_addr and i386_dr_low.unset_status. Install i386_linux_dr_get_control as i386_dr_low.get_control. Install i386_linux_dr_get_addr as i386_dr_low.get_addr. Install i386_linux_prepare_to_resume. * arm-linux-nat.c (arm_linux_new_thread): Change parameter to an lwp pointer. Adjust. * ia64-linux-nat.c (ia64_linux_new_thread): Likewise. * mips-linux-nat.c (mips_linux_new_thread): Likewise. * ppc-linux-nat.c (ppc_linux_new_thread): Likewise. * s390-nat.c (s390_fix_watch_points): Likewise. * i386-darwin-nat.c (DR_FIRSTADDR, DR_LASTADDR, DR_STATUS) (DR_CONTROL): Delete. (i386_darwin_dr_reset_addr): Delete. (i386_darwin_dr_get_addr): New. (i386_darwin_dr_get_control): New. * go32-nat.c (go32_get_dr7, go32_get_dr): New. (init_go32_ops): No longer install i386_dr_low.reset_addr. Install go32_get_dr7 as i386_dr_low.get_control. Install go32_get_dr as i386_dr_low.get_addr. * i386bsd-nat.c (i386bsd_dr_get): New. (i386bsd_dr_reset_addr): Delete. (i386bsd_dr_get_addr): New. (i386bsd_dr_get_status): Use i386bsd_dr_get. (i386bsd_dr_get_control): New. * i386bsd-nat.h (i386bsd_dr_reset_addr): Delete. (i386bsd_dr_get_addr): New. (i386bsd_dr_get_control): New. * i386fbsd-nat.c (_initialize_i386fbsd_nat): No longer install i386_dr_low.reset_addr and i386_dr_low.unset_status. Install i386bsd_dr_get_control as i386_dr_low.get_control. Install i386bsd_dr_get_addr as i386_dr_low.get_addr. * windows-nat.c (init_windows_ops): No longer install i386_dr_low.reset_addr and i386_dr_low.unset_status. Install cygwin_get_dr7 as i386_dr_low.get_control. Install cygwin_get_dr as i386_dr_low.get_addr. (cygwin_get_dr): New. (cygwin_get_dr7): New. gdb/testsuite/ 2011-12-14 Pedro Alves <pedro@codesourcery.com> PR threads/10729 * gdb.mi/watch-nonstop.c: New file. * gdb.mi/mi-watch-nonstop.exp: New file.
2011-12-14 18:20:32 +01:00
/* Per-thread arch-specific data we want to keep. */
struct arch_lwp_info
{
/* Non-zero if our copy differs from what's recorded in the thread. */
int debug_registers_changed;
};
Support amd64 AVX. gdb/ 2010-04-07 H.J. Lu <hongjiu.lu@intel.com> * amd64-linux-nat.c: Include "regset.h", "elf/common.h", <sys/uio.h> and "i386-xstate.h". (PTRACE_GETREGSET): New. (PTRACE_SETREGSET): Likewise. (have_ptrace_getregset): Likewise. (amd64_linux_gregset64_reg_offset): Include 16 upper YMM registers. (amd64_linux_gregset32_reg_offset): Include 8 upper YMM registers. (amd64_linux_fetch_inferior_registers): Support PTRACE_GETFPREGS. (amd64_linux_store_inferior_registers): Likewise. (amd64_linux_read_description): Check and enable AVX target descriptions. * amd64-linux-tdep.c: Include "regset.h", "i386-linux-tdep.h" and "features/i386/amd64-avx-linux.c". (amd64_linux_regset_sections): New. (amd64_linux_core_read_description): Check and enable AVX target description. (amd64_linux_init_abi): Set xsave_xcr0_offset. Call set_gdbarch_core_regset_sections. (_initialize_amd64_linux_tdep): Call initialize_tdesc_amd64_avx_linux. * amd64-linux-tdep.h (AMD64_LINUX_ORIG_RAX_REGNUM): Replace AMD64_MXCSR_REGNUM with AMD64_YMM15H_REGNUM. (tdesc_amd64_avx_linux): New. (amd64_linux_update_xstateregset): Likewise. * amd64-tdep.c: Include "features/i386/amd64-avx.c". (amd64_ymm_names): New. (amd64_ymmh_names): Likewise. (amd64_register_name): Likewise. (amd64_supply_xstateregset): Likewise. (amd64_collect_xstateregset): Likewise. (amd64_supply_xsave): Likewise. (amd64_collect_xsave): Likewise. (AMD64_NUM_REGS): Removed. (amd64_dwarf_reg_to_regnum): Return %ymmN register number for %xmmN if AVX is available. (amd64_pseudo_register_name): Support pseudo YMM registers. (amd64_regset_from_core_section): Support .reg-xstate section. (amd64_init_abi): Set ymmh_register_names, num_ymm_regs and ymm0h_regnum. Call set_gdbarch_register_name. (amd64_init_abi): Call initialize_tdesc_amd64_avx. * amd64-tdep.h (amd64_regnum): Add AMD64_YMM0H_REGNUM and AMD64_YMM15H_REGNUM. (AMD64_NUM_REGS): New. (amd64_supply_xsave): Likewise. (amd64_collect_xsave): Likewise. (amd64_register_name): Removed. (amd64_register_type): Likewise. gdb/testsuite/ 2010-04-07 H.J. Lu <hongjiu.lu@intel.com> * gdb.arch/i386-avx.c: New. * gdb.arch/i386-avx.exp: Likewise. * gdb.arch/i386-cpuid.h: Updated from gcc 4.4.
2010-04-07 20:46:50 +02:00
/* Does the current host support PTRACE_GETREGSET? */
static int have_ptrace_getregset = -1;
/* Mapping between the general-purpose registers in GNU/Linux x86-64
`struct user' format and GDB's register cache layout for GNU/Linux
i386.
Note that most GNU/Linux x86-64 registers are 64-bit, while the
GNU/Linux i386 registers are all 32-bit, but since we're
little-endian we get away with that. */
/* From <sys/reg.h> on GNU/Linux i386. */
static int amd64_linux_gregset32_reg_offset[] =
{
RAX * 8, RCX * 8, /* %eax, %ecx */
RDX * 8, RBX * 8, /* %edx, %ebx */
RSP * 8, RBP * 8, /* %esp, %ebp */
RSI * 8, RDI * 8, /* %esi, %edi */
RIP * 8, EFLAGS * 8, /* %eip, %eflags */
CS * 8, SS * 8, /* %cs, %ss */
DS * 8, ES * 8, /* %ds, %es */
FS * 8, GS * 8, /* %fs, %gs */
-1, -1, -1, -1, -1, -1, -1, -1,
-1, -1, -1, -1, -1, -1, -1, -1,
-1, -1, -1, -1, -1, -1, -1, -1, -1,
Support amd64 AVX. gdb/ 2010-04-07 H.J. Lu <hongjiu.lu@intel.com> * amd64-linux-nat.c: Include "regset.h", "elf/common.h", <sys/uio.h> and "i386-xstate.h". (PTRACE_GETREGSET): New. (PTRACE_SETREGSET): Likewise. (have_ptrace_getregset): Likewise. (amd64_linux_gregset64_reg_offset): Include 16 upper YMM registers. (amd64_linux_gregset32_reg_offset): Include 8 upper YMM registers. (amd64_linux_fetch_inferior_registers): Support PTRACE_GETFPREGS. (amd64_linux_store_inferior_registers): Likewise. (amd64_linux_read_description): Check and enable AVX target descriptions. * amd64-linux-tdep.c: Include "regset.h", "i386-linux-tdep.h" and "features/i386/amd64-avx-linux.c". (amd64_linux_regset_sections): New. (amd64_linux_core_read_description): Check and enable AVX target description. (amd64_linux_init_abi): Set xsave_xcr0_offset. Call set_gdbarch_core_regset_sections. (_initialize_amd64_linux_tdep): Call initialize_tdesc_amd64_avx_linux. * amd64-linux-tdep.h (AMD64_LINUX_ORIG_RAX_REGNUM): Replace AMD64_MXCSR_REGNUM with AMD64_YMM15H_REGNUM. (tdesc_amd64_avx_linux): New. (amd64_linux_update_xstateregset): Likewise. * amd64-tdep.c: Include "features/i386/amd64-avx.c". (amd64_ymm_names): New. (amd64_ymmh_names): Likewise. (amd64_register_name): Likewise. (amd64_supply_xstateregset): Likewise. (amd64_collect_xstateregset): Likewise. (amd64_supply_xsave): Likewise. (amd64_collect_xsave): Likewise. (AMD64_NUM_REGS): Removed. (amd64_dwarf_reg_to_regnum): Return %ymmN register number for %xmmN if AVX is available. (amd64_pseudo_register_name): Support pseudo YMM registers. (amd64_regset_from_core_section): Support .reg-xstate section. (amd64_init_abi): Set ymmh_register_names, num_ymm_regs and ymm0h_regnum. Call set_gdbarch_register_name. (amd64_init_abi): Call initialize_tdesc_amd64_avx. * amd64-tdep.h (amd64_regnum): Add AMD64_YMM0H_REGNUM and AMD64_YMM15H_REGNUM. (AMD64_NUM_REGS): New. (amd64_supply_xsave): Likewise. (amd64_collect_xsave): Likewise. (amd64_register_name): Removed. (amd64_register_type): Likewise. gdb/testsuite/ 2010-04-07 H.J. Lu <hongjiu.lu@intel.com> * gdb.arch/i386-avx.c: New. * gdb.arch/i386-avx.exp: Likewise. * gdb.arch/i386-cpuid.h: Updated from gcc 4.4.
2010-04-07 20:46:50 +02:00
-1, -1, -1, -1, -1, -1, -1, -1,
-1, -1, -1, -1, /* MPX registers BND0 ... BND3. */
-1, -1, /* MPX registers BNDCFGU, BNDSTATUS. */
ORIG_RAX * 8, /* "orig_eax" */
};
/* Transfering the general-purpose registers between GDB, inferiors
and core files. */
/* Fill GDB's register cache with the general-purpose register values
in *GREGSETP. */
void
* gregset.h (struct regcache): Add forward declaration. (supply_gregset): Add REGCACHE parameter, make GREGS const. (supply_fpregset): Add REGCACHE parameter, make FPREGS const. (supply_fpxregset): Add REGCACHE parameter, make FPXREGS const. (fill_gregset): Add REGCACHE parameter. (fill_fpregset): Likewise. (fill_fpxregset): Likewise. Update all definitions accordingly: * alphabsd-nat.c, alpha-linux-nat.c, alpha-nat.c, amd64-linux-nat.c, arm-linux-nat.c, hppa-linux-nat.c, i386gnu-nat.c, i386-linux-nat.c, i386-sol2-nat.c, i386v4-nat.c, ia64-linux-nat.c, irix5-nat.c, m32r-linux-nat.c, m68klinux-nat.c, mips-linux-nat.c, ppc-linux-nat.c, s390-nat.c, sparc64-linux-nat.c, sparc-linux-nat.c, sparc-sol2-nat.c (supply_gregset): Add REGCACHE parameter, use it instead of current_regcache. Make GREGSETP parameter const, adapt casts. (supply_fpregset): Add REGCACHE parameter, use it instead of current_regcache. Make FPREGSETP parameter const, adapt casts. (fill_gregset): Add REGCACHE parameter, use it instead of current_regcache. (fill_fpregset): Likewise. Update all callers to pass in current_regcache as the new argument: * core-regset.c: Include "regcache.h". (fetch_core_registers): Update supply_gregset,and supply_fpregset calls. * procfs.c: Include "regcache.h". (procfs_fetch_registers): Update supply_gregset, supply_fpregset calls. (procfs_store_registers): Update fill_gregset, fill_fpregset calls. (procfs_do_thread_registers): Likewise. (procfs_make_note_section): Likewise. * proc-service.c: Include "regcache.h". (ps_lgetregs): Update fill_gregset call. (ps_lsetregs): Update supply_gregset call. (ps_lgetfpregs): Update fill_fpregset call. (ps_lsetfpregs): Update supply_fpregset call. * sol-thread.c (sol_thread_fetch_registers): Update supply_gregset, supply_fpregset calls. (sol_thread_store_registers): Update fill_gregset, fill_fpregset calls. (ps_lgetregs): Update fill_gregset call. (ps_lsetregs): Update supply_gregset call. (ps_lgetfpregs): Update fill_fpregset call. (ps_lsetfpregs): Update supply_fpregset call. * linux-nat.c (linux_nat_do_thread_registers): Update fill_gregset, fill_fpregset, and fill_fpxregset calls. * i386-linux-nat.c (fetch_regs): Update supply_gregset call. (store_regs): Update fill_gregset call. (fetch_fpregs): Update supply_fpregset call. (store_fpregs): Update fill_fpregset call. (fetch_fpxregs): Update supply_fpxregset call. (store_fpxregs): Update fill_fpxregset call. * m32r-linux-nat.c (fetch_regs): Update supply_gregset call. (store_regs): Update fill_gregset call. * m68klinux-nat.c (fetch_regs): Update supply_gregset call. (store_regs): Update fill_gregset call. (fetch_fpregs): Update supply_fpregset call. (store_fpregs): Update fill_fpregset call. (fetch_core_registers): Update supply_gregset, supply_fpregset calls. * s390-nat.c (fetch_regs): Update supply_gregset call. (store_regs): Update fill_gregset call. (fetch_fpregs): Update supply_fpregset call. (store_fpregs): Update fill_fpregset call. * Makefile.in (core-regset.o, procfs.o, proc-service.o): Update dependencies.
2007-05-06 16:32:31 +02:00
supply_gregset (struct regcache *regcache, const elf_gregset_t *gregsetp)
{
* gregset.h (struct regcache): Add forward declaration. (supply_gregset): Add REGCACHE parameter, make GREGS const. (supply_fpregset): Add REGCACHE parameter, make FPREGS const. (supply_fpxregset): Add REGCACHE parameter, make FPXREGS const. (fill_gregset): Add REGCACHE parameter. (fill_fpregset): Likewise. (fill_fpxregset): Likewise. Update all definitions accordingly: * alphabsd-nat.c, alpha-linux-nat.c, alpha-nat.c, amd64-linux-nat.c, arm-linux-nat.c, hppa-linux-nat.c, i386gnu-nat.c, i386-linux-nat.c, i386-sol2-nat.c, i386v4-nat.c, ia64-linux-nat.c, irix5-nat.c, m32r-linux-nat.c, m68klinux-nat.c, mips-linux-nat.c, ppc-linux-nat.c, s390-nat.c, sparc64-linux-nat.c, sparc-linux-nat.c, sparc-sol2-nat.c (supply_gregset): Add REGCACHE parameter, use it instead of current_regcache. Make GREGSETP parameter const, adapt casts. (supply_fpregset): Add REGCACHE parameter, use it instead of current_regcache. Make FPREGSETP parameter const, adapt casts. (fill_gregset): Add REGCACHE parameter, use it instead of current_regcache. (fill_fpregset): Likewise. Update all callers to pass in current_regcache as the new argument: * core-regset.c: Include "regcache.h". (fetch_core_registers): Update supply_gregset,and supply_fpregset calls. * procfs.c: Include "regcache.h". (procfs_fetch_registers): Update supply_gregset, supply_fpregset calls. (procfs_store_registers): Update fill_gregset, fill_fpregset calls. (procfs_do_thread_registers): Likewise. (procfs_make_note_section): Likewise. * proc-service.c: Include "regcache.h". (ps_lgetregs): Update fill_gregset call. (ps_lsetregs): Update supply_gregset call. (ps_lgetfpregs): Update fill_fpregset call. (ps_lsetfpregs): Update supply_fpregset call. * sol-thread.c (sol_thread_fetch_registers): Update supply_gregset, supply_fpregset calls. (sol_thread_store_registers): Update fill_gregset, fill_fpregset calls. (ps_lgetregs): Update fill_gregset call. (ps_lsetregs): Update supply_gregset call. (ps_lgetfpregs): Update fill_fpregset call. (ps_lsetfpregs): Update supply_fpregset call. * linux-nat.c (linux_nat_do_thread_registers): Update fill_gregset, fill_fpregset, and fill_fpxregset calls. * i386-linux-nat.c (fetch_regs): Update supply_gregset call. (store_regs): Update fill_gregset call. (fetch_fpregs): Update supply_fpregset call. (store_fpregs): Update fill_fpregset call. (fetch_fpxregs): Update supply_fpxregset call. (store_fpxregs): Update fill_fpxregset call. * m32r-linux-nat.c (fetch_regs): Update supply_gregset call. (store_regs): Update fill_gregset call. * m68klinux-nat.c (fetch_regs): Update supply_gregset call. (store_regs): Update fill_gregset call. (fetch_fpregs): Update supply_fpregset call. (store_fpregs): Update fill_fpregset call. (fetch_core_registers): Update supply_gregset, supply_fpregset calls. * s390-nat.c (fetch_regs): Update supply_gregset call. (store_regs): Update fill_gregset call. (fetch_fpregs): Update supply_fpregset call. (store_fpregs): Update fill_fpregset call. * Makefile.in (core-regset.o, procfs.o, proc-service.o): Update dependencies.
2007-05-06 16:32:31 +02:00
amd64_supply_native_gregset (regcache, gregsetp, -1);
}
/* Fill register REGNUM (if it is a general-purpose register) in
*GREGSETP with the value in GDB's register cache. If REGNUM is -1,
do this for all registers. */
void
* gregset.h (struct regcache): Add forward declaration. (supply_gregset): Add REGCACHE parameter, make GREGS const. (supply_fpregset): Add REGCACHE parameter, make FPREGS const. (supply_fpxregset): Add REGCACHE parameter, make FPXREGS const. (fill_gregset): Add REGCACHE parameter. (fill_fpregset): Likewise. (fill_fpxregset): Likewise. Update all definitions accordingly: * alphabsd-nat.c, alpha-linux-nat.c, alpha-nat.c, amd64-linux-nat.c, arm-linux-nat.c, hppa-linux-nat.c, i386gnu-nat.c, i386-linux-nat.c, i386-sol2-nat.c, i386v4-nat.c, ia64-linux-nat.c, irix5-nat.c, m32r-linux-nat.c, m68klinux-nat.c, mips-linux-nat.c, ppc-linux-nat.c, s390-nat.c, sparc64-linux-nat.c, sparc-linux-nat.c, sparc-sol2-nat.c (supply_gregset): Add REGCACHE parameter, use it instead of current_regcache. Make GREGSETP parameter const, adapt casts. (supply_fpregset): Add REGCACHE parameter, use it instead of current_regcache. Make FPREGSETP parameter const, adapt casts. (fill_gregset): Add REGCACHE parameter, use it instead of current_regcache. (fill_fpregset): Likewise. Update all callers to pass in current_regcache as the new argument: * core-regset.c: Include "regcache.h". (fetch_core_registers): Update supply_gregset,and supply_fpregset calls. * procfs.c: Include "regcache.h". (procfs_fetch_registers): Update supply_gregset, supply_fpregset calls. (procfs_store_registers): Update fill_gregset, fill_fpregset calls. (procfs_do_thread_registers): Likewise. (procfs_make_note_section): Likewise. * proc-service.c: Include "regcache.h". (ps_lgetregs): Update fill_gregset call. (ps_lsetregs): Update supply_gregset call. (ps_lgetfpregs): Update fill_fpregset call. (ps_lsetfpregs): Update supply_fpregset call. * sol-thread.c (sol_thread_fetch_registers): Update supply_gregset, supply_fpregset calls. (sol_thread_store_registers): Update fill_gregset, fill_fpregset calls. (ps_lgetregs): Update fill_gregset call. (ps_lsetregs): Update supply_gregset call. (ps_lgetfpregs): Update fill_fpregset call. (ps_lsetfpregs): Update supply_fpregset call. * linux-nat.c (linux_nat_do_thread_registers): Update fill_gregset, fill_fpregset, and fill_fpxregset calls. * i386-linux-nat.c (fetch_regs): Update supply_gregset call. (store_regs): Update fill_gregset call. (fetch_fpregs): Update supply_fpregset call. (store_fpregs): Update fill_fpregset call. (fetch_fpxregs): Update supply_fpxregset call. (store_fpxregs): Update fill_fpxregset call. * m32r-linux-nat.c (fetch_regs): Update supply_gregset call. (store_regs): Update fill_gregset call. * m68klinux-nat.c (fetch_regs): Update supply_gregset call. (store_regs): Update fill_gregset call. (fetch_fpregs): Update supply_fpregset call. (store_fpregs): Update fill_fpregset call. (fetch_core_registers): Update supply_gregset, supply_fpregset calls. * s390-nat.c (fetch_regs): Update supply_gregset call. (store_regs): Update fill_gregset call. (fetch_fpregs): Update supply_fpregset call. (store_fpregs): Update fill_fpregset call. * Makefile.in (core-regset.o, procfs.o, proc-service.o): Update dependencies.
2007-05-06 16:32:31 +02:00
fill_gregset (const struct regcache *regcache,
elf_gregset_t *gregsetp, int regnum)
{
* gregset.h (struct regcache): Add forward declaration. (supply_gregset): Add REGCACHE parameter, make GREGS const. (supply_fpregset): Add REGCACHE parameter, make FPREGS const. (supply_fpxregset): Add REGCACHE parameter, make FPXREGS const. (fill_gregset): Add REGCACHE parameter. (fill_fpregset): Likewise. (fill_fpxregset): Likewise. Update all definitions accordingly: * alphabsd-nat.c, alpha-linux-nat.c, alpha-nat.c, amd64-linux-nat.c, arm-linux-nat.c, hppa-linux-nat.c, i386gnu-nat.c, i386-linux-nat.c, i386-sol2-nat.c, i386v4-nat.c, ia64-linux-nat.c, irix5-nat.c, m32r-linux-nat.c, m68klinux-nat.c, mips-linux-nat.c, ppc-linux-nat.c, s390-nat.c, sparc64-linux-nat.c, sparc-linux-nat.c, sparc-sol2-nat.c (supply_gregset): Add REGCACHE parameter, use it instead of current_regcache. Make GREGSETP parameter const, adapt casts. (supply_fpregset): Add REGCACHE parameter, use it instead of current_regcache. Make FPREGSETP parameter const, adapt casts. (fill_gregset): Add REGCACHE parameter, use it instead of current_regcache. (fill_fpregset): Likewise. Update all callers to pass in current_regcache as the new argument: * core-regset.c: Include "regcache.h". (fetch_core_registers): Update supply_gregset,and supply_fpregset calls. * procfs.c: Include "regcache.h". (procfs_fetch_registers): Update supply_gregset, supply_fpregset calls. (procfs_store_registers): Update fill_gregset, fill_fpregset calls. (procfs_do_thread_registers): Likewise. (procfs_make_note_section): Likewise. * proc-service.c: Include "regcache.h". (ps_lgetregs): Update fill_gregset call. (ps_lsetregs): Update supply_gregset call. (ps_lgetfpregs): Update fill_fpregset call. (ps_lsetfpregs): Update supply_fpregset call. * sol-thread.c (sol_thread_fetch_registers): Update supply_gregset, supply_fpregset calls. (sol_thread_store_registers): Update fill_gregset, fill_fpregset calls. (ps_lgetregs): Update fill_gregset call. (ps_lsetregs): Update supply_gregset call. (ps_lgetfpregs): Update fill_fpregset call. (ps_lsetfpregs): Update supply_fpregset call. * linux-nat.c (linux_nat_do_thread_registers): Update fill_gregset, fill_fpregset, and fill_fpxregset calls. * i386-linux-nat.c (fetch_regs): Update supply_gregset call. (store_regs): Update fill_gregset call. (fetch_fpregs): Update supply_fpregset call. (store_fpregs): Update fill_fpregset call. (fetch_fpxregs): Update supply_fpxregset call. (store_fpxregs): Update fill_fpxregset call. * m32r-linux-nat.c (fetch_regs): Update supply_gregset call. (store_regs): Update fill_gregset call. * m68klinux-nat.c (fetch_regs): Update supply_gregset call. (store_regs): Update fill_gregset call. (fetch_fpregs): Update supply_fpregset call. (store_fpregs): Update fill_fpregset call. (fetch_core_registers): Update supply_gregset, supply_fpregset calls. * s390-nat.c (fetch_regs): Update supply_gregset call. (store_regs): Update fill_gregset call. (fetch_fpregs): Update supply_fpregset call. (store_fpregs): Update fill_fpregset call. * Makefile.in (core-regset.o, procfs.o, proc-service.o): Update dependencies.
2007-05-06 16:32:31 +02:00
amd64_collect_native_gregset (regcache, gregsetp, regnum);
}
/* Transfering floating-point registers between GDB, inferiors and cores. */
/* Fill GDB's register cache with the floating-point and SSE register
* x86-64-tdep.h (x86_64_num_regs, x86_64_num_gregs): Remove variable declarations. (x86_64_register_number, x86_64_register_name): Remove prototypes. (x86_64_linux_frame_saved_pc, x86_64_linux+saved_pc_after_call, x86_64_linux_in_sigtramp, x86_64_linux_frame_chain, x86_64_init_frame_pc, x86_64_init_frame_pc, x86_64_function_has_prologue): Remove prototypes. (X86_64_NUM_GREGS): New define. (x86_64_supply_fxsave, x86_64_fill_fxsave): New prototypes. * x86-64-tdep.c: Don't include "dwarf2cfi.h". Include "dummy_frame.h", "frame.h", "frame-base.h", "frame-unwind.h". (RAX_REGNUM, RDX_REGNUM, RDI_REGNUM, EFLAGS_REGNUM, ST0_REGNUM, XMM1_REGNUM): Remove defines. (X86_64_RAX_REGNUM, X86_64_RDX_REGNUM, X86_64_RDI_REGNUM, X86_64_RBP_REGNUM, X86_64_RSP_REGNUM, X86_64_RIP_REGNUM, X86_64_EFLAGS_REGNUM, X86_64_ST0_REGNUM, X86_64_XMM0_REGNUM, X86_64_XMM1_REGNUM): New defines. (struct x86_64_register_info): Renamed from `struct register_info'. Remove `size' member. (x86_64_register_info_table): Remove variable. (x86_64_register_info): New variable. (X86_64_NUM_REGS): New define. (X86_64_NUM_GREGS): Remove define. (x86_64_num_regs, x86_64_num_gregs): Remove variables. (x86_64_dwarf2gdb_regno_map, x86_64_dwarf2gdb_regno_map_length): Remove variables. (x86_54_dwarf2_reg_to_regnum): Remove function. (x86_64_dwarf_regmap, x86_64_dwarf_regmap_len): New variables. (x86_64_dwarf_reg_to_regnum): New function. (x86_64_register_name): Rewrite. (x86_64_register_raw_size): Remove function. (x86_64_register_byte_table): Remove variable. (x86_64_register_byte): Remove function. (x86_64_register_virtual_type): Remove function. (x86_64_register_type): New function. (x86_64_register_convertible, x86_64_register_convert_to_virtual, x86_64_register_convert_to_raw): Remove functions. (x86_64_push_return_address, x86_64_pop_frame): Remove functon. (x86_64_use_struct_convention): Make static. Adjust for renamed defines. (x86_64_frame_init_saved_regs): Remove function. (x86_64_push_arguments): Make static. Change to accept a regcache as argument. (x86_64_store_return_value, x86_64_extract_return_value): Make static. Rewrite based on i386 counterparts. (x86_64_push_dummy_call): New function. (X86_64_NUM_SAVED_REGS): New define. (x86_64_register_number): Remove function. (x86_64_store_struct_return): Remove function. (x86_64_frameless_function_invocation, x86_64_function_has_prologue): Remove functions. (PROLOG_BUFSIZE): Remove define. (struct x86_64_frame_cache): New structure. (x86_64_alloc_frame_cache, x86_64_analyze_prologue, x86_64_frame_cache, x86_64_frame_this_id, x86_64_frame_prev_register, x86_64_frame_p, x86_64_sigtramp_frame_cache, x86_64_sigtramp_frame_this_id, x86_64_sigtramp_frame_prev_register, x86_sigtramp_frame_p): New functions. (x86_64_frame_unwind, x86_64_sigtramp_frame_unwind): New variables. (x86_64_skip_prologue): Rewrite in terms of x86_64_analyze_prologue. (x86_64_frame_base_address): New function. (x86_64_frame_base): New variable. (x86_64_save_dummy_frame_tos, x86_64_unwind_dummy_id): Rewrite. (x86_64_init_abi): Set register_type and push_dummy_call. Don't set deprecated_fp_regnum, deprecated_register_size, deprecated_register_bytes, register_raw_size, register_byte, register_virtual_type, register_convertiable, register_convert_to_virtual, convert_to_raw, deprecated_get_saved_register, deprecated_target_read_fp, deprecated_push_arguments, deprecated_push_return_address, deprecated_pop_frame, deprecated_store_struct_return, deprecated_frame_init_saved_regs, deprecated_frame_chain, frameless_function_invocation, deprecated_frame_saved_pc, deprecated_saved_pc_after_call, frame_num_args, pc_in_sigtramp, dwarf2_build_frame_info, deprecated_init_extra_frame_info, deprecated_init_frame_pc and virtual_frame_pointer. Call frame_unwind_append_predicate to register x86_64_sigtramp_frame_p and x86_64_frame_p. Call frame_base_set_default to register x86_64_frame_base. (I387_FISEG_REGNUM, I387_FOSEG_REGNUM): New defines. (x86_64_supply_fxsave, x86_64_fill_fxsave): New functions. (_initialize_x86_64_tdep): Remove function. * x86-64-linux-tdep.c: Don't include "dwarf2cfi.h". (LINUX_SIGINFO_SIZE, LINUX_UCONTEXT_SIGCONTEXT_OFFSET, LINUX_SIGCONTEXT_PC_OFFSET, LINUX_SIGCONTEXT_FP_OFFSET): Don't define. (X86_64_LINUX_UCONTEXT_SIGCONTEXT_OFFSET): Define. (x86_64_linux_sigcontext_addr): Rewrite. (x86_64_linux_sigtramp_saved_pc, x86_64_linux_saved_pc_after_call, x86_64_linux_frame_saved_pc): Remove functions. (x86_64_linux_pc_in_sigtramp): Renamed from x86_64_linux_in_sigtramp. Try harder to recognize a signal trampoline. (x86_64_linux_frame_chain, x86_64_init_frame_pc): Remove_functions. (x86_64_linux_init_abi): Set pc_in_sigtramp. Initialize TDEP->sigcontext_addr, TDEP->sc_pc_offset and TDEP->sc_sp_offset. * x86-64-linux-nat.c: Sync with i386-linux-tdep.c. (x86_64_regmap): Rename to regmap. (GETREGS_SUPPLIES): Use X86_64_NUM_GREGS instead of x86_64_num_gregs. (supply_gregset, fill_gregset): Likewise. Use regmap instead of x86_64_regmap. (x86_64_fxsave_offset): Remove function. (supply_fpregset): Simply call x86_64_supply_fxsave. (fill_fpregset): Simply call x86_64_fill_fxsave. (fetch_inferior_registers, store_inferior_registers): Avoid asignment in if-statement. (LINUX_SYSCALL_LEN, LINUX_SYSCALL_REGNUM, SYS_Sigreturn, SYS_rt_sigreturn, LINUX_SIGCONTEXT_EFLAGS_OFFSET, LINUX_UCONTEXT_SIGCONTEXT_OFFSET): Remove defines. (fetch_core_registers): Remove function. (linux_elf_core_fns): Remove. (offsetoff): Don't define. (_initialize_x86_64_linux_nat, kernel_u_size): Remove functions. * config/i386/x86-64linux.mt (TDEPFILES): Add i386-linux-tdep.o. * config/i386/x86-64linux.mh (NATDEPFILES): Remove core-aout.o, add core-regset.o. * config/i386/nm-x86-64linux.h: Use NM_X86_64_LINUX_H for protection against multiple includes instead of NM_X86_64_h. Add various comments. Include "config/nm-linux.h". Don't include <signal.h>. (REGISTER_U_ADDR, KERNEL_U_SIZE, U_REGS_OFFSET, KERN_U_ADDR, GET_THREAD_SIGNALS): Remove defines. (x86_64_register_u_addr, kernel_u_size, lin_thread_get_thread_signals): Remove prototypes. (PTRACE_ARG3_TYPE, PTRACE_XFER_TYPE): Define to `long'. [HAVE_LINK_H]: Don't include "solib.h". [HAVE_LINK_H] (SVR4_SHARED_LIBS): Remove define. * config/i386/tm-x86-64linux.h: Fix comments. * Makefile.in (x86-64-linux-nat.o, x86_64-linux-tdep.o, x86-64-tdep.o): Update dependencies.
2003-05-31 10:15:38 +02:00
values in *FPREGSETP. */
void
* gregset.h (struct regcache): Add forward declaration. (supply_gregset): Add REGCACHE parameter, make GREGS const. (supply_fpregset): Add REGCACHE parameter, make FPREGS const. (supply_fpxregset): Add REGCACHE parameter, make FPXREGS const. (fill_gregset): Add REGCACHE parameter. (fill_fpregset): Likewise. (fill_fpxregset): Likewise. Update all definitions accordingly: * alphabsd-nat.c, alpha-linux-nat.c, alpha-nat.c, amd64-linux-nat.c, arm-linux-nat.c, hppa-linux-nat.c, i386gnu-nat.c, i386-linux-nat.c, i386-sol2-nat.c, i386v4-nat.c, ia64-linux-nat.c, irix5-nat.c, m32r-linux-nat.c, m68klinux-nat.c, mips-linux-nat.c, ppc-linux-nat.c, s390-nat.c, sparc64-linux-nat.c, sparc-linux-nat.c, sparc-sol2-nat.c (supply_gregset): Add REGCACHE parameter, use it instead of current_regcache. Make GREGSETP parameter const, adapt casts. (supply_fpregset): Add REGCACHE parameter, use it instead of current_regcache. Make FPREGSETP parameter const, adapt casts. (fill_gregset): Add REGCACHE parameter, use it instead of current_regcache. (fill_fpregset): Likewise. Update all callers to pass in current_regcache as the new argument: * core-regset.c: Include "regcache.h". (fetch_core_registers): Update supply_gregset,and supply_fpregset calls. * procfs.c: Include "regcache.h". (procfs_fetch_registers): Update supply_gregset, supply_fpregset calls. (procfs_store_registers): Update fill_gregset, fill_fpregset calls. (procfs_do_thread_registers): Likewise. (procfs_make_note_section): Likewise. * proc-service.c: Include "regcache.h". (ps_lgetregs): Update fill_gregset call. (ps_lsetregs): Update supply_gregset call. (ps_lgetfpregs): Update fill_fpregset call. (ps_lsetfpregs): Update supply_fpregset call. * sol-thread.c (sol_thread_fetch_registers): Update supply_gregset, supply_fpregset calls. (sol_thread_store_registers): Update fill_gregset, fill_fpregset calls. (ps_lgetregs): Update fill_gregset call. (ps_lsetregs): Update supply_gregset call. (ps_lgetfpregs): Update fill_fpregset call. (ps_lsetfpregs): Update supply_fpregset call. * linux-nat.c (linux_nat_do_thread_registers): Update fill_gregset, fill_fpregset, and fill_fpxregset calls. * i386-linux-nat.c (fetch_regs): Update supply_gregset call. (store_regs): Update fill_gregset call. (fetch_fpregs): Update supply_fpregset call. (store_fpregs): Update fill_fpregset call. (fetch_fpxregs): Update supply_fpxregset call. (store_fpxregs): Update fill_fpxregset call. * m32r-linux-nat.c (fetch_regs): Update supply_gregset call. (store_regs): Update fill_gregset call. * m68klinux-nat.c (fetch_regs): Update supply_gregset call. (store_regs): Update fill_gregset call. (fetch_fpregs): Update supply_fpregset call. (store_fpregs): Update fill_fpregset call. (fetch_core_registers): Update supply_gregset, supply_fpregset calls. * s390-nat.c (fetch_regs): Update supply_gregset call. (store_regs): Update fill_gregset call. (fetch_fpregs): Update supply_fpregset call. (store_fpregs): Update fill_fpregset call. * Makefile.in (core-regset.o, procfs.o, proc-service.o): Update dependencies.
2007-05-06 16:32:31 +02:00
supply_fpregset (struct regcache *regcache, const elf_fpregset_t *fpregsetp)
{
* gregset.h (struct regcache): Add forward declaration. (supply_gregset): Add REGCACHE parameter, make GREGS const. (supply_fpregset): Add REGCACHE parameter, make FPREGS const. (supply_fpxregset): Add REGCACHE parameter, make FPXREGS const. (fill_gregset): Add REGCACHE parameter. (fill_fpregset): Likewise. (fill_fpxregset): Likewise. Update all definitions accordingly: * alphabsd-nat.c, alpha-linux-nat.c, alpha-nat.c, amd64-linux-nat.c, arm-linux-nat.c, hppa-linux-nat.c, i386gnu-nat.c, i386-linux-nat.c, i386-sol2-nat.c, i386v4-nat.c, ia64-linux-nat.c, irix5-nat.c, m32r-linux-nat.c, m68klinux-nat.c, mips-linux-nat.c, ppc-linux-nat.c, s390-nat.c, sparc64-linux-nat.c, sparc-linux-nat.c, sparc-sol2-nat.c (supply_gregset): Add REGCACHE parameter, use it instead of current_regcache. Make GREGSETP parameter const, adapt casts. (supply_fpregset): Add REGCACHE parameter, use it instead of current_regcache. Make FPREGSETP parameter const, adapt casts. (fill_gregset): Add REGCACHE parameter, use it instead of current_regcache. (fill_fpregset): Likewise. Update all callers to pass in current_regcache as the new argument: * core-regset.c: Include "regcache.h". (fetch_core_registers): Update supply_gregset,and supply_fpregset calls. * procfs.c: Include "regcache.h". (procfs_fetch_registers): Update supply_gregset, supply_fpregset calls. (procfs_store_registers): Update fill_gregset, fill_fpregset calls. (procfs_do_thread_registers): Likewise. (procfs_make_note_section): Likewise. * proc-service.c: Include "regcache.h". (ps_lgetregs): Update fill_gregset call. (ps_lsetregs): Update supply_gregset call. (ps_lgetfpregs): Update fill_fpregset call. (ps_lsetfpregs): Update supply_fpregset call. * sol-thread.c (sol_thread_fetch_registers): Update supply_gregset, supply_fpregset calls. (sol_thread_store_registers): Update fill_gregset, fill_fpregset calls. (ps_lgetregs): Update fill_gregset call. (ps_lsetregs): Update supply_gregset call. (ps_lgetfpregs): Update fill_fpregset call. (ps_lsetfpregs): Update supply_fpregset call. * linux-nat.c (linux_nat_do_thread_registers): Update fill_gregset, fill_fpregset, and fill_fpxregset calls. * i386-linux-nat.c (fetch_regs): Update supply_gregset call. (store_regs): Update fill_gregset call. (fetch_fpregs): Update supply_fpregset call. (store_fpregs): Update fill_fpregset call. (fetch_fpxregs): Update supply_fpxregset call. (store_fpxregs): Update fill_fpxregset call. * m32r-linux-nat.c (fetch_regs): Update supply_gregset call. (store_regs): Update fill_gregset call. * m68klinux-nat.c (fetch_regs): Update supply_gregset call. (store_regs): Update fill_gregset call. (fetch_fpregs): Update supply_fpregset call. (store_fpregs): Update fill_fpregset call. (fetch_core_registers): Update supply_gregset, supply_fpregset calls. * s390-nat.c (fetch_regs): Update supply_gregset call. (store_regs): Update fill_gregset call. (fetch_fpregs): Update supply_fpregset call. (store_fpregs): Update fill_fpregset call. * Makefile.in (core-regset.o, procfs.o, proc-service.o): Update dependencies.
2007-05-06 16:32:31 +02:00
amd64_supply_fxsave (regcache, -1, fpregsetp);
}
/* Fill register REGNUM (if it is a floating-point or SSE register) in
*FPREGSETP with the value in GDB's register cache. If REGNUM is
* x86-64-tdep.h (x86_64_num_regs, x86_64_num_gregs): Remove variable declarations. (x86_64_register_number, x86_64_register_name): Remove prototypes. (x86_64_linux_frame_saved_pc, x86_64_linux+saved_pc_after_call, x86_64_linux_in_sigtramp, x86_64_linux_frame_chain, x86_64_init_frame_pc, x86_64_init_frame_pc, x86_64_function_has_prologue): Remove prototypes. (X86_64_NUM_GREGS): New define. (x86_64_supply_fxsave, x86_64_fill_fxsave): New prototypes. * x86-64-tdep.c: Don't include "dwarf2cfi.h". Include "dummy_frame.h", "frame.h", "frame-base.h", "frame-unwind.h". (RAX_REGNUM, RDX_REGNUM, RDI_REGNUM, EFLAGS_REGNUM, ST0_REGNUM, XMM1_REGNUM): Remove defines. (X86_64_RAX_REGNUM, X86_64_RDX_REGNUM, X86_64_RDI_REGNUM, X86_64_RBP_REGNUM, X86_64_RSP_REGNUM, X86_64_RIP_REGNUM, X86_64_EFLAGS_REGNUM, X86_64_ST0_REGNUM, X86_64_XMM0_REGNUM, X86_64_XMM1_REGNUM): New defines. (struct x86_64_register_info): Renamed from `struct register_info'. Remove `size' member. (x86_64_register_info_table): Remove variable. (x86_64_register_info): New variable. (X86_64_NUM_REGS): New define. (X86_64_NUM_GREGS): Remove define. (x86_64_num_regs, x86_64_num_gregs): Remove variables. (x86_64_dwarf2gdb_regno_map, x86_64_dwarf2gdb_regno_map_length): Remove variables. (x86_54_dwarf2_reg_to_regnum): Remove function. (x86_64_dwarf_regmap, x86_64_dwarf_regmap_len): New variables. (x86_64_dwarf_reg_to_regnum): New function. (x86_64_register_name): Rewrite. (x86_64_register_raw_size): Remove function. (x86_64_register_byte_table): Remove variable. (x86_64_register_byte): Remove function. (x86_64_register_virtual_type): Remove function. (x86_64_register_type): New function. (x86_64_register_convertible, x86_64_register_convert_to_virtual, x86_64_register_convert_to_raw): Remove functions. (x86_64_push_return_address, x86_64_pop_frame): Remove functon. (x86_64_use_struct_convention): Make static. Adjust for renamed defines. (x86_64_frame_init_saved_regs): Remove function. (x86_64_push_arguments): Make static. Change to accept a regcache as argument. (x86_64_store_return_value, x86_64_extract_return_value): Make static. Rewrite based on i386 counterparts. (x86_64_push_dummy_call): New function. (X86_64_NUM_SAVED_REGS): New define. (x86_64_register_number): Remove function. (x86_64_store_struct_return): Remove function. (x86_64_frameless_function_invocation, x86_64_function_has_prologue): Remove functions. (PROLOG_BUFSIZE): Remove define. (struct x86_64_frame_cache): New structure. (x86_64_alloc_frame_cache, x86_64_analyze_prologue, x86_64_frame_cache, x86_64_frame_this_id, x86_64_frame_prev_register, x86_64_frame_p, x86_64_sigtramp_frame_cache, x86_64_sigtramp_frame_this_id, x86_64_sigtramp_frame_prev_register, x86_sigtramp_frame_p): New functions. (x86_64_frame_unwind, x86_64_sigtramp_frame_unwind): New variables. (x86_64_skip_prologue): Rewrite in terms of x86_64_analyze_prologue. (x86_64_frame_base_address): New function. (x86_64_frame_base): New variable. (x86_64_save_dummy_frame_tos, x86_64_unwind_dummy_id): Rewrite. (x86_64_init_abi): Set register_type and push_dummy_call. Don't set deprecated_fp_regnum, deprecated_register_size, deprecated_register_bytes, register_raw_size, register_byte, register_virtual_type, register_convertiable, register_convert_to_virtual, convert_to_raw, deprecated_get_saved_register, deprecated_target_read_fp, deprecated_push_arguments, deprecated_push_return_address, deprecated_pop_frame, deprecated_store_struct_return, deprecated_frame_init_saved_regs, deprecated_frame_chain, frameless_function_invocation, deprecated_frame_saved_pc, deprecated_saved_pc_after_call, frame_num_args, pc_in_sigtramp, dwarf2_build_frame_info, deprecated_init_extra_frame_info, deprecated_init_frame_pc and virtual_frame_pointer. Call frame_unwind_append_predicate to register x86_64_sigtramp_frame_p and x86_64_frame_p. Call frame_base_set_default to register x86_64_frame_base. (I387_FISEG_REGNUM, I387_FOSEG_REGNUM): New defines. (x86_64_supply_fxsave, x86_64_fill_fxsave): New functions. (_initialize_x86_64_tdep): Remove function. * x86-64-linux-tdep.c: Don't include "dwarf2cfi.h". (LINUX_SIGINFO_SIZE, LINUX_UCONTEXT_SIGCONTEXT_OFFSET, LINUX_SIGCONTEXT_PC_OFFSET, LINUX_SIGCONTEXT_FP_OFFSET): Don't define. (X86_64_LINUX_UCONTEXT_SIGCONTEXT_OFFSET): Define. (x86_64_linux_sigcontext_addr): Rewrite. (x86_64_linux_sigtramp_saved_pc, x86_64_linux_saved_pc_after_call, x86_64_linux_frame_saved_pc): Remove functions. (x86_64_linux_pc_in_sigtramp): Renamed from x86_64_linux_in_sigtramp. Try harder to recognize a signal trampoline. (x86_64_linux_frame_chain, x86_64_init_frame_pc): Remove_functions. (x86_64_linux_init_abi): Set pc_in_sigtramp. Initialize TDEP->sigcontext_addr, TDEP->sc_pc_offset and TDEP->sc_sp_offset. * x86-64-linux-nat.c: Sync with i386-linux-tdep.c. (x86_64_regmap): Rename to regmap. (GETREGS_SUPPLIES): Use X86_64_NUM_GREGS instead of x86_64_num_gregs. (supply_gregset, fill_gregset): Likewise. Use regmap instead of x86_64_regmap. (x86_64_fxsave_offset): Remove function. (supply_fpregset): Simply call x86_64_supply_fxsave. (fill_fpregset): Simply call x86_64_fill_fxsave. (fetch_inferior_registers, store_inferior_registers): Avoid asignment in if-statement. (LINUX_SYSCALL_LEN, LINUX_SYSCALL_REGNUM, SYS_Sigreturn, SYS_rt_sigreturn, LINUX_SIGCONTEXT_EFLAGS_OFFSET, LINUX_UCONTEXT_SIGCONTEXT_OFFSET): Remove defines. (fetch_core_registers): Remove function. (linux_elf_core_fns): Remove. (offsetoff): Don't define. (_initialize_x86_64_linux_nat, kernel_u_size): Remove functions. * config/i386/x86-64linux.mt (TDEPFILES): Add i386-linux-tdep.o. * config/i386/x86-64linux.mh (NATDEPFILES): Remove core-aout.o, add core-regset.o. * config/i386/nm-x86-64linux.h: Use NM_X86_64_LINUX_H for protection against multiple includes instead of NM_X86_64_h. Add various comments. Include "config/nm-linux.h". Don't include <signal.h>. (REGISTER_U_ADDR, KERNEL_U_SIZE, U_REGS_OFFSET, KERN_U_ADDR, GET_THREAD_SIGNALS): Remove defines. (x86_64_register_u_addr, kernel_u_size, lin_thread_get_thread_signals): Remove prototypes. (PTRACE_ARG3_TYPE, PTRACE_XFER_TYPE): Define to `long'. [HAVE_LINK_H]: Don't include "solib.h". [HAVE_LINK_H] (SVR4_SHARED_LIBS): Remove define. * config/i386/tm-x86-64linux.h: Fix comments. * Makefile.in (x86-64-linux-nat.o, x86_64-linux-tdep.o, x86-64-tdep.o): Update dependencies.
2003-05-31 10:15:38 +02:00
-1, do this for all registers. */
void
* gregset.h (struct regcache): Add forward declaration. (supply_gregset): Add REGCACHE parameter, make GREGS const. (supply_fpregset): Add REGCACHE parameter, make FPREGS const. (supply_fpxregset): Add REGCACHE parameter, make FPXREGS const. (fill_gregset): Add REGCACHE parameter. (fill_fpregset): Likewise. (fill_fpxregset): Likewise. Update all definitions accordingly: * alphabsd-nat.c, alpha-linux-nat.c, alpha-nat.c, amd64-linux-nat.c, arm-linux-nat.c, hppa-linux-nat.c, i386gnu-nat.c, i386-linux-nat.c, i386-sol2-nat.c, i386v4-nat.c, ia64-linux-nat.c, irix5-nat.c, m32r-linux-nat.c, m68klinux-nat.c, mips-linux-nat.c, ppc-linux-nat.c, s390-nat.c, sparc64-linux-nat.c, sparc-linux-nat.c, sparc-sol2-nat.c (supply_gregset): Add REGCACHE parameter, use it instead of current_regcache. Make GREGSETP parameter const, adapt casts. (supply_fpregset): Add REGCACHE parameter, use it instead of current_regcache. Make FPREGSETP parameter const, adapt casts. (fill_gregset): Add REGCACHE parameter, use it instead of current_regcache. (fill_fpregset): Likewise. Update all callers to pass in current_regcache as the new argument: * core-regset.c: Include "regcache.h". (fetch_core_registers): Update supply_gregset,and supply_fpregset calls. * procfs.c: Include "regcache.h". (procfs_fetch_registers): Update supply_gregset, supply_fpregset calls. (procfs_store_registers): Update fill_gregset, fill_fpregset calls. (procfs_do_thread_registers): Likewise. (procfs_make_note_section): Likewise. * proc-service.c: Include "regcache.h". (ps_lgetregs): Update fill_gregset call. (ps_lsetregs): Update supply_gregset call. (ps_lgetfpregs): Update fill_fpregset call. (ps_lsetfpregs): Update supply_fpregset call. * sol-thread.c (sol_thread_fetch_registers): Update supply_gregset, supply_fpregset calls. (sol_thread_store_registers): Update fill_gregset, fill_fpregset calls. (ps_lgetregs): Update fill_gregset call. (ps_lsetregs): Update supply_gregset call. (ps_lgetfpregs): Update fill_fpregset call. (ps_lsetfpregs): Update supply_fpregset call. * linux-nat.c (linux_nat_do_thread_registers): Update fill_gregset, fill_fpregset, and fill_fpxregset calls. * i386-linux-nat.c (fetch_regs): Update supply_gregset call. (store_regs): Update fill_gregset call. (fetch_fpregs): Update supply_fpregset call. (store_fpregs): Update fill_fpregset call. (fetch_fpxregs): Update supply_fpxregset call. (store_fpxregs): Update fill_fpxregset call. * m32r-linux-nat.c (fetch_regs): Update supply_gregset call. (store_regs): Update fill_gregset call. * m68klinux-nat.c (fetch_regs): Update supply_gregset call. (store_regs): Update fill_gregset call. (fetch_fpregs): Update supply_fpregset call. (store_fpregs): Update fill_fpregset call. (fetch_core_registers): Update supply_gregset, supply_fpregset calls. * s390-nat.c (fetch_regs): Update supply_gregset call. (store_regs): Update fill_gregset call. (fetch_fpregs): Update supply_fpregset call. (store_fpregs): Update fill_fpregset call. * Makefile.in (core-regset.o, procfs.o, proc-service.o): Update dependencies.
2007-05-06 16:32:31 +02:00
fill_fpregset (const struct regcache *regcache,
elf_fpregset_t *fpregsetp, int regnum)
{
* gregset.h (struct regcache): Add forward declaration. (supply_gregset): Add REGCACHE parameter, make GREGS const. (supply_fpregset): Add REGCACHE parameter, make FPREGS const. (supply_fpxregset): Add REGCACHE parameter, make FPXREGS const. (fill_gregset): Add REGCACHE parameter. (fill_fpregset): Likewise. (fill_fpxregset): Likewise. Update all definitions accordingly: * alphabsd-nat.c, alpha-linux-nat.c, alpha-nat.c, amd64-linux-nat.c, arm-linux-nat.c, hppa-linux-nat.c, i386gnu-nat.c, i386-linux-nat.c, i386-sol2-nat.c, i386v4-nat.c, ia64-linux-nat.c, irix5-nat.c, m32r-linux-nat.c, m68klinux-nat.c, mips-linux-nat.c, ppc-linux-nat.c, s390-nat.c, sparc64-linux-nat.c, sparc-linux-nat.c, sparc-sol2-nat.c (supply_gregset): Add REGCACHE parameter, use it instead of current_regcache. Make GREGSETP parameter const, adapt casts. (supply_fpregset): Add REGCACHE parameter, use it instead of current_regcache. Make FPREGSETP parameter const, adapt casts. (fill_gregset): Add REGCACHE parameter, use it instead of current_regcache. (fill_fpregset): Likewise. Update all callers to pass in current_regcache as the new argument: * core-regset.c: Include "regcache.h". (fetch_core_registers): Update supply_gregset,and supply_fpregset calls. * procfs.c: Include "regcache.h". (procfs_fetch_registers): Update supply_gregset, supply_fpregset calls. (procfs_store_registers): Update fill_gregset, fill_fpregset calls. (procfs_do_thread_registers): Likewise. (procfs_make_note_section): Likewise. * proc-service.c: Include "regcache.h". (ps_lgetregs): Update fill_gregset call. (ps_lsetregs): Update supply_gregset call. (ps_lgetfpregs): Update fill_fpregset call. (ps_lsetfpregs): Update supply_fpregset call. * sol-thread.c (sol_thread_fetch_registers): Update supply_gregset, supply_fpregset calls. (sol_thread_store_registers): Update fill_gregset, fill_fpregset calls. (ps_lgetregs): Update fill_gregset call. (ps_lsetregs): Update supply_gregset call. (ps_lgetfpregs): Update fill_fpregset call. (ps_lsetfpregs): Update supply_fpregset call. * linux-nat.c (linux_nat_do_thread_registers): Update fill_gregset, fill_fpregset, and fill_fpxregset calls. * i386-linux-nat.c (fetch_regs): Update supply_gregset call. (store_regs): Update fill_gregset call. (fetch_fpregs): Update supply_fpregset call. (store_fpregs): Update fill_fpregset call. (fetch_fpxregs): Update supply_fpxregset call. (store_fpxregs): Update fill_fpxregset call. * m32r-linux-nat.c (fetch_regs): Update supply_gregset call. (store_regs): Update fill_gregset call. * m68klinux-nat.c (fetch_regs): Update supply_gregset call. (store_regs): Update fill_gregset call. (fetch_fpregs): Update supply_fpregset call. (store_fpregs): Update fill_fpregset call. (fetch_core_registers): Update supply_gregset, supply_fpregset calls. * s390-nat.c (fetch_regs): Update supply_gregset call. (store_regs): Update fill_gregset call. (fetch_fpregs): Update supply_fpregset call. (store_fpregs): Update fill_fpregset call. * Makefile.in (core-regset.o, procfs.o, proc-service.o): Update dependencies.
2007-05-06 16:32:31 +02:00
amd64_collect_fxsave (regcache, regnum, fpregsetp);
}
/* Transferring arbitrary registers between GDB and inferior. */
/* Fetch register REGNUM from the child process. If REGNUM is -1, do
this for all registers (including the floating point and SSE
registers). */
* Makefile.in (ALLDEPFILES): Update. (alpha-linux-nat.o, sparc-linux-nat.o): New rules. (amd64-linux-nat.o, arm-linux-nat.o, hppa-linux-nat.o) (i386-linux-nat.o, ia64-linux-nat.o, linux-nat.o, m32r-linux-nat.o) (m68klinux-nat.o, mips-linux-nat.o, ppc-linux-nat.o, s390-nat.o) (sparc64-linux-nat.o): Update dependencies. * alpha-linux-nat.c, sparc-linux-nat.c: New files. * amd64-linux-nat.c (amd64_linux_fetch_inferior_registers): Renamed from fetch_inferior_registers and made static. (amd64_linux_store_inferior_registers): Renamed from store_inferior_registers and made static. (amd64_linux_child_post_start_inferior): Renamed from child_post_startup_inferior and made static. Call super_post_startup_inferior. (super_post_startup_inferior): New. (_initialize_amd64_linux_nat): Set it. Call linux_target and add_target. * arm-linux-nat.c (arm_linux_fetch_inferior_registers): Renamed from fetch_inferior_registers and made static. (arm_linux_store_inferior_registers): Renamed from store_inferior_registers and made static. (_initialize_arm_linux_nat): Add a prototype. Use linux_target and add_target. * hppa-linux-nat.c (hppa_linux_fetch_inferior_registers): Renamed from fetch_inferior_registers and made static. (hppa_linux_store_inferior_registers): Renamed from store_inferior_registers and made static. (_initialize_hppa_linux_nat): New function. * i386-linux-nat.c (i386_linux_fetch_inferior_registers): Renamed from fetch_inferior_registers and made static. (i386_linux_store_inferior_registers): Renamed from store_inferior_registers and made static. (i386_linux_resume): Renamed from child_resume and made static. (i386_linux_child_post_start_inferior): Renamed from child_post_startup_inferior and made static. Call super_post_startup_inferior. (super_post_startup_inferior): New. (_initialize_i386_linux_nat): New function. * i386-nat.c: Remove LINUX_CHILD_POST_STARTUP_INFERIOR #ifndef. * ia64-linux-nat.c (ia64_linux_xfer_unwind_table): Remove. (super_xfer_partial): New. (ia64_linux_xfer_partial): New function. Use it. (_initialize_ia64_linux_nat): New function. * ia64-tdep.c (getunwind_table): Revert 2005-06-08 change; use target_read_partial and document the problem. * inf-ptrace.c (inf_ptrace_fetch_register): Use CANNOT_FETCH_REGISTER. Fix some comments. (inf_ptrace_store_register): Use CANNOT_STORE_REGISTER. Fix some comments. * linux-nat.c: Include "inf-ptrace.h" and "auxv.h". (linux_ops, super_xfer_partial): New variables. (linux_child_post_startup_inferior): Make static. (child_post_startup_inferior): Delete. (linux_nat_attach, linux_nat_detach, resume_callback) (linux_nat_resume, linux_nat_wait, linux_nat_create_inferior) (linux_nat_mourn_inferior): Use linux_ops instead of deprecated_child_ops. (child_wait): Do not depend on CHILD_WAIT. (linux_nat_xfer_memory): Remove, replace by ... (linux_nat_xfer_partial): ... this. Use linux_ops->to_xfer_partial instead of linux_proc_xfer_memory and child_xfer_memory. (linux_nat_fetch_registers, linux_nat_store_registers) (linux_nat_child_post_startup_inferior): New functions. (init_linux_nat_ops): Use the new functions. (linux_proc_xfer_memory): Remove, replace by ... (linux_proc_xfer_partial): ... this. Make static. (linux_xfer_partial, linux_register_u_offset, linux_target): New functions. (_initialize_linux_nat): Do not modify deprecated_child_ops. * linux-nat.h (linux_proc_xfer_memory): Remove prototype. (struct mem_attrib, struct target_ops): Remove forward declarations. (linux_child_post_startup_inferior): Remove prototype. (linux_target): Add prototype. * linux-thread-db.c (thread_db_xfer_memory): Remove, replace by ... (thread_db_xfer_partial): ... this. (init_thread_db_ops): Set to_xfer_partial instead of deprecated_xfer_memory. * m32r-linux-nat.c (m32r_linux_fetch_inferior_registers): Renamed from fetch_inferior_registers and made static. (m32r_linux_store_inferior_registers): Renamed from store_inferior_registers and made static. (_initialize_m32r_linux_nat): New function. * m68klinux-nat.c (m68k_linux_fetch_inferior_registers): Renamed from fetch_inferior_registers and made static. (m68k_linux_store_inferior_registers): Renamed from store_inferior_registers and made static. (old_fetch_inferior_registers, old_store_inferior_registers): Made static. (_initialize_m68k_linux_nat): Use linux_target and add_target. * mips-linux-nat.c (_initialize_mips_linux_nat): New function. * ppc-linux-nat.c (ppc_linux_fetch_inferior_registers): Renamed from fetch_inferior_registers and made static. (ppc_linux_store_inferior_registers): Renamed from store_inferior_registers and made static. (_initialize_ppc_linux_nat): New function. * s390-nat.c (s390_linux_fetch_inferior_registers): Renamed from fetch_inferior_registers and made static. (s390_linux_store_inferior_registers): Renamed from store_inferior_registers and made static. (_initialize_s390_nat): New function. * sparc64-linux-nat.c (_initialize_sparc64_linux_nat): Use linux_target and add_target. * config/nm-linux.h: Don't include "auxv.h". (struct target_waitstatus, child_wait, CHILD_WAIT) (CHILD_PID_TO_EXEC_FILE, CHILD_INSERT_FORK_CATCHPOINT) (CHILD_INSERT_VFORK_CATCHPOINT, CHILD_INSERT_EXEC_CATCHPOINT) (CHILD_POST_STARTUP_INFERIOR, CHILD_POST_ATTACH, CHILD_FOLLOW_FORK) (DEPRECATED_KILL_INFERIOR, NATIVE_XFER_AUXV): Delete. * config/alpha/alpha-linux.mh (NATDEPFILES): Replace infptrace.o and inftarg.o with inf-ptrace.o and alpha-linux-nat.o. * config/sparc/linux.mh (NATDEPFILES): Replace infptrace.o and inftarg.o with sparc-linux-nat.o. * config/sparc/linux64.mh (NATDEPFILES): Remove infptrace.o and inftarg.o. * config/arm/linux.mh (NATDEPFILES): Replace infptrace.o and inftarg.o with inf-ptrace.o. * 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/s390/s390.mh (NATDEPFILES): Likewise. * config/i386/nm-linux.h (DEPRECATED_CHILD_RESUME): Don't define. (LINUX_CHILD_POST_STARTUP_INFERIOR): Don't define. * config/i386/nm-linux64.h (LINUX_CHILD_POST_STARTUP_INFERIOR): Don't define. * config/ia64/nm-linux.h: Don't include "target.h". (NATIVE_XFER_UNWIND_TABLE, ia64_linux_xfer_unwind_table): Remove. * config/djgpp/fnchange.lst: Add alpha-linux-tdep.c, alpha-linux-nat.c, sparc-linux-tdep.c, and sparc-linux-nat.c.
2005-09-10 20:11:14 +02:00
static void
* corelow.c (get_core_registers): Adjust. (core_file_thread_alive): Rename to... (core_thread_alive): ... this. (core_pid_to_str): Try gdbarch_core_pid_to_str first. (init_core_ops): Adjust. (coreops_suppress_target): Delete. (_initialize_corelow): Unconditionally add core_ops. * procfs.c: Include "inf-child.h". (procfs_ops): Delete. (init_procfs_ops): Delete. Reimplement as... (procfs_target): ... this, inheriting from inf-child. (procfs_attach, procfs_detach, procfs_fetch_registers): Adjust. (procfs_prepare_to_store): Delete. (procfs_store_registers, procfs_resume): Adjust. (procfs_open): Delete. (procfs_suppress_run): Delete. (procfs_can_run): Delete. (procfs_mourn_inferior): Adjust. (procfs_init_inferior): Add target_ops parameter. Adjust. (procfs_create_inferior): Don't pass procfs_init_inferior to fork_inferior. Instead call it after fork_inferior returns. (procfs_find_new_threads): Adjust. (_initialize_procfs): Adjust to use procfs_target instead of init_procfs_ops. * sol-thread.c (orig_core_ops, sol_core_ops): Delete. (lwp_to_thread): Use target_thread_alive. (sol_thread_open): Delete. (sol_thread_attach): Delete. (sol_thread_detach, sol_thread_resume, sol_thread_wait) (sol_thread_fetch_registers, sol_thread_store_registers): Adjust to use find_target_beneath. (sol_thread_prepare_to_store, sol_thread_xfer_memory): Delete. (sol_thread_xfer_partial): Adjust to use find_target_beneath. (sol_thread_files_info, sol_thread_kill_inferior): Delete. (check_for_thread_db): New. (sol_thread_notice_signals, sol_thread_create_inferior): Delete. (sol_thread_new_objfile): Call check_for_thread_db. (sol_thread_mourn_inferior): Adjust to use find_target_beneath. (sol_thread_can_run): Delete. (sol_thread_alive): Adjust to use find_target_beneath. (sol_thread_stop): Delete. (rw_common): Use target_write_memory or target_read_memory. (ps_lgetregs, ps_lgetfpregs): Use target_fetch_registers. (ps_lsetregs, ps_lsetfpregs): Use target_store_registers. (solaris_pid_to_str): Remove check for libthread_db initialization failing. (sol_find_new_threads): Remove check for libthread_db initialization failing, or for an invalid inferior_ptid. Adjust to use find_target_beneath. (sol_core_open, sol_core_close, sol_core_detach, sol_core_files_info, sol_find_memory_regions, sol_make_note_section, ignore): Delete. (init_sol_thread_ops): Make it a thread_stratum target. Remove unneeded callback settings. (init_sol_core_ops): Delete. (_initialize_sol_thread): No longer call init_sol_core_ops, set procfs_suppress_run, or hack with core_ops. * target.h (struct target_ops): Add a target_ops * parameter to to_resume, to_fetch_registers, to_store_registers, to_thread_alive and to_find_new_threads. (target_fetch_registers, target_store_registers) (target_thread_alive, target_find_new_threads): Redeclare as function. * target.c (update_current_target): Do not inherit or de_fault to_resume, to_fetch_registers, to_store_registers, to_thread_alive, to_find_new_threads. (target_resume): Adjust. (target_thread_alive, target_find_new_threads): New. (debug_to_resume, debug_to_fetch_registers): Delete. (target_fetch_registers): New. (debug_to_store_registers): Delete. (target_store_registers): New. (debug_to_thread_alive, debug_to_find_new_threads): Delete. (setup_target_debug): Adjust. * gdbcore.h (core_ops): Delete declaration. * inf-ptrace.c, linux-nat.c, remote.c, amd64-linux-nat.c, inf-child.c, linux-thread-db.c, bsd-uthread.c, inf-ttrace.c, i386-sol2-tdep.c, darwin-nat.c, gnu-nat.c, go32-nat.c, hpux-thread.c, i386-linux-nat.c, i386fbsd-nat.c, monitor.c, nto-procfs.c, remote-m32r-sdi.c, remote-mips.c, windows-nat.c, alphabsd-nat.c, amd64bsd-nat.c, arm-linux-nat.c, armnbsd-nat.c, bsd-kvm.c, hppa-hpux-nat.c, hppa-linux-nat.c, hppabsd-nat.c, hppanbsd-nat.c, i386-darwin-nat.c, i386bsd-nat.c, ia64-linux-nat.c, m32r-linux-nat.c, m68kbsd-nat.c, m68klinux-nat.c, m88kbsd-nat.c, mips-linux-nat.c, mips64obsd-nat.c, mipsnbsd-nat.c, ppc-linux-nat.c, ppcnbsd-nat.c, ppcobsd-nat.c, remote-sim.c, rs6000-nat.c, s390-nat.c, shnbsd-nat.c, sparc-nat.c, sparc-nat.h, spu-linux-nat.c, vaxbsd-nat.c, xtensa-linux-nat.c: Adjust to target_ops changes. * gdbarch.sh (core_pid_to_str): New gdbarch callback. * gdbarch.h, gdbarch.c: Regenerate. * sol2-tdep.c: Include "inferior.h". (sol2_core_pid_to_str): New. * sol2-tdep.h (sol2_core_pid_to_str): Declare. * amd64-sol2-tdep.c (amd64_sol2_init_abi): Set it. * sparc-sol2-tdep.c (sparc32_sol2_init_abi): Set it. * sparc64-sol2-tdep.c (sparc64_sol2_init_abi): Set it. * i386-sol2-tdep.c (i386_sol2_init_abi): Set it.
2009-02-23 01:03:50 +01:00
amd64_linux_fetch_inferior_registers (struct target_ops *ops,
struct regcache *regcache, int regnum)
{
struct gdbarch *gdbarch = get_regcache_arch (regcache);
int tid;
2002-02-24 23:14:33 +01:00
/* GNU/Linux LWP ID's are process ID's. */
* aarch64-linux-nat.c: Replace PIDGET with ptid_get_pid. Replace TIDGET with ptid_get_lwp. Replace GET_LWP with ptid_get_lwp. * aix-thread.c (BUILD_THREAD, BUILD_LWP): Remove. Replace BUILD_THREAD with ptid_build. Replace BUILD_LWP with ptid_build. Replace PIDGET with ptid_get_pid. Replace TIDGET with ptid_get_lwp. * alphabsd-nat.c: Replace PIDGET with ptid_get_pid. * amd64-linux-nat.c: Replace PIDGET with ptid_get_pid. Replace TIDGET with ptid_get_lwp. * amd64bsd-nat.c: Replace PIDGET with ptid_get_pid. * arm-linux-nat.c: Replace PIDGET with ptid_get_pid. Replace TIDGET with ptid_get_lwp. Replace GET_LWP with ptid_get_lwp. * armnbsd-nat.c: Replace PIDGET with ptid_get_pid. * auxv.c: Likewise. * breakpoint.c: Likewise. * common/ptid.c (ptid_is_pid): Condense check for null_ptid and minus_one_ptid. (ptid_lwp_p): New function. (ptid_tid_p): New function. * common/ptid.h: Update comments for accessors. (ptid_lwp_p): New prototype. (ptid_tid_p): New prototype. * defs.h (PIDGET, TIDGET, MERGEPID): Do not define. * gcore.c: Replace PIDGET with ptid_get_pid. * gdbthread.h: Likewise. * gnu-nat.c: Likewise. * hppa-linux-nat.c: Replace PIDGET with ptid_get_pid. Replace TIDGET with ptid_get_lwp. * hppabsd-nat.c: Replace PIDGET with ptid_get_pid. * hppanbsd-nat.c: Likewise. * i386-linux-nat.c: Replace PIDGET with ptid_get_pid. Replace TIDGET with ptid_get_lwp. * i386bsd-nat.c: Replace PIDGET with ptid_get_pid. * ia64-linux-nat.c: Replace PIDGET with ptid_get_pid. * infcmd.c: Likewise. * inferior.h: Likewise. * inflow.c: Likewise. * infrun.c: Likewise. * linux-fork.c: Likewise. * linux-nat.c: Replace PIDGET with ptid_get_pid. Replace GET_PID with ptid_get_pid. Replace is_lwp with ptid_lwp_p. Replace GET_LWP with ptid_get_lwp. Replace BUILD_LWP with ptid_build.
2013-09-30 13:50:12 +02:00
tid = ptid_get_lwp (inferior_ptid);
* x86-64-tdep.h (x86_64_num_regs, x86_64_num_gregs): Remove variable declarations. (x86_64_register_number, x86_64_register_name): Remove prototypes. (x86_64_linux_frame_saved_pc, x86_64_linux+saved_pc_after_call, x86_64_linux_in_sigtramp, x86_64_linux_frame_chain, x86_64_init_frame_pc, x86_64_init_frame_pc, x86_64_function_has_prologue): Remove prototypes. (X86_64_NUM_GREGS): New define. (x86_64_supply_fxsave, x86_64_fill_fxsave): New prototypes. * x86-64-tdep.c: Don't include "dwarf2cfi.h". Include "dummy_frame.h", "frame.h", "frame-base.h", "frame-unwind.h". (RAX_REGNUM, RDX_REGNUM, RDI_REGNUM, EFLAGS_REGNUM, ST0_REGNUM, XMM1_REGNUM): Remove defines. (X86_64_RAX_REGNUM, X86_64_RDX_REGNUM, X86_64_RDI_REGNUM, X86_64_RBP_REGNUM, X86_64_RSP_REGNUM, X86_64_RIP_REGNUM, X86_64_EFLAGS_REGNUM, X86_64_ST0_REGNUM, X86_64_XMM0_REGNUM, X86_64_XMM1_REGNUM): New defines. (struct x86_64_register_info): Renamed from `struct register_info'. Remove `size' member. (x86_64_register_info_table): Remove variable. (x86_64_register_info): New variable. (X86_64_NUM_REGS): New define. (X86_64_NUM_GREGS): Remove define. (x86_64_num_regs, x86_64_num_gregs): Remove variables. (x86_64_dwarf2gdb_regno_map, x86_64_dwarf2gdb_regno_map_length): Remove variables. (x86_54_dwarf2_reg_to_regnum): Remove function. (x86_64_dwarf_regmap, x86_64_dwarf_regmap_len): New variables. (x86_64_dwarf_reg_to_regnum): New function. (x86_64_register_name): Rewrite. (x86_64_register_raw_size): Remove function. (x86_64_register_byte_table): Remove variable. (x86_64_register_byte): Remove function. (x86_64_register_virtual_type): Remove function. (x86_64_register_type): New function. (x86_64_register_convertible, x86_64_register_convert_to_virtual, x86_64_register_convert_to_raw): Remove functions. (x86_64_push_return_address, x86_64_pop_frame): Remove functon. (x86_64_use_struct_convention): Make static. Adjust for renamed defines. (x86_64_frame_init_saved_regs): Remove function. (x86_64_push_arguments): Make static. Change to accept a regcache as argument. (x86_64_store_return_value, x86_64_extract_return_value): Make static. Rewrite based on i386 counterparts. (x86_64_push_dummy_call): New function. (X86_64_NUM_SAVED_REGS): New define. (x86_64_register_number): Remove function. (x86_64_store_struct_return): Remove function. (x86_64_frameless_function_invocation, x86_64_function_has_prologue): Remove functions. (PROLOG_BUFSIZE): Remove define. (struct x86_64_frame_cache): New structure. (x86_64_alloc_frame_cache, x86_64_analyze_prologue, x86_64_frame_cache, x86_64_frame_this_id, x86_64_frame_prev_register, x86_64_frame_p, x86_64_sigtramp_frame_cache, x86_64_sigtramp_frame_this_id, x86_64_sigtramp_frame_prev_register, x86_sigtramp_frame_p): New functions. (x86_64_frame_unwind, x86_64_sigtramp_frame_unwind): New variables. (x86_64_skip_prologue): Rewrite in terms of x86_64_analyze_prologue. (x86_64_frame_base_address): New function. (x86_64_frame_base): New variable. (x86_64_save_dummy_frame_tos, x86_64_unwind_dummy_id): Rewrite. (x86_64_init_abi): Set register_type and push_dummy_call. Don't set deprecated_fp_regnum, deprecated_register_size, deprecated_register_bytes, register_raw_size, register_byte, register_virtual_type, register_convertiable, register_convert_to_virtual, convert_to_raw, deprecated_get_saved_register, deprecated_target_read_fp, deprecated_push_arguments, deprecated_push_return_address, deprecated_pop_frame, deprecated_store_struct_return, deprecated_frame_init_saved_regs, deprecated_frame_chain, frameless_function_invocation, deprecated_frame_saved_pc, deprecated_saved_pc_after_call, frame_num_args, pc_in_sigtramp, dwarf2_build_frame_info, deprecated_init_extra_frame_info, deprecated_init_frame_pc and virtual_frame_pointer. Call frame_unwind_append_predicate to register x86_64_sigtramp_frame_p and x86_64_frame_p. Call frame_base_set_default to register x86_64_frame_base. (I387_FISEG_REGNUM, I387_FOSEG_REGNUM): New defines. (x86_64_supply_fxsave, x86_64_fill_fxsave): New functions. (_initialize_x86_64_tdep): Remove function. * x86-64-linux-tdep.c: Don't include "dwarf2cfi.h". (LINUX_SIGINFO_SIZE, LINUX_UCONTEXT_SIGCONTEXT_OFFSET, LINUX_SIGCONTEXT_PC_OFFSET, LINUX_SIGCONTEXT_FP_OFFSET): Don't define. (X86_64_LINUX_UCONTEXT_SIGCONTEXT_OFFSET): Define. (x86_64_linux_sigcontext_addr): Rewrite. (x86_64_linux_sigtramp_saved_pc, x86_64_linux_saved_pc_after_call, x86_64_linux_frame_saved_pc): Remove functions. (x86_64_linux_pc_in_sigtramp): Renamed from x86_64_linux_in_sigtramp. Try harder to recognize a signal trampoline. (x86_64_linux_frame_chain, x86_64_init_frame_pc): Remove_functions. (x86_64_linux_init_abi): Set pc_in_sigtramp. Initialize TDEP->sigcontext_addr, TDEP->sc_pc_offset and TDEP->sc_sp_offset. * x86-64-linux-nat.c: Sync with i386-linux-tdep.c. (x86_64_regmap): Rename to regmap. (GETREGS_SUPPLIES): Use X86_64_NUM_GREGS instead of x86_64_num_gregs. (supply_gregset, fill_gregset): Likewise. Use regmap instead of x86_64_regmap. (x86_64_fxsave_offset): Remove function. (supply_fpregset): Simply call x86_64_supply_fxsave. (fill_fpregset): Simply call x86_64_fill_fxsave. (fetch_inferior_registers, store_inferior_registers): Avoid asignment in if-statement. (LINUX_SYSCALL_LEN, LINUX_SYSCALL_REGNUM, SYS_Sigreturn, SYS_rt_sigreturn, LINUX_SIGCONTEXT_EFLAGS_OFFSET, LINUX_UCONTEXT_SIGCONTEXT_OFFSET): Remove defines. (fetch_core_registers): Remove function. (linux_elf_core_fns): Remove. (offsetoff): Don't define. (_initialize_x86_64_linux_nat, kernel_u_size): Remove functions. * config/i386/x86-64linux.mt (TDEPFILES): Add i386-linux-tdep.o. * config/i386/x86-64linux.mh (NATDEPFILES): Remove core-aout.o, add core-regset.o. * config/i386/nm-x86-64linux.h: Use NM_X86_64_LINUX_H for protection against multiple includes instead of NM_X86_64_h. Add various comments. Include "config/nm-linux.h". Don't include <signal.h>. (REGISTER_U_ADDR, KERNEL_U_SIZE, U_REGS_OFFSET, KERN_U_ADDR, GET_THREAD_SIGNALS): Remove defines. (x86_64_register_u_addr, kernel_u_size, lin_thread_get_thread_signals): Remove prototypes. (PTRACE_ARG3_TYPE, PTRACE_XFER_TYPE): Define to `long'. [HAVE_LINK_H]: Don't include "solib.h". [HAVE_LINK_H] (SVR4_SHARED_LIBS): Remove define. * config/i386/tm-x86-64linux.h: Fix comments. * Makefile.in (x86-64-linux-nat.o, x86_64-linux-tdep.o, x86-64-tdep.o): Update dependencies.
2003-05-31 10:15:38 +02:00
if (tid == 0)
* aarch64-linux-nat.c: Replace PIDGET with ptid_get_pid. Replace TIDGET with ptid_get_lwp. Replace GET_LWP with ptid_get_lwp. * aix-thread.c (BUILD_THREAD, BUILD_LWP): Remove. Replace BUILD_THREAD with ptid_build. Replace BUILD_LWP with ptid_build. Replace PIDGET with ptid_get_pid. Replace TIDGET with ptid_get_lwp. * alphabsd-nat.c: Replace PIDGET with ptid_get_pid. * amd64-linux-nat.c: Replace PIDGET with ptid_get_pid. Replace TIDGET with ptid_get_lwp. * amd64bsd-nat.c: Replace PIDGET with ptid_get_pid. * arm-linux-nat.c: Replace PIDGET with ptid_get_pid. Replace TIDGET with ptid_get_lwp. Replace GET_LWP with ptid_get_lwp. * armnbsd-nat.c: Replace PIDGET with ptid_get_pid. * auxv.c: Likewise. * breakpoint.c: Likewise. * common/ptid.c (ptid_is_pid): Condense check for null_ptid and minus_one_ptid. (ptid_lwp_p): New function. (ptid_tid_p): New function. * common/ptid.h: Update comments for accessors. (ptid_lwp_p): New prototype. (ptid_tid_p): New prototype. * defs.h (PIDGET, TIDGET, MERGEPID): Do not define. * gcore.c: Replace PIDGET with ptid_get_pid. * gdbthread.h: Likewise. * gnu-nat.c: Likewise. * hppa-linux-nat.c: Replace PIDGET with ptid_get_pid. Replace TIDGET with ptid_get_lwp. * hppabsd-nat.c: Replace PIDGET with ptid_get_pid. * hppanbsd-nat.c: Likewise. * i386-linux-nat.c: Replace PIDGET with ptid_get_pid. Replace TIDGET with ptid_get_lwp. * i386bsd-nat.c: Replace PIDGET with ptid_get_pid. * ia64-linux-nat.c: Replace PIDGET with ptid_get_pid. * infcmd.c: Likewise. * inferior.h: Likewise. * inflow.c: Likewise. * infrun.c: Likewise. * linux-fork.c: Likewise. * linux-nat.c: Replace PIDGET with ptid_get_pid. Replace GET_PID with ptid_get_pid. Replace is_lwp with ptid_lwp_p. Replace GET_LWP with ptid_get_lwp. Replace BUILD_LWP with ptid_build.
2013-09-30 13:50:12 +02:00
tid = ptid_get_pid (inferior_ptid); /* Not a threaded program. */
if (regnum == -1 || amd64_native_gregset_supplies_p (gdbarch, regnum))
{
elf_gregset_t regs;
if (ptrace (PTRACE_GETREGS, tid, 0, (long) &regs) < 0)
perror_with_name (_("Couldn't get registers"));
* target.h (struct regcache): Add forward declaration. (struct target_ops): Add REGCACHE parameter to to_fetch_registers and to_store_registers target operations. (target_fetch_registers, target_store_registers): Update. * regcache.c (regcache_raw_read): Replace register_cached by regcache_valid_p. Pass regcache to target_fetch_registers. (regcache_raw_write): Pass regcache to target_store_registers. * arm-linux-nat.c (store_fpregister, store_fpregs, store_register, store_regs, store_wmmx_regs): Replace register_cached by regcache_valid_p. * bsd-kvm.c (bsd_kvm_open, bsd_kvm_proc_cmd): Pass current_regcache to target_fetch_registers calls. * corelow.c (core_open): Likewise. * linux-nat.c (linux_nat_corefile_thread_callback): Likewise. * proc-service.c (ps_lgetregs, ps_lsetregs, ps_lgetfpregs, ps_lsetfpregs): Likewise. * sol-thread.c (ps_lgetregs, ps_lsetregs, ps_lgetfpregs, ps_lsetfpregs): Likewise. * win32-nat.c (win32_resume): Likewise. * ia64-tdep.c (ia64_store_return_value): Pass current_regcache to target_store_registers call. * rs6000-tdep.c (rs6000_push_dummy_call): Likewise. * inferior.h (store_inferior_registers): Update prototype. (fetch_inferior_registers): Likewise. * gnu-nat.c (gnu_store_registers, gnu_fetch_registers): Likewise. * mips-linux-nat.c (super_fetch_registers, super_store_registers): Update function pointer signatures. * aix-thread.c (aix_thread_fetch_registers): Add REGCACHE parameter, use it instead of current_regcache, update calls. (aix_thread_store_registers): Likewise. * alphabsd-nat.c (alphabsd_fetch_inferior_registers): Likewise. (alphabsd_store_inferior_registers): Likewise. * amd64bsd-nat.c (amd64bsd_fetch_inferior_registers): Likewise. (amd64bsd_store_inferior_registers): Likewise. * amd64-linux-nat.c (amd64_linux_fetch_inferior_registers): Likewise. (amd64_linux_store_inferior_registers): Likewise. * arm-linux-nat.c (fetch_fpregister, fetch_fpregs, store_fpregister, store_fpregs, fetch_register, fetch_regs, store_register, store_regs, fetch_wmmx_regs, store_wmmx_regs): Likewise. (arm_linux_fetch_inferior_registers): Likewise. (arm_linux_store_inferior_registers): Likewise. * armnbsd-nat.c (fetch_register, fetch_regs, fetch_fp_register, fetch_fp_regs, armnbsd_fetch_registers): Likewise. (store_register, store_regs, store_fp_register, store_fp_regs, armnbsd_store_registers): Likewise. * bsd-kvm.c (bsd_kvm_fetch_pcb, bsd_kvm_fetch_registers): Likewise. * bsd-uthread.c (bsd_uthread_fetch_registers): Likewise. (bsd_uthread_store_registers): Likewise. * corelow.c (get_core_registers): Likewise. * go32-nat.c (fetch_register, go32_fetch_registers, store_register, go32_store_registers): Likewise. * hppabsd-nat.c (hppabsd_fetch_registers): Likewise. (hppabsd_store_registers): Likewise. * hppa-hpux-nat.c (hppa_hpux_fetch_register): Likewise. (hppa_hpux_fetch_inferior_registers): Likewise. (hppa_hpux_store_register): Likewise. (hppa_hpux_store_inferior_registers): Likewise. * hppa-linux-nat.c (fetch_register, store_register): Likewise. (hppa_linux_fetch_inferior_registers): Likewise. (hppa_linux_store_inferior_registers): Likewise. * hpux-thread.c (hpux_thread_fetch_registers): Likewise. (hpux_thread_store_registers): Likewise. * i386bsd-nat.c (i386bsd_fetch_inferior_registers): Likewise. (i386bsd_store_inferior_registers): Likewise. * i386gnu-nat.c (fetch_fpregs, gnu_fetch_registers, store_fpregs, gnu_store_registers): Likewise. * i386-linux-nat.c (fetch_register, store_register, fetch_regs, store_regs, fetch_fpregs, store_fpregs, fetch_fpxregs, store_fpxregs): Likewise. (i386_linux_fetch_inferior_registers): Likewise. (i386_linux_store_inferior_registers): Likewise. * ia64-linux-nat.c (ia64_linux_fetch_register): Likewise. (ia64_linux_fetch_registers): Likewise. (ia64_linux_store_register): Likewise. (ia64_linux_store_registers): Likewise. * inf-child.c (inf_child_fetch_inferior_registers): Likewise. (inf_child_store_inferior_registers): Likewise. * inf-ptrace.c (inf_ptrace_fetch_register): Likewise. (inf_ptrace_fetch_registers): Likewise. (inf_ptrace_store_register): Likewise. (inf_ptrace_store_registers): Likewise. * infptrace.c (fetch_register, store_register): Likewise. (fetch_inferior_registers, store_inferior_registers): Likewise. * m32r-linux-nat.c (fetch_regs, store_regs): Likewise. (m32r_linux_fetch_inferior_registers): Likewise. (m32r_linux_store_inferior_registers): Likewise. * m68kbsd-nat.c (m68kbsd_fetch_inferior_registers): Likewise. (m68kbsd_store_inferior_registers): Likewise. * m68klinux-nat.c (fetch_register, old_fetch_inferior_registers, store_register, old_store_inferior_registers, fetch_regs, store_regs, fetch_fpregs, store_fpregs): Likewise. (m68k_linux_fetch_inferior_registers): Likewise. (m68k_linux_store_inferior_registers): Likewise. * m88kbsd-nat.c (m88kbsd_fetch_inferior_registers): Likewise. (m88kbsd_store_inferior_registers): Likewise. * mips64obsd-nat.c (mips64obsd_fetch_inferior_registers): Likewise. (mips64obsd_store_inferior_registers): Likewise. * mips-linux-nat.c (mips64_linux_regsets_fetch_registers): Likewise. (mips64_linux_regsets_store_registers): Likewise. (mips64_linux_fetch_registers): Likewise. (mips64_linux_store_registers): Likewise. * mipsnbsd-nat.c (mipsnbsd_fetch_inferior_registers): Likewise. (mipsnbsd_store_inferior_registers): Likewise. * monitor.c (monitor_fetch_register, monitor_store_register): Likewise. (monitor_fetch_registers, monitor_store_registers): Likewise. * nto-procfs.c (procfs_fetch_registers): Likewise. (procfs_store_registers): Likewise. * ppc-linux-nat.c (fetch_altivec_register, fetch_spe_register, fetch_register, supply_vrregset, fetch_altivec_registers, fetch_ppc_registers, ppc_linux_fetch_inferior_registers): Likewise. (store_altivec_register, store_spe_register, store_register, fill_vrregset, store_altivec_registers, store_ppc_registers, ppc_linux_store_inferior_registers): Likewise. * ppcnbsd-nat.c (ppcnbsd_fetch_inferior_registers): Likewise. (ppcnbsd_store_inferior_registers): Likewise. * ppcobsd-nat.c (ppcobsd_fetch_registers): Likewise. (ppcobsd_store_registers): Likewise. * procfs.c (procfs_fetch_registers, procfs_store_registers): Likewise. * remote.c (fetch_register_using_p, process_g_packet, fetch_registers_using_g, remote_fetch_registers): Likewise. (store_register_using_P, store_registers_using_G, remote_store_registers): Likewise. * remote-m32r-sdi.c (m32r_fetch_registers, m32r_fetch_register, m32r_store_register, m32r_store_register): Likewise. * remote-mips.c (mips_fetch_registers, mips_store_registers): Likewise. * remote-sim.c (gdbsim_fetch_register): Likewise. (gdbsim_store_register): Likewise. * rs6000-nat.c (fetch_register, store_register): Likewise. (rs6000_fetch_inferior_registers): Likewise. (rs6000_store_inferior_registers): Likewise. * s390-nat.c (fetch_regs, store_regs): Likewise. (fetch_fpregs, store_fpregs): Likewise. (s390_linux_fetch_inferior_registers): Likewise. (s390_linux_store_inferior_registers): Likewise. * shnbsd-nat.c (shnbsd_fetch_inferior_registers): Likewise. (shnbsd_store_inferior_registers): Likewise. * sol-thread.c (sol_thread_fetch_registers): Likewise. (sol_thread_store_registers): Likewise. * sparc-nat.c (fetch_inferior_registers): Likewise. (store_inferior_registers): Likewise. * spu-linux-nat.c (spu_fetch_inferior_registers): Likewise. (spu_store_inferior_registers): Likewise. * target.c (debug_print_register): Likewise. (debug_to_fetch_registers, debug_to_store_registers): Likewise. * vaxbsd-nat.c (vaxbsd_fetch_inferior_registers): Likewise. (vaxbsd_store_inferior_registers): Likewise. * win32-nat.c (do_win32_fetch_inferior_registers): Likewise. (win32_fetch_inferior_registers): Likewise. (win32_store_inferior_registers): Likewise.
2007-05-06 16:34:38 +02:00
amd64_supply_native_gregset (regcache, &regs, -1);
if (regnum != -1)
return;
}
if (regnum == -1 || !amd64_native_gregset_supplies_p (gdbarch, regnum))
{
elf_fpregset_t fpregs;
Support amd64 AVX. gdb/ 2010-04-07 H.J. Lu <hongjiu.lu@intel.com> * amd64-linux-nat.c: Include "regset.h", "elf/common.h", <sys/uio.h> and "i386-xstate.h". (PTRACE_GETREGSET): New. (PTRACE_SETREGSET): Likewise. (have_ptrace_getregset): Likewise. (amd64_linux_gregset64_reg_offset): Include 16 upper YMM registers. (amd64_linux_gregset32_reg_offset): Include 8 upper YMM registers. (amd64_linux_fetch_inferior_registers): Support PTRACE_GETFPREGS. (amd64_linux_store_inferior_registers): Likewise. (amd64_linux_read_description): Check and enable AVX target descriptions. * amd64-linux-tdep.c: Include "regset.h", "i386-linux-tdep.h" and "features/i386/amd64-avx-linux.c". (amd64_linux_regset_sections): New. (amd64_linux_core_read_description): Check and enable AVX target description. (amd64_linux_init_abi): Set xsave_xcr0_offset. Call set_gdbarch_core_regset_sections. (_initialize_amd64_linux_tdep): Call initialize_tdesc_amd64_avx_linux. * amd64-linux-tdep.h (AMD64_LINUX_ORIG_RAX_REGNUM): Replace AMD64_MXCSR_REGNUM with AMD64_YMM15H_REGNUM. (tdesc_amd64_avx_linux): New. (amd64_linux_update_xstateregset): Likewise. * amd64-tdep.c: Include "features/i386/amd64-avx.c". (amd64_ymm_names): New. (amd64_ymmh_names): Likewise. (amd64_register_name): Likewise. (amd64_supply_xstateregset): Likewise. (amd64_collect_xstateregset): Likewise. (amd64_supply_xsave): Likewise. (amd64_collect_xsave): Likewise. (AMD64_NUM_REGS): Removed. (amd64_dwarf_reg_to_regnum): Return %ymmN register number for %xmmN if AVX is available. (amd64_pseudo_register_name): Support pseudo YMM registers. (amd64_regset_from_core_section): Support .reg-xstate section. (amd64_init_abi): Set ymmh_register_names, num_ymm_regs and ymm0h_regnum. Call set_gdbarch_register_name. (amd64_init_abi): Call initialize_tdesc_amd64_avx. * amd64-tdep.h (amd64_regnum): Add AMD64_YMM0H_REGNUM and AMD64_YMM15H_REGNUM. (AMD64_NUM_REGS): New. (amd64_supply_xsave): Likewise. (amd64_collect_xsave): Likewise. (amd64_register_name): Removed. (amd64_register_type): Likewise. gdb/testsuite/ 2010-04-07 H.J. Lu <hongjiu.lu@intel.com> * gdb.arch/i386-avx.c: New. * gdb.arch/i386-avx.exp: Likewise. * gdb.arch/i386-cpuid.h: Updated from gcc 4.4.
2010-04-07 20:46:50 +02:00
if (have_ptrace_getregset)
{
char xstateregs[I386_XSTATE_MAX_SIZE];
struct iovec iov;
iov.iov_base = xstateregs;
iov.iov_len = sizeof (xstateregs);
if (ptrace (PTRACE_GETREGSET, tid,
(unsigned int) NT_X86_XSTATE, (long) &iov) < 0)
perror_with_name (_("Couldn't get extended state status"));
Support amd64 AVX. gdb/ 2010-04-07 H.J. Lu <hongjiu.lu@intel.com> * amd64-linux-nat.c: Include "regset.h", "elf/common.h", <sys/uio.h> and "i386-xstate.h". (PTRACE_GETREGSET): New. (PTRACE_SETREGSET): Likewise. (have_ptrace_getregset): Likewise. (amd64_linux_gregset64_reg_offset): Include 16 upper YMM registers. (amd64_linux_gregset32_reg_offset): Include 8 upper YMM registers. (amd64_linux_fetch_inferior_registers): Support PTRACE_GETFPREGS. (amd64_linux_store_inferior_registers): Likewise. (amd64_linux_read_description): Check and enable AVX target descriptions. * amd64-linux-tdep.c: Include "regset.h", "i386-linux-tdep.h" and "features/i386/amd64-avx-linux.c". (amd64_linux_regset_sections): New. (amd64_linux_core_read_description): Check and enable AVX target description. (amd64_linux_init_abi): Set xsave_xcr0_offset. Call set_gdbarch_core_regset_sections. (_initialize_amd64_linux_tdep): Call initialize_tdesc_amd64_avx_linux. * amd64-linux-tdep.h (AMD64_LINUX_ORIG_RAX_REGNUM): Replace AMD64_MXCSR_REGNUM with AMD64_YMM15H_REGNUM. (tdesc_amd64_avx_linux): New. (amd64_linux_update_xstateregset): Likewise. * amd64-tdep.c: Include "features/i386/amd64-avx.c". (amd64_ymm_names): New. (amd64_ymmh_names): Likewise. (amd64_register_name): Likewise. (amd64_supply_xstateregset): Likewise. (amd64_collect_xstateregset): Likewise. (amd64_supply_xsave): Likewise. (amd64_collect_xsave): Likewise. (AMD64_NUM_REGS): Removed. (amd64_dwarf_reg_to_regnum): Return %ymmN register number for %xmmN if AVX is available. (amd64_pseudo_register_name): Support pseudo YMM registers. (amd64_regset_from_core_section): Support .reg-xstate section. (amd64_init_abi): Set ymmh_register_names, num_ymm_regs and ymm0h_regnum. Call set_gdbarch_register_name. (amd64_init_abi): Call initialize_tdesc_amd64_avx. * amd64-tdep.h (amd64_regnum): Add AMD64_YMM0H_REGNUM and AMD64_YMM15H_REGNUM. (AMD64_NUM_REGS): New. (amd64_supply_xsave): Likewise. (amd64_collect_xsave): Likewise. (amd64_register_name): Removed. (amd64_register_type): Likewise. gdb/testsuite/ 2010-04-07 H.J. Lu <hongjiu.lu@intel.com> * gdb.arch/i386-avx.c: New. * gdb.arch/i386-avx.exp: Likewise. * gdb.arch/i386-cpuid.h: Updated from gcc 4.4.
2010-04-07 20:46:50 +02:00
amd64_supply_xsave (regcache, -1, xstateregs);
}
else
{
if (ptrace (PTRACE_GETFPREGS, tid, 0, (long) &fpregs) < 0)
perror_with_name (_("Couldn't get floating point status"));
amd64_supply_fxsave (regcache, -1, &fpregs);
}
}
}
/* Store register REGNUM back into the child process. If REGNUM is
-1, do this for all registers (including the floating-point and SSE
registers). */
* x86-64-tdep.h (x86_64_num_regs, x86_64_num_gregs): Remove variable declarations. (x86_64_register_number, x86_64_register_name): Remove prototypes. (x86_64_linux_frame_saved_pc, x86_64_linux+saved_pc_after_call, x86_64_linux_in_sigtramp, x86_64_linux_frame_chain, x86_64_init_frame_pc, x86_64_init_frame_pc, x86_64_function_has_prologue): Remove prototypes. (X86_64_NUM_GREGS): New define. (x86_64_supply_fxsave, x86_64_fill_fxsave): New prototypes. * x86-64-tdep.c: Don't include "dwarf2cfi.h". Include "dummy_frame.h", "frame.h", "frame-base.h", "frame-unwind.h". (RAX_REGNUM, RDX_REGNUM, RDI_REGNUM, EFLAGS_REGNUM, ST0_REGNUM, XMM1_REGNUM): Remove defines. (X86_64_RAX_REGNUM, X86_64_RDX_REGNUM, X86_64_RDI_REGNUM, X86_64_RBP_REGNUM, X86_64_RSP_REGNUM, X86_64_RIP_REGNUM, X86_64_EFLAGS_REGNUM, X86_64_ST0_REGNUM, X86_64_XMM0_REGNUM, X86_64_XMM1_REGNUM): New defines. (struct x86_64_register_info): Renamed from `struct register_info'. Remove `size' member. (x86_64_register_info_table): Remove variable. (x86_64_register_info): New variable. (X86_64_NUM_REGS): New define. (X86_64_NUM_GREGS): Remove define. (x86_64_num_regs, x86_64_num_gregs): Remove variables. (x86_64_dwarf2gdb_regno_map, x86_64_dwarf2gdb_regno_map_length): Remove variables. (x86_54_dwarf2_reg_to_regnum): Remove function. (x86_64_dwarf_regmap, x86_64_dwarf_regmap_len): New variables. (x86_64_dwarf_reg_to_regnum): New function. (x86_64_register_name): Rewrite. (x86_64_register_raw_size): Remove function. (x86_64_register_byte_table): Remove variable. (x86_64_register_byte): Remove function. (x86_64_register_virtual_type): Remove function. (x86_64_register_type): New function. (x86_64_register_convertible, x86_64_register_convert_to_virtual, x86_64_register_convert_to_raw): Remove functions. (x86_64_push_return_address, x86_64_pop_frame): Remove functon. (x86_64_use_struct_convention): Make static. Adjust for renamed defines. (x86_64_frame_init_saved_regs): Remove function. (x86_64_push_arguments): Make static. Change to accept a regcache as argument. (x86_64_store_return_value, x86_64_extract_return_value): Make static. Rewrite based on i386 counterparts. (x86_64_push_dummy_call): New function. (X86_64_NUM_SAVED_REGS): New define. (x86_64_register_number): Remove function. (x86_64_store_struct_return): Remove function. (x86_64_frameless_function_invocation, x86_64_function_has_prologue): Remove functions. (PROLOG_BUFSIZE): Remove define. (struct x86_64_frame_cache): New structure. (x86_64_alloc_frame_cache, x86_64_analyze_prologue, x86_64_frame_cache, x86_64_frame_this_id, x86_64_frame_prev_register, x86_64_frame_p, x86_64_sigtramp_frame_cache, x86_64_sigtramp_frame_this_id, x86_64_sigtramp_frame_prev_register, x86_sigtramp_frame_p): New functions. (x86_64_frame_unwind, x86_64_sigtramp_frame_unwind): New variables. (x86_64_skip_prologue): Rewrite in terms of x86_64_analyze_prologue. (x86_64_frame_base_address): New function. (x86_64_frame_base): New variable. (x86_64_save_dummy_frame_tos, x86_64_unwind_dummy_id): Rewrite. (x86_64_init_abi): Set register_type and push_dummy_call. Don't set deprecated_fp_regnum, deprecated_register_size, deprecated_register_bytes, register_raw_size, register_byte, register_virtual_type, register_convertiable, register_convert_to_virtual, convert_to_raw, deprecated_get_saved_register, deprecated_target_read_fp, deprecated_push_arguments, deprecated_push_return_address, deprecated_pop_frame, deprecated_store_struct_return, deprecated_frame_init_saved_regs, deprecated_frame_chain, frameless_function_invocation, deprecated_frame_saved_pc, deprecated_saved_pc_after_call, frame_num_args, pc_in_sigtramp, dwarf2_build_frame_info, deprecated_init_extra_frame_info, deprecated_init_frame_pc and virtual_frame_pointer. Call frame_unwind_append_predicate to register x86_64_sigtramp_frame_p and x86_64_frame_p. Call frame_base_set_default to register x86_64_frame_base. (I387_FISEG_REGNUM, I387_FOSEG_REGNUM): New defines. (x86_64_supply_fxsave, x86_64_fill_fxsave): New functions. (_initialize_x86_64_tdep): Remove function. * x86-64-linux-tdep.c: Don't include "dwarf2cfi.h". (LINUX_SIGINFO_SIZE, LINUX_UCONTEXT_SIGCONTEXT_OFFSET, LINUX_SIGCONTEXT_PC_OFFSET, LINUX_SIGCONTEXT_FP_OFFSET): Don't define. (X86_64_LINUX_UCONTEXT_SIGCONTEXT_OFFSET): Define. (x86_64_linux_sigcontext_addr): Rewrite. (x86_64_linux_sigtramp_saved_pc, x86_64_linux_saved_pc_after_call, x86_64_linux_frame_saved_pc): Remove functions. (x86_64_linux_pc_in_sigtramp): Renamed from x86_64_linux_in_sigtramp. Try harder to recognize a signal trampoline. (x86_64_linux_frame_chain, x86_64_init_frame_pc): Remove_functions. (x86_64_linux_init_abi): Set pc_in_sigtramp. Initialize TDEP->sigcontext_addr, TDEP->sc_pc_offset and TDEP->sc_sp_offset. * x86-64-linux-nat.c: Sync with i386-linux-tdep.c. (x86_64_regmap): Rename to regmap. (GETREGS_SUPPLIES): Use X86_64_NUM_GREGS instead of x86_64_num_gregs. (supply_gregset, fill_gregset): Likewise. Use regmap instead of x86_64_regmap. (x86_64_fxsave_offset): Remove function. (supply_fpregset): Simply call x86_64_supply_fxsave. (fill_fpregset): Simply call x86_64_fill_fxsave. (fetch_inferior_registers, store_inferior_registers): Avoid asignment in if-statement. (LINUX_SYSCALL_LEN, LINUX_SYSCALL_REGNUM, SYS_Sigreturn, SYS_rt_sigreturn, LINUX_SIGCONTEXT_EFLAGS_OFFSET, LINUX_UCONTEXT_SIGCONTEXT_OFFSET): Remove defines. (fetch_core_registers): Remove function. (linux_elf_core_fns): Remove. (offsetoff): Don't define. (_initialize_x86_64_linux_nat, kernel_u_size): Remove functions. * config/i386/x86-64linux.mt (TDEPFILES): Add i386-linux-tdep.o. * config/i386/x86-64linux.mh (NATDEPFILES): Remove core-aout.o, add core-regset.o. * config/i386/nm-x86-64linux.h: Use NM_X86_64_LINUX_H for protection against multiple includes instead of NM_X86_64_h. Add various comments. Include "config/nm-linux.h". Don't include <signal.h>. (REGISTER_U_ADDR, KERNEL_U_SIZE, U_REGS_OFFSET, KERN_U_ADDR, GET_THREAD_SIGNALS): Remove defines. (x86_64_register_u_addr, kernel_u_size, lin_thread_get_thread_signals): Remove prototypes. (PTRACE_ARG3_TYPE, PTRACE_XFER_TYPE): Define to `long'. [HAVE_LINK_H]: Don't include "solib.h". [HAVE_LINK_H] (SVR4_SHARED_LIBS): Remove define. * config/i386/tm-x86-64linux.h: Fix comments. * Makefile.in (x86-64-linux-nat.o, x86_64-linux-tdep.o, x86-64-tdep.o): Update dependencies.
2003-05-31 10:15:38 +02:00
* Makefile.in (ALLDEPFILES): Update. (alpha-linux-nat.o, sparc-linux-nat.o): New rules. (amd64-linux-nat.o, arm-linux-nat.o, hppa-linux-nat.o) (i386-linux-nat.o, ia64-linux-nat.o, linux-nat.o, m32r-linux-nat.o) (m68klinux-nat.o, mips-linux-nat.o, ppc-linux-nat.o, s390-nat.o) (sparc64-linux-nat.o): Update dependencies. * alpha-linux-nat.c, sparc-linux-nat.c: New files. * amd64-linux-nat.c (amd64_linux_fetch_inferior_registers): Renamed from fetch_inferior_registers and made static. (amd64_linux_store_inferior_registers): Renamed from store_inferior_registers and made static. (amd64_linux_child_post_start_inferior): Renamed from child_post_startup_inferior and made static. Call super_post_startup_inferior. (super_post_startup_inferior): New. (_initialize_amd64_linux_nat): Set it. Call linux_target and add_target. * arm-linux-nat.c (arm_linux_fetch_inferior_registers): Renamed from fetch_inferior_registers and made static. (arm_linux_store_inferior_registers): Renamed from store_inferior_registers and made static. (_initialize_arm_linux_nat): Add a prototype. Use linux_target and add_target. * hppa-linux-nat.c (hppa_linux_fetch_inferior_registers): Renamed from fetch_inferior_registers and made static. (hppa_linux_store_inferior_registers): Renamed from store_inferior_registers and made static. (_initialize_hppa_linux_nat): New function. * i386-linux-nat.c (i386_linux_fetch_inferior_registers): Renamed from fetch_inferior_registers and made static. (i386_linux_store_inferior_registers): Renamed from store_inferior_registers and made static. (i386_linux_resume): Renamed from child_resume and made static. (i386_linux_child_post_start_inferior): Renamed from child_post_startup_inferior and made static. Call super_post_startup_inferior. (super_post_startup_inferior): New. (_initialize_i386_linux_nat): New function. * i386-nat.c: Remove LINUX_CHILD_POST_STARTUP_INFERIOR #ifndef. * ia64-linux-nat.c (ia64_linux_xfer_unwind_table): Remove. (super_xfer_partial): New. (ia64_linux_xfer_partial): New function. Use it. (_initialize_ia64_linux_nat): New function. * ia64-tdep.c (getunwind_table): Revert 2005-06-08 change; use target_read_partial and document the problem. * inf-ptrace.c (inf_ptrace_fetch_register): Use CANNOT_FETCH_REGISTER. Fix some comments. (inf_ptrace_store_register): Use CANNOT_STORE_REGISTER. Fix some comments. * linux-nat.c: Include "inf-ptrace.h" and "auxv.h". (linux_ops, super_xfer_partial): New variables. (linux_child_post_startup_inferior): Make static. (child_post_startup_inferior): Delete. (linux_nat_attach, linux_nat_detach, resume_callback) (linux_nat_resume, linux_nat_wait, linux_nat_create_inferior) (linux_nat_mourn_inferior): Use linux_ops instead of deprecated_child_ops. (child_wait): Do not depend on CHILD_WAIT. (linux_nat_xfer_memory): Remove, replace by ... (linux_nat_xfer_partial): ... this. Use linux_ops->to_xfer_partial instead of linux_proc_xfer_memory and child_xfer_memory. (linux_nat_fetch_registers, linux_nat_store_registers) (linux_nat_child_post_startup_inferior): New functions. (init_linux_nat_ops): Use the new functions. (linux_proc_xfer_memory): Remove, replace by ... (linux_proc_xfer_partial): ... this. Make static. (linux_xfer_partial, linux_register_u_offset, linux_target): New functions. (_initialize_linux_nat): Do not modify deprecated_child_ops. * linux-nat.h (linux_proc_xfer_memory): Remove prototype. (struct mem_attrib, struct target_ops): Remove forward declarations. (linux_child_post_startup_inferior): Remove prototype. (linux_target): Add prototype. * linux-thread-db.c (thread_db_xfer_memory): Remove, replace by ... (thread_db_xfer_partial): ... this. (init_thread_db_ops): Set to_xfer_partial instead of deprecated_xfer_memory. * m32r-linux-nat.c (m32r_linux_fetch_inferior_registers): Renamed from fetch_inferior_registers and made static. (m32r_linux_store_inferior_registers): Renamed from store_inferior_registers and made static. (_initialize_m32r_linux_nat): New function. * m68klinux-nat.c (m68k_linux_fetch_inferior_registers): Renamed from fetch_inferior_registers and made static. (m68k_linux_store_inferior_registers): Renamed from store_inferior_registers and made static. (old_fetch_inferior_registers, old_store_inferior_registers): Made static. (_initialize_m68k_linux_nat): Use linux_target and add_target. * mips-linux-nat.c (_initialize_mips_linux_nat): New function. * ppc-linux-nat.c (ppc_linux_fetch_inferior_registers): Renamed from fetch_inferior_registers and made static. (ppc_linux_store_inferior_registers): Renamed from store_inferior_registers and made static. (_initialize_ppc_linux_nat): New function. * s390-nat.c (s390_linux_fetch_inferior_registers): Renamed from fetch_inferior_registers and made static. (s390_linux_store_inferior_registers): Renamed from store_inferior_registers and made static. (_initialize_s390_nat): New function. * sparc64-linux-nat.c (_initialize_sparc64_linux_nat): Use linux_target and add_target. * config/nm-linux.h: Don't include "auxv.h". (struct target_waitstatus, child_wait, CHILD_WAIT) (CHILD_PID_TO_EXEC_FILE, CHILD_INSERT_FORK_CATCHPOINT) (CHILD_INSERT_VFORK_CATCHPOINT, CHILD_INSERT_EXEC_CATCHPOINT) (CHILD_POST_STARTUP_INFERIOR, CHILD_POST_ATTACH, CHILD_FOLLOW_FORK) (DEPRECATED_KILL_INFERIOR, NATIVE_XFER_AUXV): Delete. * config/alpha/alpha-linux.mh (NATDEPFILES): Replace infptrace.o and inftarg.o with inf-ptrace.o and alpha-linux-nat.o. * config/sparc/linux.mh (NATDEPFILES): Replace infptrace.o and inftarg.o with sparc-linux-nat.o. * config/sparc/linux64.mh (NATDEPFILES): Remove infptrace.o and inftarg.o. * config/arm/linux.mh (NATDEPFILES): Replace infptrace.o and inftarg.o with inf-ptrace.o. * 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/s390/s390.mh (NATDEPFILES): Likewise. * config/i386/nm-linux.h (DEPRECATED_CHILD_RESUME): Don't define. (LINUX_CHILD_POST_STARTUP_INFERIOR): Don't define. * config/i386/nm-linux64.h (LINUX_CHILD_POST_STARTUP_INFERIOR): Don't define. * config/ia64/nm-linux.h: Don't include "target.h". (NATIVE_XFER_UNWIND_TABLE, ia64_linux_xfer_unwind_table): Remove. * config/djgpp/fnchange.lst: Add alpha-linux-tdep.c, alpha-linux-nat.c, sparc-linux-tdep.c, and sparc-linux-nat.c.
2005-09-10 20:11:14 +02:00
static void
* corelow.c (get_core_registers): Adjust. (core_file_thread_alive): Rename to... (core_thread_alive): ... this. (core_pid_to_str): Try gdbarch_core_pid_to_str first. (init_core_ops): Adjust. (coreops_suppress_target): Delete. (_initialize_corelow): Unconditionally add core_ops. * procfs.c: Include "inf-child.h". (procfs_ops): Delete. (init_procfs_ops): Delete. Reimplement as... (procfs_target): ... this, inheriting from inf-child. (procfs_attach, procfs_detach, procfs_fetch_registers): Adjust. (procfs_prepare_to_store): Delete. (procfs_store_registers, procfs_resume): Adjust. (procfs_open): Delete. (procfs_suppress_run): Delete. (procfs_can_run): Delete. (procfs_mourn_inferior): Adjust. (procfs_init_inferior): Add target_ops parameter. Adjust. (procfs_create_inferior): Don't pass procfs_init_inferior to fork_inferior. Instead call it after fork_inferior returns. (procfs_find_new_threads): Adjust. (_initialize_procfs): Adjust to use procfs_target instead of init_procfs_ops. * sol-thread.c (orig_core_ops, sol_core_ops): Delete. (lwp_to_thread): Use target_thread_alive. (sol_thread_open): Delete. (sol_thread_attach): Delete. (sol_thread_detach, sol_thread_resume, sol_thread_wait) (sol_thread_fetch_registers, sol_thread_store_registers): Adjust to use find_target_beneath. (sol_thread_prepare_to_store, sol_thread_xfer_memory): Delete. (sol_thread_xfer_partial): Adjust to use find_target_beneath. (sol_thread_files_info, sol_thread_kill_inferior): Delete. (check_for_thread_db): New. (sol_thread_notice_signals, sol_thread_create_inferior): Delete. (sol_thread_new_objfile): Call check_for_thread_db. (sol_thread_mourn_inferior): Adjust to use find_target_beneath. (sol_thread_can_run): Delete. (sol_thread_alive): Adjust to use find_target_beneath. (sol_thread_stop): Delete. (rw_common): Use target_write_memory or target_read_memory. (ps_lgetregs, ps_lgetfpregs): Use target_fetch_registers. (ps_lsetregs, ps_lsetfpregs): Use target_store_registers. (solaris_pid_to_str): Remove check for libthread_db initialization failing. (sol_find_new_threads): Remove check for libthread_db initialization failing, or for an invalid inferior_ptid. Adjust to use find_target_beneath. (sol_core_open, sol_core_close, sol_core_detach, sol_core_files_info, sol_find_memory_regions, sol_make_note_section, ignore): Delete. (init_sol_thread_ops): Make it a thread_stratum target. Remove unneeded callback settings. (init_sol_core_ops): Delete. (_initialize_sol_thread): No longer call init_sol_core_ops, set procfs_suppress_run, or hack with core_ops. * target.h (struct target_ops): Add a target_ops * parameter to to_resume, to_fetch_registers, to_store_registers, to_thread_alive and to_find_new_threads. (target_fetch_registers, target_store_registers) (target_thread_alive, target_find_new_threads): Redeclare as function. * target.c (update_current_target): Do not inherit or de_fault to_resume, to_fetch_registers, to_store_registers, to_thread_alive, to_find_new_threads. (target_resume): Adjust. (target_thread_alive, target_find_new_threads): New. (debug_to_resume, debug_to_fetch_registers): Delete. (target_fetch_registers): New. (debug_to_store_registers): Delete. (target_store_registers): New. (debug_to_thread_alive, debug_to_find_new_threads): Delete. (setup_target_debug): Adjust. * gdbcore.h (core_ops): Delete declaration. * inf-ptrace.c, linux-nat.c, remote.c, amd64-linux-nat.c, inf-child.c, linux-thread-db.c, bsd-uthread.c, inf-ttrace.c, i386-sol2-tdep.c, darwin-nat.c, gnu-nat.c, go32-nat.c, hpux-thread.c, i386-linux-nat.c, i386fbsd-nat.c, monitor.c, nto-procfs.c, remote-m32r-sdi.c, remote-mips.c, windows-nat.c, alphabsd-nat.c, amd64bsd-nat.c, arm-linux-nat.c, armnbsd-nat.c, bsd-kvm.c, hppa-hpux-nat.c, hppa-linux-nat.c, hppabsd-nat.c, hppanbsd-nat.c, i386-darwin-nat.c, i386bsd-nat.c, ia64-linux-nat.c, m32r-linux-nat.c, m68kbsd-nat.c, m68klinux-nat.c, m88kbsd-nat.c, mips-linux-nat.c, mips64obsd-nat.c, mipsnbsd-nat.c, ppc-linux-nat.c, ppcnbsd-nat.c, ppcobsd-nat.c, remote-sim.c, rs6000-nat.c, s390-nat.c, shnbsd-nat.c, sparc-nat.c, sparc-nat.h, spu-linux-nat.c, vaxbsd-nat.c, xtensa-linux-nat.c: Adjust to target_ops changes. * gdbarch.sh (core_pid_to_str): New gdbarch callback. * gdbarch.h, gdbarch.c: Regenerate. * sol2-tdep.c: Include "inferior.h". (sol2_core_pid_to_str): New. * sol2-tdep.h (sol2_core_pid_to_str): Declare. * amd64-sol2-tdep.c (amd64_sol2_init_abi): Set it. * sparc-sol2-tdep.c (sparc32_sol2_init_abi): Set it. * sparc64-sol2-tdep.c (sparc64_sol2_init_abi): Set it. * i386-sol2-tdep.c (i386_sol2_init_abi): Set it.
2009-02-23 01:03:50 +01:00
amd64_linux_store_inferior_registers (struct target_ops *ops,
struct regcache *regcache, int regnum)
{
struct gdbarch *gdbarch = get_regcache_arch (regcache);
int tid;
2002-02-24 23:14:33 +01:00
/* GNU/Linux LWP ID's are process ID's. */
* aarch64-linux-nat.c: Replace PIDGET with ptid_get_pid. Replace TIDGET with ptid_get_lwp. Replace GET_LWP with ptid_get_lwp. * aix-thread.c (BUILD_THREAD, BUILD_LWP): Remove. Replace BUILD_THREAD with ptid_build. Replace BUILD_LWP with ptid_build. Replace PIDGET with ptid_get_pid. Replace TIDGET with ptid_get_lwp. * alphabsd-nat.c: Replace PIDGET with ptid_get_pid. * amd64-linux-nat.c: Replace PIDGET with ptid_get_pid. Replace TIDGET with ptid_get_lwp. * amd64bsd-nat.c: Replace PIDGET with ptid_get_pid. * arm-linux-nat.c: Replace PIDGET with ptid_get_pid. Replace TIDGET with ptid_get_lwp. Replace GET_LWP with ptid_get_lwp. * armnbsd-nat.c: Replace PIDGET with ptid_get_pid. * auxv.c: Likewise. * breakpoint.c: Likewise. * common/ptid.c (ptid_is_pid): Condense check for null_ptid and minus_one_ptid. (ptid_lwp_p): New function. (ptid_tid_p): New function. * common/ptid.h: Update comments for accessors. (ptid_lwp_p): New prototype. (ptid_tid_p): New prototype. * defs.h (PIDGET, TIDGET, MERGEPID): Do not define. * gcore.c: Replace PIDGET with ptid_get_pid. * gdbthread.h: Likewise. * gnu-nat.c: Likewise. * hppa-linux-nat.c: Replace PIDGET with ptid_get_pid. Replace TIDGET with ptid_get_lwp. * hppabsd-nat.c: Replace PIDGET with ptid_get_pid. * hppanbsd-nat.c: Likewise. * i386-linux-nat.c: Replace PIDGET with ptid_get_pid. Replace TIDGET with ptid_get_lwp. * i386bsd-nat.c: Replace PIDGET with ptid_get_pid. * ia64-linux-nat.c: Replace PIDGET with ptid_get_pid. * infcmd.c: Likewise. * inferior.h: Likewise. * inflow.c: Likewise. * infrun.c: Likewise. * linux-fork.c: Likewise. * linux-nat.c: Replace PIDGET with ptid_get_pid. Replace GET_PID with ptid_get_pid. Replace is_lwp with ptid_lwp_p. Replace GET_LWP with ptid_get_lwp. Replace BUILD_LWP with ptid_build.
2013-09-30 13:50:12 +02:00
tid = ptid_get_lwp (inferior_ptid);
* x86-64-tdep.h (x86_64_num_regs, x86_64_num_gregs): Remove variable declarations. (x86_64_register_number, x86_64_register_name): Remove prototypes. (x86_64_linux_frame_saved_pc, x86_64_linux+saved_pc_after_call, x86_64_linux_in_sigtramp, x86_64_linux_frame_chain, x86_64_init_frame_pc, x86_64_init_frame_pc, x86_64_function_has_prologue): Remove prototypes. (X86_64_NUM_GREGS): New define. (x86_64_supply_fxsave, x86_64_fill_fxsave): New prototypes. * x86-64-tdep.c: Don't include "dwarf2cfi.h". Include "dummy_frame.h", "frame.h", "frame-base.h", "frame-unwind.h". (RAX_REGNUM, RDX_REGNUM, RDI_REGNUM, EFLAGS_REGNUM, ST0_REGNUM, XMM1_REGNUM): Remove defines. (X86_64_RAX_REGNUM, X86_64_RDX_REGNUM, X86_64_RDI_REGNUM, X86_64_RBP_REGNUM, X86_64_RSP_REGNUM, X86_64_RIP_REGNUM, X86_64_EFLAGS_REGNUM, X86_64_ST0_REGNUM, X86_64_XMM0_REGNUM, X86_64_XMM1_REGNUM): New defines. (struct x86_64_register_info): Renamed from `struct register_info'. Remove `size' member. (x86_64_register_info_table): Remove variable. (x86_64_register_info): New variable. (X86_64_NUM_REGS): New define. (X86_64_NUM_GREGS): Remove define. (x86_64_num_regs, x86_64_num_gregs): Remove variables. (x86_64_dwarf2gdb_regno_map, x86_64_dwarf2gdb_regno_map_length): Remove variables. (x86_54_dwarf2_reg_to_regnum): Remove function. (x86_64_dwarf_regmap, x86_64_dwarf_regmap_len): New variables. (x86_64_dwarf_reg_to_regnum): New function. (x86_64_register_name): Rewrite. (x86_64_register_raw_size): Remove function. (x86_64_register_byte_table): Remove variable. (x86_64_register_byte): Remove function. (x86_64_register_virtual_type): Remove function. (x86_64_register_type): New function. (x86_64_register_convertible, x86_64_register_convert_to_virtual, x86_64_register_convert_to_raw): Remove functions. (x86_64_push_return_address, x86_64_pop_frame): Remove functon. (x86_64_use_struct_convention): Make static. Adjust for renamed defines. (x86_64_frame_init_saved_regs): Remove function. (x86_64_push_arguments): Make static. Change to accept a regcache as argument. (x86_64_store_return_value, x86_64_extract_return_value): Make static. Rewrite based on i386 counterparts. (x86_64_push_dummy_call): New function. (X86_64_NUM_SAVED_REGS): New define. (x86_64_register_number): Remove function. (x86_64_store_struct_return): Remove function. (x86_64_frameless_function_invocation, x86_64_function_has_prologue): Remove functions. (PROLOG_BUFSIZE): Remove define. (struct x86_64_frame_cache): New structure. (x86_64_alloc_frame_cache, x86_64_analyze_prologue, x86_64_frame_cache, x86_64_frame_this_id, x86_64_frame_prev_register, x86_64_frame_p, x86_64_sigtramp_frame_cache, x86_64_sigtramp_frame_this_id, x86_64_sigtramp_frame_prev_register, x86_sigtramp_frame_p): New functions. (x86_64_frame_unwind, x86_64_sigtramp_frame_unwind): New variables. (x86_64_skip_prologue): Rewrite in terms of x86_64_analyze_prologue. (x86_64_frame_base_address): New function. (x86_64_frame_base): New variable. (x86_64_save_dummy_frame_tos, x86_64_unwind_dummy_id): Rewrite. (x86_64_init_abi): Set register_type and push_dummy_call. Don't set deprecated_fp_regnum, deprecated_register_size, deprecated_register_bytes, register_raw_size, register_byte, register_virtual_type, register_convertiable, register_convert_to_virtual, convert_to_raw, deprecated_get_saved_register, deprecated_target_read_fp, deprecated_push_arguments, deprecated_push_return_address, deprecated_pop_frame, deprecated_store_struct_return, deprecated_frame_init_saved_regs, deprecated_frame_chain, frameless_function_invocation, deprecated_frame_saved_pc, deprecated_saved_pc_after_call, frame_num_args, pc_in_sigtramp, dwarf2_build_frame_info, deprecated_init_extra_frame_info, deprecated_init_frame_pc and virtual_frame_pointer. Call frame_unwind_append_predicate to register x86_64_sigtramp_frame_p and x86_64_frame_p. Call frame_base_set_default to register x86_64_frame_base. (I387_FISEG_REGNUM, I387_FOSEG_REGNUM): New defines. (x86_64_supply_fxsave, x86_64_fill_fxsave): New functions. (_initialize_x86_64_tdep): Remove function. * x86-64-linux-tdep.c: Don't include "dwarf2cfi.h". (LINUX_SIGINFO_SIZE, LINUX_UCONTEXT_SIGCONTEXT_OFFSET, LINUX_SIGCONTEXT_PC_OFFSET, LINUX_SIGCONTEXT_FP_OFFSET): Don't define. (X86_64_LINUX_UCONTEXT_SIGCONTEXT_OFFSET): Define. (x86_64_linux_sigcontext_addr): Rewrite. (x86_64_linux_sigtramp_saved_pc, x86_64_linux_saved_pc_after_call, x86_64_linux_frame_saved_pc): Remove functions. (x86_64_linux_pc_in_sigtramp): Renamed from x86_64_linux_in_sigtramp. Try harder to recognize a signal trampoline. (x86_64_linux_frame_chain, x86_64_init_frame_pc): Remove_functions. (x86_64_linux_init_abi): Set pc_in_sigtramp. Initialize TDEP->sigcontext_addr, TDEP->sc_pc_offset and TDEP->sc_sp_offset. * x86-64-linux-nat.c: Sync with i386-linux-tdep.c. (x86_64_regmap): Rename to regmap. (GETREGS_SUPPLIES): Use X86_64_NUM_GREGS instead of x86_64_num_gregs. (supply_gregset, fill_gregset): Likewise. Use regmap instead of x86_64_regmap. (x86_64_fxsave_offset): Remove function. (supply_fpregset): Simply call x86_64_supply_fxsave. (fill_fpregset): Simply call x86_64_fill_fxsave. (fetch_inferior_registers, store_inferior_registers): Avoid asignment in if-statement. (LINUX_SYSCALL_LEN, LINUX_SYSCALL_REGNUM, SYS_Sigreturn, SYS_rt_sigreturn, LINUX_SIGCONTEXT_EFLAGS_OFFSET, LINUX_UCONTEXT_SIGCONTEXT_OFFSET): Remove defines. (fetch_core_registers): Remove function. (linux_elf_core_fns): Remove. (offsetoff): Don't define. (_initialize_x86_64_linux_nat, kernel_u_size): Remove functions. * config/i386/x86-64linux.mt (TDEPFILES): Add i386-linux-tdep.o. * config/i386/x86-64linux.mh (NATDEPFILES): Remove core-aout.o, add core-regset.o. * config/i386/nm-x86-64linux.h: Use NM_X86_64_LINUX_H for protection against multiple includes instead of NM_X86_64_h. Add various comments. Include "config/nm-linux.h". Don't include <signal.h>. (REGISTER_U_ADDR, KERNEL_U_SIZE, U_REGS_OFFSET, KERN_U_ADDR, GET_THREAD_SIGNALS): Remove defines. (x86_64_register_u_addr, kernel_u_size, lin_thread_get_thread_signals): Remove prototypes. (PTRACE_ARG3_TYPE, PTRACE_XFER_TYPE): Define to `long'. [HAVE_LINK_H]: Don't include "solib.h". [HAVE_LINK_H] (SVR4_SHARED_LIBS): Remove define. * config/i386/tm-x86-64linux.h: Fix comments. * Makefile.in (x86-64-linux-nat.o, x86_64-linux-tdep.o, x86-64-tdep.o): Update dependencies.
2003-05-31 10:15:38 +02:00
if (tid == 0)
* aarch64-linux-nat.c: Replace PIDGET with ptid_get_pid. Replace TIDGET with ptid_get_lwp. Replace GET_LWP with ptid_get_lwp. * aix-thread.c (BUILD_THREAD, BUILD_LWP): Remove. Replace BUILD_THREAD with ptid_build. Replace BUILD_LWP with ptid_build. Replace PIDGET with ptid_get_pid. Replace TIDGET with ptid_get_lwp. * alphabsd-nat.c: Replace PIDGET with ptid_get_pid. * amd64-linux-nat.c: Replace PIDGET with ptid_get_pid. Replace TIDGET with ptid_get_lwp. * amd64bsd-nat.c: Replace PIDGET with ptid_get_pid. * arm-linux-nat.c: Replace PIDGET with ptid_get_pid. Replace TIDGET with ptid_get_lwp. Replace GET_LWP with ptid_get_lwp. * armnbsd-nat.c: Replace PIDGET with ptid_get_pid. * auxv.c: Likewise. * breakpoint.c: Likewise. * common/ptid.c (ptid_is_pid): Condense check for null_ptid and minus_one_ptid. (ptid_lwp_p): New function. (ptid_tid_p): New function. * common/ptid.h: Update comments for accessors. (ptid_lwp_p): New prototype. (ptid_tid_p): New prototype. * defs.h (PIDGET, TIDGET, MERGEPID): Do not define. * gcore.c: Replace PIDGET with ptid_get_pid. * gdbthread.h: Likewise. * gnu-nat.c: Likewise. * hppa-linux-nat.c: Replace PIDGET with ptid_get_pid. Replace TIDGET with ptid_get_lwp. * hppabsd-nat.c: Replace PIDGET with ptid_get_pid. * hppanbsd-nat.c: Likewise. * i386-linux-nat.c: Replace PIDGET with ptid_get_pid. Replace TIDGET with ptid_get_lwp. * i386bsd-nat.c: Replace PIDGET with ptid_get_pid. * ia64-linux-nat.c: Replace PIDGET with ptid_get_pid. * infcmd.c: Likewise. * inferior.h: Likewise. * inflow.c: Likewise. * infrun.c: Likewise. * linux-fork.c: Likewise. * linux-nat.c: Replace PIDGET with ptid_get_pid. Replace GET_PID with ptid_get_pid. Replace is_lwp with ptid_lwp_p. Replace GET_LWP with ptid_get_lwp. Replace BUILD_LWP with ptid_build.
2013-09-30 13:50:12 +02:00
tid = ptid_get_pid (inferior_ptid); /* Not a threaded program. */
if (regnum == -1 || amd64_native_gregset_supplies_p (gdbarch, regnum))
{
elf_gregset_t regs;
if (ptrace (PTRACE_GETREGS, tid, 0, (long) &regs) < 0)
perror_with_name (_("Couldn't get registers"));
* target.h (struct regcache): Add forward declaration. (struct target_ops): Add REGCACHE parameter to to_fetch_registers and to_store_registers target operations. (target_fetch_registers, target_store_registers): Update. * regcache.c (regcache_raw_read): Replace register_cached by regcache_valid_p. Pass regcache to target_fetch_registers. (regcache_raw_write): Pass regcache to target_store_registers. * arm-linux-nat.c (store_fpregister, store_fpregs, store_register, store_regs, store_wmmx_regs): Replace register_cached by regcache_valid_p. * bsd-kvm.c (bsd_kvm_open, bsd_kvm_proc_cmd): Pass current_regcache to target_fetch_registers calls. * corelow.c (core_open): Likewise. * linux-nat.c (linux_nat_corefile_thread_callback): Likewise. * proc-service.c (ps_lgetregs, ps_lsetregs, ps_lgetfpregs, ps_lsetfpregs): Likewise. * sol-thread.c (ps_lgetregs, ps_lsetregs, ps_lgetfpregs, ps_lsetfpregs): Likewise. * win32-nat.c (win32_resume): Likewise. * ia64-tdep.c (ia64_store_return_value): Pass current_regcache to target_store_registers call. * rs6000-tdep.c (rs6000_push_dummy_call): Likewise. * inferior.h (store_inferior_registers): Update prototype. (fetch_inferior_registers): Likewise. * gnu-nat.c (gnu_store_registers, gnu_fetch_registers): Likewise. * mips-linux-nat.c (super_fetch_registers, super_store_registers): Update function pointer signatures. * aix-thread.c (aix_thread_fetch_registers): Add REGCACHE parameter, use it instead of current_regcache, update calls. (aix_thread_store_registers): Likewise. * alphabsd-nat.c (alphabsd_fetch_inferior_registers): Likewise. (alphabsd_store_inferior_registers): Likewise. * amd64bsd-nat.c (amd64bsd_fetch_inferior_registers): Likewise. (amd64bsd_store_inferior_registers): Likewise. * amd64-linux-nat.c (amd64_linux_fetch_inferior_registers): Likewise. (amd64_linux_store_inferior_registers): Likewise. * arm-linux-nat.c (fetch_fpregister, fetch_fpregs, store_fpregister, store_fpregs, fetch_register, fetch_regs, store_register, store_regs, fetch_wmmx_regs, store_wmmx_regs): Likewise. (arm_linux_fetch_inferior_registers): Likewise. (arm_linux_store_inferior_registers): Likewise. * armnbsd-nat.c (fetch_register, fetch_regs, fetch_fp_register, fetch_fp_regs, armnbsd_fetch_registers): Likewise. (store_register, store_regs, store_fp_register, store_fp_regs, armnbsd_store_registers): Likewise. * bsd-kvm.c (bsd_kvm_fetch_pcb, bsd_kvm_fetch_registers): Likewise. * bsd-uthread.c (bsd_uthread_fetch_registers): Likewise. (bsd_uthread_store_registers): Likewise. * corelow.c (get_core_registers): Likewise. * go32-nat.c (fetch_register, go32_fetch_registers, store_register, go32_store_registers): Likewise. * hppabsd-nat.c (hppabsd_fetch_registers): Likewise. (hppabsd_store_registers): Likewise. * hppa-hpux-nat.c (hppa_hpux_fetch_register): Likewise. (hppa_hpux_fetch_inferior_registers): Likewise. (hppa_hpux_store_register): Likewise. (hppa_hpux_store_inferior_registers): Likewise. * hppa-linux-nat.c (fetch_register, store_register): Likewise. (hppa_linux_fetch_inferior_registers): Likewise. (hppa_linux_store_inferior_registers): Likewise. * hpux-thread.c (hpux_thread_fetch_registers): Likewise. (hpux_thread_store_registers): Likewise. * i386bsd-nat.c (i386bsd_fetch_inferior_registers): Likewise. (i386bsd_store_inferior_registers): Likewise. * i386gnu-nat.c (fetch_fpregs, gnu_fetch_registers, store_fpregs, gnu_store_registers): Likewise. * i386-linux-nat.c (fetch_register, store_register, fetch_regs, store_regs, fetch_fpregs, store_fpregs, fetch_fpxregs, store_fpxregs): Likewise. (i386_linux_fetch_inferior_registers): Likewise. (i386_linux_store_inferior_registers): Likewise. * ia64-linux-nat.c (ia64_linux_fetch_register): Likewise. (ia64_linux_fetch_registers): Likewise. (ia64_linux_store_register): Likewise. (ia64_linux_store_registers): Likewise. * inf-child.c (inf_child_fetch_inferior_registers): Likewise. (inf_child_store_inferior_registers): Likewise. * inf-ptrace.c (inf_ptrace_fetch_register): Likewise. (inf_ptrace_fetch_registers): Likewise. (inf_ptrace_store_register): Likewise. (inf_ptrace_store_registers): Likewise. * infptrace.c (fetch_register, store_register): Likewise. (fetch_inferior_registers, store_inferior_registers): Likewise. * m32r-linux-nat.c (fetch_regs, store_regs): Likewise. (m32r_linux_fetch_inferior_registers): Likewise. (m32r_linux_store_inferior_registers): Likewise. * m68kbsd-nat.c (m68kbsd_fetch_inferior_registers): Likewise. (m68kbsd_store_inferior_registers): Likewise. * m68klinux-nat.c (fetch_register, old_fetch_inferior_registers, store_register, old_store_inferior_registers, fetch_regs, store_regs, fetch_fpregs, store_fpregs): Likewise. (m68k_linux_fetch_inferior_registers): Likewise. (m68k_linux_store_inferior_registers): Likewise. * m88kbsd-nat.c (m88kbsd_fetch_inferior_registers): Likewise. (m88kbsd_store_inferior_registers): Likewise. * mips64obsd-nat.c (mips64obsd_fetch_inferior_registers): Likewise. (mips64obsd_store_inferior_registers): Likewise. * mips-linux-nat.c (mips64_linux_regsets_fetch_registers): Likewise. (mips64_linux_regsets_store_registers): Likewise. (mips64_linux_fetch_registers): Likewise. (mips64_linux_store_registers): Likewise. * mipsnbsd-nat.c (mipsnbsd_fetch_inferior_registers): Likewise. (mipsnbsd_store_inferior_registers): Likewise. * monitor.c (monitor_fetch_register, monitor_store_register): Likewise. (monitor_fetch_registers, monitor_store_registers): Likewise. * nto-procfs.c (procfs_fetch_registers): Likewise. (procfs_store_registers): Likewise. * ppc-linux-nat.c (fetch_altivec_register, fetch_spe_register, fetch_register, supply_vrregset, fetch_altivec_registers, fetch_ppc_registers, ppc_linux_fetch_inferior_registers): Likewise. (store_altivec_register, store_spe_register, store_register, fill_vrregset, store_altivec_registers, store_ppc_registers, ppc_linux_store_inferior_registers): Likewise. * ppcnbsd-nat.c (ppcnbsd_fetch_inferior_registers): Likewise. (ppcnbsd_store_inferior_registers): Likewise. * ppcobsd-nat.c (ppcobsd_fetch_registers): Likewise. (ppcobsd_store_registers): Likewise. * procfs.c (procfs_fetch_registers, procfs_store_registers): Likewise. * remote.c (fetch_register_using_p, process_g_packet, fetch_registers_using_g, remote_fetch_registers): Likewise. (store_register_using_P, store_registers_using_G, remote_store_registers): Likewise. * remote-m32r-sdi.c (m32r_fetch_registers, m32r_fetch_register, m32r_store_register, m32r_store_register): Likewise. * remote-mips.c (mips_fetch_registers, mips_store_registers): Likewise. * remote-sim.c (gdbsim_fetch_register): Likewise. (gdbsim_store_register): Likewise. * rs6000-nat.c (fetch_register, store_register): Likewise. (rs6000_fetch_inferior_registers): Likewise. (rs6000_store_inferior_registers): Likewise. * s390-nat.c (fetch_regs, store_regs): Likewise. (fetch_fpregs, store_fpregs): Likewise. (s390_linux_fetch_inferior_registers): Likewise. (s390_linux_store_inferior_registers): Likewise. * shnbsd-nat.c (shnbsd_fetch_inferior_registers): Likewise. (shnbsd_store_inferior_registers): Likewise. * sol-thread.c (sol_thread_fetch_registers): Likewise. (sol_thread_store_registers): Likewise. * sparc-nat.c (fetch_inferior_registers): Likewise. (store_inferior_registers): Likewise. * spu-linux-nat.c (spu_fetch_inferior_registers): Likewise. (spu_store_inferior_registers): Likewise. * target.c (debug_print_register): Likewise. (debug_to_fetch_registers, debug_to_store_registers): Likewise. * vaxbsd-nat.c (vaxbsd_fetch_inferior_registers): Likewise. (vaxbsd_store_inferior_registers): Likewise. * win32-nat.c (do_win32_fetch_inferior_registers): Likewise. (win32_fetch_inferior_registers): Likewise. (win32_store_inferior_registers): Likewise.
2007-05-06 16:34:38 +02:00
amd64_collect_native_gregset (regcache, &regs, regnum);
if (ptrace (PTRACE_SETREGS, tid, 0, (long) &regs) < 0)
perror_with_name (_("Couldn't write registers"));
if (regnum != -1)
return;
}
if (regnum == -1 || !amd64_native_gregset_supplies_p (gdbarch, regnum))
{
elf_fpregset_t fpregs;
Support amd64 AVX. gdb/ 2010-04-07 H.J. Lu <hongjiu.lu@intel.com> * amd64-linux-nat.c: Include "regset.h", "elf/common.h", <sys/uio.h> and "i386-xstate.h". (PTRACE_GETREGSET): New. (PTRACE_SETREGSET): Likewise. (have_ptrace_getregset): Likewise. (amd64_linux_gregset64_reg_offset): Include 16 upper YMM registers. (amd64_linux_gregset32_reg_offset): Include 8 upper YMM registers. (amd64_linux_fetch_inferior_registers): Support PTRACE_GETFPREGS. (amd64_linux_store_inferior_registers): Likewise. (amd64_linux_read_description): Check and enable AVX target descriptions. * amd64-linux-tdep.c: Include "regset.h", "i386-linux-tdep.h" and "features/i386/amd64-avx-linux.c". (amd64_linux_regset_sections): New. (amd64_linux_core_read_description): Check and enable AVX target description. (amd64_linux_init_abi): Set xsave_xcr0_offset. Call set_gdbarch_core_regset_sections. (_initialize_amd64_linux_tdep): Call initialize_tdesc_amd64_avx_linux. * amd64-linux-tdep.h (AMD64_LINUX_ORIG_RAX_REGNUM): Replace AMD64_MXCSR_REGNUM with AMD64_YMM15H_REGNUM. (tdesc_amd64_avx_linux): New. (amd64_linux_update_xstateregset): Likewise. * amd64-tdep.c: Include "features/i386/amd64-avx.c". (amd64_ymm_names): New. (amd64_ymmh_names): Likewise. (amd64_register_name): Likewise. (amd64_supply_xstateregset): Likewise. (amd64_collect_xstateregset): Likewise. (amd64_supply_xsave): Likewise. (amd64_collect_xsave): Likewise. (AMD64_NUM_REGS): Removed. (amd64_dwarf_reg_to_regnum): Return %ymmN register number for %xmmN if AVX is available. (amd64_pseudo_register_name): Support pseudo YMM registers. (amd64_regset_from_core_section): Support .reg-xstate section. (amd64_init_abi): Set ymmh_register_names, num_ymm_regs and ymm0h_regnum. Call set_gdbarch_register_name. (amd64_init_abi): Call initialize_tdesc_amd64_avx. * amd64-tdep.h (amd64_regnum): Add AMD64_YMM0H_REGNUM and AMD64_YMM15H_REGNUM. (AMD64_NUM_REGS): New. (amd64_supply_xsave): Likewise. (amd64_collect_xsave): Likewise. (amd64_register_name): Removed. (amd64_register_type): Likewise. gdb/testsuite/ 2010-04-07 H.J. Lu <hongjiu.lu@intel.com> * gdb.arch/i386-avx.c: New. * gdb.arch/i386-avx.exp: Likewise. * gdb.arch/i386-cpuid.h: Updated from gcc 4.4.
2010-04-07 20:46:50 +02:00
if (have_ptrace_getregset)
{
char xstateregs[I386_XSTATE_MAX_SIZE];
struct iovec iov;
iov.iov_base = xstateregs;
iov.iov_len = sizeof (xstateregs);
if (ptrace (PTRACE_GETREGSET, tid,
(unsigned int) NT_X86_XSTATE, (long) &iov) < 0)
perror_with_name (_("Couldn't get extended state status"));
Support amd64 AVX. gdb/ 2010-04-07 H.J. Lu <hongjiu.lu@intel.com> * amd64-linux-nat.c: Include "regset.h", "elf/common.h", <sys/uio.h> and "i386-xstate.h". (PTRACE_GETREGSET): New. (PTRACE_SETREGSET): Likewise. (have_ptrace_getregset): Likewise. (amd64_linux_gregset64_reg_offset): Include 16 upper YMM registers. (amd64_linux_gregset32_reg_offset): Include 8 upper YMM registers. (amd64_linux_fetch_inferior_registers): Support PTRACE_GETFPREGS. (amd64_linux_store_inferior_registers): Likewise. (amd64_linux_read_description): Check and enable AVX target descriptions. * amd64-linux-tdep.c: Include "regset.h", "i386-linux-tdep.h" and "features/i386/amd64-avx-linux.c". (amd64_linux_regset_sections): New. (amd64_linux_core_read_description): Check and enable AVX target description. (amd64_linux_init_abi): Set xsave_xcr0_offset. Call set_gdbarch_core_regset_sections. (_initialize_amd64_linux_tdep): Call initialize_tdesc_amd64_avx_linux. * amd64-linux-tdep.h (AMD64_LINUX_ORIG_RAX_REGNUM): Replace AMD64_MXCSR_REGNUM with AMD64_YMM15H_REGNUM. (tdesc_amd64_avx_linux): New. (amd64_linux_update_xstateregset): Likewise. * amd64-tdep.c: Include "features/i386/amd64-avx.c". (amd64_ymm_names): New. (amd64_ymmh_names): Likewise. (amd64_register_name): Likewise. (amd64_supply_xstateregset): Likewise. (amd64_collect_xstateregset): Likewise. (amd64_supply_xsave): Likewise. (amd64_collect_xsave): Likewise. (AMD64_NUM_REGS): Removed. (amd64_dwarf_reg_to_regnum): Return %ymmN register number for %xmmN if AVX is available. (amd64_pseudo_register_name): Support pseudo YMM registers. (amd64_regset_from_core_section): Support .reg-xstate section. (amd64_init_abi): Set ymmh_register_names, num_ymm_regs and ymm0h_regnum. Call set_gdbarch_register_name. (amd64_init_abi): Call initialize_tdesc_amd64_avx. * amd64-tdep.h (amd64_regnum): Add AMD64_YMM0H_REGNUM and AMD64_YMM15H_REGNUM. (AMD64_NUM_REGS): New. (amd64_supply_xsave): Likewise. (amd64_collect_xsave): Likewise. (amd64_register_name): Removed. (amd64_register_type): Likewise. gdb/testsuite/ 2010-04-07 H.J. Lu <hongjiu.lu@intel.com> * gdb.arch/i386-avx.c: New. * gdb.arch/i386-avx.exp: Likewise. * gdb.arch/i386-cpuid.h: Updated from gcc 4.4.
2010-04-07 20:46:50 +02:00
amd64_collect_xsave (regcache, regnum, xstateregs, 0);
if (ptrace (PTRACE_SETREGSET, tid,
(unsigned int) NT_X86_XSTATE, (long) &iov) < 0)
perror_with_name (_("Couldn't write extended state status"));
}
else
{
if (ptrace (PTRACE_GETFPREGS, tid, 0, (long) &fpregs) < 0)
perror_with_name (_("Couldn't get floating point status"));
Support amd64 AVX. gdb/ 2010-04-07 H.J. Lu <hongjiu.lu@intel.com> * amd64-linux-nat.c: Include "regset.h", "elf/common.h", <sys/uio.h> and "i386-xstate.h". (PTRACE_GETREGSET): New. (PTRACE_SETREGSET): Likewise. (have_ptrace_getregset): Likewise. (amd64_linux_gregset64_reg_offset): Include 16 upper YMM registers. (amd64_linux_gregset32_reg_offset): Include 8 upper YMM registers. (amd64_linux_fetch_inferior_registers): Support PTRACE_GETFPREGS. (amd64_linux_store_inferior_registers): Likewise. (amd64_linux_read_description): Check and enable AVX target descriptions. * amd64-linux-tdep.c: Include "regset.h", "i386-linux-tdep.h" and "features/i386/amd64-avx-linux.c". (amd64_linux_regset_sections): New. (amd64_linux_core_read_description): Check and enable AVX target description. (amd64_linux_init_abi): Set xsave_xcr0_offset. Call set_gdbarch_core_regset_sections. (_initialize_amd64_linux_tdep): Call initialize_tdesc_amd64_avx_linux. * amd64-linux-tdep.h (AMD64_LINUX_ORIG_RAX_REGNUM): Replace AMD64_MXCSR_REGNUM with AMD64_YMM15H_REGNUM. (tdesc_amd64_avx_linux): New. (amd64_linux_update_xstateregset): Likewise. * amd64-tdep.c: Include "features/i386/amd64-avx.c". (amd64_ymm_names): New. (amd64_ymmh_names): Likewise. (amd64_register_name): Likewise. (amd64_supply_xstateregset): Likewise. (amd64_collect_xstateregset): Likewise. (amd64_supply_xsave): Likewise. (amd64_collect_xsave): Likewise. (AMD64_NUM_REGS): Removed. (amd64_dwarf_reg_to_regnum): Return %ymmN register number for %xmmN if AVX is available. (amd64_pseudo_register_name): Support pseudo YMM registers. (amd64_regset_from_core_section): Support .reg-xstate section. (amd64_init_abi): Set ymmh_register_names, num_ymm_regs and ymm0h_regnum. Call set_gdbarch_register_name. (amd64_init_abi): Call initialize_tdesc_amd64_avx. * amd64-tdep.h (amd64_regnum): Add AMD64_YMM0H_REGNUM and AMD64_YMM15H_REGNUM. (AMD64_NUM_REGS): New. (amd64_supply_xsave): Likewise. (amd64_collect_xsave): Likewise. (amd64_register_name): Removed. (amd64_register_type): Likewise. gdb/testsuite/ 2010-04-07 H.J. Lu <hongjiu.lu@intel.com> * gdb.arch/i386-avx.c: New. * gdb.arch/i386-avx.exp: Likewise. * gdb.arch/i386-cpuid.h: Updated from gcc 4.4.
2010-04-07 20:46:50 +02:00
amd64_collect_fxsave (regcache, regnum, &fpregs);
Support amd64 AVX. gdb/ 2010-04-07 H.J. Lu <hongjiu.lu@intel.com> * amd64-linux-nat.c: Include "regset.h", "elf/common.h", <sys/uio.h> and "i386-xstate.h". (PTRACE_GETREGSET): New. (PTRACE_SETREGSET): Likewise. (have_ptrace_getregset): Likewise. (amd64_linux_gregset64_reg_offset): Include 16 upper YMM registers. (amd64_linux_gregset32_reg_offset): Include 8 upper YMM registers. (amd64_linux_fetch_inferior_registers): Support PTRACE_GETFPREGS. (amd64_linux_store_inferior_registers): Likewise. (amd64_linux_read_description): Check and enable AVX target descriptions. * amd64-linux-tdep.c: Include "regset.h", "i386-linux-tdep.h" and "features/i386/amd64-avx-linux.c". (amd64_linux_regset_sections): New. (amd64_linux_core_read_description): Check and enable AVX target description. (amd64_linux_init_abi): Set xsave_xcr0_offset. Call set_gdbarch_core_regset_sections. (_initialize_amd64_linux_tdep): Call initialize_tdesc_amd64_avx_linux. * amd64-linux-tdep.h (AMD64_LINUX_ORIG_RAX_REGNUM): Replace AMD64_MXCSR_REGNUM with AMD64_YMM15H_REGNUM. (tdesc_amd64_avx_linux): New. (amd64_linux_update_xstateregset): Likewise. * amd64-tdep.c: Include "features/i386/amd64-avx.c". (amd64_ymm_names): New. (amd64_ymmh_names): Likewise. (amd64_register_name): Likewise. (amd64_supply_xstateregset): Likewise. (amd64_collect_xstateregset): Likewise. (amd64_supply_xsave): Likewise. (amd64_collect_xsave): Likewise. (AMD64_NUM_REGS): Removed. (amd64_dwarf_reg_to_regnum): Return %ymmN register number for %xmmN if AVX is available. (amd64_pseudo_register_name): Support pseudo YMM registers. (amd64_regset_from_core_section): Support .reg-xstate section. (amd64_init_abi): Set ymmh_register_names, num_ymm_regs and ymm0h_regnum. Call set_gdbarch_register_name. (amd64_init_abi): Call initialize_tdesc_amd64_avx. * amd64-tdep.h (amd64_regnum): Add AMD64_YMM0H_REGNUM and AMD64_YMM15H_REGNUM. (AMD64_NUM_REGS): New. (amd64_supply_xsave): Likewise. (amd64_collect_xsave): Likewise. (amd64_register_name): Removed. (amd64_register_type): Likewise. gdb/testsuite/ 2010-04-07 H.J. Lu <hongjiu.lu@intel.com> * gdb.arch/i386-avx.c: New. * gdb.arch/i386-avx.exp: Likewise. * gdb.arch/i386-cpuid.h: Updated from gcc 4.4.
2010-04-07 20:46:50 +02:00
if (ptrace (PTRACE_SETFPREGS, tid, 0, (long) &fpregs) < 0)
perror_with_name (_("Couldn't write floating point status"));
}
}
}
* linux-nat.c (linux_nat_new_thread): New variable. (linux_child_follow_fork): Set inferior_ptid to include LWP ID. Use linux_nat_switch_fork. (lwp_list): Make public. (add_lwp): Call linux_nat_new_thread. (lin_lwp_attach_lwp, linux_nat_attach): Call add_lwp after stopping the new thread. (resume_callback): Clear lp->siginfo. Remove unused variable. (linux_nat_resume): Assert that the LWP list is already initialized. Clear lp->siginfo. (save_siginfo): New. (stop_wait_callback, linux_nat_wait): Call it. (linux_nat_set_new_thread, linux_nat_get_siginfo): New. * linux-nat.h (struct lwp_info): Add siginfo. (lwp_list, linux_nat_set_new_thread, linux_nat_get_siginfo): Declare. (ALL_LWPS): Define. * amd64-linux-nat.c (amd64_linux_dr): New. (amd64_linux_dr_get): Take a PTID argument. Correct typo. (amd64_linux_dr_set): Take a PTID argument. (amd64_linux_dr_set_control, amd64_linux_dr_set_addr): Use ALL_LWPS. (amd64_linux_dr_reset_addr): Use amd64_linux_dr_set_addr. (amd64_linux_dr_get_status): Pass inferior_ptid to amd64_linux_dr_get. (amd64_linux_new_thread): New. (_initialize_amd64_linux_nat): Call linux_nat_set_new_thread. * i386-linux-nat.c (i386_linux_dr): New. (i386_linux_dr_get, i386_linux_dr_set): Take a PTID argument. (i386_linux_dr_set_control, i386_linux_dr_set_addr): Use ALL_LWPS. (i386_linux_dr_reset_addr): Use i386_linux_dr_set_addr. (i386_linux_dr_get_status): Pass inferior_ptid to i386_linux_dr_get. (i386_linux_new_thread): New. (i386_linux_resume): Remove unnecessary PID check. (_initialize_i386_linux_nat): Call linux_nat_set_new_thread. * ia64-linux-nat.c (enable_watchpoints_in_psr): Take PTID argument. (fetch_debug_register, fetch_debug_register_pair): Delete. (debug_registers): New. (ia64_linux_insert_watchpoint, ia64_linux_remove_watchpoint): Use ALL_LWPS and debug_registers. (ia64_linux_new_thread): New. (ia64_linux_stopped_data_address): Use linux_nat_get_siginfo. (_initialize_ia64_linux_nat): Call linux_nat_set_new_thread. * ppc-linux-nat.c (last_stopped_data_address): Delete. (saved_dabr_value): New. (ppc_linux_insert_watchpoint, ppc_linux_remove_watchpoint): Use ALL_LWPS. (ppc_linux_new_thread): New. (ppc_linux_stopped_data_address): Use linux_nat_get_siginfo. (ppc_linux_stopped_by_watchpoint): Call ppc_linux_stopped_data_address. (_initialize_ppc_linux_nat): Call linux_nat_set_new_thread. * s390-nat.c (s390_stopped_by_watchpoint): Clear the watchpoint status after reading it. (s390_fix_watch_points): Take a PTID argument. (s390_insert_watchpoint, s390_remove_watchpoint): Use ALL_LWPS. (_initialize_s390_nat): Call linux_nat_set_new_thread.
2007-10-01 02:22:50 +02:00
/* Support for debug registers. */
* x86-64-tdep.h (x86_64_num_regs, x86_64_num_gregs): Remove variable declarations. (x86_64_register_number, x86_64_register_name): Remove prototypes. (x86_64_linux_frame_saved_pc, x86_64_linux+saved_pc_after_call, x86_64_linux_in_sigtramp, x86_64_linux_frame_chain, x86_64_init_frame_pc, x86_64_init_frame_pc, x86_64_function_has_prologue): Remove prototypes. (X86_64_NUM_GREGS): New define. (x86_64_supply_fxsave, x86_64_fill_fxsave): New prototypes. * x86-64-tdep.c: Don't include "dwarf2cfi.h". Include "dummy_frame.h", "frame.h", "frame-base.h", "frame-unwind.h". (RAX_REGNUM, RDX_REGNUM, RDI_REGNUM, EFLAGS_REGNUM, ST0_REGNUM, XMM1_REGNUM): Remove defines. (X86_64_RAX_REGNUM, X86_64_RDX_REGNUM, X86_64_RDI_REGNUM, X86_64_RBP_REGNUM, X86_64_RSP_REGNUM, X86_64_RIP_REGNUM, X86_64_EFLAGS_REGNUM, X86_64_ST0_REGNUM, X86_64_XMM0_REGNUM, X86_64_XMM1_REGNUM): New defines. (struct x86_64_register_info): Renamed from `struct register_info'. Remove `size' member. (x86_64_register_info_table): Remove variable. (x86_64_register_info): New variable. (X86_64_NUM_REGS): New define. (X86_64_NUM_GREGS): Remove define. (x86_64_num_regs, x86_64_num_gregs): Remove variables. (x86_64_dwarf2gdb_regno_map, x86_64_dwarf2gdb_regno_map_length): Remove variables. (x86_54_dwarf2_reg_to_regnum): Remove function. (x86_64_dwarf_regmap, x86_64_dwarf_regmap_len): New variables. (x86_64_dwarf_reg_to_regnum): New function. (x86_64_register_name): Rewrite. (x86_64_register_raw_size): Remove function. (x86_64_register_byte_table): Remove variable. (x86_64_register_byte): Remove function. (x86_64_register_virtual_type): Remove function. (x86_64_register_type): New function. (x86_64_register_convertible, x86_64_register_convert_to_virtual, x86_64_register_convert_to_raw): Remove functions. (x86_64_push_return_address, x86_64_pop_frame): Remove functon. (x86_64_use_struct_convention): Make static. Adjust for renamed defines. (x86_64_frame_init_saved_regs): Remove function. (x86_64_push_arguments): Make static. Change to accept a regcache as argument. (x86_64_store_return_value, x86_64_extract_return_value): Make static. Rewrite based on i386 counterparts. (x86_64_push_dummy_call): New function. (X86_64_NUM_SAVED_REGS): New define. (x86_64_register_number): Remove function. (x86_64_store_struct_return): Remove function. (x86_64_frameless_function_invocation, x86_64_function_has_prologue): Remove functions. (PROLOG_BUFSIZE): Remove define. (struct x86_64_frame_cache): New structure. (x86_64_alloc_frame_cache, x86_64_analyze_prologue, x86_64_frame_cache, x86_64_frame_this_id, x86_64_frame_prev_register, x86_64_frame_p, x86_64_sigtramp_frame_cache, x86_64_sigtramp_frame_this_id, x86_64_sigtramp_frame_prev_register, x86_sigtramp_frame_p): New functions. (x86_64_frame_unwind, x86_64_sigtramp_frame_unwind): New variables. (x86_64_skip_prologue): Rewrite in terms of x86_64_analyze_prologue. (x86_64_frame_base_address): New function. (x86_64_frame_base): New variable. (x86_64_save_dummy_frame_tos, x86_64_unwind_dummy_id): Rewrite. (x86_64_init_abi): Set register_type and push_dummy_call. Don't set deprecated_fp_regnum, deprecated_register_size, deprecated_register_bytes, register_raw_size, register_byte, register_virtual_type, register_convertiable, register_convert_to_virtual, convert_to_raw, deprecated_get_saved_register, deprecated_target_read_fp, deprecated_push_arguments, deprecated_push_return_address, deprecated_pop_frame, deprecated_store_struct_return, deprecated_frame_init_saved_regs, deprecated_frame_chain, frameless_function_invocation, deprecated_frame_saved_pc, deprecated_saved_pc_after_call, frame_num_args, pc_in_sigtramp, dwarf2_build_frame_info, deprecated_init_extra_frame_info, deprecated_init_frame_pc and virtual_frame_pointer. Call frame_unwind_append_predicate to register x86_64_sigtramp_frame_p and x86_64_frame_p. Call frame_base_set_default to register x86_64_frame_base. (I387_FISEG_REGNUM, I387_FOSEG_REGNUM): New defines. (x86_64_supply_fxsave, x86_64_fill_fxsave): New functions. (_initialize_x86_64_tdep): Remove function. * x86-64-linux-tdep.c: Don't include "dwarf2cfi.h". (LINUX_SIGINFO_SIZE, LINUX_UCONTEXT_SIGCONTEXT_OFFSET, LINUX_SIGCONTEXT_PC_OFFSET, LINUX_SIGCONTEXT_FP_OFFSET): Don't define. (X86_64_LINUX_UCONTEXT_SIGCONTEXT_OFFSET): Define. (x86_64_linux_sigcontext_addr): Rewrite. (x86_64_linux_sigtramp_saved_pc, x86_64_linux_saved_pc_after_call, x86_64_linux_frame_saved_pc): Remove functions. (x86_64_linux_pc_in_sigtramp): Renamed from x86_64_linux_in_sigtramp. Try harder to recognize a signal trampoline. (x86_64_linux_frame_chain, x86_64_init_frame_pc): Remove_functions. (x86_64_linux_init_abi): Set pc_in_sigtramp. Initialize TDEP->sigcontext_addr, TDEP->sc_pc_offset and TDEP->sc_sp_offset. * x86-64-linux-nat.c: Sync with i386-linux-tdep.c. (x86_64_regmap): Rename to regmap. (GETREGS_SUPPLIES): Use X86_64_NUM_GREGS instead of x86_64_num_gregs. (supply_gregset, fill_gregset): Likewise. Use regmap instead of x86_64_regmap. (x86_64_fxsave_offset): Remove function. (supply_fpregset): Simply call x86_64_supply_fxsave. (fill_fpregset): Simply call x86_64_fill_fxsave. (fetch_inferior_registers, store_inferior_registers): Avoid asignment in if-statement. (LINUX_SYSCALL_LEN, LINUX_SYSCALL_REGNUM, SYS_Sigreturn, SYS_rt_sigreturn, LINUX_SIGCONTEXT_EFLAGS_OFFSET, LINUX_UCONTEXT_SIGCONTEXT_OFFSET): Remove defines. (fetch_core_registers): Remove function. (linux_elf_core_fns): Remove. (offsetoff): Don't define. (_initialize_x86_64_linux_nat, kernel_u_size): Remove functions. * config/i386/x86-64linux.mt (TDEPFILES): Add i386-linux-tdep.o. * config/i386/x86-64linux.mh (NATDEPFILES): Remove core-aout.o, add core-regset.o. * config/i386/nm-x86-64linux.h: Use NM_X86_64_LINUX_H for protection against multiple includes instead of NM_X86_64_h. Add various comments. Include "config/nm-linux.h". Don't include <signal.h>. (REGISTER_U_ADDR, KERNEL_U_SIZE, U_REGS_OFFSET, KERN_U_ADDR, GET_THREAD_SIGNALS): Remove defines. (x86_64_register_u_addr, kernel_u_size, lin_thread_get_thread_signals): Remove prototypes. (PTRACE_ARG3_TYPE, PTRACE_XFER_TYPE): Define to `long'. [HAVE_LINK_H]: Don't include "solib.h". [HAVE_LINK_H] (SVR4_SHARED_LIBS): Remove define. * config/i386/tm-x86-64linux.h: Fix comments. * Makefile.in (x86-64-linux-nat.o, x86_64-linux-tdep.o, x86-64-tdep.o): Update dependencies.
2003-05-31 10:15:38 +02:00
static unsigned long
* linux-nat.c (linux_nat_new_thread): New variable. (linux_child_follow_fork): Set inferior_ptid to include LWP ID. Use linux_nat_switch_fork. (lwp_list): Make public. (add_lwp): Call linux_nat_new_thread. (lin_lwp_attach_lwp, linux_nat_attach): Call add_lwp after stopping the new thread. (resume_callback): Clear lp->siginfo. Remove unused variable. (linux_nat_resume): Assert that the LWP list is already initialized. Clear lp->siginfo. (save_siginfo): New. (stop_wait_callback, linux_nat_wait): Call it. (linux_nat_set_new_thread, linux_nat_get_siginfo): New. * linux-nat.h (struct lwp_info): Add siginfo. (lwp_list, linux_nat_set_new_thread, linux_nat_get_siginfo): Declare. (ALL_LWPS): Define. * amd64-linux-nat.c (amd64_linux_dr): New. (amd64_linux_dr_get): Take a PTID argument. Correct typo. (amd64_linux_dr_set): Take a PTID argument. (amd64_linux_dr_set_control, amd64_linux_dr_set_addr): Use ALL_LWPS. (amd64_linux_dr_reset_addr): Use amd64_linux_dr_set_addr. (amd64_linux_dr_get_status): Pass inferior_ptid to amd64_linux_dr_get. (amd64_linux_new_thread): New. (_initialize_amd64_linux_nat): Call linux_nat_set_new_thread. * i386-linux-nat.c (i386_linux_dr): New. (i386_linux_dr_get, i386_linux_dr_set): Take a PTID argument. (i386_linux_dr_set_control, i386_linux_dr_set_addr): Use ALL_LWPS. (i386_linux_dr_reset_addr): Use i386_linux_dr_set_addr. (i386_linux_dr_get_status): Pass inferior_ptid to i386_linux_dr_get. (i386_linux_new_thread): New. (i386_linux_resume): Remove unnecessary PID check. (_initialize_i386_linux_nat): Call linux_nat_set_new_thread. * ia64-linux-nat.c (enable_watchpoints_in_psr): Take PTID argument. (fetch_debug_register, fetch_debug_register_pair): Delete. (debug_registers): New. (ia64_linux_insert_watchpoint, ia64_linux_remove_watchpoint): Use ALL_LWPS and debug_registers. (ia64_linux_new_thread): New. (ia64_linux_stopped_data_address): Use linux_nat_get_siginfo. (_initialize_ia64_linux_nat): Call linux_nat_set_new_thread. * ppc-linux-nat.c (last_stopped_data_address): Delete. (saved_dabr_value): New. (ppc_linux_insert_watchpoint, ppc_linux_remove_watchpoint): Use ALL_LWPS. (ppc_linux_new_thread): New. (ppc_linux_stopped_data_address): Use linux_nat_get_siginfo. (ppc_linux_stopped_by_watchpoint): Call ppc_linux_stopped_data_address. (_initialize_ppc_linux_nat): Call linux_nat_set_new_thread. * s390-nat.c (s390_stopped_by_watchpoint): Clear the watchpoint status after reading it. (s390_fix_watch_points): Take a PTID argument. (s390_insert_watchpoint, s390_remove_watchpoint): Use ALL_LWPS. (_initialize_s390_nat): Call linux_nat_set_new_thread.
2007-10-01 02:22:50 +02:00
amd64_linux_dr_get (ptid_t ptid, int regnum)
* x86-64-tdep.h (x86_64_num_regs, x86_64_num_gregs): Remove variable declarations. (x86_64_register_number, x86_64_register_name): Remove prototypes. (x86_64_linux_frame_saved_pc, x86_64_linux+saved_pc_after_call, x86_64_linux_in_sigtramp, x86_64_linux_frame_chain, x86_64_init_frame_pc, x86_64_init_frame_pc, x86_64_function_has_prologue): Remove prototypes. (X86_64_NUM_GREGS): New define. (x86_64_supply_fxsave, x86_64_fill_fxsave): New prototypes. * x86-64-tdep.c: Don't include "dwarf2cfi.h". Include "dummy_frame.h", "frame.h", "frame-base.h", "frame-unwind.h". (RAX_REGNUM, RDX_REGNUM, RDI_REGNUM, EFLAGS_REGNUM, ST0_REGNUM, XMM1_REGNUM): Remove defines. (X86_64_RAX_REGNUM, X86_64_RDX_REGNUM, X86_64_RDI_REGNUM, X86_64_RBP_REGNUM, X86_64_RSP_REGNUM, X86_64_RIP_REGNUM, X86_64_EFLAGS_REGNUM, X86_64_ST0_REGNUM, X86_64_XMM0_REGNUM, X86_64_XMM1_REGNUM): New defines. (struct x86_64_register_info): Renamed from `struct register_info'. Remove `size' member. (x86_64_register_info_table): Remove variable. (x86_64_register_info): New variable. (X86_64_NUM_REGS): New define. (X86_64_NUM_GREGS): Remove define. (x86_64_num_regs, x86_64_num_gregs): Remove variables. (x86_64_dwarf2gdb_regno_map, x86_64_dwarf2gdb_regno_map_length): Remove variables. (x86_54_dwarf2_reg_to_regnum): Remove function. (x86_64_dwarf_regmap, x86_64_dwarf_regmap_len): New variables. (x86_64_dwarf_reg_to_regnum): New function. (x86_64_register_name): Rewrite. (x86_64_register_raw_size): Remove function. (x86_64_register_byte_table): Remove variable. (x86_64_register_byte): Remove function. (x86_64_register_virtual_type): Remove function. (x86_64_register_type): New function. (x86_64_register_convertible, x86_64_register_convert_to_virtual, x86_64_register_convert_to_raw): Remove functions. (x86_64_push_return_address, x86_64_pop_frame): Remove functon. (x86_64_use_struct_convention): Make static. Adjust for renamed defines. (x86_64_frame_init_saved_regs): Remove function. (x86_64_push_arguments): Make static. Change to accept a regcache as argument. (x86_64_store_return_value, x86_64_extract_return_value): Make static. Rewrite based on i386 counterparts. (x86_64_push_dummy_call): New function. (X86_64_NUM_SAVED_REGS): New define. (x86_64_register_number): Remove function. (x86_64_store_struct_return): Remove function. (x86_64_frameless_function_invocation, x86_64_function_has_prologue): Remove functions. (PROLOG_BUFSIZE): Remove define. (struct x86_64_frame_cache): New structure. (x86_64_alloc_frame_cache, x86_64_analyze_prologue, x86_64_frame_cache, x86_64_frame_this_id, x86_64_frame_prev_register, x86_64_frame_p, x86_64_sigtramp_frame_cache, x86_64_sigtramp_frame_this_id, x86_64_sigtramp_frame_prev_register, x86_sigtramp_frame_p): New functions. (x86_64_frame_unwind, x86_64_sigtramp_frame_unwind): New variables. (x86_64_skip_prologue): Rewrite in terms of x86_64_analyze_prologue. (x86_64_frame_base_address): New function. (x86_64_frame_base): New variable. (x86_64_save_dummy_frame_tos, x86_64_unwind_dummy_id): Rewrite. (x86_64_init_abi): Set register_type and push_dummy_call. Don't set deprecated_fp_regnum, deprecated_register_size, deprecated_register_bytes, register_raw_size, register_byte, register_virtual_type, register_convertiable, register_convert_to_virtual, convert_to_raw, deprecated_get_saved_register, deprecated_target_read_fp, deprecated_push_arguments, deprecated_push_return_address, deprecated_pop_frame, deprecated_store_struct_return, deprecated_frame_init_saved_regs, deprecated_frame_chain, frameless_function_invocation, deprecated_frame_saved_pc, deprecated_saved_pc_after_call, frame_num_args, pc_in_sigtramp, dwarf2_build_frame_info, deprecated_init_extra_frame_info, deprecated_init_frame_pc and virtual_frame_pointer. Call frame_unwind_append_predicate to register x86_64_sigtramp_frame_p and x86_64_frame_p. Call frame_base_set_default to register x86_64_frame_base. (I387_FISEG_REGNUM, I387_FOSEG_REGNUM): New defines. (x86_64_supply_fxsave, x86_64_fill_fxsave): New functions. (_initialize_x86_64_tdep): Remove function. * x86-64-linux-tdep.c: Don't include "dwarf2cfi.h". (LINUX_SIGINFO_SIZE, LINUX_UCONTEXT_SIGCONTEXT_OFFSET, LINUX_SIGCONTEXT_PC_OFFSET, LINUX_SIGCONTEXT_FP_OFFSET): Don't define. (X86_64_LINUX_UCONTEXT_SIGCONTEXT_OFFSET): Define. (x86_64_linux_sigcontext_addr): Rewrite. (x86_64_linux_sigtramp_saved_pc, x86_64_linux_saved_pc_after_call, x86_64_linux_frame_saved_pc): Remove functions. (x86_64_linux_pc_in_sigtramp): Renamed from x86_64_linux_in_sigtramp. Try harder to recognize a signal trampoline. (x86_64_linux_frame_chain, x86_64_init_frame_pc): Remove_functions. (x86_64_linux_init_abi): Set pc_in_sigtramp. Initialize TDEP->sigcontext_addr, TDEP->sc_pc_offset and TDEP->sc_sp_offset. * x86-64-linux-nat.c: Sync with i386-linux-tdep.c. (x86_64_regmap): Rename to regmap. (GETREGS_SUPPLIES): Use X86_64_NUM_GREGS instead of x86_64_num_gregs. (supply_gregset, fill_gregset): Likewise. Use regmap instead of x86_64_regmap. (x86_64_fxsave_offset): Remove function. (supply_fpregset): Simply call x86_64_supply_fxsave. (fill_fpregset): Simply call x86_64_fill_fxsave. (fetch_inferior_registers, store_inferior_registers): Avoid asignment in if-statement. (LINUX_SYSCALL_LEN, LINUX_SYSCALL_REGNUM, SYS_Sigreturn, SYS_rt_sigreturn, LINUX_SIGCONTEXT_EFLAGS_OFFSET, LINUX_UCONTEXT_SIGCONTEXT_OFFSET): Remove defines. (fetch_core_registers): Remove function. (linux_elf_core_fns): Remove. (offsetoff): Don't define. (_initialize_x86_64_linux_nat, kernel_u_size): Remove functions. * config/i386/x86-64linux.mt (TDEPFILES): Add i386-linux-tdep.o. * config/i386/x86-64linux.mh (NATDEPFILES): Remove core-aout.o, add core-regset.o. * config/i386/nm-x86-64linux.h: Use NM_X86_64_LINUX_H for protection against multiple includes instead of NM_X86_64_h. Add various comments. Include "config/nm-linux.h". Don't include <signal.h>. (REGISTER_U_ADDR, KERNEL_U_SIZE, U_REGS_OFFSET, KERN_U_ADDR, GET_THREAD_SIGNALS): Remove defines. (x86_64_register_u_addr, kernel_u_size, lin_thread_get_thread_signals): Remove prototypes. (PTRACE_ARG3_TYPE, PTRACE_XFER_TYPE): Define to `long'. [HAVE_LINK_H]: Don't include "solib.h". [HAVE_LINK_H] (SVR4_SHARED_LIBS): Remove define. * config/i386/tm-x86-64linux.h: Fix comments. * Makefile.in (x86-64-linux-nat.o, x86_64-linux-tdep.o, x86-64-tdep.o): Update dependencies.
2003-05-31 10:15:38 +02:00
{
int tid;
unsigned long value;
* aarch64-linux-nat.c: Replace PIDGET with ptid_get_pid. Replace TIDGET with ptid_get_lwp. Replace GET_LWP with ptid_get_lwp. * aix-thread.c (BUILD_THREAD, BUILD_LWP): Remove. Replace BUILD_THREAD with ptid_build. Replace BUILD_LWP with ptid_build. Replace PIDGET with ptid_get_pid. Replace TIDGET with ptid_get_lwp. * alphabsd-nat.c: Replace PIDGET with ptid_get_pid. * amd64-linux-nat.c: Replace PIDGET with ptid_get_pid. Replace TIDGET with ptid_get_lwp. * amd64bsd-nat.c: Replace PIDGET with ptid_get_pid. * arm-linux-nat.c: Replace PIDGET with ptid_get_pid. Replace TIDGET with ptid_get_lwp. Replace GET_LWP with ptid_get_lwp. * armnbsd-nat.c: Replace PIDGET with ptid_get_pid. * auxv.c: Likewise. * breakpoint.c: Likewise. * common/ptid.c (ptid_is_pid): Condense check for null_ptid and minus_one_ptid. (ptid_lwp_p): New function. (ptid_tid_p): New function. * common/ptid.h: Update comments for accessors. (ptid_lwp_p): New prototype. (ptid_tid_p): New prototype. * defs.h (PIDGET, TIDGET, MERGEPID): Do not define. * gcore.c: Replace PIDGET with ptid_get_pid. * gdbthread.h: Likewise. * gnu-nat.c: Likewise. * hppa-linux-nat.c: Replace PIDGET with ptid_get_pid. Replace TIDGET with ptid_get_lwp. * hppabsd-nat.c: Replace PIDGET with ptid_get_pid. * hppanbsd-nat.c: Likewise. * i386-linux-nat.c: Replace PIDGET with ptid_get_pid. Replace TIDGET with ptid_get_lwp. * i386bsd-nat.c: Replace PIDGET with ptid_get_pid. * ia64-linux-nat.c: Replace PIDGET with ptid_get_pid. * infcmd.c: Likewise. * inferior.h: Likewise. * inflow.c: Likewise. * infrun.c: Likewise. * linux-fork.c: Likewise. * linux-nat.c: Replace PIDGET with ptid_get_pid. Replace GET_PID with ptid_get_pid. Replace is_lwp with ptid_lwp_p. Replace GET_LWP with ptid_get_lwp. Replace BUILD_LWP with ptid_build.
2013-09-30 13:50:12 +02:00
tid = ptid_get_lwp (ptid);
* linux-nat.c (linux_nat_new_thread): New variable. (linux_child_follow_fork): Set inferior_ptid to include LWP ID. Use linux_nat_switch_fork. (lwp_list): Make public. (add_lwp): Call linux_nat_new_thread. (lin_lwp_attach_lwp, linux_nat_attach): Call add_lwp after stopping the new thread. (resume_callback): Clear lp->siginfo. Remove unused variable. (linux_nat_resume): Assert that the LWP list is already initialized. Clear lp->siginfo. (save_siginfo): New. (stop_wait_callback, linux_nat_wait): Call it. (linux_nat_set_new_thread, linux_nat_get_siginfo): New. * linux-nat.h (struct lwp_info): Add siginfo. (lwp_list, linux_nat_set_new_thread, linux_nat_get_siginfo): Declare. (ALL_LWPS): Define. * amd64-linux-nat.c (amd64_linux_dr): New. (amd64_linux_dr_get): Take a PTID argument. Correct typo. (amd64_linux_dr_set): Take a PTID argument. (amd64_linux_dr_set_control, amd64_linux_dr_set_addr): Use ALL_LWPS. (amd64_linux_dr_reset_addr): Use amd64_linux_dr_set_addr. (amd64_linux_dr_get_status): Pass inferior_ptid to amd64_linux_dr_get. (amd64_linux_new_thread): New. (_initialize_amd64_linux_nat): Call linux_nat_set_new_thread. * i386-linux-nat.c (i386_linux_dr): New. (i386_linux_dr_get, i386_linux_dr_set): Take a PTID argument. (i386_linux_dr_set_control, i386_linux_dr_set_addr): Use ALL_LWPS. (i386_linux_dr_reset_addr): Use i386_linux_dr_set_addr. (i386_linux_dr_get_status): Pass inferior_ptid to i386_linux_dr_get. (i386_linux_new_thread): New. (i386_linux_resume): Remove unnecessary PID check. (_initialize_i386_linux_nat): Call linux_nat_set_new_thread. * ia64-linux-nat.c (enable_watchpoints_in_psr): Take PTID argument. (fetch_debug_register, fetch_debug_register_pair): Delete. (debug_registers): New. (ia64_linux_insert_watchpoint, ia64_linux_remove_watchpoint): Use ALL_LWPS and debug_registers. (ia64_linux_new_thread): New. (ia64_linux_stopped_data_address): Use linux_nat_get_siginfo. (_initialize_ia64_linux_nat): Call linux_nat_set_new_thread. * ppc-linux-nat.c (last_stopped_data_address): Delete. (saved_dabr_value): New. (ppc_linux_insert_watchpoint, ppc_linux_remove_watchpoint): Use ALL_LWPS. (ppc_linux_new_thread): New. (ppc_linux_stopped_data_address): Use linux_nat_get_siginfo. (ppc_linux_stopped_by_watchpoint): Call ppc_linux_stopped_data_address. (_initialize_ppc_linux_nat): Call linux_nat_set_new_thread. * s390-nat.c (s390_stopped_by_watchpoint): Clear the watchpoint status after reading it. (s390_fix_watch_points): Take a PTID argument. (s390_insert_watchpoint, s390_remove_watchpoint): Use ALL_LWPS. (_initialize_s390_nat): Call linux_nat_set_new_thread.
2007-10-01 02:22:50 +02:00
if (tid == 0)
* aarch64-linux-nat.c: Replace PIDGET with ptid_get_pid. Replace TIDGET with ptid_get_lwp. Replace GET_LWP with ptid_get_lwp. * aix-thread.c (BUILD_THREAD, BUILD_LWP): Remove. Replace BUILD_THREAD with ptid_build. Replace BUILD_LWP with ptid_build. Replace PIDGET with ptid_get_pid. Replace TIDGET with ptid_get_lwp. * alphabsd-nat.c: Replace PIDGET with ptid_get_pid. * amd64-linux-nat.c: Replace PIDGET with ptid_get_pid. Replace TIDGET with ptid_get_lwp. * amd64bsd-nat.c: Replace PIDGET with ptid_get_pid. * arm-linux-nat.c: Replace PIDGET with ptid_get_pid. Replace TIDGET with ptid_get_lwp. Replace GET_LWP with ptid_get_lwp. * armnbsd-nat.c: Replace PIDGET with ptid_get_pid. * auxv.c: Likewise. * breakpoint.c: Likewise. * common/ptid.c (ptid_is_pid): Condense check for null_ptid and minus_one_ptid. (ptid_lwp_p): New function. (ptid_tid_p): New function. * common/ptid.h: Update comments for accessors. (ptid_lwp_p): New prototype. (ptid_tid_p): New prototype. * defs.h (PIDGET, TIDGET, MERGEPID): Do not define. * gcore.c: Replace PIDGET with ptid_get_pid. * gdbthread.h: Likewise. * gnu-nat.c: Likewise. * hppa-linux-nat.c: Replace PIDGET with ptid_get_pid. Replace TIDGET with ptid_get_lwp. * hppabsd-nat.c: Replace PIDGET with ptid_get_pid. * hppanbsd-nat.c: Likewise. * i386-linux-nat.c: Replace PIDGET with ptid_get_pid. Replace TIDGET with ptid_get_lwp. * i386bsd-nat.c: Replace PIDGET with ptid_get_pid. * ia64-linux-nat.c: Replace PIDGET with ptid_get_pid. * infcmd.c: Likewise. * inferior.h: Likewise. * inflow.c: Likewise. * infrun.c: Likewise. * linux-fork.c: Likewise. * linux-nat.c: Replace PIDGET with ptid_get_pid. Replace GET_PID with ptid_get_pid. Replace is_lwp with ptid_lwp_p. Replace GET_LWP with ptid_get_lwp. Replace BUILD_LWP with ptid_build.
2013-09-30 13:50:12 +02:00
tid = ptid_get_pid (ptid);
* x86-64-tdep.h (x86_64_num_regs, x86_64_num_gregs): Remove variable declarations. (x86_64_register_number, x86_64_register_name): Remove prototypes. (x86_64_linux_frame_saved_pc, x86_64_linux+saved_pc_after_call, x86_64_linux_in_sigtramp, x86_64_linux_frame_chain, x86_64_init_frame_pc, x86_64_init_frame_pc, x86_64_function_has_prologue): Remove prototypes. (X86_64_NUM_GREGS): New define. (x86_64_supply_fxsave, x86_64_fill_fxsave): New prototypes. * x86-64-tdep.c: Don't include "dwarf2cfi.h". Include "dummy_frame.h", "frame.h", "frame-base.h", "frame-unwind.h". (RAX_REGNUM, RDX_REGNUM, RDI_REGNUM, EFLAGS_REGNUM, ST0_REGNUM, XMM1_REGNUM): Remove defines. (X86_64_RAX_REGNUM, X86_64_RDX_REGNUM, X86_64_RDI_REGNUM, X86_64_RBP_REGNUM, X86_64_RSP_REGNUM, X86_64_RIP_REGNUM, X86_64_EFLAGS_REGNUM, X86_64_ST0_REGNUM, X86_64_XMM0_REGNUM, X86_64_XMM1_REGNUM): New defines. (struct x86_64_register_info): Renamed from `struct register_info'. Remove `size' member. (x86_64_register_info_table): Remove variable. (x86_64_register_info): New variable. (X86_64_NUM_REGS): New define. (X86_64_NUM_GREGS): Remove define. (x86_64_num_regs, x86_64_num_gregs): Remove variables. (x86_64_dwarf2gdb_regno_map, x86_64_dwarf2gdb_regno_map_length): Remove variables. (x86_54_dwarf2_reg_to_regnum): Remove function. (x86_64_dwarf_regmap, x86_64_dwarf_regmap_len): New variables. (x86_64_dwarf_reg_to_regnum): New function. (x86_64_register_name): Rewrite. (x86_64_register_raw_size): Remove function. (x86_64_register_byte_table): Remove variable. (x86_64_register_byte): Remove function. (x86_64_register_virtual_type): Remove function. (x86_64_register_type): New function. (x86_64_register_convertible, x86_64_register_convert_to_virtual, x86_64_register_convert_to_raw): Remove functions. (x86_64_push_return_address, x86_64_pop_frame): Remove functon. (x86_64_use_struct_convention): Make static. Adjust for renamed defines. (x86_64_frame_init_saved_regs): Remove function. (x86_64_push_arguments): Make static. Change to accept a regcache as argument. (x86_64_store_return_value, x86_64_extract_return_value): Make static. Rewrite based on i386 counterparts. (x86_64_push_dummy_call): New function. (X86_64_NUM_SAVED_REGS): New define. (x86_64_register_number): Remove function. (x86_64_store_struct_return): Remove function. (x86_64_frameless_function_invocation, x86_64_function_has_prologue): Remove functions. (PROLOG_BUFSIZE): Remove define. (struct x86_64_frame_cache): New structure. (x86_64_alloc_frame_cache, x86_64_analyze_prologue, x86_64_frame_cache, x86_64_frame_this_id, x86_64_frame_prev_register, x86_64_frame_p, x86_64_sigtramp_frame_cache, x86_64_sigtramp_frame_this_id, x86_64_sigtramp_frame_prev_register, x86_sigtramp_frame_p): New functions. (x86_64_frame_unwind, x86_64_sigtramp_frame_unwind): New variables. (x86_64_skip_prologue): Rewrite in terms of x86_64_analyze_prologue. (x86_64_frame_base_address): New function. (x86_64_frame_base): New variable. (x86_64_save_dummy_frame_tos, x86_64_unwind_dummy_id): Rewrite. (x86_64_init_abi): Set register_type and push_dummy_call. Don't set deprecated_fp_regnum, deprecated_register_size, deprecated_register_bytes, register_raw_size, register_byte, register_virtual_type, register_convertiable, register_convert_to_virtual, convert_to_raw, deprecated_get_saved_register, deprecated_target_read_fp, deprecated_push_arguments, deprecated_push_return_address, deprecated_pop_frame, deprecated_store_struct_return, deprecated_frame_init_saved_regs, deprecated_frame_chain, frameless_function_invocation, deprecated_frame_saved_pc, deprecated_saved_pc_after_call, frame_num_args, pc_in_sigtramp, dwarf2_build_frame_info, deprecated_init_extra_frame_info, deprecated_init_frame_pc and virtual_frame_pointer. Call frame_unwind_append_predicate to register x86_64_sigtramp_frame_p and x86_64_frame_p. Call frame_base_set_default to register x86_64_frame_base. (I387_FISEG_REGNUM, I387_FOSEG_REGNUM): New defines. (x86_64_supply_fxsave, x86_64_fill_fxsave): New functions. (_initialize_x86_64_tdep): Remove function. * x86-64-linux-tdep.c: Don't include "dwarf2cfi.h". (LINUX_SIGINFO_SIZE, LINUX_UCONTEXT_SIGCONTEXT_OFFSET, LINUX_SIGCONTEXT_PC_OFFSET, LINUX_SIGCONTEXT_FP_OFFSET): Don't define. (X86_64_LINUX_UCONTEXT_SIGCONTEXT_OFFSET): Define. (x86_64_linux_sigcontext_addr): Rewrite. (x86_64_linux_sigtramp_saved_pc, x86_64_linux_saved_pc_after_call, x86_64_linux_frame_saved_pc): Remove functions. (x86_64_linux_pc_in_sigtramp): Renamed from x86_64_linux_in_sigtramp. Try harder to recognize a signal trampoline. (x86_64_linux_frame_chain, x86_64_init_frame_pc): Remove_functions. (x86_64_linux_init_abi): Set pc_in_sigtramp. Initialize TDEP->sigcontext_addr, TDEP->sc_pc_offset and TDEP->sc_sp_offset. * x86-64-linux-nat.c: Sync with i386-linux-tdep.c. (x86_64_regmap): Rename to regmap. (GETREGS_SUPPLIES): Use X86_64_NUM_GREGS instead of x86_64_num_gregs. (supply_gregset, fill_gregset): Likewise. Use regmap instead of x86_64_regmap. (x86_64_fxsave_offset): Remove function. (supply_fpregset): Simply call x86_64_supply_fxsave. (fill_fpregset): Simply call x86_64_fill_fxsave. (fetch_inferior_registers, store_inferior_registers): Avoid asignment in if-statement. (LINUX_SYSCALL_LEN, LINUX_SYSCALL_REGNUM, SYS_Sigreturn, SYS_rt_sigreturn, LINUX_SIGCONTEXT_EFLAGS_OFFSET, LINUX_UCONTEXT_SIGCONTEXT_OFFSET): Remove defines. (fetch_core_registers): Remove function. (linux_elf_core_fns): Remove. (offsetoff): Don't define. (_initialize_x86_64_linux_nat, kernel_u_size): Remove functions. * config/i386/x86-64linux.mt (TDEPFILES): Add i386-linux-tdep.o. * config/i386/x86-64linux.mh (NATDEPFILES): Remove core-aout.o, add core-regset.o. * config/i386/nm-x86-64linux.h: Use NM_X86_64_LINUX_H for protection against multiple includes instead of NM_X86_64_h. Add various comments. Include "config/nm-linux.h". Don't include <signal.h>. (REGISTER_U_ADDR, KERNEL_U_SIZE, U_REGS_OFFSET, KERN_U_ADDR, GET_THREAD_SIGNALS): Remove defines. (x86_64_register_u_addr, kernel_u_size, lin_thread_get_thread_signals): Remove prototypes. (PTRACE_ARG3_TYPE, PTRACE_XFER_TYPE): Define to `long'. [HAVE_LINK_H]: Don't include "solib.h". [HAVE_LINK_H] (SVR4_SHARED_LIBS): Remove define. * config/i386/tm-x86-64linux.h: Fix comments. * Makefile.in (x86-64-linux-nat.o, x86_64-linux-tdep.o, x86-64-tdep.o): Update dependencies.
2003-05-31 10:15:38 +02:00
errno = 0;
* linux-nat.c (linux_nat_new_thread): New variable. (linux_child_follow_fork): Set inferior_ptid to include LWP ID. Use linux_nat_switch_fork. (lwp_list): Make public. (add_lwp): Call linux_nat_new_thread. (lin_lwp_attach_lwp, linux_nat_attach): Call add_lwp after stopping the new thread. (resume_callback): Clear lp->siginfo. Remove unused variable. (linux_nat_resume): Assert that the LWP list is already initialized. Clear lp->siginfo. (save_siginfo): New. (stop_wait_callback, linux_nat_wait): Call it. (linux_nat_set_new_thread, linux_nat_get_siginfo): New. * linux-nat.h (struct lwp_info): Add siginfo. (lwp_list, linux_nat_set_new_thread, linux_nat_get_siginfo): Declare. (ALL_LWPS): Define. * amd64-linux-nat.c (amd64_linux_dr): New. (amd64_linux_dr_get): Take a PTID argument. Correct typo. (amd64_linux_dr_set): Take a PTID argument. (amd64_linux_dr_set_control, amd64_linux_dr_set_addr): Use ALL_LWPS. (amd64_linux_dr_reset_addr): Use amd64_linux_dr_set_addr. (amd64_linux_dr_get_status): Pass inferior_ptid to amd64_linux_dr_get. (amd64_linux_new_thread): New. (_initialize_amd64_linux_nat): Call linux_nat_set_new_thread. * i386-linux-nat.c (i386_linux_dr): New. (i386_linux_dr_get, i386_linux_dr_set): Take a PTID argument. (i386_linux_dr_set_control, i386_linux_dr_set_addr): Use ALL_LWPS. (i386_linux_dr_reset_addr): Use i386_linux_dr_set_addr. (i386_linux_dr_get_status): Pass inferior_ptid to i386_linux_dr_get. (i386_linux_new_thread): New. (i386_linux_resume): Remove unnecessary PID check. (_initialize_i386_linux_nat): Call linux_nat_set_new_thread. * ia64-linux-nat.c (enable_watchpoints_in_psr): Take PTID argument. (fetch_debug_register, fetch_debug_register_pair): Delete. (debug_registers): New. (ia64_linux_insert_watchpoint, ia64_linux_remove_watchpoint): Use ALL_LWPS and debug_registers. (ia64_linux_new_thread): New. (ia64_linux_stopped_data_address): Use linux_nat_get_siginfo. (_initialize_ia64_linux_nat): Call linux_nat_set_new_thread. * ppc-linux-nat.c (last_stopped_data_address): Delete. (saved_dabr_value): New. (ppc_linux_insert_watchpoint, ppc_linux_remove_watchpoint): Use ALL_LWPS. (ppc_linux_new_thread): New. (ppc_linux_stopped_data_address): Use linux_nat_get_siginfo. (ppc_linux_stopped_by_watchpoint): Call ppc_linux_stopped_data_address. (_initialize_ppc_linux_nat): Call linux_nat_set_new_thread. * s390-nat.c (s390_stopped_by_watchpoint): Clear the watchpoint status after reading it. (s390_fix_watch_points): Take a PTID argument. (s390_insert_watchpoint, s390_remove_watchpoint): Use ALL_LWPS. (_initialize_s390_nat): Call linux_nat_set_new_thread.
2007-10-01 02:22:50 +02:00
value = ptrace (PTRACE_PEEKUSER, tid,
* x86-64-tdep.h (x86_64_num_regs, x86_64_num_gregs): Remove variable declarations. (x86_64_register_number, x86_64_register_name): Remove prototypes. (x86_64_linux_frame_saved_pc, x86_64_linux+saved_pc_after_call, x86_64_linux_in_sigtramp, x86_64_linux_frame_chain, x86_64_init_frame_pc, x86_64_init_frame_pc, x86_64_function_has_prologue): Remove prototypes. (X86_64_NUM_GREGS): New define. (x86_64_supply_fxsave, x86_64_fill_fxsave): New prototypes. * x86-64-tdep.c: Don't include "dwarf2cfi.h". Include "dummy_frame.h", "frame.h", "frame-base.h", "frame-unwind.h". (RAX_REGNUM, RDX_REGNUM, RDI_REGNUM, EFLAGS_REGNUM, ST0_REGNUM, XMM1_REGNUM): Remove defines. (X86_64_RAX_REGNUM, X86_64_RDX_REGNUM, X86_64_RDI_REGNUM, X86_64_RBP_REGNUM, X86_64_RSP_REGNUM, X86_64_RIP_REGNUM, X86_64_EFLAGS_REGNUM, X86_64_ST0_REGNUM, X86_64_XMM0_REGNUM, X86_64_XMM1_REGNUM): New defines. (struct x86_64_register_info): Renamed from `struct register_info'. Remove `size' member. (x86_64_register_info_table): Remove variable. (x86_64_register_info): New variable. (X86_64_NUM_REGS): New define. (X86_64_NUM_GREGS): Remove define. (x86_64_num_regs, x86_64_num_gregs): Remove variables. (x86_64_dwarf2gdb_regno_map, x86_64_dwarf2gdb_regno_map_length): Remove variables. (x86_54_dwarf2_reg_to_regnum): Remove function. (x86_64_dwarf_regmap, x86_64_dwarf_regmap_len): New variables. (x86_64_dwarf_reg_to_regnum): New function. (x86_64_register_name): Rewrite. (x86_64_register_raw_size): Remove function. (x86_64_register_byte_table): Remove variable. (x86_64_register_byte): Remove function. (x86_64_register_virtual_type): Remove function. (x86_64_register_type): New function. (x86_64_register_convertible, x86_64_register_convert_to_virtual, x86_64_register_convert_to_raw): Remove functions. (x86_64_push_return_address, x86_64_pop_frame): Remove functon. (x86_64_use_struct_convention): Make static. Adjust for renamed defines. (x86_64_frame_init_saved_regs): Remove function. (x86_64_push_arguments): Make static. Change to accept a regcache as argument. (x86_64_store_return_value, x86_64_extract_return_value): Make static. Rewrite based on i386 counterparts. (x86_64_push_dummy_call): New function. (X86_64_NUM_SAVED_REGS): New define. (x86_64_register_number): Remove function. (x86_64_store_struct_return): Remove function. (x86_64_frameless_function_invocation, x86_64_function_has_prologue): Remove functions. (PROLOG_BUFSIZE): Remove define. (struct x86_64_frame_cache): New structure. (x86_64_alloc_frame_cache, x86_64_analyze_prologue, x86_64_frame_cache, x86_64_frame_this_id, x86_64_frame_prev_register, x86_64_frame_p, x86_64_sigtramp_frame_cache, x86_64_sigtramp_frame_this_id, x86_64_sigtramp_frame_prev_register, x86_sigtramp_frame_p): New functions. (x86_64_frame_unwind, x86_64_sigtramp_frame_unwind): New variables. (x86_64_skip_prologue): Rewrite in terms of x86_64_analyze_prologue. (x86_64_frame_base_address): New function. (x86_64_frame_base): New variable. (x86_64_save_dummy_frame_tos, x86_64_unwind_dummy_id): Rewrite. (x86_64_init_abi): Set register_type and push_dummy_call. Don't set deprecated_fp_regnum, deprecated_register_size, deprecated_register_bytes, register_raw_size, register_byte, register_virtual_type, register_convertiable, register_convert_to_virtual, convert_to_raw, deprecated_get_saved_register, deprecated_target_read_fp, deprecated_push_arguments, deprecated_push_return_address, deprecated_pop_frame, deprecated_store_struct_return, deprecated_frame_init_saved_regs, deprecated_frame_chain, frameless_function_invocation, deprecated_frame_saved_pc, deprecated_saved_pc_after_call, frame_num_args, pc_in_sigtramp, dwarf2_build_frame_info, deprecated_init_extra_frame_info, deprecated_init_frame_pc and virtual_frame_pointer. Call frame_unwind_append_predicate to register x86_64_sigtramp_frame_p and x86_64_frame_p. Call frame_base_set_default to register x86_64_frame_base. (I387_FISEG_REGNUM, I387_FOSEG_REGNUM): New defines. (x86_64_supply_fxsave, x86_64_fill_fxsave): New functions. (_initialize_x86_64_tdep): Remove function. * x86-64-linux-tdep.c: Don't include "dwarf2cfi.h". (LINUX_SIGINFO_SIZE, LINUX_UCONTEXT_SIGCONTEXT_OFFSET, LINUX_SIGCONTEXT_PC_OFFSET, LINUX_SIGCONTEXT_FP_OFFSET): Don't define. (X86_64_LINUX_UCONTEXT_SIGCONTEXT_OFFSET): Define. (x86_64_linux_sigcontext_addr): Rewrite. (x86_64_linux_sigtramp_saved_pc, x86_64_linux_saved_pc_after_call, x86_64_linux_frame_saved_pc): Remove functions. (x86_64_linux_pc_in_sigtramp): Renamed from x86_64_linux_in_sigtramp. Try harder to recognize a signal trampoline. (x86_64_linux_frame_chain, x86_64_init_frame_pc): Remove_functions. (x86_64_linux_init_abi): Set pc_in_sigtramp. Initialize TDEP->sigcontext_addr, TDEP->sc_pc_offset and TDEP->sc_sp_offset. * x86-64-linux-nat.c: Sync with i386-linux-tdep.c. (x86_64_regmap): Rename to regmap. (GETREGS_SUPPLIES): Use X86_64_NUM_GREGS instead of x86_64_num_gregs. (supply_gregset, fill_gregset): Likewise. Use regmap instead of x86_64_regmap. (x86_64_fxsave_offset): Remove function. (supply_fpregset): Simply call x86_64_supply_fxsave. (fill_fpregset): Simply call x86_64_fill_fxsave. (fetch_inferior_registers, store_inferior_registers): Avoid asignment in if-statement. (LINUX_SYSCALL_LEN, LINUX_SYSCALL_REGNUM, SYS_Sigreturn, SYS_rt_sigreturn, LINUX_SIGCONTEXT_EFLAGS_OFFSET, LINUX_UCONTEXT_SIGCONTEXT_OFFSET): Remove defines. (fetch_core_registers): Remove function. (linux_elf_core_fns): Remove. (offsetoff): Don't define. (_initialize_x86_64_linux_nat, kernel_u_size): Remove functions. * config/i386/x86-64linux.mt (TDEPFILES): Add i386-linux-tdep.o. * config/i386/x86-64linux.mh (NATDEPFILES): Remove core-aout.o, add core-regset.o. * config/i386/nm-x86-64linux.h: Use NM_X86_64_LINUX_H for protection against multiple includes instead of NM_X86_64_h. Add various comments. Include "config/nm-linux.h". Don't include <signal.h>. (REGISTER_U_ADDR, KERNEL_U_SIZE, U_REGS_OFFSET, KERN_U_ADDR, GET_THREAD_SIGNALS): Remove defines. (x86_64_register_u_addr, kernel_u_size, lin_thread_get_thread_signals): Remove prototypes. (PTRACE_ARG3_TYPE, PTRACE_XFER_TYPE): Define to `long'. [HAVE_LINK_H]: Don't include "solib.h". [HAVE_LINK_H] (SVR4_SHARED_LIBS): Remove define. * config/i386/tm-x86-64linux.h: Fix comments. * Makefile.in (x86-64-linux-nat.o, x86_64-linux-tdep.o, x86-64-tdep.o): Update dependencies.
2003-05-31 10:15:38 +02:00
offsetof (struct user, u_debugreg[regnum]), 0);
if (errno != 0)
perror_with_name (_("Couldn't read debug register"));
* x86-64-tdep.h (x86_64_num_regs, x86_64_num_gregs): Remove variable declarations. (x86_64_register_number, x86_64_register_name): Remove prototypes. (x86_64_linux_frame_saved_pc, x86_64_linux+saved_pc_after_call, x86_64_linux_in_sigtramp, x86_64_linux_frame_chain, x86_64_init_frame_pc, x86_64_init_frame_pc, x86_64_function_has_prologue): Remove prototypes. (X86_64_NUM_GREGS): New define. (x86_64_supply_fxsave, x86_64_fill_fxsave): New prototypes. * x86-64-tdep.c: Don't include "dwarf2cfi.h". Include "dummy_frame.h", "frame.h", "frame-base.h", "frame-unwind.h". (RAX_REGNUM, RDX_REGNUM, RDI_REGNUM, EFLAGS_REGNUM, ST0_REGNUM, XMM1_REGNUM): Remove defines. (X86_64_RAX_REGNUM, X86_64_RDX_REGNUM, X86_64_RDI_REGNUM, X86_64_RBP_REGNUM, X86_64_RSP_REGNUM, X86_64_RIP_REGNUM, X86_64_EFLAGS_REGNUM, X86_64_ST0_REGNUM, X86_64_XMM0_REGNUM, X86_64_XMM1_REGNUM): New defines. (struct x86_64_register_info): Renamed from `struct register_info'. Remove `size' member. (x86_64_register_info_table): Remove variable. (x86_64_register_info): New variable. (X86_64_NUM_REGS): New define. (X86_64_NUM_GREGS): Remove define. (x86_64_num_regs, x86_64_num_gregs): Remove variables. (x86_64_dwarf2gdb_regno_map, x86_64_dwarf2gdb_regno_map_length): Remove variables. (x86_54_dwarf2_reg_to_regnum): Remove function. (x86_64_dwarf_regmap, x86_64_dwarf_regmap_len): New variables. (x86_64_dwarf_reg_to_regnum): New function. (x86_64_register_name): Rewrite. (x86_64_register_raw_size): Remove function. (x86_64_register_byte_table): Remove variable. (x86_64_register_byte): Remove function. (x86_64_register_virtual_type): Remove function. (x86_64_register_type): New function. (x86_64_register_convertible, x86_64_register_convert_to_virtual, x86_64_register_convert_to_raw): Remove functions. (x86_64_push_return_address, x86_64_pop_frame): Remove functon. (x86_64_use_struct_convention): Make static. Adjust for renamed defines. (x86_64_frame_init_saved_regs): Remove function. (x86_64_push_arguments): Make static. Change to accept a regcache as argument. (x86_64_store_return_value, x86_64_extract_return_value): Make static. Rewrite based on i386 counterparts. (x86_64_push_dummy_call): New function. (X86_64_NUM_SAVED_REGS): New define. (x86_64_register_number): Remove function. (x86_64_store_struct_return): Remove function. (x86_64_frameless_function_invocation, x86_64_function_has_prologue): Remove functions. (PROLOG_BUFSIZE): Remove define. (struct x86_64_frame_cache): New structure. (x86_64_alloc_frame_cache, x86_64_analyze_prologue, x86_64_frame_cache, x86_64_frame_this_id, x86_64_frame_prev_register, x86_64_frame_p, x86_64_sigtramp_frame_cache, x86_64_sigtramp_frame_this_id, x86_64_sigtramp_frame_prev_register, x86_sigtramp_frame_p): New functions. (x86_64_frame_unwind, x86_64_sigtramp_frame_unwind): New variables. (x86_64_skip_prologue): Rewrite in terms of x86_64_analyze_prologue. (x86_64_frame_base_address): New function. (x86_64_frame_base): New variable. (x86_64_save_dummy_frame_tos, x86_64_unwind_dummy_id): Rewrite. (x86_64_init_abi): Set register_type and push_dummy_call. Don't set deprecated_fp_regnum, deprecated_register_size, deprecated_register_bytes, register_raw_size, register_byte, register_virtual_type, register_convertiable, register_convert_to_virtual, convert_to_raw, deprecated_get_saved_register, deprecated_target_read_fp, deprecated_push_arguments, deprecated_push_return_address, deprecated_pop_frame, deprecated_store_struct_return, deprecated_frame_init_saved_regs, deprecated_frame_chain, frameless_function_invocation, deprecated_frame_saved_pc, deprecated_saved_pc_after_call, frame_num_args, pc_in_sigtramp, dwarf2_build_frame_info, deprecated_init_extra_frame_info, deprecated_init_frame_pc and virtual_frame_pointer. Call frame_unwind_append_predicate to register x86_64_sigtramp_frame_p and x86_64_frame_p. Call frame_base_set_default to register x86_64_frame_base. (I387_FISEG_REGNUM, I387_FOSEG_REGNUM): New defines. (x86_64_supply_fxsave, x86_64_fill_fxsave): New functions. (_initialize_x86_64_tdep): Remove function. * x86-64-linux-tdep.c: Don't include "dwarf2cfi.h". (LINUX_SIGINFO_SIZE, LINUX_UCONTEXT_SIGCONTEXT_OFFSET, LINUX_SIGCONTEXT_PC_OFFSET, LINUX_SIGCONTEXT_FP_OFFSET): Don't define. (X86_64_LINUX_UCONTEXT_SIGCONTEXT_OFFSET): Define. (x86_64_linux_sigcontext_addr): Rewrite. (x86_64_linux_sigtramp_saved_pc, x86_64_linux_saved_pc_after_call, x86_64_linux_frame_saved_pc): Remove functions. (x86_64_linux_pc_in_sigtramp): Renamed from x86_64_linux_in_sigtramp. Try harder to recognize a signal trampoline. (x86_64_linux_frame_chain, x86_64_init_frame_pc): Remove_functions. (x86_64_linux_init_abi): Set pc_in_sigtramp. Initialize TDEP->sigcontext_addr, TDEP->sc_pc_offset and TDEP->sc_sp_offset. * x86-64-linux-nat.c: Sync with i386-linux-tdep.c. (x86_64_regmap): Rename to regmap. (GETREGS_SUPPLIES): Use X86_64_NUM_GREGS instead of x86_64_num_gregs. (supply_gregset, fill_gregset): Likewise. Use regmap instead of x86_64_regmap. (x86_64_fxsave_offset): Remove function. (supply_fpregset): Simply call x86_64_supply_fxsave. (fill_fpregset): Simply call x86_64_fill_fxsave. (fetch_inferior_registers, store_inferior_registers): Avoid asignment in if-statement. (LINUX_SYSCALL_LEN, LINUX_SYSCALL_REGNUM, SYS_Sigreturn, SYS_rt_sigreturn, LINUX_SIGCONTEXT_EFLAGS_OFFSET, LINUX_UCONTEXT_SIGCONTEXT_OFFSET): Remove defines. (fetch_core_registers): Remove function. (linux_elf_core_fns): Remove. (offsetoff): Don't define. (_initialize_x86_64_linux_nat, kernel_u_size): Remove functions. * config/i386/x86-64linux.mt (TDEPFILES): Add i386-linux-tdep.o. * config/i386/x86-64linux.mh (NATDEPFILES): Remove core-aout.o, add core-regset.o. * config/i386/nm-x86-64linux.h: Use NM_X86_64_LINUX_H for protection against multiple includes instead of NM_X86_64_h. Add various comments. Include "config/nm-linux.h". Don't include <signal.h>. (REGISTER_U_ADDR, KERNEL_U_SIZE, U_REGS_OFFSET, KERN_U_ADDR, GET_THREAD_SIGNALS): Remove defines. (x86_64_register_u_addr, kernel_u_size, lin_thread_get_thread_signals): Remove prototypes. (PTRACE_ARG3_TYPE, PTRACE_XFER_TYPE): Define to `long'. [HAVE_LINK_H]: Don't include "solib.h". [HAVE_LINK_H] (SVR4_SHARED_LIBS): Remove define. * config/i386/tm-x86-64linux.h: Fix comments. * Makefile.in (x86-64-linux-nat.o, x86_64-linux-tdep.o, x86-64-tdep.o): Update dependencies.
2003-05-31 10:15:38 +02:00
return value;
}
/* Set debug register REGNUM to VALUE in only the one LWP of PTID. */
static void
* linux-nat.c (linux_nat_new_thread): New variable. (linux_child_follow_fork): Set inferior_ptid to include LWP ID. Use linux_nat_switch_fork. (lwp_list): Make public. (add_lwp): Call linux_nat_new_thread. (lin_lwp_attach_lwp, linux_nat_attach): Call add_lwp after stopping the new thread. (resume_callback): Clear lp->siginfo. Remove unused variable. (linux_nat_resume): Assert that the LWP list is already initialized. Clear lp->siginfo. (save_siginfo): New. (stop_wait_callback, linux_nat_wait): Call it. (linux_nat_set_new_thread, linux_nat_get_siginfo): New. * linux-nat.h (struct lwp_info): Add siginfo. (lwp_list, linux_nat_set_new_thread, linux_nat_get_siginfo): Declare. (ALL_LWPS): Define. * amd64-linux-nat.c (amd64_linux_dr): New. (amd64_linux_dr_get): Take a PTID argument. Correct typo. (amd64_linux_dr_set): Take a PTID argument. (amd64_linux_dr_set_control, amd64_linux_dr_set_addr): Use ALL_LWPS. (amd64_linux_dr_reset_addr): Use amd64_linux_dr_set_addr. (amd64_linux_dr_get_status): Pass inferior_ptid to amd64_linux_dr_get. (amd64_linux_new_thread): New. (_initialize_amd64_linux_nat): Call linux_nat_set_new_thread. * i386-linux-nat.c (i386_linux_dr): New. (i386_linux_dr_get, i386_linux_dr_set): Take a PTID argument. (i386_linux_dr_set_control, i386_linux_dr_set_addr): Use ALL_LWPS. (i386_linux_dr_reset_addr): Use i386_linux_dr_set_addr. (i386_linux_dr_get_status): Pass inferior_ptid to i386_linux_dr_get. (i386_linux_new_thread): New. (i386_linux_resume): Remove unnecessary PID check. (_initialize_i386_linux_nat): Call linux_nat_set_new_thread. * ia64-linux-nat.c (enable_watchpoints_in_psr): Take PTID argument. (fetch_debug_register, fetch_debug_register_pair): Delete. (debug_registers): New. (ia64_linux_insert_watchpoint, ia64_linux_remove_watchpoint): Use ALL_LWPS and debug_registers. (ia64_linux_new_thread): New. (ia64_linux_stopped_data_address): Use linux_nat_get_siginfo. (_initialize_ia64_linux_nat): Call linux_nat_set_new_thread. * ppc-linux-nat.c (last_stopped_data_address): Delete. (saved_dabr_value): New. (ppc_linux_insert_watchpoint, ppc_linux_remove_watchpoint): Use ALL_LWPS. (ppc_linux_new_thread): New. (ppc_linux_stopped_data_address): Use linux_nat_get_siginfo. (ppc_linux_stopped_by_watchpoint): Call ppc_linux_stopped_data_address. (_initialize_ppc_linux_nat): Call linux_nat_set_new_thread. * s390-nat.c (s390_stopped_by_watchpoint): Clear the watchpoint status after reading it. (s390_fix_watch_points): Take a PTID argument. (s390_insert_watchpoint, s390_remove_watchpoint): Use ALL_LWPS. (_initialize_s390_nat): Call linux_nat_set_new_thread.
2007-10-01 02:22:50 +02:00
amd64_linux_dr_set (ptid_t ptid, int regnum, unsigned long value)
{
* x86-64-tdep.h (x86_64_num_regs, x86_64_num_gregs): Remove variable declarations. (x86_64_register_number, x86_64_register_name): Remove prototypes. (x86_64_linux_frame_saved_pc, x86_64_linux+saved_pc_after_call, x86_64_linux_in_sigtramp, x86_64_linux_frame_chain, x86_64_init_frame_pc, x86_64_init_frame_pc, x86_64_function_has_prologue): Remove prototypes. (X86_64_NUM_GREGS): New define. (x86_64_supply_fxsave, x86_64_fill_fxsave): New prototypes. * x86-64-tdep.c: Don't include "dwarf2cfi.h". Include "dummy_frame.h", "frame.h", "frame-base.h", "frame-unwind.h". (RAX_REGNUM, RDX_REGNUM, RDI_REGNUM, EFLAGS_REGNUM, ST0_REGNUM, XMM1_REGNUM): Remove defines. (X86_64_RAX_REGNUM, X86_64_RDX_REGNUM, X86_64_RDI_REGNUM, X86_64_RBP_REGNUM, X86_64_RSP_REGNUM, X86_64_RIP_REGNUM, X86_64_EFLAGS_REGNUM, X86_64_ST0_REGNUM, X86_64_XMM0_REGNUM, X86_64_XMM1_REGNUM): New defines. (struct x86_64_register_info): Renamed from `struct register_info'. Remove `size' member. (x86_64_register_info_table): Remove variable. (x86_64_register_info): New variable. (X86_64_NUM_REGS): New define. (X86_64_NUM_GREGS): Remove define. (x86_64_num_regs, x86_64_num_gregs): Remove variables. (x86_64_dwarf2gdb_regno_map, x86_64_dwarf2gdb_regno_map_length): Remove variables. (x86_54_dwarf2_reg_to_regnum): Remove function. (x86_64_dwarf_regmap, x86_64_dwarf_regmap_len): New variables. (x86_64_dwarf_reg_to_regnum): New function. (x86_64_register_name): Rewrite. (x86_64_register_raw_size): Remove function. (x86_64_register_byte_table): Remove variable. (x86_64_register_byte): Remove function. (x86_64_register_virtual_type): Remove function. (x86_64_register_type): New function. (x86_64_register_convertible, x86_64_register_convert_to_virtual, x86_64_register_convert_to_raw): Remove functions. (x86_64_push_return_address, x86_64_pop_frame): Remove functon. (x86_64_use_struct_convention): Make static. Adjust for renamed defines. (x86_64_frame_init_saved_regs): Remove function. (x86_64_push_arguments): Make static. Change to accept a regcache as argument. (x86_64_store_return_value, x86_64_extract_return_value): Make static. Rewrite based on i386 counterparts. (x86_64_push_dummy_call): New function. (X86_64_NUM_SAVED_REGS): New define. (x86_64_register_number): Remove function. (x86_64_store_struct_return): Remove function. (x86_64_frameless_function_invocation, x86_64_function_has_prologue): Remove functions. (PROLOG_BUFSIZE): Remove define. (struct x86_64_frame_cache): New structure. (x86_64_alloc_frame_cache, x86_64_analyze_prologue, x86_64_frame_cache, x86_64_frame_this_id, x86_64_frame_prev_register, x86_64_frame_p, x86_64_sigtramp_frame_cache, x86_64_sigtramp_frame_this_id, x86_64_sigtramp_frame_prev_register, x86_sigtramp_frame_p): New functions. (x86_64_frame_unwind, x86_64_sigtramp_frame_unwind): New variables. (x86_64_skip_prologue): Rewrite in terms of x86_64_analyze_prologue. (x86_64_frame_base_address): New function. (x86_64_frame_base): New variable. (x86_64_save_dummy_frame_tos, x86_64_unwind_dummy_id): Rewrite. (x86_64_init_abi): Set register_type and push_dummy_call. Don't set deprecated_fp_regnum, deprecated_register_size, deprecated_register_bytes, register_raw_size, register_byte, register_virtual_type, register_convertiable, register_convert_to_virtual, convert_to_raw, deprecated_get_saved_register, deprecated_target_read_fp, deprecated_push_arguments, deprecated_push_return_address, deprecated_pop_frame, deprecated_store_struct_return, deprecated_frame_init_saved_regs, deprecated_frame_chain, frameless_function_invocation, deprecated_frame_saved_pc, deprecated_saved_pc_after_call, frame_num_args, pc_in_sigtramp, dwarf2_build_frame_info, deprecated_init_extra_frame_info, deprecated_init_frame_pc and virtual_frame_pointer. Call frame_unwind_append_predicate to register x86_64_sigtramp_frame_p and x86_64_frame_p. Call frame_base_set_default to register x86_64_frame_base. (I387_FISEG_REGNUM, I387_FOSEG_REGNUM): New defines. (x86_64_supply_fxsave, x86_64_fill_fxsave): New functions. (_initialize_x86_64_tdep): Remove function. * x86-64-linux-tdep.c: Don't include "dwarf2cfi.h". (LINUX_SIGINFO_SIZE, LINUX_UCONTEXT_SIGCONTEXT_OFFSET, LINUX_SIGCONTEXT_PC_OFFSET, LINUX_SIGCONTEXT_FP_OFFSET): Don't define. (X86_64_LINUX_UCONTEXT_SIGCONTEXT_OFFSET): Define. (x86_64_linux_sigcontext_addr): Rewrite. (x86_64_linux_sigtramp_saved_pc, x86_64_linux_saved_pc_after_call, x86_64_linux_frame_saved_pc): Remove functions. (x86_64_linux_pc_in_sigtramp): Renamed from x86_64_linux_in_sigtramp. Try harder to recognize a signal trampoline. (x86_64_linux_frame_chain, x86_64_init_frame_pc): Remove_functions. (x86_64_linux_init_abi): Set pc_in_sigtramp. Initialize TDEP->sigcontext_addr, TDEP->sc_pc_offset and TDEP->sc_sp_offset. * x86-64-linux-nat.c: Sync with i386-linux-tdep.c. (x86_64_regmap): Rename to regmap. (GETREGS_SUPPLIES): Use X86_64_NUM_GREGS instead of x86_64_num_gregs. (supply_gregset, fill_gregset): Likewise. Use regmap instead of x86_64_regmap. (x86_64_fxsave_offset): Remove function. (supply_fpregset): Simply call x86_64_supply_fxsave. (fill_fpregset): Simply call x86_64_fill_fxsave. (fetch_inferior_registers, store_inferior_registers): Avoid asignment in if-statement. (LINUX_SYSCALL_LEN, LINUX_SYSCALL_REGNUM, SYS_Sigreturn, SYS_rt_sigreturn, LINUX_SIGCONTEXT_EFLAGS_OFFSET, LINUX_UCONTEXT_SIGCONTEXT_OFFSET): Remove defines. (fetch_core_registers): Remove function. (linux_elf_core_fns): Remove. (offsetoff): Don't define. (_initialize_x86_64_linux_nat, kernel_u_size): Remove functions. * config/i386/x86-64linux.mt (TDEPFILES): Add i386-linux-tdep.o. * config/i386/x86-64linux.mh (NATDEPFILES): Remove core-aout.o, add core-regset.o. * config/i386/nm-x86-64linux.h: Use NM_X86_64_LINUX_H for protection against multiple includes instead of NM_X86_64_h. Add various comments. Include "config/nm-linux.h". Don't include <signal.h>. (REGISTER_U_ADDR, KERNEL_U_SIZE, U_REGS_OFFSET, KERN_U_ADDR, GET_THREAD_SIGNALS): Remove defines. (x86_64_register_u_addr, kernel_u_size, lin_thread_get_thread_signals): Remove prototypes. (PTRACE_ARG3_TYPE, PTRACE_XFER_TYPE): Define to `long'. [HAVE_LINK_H]: Don't include "solib.h". [HAVE_LINK_H] (SVR4_SHARED_LIBS): Remove define. * config/i386/tm-x86-64linux.h: Fix comments. * Makefile.in (x86-64-linux-nat.o, x86_64-linux-tdep.o, x86-64-tdep.o): Update dependencies.
2003-05-31 10:15:38 +02:00
int tid;
* aarch64-linux-nat.c: Replace PIDGET with ptid_get_pid. Replace TIDGET with ptid_get_lwp. Replace GET_LWP with ptid_get_lwp. * aix-thread.c (BUILD_THREAD, BUILD_LWP): Remove. Replace BUILD_THREAD with ptid_build. Replace BUILD_LWP with ptid_build. Replace PIDGET with ptid_get_pid. Replace TIDGET with ptid_get_lwp. * alphabsd-nat.c: Replace PIDGET with ptid_get_pid. * amd64-linux-nat.c: Replace PIDGET with ptid_get_pid. Replace TIDGET with ptid_get_lwp. * amd64bsd-nat.c: Replace PIDGET with ptid_get_pid. * arm-linux-nat.c: Replace PIDGET with ptid_get_pid. Replace TIDGET with ptid_get_lwp. Replace GET_LWP with ptid_get_lwp. * armnbsd-nat.c: Replace PIDGET with ptid_get_pid. * auxv.c: Likewise. * breakpoint.c: Likewise. * common/ptid.c (ptid_is_pid): Condense check for null_ptid and minus_one_ptid. (ptid_lwp_p): New function. (ptid_tid_p): New function. * common/ptid.h: Update comments for accessors. (ptid_lwp_p): New prototype. (ptid_tid_p): New prototype. * defs.h (PIDGET, TIDGET, MERGEPID): Do not define. * gcore.c: Replace PIDGET with ptid_get_pid. * gdbthread.h: Likewise. * gnu-nat.c: Likewise. * hppa-linux-nat.c: Replace PIDGET with ptid_get_pid. Replace TIDGET with ptid_get_lwp. * hppabsd-nat.c: Replace PIDGET with ptid_get_pid. * hppanbsd-nat.c: Likewise. * i386-linux-nat.c: Replace PIDGET with ptid_get_pid. Replace TIDGET with ptid_get_lwp. * i386bsd-nat.c: Replace PIDGET with ptid_get_pid. * ia64-linux-nat.c: Replace PIDGET with ptid_get_pid. * infcmd.c: Likewise. * inferior.h: Likewise. * inflow.c: Likewise. * infrun.c: Likewise. * linux-fork.c: Likewise. * linux-nat.c: Replace PIDGET with ptid_get_pid. Replace GET_PID with ptid_get_pid. Replace is_lwp with ptid_lwp_p. Replace GET_LWP with ptid_get_lwp. Replace BUILD_LWP with ptid_build.
2013-09-30 13:50:12 +02:00
tid = ptid_get_lwp (ptid);
* linux-nat.c (linux_nat_new_thread): New variable. (linux_child_follow_fork): Set inferior_ptid to include LWP ID. Use linux_nat_switch_fork. (lwp_list): Make public. (add_lwp): Call linux_nat_new_thread. (lin_lwp_attach_lwp, linux_nat_attach): Call add_lwp after stopping the new thread. (resume_callback): Clear lp->siginfo. Remove unused variable. (linux_nat_resume): Assert that the LWP list is already initialized. Clear lp->siginfo. (save_siginfo): New. (stop_wait_callback, linux_nat_wait): Call it. (linux_nat_set_new_thread, linux_nat_get_siginfo): New. * linux-nat.h (struct lwp_info): Add siginfo. (lwp_list, linux_nat_set_new_thread, linux_nat_get_siginfo): Declare. (ALL_LWPS): Define. * amd64-linux-nat.c (amd64_linux_dr): New. (amd64_linux_dr_get): Take a PTID argument. Correct typo. (amd64_linux_dr_set): Take a PTID argument. (amd64_linux_dr_set_control, amd64_linux_dr_set_addr): Use ALL_LWPS. (amd64_linux_dr_reset_addr): Use amd64_linux_dr_set_addr. (amd64_linux_dr_get_status): Pass inferior_ptid to amd64_linux_dr_get. (amd64_linux_new_thread): New. (_initialize_amd64_linux_nat): Call linux_nat_set_new_thread. * i386-linux-nat.c (i386_linux_dr): New. (i386_linux_dr_get, i386_linux_dr_set): Take a PTID argument. (i386_linux_dr_set_control, i386_linux_dr_set_addr): Use ALL_LWPS. (i386_linux_dr_reset_addr): Use i386_linux_dr_set_addr. (i386_linux_dr_get_status): Pass inferior_ptid to i386_linux_dr_get. (i386_linux_new_thread): New. (i386_linux_resume): Remove unnecessary PID check. (_initialize_i386_linux_nat): Call linux_nat_set_new_thread. * ia64-linux-nat.c (enable_watchpoints_in_psr): Take PTID argument. (fetch_debug_register, fetch_debug_register_pair): Delete. (debug_registers): New. (ia64_linux_insert_watchpoint, ia64_linux_remove_watchpoint): Use ALL_LWPS and debug_registers. (ia64_linux_new_thread): New. (ia64_linux_stopped_data_address): Use linux_nat_get_siginfo. (_initialize_ia64_linux_nat): Call linux_nat_set_new_thread. * ppc-linux-nat.c (last_stopped_data_address): Delete. (saved_dabr_value): New. (ppc_linux_insert_watchpoint, ppc_linux_remove_watchpoint): Use ALL_LWPS. (ppc_linux_new_thread): New. (ppc_linux_stopped_data_address): Use linux_nat_get_siginfo. (ppc_linux_stopped_by_watchpoint): Call ppc_linux_stopped_data_address. (_initialize_ppc_linux_nat): Call linux_nat_set_new_thread. * s390-nat.c (s390_stopped_by_watchpoint): Clear the watchpoint status after reading it. (s390_fix_watch_points): Take a PTID argument. (s390_insert_watchpoint, s390_remove_watchpoint): Use ALL_LWPS. (_initialize_s390_nat): Call linux_nat_set_new_thread.
2007-10-01 02:22:50 +02:00
if (tid == 0)
* aarch64-linux-nat.c: Replace PIDGET with ptid_get_pid. Replace TIDGET with ptid_get_lwp. Replace GET_LWP with ptid_get_lwp. * aix-thread.c (BUILD_THREAD, BUILD_LWP): Remove. Replace BUILD_THREAD with ptid_build. Replace BUILD_LWP with ptid_build. Replace PIDGET with ptid_get_pid. Replace TIDGET with ptid_get_lwp. * alphabsd-nat.c: Replace PIDGET with ptid_get_pid. * amd64-linux-nat.c: Replace PIDGET with ptid_get_pid. Replace TIDGET with ptid_get_lwp. * amd64bsd-nat.c: Replace PIDGET with ptid_get_pid. * arm-linux-nat.c: Replace PIDGET with ptid_get_pid. Replace TIDGET with ptid_get_lwp. Replace GET_LWP with ptid_get_lwp. * armnbsd-nat.c: Replace PIDGET with ptid_get_pid. * auxv.c: Likewise. * breakpoint.c: Likewise. * common/ptid.c (ptid_is_pid): Condense check for null_ptid and minus_one_ptid. (ptid_lwp_p): New function. (ptid_tid_p): New function. * common/ptid.h: Update comments for accessors. (ptid_lwp_p): New prototype. (ptid_tid_p): New prototype. * defs.h (PIDGET, TIDGET, MERGEPID): Do not define. * gcore.c: Replace PIDGET with ptid_get_pid. * gdbthread.h: Likewise. * gnu-nat.c: Likewise. * hppa-linux-nat.c: Replace PIDGET with ptid_get_pid. Replace TIDGET with ptid_get_lwp. * hppabsd-nat.c: Replace PIDGET with ptid_get_pid. * hppanbsd-nat.c: Likewise. * i386-linux-nat.c: Replace PIDGET with ptid_get_pid. Replace TIDGET with ptid_get_lwp. * i386bsd-nat.c: Replace PIDGET with ptid_get_pid. * ia64-linux-nat.c: Replace PIDGET with ptid_get_pid. * infcmd.c: Likewise. * inferior.h: Likewise. * inflow.c: Likewise. * infrun.c: Likewise. * linux-fork.c: Likewise. * linux-nat.c: Replace PIDGET with ptid_get_pid. Replace GET_PID with ptid_get_pid. Replace is_lwp with ptid_lwp_p. Replace GET_LWP with ptid_get_lwp. Replace BUILD_LWP with ptid_build.
2013-09-30 13:50:12 +02:00
tid = ptid_get_pid (ptid);
* x86-64-tdep.h (x86_64_num_regs, x86_64_num_gregs): Remove variable declarations. (x86_64_register_number, x86_64_register_name): Remove prototypes. (x86_64_linux_frame_saved_pc, x86_64_linux+saved_pc_after_call, x86_64_linux_in_sigtramp, x86_64_linux_frame_chain, x86_64_init_frame_pc, x86_64_init_frame_pc, x86_64_function_has_prologue): Remove prototypes. (X86_64_NUM_GREGS): New define. (x86_64_supply_fxsave, x86_64_fill_fxsave): New prototypes. * x86-64-tdep.c: Don't include "dwarf2cfi.h". Include "dummy_frame.h", "frame.h", "frame-base.h", "frame-unwind.h". (RAX_REGNUM, RDX_REGNUM, RDI_REGNUM, EFLAGS_REGNUM, ST0_REGNUM, XMM1_REGNUM): Remove defines. (X86_64_RAX_REGNUM, X86_64_RDX_REGNUM, X86_64_RDI_REGNUM, X86_64_RBP_REGNUM, X86_64_RSP_REGNUM, X86_64_RIP_REGNUM, X86_64_EFLAGS_REGNUM, X86_64_ST0_REGNUM, X86_64_XMM0_REGNUM, X86_64_XMM1_REGNUM): New defines. (struct x86_64_register_info): Renamed from `struct register_info'. Remove `size' member. (x86_64_register_info_table): Remove variable. (x86_64_register_info): New variable. (X86_64_NUM_REGS): New define. (X86_64_NUM_GREGS): Remove define. (x86_64_num_regs, x86_64_num_gregs): Remove variables. (x86_64_dwarf2gdb_regno_map, x86_64_dwarf2gdb_regno_map_length): Remove variables. (x86_54_dwarf2_reg_to_regnum): Remove function. (x86_64_dwarf_regmap, x86_64_dwarf_regmap_len): New variables. (x86_64_dwarf_reg_to_regnum): New function. (x86_64_register_name): Rewrite. (x86_64_register_raw_size): Remove function. (x86_64_register_byte_table): Remove variable. (x86_64_register_byte): Remove function. (x86_64_register_virtual_type): Remove function. (x86_64_register_type): New function. (x86_64_register_convertible, x86_64_register_convert_to_virtual, x86_64_register_convert_to_raw): Remove functions. (x86_64_push_return_address, x86_64_pop_frame): Remove functon. (x86_64_use_struct_convention): Make static. Adjust for renamed defines. (x86_64_frame_init_saved_regs): Remove function. (x86_64_push_arguments): Make static. Change to accept a regcache as argument. (x86_64_store_return_value, x86_64_extract_return_value): Make static. Rewrite based on i386 counterparts. (x86_64_push_dummy_call): New function. (X86_64_NUM_SAVED_REGS): New define. (x86_64_register_number): Remove function. (x86_64_store_struct_return): Remove function. (x86_64_frameless_function_invocation, x86_64_function_has_prologue): Remove functions. (PROLOG_BUFSIZE): Remove define. (struct x86_64_frame_cache): New structure. (x86_64_alloc_frame_cache, x86_64_analyze_prologue, x86_64_frame_cache, x86_64_frame_this_id, x86_64_frame_prev_register, x86_64_frame_p, x86_64_sigtramp_frame_cache, x86_64_sigtramp_frame_this_id, x86_64_sigtramp_frame_prev_register, x86_sigtramp_frame_p): New functions. (x86_64_frame_unwind, x86_64_sigtramp_frame_unwind): New variables. (x86_64_skip_prologue): Rewrite in terms of x86_64_analyze_prologue. (x86_64_frame_base_address): New function. (x86_64_frame_base): New variable. (x86_64_save_dummy_frame_tos, x86_64_unwind_dummy_id): Rewrite. (x86_64_init_abi): Set register_type and push_dummy_call. Don't set deprecated_fp_regnum, deprecated_register_size, deprecated_register_bytes, register_raw_size, register_byte, register_virtual_type, register_convertiable, register_convert_to_virtual, convert_to_raw, deprecated_get_saved_register, deprecated_target_read_fp, deprecated_push_arguments, deprecated_push_return_address, deprecated_pop_frame, deprecated_store_struct_return, deprecated_frame_init_saved_regs, deprecated_frame_chain, frameless_function_invocation, deprecated_frame_saved_pc, deprecated_saved_pc_after_call, frame_num_args, pc_in_sigtramp, dwarf2_build_frame_info, deprecated_init_extra_frame_info, deprecated_init_frame_pc and virtual_frame_pointer. Call frame_unwind_append_predicate to register x86_64_sigtramp_frame_p and x86_64_frame_p. Call frame_base_set_default to register x86_64_frame_base. (I387_FISEG_REGNUM, I387_FOSEG_REGNUM): New defines. (x86_64_supply_fxsave, x86_64_fill_fxsave): New functions. (_initialize_x86_64_tdep): Remove function. * x86-64-linux-tdep.c: Don't include "dwarf2cfi.h". (LINUX_SIGINFO_SIZE, LINUX_UCONTEXT_SIGCONTEXT_OFFSET, LINUX_SIGCONTEXT_PC_OFFSET, LINUX_SIGCONTEXT_FP_OFFSET): Don't define. (X86_64_LINUX_UCONTEXT_SIGCONTEXT_OFFSET): Define. (x86_64_linux_sigcontext_addr): Rewrite. (x86_64_linux_sigtramp_saved_pc, x86_64_linux_saved_pc_after_call, x86_64_linux_frame_saved_pc): Remove functions. (x86_64_linux_pc_in_sigtramp): Renamed from x86_64_linux_in_sigtramp. Try harder to recognize a signal trampoline. (x86_64_linux_frame_chain, x86_64_init_frame_pc): Remove_functions. (x86_64_linux_init_abi): Set pc_in_sigtramp. Initialize TDEP->sigcontext_addr, TDEP->sc_pc_offset and TDEP->sc_sp_offset. * x86-64-linux-nat.c: Sync with i386-linux-tdep.c. (x86_64_regmap): Rename to regmap. (GETREGS_SUPPLIES): Use X86_64_NUM_GREGS instead of x86_64_num_gregs. (supply_gregset, fill_gregset): Likewise. Use regmap instead of x86_64_regmap. (x86_64_fxsave_offset): Remove function. (supply_fpregset): Simply call x86_64_supply_fxsave. (fill_fpregset): Simply call x86_64_fill_fxsave. (fetch_inferior_registers, store_inferior_registers): Avoid asignment in if-statement. (LINUX_SYSCALL_LEN, LINUX_SYSCALL_REGNUM, SYS_Sigreturn, SYS_rt_sigreturn, LINUX_SIGCONTEXT_EFLAGS_OFFSET, LINUX_UCONTEXT_SIGCONTEXT_OFFSET): Remove defines. (fetch_core_registers): Remove function. (linux_elf_core_fns): Remove. (offsetoff): Don't define. (_initialize_x86_64_linux_nat, kernel_u_size): Remove functions. * config/i386/x86-64linux.mt (TDEPFILES): Add i386-linux-tdep.o. * config/i386/x86-64linux.mh (NATDEPFILES): Remove core-aout.o, add core-regset.o. * config/i386/nm-x86-64linux.h: Use NM_X86_64_LINUX_H for protection against multiple includes instead of NM_X86_64_h. Add various comments. Include "config/nm-linux.h". Don't include <signal.h>. (REGISTER_U_ADDR, KERNEL_U_SIZE, U_REGS_OFFSET, KERN_U_ADDR, GET_THREAD_SIGNALS): Remove defines. (x86_64_register_u_addr, kernel_u_size, lin_thread_get_thread_signals): Remove prototypes. (PTRACE_ARG3_TYPE, PTRACE_XFER_TYPE): Define to `long'. [HAVE_LINK_H]: Don't include "solib.h". [HAVE_LINK_H] (SVR4_SHARED_LIBS): Remove define. * config/i386/tm-x86-64linux.h: Fix comments. * Makefile.in (x86-64-linux-nat.o, x86_64-linux-tdep.o, x86-64-tdep.o): Update dependencies.
2003-05-31 10:15:38 +02:00
errno = 0;
* linux-nat.c (linux_nat_new_thread): New variable. (linux_child_follow_fork): Set inferior_ptid to include LWP ID. Use linux_nat_switch_fork. (lwp_list): Make public. (add_lwp): Call linux_nat_new_thread. (lin_lwp_attach_lwp, linux_nat_attach): Call add_lwp after stopping the new thread. (resume_callback): Clear lp->siginfo. Remove unused variable. (linux_nat_resume): Assert that the LWP list is already initialized. Clear lp->siginfo. (save_siginfo): New. (stop_wait_callback, linux_nat_wait): Call it. (linux_nat_set_new_thread, linux_nat_get_siginfo): New. * linux-nat.h (struct lwp_info): Add siginfo. (lwp_list, linux_nat_set_new_thread, linux_nat_get_siginfo): Declare. (ALL_LWPS): Define. * amd64-linux-nat.c (amd64_linux_dr): New. (amd64_linux_dr_get): Take a PTID argument. Correct typo. (amd64_linux_dr_set): Take a PTID argument. (amd64_linux_dr_set_control, amd64_linux_dr_set_addr): Use ALL_LWPS. (amd64_linux_dr_reset_addr): Use amd64_linux_dr_set_addr. (amd64_linux_dr_get_status): Pass inferior_ptid to amd64_linux_dr_get. (amd64_linux_new_thread): New. (_initialize_amd64_linux_nat): Call linux_nat_set_new_thread. * i386-linux-nat.c (i386_linux_dr): New. (i386_linux_dr_get, i386_linux_dr_set): Take a PTID argument. (i386_linux_dr_set_control, i386_linux_dr_set_addr): Use ALL_LWPS. (i386_linux_dr_reset_addr): Use i386_linux_dr_set_addr. (i386_linux_dr_get_status): Pass inferior_ptid to i386_linux_dr_get. (i386_linux_new_thread): New. (i386_linux_resume): Remove unnecessary PID check. (_initialize_i386_linux_nat): Call linux_nat_set_new_thread. * ia64-linux-nat.c (enable_watchpoints_in_psr): Take PTID argument. (fetch_debug_register, fetch_debug_register_pair): Delete. (debug_registers): New. (ia64_linux_insert_watchpoint, ia64_linux_remove_watchpoint): Use ALL_LWPS and debug_registers. (ia64_linux_new_thread): New. (ia64_linux_stopped_data_address): Use linux_nat_get_siginfo. (_initialize_ia64_linux_nat): Call linux_nat_set_new_thread. * ppc-linux-nat.c (last_stopped_data_address): Delete. (saved_dabr_value): New. (ppc_linux_insert_watchpoint, ppc_linux_remove_watchpoint): Use ALL_LWPS. (ppc_linux_new_thread): New. (ppc_linux_stopped_data_address): Use linux_nat_get_siginfo. (ppc_linux_stopped_by_watchpoint): Call ppc_linux_stopped_data_address. (_initialize_ppc_linux_nat): Call linux_nat_set_new_thread. * s390-nat.c (s390_stopped_by_watchpoint): Clear the watchpoint status after reading it. (s390_fix_watch_points): Take a PTID argument. (s390_insert_watchpoint, s390_remove_watchpoint): Use ALL_LWPS. (_initialize_s390_nat): Call linux_nat_set_new_thread.
2007-10-01 02:22:50 +02:00
ptrace (PTRACE_POKEUSER, tid,
offsetof (struct user, u_debugreg[regnum]), value);
* x86-64-tdep.h (x86_64_num_regs, x86_64_num_gregs): Remove variable declarations. (x86_64_register_number, x86_64_register_name): Remove prototypes. (x86_64_linux_frame_saved_pc, x86_64_linux+saved_pc_after_call, x86_64_linux_in_sigtramp, x86_64_linux_frame_chain, x86_64_init_frame_pc, x86_64_init_frame_pc, x86_64_function_has_prologue): Remove prototypes. (X86_64_NUM_GREGS): New define. (x86_64_supply_fxsave, x86_64_fill_fxsave): New prototypes. * x86-64-tdep.c: Don't include "dwarf2cfi.h". Include "dummy_frame.h", "frame.h", "frame-base.h", "frame-unwind.h". (RAX_REGNUM, RDX_REGNUM, RDI_REGNUM, EFLAGS_REGNUM, ST0_REGNUM, XMM1_REGNUM): Remove defines. (X86_64_RAX_REGNUM, X86_64_RDX_REGNUM, X86_64_RDI_REGNUM, X86_64_RBP_REGNUM, X86_64_RSP_REGNUM, X86_64_RIP_REGNUM, X86_64_EFLAGS_REGNUM, X86_64_ST0_REGNUM, X86_64_XMM0_REGNUM, X86_64_XMM1_REGNUM): New defines. (struct x86_64_register_info): Renamed from `struct register_info'. Remove `size' member. (x86_64_register_info_table): Remove variable. (x86_64_register_info): New variable. (X86_64_NUM_REGS): New define. (X86_64_NUM_GREGS): Remove define. (x86_64_num_regs, x86_64_num_gregs): Remove variables. (x86_64_dwarf2gdb_regno_map, x86_64_dwarf2gdb_regno_map_length): Remove variables. (x86_54_dwarf2_reg_to_regnum): Remove function. (x86_64_dwarf_regmap, x86_64_dwarf_regmap_len): New variables. (x86_64_dwarf_reg_to_regnum): New function. (x86_64_register_name): Rewrite. (x86_64_register_raw_size): Remove function. (x86_64_register_byte_table): Remove variable. (x86_64_register_byte): Remove function. (x86_64_register_virtual_type): Remove function. (x86_64_register_type): New function. (x86_64_register_convertible, x86_64_register_convert_to_virtual, x86_64_register_convert_to_raw): Remove functions. (x86_64_push_return_address, x86_64_pop_frame): Remove functon. (x86_64_use_struct_convention): Make static. Adjust for renamed defines. (x86_64_frame_init_saved_regs): Remove function. (x86_64_push_arguments): Make static. Change to accept a regcache as argument. (x86_64_store_return_value, x86_64_extract_return_value): Make static. Rewrite based on i386 counterparts. (x86_64_push_dummy_call): New function. (X86_64_NUM_SAVED_REGS): New define. (x86_64_register_number): Remove function. (x86_64_store_struct_return): Remove function. (x86_64_frameless_function_invocation, x86_64_function_has_prologue): Remove functions. (PROLOG_BUFSIZE): Remove define. (struct x86_64_frame_cache): New structure. (x86_64_alloc_frame_cache, x86_64_analyze_prologue, x86_64_frame_cache, x86_64_frame_this_id, x86_64_frame_prev_register, x86_64_frame_p, x86_64_sigtramp_frame_cache, x86_64_sigtramp_frame_this_id, x86_64_sigtramp_frame_prev_register, x86_sigtramp_frame_p): New functions. (x86_64_frame_unwind, x86_64_sigtramp_frame_unwind): New variables. (x86_64_skip_prologue): Rewrite in terms of x86_64_analyze_prologue. (x86_64_frame_base_address): New function. (x86_64_frame_base): New variable. (x86_64_save_dummy_frame_tos, x86_64_unwind_dummy_id): Rewrite. (x86_64_init_abi): Set register_type and push_dummy_call. Don't set deprecated_fp_regnum, deprecated_register_size, deprecated_register_bytes, register_raw_size, register_byte, register_virtual_type, register_convertiable, register_convert_to_virtual, convert_to_raw, deprecated_get_saved_register, deprecated_target_read_fp, deprecated_push_arguments, deprecated_push_return_address, deprecated_pop_frame, deprecated_store_struct_return, deprecated_frame_init_saved_regs, deprecated_frame_chain, frameless_function_invocation, deprecated_frame_saved_pc, deprecated_saved_pc_after_call, frame_num_args, pc_in_sigtramp, dwarf2_build_frame_info, deprecated_init_extra_frame_info, deprecated_init_frame_pc and virtual_frame_pointer. Call frame_unwind_append_predicate to register x86_64_sigtramp_frame_p and x86_64_frame_p. Call frame_base_set_default to register x86_64_frame_base. (I387_FISEG_REGNUM, I387_FOSEG_REGNUM): New defines. (x86_64_supply_fxsave, x86_64_fill_fxsave): New functions. (_initialize_x86_64_tdep): Remove function. * x86-64-linux-tdep.c: Don't include "dwarf2cfi.h". (LINUX_SIGINFO_SIZE, LINUX_UCONTEXT_SIGCONTEXT_OFFSET, LINUX_SIGCONTEXT_PC_OFFSET, LINUX_SIGCONTEXT_FP_OFFSET): Don't define. (X86_64_LINUX_UCONTEXT_SIGCONTEXT_OFFSET): Define. (x86_64_linux_sigcontext_addr): Rewrite. (x86_64_linux_sigtramp_saved_pc, x86_64_linux_saved_pc_after_call, x86_64_linux_frame_saved_pc): Remove functions. (x86_64_linux_pc_in_sigtramp): Renamed from x86_64_linux_in_sigtramp. Try harder to recognize a signal trampoline. (x86_64_linux_frame_chain, x86_64_init_frame_pc): Remove_functions. (x86_64_linux_init_abi): Set pc_in_sigtramp. Initialize TDEP->sigcontext_addr, TDEP->sc_pc_offset and TDEP->sc_sp_offset. * x86-64-linux-nat.c: Sync with i386-linux-tdep.c. (x86_64_regmap): Rename to regmap. (GETREGS_SUPPLIES): Use X86_64_NUM_GREGS instead of x86_64_num_gregs. (supply_gregset, fill_gregset): Likewise. Use regmap instead of x86_64_regmap. (x86_64_fxsave_offset): Remove function. (supply_fpregset): Simply call x86_64_supply_fxsave. (fill_fpregset): Simply call x86_64_fill_fxsave. (fetch_inferior_registers, store_inferior_registers): Avoid asignment in if-statement. (LINUX_SYSCALL_LEN, LINUX_SYSCALL_REGNUM, SYS_Sigreturn, SYS_rt_sigreturn, LINUX_SIGCONTEXT_EFLAGS_OFFSET, LINUX_UCONTEXT_SIGCONTEXT_OFFSET): Remove defines. (fetch_core_registers): Remove function. (linux_elf_core_fns): Remove. (offsetoff): Don't define. (_initialize_x86_64_linux_nat, kernel_u_size): Remove functions. * config/i386/x86-64linux.mt (TDEPFILES): Add i386-linux-tdep.o. * config/i386/x86-64linux.mh (NATDEPFILES): Remove core-aout.o, add core-regset.o. * config/i386/nm-x86-64linux.h: Use NM_X86_64_LINUX_H for protection against multiple includes instead of NM_X86_64_h. Add various comments. Include "config/nm-linux.h". Don't include <signal.h>. (REGISTER_U_ADDR, KERNEL_U_SIZE, U_REGS_OFFSET, KERN_U_ADDR, GET_THREAD_SIGNALS): Remove defines. (x86_64_register_u_addr, kernel_u_size, lin_thread_get_thread_signals): Remove prototypes. (PTRACE_ARG3_TYPE, PTRACE_XFER_TYPE): Define to `long'. [HAVE_LINK_H]: Don't include "solib.h". [HAVE_LINK_H] (SVR4_SHARED_LIBS): Remove define. * config/i386/tm-x86-64linux.h: Fix comments. * Makefile.in (x86-64-linux-nat.o, x86_64-linux-tdep.o, x86-64-tdep.o): Update dependencies.
2003-05-31 10:15:38 +02:00
if (errno != 0)
perror_with_name (_("Couldn't write debug register"));
* x86-64-tdep.h (x86_64_num_regs, x86_64_num_gregs): Remove variable declarations. (x86_64_register_number, x86_64_register_name): Remove prototypes. (x86_64_linux_frame_saved_pc, x86_64_linux+saved_pc_after_call, x86_64_linux_in_sigtramp, x86_64_linux_frame_chain, x86_64_init_frame_pc, x86_64_init_frame_pc, x86_64_function_has_prologue): Remove prototypes. (X86_64_NUM_GREGS): New define. (x86_64_supply_fxsave, x86_64_fill_fxsave): New prototypes. * x86-64-tdep.c: Don't include "dwarf2cfi.h". Include "dummy_frame.h", "frame.h", "frame-base.h", "frame-unwind.h". (RAX_REGNUM, RDX_REGNUM, RDI_REGNUM, EFLAGS_REGNUM, ST0_REGNUM, XMM1_REGNUM): Remove defines. (X86_64_RAX_REGNUM, X86_64_RDX_REGNUM, X86_64_RDI_REGNUM, X86_64_RBP_REGNUM, X86_64_RSP_REGNUM, X86_64_RIP_REGNUM, X86_64_EFLAGS_REGNUM, X86_64_ST0_REGNUM, X86_64_XMM0_REGNUM, X86_64_XMM1_REGNUM): New defines. (struct x86_64_register_info): Renamed from `struct register_info'. Remove `size' member. (x86_64_register_info_table): Remove variable. (x86_64_register_info): New variable. (X86_64_NUM_REGS): New define. (X86_64_NUM_GREGS): Remove define. (x86_64_num_regs, x86_64_num_gregs): Remove variables. (x86_64_dwarf2gdb_regno_map, x86_64_dwarf2gdb_regno_map_length): Remove variables. (x86_54_dwarf2_reg_to_regnum): Remove function. (x86_64_dwarf_regmap, x86_64_dwarf_regmap_len): New variables. (x86_64_dwarf_reg_to_regnum): New function. (x86_64_register_name): Rewrite. (x86_64_register_raw_size): Remove function. (x86_64_register_byte_table): Remove variable. (x86_64_register_byte): Remove function. (x86_64_register_virtual_type): Remove function. (x86_64_register_type): New function. (x86_64_register_convertible, x86_64_register_convert_to_virtual, x86_64_register_convert_to_raw): Remove functions. (x86_64_push_return_address, x86_64_pop_frame): Remove functon. (x86_64_use_struct_convention): Make static. Adjust for renamed defines. (x86_64_frame_init_saved_regs): Remove function. (x86_64_push_arguments): Make static. Change to accept a regcache as argument. (x86_64_store_return_value, x86_64_extract_return_value): Make static. Rewrite based on i386 counterparts. (x86_64_push_dummy_call): New function. (X86_64_NUM_SAVED_REGS): New define. (x86_64_register_number): Remove function. (x86_64_store_struct_return): Remove function. (x86_64_frameless_function_invocation, x86_64_function_has_prologue): Remove functions. (PROLOG_BUFSIZE): Remove define. (struct x86_64_frame_cache): New structure. (x86_64_alloc_frame_cache, x86_64_analyze_prologue, x86_64_frame_cache, x86_64_frame_this_id, x86_64_frame_prev_register, x86_64_frame_p, x86_64_sigtramp_frame_cache, x86_64_sigtramp_frame_this_id, x86_64_sigtramp_frame_prev_register, x86_sigtramp_frame_p): New functions. (x86_64_frame_unwind, x86_64_sigtramp_frame_unwind): New variables. (x86_64_skip_prologue): Rewrite in terms of x86_64_analyze_prologue. (x86_64_frame_base_address): New function. (x86_64_frame_base): New variable. (x86_64_save_dummy_frame_tos, x86_64_unwind_dummy_id): Rewrite. (x86_64_init_abi): Set register_type and push_dummy_call. Don't set deprecated_fp_regnum, deprecated_register_size, deprecated_register_bytes, register_raw_size, register_byte, register_virtual_type, register_convertiable, register_convert_to_virtual, convert_to_raw, deprecated_get_saved_register, deprecated_target_read_fp, deprecated_push_arguments, deprecated_push_return_address, deprecated_pop_frame, deprecated_store_struct_return, deprecated_frame_init_saved_regs, deprecated_frame_chain, frameless_function_invocation, deprecated_frame_saved_pc, deprecated_saved_pc_after_call, frame_num_args, pc_in_sigtramp, dwarf2_build_frame_info, deprecated_init_extra_frame_info, deprecated_init_frame_pc and virtual_frame_pointer. Call frame_unwind_append_predicate to register x86_64_sigtramp_frame_p and x86_64_frame_p. Call frame_base_set_default to register x86_64_frame_base. (I387_FISEG_REGNUM, I387_FOSEG_REGNUM): New defines. (x86_64_supply_fxsave, x86_64_fill_fxsave): New functions. (_initialize_x86_64_tdep): Remove function. * x86-64-linux-tdep.c: Don't include "dwarf2cfi.h". (LINUX_SIGINFO_SIZE, LINUX_UCONTEXT_SIGCONTEXT_OFFSET, LINUX_SIGCONTEXT_PC_OFFSET, LINUX_SIGCONTEXT_FP_OFFSET): Don't define. (X86_64_LINUX_UCONTEXT_SIGCONTEXT_OFFSET): Define. (x86_64_linux_sigcontext_addr): Rewrite. (x86_64_linux_sigtramp_saved_pc, x86_64_linux_saved_pc_after_call, x86_64_linux_frame_saved_pc): Remove functions. (x86_64_linux_pc_in_sigtramp): Renamed from x86_64_linux_in_sigtramp. Try harder to recognize a signal trampoline. (x86_64_linux_frame_chain, x86_64_init_frame_pc): Remove_functions. (x86_64_linux_init_abi): Set pc_in_sigtramp. Initialize TDEP->sigcontext_addr, TDEP->sc_pc_offset and TDEP->sc_sp_offset. * x86-64-linux-nat.c: Sync with i386-linux-tdep.c. (x86_64_regmap): Rename to regmap. (GETREGS_SUPPLIES): Use X86_64_NUM_GREGS instead of x86_64_num_gregs. (supply_gregset, fill_gregset): Likewise. Use regmap instead of x86_64_regmap. (x86_64_fxsave_offset): Remove function. (supply_fpregset): Simply call x86_64_supply_fxsave. (fill_fpregset): Simply call x86_64_fill_fxsave. (fetch_inferior_registers, store_inferior_registers): Avoid asignment in if-statement. (LINUX_SYSCALL_LEN, LINUX_SYSCALL_REGNUM, SYS_Sigreturn, SYS_rt_sigreturn, LINUX_SIGCONTEXT_EFLAGS_OFFSET, LINUX_UCONTEXT_SIGCONTEXT_OFFSET): Remove defines. (fetch_core_registers): Remove function. (linux_elf_core_fns): Remove. (offsetoff): Don't define. (_initialize_x86_64_linux_nat, kernel_u_size): Remove functions. * config/i386/x86-64linux.mt (TDEPFILES): Add i386-linux-tdep.o. * config/i386/x86-64linux.mh (NATDEPFILES): Remove core-aout.o, add core-regset.o. * config/i386/nm-x86-64linux.h: Use NM_X86_64_LINUX_H for protection against multiple includes instead of NM_X86_64_h. Add various comments. Include "config/nm-linux.h". Don't include <signal.h>. (REGISTER_U_ADDR, KERNEL_U_SIZE, U_REGS_OFFSET, KERN_U_ADDR, GET_THREAD_SIGNALS): Remove defines. (x86_64_register_u_addr, kernel_u_size, lin_thread_get_thread_signals): Remove prototypes. (PTRACE_ARG3_TYPE, PTRACE_XFER_TYPE): Define to `long'. [HAVE_LINK_H]: Don't include "solib.h". [HAVE_LINK_H] (SVR4_SHARED_LIBS): Remove define. * config/i386/tm-x86-64linux.h: Fix comments. * Makefile.in (x86-64-linux-nat.o, x86_64-linux-tdep.o, x86-64-tdep.o): Update dependencies.
2003-05-31 10:15:38 +02:00
}
gdb/ 2011-12-14 Pedro Alves <pedro@codesourcery.com> PR threads/10729 * linux-nat.c (linux_nat_new_thread): Change parameter to an lwp pointer. (linux_nat_prepare_to_resume): New global. (lwp_free): New. (purge_lwp_list): Use it. (add_lwp): Call linux_nat_new_thread even on the first LWP. Adjust to interface change. (delete_lwp): Call lwp_free instead of xfree. (detach_callback, linux_nat_detach, resume_lwp, linux_nat_resume) (linux_handle_syscall_trap, linux_handle_extended_wait) (linux_nat_filter_event, resume_stopped_resumed_lwps): Call linux_nat_prepare_to_resume before resuming. (linux_stop_lwp): New. (linux_nat_set_new_thread): Adjust. (linux_nat_set_prepare_to_resume): New. * linux-nat.h (struct arch_lwp_info): Forward declare. (struct lwp_info) <arch_private>: New field. (linux_stop_lwp): Declare. (linux_nat_set_new_thread): Adjust. (linux_nat_set_prepare_to_resume): New. * i386-nat.c (DR_NADDR, DR_STATUS, DR_CONTROL) (struct i386_debug_reg_state): Move to i386-nat.h. (dr_mirror): Comment. (i386_debug_reg_state): New. (i386_update_inferior_debug_regs): Simplify. (i386_stopped_data_address): Use the debug register state from the inferior, not from the local cache. * i386-nat.h (struct i386_dr_low_type): Delete reset_addr and unset_status fields. New get_addr and get_control fields. (DR_FIRSTADDR, DR_LASTADDR, DR_CONTROL): Moved from i386-nat.c. (DR_NADDR, DR_STATUS): New. (struct i386_debug_reg_state): Moved from i386-nat.c. * amd64-linux-nat.c (struct arch_lwp_info): New. (amd64_linux_dr): Delete global. (amd64_linux_dr_get_addr): New. (amd64_linux_dr_get_control): New. (amd64_linux_dr_unset_status): Delete. (amd64_linux_dr_set_addr): Reimplement. (amd64_linux_dr_reset_addr): Delete. (update_debug_registers_callback): New. (amd64_linux_dr_set_control): Reimplement. (amd64_linux_dr_set_addr): Reimplement. (amd64_linux_prepare_to_resume): New. (amd64_linux_new_thread): Change parameter to an lwp pointer. Reimplement. (_initialize_amd64_linux_nat): No longer install i386_dr_low.reset_addr and i386_dr_low.unset_status. Install amd64_linux_dr_get_control as i386_dr_low.get_control. Install amd64_linux_dr_get_addr as i386_dr_low.get_addr. Install amd64_linux_prepare_to_resume. * i386-linux-nat.c (DR_FIRSTADDR, DR_LASTADDR, DR_STATUS) (DR_CONTROL): Delete. (struct arch_lwp_info): New. (i386_linux_dr): Delete global. (i386_linux_dr_set_control): Reimplement. (i386_linux_dr_get_addr): New. (i386_linux_dr_set_addr): Reimplement. (i386_linux_dr_get_control): New. (update_debug_registers_callback): New. (i386_linux_dr_unset_status): Delete. (i386_linux_dr_set_addr): Reimplement. (i386_linux_prepare_to_resume): New. (i386_linux_new_thread): Change parameter to an lwp pointer. Reimplement. (_initialize_i386_linux_nat): No longer install i386_dr_low.reset_addr and i386_dr_low.unset_status. Install i386_linux_dr_get_control as i386_dr_low.get_control. Install i386_linux_dr_get_addr as i386_dr_low.get_addr. Install i386_linux_prepare_to_resume. * arm-linux-nat.c (arm_linux_new_thread): Change parameter to an lwp pointer. Adjust. * ia64-linux-nat.c (ia64_linux_new_thread): Likewise. * mips-linux-nat.c (mips_linux_new_thread): Likewise. * ppc-linux-nat.c (ppc_linux_new_thread): Likewise. * s390-nat.c (s390_fix_watch_points): Likewise. * i386-darwin-nat.c (DR_FIRSTADDR, DR_LASTADDR, DR_STATUS) (DR_CONTROL): Delete. (i386_darwin_dr_reset_addr): Delete. (i386_darwin_dr_get_addr): New. (i386_darwin_dr_get_control): New. * go32-nat.c (go32_get_dr7, go32_get_dr): New. (init_go32_ops): No longer install i386_dr_low.reset_addr. Install go32_get_dr7 as i386_dr_low.get_control. Install go32_get_dr as i386_dr_low.get_addr. * i386bsd-nat.c (i386bsd_dr_get): New. (i386bsd_dr_reset_addr): Delete. (i386bsd_dr_get_addr): New. (i386bsd_dr_get_status): Use i386bsd_dr_get. (i386bsd_dr_get_control): New. * i386bsd-nat.h (i386bsd_dr_reset_addr): Delete. (i386bsd_dr_get_addr): New. (i386bsd_dr_get_control): New. * i386fbsd-nat.c (_initialize_i386fbsd_nat): No longer install i386_dr_low.reset_addr and i386_dr_low.unset_status. Install i386bsd_dr_get_control as i386_dr_low.get_control. Install i386bsd_dr_get_addr as i386_dr_low.get_addr. * windows-nat.c (init_windows_ops): No longer install i386_dr_low.reset_addr and i386_dr_low.unset_status. Install cygwin_get_dr7 as i386_dr_low.get_control. Install cygwin_get_dr as i386_dr_low.get_addr. (cygwin_get_dr): New. (cygwin_get_dr7): New. gdb/testsuite/ 2011-12-14 Pedro Alves <pedro@codesourcery.com> PR threads/10729 * gdb.mi/watch-nonstop.c: New file. * gdb.mi/mi-watch-nonstop.exp: New file.
2011-12-14 18:20:32 +01:00
/* Return the inferior's debug register REGNUM. */
gdb/ 2011-12-14 Pedro Alves <pedro@codesourcery.com> PR threads/10729 * linux-nat.c (linux_nat_new_thread): Change parameter to an lwp pointer. (linux_nat_prepare_to_resume): New global. (lwp_free): New. (purge_lwp_list): Use it. (add_lwp): Call linux_nat_new_thread even on the first LWP. Adjust to interface change. (delete_lwp): Call lwp_free instead of xfree. (detach_callback, linux_nat_detach, resume_lwp, linux_nat_resume) (linux_handle_syscall_trap, linux_handle_extended_wait) (linux_nat_filter_event, resume_stopped_resumed_lwps): Call linux_nat_prepare_to_resume before resuming. (linux_stop_lwp): New. (linux_nat_set_new_thread): Adjust. (linux_nat_set_prepare_to_resume): New. * linux-nat.h (struct arch_lwp_info): Forward declare. (struct lwp_info) <arch_private>: New field. (linux_stop_lwp): Declare. (linux_nat_set_new_thread): Adjust. (linux_nat_set_prepare_to_resume): New. * i386-nat.c (DR_NADDR, DR_STATUS, DR_CONTROL) (struct i386_debug_reg_state): Move to i386-nat.h. (dr_mirror): Comment. (i386_debug_reg_state): New. (i386_update_inferior_debug_regs): Simplify. (i386_stopped_data_address): Use the debug register state from the inferior, not from the local cache. * i386-nat.h (struct i386_dr_low_type): Delete reset_addr and unset_status fields. New get_addr and get_control fields. (DR_FIRSTADDR, DR_LASTADDR, DR_CONTROL): Moved from i386-nat.c. (DR_NADDR, DR_STATUS): New. (struct i386_debug_reg_state): Moved from i386-nat.c. * amd64-linux-nat.c (struct arch_lwp_info): New. (amd64_linux_dr): Delete global. (amd64_linux_dr_get_addr): New. (amd64_linux_dr_get_control): New. (amd64_linux_dr_unset_status): Delete. (amd64_linux_dr_set_addr): Reimplement. (amd64_linux_dr_reset_addr): Delete. (update_debug_registers_callback): New. (amd64_linux_dr_set_control): Reimplement. (amd64_linux_dr_set_addr): Reimplement. (amd64_linux_prepare_to_resume): New. (amd64_linux_new_thread): Change parameter to an lwp pointer. Reimplement. (_initialize_amd64_linux_nat): No longer install i386_dr_low.reset_addr and i386_dr_low.unset_status. Install amd64_linux_dr_get_control as i386_dr_low.get_control. Install amd64_linux_dr_get_addr as i386_dr_low.get_addr. Install amd64_linux_prepare_to_resume. * i386-linux-nat.c (DR_FIRSTADDR, DR_LASTADDR, DR_STATUS) (DR_CONTROL): Delete. (struct arch_lwp_info): New. (i386_linux_dr): Delete global. (i386_linux_dr_set_control): Reimplement. (i386_linux_dr_get_addr): New. (i386_linux_dr_set_addr): Reimplement. (i386_linux_dr_get_control): New. (update_debug_registers_callback): New. (i386_linux_dr_unset_status): Delete. (i386_linux_dr_set_addr): Reimplement. (i386_linux_prepare_to_resume): New. (i386_linux_new_thread): Change parameter to an lwp pointer. Reimplement. (_initialize_i386_linux_nat): No longer install i386_dr_low.reset_addr and i386_dr_low.unset_status. Install i386_linux_dr_get_control as i386_dr_low.get_control. Install i386_linux_dr_get_addr as i386_dr_low.get_addr. Install i386_linux_prepare_to_resume. * arm-linux-nat.c (arm_linux_new_thread): Change parameter to an lwp pointer. Adjust. * ia64-linux-nat.c (ia64_linux_new_thread): Likewise. * mips-linux-nat.c (mips_linux_new_thread): Likewise. * ppc-linux-nat.c (ppc_linux_new_thread): Likewise. * s390-nat.c (s390_fix_watch_points): Likewise. * i386-darwin-nat.c (DR_FIRSTADDR, DR_LASTADDR, DR_STATUS) (DR_CONTROL): Delete. (i386_darwin_dr_reset_addr): Delete. (i386_darwin_dr_get_addr): New. (i386_darwin_dr_get_control): New. * go32-nat.c (go32_get_dr7, go32_get_dr): New. (init_go32_ops): No longer install i386_dr_low.reset_addr. Install go32_get_dr7 as i386_dr_low.get_control. Install go32_get_dr as i386_dr_low.get_addr. * i386bsd-nat.c (i386bsd_dr_get): New. (i386bsd_dr_reset_addr): Delete. (i386bsd_dr_get_addr): New. (i386bsd_dr_get_status): Use i386bsd_dr_get. (i386bsd_dr_get_control): New. * i386bsd-nat.h (i386bsd_dr_reset_addr): Delete. (i386bsd_dr_get_addr): New. (i386bsd_dr_get_control): New. * i386fbsd-nat.c (_initialize_i386fbsd_nat): No longer install i386_dr_low.reset_addr and i386_dr_low.unset_status. Install i386bsd_dr_get_control as i386_dr_low.get_control. Install i386bsd_dr_get_addr as i386_dr_low.get_addr. * windows-nat.c (init_windows_ops): No longer install i386_dr_low.reset_addr and i386_dr_low.unset_status. Install cygwin_get_dr7 as i386_dr_low.get_control. Install cygwin_get_dr as i386_dr_low.get_addr. (cygwin_get_dr): New. (cygwin_get_dr7): New. gdb/testsuite/ 2011-12-14 Pedro Alves <pedro@codesourcery.com> PR threads/10729 * gdb.mi/watch-nonstop.c: New file. * gdb.mi/mi-watch-nonstop.exp: New file.
2011-12-14 18:20:32 +01:00
static CORE_ADDR
amd64_linux_dr_get_addr (int regnum)
* x86-64-tdep.h (x86_64_num_regs, x86_64_num_gregs): Remove variable declarations. (x86_64_register_number, x86_64_register_name): Remove prototypes. (x86_64_linux_frame_saved_pc, x86_64_linux+saved_pc_after_call, x86_64_linux_in_sigtramp, x86_64_linux_frame_chain, x86_64_init_frame_pc, x86_64_init_frame_pc, x86_64_function_has_prologue): Remove prototypes. (X86_64_NUM_GREGS): New define. (x86_64_supply_fxsave, x86_64_fill_fxsave): New prototypes. * x86-64-tdep.c: Don't include "dwarf2cfi.h". Include "dummy_frame.h", "frame.h", "frame-base.h", "frame-unwind.h". (RAX_REGNUM, RDX_REGNUM, RDI_REGNUM, EFLAGS_REGNUM, ST0_REGNUM, XMM1_REGNUM): Remove defines. (X86_64_RAX_REGNUM, X86_64_RDX_REGNUM, X86_64_RDI_REGNUM, X86_64_RBP_REGNUM, X86_64_RSP_REGNUM, X86_64_RIP_REGNUM, X86_64_EFLAGS_REGNUM, X86_64_ST0_REGNUM, X86_64_XMM0_REGNUM, X86_64_XMM1_REGNUM): New defines. (struct x86_64_register_info): Renamed from `struct register_info'. Remove `size' member. (x86_64_register_info_table): Remove variable. (x86_64_register_info): New variable. (X86_64_NUM_REGS): New define. (X86_64_NUM_GREGS): Remove define. (x86_64_num_regs, x86_64_num_gregs): Remove variables. (x86_64_dwarf2gdb_regno_map, x86_64_dwarf2gdb_regno_map_length): Remove variables. (x86_54_dwarf2_reg_to_regnum): Remove function. (x86_64_dwarf_regmap, x86_64_dwarf_regmap_len): New variables. (x86_64_dwarf_reg_to_regnum): New function. (x86_64_register_name): Rewrite. (x86_64_register_raw_size): Remove function. (x86_64_register_byte_table): Remove variable. (x86_64_register_byte): Remove function. (x86_64_register_virtual_type): Remove function. (x86_64_register_type): New function. (x86_64_register_convertible, x86_64_register_convert_to_virtual, x86_64_register_convert_to_raw): Remove functions. (x86_64_push_return_address, x86_64_pop_frame): Remove functon. (x86_64_use_struct_convention): Make static. Adjust for renamed defines. (x86_64_frame_init_saved_regs): Remove function. (x86_64_push_arguments): Make static. Change to accept a regcache as argument. (x86_64_store_return_value, x86_64_extract_return_value): Make static. Rewrite based on i386 counterparts. (x86_64_push_dummy_call): New function. (X86_64_NUM_SAVED_REGS): New define. (x86_64_register_number): Remove function. (x86_64_store_struct_return): Remove function. (x86_64_frameless_function_invocation, x86_64_function_has_prologue): Remove functions. (PROLOG_BUFSIZE): Remove define. (struct x86_64_frame_cache): New structure. (x86_64_alloc_frame_cache, x86_64_analyze_prologue, x86_64_frame_cache, x86_64_frame_this_id, x86_64_frame_prev_register, x86_64_frame_p, x86_64_sigtramp_frame_cache, x86_64_sigtramp_frame_this_id, x86_64_sigtramp_frame_prev_register, x86_sigtramp_frame_p): New functions. (x86_64_frame_unwind, x86_64_sigtramp_frame_unwind): New variables. (x86_64_skip_prologue): Rewrite in terms of x86_64_analyze_prologue. (x86_64_frame_base_address): New function. (x86_64_frame_base): New variable. (x86_64_save_dummy_frame_tos, x86_64_unwind_dummy_id): Rewrite. (x86_64_init_abi): Set register_type and push_dummy_call. Don't set deprecated_fp_regnum, deprecated_register_size, deprecated_register_bytes, register_raw_size, register_byte, register_virtual_type, register_convertiable, register_convert_to_virtual, convert_to_raw, deprecated_get_saved_register, deprecated_target_read_fp, deprecated_push_arguments, deprecated_push_return_address, deprecated_pop_frame, deprecated_store_struct_return, deprecated_frame_init_saved_regs, deprecated_frame_chain, frameless_function_invocation, deprecated_frame_saved_pc, deprecated_saved_pc_after_call, frame_num_args, pc_in_sigtramp, dwarf2_build_frame_info, deprecated_init_extra_frame_info, deprecated_init_frame_pc and virtual_frame_pointer. Call frame_unwind_append_predicate to register x86_64_sigtramp_frame_p and x86_64_frame_p. Call frame_base_set_default to register x86_64_frame_base. (I387_FISEG_REGNUM, I387_FOSEG_REGNUM): New defines. (x86_64_supply_fxsave, x86_64_fill_fxsave): New functions. (_initialize_x86_64_tdep): Remove function. * x86-64-linux-tdep.c: Don't include "dwarf2cfi.h". (LINUX_SIGINFO_SIZE, LINUX_UCONTEXT_SIGCONTEXT_OFFSET, LINUX_SIGCONTEXT_PC_OFFSET, LINUX_SIGCONTEXT_FP_OFFSET): Don't define. (X86_64_LINUX_UCONTEXT_SIGCONTEXT_OFFSET): Define. (x86_64_linux_sigcontext_addr): Rewrite. (x86_64_linux_sigtramp_saved_pc, x86_64_linux_saved_pc_after_call, x86_64_linux_frame_saved_pc): Remove functions. (x86_64_linux_pc_in_sigtramp): Renamed from x86_64_linux_in_sigtramp. Try harder to recognize a signal trampoline. (x86_64_linux_frame_chain, x86_64_init_frame_pc): Remove_functions. (x86_64_linux_init_abi): Set pc_in_sigtramp. Initialize TDEP->sigcontext_addr, TDEP->sc_pc_offset and TDEP->sc_sp_offset. * x86-64-linux-nat.c: Sync with i386-linux-tdep.c. (x86_64_regmap): Rename to regmap. (GETREGS_SUPPLIES): Use X86_64_NUM_GREGS instead of x86_64_num_gregs. (supply_gregset, fill_gregset): Likewise. Use regmap instead of x86_64_regmap. (x86_64_fxsave_offset): Remove function. (supply_fpregset): Simply call x86_64_supply_fxsave. (fill_fpregset): Simply call x86_64_fill_fxsave. (fetch_inferior_registers, store_inferior_registers): Avoid asignment in if-statement. (LINUX_SYSCALL_LEN, LINUX_SYSCALL_REGNUM, SYS_Sigreturn, SYS_rt_sigreturn, LINUX_SIGCONTEXT_EFLAGS_OFFSET, LINUX_UCONTEXT_SIGCONTEXT_OFFSET): Remove defines. (fetch_core_registers): Remove function. (linux_elf_core_fns): Remove. (offsetoff): Don't define. (_initialize_x86_64_linux_nat, kernel_u_size): Remove functions. * config/i386/x86-64linux.mt (TDEPFILES): Add i386-linux-tdep.o. * config/i386/x86-64linux.mh (NATDEPFILES): Remove core-aout.o, add core-regset.o. * config/i386/nm-x86-64linux.h: Use NM_X86_64_LINUX_H for protection against multiple includes instead of NM_X86_64_h. Add various comments. Include "config/nm-linux.h". Don't include <signal.h>. (REGISTER_U_ADDR, KERNEL_U_SIZE, U_REGS_OFFSET, KERN_U_ADDR, GET_THREAD_SIGNALS): Remove defines. (x86_64_register_u_addr, kernel_u_size, lin_thread_get_thread_signals): Remove prototypes. (PTRACE_ARG3_TYPE, PTRACE_XFER_TYPE): Define to `long'. [HAVE_LINK_H]: Don't include "solib.h". [HAVE_LINK_H] (SVR4_SHARED_LIBS): Remove define. * config/i386/tm-x86-64linux.h: Fix comments. * Makefile.in (x86-64-linux-nat.o, x86_64-linux-tdep.o, x86-64-tdep.o): Update dependencies.
2003-05-31 10:15:38 +02:00
{
gdb/ 2011-12-14 Pedro Alves <pedro@codesourcery.com> PR threads/10729 * linux-nat.c (linux_nat_new_thread): Change parameter to an lwp pointer. (linux_nat_prepare_to_resume): New global. (lwp_free): New. (purge_lwp_list): Use it. (add_lwp): Call linux_nat_new_thread even on the first LWP. Adjust to interface change. (delete_lwp): Call lwp_free instead of xfree. (detach_callback, linux_nat_detach, resume_lwp, linux_nat_resume) (linux_handle_syscall_trap, linux_handle_extended_wait) (linux_nat_filter_event, resume_stopped_resumed_lwps): Call linux_nat_prepare_to_resume before resuming. (linux_stop_lwp): New. (linux_nat_set_new_thread): Adjust. (linux_nat_set_prepare_to_resume): New. * linux-nat.h (struct arch_lwp_info): Forward declare. (struct lwp_info) <arch_private>: New field. (linux_stop_lwp): Declare. (linux_nat_set_new_thread): Adjust. (linux_nat_set_prepare_to_resume): New. * i386-nat.c (DR_NADDR, DR_STATUS, DR_CONTROL) (struct i386_debug_reg_state): Move to i386-nat.h. (dr_mirror): Comment. (i386_debug_reg_state): New. (i386_update_inferior_debug_regs): Simplify. (i386_stopped_data_address): Use the debug register state from the inferior, not from the local cache. * i386-nat.h (struct i386_dr_low_type): Delete reset_addr and unset_status fields. New get_addr and get_control fields. (DR_FIRSTADDR, DR_LASTADDR, DR_CONTROL): Moved from i386-nat.c. (DR_NADDR, DR_STATUS): New. (struct i386_debug_reg_state): Moved from i386-nat.c. * amd64-linux-nat.c (struct arch_lwp_info): New. (amd64_linux_dr): Delete global. (amd64_linux_dr_get_addr): New. (amd64_linux_dr_get_control): New. (amd64_linux_dr_unset_status): Delete. (amd64_linux_dr_set_addr): Reimplement. (amd64_linux_dr_reset_addr): Delete. (update_debug_registers_callback): New. (amd64_linux_dr_set_control): Reimplement. (amd64_linux_dr_set_addr): Reimplement. (amd64_linux_prepare_to_resume): New. (amd64_linux_new_thread): Change parameter to an lwp pointer. Reimplement. (_initialize_amd64_linux_nat): No longer install i386_dr_low.reset_addr and i386_dr_low.unset_status. Install amd64_linux_dr_get_control as i386_dr_low.get_control. Install amd64_linux_dr_get_addr as i386_dr_low.get_addr. Install amd64_linux_prepare_to_resume. * i386-linux-nat.c (DR_FIRSTADDR, DR_LASTADDR, DR_STATUS) (DR_CONTROL): Delete. (struct arch_lwp_info): New. (i386_linux_dr): Delete global. (i386_linux_dr_set_control): Reimplement. (i386_linux_dr_get_addr): New. (i386_linux_dr_set_addr): Reimplement. (i386_linux_dr_get_control): New. (update_debug_registers_callback): New. (i386_linux_dr_unset_status): Delete. (i386_linux_dr_set_addr): Reimplement. (i386_linux_prepare_to_resume): New. (i386_linux_new_thread): Change parameter to an lwp pointer. Reimplement. (_initialize_i386_linux_nat): No longer install i386_dr_low.reset_addr and i386_dr_low.unset_status. Install i386_linux_dr_get_control as i386_dr_low.get_control. Install i386_linux_dr_get_addr as i386_dr_low.get_addr. Install i386_linux_prepare_to_resume. * arm-linux-nat.c (arm_linux_new_thread): Change parameter to an lwp pointer. Adjust. * ia64-linux-nat.c (ia64_linux_new_thread): Likewise. * mips-linux-nat.c (mips_linux_new_thread): Likewise. * ppc-linux-nat.c (ppc_linux_new_thread): Likewise. * s390-nat.c (s390_fix_watch_points): Likewise. * i386-darwin-nat.c (DR_FIRSTADDR, DR_LASTADDR, DR_STATUS) (DR_CONTROL): Delete. (i386_darwin_dr_reset_addr): Delete. (i386_darwin_dr_get_addr): New. (i386_darwin_dr_get_control): New. * go32-nat.c (go32_get_dr7, go32_get_dr): New. (init_go32_ops): No longer install i386_dr_low.reset_addr. Install go32_get_dr7 as i386_dr_low.get_control. Install go32_get_dr as i386_dr_low.get_addr. * i386bsd-nat.c (i386bsd_dr_get): New. (i386bsd_dr_reset_addr): Delete. (i386bsd_dr_get_addr): New. (i386bsd_dr_get_status): Use i386bsd_dr_get. (i386bsd_dr_get_control): New. * i386bsd-nat.h (i386bsd_dr_reset_addr): Delete. (i386bsd_dr_get_addr): New. (i386bsd_dr_get_control): New. * i386fbsd-nat.c (_initialize_i386fbsd_nat): No longer install i386_dr_low.reset_addr and i386_dr_low.unset_status. Install i386bsd_dr_get_control as i386_dr_low.get_control. Install i386bsd_dr_get_addr as i386_dr_low.get_addr. * windows-nat.c (init_windows_ops): No longer install i386_dr_low.reset_addr and i386_dr_low.unset_status. Install cygwin_get_dr7 as i386_dr_low.get_control. Install cygwin_get_dr as i386_dr_low.get_addr. (cygwin_get_dr): New. (cygwin_get_dr7): New. gdb/testsuite/ 2011-12-14 Pedro Alves <pedro@codesourcery.com> PR threads/10729 * gdb.mi/watch-nonstop.c: New file. * gdb.mi/mi-watch-nonstop.exp: New file.
2011-12-14 18:20:32 +01:00
/* DR6 and DR7 are retrieved with some other way. */
gdb_assert (DR_FIRSTADDR <= regnum && regnum <= DR_LASTADDR);
* linux-nat.c (linux_nat_new_thread): New variable. (linux_child_follow_fork): Set inferior_ptid to include LWP ID. Use linux_nat_switch_fork. (lwp_list): Make public. (add_lwp): Call linux_nat_new_thread. (lin_lwp_attach_lwp, linux_nat_attach): Call add_lwp after stopping the new thread. (resume_callback): Clear lp->siginfo. Remove unused variable. (linux_nat_resume): Assert that the LWP list is already initialized. Clear lp->siginfo. (save_siginfo): New. (stop_wait_callback, linux_nat_wait): Call it. (linux_nat_set_new_thread, linux_nat_get_siginfo): New. * linux-nat.h (struct lwp_info): Add siginfo. (lwp_list, linux_nat_set_new_thread, linux_nat_get_siginfo): Declare. (ALL_LWPS): Define. * amd64-linux-nat.c (amd64_linux_dr): New. (amd64_linux_dr_get): Take a PTID argument. Correct typo. (amd64_linux_dr_set): Take a PTID argument. (amd64_linux_dr_set_control, amd64_linux_dr_set_addr): Use ALL_LWPS. (amd64_linux_dr_reset_addr): Use amd64_linux_dr_set_addr. (amd64_linux_dr_get_status): Pass inferior_ptid to amd64_linux_dr_get. (amd64_linux_new_thread): New. (_initialize_amd64_linux_nat): Call linux_nat_set_new_thread. * i386-linux-nat.c (i386_linux_dr): New. (i386_linux_dr_get, i386_linux_dr_set): Take a PTID argument. (i386_linux_dr_set_control, i386_linux_dr_set_addr): Use ALL_LWPS. (i386_linux_dr_reset_addr): Use i386_linux_dr_set_addr. (i386_linux_dr_get_status): Pass inferior_ptid to i386_linux_dr_get. (i386_linux_new_thread): New. (i386_linux_resume): Remove unnecessary PID check. (_initialize_i386_linux_nat): Call linux_nat_set_new_thread. * ia64-linux-nat.c (enable_watchpoints_in_psr): Take PTID argument. (fetch_debug_register, fetch_debug_register_pair): Delete. (debug_registers): New. (ia64_linux_insert_watchpoint, ia64_linux_remove_watchpoint): Use ALL_LWPS and debug_registers. (ia64_linux_new_thread): New. (ia64_linux_stopped_data_address): Use linux_nat_get_siginfo. (_initialize_ia64_linux_nat): Call linux_nat_set_new_thread. * ppc-linux-nat.c (last_stopped_data_address): Delete. (saved_dabr_value): New. (ppc_linux_insert_watchpoint, ppc_linux_remove_watchpoint): Use ALL_LWPS. (ppc_linux_new_thread): New. (ppc_linux_stopped_data_address): Use linux_nat_get_siginfo. (ppc_linux_stopped_by_watchpoint): Call ppc_linux_stopped_data_address. (_initialize_ppc_linux_nat): Call linux_nat_set_new_thread. * s390-nat.c (s390_stopped_by_watchpoint): Clear the watchpoint status after reading it. (s390_fix_watch_points): Take a PTID argument. (s390_insert_watchpoint, s390_remove_watchpoint): Use ALL_LWPS. (_initialize_s390_nat): Call linux_nat_set_new_thread.
2007-10-01 02:22:50 +02:00
gdb/ 2011-12-14 Pedro Alves <pedro@codesourcery.com> PR threads/10729 * linux-nat.c (linux_nat_new_thread): Change parameter to an lwp pointer. (linux_nat_prepare_to_resume): New global. (lwp_free): New. (purge_lwp_list): Use it. (add_lwp): Call linux_nat_new_thread even on the first LWP. Adjust to interface change. (delete_lwp): Call lwp_free instead of xfree. (detach_callback, linux_nat_detach, resume_lwp, linux_nat_resume) (linux_handle_syscall_trap, linux_handle_extended_wait) (linux_nat_filter_event, resume_stopped_resumed_lwps): Call linux_nat_prepare_to_resume before resuming. (linux_stop_lwp): New. (linux_nat_set_new_thread): Adjust. (linux_nat_set_prepare_to_resume): New. * linux-nat.h (struct arch_lwp_info): Forward declare. (struct lwp_info) <arch_private>: New field. (linux_stop_lwp): Declare. (linux_nat_set_new_thread): Adjust. (linux_nat_set_prepare_to_resume): New. * i386-nat.c (DR_NADDR, DR_STATUS, DR_CONTROL) (struct i386_debug_reg_state): Move to i386-nat.h. (dr_mirror): Comment. (i386_debug_reg_state): New. (i386_update_inferior_debug_regs): Simplify. (i386_stopped_data_address): Use the debug register state from the inferior, not from the local cache. * i386-nat.h (struct i386_dr_low_type): Delete reset_addr and unset_status fields. New get_addr and get_control fields. (DR_FIRSTADDR, DR_LASTADDR, DR_CONTROL): Moved from i386-nat.c. (DR_NADDR, DR_STATUS): New. (struct i386_debug_reg_state): Moved from i386-nat.c. * amd64-linux-nat.c (struct arch_lwp_info): New. (amd64_linux_dr): Delete global. (amd64_linux_dr_get_addr): New. (amd64_linux_dr_get_control): New. (amd64_linux_dr_unset_status): Delete. (amd64_linux_dr_set_addr): Reimplement. (amd64_linux_dr_reset_addr): Delete. (update_debug_registers_callback): New. (amd64_linux_dr_set_control): Reimplement. (amd64_linux_dr_set_addr): Reimplement. (amd64_linux_prepare_to_resume): New. (amd64_linux_new_thread): Change parameter to an lwp pointer. Reimplement. (_initialize_amd64_linux_nat): No longer install i386_dr_low.reset_addr and i386_dr_low.unset_status. Install amd64_linux_dr_get_control as i386_dr_low.get_control. Install amd64_linux_dr_get_addr as i386_dr_low.get_addr. Install amd64_linux_prepare_to_resume. * i386-linux-nat.c (DR_FIRSTADDR, DR_LASTADDR, DR_STATUS) (DR_CONTROL): Delete. (struct arch_lwp_info): New. (i386_linux_dr): Delete global. (i386_linux_dr_set_control): Reimplement. (i386_linux_dr_get_addr): New. (i386_linux_dr_set_addr): Reimplement. (i386_linux_dr_get_control): New. (update_debug_registers_callback): New. (i386_linux_dr_unset_status): Delete. (i386_linux_dr_set_addr): Reimplement. (i386_linux_prepare_to_resume): New. (i386_linux_new_thread): Change parameter to an lwp pointer. Reimplement. (_initialize_i386_linux_nat): No longer install i386_dr_low.reset_addr and i386_dr_low.unset_status. Install i386_linux_dr_get_control as i386_dr_low.get_control. Install i386_linux_dr_get_addr as i386_dr_low.get_addr. Install i386_linux_prepare_to_resume. * arm-linux-nat.c (arm_linux_new_thread): Change parameter to an lwp pointer. Adjust. * ia64-linux-nat.c (ia64_linux_new_thread): Likewise. * mips-linux-nat.c (mips_linux_new_thread): Likewise. * ppc-linux-nat.c (ppc_linux_new_thread): Likewise. * s390-nat.c (s390_fix_watch_points): Likewise. * i386-darwin-nat.c (DR_FIRSTADDR, DR_LASTADDR, DR_STATUS) (DR_CONTROL): Delete. (i386_darwin_dr_reset_addr): Delete. (i386_darwin_dr_get_addr): New. (i386_darwin_dr_get_control): New. * go32-nat.c (go32_get_dr7, go32_get_dr): New. (init_go32_ops): No longer install i386_dr_low.reset_addr. Install go32_get_dr7 as i386_dr_low.get_control. Install go32_get_dr as i386_dr_low.get_addr. * i386bsd-nat.c (i386bsd_dr_get): New. (i386bsd_dr_reset_addr): Delete. (i386bsd_dr_get_addr): New. (i386bsd_dr_get_status): Use i386bsd_dr_get. (i386bsd_dr_get_control): New. * i386bsd-nat.h (i386bsd_dr_reset_addr): Delete. (i386bsd_dr_get_addr): New. (i386bsd_dr_get_control): New. * i386fbsd-nat.c (_initialize_i386fbsd_nat): No longer install i386_dr_low.reset_addr and i386_dr_low.unset_status. Install i386bsd_dr_get_control as i386_dr_low.get_control. Install i386bsd_dr_get_addr as i386_dr_low.get_addr. * windows-nat.c (init_windows_ops): No longer install i386_dr_low.reset_addr and i386_dr_low.unset_status. Install cygwin_get_dr7 as i386_dr_low.get_control. Install cygwin_get_dr as i386_dr_low.get_addr. (cygwin_get_dr): New. (cygwin_get_dr7): New. gdb/testsuite/ 2011-12-14 Pedro Alves <pedro@codesourcery.com> PR threads/10729 * gdb.mi/watch-nonstop.c: New file. * gdb.mi/mi-watch-nonstop.exp: New file.
2011-12-14 18:20:32 +01:00
return amd64_linux_dr_get (inferior_ptid, regnum);
* x86-64-tdep.h (x86_64_num_regs, x86_64_num_gregs): Remove variable declarations. (x86_64_register_number, x86_64_register_name): Remove prototypes. (x86_64_linux_frame_saved_pc, x86_64_linux+saved_pc_after_call, x86_64_linux_in_sigtramp, x86_64_linux_frame_chain, x86_64_init_frame_pc, x86_64_init_frame_pc, x86_64_function_has_prologue): Remove prototypes. (X86_64_NUM_GREGS): New define. (x86_64_supply_fxsave, x86_64_fill_fxsave): New prototypes. * x86-64-tdep.c: Don't include "dwarf2cfi.h". Include "dummy_frame.h", "frame.h", "frame-base.h", "frame-unwind.h". (RAX_REGNUM, RDX_REGNUM, RDI_REGNUM, EFLAGS_REGNUM, ST0_REGNUM, XMM1_REGNUM): Remove defines. (X86_64_RAX_REGNUM, X86_64_RDX_REGNUM, X86_64_RDI_REGNUM, X86_64_RBP_REGNUM, X86_64_RSP_REGNUM, X86_64_RIP_REGNUM, X86_64_EFLAGS_REGNUM, X86_64_ST0_REGNUM, X86_64_XMM0_REGNUM, X86_64_XMM1_REGNUM): New defines. (struct x86_64_register_info): Renamed from `struct register_info'. Remove `size' member. (x86_64_register_info_table): Remove variable. (x86_64_register_info): New variable. (X86_64_NUM_REGS): New define. (X86_64_NUM_GREGS): Remove define. (x86_64_num_regs, x86_64_num_gregs): Remove variables. (x86_64_dwarf2gdb_regno_map, x86_64_dwarf2gdb_regno_map_length): Remove variables. (x86_54_dwarf2_reg_to_regnum): Remove function. (x86_64_dwarf_regmap, x86_64_dwarf_regmap_len): New variables. (x86_64_dwarf_reg_to_regnum): New function. (x86_64_register_name): Rewrite. (x86_64_register_raw_size): Remove function. (x86_64_register_byte_table): Remove variable. (x86_64_register_byte): Remove function. (x86_64_register_virtual_type): Remove function. (x86_64_register_type): New function. (x86_64_register_convertible, x86_64_register_convert_to_virtual, x86_64_register_convert_to_raw): Remove functions. (x86_64_push_return_address, x86_64_pop_frame): Remove functon. (x86_64_use_struct_convention): Make static. Adjust for renamed defines. (x86_64_frame_init_saved_regs): Remove function. (x86_64_push_arguments): Make static. Change to accept a regcache as argument. (x86_64_store_return_value, x86_64_extract_return_value): Make static. Rewrite based on i386 counterparts. (x86_64_push_dummy_call): New function. (X86_64_NUM_SAVED_REGS): New define. (x86_64_register_number): Remove function. (x86_64_store_struct_return): Remove function. (x86_64_frameless_function_invocation, x86_64_function_has_prologue): Remove functions. (PROLOG_BUFSIZE): Remove define. (struct x86_64_frame_cache): New structure. (x86_64_alloc_frame_cache, x86_64_analyze_prologue, x86_64_frame_cache, x86_64_frame_this_id, x86_64_frame_prev_register, x86_64_frame_p, x86_64_sigtramp_frame_cache, x86_64_sigtramp_frame_this_id, x86_64_sigtramp_frame_prev_register, x86_sigtramp_frame_p): New functions. (x86_64_frame_unwind, x86_64_sigtramp_frame_unwind): New variables. (x86_64_skip_prologue): Rewrite in terms of x86_64_analyze_prologue. (x86_64_frame_base_address): New function. (x86_64_frame_base): New variable. (x86_64_save_dummy_frame_tos, x86_64_unwind_dummy_id): Rewrite. (x86_64_init_abi): Set register_type and push_dummy_call. Don't set deprecated_fp_regnum, deprecated_register_size, deprecated_register_bytes, register_raw_size, register_byte, register_virtual_type, register_convertiable, register_convert_to_virtual, convert_to_raw, deprecated_get_saved_register, deprecated_target_read_fp, deprecated_push_arguments, deprecated_push_return_address, deprecated_pop_frame, deprecated_store_struct_return, deprecated_frame_init_saved_regs, deprecated_frame_chain, frameless_function_invocation, deprecated_frame_saved_pc, deprecated_saved_pc_after_call, frame_num_args, pc_in_sigtramp, dwarf2_build_frame_info, deprecated_init_extra_frame_info, deprecated_init_frame_pc and virtual_frame_pointer. Call frame_unwind_append_predicate to register x86_64_sigtramp_frame_p and x86_64_frame_p. Call frame_base_set_default to register x86_64_frame_base. (I387_FISEG_REGNUM, I387_FOSEG_REGNUM): New defines. (x86_64_supply_fxsave, x86_64_fill_fxsave): New functions. (_initialize_x86_64_tdep): Remove function. * x86-64-linux-tdep.c: Don't include "dwarf2cfi.h". (LINUX_SIGINFO_SIZE, LINUX_UCONTEXT_SIGCONTEXT_OFFSET, LINUX_SIGCONTEXT_PC_OFFSET, LINUX_SIGCONTEXT_FP_OFFSET): Don't define. (X86_64_LINUX_UCONTEXT_SIGCONTEXT_OFFSET): Define. (x86_64_linux_sigcontext_addr): Rewrite. (x86_64_linux_sigtramp_saved_pc, x86_64_linux_saved_pc_after_call, x86_64_linux_frame_saved_pc): Remove functions. (x86_64_linux_pc_in_sigtramp): Renamed from x86_64_linux_in_sigtramp. Try harder to recognize a signal trampoline. (x86_64_linux_frame_chain, x86_64_init_frame_pc): Remove_functions. (x86_64_linux_init_abi): Set pc_in_sigtramp. Initialize TDEP->sigcontext_addr, TDEP->sc_pc_offset and TDEP->sc_sp_offset. * x86-64-linux-nat.c: Sync with i386-linux-tdep.c. (x86_64_regmap): Rename to regmap. (GETREGS_SUPPLIES): Use X86_64_NUM_GREGS instead of x86_64_num_gregs. (supply_gregset, fill_gregset): Likewise. Use regmap instead of x86_64_regmap. (x86_64_fxsave_offset): Remove function. (supply_fpregset): Simply call x86_64_supply_fxsave. (fill_fpregset): Simply call x86_64_fill_fxsave. (fetch_inferior_registers, store_inferior_registers): Avoid asignment in if-statement. (LINUX_SYSCALL_LEN, LINUX_SYSCALL_REGNUM, SYS_Sigreturn, SYS_rt_sigreturn, LINUX_SIGCONTEXT_EFLAGS_OFFSET, LINUX_UCONTEXT_SIGCONTEXT_OFFSET): Remove defines. (fetch_core_registers): Remove function. (linux_elf_core_fns): Remove. (offsetoff): Don't define. (_initialize_x86_64_linux_nat, kernel_u_size): Remove functions. * config/i386/x86-64linux.mt (TDEPFILES): Add i386-linux-tdep.o. * config/i386/x86-64linux.mh (NATDEPFILES): Remove core-aout.o, add core-regset.o. * config/i386/nm-x86-64linux.h: Use NM_X86_64_LINUX_H for protection against multiple includes instead of NM_X86_64_h. Add various comments. Include "config/nm-linux.h". Don't include <signal.h>. (REGISTER_U_ADDR, KERNEL_U_SIZE, U_REGS_OFFSET, KERN_U_ADDR, GET_THREAD_SIGNALS): Remove defines. (x86_64_register_u_addr, kernel_u_size, lin_thread_get_thread_signals): Remove prototypes. (PTRACE_ARG3_TYPE, PTRACE_XFER_TYPE): Define to `long'. [HAVE_LINK_H]: Don't include "solib.h". [HAVE_LINK_H] (SVR4_SHARED_LIBS): Remove define. * config/i386/tm-x86-64linux.h: Fix comments. * Makefile.in (x86-64-linux-nat.o, x86_64-linux-tdep.o, x86-64-tdep.o): Update dependencies.
2003-05-31 10:15:38 +02:00
}
gdb/ 2011-12-14 Pedro Alves <pedro@codesourcery.com> PR threads/10729 * linux-nat.c (linux_nat_new_thread): Change parameter to an lwp pointer. (linux_nat_prepare_to_resume): New global. (lwp_free): New. (purge_lwp_list): Use it. (add_lwp): Call linux_nat_new_thread even on the first LWP. Adjust to interface change. (delete_lwp): Call lwp_free instead of xfree. (detach_callback, linux_nat_detach, resume_lwp, linux_nat_resume) (linux_handle_syscall_trap, linux_handle_extended_wait) (linux_nat_filter_event, resume_stopped_resumed_lwps): Call linux_nat_prepare_to_resume before resuming. (linux_stop_lwp): New. (linux_nat_set_new_thread): Adjust. (linux_nat_set_prepare_to_resume): New. * linux-nat.h (struct arch_lwp_info): Forward declare. (struct lwp_info) <arch_private>: New field. (linux_stop_lwp): Declare. (linux_nat_set_new_thread): Adjust. (linux_nat_set_prepare_to_resume): New. * i386-nat.c (DR_NADDR, DR_STATUS, DR_CONTROL) (struct i386_debug_reg_state): Move to i386-nat.h. (dr_mirror): Comment. (i386_debug_reg_state): New. (i386_update_inferior_debug_regs): Simplify. (i386_stopped_data_address): Use the debug register state from the inferior, not from the local cache. * i386-nat.h (struct i386_dr_low_type): Delete reset_addr and unset_status fields. New get_addr and get_control fields. (DR_FIRSTADDR, DR_LASTADDR, DR_CONTROL): Moved from i386-nat.c. (DR_NADDR, DR_STATUS): New. (struct i386_debug_reg_state): Moved from i386-nat.c. * amd64-linux-nat.c (struct arch_lwp_info): New. (amd64_linux_dr): Delete global. (amd64_linux_dr_get_addr): New. (amd64_linux_dr_get_control): New. (amd64_linux_dr_unset_status): Delete. (amd64_linux_dr_set_addr): Reimplement. (amd64_linux_dr_reset_addr): Delete. (update_debug_registers_callback): New. (amd64_linux_dr_set_control): Reimplement. (amd64_linux_dr_set_addr): Reimplement. (amd64_linux_prepare_to_resume): New. (amd64_linux_new_thread): Change parameter to an lwp pointer. Reimplement. (_initialize_amd64_linux_nat): No longer install i386_dr_low.reset_addr and i386_dr_low.unset_status. Install amd64_linux_dr_get_control as i386_dr_low.get_control. Install amd64_linux_dr_get_addr as i386_dr_low.get_addr. Install amd64_linux_prepare_to_resume. * i386-linux-nat.c (DR_FIRSTADDR, DR_LASTADDR, DR_STATUS) (DR_CONTROL): Delete. (struct arch_lwp_info): New. (i386_linux_dr): Delete global. (i386_linux_dr_set_control): Reimplement. (i386_linux_dr_get_addr): New. (i386_linux_dr_set_addr): Reimplement. (i386_linux_dr_get_control): New. (update_debug_registers_callback): New. (i386_linux_dr_unset_status): Delete. (i386_linux_dr_set_addr): Reimplement. (i386_linux_prepare_to_resume): New. (i386_linux_new_thread): Change parameter to an lwp pointer. Reimplement. (_initialize_i386_linux_nat): No longer install i386_dr_low.reset_addr and i386_dr_low.unset_status. Install i386_linux_dr_get_control as i386_dr_low.get_control. Install i386_linux_dr_get_addr as i386_dr_low.get_addr. Install i386_linux_prepare_to_resume. * arm-linux-nat.c (arm_linux_new_thread): Change parameter to an lwp pointer. Adjust. * ia64-linux-nat.c (ia64_linux_new_thread): Likewise. * mips-linux-nat.c (mips_linux_new_thread): Likewise. * ppc-linux-nat.c (ppc_linux_new_thread): Likewise. * s390-nat.c (s390_fix_watch_points): Likewise. * i386-darwin-nat.c (DR_FIRSTADDR, DR_LASTADDR, DR_STATUS) (DR_CONTROL): Delete. (i386_darwin_dr_reset_addr): Delete. (i386_darwin_dr_get_addr): New. (i386_darwin_dr_get_control): New. * go32-nat.c (go32_get_dr7, go32_get_dr): New. (init_go32_ops): No longer install i386_dr_low.reset_addr. Install go32_get_dr7 as i386_dr_low.get_control. Install go32_get_dr as i386_dr_low.get_addr. * i386bsd-nat.c (i386bsd_dr_get): New. (i386bsd_dr_reset_addr): Delete. (i386bsd_dr_get_addr): New. (i386bsd_dr_get_status): Use i386bsd_dr_get. (i386bsd_dr_get_control): New. * i386bsd-nat.h (i386bsd_dr_reset_addr): Delete. (i386bsd_dr_get_addr): New. (i386bsd_dr_get_control): New. * i386fbsd-nat.c (_initialize_i386fbsd_nat): No longer install i386_dr_low.reset_addr and i386_dr_low.unset_status. Install i386bsd_dr_get_control as i386_dr_low.get_control. Install i386bsd_dr_get_addr as i386_dr_low.get_addr. * windows-nat.c (init_windows_ops): No longer install i386_dr_low.reset_addr and i386_dr_low.unset_status. Install cygwin_get_dr7 as i386_dr_low.get_control. Install cygwin_get_dr as i386_dr_low.get_addr. (cygwin_get_dr): New. (cygwin_get_dr7): New. gdb/testsuite/ 2011-12-14 Pedro Alves <pedro@codesourcery.com> PR threads/10729 * gdb.mi/watch-nonstop.c: New file. * gdb.mi/mi-watch-nonstop.exp: New file.
2011-12-14 18:20:32 +01:00
/* Return the inferior's DR7 debug control register. */
gdb/ 2011-12-14 Pedro Alves <pedro@codesourcery.com> PR threads/10729 * linux-nat.c (linux_nat_new_thread): Change parameter to an lwp pointer. (linux_nat_prepare_to_resume): New global. (lwp_free): New. (purge_lwp_list): Use it. (add_lwp): Call linux_nat_new_thread even on the first LWP. Adjust to interface change. (delete_lwp): Call lwp_free instead of xfree. (detach_callback, linux_nat_detach, resume_lwp, linux_nat_resume) (linux_handle_syscall_trap, linux_handle_extended_wait) (linux_nat_filter_event, resume_stopped_resumed_lwps): Call linux_nat_prepare_to_resume before resuming. (linux_stop_lwp): New. (linux_nat_set_new_thread): Adjust. (linux_nat_set_prepare_to_resume): New. * linux-nat.h (struct arch_lwp_info): Forward declare. (struct lwp_info) <arch_private>: New field. (linux_stop_lwp): Declare. (linux_nat_set_new_thread): Adjust. (linux_nat_set_prepare_to_resume): New. * i386-nat.c (DR_NADDR, DR_STATUS, DR_CONTROL) (struct i386_debug_reg_state): Move to i386-nat.h. (dr_mirror): Comment. (i386_debug_reg_state): New. (i386_update_inferior_debug_regs): Simplify. (i386_stopped_data_address): Use the debug register state from the inferior, not from the local cache. * i386-nat.h (struct i386_dr_low_type): Delete reset_addr and unset_status fields. New get_addr and get_control fields. (DR_FIRSTADDR, DR_LASTADDR, DR_CONTROL): Moved from i386-nat.c. (DR_NADDR, DR_STATUS): New. (struct i386_debug_reg_state): Moved from i386-nat.c. * amd64-linux-nat.c (struct arch_lwp_info): New. (amd64_linux_dr): Delete global. (amd64_linux_dr_get_addr): New. (amd64_linux_dr_get_control): New. (amd64_linux_dr_unset_status): Delete. (amd64_linux_dr_set_addr): Reimplement. (amd64_linux_dr_reset_addr): Delete. (update_debug_registers_callback): New. (amd64_linux_dr_set_control): Reimplement. (amd64_linux_dr_set_addr): Reimplement. (amd64_linux_prepare_to_resume): New. (amd64_linux_new_thread): Change parameter to an lwp pointer. Reimplement. (_initialize_amd64_linux_nat): No longer install i386_dr_low.reset_addr and i386_dr_low.unset_status. Install amd64_linux_dr_get_control as i386_dr_low.get_control. Install amd64_linux_dr_get_addr as i386_dr_low.get_addr. Install amd64_linux_prepare_to_resume. * i386-linux-nat.c (DR_FIRSTADDR, DR_LASTADDR, DR_STATUS) (DR_CONTROL): Delete. (struct arch_lwp_info): New. (i386_linux_dr): Delete global. (i386_linux_dr_set_control): Reimplement. (i386_linux_dr_get_addr): New. (i386_linux_dr_set_addr): Reimplement. (i386_linux_dr_get_control): New. (update_debug_registers_callback): New. (i386_linux_dr_unset_status): Delete. (i386_linux_dr_set_addr): Reimplement. (i386_linux_prepare_to_resume): New. (i386_linux_new_thread): Change parameter to an lwp pointer. Reimplement. (_initialize_i386_linux_nat): No longer install i386_dr_low.reset_addr and i386_dr_low.unset_status. Install i386_linux_dr_get_control as i386_dr_low.get_control. Install i386_linux_dr_get_addr as i386_dr_low.get_addr. Install i386_linux_prepare_to_resume. * arm-linux-nat.c (arm_linux_new_thread): Change parameter to an lwp pointer. Adjust. * ia64-linux-nat.c (ia64_linux_new_thread): Likewise. * mips-linux-nat.c (mips_linux_new_thread): Likewise. * ppc-linux-nat.c (ppc_linux_new_thread): Likewise. * s390-nat.c (s390_fix_watch_points): Likewise. * i386-darwin-nat.c (DR_FIRSTADDR, DR_LASTADDR, DR_STATUS) (DR_CONTROL): Delete. (i386_darwin_dr_reset_addr): Delete. (i386_darwin_dr_get_addr): New. (i386_darwin_dr_get_control): New. * go32-nat.c (go32_get_dr7, go32_get_dr): New. (init_go32_ops): No longer install i386_dr_low.reset_addr. Install go32_get_dr7 as i386_dr_low.get_control. Install go32_get_dr as i386_dr_low.get_addr. * i386bsd-nat.c (i386bsd_dr_get): New. (i386bsd_dr_reset_addr): Delete. (i386bsd_dr_get_addr): New. (i386bsd_dr_get_status): Use i386bsd_dr_get. (i386bsd_dr_get_control): New. * i386bsd-nat.h (i386bsd_dr_reset_addr): Delete. (i386bsd_dr_get_addr): New. (i386bsd_dr_get_control): New. * i386fbsd-nat.c (_initialize_i386fbsd_nat): No longer install i386_dr_low.reset_addr and i386_dr_low.unset_status. Install i386bsd_dr_get_control as i386_dr_low.get_control. Install i386bsd_dr_get_addr as i386_dr_low.get_addr. * windows-nat.c (init_windows_ops): No longer install i386_dr_low.reset_addr and i386_dr_low.unset_status. Install cygwin_get_dr7 as i386_dr_low.get_control. Install cygwin_get_dr as i386_dr_low.get_addr. (cygwin_get_dr): New. (cygwin_get_dr7): New. gdb/testsuite/ 2011-12-14 Pedro Alves <pedro@codesourcery.com> PR threads/10729 * gdb.mi/watch-nonstop.c: New file. * gdb.mi/mi-watch-nonstop.exp: New file.
2011-12-14 18:20:32 +01:00
static unsigned long
amd64_linux_dr_get_control (void)
{
gdb/ 2011-12-14 Pedro Alves <pedro@codesourcery.com> PR threads/10729 * linux-nat.c (linux_nat_new_thread): Change parameter to an lwp pointer. (linux_nat_prepare_to_resume): New global. (lwp_free): New. (purge_lwp_list): Use it. (add_lwp): Call linux_nat_new_thread even on the first LWP. Adjust to interface change. (delete_lwp): Call lwp_free instead of xfree. (detach_callback, linux_nat_detach, resume_lwp, linux_nat_resume) (linux_handle_syscall_trap, linux_handle_extended_wait) (linux_nat_filter_event, resume_stopped_resumed_lwps): Call linux_nat_prepare_to_resume before resuming. (linux_stop_lwp): New. (linux_nat_set_new_thread): Adjust. (linux_nat_set_prepare_to_resume): New. * linux-nat.h (struct arch_lwp_info): Forward declare. (struct lwp_info) <arch_private>: New field. (linux_stop_lwp): Declare. (linux_nat_set_new_thread): Adjust. (linux_nat_set_prepare_to_resume): New. * i386-nat.c (DR_NADDR, DR_STATUS, DR_CONTROL) (struct i386_debug_reg_state): Move to i386-nat.h. (dr_mirror): Comment. (i386_debug_reg_state): New. (i386_update_inferior_debug_regs): Simplify. (i386_stopped_data_address): Use the debug register state from the inferior, not from the local cache. * i386-nat.h (struct i386_dr_low_type): Delete reset_addr and unset_status fields. New get_addr and get_control fields. (DR_FIRSTADDR, DR_LASTADDR, DR_CONTROL): Moved from i386-nat.c. (DR_NADDR, DR_STATUS): New. (struct i386_debug_reg_state): Moved from i386-nat.c. * amd64-linux-nat.c (struct arch_lwp_info): New. (amd64_linux_dr): Delete global. (amd64_linux_dr_get_addr): New. (amd64_linux_dr_get_control): New. (amd64_linux_dr_unset_status): Delete. (amd64_linux_dr_set_addr): Reimplement. (amd64_linux_dr_reset_addr): Delete. (update_debug_registers_callback): New. (amd64_linux_dr_set_control): Reimplement. (amd64_linux_dr_set_addr): Reimplement. (amd64_linux_prepare_to_resume): New. (amd64_linux_new_thread): Change parameter to an lwp pointer. Reimplement. (_initialize_amd64_linux_nat): No longer install i386_dr_low.reset_addr and i386_dr_low.unset_status. Install amd64_linux_dr_get_control as i386_dr_low.get_control. Install amd64_linux_dr_get_addr as i386_dr_low.get_addr. Install amd64_linux_prepare_to_resume. * i386-linux-nat.c (DR_FIRSTADDR, DR_LASTADDR, DR_STATUS) (DR_CONTROL): Delete. (struct arch_lwp_info): New. (i386_linux_dr): Delete global. (i386_linux_dr_set_control): Reimplement. (i386_linux_dr_get_addr): New. (i386_linux_dr_set_addr): Reimplement. (i386_linux_dr_get_control): New. (update_debug_registers_callback): New. (i386_linux_dr_unset_status): Delete. (i386_linux_dr_set_addr): Reimplement. (i386_linux_prepare_to_resume): New. (i386_linux_new_thread): Change parameter to an lwp pointer. Reimplement. (_initialize_i386_linux_nat): No longer install i386_dr_low.reset_addr and i386_dr_low.unset_status. Install i386_linux_dr_get_control as i386_dr_low.get_control. Install i386_linux_dr_get_addr as i386_dr_low.get_addr. Install i386_linux_prepare_to_resume. * arm-linux-nat.c (arm_linux_new_thread): Change parameter to an lwp pointer. Adjust. * ia64-linux-nat.c (ia64_linux_new_thread): Likewise. * mips-linux-nat.c (mips_linux_new_thread): Likewise. * ppc-linux-nat.c (ppc_linux_new_thread): Likewise. * s390-nat.c (s390_fix_watch_points): Likewise. * i386-darwin-nat.c (DR_FIRSTADDR, DR_LASTADDR, DR_STATUS) (DR_CONTROL): Delete. (i386_darwin_dr_reset_addr): Delete. (i386_darwin_dr_get_addr): New. (i386_darwin_dr_get_control): New. * go32-nat.c (go32_get_dr7, go32_get_dr): New. (init_go32_ops): No longer install i386_dr_low.reset_addr. Install go32_get_dr7 as i386_dr_low.get_control. Install go32_get_dr as i386_dr_low.get_addr. * i386bsd-nat.c (i386bsd_dr_get): New. (i386bsd_dr_reset_addr): Delete. (i386bsd_dr_get_addr): New. (i386bsd_dr_get_status): Use i386bsd_dr_get. (i386bsd_dr_get_control): New. * i386bsd-nat.h (i386bsd_dr_reset_addr): Delete. (i386bsd_dr_get_addr): New. (i386bsd_dr_get_control): New. * i386fbsd-nat.c (_initialize_i386fbsd_nat): No longer install i386_dr_low.reset_addr and i386_dr_low.unset_status. Install i386bsd_dr_get_control as i386_dr_low.get_control. Install i386bsd_dr_get_addr as i386_dr_low.get_addr. * windows-nat.c (init_windows_ops): No longer install i386_dr_low.reset_addr and i386_dr_low.unset_status. Install cygwin_get_dr7 as i386_dr_low.get_control. Install cygwin_get_dr as i386_dr_low.get_addr. (cygwin_get_dr): New. (cygwin_get_dr7): New. gdb/testsuite/ 2011-12-14 Pedro Alves <pedro@codesourcery.com> PR threads/10729 * gdb.mi/watch-nonstop.c: New file. * gdb.mi/mi-watch-nonstop.exp: New file.
2011-12-14 18:20:32 +01:00
return amd64_linux_dr_get (inferior_ptid, DR_CONTROL);
}
* linux-nat.c (linux_nat_new_thread): New variable. (linux_child_follow_fork): Set inferior_ptid to include LWP ID. Use linux_nat_switch_fork. (lwp_list): Make public. (add_lwp): Call linux_nat_new_thread. (lin_lwp_attach_lwp, linux_nat_attach): Call add_lwp after stopping the new thread. (resume_callback): Clear lp->siginfo. Remove unused variable. (linux_nat_resume): Assert that the LWP list is already initialized. Clear lp->siginfo. (save_siginfo): New. (stop_wait_callback, linux_nat_wait): Call it. (linux_nat_set_new_thread, linux_nat_get_siginfo): New. * linux-nat.h (struct lwp_info): Add siginfo. (lwp_list, linux_nat_set_new_thread, linux_nat_get_siginfo): Declare. (ALL_LWPS): Define. * amd64-linux-nat.c (amd64_linux_dr): New. (amd64_linux_dr_get): Take a PTID argument. Correct typo. (amd64_linux_dr_set): Take a PTID argument. (amd64_linux_dr_set_control, amd64_linux_dr_set_addr): Use ALL_LWPS. (amd64_linux_dr_reset_addr): Use amd64_linux_dr_set_addr. (amd64_linux_dr_get_status): Pass inferior_ptid to amd64_linux_dr_get. (amd64_linux_new_thread): New. (_initialize_amd64_linux_nat): Call linux_nat_set_new_thread. * i386-linux-nat.c (i386_linux_dr): New. (i386_linux_dr_get, i386_linux_dr_set): Take a PTID argument. (i386_linux_dr_set_control, i386_linux_dr_set_addr): Use ALL_LWPS. (i386_linux_dr_reset_addr): Use i386_linux_dr_set_addr. (i386_linux_dr_get_status): Pass inferior_ptid to i386_linux_dr_get. (i386_linux_new_thread): New. (i386_linux_resume): Remove unnecessary PID check. (_initialize_i386_linux_nat): Call linux_nat_set_new_thread. * ia64-linux-nat.c (enable_watchpoints_in_psr): Take PTID argument. (fetch_debug_register, fetch_debug_register_pair): Delete. (debug_registers): New. (ia64_linux_insert_watchpoint, ia64_linux_remove_watchpoint): Use ALL_LWPS and debug_registers. (ia64_linux_new_thread): New. (ia64_linux_stopped_data_address): Use linux_nat_get_siginfo. (_initialize_ia64_linux_nat): Call linux_nat_set_new_thread. * ppc-linux-nat.c (last_stopped_data_address): Delete. (saved_dabr_value): New. (ppc_linux_insert_watchpoint, ppc_linux_remove_watchpoint): Use ALL_LWPS. (ppc_linux_new_thread): New. (ppc_linux_stopped_data_address): Use linux_nat_get_siginfo. (ppc_linux_stopped_by_watchpoint): Call ppc_linux_stopped_data_address. (_initialize_ppc_linux_nat): Call linux_nat_set_new_thread. * s390-nat.c (s390_stopped_by_watchpoint): Clear the watchpoint status after reading it. (s390_fix_watch_points): Take a PTID argument. (s390_insert_watchpoint, s390_remove_watchpoint): Use ALL_LWPS. (_initialize_s390_nat): Call linux_nat_set_new_thread.
2007-10-01 02:22:50 +02:00
gdb/ 2011-12-14 Pedro Alves <pedro@codesourcery.com> PR threads/10729 * linux-nat.c (linux_nat_new_thread): Change parameter to an lwp pointer. (linux_nat_prepare_to_resume): New global. (lwp_free): New. (purge_lwp_list): Use it. (add_lwp): Call linux_nat_new_thread even on the first LWP. Adjust to interface change. (delete_lwp): Call lwp_free instead of xfree. (detach_callback, linux_nat_detach, resume_lwp, linux_nat_resume) (linux_handle_syscall_trap, linux_handle_extended_wait) (linux_nat_filter_event, resume_stopped_resumed_lwps): Call linux_nat_prepare_to_resume before resuming. (linux_stop_lwp): New. (linux_nat_set_new_thread): Adjust. (linux_nat_set_prepare_to_resume): New. * linux-nat.h (struct arch_lwp_info): Forward declare. (struct lwp_info) <arch_private>: New field. (linux_stop_lwp): Declare. (linux_nat_set_new_thread): Adjust. (linux_nat_set_prepare_to_resume): New. * i386-nat.c (DR_NADDR, DR_STATUS, DR_CONTROL) (struct i386_debug_reg_state): Move to i386-nat.h. (dr_mirror): Comment. (i386_debug_reg_state): New. (i386_update_inferior_debug_regs): Simplify. (i386_stopped_data_address): Use the debug register state from the inferior, not from the local cache. * i386-nat.h (struct i386_dr_low_type): Delete reset_addr and unset_status fields. New get_addr and get_control fields. (DR_FIRSTADDR, DR_LASTADDR, DR_CONTROL): Moved from i386-nat.c. (DR_NADDR, DR_STATUS): New. (struct i386_debug_reg_state): Moved from i386-nat.c. * amd64-linux-nat.c (struct arch_lwp_info): New. (amd64_linux_dr): Delete global. (amd64_linux_dr_get_addr): New. (amd64_linux_dr_get_control): New. (amd64_linux_dr_unset_status): Delete. (amd64_linux_dr_set_addr): Reimplement. (amd64_linux_dr_reset_addr): Delete. (update_debug_registers_callback): New. (amd64_linux_dr_set_control): Reimplement. (amd64_linux_dr_set_addr): Reimplement. (amd64_linux_prepare_to_resume): New. (amd64_linux_new_thread): Change parameter to an lwp pointer. Reimplement. (_initialize_amd64_linux_nat): No longer install i386_dr_low.reset_addr and i386_dr_low.unset_status. Install amd64_linux_dr_get_control as i386_dr_low.get_control. Install amd64_linux_dr_get_addr as i386_dr_low.get_addr. Install amd64_linux_prepare_to_resume. * i386-linux-nat.c (DR_FIRSTADDR, DR_LASTADDR, DR_STATUS) (DR_CONTROL): Delete. (struct arch_lwp_info): New. (i386_linux_dr): Delete global. (i386_linux_dr_set_control): Reimplement. (i386_linux_dr_get_addr): New. (i386_linux_dr_set_addr): Reimplement. (i386_linux_dr_get_control): New. (update_debug_registers_callback): New. (i386_linux_dr_unset_status): Delete. (i386_linux_dr_set_addr): Reimplement. (i386_linux_prepare_to_resume): New. (i386_linux_new_thread): Change parameter to an lwp pointer. Reimplement. (_initialize_i386_linux_nat): No longer install i386_dr_low.reset_addr and i386_dr_low.unset_status. Install i386_linux_dr_get_control as i386_dr_low.get_control. Install i386_linux_dr_get_addr as i386_dr_low.get_addr. Install i386_linux_prepare_to_resume. * arm-linux-nat.c (arm_linux_new_thread): Change parameter to an lwp pointer. Adjust. * ia64-linux-nat.c (ia64_linux_new_thread): Likewise. * mips-linux-nat.c (mips_linux_new_thread): Likewise. * ppc-linux-nat.c (ppc_linux_new_thread): Likewise. * s390-nat.c (s390_fix_watch_points): Likewise. * i386-darwin-nat.c (DR_FIRSTADDR, DR_LASTADDR, DR_STATUS) (DR_CONTROL): Delete. (i386_darwin_dr_reset_addr): Delete. (i386_darwin_dr_get_addr): New. (i386_darwin_dr_get_control): New. * go32-nat.c (go32_get_dr7, go32_get_dr): New. (init_go32_ops): No longer install i386_dr_low.reset_addr. Install go32_get_dr7 as i386_dr_low.get_control. Install go32_get_dr as i386_dr_low.get_addr. * i386bsd-nat.c (i386bsd_dr_get): New. (i386bsd_dr_reset_addr): Delete. (i386bsd_dr_get_addr): New. (i386bsd_dr_get_status): Use i386bsd_dr_get. (i386bsd_dr_get_control): New. * i386bsd-nat.h (i386bsd_dr_reset_addr): Delete. (i386bsd_dr_get_addr): New. (i386bsd_dr_get_control): New. * i386fbsd-nat.c (_initialize_i386fbsd_nat): No longer install i386_dr_low.reset_addr and i386_dr_low.unset_status. Install i386bsd_dr_get_control as i386_dr_low.get_control. Install i386bsd_dr_get_addr as i386_dr_low.get_addr. * windows-nat.c (init_windows_ops): No longer install i386_dr_low.reset_addr and i386_dr_low.unset_status. Install cygwin_get_dr7 as i386_dr_low.get_control. Install cygwin_get_dr as i386_dr_low.get_addr. (cygwin_get_dr): New. (cygwin_get_dr7): New. gdb/testsuite/ 2011-12-14 Pedro Alves <pedro@codesourcery.com> PR threads/10729 * gdb.mi/watch-nonstop.c: New file. * gdb.mi/mi-watch-nonstop.exp: New file.
2011-12-14 18:20:32 +01:00
/* Get DR_STATUS from only the one LWP of INFERIOR_PTID. */
static unsigned long
amd64_linux_dr_get_status (void)
{
return amd64_linux_dr_get (inferior_ptid, DR_STATUS);
}
[native x86 GNU/Linux] Access debug register mirror from the corresponding process. While reviewing the native AArch64 patch, I noticed a problem: On 02/06/2013 08:46 PM, Pedro Alves wrote: > >> > +static void >> > +aarch64_linux_prepare_to_resume (struct lwp_info *lwp) >> > +{ >> > + struct arch_lwp_info *info = lwp->arch_private; >> > + >> > + /* NULL means this is the main thread still going through the shell, >> > + or, no watchpoint has been set yet. In that case, there's >> > + nothing to do. */ >> > + if (info == NULL) >> > + return; >> > + >> > + if (DR_HAS_CHANGED (info->dr_changed_bp) >> > + || DR_HAS_CHANGED (info->dr_changed_wp)) >> > + { >> > + int tid = GET_LWP (lwp->ptid); >> > + struct aarch64_debug_reg_state *state = aarch64_get_debug_reg_state (); > Hmm. This is always fetching the debug_reg_state of > the current inferior, but may not be the inferior of lwp. > I see the same bug on x86. Sorry about that. I'll fix it. A natural fix would be to make xxx_get_debug_reg_state take an inferior argument, but that doesn't work because of the case where we detach breakpoints/watchpoints from the child fork, at a time there's no inferior for the child fork at all. We do a nasty hack in i386_inferior_data_get, but that relies on all callers pointing the current inferior to the correct inferior, which isn't actually being done by all callers, and I don't think we want to enforce that -- deep in the bowls of linux-nat.c, there are many cases we resume lwps behind the scenes, and it's be better to not have that code rely on global state (as it doesn't today). The fix is to decouple the watchpoints code from inferiors, making it track target processes instead. This way, we can freely keep track of the watchpoint mirrors for these processes behind the core's back. Checkpoints also play dirty tricks with swapping the process behind the inferior, so they get special treatment too in the patch (which just amounts to calling a new hook). Instead of the old hack in i386_inferior_data_get, where we returned a copy of the current inferior's debug registers mirror, as soon as we detect a fork in the target, we copy the debug register mirror from the parent to the child process. I don't have an old kernel handy to test, but I stepped through gdb doing the watchpoint removal in the fork child in the watchpoint-fork test seeing that the debug registers end up cleared in the child. I didn't find the need for linux_nat_iterate_watchpoint_lwps. If we use plain iterate_over_lwps instead, what happens is that when removing watchpoints, that iterate_over_lwps doesn't actually iterate over anything, since the fork child is not added to the lwp list until later, at detach time, in linux_child_follow_fork. And if we don't iterate over that lwp, we don't mark its debug registers as needing update. But linux_child_follow_fork takes care of doing that explicitly: child_lp = add_lwp (inferior_ptid); child_lp->stopped = 1; child_lp->last_resume_kind = resume_stop; make_cleanup (delete_lwp_cleanup, child_lp); /* CHILD_LP has new PID, therefore linux_nat_new_thread is not called for it. See i386_inferior_data_get for the Linux kernel specifics. Ensure linux_nat_prepare_to_resume will reset the hardware debug registers. It is done by the linux_nat_new_thread call, which is being skipped in add_lwp above for the first lwp of a pid. */ gdb_assert (num_lwps (GET_PID (child_lp->ptid)) == 1); if (linux_nat_new_thread != NULL) linux_nat_new_thread (child_lp); if (linux_nat_prepare_to_resume != NULL) linux_nat_prepare_to_resume (child_lp); ptrace (PTRACE_DETACH, child_pid, 0, 0); so unless I'm missing something (quite possible) it ends up all the same. But, the !detach-on-fork, and the "follow-fork child" paths should also call linux_nat_new_thread, and they don't presently. It seems to me in those cases we're not clearing debug regs correctly when that's needed. Instead of copying that bit that works around add_lwp bypassing the linux_nat_new_thread call, I thought it'd be better to add an add_initial_lwp call to be used in the case we really need to bypass linux_nat_new_thread, and make add_lwp always call linux_nat_new_thread. i386_cleanup_dregs is rewritten to forget about the current process debug mirrors, which takes cares of other i386 ports. Only a couple of extra tweaks here and there were needed, as some targets wheren't actually calling i386_cleanup_dregs. Tested on Fedora 17 x86_64 -m64/-m32. GDBserver already fetches the i386_debug_reg_state from the right process, and, it doesn't handle forks at all, so no fix is needed over there. gdb/ 2013-02-13 Pedro Alves <palves@redhat.com> * amd64-linux-nat.c (update_debug_registers_callback): Update comment. (amd64_linux_dr_set_control, amd64_linux_dr_set_addr): Use iterate_over_lwps. (amd64_linux_prepare_to_resume): Pass the lwp's pid to i386_debug_reg_state. (amd64_linux_new_fork): New function. (_initialize_amd64_linux_nat): Install amd64_linux_new_fork as linux_nat_new_fork hook, and i386_forget_process as linux_nat_forget_process hook. * i386-linux-nat.c (update_debug_registers_callback): Update comment. (amd64_linux_dr_set_control, amd64_linux_dr_set_addr): Use iterate_over_lwps. (i386_linux_prepare_to_resume): Pass the lwp's pid to i386_debug_reg_state. (i386_linux_new_fork): New function. (_initialize_i386_linux_nat): Install i386_linux_new_fork as linux_nat_new_fork hook, and i386_forget_process as linux_nat_forget_process hook. * i386-nat.c (i386_init_dregs): Delete. (i386_inferior_data, struct i386_inferior_data): Delete. (struct i386_process_info): New. (i386_process_list): New global. (i386_find_process_pid, i386_add_process, i386_process_info_get): New functions. (i386_inferior_data_get): Delete. (i386_process_info_get): New function. (i386_debug_reg_state): New parameter 'pid'. Reimplement. (i386_forget_process): New function. (i386_cleanup_dregs): Rewrite. (i386_update_inferior_debug_regs, i386_insert_watchpoint) (i386_remove_watchpoint, i386_region_ok_for_watchpoint) (i386_stopped_data_address, i386_insert_hw_breakpoint) (i386_remove_hw_breakpoint): Adjust to pass the current process id to i386_debug_reg_state. (i386_use_watchpoints): Don't register inferior data. * i386-nat.h (i386_debug_reg_state): Add new 'pid' parameter, and adjust comment. (i386_forget_process): Declare. * linux-fork.c (delete_fork): Call linux_nat_forget_process. * linux-nat.c (linux_nat_new_fork, linux_nat_forget_process_hook): New static globals. (linux_child_follow_fork): Don't call linux_nat_new_thread here. (add_initial_lwp): New, factored out from ... (add_lwp): ... this. Don't check the number of lwps before calling linux_nat_new_thread. (linux_nat_iterate_watchpoint_lwps): Delete. (linux_nat_attach): Use add_initial_lwp instead of add_lwp. (linux_handle_extended_wait): Call the linux_nat_new_fork hook on forks and vforks. (linux_nat_wait_1): Use add_initial_lwp instead of add_lwp for the initial lwp. (linux_nat_kill, linux_nat_mourn_inferior): Call linux_nat_forget_process. (linux_nat_set_new_fork, linux_nat_set_forget_process) (linux_nat_forget_process): New functions. * linux-nat.h (linux_nat_iterate_watchpoint_lwps_ftype): Delete type. (linux_nat_iterate_watchpoint_lwps): Delete declaration. (linux_nat_new_fork_ftype, linux_nat_forget_process_ftype): New types. (linux_nat_set_new_fork, linux_nat_set_forget_process) (linux_nat_forget_process): New declarations. * amd64fbsd-nat.c (super_mourn_inferior): New global. (amd64fbsd_mourn_inferior): New function. (_initialize_amd64fbsd_nat): Override to_mourn_inferior. * windows-nat.c (windows_detach): Call i386_cleanup_dregs.
2013-02-13 15:59:49 +01:00
/* Callback for iterate_over_lwps. Update the debug registers of
LWP. */
gdb/ 2011-12-14 Pedro Alves <pedro@codesourcery.com> PR threads/10729 * linux-nat.c (linux_nat_new_thread): Change parameter to an lwp pointer. (linux_nat_prepare_to_resume): New global. (lwp_free): New. (purge_lwp_list): Use it. (add_lwp): Call linux_nat_new_thread even on the first LWP. Adjust to interface change. (delete_lwp): Call lwp_free instead of xfree. (detach_callback, linux_nat_detach, resume_lwp, linux_nat_resume) (linux_handle_syscall_trap, linux_handle_extended_wait) (linux_nat_filter_event, resume_stopped_resumed_lwps): Call linux_nat_prepare_to_resume before resuming. (linux_stop_lwp): New. (linux_nat_set_new_thread): Adjust. (linux_nat_set_prepare_to_resume): New. * linux-nat.h (struct arch_lwp_info): Forward declare. (struct lwp_info) <arch_private>: New field. (linux_stop_lwp): Declare. (linux_nat_set_new_thread): Adjust. (linux_nat_set_prepare_to_resume): New. * i386-nat.c (DR_NADDR, DR_STATUS, DR_CONTROL) (struct i386_debug_reg_state): Move to i386-nat.h. (dr_mirror): Comment. (i386_debug_reg_state): New. (i386_update_inferior_debug_regs): Simplify. (i386_stopped_data_address): Use the debug register state from the inferior, not from the local cache. * i386-nat.h (struct i386_dr_low_type): Delete reset_addr and unset_status fields. New get_addr and get_control fields. (DR_FIRSTADDR, DR_LASTADDR, DR_CONTROL): Moved from i386-nat.c. (DR_NADDR, DR_STATUS): New. (struct i386_debug_reg_state): Moved from i386-nat.c. * amd64-linux-nat.c (struct arch_lwp_info): New. (amd64_linux_dr): Delete global. (amd64_linux_dr_get_addr): New. (amd64_linux_dr_get_control): New. (amd64_linux_dr_unset_status): Delete. (amd64_linux_dr_set_addr): Reimplement. (amd64_linux_dr_reset_addr): Delete. (update_debug_registers_callback): New. (amd64_linux_dr_set_control): Reimplement. (amd64_linux_dr_set_addr): Reimplement. (amd64_linux_prepare_to_resume): New. (amd64_linux_new_thread): Change parameter to an lwp pointer. Reimplement. (_initialize_amd64_linux_nat): No longer install i386_dr_low.reset_addr and i386_dr_low.unset_status. Install amd64_linux_dr_get_control as i386_dr_low.get_control. Install amd64_linux_dr_get_addr as i386_dr_low.get_addr. Install amd64_linux_prepare_to_resume. * i386-linux-nat.c (DR_FIRSTADDR, DR_LASTADDR, DR_STATUS) (DR_CONTROL): Delete. (struct arch_lwp_info): New. (i386_linux_dr): Delete global. (i386_linux_dr_set_control): Reimplement. (i386_linux_dr_get_addr): New. (i386_linux_dr_set_addr): Reimplement. (i386_linux_dr_get_control): New. (update_debug_registers_callback): New. (i386_linux_dr_unset_status): Delete. (i386_linux_dr_set_addr): Reimplement. (i386_linux_prepare_to_resume): New. (i386_linux_new_thread): Change parameter to an lwp pointer. Reimplement. (_initialize_i386_linux_nat): No longer install i386_dr_low.reset_addr and i386_dr_low.unset_status. Install i386_linux_dr_get_control as i386_dr_low.get_control. Install i386_linux_dr_get_addr as i386_dr_low.get_addr. Install i386_linux_prepare_to_resume. * arm-linux-nat.c (arm_linux_new_thread): Change parameter to an lwp pointer. Adjust. * ia64-linux-nat.c (ia64_linux_new_thread): Likewise. * mips-linux-nat.c (mips_linux_new_thread): Likewise. * ppc-linux-nat.c (ppc_linux_new_thread): Likewise. * s390-nat.c (s390_fix_watch_points): Likewise. * i386-darwin-nat.c (DR_FIRSTADDR, DR_LASTADDR, DR_STATUS) (DR_CONTROL): Delete. (i386_darwin_dr_reset_addr): Delete. (i386_darwin_dr_get_addr): New. (i386_darwin_dr_get_control): New. * go32-nat.c (go32_get_dr7, go32_get_dr): New. (init_go32_ops): No longer install i386_dr_low.reset_addr. Install go32_get_dr7 as i386_dr_low.get_control. Install go32_get_dr as i386_dr_low.get_addr. * i386bsd-nat.c (i386bsd_dr_get): New. (i386bsd_dr_reset_addr): Delete. (i386bsd_dr_get_addr): New. (i386bsd_dr_get_status): Use i386bsd_dr_get. (i386bsd_dr_get_control): New. * i386bsd-nat.h (i386bsd_dr_reset_addr): Delete. (i386bsd_dr_get_addr): New. (i386bsd_dr_get_control): New. * i386fbsd-nat.c (_initialize_i386fbsd_nat): No longer install i386_dr_low.reset_addr and i386_dr_low.unset_status. Install i386bsd_dr_get_control as i386_dr_low.get_control. Install i386bsd_dr_get_addr as i386_dr_low.get_addr. * windows-nat.c (init_windows_ops): No longer install i386_dr_low.reset_addr and i386_dr_low.unset_status. Install cygwin_get_dr7 as i386_dr_low.get_control. Install cygwin_get_dr as i386_dr_low.get_addr. (cygwin_get_dr): New. (cygwin_get_dr7): New. gdb/testsuite/ 2011-12-14 Pedro Alves <pedro@codesourcery.com> PR threads/10729 * gdb.mi/watch-nonstop.c: New file. * gdb.mi/mi-watch-nonstop.exp: New file.
2011-12-14 18:20:32 +01:00
static int
update_debug_registers_callback (struct lwp_info *lwp, void *arg)
{
if (lwp->arch_private == NULL)
lwp->arch_private = XCNEW (struct arch_lwp_info);
gdb/ 2011-12-14 Pedro Alves <pedro@codesourcery.com> PR threads/10729 * linux-nat.c (linux_nat_new_thread): Change parameter to an lwp pointer. (linux_nat_prepare_to_resume): New global. (lwp_free): New. (purge_lwp_list): Use it. (add_lwp): Call linux_nat_new_thread even on the first LWP. Adjust to interface change. (delete_lwp): Call lwp_free instead of xfree. (detach_callback, linux_nat_detach, resume_lwp, linux_nat_resume) (linux_handle_syscall_trap, linux_handle_extended_wait) (linux_nat_filter_event, resume_stopped_resumed_lwps): Call linux_nat_prepare_to_resume before resuming. (linux_stop_lwp): New. (linux_nat_set_new_thread): Adjust. (linux_nat_set_prepare_to_resume): New. * linux-nat.h (struct arch_lwp_info): Forward declare. (struct lwp_info) <arch_private>: New field. (linux_stop_lwp): Declare. (linux_nat_set_new_thread): Adjust. (linux_nat_set_prepare_to_resume): New. * i386-nat.c (DR_NADDR, DR_STATUS, DR_CONTROL) (struct i386_debug_reg_state): Move to i386-nat.h. (dr_mirror): Comment. (i386_debug_reg_state): New. (i386_update_inferior_debug_regs): Simplify. (i386_stopped_data_address): Use the debug register state from the inferior, not from the local cache. * i386-nat.h (struct i386_dr_low_type): Delete reset_addr and unset_status fields. New get_addr and get_control fields. (DR_FIRSTADDR, DR_LASTADDR, DR_CONTROL): Moved from i386-nat.c. (DR_NADDR, DR_STATUS): New. (struct i386_debug_reg_state): Moved from i386-nat.c. * amd64-linux-nat.c (struct arch_lwp_info): New. (amd64_linux_dr): Delete global. (amd64_linux_dr_get_addr): New. (amd64_linux_dr_get_control): New. (amd64_linux_dr_unset_status): Delete. (amd64_linux_dr_set_addr): Reimplement. (amd64_linux_dr_reset_addr): Delete. (update_debug_registers_callback): New. (amd64_linux_dr_set_control): Reimplement. (amd64_linux_dr_set_addr): Reimplement. (amd64_linux_prepare_to_resume): New. (amd64_linux_new_thread): Change parameter to an lwp pointer. Reimplement. (_initialize_amd64_linux_nat): No longer install i386_dr_low.reset_addr and i386_dr_low.unset_status. Install amd64_linux_dr_get_control as i386_dr_low.get_control. Install amd64_linux_dr_get_addr as i386_dr_low.get_addr. Install amd64_linux_prepare_to_resume. * i386-linux-nat.c (DR_FIRSTADDR, DR_LASTADDR, DR_STATUS) (DR_CONTROL): Delete. (struct arch_lwp_info): New. (i386_linux_dr): Delete global. (i386_linux_dr_set_control): Reimplement. (i386_linux_dr_get_addr): New. (i386_linux_dr_set_addr): Reimplement. (i386_linux_dr_get_control): New. (update_debug_registers_callback): New. (i386_linux_dr_unset_status): Delete. (i386_linux_dr_set_addr): Reimplement. (i386_linux_prepare_to_resume): New. (i386_linux_new_thread): Change parameter to an lwp pointer. Reimplement. (_initialize_i386_linux_nat): No longer install i386_dr_low.reset_addr and i386_dr_low.unset_status. Install i386_linux_dr_get_control as i386_dr_low.get_control. Install i386_linux_dr_get_addr as i386_dr_low.get_addr. Install i386_linux_prepare_to_resume. * arm-linux-nat.c (arm_linux_new_thread): Change parameter to an lwp pointer. Adjust. * ia64-linux-nat.c (ia64_linux_new_thread): Likewise. * mips-linux-nat.c (mips_linux_new_thread): Likewise. * ppc-linux-nat.c (ppc_linux_new_thread): Likewise. * s390-nat.c (s390_fix_watch_points): Likewise. * i386-darwin-nat.c (DR_FIRSTADDR, DR_LASTADDR, DR_STATUS) (DR_CONTROL): Delete. (i386_darwin_dr_reset_addr): Delete. (i386_darwin_dr_get_addr): New. (i386_darwin_dr_get_control): New. * go32-nat.c (go32_get_dr7, go32_get_dr): New. (init_go32_ops): No longer install i386_dr_low.reset_addr. Install go32_get_dr7 as i386_dr_low.get_control. Install go32_get_dr as i386_dr_low.get_addr. * i386bsd-nat.c (i386bsd_dr_get): New. (i386bsd_dr_reset_addr): Delete. (i386bsd_dr_get_addr): New. (i386bsd_dr_get_status): Use i386bsd_dr_get. (i386bsd_dr_get_control): New. * i386bsd-nat.h (i386bsd_dr_reset_addr): Delete. (i386bsd_dr_get_addr): New. (i386bsd_dr_get_control): New. * i386fbsd-nat.c (_initialize_i386fbsd_nat): No longer install i386_dr_low.reset_addr and i386_dr_low.unset_status. Install i386bsd_dr_get_control as i386_dr_low.get_control. Install i386bsd_dr_get_addr as i386_dr_low.get_addr. * windows-nat.c (init_windows_ops): No longer install i386_dr_low.reset_addr and i386_dr_low.unset_status. Install cygwin_get_dr7 as i386_dr_low.get_control. Install cygwin_get_dr as i386_dr_low.get_addr. (cygwin_get_dr): New. (cygwin_get_dr7): New. gdb/testsuite/ 2011-12-14 Pedro Alves <pedro@codesourcery.com> PR threads/10729 * gdb.mi/watch-nonstop.c: New file. * gdb.mi/mi-watch-nonstop.exp: New file.
2011-12-14 18:20:32 +01:00
/* The actual update is done later just before resuming the lwp, we
just mark that the registers need updating. */
lwp->arch_private->debug_registers_changed = 1;
/* If the lwp isn't stopped, force it to momentarily pause, so we
can update its debug registers. */
if (!lwp->stopped)
linux_stop_lwp (lwp);
* x86-64-tdep.h (x86_64_num_regs, x86_64_num_gregs): Remove variable declarations. (x86_64_register_number, x86_64_register_name): Remove prototypes. (x86_64_linux_frame_saved_pc, x86_64_linux+saved_pc_after_call, x86_64_linux_in_sigtramp, x86_64_linux_frame_chain, x86_64_init_frame_pc, x86_64_init_frame_pc, x86_64_function_has_prologue): Remove prototypes. (X86_64_NUM_GREGS): New define. (x86_64_supply_fxsave, x86_64_fill_fxsave): New prototypes. * x86-64-tdep.c: Don't include "dwarf2cfi.h". Include "dummy_frame.h", "frame.h", "frame-base.h", "frame-unwind.h". (RAX_REGNUM, RDX_REGNUM, RDI_REGNUM, EFLAGS_REGNUM, ST0_REGNUM, XMM1_REGNUM): Remove defines. (X86_64_RAX_REGNUM, X86_64_RDX_REGNUM, X86_64_RDI_REGNUM, X86_64_RBP_REGNUM, X86_64_RSP_REGNUM, X86_64_RIP_REGNUM, X86_64_EFLAGS_REGNUM, X86_64_ST0_REGNUM, X86_64_XMM0_REGNUM, X86_64_XMM1_REGNUM): New defines. (struct x86_64_register_info): Renamed from `struct register_info'. Remove `size' member. (x86_64_register_info_table): Remove variable. (x86_64_register_info): New variable. (X86_64_NUM_REGS): New define. (X86_64_NUM_GREGS): Remove define. (x86_64_num_regs, x86_64_num_gregs): Remove variables. (x86_64_dwarf2gdb_regno_map, x86_64_dwarf2gdb_regno_map_length): Remove variables. (x86_54_dwarf2_reg_to_regnum): Remove function. (x86_64_dwarf_regmap, x86_64_dwarf_regmap_len): New variables. (x86_64_dwarf_reg_to_regnum): New function. (x86_64_register_name): Rewrite. (x86_64_register_raw_size): Remove function. (x86_64_register_byte_table): Remove variable. (x86_64_register_byte): Remove function. (x86_64_register_virtual_type): Remove function. (x86_64_register_type): New function. (x86_64_register_convertible, x86_64_register_convert_to_virtual, x86_64_register_convert_to_raw): Remove functions. (x86_64_push_return_address, x86_64_pop_frame): Remove functon. (x86_64_use_struct_convention): Make static. Adjust for renamed defines. (x86_64_frame_init_saved_regs): Remove function. (x86_64_push_arguments): Make static. Change to accept a regcache as argument. (x86_64_store_return_value, x86_64_extract_return_value): Make static. Rewrite based on i386 counterparts. (x86_64_push_dummy_call): New function. (X86_64_NUM_SAVED_REGS): New define. (x86_64_register_number): Remove function. (x86_64_store_struct_return): Remove function. (x86_64_frameless_function_invocation, x86_64_function_has_prologue): Remove functions. (PROLOG_BUFSIZE): Remove define. (struct x86_64_frame_cache): New structure. (x86_64_alloc_frame_cache, x86_64_analyze_prologue, x86_64_frame_cache, x86_64_frame_this_id, x86_64_frame_prev_register, x86_64_frame_p, x86_64_sigtramp_frame_cache, x86_64_sigtramp_frame_this_id, x86_64_sigtramp_frame_prev_register, x86_sigtramp_frame_p): New functions. (x86_64_frame_unwind, x86_64_sigtramp_frame_unwind): New variables. (x86_64_skip_prologue): Rewrite in terms of x86_64_analyze_prologue. (x86_64_frame_base_address): New function. (x86_64_frame_base): New variable. (x86_64_save_dummy_frame_tos, x86_64_unwind_dummy_id): Rewrite. (x86_64_init_abi): Set register_type and push_dummy_call. Don't set deprecated_fp_regnum, deprecated_register_size, deprecated_register_bytes, register_raw_size, register_byte, register_virtual_type, register_convertiable, register_convert_to_virtual, convert_to_raw, deprecated_get_saved_register, deprecated_target_read_fp, deprecated_push_arguments, deprecated_push_return_address, deprecated_pop_frame, deprecated_store_struct_return, deprecated_frame_init_saved_regs, deprecated_frame_chain, frameless_function_invocation, deprecated_frame_saved_pc, deprecated_saved_pc_after_call, frame_num_args, pc_in_sigtramp, dwarf2_build_frame_info, deprecated_init_extra_frame_info, deprecated_init_frame_pc and virtual_frame_pointer. Call frame_unwind_append_predicate to register x86_64_sigtramp_frame_p and x86_64_frame_p. Call frame_base_set_default to register x86_64_frame_base. (I387_FISEG_REGNUM, I387_FOSEG_REGNUM): New defines. (x86_64_supply_fxsave, x86_64_fill_fxsave): New functions. (_initialize_x86_64_tdep): Remove function. * x86-64-linux-tdep.c: Don't include "dwarf2cfi.h". (LINUX_SIGINFO_SIZE, LINUX_UCONTEXT_SIGCONTEXT_OFFSET, LINUX_SIGCONTEXT_PC_OFFSET, LINUX_SIGCONTEXT_FP_OFFSET): Don't define. (X86_64_LINUX_UCONTEXT_SIGCONTEXT_OFFSET): Define. (x86_64_linux_sigcontext_addr): Rewrite. (x86_64_linux_sigtramp_saved_pc, x86_64_linux_saved_pc_after_call, x86_64_linux_frame_saved_pc): Remove functions. (x86_64_linux_pc_in_sigtramp): Renamed from x86_64_linux_in_sigtramp. Try harder to recognize a signal trampoline. (x86_64_linux_frame_chain, x86_64_init_frame_pc): Remove_functions. (x86_64_linux_init_abi): Set pc_in_sigtramp. Initialize TDEP->sigcontext_addr, TDEP->sc_pc_offset and TDEP->sc_sp_offset. * x86-64-linux-nat.c: Sync with i386-linux-tdep.c. (x86_64_regmap): Rename to regmap. (GETREGS_SUPPLIES): Use X86_64_NUM_GREGS instead of x86_64_num_gregs. (supply_gregset, fill_gregset): Likewise. Use regmap instead of x86_64_regmap. (x86_64_fxsave_offset): Remove function. (supply_fpregset): Simply call x86_64_supply_fxsave. (fill_fpregset): Simply call x86_64_fill_fxsave. (fetch_inferior_registers, store_inferior_registers): Avoid asignment in if-statement. (LINUX_SYSCALL_LEN, LINUX_SYSCALL_REGNUM, SYS_Sigreturn, SYS_rt_sigreturn, LINUX_SIGCONTEXT_EFLAGS_OFFSET, LINUX_UCONTEXT_SIGCONTEXT_OFFSET): Remove defines. (fetch_core_registers): Remove function. (linux_elf_core_fns): Remove. (offsetoff): Don't define. (_initialize_x86_64_linux_nat, kernel_u_size): Remove functions. * config/i386/x86-64linux.mt (TDEPFILES): Add i386-linux-tdep.o. * config/i386/x86-64linux.mh (NATDEPFILES): Remove core-aout.o, add core-regset.o. * config/i386/nm-x86-64linux.h: Use NM_X86_64_LINUX_H for protection against multiple includes instead of NM_X86_64_h. Add various comments. Include "config/nm-linux.h". Don't include <signal.h>. (REGISTER_U_ADDR, KERNEL_U_SIZE, U_REGS_OFFSET, KERN_U_ADDR, GET_THREAD_SIGNALS): Remove defines. (x86_64_register_u_addr, kernel_u_size, lin_thread_get_thread_signals): Remove prototypes. (PTRACE_ARG3_TYPE, PTRACE_XFER_TYPE): Define to `long'. [HAVE_LINK_H]: Don't include "solib.h". [HAVE_LINK_H] (SVR4_SHARED_LIBS): Remove define. * config/i386/tm-x86-64linux.h: Fix comments. * Makefile.in (x86-64-linux-nat.o, x86_64-linux-tdep.o, x86-64-tdep.o): Update dependencies.
2003-05-31 10:15:38 +02:00
/* Continue the iteration. */
gdb/ 2011-12-14 Pedro Alves <pedro@codesourcery.com> PR threads/10729 * linux-nat.c (linux_nat_new_thread): Change parameter to an lwp pointer. (linux_nat_prepare_to_resume): New global. (lwp_free): New. (purge_lwp_list): Use it. (add_lwp): Call linux_nat_new_thread even on the first LWP. Adjust to interface change. (delete_lwp): Call lwp_free instead of xfree. (detach_callback, linux_nat_detach, resume_lwp, linux_nat_resume) (linux_handle_syscall_trap, linux_handle_extended_wait) (linux_nat_filter_event, resume_stopped_resumed_lwps): Call linux_nat_prepare_to_resume before resuming. (linux_stop_lwp): New. (linux_nat_set_new_thread): Adjust. (linux_nat_set_prepare_to_resume): New. * linux-nat.h (struct arch_lwp_info): Forward declare. (struct lwp_info) <arch_private>: New field. (linux_stop_lwp): Declare. (linux_nat_set_new_thread): Adjust. (linux_nat_set_prepare_to_resume): New. * i386-nat.c (DR_NADDR, DR_STATUS, DR_CONTROL) (struct i386_debug_reg_state): Move to i386-nat.h. (dr_mirror): Comment. (i386_debug_reg_state): New. (i386_update_inferior_debug_regs): Simplify. (i386_stopped_data_address): Use the debug register state from the inferior, not from the local cache. * i386-nat.h (struct i386_dr_low_type): Delete reset_addr and unset_status fields. New get_addr and get_control fields. (DR_FIRSTADDR, DR_LASTADDR, DR_CONTROL): Moved from i386-nat.c. (DR_NADDR, DR_STATUS): New. (struct i386_debug_reg_state): Moved from i386-nat.c. * amd64-linux-nat.c (struct arch_lwp_info): New. (amd64_linux_dr): Delete global. (amd64_linux_dr_get_addr): New. (amd64_linux_dr_get_control): New. (amd64_linux_dr_unset_status): Delete. (amd64_linux_dr_set_addr): Reimplement. (amd64_linux_dr_reset_addr): Delete. (update_debug_registers_callback): New. (amd64_linux_dr_set_control): Reimplement. (amd64_linux_dr_set_addr): Reimplement. (amd64_linux_prepare_to_resume): New. (amd64_linux_new_thread): Change parameter to an lwp pointer. Reimplement. (_initialize_amd64_linux_nat): No longer install i386_dr_low.reset_addr and i386_dr_low.unset_status. Install amd64_linux_dr_get_control as i386_dr_low.get_control. Install amd64_linux_dr_get_addr as i386_dr_low.get_addr. Install amd64_linux_prepare_to_resume. * i386-linux-nat.c (DR_FIRSTADDR, DR_LASTADDR, DR_STATUS) (DR_CONTROL): Delete. (struct arch_lwp_info): New. (i386_linux_dr): Delete global. (i386_linux_dr_set_control): Reimplement. (i386_linux_dr_get_addr): New. (i386_linux_dr_set_addr): Reimplement. (i386_linux_dr_get_control): New. (update_debug_registers_callback): New. (i386_linux_dr_unset_status): Delete. (i386_linux_dr_set_addr): Reimplement. (i386_linux_prepare_to_resume): New. (i386_linux_new_thread): Change parameter to an lwp pointer. Reimplement. (_initialize_i386_linux_nat): No longer install i386_dr_low.reset_addr and i386_dr_low.unset_status. Install i386_linux_dr_get_control as i386_dr_low.get_control. Install i386_linux_dr_get_addr as i386_dr_low.get_addr. Install i386_linux_prepare_to_resume. * arm-linux-nat.c (arm_linux_new_thread): Change parameter to an lwp pointer. Adjust. * ia64-linux-nat.c (ia64_linux_new_thread): Likewise. * mips-linux-nat.c (mips_linux_new_thread): Likewise. * ppc-linux-nat.c (ppc_linux_new_thread): Likewise. * s390-nat.c (s390_fix_watch_points): Likewise. * i386-darwin-nat.c (DR_FIRSTADDR, DR_LASTADDR, DR_STATUS) (DR_CONTROL): Delete. (i386_darwin_dr_reset_addr): Delete. (i386_darwin_dr_get_addr): New. (i386_darwin_dr_get_control): New. * go32-nat.c (go32_get_dr7, go32_get_dr): New. (init_go32_ops): No longer install i386_dr_low.reset_addr. Install go32_get_dr7 as i386_dr_low.get_control. Install go32_get_dr as i386_dr_low.get_addr. * i386bsd-nat.c (i386bsd_dr_get): New. (i386bsd_dr_reset_addr): Delete. (i386bsd_dr_get_addr): New. (i386bsd_dr_get_status): Use i386bsd_dr_get. (i386bsd_dr_get_control): New. * i386bsd-nat.h (i386bsd_dr_reset_addr): Delete. (i386bsd_dr_get_addr): New. (i386bsd_dr_get_control): New. * i386fbsd-nat.c (_initialize_i386fbsd_nat): No longer install i386_dr_low.reset_addr and i386_dr_low.unset_status. Install i386bsd_dr_get_control as i386_dr_low.get_control. Install i386bsd_dr_get_addr as i386_dr_low.get_addr. * windows-nat.c (init_windows_ops): No longer install i386_dr_low.reset_addr and i386_dr_low.unset_status. Install cygwin_get_dr7 as i386_dr_low.get_control. Install cygwin_get_dr as i386_dr_low.get_addr. (cygwin_get_dr): New. (cygwin_get_dr7): New. gdb/testsuite/ 2011-12-14 Pedro Alves <pedro@codesourcery.com> PR threads/10729 * gdb.mi/watch-nonstop.c: New file. * gdb.mi/mi-watch-nonstop.exp: New file.
2011-12-14 18:20:32 +01:00
return 0;
}
gdb/ 2011-12-14 Pedro Alves <pedro@codesourcery.com> PR threads/10729 * linux-nat.c (linux_nat_new_thread): Change parameter to an lwp pointer. (linux_nat_prepare_to_resume): New global. (lwp_free): New. (purge_lwp_list): Use it. (add_lwp): Call linux_nat_new_thread even on the first LWP. Adjust to interface change. (delete_lwp): Call lwp_free instead of xfree. (detach_callback, linux_nat_detach, resume_lwp, linux_nat_resume) (linux_handle_syscall_trap, linux_handle_extended_wait) (linux_nat_filter_event, resume_stopped_resumed_lwps): Call linux_nat_prepare_to_resume before resuming. (linux_stop_lwp): New. (linux_nat_set_new_thread): Adjust. (linux_nat_set_prepare_to_resume): New. * linux-nat.h (struct arch_lwp_info): Forward declare. (struct lwp_info) <arch_private>: New field. (linux_stop_lwp): Declare. (linux_nat_set_new_thread): Adjust. (linux_nat_set_prepare_to_resume): New. * i386-nat.c (DR_NADDR, DR_STATUS, DR_CONTROL) (struct i386_debug_reg_state): Move to i386-nat.h. (dr_mirror): Comment. (i386_debug_reg_state): New. (i386_update_inferior_debug_regs): Simplify. (i386_stopped_data_address): Use the debug register state from the inferior, not from the local cache. * i386-nat.h (struct i386_dr_low_type): Delete reset_addr and unset_status fields. New get_addr and get_control fields. (DR_FIRSTADDR, DR_LASTADDR, DR_CONTROL): Moved from i386-nat.c. (DR_NADDR, DR_STATUS): New. (struct i386_debug_reg_state): Moved from i386-nat.c. * amd64-linux-nat.c (struct arch_lwp_info): New. (amd64_linux_dr): Delete global. (amd64_linux_dr_get_addr): New. (amd64_linux_dr_get_control): New. (amd64_linux_dr_unset_status): Delete. (amd64_linux_dr_set_addr): Reimplement. (amd64_linux_dr_reset_addr): Delete. (update_debug_registers_callback): New. (amd64_linux_dr_set_control): Reimplement. (amd64_linux_dr_set_addr): Reimplement. (amd64_linux_prepare_to_resume): New. (amd64_linux_new_thread): Change parameter to an lwp pointer. Reimplement. (_initialize_amd64_linux_nat): No longer install i386_dr_low.reset_addr and i386_dr_low.unset_status. Install amd64_linux_dr_get_control as i386_dr_low.get_control. Install amd64_linux_dr_get_addr as i386_dr_low.get_addr. Install amd64_linux_prepare_to_resume. * i386-linux-nat.c (DR_FIRSTADDR, DR_LASTADDR, DR_STATUS) (DR_CONTROL): Delete. (struct arch_lwp_info): New. (i386_linux_dr): Delete global. (i386_linux_dr_set_control): Reimplement. (i386_linux_dr_get_addr): New. (i386_linux_dr_set_addr): Reimplement. (i386_linux_dr_get_control): New. (update_debug_registers_callback): New. (i386_linux_dr_unset_status): Delete. (i386_linux_dr_set_addr): Reimplement. (i386_linux_prepare_to_resume): New. (i386_linux_new_thread): Change parameter to an lwp pointer. Reimplement. (_initialize_i386_linux_nat): No longer install i386_dr_low.reset_addr and i386_dr_low.unset_status. Install i386_linux_dr_get_control as i386_dr_low.get_control. Install i386_linux_dr_get_addr as i386_dr_low.get_addr. Install i386_linux_prepare_to_resume. * arm-linux-nat.c (arm_linux_new_thread): Change parameter to an lwp pointer. Adjust. * ia64-linux-nat.c (ia64_linux_new_thread): Likewise. * mips-linux-nat.c (mips_linux_new_thread): Likewise. * ppc-linux-nat.c (ppc_linux_new_thread): Likewise. * s390-nat.c (s390_fix_watch_points): Likewise. * i386-darwin-nat.c (DR_FIRSTADDR, DR_LASTADDR, DR_STATUS) (DR_CONTROL): Delete. (i386_darwin_dr_reset_addr): Delete. (i386_darwin_dr_get_addr): New. (i386_darwin_dr_get_control): New. * go32-nat.c (go32_get_dr7, go32_get_dr): New. (init_go32_ops): No longer install i386_dr_low.reset_addr. Install go32_get_dr7 as i386_dr_low.get_control. Install go32_get_dr as i386_dr_low.get_addr. * i386bsd-nat.c (i386bsd_dr_get): New. (i386bsd_dr_reset_addr): Delete. (i386bsd_dr_get_addr): New. (i386bsd_dr_get_status): Use i386bsd_dr_get. (i386bsd_dr_get_control): New. * i386bsd-nat.h (i386bsd_dr_reset_addr): Delete. (i386bsd_dr_get_addr): New. (i386bsd_dr_get_control): New. * i386fbsd-nat.c (_initialize_i386fbsd_nat): No longer install i386_dr_low.reset_addr and i386_dr_low.unset_status. Install i386bsd_dr_get_control as i386_dr_low.get_control. Install i386bsd_dr_get_addr as i386_dr_low.get_addr. * windows-nat.c (init_windows_ops): No longer install i386_dr_low.reset_addr and i386_dr_low.unset_status. Install cygwin_get_dr7 as i386_dr_low.get_control. Install cygwin_get_dr as i386_dr_low.get_addr. (cygwin_get_dr): New. (cygwin_get_dr7): New. gdb/testsuite/ 2011-12-14 Pedro Alves <pedro@codesourcery.com> PR threads/10729 * gdb.mi/watch-nonstop.c: New file. * gdb.mi/mi-watch-nonstop.exp: New file.
2011-12-14 18:20:32 +01:00
/* Set DR_CONTROL to CONTROL in all LWPs of the current inferior. */
Remove all i386 debug register low level macros in config nm files. (I386_DR_LOW_SET_ADDR, I386_DR_LOW_RESET_ADDR): Remove. (I386_DR_LOW_GET_STATUS, I386_DR_LOW_SET_CONTROL): Remove. (I386_USE_GENERIC_WATCHPOIINTS): Remove. * i386-nat.h: New file (adapted from config/i386/nm-i386.h). (struct i386_dr_low_type): New type. (i386_dr_low): New global variable. * i386-nat.c (TARGET_HAS_DR_LEN_8): Update macro. (i386_insert_aligned_watchpoint): Replace i386 dr low macros by i386_dr_low struct variable fields. (i386_remove_aligned_watchpoint): Likewise. (i386_stopped_data_address): Likewise. (i386_stopped_by_hwbp): Likewise. (show_debug_regs_command_added): New static variable. (add_show_debug_regs_command): New static function. (i386_use_watchpoints): Call add_show_debug_regs_command if not done. (i386_set_debug_register_length): New function. (_initialize_i386_nat): Delete. * amd64-linux-nat.c: Include "i386-nat.h". (amd64_linux_dr_set_control): Change to static. (amd64_linux_dr_get_status): Change to static. (amd64_linux_dr_set_addr,amd64_linux_dr_reset_addr): Likewise. (_initialize_amd64_linux_nat): Set i386_dr_low variable fields. * go32-nat.c: Include "i386-nat.h". (go32_set_addr): Change to static. (go32_set_dr7): Change to static. Change arg type to unisgned long. (go32_get_dr6): Change to static. Change return type to unisnged long. (init_go32_ops): Set i386_dr_low variable fields. * i386-linux-nat.c: Include "i386-nat.h". (i386_linux_dr_set_control, i386_linux_dr_get_status): Change to static. (i386_linux_dr_set_addr, i386_linux_dr_reset_addr): Idem. (_initialize_i386_linux_nat): Set i386_dr_low variable fields. * i386bsd-nat.h: Declare functions used for i386_dr_low fields in i386fbsd-nat.c. * i386fbsd-nat.c: Include "i386-nat.h". (_initialize_i386fbsd_nat): Set i386_dr_low variable fields. * windows-nat.c: Include "i386-nat.h". (cygwin_set_dr, cygwin_get_dr6, cygwin_set_dr7): Add prototypes. Change to static. (cygwin_get_dr6): Change return type to unisnged long. (cygwin_set_dr7): Change arg type to unisgned long. (init_windows_ops): Set i386_dr_low function fields. * amd64-windows-nat.c (_initialize_amd64_windows_nat): Call i386_set_debug_register_length. * i386-windows-nat.c (_initialize_i386_windows_nat): Likewise. * config/i386/nm-cygwin.h: Remove all I386_* macros. * config/i386/nm-cygwin64.h: Likewise. * config/i386/nm-fbsd.h: Likewise. * config/i386/nm-linux.h: Likewise. * config/i386/nm-i386.h: Remove completely. * config/i386/nm-go32.h: Remove completely. * config/i386/nm-linux64.h: Remove completely. * config/i386/go32.mh (NAT_FILE): Remove entry. * config/i386/linux64.h (NAT_FILE): Change to config/nm-linux.h.
2009-05-14 11:37:00 +02:00
static void
gdb/ 2011-12-14 Pedro Alves <pedro@codesourcery.com> PR threads/10729 * linux-nat.c (linux_nat_new_thread): Change parameter to an lwp pointer. (linux_nat_prepare_to_resume): New global. (lwp_free): New. (purge_lwp_list): Use it. (add_lwp): Call linux_nat_new_thread even on the first LWP. Adjust to interface change. (delete_lwp): Call lwp_free instead of xfree. (detach_callback, linux_nat_detach, resume_lwp, linux_nat_resume) (linux_handle_syscall_trap, linux_handle_extended_wait) (linux_nat_filter_event, resume_stopped_resumed_lwps): Call linux_nat_prepare_to_resume before resuming. (linux_stop_lwp): New. (linux_nat_set_new_thread): Adjust. (linux_nat_set_prepare_to_resume): New. * linux-nat.h (struct arch_lwp_info): Forward declare. (struct lwp_info) <arch_private>: New field. (linux_stop_lwp): Declare. (linux_nat_set_new_thread): Adjust. (linux_nat_set_prepare_to_resume): New. * i386-nat.c (DR_NADDR, DR_STATUS, DR_CONTROL) (struct i386_debug_reg_state): Move to i386-nat.h. (dr_mirror): Comment. (i386_debug_reg_state): New. (i386_update_inferior_debug_regs): Simplify. (i386_stopped_data_address): Use the debug register state from the inferior, not from the local cache. * i386-nat.h (struct i386_dr_low_type): Delete reset_addr and unset_status fields. New get_addr and get_control fields. (DR_FIRSTADDR, DR_LASTADDR, DR_CONTROL): Moved from i386-nat.c. (DR_NADDR, DR_STATUS): New. (struct i386_debug_reg_state): Moved from i386-nat.c. * amd64-linux-nat.c (struct arch_lwp_info): New. (amd64_linux_dr): Delete global. (amd64_linux_dr_get_addr): New. (amd64_linux_dr_get_control): New. (amd64_linux_dr_unset_status): Delete. (amd64_linux_dr_set_addr): Reimplement. (amd64_linux_dr_reset_addr): Delete. (update_debug_registers_callback): New. (amd64_linux_dr_set_control): Reimplement. (amd64_linux_dr_set_addr): Reimplement. (amd64_linux_prepare_to_resume): New. (amd64_linux_new_thread): Change parameter to an lwp pointer. Reimplement. (_initialize_amd64_linux_nat): No longer install i386_dr_low.reset_addr and i386_dr_low.unset_status. Install amd64_linux_dr_get_control as i386_dr_low.get_control. Install amd64_linux_dr_get_addr as i386_dr_low.get_addr. Install amd64_linux_prepare_to_resume. * i386-linux-nat.c (DR_FIRSTADDR, DR_LASTADDR, DR_STATUS) (DR_CONTROL): Delete. (struct arch_lwp_info): New. (i386_linux_dr): Delete global. (i386_linux_dr_set_control): Reimplement. (i386_linux_dr_get_addr): New. (i386_linux_dr_set_addr): Reimplement. (i386_linux_dr_get_control): New. (update_debug_registers_callback): New. (i386_linux_dr_unset_status): Delete. (i386_linux_dr_set_addr): Reimplement. (i386_linux_prepare_to_resume): New. (i386_linux_new_thread): Change parameter to an lwp pointer. Reimplement. (_initialize_i386_linux_nat): No longer install i386_dr_low.reset_addr and i386_dr_low.unset_status. Install i386_linux_dr_get_control as i386_dr_low.get_control. Install i386_linux_dr_get_addr as i386_dr_low.get_addr. Install i386_linux_prepare_to_resume. * arm-linux-nat.c (arm_linux_new_thread): Change parameter to an lwp pointer. Adjust. * ia64-linux-nat.c (ia64_linux_new_thread): Likewise. * mips-linux-nat.c (mips_linux_new_thread): Likewise. * ppc-linux-nat.c (ppc_linux_new_thread): Likewise. * s390-nat.c (s390_fix_watch_points): Likewise. * i386-darwin-nat.c (DR_FIRSTADDR, DR_LASTADDR, DR_STATUS) (DR_CONTROL): Delete. (i386_darwin_dr_reset_addr): Delete. (i386_darwin_dr_get_addr): New. (i386_darwin_dr_get_control): New. * go32-nat.c (go32_get_dr7, go32_get_dr): New. (init_go32_ops): No longer install i386_dr_low.reset_addr. Install go32_get_dr7 as i386_dr_low.get_control. Install go32_get_dr as i386_dr_low.get_addr. * i386bsd-nat.c (i386bsd_dr_get): New. (i386bsd_dr_reset_addr): Delete. (i386bsd_dr_get_addr): New. (i386bsd_dr_get_status): Use i386bsd_dr_get. (i386bsd_dr_get_control): New. * i386bsd-nat.h (i386bsd_dr_reset_addr): Delete. (i386bsd_dr_get_addr): New. (i386bsd_dr_get_control): New. * i386fbsd-nat.c (_initialize_i386fbsd_nat): No longer install i386_dr_low.reset_addr and i386_dr_low.unset_status. Install i386bsd_dr_get_control as i386_dr_low.get_control. Install i386bsd_dr_get_addr as i386_dr_low.get_addr. * windows-nat.c (init_windows_ops): No longer install i386_dr_low.reset_addr and i386_dr_low.unset_status. Install cygwin_get_dr7 as i386_dr_low.get_control. Install cygwin_get_dr as i386_dr_low.get_addr. (cygwin_get_dr): New. (cygwin_get_dr7): New. gdb/testsuite/ 2011-12-14 Pedro Alves <pedro@codesourcery.com> PR threads/10729 * gdb.mi/watch-nonstop.c: New file. * gdb.mi/mi-watch-nonstop.exp: New file.
2011-12-14 18:20:32 +01:00
amd64_linux_dr_set_control (unsigned long control)
{
[native x86 GNU/Linux] Access debug register mirror from the corresponding process. While reviewing the native AArch64 patch, I noticed a problem: On 02/06/2013 08:46 PM, Pedro Alves wrote: > >> > +static void >> > +aarch64_linux_prepare_to_resume (struct lwp_info *lwp) >> > +{ >> > + struct arch_lwp_info *info = lwp->arch_private; >> > + >> > + /* NULL means this is the main thread still going through the shell, >> > + or, no watchpoint has been set yet. In that case, there's >> > + nothing to do. */ >> > + if (info == NULL) >> > + return; >> > + >> > + if (DR_HAS_CHANGED (info->dr_changed_bp) >> > + || DR_HAS_CHANGED (info->dr_changed_wp)) >> > + { >> > + int tid = GET_LWP (lwp->ptid); >> > + struct aarch64_debug_reg_state *state = aarch64_get_debug_reg_state (); > Hmm. This is always fetching the debug_reg_state of > the current inferior, but may not be the inferior of lwp. > I see the same bug on x86. Sorry about that. I'll fix it. A natural fix would be to make xxx_get_debug_reg_state take an inferior argument, but that doesn't work because of the case where we detach breakpoints/watchpoints from the child fork, at a time there's no inferior for the child fork at all. We do a nasty hack in i386_inferior_data_get, but that relies on all callers pointing the current inferior to the correct inferior, which isn't actually being done by all callers, and I don't think we want to enforce that -- deep in the bowls of linux-nat.c, there are many cases we resume lwps behind the scenes, and it's be better to not have that code rely on global state (as it doesn't today). The fix is to decouple the watchpoints code from inferiors, making it track target processes instead. This way, we can freely keep track of the watchpoint mirrors for these processes behind the core's back. Checkpoints also play dirty tricks with swapping the process behind the inferior, so they get special treatment too in the patch (which just amounts to calling a new hook). Instead of the old hack in i386_inferior_data_get, where we returned a copy of the current inferior's debug registers mirror, as soon as we detect a fork in the target, we copy the debug register mirror from the parent to the child process. I don't have an old kernel handy to test, but I stepped through gdb doing the watchpoint removal in the fork child in the watchpoint-fork test seeing that the debug registers end up cleared in the child. I didn't find the need for linux_nat_iterate_watchpoint_lwps. If we use plain iterate_over_lwps instead, what happens is that when removing watchpoints, that iterate_over_lwps doesn't actually iterate over anything, since the fork child is not added to the lwp list until later, at detach time, in linux_child_follow_fork. And if we don't iterate over that lwp, we don't mark its debug registers as needing update. But linux_child_follow_fork takes care of doing that explicitly: child_lp = add_lwp (inferior_ptid); child_lp->stopped = 1; child_lp->last_resume_kind = resume_stop; make_cleanup (delete_lwp_cleanup, child_lp); /* CHILD_LP has new PID, therefore linux_nat_new_thread is not called for it. See i386_inferior_data_get for the Linux kernel specifics. Ensure linux_nat_prepare_to_resume will reset the hardware debug registers. It is done by the linux_nat_new_thread call, which is being skipped in add_lwp above for the first lwp of a pid. */ gdb_assert (num_lwps (GET_PID (child_lp->ptid)) == 1); if (linux_nat_new_thread != NULL) linux_nat_new_thread (child_lp); if (linux_nat_prepare_to_resume != NULL) linux_nat_prepare_to_resume (child_lp); ptrace (PTRACE_DETACH, child_pid, 0, 0); so unless I'm missing something (quite possible) it ends up all the same. But, the !detach-on-fork, and the "follow-fork child" paths should also call linux_nat_new_thread, and they don't presently. It seems to me in those cases we're not clearing debug regs correctly when that's needed. Instead of copying that bit that works around add_lwp bypassing the linux_nat_new_thread call, I thought it'd be better to add an add_initial_lwp call to be used in the case we really need to bypass linux_nat_new_thread, and make add_lwp always call linux_nat_new_thread. i386_cleanup_dregs is rewritten to forget about the current process debug mirrors, which takes cares of other i386 ports. Only a couple of extra tweaks here and there were needed, as some targets wheren't actually calling i386_cleanup_dregs. Tested on Fedora 17 x86_64 -m64/-m32. GDBserver already fetches the i386_debug_reg_state from the right process, and, it doesn't handle forks at all, so no fix is needed over there. gdb/ 2013-02-13 Pedro Alves <palves@redhat.com> * amd64-linux-nat.c (update_debug_registers_callback): Update comment. (amd64_linux_dr_set_control, amd64_linux_dr_set_addr): Use iterate_over_lwps. (amd64_linux_prepare_to_resume): Pass the lwp's pid to i386_debug_reg_state. (amd64_linux_new_fork): New function. (_initialize_amd64_linux_nat): Install amd64_linux_new_fork as linux_nat_new_fork hook, and i386_forget_process as linux_nat_forget_process hook. * i386-linux-nat.c (update_debug_registers_callback): Update comment. (amd64_linux_dr_set_control, amd64_linux_dr_set_addr): Use iterate_over_lwps. (i386_linux_prepare_to_resume): Pass the lwp's pid to i386_debug_reg_state. (i386_linux_new_fork): New function. (_initialize_i386_linux_nat): Install i386_linux_new_fork as linux_nat_new_fork hook, and i386_forget_process as linux_nat_forget_process hook. * i386-nat.c (i386_init_dregs): Delete. (i386_inferior_data, struct i386_inferior_data): Delete. (struct i386_process_info): New. (i386_process_list): New global. (i386_find_process_pid, i386_add_process, i386_process_info_get): New functions. (i386_inferior_data_get): Delete. (i386_process_info_get): New function. (i386_debug_reg_state): New parameter 'pid'. Reimplement. (i386_forget_process): New function. (i386_cleanup_dregs): Rewrite. (i386_update_inferior_debug_regs, i386_insert_watchpoint) (i386_remove_watchpoint, i386_region_ok_for_watchpoint) (i386_stopped_data_address, i386_insert_hw_breakpoint) (i386_remove_hw_breakpoint): Adjust to pass the current process id to i386_debug_reg_state. (i386_use_watchpoints): Don't register inferior data. * i386-nat.h (i386_debug_reg_state): Add new 'pid' parameter, and adjust comment. (i386_forget_process): Declare. * linux-fork.c (delete_fork): Call linux_nat_forget_process. * linux-nat.c (linux_nat_new_fork, linux_nat_forget_process_hook): New static globals. (linux_child_follow_fork): Don't call linux_nat_new_thread here. (add_initial_lwp): New, factored out from ... (add_lwp): ... this. Don't check the number of lwps before calling linux_nat_new_thread. (linux_nat_iterate_watchpoint_lwps): Delete. (linux_nat_attach): Use add_initial_lwp instead of add_lwp. (linux_handle_extended_wait): Call the linux_nat_new_fork hook on forks and vforks. (linux_nat_wait_1): Use add_initial_lwp instead of add_lwp for the initial lwp. (linux_nat_kill, linux_nat_mourn_inferior): Call linux_nat_forget_process. (linux_nat_set_new_fork, linux_nat_set_forget_process) (linux_nat_forget_process): New functions. * linux-nat.h (linux_nat_iterate_watchpoint_lwps_ftype): Delete type. (linux_nat_iterate_watchpoint_lwps): Delete declaration. (linux_nat_new_fork_ftype, linux_nat_forget_process_ftype): New types. (linux_nat_set_new_fork, linux_nat_set_forget_process) (linux_nat_forget_process): New declarations. * amd64fbsd-nat.c (super_mourn_inferior): New global. (amd64fbsd_mourn_inferior): New function. (_initialize_amd64fbsd_nat): Override to_mourn_inferior. * windows-nat.c (windows_detach): Call i386_cleanup_dregs.
2013-02-13 15:59:49 +01:00
ptid_t pid_ptid = pid_to_ptid (ptid_get_pid (inferior_ptid));
iterate_over_lwps (pid_ptid, update_debug_registers_callback, NULL);
}
gdb/ 2011-12-14 Pedro Alves <pedro@codesourcery.com> PR threads/10729 * linux-nat.c (linux_nat_new_thread): Change parameter to an lwp pointer. (linux_nat_prepare_to_resume): New global. (lwp_free): New. (purge_lwp_list): Use it. (add_lwp): Call linux_nat_new_thread even on the first LWP. Adjust to interface change. (delete_lwp): Call lwp_free instead of xfree. (detach_callback, linux_nat_detach, resume_lwp, linux_nat_resume) (linux_handle_syscall_trap, linux_handle_extended_wait) (linux_nat_filter_event, resume_stopped_resumed_lwps): Call linux_nat_prepare_to_resume before resuming. (linux_stop_lwp): New. (linux_nat_set_new_thread): Adjust. (linux_nat_set_prepare_to_resume): New. * linux-nat.h (struct arch_lwp_info): Forward declare. (struct lwp_info) <arch_private>: New field. (linux_stop_lwp): Declare. (linux_nat_set_new_thread): Adjust. (linux_nat_set_prepare_to_resume): New. * i386-nat.c (DR_NADDR, DR_STATUS, DR_CONTROL) (struct i386_debug_reg_state): Move to i386-nat.h. (dr_mirror): Comment. (i386_debug_reg_state): New. (i386_update_inferior_debug_regs): Simplify. (i386_stopped_data_address): Use the debug register state from the inferior, not from the local cache. * i386-nat.h (struct i386_dr_low_type): Delete reset_addr and unset_status fields. New get_addr and get_control fields. (DR_FIRSTADDR, DR_LASTADDR, DR_CONTROL): Moved from i386-nat.c. (DR_NADDR, DR_STATUS): New. (struct i386_debug_reg_state): Moved from i386-nat.c. * amd64-linux-nat.c (struct arch_lwp_info): New. (amd64_linux_dr): Delete global. (amd64_linux_dr_get_addr): New. (amd64_linux_dr_get_control): New. (amd64_linux_dr_unset_status): Delete. (amd64_linux_dr_set_addr): Reimplement. (amd64_linux_dr_reset_addr): Delete. (update_debug_registers_callback): New. (amd64_linux_dr_set_control): Reimplement. (amd64_linux_dr_set_addr): Reimplement. (amd64_linux_prepare_to_resume): New. (amd64_linux_new_thread): Change parameter to an lwp pointer. Reimplement. (_initialize_amd64_linux_nat): No longer install i386_dr_low.reset_addr and i386_dr_low.unset_status. Install amd64_linux_dr_get_control as i386_dr_low.get_control. Install amd64_linux_dr_get_addr as i386_dr_low.get_addr. Install amd64_linux_prepare_to_resume. * i386-linux-nat.c (DR_FIRSTADDR, DR_LASTADDR, DR_STATUS) (DR_CONTROL): Delete. (struct arch_lwp_info): New. (i386_linux_dr): Delete global. (i386_linux_dr_set_control): Reimplement. (i386_linux_dr_get_addr): New. (i386_linux_dr_set_addr): Reimplement. (i386_linux_dr_get_control): New. (update_debug_registers_callback): New. (i386_linux_dr_unset_status): Delete. (i386_linux_dr_set_addr): Reimplement. (i386_linux_prepare_to_resume): New. (i386_linux_new_thread): Change parameter to an lwp pointer. Reimplement. (_initialize_i386_linux_nat): No longer install i386_dr_low.reset_addr and i386_dr_low.unset_status. Install i386_linux_dr_get_control as i386_dr_low.get_control. Install i386_linux_dr_get_addr as i386_dr_low.get_addr. Install i386_linux_prepare_to_resume. * arm-linux-nat.c (arm_linux_new_thread): Change parameter to an lwp pointer. Adjust. * ia64-linux-nat.c (ia64_linux_new_thread): Likewise. * mips-linux-nat.c (mips_linux_new_thread): Likewise. * ppc-linux-nat.c (ppc_linux_new_thread): Likewise. * s390-nat.c (s390_fix_watch_points): Likewise. * i386-darwin-nat.c (DR_FIRSTADDR, DR_LASTADDR, DR_STATUS) (DR_CONTROL): Delete. (i386_darwin_dr_reset_addr): Delete. (i386_darwin_dr_get_addr): New. (i386_darwin_dr_get_control): New. * go32-nat.c (go32_get_dr7, go32_get_dr): New. (init_go32_ops): No longer install i386_dr_low.reset_addr. Install go32_get_dr7 as i386_dr_low.get_control. Install go32_get_dr as i386_dr_low.get_addr. * i386bsd-nat.c (i386bsd_dr_get): New. (i386bsd_dr_reset_addr): Delete. (i386bsd_dr_get_addr): New. (i386bsd_dr_get_status): Use i386bsd_dr_get. (i386bsd_dr_get_control): New. * i386bsd-nat.h (i386bsd_dr_reset_addr): Delete. (i386bsd_dr_get_addr): New. (i386bsd_dr_get_control): New. * i386fbsd-nat.c (_initialize_i386fbsd_nat): No longer install i386_dr_low.reset_addr and i386_dr_low.unset_status. Install i386bsd_dr_get_control as i386_dr_low.get_control. Install i386bsd_dr_get_addr as i386_dr_low.get_addr. * windows-nat.c (init_windows_ops): No longer install i386_dr_low.reset_addr and i386_dr_low.unset_status. Install cygwin_get_dr7 as i386_dr_low.get_control. Install cygwin_get_dr as i386_dr_low.get_addr. (cygwin_get_dr): New. (cygwin_get_dr7): New. gdb/testsuite/ 2011-12-14 Pedro Alves <pedro@codesourcery.com> PR threads/10729 * gdb.mi/watch-nonstop.c: New file. * gdb.mi/mi-watch-nonstop.exp: New file.
2011-12-14 18:20:32 +01:00
/* Set address REGNUM (zero based) to ADDR in all LWPs of the current
inferior. */
gdb/ 2011-12-14 Pedro Alves <pedro@codesourcery.com> PR threads/10729 * linux-nat.c (linux_nat_new_thread): Change parameter to an lwp pointer. (linux_nat_prepare_to_resume): New global. (lwp_free): New. (purge_lwp_list): Use it. (add_lwp): Call linux_nat_new_thread even on the first LWP. Adjust to interface change. (delete_lwp): Call lwp_free instead of xfree. (detach_callback, linux_nat_detach, resume_lwp, linux_nat_resume) (linux_handle_syscall_trap, linux_handle_extended_wait) (linux_nat_filter_event, resume_stopped_resumed_lwps): Call linux_nat_prepare_to_resume before resuming. (linux_stop_lwp): New. (linux_nat_set_new_thread): Adjust. (linux_nat_set_prepare_to_resume): New. * linux-nat.h (struct arch_lwp_info): Forward declare. (struct lwp_info) <arch_private>: New field. (linux_stop_lwp): Declare. (linux_nat_set_new_thread): Adjust. (linux_nat_set_prepare_to_resume): New. * i386-nat.c (DR_NADDR, DR_STATUS, DR_CONTROL) (struct i386_debug_reg_state): Move to i386-nat.h. (dr_mirror): Comment. (i386_debug_reg_state): New. (i386_update_inferior_debug_regs): Simplify. (i386_stopped_data_address): Use the debug register state from the inferior, not from the local cache. * i386-nat.h (struct i386_dr_low_type): Delete reset_addr and unset_status fields. New get_addr and get_control fields. (DR_FIRSTADDR, DR_LASTADDR, DR_CONTROL): Moved from i386-nat.c. (DR_NADDR, DR_STATUS): New. (struct i386_debug_reg_state): Moved from i386-nat.c. * amd64-linux-nat.c (struct arch_lwp_info): New. (amd64_linux_dr): Delete global. (amd64_linux_dr_get_addr): New. (amd64_linux_dr_get_control): New. (amd64_linux_dr_unset_status): Delete. (amd64_linux_dr_set_addr): Reimplement. (amd64_linux_dr_reset_addr): Delete. (update_debug_registers_callback): New. (amd64_linux_dr_set_control): Reimplement. (amd64_linux_dr_set_addr): Reimplement. (amd64_linux_prepare_to_resume): New. (amd64_linux_new_thread): Change parameter to an lwp pointer. Reimplement. (_initialize_amd64_linux_nat): No longer install i386_dr_low.reset_addr and i386_dr_low.unset_status. Install amd64_linux_dr_get_control as i386_dr_low.get_control. Install amd64_linux_dr_get_addr as i386_dr_low.get_addr. Install amd64_linux_prepare_to_resume. * i386-linux-nat.c (DR_FIRSTADDR, DR_LASTADDR, DR_STATUS) (DR_CONTROL): Delete. (struct arch_lwp_info): New. (i386_linux_dr): Delete global. (i386_linux_dr_set_control): Reimplement. (i386_linux_dr_get_addr): New. (i386_linux_dr_set_addr): Reimplement. (i386_linux_dr_get_control): New. (update_debug_registers_callback): New. (i386_linux_dr_unset_status): Delete. (i386_linux_dr_set_addr): Reimplement. (i386_linux_prepare_to_resume): New. (i386_linux_new_thread): Change parameter to an lwp pointer. Reimplement. (_initialize_i386_linux_nat): No longer install i386_dr_low.reset_addr and i386_dr_low.unset_status. Install i386_linux_dr_get_control as i386_dr_low.get_control. Install i386_linux_dr_get_addr as i386_dr_low.get_addr. Install i386_linux_prepare_to_resume. * arm-linux-nat.c (arm_linux_new_thread): Change parameter to an lwp pointer. Adjust. * ia64-linux-nat.c (ia64_linux_new_thread): Likewise. * mips-linux-nat.c (mips_linux_new_thread): Likewise. * ppc-linux-nat.c (ppc_linux_new_thread): Likewise. * s390-nat.c (s390_fix_watch_points): Likewise. * i386-darwin-nat.c (DR_FIRSTADDR, DR_LASTADDR, DR_STATUS) (DR_CONTROL): Delete. (i386_darwin_dr_reset_addr): Delete. (i386_darwin_dr_get_addr): New. (i386_darwin_dr_get_control): New. * go32-nat.c (go32_get_dr7, go32_get_dr): New. (init_go32_ops): No longer install i386_dr_low.reset_addr. Install go32_get_dr7 as i386_dr_low.get_control. Install go32_get_dr as i386_dr_low.get_addr. * i386bsd-nat.c (i386bsd_dr_get): New. (i386bsd_dr_reset_addr): Delete. (i386bsd_dr_get_addr): New. (i386bsd_dr_get_status): Use i386bsd_dr_get. (i386bsd_dr_get_control): New. * i386bsd-nat.h (i386bsd_dr_reset_addr): Delete. (i386bsd_dr_get_addr): New. (i386bsd_dr_get_control): New. * i386fbsd-nat.c (_initialize_i386fbsd_nat): No longer install i386_dr_low.reset_addr and i386_dr_low.unset_status. Install i386bsd_dr_get_control as i386_dr_low.get_control. Install i386bsd_dr_get_addr as i386_dr_low.get_addr. * windows-nat.c (init_windows_ops): No longer install i386_dr_low.reset_addr and i386_dr_low.unset_status. Install cygwin_get_dr7 as i386_dr_low.get_control. Install cygwin_get_dr as i386_dr_low.get_addr. (cygwin_get_dr): New. (cygwin_get_dr7): New. gdb/testsuite/ 2011-12-14 Pedro Alves <pedro@codesourcery.com> PR threads/10729 * gdb.mi/watch-nonstop.c: New file. * gdb.mi/mi-watch-nonstop.exp: New file.
2011-12-14 18:20:32 +01:00
static void
amd64_linux_dr_set_addr (int regnum, CORE_ADDR addr)
{
[native x86 GNU/Linux] Access debug register mirror from the corresponding process. While reviewing the native AArch64 patch, I noticed a problem: On 02/06/2013 08:46 PM, Pedro Alves wrote: > >> > +static void >> > +aarch64_linux_prepare_to_resume (struct lwp_info *lwp) >> > +{ >> > + struct arch_lwp_info *info = lwp->arch_private; >> > + >> > + /* NULL means this is the main thread still going through the shell, >> > + or, no watchpoint has been set yet. In that case, there's >> > + nothing to do. */ >> > + if (info == NULL) >> > + return; >> > + >> > + if (DR_HAS_CHANGED (info->dr_changed_bp) >> > + || DR_HAS_CHANGED (info->dr_changed_wp)) >> > + { >> > + int tid = GET_LWP (lwp->ptid); >> > + struct aarch64_debug_reg_state *state = aarch64_get_debug_reg_state (); > Hmm. This is always fetching the debug_reg_state of > the current inferior, but may not be the inferior of lwp. > I see the same bug on x86. Sorry about that. I'll fix it. A natural fix would be to make xxx_get_debug_reg_state take an inferior argument, but that doesn't work because of the case where we detach breakpoints/watchpoints from the child fork, at a time there's no inferior for the child fork at all. We do a nasty hack in i386_inferior_data_get, but that relies on all callers pointing the current inferior to the correct inferior, which isn't actually being done by all callers, and I don't think we want to enforce that -- deep in the bowls of linux-nat.c, there are many cases we resume lwps behind the scenes, and it's be better to not have that code rely on global state (as it doesn't today). The fix is to decouple the watchpoints code from inferiors, making it track target processes instead. This way, we can freely keep track of the watchpoint mirrors for these processes behind the core's back. Checkpoints also play dirty tricks with swapping the process behind the inferior, so they get special treatment too in the patch (which just amounts to calling a new hook). Instead of the old hack in i386_inferior_data_get, where we returned a copy of the current inferior's debug registers mirror, as soon as we detect a fork in the target, we copy the debug register mirror from the parent to the child process. I don't have an old kernel handy to test, but I stepped through gdb doing the watchpoint removal in the fork child in the watchpoint-fork test seeing that the debug registers end up cleared in the child. I didn't find the need for linux_nat_iterate_watchpoint_lwps. If we use plain iterate_over_lwps instead, what happens is that when removing watchpoints, that iterate_over_lwps doesn't actually iterate over anything, since the fork child is not added to the lwp list until later, at detach time, in linux_child_follow_fork. And if we don't iterate over that lwp, we don't mark its debug registers as needing update. But linux_child_follow_fork takes care of doing that explicitly: child_lp = add_lwp (inferior_ptid); child_lp->stopped = 1; child_lp->last_resume_kind = resume_stop; make_cleanup (delete_lwp_cleanup, child_lp); /* CHILD_LP has new PID, therefore linux_nat_new_thread is not called for it. See i386_inferior_data_get for the Linux kernel specifics. Ensure linux_nat_prepare_to_resume will reset the hardware debug registers. It is done by the linux_nat_new_thread call, which is being skipped in add_lwp above for the first lwp of a pid. */ gdb_assert (num_lwps (GET_PID (child_lp->ptid)) == 1); if (linux_nat_new_thread != NULL) linux_nat_new_thread (child_lp); if (linux_nat_prepare_to_resume != NULL) linux_nat_prepare_to_resume (child_lp); ptrace (PTRACE_DETACH, child_pid, 0, 0); so unless I'm missing something (quite possible) it ends up all the same. But, the !detach-on-fork, and the "follow-fork child" paths should also call linux_nat_new_thread, and they don't presently. It seems to me in those cases we're not clearing debug regs correctly when that's needed. Instead of copying that bit that works around add_lwp bypassing the linux_nat_new_thread call, I thought it'd be better to add an add_initial_lwp call to be used in the case we really need to bypass linux_nat_new_thread, and make add_lwp always call linux_nat_new_thread. i386_cleanup_dregs is rewritten to forget about the current process debug mirrors, which takes cares of other i386 ports. Only a couple of extra tweaks here and there were needed, as some targets wheren't actually calling i386_cleanup_dregs. Tested on Fedora 17 x86_64 -m64/-m32. GDBserver already fetches the i386_debug_reg_state from the right process, and, it doesn't handle forks at all, so no fix is needed over there. gdb/ 2013-02-13 Pedro Alves <palves@redhat.com> * amd64-linux-nat.c (update_debug_registers_callback): Update comment. (amd64_linux_dr_set_control, amd64_linux_dr_set_addr): Use iterate_over_lwps. (amd64_linux_prepare_to_resume): Pass the lwp's pid to i386_debug_reg_state. (amd64_linux_new_fork): New function. (_initialize_amd64_linux_nat): Install amd64_linux_new_fork as linux_nat_new_fork hook, and i386_forget_process as linux_nat_forget_process hook. * i386-linux-nat.c (update_debug_registers_callback): Update comment. (amd64_linux_dr_set_control, amd64_linux_dr_set_addr): Use iterate_over_lwps. (i386_linux_prepare_to_resume): Pass the lwp's pid to i386_debug_reg_state. (i386_linux_new_fork): New function. (_initialize_i386_linux_nat): Install i386_linux_new_fork as linux_nat_new_fork hook, and i386_forget_process as linux_nat_forget_process hook. * i386-nat.c (i386_init_dregs): Delete. (i386_inferior_data, struct i386_inferior_data): Delete. (struct i386_process_info): New. (i386_process_list): New global. (i386_find_process_pid, i386_add_process, i386_process_info_get): New functions. (i386_inferior_data_get): Delete. (i386_process_info_get): New function. (i386_debug_reg_state): New parameter 'pid'. Reimplement. (i386_forget_process): New function. (i386_cleanup_dregs): Rewrite. (i386_update_inferior_debug_regs, i386_insert_watchpoint) (i386_remove_watchpoint, i386_region_ok_for_watchpoint) (i386_stopped_data_address, i386_insert_hw_breakpoint) (i386_remove_hw_breakpoint): Adjust to pass the current process id to i386_debug_reg_state. (i386_use_watchpoints): Don't register inferior data. * i386-nat.h (i386_debug_reg_state): Add new 'pid' parameter, and adjust comment. (i386_forget_process): Declare. * linux-fork.c (delete_fork): Call linux_nat_forget_process. * linux-nat.c (linux_nat_new_fork, linux_nat_forget_process_hook): New static globals. (linux_child_follow_fork): Don't call linux_nat_new_thread here. (add_initial_lwp): New, factored out from ... (add_lwp): ... this. Don't check the number of lwps before calling linux_nat_new_thread. (linux_nat_iterate_watchpoint_lwps): Delete. (linux_nat_attach): Use add_initial_lwp instead of add_lwp. (linux_handle_extended_wait): Call the linux_nat_new_fork hook on forks and vforks. (linux_nat_wait_1): Use add_initial_lwp instead of add_lwp for the initial lwp. (linux_nat_kill, linux_nat_mourn_inferior): Call linux_nat_forget_process. (linux_nat_set_new_fork, linux_nat_set_forget_process) (linux_nat_forget_process): New functions. * linux-nat.h (linux_nat_iterate_watchpoint_lwps_ftype): Delete type. (linux_nat_iterate_watchpoint_lwps): Delete declaration. (linux_nat_new_fork_ftype, linux_nat_forget_process_ftype): New types. (linux_nat_set_new_fork, linux_nat_set_forget_process) (linux_nat_forget_process): New declarations. * amd64fbsd-nat.c (super_mourn_inferior): New global. (amd64fbsd_mourn_inferior): New function. (_initialize_amd64fbsd_nat): Override to_mourn_inferior. * windows-nat.c (windows_detach): Call i386_cleanup_dregs.
2013-02-13 15:59:49 +01:00
ptid_t pid_ptid = pid_to_ptid (ptid_get_pid (inferior_ptid));
gdb/ 2011-12-14 Pedro Alves <pedro@codesourcery.com> PR threads/10729 * linux-nat.c (linux_nat_new_thread): Change parameter to an lwp pointer. (linux_nat_prepare_to_resume): New global. (lwp_free): New. (purge_lwp_list): Use it. (add_lwp): Call linux_nat_new_thread even on the first LWP. Adjust to interface change. (delete_lwp): Call lwp_free instead of xfree. (detach_callback, linux_nat_detach, resume_lwp, linux_nat_resume) (linux_handle_syscall_trap, linux_handle_extended_wait) (linux_nat_filter_event, resume_stopped_resumed_lwps): Call linux_nat_prepare_to_resume before resuming. (linux_stop_lwp): New. (linux_nat_set_new_thread): Adjust. (linux_nat_set_prepare_to_resume): New. * linux-nat.h (struct arch_lwp_info): Forward declare. (struct lwp_info) <arch_private>: New field. (linux_stop_lwp): Declare. (linux_nat_set_new_thread): Adjust. (linux_nat_set_prepare_to_resume): New. * i386-nat.c (DR_NADDR, DR_STATUS, DR_CONTROL) (struct i386_debug_reg_state): Move to i386-nat.h. (dr_mirror): Comment. (i386_debug_reg_state): New. (i386_update_inferior_debug_regs): Simplify. (i386_stopped_data_address): Use the debug register state from the inferior, not from the local cache. * i386-nat.h (struct i386_dr_low_type): Delete reset_addr and unset_status fields. New get_addr and get_control fields. (DR_FIRSTADDR, DR_LASTADDR, DR_CONTROL): Moved from i386-nat.c. (DR_NADDR, DR_STATUS): New. (struct i386_debug_reg_state): Moved from i386-nat.c. * amd64-linux-nat.c (struct arch_lwp_info): New. (amd64_linux_dr): Delete global. (amd64_linux_dr_get_addr): New. (amd64_linux_dr_get_control): New. (amd64_linux_dr_unset_status): Delete. (amd64_linux_dr_set_addr): Reimplement. (amd64_linux_dr_reset_addr): Delete. (update_debug_registers_callback): New. (amd64_linux_dr_set_control): Reimplement. (amd64_linux_dr_set_addr): Reimplement. (amd64_linux_prepare_to_resume): New. (amd64_linux_new_thread): Change parameter to an lwp pointer. Reimplement. (_initialize_amd64_linux_nat): No longer install i386_dr_low.reset_addr and i386_dr_low.unset_status. Install amd64_linux_dr_get_control as i386_dr_low.get_control. Install amd64_linux_dr_get_addr as i386_dr_low.get_addr. Install amd64_linux_prepare_to_resume. * i386-linux-nat.c (DR_FIRSTADDR, DR_LASTADDR, DR_STATUS) (DR_CONTROL): Delete. (struct arch_lwp_info): New. (i386_linux_dr): Delete global. (i386_linux_dr_set_control): Reimplement. (i386_linux_dr_get_addr): New. (i386_linux_dr_set_addr): Reimplement. (i386_linux_dr_get_control): New. (update_debug_registers_callback): New. (i386_linux_dr_unset_status): Delete. (i386_linux_dr_set_addr): Reimplement. (i386_linux_prepare_to_resume): New. (i386_linux_new_thread): Change parameter to an lwp pointer. Reimplement. (_initialize_i386_linux_nat): No longer install i386_dr_low.reset_addr and i386_dr_low.unset_status. Install i386_linux_dr_get_control as i386_dr_low.get_control. Install i386_linux_dr_get_addr as i386_dr_low.get_addr. Install i386_linux_prepare_to_resume. * arm-linux-nat.c (arm_linux_new_thread): Change parameter to an lwp pointer. Adjust. * ia64-linux-nat.c (ia64_linux_new_thread): Likewise. * mips-linux-nat.c (mips_linux_new_thread): Likewise. * ppc-linux-nat.c (ppc_linux_new_thread): Likewise. * s390-nat.c (s390_fix_watch_points): Likewise. * i386-darwin-nat.c (DR_FIRSTADDR, DR_LASTADDR, DR_STATUS) (DR_CONTROL): Delete. (i386_darwin_dr_reset_addr): Delete. (i386_darwin_dr_get_addr): New. (i386_darwin_dr_get_control): New. * go32-nat.c (go32_get_dr7, go32_get_dr): New. (init_go32_ops): No longer install i386_dr_low.reset_addr. Install go32_get_dr7 as i386_dr_low.get_control. Install go32_get_dr as i386_dr_low.get_addr. * i386bsd-nat.c (i386bsd_dr_get): New. (i386bsd_dr_reset_addr): Delete. (i386bsd_dr_get_addr): New. (i386bsd_dr_get_status): Use i386bsd_dr_get. (i386bsd_dr_get_control): New. * i386bsd-nat.h (i386bsd_dr_reset_addr): Delete. (i386bsd_dr_get_addr): New. (i386bsd_dr_get_control): New. * i386fbsd-nat.c (_initialize_i386fbsd_nat): No longer install i386_dr_low.reset_addr and i386_dr_low.unset_status. Install i386bsd_dr_get_control as i386_dr_low.get_control. Install i386bsd_dr_get_addr as i386_dr_low.get_addr. * windows-nat.c (init_windows_ops): No longer install i386_dr_low.reset_addr and i386_dr_low.unset_status. Install cygwin_get_dr7 as i386_dr_low.get_control. Install cygwin_get_dr as i386_dr_low.get_addr. (cygwin_get_dr): New. (cygwin_get_dr7): New. gdb/testsuite/ 2011-12-14 Pedro Alves <pedro@codesourcery.com> PR threads/10729 * gdb.mi/watch-nonstop.c: New file. * gdb.mi/mi-watch-nonstop.exp: New file.
2011-12-14 18:20:32 +01:00
gdb_assert (regnum >= 0 && regnum <= DR_LASTADDR - DR_FIRSTADDR);
[native x86 GNU/Linux] Access debug register mirror from the corresponding process. While reviewing the native AArch64 patch, I noticed a problem: On 02/06/2013 08:46 PM, Pedro Alves wrote: > >> > +static void >> > +aarch64_linux_prepare_to_resume (struct lwp_info *lwp) >> > +{ >> > + struct arch_lwp_info *info = lwp->arch_private; >> > + >> > + /* NULL means this is the main thread still going through the shell, >> > + or, no watchpoint has been set yet. In that case, there's >> > + nothing to do. */ >> > + if (info == NULL) >> > + return; >> > + >> > + if (DR_HAS_CHANGED (info->dr_changed_bp) >> > + || DR_HAS_CHANGED (info->dr_changed_wp)) >> > + { >> > + int tid = GET_LWP (lwp->ptid); >> > + struct aarch64_debug_reg_state *state = aarch64_get_debug_reg_state (); > Hmm. This is always fetching the debug_reg_state of > the current inferior, but may not be the inferior of lwp. > I see the same bug on x86. Sorry about that. I'll fix it. A natural fix would be to make xxx_get_debug_reg_state take an inferior argument, but that doesn't work because of the case where we detach breakpoints/watchpoints from the child fork, at a time there's no inferior for the child fork at all. We do a nasty hack in i386_inferior_data_get, but that relies on all callers pointing the current inferior to the correct inferior, which isn't actually being done by all callers, and I don't think we want to enforce that -- deep in the bowls of linux-nat.c, there are many cases we resume lwps behind the scenes, and it's be better to not have that code rely on global state (as it doesn't today). The fix is to decouple the watchpoints code from inferiors, making it track target processes instead. This way, we can freely keep track of the watchpoint mirrors for these processes behind the core's back. Checkpoints also play dirty tricks with swapping the process behind the inferior, so they get special treatment too in the patch (which just amounts to calling a new hook). Instead of the old hack in i386_inferior_data_get, where we returned a copy of the current inferior's debug registers mirror, as soon as we detect a fork in the target, we copy the debug register mirror from the parent to the child process. I don't have an old kernel handy to test, but I stepped through gdb doing the watchpoint removal in the fork child in the watchpoint-fork test seeing that the debug registers end up cleared in the child. I didn't find the need for linux_nat_iterate_watchpoint_lwps. If we use plain iterate_over_lwps instead, what happens is that when removing watchpoints, that iterate_over_lwps doesn't actually iterate over anything, since the fork child is not added to the lwp list until later, at detach time, in linux_child_follow_fork. And if we don't iterate over that lwp, we don't mark its debug registers as needing update. But linux_child_follow_fork takes care of doing that explicitly: child_lp = add_lwp (inferior_ptid); child_lp->stopped = 1; child_lp->last_resume_kind = resume_stop; make_cleanup (delete_lwp_cleanup, child_lp); /* CHILD_LP has new PID, therefore linux_nat_new_thread is not called for it. See i386_inferior_data_get for the Linux kernel specifics. Ensure linux_nat_prepare_to_resume will reset the hardware debug registers. It is done by the linux_nat_new_thread call, which is being skipped in add_lwp above for the first lwp of a pid. */ gdb_assert (num_lwps (GET_PID (child_lp->ptid)) == 1); if (linux_nat_new_thread != NULL) linux_nat_new_thread (child_lp); if (linux_nat_prepare_to_resume != NULL) linux_nat_prepare_to_resume (child_lp); ptrace (PTRACE_DETACH, child_pid, 0, 0); so unless I'm missing something (quite possible) it ends up all the same. But, the !detach-on-fork, and the "follow-fork child" paths should also call linux_nat_new_thread, and they don't presently. It seems to me in those cases we're not clearing debug regs correctly when that's needed. Instead of copying that bit that works around add_lwp bypassing the linux_nat_new_thread call, I thought it'd be better to add an add_initial_lwp call to be used in the case we really need to bypass linux_nat_new_thread, and make add_lwp always call linux_nat_new_thread. i386_cleanup_dregs is rewritten to forget about the current process debug mirrors, which takes cares of other i386 ports. Only a couple of extra tweaks here and there were needed, as some targets wheren't actually calling i386_cleanup_dregs. Tested on Fedora 17 x86_64 -m64/-m32. GDBserver already fetches the i386_debug_reg_state from the right process, and, it doesn't handle forks at all, so no fix is needed over there. gdb/ 2013-02-13 Pedro Alves <palves@redhat.com> * amd64-linux-nat.c (update_debug_registers_callback): Update comment. (amd64_linux_dr_set_control, amd64_linux_dr_set_addr): Use iterate_over_lwps. (amd64_linux_prepare_to_resume): Pass the lwp's pid to i386_debug_reg_state. (amd64_linux_new_fork): New function. (_initialize_amd64_linux_nat): Install amd64_linux_new_fork as linux_nat_new_fork hook, and i386_forget_process as linux_nat_forget_process hook. * i386-linux-nat.c (update_debug_registers_callback): Update comment. (amd64_linux_dr_set_control, amd64_linux_dr_set_addr): Use iterate_over_lwps. (i386_linux_prepare_to_resume): Pass the lwp's pid to i386_debug_reg_state. (i386_linux_new_fork): New function. (_initialize_i386_linux_nat): Install i386_linux_new_fork as linux_nat_new_fork hook, and i386_forget_process as linux_nat_forget_process hook. * i386-nat.c (i386_init_dregs): Delete. (i386_inferior_data, struct i386_inferior_data): Delete. (struct i386_process_info): New. (i386_process_list): New global. (i386_find_process_pid, i386_add_process, i386_process_info_get): New functions. (i386_inferior_data_get): Delete. (i386_process_info_get): New function. (i386_debug_reg_state): New parameter 'pid'. Reimplement. (i386_forget_process): New function. (i386_cleanup_dregs): Rewrite. (i386_update_inferior_debug_regs, i386_insert_watchpoint) (i386_remove_watchpoint, i386_region_ok_for_watchpoint) (i386_stopped_data_address, i386_insert_hw_breakpoint) (i386_remove_hw_breakpoint): Adjust to pass the current process id to i386_debug_reg_state. (i386_use_watchpoints): Don't register inferior data. * i386-nat.h (i386_debug_reg_state): Add new 'pid' parameter, and adjust comment. (i386_forget_process): Declare. * linux-fork.c (delete_fork): Call linux_nat_forget_process. * linux-nat.c (linux_nat_new_fork, linux_nat_forget_process_hook): New static globals. (linux_child_follow_fork): Don't call linux_nat_new_thread here. (add_initial_lwp): New, factored out from ... (add_lwp): ... this. Don't check the number of lwps before calling linux_nat_new_thread. (linux_nat_iterate_watchpoint_lwps): Delete. (linux_nat_attach): Use add_initial_lwp instead of add_lwp. (linux_handle_extended_wait): Call the linux_nat_new_fork hook on forks and vforks. (linux_nat_wait_1): Use add_initial_lwp instead of add_lwp for the initial lwp. (linux_nat_kill, linux_nat_mourn_inferior): Call linux_nat_forget_process. (linux_nat_set_new_fork, linux_nat_set_forget_process) (linux_nat_forget_process): New functions. * linux-nat.h (linux_nat_iterate_watchpoint_lwps_ftype): Delete type. (linux_nat_iterate_watchpoint_lwps): Delete declaration. (linux_nat_new_fork_ftype, linux_nat_forget_process_ftype): New types. (linux_nat_set_new_fork, linux_nat_set_forget_process) (linux_nat_forget_process): New declarations. * amd64fbsd-nat.c (super_mourn_inferior): New global. (amd64fbsd_mourn_inferior): New function. (_initialize_amd64fbsd_nat): Override to_mourn_inferior. * windows-nat.c (windows_detach): Call i386_cleanup_dregs.
2013-02-13 15:59:49 +01:00
iterate_over_lwps (pid_ptid, update_debug_registers_callback, NULL);
* linux-nat.c (linux_nat_new_thread): New variable. (linux_child_follow_fork): Set inferior_ptid to include LWP ID. Use linux_nat_switch_fork. (lwp_list): Make public. (add_lwp): Call linux_nat_new_thread. (lin_lwp_attach_lwp, linux_nat_attach): Call add_lwp after stopping the new thread. (resume_callback): Clear lp->siginfo. Remove unused variable. (linux_nat_resume): Assert that the LWP list is already initialized. Clear lp->siginfo. (save_siginfo): New. (stop_wait_callback, linux_nat_wait): Call it. (linux_nat_set_new_thread, linux_nat_get_siginfo): New. * linux-nat.h (struct lwp_info): Add siginfo. (lwp_list, linux_nat_set_new_thread, linux_nat_get_siginfo): Declare. (ALL_LWPS): Define. * amd64-linux-nat.c (amd64_linux_dr): New. (amd64_linux_dr_get): Take a PTID argument. Correct typo. (amd64_linux_dr_set): Take a PTID argument. (amd64_linux_dr_set_control, amd64_linux_dr_set_addr): Use ALL_LWPS. (amd64_linux_dr_reset_addr): Use amd64_linux_dr_set_addr. (amd64_linux_dr_get_status): Pass inferior_ptid to amd64_linux_dr_get. (amd64_linux_new_thread): New. (_initialize_amd64_linux_nat): Call linux_nat_set_new_thread. * i386-linux-nat.c (i386_linux_dr): New. (i386_linux_dr_get, i386_linux_dr_set): Take a PTID argument. (i386_linux_dr_set_control, i386_linux_dr_set_addr): Use ALL_LWPS. (i386_linux_dr_reset_addr): Use i386_linux_dr_set_addr. (i386_linux_dr_get_status): Pass inferior_ptid to i386_linux_dr_get. (i386_linux_new_thread): New. (i386_linux_resume): Remove unnecessary PID check. (_initialize_i386_linux_nat): Call linux_nat_set_new_thread. * ia64-linux-nat.c (enable_watchpoints_in_psr): Take PTID argument. (fetch_debug_register, fetch_debug_register_pair): Delete. (debug_registers): New. (ia64_linux_insert_watchpoint, ia64_linux_remove_watchpoint): Use ALL_LWPS and debug_registers. (ia64_linux_new_thread): New. (ia64_linux_stopped_data_address): Use linux_nat_get_siginfo. (_initialize_ia64_linux_nat): Call linux_nat_set_new_thread. * ppc-linux-nat.c (last_stopped_data_address): Delete. (saved_dabr_value): New. (ppc_linux_insert_watchpoint, ppc_linux_remove_watchpoint): Use ALL_LWPS. (ppc_linux_new_thread): New. (ppc_linux_stopped_data_address): Use linux_nat_get_siginfo. (ppc_linux_stopped_by_watchpoint): Call ppc_linux_stopped_data_address. (_initialize_ppc_linux_nat): Call linux_nat_set_new_thread. * s390-nat.c (s390_stopped_by_watchpoint): Clear the watchpoint status after reading it. (s390_fix_watch_points): Take a PTID argument. (s390_insert_watchpoint, s390_remove_watchpoint): Use ALL_LWPS. (_initialize_s390_nat): Call linux_nat_set_new_thread.
2007-10-01 02:22:50 +02:00
}
gdb/ 2011-12-14 Pedro Alves <pedro@codesourcery.com> PR threads/10729 * linux-nat.c (linux_nat_new_thread): Change parameter to an lwp pointer. (linux_nat_prepare_to_resume): New global. (lwp_free): New. (purge_lwp_list): Use it. (add_lwp): Call linux_nat_new_thread even on the first LWP. Adjust to interface change. (delete_lwp): Call lwp_free instead of xfree. (detach_callback, linux_nat_detach, resume_lwp, linux_nat_resume) (linux_handle_syscall_trap, linux_handle_extended_wait) (linux_nat_filter_event, resume_stopped_resumed_lwps): Call linux_nat_prepare_to_resume before resuming. (linux_stop_lwp): New. (linux_nat_set_new_thread): Adjust. (linux_nat_set_prepare_to_resume): New. * linux-nat.h (struct arch_lwp_info): Forward declare. (struct lwp_info) <arch_private>: New field. (linux_stop_lwp): Declare. (linux_nat_set_new_thread): Adjust. (linux_nat_set_prepare_to_resume): New. * i386-nat.c (DR_NADDR, DR_STATUS, DR_CONTROL) (struct i386_debug_reg_state): Move to i386-nat.h. (dr_mirror): Comment. (i386_debug_reg_state): New. (i386_update_inferior_debug_regs): Simplify. (i386_stopped_data_address): Use the debug register state from the inferior, not from the local cache. * i386-nat.h (struct i386_dr_low_type): Delete reset_addr and unset_status fields. New get_addr and get_control fields. (DR_FIRSTADDR, DR_LASTADDR, DR_CONTROL): Moved from i386-nat.c. (DR_NADDR, DR_STATUS): New. (struct i386_debug_reg_state): Moved from i386-nat.c. * amd64-linux-nat.c (struct arch_lwp_info): New. (amd64_linux_dr): Delete global. (amd64_linux_dr_get_addr): New. (amd64_linux_dr_get_control): New. (amd64_linux_dr_unset_status): Delete. (amd64_linux_dr_set_addr): Reimplement. (amd64_linux_dr_reset_addr): Delete. (update_debug_registers_callback): New. (amd64_linux_dr_set_control): Reimplement. (amd64_linux_dr_set_addr): Reimplement. (amd64_linux_prepare_to_resume): New. (amd64_linux_new_thread): Change parameter to an lwp pointer. Reimplement. (_initialize_amd64_linux_nat): No longer install i386_dr_low.reset_addr and i386_dr_low.unset_status. Install amd64_linux_dr_get_control as i386_dr_low.get_control. Install amd64_linux_dr_get_addr as i386_dr_low.get_addr. Install amd64_linux_prepare_to_resume. * i386-linux-nat.c (DR_FIRSTADDR, DR_LASTADDR, DR_STATUS) (DR_CONTROL): Delete. (struct arch_lwp_info): New. (i386_linux_dr): Delete global. (i386_linux_dr_set_control): Reimplement. (i386_linux_dr_get_addr): New. (i386_linux_dr_set_addr): Reimplement. (i386_linux_dr_get_control): New. (update_debug_registers_callback): New. (i386_linux_dr_unset_status): Delete. (i386_linux_dr_set_addr): Reimplement. (i386_linux_prepare_to_resume): New. (i386_linux_new_thread): Change parameter to an lwp pointer. Reimplement. (_initialize_i386_linux_nat): No longer install i386_dr_low.reset_addr and i386_dr_low.unset_status. Install i386_linux_dr_get_control as i386_dr_low.get_control. Install i386_linux_dr_get_addr as i386_dr_low.get_addr. Install i386_linux_prepare_to_resume. * arm-linux-nat.c (arm_linux_new_thread): Change parameter to an lwp pointer. Adjust. * ia64-linux-nat.c (ia64_linux_new_thread): Likewise. * mips-linux-nat.c (mips_linux_new_thread): Likewise. * ppc-linux-nat.c (ppc_linux_new_thread): Likewise. * s390-nat.c (s390_fix_watch_points): Likewise. * i386-darwin-nat.c (DR_FIRSTADDR, DR_LASTADDR, DR_STATUS) (DR_CONTROL): Delete. (i386_darwin_dr_reset_addr): Delete. (i386_darwin_dr_get_addr): New. (i386_darwin_dr_get_control): New. * go32-nat.c (go32_get_dr7, go32_get_dr): New. (init_go32_ops): No longer install i386_dr_low.reset_addr. Install go32_get_dr7 as i386_dr_low.get_control. Install go32_get_dr as i386_dr_low.get_addr. * i386bsd-nat.c (i386bsd_dr_get): New. (i386bsd_dr_reset_addr): Delete. (i386bsd_dr_get_addr): New. (i386bsd_dr_get_status): Use i386bsd_dr_get. (i386bsd_dr_get_control): New. * i386bsd-nat.h (i386bsd_dr_reset_addr): Delete. (i386bsd_dr_get_addr): New. (i386bsd_dr_get_control): New. * i386fbsd-nat.c (_initialize_i386fbsd_nat): No longer install i386_dr_low.reset_addr and i386_dr_low.unset_status. Install i386bsd_dr_get_control as i386_dr_low.get_control. Install i386bsd_dr_get_addr as i386_dr_low.get_addr. * windows-nat.c (init_windows_ops): No longer install i386_dr_low.reset_addr and i386_dr_low.unset_status. Install cygwin_get_dr7 as i386_dr_low.get_control. Install cygwin_get_dr as i386_dr_low.get_addr. (cygwin_get_dr): New. (cygwin_get_dr7): New. gdb/testsuite/ 2011-12-14 Pedro Alves <pedro@codesourcery.com> PR threads/10729 * gdb.mi/watch-nonstop.c: New file. * gdb.mi/mi-watch-nonstop.exp: New file.
2011-12-14 18:20:32 +01:00
/* Called when resuming a thread.
If the debug regs have changed, update the thread's copies. */
static void
gdb/ 2011-12-14 Pedro Alves <pedro@codesourcery.com> PR threads/10729 * linux-nat.c (linux_nat_new_thread): Change parameter to an lwp pointer. (linux_nat_prepare_to_resume): New global. (lwp_free): New. (purge_lwp_list): Use it. (add_lwp): Call linux_nat_new_thread even on the first LWP. Adjust to interface change. (delete_lwp): Call lwp_free instead of xfree. (detach_callback, linux_nat_detach, resume_lwp, linux_nat_resume) (linux_handle_syscall_trap, linux_handle_extended_wait) (linux_nat_filter_event, resume_stopped_resumed_lwps): Call linux_nat_prepare_to_resume before resuming. (linux_stop_lwp): New. (linux_nat_set_new_thread): Adjust. (linux_nat_set_prepare_to_resume): New. * linux-nat.h (struct arch_lwp_info): Forward declare. (struct lwp_info) <arch_private>: New field. (linux_stop_lwp): Declare. (linux_nat_set_new_thread): Adjust. (linux_nat_set_prepare_to_resume): New. * i386-nat.c (DR_NADDR, DR_STATUS, DR_CONTROL) (struct i386_debug_reg_state): Move to i386-nat.h. (dr_mirror): Comment. (i386_debug_reg_state): New. (i386_update_inferior_debug_regs): Simplify. (i386_stopped_data_address): Use the debug register state from the inferior, not from the local cache. * i386-nat.h (struct i386_dr_low_type): Delete reset_addr and unset_status fields. New get_addr and get_control fields. (DR_FIRSTADDR, DR_LASTADDR, DR_CONTROL): Moved from i386-nat.c. (DR_NADDR, DR_STATUS): New. (struct i386_debug_reg_state): Moved from i386-nat.c. * amd64-linux-nat.c (struct arch_lwp_info): New. (amd64_linux_dr): Delete global. (amd64_linux_dr_get_addr): New. (amd64_linux_dr_get_control): New. (amd64_linux_dr_unset_status): Delete. (amd64_linux_dr_set_addr): Reimplement. (amd64_linux_dr_reset_addr): Delete. (update_debug_registers_callback): New. (amd64_linux_dr_set_control): Reimplement. (amd64_linux_dr_set_addr): Reimplement. (amd64_linux_prepare_to_resume): New. (amd64_linux_new_thread): Change parameter to an lwp pointer. Reimplement. (_initialize_amd64_linux_nat): No longer install i386_dr_low.reset_addr and i386_dr_low.unset_status. Install amd64_linux_dr_get_control as i386_dr_low.get_control. Install amd64_linux_dr_get_addr as i386_dr_low.get_addr. Install amd64_linux_prepare_to_resume. * i386-linux-nat.c (DR_FIRSTADDR, DR_LASTADDR, DR_STATUS) (DR_CONTROL): Delete. (struct arch_lwp_info): New. (i386_linux_dr): Delete global. (i386_linux_dr_set_control): Reimplement. (i386_linux_dr_get_addr): New. (i386_linux_dr_set_addr): Reimplement. (i386_linux_dr_get_control): New. (update_debug_registers_callback): New. (i386_linux_dr_unset_status): Delete. (i386_linux_dr_set_addr): Reimplement. (i386_linux_prepare_to_resume): New. (i386_linux_new_thread): Change parameter to an lwp pointer. Reimplement. (_initialize_i386_linux_nat): No longer install i386_dr_low.reset_addr and i386_dr_low.unset_status. Install i386_linux_dr_get_control as i386_dr_low.get_control. Install i386_linux_dr_get_addr as i386_dr_low.get_addr. Install i386_linux_prepare_to_resume. * arm-linux-nat.c (arm_linux_new_thread): Change parameter to an lwp pointer. Adjust. * ia64-linux-nat.c (ia64_linux_new_thread): Likewise. * mips-linux-nat.c (mips_linux_new_thread): Likewise. * ppc-linux-nat.c (ppc_linux_new_thread): Likewise. * s390-nat.c (s390_fix_watch_points): Likewise. * i386-darwin-nat.c (DR_FIRSTADDR, DR_LASTADDR, DR_STATUS) (DR_CONTROL): Delete. (i386_darwin_dr_reset_addr): Delete. (i386_darwin_dr_get_addr): New. (i386_darwin_dr_get_control): New. * go32-nat.c (go32_get_dr7, go32_get_dr): New. (init_go32_ops): No longer install i386_dr_low.reset_addr. Install go32_get_dr7 as i386_dr_low.get_control. Install go32_get_dr as i386_dr_low.get_addr. * i386bsd-nat.c (i386bsd_dr_get): New. (i386bsd_dr_reset_addr): Delete. (i386bsd_dr_get_addr): New. (i386bsd_dr_get_status): Use i386bsd_dr_get. (i386bsd_dr_get_control): New. * i386bsd-nat.h (i386bsd_dr_reset_addr): Delete. (i386bsd_dr_get_addr): New. (i386bsd_dr_get_control): New. * i386fbsd-nat.c (_initialize_i386fbsd_nat): No longer install i386_dr_low.reset_addr and i386_dr_low.unset_status. Install i386bsd_dr_get_control as i386_dr_low.get_control. Install i386bsd_dr_get_addr as i386_dr_low.get_addr. * windows-nat.c (init_windows_ops): No longer install i386_dr_low.reset_addr and i386_dr_low.unset_status. Install cygwin_get_dr7 as i386_dr_low.get_control. Install cygwin_get_dr as i386_dr_low.get_addr. (cygwin_get_dr): New. (cygwin_get_dr7): New. gdb/testsuite/ 2011-12-14 Pedro Alves <pedro@codesourcery.com> PR threads/10729 * gdb.mi/watch-nonstop.c: New file. * gdb.mi/mi-watch-nonstop.exp: New file.
2011-12-14 18:20:32 +01:00
amd64_linux_prepare_to_resume (struct lwp_info *lwp)
{
gdb/ 2011-12-14 Pedro Alves <pedro@codesourcery.com> PR threads/10729 * linux-nat.c (linux_nat_new_thread): Change parameter to an lwp pointer. (linux_nat_prepare_to_resume): New global. (lwp_free): New. (purge_lwp_list): Use it. (add_lwp): Call linux_nat_new_thread even on the first LWP. Adjust to interface change. (delete_lwp): Call lwp_free instead of xfree. (detach_callback, linux_nat_detach, resume_lwp, linux_nat_resume) (linux_handle_syscall_trap, linux_handle_extended_wait) (linux_nat_filter_event, resume_stopped_resumed_lwps): Call linux_nat_prepare_to_resume before resuming. (linux_stop_lwp): New. (linux_nat_set_new_thread): Adjust. (linux_nat_set_prepare_to_resume): New. * linux-nat.h (struct arch_lwp_info): Forward declare. (struct lwp_info) <arch_private>: New field. (linux_stop_lwp): Declare. (linux_nat_set_new_thread): Adjust. (linux_nat_set_prepare_to_resume): New. * i386-nat.c (DR_NADDR, DR_STATUS, DR_CONTROL) (struct i386_debug_reg_state): Move to i386-nat.h. (dr_mirror): Comment. (i386_debug_reg_state): New. (i386_update_inferior_debug_regs): Simplify. (i386_stopped_data_address): Use the debug register state from the inferior, not from the local cache. * i386-nat.h (struct i386_dr_low_type): Delete reset_addr and unset_status fields. New get_addr and get_control fields. (DR_FIRSTADDR, DR_LASTADDR, DR_CONTROL): Moved from i386-nat.c. (DR_NADDR, DR_STATUS): New. (struct i386_debug_reg_state): Moved from i386-nat.c. * amd64-linux-nat.c (struct arch_lwp_info): New. (amd64_linux_dr): Delete global. (amd64_linux_dr_get_addr): New. (amd64_linux_dr_get_control): New. (amd64_linux_dr_unset_status): Delete. (amd64_linux_dr_set_addr): Reimplement. (amd64_linux_dr_reset_addr): Delete. (update_debug_registers_callback): New. (amd64_linux_dr_set_control): Reimplement. (amd64_linux_dr_set_addr): Reimplement. (amd64_linux_prepare_to_resume): New. (amd64_linux_new_thread): Change parameter to an lwp pointer. Reimplement. (_initialize_amd64_linux_nat): No longer install i386_dr_low.reset_addr and i386_dr_low.unset_status. Install amd64_linux_dr_get_control as i386_dr_low.get_control. Install amd64_linux_dr_get_addr as i386_dr_low.get_addr. Install amd64_linux_prepare_to_resume. * i386-linux-nat.c (DR_FIRSTADDR, DR_LASTADDR, DR_STATUS) (DR_CONTROL): Delete. (struct arch_lwp_info): New. (i386_linux_dr): Delete global. (i386_linux_dr_set_control): Reimplement. (i386_linux_dr_get_addr): New. (i386_linux_dr_set_addr): Reimplement. (i386_linux_dr_get_control): New. (update_debug_registers_callback): New. (i386_linux_dr_unset_status): Delete. (i386_linux_dr_set_addr): Reimplement. (i386_linux_prepare_to_resume): New. (i386_linux_new_thread): Change parameter to an lwp pointer. Reimplement. (_initialize_i386_linux_nat): No longer install i386_dr_low.reset_addr and i386_dr_low.unset_status. Install i386_linux_dr_get_control as i386_dr_low.get_control. Install i386_linux_dr_get_addr as i386_dr_low.get_addr. Install i386_linux_prepare_to_resume. * arm-linux-nat.c (arm_linux_new_thread): Change parameter to an lwp pointer. Adjust. * ia64-linux-nat.c (ia64_linux_new_thread): Likewise. * mips-linux-nat.c (mips_linux_new_thread): Likewise. * ppc-linux-nat.c (ppc_linux_new_thread): Likewise. * s390-nat.c (s390_fix_watch_points): Likewise. * i386-darwin-nat.c (DR_FIRSTADDR, DR_LASTADDR, DR_STATUS) (DR_CONTROL): Delete. (i386_darwin_dr_reset_addr): Delete. (i386_darwin_dr_get_addr): New. (i386_darwin_dr_get_control): New. * go32-nat.c (go32_get_dr7, go32_get_dr): New. (init_go32_ops): No longer install i386_dr_low.reset_addr. Install go32_get_dr7 as i386_dr_low.get_control. Install go32_get_dr as i386_dr_low.get_addr. * i386bsd-nat.c (i386bsd_dr_get): New. (i386bsd_dr_reset_addr): Delete. (i386bsd_dr_get_addr): New. (i386bsd_dr_get_status): Use i386bsd_dr_get. (i386bsd_dr_get_control): New. * i386bsd-nat.h (i386bsd_dr_reset_addr): Delete. (i386bsd_dr_get_addr): New. (i386bsd_dr_get_control): New. * i386fbsd-nat.c (_initialize_i386fbsd_nat): No longer install i386_dr_low.reset_addr and i386_dr_low.unset_status. Install i386bsd_dr_get_control as i386_dr_low.get_control. Install i386bsd_dr_get_addr as i386_dr_low.get_addr. * windows-nat.c (init_windows_ops): No longer install i386_dr_low.reset_addr and i386_dr_low.unset_status. Install cygwin_get_dr7 as i386_dr_low.get_control. Install cygwin_get_dr as i386_dr_low.get_addr. (cygwin_get_dr): New. (cygwin_get_dr7): New. gdb/testsuite/ 2011-12-14 Pedro Alves <pedro@codesourcery.com> PR threads/10729 * gdb.mi/watch-nonstop.c: New file. * gdb.mi/mi-watch-nonstop.exp: New file.
2011-12-14 18:20:32 +01:00
int clear_status = 0;
/* NULL means this is the main thread still going through the shell,
or, no watchpoint has been set yet. In that case, there's
nothing to do. */
if (lwp->arch_private == NULL)
return;
gdb/ 2011-12-14 Pedro Alves <pedro@codesourcery.com> PR threads/10729 * linux-nat.c (linux_nat_new_thread): Change parameter to an lwp pointer. (linux_nat_prepare_to_resume): New global. (lwp_free): New. (purge_lwp_list): Use it. (add_lwp): Call linux_nat_new_thread even on the first LWP. Adjust to interface change. (delete_lwp): Call lwp_free instead of xfree. (detach_callback, linux_nat_detach, resume_lwp, linux_nat_resume) (linux_handle_syscall_trap, linux_handle_extended_wait) (linux_nat_filter_event, resume_stopped_resumed_lwps): Call linux_nat_prepare_to_resume before resuming. (linux_stop_lwp): New. (linux_nat_set_new_thread): Adjust. (linux_nat_set_prepare_to_resume): New. * linux-nat.h (struct arch_lwp_info): Forward declare. (struct lwp_info) <arch_private>: New field. (linux_stop_lwp): Declare. (linux_nat_set_new_thread): Adjust. (linux_nat_set_prepare_to_resume): New. * i386-nat.c (DR_NADDR, DR_STATUS, DR_CONTROL) (struct i386_debug_reg_state): Move to i386-nat.h. (dr_mirror): Comment. (i386_debug_reg_state): New. (i386_update_inferior_debug_regs): Simplify. (i386_stopped_data_address): Use the debug register state from the inferior, not from the local cache. * i386-nat.h (struct i386_dr_low_type): Delete reset_addr and unset_status fields. New get_addr and get_control fields. (DR_FIRSTADDR, DR_LASTADDR, DR_CONTROL): Moved from i386-nat.c. (DR_NADDR, DR_STATUS): New. (struct i386_debug_reg_state): Moved from i386-nat.c. * amd64-linux-nat.c (struct arch_lwp_info): New. (amd64_linux_dr): Delete global. (amd64_linux_dr_get_addr): New. (amd64_linux_dr_get_control): New. (amd64_linux_dr_unset_status): Delete. (amd64_linux_dr_set_addr): Reimplement. (amd64_linux_dr_reset_addr): Delete. (update_debug_registers_callback): New. (amd64_linux_dr_set_control): Reimplement. (amd64_linux_dr_set_addr): Reimplement. (amd64_linux_prepare_to_resume): New. (amd64_linux_new_thread): Change parameter to an lwp pointer. Reimplement. (_initialize_amd64_linux_nat): No longer install i386_dr_low.reset_addr and i386_dr_low.unset_status. Install amd64_linux_dr_get_control as i386_dr_low.get_control. Install amd64_linux_dr_get_addr as i386_dr_low.get_addr. Install amd64_linux_prepare_to_resume. * i386-linux-nat.c (DR_FIRSTADDR, DR_LASTADDR, DR_STATUS) (DR_CONTROL): Delete. (struct arch_lwp_info): New. (i386_linux_dr): Delete global. (i386_linux_dr_set_control): Reimplement. (i386_linux_dr_get_addr): New. (i386_linux_dr_set_addr): Reimplement. (i386_linux_dr_get_control): New. (update_debug_registers_callback): New. (i386_linux_dr_unset_status): Delete. (i386_linux_dr_set_addr): Reimplement. (i386_linux_prepare_to_resume): New. (i386_linux_new_thread): Change parameter to an lwp pointer. Reimplement. (_initialize_i386_linux_nat): No longer install i386_dr_low.reset_addr and i386_dr_low.unset_status. Install i386_linux_dr_get_control as i386_dr_low.get_control. Install i386_linux_dr_get_addr as i386_dr_low.get_addr. Install i386_linux_prepare_to_resume. * arm-linux-nat.c (arm_linux_new_thread): Change parameter to an lwp pointer. Adjust. * ia64-linux-nat.c (ia64_linux_new_thread): Likewise. * mips-linux-nat.c (mips_linux_new_thread): Likewise. * ppc-linux-nat.c (ppc_linux_new_thread): Likewise. * s390-nat.c (s390_fix_watch_points): Likewise. * i386-darwin-nat.c (DR_FIRSTADDR, DR_LASTADDR, DR_STATUS) (DR_CONTROL): Delete. (i386_darwin_dr_reset_addr): Delete. (i386_darwin_dr_get_addr): New. (i386_darwin_dr_get_control): New. * go32-nat.c (go32_get_dr7, go32_get_dr): New. (init_go32_ops): No longer install i386_dr_low.reset_addr. Install go32_get_dr7 as i386_dr_low.get_control. Install go32_get_dr as i386_dr_low.get_addr. * i386bsd-nat.c (i386bsd_dr_get): New. (i386bsd_dr_reset_addr): Delete. (i386bsd_dr_get_addr): New. (i386bsd_dr_get_status): Use i386bsd_dr_get. (i386bsd_dr_get_control): New. * i386bsd-nat.h (i386bsd_dr_reset_addr): Delete. (i386bsd_dr_get_addr): New. (i386bsd_dr_get_control): New. * i386fbsd-nat.c (_initialize_i386fbsd_nat): No longer install i386_dr_low.reset_addr and i386_dr_low.unset_status. Install i386bsd_dr_get_control as i386_dr_low.get_control. Install i386bsd_dr_get_addr as i386_dr_low.get_addr. * windows-nat.c (init_windows_ops): No longer install i386_dr_low.reset_addr and i386_dr_low.unset_status. Install cygwin_get_dr7 as i386_dr_low.get_control. Install cygwin_get_dr as i386_dr_low.get_addr. (cygwin_get_dr): New. (cygwin_get_dr7): New. gdb/testsuite/ 2011-12-14 Pedro Alves <pedro@codesourcery.com> PR threads/10729 * gdb.mi/watch-nonstop.c: New file. * gdb.mi/mi-watch-nonstop.exp: New file.
2011-12-14 18:20:32 +01:00
if (lwp->arch_private->debug_registers_changed)
{
[native x86 GNU/Linux] Access debug register mirror from the corresponding process. While reviewing the native AArch64 patch, I noticed a problem: On 02/06/2013 08:46 PM, Pedro Alves wrote: > >> > +static void >> > +aarch64_linux_prepare_to_resume (struct lwp_info *lwp) >> > +{ >> > + struct arch_lwp_info *info = lwp->arch_private; >> > + >> > + /* NULL means this is the main thread still going through the shell, >> > + or, no watchpoint has been set yet. In that case, there's >> > + nothing to do. */ >> > + if (info == NULL) >> > + return; >> > + >> > + if (DR_HAS_CHANGED (info->dr_changed_bp) >> > + || DR_HAS_CHANGED (info->dr_changed_wp)) >> > + { >> > + int tid = GET_LWP (lwp->ptid); >> > + struct aarch64_debug_reg_state *state = aarch64_get_debug_reg_state (); > Hmm. This is always fetching the debug_reg_state of > the current inferior, but may not be the inferior of lwp. > I see the same bug on x86. Sorry about that. I'll fix it. A natural fix would be to make xxx_get_debug_reg_state take an inferior argument, but that doesn't work because of the case where we detach breakpoints/watchpoints from the child fork, at a time there's no inferior for the child fork at all. We do a nasty hack in i386_inferior_data_get, but that relies on all callers pointing the current inferior to the correct inferior, which isn't actually being done by all callers, and I don't think we want to enforce that -- deep in the bowls of linux-nat.c, there are many cases we resume lwps behind the scenes, and it's be better to not have that code rely on global state (as it doesn't today). The fix is to decouple the watchpoints code from inferiors, making it track target processes instead. This way, we can freely keep track of the watchpoint mirrors for these processes behind the core's back. Checkpoints also play dirty tricks with swapping the process behind the inferior, so they get special treatment too in the patch (which just amounts to calling a new hook). Instead of the old hack in i386_inferior_data_get, where we returned a copy of the current inferior's debug registers mirror, as soon as we detect a fork in the target, we copy the debug register mirror from the parent to the child process. I don't have an old kernel handy to test, but I stepped through gdb doing the watchpoint removal in the fork child in the watchpoint-fork test seeing that the debug registers end up cleared in the child. I didn't find the need for linux_nat_iterate_watchpoint_lwps. If we use plain iterate_over_lwps instead, what happens is that when removing watchpoints, that iterate_over_lwps doesn't actually iterate over anything, since the fork child is not added to the lwp list until later, at detach time, in linux_child_follow_fork. And if we don't iterate over that lwp, we don't mark its debug registers as needing update. But linux_child_follow_fork takes care of doing that explicitly: child_lp = add_lwp (inferior_ptid); child_lp->stopped = 1; child_lp->last_resume_kind = resume_stop; make_cleanup (delete_lwp_cleanup, child_lp); /* CHILD_LP has new PID, therefore linux_nat_new_thread is not called for it. See i386_inferior_data_get for the Linux kernel specifics. Ensure linux_nat_prepare_to_resume will reset the hardware debug registers. It is done by the linux_nat_new_thread call, which is being skipped in add_lwp above for the first lwp of a pid. */ gdb_assert (num_lwps (GET_PID (child_lp->ptid)) == 1); if (linux_nat_new_thread != NULL) linux_nat_new_thread (child_lp); if (linux_nat_prepare_to_resume != NULL) linux_nat_prepare_to_resume (child_lp); ptrace (PTRACE_DETACH, child_pid, 0, 0); so unless I'm missing something (quite possible) it ends up all the same. But, the !detach-on-fork, and the "follow-fork child" paths should also call linux_nat_new_thread, and they don't presently. It seems to me in those cases we're not clearing debug regs correctly when that's needed. Instead of copying that bit that works around add_lwp bypassing the linux_nat_new_thread call, I thought it'd be better to add an add_initial_lwp call to be used in the case we really need to bypass linux_nat_new_thread, and make add_lwp always call linux_nat_new_thread. i386_cleanup_dregs is rewritten to forget about the current process debug mirrors, which takes cares of other i386 ports. Only a couple of extra tweaks here and there were needed, as some targets wheren't actually calling i386_cleanup_dregs. Tested on Fedora 17 x86_64 -m64/-m32. GDBserver already fetches the i386_debug_reg_state from the right process, and, it doesn't handle forks at all, so no fix is needed over there. gdb/ 2013-02-13 Pedro Alves <palves@redhat.com> * amd64-linux-nat.c (update_debug_registers_callback): Update comment. (amd64_linux_dr_set_control, amd64_linux_dr_set_addr): Use iterate_over_lwps. (amd64_linux_prepare_to_resume): Pass the lwp's pid to i386_debug_reg_state. (amd64_linux_new_fork): New function. (_initialize_amd64_linux_nat): Install amd64_linux_new_fork as linux_nat_new_fork hook, and i386_forget_process as linux_nat_forget_process hook. * i386-linux-nat.c (update_debug_registers_callback): Update comment. (amd64_linux_dr_set_control, amd64_linux_dr_set_addr): Use iterate_over_lwps. (i386_linux_prepare_to_resume): Pass the lwp's pid to i386_debug_reg_state. (i386_linux_new_fork): New function. (_initialize_i386_linux_nat): Install i386_linux_new_fork as linux_nat_new_fork hook, and i386_forget_process as linux_nat_forget_process hook. * i386-nat.c (i386_init_dregs): Delete. (i386_inferior_data, struct i386_inferior_data): Delete. (struct i386_process_info): New. (i386_process_list): New global. (i386_find_process_pid, i386_add_process, i386_process_info_get): New functions. (i386_inferior_data_get): Delete. (i386_process_info_get): New function. (i386_debug_reg_state): New parameter 'pid'. Reimplement. (i386_forget_process): New function. (i386_cleanup_dregs): Rewrite. (i386_update_inferior_debug_regs, i386_insert_watchpoint) (i386_remove_watchpoint, i386_region_ok_for_watchpoint) (i386_stopped_data_address, i386_insert_hw_breakpoint) (i386_remove_hw_breakpoint): Adjust to pass the current process id to i386_debug_reg_state. (i386_use_watchpoints): Don't register inferior data. * i386-nat.h (i386_debug_reg_state): Add new 'pid' parameter, and adjust comment. (i386_forget_process): Declare. * linux-fork.c (delete_fork): Call linux_nat_forget_process. * linux-nat.c (linux_nat_new_fork, linux_nat_forget_process_hook): New static globals. (linux_child_follow_fork): Don't call linux_nat_new_thread here. (add_initial_lwp): New, factored out from ... (add_lwp): ... this. Don't check the number of lwps before calling linux_nat_new_thread. (linux_nat_iterate_watchpoint_lwps): Delete. (linux_nat_attach): Use add_initial_lwp instead of add_lwp. (linux_handle_extended_wait): Call the linux_nat_new_fork hook on forks and vforks. (linux_nat_wait_1): Use add_initial_lwp instead of add_lwp for the initial lwp. (linux_nat_kill, linux_nat_mourn_inferior): Call linux_nat_forget_process. (linux_nat_set_new_fork, linux_nat_set_forget_process) (linux_nat_forget_process): New functions. * linux-nat.h (linux_nat_iterate_watchpoint_lwps_ftype): Delete type. (linux_nat_iterate_watchpoint_lwps): Delete declaration. (linux_nat_new_fork_ftype, linux_nat_forget_process_ftype): New types. (linux_nat_set_new_fork, linux_nat_set_forget_process) (linux_nat_forget_process): New declarations. * amd64fbsd-nat.c (super_mourn_inferior): New global. (amd64fbsd_mourn_inferior): New function. (_initialize_amd64fbsd_nat): Override to_mourn_inferior. * windows-nat.c (windows_detach): Call i386_cleanup_dregs.
2013-02-13 15:59:49 +01:00
struct i386_debug_reg_state *state
= i386_debug_reg_state (ptid_get_pid (lwp->ptid));
gdb/ 2011-12-14 Pedro Alves <pedro@codesourcery.com> PR threads/10729 * linux-nat.c (linux_nat_new_thread): Change parameter to an lwp pointer. (linux_nat_prepare_to_resume): New global. (lwp_free): New. (purge_lwp_list): Use it. (add_lwp): Call linux_nat_new_thread even on the first LWP. Adjust to interface change. (delete_lwp): Call lwp_free instead of xfree. (detach_callback, linux_nat_detach, resume_lwp, linux_nat_resume) (linux_handle_syscall_trap, linux_handle_extended_wait) (linux_nat_filter_event, resume_stopped_resumed_lwps): Call linux_nat_prepare_to_resume before resuming. (linux_stop_lwp): New. (linux_nat_set_new_thread): Adjust. (linux_nat_set_prepare_to_resume): New. * linux-nat.h (struct arch_lwp_info): Forward declare. (struct lwp_info) <arch_private>: New field. (linux_stop_lwp): Declare. (linux_nat_set_new_thread): Adjust. (linux_nat_set_prepare_to_resume): New. * i386-nat.c (DR_NADDR, DR_STATUS, DR_CONTROL) (struct i386_debug_reg_state): Move to i386-nat.h. (dr_mirror): Comment. (i386_debug_reg_state): New. (i386_update_inferior_debug_regs): Simplify. (i386_stopped_data_address): Use the debug register state from the inferior, not from the local cache. * i386-nat.h (struct i386_dr_low_type): Delete reset_addr and unset_status fields. New get_addr and get_control fields. (DR_FIRSTADDR, DR_LASTADDR, DR_CONTROL): Moved from i386-nat.c. (DR_NADDR, DR_STATUS): New. (struct i386_debug_reg_state): Moved from i386-nat.c. * amd64-linux-nat.c (struct arch_lwp_info): New. (amd64_linux_dr): Delete global. (amd64_linux_dr_get_addr): New. (amd64_linux_dr_get_control): New. (amd64_linux_dr_unset_status): Delete. (amd64_linux_dr_set_addr): Reimplement. (amd64_linux_dr_reset_addr): Delete. (update_debug_registers_callback): New. (amd64_linux_dr_set_control): Reimplement. (amd64_linux_dr_set_addr): Reimplement. (amd64_linux_prepare_to_resume): New. (amd64_linux_new_thread): Change parameter to an lwp pointer. Reimplement. (_initialize_amd64_linux_nat): No longer install i386_dr_low.reset_addr and i386_dr_low.unset_status. Install amd64_linux_dr_get_control as i386_dr_low.get_control. Install amd64_linux_dr_get_addr as i386_dr_low.get_addr. Install amd64_linux_prepare_to_resume. * i386-linux-nat.c (DR_FIRSTADDR, DR_LASTADDR, DR_STATUS) (DR_CONTROL): Delete. (struct arch_lwp_info): New. (i386_linux_dr): Delete global. (i386_linux_dr_set_control): Reimplement. (i386_linux_dr_get_addr): New. (i386_linux_dr_set_addr): Reimplement. (i386_linux_dr_get_control): New. (update_debug_registers_callback): New. (i386_linux_dr_unset_status): Delete. (i386_linux_dr_set_addr): Reimplement. (i386_linux_prepare_to_resume): New. (i386_linux_new_thread): Change parameter to an lwp pointer. Reimplement. (_initialize_i386_linux_nat): No longer install i386_dr_low.reset_addr and i386_dr_low.unset_status. Install i386_linux_dr_get_control as i386_dr_low.get_control. Install i386_linux_dr_get_addr as i386_dr_low.get_addr. Install i386_linux_prepare_to_resume. * arm-linux-nat.c (arm_linux_new_thread): Change parameter to an lwp pointer. Adjust. * ia64-linux-nat.c (ia64_linux_new_thread): Likewise. * mips-linux-nat.c (mips_linux_new_thread): Likewise. * ppc-linux-nat.c (ppc_linux_new_thread): Likewise. * s390-nat.c (s390_fix_watch_points): Likewise. * i386-darwin-nat.c (DR_FIRSTADDR, DR_LASTADDR, DR_STATUS) (DR_CONTROL): Delete. (i386_darwin_dr_reset_addr): Delete. (i386_darwin_dr_get_addr): New. (i386_darwin_dr_get_control): New. * go32-nat.c (go32_get_dr7, go32_get_dr): New. (init_go32_ops): No longer install i386_dr_low.reset_addr. Install go32_get_dr7 as i386_dr_low.get_control. Install go32_get_dr as i386_dr_low.get_addr. * i386bsd-nat.c (i386bsd_dr_get): New. (i386bsd_dr_reset_addr): Delete. (i386bsd_dr_get_addr): New. (i386bsd_dr_get_status): Use i386bsd_dr_get. (i386bsd_dr_get_control): New. * i386bsd-nat.h (i386bsd_dr_reset_addr): Delete. (i386bsd_dr_get_addr): New. (i386bsd_dr_get_control): New. * i386fbsd-nat.c (_initialize_i386fbsd_nat): No longer install i386_dr_low.reset_addr and i386_dr_low.unset_status. Install i386bsd_dr_get_control as i386_dr_low.get_control. Install i386bsd_dr_get_addr as i386_dr_low.get_addr. * windows-nat.c (init_windows_ops): No longer install i386_dr_low.reset_addr and i386_dr_low.unset_status. Install cygwin_get_dr7 as i386_dr_low.get_control. Install cygwin_get_dr as i386_dr_low.get_addr. (cygwin_get_dr): New. (cygwin_get_dr7): New. gdb/testsuite/ 2011-12-14 Pedro Alves <pedro@codesourcery.com> PR threads/10729 * gdb.mi/watch-nonstop.c: New file. * gdb.mi/mi-watch-nonstop.exp: New file.
2011-12-14 18:20:32 +01:00
int i;
gdb/ Fix watchpoints across inferior fork. * amd64-linux-nat.c (update_debug_registers_callback): Update the comment for linux_nat_iterate_watchpoint_lwps. (amd64_linux_dr_set_control, amd64_linux_dr_set_addr): Use linux_nat_iterate_watchpoint_lwps. (amd64_linux_prepare_to_resume): New comment on Linux kernel. * i386-linux-nat.c (update_debug_registers_callback): Update the comment for linux_nat_iterate_watchpoint_lwps. (i386_linux_dr_set_control, i386_linux_dr_set_addr): Use linux_nat_iterate_watchpoint_lwps. (i386_linux_prepare_to_resume): New comment on Linux kernel. * i386-nat.c: Include inferior.h. (dr_mirror): Remove. (i386_inferior_data, struct i386_inferior_data) (i386_inferior_data_get): New. (i386_debug_reg_state): Use i386_inferior_data_get. (i386_cleanup_dregs, i386_update_inferior_debug_regs) (i386_insert_watchpoint, i386_remove_watchpoint) (i386_stopped_data_address, i386_insert_hw_breakpoint) (i386_remove_hw_breakpoint): New variable state, use i386_debug_reg_state instead of DR_MIRROR. * linux-nat.c (delete_lwp): New declaration. (num_lwps): Move here from downwards. (delete_lwp_cleanup): New. (linux_child_follow_fork): Create new child_lp, call linux_nat_new_thread and linux_nat_prepare_to_resume before calling PTRACE_DETACH. (num_lwps): Move upwards. (linux_nat_iterate_watchpoint_lwps): New. * linux-nat.h (linux_nat_iterate_watchpoint_lwps_ftype): New. (linux_nat_iterate_watchpoint_lwps_ftype): New declaration. gdb/testsuite/ Fix watchpoints across inferior fork. * gdb.threads/watchpoint-fork-child.c: New file. * gdb.threads/watchpoint-fork-mt.c: New file. * gdb.threads/watchpoint-fork-parent.c: New file. * gdb.threads/watchpoint-fork-st.c: New file. * gdb.threads/watchpoint-fork.exp: New file. * gdb.threads/watchpoint-fork.h: New file.
2012-01-24 14:46:55 +01:00
/* On Linux kernel before 2.6.33 commit
72f674d203cd230426437cdcf7dd6f681dad8b0d
if you enable a breakpoint by the DR_CONTROL bits you need to have
already written the corresponding DR_FIRSTADDR...DR_LASTADDR registers.
Ensure DR_CONTROL gets written as the very last register here. */
gdb/ 2011-12-14 Pedro Alves <pedro@codesourcery.com> PR threads/10729 * linux-nat.c (linux_nat_new_thread): Change parameter to an lwp pointer. (linux_nat_prepare_to_resume): New global. (lwp_free): New. (purge_lwp_list): Use it. (add_lwp): Call linux_nat_new_thread even on the first LWP. Adjust to interface change. (delete_lwp): Call lwp_free instead of xfree. (detach_callback, linux_nat_detach, resume_lwp, linux_nat_resume) (linux_handle_syscall_trap, linux_handle_extended_wait) (linux_nat_filter_event, resume_stopped_resumed_lwps): Call linux_nat_prepare_to_resume before resuming. (linux_stop_lwp): New. (linux_nat_set_new_thread): Adjust. (linux_nat_set_prepare_to_resume): New. * linux-nat.h (struct arch_lwp_info): Forward declare. (struct lwp_info) <arch_private>: New field. (linux_stop_lwp): Declare. (linux_nat_set_new_thread): Adjust. (linux_nat_set_prepare_to_resume): New. * i386-nat.c (DR_NADDR, DR_STATUS, DR_CONTROL) (struct i386_debug_reg_state): Move to i386-nat.h. (dr_mirror): Comment. (i386_debug_reg_state): New. (i386_update_inferior_debug_regs): Simplify. (i386_stopped_data_address): Use the debug register state from the inferior, not from the local cache. * i386-nat.h (struct i386_dr_low_type): Delete reset_addr and unset_status fields. New get_addr and get_control fields. (DR_FIRSTADDR, DR_LASTADDR, DR_CONTROL): Moved from i386-nat.c. (DR_NADDR, DR_STATUS): New. (struct i386_debug_reg_state): Moved from i386-nat.c. * amd64-linux-nat.c (struct arch_lwp_info): New. (amd64_linux_dr): Delete global. (amd64_linux_dr_get_addr): New. (amd64_linux_dr_get_control): New. (amd64_linux_dr_unset_status): Delete. (amd64_linux_dr_set_addr): Reimplement. (amd64_linux_dr_reset_addr): Delete. (update_debug_registers_callback): New. (amd64_linux_dr_set_control): Reimplement. (amd64_linux_dr_set_addr): Reimplement. (amd64_linux_prepare_to_resume): New. (amd64_linux_new_thread): Change parameter to an lwp pointer. Reimplement. (_initialize_amd64_linux_nat): No longer install i386_dr_low.reset_addr and i386_dr_low.unset_status. Install amd64_linux_dr_get_control as i386_dr_low.get_control. Install amd64_linux_dr_get_addr as i386_dr_low.get_addr. Install amd64_linux_prepare_to_resume. * i386-linux-nat.c (DR_FIRSTADDR, DR_LASTADDR, DR_STATUS) (DR_CONTROL): Delete. (struct arch_lwp_info): New. (i386_linux_dr): Delete global. (i386_linux_dr_set_control): Reimplement. (i386_linux_dr_get_addr): New. (i386_linux_dr_set_addr): Reimplement. (i386_linux_dr_get_control): New. (update_debug_registers_callback): New. (i386_linux_dr_unset_status): Delete. (i386_linux_dr_set_addr): Reimplement. (i386_linux_prepare_to_resume): New. (i386_linux_new_thread): Change parameter to an lwp pointer. Reimplement. (_initialize_i386_linux_nat): No longer install i386_dr_low.reset_addr and i386_dr_low.unset_status. Install i386_linux_dr_get_control as i386_dr_low.get_control. Install i386_linux_dr_get_addr as i386_dr_low.get_addr. Install i386_linux_prepare_to_resume. * arm-linux-nat.c (arm_linux_new_thread): Change parameter to an lwp pointer. Adjust. * ia64-linux-nat.c (ia64_linux_new_thread): Likewise. * mips-linux-nat.c (mips_linux_new_thread): Likewise. * ppc-linux-nat.c (ppc_linux_new_thread): Likewise. * s390-nat.c (s390_fix_watch_points): Likewise. * i386-darwin-nat.c (DR_FIRSTADDR, DR_LASTADDR, DR_STATUS) (DR_CONTROL): Delete. (i386_darwin_dr_reset_addr): Delete. (i386_darwin_dr_get_addr): New. (i386_darwin_dr_get_control): New. * go32-nat.c (go32_get_dr7, go32_get_dr): New. (init_go32_ops): No longer install i386_dr_low.reset_addr. Install go32_get_dr7 as i386_dr_low.get_control. Install go32_get_dr as i386_dr_low.get_addr. * i386bsd-nat.c (i386bsd_dr_get): New. (i386bsd_dr_reset_addr): Delete. (i386bsd_dr_get_addr): New. (i386bsd_dr_get_status): Use i386bsd_dr_get. (i386bsd_dr_get_control): New. * i386bsd-nat.h (i386bsd_dr_reset_addr): Delete. (i386bsd_dr_get_addr): New. (i386bsd_dr_get_control): New. * i386fbsd-nat.c (_initialize_i386fbsd_nat): No longer install i386_dr_low.reset_addr and i386_dr_low.unset_status. Install i386bsd_dr_get_control as i386_dr_low.get_control. Install i386bsd_dr_get_addr as i386_dr_low.get_addr. * windows-nat.c (init_windows_ops): No longer install i386_dr_low.reset_addr and i386_dr_low.unset_status. Install cygwin_get_dr7 as i386_dr_low.get_control. Install cygwin_get_dr as i386_dr_low.get_addr. (cygwin_get_dr): New. (cygwin_get_dr7): New. gdb/testsuite/ 2011-12-14 Pedro Alves <pedro@codesourcery.com> PR threads/10729 * gdb.mi/watch-nonstop.c: New file. * gdb.mi/mi-watch-nonstop.exp: New file.
2011-12-14 18:20:32 +01:00
for (i = DR_FIRSTADDR; i <= DR_LASTADDR; i++)
if (state->dr_ref_count[i] > 0)
{
amd64_linux_dr_set (lwp->ptid, i, state->dr_mirror[i]);
/* If we're setting a watchpoint, any change the inferior
had done itself to the debug registers needs to be
discarded, otherwise, i386_stopped_data_address can get
confused. */
clear_status = 1;
}
amd64_linux_dr_set (lwp->ptid, DR_CONTROL, state->dr_control_mirror);
lwp->arch_private->debug_registers_changed = 0;
}
gdb/ 2011-12-14 Pedro Alves <pedro@codesourcery.com> PR threads/10729 * linux-nat.c (linux_nat_new_thread): Change parameter to an lwp pointer. (linux_nat_prepare_to_resume): New global. (lwp_free): New. (purge_lwp_list): Use it. (add_lwp): Call linux_nat_new_thread even on the first LWP. Adjust to interface change. (delete_lwp): Call lwp_free instead of xfree. (detach_callback, linux_nat_detach, resume_lwp, linux_nat_resume) (linux_handle_syscall_trap, linux_handle_extended_wait) (linux_nat_filter_event, resume_stopped_resumed_lwps): Call linux_nat_prepare_to_resume before resuming. (linux_stop_lwp): New. (linux_nat_set_new_thread): Adjust. (linux_nat_set_prepare_to_resume): New. * linux-nat.h (struct arch_lwp_info): Forward declare. (struct lwp_info) <arch_private>: New field. (linux_stop_lwp): Declare. (linux_nat_set_new_thread): Adjust. (linux_nat_set_prepare_to_resume): New. * i386-nat.c (DR_NADDR, DR_STATUS, DR_CONTROL) (struct i386_debug_reg_state): Move to i386-nat.h. (dr_mirror): Comment. (i386_debug_reg_state): New. (i386_update_inferior_debug_regs): Simplify. (i386_stopped_data_address): Use the debug register state from the inferior, not from the local cache. * i386-nat.h (struct i386_dr_low_type): Delete reset_addr and unset_status fields. New get_addr and get_control fields. (DR_FIRSTADDR, DR_LASTADDR, DR_CONTROL): Moved from i386-nat.c. (DR_NADDR, DR_STATUS): New. (struct i386_debug_reg_state): Moved from i386-nat.c. * amd64-linux-nat.c (struct arch_lwp_info): New. (amd64_linux_dr): Delete global. (amd64_linux_dr_get_addr): New. (amd64_linux_dr_get_control): New. (amd64_linux_dr_unset_status): Delete. (amd64_linux_dr_set_addr): Reimplement. (amd64_linux_dr_reset_addr): Delete. (update_debug_registers_callback): New. (amd64_linux_dr_set_control): Reimplement. (amd64_linux_dr_set_addr): Reimplement. (amd64_linux_prepare_to_resume): New. (amd64_linux_new_thread): Change parameter to an lwp pointer. Reimplement. (_initialize_amd64_linux_nat): No longer install i386_dr_low.reset_addr and i386_dr_low.unset_status. Install amd64_linux_dr_get_control as i386_dr_low.get_control. Install amd64_linux_dr_get_addr as i386_dr_low.get_addr. Install amd64_linux_prepare_to_resume. * i386-linux-nat.c (DR_FIRSTADDR, DR_LASTADDR, DR_STATUS) (DR_CONTROL): Delete. (struct arch_lwp_info): New. (i386_linux_dr): Delete global. (i386_linux_dr_set_control): Reimplement. (i386_linux_dr_get_addr): New. (i386_linux_dr_set_addr): Reimplement. (i386_linux_dr_get_control): New. (update_debug_registers_callback): New. (i386_linux_dr_unset_status): Delete. (i386_linux_dr_set_addr): Reimplement. (i386_linux_prepare_to_resume): New. (i386_linux_new_thread): Change parameter to an lwp pointer. Reimplement. (_initialize_i386_linux_nat): No longer install i386_dr_low.reset_addr and i386_dr_low.unset_status. Install i386_linux_dr_get_control as i386_dr_low.get_control. Install i386_linux_dr_get_addr as i386_dr_low.get_addr. Install i386_linux_prepare_to_resume. * arm-linux-nat.c (arm_linux_new_thread): Change parameter to an lwp pointer. Adjust. * ia64-linux-nat.c (ia64_linux_new_thread): Likewise. * mips-linux-nat.c (mips_linux_new_thread): Likewise. * ppc-linux-nat.c (ppc_linux_new_thread): Likewise. * s390-nat.c (s390_fix_watch_points): Likewise. * i386-darwin-nat.c (DR_FIRSTADDR, DR_LASTADDR, DR_STATUS) (DR_CONTROL): Delete. (i386_darwin_dr_reset_addr): Delete. (i386_darwin_dr_get_addr): New. (i386_darwin_dr_get_control): New. * go32-nat.c (go32_get_dr7, go32_get_dr): New. (init_go32_ops): No longer install i386_dr_low.reset_addr. Install go32_get_dr7 as i386_dr_low.get_control. Install go32_get_dr as i386_dr_low.get_addr. * i386bsd-nat.c (i386bsd_dr_get): New. (i386bsd_dr_reset_addr): Delete. (i386bsd_dr_get_addr): New. (i386bsd_dr_get_status): Use i386bsd_dr_get. (i386bsd_dr_get_control): New. * i386bsd-nat.h (i386bsd_dr_reset_addr): Delete. (i386bsd_dr_get_addr): New. (i386bsd_dr_get_control): New. * i386fbsd-nat.c (_initialize_i386fbsd_nat): No longer install i386_dr_low.reset_addr and i386_dr_low.unset_status. Install i386bsd_dr_get_control as i386_dr_low.get_control. Install i386bsd_dr_get_addr as i386_dr_low.get_addr. * windows-nat.c (init_windows_ops): No longer install i386_dr_low.reset_addr and i386_dr_low.unset_status. Install cygwin_get_dr7 as i386_dr_low.get_control. Install cygwin_get_dr as i386_dr_low.get_addr. (cygwin_get_dr): New. (cygwin_get_dr7): New. gdb/testsuite/ 2011-12-14 Pedro Alves <pedro@codesourcery.com> PR threads/10729 * gdb.mi/watch-nonstop.c: New file. * gdb.mi/mi-watch-nonstop.exp: New file.
2011-12-14 18:20:32 +01:00
if (clear_status || lwp->stopped_by_watchpoint)
amd64_linux_dr_set (lwp->ptid, DR_STATUS, 0);
}
* linux-nat.c (linux_nat_new_thread): New variable. (linux_child_follow_fork): Set inferior_ptid to include LWP ID. Use linux_nat_switch_fork. (lwp_list): Make public. (add_lwp): Call linux_nat_new_thread. (lin_lwp_attach_lwp, linux_nat_attach): Call add_lwp after stopping the new thread. (resume_callback): Clear lp->siginfo. Remove unused variable. (linux_nat_resume): Assert that the LWP list is already initialized. Clear lp->siginfo. (save_siginfo): New. (stop_wait_callback, linux_nat_wait): Call it. (linux_nat_set_new_thread, linux_nat_get_siginfo): New. * linux-nat.h (struct lwp_info): Add siginfo. (lwp_list, linux_nat_set_new_thread, linux_nat_get_siginfo): Declare. (ALL_LWPS): Define. * amd64-linux-nat.c (amd64_linux_dr): New. (amd64_linux_dr_get): Take a PTID argument. Correct typo. (amd64_linux_dr_set): Take a PTID argument. (amd64_linux_dr_set_control, amd64_linux_dr_set_addr): Use ALL_LWPS. (amd64_linux_dr_reset_addr): Use amd64_linux_dr_set_addr. (amd64_linux_dr_get_status): Pass inferior_ptid to amd64_linux_dr_get. (amd64_linux_new_thread): New. (_initialize_amd64_linux_nat): Call linux_nat_set_new_thread. * i386-linux-nat.c (i386_linux_dr): New. (i386_linux_dr_get, i386_linux_dr_set): Take a PTID argument. (i386_linux_dr_set_control, i386_linux_dr_set_addr): Use ALL_LWPS. (i386_linux_dr_reset_addr): Use i386_linux_dr_set_addr. (i386_linux_dr_get_status): Pass inferior_ptid to i386_linux_dr_get. (i386_linux_new_thread): New. (i386_linux_resume): Remove unnecessary PID check. (_initialize_i386_linux_nat): Call linux_nat_set_new_thread. * ia64-linux-nat.c (enable_watchpoints_in_psr): Take PTID argument. (fetch_debug_register, fetch_debug_register_pair): Delete. (debug_registers): New. (ia64_linux_insert_watchpoint, ia64_linux_remove_watchpoint): Use ALL_LWPS and debug_registers. (ia64_linux_new_thread): New. (ia64_linux_stopped_data_address): Use linux_nat_get_siginfo. (_initialize_ia64_linux_nat): Call linux_nat_set_new_thread. * ppc-linux-nat.c (last_stopped_data_address): Delete. (saved_dabr_value): New. (ppc_linux_insert_watchpoint, ppc_linux_remove_watchpoint): Use ALL_LWPS. (ppc_linux_new_thread): New. (ppc_linux_stopped_data_address): Use linux_nat_get_siginfo. (ppc_linux_stopped_by_watchpoint): Call ppc_linux_stopped_data_address. (_initialize_ppc_linux_nat): Call linux_nat_set_new_thread. * s390-nat.c (s390_stopped_by_watchpoint): Clear the watchpoint status after reading it. (s390_fix_watch_points): Take a PTID argument. (s390_insert_watchpoint, s390_remove_watchpoint): Use ALL_LWPS. (_initialize_s390_nat): Call linux_nat_set_new_thread.
2007-10-01 02:22:50 +02:00
static void
gdb/ 2011-12-14 Pedro Alves <pedro@codesourcery.com> PR threads/10729 * linux-nat.c (linux_nat_new_thread): Change parameter to an lwp pointer. (linux_nat_prepare_to_resume): New global. (lwp_free): New. (purge_lwp_list): Use it. (add_lwp): Call linux_nat_new_thread even on the first LWP. Adjust to interface change. (delete_lwp): Call lwp_free instead of xfree. (detach_callback, linux_nat_detach, resume_lwp, linux_nat_resume) (linux_handle_syscall_trap, linux_handle_extended_wait) (linux_nat_filter_event, resume_stopped_resumed_lwps): Call linux_nat_prepare_to_resume before resuming. (linux_stop_lwp): New. (linux_nat_set_new_thread): Adjust. (linux_nat_set_prepare_to_resume): New. * linux-nat.h (struct arch_lwp_info): Forward declare. (struct lwp_info) <arch_private>: New field. (linux_stop_lwp): Declare. (linux_nat_set_new_thread): Adjust. (linux_nat_set_prepare_to_resume): New. * i386-nat.c (DR_NADDR, DR_STATUS, DR_CONTROL) (struct i386_debug_reg_state): Move to i386-nat.h. (dr_mirror): Comment. (i386_debug_reg_state): New. (i386_update_inferior_debug_regs): Simplify. (i386_stopped_data_address): Use the debug register state from the inferior, not from the local cache. * i386-nat.h (struct i386_dr_low_type): Delete reset_addr and unset_status fields. New get_addr and get_control fields. (DR_FIRSTADDR, DR_LASTADDR, DR_CONTROL): Moved from i386-nat.c. (DR_NADDR, DR_STATUS): New. (struct i386_debug_reg_state): Moved from i386-nat.c. * amd64-linux-nat.c (struct arch_lwp_info): New. (amd64_linux_dr): Delete global. (amd64_linux_dr_get_addr): New. (amd64_linux_dr_get_control): New. (amd64_linux_dr_unset_status): Delete. (amd64_linux_dr_set_addr): Reimplement. (amd64_linux_dr_reset_addr): Delete. (update_debug_registers_callback): New. (amd64_linux_dr_set_control): Reimplement. (amd64_linux_dr_set_addr): Reimplement. (amd64_linux_prepare_to_resume): New. (amd64_linux_new_thread): Change parameter to an lwp pointer. Reimplement. (_initialize_amd64_linux_nat): No longer install i386_dr_low.reset_addr and i386_dr_low.unset_status. Install amd64_linux_dr_get_control as i386_dr_low.get_control. Install amd64_linux_dr_get_addr as i386_dr_low.get_addr. Install amd64_linux_prepare_to_resume. * i386-linux-nat.c (DR_FIRSTADDR, DR_LASTADDR, DR_STATUS) (DR_CONTROL): Delete. (struct arch_lwp_info): New. (i386_linux_dr): Delete global. (i386_linux_dr_set_control): Reimplement. (i386_linux_dr_get_addr): New. (i386_linux_dr_set_addr): Reimplement. (i386_linux_dr_get_control): New. (update_debug_registers_callback): New. (i386_linux_dr_unset_status): Delete. (i386_linux_dr_set_addr): Reimplement. (i386_linux_prepare_to_resume): New. (i386_linux_new_thread): Change parameter to an lwp pointer. Reimplement. (_initialize_i386_linux_nat): No longer install i386_dr_low.reset_addr and i386_dr_low.unset_status. Install i386_linux_dr_get_control as i386_dr_low.get_control. Install i386_linux_dr_get_addr as i386_dr_low.get_addr. Install i386_linux_prepare_to_resume. * arm-linux-nat.c (arm_linux_new_thread): Change parameter to an lwp pointer. Adjust. * ia64-linux-nat.c (ia64_linux_new_thread): Likewise. * mips-linux-nat.c (mips_linux_new_thread): Likewise. * ppc-linux-nat.c (ppc_linux_new_thread): Likewise. * s390-nat.c (s390_fix_watch_points): Likewise. * i386-darwin-nat.c (DR_FIRSTADDR, DR_LASTADDR, DR_STATUS) (DR_CONTROL): Delete. (i386_darwin_dr_reset_addr): Delete. (i386_darwin_dr_get_addr): New. (i386_darwin_dr_get_control): New. * go32-nat.c (go32_get_dr7, go32_get_dr): New. (init_go32_ops): No longer install i386_dr_low.reset_addr. Install go32_get_dr7 as i386_dr_low.get_control. Install go32_get_dr as i386_dr_low.get_addr. * i386bsd-nat.c (i386bsd_dr_get): New. (i386bsd_dr_reset_addr): Delete. (i386bsd_dr_get_addr): New. (i386bsd_dr_get_status): Use i386bsd_dr_get. (i386bsd_dr_get_control): New. * i386bsd-nat.h (i386bsd_dr_reset_addr): Delete. (i386bsd_dr_get_addr): New. (i386bsd_dr_get_control): New. * i386fbsd-nat.c (_initialize_i386fbsd_nat): No longer install i386_dr_low.reset_addr and i386_dr_low.unset_status. Install i386bsd_dr_get_control as i386_dr_low.get_control. Install i386bsd_dr_get_addr as i386_dr_low.get_addr. * windows-nat.c (init_windows_ops): No longer install i386_dr_low.reset_addr and i386_dr_low.unset_status. Install cygwin_get_dr7 as i386_dr_low.get_control. Install cygwin_get_dr as i386_dr_low.get_addr. (cygwin_get_dr): New. (cygwin_get_dr7): New. gdb/testsuite/ 2011-12-14 Pedro Alves <pedro@codesourcery.com> PR threads/10729 * gdb.mi/watch-nonstop.c: New file. * gdb.mi/mi-watch-nonstop.exp: New file.
2011-12-14 18:20:32 +01:00
amd64_linux_new_thread (struct lwp_info *lp)
* linux-nat.c (linux_nat_new_thread): New variable. (linux_child_follow_fork): Set inferior_ptid to include LWP ID. Use linux_nat_switch_fork. (lwp_list): Make public. (add_lwp): Call linux_nat_new_thread. (lin_lwp_attach_lwp, linux_nat_attach): Call add_lwp after stopping the new thread. (resume_callback): Clear lp->siginfo. Remove unused variable. (linux_nat_resume): Assert that the LWP list is already initialized. Clear lp->siginfo. (save_siginfo): New. (stop_wait_callback, linux_nat_wait): Call it. (linux_nat_set_new_thread, linux_nat_get_siginfo): New. * linux-nat.h (struct lwp_info): Add siginfo. (lwp_list, linux_nat_set_new_thread, linux_nat_get_siginfo): Declare. (ALL_LWPS): Define. * amd64-linux-nat.c (amd64_linux_dr): New. (amd64_linux_dr_get): Take a PTID argument. Correct typo. (amd64_linux_dr_set): Take a PTID argument. (amd64_linux_dr_set_control, amd64_linux_dr_set_addr): Use ALL_LWPS. (amd64_linux_dr_reset_addr): Use amd64_linux_dr_set_addr. (amd64_linux_dr_get_status): Pass inferior_ptid to amd64_linux_dr_get. (amd64_linux_new_thread): New. (_initialize_amd64_linux_nat): Call linux_nat_set_new_thread. * i386-linux-nat.c (i386_linux_dr): New. (i386_linux_dr_get, i386_linux_dr_set): Take a PTID argument. (i386_linux_dr_set_control, i386_linux_dr_set_addr): Use ALL_LWPS. (i386_linux_dr_reset_addr): Use i386_linux_dr_set_addr. (i386_linux_dr_get_status): Pass inferior_ptid to i386_linux_dr_get. (i386_linux_new_thread): New. (i386_linux_resume): Remove unnecessary PID check. (_initialize_i386_linux_nat): Call linux_nat_set_new_thread. * ia64-linux-nat.c (enable_watchpoints_in_psr): Take PTID argument. (fetch_debug_register, fetch_debug_register_pair): Delete. (debug_registers): New. (ia64_linux_insert_watchpoint, ia64_linux_remove_watchpoint): Use ALL_LWPS and debug_registers. (ia64_linux_new_thread): New. (ia64_linux_stopped_data_address): Use linux_nat_get_siginfo. (_initialize_ia64_linux_nat): Call linux_nat_set_new_thread. * ppc-linux-nat.c (last_stopped_data_address): Delete. (saved_dabr_value): New. (ppc_linux_insert_watchpoint, ppc_linux_remove_watchpoint): Use ALL_LWPS. (ppc_linux_new_thread): New. (ppc_linux_stopped_data_address): Use linux_nat_get_siginfo. (ppc_linux_stopped_by_watchpoint): Call ppc_linux_stopped_data_address. (_initialize_ppc_linux_nat): Call linux_nat_set_new_thread. * s390-nat.c (s390_stopped_by_watchpoint): Clear the watchpoint status after reading it. (s390_fix_watch_points): Take a PTID argument. (s390_insert_watchpoint, s390_remove_watchpoint): Use ALL_LWPS. (_initialize_s390_nat): Call linux_nat_set_new_thread.
2007-10-01 02:22:50 +02:00
{
gdb/ 2011-12-14 Pedro Alves <pedro@codesourcery.com> PR threads/10729 * linux-nat.c (linux_nat_new_thread): Change parameter to an lwp pointer. (linux_nat_prepare_to_resume): New global. (lwp_free): New. (purge_lwp_list): Use it. (add_lwp): Call linux_nat_new_thread even on the first LWP. Adjust to interface change. (delete_lwp): Call lwp_free instead of xfree. (detach_callback, linux_nat_detach, resume_lwp, linux_nat_resume) (linux_handle_syscall_trap, linux_handle_extended_wait) (linux_nat_filter_event, resume_stopped_resumed_lwps): Call linux_nat_prepare_to_resume before resuming. (linux_stop_lwp): New. (linux_nat_set_new_thread): Adjust. (linux_nat_set_prepare_to_resume): New. * linux-nat.h (struct arch_lwp_info): Forward declare. (struct lwp_info) <arch_private>: New field. (linux_stop_lwp): Declare. (linux_nat_set_new_thread): Adjust. (linux_nat_set_prepare_to_resume): New. * i386-nat.c (DR_NADDR, DR_STATUS, DR_CONTROL) (struct i386_debug_reg_state): Move to i386-nat.h. (dr_mirror): Comment. (i386_debug_reg_state): New. (i386_update_inferior_debug_regs): Simplify. (i386_stopped_data_address): Use the debug register state from the inferior, not from the local cache. * i386-nat.h (struct i386_dr_low_type): Delete reset_addr and unset_status fields. New get_addr and get_control fields. (DR_FIRSTADDR, DR_LASTADDR, DR_CONTROL): Moved from i386-nat.c. (DR_NADDR, DR_STATUS): New. (struct i386_debug_reg_state): Moved from i386-nat.c. * amd64-linux-nat.c (struct arch_lwp_info): New. (amd64_linux_dr): Delete global. (amd64_linux_dr_get_addr): New. (amd64_linux_dr_get_control): New. (amd64_linux_dr_unset_status): Delete. (amd64_linux_dr_set_addr): Reimplement. (amd64_linux_dr_reset_addr): Delete. (update_debug_registers_callback): New. (amd64_linux_dr_set_control): Reimplement. (amd64_linux_dr_set_addr): Reimplement. (amd64_linux_prepare_to_resume): New. (amd64_linux_new_thread): Change parameter to an lwp pointer. Reimplement. (_initialize_amd64_linux_nat): No longer install i386_dr_low.reset_addr and i386_dr_low.unset_status. Install amd64_linux_dr_get_control as i386_dr_low.get_control. Install amd64_linux_dr_get_addr as i386_dr_low.get_addr. Install amd64_linux_prepare_to_resume. * i386-linux-nat.c (DR_FIRSTADDR, DR_LASTADDR, DR_STATUS) (DR_CONTROL): Delete. (struct arch_lwp_info): New. (i386_linux_dr): Delete global. (i386_linux_dr_set_control): Reimplement. (i386_linux_dr_get_addr): New. (i386_linux_dr_set_addr): Reimplement. (i386_linux_dr_get_control): New. (update_debug_registers_callback): New. (i386_linux_dr_unset_status): Delete. (i386_linux_dr_set_addr): Reimplement. (i386_linux_prepare_to_resume): New. (i386_linux_new_thread): Change parameter to an lwp pointer. Reimplement. (_initialize_i386_linux_nat): No longer install i386_dr_low.reset_addr and i386_dr_low.unset_status. Install i386_linux_dr_get_control as i386_dr_low.get_control. Install i386_linux_dr_get_addr as i386_dr_low.get_addr. Install i386_linux_prepare_to_resume. * arm-linux-nat.c (arm_linux_new_thread): Change parameter to an lwp pointer. Adjust. * ia64-linux-nat.c (ia64_linux_new_thread): Likewise. * mips-linux-nat.c (mips_linux_new_thread): Likewise. * ppc-linux-nat.c (ppc_linux_new_thread): Likewise. * s390-nat.c (s390_fix_watch_points): Likewise. * i386-darwin-nat.c (DR_FIRSTADDR, DR_LASTADDR, DR_STATUS) (DR_CONTROL): Delete. (i386_darwin_dr_reset_addr): Delete. (i386_darwin_dr_get_addr): New. (i386_darwin_dr_get_control): New. * go32-nat.c (go32_get_dr7, go32_get_dr): New. (init_go32_ops): No longer install i386_dr_low.reset_addr. Install go32_get_dr7 as i386_dr_low.get_control. Install go32_get_dr as i386_dr_low.get_addr. * i386bsd-nat.c (i386bsd_dr_get): New. (i386bsd_dr_reset_addr): Delete. (i386bsd_dr_get_addr): New. (i386bsd_dr_get_status): Use i386bsd_dr_get. (i386bsd_dr_get_control): New. * i386bsd-nat.h (i386bsd_dr_reset_addr): Delete. (i386bsd_dr_get_addr): New. (i386bsd_dr_get_control): New. * i386fbsd-nat.c (_initialize_i386fbsd_nat): No longer install i386_dr_low.reset_addr and i386_dr_low.unset_status. Install i386bsd_dr_get_control as i386_dr_low.get_control. Install i386bsd_dr_get_addr as i386_dr_low.get_addr. * windows-nat.c (init_windows_ops): No longer install i386_dr_low.reset_addr and i386_dr_low.unset_status. Install cygwin_get_dr7 as i386_dr_low.get_control. Install cygwin_get_dr as i386_dr_low.get_addr. (cygwin_get_dr): New. (cygwin_get_dr7): New. gdb/testsuite/ 2011-12-14 Pedro Alves <pedro@codesourcery.com> PR threads/10729 * gdb.mi/watch-nonstop.c: New file. * gdb.mi/mi-watch-nonstop.exp: New file.
2011-12-14 18:20:32 +01:00
struct arch_lwp_info *info = XCNEW (struct arch_lwp_info);
* linux-nat.c (linux_nat_new_thread): New variable. (linux_child_follow_fork): Set inferior_ptid to include LWP ID. Use linux_nat_switch_fork. (lwp_list): Make public. (add_lwp): Call linux_nat_new_thread. (lin_lwp_attach_lwp, linux_nat_attach): Call add_lwp after stopping the new thread. (resume_callback): Clear lp->siginfo. Remove unused variable. (linux_nat_resume): Assert that the LWP list is already initialized. Clear lp->siginfo. (save_siginfo): New. (stop_wait_callback, linux_nat_wait): Call it. (linux_nat_set_new_thread, linux_nat_get_siginfo): New. * linux-nat.h (struct lwp_info): Add siginfo. (lwp_list, linux_nat_set_new_thread, linux_nat_get_siginfo): Declare. (ALL_LWPS): Define. * amd64-linux-nat.c (amd64_linux_dr): New. (amd64_linux_dr_get): Take a PTID argument. Correct typo. (amd64_linux_dr_set): Take a PTID argument. (amd64_linux_dr_set_control, amd64_linux_dr_set_addr): Use ALL_LWPS. (amd64_linux_dr_reset_addr): Use amd64_linux_dr_set_addr. (amd64_linux_dr_get_status): Pass inferior_ptid to amd64_linux_dr_get. (amd64_linux_new_thread): New. (_initialize_amd64_linux_nat): Call linux_nat_set_new_thread. * i386-linux-nat.c (i386_linux_dr): New. (i386_linux_dr_get, i386_linux_dr_set): Take a PTID argument. (i386_linux_dr_set_control, i386_linux_dr_set_addr): Use ALL_LWPS. (i386_linux_dr_reset_addr): Use i386_linux_dr_set_addr. (i386_linux_dr_get_status): Pass inferior_ptid to i386_linux_dr_get. (i386_linux_new_thread): New. (i386_linux_resume): Remove unnecessary PID check. (_initialize_i386_linux_nat): Call linux_nat_set_new_thread. * ia64-linux-nat.c (enable_watchpoints_in_psr): Take PTID argument. (fetch_debug_register, fetch_debug_register_pair): Delete. (debug_registers): New. (ia64_linux_insert_watchpoint, ia64_linux_remove_watchpoint): Use ALL_LWPS and debug_registers. (ia64_linux_new_thread): New. (ia64_linux_stopped_data_address): Use linux_nat_get_siginfo. (_initialize_ia64_linux_nat): Call linux_nat_set_new_thread. * ppc-linux-nat.c (last_stopped_data_address): Delete. (saved_dabr_value): New. (ppc_linux_insert_watchpoint, ppc_linux_remove_watchpoint): Use ALL_LWPS. (ppc_linux_new_thread): New. (ppc_linux_stopped_data_address): Use linux_nat_get_siginfo. (ppc_linux_stopped_by_watchpoint): Call ppc_linux_stopped_data_address. (_initialize_ppc_linux_nat): Call linux_nat_set_new_thread. * s390-nat.c (s390_stopped_by_watchpoint): Clear the watchpoint status after reading it. (s390_fix_watch_points): Take a PTID argument. (s390_insert_watchpoint, s390_remove_watchpoint): Use ALL_LWPS. (_initialize_s390_nat): Call linux_nat_set_new_thread.
2007-10-01 02:22:50 +02:00
gdb/ 2011-12-14 Pedro Alves <pedro@codesourcery.com> PR threads/10729 * linux-nat.c (linux_nat_new_thread): Change parameter to an lwp pointer. (linux_nat_prepare_to_resume): New global. (lwp_free): New. (purge_lwp_list): Use it. (add_lwp): Call linux_nat_new_thread even on the first LWP. Adjust to interface change. (delete_lwp): Call lwp_free instead of xfree. (detach_callback, linux_nat_detach, resume_lwp, linux_nat_resume) (linux_handle_syscall_trap, linux_handle_extended_wait) (linux_nat_filter_event, resume_stopped_resumed_lwps): Call linux_nat_prepare_to_resume before resuming. (linux_stop_lwp): New. (linux_nat_set_new_thread): Adjust. (linux_nat_set_prepare_to_resume): New. * linux-nat.h (struct arch_lwp_info): Forward declare. (struct lwp_info) <arch_private>: New field. (linux_stop_lwp): Declare. (linux_nat_set_new_thread): Adjust. (linux_nat_set_prepare_to_resume): New. * i386-nat.c (DR_NADDR, DR_STATUS, DR_CONTROL) (struct i386_debug_reg_state): Move to i386-nat.h. (dr_mirror): Comment. (i386_debug_reg_state): New. (i386_update_inferior_debug_regs): Simplify. (i386_stopped_data_address): Use the debug register state from the inferior, not from the local cache. * i386-nat.h (struct i386_dr_low_type): Delete reset_addr and unset_status fields. New get_addr and get_control fields. (DR_FIRSTADDR, DR_LASTADDR, DR_CONTROL): Moved from i386-nat.c. (DR_NADDR, DR_STATUS): New. (struct i386_debug_reg_state): Moved from i386-nat.c. * amd64-linux-nat.c (struct arch_lwp_info): New. (amd64_linux_dr): Delete global. (amd64_linux_dr_get_addr): New. (amd64_linux_dr_get_control): New. (amd64_linux_dr_unset_status): Delete. (amd64_linux_dr_set_addr): Reimplement. (amd64_linux_dr_reset_addr): Delete. (update_debug_registers_callback): New. (amd64_linux_dr_set_control): Reimplement. (amd64_linux_dr_set_addr): Reimplement. (amd64_linux_prepare_to_resume): New. (amd64_linux_new_thread): Change parameter to an lwp pointer. Reimplement. (_initialize_amd64_linux_nat): No longer install i386_dr_low.reset_addr and i386_dr_low.unset_status. Install amd64_linux_dr_get_control as i386_dr_low.get_control. Install amd64_linux_dr_get_addr as i386_dr_low.get_addr. Install amd64_linux_prepare_to_resume. * i386-linux-nat.c (DR_FIRSTADDR, DR_LASTADDR, DR_STATUS) (DR_CONTROL): Delete. (struct arch_lwp_info): New. (i386_linux_dr): Delete global. (i386_linux_dr_set_control): Reimplement. (i386_linux_dr_get_addr): New. (i386_linux_dr_set_addr): Reimplement. (i386_linux_dr_get_control): New. (update_debug_registers_callback): New. (i386_linux_dr_unset_status): Delete. (i386_linux_dr_set_addr): Reimplement. (i386_linux_prepare_to_resume): New. (i386_linux_new_thread): Change parameter to an lwp pointer. Reimplement. (_initialize_i386_linux_nat): No longer install i386_dr_low.reset_addr and i386_dr_low.unset_status. Install i386_linux_dr_get_control as i386_dr_low.get_control. Install i386_linux_dr_get_addr as i386_dr_low.get_addr. Install i386_linux_prepare_to_resume. * arm-linux-nat.c (arm_linux_new_thread): Change parameter to an lwp pointer. Adjust. * ia64-linux-nat.c (ia64_linux_new_thread): Likewise. * mips-linux-nat.c (mips_linux_new_thread): Likewise. * ppc-linux-nat.c (ppc_linux_new_thread): Likewise. * s390-nat.c (s390_fix_watch_points): Likewise. * i386-darwin-nat.c (DR_FIRSTADDR, DR_LASTADDR, DR_STATUS) (DR_CONTROL): Delete. (i386_darwin_dr_reset_addr): Delete. (i386_darwin_dr_get_addr): New. (i386_darwin_dr_get_control): New. * go32-nat.c (go32_get_dr7, go32_get_dr): New. (init_go32_ops): No longer install i386_dr_low.reset_addr. Install go32_get_dr7 as i386_dr_low.get_control. Install go32_get_dr as i386_dr_low.get_addr. * i386bsd-nat.c (i386bsd_dr_get): New. (i386bsd_dr_reset_addr): Delete. (i386bsd_dr_get_addr): New. (i386bsd_dr_get_status): Use i386bsd_dr_get. (i386bsd_dr_get_control): New. * i386bsd-nat.h (i386bsd_dr_reset_addr): Delete. (i386bsd_dr_get_addr): New. (i386bsd_dr_get_control): New. * i386fbsd-nat.c (_initialize_i386fbsd_nat): No longer install i386_dr_low.reset_addr and i386_dr_low.unset_status. Install i386bsd_dr_get_control as i386_dr_low.get_control. Install i386bsd_dr_get_addr as i386_dr_low.get_addr. * windows-nat.c (init_windows_ops): No longer install i386_dr_low.reset_addr and i386_dr_low.unset_status. Install cygwin_get_dr7 as i386_dr_low.get_control. Install cygwin_get_dr as i386_dr_low.get_addr. (cygwin_get_dr): New. (cygwin_get_dr7): New. gdb/testsuite/ 2011-12-14 Pedro Alves <pedro@codesourcery.com> PR threads/10729 * gdb.mi/watch-nonstop.c: New file. * gdb.mi/mi-watch-nonstop.exp: New file.
2011-12-14 18:20:32 +01:00
info->debug_registers_changed = 1;
* linux-nat.c (linux_nat_new_thread): New variable. (linux_child_follow_fork): Set inferior_ptid to include LWP ID. Use linux_nat_switch_fork. (lwp_list): Make public. (add_lwp): Call linux_nat_new_thread. (lin_lwp_attach_lwp, linux_nat_attach): Call add_lwp after stopping the new thread. (resume_callback): Clear lp->siginfo. Remove unused variable. (linux_nat_resume): Assert that the LWP list is already initialized. Clear lp->siginfo. (save_siginfo): New. (stop_wait_callback, linux_nat_wait): Call it. (linux_nat_set_new_thread, linux_nat_get_siginfo): New. * linux-nat.h (struct lwp_info): Add siginfo. (lwp_list, linux_nat_set_new_thread, linux_nat_get_siginfo): Declare. (ALL_LWPS): Define. * amd64-linux-nat.c (amd64_linux_dr): New. (amd64_linux_dr_get): Take a PTID argument. Correct typo. (amd64_linux_dr_set): Take a PTID argument. (amd64_linux_dr_set_control, amd64_linux_dr_set_addr): Use ALL_LWPS. (amd64_linux_dr_reset_addr): Use amd64_linux_dr_set_addr. (amd64_linux_dr_get_status): Pass inferior_ptid to amd64_linux_dr_get. (amd64_linux_new_thread): New. (_initialize_amd64_linux_nat): Call linux_nat_set_new_thread. * i386-linux-nat.c (i386_linux_dr): New. (i386_linux_dr_get, i386_linux_dr_set): Take a PTID argument. (i386_linux_dr_set_control, i386_linux_dr_set_addr): Use ALL_LWPS. (i386_linux_dr_reset_addr): Use i386_linux_dr_set_addr. (i386_linux_dr_get_status): Pass inferior_ptid to i386_linux_dr_get. (i386_linux_new_thread): New. (i386_linux_resume): Remove unnecessary PID check. (_initialize_i386_linux_nat): Call linux_nat_set_new_thread. * ia64-linux-nat.c (enable_watchpoints_in_psr): Take PTID argument. (fetch_debug_register, fetch_debug_register_pair): Delete. (debug_registers): New. (ia64_linux_insert_watchpoint, ia64_linux_remove_watchpoint): Use ALL_LWPS and debug_registers. (ia64_linux_new_thread): New. (ia64_linux_stopped_data_address): Use linux_nat_get_siginfo. (_initialize_ia64_linux_nat): Call linux_nat_set_new_thread. * ppc-linux-nat.c (last_stopped_data_address): Delete. (saved_dabr_value): New. (ppc_linux_insert_watchpoint, ppc_linux_remove_watchpoint): Use ALL_LWPS. (ppc_linux_new_thread): New. (ppc_linux_stopped_data_address): Use linux_nat_get_siginfo. (ppc_linux_stopped_by_watchpoint): Call ppc_linux_stopped_data_address. (_initialize_ppc_linux_nat): Call linux_nat_set_new_thread. * s390-nat.c (s390_stopped_by_watchpoint): Clear the watchpoint status after reading it. (s390_fix_watch_points): Take a PTID argument. (s390_insert_watchpoint, s390_remove_watchpoint): Use ALL_LWPS. (_initialize_s390_nat): Call linux_nat_set_new_thread.
2007-10-01 02:22:50 +02:00
gdb/ 2011-12-14 Pedro Alves <pedro@codesourcery.com> PR threads/10729 * linux-nat.c (linux_nat_new_thread): Change parameter to an lwp pointer. (linux_nat_prepare_to_resume): New global. (lwp_free): New. (purge_lwp_list): Use it. (add_lwp): Call linux_nat_new_thread even on the first LWP. Adjust to interface change. (delete_lwp): Call lwp_free instead of xfree. (detach_callback, linux_nat_detach, resume_lwp, linux_nat_resume) (linux_handle_syscall_trap, linux_handle_extended_wait) (linux_nat_filter_event, resume_stopped_resumed_lwps): Call linux_nat_prepare_to_resume before resuming. (linux_stop_lwp): New. (linux_nat_set_new_thread): Adjust. (linux_nat_set_prepare_to_resume): New. * linux-nat.h (struct arch_lwp_info): Forward declare. (struct lwp_info) <arch_private>: New field. (linux_stop_lwp): Declare. (linux_nat_set_new_thread): Adjust. (linux_nat_set_prepare_to_resume): New. * i386-nat.c (DR_NADDR, DR_STATUS, DR_CONTROL) (struct i386_debug_reg_state): Move to i386-nat.h. (dr_mirror): Comment. (i386_debug_reg_state): New. (i386_update_inferior_debug_regs): Simplify. (i386_stopped_data_address): Use the debug register state from the inferior, not from the local cache. * i386-nat.h (struct i386_dr_low_type): Delete reset_addr and unset_status fields. New get_addr and get_control fields. (DR_FIRSTADDR, DR_LASTADDR, DR_CONTROL): Moved from i386-nat.c. (DR_NADDR, DR_STATUS): New. (struct i386_debug_reg_state): Moved from i386-nat.c. * amd64-linux-nat.c (struct arch_lwp_info): New. (amd64_linux_dr): Delete global. (amd64_linux_dr_get_addr): New. (amd64_linux_dr_get_control): New. (amd64_linux_dr_unset_status): Delete. (amd64_linux_dr_set_addr): Reimplement. (amd64_linux_dr_reset_addr): Delete. (update_debug_registers_callback): New. (amd64_linux_dr_set_control): Reimplement. (amd64_linux_dr_set_addr): Reimplement. (amd64_linux_prepare_to_resume): New. (amd64_linux_new_thread): Change parameter to an lwp pointer. Reimplement. (_initialize_amd64_linux_nat): No longer install i386_dr_low.reset_addr and i386_dr_low.unset_status. Install amd64_linux_dr_get_control as i386_dr_low.get_control. Install amd64_linux_dr_get_addr as i386_dr_low.get_addr. Install amd64_linux_prepare_to_resume. * i386-linux-nat.c (DR_FIRSTADDR, DR_LASTADDR, DR_STATUS) (DR_CONTROL): Delete. (struct arch_lwp_info): New. (i386_linux_dr): Delete global. (i386_linux_dr_set_control): Reimplement. (i386_linux_dr_get_addr): New. (i386_linux_dr_set_addr): Reimplement. (i386_linux_dr_get_control): New. (update_debug_registers_callback): New. (i386_linux_dr_unset_status): Delete. (i386_linux_dr_set_addr): Reimplement. (i386_linux_prepare_to_resume): New. (i386_linux_new_thread): Change parameter to an lwp pointer. Reimplement. (_initialize_i386_linux_nat): No longer install i386_dr_low.reset_addr and i386_dr_low.unset_status. Install i386_linux_dr_get_control as i386_dr_low.get_control. Install i386_linux_dr_get_addr as i386_dr_low.get_addr. Install i386_linux_prepare_to_resume. * arm-linux-nat.c (arm_linux_new_thread): Change parameter to an lwp pointer. Adjust. * ia64-linux-nat.c (ia64_linux_new_thread): Likewise. * mips-linux-nat.c (mips_linux_new_thread): Likewise. * ppc-linux-nat.c (ppc_linux_new_thread): Likewise. * s390-nat.c (s390_fix_watch_points): Likewise. * i386-darwin-nat.c (DR_FIRSTADDR, DR_LASTADDR, DR_STATUS) (DR_CONTROL): Delete. (i386_darwin_dr_reset_addr): Delete. (i386_darwin_dr_get_addr): New. (i386_darwin_dr_get_control): New. * go32-nat.c (go32_get_dr7, go32_get_dr): New. (init_go32_ops): No longer install i386_dr_low.reset_addr. Install go32_get_dr7 as i386_dr_low.get_control. Install go32_get_dr as i386_dr_low.get_addr. * i386bsd-nat.c (i386bsd_dr_get): New. (i386bsd_dr_reset_addr): Delete. (i386bsd_dr_get_addr): New. (i386bsd_dr_get_status): Use i386bsd_dr_get. (i386bsd_dr_get_control): New. * i386bsd-nat.h (i386bsd_dr_reset_addr): Delete. (i386bsd_dr_get_addr): New. (i386bsd_dr_get_control): New. * i386fbsd-nat.c (_initialize_i386fbsd_nat): No longer install i386_dr_low.reset_addr and i386_dr_low.unset_status. Install i386bsd_dr_get_control as i386_dr_low.get_control. Install i386bsd_dr_get_addr as i386_dr_low.get_addr. * windows-nat.c (init_windows_ops): No longer install i386_dr_low.reset_addr and i386_dr_low.unset_status. Install cygwin_get_dr7 as i386_dr_low.get_control. Install cygwin_get_dr as i386_dr_low.get_addr. (cygwin_get_dr): New. (cygwin_get_dr7): New. gdb/testsuite/ 2011-12-14 Pedro Alves <pedro@codesourcery.com> PR threads/10729 * gdb.mi/watch-nonstop.c: New file. * gdb.mi/mi-watch-nonstop.exp: New file.
2011-12-14 18:20:32 +01:00
lp->arch_private = info;
}
[native x86 GNU/Linux] Access debug register mirror from the corresponding process. While reviewing the native AArch64 patch, I noticed a problem: On 02/06/2013 08:46 PM, Pedro Alves wrote: > >> > +static void >> > +aarch64_linux_prepare_to_resume (struct lwp_info *lwp) >> > +{ >> > + struct arch_lwp_info *info = lwp->arch_private; >> > + >> > + /* NULL means this is the main thread still going through the shell, >> > + or, no watchpoint has been set yet. In that case, there's >> > + nothing to do. */ >> > + if (info == NULL) >> > + return; >> > + >> > + if (DR_HAS_CHANGED (info->dr_changed_bp) >> > + || DR_HAS_CHANGED (info->dr_changed_wp)) >> > + { >> > + int tid = GET_LWP (lwp->ptid); >> > + struct aarch64_debug_reg_state *state = aarch64_get_debug_reg_state (); > Hmm. This is always fetching the debug_reg_state of > the current inferior, but may not be the inferior of lwp. > I see the same bug on x86. Sorry about that. I'll fix it. A natural fix would be to make xxx_get_debug_reg_state take an inferior argument, but that doesn't work because of the case where we detach breakpoints/watchpoints from the child fork, at a time there's no inferior for the child fork at all. We do a nasty hack in i386_inferior_data_get, but that relies on all callers pointing the current inferior to the correct inferior, which isn't actually being done by all callers, and I don't think we want to enforce that -- deep in the bowls of linux-nat.c, there are many cases we resume lwps behind the scenes, and it's be better to not have that code rely on global state (as it doesn't today). The fix is to decouple the watchpoints code from inferiors, making it track target processes instead. This way, we can freely keep track of the watchpoint mirrors for these processes behind the core's back. Checkpoints also play dirty tricks with swapping the process behind the inferior, so they get special treatment too in the patch (which just amounts to calling a new hook). Instead of the old hack in i386_inferior_data_get, where we returned a copy of the current inferior's debug registers mirror, as soon as we detect a fork in the target, we copy the debug register mirror from the parent to the child process. I don't have an old kernel handy to test, but I stepped through gdb doing the watchpoint removal in the fork child in the watchpoint-fork test seeing that the debug registers end up cleared in the child. I didn't find the need for linux_nat_iterate_watchpoint_lwps. If we use plain iterate_over_lwps instead, what happens is that when removing watchpoints, that iterate_over_lwps doesn't actually iterate over anything, since the fork child is not added to the lwp list until later, at detach time, in linux_child_follow_fork. And if we don't iterate over that lwp, we don't mark its debug registers as needing update. But linux_child_follow_fork takes care of doing that explicitly: child_lp = add_lwp (inferior_ptid); child_lp->stopped = 1; child_lp->last_resume_kind = resume_stop; make_cleanup (delete_lwp_cleanup, child_lp); /* CHILD_LP has new PID, therefore linux_nat_new_thread is not called for it. See i386_inferior_data_get for the Linux kernel specifics. Ensure linux_nat_prepare_to_resume will reset the hardware debug registers. It is done by the linux_nat_new_thread call, which is being skipped in add_lwp above for the first lwp of a pid. */ gdb_assert (num_lwps (GET_PID (child_lp->ptid)) == 1); if (linux_nat_new_thread != NULL) linux_nat_new_thread (child_lp); if (linux_nat_prepare_to_resume != NULL) linux_nat_prepare_to_resume (child_lp); ptrace (PTRACE_DETACH, child_pid, 0, 0); so unless I'm missing something (quite possible) it ends up all the same. But, the !detach-on-fork, and the "follow-fork child" paths should also call linux_nat_new_thread, and they don't presently. It seems to me in those cases we're not clearing debug regs correctly when that's needed. Instead of copying that bit that works around add_lwp bypassing the linux_nat_new_thread call, I thought it'd be better to add an add_initial_lwp call to be used in the case we really need to bypass linux_nat_new_thread, and make add_lwp always call linux_nat_new_thread. i386_cleanup_dregs is rewritten to forget about the current process debug mirrors, which takes cares of other i386 ports. Only a couple of extra tweaks here and there were needed, as some targets wheren't actually calling i386_cleanup_dregs. Tested on Fedora 17 x86_64 -m64/-m32. GDBserver already fetches the i386_debug_reg_state from the right process, and, it doesn't handle forks at all, so no fix is needed over there. gdb/ 2013-02-13 Pedro Alves <palves@redhat.com> * amd64-linux-nat.c (update_debug_registers_callback): Update comment. (amd64_linux_dr_set_control, amd64_linux_dr_set_addr): Use iterate_over_lwps. (amd64_linux_prepare_to_resume): Pass the lwp's pid to i386_debug_reg_state. (amd64_linux_new_fork): New function. (_initialize_amd64_linux_nat): Install amd64_linux_new_fork as linux_nat_new_fork hook, and i386_forget_process as linux_nat_forget_process hook. * i386-linux-nat.c (update_debug_registers_callback): Update comment. (amd64_linux_dr_set_control, amd64_linux_dr_set_addr): Use iterate_over_lwps. (i386_linux_prepare_to_resume): Pass the lwp's pid to i386_debug_reg_state. (i386_linux_new_fork): New function. (_initialize_i386_linux_nat): Install i386_linux_new_fork as linux_nat_new_fork hook, and i386_forget_process as linux_nat_forget_process hook. * i386-nat.c (i386_init_dregs): Delete. (i386_inferior_data, struct i386_inferior_data): Delete. (struct i386_process_info): New. (i386_process_list): New global. (i386_find_process_pid, i386_add_process, i386_process_info_get): New functions. (i386_inferior_data_get): Delete. (i386_process_info_get): New function. (i386_debug_reg_state): New parameter 'pid'. Reimplement. (i386_forget_process): New function. (i386_cleanup_dregs): Rewrite. (i386_update_inferior_debug_regs, i386_insert_watchpoint) (i386_remove_watchpoint, i386_region_ok_for_watchpoint) (i386_stopped_data_address, i386_insert_hw_breakpoint) (i386_remove_hw_breakpoint): Adjust to pass the current process id to i386_debug_reg_state. (i386_use_watchpoints): Don't register inferior data. * i386-nat.h (i386_debug_reg_state): Add new 'pid' parameter, and adjust comment. (i386_forget_process): Declare. * linux-fork.c (delete_fork): Call linux_nat_forget_process. * linux-nat.c (linux_nat_new_fork, linux_nat_forget_process_hook): New static globals. (linux_child_follow_fork): Don't call linux_nat_new_thread here. (add_initial_lwp): New, factored out from ... (add_lwp): ... this. Don't check the number of lwps before calling linux_nat_new_thread. (linux_nat_iterate_watchpoint_lwps): Delete. (linux_nat_attach): Use add_initial_lwp instead of add_lwp. (linux_handle_extended_wait): Call the linux_nat_new_fork hook on forks and vforks. (linux_nat_wait_1): Use add_initial_lwp instead of add_lwp for the initial lwp. (linux_nat_kill, linux_nat_mourn_inferior): Call linux_nat_forget_process. (linux_nat_set_new_fork, linux_nat_set_forget_process) (linux_nat_forget_process): New functions. * linux-nat.h (linux_nat_iterate_watchpoint_lwps_ftype): Delete type. (linux_nat_iterate_watchpoint_lwps): Delete declaration. (linux_nat_new_fork_ftype, linux_nat_forget_process_ftype): New types. (linux_nat_set_new_fork, linux_nat_set_forget_process) (linux_nat_forget_process): New declarations. * amd64fbsd-nat.c (super_mourn_inferior): New global. (amd64fbsd_mourn_inferior): New function. (_initialize_amd64fbsd_nat): Override to_mourn_inferior. * windows-nat.c (windows_detach): Call i386_cleanup_dregs.
2013-02-13 15:59:49 +01:00
/* linux_nat_new_fork hook. */
static void
amd64_linux_new_fork (struct lwp_info *parent, pid_t child_pid)
{
pid_t parent_pid;
struct i386_debug_reg_state *parent_state;
struct i386_debug_reg_state *child_state;
/* NULL means no watchpoint has ever been set in the parent. In
that case, there's nothing to do. */
if (parent->arch_private == NULL)
return;
/* Linux kernel before 2.6.33 commit
72f674d203cd230426437cdcf7dd6f681dad8b0d
will inherit hardware debug registers from parent
on fork/vfork/clone. Newer Linux kernels create such tasks with
zeroed debug registers.
GDB core assumes the child inherits the watchpoints/hw
breakpoints of the parent, and will remove them all from the
forked off process. Copy the debug registers mirrors into the
new process so that all breakpoints and watchpoints can be
removed together. The debug registers mirror will become zeroed
in the end before detaching the forked off process, thus making
this compatible with older Linux kernels too. */
parent_pid = ptid_get_pid (parent->ptid);
parent_state = i386_debug_reg_state (parent_pid);
child_state = i386_debug_reg_state (child_pid);
*child_state = *parent_state;
}
/* This function is called by libthread_db as part of its handling of
a request for a thread's local storage address. */
ps_err_e
ps_get_thread_area (const struct ps_prochandle *ph,
lwpid_t lwpid, int idx, void **base)
{
if (gdbarch_bfd_arch_info (target_gdbarch ())->bits_per_word == 32)
{
/* The full structure is found in <asm-i386/ldt.h>. The second
integer is the LDT's base_address and that is used to locate
the thread's local storage. See i386-linux-nat.c more
info. */
unsigned int desc[4];
/* This code assumes that "int" is 32 bits and that
GET_THREAD_AREA returns no more than 4 int values. */
gdb_assert (sizeof (int) == 4);
#ifndef PTRACE_GET_THREAD_AREA
#define PTRACE_GET_THREAD_AREA 25
#endif
if (ptrace (PTRACE_GET_THREAD_AREA,
lwpid, (void *) (long) idx, (unsigned long) &desc) < 0)
return PS_ERR;
/* Extend the value to 64 bits. Here it's assumed that a "long"
and a "void *" are the same. */
(*base) = (void *) (long) desc[1];
return PS_OK;
}
else
{
/* This definition comes from prctl.h, but some kernels may not
have it. */
#ifndef PTRACE_ARCH_PRCTL
#define PTRACE_ARCH_PRCTL 30
#endif
/* FIXME: ezannoni-2003-07-09 see comment above about include
file order. We could be getting bogus values for these two. */
gdb_assert (FS < ELF_NGREG);
gdb_assert (GS < ELF_NGREG);
switch (idx)
{
case FS:
#ifdef HAVE_STRUCT_USER_REGS_STRUCT_FS_BASE
{
/* PTRACE_ARCH_PRCTL is obsolete since 2.6.25, where the
fs_base and gs_base fields of user_regs_struct can be
used directly. */
unsigned long fs;
errno = 0;
fs = ptrace (PTRACE_PEEKUSER, lwpid,
offsetof (struct user_regs_struct, fs_base), 0);
if (errno == 0)
{
*base = (void *) fs;
return PS_OK;
}
}
#endif
if (ptrace (PTRACE_ARCH_PRCTL, lwpid, base, ARCH_GET_FS) == 0)
return PS_OK;
break;
case GS:
#ifdef HAVE_STRUCT_USER_REGS_STRUCT_GS_BASE
{
unsigned long gs;
errno = 0;
gs = ptrace (PTRACE_PEEKUSER, lwpid,
offsetof (struct user_regs_struct, gs_base), 0);
if (errno == 0)
{
*base = (void *) gs;
return PS_OK;
}
}
#endif
if (ptrace (PTRACE_ARCH_PRCTL, lwpid, base, ARCH_GET_GS) == 0)
return PS_OK;
break;
default: /* Should not happen. */
return PS_BADADDR;
}
}
2004-02-28 19:54:31 +01:00
return PS_ERR; /* ptrace failed. */
}
static void (*super_post_startup_inferior) (struct target_ops *self,
ptid_t ptid);
* Makefile.in (ALLDEPFILES): Update. (alpha-linux-nat.o, sparc-linux-nat.o): New rules. (amd64-linux-nat.o, arm-linux-nat.o, hppa-linux-nat.o) (i386-linux-nat.o, ia64-linux-nat.o, linux-nat.o, m32r-linux-nat.o) (m68klinux-nat.o, mips-linux-nat.o, ppc-linux-nat.o, s390-nat.o) (sparc64-linux-nat.o): Update dependencies. * alpha-linux-nat.c, sparc-linux-nat.c: New files. * amd64-linux-nat.c (amd64_linux_fetch_inferior_registers): Renamed from fetch_inferior_registers and made static. (amd64_linux_store_inferior_registers): Renamed from store_inferior_registers and made static. (amd64_linux_child_post_start_inferior): Renamed from child_post_startup_inferior and made static. Call super_post_startup_inferior. (super_post_startup_inferior): New. (_initialize_amd64_linux_nat): Set it. Call linux_target and add_target. * arm-linux-nat.c (arm_linux_fetch_inferior_registers): Renamed from fetch_inferior_registers and made static. (arm_linux_store_inferior_registers): Renamed from store_inferior_registers and made static. (_initialize_arm_linux_nat): Add a prototype. Use linux_target and add_target. * hppa-linux-nat.c (hppa_linux_fetch_inferior_registers): Renamed from fetch_inferior_registers and made static. (hppa_linux_store_inferior_registers): Renamed from store_inferior_registers and made static. (_initialize_hppa_linux_nat): New function. * i386-linux-nat.c (i386_linux_fetch_inferior_registers): Renamed from fetch_inferior_registers and made static. (i386_linux_store_inferior_registers): Renamed from store_inferior_registers and made static. (i386_linux_resume): Renamed from child_resume and made static. (i386_linux_child_post_start_inferior): Renamed from child_post_startup_inferior and made static. Call super_post_startup_inferior. (super_post_startup_inferior): New. (_initialize_i386_linux_nat): New function. * i386-nat.c: Remove LINUX_CHILD_POST_STARTUP_INFERIOR #ifndef. * ia64-linux-nat.c (ia64_linux_xfer_unwind_table): Remove. (super_xfer_partial): New. (ia64_linux_xfer_partial): New function. Use it. (_initialize_ia64_linux_nat): New function. * ia64-tdep.c (getunwind_table): Revert 2005-06-08 change; use target_read_partial and document the problem. * inf-ptrace.c (inf_ptrace_fetch_register): Use CANNOT_FETCH_REGISTER. Fix some comments. (inf_ptrace_store_register): Use CANNOT_STORE_REGISTER. Fix some comments. * linux-nat.c: Include "inf-ptrace.h" and "auxv.h". (linux_ops, super_xfer_partial): New variables. (linux_child_post_startup_inferior): Make static. (child_post_startup_inferior): Delete. (linux_nat_attach, linux_nat_detach, resume_callback) (linux_nat_resume, linux_nat_wait, linux_nat_create_inferior) (linux_nat_mourn_inferior): Use linux_ops instead of deprecated_child_ops. (child_wait): Do not depend on CHILD_WAIT. (linux_nat_xfer_memory): Remove, replace by ... (linux_nat_xfer_partial): ... this. Use linux_ops->to_xfer_partial instead of linux_proc_xfer_memory and child_xfer_memory. (linux_nat_fetch_registers, linux_nat_store_registers) (linux_nat_child_post_startup_inferior): New functions. (init_linux_nat_ops): Use the new functions. (linux_proc_xfer_memory): Remove, replace by ... (linux_proc_xfer_partial): ... this. Make static. (linux_xfer_partial, linux_register_u_offset, linux_target): New functions. (_initialize_linux_nat): Do not modify deprecated_child_ops. * linux-nat.h (linux_proc_xfer_memory): Remove prototype. (struct mem_attrib, struct target_ops): Remove forward declarations. (linux_child_post_startup_inferior): Remove prototype. (linux_target): Add prototype. * linux-thread-db.c (thread_db_xfer_memory): Remove, replace by ... (thread_db_xfer_partial): ... this. (init_thread_db_ops): Set to_xfer_partial instead of deprecated_xfer_memory. * m32r-linux-nat.c (m32r_linux_fetch_inferior_registers): Renamed from fetch_inferior_registers and made static. (m32r_linux_store_inferior_registers): Renamed from store_inferior_registers and made static. (_initialize_m32r_linux_nat): New function. * m68klinux-nat.c (m68k_linux_fetch_inferior_registers): Renamed from fetch_inferior_registers and made static. (m68k_linux_store_inferior_registers): Renamed from store_inferior_registers and made static. (old_fetch_inferior_registers, old_store_inferior_registers): Made static. (_initialize_m68k_linux_nat): Use linux_target and add_target. * mips-linux-nat.c (_initialize_mips_linux_nat): New function. * ppc-linux-nat.c (ppc_linux_fetch_inferior_registers): Renamed from fetch_inferior_registers and made static. (ppc_linux_store_inferior_registers): Renamed from store_inferior_registers and made static. (_initialize_ppc_linux_nat): New function. * s390-nat.c (s390_linux_fetch_inferior_registers): Renamed from fetch_inferior_registers and made static. (s390_linux_store_inferior_registers): Renamed from store_inferior_registers and made static. (_initialize_s390_nat): New function. * sparc64-linux-nat.c (_initialize_sparc64_linux_nat): Use linux_target and add_target. * config/nm-linux.h: Don't include "auxv.h". (struct target_waitstatus, child_wait, CHILD_WAIT) (CHILD_PID_TO_EXEC_FILE, CHILD_INSERT_FORK_CATCHPOINT) (CHILD_INSERT_VFORK_CATCHPOINT, CHILD_INSERT_EXEC_CATCHPOINT) (CHILD_POST_STARTUP_INFERIOR, CHILD_POST_ATTACH, CHILD_FOLLOW_FORK) (DEPRECATED_KILL_INFERIOR, NATIVE_XFER_AUXV): Delete. * config/alpha/alpha-linux.mh (NATDEPFILES): Replace infptrace.o and inftarg.o with inf-ptrace.o and alpha-linux-nat.o. * config/sparc/linux.mh (NATDEPFILES): Replace infptrace.o and inftarg.o with sparc-linux-nat.o. * config/sparc/linux64.mh (NATDEPFILES): Remove infptrace.o and inftarg.o. * config/arm/linux.mh (NATDEPFILES): Replace infptrace.o and inftarg.o with inf-ptrace.o. * 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/s390/s390.mh (NATDEPFILES): Likewise. * config/i386/nm-linux.h (DEPRECATED_CHILD_RESUME): Don't define. (LINUX_CHILD_POST_STARTUP_INFERIOR): Don't define. * config/i386/nm-linux64.h (LINUX_CHILD_POST_STARTUP_INFERIOR): Don't define. * config/ia64/nm-linux.h: Don't include "target.h". (NATIVE_XFER_UNWIND_TABLE, ia64_linux_xfer_unwind_table): Remove. * config/djgpp/fnchange.lst: Add alpha-linux-tdep.c, alpha-linux-nat.c, sparc-linux-tdep.c, and sparc-linux-nat.c.
2005-09-10 20:11:14 +02:00
static void
amd64_linux_child_post_startup_inferior (struct target_ops *self, ptid_t ptid)
{
i386_cleanup_dregs ();
super_post_startup_inferior (self, ptid);
}
/* When GDB is built as a 64-bit application on linux, the
PTRACE_GETSIGINFO data is always presented in 64-bit layout. Since
debugging a 32-bit inferior with a 64-bit GDB should look the same
as debugging it with a 32-bit GDB, we do the 32-bit <-> 64-bit
conversion in-place ourselves. */
/* These types below (compat_*) define a siginfo type that is layout
compatible with the siginfo type exported by the 32-bit userspace
support. */
typedef int compat_int_t;
typedef unsigned int compat_uptr_t;
typedef int compat_time_t;
typedef int compat_timer_t;
typedef int compat_clock_t;
struct compat_timeval
{
compat_time_t tv_sec;
int tv_usec;
};
typedef union compat_sigval
{
compat_int_t sival_int;
compat_uptr_t sival_ptr;
} compat_sigval_t;
typedef struct compat_siginfo
{
int si_signo;
int si_errno;
int si_code;
union
{
int _pad[((128 / sizeof (int)) - 3)];
/* kill() */
struct
{
unsigned int _pid;
unsigned int _uid;
} _kill;
/* POSIX.1b timers */
struct
{
compat_timer_t _tid;
int _overrun;
compat_sigval_t _sigval;
} _timer;
/* POSIX.1b signals */
struct
{
unsigned int _pid;
unsigned int _uid;
compat_sigval_t _sigval;
} _rt;
/* SIGCHLD */
struct
{
unsigned int _pid;
unsigned int _uid;
int _status;
compat_clock_t _utime;
compat_clock_t _stime;
} _sigchld;
/* SIGILL, SIGFPE, SIGSEGV, SIGBUS */
struct
{
unsigned int _addr;
} _sigfault;
/* SIGPOLL */
struct
{
int _band;
int _fd;
} _sigpoll;
} _sifields;
} compat_siginfo_t;
/* For x32, clock_t in _sigchld is 64bit aligned at 4 bytes. */
typedef struct compat_x32_clock
{
int lower;
int upper;
} compat_x32_clock_t;
typedef struct compat_x32_siginfo
{
int si_signo;
int si_errno;
int si_code;
union
{
int _pad[((128 / sizeof (int)) - 3)];
/* kill() */
struct
{
unsigned int _pid;
unsigned int _uid;
} _kill;
/* POSIX.1b timers */
struct
{
compat_timer_t _tid;
int _overrun;
compat_sigval_t _sigval;
} _timer;
/* POSIX.1b signals */
struct
{
unsigned int _pid;
unsigned int _uid;
compat_sigval_t _sigval;
} _rt;
/* SIGCHLD */
struct
{
unsigned int _pid;
unsigned int _uid;
int _status;
compat_x32_clock_t _utime;
compat_x32_clock_t _stime;
} _sigchld;
/* SIGILL, SIGFPE, SIGSEGV, SIGBUS */
struct
{
unsigned int _addr;
} _sigfault;
/* SIGPOLL */
struct
{
int _band;
int _fd;
} _sigpoll;
} _sifields;
} compat_x32_siginfo_t;
#define cpt_si_pid _sifields._kill._pid
#define cpt_si_uid _sifields._kill._uid
#define cpt_si_timerid _sifields._timer._tid
#define cpt_si_overrun _sifields._timer._overrun
#define cpt_si_status _sifields._sigchld._status
#define cpt_si_utime _sifields._sigchld._utime
#define cpt_si_stime _sifields._sigchld._stime
#define cpt_si_ptr _sifields._rt._sigval.sival_ptr
#define cpt_si_addr _sifields._sigfault._addr
#define cpt_si_band _sifields._sigpoll._band
#define cpt_si_fd _sifields._sigpoll._fd
/* glibc at least up to 2.3.2 doesn't have si_timerid, si_overrun.
In their place is si_timer1,si_timer2. */
#ifndef si_timerid
#define si_timerid si_timer1
#endif
#ifndef si_overrun
#define si_overrun si_timer2
#endif
static void
compat_siginfo_from_siginfo (compat_siginfo_t *to, siginfo_t *from)
{
memset (to, 0, sizeof (*to));
to->si_signo = from->si_signo;
to->si_errno = from->si_errno;
to->si_code = from->si_code;
if (to->si_code == SI_TIMER)
{
to->cpt_si_timerid = from->si_timerid;
to->cpt_si_overrun = from->si_overrun;
to->cpt_si_ptr = (intptr_t) from->si_ptr;
}
else if (to->si_code == SI_USER)
{
to->cpt_si_pid = from->si_pid;
to->cpt_si_uid = from->si_uid;
}
else if (to->si_code < 0)
{
to->cpt_si_pid = from->si_pid;
to->cpt_si_uid = from->si_uid;
to->cpt_si_ptr = (intptr_t) from->si_ptr;
}
else
{
switch (to->si_signo)
{
case SIGCHLD:
to->cpt_si_pid = from->si_pid;
to->cpt_si_uid = from->si_uid;
to->cpt_si_status = from->si_status;
to->cpt_si_utime = from->si_utime;
to->cpt_si_stime = from->si_stime;
break;
case SIGILL:
case SIGFPE:
case SIGSEGV:
case SIGBUS:
to->cpt_si_addr = (intptr_t) from->si_addr;
break;
case SIGPOLL:
to->cpt_si_band = from->si_band;
to->cpt_si_fd = from->si_fd;
break;
default:
to->cpt_si_pid = from->si_pid;
to->cpt_si_uid = from->si_uid;
to->cpt_si_ptr = (intptr_t) from->si_ptr;
break;
}
}
}
static void
siginfo_from_compat_siginfo (siginfo_t *to, compat_siginfo_t *from)
{
memset (to, 0, sizeof (*to));
to->si_signo = from->si_signo;
to->si_errno = from->si_errno;
to->si_code = from->si_code;
if (to->si_code == SI_TIMER)
{
to->si_timerid = from->cpt_si_timerid;
to->si_overrun = from->cpt_si_overrun;
to->si_ptr = (void *) (intptr_t) from->cpt_si_ptr;
}
else if (to->si_code == SI_USER)
{
to->si_pid = from->cpt_si_pid;
to->si_uid = from->cpt_si_uid;
}
if (to->si_code < 0)
{
to->si_pid = from->cpt_si_pid;
to->si_uid = from->cpt_si_uid;
to->si_ptr = (void *) (intptr_t) from->cpt_si_ptr;
}
else
{
switch (to->si_signo)
{
case SIGCHLD:
to->si_pid = from->cpt_si_pid;
to->si_uid = from->cpt_si_uid;
to->si_status = from->cpt_si_status;
to->si_utime = from->cpt_si_utime;
to->si_stime = from->cpt_si_stime;
break;
case SIGILL:
case SIGFPE:
case SIGSEGV:
case SIGBUS:
to->si_addr = (void *) (intptr_t) from->cpt_si_addr;
break;
case SIGPOLL:
to->si_band = from->cpt_si_band;
to->si_fd = from->cpt_si_fd;
break;
default:
to->si_pid = from->cpt_si_pid;
to->si_uid = from->cpt_si_uid;
to->si_ptr = (void* ) (intptr_t) from->cpt_si_ptr;
break;
}
}
}
static void
compat_x32_siginfo_from_siginfo (compat_x32_siginfo_t *to,
siginfo_t *from)
{
memset (to, 0, sizeof (*to));
to->si_signo = from->si_signo;
to->si_errno = from->si_errno;
to->si_code = from->si_code;
if (to->si_code == SI_TIMER)
{
to->cpt_si_timerid = from->si_timerid;
to->cpt_si_overrun = from->si_overrun;
to->cpt_si_ptr = (intptr_t) from->si_ptr;
}
else if (to->si_code == SI_USER)
{
to->cpt_si_pid = from->si_pid;
to->cpt_si_uid = from->si_uid;
}
else if (to->si_code < 0)
{
to->cpt_si_pid = from->si_pid;
to->cpt_si_uid = from->si_uid;
to->cpt_si_ptr = (intptr_t) from->si_ptr;
}
else
{
switch (to->si_signo)
{
case SIGCHLD:
to->cpt_si_pid = from->si_pid;
to->cpt_si_uid = from->si_uid;
to->cpt_si_status = from->si_status;
memcpy (&to->cpt_si_utime, &from->si_utime,
sizeof (to->cpt_si_utime));
memcpy (&to->cpt_si_stime, &from->si_stime,
sizeof (to->cpt_si_stime));
break;
case SIGILL:
case SIGFPE:
case SIGSEGV:
case SIGBUS:
to->cpt_si_addr = (intptr_t) from->si_addr;
break;
case SIGPOLL:
to->cpt_si_band = from->si_band;
to->cpt_si_fd = from->si_fd;
break;
default:
to->cpt_si_pid = from->si_pid;
to->cpt_si_uid = from->si_uid;
to->cpt_si_ptr = (intptr_t) from->si_ptr;
break;
}
}
}
static void
siginfo_from_compat_x32_siginfo (siginfo_t *to,
compat_x32_siginfo_t *from)
{
memset (to, 0, sizeof (*to));
to->si_signo = from->si_signo;
to->si_errno = from->si_errno;
to->si_code = from->si_code;
if (to->si_code == SI_TIMER)
{
to->si_timerid = from->cpt_si_timerid;
to->si_overrun = from->cpt_si_overrun;
to->si_ptr = (void *) (intptr_t) from->cpt_si_ptr;
}
else if (to->si_code == SI_USER)
{
to->si_pid = from->cpt_si_pid;
to->si_uid = from->cpt_si_uid;
}
if (to->si_code < 0)
{
to->si_pid = from->cpt_si_pid;
to->si_uid = from->cpt_si_uid;
to->si_ptr = (void *) (intptr_t) from->cpt_si_ptr;
}
else
{
switch (to->si_signo)
{
case SIGCHLD:
to->si_pid = from->cpt_si_pid;
to->si_uid = from->cpt_si_uid;
to->si_status = from->cpt_si_status;
memcpy (&to->si_utime, &from->cpt_si_utime,
sizeof (to->si_utime));
memcpy (&to->si_stime, &from->cpt_si_stime,
sizeof (to->si_stime));
break;
case SIGILL:
case SIGFPE:
case SIGSEGV:
case SIGBUS:
to->si_addr = (void *) (intptr_t) from->cpt_si_addr;
break;
case SIGPOLL:
to->si_band = from->cpt_si_band;
to->si_fd = from->cpt_si_fd;
break;
default:
to->si_pid = from->cpt_si_pid;
to->si_uid = from->cpt_si_uid;
to->si_ptr = (void* ) (intptr_t) from->cpt_si_ptr;
break;
}
}
}
/* Convert a native/host siginfo object, into/from the siginfo in the
layout of the inferiors' architecture. 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. */
static int
amd64_linux_siginfo_fixup (siginfo_t *native, gdb_byte *inf, int direction)
{
struct gdbarch *gdbarch = get_frame_arch (get_current_frame ());
/* Is the inferior 32-bit? If so, then do fixup the siginfo
object. */
if (gdbarch_bfd_arch_info (gdbarch)->bits_per_word == 32)
{
gdb_assert (sizeof (siginfo_t) == sizeof (compat_siginfo_t));
if (direction == 0)
compat_siginfo_from_siginfo ((struct compat_siginfo *) inf, native);
else
siginfo_from_compat_siginfo (native, (struct compat_siginfo *) inf);
return 1;
}
/* No fixup for native x32 GDB. */
else if (gdbarch_addr_bit (gdbarch) == 32 && sizeof (void *) == 8)
{
gdb_assert (sizeof (siginfo_t) == sizeof (compat_x32_siginfo_t));
if (direction == 0)
compat_x32_siginfo_from_siginfo ((struct compat_x32_siginfo *) inf,
native);
else
siginfo_from_compat_x32_siginfo (native,
(struct compat_x32_siginfo *) inf);
return 1;
}
else
return 0;
}
Enable XML target descriptions for x86. gdb/ 2010-03-01 H.J. Lu <hongjiu.lu@intel.com> * amd64-linux-nat.c (AMD64_LINUX_USER64_CS): New. (amd64_linux_read_description): Likewise. (_initialize_amd64_linux_nat): Set to_read_description to amd64_linux_read_description. * amd64-linux-tdep.c: Include "features/i386/amd64-linux.c". (amd64_linux_register_name): Removed. (amd64_linux_register_type): Likewise. (amd64_linux_core_read_description): New. (amd64_linux_init_abi): Set target description to tdesc_amd64_linux if needed. Support orig_rax in target description. Don't call set_gdbarch_register_name nor set_gdbarch_register_type. Call set_gdbarch_core_read_description. (_initialize_amd64_linux_tdep): Call initialize_tdesc_amd64_linux. * amd64-linux-tdep.h (tdesc_amd64_linux): New. * amd64-tdep.c: Include "features/i386/amd64.c". (amd64_register_names): Removed. (amd64_register_name): Likewise. (amd64_register_type): Likewise. (amd64_init_abi): Set num_core_regs and register_names. Set target description to tdesc_amd64 if needed. Don't call set_gdbarch_register_name nor set_gdbarch_register_type. (_initialize_amd64_tdep): New. * i386-linux-nat.c (i386_linux_read_description): New. (_initialize_i386_linux_nat): Set to_read_description to i386_linux_read_description. * i386-linux-tdep.c: Include "features/i386/i386-linux.c". (i386_linux_register_name): Removed. (i386_linux_core_read_description): New. (i386_linux_read_description): Likewise. (i386_linux_init_abi): Don't call set_gdbarch_register_name. Set target description to tdesc_i386_linux if needed. Support orig_eax. Set register_reggroup_p. Call set_gdbarch_core_read_description. (_initialize_i386_linux_tdep): Call initialize_tdesc_i386_linux. * i386-linux-tdep.h (tdesc_i386_linux): New. * i386-nto-tdep.c (i386nto_regset_id): Replace I386_NUM_FREGS with I387_NUM_REGS. * i386-tdep.c: Include "features/i386/i386.c". (i386_register_names): Make it const. (i386_mmx_names): Likewise. (i386_num_register_names): Removed. (i386_register_name): Likewise. (i386_eflags_type): Likewise. (i386_mxcsr_type): Likewise. (i386_sse_type): Likewise. (i386_register_type): Likewise. (i387_ext_type): Call tdesc_find_type instead of arch_float_type. (i386_pseudo_register_name): New. (i386_pseudo_register_type): Likewise. (i386_mmx_type): Make it static. (i386_gdbarch_init): Check arch. Replace I386_NUM_FREGS with I387_NUM_REGS. Set num_core_regs and register_names. Don't call set_gdbarch_register_name nor set_gdbarch_register_type. Set register_reggroup_p. Set target description to tdesc_i386 if needed. Call set_tdesc_pseudo_register_type, set_tdesc_pseudo_register_name and tdesc_use_registers. (_initialize_i386_tdep): Call initialize_tdesc_i386. initialize_tdesc_x86_64. * i386-tdep.h (gdbarch_tdep): Remove i386_eflags_type, i386_mxcsr_type and i386_sse_type. Add num_core_regs, register_names, tdesc and register_reggroup_p. (I386_NUM_FREGS): Removed. (i386_eflags_type): Likewise. (i386_mxcsr_type): Likewise. (i386_mmx_type): Likewise. (i386_sse_type): Likewise. (i386_register_name): Likewise. (i386_regnum): Add I386_MXCSR_REGNUM. (I386_SSE_NUM_REGS): Defined with I386_MXCSR_REGNUM. * i387-tdep.h (I387_NUM_REGS): New. * regformats/i386/i386-linux.dat: Generated. * regformats/i386/i386.dat: Likewise. * regformats/i386/amd64-linux.dat: Likewise. * regformats/i386/amd64.dat: Likewise. * regformats/reg-i386-linux.dat: Removed. * regformats/reg-i386.dat: Likewise. * regformats/reg-x86-64-linux.dat: Likewise. * regformats/reg-x86-64.dat: Likewise. gdb/gdbserver/ 2010-03-01 H.J. Lu <hongjiu.lu@intel.com> * Makefile.in (clean): Replace reg-i386.c, reg-x86-64.c, reg-i386-linux.c and reg-x86-64-linux.c with i386.c, amd64.c, i386-linux.c and amd64-linux.c. (reg-i386.o): Removed. (reg-i386.c): Likewise. (reg-i386-linux.o): Likewise. (reg-i386-linux.c): Likewise. (reg-x86-64.o): Likewise. (reg-x86-64.c): Likewise. (reg-x86-64-linux.o): Likewise. (reg-x86-64-linux.c): Likewise. (i386.o): New. (i386.c): Likewise. (i386-linux.o): Likewise. (i386-linux.c): Likewise. (amd64.o): Likewise. (amd64.c): Likewise. (amd64-linux.o): Likewise. (amd64-linux.c): Likewise. * configure.srv (srv_i386_regobj): New. (srv_i386_linux_regobj): Likewise. (srv_amd64_regobj): Likewise. (srv_amd64_linux_regobj): Likewise. (srv_i386_32bit_xmlfiles): Likewise. (srv_i386_64bit_xmlfiles): Likewise. (srv_i386_xmlfiles): Likewise. (srv_amd64_xmlfiles): Likewise. (srv_i386_linux_xmlfiles): Likewise. (srv_amd64_linux_xmlfiles): Likewise. (i[34567]86-*-cygwin*): Set srv_regobj to $srv_i386_regobj. Set srv_xmlfiles to $srv_i386_xmlfiles. (i[34567]86-*-mingw32ce*): Likewise. (i[34567]86-*-mingw*): Likewise. (i[34567]86-*-nto*): Likewise. (i[34567]86-*-linux*): Set srv_regobj to $srv_i386_linux_regobj and $srv_amd64_linux_regobj. Set srv_xmlfiles to $srv_i386_linux_xmlfiles and $srv_amd64_linux_xmlfiles. (x86_64-*-linux*): Likewise. * linux-x86-low.c (init_registers_x86_64_linux): Removed. (init_registers_amd64_linux): New. (x86_arch_setup): Replace init_registers_x86_64_linux with init_registers_amd64_linux. gdb/testsuite/ 2010-03-01 H.J. Lu <hongjiu.lu@intel.com> * gdb.xml/tdesc-regs.exp (architecture): New. Set it for x86. (load_description): Set architecture if defined.
2010-03-01 16:33:32 +01:00
/* Get Linux/x86 target description from running target.
Value of CS segment register:
1. 64bit process: 0x33.
2. 32bit process: 0x23.
Value of DS segment register:
1. LP64 process: 0x0.
2. X32 process: 0x2b.
Enable XML target descriptions for x86. gdb/ 2010-03-01 H.J. Lu <hongjiu.lu@intel.com> * amd64-linux-nat.c (AMD64_LINUX_USER64_CS): New. (amd64_linux_read_description): Likewise. (_initialize_amd64_linux_nat): Set to_read_description to amd64_linux_read_description. * amd64-linux-tdep.c: Include "features/i386/amd64-linux.c". (amd64_linux_register_name): Removed. (amd64_linux_register_type): Likewise. (amd64_linux_core_read_description): New. (amd64_linux_init_abi): Set target description to tdesc_amd64_linux if needed. Support orig_rax in target description. Don't call set_gdbarch_register_name nor set_gdbarch_register_type. Call set_gdbarch_core_read_description. (_initialize_amd64_linux_tdep): Call initialize_tdesc_amd64_linux. * amd64-linux-tdep.h (tdesc_amd64_linux): New. * amd64-tdep.c: Include "features/i386/amd64.c". (amd64_register_names): Removed. (amd64_register_name): Likewise. (amd64_register_type): Likewise. (amd64_init_abi): Set num_core_regs and register_names. Set target description to tdesc_amd64 if needed. Don't call set_gdbarch_register_name nor set_gdbarch_register_type. (_initialize_amd64_tdep): New. * i386-linux-nat.c (i386_linux_read_description): New. (_initialize_i386_linux_nat): Set to_read_description to i386_linux_read_description. * i386-linux-tdep.c: Include "features/i386/i386-linux.c". (i386_linux_register_name): Removed. (i386_linux_core_read_description): New. (i386_linux_read_description): Likewise. (i386_linux_init_abi): Don't call set_gdbarch_register_name. Set target description to tdesc_i386_linux if needed. Support orig_eax. Set register_reggroup_p. Call set_gdbarch_core_read_description. (_initialize_i386_linux_tdep): Call initialize_tdesc_i386_linux. * i386-linux-tdep.h (tdesc_i386_linux): New. * i386-nto-tdep.c (i386nto_regset_id): Replace I386_NUM_FREGS with I387_NUM_REGS. * i386-tdep.c: Include "features/i386/i386.c". (i386_register_names): Make it const. (i386_mmx_names): Likewise. (i386_num_register_names): Removed. (i386_register_name): Likewise. (i386_eflags_type): Likewise. (i386_mxcsr_type): Likewise. (i386_sse_type): Likewise. (i386_register_type): Likewise. (i387_ext_type): Call tdesc_find_type instead of arch_float_type. (i386_pseudo_register_name): New. (i386_pseudo_register_type): Likewise. (i386_mmx_type): Make it static. (i386_gdbarch_init): Check arch. Replace I386_NUM_FREGS with I387_NUM_REGS. Set num_core_regs and register_names. Don't call set_gdbarch_register_name nor set_gdbarch_register_type. Set register_reggroup_p. Set target description to tdesc_i386 if needed. Call set_tdesc_pseudo_register_type, set_tdesc_pseudo_register_name and tdesc_use_registers. (_initialize_i386_tdep): Call initialize_tdesc_i386. initialize_tdesc_x86_64. * i386-tdep.h (gdbarch_tdep): Remove i386_eflags_type, i386_mxcsr_type and i386_sse_type. Add num_core_regs, register_names, tdesc and register_reggroup_p. (I386_NUM_FREGS): Removed. (i386_eflags_type): Likewise. (i386_mxcsr_type): Likewise. (i386_mmx_type): Likewise. (i386_sse_type): Likewise. (i386_register_name): Likewise. (i386_regnum): Add I386_MXCSR_REGNUM. (I386_SSE_NUM_REGS): Defined with I386_MXCSR_REGNUM. * i387-tdep.h (I387_NUM_REGS): New. * regformats/i386/i386-linux.dat: Generated. * regformats/i386/i386.dat: Likewise. * regformats/i386/amd64-linux.dat: Likewise. * regformats/i386/amd64.dat: Likewise. * regformats/reg-i386-linux.dat: Removed. * regformats/reg-i386.dat: Likewise. * regformats/reg-x86-64-linux.dat: Likewise. * regformats/reg-x86-64.dat: Likewise. gdb/gdbserver/ 2010-03-01 H.J. Lu <hongjiu.lu@intel.com> * Makefile.in (clean): Replace reg-i386.c, reg-x86-64.c, reg-i386-linux.c and reg-x86-64-linux.c with i386.c, amd64.c, i386-linux.c and amd64-linux.c. (reg-i386.o): Removed. (reg-i386.c): Likewise. (reg-i386-linux.o): Likewise. (reg-i386-linux.c): Likewise. (reg-x86-64.o): Likewise. (reg-x86-64.c): Likewise. (reg-x86-64-linux.o): Likewise. (reg-x86-64-linux.c): Likewise. (i386.o): New. (i386.c): Likewise. (i386-linux.o): Likewise. (i386-linux.c): Likewise. (amd64.o): Likewise. (amd64.c): Likewise. (amd64-linux.o): Likewise. (amd64-linux.c): Likewise. * configure.srv (srv_i386_regobj): New. (srv_i386_linux_regobj): Likewise. (srv_amd64_regobj): Likewise. (srv_amd64_linux_regobj): Likewise. (srv_i386_32bit_xmlfiles): Likewise. (srv_i386_64bit_xmlfiles): Likewise. (srv_i386_xmlfiles): Likewise. (srv_amd64_xmlfiles): Likewise. (srv_i386_linux_xmlfiles): Likewise. (srv_amd64_linux_xmlfiles): Likewise. (i[34567]86-*-cygwin*): Set srv_regobj to $srv_i386_regobj. Set srv_xmlfiles to $srv_i386_xmlfiles. (i[34567]86-*-mingw32ce*): Likewise. (i[34567]86-*-mingw*): Likewise. (i[34567]86-*-nto*): Likewise. (i[34567]86-*-linux*): Set srv_regobj to $srv_i386_linux_regobj and $srv_amd64_linux_regobj. Set srv_xmlfiles to $srv_i386_linux_xmlfiles and $srv_amd64_linux_xmlfiles. (x86_64-*-linux*): Likewise. * linux-x86-low.c (init_registers_x86_64_linux): Removed. (init_registers_amd64_linux): New. (x86_arch_setup): Replace init_registers_x86_64_linux with init_registers_amd64_linux. gdb/testsuite/ 2010-03-01 H.J. Lu <hongjiu.lu@intel.com> * gdb.xml/tdesc-regs.exp (architecture): New. Set it for x86. (load_description): Set architecture if defined.
2010-03-01 16:33:32 +01:00
*/
#define AMD64_LINUX_USER64_CS 0x33
#define AMD64_LINUX_X32_DS 0x2b
Enable XML target descriptions for x86. gdb/ 2010-03-01 H.J. Lu <hongjiu.lu@intel.com> * amd64-linux-nat.c (AMD64_LINUX_USER64_CS): New. (amd64_linux_read_description): Likewise. (_initialize_amd64_linux_nat): Set to_read_description to amd64_linux_read_description. * amd64-linux-tdep.c: Include "features/i386/amd64-linux.c". (amd64_linux_register_name): Removed. (amd64_linux_register_type): Likewise. (amd64_linux_core_read_description): New. (amd64_linux_init_abi): Set target description to tdesc_amd64_linux if needed. Support orig_rax in target description. Don't call set_gdbarch_register_name nor set_gdbarch_register_type. Call set_gdbarch_core_read_description. (_initialize_amd64_linux_tdep): Call initialize_tdesc_amd64_linux. * amd64-linux-tdep.h (tdesc_amd64_linux): New. * amd64-tdep.c: Include "features/i386/amd64.c". (amd64_register_names): Removed. (amd64_register_name): Likewise. (amd64_register_type): Likewise. (amd64_init_abi): Set num_core_regs and register_names. Set target description to tdesc_amd64 if needed. Don't call set_gdbarch_register_name nor set_gdbarch_register_type. (_initialize_amd64_tdep): New. * i386-linux-nat.c (i386_linux_read_description): New. (_initialize_i386_linux_nat): Set to_read_description to i386_linux_read_description. * i386-linux-tdep.c: Include "features/i386/i386-linux.c". (i386_linux_register_name): Removed. (i386_linux_core_read_description): New. (i386_linux_read_description): Likewise. (i386_linux_init_abi): Don't call set_gdbarch_register_name. Set target description to tdesc_i386_linux if needed. Support orig_eax. Set register_reggroup_p. Call set_gdbarch_core_read_description. (_initialize_i386_linux_tdep): Call initialize_tdesc_i386_linux. * i386-linux-tdep.h (tdesc_i386_linux): New. * i386-nto-tdep.c (i386nto_regset_id): Replace I386_NUM_FREGS with I387_NUM_REGS. * i386-tdep.c: Include "features/i386/i386.c". (i386_register_names): Make it const. (i386_mmx_names): Likewise. (i386_num_register_names): Removed. (i386_register_name): Likewise. (i386_eflags_type): Likewise. (i386_mxcsr_type): Likewise. (i386_sse_type): Likewise. (i386_register_type): Likewise. (i387_ext_type): Call tdesc_find_type instead of arch_float_type. (i386_pseudo_register_name): New. (i386_pseudo_register_type): Likewise. (i386_mmx_type): Make it static. (i386_gdbarch_init): Check arch. Replace I386_NUM_FREGS with I387_NUM_REGS. Set num_core_regs and register_names. Don't call set_gdbarch_register_name nor set_gdbarch_register_type. Set register_reggroup_p. Set target description to tdesc_i386 if needed. Call set_tdesc_pseudo_register_type, set_tdesc_pseudo_register_name and tdesc_use_registers. (_initialize_i386_tdep): Call initialize_tdesc_i386. initialize_tdesc_x86_64. * i386-tdep.h (gdbarch_tdep): Remove i386_eflags_type, i386_mxcsr_type and i386_sse_type. Add num_core_regs, register_names, tdesc and register_reggroup_p. (I386_NUM_FREGS): Removed. (i386_eflags_type): Likewise. (i386_mxcsr_type): Likewise. (i386_mmx_type): Likewise. (i386_sse_type): Likewise. (i386_register_name): Likewise. (i386_regnum): Add I386_MXCSR_REGNUM. (I386_SSE_NUM_REGS): Defined with I386_MXCSR_REGNUM. * i387-tdep.h (I387_NUM_REGS): New. * regformats/i386/i386-linux.dat: Generated. * regformats/i386/i386.dat: Likewise. * regformats/i386/amd64-linux.dat: Likewise. * regformats/i386/amd64.dat: Likewise. * regformats/reg-i386-linux.dat: Removed. * regformats/reg-i386.dat: Likewise. * regformats/reg-x86-64-linux.dat: Likewise. * regformats/reg-x86-64.dat: Likewise. gdb/gdbserver/ 2010-03-01 H.J. Lu <hongjiu.lu@intel.com> * Makefile.in (clean): Replace reg-i386.c, reg-x86-64.c, reg-i386-linux.c and reg-x86-64-linux.c with i386.c, amd64.c, i386-linux.c and amd64-linux.c. (reg-i386.o): Removed. (reg-i386.c): Likewise. (reg-i386-linux.o): Likewise. (reg-i386-linux.c): Likewise. (reg-x86-64.o): Likewise. (reg-x86-64.c): Likewise. (reg-x86-64-linux.o): Likewise. (reg-x86-64-linux.c): Likewise. (i386.o): New. (i386.c): Likewise. (i386-linux.o): Likewise. (i386-linux.c): Likewise. (amd64.o): Likewise. (amd64.c): Likewise. (amd64-linux.o): Likewise. (amd64-linux.c): Likewise. * configure.srv (srv_i386_regobj): New. (srv_i386_linux_regobj): Likewise. (srv_amd64_regobj): Likewise. (srv_amd64_linux_regobj): Likewise. (srv_i386_32bit_xmlfiles): Likewise. (srv_i386_64bit_xmlfiles): Likewise. (srv_i386_xmlfiles): Likewise. (srv_amd64_xmlfiles): Likewise. (srv_i386_linux_xmlfiles): Likewise. (srv_amd64_linux_xmlfiles): Likewise. (i[34567]86-*-cygwin*): Set srv_regobj to $srv_i386_regobj. Set srv_xmlfiles to $srv_i386_xmlfiles. (i[34567]86-*-mingw32ce*): Likewise. (i[34567]86-*-mingw*): Likewise. (i[34567]86-*-nto*): Likewise. (i[34567]86-*-linux*): Set srv_regobj to $srv_i386_linux_regobj and $srv_amd64_linux_regobj. Set srv_xmlfiles to $srv_i386_linux_xmlfiles and $srv_amd64_linux_xmlfiles. (x86_64-*-linux*): Likewise. * linux-x86-low.c (init_registers_x86_64_linux): Removed. (init_registers_amd64_linux): New. (x86_arch_setup): Replace init_registers_x86_64_linux with init_registers_amd64_linux. gdb/testsuite/ 2010-03-01 H.J. Lu <hongjiu.lu@intel.com> * gdb.xml/tdesc-regs.exp (architecture): New. Set it for x86. (load_description): Set architecture if defined.
2010-03-01 16:33:32 +01:00
static const struct target_desc *
amd64_linux_read_description (struct target_ops *ops)
{
unsigned long cs;
unsigned long ds;
Enable XML target descriptions for x86. gdb/ 2010-03-01 H.J. Lu <hongjiu.lu@intel.com> * amd64-linux-nat.c (AMD64_LINUX_USER64_CS): New. (amd64_linux_read_description): Likewise. (_initialize_amd64_linux_nat): Set to_read_description to amd64_linux_read_description. * amd64-linux-tdep.c: Include "features/i386/amd64-linux.c". (amd64_linux_register_name): Removed. (amd64_linux_register_type): Likewise. (amd64_linux_core_read_description): New. (amd64_linux_init_abi): Set target description to tdesc_amd64_linux if needed. Support orig_rax in target description. Don't call set_gdbarch_register_name nor set_gdbarch_register_type. Call set_gdbarch_core_read_description. (_initialize_amd64_linux_tdep): Call initialize_tdesc_amd64_linux. * amd64-linux-tdep.h (tdesc_amd64_linux): New. * amd64-tdep.c: Include "features/i386/amd64.c". (amd64_register_names): Removed. (amd64_register_name): Likewise. (amd64_register_type): Likewise. (amd64_init_abi): Set num_core_regs and register_names. Set target description to tdesc_amd64 if needed. Don't call set_gdbarch_register_name nor set_gdbarch_register_type. (_initialize_amd64_tdep): New. * i386-linux-nat.c (i386_linux_read_description): New. (_initialize_i386_linux_nat): Set to_read_description to i386_linux_read_description. * i386-linux-tdep.c: Include "features/i386/i386-linux.c". (i386_linux_register_name): Removed. (i386_linux_core_read_description): New. (i386_linux_read_description): Likewise. (i386_linux_init_abi): Don't call set_gdbarch_register_name. Set target description to tdesc_i386_linux if needed. Support orig_eax. Set register_reggroup_p. Call set_gdbarch_core_read_description. (_initialize_i386_linux_tdep): Call initialize_tdesc_i386_linux. * i386-linux-tdep.h (tdesc_i386_linux): New. * i386-nto-tdep.c (i386nto_regset_id): Replace I386_NUM_FREGS with I387_NUM_REGS. * i386-tdep.c: Include "features/i386/i386.c". (i386_register_names): Make it const. (i386_mmx_names): Likewise. (i386_num_register_names): Removed. (i386_register_name): Likewise. (i386_eflags_type): Likewise. (i386_mxcsr_type): Likewise. (i386_sse_type): Likewise. (i386_register_type): Likewise. (i387_ext_type): Call tdesc_find_type instead of arch_float_type. (i386_pseudo_register_name): New. (i386_pseudo_register_type): Likewise. (i386_mmx_type): Make it static. (i386_gdbarch_init): Check arch. Replace I386_NUM_FREGS with I387_NUM_REGS. Set num_core_regs and register_names. Don't call set_gdbarch_register_name nor set_gdbarch_register_type. Set register_reggroup_p. Set target description to tdesc_i386 if needed. Call set_tdesc_pseudo_register_type, set_tdesc_pseudo_register_name and tdesc_use_registers. (_initialize_i386_tdep): Call initialize_tdesc_i386. initialize_tdesc_x86_64. * i386-tdep.h (gdbarch_tdep): Remove i386_eflags_type, i386_mxcsr_type and i386_sse_type. Add num_core_regs, register_names, tdesc and register_reggroup_p. (I386_NUM_FREGS): Removed. (i386_eflags_type): Likewise. (i386_mxcsr_type): Likewise. (i386_mmx_type): Likewise. (i386_sse_type): Likewise. (i386_register_name): Likewise. (i386_regnum): Add I386_MXCSR_REGNUM. (I386_SSE_NUM_REGS): Defined with I386_MXCSR_REGNUM. * i387-tdep.h (I387_NUM_REGS): New. * regformats/i386/i386-linux.dat: Generated. * regformats/i386/i386.dat: Likewise. * regformats/i386/amd64-linux.dat: Likewise. * regformats/i386/amd64.dat: Likewise. * regformats/reg-i386-linux.dat: Removed. * regformats/reg-i386.dat: Likewise. * regformats/reg-x86-64-linux.dat: Likewise. * regformats/reg-x86-64.dat: Likewise. gdb/gdbserver/ 2010-03-01 H.J. Lu <hongjiu.lu@intel.com> * Makefile.in (clean): Replace reg-i386.c, reg-x86-64.c, reg-i386-linux.c and reg-x86-64-linux.c with i386.c, amd64.c, i386-linux.c and amd64-linux.c. (reg-i386.o): Removed. (reg-i386.c): Likewise. (reg-i386-linux.o): Likewise. (reg-i386-linux.c): Likewise. (reg-x86-64.o): Likewise. (reg-x86-64.c): Likewise. (reg-x86-64-linux.o): Likewise. (reg-x86-64-linux.c): Likewise. (i386.o): New. (i386.c): Likewise. (i386-linux.o): Likewise. (i386-linux.c): Likewise. (amd64.o): Likewise. (amd64.c): Likewise. (amd64-linux.o): Likewise. (amd64-linux.c): Likewise. * configure.srv (srv_i386_regobj): New. (srv_i386_linux_regobj): Likewise. (srv_amd64_regobj): Likewise. (srv_amd64_linux_regobj): Likewise. (srv_i386_32bit_xmlfiles): Likewise. (srv_i386_64bit_xmlfiles): Likewise. (srv_i386_xmlfiles): Likewise. (srv_amd64_xmlfiles): Likewise. (srv_i386_linux_xmlfiles): Likewise. (srv_amd64_linux_xmlfiles): Likewise. (i[34567]86-*-cygwin*): Set srv_regobj to $srv_i386_regobj. Set srv_xmlfiles to $srv_i386_xmlfiles. (i[34567]86-*-mingw32ce*): Likewise. (i[34567]86-*-mingw*): Likewise. (i[34567]86-*-nto*): Likewise. (i[34567]86-*-linux*): Set srv_regobj to $srv_i386_linux_regobj and $srv_amd64_linux_regobj. Set srv_xmlfiles to $srv_i386_linux_xmlfiles and $srv_amd64_linux_xmlfiles. (x86_64-*-linux*): Likewise. * linux-x86-low.c (init_registers_x86_64_linux): Removed. (init_registers_amd64_linux): New. (x86_arch_setup): Replace init_registers_x86_64_linux with init_registers_amd64_linux. gdb/testsuite/ 2010-03-01 H.J. Lu <hongjiu.lu@intel.com> * gdb.xml/tdesc-regs.exp (architecture): New. Set it for x86. (load_description): Set architecture if defined.
2010-03-01 16:33:32 +01:00
int tid;
Support amd64 AVX. gdb/ 2010-04-07 H.J. Lu <hongjiu.lu@intel.com> * amd64-linux-nat.c: Include "regset.h", "elf/common.h", <sys/uio.h> and "i386-xstate.h". (PTRACE_GETREGSET): New. (PTRACE_SETREGSET): Likewise. (have_ptrace_getregset): Likewise. (amd64_linux_gregset64_reg_offset): Include 16 upper YMM registers. (amd64_linux_gregset32_reg_offset): Include 8 upper YMM registers. (amd64_linux_fetch_inferior_registers): Support PTRACE_GETFPREGS. (amd64_linux_store_inferior_registers): Likewise. (amd64_linux_read_description): Check and enable AVX target descriptions. * amd64-linux-tdep.c: Include "regset.h", "i386-linux-tdep.h" and "features/i386/amd64-avx-linux.c". (amd64_linux_regset_sections): New. (amd64_linux_core_read_description): Check and enable AVX target description. (amd64_linux_init_abi): Set xsave_xcr0_offset. Call set_gdbarch_core_regset_sections. (_initialize_amd64_linux_tdep): Call initialize_tdesc_amd64_avx_linux. * amd64-linux-tdep.h (AMD64_LINUX_ORIG_RAX_REGNUM): Replace AMD64_MXCSR_REGNUM with AMD64_YMM15H_REGNUM. (tdesc_amd64_avx_linux): New. (amd64_linux_update_xstateregset): Likewise. * amd64-tdep.c: Include "features/i386/amd64-avx.c". (amd64_ymm_names): New. (amd64_ymmh_names): Likewise. (amd64_register_name): Likewise. (amd64_supply_xstateregset): Likewise. (amd64_collect_xstateregset): Likewise. (amd64_supply_xsave): Likewise. (amd64_collect_xsave): Likewise. (AMD64_NUM_REGS): Removed. (amd64_dwarf_reg_to_regnum): Return %ymmN register number for %xmmN if AVX is available. (amd64_pseudo_register_name): Support pseudo YMM registers. (amd64_regset_from_core_section): Support .reg-xstate section. (amd64_init_abi): Set ymmh_register_names, num_ymm_regs and ymm0h_regnum. Call set_gdbarch_register_name. (amd64_init_abi): Call initialize_tdesc_amd64_avx. * amd64-tdep.h (amd64_regnum): Add AMD64_YMM0H_REGNUM and AMD64_YMM15H_REGNUM. (AMD64_NUM_REGS): New. (amd64_supply_xsave): Likewise. (amd64_collect_xsave): Likewise. (amd64_register_name): Removed. (amd64_register_type): Likewise. gdb/testsuite/ 2010-04-07 H.J. Lu <hongjiu.lu@intel.com> * gdb.arch/i386-avx.c: New. * gdb.arch/i386-avx.exp: Likewise. * gdb.arch/i386-cpuid.h: Updated from gcc 4.4.
2010-04-07 20:46:50 +02:00
int is_64bit;
int is_x32;
Support amd64 AVX. gdb/ 2010-04-07 H.J. Lu <hongjiu.lu@intel.com> * amd64-linux-nat.c: Include "regset.h", "elf/common.h", <sys/uio.h> and "i386-xstate.h". (PTRACE_GETREGSET): New. (PTRACE_SETREGSET): Likewise. (have_ptrace_getregset): Likewise. (amd64_linux_gregset64_reg_offset): Include 16 upper YMM registers. (amd64_linux_gregset32_reg_offset): Include 8 upper YMM registers. (amd64_linux_fetch_inferior_registers): Support PTRACE_GETFPREGS. (amd64_linux_store_inferior_registers): Likewise. (amd64_linux_read_description): Check and enable AVX target descriptions. * amd64-linux-tdep.c: Include "regset.h", "i386-linux-tdep.h" and "features/i386/amd64-avx-linux.c". (amd64_linux_regset_sections): New. (amd64_linux_core_read_description): Check and enable AVX target description. (amd64_linux_init_abi): Set xsave_xcr0_offset. Call set_gdbarch_core_regset_sections. (_initialize_amd64_linux_tdep): Call initialize_tdesc_amd64_avx_linux. * amd64-linux-tdep.h (AMD64_LINUX_ORIG_RAX_REGNUM): Replace AMD64_MXCSR_REGNUM with AMD64_YMM15H_REGNUM. (tdesc_amd64_avx_linux): New. (amd64_linux_update_xstateregset): Likewise. * amd64-tdep.c: Include "features/i386/amd64-avx.c". (amd64_ymm_names): New. (amd64_ymmh_names): Likewise. (amd64_register_name): Likewise. (amd64_supply_xstateregset): Likewise. (amd64_collect_xstateregset): Likewise. (amd64_supply_xsave): Likewise. (amd64_collect_xsave): Likewise. (AMD64_NUM_REGS): Removed. (amd64_dwarf_reg_to_regnum): Return %ymmN register number for %xmmN if AVX is available. (amd64_pseudo_register_name): Support pseudo YMM registers. (amd64_regset_from_core_section): Support .reg-xstate section. (amd64_init_abi): Set ymmh_register_names, num_ymm_regs and ymm0h_regnum. Call set_gdbarch_register_name. (amd64_init_abi): Call initialize_tdesc_amd64_avx. * amd64-tdep.h (amd64_regnum): Add AMD64_YMM0H_REGNUM and AMD64_YMM15H_REGNUM. (AMD64_NUM_REGS): New. (amd64_supply_xsave): Likewise. (amd64_collect_xsave): Likewise. (amd64_register_name): Removed. (amd64_register_type): Likewise. gdb/testsuite/ 2010-04-07 H.J. Lu <hongjiu.lu@intel.com> * gdb.arch/i386-avx.c: New. * gdb.arch/i386-avx.exp: Likewise. * gdb.arch/i386-cpuid.h: Updated from gcc 4.4.
2010-04-07 20:46:50 +02:00
static uint64_t xcr0;
Enable XML target descriptions for x86. gdb/ 2010-03-01 H.J. Lu <hongjiu.lu@intel.com> * amd64-linux-nat.c (AMD64_LINUX_USER64_CS): New. (amd64_linux_read_description): Likewise. (_initialize_amd64_linux_nat): Set to_read_description to amd64_linux_read_description. * amd64-linux-tdep.c: Include "features/i386/amd64-linux.c". (amd64_linux_register_name): Removed. (amd64_linux_register_type): Likewise. (amd64_linux_core_read_description): New. (amd64_linux_init_abi): Set target description to tdesc_amd64_linux if needed. Support orig_rax in target description. Don't call set_gdbarch_register_name nor set_gdbarch_register_type. Call set_gdbarch_core_read_description. (_initialize_amd64_linux_tdep): Call initialize_tdesc_amd64_linux. * amd64-linux-tdep.h (tdesc_amd64_linux): New. * amd64-tdep.c: Include "features/i386/amd64.c". (amd64_register_names): Removed. (amd64_register_name): Likewise. (amd64_register_type): Likewise. (amd64_init_abi): Set num_core_regs and register_names. Set target description to tdesc_amd64 if needed. Don't call set_gdbarch_register_name nor set_gdbarch_register_type. (_initialize_amd64_tdep): New. * i386-linux-nat.c (i386_linux_read_description): New. (_initialize_i386_linux_nat): Set to_read_description to i386_linux_read_description. * i386-linux-tdep.c: Include "features/i386/i386-linux.c". (i386_linux_register_name): Removed. (i386_linux_core_read_description): New. (i386_linux_read_description): Likewise. (i386_linux_init_abi): Don't call set_gdbarch_register_name. Set target description to tdesc_i386_linux if needed. Support orig_eax. Set register_reggroup_p. Call set_gdbarch_core_read_description. (_initialize_i386_linux_tdep): Call initialize_tdesc_i386_linux. * i386-linux-tdep.h (tdesc_i386_linux): New. * i386-nto-tdep.c (i386nto_regset_id): Replace I386_NUM_FREGS with I387_NUM_REGS. * i386-tdep.c: Include "features/i386/i386.c". (i386_register_names): Make it const. (i386_mmx_names): Likewise. (i386_num_register_names): Removed. (i386_register_name): Likewise. (i386_eflags_type): Likewise. (i386_mxcsr_type): Likewise. (i386_sse_type): Likewise. (i386_register_type): Likewise. (i387_ext_type): Call tdesc_find_type instead of arch_float_type. (i386_pseudo_register_name): New. (i386_pseudo_register_type): Likewise. (i386_mmx_type): Make it static. (i386_gdbarch_init): Check arch. Replace I386_NUM_FREGS with I387_NUM_REGS. Set num_core_regs and register_names. Don't call set_gdbarch_register_name nor set_gdbarch_register_type. Set register_reggroup_p. Set target description to tdesc_i386 if needed. Call set_tdesc_pseudo_register_type, set_tdesc_pseudo_register_name and tdesc_use_registers. (_initialize_i386_tdep): Call initialize_tdesc_i386. initialize_tdesc_x86_64. * i386-tdep.h (gdbarch_tdep): Remove i386_eflags_type, i386_mxcsr_type and i386_sse_type. Add num_core_regs, register_names, tdesc and register_reggroup_p. (I386_NUM_FREGS): Removed. (i386_eflags_type): Likewise. (i386_mxcsr_type): Likewise. (i386_mmx_type): Likewise. (i386_sse_type): Likewise. (i386_register_name): Likewise. (i386_regnum): Add I386_MXCSR_REGNUM. (I386_SSE_NUM_REGS): Defined with I386_MXCSR_REGNUM. * i387-tdep.h (I387_NUM_REGS): New. * regformats/i386/i386-linux.dat: Generated. * regformats/i386/i386.dat: Likewise. * regformats/i386/amd64-linux.dat: Likewise. * regformats/i386/amd64.dat: Likewise. * regformats/reg-i386-linux.dat: Removed. * regformats/reg-i386.dat: Likewise. * regformats/reg-x86-64-linux.dat: Likewise. * regformats/reg-x86-64.dat: Likewise. gdb/gdbserver/ 2010-03-01 H.J. Lu <hongjiu.lu@intel.com> * Makefile.in (clean): Replace reg-i386.c, reg-x86-64.c, reg-i386-linux.c and reg-x86-64-linux.c with i386.c, amd64.c, i386-linux.c and amd64-linux.c. (reg-i386.o): Removed. (reg-i386.c): Likewise. (reg-i386-linux.o): Likewise. (reg-i386-linux.c): Likewise. (reg-x86-64.o): Likewise. (reg-x86-64.c): Likewise. (reg-x86-64-linux.o): Likewise. (reg-x86-64-linux.c): Likewise. (i386.o): New. (i386.c): Likewise. (i386-linux.o): Likewise. (i386-linux.c): Likewise. (amd64.o): Likewise. (amd64.c): Likewise. (amd64-linux.o): Likewise. (amd64-linux.c): Likewise. * configure.srv (srv_i386_regobj): New. (srv_i386_linux_regobj): Likewise. (srv_amd64_regobj): Likewise. (srv_amd64_linux_regobj): Likewise. (srv_i386_32bit_xmlfiles): Likewise. (srv_i386_64bit_xmlfiles): Likewise. (srv_i386_xmlfiles): Likewise. (srv_amd64_xmlfiles): Likewise. (srv_i386_linux_xmlfiles): Likewise. (srv_amd64_linux_xmlfiles): Likewise. (i[34567]86-*-cygwin*): Set srv_regobj to $srv_i386_regobj. Set srv_xmlfiles to $srv_i386_xmlfiles. (i[34567]86-*-mingw32ce*): Likewise. (i[34567]86-*-mingw*): Likewise. (i[34567]86-*-nto*): Likewise. (i[34567]86-*-linux*): Set srv_regobj to $srv_i386_linux_regobj and $srv_amd64_linux_regobj. Set srv_xmlfiles to $srv_i386_linux_xmlfiles and $srv_amd64_linux_xmlfiles. (x86_64-*-linux*): Likewise. * linux-x86-low.c (init_registers_x86_64_linux): Removed. (init_registers_amd64_linux): New. (x86_arch_setup): Replace init_registers_x86_64_linux with init_registers_amd64_linux. gdb/testsuite/ 2010-03-01 H.J. Lu <hongjiu.lu@intel.com> * gdb.xml/tdesc-regs.exp (architecture): New. Set it for x86. (load_description): Set architecture if defined.
2010-03-01 16:33:32 +01:00
/* GNU/Linux LWP ID's are process ID's. */
* aarch64-linux-nat.c: Replace PIDGET with ptid_get_pid. Replace TIDGET with ptid_get_lwp. Replace GET_LWP with ptid_get_lwp. * aix-thread.c (BUILD_THREAD, BUILD_LWP): Remove. Replace BUILD_THREAD with ptid_build. Replace BUILD_LWP with ptid_build. Replace PIDGET with ptid_get_pid. Replace TIDGET with ptid_get_lwp. * alphabsd-nat.c: Replace PIDGET with ptid_get_pid. * amd64-linux-nat.c: Replace PIDGET with ptid_get_pid. Replace TIDGET with ptid_get_lwp. * amd64bsd-nat.c: Replace PIDGET with ptid_get_pid. * arm-linux-nat.c: Replace PIDGET with ptid_get_pid. Replace TIDGET with ptid_get_lwp. Replace GET_LWP with ptid_get_lwp. * armnbsd-nat.c: Replace PIDGET with ptid_get_pid. * auxv.c: Likewise. * breakpoint.c: Likewise. * common/ptid.c (ptid_is_pid): Condense check for null_ptid and minus_one_ptid. (ptid_lwp_p): New function. (ptid_tid_p): New function. * common/ptid.h: Update comments for accessors. (ptid_lwp_p): New prototype. (ptid_tid_p): New prototype. * defs.h (PIDGET, TIDGET, MERGEPID): Do not define. * gcore.c: Replace PIDGET with ptid_get_pid. * gdbthread.h: Likewise. * gnu-nat.c: Likewise. * hppa-linux-nat.c: Replace PIDGET with ptid_get_pid. Replace TIDGET with ptid_get_lwp. * hppabsd-nat.c: Replace PIDGET with ptid_get_pid. * hppanbsd-nat.c: Likewise. * i386-linux-nat.c: Replace PIDGET with ptid_get_pid. Replace TIDGET with ptid_get_lwp. * i386bsd-nat.c: Replace PIDGET with ptid_get_pid. * ia64-linux-nat.c: Replace PIDGET with ptid_get_pid. * infcmd.c: Likewise. * inferior.h: Likewise. * inflow.c: Likewise. * infrun.c: Likewise. * linux-fork.c: Likewise. * linux-nat.c: Replace PIDGET with ptid_get_pid. Replace GET_PID with ptid_get_pid. Replace is_lwp with ptid_lwp_p. Replace GET_LWP with ptid_get_lwp. Replace BUILD_LWP with ptid_build.
2013-09-30 13:50:12 +02:00
tid = ptid_get_lwp (inferior_ptid);
Enable XML target descriptions for x86. gdb/ 2010-03-01 H.J. Lu <hongjiu.lu@intel.com> * amd64-linux-nat.c (AMD64_LINUX_USER64_CS): New. (amd64_linux_read_description): Likewise. (_initialize_amd64_linux_nat): Set to_read_description to amd64_linux_read_description. * amd64-linux-tdep.c: Include "features/i386/amd64-linux.c". (amd64_linux_register_name): Removed. (amd64_linux_register_type): Likewise. (amd64_linux_core_read_description): New. (amd64_linux_init_abi): Set target description to tdesc_amd64_linux if needed. Support orig_rax in target description. Don't call set_gdbarch_register_name nor set_gdbarch_register_type. Call set_gdbarch_core_read_description. (_initialize_amd64_linux_tdep): Call initialize_tdesc_amd64_linux. * amd64-linux-tdep.h (tdesc_amd64_linux): New. * amd64-tdep.c: Include "features/i386/amd64.c". (amd64_register_names): Removed. (amd64_register_name): Likewise. (amd64_register_type): Likewise. (amd64_init_abi): Set num_core_regs and register_names. Set target description to tdesc_amd64 if needed. Don't call set_gdbarch_register_name nor set_gdbarch_register_type. (_initialize_amd64_tdep): New. * i386-linux-nat.c (i386_linux_read_description): New. (_initialize_i386_linux_nat): Set to_read_description to i386_linux_read_description. * i386-linux-tdep.c: Include "features/i386/i386-linux.c". (i386_linux_register_name): Removed. (i386_linux_core_read_description): New. (i386_linux_read_description): Likewise. (i386_linux_init_abi): Don't call set_gdbarch_register_name. Set target description to tdesc_i386_linux if needed. Support orig_eax. Set register_reggroup_p. Call set_gdbarch_core_read_description. (_initialize_i386_linux_tdep): Call initialize_tdesc_i386_linux. * i386-linux-tdep.h (tdesc_i386_linux): New. * i386-nto-tdep.c (i386nto_regset_id): Replace I386_NUM_FREGS with I387_NUM_REGS. * i386-tdep.c: Include "features/i386/i386.c". (i386_register_names): Make it const. (i386_mmx_names): Likewise. (i386_num_register_names): Removed. (i386_register_name): Likewise. (i386_eflags_type): Likewise. (i386_mxcsr_type): Likewise. (i386_sse_type): Likewise. (i386_register_type): Likewise. (i387_ext_type): Call tdesc_find_type instead of arch_float_type. (i386_pseudo_register_name): New. (i386_pseudo_register_type): Likewise. (i386_mmx_type): Make it static. (i386_gdbarch_init): Check arch. Replace I386_NUM_FREGS with I387_NUM_REGS. Set num_core_regs and register_names. Don't call set_gdbarch_register_name nor set_gdbarch_register_type. Set register_reggroup_p. Set target description to tdesc_i386 if needed. Call set_tdesc_pseudo_register_type, set_tdesc_pseudo_register_name and tdesc_use_registers. (_initialize_i386_tdep): Call initialize_tdesc_i386. initialize_tdesc_x86_64. * i386-tdep.h (gdbarch_tdep): Remove i386_eflags_type, i386_mxcsr_type and i386_sse_type. Add num_core_regs, register_names, tdesc and register_reggroup_p. (I386_NUM_FREGS): Removed. (i386_eflags_type): Likewise. (i386_mxcsr_type): Likewise. (i386_mmx_type): Likewise. (i386_sse_type): Likewise. (i386_register_name): Likewise. (i386_regnum): Add I386_MXCSR_REGNUM. (I386_SSE_NUM_REGS): Defined with I386_MXCSR_REGNUM. * i387-tdep.h (I387_NUM_REGS): New. * regformats/i386/i386-linux.dat: Generated. * regformats/i386/i386.dat: Likewise. * regformats/i386/amd64-linux.dat: Likewise. * regformats/i386/amd64.dat: Likewise. * regformats/reg-i386-linux.dat: Removed. * regformats/reg-i386.dat: Likewise. * regformats/reg-x86-64-linux.dat: Likewise. * regformats/reg-x86-64.dat: Likewise. gdb/gdbserver/ 2010-03-01 H.J. Lu <hongjiu.lu@intel.com> * Makefile.in (clean): Replace reg-i386.c, reg-x86-64.c, reg-i386-linux.c and reg-x86-64-linux.c with i386.c, amd64.c, i386-linux.c and amd64-linux.c. (reg-i386.o): Removed. (reg-i386.c): Likewise. (reg-i386-linux.o): Likewise. (reg-i386-linux.c): Likewise. (reg-x86-64.o): Likewise. (reg-x86-64.c): Likewise. (reg-x86-64-linux.o): Likewise. (reg-x86-64-linux.c): Likewise. (i386.o): New. (i386.c): Likewise. (i386-linux.o): Likewise. (i386-linux.c): Likewise. (amd64.o): Likewise. (amd64.c): Likewise. (amd64-linux.o): Likewise. (amd64-linux.c): Likewise. * configure.srv (srv_i386_regobj): New. (srv_i386_linux_regobj): Likewise. (srv_amd64_regobj): Likewise. (srv_amd64_linux_regobj): Likewise. (srv_i386_32bit_xmlfiles): Likewise. (srv_i386_64bit_xmlfiles): Likewise. (srv_i386_xmlfiles): Likewise. (srv_amd64_xmlfiles): Likewise. (srv_i386_linux_xmlfiles): Likewise. (srv_amd64_linux_xmlfiles): Likewise. (i[34567]86-*-cygwin*): Set srv_regobj to $srv_i386_regobj. Set srv_xmlfiles to $srv_i386_xmlfiles. (i[34567]86-*-mingw32ce*): Likewise. (i[34567]86-*-mingw*): Likewise. (i[34567]86-*-nto*): Likewise. (i[34567]86-*-linux*): Set srv_regobj to $srv_i386_linux_regobj and $srv_amd64_linux_regobj. Set srv_xmlfiles to $srv_i386_linux_xmlfiles and $srv_amd64_linux_xmlfiles. (x86_64-*-linux*): Likewise. * linux-x86-low.c (init_registers_x86_64_linux): Removed. (init_registers_amd64_linux): New. (x86_arch_setup): Replace init_registers_x86_64_linux with init_registers_amd64_linux. gdb/testsuite/ 2010-03-01 H.J. Lu <hongjiu.lu@intel.com> * gdb.xml/tdesc-regs.exp (architecture): New. Set it for x86. (load_description): Set architecture if defined.
2010-03-01 16:33:32 +01:00
if (tid == 0)
* aarch64-linux-nat.c: Replace PIDGET with ptid_get_pid. Replace TIDGET with ptid_get_lwp. Replace GET_LWP with ptid_get_lwp. * aix-thread.c (BUILD_THREAD, BUILD_LWP): Remove. Replace BUILD_THREAD with ptid_build. Replace BUILD_LWP with ptid_build. Replace PIDGET with ptid_get_pid. Replace TIDGET with ptid_get_lwp. * alphabsd-nat.c: Replace PIDGET with ptid_get_pid. * amd64-linux-nat.c: Replace PIDGET with ptid_get_pid. Replace TIDGET with ptid_get_lwp. * amd64bsd-nat.c: Replace PIDGET with ptid_get_pid. * arm-linux-nat.c: Replace PIDGET with ptid_get_pid. Replace TIDGET with ptid_get_lwp. Replace GET_LWP with ptid_get_lwp. * armnbsd-nat.c: Replace PIDGET with ptid_get_pid. * auxv.c: Likewise. * breakpoint.c: Likewise. * common/ptid.c (ptid_is_pid): Condense check for null_ptid and minus_one_ptid. (ptid_lwp_p): New function. (ptid_tid_p): New function. * common/ptid.h: Update comments for accessors. (ptid_lwp_p): New prototype. (ptid_tid_p): New prototype. * defs.h (PIDGET, TIDGET, MERGEPID): Do not define. * gcore.c: Replace PIDGET with ptid_get_pid. * gdbthread.h: Likewise. * gnu-nat.c: Likewise. * hppa-linux-nat.c: Replace PIDGET with ptid_get_pid. Replace TIDGET with ptid_get_lwp. * hppabsd-nat.c: Replace PIDGET with ptid_get_pid. * hppanbsd-nat.c: Likewise. * i386-linux-nat.c: Replace PIDGET with ptid_get_pid. Replace TIDGET with ptid_get_lwp. * i386bsd-nat.c: Replace PIDGET with ptid_get_pid. * ia64-linux-nat.c: Replace PIDGET with ptid_get_pid. * infcmd.c: Likewise. * inferior.h: Likewise. * inflow.c: Likewise. * infrun.c: Likewise. * linux-fork.c: Likewise. * linux-nat.c: Replace PIDGET with ptid_get_pid. Replace GET_PID with ptid_get_pid. Replace is_lwp with ptid_lwp_p. Replace GET_LWP with ptid_get_lwp. Replace BUILD_LWP with ptid_build.
2013-09-30 13:50:12 +02:00
tid = ptid_get_pid (inferior_ptid); /* Not a threaded program. */
Enable XML target descriptions for x86. gdb/ 2010-03-01 H.J. Lu <hongjiu.lu@intel.com> * amd64-linux-nat.c (AMD64_LINUX_USER64_CS): New. (amd64_linux_read_description): Likewise. (_initialize_amd64_linux_nat): Set to_read_description to amd64_linux_read_description. * amd64-linux-tdep.c: Include "features/i386/amd64-linux.c". (amd64_linux_register_name): Removed. (amd64_linux_register_type): Likewise. (amd64_linux_core_read_description): New. (amd64_linux_init_abi): Set target description to tdesc_amd64_linux if needed. Support orig_rax in target description. Don't call set_gdbarch_register_name nor set_gdbarch_register_type. Call set_gdbarch_core_read_description. (_initialize_amd64_linux_tdep): Call initialize_tdesc_amd64_linux. * amd64-linux-tdep.h (tdesc_amd64_linux): New. * amd64-tdep.c: Include "features/i386/amd64.c". (amd64_register_names): Removed. (amd64_register_name): Likewise. (amd64_register_type): Likewise. (amd64_init_abi): Set num_core_regs and register_names. Set target description to tdesc_amd64 if needed. Don't call set_gdbarch_register_name nor set_gdbarch_register_type. (_initialize_amd64_tdep): New. * i386-linux-nat.c (i386_linux_read_description): New. (_initialize_i386_linux_nat): Set to_read_description to i386_linux_read_description. * i386-linux-tdep.c: Include "features/i386/i386-linux.c". (i386_linux_register_name): Removed. (i386_linux_core_read_description): New. (i386_linux_read_description): Likewise. (i386_linux_init_abi): Don't call set_gdbarch_register_name. Set target description to tdesc_i386_linux if needed. Support orig_eax. Set register_reggroup_p. Call set_gdbarch_core_read_description. (_initialize_i386_linux_tdep): Call initialize_tdesc_i386_linux. * i386-linux-tdep.h (tdesc_i386_linux): New. * i386-nto-tdep.c (i386nto_regset_id): Replace I386_NUM_FREGS with I387_NUM_REGS. * i386-tdep.c: Include "features/i386/i386.c". (i386_register_names): Make it const. (i386_mmx_names): Likewise. (i386_num_register_names): Removed. (i386_register_name): Likewise. (i386_eflags_type): Likewise. (i386_mxcsr_type): Likewise. (i386_sse_type): Likewise. (i386_register_type): Likewise. (i387_ext_type): Call tdesc_find_type instead of arch_float_type. (i386_pseudo_register_name): New. (i386_pseudo_register_type): Likewise. (i386_mmx_type): Make it static. (i386_gdbarch_init): Check arch. Replace I386_NUM_FREGS with I387_NUM_REGS. Set num_core_regs and register_names. Don't call set_gdbarch_register_name nor set_gdbarch_register_type. Set register_reggroup_p. Set target description to tdesc_i386 if needed. Call set_tdesc_pseudo_register_type, set_tdesc_pseudo_register_name and tdesc_use_registers. (_initialize_i386_tdep): Call initialize_tdesc_i386. initialize_tdesc_x86_64. * i386-tdep.h (gdbarch_tdep): Remove i386_eflags_type, i386_mxcsr_type and i386_sse_type. Add num_core_regs, register_names, tdesc and register_reggroup_p. (I386_NUM_FREGS): Removed. (i386_eflags_type): Likewise. (i386_mxcsr_type): Likewise. (i386_mmx_type): Likewise. (i386_sse_type): Likewise. (i386_register_name): Likewise. (i386_regnum): Add I386_MXCSR_REGNUM. (I386_SSE_NUM_REGS): Defined with I386_MXCSR_REGNUM. * i387-tdep.h (I387_NUM_REGS): New. * regformats/i386/i386-linux.dat: Generated. * regformats/i386/i386.dat: Likewise. * regformats/i386/amd64-linux.dat: Likewise. * regformats/i386/amd64.dat: Likewise. * regformats/reg-i386-linux.dat: Removed. * regformats/reg-i386.dat: Likewise. * regformats/reg-x86-64-linux.dat: Likewise. * regformats/reg-x86-64.dat: Likewise. gdb/gdbserver/ 2010-03-01 H.J. Lu <hongjiu.lu@intel.com> * Makefile.in (clean): Replace reg-i386.c, reg-x86-64.c, reg-i386-linux.c and reg-x86-64-linux.c with i386.c, amd64.c, i386-linux.c and amd64-linux.c. (reg-i386.o): Removed. (reg-i386.c): Likewise. (reg-i386-linux.o): Likewise. (reg-i386-linux.c): Likewise. (reg-x86-64.o): Likewise. (reg-x86-64.c): Likewise. (reg-x86-64-linux.o): Likewise. (reg-x86-64-linux.c): Likewise. (i386.o): New. (i386.c): Likewise. (i386-linux.o): Likewise. (i386-linux.c): Likewise. (amd64.o): Likewise. (amd64.c): Likewise. (amd64-linux.o): Likewise. (amd64-linux.c): Likewise. * configure.srv (srv_i386_regobj): New. (srv_i386_linux_regobj): Likewise. (srv_amd64_regobj): Likewise. (srv_amd64_linux_regobj): Likewise. (srv_i386_32bit_xmlfiles): Likewise. (srv_i386_64bit_xmlfiles): Likewise. (srv_i386_xmlfiles): Likewise. (srv_amd64_xmlfiles): Likewise. (srv_i386_linux_xmlfiles): Likewise. (srv_amd64_linux_xmlfiles): Likewise. (i[34567]86-*-cygwin*): Set srv_regobj to $srv_i386_regobj. Set srv_xmlfiles to $srv_i386_xmlfiles. (i[34567]86-*-mingw32ce*): Likewise. (i[34567]86-*-mingw*): Likewise. (i[34567]86-*-nto*): Likewise. (i[34567]86-*-linux*): Set srv_regobj to $srv_i386_linux_regobj and $srv_amd64_linux_regobj. Set srv_xmlfiles to $srv_i386_linux_xmlfiles and $srv_amd64_linux_xmlfiles. (x86_64-*-linux*): Likewise. * linux-x86-low.c (init_registers_x86_64_linux): Removed. (init_registers_amd64_linux): New. (x86_arch_setup): Replace init_registers_x86_64_linux with init_registers_amd64_linux. gdb/testsuite/ 2010-03-01 H.J. Lu <hongjiu.lu@intel.com> * gdb.xml/tdesc-regs.exp (architecture): New. Set it for x86. (load_description): Set architecture if defined.
2010-03-01 16:33:32 +01:00
/* Get CS register. */
errno = 0;
cs = ptrace (PTRACE_PEEKUSER, tid,
offsetof (struct user_regs_struct, cs), 0);
if (errno != 0)
perror_with_name (_("Couldn't get CS register"));
Support amd64 AVX. gdb/ 2010-04-07 H.J. Lu <hongjiu.lu@intel.com> * amd64-linux-nat.c: Include "regset.h", "elf/common.h", <sys/uio.h> and "i386-xstate.h". (PTRACE_GETREGSET): New. (PTRACE_SETREGSET): Likewise. (have_ptrace_getregset): Likewise. (amd64_linux_gregset64_reg_offset): Include 16 upper YMM registers. (amd64_linux_gregset32_reg_offset): Include 8 upper YMM registers. (amd64_linux_fetch_inferior_registers): Support PTRACE_GETFPREGS. (amd64_linux_store_inferior_registers): Likewise. (amd64_linux_read_description): Check and enable AVX target descriptions. * amd64-linux-tdep.c: Include "regset.h", "i386-linux-tdep.h" and "features/i386/amd64-avx-linux.c". (amd64_linux_regset_sections): New. (amd64_linux_core_read_description): Check and enable AVX target description. (amd64_linux_init_abi): Set xsave_xcr0_offset. Call set_gdbarch_core_regset_sections. (_initialize_amd64_linux_tdep): Call initialize_tdesc_amd64_avx_linux. * amd64-linux-tdep.h (AMD64_LINUX_ORIG_RAX_REGNUM): Replace AMD64_MXCSR_REGNUM with AMD64_YMM15H_REGNUM. (tdesc_amd64_avx_linux): New. (amd64_linux_update_xstateregset): Likewise. * amd64-tdep.c: Include "features/i386/amd64-avx.c". (amd64_ymm_names): New. (amd64_ymmh_names): Likewise. (amd64_register_name): Likewise. (amd64_supply_xstateregset): Likewise. (amd64_collect_xstateregset): Likewise. (amd64_supply_xsave): Likewise. (amd64_collect_xsave): Likewise. (AMD64_NUM_REGS): Removed. (amd64_dwarf_reg_to_regnum): Return %ymmN register number for %xmmN if AVX is available. (amd64_pseudo_register_name): Support pseudo YMM registers. (amd64_regset_from_core_section): Support .reg-xstate section. (amd64_init_abi): Set ymmh_register_names, num_ymm_regs and ymm0h_regnum. Call set_gdbarch_register_name. (amd64_init_abi): Call initialize_tdesc_amd64_avx. * amd64-tdep.h (amd64_regnum): Add AMD64_YMM0H_REGNUM and AMD64_YMM15H_REGNUM. (AMD64_NUM_REGS): New. (amd64_supply_xsave): Likewise. (amd64_collect_xsave): Likewise. (amd64_register_name): Removed. (amd64_register_type): Likewise. gdb/testsuite/ 2010-04-07 H.J. Lu <hongjiu.lu@intel.com> * gdb.arch/i386-avx.c: New. * gdb.arch/i386-avx.exp: Likewise. * gdb.arch/i386-cpuid.h: Updated from gcc 4.4.
2010-04-07 20:46:50 +02:00
is_64bit = cs == AMD64_LINUX_USER64_CS;
/* Get DS register. */
errno = 0;
ds = ptrace (PTRACE_PEEKUSER, tid,
offsetof (struct user_regs_struct, ds), 0);
if (errno != 0)
perror_with_name (_("Couldn't get DS register"));
is_x32 = ds == AMD64_LINUX_X32_DS;
if (sizeof (void *) == 4 && is_64bit && !is_x32)
error (_("Can't debug 64-bit process with 32-bit GDB"));
Support amd64 AVX. gdb/ 2010-04-07 H.J. Lu <hongjiu.lu@intel.com> * amd64-linux-nat.c: Include "regset.h", "elf/common.h", <sys/uio.h> and "i386-xstate.h". (PTRACE_GETREGSET): New. (PTRACE_SETREGSET): Likewise. (have_ptrace_getregset): Likewise. (amd64_linux_gregset64_reg_offset): Include 16 upper YMM registers. (amd64_linux_gregset32_reg_offset): Include 8 upper YMM registers. (amd64_linux_fetch_inferior_registers): Support PTRACE_GETFPREGS. (amd64_linux_store_inferior_registers): Likewise. (amd64_linux_read_description): Check and enable AVX target descriptions. * amd64-linux-tdep.c: Include "regset.h", "i386-linux-tdep.h" and "features/i386/amd64-avx-linux.c". (amd64_linux_regset_sections): New. (amd64_linux_core_read_description): Check and enable AVX target description. (amd64_linux_init_abi): Set xsave_xcr0_offset. Call set_gdbarch_core_regset_sections. (_initialize_amd64_linux_tdep): Call initialize_tdesc_amd64_avx_linux. * amd64-linux-tdep.h (AMD64_LINUX_ORIG_RAX_REGNUM): Replace AMD64_MXCSR_REGNUM with AMD64_YMM15H_REGNUM. (tdesc_amd64_avx_linux): New. (amd64_linux_update_xstateregset): Likewise. * amd64-tdep.c: Include "features/i386/amd64-avx.c". (amd64_ymm_names): New. (amd64_ymmh_names): Likewise. (amd64_register_name): Likewise. (amd64_supply_xstateregset): Likewise. (amd64_collect_xstateregset): Likewise. (amd64_supply_xsave): Likewise. (amd64_collect_xsave): Likewise. (AMD64_NUM_REGS): Removed. (amd64_dwarf_reg_to_regnum): Return %ymmN register number for %xmmN if AVX is available. (amd64_pseudo_register_name): Support pseudo YMM registers. (amd64_regset_from_core_section): Support .reg-xstate section. (amd64_init_abi): Set ymmh_register_names, num_ymm_regs and ymm0h_regnum. Call set_gdbarch_register_name. (amd64_init_abi): Call initialize_tdesc_amd64_avx. * amd64-tdep.h (amd64_regnum): Add AMD64_YMM0H_REGNUM and AMD64_YMM15H_REGNUM. (AMD64_NUM_REGS): New. (amd64_supply_xsave): Likewise. (amd64_collect_xsave): Likewise. (amd64_register_name): Removed. (amd64_register_type): Likewise. gdb/testsuite/ 2010-04-07 H.J. Lu <hongjiu.lu@intel.com> * gdb.arch/i386-avx.c: New. * gdb.arch/i386-avx.exp: Likewise. * gdb.arch/i386-cpuid.h: Updated from gcc 4.4.
2010-04-07 20:46:50 +02:00
if (have_ptrace_getregset == -1)
{
uint64_t xstateregs[(I386_XSTATE_SSE_SIZE / sizeof (uint64_t))];
struct iovec iov;
iov.iov_base = xstateregs;
iov.iov_len = sizeof (xstateregs);
/* Check if PTRACE_GETREGSET works. */
if (ptrace (PTRACE_GETREGSET, tid,
(unsigned int) NT_X86_XSTATE, (long) &iov) < 0)
have_ptrace_getregset = 0;
else
{
have_ptrace_getregset = 1;
/* Get XCR0 from XSAVE extended state. */
xcr0 = xstateregs[(I386_LINUX_XSAVE_XCR0_OFFSET
/ sizeof (uint64_t))];
}
}
/* Check the native XCR0 only if PTRACE_GETREGSET is available. */
if (have_ptrace_getregset && (xcr0 & I386_XSTATE_ALL_MASK))
Support amd64 AVX. gdb/ 2010-04-07 H.J. Lu <hongjiu.lu@intel.com> * amd64-linux-nat.c: Include "regset.h", "elf/common.h", <sys/uio.h> and "i386-xstate.h". (PTRACE_GETREGSET): New. (PTRACE_SETREGSET): Likewise. (have_ptrace_getregset): Likewise. (amd64_linux_gregset64_reg_offset): Include 16 upper YMM registers. (amd64_linux_gregset32_reg_offset): Include 8 upper YMM registers. (amd64_linux_fetch_inferior_registers): Support PTRACE_GETFPREGS. (amd64_linux_store_inferior_registers): Likewise. (amd64_linux_read_description): Check and enable AVX target descriptions. * amd64-linux-tdep.c: Include "regset.h", "i386-linux-tdep.h" and "features/i386/amd64-avx-linux.c". (amd64_linux_regset_sections): New. (amd64_linux_core_read_description): Check and enable AVX target description. (amd64_linux_init_abi): Set xsave_xcr0_offset. Call set_gdbarch_core_regset_sections. (_initialize_amd64_linux_tdep): Call initialize_tdesc_amd64_avx_linux. * amd64-linux-tdep.h (AMD64_LINUX_ORIG_RAX_REGNUM): Replace AMD64_MXCSR_REGNUM with AMD64_YMM15H_REGNUM. (tdesc_amd64_avx_linux): New. (amd64_linux_update_xstateregset): Likewise. * amd64-tdep.c: Include "features/i386/amd64-avx.c". (amd64_ymm_names): New. (amd64_ymmh_names): Likewise. (amd64_register_name): Likewise. (amd64_supply_xstateregset): Likewise. (amd64_collect_xstateregset): Likewise. (amd64_supply_xsave): Likewise. (amd64_collect_xsave): Likewise. (AMD64_NUM_REGS): Removed. (amd64_dwarf_reg_to_regnum): Return %ymmN register number for %xmmN if AVX is available. (amd64_pseudo_register_name): Support pseudo YMM registers. (amd64_regset_from_core_section): Support .reg-xstate section. (amd64_init_abi): Set ymmh_register_names, num_ymm_regs and ymm0h_regnum. Call set_gdbarch_register_name. (amd64_init_abi): Call initialize_tdesc_amd64_avx. * amd64-tdep.h (amd64_regnum): Add AMD64_YMM0H_REGNUM and AMD64_YMM15H_REGNUM. (AMD64_NUM_REGS): New. (amd64_supply_xsave): Likewise. (amd64_collect_xsave): Likewise. (amd64_register_name): Removed. (amd64_register_type): Likewise. gdb/testsuite/ 2010-04-07 H.J. Lu <hongjiu.lu@intel.com> * gdb.arch/i386-avx.c: New. * gdb.arch/i386-avx.exp: Likewise. * gdb.arch/i386-cpuid.h: Updated from gcc 4.4.
2010-04-07 20:46:50 +02:00
{
switch (xcr0 & I386_XSTATE_ALL_MASK)
{
case I386_XSTATE_MPX_MASK:
if (is_64bit)
{
if (is_x32)
return tdesc_x32_avx_linux; /* No MPX on x32 using AVX. */
else
return tdesc_amd64_mpx_linux;
}
else
return tdesc_i386_mpx_linux;
case I386_XSTATE_AVX_MASK:
if (is_64bit)
{
if (is_x32)
return tdesc_x32_avx_linux;
else
return tdesc_amd64_avx_linux;
}
else
return tdesc_i386_avx_linux;
default:
if (is_64bit)
{
if (is_x32)
return tdesc_x32_linux;
else
return tdesc_amd64_linux;
}
else
return tdesc_i386_linux;
}
Support amd64 AVX. gdb/ 2010-04-07 H.J. Lu <hongjiu.lu@intel.com> * amd64-linux-nat.c: Include "regset.h", "elf/common.h", <sys/uio.h> and "i386-xstate.h". (PTRACE_GETREGSET): New. (PTRACE_SETREGSET): Likewise. (have_ptrace_getregset): Likewise. (amd64_linux_gregset64_reg_offset): Include 16 upper YMM registers. (amd64_linux_gregset32_reg_offset): Include 8 upper YMM registers. (amd64_linux_fetch_inferior_registers): Support PTRACE_GETFPREGS. (amd64_linux_store_inferior_registers): Likewise. (amd64_linux_read_description): Check and enable AVX target descriptions. * amd64-linux-tdep.c: Include "regset.h", "i386-linux-tdep.h" and "features/i386/amd64-avx-linux.c". (amd64_linux_regset_sections): New. (amd64_linux_core_read_description): Check and enable AVX target description. (amd64_linux_init_abi): Set xsave_xcr0_offset. Call set_gdbarch_core_regset_sections. (_initialize_amd64_linux_tdep): Call initialize_tdesc_amd64_avx_linux. * amd64-linux-tdep.h (AMD64_LINUX_ORIG_RAX_REGNUM): Replace AMD64_MXCSR_REGNUM with AMD64_YMM15H_REGNUM. (tdesc_amd64_avx_linux): New. (amd64_linux_update_xstateregset): Likewise. * amd64-tdep.c: Include "features/i386/amd64-avx.c". (amd64_ymm_names): New. (amd64_ymmh_names): Likewise. (amd64_register_name): Likewise. (amd64_supply_xstateregset): Likewise. (amd64_collect_xstateregset): Likewise. (amd64_supply_xsave): Likewise. (amd64_collect_xsave): Likewise. (AMD64_NUM_REGS): Removed. (amd64_dwarf_reg_to_regnum): Return %ymmN register number for %xmmN if AVX is available. (amd64_pseudo_register_name): Support pseudo YMM registers. (amd64_regset_from_core_section): Support .reg-xstate section. (amd64_init_abi): Set ymmh_register_names, num_ymm_regs and ymm0h_regnum. Call set_gdbarch_register_name. (amd64_init_abi): Call initialize_tdesc_amd64_avx. * amd64-tdep.h (amd64_regnum): Add AMD64_YMM0H_REGNUM and AMD64_YMM15H_REGNUM. (AMD64_NUM_REGS): New. (amd64_supply_xsave): Likewise. (amd64_collect_xsave): Likewise. (amd64_register_name): Removed. (amd64_register_type): Likewise. gdb/testsuite/ 2010-04-07 H.J. Lu <hongjiu.lu@intel.com> * gdb.arch/i386-avx.c: New. * gdb.arch/i386-avx.exp: Likewise. * gdb.arch/i386-cpuid.h: Updated from gcc 4.4.
2010-04-07 20:46:50 +02:00
}
Enable XML target descriptions for x86. gdb/ 2010-03-01 H.J. Lu <hongjiu.lu@intel.com> * amd64-linux-nat.c (AMD64_LINUX_USER64_CS): New. (amd64_linux_read_description): Likewise. (_initialize_amd64_linux_nat): Set to_read_description to amd64_linux_read_description. * amd64-linux-tdep.c: Include "features/i386/amd64-linux.c". (amd64_linux_register_name): Removed. (amd64_linux_register_type): Likewise. (amd64_linux_core_read_description): New. (amd64_linux_init_abi): Set target description to tdesc_amd64_linux if needed. Support orig_rax in target description. Don't call set_gdbarch_register_name nor set_gdbarch_register_type. Call set_gdbarch_core_read_description. (_initialize_amd64_linux_tdep): Call initialize_tdesc_amd64_linux. * amd64-linux-tdep.h (tdesc_amd64_linux): New. * amd64-tdep.c: Include "features/i386/amd64.c". (amd64_register_names): Removed. (amd64_register_name): Likewise. (amd64_register_type): Likewise. (amd64_init_abi): Set num_core_regs and register_names. Set target description to tdesc_amd64 if needed. Don't call set_gdbarch_register_name nor set_gdbarch_register_type. (_initialize_amd64_tdep): New. * i386-linux-nat.c (i386_linux_read_description): New. (_initialize_i386_linux_nat): Set to_read_description to i386_linux_read_description. * i386-linux-tdep.c: Include "features/i386/i386-linux.c". (i386_linux_register_name): Removed. (i386_linux_core_read_description): New. (i386_linux_read_description): Likewise. (i386_linux_init_abi): Don't call set_gdbarch_register_name. Set target description to tdesc_i386_linux if needed. Support orig_eax. Set register_reggroup_p. Call set_gdbarch_core_read_description. (_initialize_i386_linux_tdep): Call initialize_tdesc_i386_linux. * i386-linux-tdep.h (tdesc_i386_linux): New. * i386-nto-tdep.c (i386nto_regset_id): Replace I386_NUM_FREGS with I387_NUM_REGS. * i386-tdep.c: Include "features/i386/i386.c". (i386_register_names): Make it const. (i386_mmx_names): Likewise. (i386_num_register_names): Removed. (i386_register_name): Likewise. (i386_eflags_type): Likewise. (i386_mxcsr_type): Likewise. (i386_sse_type): Likewise. (i386_register_type): Likewise. (i387_ext_type): Call tdesc_find_type instead of arch_float_type. (i386_pseudo_register_name): New. (i386_pseudo_register_type): Likewise. (i386_mmx_type): Make it static. (i386_gdbarch_init): Check arch. Replace I386_NUM_FREGS with I387_NUM_REGS. Set num_core_regs and register_names. Don't call set_gdbarch_register_name nor set_gdbarch_register_type. Set register_reggroup_p. Set target description to tdesc_i386 if needed. Call set_tdesc_pseudo_register_type, set_tdesc_pseudo_register_name and tdesc_use_registers. (_initialize_i386_tdep): Call initialize_tdesc_i386. initialize_tdesc_x86_64. * i386-tdep.h (gdbarch_tdep): Remove i386_eflags_type, i386_mxcsr_type and i386_sse_type. Add num_core_regs, register_names, tdesc and register_reggroup_p. (I386_NUM_FREGS): Removed. (i386_eflags_type): Likewise. (i386_mxcsr_type): Likewise. (i386_mmx_type): Likewise. (i386_sse_type): Likewise. (i386_register_name): Likewise. (i386_regnum): Add I386_MXCSR_REGNUM. (I386_SSE_NUM_REGS): Defined with I386_MXCSR_REGNUM. * i387-tdep.h (I387_NUM_REGS): New. * regformats/i386/i386-linux.dat: Generated. * regformats/i386/i386.dat: Likewise. * regformats/i386/amd64-linux.dat: Likewise. * regformats/i386/amd64.dat: Likewise. * regformats/reg-i386-linux.dat: Removed. * regformats/reg-i386.dat: Likewise. * regformats/reg-x86-64-linux.dat: Likewise. * regformats/reg-x86-64.dat: Likewise. gdb/gdbserver/ 2010-03-01 H.J. Lu <hongjiu.lu@intel.com> * Makefile.in (clean): Replace reg-i386.c, reg-x86-64.c, reg-i386-linux.c and reg-x86-64-linux.c with i386.c, amd64.c, i386-linux.c and amd64-linux.c. (reg-i386.o): Removed. (reg-i386.c): Likewise. (reg-i386-linux.o): Likewise. (reg-i386-linux.c): Likewise. (reg-x86-64.o): Likewise. (reg-x86-64.c): Likewise. (reg-x86-64-linux.o): Likewise. (reg-x86-64-linux.c): Likewise. (i386.o): New. (i386.c): Likewise. (i386-linux.o): Likewise. (i386-linux.c): Likewise. (amd64.o): Likewise. (amd64.c): Likewise. (amd64-linux.o): Likewise. (amd64-linux.c): Likewise. * configure.srv (srv_i386_regobj): New. (srv_i386_linux_regobj): Likewise. (srv_amd64_regobj): Likewise. (srv_amd64_linux_regobj): Likewise. (srv_i386_32bit_xmlfiles): Likewise. (srv_i386_64bit_xmlfiles): Likewise. (srv_i386_xmlfiles): Likewise. (srv_amd64_xmlfiles): Likewise. (srv_i386_linux_xmlfiles): Likewise. (srv_amd64_linux_xmlfiles): Likewise. (i[34567]86-*-cygwin*): Set srv_regobj to $srv_i386_regobj. Set srv_xmlfiles to $srv_i386_xmlfiles. (i[34567]86-*-mingw32ce*): Likewise. (i[34567]86-*-mingw*): Likewise. (i[34567]86-*-nto*): Likewise. (i[34567]86-*-linux*): Set srv_regobj to $srv_i386_linux_regobj and $srv_amd64_linux_regobj. Set srv_xmlfiles to $srv_i386_linux_xmlfiles and $srv_amd64_linux_xmlfiles. (x86_64-*-linux*): Likewise. * linux-x86-low.c (init_registers_x86_64_linux): Removed. (init_registers_amd64_linux): New. (x86_arch_setup): Replace init_registers_x86_64_linux with init_registers_amd64_linux. gdb/testsuite/ 2010-03-01 H.J. Lu <hongjiu.lu@intel.com> * gdb.xml/tdesc-regs.exp (architecture): New. Set it for x86. (load_description): Set architecture if defined.
2010-03-01 16:33:32 +01:00
else
Support amd64 AVX. gdb/ 2010-04-07 H.J. Lu <hongjiu.lu@intel.com> * amd64-linux-nat.c: Include "regset.h", "elf/common.h", <sys/uio.h> and "i386-xstate.h". (PTRACE_GETREGSET): New. (PTRACE_SETREGSET): Likewise. (have_ptrace_getregset): Likewise. (amd64_linux_gregset64_reg_offset): Include 16 upper YMM registers. (amd64_linux_gregset32_reg_offset): Include 8 upper YMM registers. (amd64_linux_fetch_inferior_registers): Support PTRACE_GETFPREGS. (amd64_linux_store_inferior_registers): Likewise. (amd64_linux_read_description): Check and enable AVX target descriptions. * amd64-linux-tdep.c: Include "regset.h", "i386-linux-tdep.h" and "features/i386/amd64-avx-linux.c". (amd64_linux_regset_sections): New. (amd64_linux_core_read_description): Check and enable AVX target description. (amd64_linux_init_abi): Set xsave_xcr0_offset. Call set_gdbarch_core_regset_sections. (_initialize_amd64_linux_tdep): Call initialize_tdesc_amd64_avx_linux. * amd64-linux-tdep.h (AMD64_LINUX_ORIG_RAX_REGNUM): Replace AMD64_MXCSR_REGNUM with AMD64_YMM15H_REGNUM. (tdesc_amd64_avx_linux): New. (amd64_linux_update_xstateregset): Likewise. * amd64-tdep.c: Include "features/i386/amd64-avx.c". (amd64_ymm_names): New. (amd64_ymmh_names): Likewise. (amd64_register_name): Likewise. (amd64_supply_xstateregset): Likewise. (amd64_collect_xstateregset): Likewise. (amd64_supply_xsave): Likewise. (amd64_collect_xsave): Likewise. (AMD64_NUM_REGS): Removed. (amd64_dwarf_reg_to_regnum): Return %ymmN register number for %xmmN if AVX is available. (amd64_pseudo_register_name): Support pseudo YMM registers. (amd64_regset_from_core_section): Support .reg-xstate section. (amd64_init_abi): Set ymmh_register_names, num_ymm_regs and ymm0h_regnum. Call set_gdbarch_register_name. (amd64_init_abi): Call initialize_tdesc_amd64_avx. * amd64-tdep.h (amd64_regnum): Add AMD64_YMM0H_REGNUM and AMD64_YMM15H_REGNUM. (AMD64_NUM_REGS): New. (amd64_supply_xsave): Likewise. (amd64_collect_xsave): Likewise. (amd64_register_name): Removed. (amd64_register_type): Likewise. gdb/testsuite/ 2010-04-07 H.J. Lu <hongjiu.lu@intel.com> * gdb.arch/i386-avx.c: New. * gdb.arch/i386-avx.exp: Likewise. * gdb.arch/i386-cpuid.h: Updated from gcc 4.4.
2010-04-07 20:46:50 +02:00
{
if (is_64bit)
{
if (is_x32)
return tdesc_x32_linux;
else
return tdesc_amd64_linux;
}
Support amd64 AVX. gdb/ 2010-04-07 H.J. Lu <hongjiu.lu@intel.com> * amd64-linux-nat.c: Include "regset.h", "elf/common.h", <sys/uio.h> and "i386-xstate.h". (PTRACE_GETREGSET): New. (PTRACE_SETREGSET): Likewise. (have_ptrace_getregset): Likewise. (amd64_linux_gregset64_reg_offset): Include 16 upper YMM registers. (amd64_linux_gregset32_reg_offset): Include 8 upper YMM registers. (amd64_linux_fetch_inferior_registers): Support PTRACE_GETFPREGS. (amd64_linux_store_inferior_registers): Likewise. (amd64_linux_read_description): Check and enable AVX target descriptions. * amd64-linux-tdep.c: Include "regset.h", "i386-linux-tdep.h" and "features/i386/amd64-avx-linux.c". (amd64_linux_regset_sections): New. (amd64_linux_core_read_description): Check and enable AVX target description. (amd64_linux_init_abi): Set xsave_xcr0_offset. Call set_gdbarch_core_regset_sections. (_initialize_amd64_linux_tdep): Call initialize_tdesc_amd64_avx_linux. * amd64-linux-tdep.h (AMD64_LINUX_ORIG_RAX_REGNUM): Replace AMD64_MXCSR_REGNUM with AMD64_YMM15H_REGNUM. (tdesc_amd64_avx_linux): New. (amd64_linux_update_xstateregset): Likewise. * amd64-tdep.c: Include "features/i386/amd64-avx.c". (amd64_ymm_names): New. (amd64_ymmh_names): Likewise. (amd64_register_name): Likewise. (amd64_supply_xstateregset): Likewise. (amd64_collect_xstateregset): Likewise. (amd64_supply_xsave): Likewise. (amd64_collect_xsave): Likewise. (AMD64_NUM_REGS): Removed. (amd64_dwarf_reg_to_regnum): Return %ymmN register number for %xmmN if AVX is available. (amd64_pseudo_register_name): Support pseudo YMM registers. (amd64_regset_from_core_section): Support .reg-xstate section. (amd64_init_abi): Set ymmh_register_names, num_ymm_regs and ymm0h_regnum. Call set_gdbarch_register_name. (amd64_init_abi): Call initialize_tdesc_amd64_avx. * amd64-tdep.h (amd64_regnum): Add AMD64_YMM0H_REGNUM and AMD64_YMM15H_REGNUM. (AMD64_NUM_REGS): New. (amd64_supply_xsave): Likewise. (amd64_collect_xsave): Likewise. (amd64_register_name): Removed. (amd64_register_type): Likewise. gdb/testsuite/ 2010-04-07 H.J. Lu <hongjiu.lu@intel.com> * gdb.arch/i386-avx.c: New. * gdb.arch/i386-avx.exp: Likewise. * gdb.arch/i386-cpuid.h: Updated from gcc 4.4.
2010-04-07 20:46:50 +02:00
else
return tdesc_i386_linux;
}
Enable XML target descriptions for x86. gdb/ 2010-03-01 H.J. Lu <hongjiu.lu@intel.com> * amd64-linux-nat.c (AMD64_LINUX_USER64_CS): New. (amd64_linux_read_description): Likewise. (_initialize_amd64_linux_nat): Set to_read_description to amd64_linux_read_description. * amd64-linux-tdep.c: Include "features/i386/amd64-linux.c". (amd64_linux_register_name): Removed. (amd64_linux_register_type): Likewise. (amd64_linux_core_read_description): New. (amd64_linux_init_abi): Set target description to tdesc_amd64_linux if needed. Support orig_rax in target description. Don't call set_gdbarch_register_name nor set_gdbarch_register_type. Call set_gdbarch_core_read_description. (_initialize_amd64_linux_tdep): Call initialize_tdesc_amd64_linux. * amd64-linux-tdep.h (tdesc_amd64_linux): New. * amd64-tdep.c: Include "features/i386/amd64.c". (amd64_register_names): Removed. (amd64_register_name): Likewise. (amd64_register_type): Likewise. (amd64_init_abi): Set num_core_regs and register_names. Set target description to tdesc_amd64 if needed. Don't call set_gdbarch_register_name nor set_gdbarch_register_type. (_initialize_amd64_tdep): New. * i386-linux-nat.c (i386_linux_read_description): New. (_initialize_i386_linux_nat): Set to_read_description to i386_linux_read_description. * i386-linux-tdep.c: Include "features/i386/i386-linux.c". (i386_linux_register_name): Removed. (i386_linux_core_read_description): New. (i386_linux_read_description): Likewise. (i386_linux_init_abi): Don't call set_gdbarch_register_name. Set target description to tdesc_i386_linux if needed. Support orig_eax. Set register_reggroup_p. Call set_gdbarch_core_read_description. (_initialize_i386_linux_tdep): Call initialize_tdesc_i386_linux. * i386-linux-tdep.h (tdesc_i386_linux): New. * i386-nto-tdep.c (i386nto_regset_id): Replace I386_NUM_FREGS with I387_NUM_REGS. * i386-tdep.c: Include "features/i386/i386.c". (i386_register_names): Make it const. (i386_mmx_names): Likewise. (i386_num_register_names): Removed. (i386_register_name): Likewise. (i386_eflags_type): Likewise. (i386_mxcsr_type): Likewise. (i386_sse_type): Likewise. (i386_register_type): Likewise. (i387_ext_type): Call tdesc_find_type instead of arch_float_type. (i386_pseudo_register_name): New. (i386_pseudo_register_type): Likewise. (i386_mmx_type): Make it static. (i386_gdbarch_init): Check arch. Replace I386_NUM_FREGS with I387_NUM_REGS. Set num_core_regs and register_names. Don't call set_gdbarch_register_name nor set_gdbarch_register_type. Set register_reggroup_p. Set target description to tdesc_i386 if needed. Call set_tdesc_pseudo_register_type, set_tdesc_pseudo_register_name and tdesc_use_registers. (_initialize_i386_tdep): Call initialize_tdesc_i386. initialize_tdesc_x86_64. * i386-tdep.h (gdbarch_tdep): Remove i386_eflags_type, i386_mxcsr_type and i386_sse_type. Add num_core_regs, register_names, tdesc and register_reggroup_p. (I386_NUM_FREGS): Removed. (i386_eflags_type): Likewise. (i386_mxcsr_type): Likewise. (i386_mmx_type): Likewise. (i386_sse_type): Likewise. (i386_register_name): Likewise. (i386_regnum): Add I386_MXCSR_REGNUM. (I386_SSE_NUM_REGS): Defined with I386_MXCSR_REGNUM. * i387-tdep.h (I387_NUM_REGS): New. * regformats/i386/i386-linux.dat: Generated. * regformats/i386/i386.dat: Likewise. * regformats/i386/amd64-linux.dat: Likewise. * regformats/i386/amd64.dat: Likewise. * regformats/reg-i386-linux.dat: Removed. * regformats/reg-i386.dat: Likewise. * regformats/reg-x86-64-linux.dat: Likewise. * regformats/reg-x86-64.dat: Likewise. gdb/gdbserver/ 2010-03-01 H.J. Lu <hongjiu.lu@intel.com> * Makefile.in (clean): Replace reg-i386.c, reg-x86-64.c, reg-i386-linux.c and reg-x86-64-linux.c with i386.c, amd64.c, i386-linux.c and amd64-linux.c. (reg-i386.o): Removed. (reg-i386.c): Likewise. (reg-i386-linux.o): Likewise. (reg-i386-linux.c): Likewise. (reg-x86-64.o): Likewise. (reg-x86-64.c): Likewise. (reg-x86-64-linux.o): Likewise. (reg-x86-64-linux.c): Likewise. (i386.o): New. (i386.c): Likewise. (i386-linux.o): Likewise. (i386-linux.c): Likewise. (amd64.o): Likewise. (amd64.c): Likewise. (amd64-linux.o): Likewise. (amd64-linux.c): Likewise. * configure.srv (srv_i386_regobj): New. (srv_i386_linux_regobj): Likewise. (srv_amd64_regobj): Likewise. (srv_amd64_linux_regobj): Likewise. (srv_i386_32bit_xmlfiles): Likewise. (srv_i386_64bit_xmlfiles): Likewise. (srv_i386_xmlfiles): Likewise. (srv_amd64_xmlfiles): Likewise. (srv_i386_linux_xmlfiles): Likewise. (srv_amd64_linux_xmlfiles): Likewise. (i[34567]86-*-cygwin*): Set srv_regobj to $srv_i386_regobj. Set srv_xmlfiles to $srv_i386_xmlfiles. (i[34567]86-*-mingw32ce*): Likewise. (i[34567]86-*-mingw*): Likewise. (i[34567]86-*-nto*): Likewise. (i[34567]86-*-linux*): Set srv_regobj to $srv_i386_linux_regobj and $srv_amd64_linux_regobj. Set srv_xmlfiles to $srv_i386_linux_xmlfiles and $srv_amd64_linux_xmlfiles. (x86_64-*-linux*): Likewise. * linux-x86-low.c (init_registers_x86_64_linux): Removed. (init_registers_amd64_linux): New. (x86_arch_setup): Replace init_registers_x86_64_linux with init_registers_amd64_linux. gdb/testsuite/ 2010-03-01 H.J. Lu <hongjiu.lu@intel.com> * gdb.xml/tdesc-regs.exp (architecture): New. Set it for x86. (load_description): Set architecture if defined.
2010-03-01 16:33:32 +01:00
}
/* Enable branch tracing. */
static struct btrace_target_info *
amd64_linux_enable_btrace (struct target_ops *self, ptid_t ptid)
{
struct btrace_target_info *tinfo;
struct gdbarch *gdbarch;
errno = 0;
tinfo = linux_enable_btrace (ptid);
if (tinfo == NULL)
error (_("Could not enable branch tracing for %s: %s."),
target_pid_to_str (ptid), safe_strerror (errno));
/* Fill in the size of a pointer in bits. */
gdbarch = target_thread_architecture (ptid);
tinfo->ptr_bits = gdbarch_ptr_bit (gdbarch);
return tinfo;
}
/* Disable branch tracing. */
static void
amd64_linux_disable_btrace (struct target_ops *self,
struct btrace_target_info *tinfo)
{
btrace, gdbserver: read branch trace incrementally Read branch trace data incrementally and extend the current trace rather than discarding it and reading the entire trace buffer each time. If the branch trace buffer overflowed, we can't extend the current trace so we discard it and start anew by reading the entire branch trace buffer. 2014-01-16 Markus Metzger <markus.t.metzger@intel.com> * common/linux-btrace.c (perf_event_read_bts, linux_read_btrace): Support delta reads. (linux_disable_btrace): Change return type. * common/linux-btrace.h (linux_read_btrace): Change parameters and return type to allow error reporting. Update users. (linux_disable_btrace): Change return type. Update users. * common/btrace-common.h (btrace_read_type) <BTRACE_READ_DELTA>: New. (btrace_error): New. (btrace_block) <begin>: Comment on BEGIN == 0. * btrace.c (btrace_compute_ftrace): Start from the end of the current trace. (btrace_stitch_trace, btrace_clear_history): New. (btrace_fetch): Read delta trace, return if replaying. (btrace_clear): Move clear history code to btrace_clear_history. (parse_xml_btrace): Throw an error if parsing failed. * target.h (struct target_ops) <to_read_btrace>: Change parameters and return type to allow error reporting. (target_read_btrace): Change parameters and return type to allow error reporting. * target.c (target_read_btrace): Update. * remote.c (remote_read_btrace): Support delta reads. Pass errors on. * NEWS: Announce it. gdbserver/ * target.h (target_ops) <read_btrace>: Change parameters and return type to allow error reporting. * server.c (handle_qxfer_btrace): Support delta reads. Pass trace reading errors on. * linux-low.c (linux_low_read_btrace): Pass trace reading errors on. (linux_low_disable_btrace): New.
2013-06-03 15:39:35 +02:00
enum btrace_error errcode = linux_disable_btrace (tinfo);
btrace, gdbserver: read branch trace incrementally Read branch trace data incrementally and extend the current trace rather than discarding it and reading the entire trace buffer each time. If the branch trace buffer overflowed, we can't extend the current trace so we discard it and start anew by reading the entire branch trace buffer. 2014-01-16 Markus Metzger <markus.t.metzger@intel.com> * common/linux-btrace.c (perf_event_read_bts, linux_read_btrace): Support delta reads. (linux_disable_btrace): Change return type. * common/linux-btrace.h (linux_read_btrace): Change parameters and return type to allow error reporting. Update users. (linux_disable_btrace): Change return type. Update users. * common/btrace-common.h (btrace_read_type) <BTRACE_READ_DELTA>: New. (btrace_error): New. (btrace_block) <begin>: Comment on BEGIN == 0. * btrace.c (btrace_compute_ftrace): Start from the end of the current trace. (btrace_stitch_trace, btrace_clear_history): New. (btrace_fetch): Read delta trace, return if replaying. (btrace_clear): Move clear history code to btrace_clear_history. (parse_xml_btrace): Throw an error if parsing failed. * target.h (struct target_ops) <to_read_btrace>: Change parameters and return type to allow error reporting. (target_read_btrace): Change parameters and return type to allow error reporting. * target.c (target_read_btrace): Update. * remote.c (remote_read_btrace): Support delta reads. Pass errors on. * NEWS: Announce it. gdbserver/ * target.h (target_ops) <read_btrace>: Change parameters and return type to allow error reporting. * server.c (handle_qxfer_btrace): Support delta reads. Pass trace reading errors on. * linux-low.c (linux_low_read_btrace): Pass trace reading errors on. (linux_low_disable_btrace): New.
2013-06-03 15:39:35 +02:00
if (errcode != BTRACE_ERR_NONE)
error (_("Could not disable branch tracing."));
}
/* Teardown branch tracing. */
static void
amd64_linux_teardown_btrace (struct target_ops *self,
struct btrace_target_info *tinfo)
{
/* Ignore errors. */
linux_disable_btrace (tinfo);
}
static enum btrace_error
amd64_linux_read_btrace (struct target_ops *self,
VEC (btrace_block_s) **data,
struct btrace_target_info *btinfo,
enum btrace_read_type type)
{
return linux_read_btrace (data, btinfo, type);
}
/* Provide a prototype to silence -Wmissing-prototypes. */
void _initialize_amd64_linux_nat (void);
void
_initialize_amd64_linux_nat (void)
{
* Makefile.in (ALLDEPFILES): Update. (alpha-linux-nat.o, sparc-linux-nat.o): New rules. (amd64-linux-nat.o, arm-linux-nat.o, hppa-linux-nat.o) (i386-linux-nat.o, ia64-linux-nat.o, linux-nat.o, m32r-linux-nat.o) (m68klinux-nat.o, mips-linux-nat.o, ppc-linux-nat.o, s390-nat.o) (sparc64-linux-nat.o): Update dependencies. * alpha-linux-nat.c, sparc-linux-nat.c: New files. * amd64-linux-nat.c (amd64_linux_fetch_inferior_registers): Renamed from fetch_inferior_registers and made static. (amd64_linux_store_inferior_registers): Renamed from store_inferior_registers and made static. (amd64_linux_child_post_start_inferior): Renamed from child_post_startup_inferior and made static. Call super_post_startup_inferior. (super_post_startup_inferior): New. (_initialize_amd64_linux_nat): Set it. Call linux_target and add_target. * arm-linux-nat.c (arm_linux_fetch_inferior_registers): Renamed from fetch_inferior_registers and made static. (arm_linux_store_inferior_registers): Renamed from store_inferior_registers and made static. (_initialize_arm_linux_nat): Add a prototype. Use linux_target and add_target. * hppa-linux-nat.c (hppa_linux_fetch_inferior_registers): Renamed from fetch_inferior_registers and made static. (hppa_linux_store_inferior_registers): Renamed from store_inferior_registers and made static. (_initialize_hppa_linux_nat): New function. * i386-linux-nat.c (i386_linux_fetch_inferior_registers): Renamed from fetch_inferior_registers and made static. (i386_linux_store_inferior_registers): Renamed from store_inferior_registers and made static. (i386_linux_resume): Renamed from child_resume and made static. (i386_linux_child_post_start_inferior): Renamed from child_post_startup_inferior and made static. Call super_post_startup_inferior. (super_post_startup_inferior): New. (_initialize_i386_linux_nat): New function. * i386-nat.c: Remove LINUX_CHILD_POST_STARTUP_INFERIOR #ifndef. * ia64-linux-nat.c (ia64_linux_xfer_unwind_table): Remove. (super_xfer_partial): New. (ia64_linux_xfer_partial): New function. Use it. (_initialize_ia64_linux_nat): New function. * ia64-tdep.c (getunwind_table): Revert 2005-06-08 change; use target_read_partial and document the problem. * inf-ptrace.c (inf_ptrace_fetch_register): Use CANNOT_FETCH_REGISTER. Fix some comments. (inf_ptrace_store_register): Use CANNOT_STORE_REGISTER. Fix some comments. * linux-nat.c: Include "inf-ptrace.h" and "auxv.h". (linux_ops, super_xfer_partial): New variables. (linux_child_post_startup_inferior): Make static. (child_post_startup_inferior): Delete. (linux_nat_attach, linux_nat_detach, resume_callback) (linux_nat_resume, linux_nat_wait, linux_nat_create_inferior) (linux_nat_mourn_inferior): Use linux_ops instead of deprecated_child_ops. (child_wait): Do not depend on CHILD_WAIT. (linux_nat_xfer_memory): Remove, replace by ... (linux_nat_xfer_partial): ... this. Use linux_ops->to_xfer_partial instead of linux_proc_xfer_memory and child_xfer_memory. (linux_nat_fetch_registers, linux_nat_store_registers) (linux_nat_child_post_startup_inferior): New functions. (init_linux_nat_ops): Use the new functions. (linux_proc_xfer_memory): Remove, replace by ... (linux_proc_xfer_partial): ... this. Make static. (linux_xfer_partial, linux_register_u_offset, linux_target): New functions. (_initialize_linux_nat): Do not modify deprecated_child_ops. * linux-nat.h (linux_proc_xfer_memory): Remove prototype. (struct mem_attrib, struct target_ops): Remove forward declarations. (linux_child_post_startup_inferior): Remove prototype. (linux_target): Add prototype. * linux-thread-db.c (thread_db_xfer_memory): Remove, replace by ... (thread_db_xfer_partial): ... this. (init_thread_db_ops): Set to_xfer_partial instead of deprecated_xfer_memory. * m32r-linux-nat.c (m32r_linux_fetch_inferior_registers): Renamed from fetch_inferior_registers and made static. (m32r_linux_store_inferior_registers): Renamed from store_inferior_registers and made static. (_initialize_m32r_linux_nat): New function. * m68klinux-nat.c (m68k_linux_fetch_inferior_registers): Renamed from fetch_inferior_registers and made static. (m68k_linux_store_inferior_registers): Renamed from store_inferior_registers and made static. (old_fetch_inferior_registers, old_store_inferior_registers): Made static. (_initialize_m68k_linux_nat): Use linux_target and add_target. * mips-linux-nat.c (_initialize_mips_linux_nat): New function. * ppc-linux-nat.c (ppc_linux_fetch_inferior_registers): Renamed from fetch_inferior_registers and made static. (ppc_linux_store_inferior_registers): Renamed from store_inferior_registers and made static. (_initialize_ppc_linux_nat): New function. * s390-nat.c (s390_linux_fetch_inferior_registers): Renamed from fetch_inferior_registers and made static. (s390_linux_store_inferior_registers): Renamed from store_inferior_registers and made static. (_initialize_s390_nat): New function. * sparc64-linux-nat.c (_initialize_sparc64_linux_nat): Use linux_target and add_target. * config/nm-linux.h: Don't include "auxv.h". (struct target_waitstatus, child_wait, CHILD_WAIT) (CHILD_PID_TO_EXEC_FILE, CHILD_INSERT_FORK_CATCHPOINT) (CHILD_INSERT_VFORK_CATCHPOINT, CHILD_INSERT_EXEC_CATCHPOINT) (CHILD_POST_STARTUP_INFERIOR, CHILD_POST_ATTACH, CHILD_FOLLOW_FORK) (DEPRECATED_KILL_INFERIOR, NATIVE_XFER_AUXV): Delete. * config/alpha/alpha-linux.mh (NATDEPFILES): Replace infptrace.o and inftarg.o with inf-ptrace.o and alpha-linux-nat.o. * config/sparc/linux.mh (NATDEPFILES): Replace infptrace.o and inftarg.o with sparc-linux-nat.o. * config/sparc/linux64.mh (NATDEPFILES): Remove infptrace.o and inftarg.o. * config/arm/linux.mh (NATDEPFILES): Replace infptrace.o and inftarg.o with inf-ptrace.o. * 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/s390/s390.mh (NATDEPFILES): Likewise. * config/i386/nm-linux.h (DEPRECATED_CHILD_RESUME): Don't define. (LINUX_CHILD_POST_STARTUP_INFERIOR): Don't define. * config/i386/nm-linux64.h (LINUX_CHILD_POST_STARTUP_INFERIOR): Don't define. * config/ia64/nm-linux.h: Don't include "target.h". (NATIVE_XFER_UNWIND_TABLE, ia64_linux_xfer_unwind_table): Remove. * config/djgpp/fnchange.lst: Add alpha-linux-tdep.c, alpha-linux-nat.c, sparc-linux-tdep.c, and sparc-linux-nat.c.
2005-09-10 20:11:14 +02:00
struct target_ops *t;
amd64_native_gregset32_reg_offset = amd64_linux_gregset32_reg_offset;
amd64_native_gregset32_num_regs = I386_LINUX_NUM_REGS;
amd64_native_gregset64_reg_offset = amd64_linux_gregset_reg_offset;
amd64_native_gregset64_num_regs = AMD64_LINUX_NUM_REGS;
gdb_assert (ARRAY_SIZE (amd64_linux_gregset32_reg_offset)
== amd64_native_gregset32_num_regs);
* Makefile.in (ALLDEPFILES): Update. (alpha-linux-nat.o, sparc-linux-nat.o): New rules. (amd64-linux-nat.o, arm-linux-nat.o, hppa-linux-nat.o) (i386-linux-nat.o, ia64-linux-nat.o, linux-nat.o, m32r-linux-nat.o) (m68klinux-nat.o, mips-linux-nat.o, ppc-linux-nat.o, s390-nat.o) (sparc64-linux-nat.o): Update dependencies. * alpha-linux-nat.c, sparc-linux-nat.c: New files. * amd64-linux-nat.c (amd64_linux_fetch_inferior_registers): Renamed from fetch_inferior_registers and made static. (amd64_linux_store_inferior_registers): Renamed from store_inferior_registers and made static. (amd64_linux_child_post_start_inferior): Renamed from child_post_startup_inferior and made static. Call super_post_startup_inferior. (super_post_startup_inferior): New. (_initialize_amd64_linux_nat): Set it. Call linux_target and add_target. * arm-linux-nat.c (arm_linux_fetch_inferior_registers): Renamed from fetch_inferior_registers and made static. (arm_linux_store_inferior_registers): Renamed from store_inferior_registers and made static. (_initialize_arm_linux_nat): Add a prototype. Use linux_target and add_target. * hppa-linux-nat.c (hppa_linux_fetch_inferior_registers): Renamed from fetch_inferior_registers and made static. (hppa_linux_store_inferior_registers): Renamed from store_inferior_registers and made static. (_initialize_hppa_linux_nat): New function. * i386-linux-nat.c (i386_linux_fetch_inferior_registers): Renamed from fetch_inferior_registers and made static. (i386_linux_store_inferior_registers): Renamed from store_inferior_registers and made static. (i386_linux_resume): Renamed from child_resume and made static. (i386_linux_child_post_start_inferior): Renamed from child_post_startup_inferior and made static. Call super_post_startup_inferior. (super_post_startup_inferior): New. (_initialize_i386_linux_nat): New function. * i386-nat.c: Remove LINUX_CHILD_POST_STARTUP_INFERIOR #ifndef. * ia64-linux-nat.c (ia64_linux_xfer_unwind_table): Remove. (super_xfer_partial): New. (ia64_linux_xfer_partial): New function. Use it. (_initialize_ia64_linux_nat): New function. * ia64-tdep.c (getunwind_table): Revert 2005-06-08 change; use target_read_partial and document the problem. * inf-ptrace.c (inf_ptrace_fetch_register): Use CANNOT_FETCH_REGISTER. Fix some comments. (inf_ptrace_store_register): Use CANNOT_STORE_REGISTER. Fix some comments. * linux-nat.c: Include "inf-ptrace.h" and "auxv.h". (linux_ops, super_xfer_partial): New variables. (linux_child_post_startup_inferior): Make static. (child_post_startup_inferior): Delete. (linux_nat_attach, linux_nat_detach, resume_callback) (linux_nat_resume, linux_nat_wait, linux_nat_create_inferior) (linux_nat_mourn_inferior): Use linux_ops instead of deprecated_child_ops. (child_wait): Do not depend on CHILD_WAIT. (linux_nat_xfer_memory): Remove, replace by ... (linux_nat_xfer_partial): ... this. Use linux_ops->to_xfer_partial instead of linux_proc_xfer_memory and child_xfer_memory. (linux_nat_fetch_registers, linux_nat_store_registers) (linux_nat_child_post_startup_inferior): New functions. (init_linux_nat_ops): Use the new functions. (linux_proc_xfer_memory): Remove, replace by ... (linux_proc_xfer_partial): ... this. Make static. (linux_xfer_partial, linux_register_u_offset, linux_target): New functions. (_initialize_linux_nat): Do not modify deprecated_child_ops. * linux-nat.h (linux_proc_xfer_memory): Remove prototype. (struct mem_attrib, struct target_ops): Remove forward declarations. (linux_child_post_startup_inferior): Remove prototype. (linux_target): Add prototype. * linux-thread-db.c (thread_db_xfer_memory): Remove, replace by ... (thread_db_xfer_partial): ... this. (init_thread_db_ops): Set to_xfer_partial instead of deprecated_xfer_memory. * m32r-linux-nat.c (m32r_linux_fetch_inferior_registers): Renamed from fetch_inferior_registers and made static. (m32r_linux_store_inferior_registers): Renamed from store_inferior_registers and made static. (_initialize_m32r_linux_nat): New function. * m68klinux-nat.c (m68k_linux_fetch_inferior_registers): Renamed from fetch_inferior_registers and made static. (m68k_linux_store_inferior_registers): Renamed from store_inferior_registers and made static. (old_fetch_inferior_registers, old_store_inferior_registers): Made static. (_initialize_m68k_linux_nat): Use linux_target and add_target. * mips-linux-nat.c (_initialize_mips_linux_nat): New function. * ppc-linux-nat.c (ppc_linux_fetch_inferior_registers): Renamed from fetch_inferior_registers and made static. (ppc_linux_store_inferior_registers): Renamed from store_inferior_registers and made static. (_initialize_ppc_linux_nat): New function. * s390-nat.c (s390_linux_fetch_inferior_registers): Renamed from fetch_inferior_registers and made static. (s390_linux_store_inferior_registers): Renamed from store_inferior_registers and made static. (_initialize_s390_nat): New function. * sparc64-linux-nat.c (_initialize_sparc64_linux_nat): Use linux_target and add_target. * config/nm-linux.h: Don't include "auxv.h". (struct target_waitstatus, child_wait, CHILD_WAIT) (CHILD_PID_TO_EXEC_FILE, CHILD_INSERT_FORK_CATCHPOINT) (CHILD_INSERT_VFORK_CATCHPOINT, CHILD_INSERT_EXEC_CATCHPOINT) (CHILD_POST_STARTUP_INFERIOR, CHILD_POST_ATTACH, CHILD_FOLLOW_FORK) (DEPRECATED_KILL_INFERIOR, NATIVE_XFER_AUXV): Delete. * config/alpha/alpha-linux.mh (NATDEPFILES): Replace infptrace.o and inftarg.o with inf-ptrace.o and alpha-linux-nat.o. * config/sparc/linux.mh (NATDEPFILES): Replace infptrace.o and inftarg.o with sparc-linux-nat.o. * config/sparc/linux64.mh (NATDEPFILES): Remove infptrace.o and inftarg.o. * config/arm/linux.mh (NATDEPFILES): Replace infptrace.o and inftarg.o with inf-ptrace.o. * 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/s390/s390.mh (NATDEPFILES): Likewise. * config/i386/nm-linux.h (DEPRECATED_CHILD_RESUME): Don't define. (LINUX_CHILD_POST_STARTUP_INFERIOR): Don't define. * config/i386/nm-linux64.h (LINUX_CHILD_POST_STARTUP_INFERIOR): Don't define. * config/ia64/nm-linux.h: Don't include "target.h". (NATIVE_XFER_UNWIND_TABLE, ia64_linux_xfer_unwind_table): Remove. * config/djgpp/fnchange.lst: Add alpha-linux-tdep.c, alpha-linux-nat.c, sparc-linux-tdep.c, and sparc-linux-nat.c.
2005-09-10 20:11:14 +02:00
/* Fill in the generic GNU/Linux methods. */
t = linux_target ();
i386_use_watchpoints (t);
Remove all i386 debug register low level macros in config nm files. (I386_DR_LOW_SET_ADDR, I386_DR_LOW_RESET_ADDR): Remove. (I386_DR_LOW_GET_STATUS, I386_DR_LOW_SET_CONTROL): Remove. (I386_USE_GENERIC_WATCHPOIINTS): Remove. * i386-nat.h: New file (adapted from config/i386/nm-i386.h). (struct i386_dr_low_type): New type. (i386_dr_low): New global variable. * i386-nat.c (TARGET_HAS_DR_LEN_8): Update macro. (i386_insert_aligned_watchpoint): Replace i386 dr low macros by i386_dr_low struct variable fields. (i386_remove_aligned_watchpoint): Likewise. (i386_stopped_data_address): Likewise. (i386_stopped_by_hwbp): Likewise. (show_debug_regs_command_added): New static variable. (add_show_debug_regs_command): New static function. (i386_use_watchpoints): Call add_show_debug_regs_command if not done. (i386_set_debug_register_length): New function. (_initialize_i386_nat): Delete. * amd64-linux-nat.c: Include "i386-nat.h". (amd64_linux_dr_set_control): Change to static. (amd64_linux_dr_get_status): Change to static. (amd64_linux_dr_set_addr,amd64_linux_dr_reset_addr): Likewise. (_initialize_amd64_linux_nat): Set i386_dr_low variable fields. * go32-nat.c: Include "i386-nat.h". (go32_set_addr): Change to static. (go32_set_dr7): Change to static. Change arg type to unisgned long. (go32_get_dr6): Change to static. Change return type to unisnged long. (init_go32_ops): Set i386_dr_low variable fields. * i386-linux-nat.c: Include "i386-nat.h". (i386_linux_dr_set_control, i386_linux_dr_get_status): Change to static. (i386_linux_dr_set_addr, i386_linux_dr_reset_addr): Idem. (_initialize_i386_linux_nat): Set i386_dr_low variable fields. * i386bsd-nat.h: Declare functions used for i386_dr_low fields in i386fbsd-nat.c. * i386fbsd-nat.c: Include "i386-nat.h". (_initialize_i386fbsd_nat): Set i386_dr_low variable fields. * windows-nat.c: Include "i386-nat.h". (cygwin_set_dr, cygwin_get_dr6, cygwin_set_dr7): Add prototypes. Change to static. (cygwin_get_dr6): Change return type to unisnged long. (cygwin_set_dr7): Change arg type to unisgned long. (init_windows_ops): Set i386_dr_low function fields. * amd64-windows-nat.c (_initialize_amd64_windows_nat): Call i386_set_debug_register_length. * i386-windows-nat.c (_initialize_i386_windows_nat): Likewise. * config/i386/nm-cygwin.h: Remove all I386_* macros. * config/i386/nm-cygwin64.h: Likewise. * config/i386/nm-fbsd.h: Likewise. * config/i386/nm-linux.h: Likewise. * config/i386/nm-i386.h: Remove completely. * config/i386/nm-go32.h: Remove completely. * config/i386/nm-linux64.h: Remove completely. * config/i386/go32.mh (NAT_FILE): Remove entry. * config/i386/linux64.h (NAT_FILE): Change to config/nm-linux.h.
2009-05-14 11:37:00 +02:00
i386_dr_low.set_control = amd64_linux_dr_set_control;
i386_dr_low.set_addr = amd64_linux_dr_set_addr;
gdb/ 2011-12-14 Pedro Alves <pedro@codesourcery.com> PR threads/10729 * linux-nat.c (linux_nat_new_thread): Change parameter to an lwp pointer. (linux_nat_prepare_to_resume): New global. (lwp_free): New. (purge_lwp_list): Use it. (add_lwp): Call linux_nat_new_thread even on the first LWP. Adjust to interface change. (delete_lwp): Call lwp_free instead of xfree. (detach_callback, linux_nat_detach, resume_lwp, linux_nat_resume) (linux_handle_syscall_trap, linux_handle_extended_wait) (linux_nat_filter_event, resume_stopped_resumed_lwps): Call linux_nat_prepare_to_resume before resuming. (linux_stop_lwp): New. (linux_nat_set_new_thread): Adjust. (linux_nat_set_prepare_to_resume): New. * linux-nat.h (struct arch_lwp_info): Forward declare. (struct lwp_info) <arch_private>: New field. (linux_stop_lwp): Declare. (linux_nat_set_new_thread): Adjust. (linux_nat_set_prepare_to_resume): New. * i386-nat.c (DR_NADDR, DR_STATUS, DR_CONTROL) (struct i386_debug_reg_state): Move to i386-nat.h. (dr_mirror): Comment. (i386_debug_reg_state): New. (i386_update_inferior_debug_regs): Simplify. (i386_stopped_data_address): Use the debug register state from the inferior, not from the local cache. * i386-nat.h (struct i386_dr_low_type): Delete reset_addr and unset_status fields. New get_addr and get_control fields. (DR_FIRSTADDR, DR_LASTADDR, DR_CONTROL): Moved from i386-nat.c. (DR_NADDR, DR_STATUS): New. (struct i386_debug_reg_state): Moved from i386-nat.c. * amd64-linux-nat.c (struct arch_lwp_info): New. (amd64_linux_dr): Delete global. (amd64_linux_dr_get_addr): New. (amd64_linux_dr_get_control): New. (amd64_linux_dr_unset_status): Delete. (amd64_linux_dr_set_addr): Reimplement. (amd64_linux_dr_reset_addr): Delete. (update_debug_registers_callback): New. (amd64_linux_dr_set_control): Reimplement. (amd64_linux_dr_set_addr): Reimplement. (amd64_linux_prepare_to_resume): New. (amd64_linux_new_thread): Change parameter to an lwp pointer. Reimplement. (_initialize_amd64_linux_nat): No longer install i386_dr_low.reset_addr and i386_dr_low.unset_status. Install amd64_linux_dr_get_control as i386_dr_low.get_control. Install amd64_linux_dr_get_addr as i386_dr_low.get_addr. Install amd64_linux_prepare_to_resume. * i386-linux-nat.c (DR_FIRSTADDR, DR_LASTADDR, DR_STATUS) (DR_CONTROL): Delete. (struct arch_lwp_info): New. (i386_linux_dr): Delete global. (i386_linux_dr_set_control): Reimplement. (i386_linux_dr_get_addr): New. (i386_linux_dr_set_addr): Reimplement. (i386_linux_dr_get_control): New. (update_debug_registers_callback): New. (i386_linux_dr_unset_status): Delete. (i386_linux_dr_set_addr): Reimplement. (i386_linux_prepare_to_resume): New. (i386_linux_new_thread): Change parameter to an lwp pointer. Reimplement. (_initialize_i386_linux_nat): No longer install i386_dr_low.reset_addr and i386_dr_low.unset_status. Install i386_linux_dr_get_control as i386_dr_low.get_control. Install i386_linux_dr_get_addr as i386_dr_low.get_addr. Install i386_linux_prepare_to_resume. * arm-linux-nat.c (arm_linux_new_thread): Change parameter to an lwp pointer. Adjust. * ia64-linux-nat.c (ia64_linux_new_thread): Likewise. * mips-linux-nat.c (mips_linux_new_thread): Likewise. * ppc-linux-nat.c (ppc_linux_new_thread): Likewise. * s390-nat.c (s390_fix_watch_points): Likewise. * i386-darwin-nat.c (DR_FIRSTADDR, DR_LASTADDR, DR_STATUS) (DR_CONTROL): Delete. (i386_darwin_dr_reset_addr): Delete. (i386_darwin_dr_get_addr): New. (i386_darwin_dr_get_control): New. * go32-nat.c (go32_get_dr7, go32_get_dr): New. (init_go32_ops): No longer install i386_dr_low.reset_addr. Install go32_get_dr7 as i386_dr_low.get_control. Install go32_get_dr as i386_dr_low.get_addr. * i386bsd-nat.c (i386bsd_dr_get): New. (i386bsd_dr_reset_addr): Delete. (i386bsd_dr_get_addr): New. (i386bsd_dr_get_status): Use i386bsd_dr_get. (i386bsd_dr_get_control): New. * i386bsd-nat.h (i386bsd_dr_reset_addr): Delete. (i386bsd_dr_get_addr): New. (i386bsd_dr_get_control): New. * i386fbsd-nat.c (_initialize_i386fbsd_nat): No longer install i386_dr_low.reset_addr and i386_dr_low.unset_status. Install i386bsd_dr_get_control as i386_dr_low.get_control. Install i386bsd_dr_get_addr as i386_dr_low.get_addr. * windows-nat.c (init_windows_ops): No longer install i386_dr_low.reset_addr and i386_dr_low.unset_status. Install cygwin_get_dr7 as i386_dr_low.get_control. Install cygwin_get_dr as i386_dr_low.get_addr. (cygwin_get_dr): New. (cygwin_get_dr7): New. gdb/testsuite/ 2011-12-14 Pedro Alves <pedro@codesourcery.com> PR threads/10729 * gdb.mi/watch-nonstop.c: New file. * gdb.mi/mi-watch-nonstop.exp: New file.
2011-12-14 18:20:32 +01:00
i386_dr_low.get_addr = amd64_linux_dr_get_addr;
Remove all i386 debug register low level macros in config nm files. (I386_DR_LOW_SET_ADDR, I386_DR_LOW_RESET_ADDR): Remove. (I386_DR_LOW_GET_STATUS, I386_DR_LOW_SET_CONTROL): Remove. (I386_USE_GENERIC_WATCHPOIINTS): Remove. * i386-nat.h: New file (adapted from config/i386/nm-i386.h). (struct i386_dr_low_type): New type. (i386_dr_low): New global variable. * i386-nat.c (TARGET_HAS_DR_LEN_8): Update macro. (i386_insert_aligned_watchpoint): Replace i386 dr low macros by i386_dr_low struct variable fields. (i386_remove_aligned_watchpoint): Likewise. (i386_stopped_data_address): Likewise. (i386_stopped_by_hwbp): Likewise. (show_debug_regs_command_added): New static variable. (add_show_debug_regs_command): New static function. (i386_use_watchpoints): Call add_show_debug_regs_command if not done. (i386_set_debug_register_length): New function. (_initialize_i386_nat): Delete. * amd64-linux-nat.c: Include "i386-nat.h". (amd64_linux_dr_set_control): Change to static. (amd64_linux_dr_get_status): Change to static. (amd64_linux_dr_set_addr,amd64_linux_dr_reset_addr): Likewise. (_initialize_amd64_linux_nat): Set i386_dr_low variable fields. * go32-nat.c: Include "i386-nat.h". (go32_set_addr): Change to static. (go32_set_dr7): Change to static. Change arg type to unisgned long. (go32_get_dr6): Change to static. Change return type to unisnged long. (init_go32_ops): Set i386_dr_low variable fields. * i386-linux-nat.c: Include "i386-nat.h". (i386_linux_dr_set_control, i386_linux_dr_get_status): Change to static. (i386_linux_dr_set_addr, i386_linux_dr_reset_addr): Idem. (_initialize_i386_linux_nat): Set i386_dr_low variable fields. * i386bsd-nat.h: Declare functions used for i386_dr_low fields in i386fbsd-nat.c. * i386fbsd-nat.c: Include "i386-nat.h". (_initialize_i386fbsd_nat): Set i386_dr_low variable fields. * windows-nat.c: Include "i386-nat.h". (cygwin_set_dr, cygwin_get_dr6, cygwin_set_dr7): Add prototypes. Change to static. (cygwin_get_dr6): Change return type to unisnged long. (cygwin_set_dr7): Change arg type to unisgned long. (init_windows_ops): Set i386_dr_low function fields. * amd64-windows-nat.c (_initialize_amd64_windows_nat): Call i386_set_debug_register_length. * i386-windows-nat.c (_initialize_i386_windows_nat): Likewise. * config/i386/nm-cygwin.h: Remove all I386_* macros. * config/i386/nm-cygwin64.h: Likewise. * config/i386/nm-fbsd.h: Likewise. * config/i386/nm-linux.h: Likewise. * config/i386/nm-i386.h: Remove completely. * config/i386/nm-go32.h: Remove completely. * config/i386/nm-linux64.h: Remove completely. * config/i386/go32.mh (NAT_FILE): Remove entry. * config/i386/linux64.h (NAT_FILE): Change to config/nm-linux.h.
2009-05-14 11:37:00 +02:00
i386_dr_low.get_status = amd64_linux_dr_get_status;
gdb/ 2011-12-14 Pedro Alves <pedro@codesourcery.com> PR threads/10729 * linux-nat.c (linux_nat_new_thread): Change parameter to an lwp pointer. (linux_nat_prepare_to_resume): New global. (lwp_free): New. (purge_lwp_list): Use it. (add_lwp): Call linux_nat_new_thread even on the first LWP. Adjust to interface change. (delete_lwp): Call lwp_free instead of xfree. (detach_callback, linux_nat_detach, resume_lwp, linux_nat_resume) (linux_handle_syscall_trap, linux_handle_extended_wait) (linux_nat_filter_event, resume_stopped_resumed_lwps): Call linux_nat_prepare_to_resume before resuming. (linux_stop_lwp): New. (linux_nat_set_new_thread): Adjust. (linux_nat_set_prepare_to_resume): New. * linux-nat.h (struct arch_lwp_info): Forward declare. (struct lwp_info) <arch_private>: New field. (linux_stop_lwp): Declare. (linux_nat_set_new_thread): Adjust. (linux_nat_set_prepare_to_resume): New. * i386-nat.c (DR_NADDR, DR_STATUS, DR_CONTROL) (struct i386_debug_reg_state): Move to i386-nat.h. (dr_mirror): Comment. (i386_debug_reg_state): New. (i386_update_inferior_debug_regs): Simplify. (i386_stopped_data_address): Use the debug register state from the inferior, not from the local cache. * i386-nat.h (struct i386_dr_low_type): Delete reset_addr and unset_status fields. New get_addr and get_control fields. (DR_FIRSTADDR, DR_LASTADDR, DR_CONTROL): Moved from i386-nat.c. (DR_NADDR, DR_STATUS): New. (struct i386_debug_reg_state): Moved from i386-nat.c. * amd64-linux-nat.c (struct arch_lwp_info): New. (amd64_linux_dr): Delete global. (amd64_linux_dr_get_addr): New. (amd64_linux_dr_get_control): New. (amd64_linux_dr_unset_status): Delete. (amd64_linux_dr_set_addr): Reimplement. (amd64_linux_dr_reset_addr): Delete. (update_debug_registers_callback): New. (amd64_linux_dr_set_control): Reimplement. (amd64_linux_dr_set_addr): Reimplement. (amd64_linux_prepare_to_resume): New. (amd64_linux_new_thread): Change parameter to an lwp pointer. Reimplement. (_initialize_amd64_linux_nat): No longer install i386_dr_low.reset_addr and i386_dr_low.unset_status. Install amd64_linux_dr_get_control as i386_dr_low.get_control. Install amd64_linux_dr_get_addr as i386_dr_low.get_addr. Install amd64_linux_prepare_to_resume. * i386-linux-nat.c (DR_FIRSTADDR, DR_LASTADDR, DR_STATUS) (DR_CONTROL): Delete. (struct arch_lwp_info): New. (i386_linux_dr): Delete global. (i386_linux_dr_set_control): Reimplement. (i386_linux_dr_get_addr): New. (i386_linux_dr_set_addr): Reimplement. (i386_linux_dr_get_control): New. (update_debug_registers_callback): New. (i386_linux_dr_unset_status): Delete. (i386_linux_dr_set_addr): Reimplement. (i386_linux_prepare_to_resume): New. (i386_linux_new_thread): Change parameter to an lwp pointer. Reimplement. (_initialize_i386_linux_nat): No longer install i386_dr_low.reset_addr and i386_dr_low.unset_status. Install i386_linux_dr_get_control as i386_dr_low.get_control. Install i386_linux_dr_get_addr as i386_dr_low.get_addr. Install i386_linux_prepare_to_resume. * arm-linux-nat.c (arm_linux_new_thread): Change parameter to an lwp pointer. Adjust. * ia64-linux-nat.c (ia64_linux_new_thread): Likewise. * mips-linux-nat.c (mips_linux_new_thread): Likewise. * ppc-linux-nat.c (ppc_linux_new_thread): Likewise. * s390-nat.c (s390_fix_watch_points): Likewise. * i386-darwin-nat.c (DR_FIRSTADDR, DR_LASTADDR, DR_STATUS) (DR_CONTROL): Delete. (i386_darwin_dr_reset_addr): Delete. (i386_darwin_dr_get_addr): New. (i386_darwin_dr_get_control): New. * go32-nat.c (go32_get_dr7, go32_get_dr): New. (init_go32_ops): No longer install i386_dr_low.reset_addr. Install go32_get_dr7 as i386_dr_low.get_control. Install go32_get_dr as i386_dr_low.get_addr. * i386bsd-nat.c (i386bsd_dr_get): New. (i386bsd_dr_reset_addr): Delete. (i386bsd_dr_get_addr): New. (i386bsd_dr_get_status): Use i386bsd_dr_get. (i386bsd_dr_get_control): New. * i386bsd-nat.h (i386bsd_dr_reset_addr): Delete. (i386bsd_dr_get_addr): New. (i386bsd_dr_get_control): New. * i386fbsd-nat.c (_initialize_i386fbsd_nat): No longer install i386_dr_low.reset_addr and i386_dr_low.unset_status. Install i386bsd_dr_get_control as i386_dr_low.get_control. Install i386bsd_dr_get_addr as i386_dr_low.get_addr. * windows-nat.c (init_windows_ops): No longer install i386_dr_low.reset_addr and i386_dr_low.unset_status. Install cygwin_get_dr7 as i386_dr_low.get_control. Install cygwin_get_dr as i386_dr_low.get_addr. (cygwin_get_dr): New. (cygwin_get_dr7): New. gdb/testsuite/ 2011-12-14 Pedro Alves <pedro@codesourcery.com> PR threads/10729 * gdb.mi/watch-nonstop.c: New file. * gdb.mi/mi-watch-nonstop.exp: New file.
2011-12-14 18:20:32 +01:00
i386_dr_low.get_control = amd64_linux_dr_get_control;
Remove all i386 debug register low level macros in config nm files. (I386_DR_LOW_SET_ADDR, I386_DR_LOW_RESET_ADDR): Remove. (I386_DR_LOW_GET_STATUS, I386_DR_LOW_SET_CONTROL): Remove. (I386_USE_GENERIC_WATCHPOIINTS): Remove. * i386-nat.h: New file (adapted from config/i386/nm-i386.h). (struct i386_dr_low_type): New type. (i386_dr_low): New global variable. * i386-nat.c (TARGET_HAS_DR_LEN_8): Update macro. (i386_insert_aligned_watchpoint): Replace i386 dr low macros by i386_dr_low struct variable fields. (i386_remove_aligned_watchpoint): Likewise. (i386_stopped_data_address): Likewise. (i386_stopped_by_hwbp): Likewise. (show_debug_regs_command_added): New static variable. (add_show_debug_regs_command): New static function. (i386_use_watchpoints): Call add_show_debug_regs_command if not done. (i386_set_debug_register_length): New function. (_initialize_i386_nat): Delete. * amd64-linux-nat.c: Include "i386-nat.h". (amd64_linux_dr_set_control): Change to static. (amd64_linux_dr_get_status): Change to static. (amd64_linux_dr_set_addr,amd64_linux_dr_reset_addr): Likewise. (_initialize_amd64_linux_nat): Set i386_dr_low variable fields. * go32-nat.c: Include "i386-nat.h". (go32_set_addr): Change to static. (go32_set_dr7): Change to static. Change arg type to unisgned long. (go32_get_dr6): Change to static. Change return type to unisnged long. (init_go32_ops): Set i386_dr_low variable fields. * i386-linux-nat.c: Include "i386-nat.h". (i386_linux_dr_set_control, i386_linux_dr_get_status): Change to static. (i386_linux_dr_set_addr, i386_linux_dr_reset_addr): Idem. (_initialize_i386_linux_nat): Set i386_dr_low variable fields. * i386bsd-nat.h: Declare functions used for i386_dr_low fields in i386fbsd-nat.c. * i386fbsd-nat.c: Include "i386-nat.h". (_initialize_i386fbsd_nat): Set i386_dr_low variable fields. * windows-nat.c: Include "i386-nat.h". (cygwin_set_dr, cygwin_get_dr6, cygwin_set_dr7): Add prototypes. Change to static. (cygwin_get_dr6): Change return type to unisnged long. (cygwin_set_dr7): Change arg type to unisgned long. (init_windows_ops): Set i386_dr_low function fields. * amd64-windows-nat.c (_initialize_amd64_windows_nat): Call i386_set_debug_register_length. * i386-windows-nat.c (_initialize_i386_windows_nat): Likewise. * config/i386/nm-cygwin.h: Remove all I386_* macros. * config/i386/nm-cygwin64.h: Likewise. * config/i386/nm-fbsd.h: Likewise. * config/i386/nm-linux.h: Likewise. * config/i386/nm-i386.h: Remove completely. * config/i386/nm-go32.h: Remove completely. * config/i386/nm-linux64.h: Remove completely. * config/i386/go32.mh (NAT_FILE): Remove entry. * config/i386/linux64.h (NAT_FILE): Change to config/nm-linux.h.
2009-05-14 11:37:00 +02:00
i386_set_debug_register_length (8);
* Makefile.in (ALLDEPFILES): Update. (alpha-linux-nat.o, sparc-linux-nat.o): New rules. (amd64-linux-nat.o, arm-linux-nat.o, hppa-linux-nat.o) (i386-linux-nat.o, ia64-linux-nat.o, linux-nat.o, m32r-linux-nat.o) (m68klinux-nat.o, mips-linux-nat.o, ppc-linux-nat.o, s390-nat.o) (sparc64-linux-nat.o): Update dependencies. * alpha-linux-nat.c, sparc-linux-nat.c: New files. * amd64-linux-nat.c (amd64_linux_fetch_inferior_registers): Renamed from fetch_inferior_registers and made static. (amd64_linux_store_inferior_registers): Renamed from store_inferior_registers and made static. (amd64_linux_child_post_start_inferior): Renamed from child_post_startup_inferior and made static. Call super_post_startup_inferior. (super_post_startup_inferior): New. (_initialize_amd64_linux_nat): Set it. Call linux_target and add_target. * arm-linux-nat.c (arm_linux_fetch_inferior_registers): Renamed from fetch_inferior_registers and made static. (arm_linux_store_inferior_registers): Renamed from store_inferior_registers and made static. (_initialize_arm_linux_nat): Add a prototype. Use linux_target and add_target. * hppa-linux-nat.c (hppa_linux_fetch_inferior_registers): Renamed from fetch_inferior_registers and made static. (hppa_linux_store_inferior_registers): Renamed from store_inferior_registers and made static. (_initialize_hppa_linux_nat): New function. * i386-linux-nat.c (i386_linux_fetch_inferior_registers): Renamed from fetch_inferior_registers and made static. (i386_linux_store_inferior_registers): Renamed from store_inferior_registers and made static. (i386_linux_resume): Renamed from child_resume and made static. (i386_linux_child_post_start_inferior): Renamed from child_post_startup_inferior and made static. Call super_post_startup_inferior. (super_post_startup_inferior): New. (_initialize_i386_linux_nat): New function. * i386-nat.c: Remove LINUX_CHILD_POST_STARTUP_INFERIOR #ifndef. * ia64-linux-nat.c (ia64_linux_xfer_unwind_table): Remove. (super_xfer_partial): New. (ia64_linux_xfer_partial): New function. Use it. (_initialize_ia64_linux_nat): New function. * ia64-tdep.c (getunwind_table): Revert 2005-06-08 change; use target_read_partial and document the problem. * inf-ptrace.c (inf_ptrace_fetch_register): Use CANNOT_FETCH_REGISTER. Fix some comments. (inf_ptrace_store_register): Use CANNOT_STORE_REGISTER. Fix some comments. * linux-nat.c: Include "inf-ptrace.h" and "auxv.h". (linux_ops, super_xfer_partial): New variables. (linux_child_post_startup_inferior): Make static. (child_post_startup_inferior): Delete. (linux_nat_attach, linux_nat_detach, resume_callback) (linux_nat_resume, linux_nat_wait, linux_nat_create_inferior) (linux_nat_mourn_inferior): Use linux_ops instead of deprecated_child_ops. (child_wait): Do not depend on CHILD_WAIT. (linux_nat_xfer_memory): Remove, replace by ... (linux_nat_xfer_partial): ... this. Use linux_ops->to_xfer_partial instead of linux_proc_xfer_memory and child_xfer_memory. (linux_nat_fetch_registers, linux_nat_store_registers) (linux_nat_child_post_startup_inferior): New functions. (init_linux_nat_ops): Use the new functions. (linux_proc_xfer_memory): Remove, replace by ... (linux_proc_xfer_partial): ... this. Make static. (linux_xfer_partial, linux_register_u_offset, linux_target): New functions. (_initialize_linux_nat): Do not modify deprecated_child_ops. * linux-nat.h (linux_proc_xfer_memory): Remove prototype. (struct mem_attrib, struct target_ops): Remove forward declarations. (linux_child_post_startup_inferior): Remove prototype. (linux_target): Add prototype. * linux-thread-db.c (thread_db_xfer_memory): Remove, replace by ... (thread_db_xfer_partial): ... this. (init_thread_db_ops): Set to_xfer_partial instead of deprecated_xfer_memory. * m32r-linux-nat.c (m32r_linux_fetch_inferior_registers): Renamed from fetch_inferior_registers and made static. (m32r_linux_store_inferior_registers): Renamed from store_inferior_registers and made static. (_initialize_m32r_linux_nat): New function. * m68klinux-nat.c (m68k_linux_fetch_inferior_registers): Renamed from fetch_inferior_registers and made static. (m68k_linux_store_inferior_registers): Renamed from store_inferior_registers and made static. (old_fetch_inferior_registers, old_store_inferior_registers): Made static. (_initialize_m68k_linux_nat): Use linux_target and add_target. * mips-linux-nat.c (_initialize_mips_linux_nat): New function. * ppc-linux-nat.c (ppc_linux_fetch_inferior_registers): Renamed from fetch_inferior_registers and made static. (ppc_linux_store_inferior_registers): Renamed from store_inferior_registers and made static. (_initialize_ppc_linux_nat): New function. * s390-nat.c (s390_linux_fetch_inferior_registers): Renamed from fetch_inferior_registers and made static. (s390_linux_store_inferior_registers): Renamed from store_inferior_registers and made static. (_initialize_s390_nat): New function. * sparc64-linux-nat.c (_initialize_sparc64_linux_nat): Use linux_target and add_target. * config/nm-linux.h: Don't include "auxv.h". (struct target_waitstatus, child_wait, CHILD_WAIT) (CHILD_PID_TO_EXEC_FILE, CHILD_INSERT_FORK_CATCHPOINT) (CHILD_INSERT_VFORK_CATCHPOINT, CHILD_INSERT_EXEC_CATCHPOINT) (CHILD_POST_STARTUP_INFERIOR, CHILD_POST_ATTACH, CHILD_FOLLOW_FORK) (DEPRECATED_KILL_INFERIOR, NATIVE_XFER_AUXV): Delete. * config/alpha/alpha-linux.mh (NATDEPFILES): Replace infptrace.o and inftarg.o with inf-ptrace.o and alpha-linux-nat.o. * config/sparc/linux.mh (NATDEPFILES): Replace infptrace.o and inftarg.o with sparc-linux-nat.o. * config/sparc/linux64.mh (NATDEPFILES): Remove infptrace.o and inftarg.o. * config/arm/linux.mh (NATDEPFILES): Replace infptrace.o and inftarg.o with inf-ptrace.o. * 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/s390/s390.mh (NATDEPFILES): Likewise. * config/i386/nm-linux.h (DEPRECATED_CHILD_RESUME): Don't define. (LINUX_CHILD_POST_STARTUP_INFERIOR): Don't define. * config/i386/nm-linux64.h (LINUX_CHILD_POST_STARTUP_INFERIOR): Don't define. * config/ia64/nm-linux.h: Don't include "target.h". (NATIVE_XFER_UNWIND_TABLE, ia64_linux_xfer_unwind_table): Remove. * config/djgpp/fnchange.lst: Add alpha-linux-tdep.c, alpha-linux-nat.c, sparc-linux-tdep.c, and sparc-linux-nat.c.
2005-09-10 20:11:14 +02:00
/* Override the GNU/Linux inferior startup hook. */
super_post_startup_inferior = t->to_post_startup_inferior;
t->to_post_startup_inferior = amd64_linux_child_post_startup_inferior;
/* Add our register access methods. */
t->to_fetch_registers = amd64_linux_fetch_inferior_registers;
t->to_store_registers = amd64_linux_store_inferior_registers;
Enable XML target descriptions for x86. gdb/ 2010-03-01 H.J. Lu <hongjiu.lu@intel.com> * amd64-linux-nat.c (AMD64_LINUX_USER64_CS): New. (amd64_linux_read_description): Likewise. (_initialize_amd64_linux_nat): Set to_read_description to amd64_linux_read_description. * amd64-linux-tdep.c: Include "features/i386/amd64-linux.c". (amd64_linux_register_name): Removed. (amd64_linux_register_type): Likewise. (amd64_linux_core_read_description): New. (amd64_linux_init_abi): Set target description to tdesc_amd64_linux if needed. Support orig_rax in target description. Don't call set_gdbarch_register_name nor set_gdbarch_register_type. Call set_gdbarch_core_read_description. (_initialize_amd64_linux_tdep): Call initialize_tdesc_amd64_linux. * amd64-linux-tdep.h (tdesc_amd64_linux): New. * amd64-tdep.c: Include "features/i386/amd64.c". (amd64_register_names): Removed. (amd64_register_name): Likewise. (amd64_register_type): Likewise. (amd64_init_abi): Set num_core_regs and register_names. Set target description to tdesc_amd64 if needed. Don't call set_gdbarch_register_name nor set_gdbarch_register_type. (_initialize_amd64_tdep): New. * i386-linux-nat.c (i386_linux_read_description): New. (_initialize_i386_linux_nat): Set to_read_description to i386_linux_read_description. * i386-linux-tdep.c: Include "features/i386/i386-linux.c". (i386_linux_register_name): Removed. (i386_linux_core_read_description): New. (i386_linux_read_description): Likewise. (i386_linux_init_abi): Don't call set_gdbarch_register_name. Set target description to tdesc_i386_linux if needed. Support orig_eax. Set register_reggroup_p. Call set_gdbarch_core_read_description. (_initialize_i386_linux_tdep): Call initialize_tdesc_i386_linux. * i386-linux-tdep.h (tdesc_i386_linux): New. * i386-nto-tdep.c (i386nto_regset_id): Replace I386_NUM_FREGS with I387_NUM_REGS. * i386-tdep.c: Include "features/i386/i386.c". (i386_register_names): Make it const. (i386_mmx_names): Likewise. (i386_num_register_names): Removed. (i386_register_name): Likewise. (i386_eflags_type): Likewise. (i386_mxcsr_type): Likewise. (i386_sse_type): Likewise. (i386_register_type): Likewise. (i387_ext_type): Call tdesc_find_type instead of arch_float_type. (i386_pseudo_register_name): New. (i386_pseudo_register_type): Likewise. (i386_mmx_type): Make it static. (i386_gdbarch_init): Check arch. Replace I386_NUM_FREGS with I387_NUM_REGS. Set num_core_regs and register_names. Don't call set_gdbarch_register_name nor set_gdbarch_register_type. Set register_reggroup_p. Set target description to tdesc_i386 if needed. Call set_tdesc_pseudo_register_type, set_tdesc_pseudo_register_name and tdesc_use_registers. (_initialize_i386_tdep): Call initialize_tdesc_i386. initialize_tdesc_x86_64. * i386-tdep.h (gdbarch_tdep): Remove i386_eflags_type, i386_mxcsr_type and i386_sse_type. Add num_core_regs, register_names, tdesc and register_reggroup_p. (I386_NUM_FREGS): Removed. (i386_eflags_type): Likewise. (i386_mxcsr_type): Likewise. (i386_mmx_type): Likewise. (i386_sse_type): Likewise. (i386_register_name): Likewise. (i386_regnum): Add I386_MXCSR_REGNUM. (I386_SSE_NUM_REGS): Defined with I386_MXCSR_REGNUM. * i387-tdep.h (I387_NUM_REGS): New. * regformats/i386/i386-linux.dat: Generated. * regformats/i386/i386.dat: Likewise. * regformats/i386/amd64-linux.dat: Likewise. * regformats/i386/amd64.dat: Likewise. * regformats/reg-i386-linux.dat: Removed. * regformats/reg-i386.dat: Likewise. * regformats/reg-x86-64-linux.dat: Likewise. * regformats/reg-x86-64.dat: Likewise. gdb/gdbserver/ 2010-03-01 H.J. Lu <hongjiu.lu@intel.com> * Makefile.in (clean): Replace reg-i386.c, reg-x86-64.c, reg-i386-linux.c and reg-x86-64-linux.c with i386.c, amd64.c, i386-linux.c and amd64-linux.c. (reg-i386.o): Removed. (reg-i386.c): Likewise. (reg-i386-linux.o): Likewise. (reg-i386-linux.c): Likewise. (reg-x86-64.o): Likewise. (reg-x86-64.c): Likewise. (reg-x86-64-linux.o): Likewise. (reg-x86-64-linux.c): Likewise. (i386.o): New. (i386.c): Likewise. (i386-linux.o): Likewise. (i386-linux.c): Likewise. (amd64.o): Likewise. (amd64.c): Likewise. (amd64-linux.o): Likewise. (amd64-linux.c): Likewise. * configure.srv (srv_i386_regobj): New. (srv_i386_linux_regobj): Likewise. (srv_amd64_regobj): Likewise. (srv_amd64_linux_regobj): Likewise. (srv_i386_32bit_xmlfiles): Likewise. (srv_i386_64bit_xmlfiles): Likewise. (srv_i386_xmlfiles): Likewise. (srv_amd64_xmlfiles): Likewise. (srv_i386_linux_xmlfiles): Likewise. (srv_amd64_linux_xmlfiles): Likewise. (i[34567]86-*-cygwin*): Set srv_regobj to $srv_i386_regobj. Set srv_xmlfiles to $srv_i386_xmlfiles. (i[34567]86-*-mingw32ce*): Likewise. (i[34567]86-*-mingw*): Likewise. (i[34567]86-*-nto*): Likewise. (i[34567]86-*-linux*): Set srv_regobj to $srv_i386_linux_regobj and $srv_amd64_linux_regobj. Set srv_xmlfiles to $srv_i386_linux_xmlfiles and $srv_amd64_linux_xmlfiles. (x86_64-*-linux*): Likewise. * linux-x86-low.c (init_registers_x86_64_linux): Removed. (init_registers_amd64_linux): New. (x86_arch_setup): Replace init_registers_x86_64_linux with init_registers_amd64_linux. gdb/testsuite/ 2010-03-01 H.J. Lu <hongjiu.lu@intel.com> * gdb.xml/tdesc-regs.exp (architecture): New. Set it for x86. (load_description): Set architecture if defined.
2010-03-01 16:33:32 +01:00
t->to_read_description = amd64_linux_read_description;
/* Add btrace methods. */
t->to_supports_btrace = linux_supports_btrace;
t->to_enable_btrace = amd64_linux_enable_btrace;
t->to_disable_btrace = amd64_linux_disable_btrace;
t->to_teardown_btrace = amd64_linux_teardown_btrace;
t->to_read_btrace = amd64_linux_read_btrace;
* Makefile.in (ALLDEPFILES): Update. (alpha-linux-nat.o, sparc-linux-nat.o): New rules. (amd64-linux-nat.o, arm-linux-nat.o, hppa-linux-nat.o) (i386-linux-nat.o, ia64-linux-nat.o, linux-nat.o, m32r-linux-nat.o) (m68klinux-nat.o, mips-linux-nat.o, ppc-linux-nat.o, s390-nat.o) (sparc64-linux-nat.o): Update dependencies. * alpha-linux-nat.c, sparc-linux-nat.c: New files. * amd64-linux-nat.c (amd64_linux_fetch_inferior_registers): Renamed from fetch_inferior_registers and made static. (amd64_linux_store_inferior_registers): Renamed from store_inferior_registers and made static. (amd64_linux_child_post_start_inferior): Renamed from child_post_startup_inferior and made static. Call super_post_startup_inferior. (super_post_startup_inferior): New. (_initialize_amd64_linux_nat): Set it. Call linux_target and add_target. * arm-linux-nat.c (arm_linux_fetch_inferior_registers): Renamed from fetch_inferior_registers and made static. (arm_linux_store_inferior_registers): Renamed from store_inferior_registers and made static. (_initialize_arm_linux_nat): Add a prototype. Use linux_target and add_target. * hppa-linux-nat.c (hppa_linux_fetch_inferior_registers): Renamed from fetch_inferior_registers and made static. (hppa_linux_store_inferior_registers): Renamed from store_inferior_registers and made static. (_initialize_hppa_linux_nat): New function. * i386-linux-nat.c (i386_linux_fetch_inferior_registers): Renamed from fetch_inferior_registers and made static. (i386_linux_store_inferior_registers): Renamed from store_inferior_registers and made static. (i386_linux_resume): Renamed from child_resume and made static. (i386_linux_child_post_start_inferior): Renamed from child_post_startup_inferior and made static. Call super_post_startup_inferior. (super_post_startup_inferior): New. (_initialize_i386_linux_nat): New function. * i386-nat.c: Remove LINUX_CHILD_POST_STARTUP_INFERIOR #ifndef. * ia64-linux-nat.c (ia64_linux_xfer_unwind_table): Remove. (super_xfer_partial): New. (ia64_linux_xfer_partial): New function. Use it. (_initialize_ia64_linux_nat): New function. * ia64-tdep.c (getunwind_table): Revert 2005-06-08 change; use target_read_partial and document the problem. * inf-ptrace.c (inf_ptrace_fetch_register): Use CANNOT_FETCH_REGISTER. Fix some comments. (inf_ptrace_store_register): Use CANNOT_STORE_REGISTER. Fix some comments. * linux-nat.c: Include "inf-ptrace.h" and "auxv.h". (linux_ops, super_xfer_partial): New variables. (linux_child_post_startup_inferior): Make static. (child_post_startup_inferior): Delete. (linux_nat_attach, linux_nat_detach, resume_callback) (linux_nat_resume, linux_nat_wait, linux_nat_create_inferior) (linux_nat_mourn_inferior): Use linux_ops instead of deprecated_child_ops. (child_wait): Do not depend on CHILD_WAIT. (linux_nat_xfer_memory): Remove, replace by ... (linux_nat_xfer_partial): ... this. Use linux_ops->to_xfer_partial instead of linux_proc_xfer_memory and child_xfer_memory. (linux_nat_fetch_registers, linux_nat_store_registers) (linux_nat_child_post_startup_inferior): New functions. (init_linux_nat_ops): Use the new functions. (linux_proc_xfer_memory): Remove, replace by ... (linux_proc_xfer_partial): ... this. Make static. (linux_xfer_partial, linux_register_u_offset, linux_target): New functions. (_initialize_linux_nat): Do not modify deprecated_child_ops. * linux-nat.h (linux_proc_xfer_memory): Remove prototype. (struct mem_attrib, struct target_ops): Remove forward declarations. (linux_child_post_startup_inferior): Remove prototype. (linux_target): Add prototype. * linux-thread-db.c (thread_db_xfer_memory): Remove, replace by ... (thread_db_xfer_partial): ... this. (init_thread_db_ops): Set to_xfer_partial instead of deprecated_xfer_memory. * m32r-linux-nat.c (m32r_linux_fetch_inferior_registers): Renamed from fetch_inferior_registers and made static. (m32r_linux_store_inferior_registers): Renamed from store_inferior_registers and made static. (_initialize_m32r_linux_nat): New function. * m68klinux-nat.c (m68k_linux_fetch_inferior_registers): Renamed from fetch_inferior_registers and made static. (m68k_linux_store_inferior_registers): Renamed from store_inferior_registers and made static. (old_fetch_inferior_registers, old_store_inferior_registers): Made static. (_initialize_m68k_linux_nat): Use linux_target and add_target. * mips-linux-nat.c (_initialize_mips_linux_nat): New function. * ppc-linux-nat.c (ppc_linux_fetch_inferior_registers): Renamed from fetch_inferior_registers and made static. (ppc_linux_store_inferior_registers): Renamed from store_inferior_registers and made static. (_initialize_ppc_linux_nat): New function. * s390-nat.c (s390_linux_fetch_inferior_registers): Renamed from fetch_inferior_registers and made static. (s390_linux_store_inferior_registers): Renamed from store_inferior_registers and made static. (_initialize_s390_nat): New function. * sparc64-linux-nat.c (_initialize_sparc64_linux_nat): Use linux_target and add_target. * config/nm-linux.h: Don't include "auxv.h". (struct target_waitstatus, child_wait, CHILD_WAIT) (CHILD_PID_TO_EXEC_FILE, CHILD_INSERT_FORK_CATCHPOINT) (CHILD_INSERT_VFORK_CATCHPOINT, CHILD_INSERT_EXEC_CATCHPOINT) (CHILD_POST_STARTUP_INFERIOR, CHILD_POST_ATTACH, CHILD_FOLLOW_FORK) (DEPRECATED_KILL_INFERIOR, NATIVE_XFER_AUXV): Delete. * config/alpha/alpha-linux.mh (NATDEPFILES): Replace infptrace.o and inftarg.o with inf-ptrace.o and alpha-linux-nat.o. * config/sparc/linux.mh (NATDEPFILES): Replace infptrace.o and inftarg.o with sparc-linux-nat.o. * config/sparc/linux64.mh (NATDEPFILES): Remove infptrace.o and inftarg.o. * config/arm/linux.mh (NATDEPFILES): Replace infptrace.o and inftarg.o with inf-ptrace.o. * 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/s390/s390.mh (NATDEPFILES): Likewise. * config/i386/nm-linux.h (DEPRECATED_CHILD_RESUME): Don't define. (LINUX_CHILD_POST_STARTUP_INFERIOR): Don't define. * config/i386/nm-linux64.h (LINUX_CHILD_POST_STARTUP_INFERIOR): Don't define. * config/ia64/nm-linux.h: Don't include "target.h". (NATIVE_XFER_UNWIND_TABLE, ia64_linux_xfer_unwind_table): Remove. * config/djgpp/fnchange.lst: Add alpha-linux-tdep.c, alpha-linux-nat.c, sparc-linux-tdep.c, and sparc-linux-nat.c.
2005-09-10 20:11:14 +02:00
/* Register the target. */
* linux-nat.c (linux_ops_saved): New. (super_mourn_inferior, kill_inferior, threaded, linux_nat_ops) (child_mourn_inferior, child_wait, linux_nat_create_inferior) (linux_nat_fetch_registers, linux_nat_store_registers) (linux_nat_child_post_startup_inferior, init_linux_nat_ops): Delete. (init_lwp_list): Don't set threaded. (add_lwp): Don't modify threaded. (delete_lwp): Don't mention non-threaded mode. (linux_nat_switch_fork): New. (linux_nat_attach): Update inferior_ptid. (linux_nat_wait): Handle num_lwps == 0 at entry. Don't check threaded flag. (linux_nat_kill): Handle pending forks and saved forks. (linux_nat_mourn_inferior): Handle saved forks. (linux_nat_pid_to_str): Don't use the LWP form when there is only one thread. (linux_target): Don't set to_wait, to_kill, or to_mourn_inferior. (linux_nat_add_target): New. (_initialize_linux_nat): Don't initialize the linux native target here. * linux-nat.h (linux_nat_add_target, linux_nat_switch_fork): New prototypes. * linux-fork.c: Include "linux-nat.h". (add_fork): Update initial PID. (fork_load_infrun_state): Call linux_nat_switch_fork. * Makefile.in (linux-fork.o): Update. * alpha-linux-nat.c (_initialize_alpha_linux_nat): Use linux_nat_add_target instead of add_target. * amd64-linux-nat.c (_initialize_amd64_linux_nat): Likewise. * arm-linux-nat.c (_initialize_arm_linux_nat): Likewise. * hppa-linux-nat.c (_initialize_hppa_linux_nat): Likewise. * ia64-linux-nat.c (_initialize_ia64_linux_nat): Likewise. * i386-linux-nat.c (_initialize_i386_linux_nat): Likewise. * m32r-linux-nat.c (_initialize_m32r_linux_nat): Likewise. * m68klinux-nat.c (_initialize_m68k_linux_nat): Likewise. * mips-linux-nat.c (_initialize_mips_linux_nat): Likewise. * ppc-linux-nat.c (_initialize_ppc_linux_nat): Likewise. * s390-nat.c (_initialize_s390_nat): Likewise. * sparc-linux-nat.c (_initialize_sparc_linux_nat): Likewise. * sparc64-linux-nat.c (_initialize_sparc64_linux_nat): Likewise.
2006-03-25 00:08:16 +01:00
linux_nat_add_target (t);
* linux-nat.c (linux_nat_new_thread): New variable. (linux_child_follow_fork): Set inferior_ptid to include LWP ID. Use linux_nat_switch_fork. (lwp_list): Make public. (add_lwp): Call linux_nat_new_thread. (lin_lwp_attach_lwp, linux_nat_attach): Call add_lwp after stopping the new thread. (resume_callback): Clear lp->siginfo. Remove unused variable. (linux_nat_resume): Assert that the LWP list is already initialized. Clear lp->siginfo. (save_siginfo): New. (stop_wait_callback, linux_nat_wait): Call it. (linux_nat_set_new_thread, linux_nat_get_siginfo): New. * linux-nat.h (struct lwp_info): Add siginfo. (lwp_list, linux_nat_set_new_thread, linux_nat_get_siginfo): Declare. (ALL_LWPS): Define. * amd64-linux-nat.c (amd64_linux_dr): New. (amd64_linux_dr_get): Take a PTID argument. Correct typo. (amd64_linux_dr_set): Take a PTID argument. (amd64_linux_dr_set_control, amd64_linux_dr_set_addr): Use ALL_LWPS. (amd64_linux_dr_reset_addr): Use amd64_linux_dr_set_addr. (amd64_linux_dr_get_status): Pass inferior_ptid to amd64_linux_dr_get. (amd64_linux_new_thread): New. (_initialize_amd64_linux_nat): Call linux_nat_set_new_thread. * i386-linux-nat.c (i386_linux_dr): New. (i386_linux_dr_get, i386_linux_dr_set): Take a PTID argument. (i386_linux_dr_set_control, i386_linux_dr_set_addr): Use ALL_LWPS. (i386_linux_dr_reset_addr): Use i386_linux_dr_set_addr. (i386_linux_dr_get_status): Pass inferior_ptid to i386_linux_dr_get. (i386_linux_new_thread): New. (i386_linux_resume): Remove unnecessary PID check. (_initialize_i386_linux_nat): Call linux_nat_set_new_thread. * ia64-linux-nat.c (enable_watchpoints_in_psr): Take PTID argument. (fetch_debug_register, fetch_debug_register_pair): Delete. (debug_registers): New. (ia64_linux_insert_watchpoint, ia64_linux_remove_watchpoint): Use ALL_LWPS and debug_registers. (ia64_linux_new_thread): New. (ia64_linux_stopped_data_address): Use linux_nat_get_siginfo. (_initialize_ia64_linux_nat): Call linux_nat_set_new_thread. * ppc-linux-nat.c (last_stopped_data_address): Delete. (saved_dabr_value): New. (ppc_linux_insert_watchpoint, ppc_linux_remove_watchpoint): Use ALL_LWPS. (ppc_linux_new_thread): New. (ppc_linux_stopped_data_address): Use linux_nat_get_siginfo. (ppc_linux_stopped_by_watchpoint): Call ppc_linux_stopped_data_address. (_initialize_ppc_linux_nat): Call linux_nat_set_new_thread. * s390-nat.c (s390_stopped_by_watchpoint): Clear the watchpoint status after reading it. (s390_fix_watch_points): Take a PTID argument. (s390_insert_watchpoint, s390_remove_watchpoint): Use ALL_LWPS. (_initialize_s390_nat): Call linux_nat_set_new_thread.
2007-10-01 02:22:50 +02:00
linux_nat_set_new_thread (t, amd64_linux_new_thread);
[native x86 GNU/Linux] Access debug register mirror from the corresponding process. While reviewing the native AArch64 patch, I noticed a problem: On 02/06/2013 08:46 PM, Pedro Alves wrote: > >> > +static void >> > +aarch64_linux_prepare_to_resume (struct lwp_info *lwp) >> > +{ >> > + struct arch_lwp_info *info = lwp->arch_private; >> > + >> > + /* NULL means this is the main thread still going through the shell, >> > + or, no watchpoint has been set yet. In that case, there's >> > + nothing to do. */ >> > + if (info == NULL) >> > + return; >> > + >> > + if (DR_HAS_CHANGED (info->dr_changed_bp) >> > + || DR_HAS_CHANGED (info->dr_changed_wp)) >> > + { >> > + int tid = GET_LWP (lwp->ptid); >> > + struct aarch64_debug_reg_state *state = aarch64_get_debug_reg_state (); > Hmm. This is always fetching the debug_reg_state of > the current inferior, but may not be the inferior of lwp. > I see the same bug on x86. Sorry about that. I'll fix it. A natural fix would be to make xxx_get_debug_reg_state take an inferior argument, but that doesn't work because of the case where we detach breakpoints/watchpoints from the child fork, at a time there's no inferior for the child fork at all. We do a nasty hack in i386_inferior_data_get, but that relies on all callers pointing the current inferior to the correct inferior, which isn't actually being done by all callers, and I don't think we want to enforce that -- deep in the bowls of linux-nat.c, there are many cases we resume lwps behind the scenes, and it's be better to not have that code rely on global state (as it doesn't today). The fix is to decouple the watchpoints code from inferiors, making it track target processes instead. This way, we can freely keep track of the watchpoint mirrors for these processes behind the core's back. Checkpoints also play dirty tricks with swapping the process behind the inferior, so they get special treatment too in the patch (which just amounts to calling a new hook). Instead of the old hack in i386_inferior_data_get, where we returned a copy of the current inferior's debug registers mirror, as soon as we detect a fork in the target, we copy the debug register mirror from the parent to the child process. I don't have an old kernel handy to test, but I stepped through gdb doing the watchpoint removal in the fork child in the watchpoint-fork test seeing that the debug registers end up cleared in the child. I didn't find the need for linux_nat_iterate_watchpoint_lwps. If we use plain iterate_over_lwps instead, what happens is that when removing watchpoints, that iterate_over_lwps doesn't actually iterate over anything, since the fork child is not added to the lwp list until later, at detach time, in linux_child_follow_fork. And if we don't iterate over that lwp, we don't mark its debug registers as needing update. But linux_child_follow_fork takes care of doing that explicitly: child_lp = add_lwp (inferior_ptid); child_lp->stopped = 1; child_lp->last_resume_kind = resume_stop; make_cleanup (delete_lwp_cleanup, child_lp); /* CHILD_LP has new PID, therefore linux_nat_new_thread is not called for it. See i386_inferior_data_get for the Linux kernel specifics. Ensure linux_nat_prepare_to_resume will reset the hardware debug registers. It is done by the linux_nat_new_thread call, which is being skipped in add_lwp above for the first lwp of a pid. */ gdb_assert (num_lwps (GET_PID (child_lp->ptid)) == 1); if (linux_nat_new_thread != NULL) linux_nat_new_thread (child_lp); if (linux_nat_prepare_to_resume != NULL) linux_nat_prepare_to_resume (child_lp); ptrace (PTRACE_DETACH, child_pid, 0, 0); so unless I'm missing something (quite possible) it ends up all the same. But, the !detach-on-fork, and the "follow-fork child" paths should also call linux_nat_new_thread, and they don't presently. It seems to me in those cases we're not clearing debug regs correctly when that's needed. Instead of copying that bit that works around add_lwp bypassing the linux_nat_new_thread call, I thought it'd be better to add an add_initial_lwp call to be used in the case we really need to bypass linux_nat_new_thread, and make add_lwp always call linux_nat_new_thread. i386_cleanup_dregs is rewritten to forget about the current process debug mirrors, which takes cares of other i386 ports. Only a couple of extra tweaks here and there were needed, as some targets wheren't actually calling i386_cleanup_dregs. Tested on Fedora 17 x86_64 -m64/-m32. GDBserver already fetches the i386_debug_reg_state from the right process, and, it doesn't handle forks at all, so no fix is needed over there. gdb/ 2013-02-13 Pedro Alves <palves@redhat.com> * amd64-linux-nat.c (update_debug_registers_callback): Update comment. (amd64_linux_dr_set_control, amd64_linux_dr_set_addr): Use iterate_over_lwps. (amd64_linux_prepare_to_resume): Pass the lwp's pid to i386_debug_reg_state. (amd64_linux_new_fork): New function. (_initialize_amd64_linux_nat): Install amd64_linux_new_fork as linux_nat_new_fork hook, and i386_forget_process as linux_nat_forget_process hook. * i386-linux-nat.c (update_debug_registers_callback): Update comment. (amd64_linux_dr_set_control, amd64_linux_dr_set_addr): Use iterate_over_lwps. (i386_linux_prepare_to_resume): Pass the lwp's pid to i386_debug_reg_state. (i386_linux_new_fork): New function. (_initialize_i386_linux_nat): Install i386_linux_new_fork as linux_nat_new_fork hook, and i386_forget_process as linux_nat_forget_process hook. * i386-nat.c (i386_init_dregs): Delete. (i386_inferior_data, struct i386_inferior_data): Delete. (struct i386_process_info): New. (i386_process_list): New global. (i386_find_process_pid, i386_add_process, i386_process_info_get): New functions. (i386_inferior_data_get): Delete. (i386_process_info_get): New function. (i386_debug_reg_state): New parameter 'pid'. Reimplement. (i386_forget_process): New function. (i386_cleanup_dregs): Rewrite. (i386_update_inferior_debug_regs, i386_insert_watchpoint) (i386_remove_watchpoint, i386_region_ok_for_watchpoint) (i386_stopped_data_address, i386_insert_hw_breakpoint) (i386_remove_hw_breakpoint): Adjust to pass the current process id to i386_debug_reg_state. (i386_use_watchpoints): Don't register inferior data. * i386-nat.h (i386_debug_reg_state): Add new 'pid' parameter, and adjust comment. (i386_forget_process): Declare. * linux-fork.c (delete_fork): Call linux_nat_forget_process. * linux-nat.c (linux_nat_new_fork, linux_nat_forget_process_hook): New static globals. (linux_child_follow_fork): Don't call linux_nat_new_thread here. (add_initial_lwp): New, factored out from ... (add_lwp): ... this. Don't check the number of lwps before calling linux_nat_new_thread. (linux_nat_iterate_watchpoint_lwps): Delete. (linux_nat_attach): Use add_initial_lwp instead of add_lwp. (linux_handle_extended_wait): Call the linux_nat_new_fork hook on forks and vforks. (linux_nat_wait_1): Use add_initial_lwp instead of add_lwp for the initial lwp. (linux_nat_kill, linux_nat_mourn_inferior): Call linux_nat_forget_process. (linux_nat_set_new_fork, linux_nat_set_forget_process) (linux_nat_forget_process): New functions. * linux-nat.h (linux_nat_iterate_watchpoint_lwps_ftype): Delete type. (linux_nat_iterate_watchpoint_lwps): Delete declaration. (linux_nat_new_fork_ftype, linux_nat_forget_process_ftype): New types. (linux_nat_set_new_fork, linux_nat_set_forget_process) (linux_nat_forget_process): New declarations. * amd64fbsd-nat.c (super_mourn_inferior): New global. (amd64fbsd_mourn_inferior): New function. (_initialize_amd64fbsd_nat): Override to_mourn_inferior. * windows-nat.c (windows_detach): Call i386_cleanup_dregs.
2013-02-13 15:59:49 +01:00
linux_nat_set_new_fork (t, amd64_linux_new_fork);
linux_nat_set_forget_process (t, i386_forget_process);
linux_nat_set_siginfo_fixup (t, amd64_linux_siginfo_fixup);
gdb/ 2011-12-14 Pedro Alves <pedro@codesourcery.com> PR threads/10729 * linux-nat.c (linux_nat_new_thread): Change parameter to an lwp pointer. (linux_nat_prepare_to_resume): New global. (lwp_free): New. (purge_lwp_list): Use it. (add_lwp): Call linux_nat_new_thread even on the first LWP. Adjust to interface change. (delete_lwp): Call lwp_free instead of xfree. (detach_callback, linux_nat_detach, resume_lwp, linux_nat_resume) (linux_handle_syscall_trap, linux_handle_extended_wait) (linux_nat_filter_event, resume_stopped_resumed_lwps): Call linux_nat_prepare_to_resume before resuming. (linux_stop_lwp): New. (linux_nat_set_new_thread): Adjust. (linux_nat_set_prepare_to_resume): New. * linux-nat.h (struct arch_lwp_info): Forward declare. (struct lwp_info) <arch_private>: New field. (linux_stop_lwp): Declare. (linux_nat_set_new_thread): Adjust. (linux_nat_set_prepare_to_resume): New. * i386-nat.c (DR_NADDR, DR_STATUS, DR_CONTROL) (struct i386_debug_reg_state): Move to i386-nat.h. (dr_mirror): Comment. (i386_debug_reg_state): New. (i386_update_inferior_debug_regs): Simplify. (i386_stopped_data_address): Use the debug register state from the inferior, not from the local cache. * i386-nat.h (struct i386_dr_low_type): Delete reset_addr and unset_status fields. New get_addr and get_control fields. (DR_FIRSTADDR, DR_LASTADDR, DR_CONTROL): Moved from i386-nat.c. (DR_NADDR, DR_STATUS): New. (struct i386_debug_reg_state): Moved from i386-nat.c. * amd64-linux-nat.c (struct arch_lwp_info): New. (amd64_linux_dr): Delete global. (amd64_linux_dr_get_addr): New. (amd64_linux_dr_get_control): New. (amd64_linux_dr_unset_status): Delete. (amd64_linux_dr_set_addr): Reimplement. (amd64_linux_dr_reset_addr): Delete. (update_debug_registers_callback): New. (amd64_linux_dr_set_control): Reimplement. (amd64_linux_dr_set_addr): Reimplement. (amd64_linux_prepare_to_resume): New. (amd64_linux_new_thread): Change parameter to an lwp pointer. Reimplement. (_initialize_amd64_linux_nat): No longer install i386_dr_low.reset_addr and i386_dr_low.unset_status. Install amd64_linux_dr_get_control as i386_dr_low.get_control. Install amd64_linux_dr_get_addr as i386_dr_low.get_addr. Install amd64_linux_prepare_to_resume. * i386-linux-nat.c (DR_FIRSTADDR, DR_LASTADDR, DR_STATUS) (DR_CONTROL): Delete. (struct arch_lwp_info): New. (i386_linux_dr): Delete global. (i386_linux_dr_set_control): Reimplement. (i386_linux_dr_get_addr): New. (i386_linux_dr_set_addr): Reimplement. (i386_linux_dr_get_control): New. (update_debug_registers_callback): New. (i386_linux_dr_unset_status): Delete. (i386_linux_dr_set_addr): Reimplement. (i386_linux_prepare_to_resume): New. (i386_linux_new_thread): Change parameter to an lwp pointer. Reimplement. (_initialize_i386_linux_nat): No longer install i386_dr_low.reset_addr and i386_dr_low.unset_status. Install i386_linux_dr_get_control as i386_dr_low.get_control. Install i386_linux_dr_get_addr as i386_dr_low.get_addr. Install i386_linux_prepare_to_resume. * arm-linux-nat.c (arm_linux_new_thread): Change parameter to an lwp pointer. Adjust. * ia64-linux-nat.c (ia64_linux_new_thread): Likewise. * mips-linux-nat.c (mips_linux_new_thread): Likewise. * ppc-linux-nat.c (ppc_linux_new_thread): Likewise. * s390-nat.c (s390_fix_watch_points): Likewise. * i386-darwin-nat.c (DR_FIRSTADDR, DR_LASTADDR, DR_STATUS) (DR_CONTROL): Delete. (i386_darwin_dr_reset_addr): Delete. (i386_darwin_dr_get_addr): New. (i386_darwin_dr_get_control): New. * go32-nat.c (go32_get_dr7, go32_get_dr): New. (init_go32_ops): No longer install i386_dr_low.reset_addr. Install go32_get_dr7 as i386_dr_low.get_control. Install go32_get_dr as i386_dr_low.get_addr. * i386bsd-nat.c (i386bsd_dr_get): New. (i386bsd_dr_reset_addr): Delete. (i386bsd_dr_get_addr): New. (i386bsd_dr_get_status): Use i386bsd_dr_get. (i386bsd_dr_get_control): New. * i386bsd-nat.h (i386bsd_dr_reset_addr): Delete. (i386bsd_dr_get_addr): New. (i386bsd_dr_get_control): New. * i386fbsd-nat.c (_initialize_i386fbsd_nat): No longer install i386_dr_low.reset_addr and i386_dr_low.unset_status. Install i386bsd_dr_get_control as i386_dr_low.get_control. Install i386bsd_dr_get_addr as i386_dr_low.get_addr. * windows-nat.c (init_windows_ops): No longer install i386_dr_low.reset_addr and i386_dr_low.unset_status. Install cygwin_get_dr7 as i386_dr_low.get_control. Install cygwin_get_dr as i386_dr_low.get_addr. (cygwin_get_dr): New. (cygwin_get_dr7): New. gdb/testsuite/ 2011-12-14 Pedro Alves <pedro@codesourcery.com> PR threads/10729 * gdb.mi/watch-nonstop.c: New file. * gdb.mi/mi-watch-nonstop.exp: New file.
2011-12-14 18:20:32 +01:00
linux_nat_set_prepare_to_resume (t, amd64_linux_prepare_to_resume);
}