* linux-nat.h (linux_proc_xfer_memory): Change type of "myaddr" a
"gdb_byte" pointer.
* linux-nat.c (linux_proc_xfer_memory): Update.
(get_signo): Cast signo to a "gdb_byte" pointer.
* i386-linux-nat.c (child_resume): Make "buf" a gdb_byte, delete
redundant casts.
(child_resume): Cast eflags to a "gdb_byte" pointer.
Only define PTRACE_GET_THREAD_AREA is not already defined.
Various style fixes in code and comments and some additional
spelling fixes in comments. Move after functions dealing with
debug registers.
* x86-64-linux-nat.c (ps_get_thread_area): Don't define as extern.
Fix coding-style.
* config/i386/nm-linux.h (LINUX_CHILD_POST_STARTUP_INFERIOR): Define.
* config/nm-linux.h (CHILD_POST_STARTUP_INFERIOR, CHILD_POST_ATTACH)
(CHILD_FOLLOW_FORK, KILL_INFERIOR): Define.
* i386-linux-nat.c: Include "linux-nat.h".
(child_post_startup_inferior): New function.
* i386-nat.c (child_post_startup_inferior): Wrap in #ifdef.
* infptrace.c (kill_inferior): Wrap in #ifdef.
* lin-lwp.c (lin_lwp_attach_lwp): Call child_post_attach after
attaching to each LWP.
(child_wait, lin_lwp_wait): Call linux_handle_extended_wait.
(init_lin_lwp_ops): Fill in some more operations.
* linux-nat.h (linux_enable_event_reporting)
(linux_handle_extended_wait, linux_child_post_startup_inferior): New
prototypes.
* linux-nat.c (linux_enable_event_reporting): New function.
(child_post_attach, linux_child_post_startup_inferior)
(child_post_startup_inferior, child_follow_fork)
(linux_handle_extended_wait, kill_inferior): New functions.
* acconfig.h: Add HAVE_TKILL_SYSCALL definition check.
* config.in: Regenerated.
* configure.in: Add test for syscall function and check for
__NR_tkill macro in <syscall.h> to set HAVE_TKILL_SYSCALL.
* configure: Regenerated.
* lin-lwp.c [HAVE_TKILL_SYSCALL]: Include <unistd.h> and
<sys/syscall.h>.
(kill_lwp): New function that uses tkill syscall or
uses kill, depending on whether threading model is nptl or not.
All callers of kill() changed to use kill_lwp().
(lin_lwp_wait): Make special check when WIFEXITED occurs to
see if all threads have already exited in the nptl model.
(stop_and_resume_callback): New callback function used by the
lin_lwp_wait thread exit handling code.
(stop_wait_callback): Check for threads already having exited and
delete such threads fromt the lwp list when discovered.
(stop_callback): Don't assert retcode of kill call.
Roland McGrath <roland@redhat.com>
* i386-linux-nat.c (ps_get_thread_area): New function needed by
nptl libthread_db.
readable.
(fetch_register, store_register, fetch_inferior_registers,
store_inferior_registers): Get rid of assignment in if-statement.
(store_register): Fix typo in error message.
defined.
(regmap): Extend to cover all registers.
(PT_READ_U, PT_WRITE_U, PTRACE_XFER_TYPE,
OLD_CANNOT_FETCH_REGISTERS, OLD_CANNOT_STORE_REGISTERS): Remove
definitions.
(fetch_register, sore_register): Simplify.
(old_fetch_inferior_registers, old_store_inferior_registers):
Remove functions.
(cannot_fetch_register, cannot_store_register): Change
implementation to use regmap array to decide which registers
cannot be fetched/stored. This removes $orig_eax from the
registers that cannot be fetched/stored.
(fetch_inferior_registers): Call fetch_register directly instead
of calling old_fetch_inferior_registers.
(store_inferior_registers): Call store_register directly instead
of calling old_store_inferior_registers.
(i386_linux_dr_get): Replace PT_READ_U with PTRACE_PEEKUSER.
(i386_linux_dr_set): Replace PT_WRITE_U with PTRACE_POKEUSER.
* config/i386/nm-linux.h (U_REGS_OFFSET): Remove definition.
value to `unsigned long'. Change type of `value' to `unsigned
long'.
(i386_linux_dr_set): Change type of second argument to `unsigned
long'.
(i386_linux_dr_set_control): Change type of first argument to
`unsigned long'.
(i386_linux_dr_get_status): Change type of return value to
unsigned long.
* config/i386/nm-linux.h (i386_linux_dr_set_control,
i386_linux_dr_get_status): Adjust prototypes accordingly.
and watchpoints on x86 targets.
* i386-linux-nat.c: Doc fixes. Include "gdb_assert.h".
[HAVE_SYS_DEBUGREG_H]: Include <sys/debugreg.h>.
(DR_FIRSTADDR, DR_LASTADDR, DR_STATUS, DR_CONTROL): Define to
appropriate value if not already defined.
(register_u_addr): New function.
(kernel_u_size): New function.
(i386_linux_dr_get, i386_linux_dr_set): New functions.
(i386_linux_dr_set_control, i386_linux_dr_set_addr,
i386_linux_reset_addr, i386_linux_dr_get_status): New functions.
* config/i386/nm-linux.h: Don't include "nm-i386v.h".
(I386_USE_GENERIC_WATCHPOINTS): Define and include "nm-i386.h".
(TARGET_HAS_HARDWARE_WATCHPOINTS,
TARGET_CAN_USE_HARDWARE_WATCHPOINTS, HAVE_CONTINUABLE_WATCHPOINT,
STOPPED_BY_WATCHPOINT, target_insert_watchpoint,
target_remove_watchpoint): Remove macros.
(i386_stopped_by_watchpoint, i386_insert_watchpoint,
i386_remove_watchpoint): Remove prototypes.
(register_u_addr): New prototype.
(REGISTER_U_ADDR): Define in terms of register_u_addr.
(i386_linux_dr_set_control, i386_linux_dr_set_addr,
i386_linux_reset_addr, i386_linux_dr_get_status): New prototypes.
(I386_DR_LOW_SET_CONTROL, I386_DR_LOW_SET_ADDR,
I386_DR_LOW_RESET_ADDR, I386_DR_LOW_GET_STATUS): New macros.
* config/i386/linux.mh (NATDEPFILES): Replace i386v-nat.o with
i386-nat.o.
OLD_CANNOT_FETCH_REGISTER): New definitions for accessible registers
when accessing the registers via the U area.
(fetch_register, store_register): Use them.
(cannot_fetch_register, cannot_store_register): New functions,
all registers should be accessible if we have GETREGS support.
* config/i386/nm-linux.h: Use cannot_fetch/store_register for
CANNOT_FETCH/STORE_REGISTER definitions.
* i386-linux-nat.c (i386_linux_skip_solib_resolver,
skip_hurd_resolver, find_minsym_and_objfile): Move these
solib functions into i386-linux-tdep.c for cross debugging.
* i386-linux-tdep.c: Receive the above functions.
* i386-linux-nat.c: Various doc fixes. Include "i387-nat.h".
(GETFPXREGS_SUPPLIES): Renamed from GETXFPREGS_SUPPLIES.
(have_ptrace_getfpxregs): Renamed from have_ptrace_getxfpregs.
(convert_to_gregset): Removed. Moved logic to ...
(fill_gregset): ... here. Simplified function.
(fetch_regs): Use perror_with_name for error reporting.
(store_regs): Add `regno' parameter. Use perror_with_name for
error reporting. Call fill_gregset instead of convert_to_gregset.
(FPREG_ADDR): Remove.
(supply_fpregset): Implement by calling i387_supply_fsave.
(convert_to_fpregset): Remove.
(fill_fpregset): Implement by calling i387_fill_fsave.
(fetch_fpregs): Use perror_with_name fro error reporting.
(store_fpregs) Add `regno' parameter. Use perror_with_name fro
error reporting. Call fill_fpregset instead of
convert_to_fpregset.
(supply_xfpregset, convert_to_xfpregset): Removed.
(supply_fpxregset, fill_fpxregset): New functions.
(fetch_fpxregs): Renamed from fetch_xfpregs. Use perror_with_name
for error reporting. Call supply_fpxregset instead of
supply_xfpregset.
(store_xfpregs): Removed.
(store_fpxregs): New function.
(fetch_inferior_registers): Adjust for xfp -> fpx change. Tweak
message in call to internal_error.
(store_inferior_registers): Adjust for xfp ->fpx change. Pass
REGNO to store_regs, store_fpregs and store_fpxregs.
(fetch_core_registers): Adjust for xfp -> fpx change.
* acconfig.h (HAVE_PTRACE_GETFPXREGS): Renamed from
HAVE_PTRACE_GETXFPREGS.
* config.in: Regenerated.
* configure.in: Replace check for PTRACE_GETXFPREGS with check for
PTRACE_GETFPXREGS. Remove comment about Cygnus SSE extensions.
* configure: Regenerated.
* config/i386/linux.mh (NATDEPFILES): Add i387-nat.o.
* config/i386/tm-linux.h: Base definition of HAVE_SSE_REGS on
HAVE_PTRACE_GETFPXREGS instead of HAVE_PTRACE_GETXFPREGS.
* gregset.h: New file. Typedefs for gdb_gregset_t and
gdb_fpregset_t, prototypes for supply_gregset and friends.
* procfs.c: Include gregset.h. Delete local prototypes for
supply_gregset etc., and local typedef gdb_gregset_t etc.
* sol-thread.c: Include gregset.h, delete local prototypes,
add appropriate casts to gdb_gregset_t.
* uw-thread.c, lin-thread.c, core-sol2.c, core-regset.c,
sparc-tdep.c, ptx4-nat.c, ppc-linux-nat.c, mipsv4-nat.c,
m88k-nat.c, m68klinux-nat.c, m68k-tdep.c, irix5-nat.c,
irix4-nat.c, ia64-linux-nat.c, i386v4-nat.c, cxux-nat.c,
arm-linux-nat.c, alpha-nat.c: Include gregset.h.
* config/nm-linux.h: Define GDB_GREGSET_T, GDB_FPREGET_T.
* config/sparc/tm-sun4sol2.h: Ditto.
(LINUX_SIGTRAMP_INSN0, LINUX_SIGTRAMP_OFFSET0,
LINUX_SIGTRAMP_INSN1, LINUX_SIGTRAMP_OFFSET1,
LINUX_SIGTRAMP_INSN2, LINUX_SIGTRAMP_OFFSET2, linux_sigtramp_code,
LINUX_SIGTRAMP_LEN, i386_linux_sigtramp_start,
LINUX_RT_SIGTRAMP_INSN0, LINUX_RT_SIGTRAMP_OFFSET0,
LINUX_RT_SIGTRAMP_INSN1, LINUX_RT_SIGTRAMP_OFFSET1,
linux_rt_sigtramp_code, LINUX_RT_SIGTRAMP_LEN,
i386_linux_rt_sigtramp_start, i386_linux_in_sigtramp,
i386_linux_sigcontext_addr, LINUX_SIGCONTEXT_PC_OFFSET,
i386_linux_sigtramp_saved_pc, LINUX_SIGCONTEXT_SP_OFFSET,
i386_linux_sigtramp_saved_sp): Deleted. Folks rightly pointed
out that these are target-dependent, and useful in non-native
configurations. Moved to...
* i386-linux-tdep.c: ... Here, a new file.
* Makefile.in (ALLDEPFILES): Add i386-linux-tdep.c.
(i386-linux-tdep.o): New rule.
(i386-linux-nat.o): We no longer depend on frame.h.
* config/i386/linux.mt (TDEPFILES): Add i386-linux-tdep.o.
LINUX_SIGTRAMP_INSN1, LINUX_SIGTRAMP_OFFSET1,
LINUX_SIGTRAMP_INSN2, LINUX_SIGTRAMP_OFFSET2, linux_sigtramp_code,
LINUX_SIGTRAMP_LEN, i386_linux_sigtramp_start,
LINUX_RT_SIGTRAMP_INSN0, LINUX_RT_SIGTRAMP_OFFSET0,
LINUX_RT_SIGTRAMP_INSN1, LINUX_RT_SIGTRAMP_OFFSET1,
linux_rt_sigtramp_code, LINUX_RT_SIGTRAMP_LEN,
i386_linux_rt_sigtramp_start, i386_linux_in_sigtramp,
i386_linux_sigcontext_addr, LINUX_SIGCONTEXT_PC_OFFSET,
i386_linux_sigtramp_saved_pc, LINUX_SIGCONTEXT_SP_OFFSET,
i386_linux_sigtramp_saved_sp): Deleted. These all implement
Linux-specific signal trampoline detection, and should be moved to...
* i386-linux-nat.c: ... here.
* config/i386/tm-linux.h (I386_LINUX_SIGTRAMP): No need to define
this any more, since we're not enabling OS-specific code in a
OS-independent file.
Allow GDB to run on Linux 2.0 again.
* config.in: Add HAVE_PTRACE_GETREGS.
* configure.in: Check if <sys/ptrace.h> defines PTRACE_GETREGS.
* configure: Regenerated.
* config/i386/nm-linux.h (CANNOT_FETCH_REGISTER,
CANNOT_STORE_REGISTER): New defines.
* i386-linux-nat.c (have_ptrace_getregs): New variable.
(PTRACE_XFER_TYPE, CANNOT_FETCH_REGISTER, fetch_register,
old_fetch_inferior_registers, CANNOT_STORE_REGISTER,
store_register, old_store_inferior_registers): Copied over from
`inptrace.c' as a temporary measure.
(fetch_regs, store_regs, fetch_fpregs, store_fpregs):
Conditionalize on HAVE_PTRACE_GETREGS. Define stubs if
HAVE_PTRACE_GETREGS isn't defined.
(fetch_regs): Reset `have_ptrace_getregs' if ptrace call fails
with EIO.
(fetch_inferior_registers, store_inferior_registers): Fall back on
the method use in `infptrace.c' (by calling
old_fetch_inferior_registers and old_store_inferior_registers) if
`have_ptrace_getregs' isn't set.
* i386-linux-nat.c: Use elf_gregset_t and elf_fpregset_t instead
of gregset_t and fpregset_t. Those are the only names that are
guaranteed to specify the right types for all supported Linux
systems out there.
Various doc fixes and gratitious local variable renames, all in an
attempt to stress similarities between the code and unify the
terminology used. Use ISO-C all over.
(regmap): Remove trailing comma.
(FPREG_ADDR): Renamed from FPREGSET_T_FPREG_ADDR.
(convert_to_gregset): Make static. Remove GDB_REGS argument. It
is unnecessary and wasn't used anyway. All callers changed.
(convert_to_fpregset, convert_to_xfpregset): Likewise.
(fetch_regs, store_regs): Remove unused variable `regno'.
(fill_fpregs): If REGNO is not -1, only update the specified
register.
(fetch_core_registers): Renamed from
i386_linux_fetch_core_registers. There is no need for a unique
name since the function is static anyway.
(linux_elf_core_fns): Renamed from i386_linux_nat_core_functions
since it is more descriptive.