2004-10-05 21:53:33 +00:00
|
|
|
|
/* Native support code for HPUX PA-RISC, for GDB the GNU debugger.
|
|
|
|
|
|
|
|
|
|
Copyright 1986, 1987, 1989, 1990, 1991, 1992, 1993, 1994, 1995,
|
|
|
|
|
1996, 1998, 1999, 2000, 2001, 2004 Free Software Foundation, Inc.
|
1999-04-16 01:35:26 +00:00
|
|
|
|
|
|
|
|
|
Contributed by the Center for Software Science at the
|
|
|
|
|
University of Utah (pa-gdb-bugs@cs.utah.edu).
|
|
|
|
|
|
1999-07-07 20:19:36 +00:00
|
|
|
|
This file is part of GDB.
|
1999-04-16 01:35:26 +00:00
|
|
|
|
|
1999-07-07 20:19:36 +00:00
|
|
|
|
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 2 of the License, or
|
|
|
|
|
(at your option) any later version.
|
1999-04-16 01:35:26 +00:00
|
|
|
|
|
1999-07-07 20:19:36 +00:00
|
|
|
|
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.
|
1999-04-16 01:35:26 +00:00
|
|
|
|
|
1999-07-07 20:19:36 +00:00
|
|
|
|
You should have received a copy of the GNU General Public License
|
|
|
|
|
along with this program; if not, write to the Free Software
|
|
|
|
|
Foundation, Inc., 59 Temple Place - Suite 330,
|
|
|
|
|
Boston, MA 02111-1307, USA. */
|
1999-04-16 01:35:26 +00:00
|
|
|
|
|
|
|
|
|
|
|
|
|
|
#include "defs.h"
|
|
|
|
|
#include "inferior.h"
|
|
|
|
|
#include "target.h"
|
|
|
|
|
#include <sys/ptrace.h>
|
|
|
|
|
#include "gdbcore.h"
|
2000-02-24 08:55:15 +00:00
|
|
|
|
#include "gdb_wait.h"
|
2001-03-01 01:39:22 +00:00
|
|
|
|
#include "regcache.h"
|
2003-03-29 23:29:47 +00:00
|
|
|
|
#include "gdb_string.h"
|
2004-04-06 17:56:01 +00:00
|
|
|
|
#include "infttrace.h"
|
1999-04-16 01:35:26 +00:00
|
|
|
|
#include <signal.h>
|
|
|
|
|
|
2004-05-06 Randolph Chung <tausq@debian.org>
* config/pa/tm-hppa.h (RO_REGNUM, FLAGS_REGNUM, RP_REGNUM)
(HPPA_FP_REGNUM, HPPA_SP_REGNUM, SAR_REGNUM, IPSW_REGNUM)
(PCOQ_HEAD_REGNUM, PCSQ_HEAD_REGNUM, PCOQ_TAIL_REGNUM, PCSQ_TAIL_REGNUM)
(EIEM_REGNUM, IIR_REGNUM, ISR_REGNUM, IOR_REGNUM, SR4_REGNUM)
(RCR_REGNUM, PID0_REGNUM, PID1_REGNUM, PID2_REGNUM, PID3_REGNUM)
(CCR_REGNUM, TR0_REGNUM, CR27_REGNUM, HPPA_FP0_REGNUM, FP4_REGNUM)
(ARG0_REGNUM, ARG1_REGNUM, ARG2_REGNUM, ARG3_REGNUM): Move *_REGNUM
definitions ...
* hppa-tdep.h: ... to here, with HPPA_ prefix.
* Makefile.in (hppah-nat.o): Add $(hppa_tdep_h)
* hppa-hpux-tdep.c (hppa32_hpux_frame_find_saved_regs_in_sig)
(hppa64_hpux_frame_find_saved_regs_in_sig)
(child_get_current_exception_event): Add HPPA_ prefix to *_REGNUM usage.
* hppa-linux-nat.c (GR_REGNUM, TR_REGNUM, greg_map): Likewise.
* hppa-linux-tdep.c (hppa_dwarf_reg_to_regnum)
(hppa_linux_target_write_pc, hppa_linux_sigtramp_frame_unwind_cache)
(hppa_linux_sigtramp_frame_prev_register): Likewise.
* hppa-tdep.c (hppa32_return_value, hppa64_return_value)
(hppa32_push_dummy_call, hppa64_push_dummy_call, hppa64_frame_align)
(hppa_target_read_pc, hppa_target_write_pc, hppa_frame_cache)
(hppa_frame_prev_register, hppa_stub_frame_unwind_cache)
(hppa_stub_frame_prev_register, hppa_unwind_dummy_id)
(hppa_skip_permanent_breakpoint, hppa_instruction_nullified)
(hppa32_register_type, hppa_cannot_store_register)
(hppa_fetch_pointer_argument, hppa_pseudo_register_read): Likewise.
* hppah-nat.c (store_inferior_registers, fetch_register): Likewise.
* hpread.c (hpread_process_one_debug_symbol): Likewise.
* pa64solib.c (pa64_solib_have_load_event)
(pa64_solib_have_unload_event, pa64_solib_loaded_library_pathname)
(pa64_solib_unloaded_library_pathname): Likewise.
* somsolib.c (som_solib_have_load_event, som_solib_have_unload_event)
(som_solib_library_pathname): Likewise.
2004-05-07 05:48:50 +00:00
|
|
|
|
#include "hppa-tdep.h"
|
* breakpoint.c (bpstat_stop_status): Call inferior_has_forked,
inferior_has_vforked, and inferior_has_execd instead of
target_has_forked, target_has_vforked, and target_has_execd.
* config/pa/nm-hppah.h (CHILD_HAS_FORKED, CHILD_HAS_VFORKED)
(CHILD_HAS_EXECD, CHILD_HAS_SYSCALL_EVENT): Don't define.
(CHILD_WAIT): Define.
(child_wait): Add prototype.
* hppah-nat.c (hpux_has_forked): Rename from child_has_forked.
Add prototype.
(hpux_has_vforked): Likewise, from child_has_vforked.
(hpux_has_execd): Likewise, from child_has_execd.
(hpux_has_syscall_event): Likewise, from child_has_syscall_event.
(not_same_real_pid, child_wait): New, copied from inftarg.c.
Call hpux_has_forked, hpux_has_vforked, hpux_has_execd,
and hpux_has_syscall_event instead of the target hooks.
* infrun.c (inferior_has_forked, inferior_has_vforked)
(inferior_has_execd): New functions.
* inftarg.c (not_same_real_pid): Remove.
(child_wait): Remove references to not_same_real_pid,
target_has_forked, target_has_vforked, target_has_execd,
and target_has_syscall_event.
(child_has_forked, child_has_vforked, child_has_execd)
(child_has_syscall_event): Remove.
(init_child_ops): Remove references to child_has_forked,
child_has_vforked, child_has_execd, and child_has_syscall_event.
* infttrace.c (hpux_has_forked): Rename from child_has_forked.
(hpux_has_vforked): Likewise, from child_has_vforked.
(hpux_has_execd): Likewise, from child_has_execd.
(hpux_has_syscall_event): Likewise, from child_has_syscall_event.
* target.c (cleanup_target): Remove references to
to_has_forked, to_has_vforked, to_has_execd, and
to_has_syscall_event.
(update_current_target): Likewise.
(setup_target_debug): Likewise.
(debug_to_has_forked): Remove.
(debug_to_has_vforked): Remove.
(debug_to_has_execd): Remove.
(debug_to_has_syscall_event): Remove.
* target.h (struct target_ops): Remove to_has_forked.
to_has_vforked, to_has_execd, and to_has_syscall_event.
(child_has_forked, child_has_vforked, child_has_execd)
(child_has_syscall_event): Remove prototypes.
(inferior_has_forked, inferior_has_vforked, inferior_has_execd): Add
prototypes.
(target_has_forked, target_has_vforked, target_has_execd)
(target_has_syscall_event): Remove macros.
2002-11-16 19:22:59 +00:00
|
|
|
|
|
2003-09-19 20:09:45 +00:00
|
|
|
|
static CORE_ADDR text_end;
|
|
|
|
|
|
|
|
|
|
void
|
|
|
|
|
deprecated_hpux_text_end (struct target_ops *exec_ops)
|
|
|
|
|
{
|
|
|
|
|
struct section_table *p;
|
|
|
|
|
|
|
|
|
|
/* Set text_end to the highest address of the end of any readonly
|
|
|
|
|
code section. */
|
|
|
|
|
/* FIXME: The comment above does not match the code. The code
|
|
|
|
|
checks for sections with are either code *or* readonly. */
|
|
|
|
|
text_end = (CORE_ADDR) 0;
|
|
|
|
|
for (p = exec_ops->to_sections; p < exec_ops->to_sections_end; p++)
|
|
|
|
|
if (bfd_get_section_flags (p->bfd, p->the_bfd_section)
|
|
|
|
|
& (SEC_CODE | SEC_READONLY))
|
|
|
|
|
{
|
|
|
|
|
if (text_end < p->endaddr)
|
|
|
|
|
text_end = p->endaddr;
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
2000-05-28 01:12:42 +00:00
|
|
|
|
static void fetch_register (int);
|
1999-04-16 01:35:26 +00:00
|
|
|
|
|
|
|
|
|
void
|
2000-07-30 01:48:28 +00:00
|
|
|
|
fetch_inferior_registers (int regno)
|
1999-04-16 01:35:26 +00:00
|
|
|
|
{
|
|
|
|
|
if (regno == -1)
|
|
|
|
|
for (regno = 0; regno < NUM_REGS; regno++)
|
|
|
|
|
fetch_register (regno);
|
|
|
|
|
else
|
|
|
|
|
fetch_register (regno);
|
|
|
|
|
}
|
|
|
|
|
|
1999-08-16 19:57:19 +00:00
|
|
|
|
/* Our own version of the offsetof macro, since we can't assume ANSI C. */
|
|
|
|
|
#define HPPAH_OFFSETOF(type, member) ((int) (&((type *) 0)->member))
|
|
|
|
|
|
1999-04-16 01:35:26 +00:00
|
|
|
|
/* Store our register values back into the inferior.
|
|
|
|
|
If REGNO is -1, do this for all registers.
|
|
|
|
|
Otherwise, REGNO specifies which register (so we can save time). */
|
|
|
|
|
|
|
|
|
|
void
|
2000-07-30 01:48:28 +00:00
|
|
|
|
store_inferior_registers (int regno)
|
1999-04-16 01:35:26 +00:00
|
|
|
|
{
|
2003-09-14 Andrew Cagney <cagney@redhat.com>
* alpha-nat.c: Remove some occurances of "register".
* alpha-tdep.c, arm-tdep.c, blockframe.c, breakpoint.c: Ditto.
* buildsym.c, c-typeprint.c, c-valprint.c, coffread.c: Ditto.
* corefile.c, cp-support.c, cp-valprint.c, cris-tdep.c: Ditto.
* dbxread.c, dcache.c, dwarf2read.c, elfread.c: Ditto.
* environ.c, eval.c, event-top.c, f-typeprint.c: Ditto.
* f-valprint.c, findvar.c, frame.c, gdbtypes.c: Ditto.
* h8300-tdep.c, hppa-tdep.c, hppab-nat.c, hppah-nat.c: Ditto.
* hppam3-nat.c, hpread.c, ia64-aix-nat.c, ia64-linux-nat.c: Ditto.
* infcall.c, infcmd.c, inflow.c, infptrace.c, infrun.c: Ditto.
* infttrace.c, irix5-nat.c, jv-typeprint.c: Ditto.
* jv-valprint.c, m68k-tdep.c, m68klinux-nat.c, main.c: Ditto.
* mdebugread.c, minsyms.c, mips-linux-tdep.c: Ditto.
* mips-nat.c, mips-tdep.c, mipsread.c, mipsv4-nat.c: Ditto.
* ns32k-tdep.c, objfiles.c, p-typeprint.c: Ditto.
* p-valprint.c, ppc-linux-nat.c, printcmd.c: Ditto.
* remote-mips.c, remote-vx.c, rs6000-nat.c: Ditto.
* rs6000-tdep.c, scm-exp.c, sh-tdep.c, sh64-tdep.c: Ditto.
* solib.c, somread.c, source.c, sparc-tdep.c: Ditto.
* stabsread.c, stack.c, standalone.c, symfile.c: Ditto.
* symmisc.c, symtab.c, top.c, tracepoint.c: Ditto.
* typeprint.c, utils.c, valarith.c, valops.c: Ditto.
* values.c, vax-tdep.c, xcoffread.c: Ditto.
2003-09-14 16:32:14 +00:00
|
|
|
|
unsigned int regaddr;
|
1999-04-16 01:35:26 +00:00
|
|
|
|
char buf[80];
|
2003-09-14 Andrew Cagney <cagney@redhat.com>
* alpha-nat.c: Remove some occurances of "register".
* alpha-tdep.c, arm-tdep.c, blockframe.c, breakpoint.c: Ditto.
* buildsym.c, c-typeprint.c, c-valprint.c, coffread.c: Ditto.
* corefile.c, cp-support.c, cp-valprint.c, cris-tdep.c: Ditto.
* dbxread.c, dcache.c, dwarf2read.c, elfread.c: Ditto.
* environ.c, eval.c, event-top.c, f-typeprint.c: Ditto.
* f-valprint.c, findvar.c, frame.c, gdbtypes.c: Ditto.
* h8300-tdep.c, hppa-tdep.c, hppab-nat.c, hppah-nat.c: Ditto.
* hppam3-nat.c, hpread.c, ia64-aix-nat.c, ia64-linux-nat.c: Ditto.
* infcall.c, infcmd.c, inflow.c, infptrace.c, infrun.c: Ditto.
* infttrace.c, irix5-nat.c, jv-typeprint.c: Ditto.
* jv-valprint.c, m68k-tdep.c, m68klinux-nat.c, main.c: Ditto.
* mdebugread.c, minsyms.c, mips-linux-tdep.c: Ditto.
* mips-nat.c, mips-tdep.c, mipsread.c, mipsv4-nat.c: Ditto.
* ns32k-tdep.c, objfiles.c, p-typeprint.c: Ditto.
* p-valprint.c, ppc-linux-nat.c, printcmd.c: Ditto.
* remote-mips.c, remote-vx.c, rs6000-nat.c: Ditto.
* rs6000-tdep.c, scm-exp.c, sh-tdep.c, sh64-tdep.c: Ditto.
* solib.c, somread.c, source.c, sparc-tdep.c: Ditto.
* stabsread.c, stack.c, standalone.c, symfile.c: Ditto.
* symmisc.c, symtab.c, top.c, tracepoint.c: Ditto.
* typeprint.c, utils.c, valarith.c, valops.c: Ditto.
* values.c, vax-tdep.c, xcoffread.c: Ditto.
2003-09-14 16:32:14 +00:00
|
|
|
|
int i;
|
1999-04-16 01:35:26 +00:00
|
|
|
|
unsigned int offset = U_REGS_OFFSET;
|
|
|
|
|
int scratch;
|
|
|
|
|
|
|
|
|
|
if (regno >= 0)
|
|
|
|
|
{
|
1999-08-16 19:57:19 +00:00
|
|
|
|
unsigned int addr, len, offset;
|
|
|
|
|
|
1999-04-16 01:35:26 +00:00
|
|
|
|
if (CANNOT_STORE_REGISTER (regno))
|
|
|
|
|
return;
|
1999-08-16 19:57:19 +00:00
|
|
|
|
|
|
|
|
|
offset = 0;
|
2004-08-02 Andrew Cagney <cagney@gnu.org>
Replace DEPRECATED_REGISTER_RAW_SIZE with register_size.
* rs6000-tdep.c (rs6000_push_dummy_call)
(rs6000_extract_return_value): Use register_size.
* xstormy16-tdep.c (xstormy16_get_saved_register)
(xstormy16_extract_return_value): Ditto.
* valops.c (value_assign): Ditto.
* v850ice.c (v850ice_fetch_registers, v850ice_store_registers):
* v850-tdep.c (v850_extract_return_value): Ditto.
* tracepoint.c (collect_symbol): Ditto.
* target.c (debug_print_register): Ditto.
* stack.c (frame_info): Ditto.
* rs6000-nat.c (ARCH64, fetch_register, store_register): Ditto.
* rom68k-rom.c (rom68k_supply_one_register): Ditto.
* remote.c (struct packet_reg, remote_wait, remote_async_wait)
(store_register_using_P): Ditto.
* remote-vxmips.c (vx_read_register, vx_write_register): Ditto.
* remote-sim.c (gdbsim_fetch_register, gdbsim_store_register): Ditto.
* remote-mips.c (mips_wait, mips_fetch_registers): Ditto.
* remote-e7000.c (fetch_regs_from_dump, sub2_from_pc): Ditto.
* regcache.c (deprecated_read_register_bytes)
(deprecated_write_register_bytes, read_register)
(write_register): Ditto.
* ppc-linux-nat.c (fetch_altivec_register, fetch_register)
(supply_vrregset, store_altivec_register, fill_vrregset): Ditto.
* monitor.c (monitor_supply_register, monitor_fetch_register)
(monitor_store_register): Ditto.
* mn10300-tdep.c (mn10300_pop_frame_regular)
(mn10300_print_register): Ditto.
* mipsv4-nat.c (fill_fpregset): Ditto.
* mips-linux-tdep.c (supply_32bit_reg, fill_fpregset)
(mips64_fill_fpregset): Ditto.
* mi/mi-main.c (register_changed_p, get_register)
(mi_cmd_data_write_register_values): Ditto.
* lynx-nat.c (fetch_inferior_registers, store_inferior_registers):
* irix5-nat.c (fill_gregset, fetch_core_registers):
* infrun.c (write_inferior_status_register): Ditto.
* infptrace.c (fetch_register, store_register): Ditto.
* infcmd.c (default_print_registers_info): Ditto.
* ia64-linux-nat.c (COPY_REG, fill_fpregset): Ditto.
* ia64-aix-nat.c (COPY_REG, fill_gregset): Ditto.
* i386gnu-nat.c (gnu_store_registers, fill): Ditto.
* hpux-thread.c (hpux_thread_fetch_registers)
(hpux_thread_store_registers): Ditto.
* hppah-nat.c (store_inferior_registers, fetch_register):
* findvar.c (value_from_register): Ditto.
* dve3900-rom.c (fetch_bitmapped_register):
* cris-tdep.c (cris_gdbarch_init): Ditto.
* alpha-tdep.h: Ditto.
* aix-thread.c (pd_enable, fill_sprs64, fill_sprs32): Ditto.
2004-08-03 00:57:27 +00:00
|
|
|
|
len = register_size (current_gdbarch, regno);
|
1999-08-16 19:57:19 +00:00
|
|
|
|
|
|
|
|
|
/* Requests for register zero actually want the save_state's
|
|
|
|
|
ss_flags member. As RM says: "Oh, what a hack!" */
|
|
|
|
|
if (regno == 0)
|
1999-05-05 14:45:51 +00:00
|
|
|
|
{
|
1999-08-16 19:57:19 +00:00
|
|
|
|
save_state_t ss;
|
|
|
|
|
addr = HPPAH_OFFSETOF (save_state_t, ss_flags);
|
|
|
|
|
len = sizeof (ss.ss_flags);
|
|
|
|
|
|
|
|
|
|
/* Note that ss_flags is always an int, no matter what
|
2004-08-02 Andrew Cagney <cagney@gnu.org>
Replace DEPRECATED_REGISTER_RAW_SIZE with register_size.
* rs6000-tdep.c (rs6000_push_dummy_call)
(rs6000_extract_return_value): Use register_size.
* xstormy16-tdep.c (xstormy16_get_saved_register)
(xstormy16_extract_return_value): Ditto.
* valops.c (value_assign): Ditto.
* v850ice.c (v850ice_fetch_registers, v850ice_store_registers):
* v850-tdep.c (v850_extract_return_value): Ditto.
* tracepoint.c (collect_symbol): Ditto.
* target.c (debug_print_register): Ditto.
* stack.c (frame_info): Ditto.
* rs6000-nat.c (ARCH64, fetch_register, store_register): Ditto.
* rom68k-rom.c (rom68k_supply_one_register): Ditto.
* remote.c (struct packet_reg, remote_wait, remote_async_wait)
(store_register_using_P): Ditto.
* remote-vxmips.c (vx_read_register, vx_write_register): Ditto.
* remote-sim.c (gdbsim_fetch_register, gdbsim_store_register): Ditto.
* remote-mips.c (mips_wait, mips_fetch_registers): Ditto.
* remote-e7000.c (fetch_regs_from_dump, sub2_from_pc): Ditto.
* regcache.c (deprecated_read_register_bytes)
(deprecated_write_register_bytes, read_register)
(write_register): Ditto.
* ppc-linux-nat.c (fetch_altivec_register, fetch_register)
(supply_vrregset, store_altivec_register, fill_vrregset): Ditto.
* monitor.c (monitor_supply_register, monitor_fetch_register)
(monitor_store_register): Ditto.
* mn10300-tdep.c (mn10300_pop_frame_regular)
(mn10300_print_register): Ditto.
* mipsv4-nat.c (fill_fpregset): Ditto.
* mips-linux-tdep.c (supply_32bit_reg, fill_fpregset)
(mips64_fill_fpregset): Ditto.
* mi/mi-main.c (register_changed_p, get_register)
(mi_cmd_data_write_register_values): Ditto.
* lynx-nat.c (fetch_inferior_registers, store_inferior_registers):
* irix5-nat.c (fill_gregset, fetch_core_registers):
* infrun.c (write_inferior_status_register): Ditto.
* infptrace.c (fetch_register, store_register): Ditto.
* infcmd.c (default_print_registers_info): Ditto.
* ia64-linux-nat.c (COPY_REG, fill_fpregset): Ditto.
* ia64-aix-nat.c (COPY_REG, fill_gregset): Ditto.
* i386gnu-nat.c (gnu_store_registers, fill): Ditto.
* hpux-thread.c (hpux_thread_fetch_registers)
(hpux_thread_store_registers): Ditto.
* hppah-nat.c (store_inferior_registers, fetch_register):
* findvar.c (value_from_register): Ditto.
* dve3900-rom.c (fetch_bitmapped_register):
* cris-tdep.c (cris_gdbarch_init): Ditto.
* alpha-tdep.h: Ditto.
* aix-thread.c (pd_enable, fill_sprs64, fill_sprs32): Ditto.
2004-08-03 00:57:27 +00:00
|
|
|
|
register_size (0) says. Assuming all HP-UX PA machines
|
|
|
|
|
are big-endian, put it at the least significant end of
|
|
|
|
|
the value, and zap the rest of the buffer. */
|
|
|
|
|
offset = register_size (current_gdbarch, 0) - len;
|
1999-08-16 19:57:19 +00:00
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
/* Floating-point registers come from the ss_fpblock area. */
|
2004-05-06 Randolph Chung <tausq@debian.org>
* config/pa/tm-hppa.h (RO_REGNUM, FLAGS_REGNUM, RP_REGNUM)
(HPPA_FP_REGNUM, HPPA_SP_REGNUM, SAR_REGNUM, IPSW_REGNUM)
(PCOQ_HEAD_REGNUM, PCSQ_HEAD_REGNUM, PCOQ_TAIL_REGNUM, PCSQ_TAIL_REGNUM)
(EIEM_REGNUM, IIR_REGNUM, ISR_REGNUM, IOR_REGNUM, SR4_REGNUM)
(RCR_REGNUM, PID0_REGNUM, PID1_REGNUM, PID2_REGNUM, PID3_REGNUM)
(CCR_REGNUM, TR0_REGNUM, CR27_REGNUM, HPPA_FP0_REGNUM, FP4_REGNUM)
(ARG0_REGNUM, ARG1_REGNUM, ARG2_REGNUM, ARG3_REGNUM): Move *_REGNUM
definitions ...
* hppa-tdep.h: ... to here, with HPPA_ prefix.
* Makefile.in (hppah-nat.o): Add $(hppa_tdep_h)
* hppa-hpux-tdep.c (hppa32_hpux_frame_find_saved_regs_in_sig)
(hppa64_hpux_frame_find_saved_regs_in_sig)
(child_get_current_exception_event): Add HPPA_ prefix to *_REGNUM usage.
* hppa-linux-nat.c (GR_REGNUM, TR_REGNUM, greg_map): Likewise.
* hppa-linux-tdep.c (hppa_dwarf_reg_to_regnum)
(hppa_linux_target_write_pc, hppa_linux_sigtramp_frame_unwind_cache)
(hppa_linux_sigtramp_frame_prev_register): Likewise.
* hppa-tdep.c (hppa32_return_value, hppa64_return_value)
(hppa32_push_dummy_call, hppa64_push_dummy_call, hppa64_frame_align)
(hppa_target_read_pc, hppa_target_write_pc, hppa_frame_cache)
(hppa_frame_prev_register, hppa_stub_frame_unwind_cache)
(hppa_stub_frame_prev_register, hppa_unwind_dummy_id)
(hppa_skip_permanent_breakpoint, hppa_instruction_nullified)
(hppa32_register_type, hppa_cannot_store_register)
(hppa_fetch_pointer_argument, hppa_pseudo_register_read): Likewise.
* hppah-nat.c (store_inferior_registers, fetch_register): Likewise.
* hpread.c (hpread_process_one_debug_symbol): Likewise.
* pa64solib.c (pa64_solib_have_load_event)
(pa64_solib_have_unload_event, pa64_solib_loaded_library_pathname)
(pa64_solib_unloaded_library_pathname): Likewise.
* somsolib.c (som_solib_have_load_event, som_solib_have_unload_event)
(som_solib_library_pathname): Likewise.
2004-05-07 05:48:50 +00:00
|
|
|
|
else if (regno >= HPPA_FP0_REGNUM)
|
1999-08-16 19:57:19 +00:00
|
|
|
|
addr = (HPPAH_OFFSETOF (save_state_t, ss_fpblock)
|
2004-05-06 Randolph Chung <tausq@debian.org>
* config/pa/tm-hppa.h (RO_REGNUM, FLAGS_REGNUM, RP_REGNUM)
(HPPA_FP_REGNUM, HPPA_SP_REGNUM, SAR_REGNUM, IPSW_REGNUM)
(PCOQ_HEAD_REGNUM, PCSQ_HEAD_REGNUM, PCOQ_TAIL_REGNUM, PCSQ_TAIL_REGNUM)
(EIEM_REGNUM, IIR_REGNUM, ISR_REGNUM, IOR_REGNUM, SR4_REGNUM)
(RCR_REGNUM, PID0_REGNUM, PID1_REGNUM, PID2_REGNUM, PID3_REGNUM)
(CCR_REGNUM, TR0_REGNUM, CR27_REGNUM, HPPA_FP0_REGNUM, FP4_REGNUM)
(ARG0_REGNUM, ARG1_REGNUM, ARG2_REGNUM, ARG3_REGNUM): Move *_REGNUM
definitions ...
* hppa-tdep.h: ... to here, with HPPA_ prefix.
* Makefile.in (hppah-nat.o): Add $(hppa_tdep_h)
* hppa-hpux-tdep.c (hppa32_hpux_frame_find_saved_regs_in_sig)
(hppa64_hpux_frame_find_saved_regs_in_sig)
(child_get_current_exception_event): Add HPPA_ prefix to *_REGNUM usage.
* hppa-linux-nat.c (GR_REGNUM, TR_REGNUM, greg_map): Likewise.
* hppa-linux-tdep.c (hppa_dwarf_reg_to_regnum)
(hppa_linux_target_write_pc, hppa_linux_sigtramp_frame_unwind_cache)
(hppa_linux_sigtramp_frame_prev_register): Likewise.
* hppa-tdep.c (hppa32_return_value, hppa64_return_value)
(hppa32_push_dummy_call, hppa64_push_dummy_call, hppa64_frame_align)
(hppa_target_read_pc, hppa_target_write_pc, hppa_frame_cache)
(hppa_frame_prev_register, hppa_stub_frame_unwind_cache)
(hppa_stub_frame_prev_register, hppa_unwind_dummy_id)
(hppa_skip_permanent_breakpoint, hppa_instruction_nullified)
(hppa32_register_type, hppa_cannot_store_register)
(hppa_fetch_pointer_argument, hppa_pseudo_register_read): Likewise.
* hppah-nat.c (store_inferior_registers, fetch_register): Likewise.
* hpread.c (hpread_process_one_debug_symbol): Likewise.
* pa64solib.c (pa64_solib_have_load_event)
(pa64_solib_have_unload_event, pa64_solib_loaded_library_pathname)
(pa64_solib_unloaded_library_pathname): Likewise.
* somsolib.c (som_solib_have_load_event, som_solib_have_unload_event)
(som_solib_library_pathname): Likewise.
2004-05-07 05:48:50 +00:00
|
|
|
|
+ (DEPRECATED_REGISTER_BYTE (regno) - DEPRECATED_REGISTER_BYTE (HPPA_FP0_REGNUM)));
|
1999-08-16 19:57:19 +00:00
|
|
|
|
|
|
|
|
|
/* Wide registers come from the ss_wide area.
|
|
|
|
|
I think it's more PC to test (ss_flags & SS_WIDEREGS) to select
|
|
|
|
|
between ss_wide and ss_narrow than to use the raw register size.
|
|
|
|
|
But checking ss_flags would require an extra ptrace call for
|
|
|
|
|
every register reference. Bleah. */
|
|
|
|
|
else if (len == 8)
|
|
|
|
|
addr = (HPPAH_OFFSETOF (save_state_t, ss_wide)
|
2003-09-17 Andrew Cagney <cagney@redhat.com>
* gdbarch.sh (DEPRECATED_REGISTER_BYTE): Rename REGISTER_BYTE.
* gdbarch.h, gdbarch.c: Regenerate.
* arm-linux-tdep.c, core-sol2.c, cris-tdep.c: Update.
* d10v-tdep.c, frame.c: Update.
* hppa-tdep.c, hppab-nat.c, hppah-nat.c, hppam3-nat.c: Update.
* hpux-thread.c, i386gnu-nat.c, ia64-aix-nat.c: Update.
* ia64-linux-nat.c, irix5-nat.c, lynx-nat.c, m68knbsd-nat.c: Update.
* mcore-tdep.c, mips-linux-tdep.c, mips-tdep.c: Update.
* mipsv4-nat.c, mn10300-tdep.c, ns32k-tdep.c: Update.
* ns32knbsd-nat.c, ppc-bdm.c, regcache.c, remote-sds.c: Update.
* remote-vx68.c, remote-vxmips.c, remote-vxsparc.c: Update.
* remote.c, rs6000-tdep.c, s390-tdep.c, sh64-tdep.c: Update.
* sparc-nat.c, sparc-tdep.c, sun3-nat.c, v850-tdep.c: Update.
* v850ice.c, vax-tdep.c, xstormy16-tdep.c: Update.
* config/m68k/tm-cisco.h, config/m68k/tm-delta68.h: Update.
* config/pa/nm-hppah.h: Update.
2003-09-17 Andrew Cagney <cagney@redhat.com>
* mi/mi-main.c: Rename REGISTER_BYTE to DEPRECATED_REGISTER_BYTE.
2003-09-17 14:24:31 +00:00
|
|
|
|
+ DEPRECATED_REGISTER_BYTE (regno));
|
1999-08-16 19:57:19 +00:00
|
|
|
|
|
|
|
|
|
/* Narrow registers come from the ss_narrow area. Note that
|
|
|
|
|
ss_narrow starts with gr1, not gr0. */
|
|
|
|
|
else if (len == 4)
|
|
|
|
|
addr = (HPPAH_OFFSETOF (save_state_t, ss_narrow)
|
2003-09-17 Andrew Cagney <cagney@redhat.com>
* gdbarch.sh (DEPRECATED_REGISTER_BYTE): Rename REGISTER_BYTE.
* gdbarch.h, gdbarch.c: Regenerate.
* arm-linux-tdep.c, core-sol2.c, cris-tdep.c: Update.
* d10v-tdep.c, frame.c: Update.
* hppa-tdep.c, hppab-nat.c, hppah-nat.c, hppam3-nat.c: Update.
* hpux-thread.c, i386gnu-nat.c, ia64-aix-nat.c: Update.
* ia64-linux-nat.c, irix5-nat.c, lynx-nat.c, m68knbsd-nat.c: Update.
* mcore-tdep.c, mips-linux-tdep.c, mips-tdep.c: Update.
* mipsv4-nat.c, mn10300-tdep.c, ns32k-tdep.c: Update.
* ns32knbsd-nat.c, ppc-bdm.c, regcache.c, remote-sds.c: Update.
* remote-vx68.c, remote-vxmips.c, remote-vxsparc.c: Update.
* remote.c, rs6000-tdep.c, s390-tdep.c, sh64-tdep.c: Update.
* sparc-nat.c, sparc-tdep.c, sun3-nat.c, v850-tdep.c: Update.
* v850ice.c, vax-tdep.c, xstormy16-tdep.c: Update.
* config/m68k/tm-cisco.h, config/m68k/tm-delta68.h: Update.
* config/pa/nm-hppah.h: Update.
2003-09-17 Andrew Cagney <cagney@redhat.com>
* mi/mi-main.c: Rename REGISTER_BYTE to DEPRECATED_REGISTER_BYTE.
2003-09-17 14:24:31 +00:00
|
|
|
|
+ (DEPRECATED_REGISTER_BYTE (regno) - DEPRECATED_REGISTER_BYTE (1)));
|
1999-08-16 19:57:19 +00:00
|
|
|
|
else
|
2001-02-08 06:03:54 +00:00
|
|
|
|
internal_error (__FILE__, __LINE__,
|
|
|
|
|
"hppah-nat.c (write_register): unexpected register size");
|
1999-08-16 19:57:19 +00:00
|
|
|
|
|
|
|
|
|
#ifdef GDB_TARGET_IS_HPPA_20W
|
|
|
|
|
/* Unbelieveable. The PC head and tail must be written in 64bit hunks
|
|
|
|
|
or we will get an error. Worse yet, the oddball ptrace/ttrace
|
|
|
|
|
layering will not allow us to perform a 64bit register store.
|
|
|
|
|
|
|
|
|
|
What a crock. */
|
2004-11-20 23:56:18 +00:00
|
|
|
|
if ((regno == HPPA_PCOQ_HEAD_REGNUM || regno == HPPA_PCOQ_TAIL_REGNUM) && len == 8)
|
1999-08-16 19:57:19 +00:00
|
|
|
|
{
|
|
|
|
|
CORE_ADDR temp;
|
|
|
|
|
|
2004-11-20 23:56:18 +00:00
|
|
|
|
regcache_raw_read (current_regcache, regno, &temp);
|
1999-08-16 19:57:19 +00:00
|
|
|
|
|
|
|
|
|
/* Set the priv level (stored in the low two bits of the PC. */
|
|
|
|
|
temp |= 0x3;
|
|
|
|
|
|
2001-05-04 04:15:33 +00:00
|
|
|
|
ttrace_write_reg_64 (PIDGET (inferior_ptid), (CORE_ADDR)addr,
|
|
|
|
|
(CORE_ADDR)&temp);
|
1999-08-16 19:57:19 +00:00
|
|
|
|
|
|
|
|
|
/* If we fail to write the PC, give a true error instead of
|
|
|
|
|
just a warning. */
|
2004-11-20 23:56:18 +00:00
|
|
|
|
if (errno != 0)
|
1999-05-05 14:45:51 +00:00
|
|
|
|
{
|
1999-08-16 19:57:19 +00:00
|
|
|
|
char *err = safe_strerror (errno);
|
|
|
|
|
char *msg = alloca (strlen (err) + 128);
|
|
|
|
|
sprintf (msg, "writing `%s' register: %s",
|
|
|
|
|
REGISTER_NAME (regno), err);
|
|
|
|
|
perror_with_name (msg);
|
1999-05-05 14:45:51 +00:00
|
|
|
|
}
|
1999-08-16 19:57:19 +00:00
|
|
|
|
return;
|
1999-05-05 14:45:51 +00:00
|
|
|
|
}
|
1999-08-23 22:40:00 +00:00
|
|
|
|
|
|
|
|
|
/* Another crock. HPUX complains if you write a nonzero value to
|
|
|
|
|
the high part of IPSW. What will it take for HP to catch a
|
|
|
|
|
clue about building sensible interfaces? */
|
2004-05-06 Randolph Chung <tausq@debian.org>
* config/pa/tm-hppa.h (RO_REGNUM, FLAGS_REGNUM, RP_REGNUM)
(HPPA_FP_REGNUM, HPPA_SP_REGNUM, SAR_REGNUM, IPSW_REGNUM)
(PCOQ_HEAD_REGNUM, PCSQ_HEAD_REGNUM, PCOQ_TAIL_REGNUM, PCSQ_TAIL_REGNUM)
(EIEM_REGNUM, IIR_REGNUM, ISR_REGNUM, IOR_REGNUM, SR4_REGNUM)
(RCR_REGNUM, PID0_REGNUM, PID1_REGNUM, PID2_REGNUM, PID3_REGNUM)
(CCR_REGNUM, TR0_REGNUM, CR27_REGNUM, HPPA_FP0_REGNUM, FP4_REGNUM)
(ARG0_REGNUM, ARG1_REGNUM, ARG2_REGNUM, ARG3_REGNUM): Move *_REGNUM
definitions ...
* hppa-tdep.h: ... to here, with HPPA_ prefix.
* Makefile.in (hppah-nat.o): Add $(hppa_tdep_h)
* hppa-hpux-tdep.c (hppa32_hpux_frame_find_saved_regs_in_sig)
(hppa64_hpux_frame_find_saved_regs_in_sig)
(child_get_current_exception_event): Add HPPA_ prefix to *_REGNUM usage.
* hppa-linux-nat.c (GR_REGNUM, TR_REGNUM, greg_map): Likewise.
* hppa-linux-tdep.c (hppa_dwarf_reg_to_regnum)
(hppa_linux_target_write_pc, hppa_linux_sigtramp_frame_unwind_cache)
(hppa_linux_sigtramp_frame_prev_register): Likewise.
* hppa-tdep.c (hppa32_return_value, hppa64_return_value)
(hppa32_push_dummy_call, hppa64_push_dummy_call, hppa64_frame_align)
(hppa_target_read_pc, hppa_target_write_pc, hppa_frame_cache)
(hppa_frame_prev_register, hppa_stub_frame_unwind_cache)
(hppa_stub_frame_prev_register, hppa_unwind_dummy_id)
(hppa_skip_permanent_breakpoint, hppa_instruction_nullified)
(hppa32_register_type, hppa_cannot_store_register)
(hppa_fetch_pointer_argument, hppa_pseudo_register_read): Likewise.
* hppah-nat.c (store_inferior_registers, fetch_register): Likewise.
* hpread.c (hpread_process_one_debug_symbol): Likewise.
* pa64solib.c (pa64_solib_have_load_event)
(pa64_solib_have_unload_event, pa64_solib_loaded_library_pathname)
(pa64_solib_unloaded_library_pathname): Likewise.
* somsolib.c (som_solib_have_load_event, som_solib_have_unload_event)
(som_solib_library_pathname): Likewise.
2004-05-07 05:48:50 +00:00
|
|
|
|
if (regno == HPPA_IPSW_REGNUM && len == 8)
|
2004-11-20 23:56:18 +00:00
|
|
|
|
{
|
|
|
|
|
int temp = 0;
|
|
|
|
|
|
|
|
|
|
regcache_raw_write_part (current_regcache, regno, 0,
|
|
|
|
|
sizeof (int), &temp);
|
|
|
|
|
}
|
1999-08-16 19:57:19 +00:00
|
|
|
|
#endif
|
|
|
|
|
|
|
|
|
|
for (i = 0; i < len; i += sizeof (int))
|
|
|
|
|
{
|
2004-11-20 23:56:18 +00:00
|
|
|
|
int temp;
|
|
|
|
|
|
1999-08-16 19:57:19 +00:00
|
|
|
|
errno = 0;
|
2004-11-20 23:56:18 +00:00
|
|
|
|
regcache_raw_read_part (current_regcache, regno, i,
|
|
|
|
|
sizeof (int), &temp);
|
2001-05-04 04:15:33 +00:00
|
|
|
|
call_ptrace (PT_WUREGS, PIDGET (inferior_ptid),
|
|
|
|
|
(PTRACE_ARG3_TYPE) addr + i,
|
2004-11-20 23:56:18 +00:00
|
|
|
|
temp);
|
1999-08-16 19:57:19 +00:00
|
|
|
|
if (errno != 0)
|
|
|
|
|
{
|
|
|
|
|
/* Warning, not error, in case we are attached; sometimes
|
|
|
|
|
the kernel doesn't let us at the registers. */
|
|
|
|
|
char *err = safe_strerror (errno);
|
|
|
|
|
char *msg = alloca (strlen (err) + 128);
|
1999-08-23 22:40:00 +00:00
|
|
|
|
sprintf (msg, "writing `%s' register: %s",
|
1999-08-16 19:57:19 +00:00
|
|
|
|
REGISTER_NAME (regno), err);
|
|
|
|
|
/* If we fail to write the PC, give a true error instead of
|
|
|
|
|
just a warning. */
|
2004-05-06 Randolph Chung <tausq@debian.org>
* config/pa/tm-hppa.h (RO_REGNUM, FLAGS_REGNUM, RP_REGNUM)
(HPPA_FP_REGNUM, HPPA_SP_REGNUM, SAR_REGNUM, IPSW_REGNUM)
(PCOQ_HEAD_REGNUM, PCSQ_HEAD_REGNUM, PCOQ_TAIL_REGNUM, PCSQ_TAIL_REGNUM)
(EIEM_REGNUM, IIR_REGNUM, ISR_REGNUM, IOR_REGNUM, SR4_REGNUM)
(RCR_REGNUM, PID0_REGNUM, PID1_REGNUM, PID2_REGNUM, PID3_REGNUM)
(CCR_REGNUM, TR0_REGNUM, CR27_REGNUM, HPPA_FP0_REGNUM, FP4_REGNUM)
(ARG0_REGNUM, ARG1_REGNUM, ARG2_REGNUM, ARG3_REGNUM): Move *_REGNUM
definitions ...
* hppa-tdep.h: ... to here, with HPPA_ prefix.
* Makefile.in (hppah-nat.o): Add $(hppa_tdep_h)
* hppa-hpux-tdep.c (hppa32_hpux_frame_find_saved_regs_in_sig)
(hppa64_hpux_frame_find_saved_regs_in_sig)
(child_get_current_exception_event): Add HPPA_ prefix to *_REGNUM usage.
* hppa-linux-nat.c (GR_REGNUM, TR_REGNUM, greg_map): Likewise.
* hppa-linux-tdep.c (hppa_dwarf_reg_to_regnum)
(hppa_linux_target_write_pc, hppa_linux_sigtramp_frame_unwind_cache)
(hppa_linux_sigtramp_frame_prev_register): Likewise.
* hppa-tdep.c (hppa32_return_value, hppa64_return_value)
(hppa32_push_dummy_call, hppa64_push_dummy_call, hppa64_frame_align)
(hppa_target_read_pc, hppa_target_write_pc, hppa_frame_cache)
(hppa_frame_prev_register, hppa_stub_frame_unwind_cache)
(hppa_stub_frame_prev_register, hppa_unwind_dummy_id)
(hppa_skip_permanent_breakpoint, hppa_instruction_nullified)
(hppa32_register_type, hppa_cannot_store_register)
(hppa_fetch_pointer_argument, hppa_pseudo_register_read): Likewise.
* hppah-nat.c (store_inferior_registers, fetch_register): Likewise.
* hpread.c (hpread_process_one_debug_symbol): Likewise.
* pa64solib.c (pa64_solib_have_load_event)
(pa64_solib_have_unload_event, pa64_solib_loaded_library_pathname)
(pa64_solib_unloaded_library_pathname): Likewise.
* somsolib.c (som_solib_have_load_event, som_solib_have_unload_event)
(som_solib_library_pathname): Likewise.
2004-05-07 05:48:50 +00:00
|
|
|
|
if (regno == HPPA_PCOQ_HEAD_REGNUM || regno == HPPA_PCOQ_TAIL_REGNUM)
|
1999-08-16 19:57:19 +00:00
|
|
|
|
perror_with_name (msg);
|
|
|
|
|
else
|
1999-04-16 01:35:26 +00:00
|
|
|
|
warning (msg);
|
1999-08-16 19:57:19 +00:00
|
|
|
|
return;
|
|
|
|
|
}
|
|
|
|
|
}
|
1999-04-16 01:35:26 +00:00
|
|
|
|
}
|
|
|
|
|
else
|
|
|
|
|
for (regno = 0; regno < NUM_REGS; regno++)
|
|
|
|
|
store_inferior_registers (regno);
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
1999-07-19 23:30:11 +00:00
|
|
|
|
/* Fetch a register's value from the process's U area. */
|
1999-04-16 01:35:26 +00:00
|
|
|
|
static void
|
2000-07-30 01:48:28 +00:00
|
|
|
|
fetch_register (int regno)
|
1999-04-16 01:35:26 +00:00
|
|
|
|
{
|
2003-05-08 Andrew Cagney <cagney@redhat.com>
* regcache.h (max_register_size): Delete declaration.
* regcache.c (max_register_size): Delete function.
(struct regcache_descr): Delete field "max_register_size".
(init_regcache_descr, init_legacy_regcache_descr): Assert that all
registers fit in MAX_REGISTER_SIZE.
(regcache_save): Replace max_register_size with MAX_REGISTER_SIZE.
(regcache_restore, regcache_xfer_part, regcache_dump): Ditto.
* thread-db.c: Replace max_register_size with MAX_REGISTER_SIZE.
* sh-tdep.c, rom68k-rom.c, remote-sim.c, remote-mips.c: Ditto.
* remote-e7000.c, monitor.c, mipsv4-nat.c, mips-nat.c: Ditto.
* m68klinux-nat.c, lynx-nat.c, irix4-nat.c: Ditto.
* hpux-thread.c, hppah-nat.c, hppab-nat.c, hppa-tdep.c: Ditto.
* dve3900-rom.c, hppa-tdep.c: Ditto.
2003-05-08 22:33:14 +00:00
|
|
|
|
char buf[MAX_REGISTER_SIZE];
|
1999-07-19 23:30:11 +00:00
|
|
|
|
unsigned int addr, len, offset;
|
|
|
|
|
int i;
|
1999-04-16 01:35:26 +00:00
|
|
|
|
|
1999-07-19 23:30:11 +00:00
|
|
|
|
offset = 0;
|
2004-08-02 Andrew Cagney <cagney@gnu.org>
Replace DEPRECATED_REGISTER_RAW_SIZE with register_size.
* rs6000-tdep.c (rs6000_push_dummy_call)
(rs6000_extract_return_value): Use register_size.
* xstormy16-tdep.c (xstormy16_get_saved_register)
(xstormy16_extract_return_value): Ditto.
* valops.c (value_assign): Ditto.
* v850ice.c (v850ice_fetch_registers, v850ice_store_registers):
* v850-tdep.c (v850_extract_return_value): Ditto.
* tracepoint.c (collect_symbol): Ditto.
* target.c (debug_print_register): Ditto.
* stack.c (frame_info): Ditto.
* rs6000-nat.c (ARCH64, fetch_register, store_register): Ditto.
* rom68k-rom.c (rom68k_supply_one_register): Ditto.
* remote.c (struct packet_reg, remote_wait, remote_async_wait)
(store_register_using_P): Ditto.
* remote-vxmips.c (vx_read_register, vx_write_register): Ditto.
* remote-sim.c (gdbsim_fetch_register, gdbsim_store_register): Ditto.
* remote-mips.c (mips_wait, mips_fetch_registers): Ditto.
* remote-e7000.c (fetch_regs_from_dump, sub2_from_pc): Ditto.
* regcache.c (deprecated_read_register_bytes)
(deprecated_write_register_bytes, read_register)
(write_register): Ditto.
* ppc-linux-nat.c (fetch_altivec_register, fetch_register)
(supply_vrregset, store_altivec_register, fill_vrregset): Ditto.
* monitor.c (monitor_supply_register, monitor_fetch_register)
(monitor_store_register): Ditto.
* mn10300-tdep.c (mn10300_pop_frame_regular)
(mn10300_print_register): Ditto.
* mipsv4-nat.c (fill_fpregset): Ditto.
* mips-linux-tdep.c (supply_32bit_reg, fill_fpregset)
(mips64_fill_fpregset): Ditto.
* mi/mi-main.c (register_changed_p, get_register)
(mi_cmd_data_write_register_values): Ditto.
* lynx-nat.c (fetch_inferior_registers, store_inferior_registers):
* irix5-nat.c (fill_gregset, fetch_core_registers):
* infrun.c (write_inferior_status_register): Ditto.
* infptrace.c (fetch_register, store_register): Ditto.
* infcmd.c (default_print_registers_info): Ditto.
* ia64-linux-nat.c (COPY_REG, fill_fpregset): Ditto.
* ia64-aix-nat.c (COPY_REG, fill_gregset): Ditto.
* i386gnu-nat.c (gnu_store_registers, fill): Ditto.
* hpux-thread.c (hpux_thread_fetch_registers)
(hpux_thread_store_registers): Ditto.
* hppah-nat.c (store_inferior_registers, fetch_register):
* findvar.c (value_from_register): Ditto.
* dve3900-rom.c (fetch_bitmapped_register):
* cris-tdep.c (cris_gdbarch_init): Ditto.
* alpha-tdep.h: Ditto.
* aix-thread.c (pd_enable, fill_sprs64, fill_sprs32): Ditto.
2004-08-03 00:57:27 +00:00
|
|
|
|
len = register_size (current_gdbarch, regno);
|
1999-07-19 23:30:11 +00:00
|
|
|
|
|
|
|
|
|
/* Requests for register zero actually want the save_state's
|
|
|
|
|
ss_flags member. As RM says: "Oh, what a hack!" */
|
|
|
|
|
if (regno == 0)
|
|
|
|
|
{
|
|
|
|
|
save_state_t ss;
|
|
|
|
|
addr = HPPAH_OFFSETOF (save_state_t, ss_flags);
|
|
|
|
|
len = sizeof (ss.ss_flags);
|
|
|
|
|
|
|
|
|
|
/* Note that ss_flags is always an int, no matter what
|
2004-08-02 Andrew Cagney <cagney@gnu.org>
Replace DEPRECATED_REGISTER_RAW_SIZE with register_size.
* rs6000-tdep.c (rs6000_push_dummy_call)
(rs6000_extract_return_value): Use register_size.
* xstormy16-tdep.c (xstormy16_get_saved_register)
(xstormy16_extract_return_value): Ditto.
* valops.c (value_assign): Ditto.
* v850ice.c (v850ice_fetch_registers, v850ice_store_registers):
* v850-tdep.c (v850_extract_return_value): Ditto.
* tracepoint.c (collect_symbol): Ditto.
* target.c (debug_print_register): Ditto.
* stack.c (frame_info): Ditto.
* rs6000-nat.c (ARCH64, fetch_register, store_register): Ditto.
* rom68k-rom.c (rom68k_supply_one_register): Ditto.
* remote.c (struct packet_reg, remote_wait, remote_async_wait)
(store_register_using_P): Ditto.
* remote-vxmips.c (vx_read_register, vx_write_register): Ditto.
* remote-sim.c (gdbsim_fetch_register, gdbsim_store_register): Ditto.
* remote-mips.c (mips_wait, mips_fetch_registers): Ditto.
* remote-e7000.c (fetch_regs_from_dump, sub2_from_pc): Ditto.
* regcache.c (deprecated_read_register_bytes)
(deprecated_write_register_bytes, read_register)
(write_register): Ditto.
* ppc-linux-nat.c (fetch_altivec_register, fetch_register)
(supply_vrregset, store_altivec_register, fill_vrregset): Ditto.
* monitor.c (monitor_supply_register, monitor_fetch_register)
(monitor_store_register): Ditto.
* mn10300-tdep.c (mn10300_pop_frame_regular)
(mn10300_print_register): Ditto.
* mipsv4-nat.c (fill_fpregset): Ditto.
* mips-linux-tdep.c (supply_32bit_reg, fill_fpregset)
(mips64_fill_fpregset): Ditto.
* mi/mi-main.c (register_changed_p, get_register)
(mi_cmd_data_write_register_values): Ditto.
* lynx-nat.c (fetch_inferior_registers, store_inferior_registers):
* irix5-nat.c (fill_gregset, fetch_core_registers):
* infrun.c (write_inferior_status_register): Ditto.
* infptrace.c (fetch_register, store_register): Ditto.
* infcmd.c (default_print_registers_info): Ditto.
* ia64-linux-nat.c (COPY_REG, fill_fpregset): Ditto.
* ia64-aix-nat.c (COPY_REG, fill_gregset): Ditto.
* i386gnu-nat.c (gnu_store_registers, fill): Ditto.
* hpux-thread.c (hpux_thread_fetch_registers)
(hpux_thread_store_registers): Ditto.
* hppah-nat.c (store_inferior_registers, fetch_register):
* findvar.c (value_from_register): Ditto.
* dve3900-rom.c (fetch_bitmapped_register):
* cris-tdep.c (cris_gdbarch_init): Ditto.
* alpha-tdep.h: Ditto.
* aix-thread.c (pd_enable, fill_sprs64, fill_sprs32): Ditto.
2004-08-03 00:57:27 +00:00
|
|
|
|
register_size (0) says. Assuming all HP-UX PA machines are
|
|
|
|
|
big-endian, put it at the least significant end of the value,
|
|
|
|
|
and zap the rest of the buffer. */
|
|
|
|
|
offset = register_size (current_gdbarch, 0) - len;
|
1999-07-19 23:30:11 +00:00
|
|
|
|
memset (buf, 0, sizeof (buf));
|
|
|
|
|
}
|
1999-04-16 01:35:26 +00:00
|
|
|
|
|
1999-07-19 23:30:11 +00:00
|
|
|
|
/* Floating-point registers come from the ss_fpblock area. */
|
2004-05-06 Randolph Chung <tausq@debian.org>
* config/pa/tm-hppa.h (RO_REGNUM, FLAGS_REGNUM, RP_REGNUM)
(HPPA_FP_REGNUM, HPPA_SP_REGNUM, SAR_REGNUM, IPSW_REGNUM)
(PCOQ_HEAD_REGNUM, PCSQ_HEAD_REGNUM, PCOQ_TAIL_REGNUM, PCSQ_TAIL_REGNUM)
(EIEM_REGNUM, IIR_REGNUM, ISR_REGNUM, IOR_REGNUM, SR4_REGNUM)
(RCR_REGNUM, PID0_REGNUM, PID1_REGNUM, PID2_REGNUM, PID3_REGNUM)
(CCR_REGNUM, TR0_REGNUM, CR27_REGNUM, HPPA_FP0_REGNUM, FP4_REGNUM)
(ARG0_REGNUM, ARG1_REGNUM, ARG2_REGNUM, ARG3_REGNUM): Move *_REGNUM
definitions ...
* hppa-tdep.h: ... to here, with HPPA_ prefix.
* Makefile.in (hppah-nat.o): Add $(hppa_tdep_h)
* hppa-hpux-tdep.c (hppa32_hpux_frame_find_saved_regs_in_sig)
(hppa64_hpux_frame_find_saved_regs_in_sig)
(child_get_current_exception_event): Add HPPA_ prefix to *_REGNUM usage.
* hppa-linux-nat.c (GR_REGNUM, TR_REGNUM, greg_map): Likewise.
* hppa-linux-tdep.c (hppa_dwarf_reg_to_regnum)
(hppa_linux_target_write_pc, hppa_linux_sigtramp_frame_unwind_cache)
(hppa_linux_sigtramp_frame_prev_register): Likewise.
* hppa-tdep.c (hppa32_return_value, hppa64_return_value)
(hppa32_push_dummy_call, hppa64_push_dummy_call, hppa64_frame_align)
(hppa_target_read_pc, hppa_target_write_pc, hppa_frame_cache)
(hppa_frame_prev_register, hppa_stub_frame_unwind_cache)
(hppa_stub_frame_prev_register, hppa_unwind_dummy_id)
(hppa_skip_permanent_breakpoint, hppa_instruction_nullified)
(hppa32_register_type, hppa_cannot_store_register)
(hppa_fetch_pointer_argument, hppa_pseudo_register_read): Likewise.
* hppah-nat.c (store_inferior_registers, fetch_register): Likewise.
* hpread.c (hpread_process_one_debug_symbol): Likewise.
* pa64solib.c (pa64_solib_have_load_event)
(pa64_solib_have_unload_event, pa64_solib_loaded_library_pathname)
(pa64_solib_unloaded_library_pathname): Likewise.
* somsolib.c (som_solib_have_load_event, som_solib_have_unload_event)
(som_solib_library_pathname): Likewise.
2004-05-07 05:48:50 +00:00
|
|
|
|
else if (regno >= HPPA_FP0_REGNUM)
|
1999-07-19 23:30:11 +00:00
|
|
|
|
addr = (HPPAH_OFFSETOF (save_state_t, ss_fpblock)
|
2004-05-06 Randolph Chung <tausq@debian.org>
* config/pa/tm-hppa.h (RO_REGNUM, FLAGS_REGNUM, RP_REGNUM)
(HPPA_FP_REGNUM, HPPA_SP_REGNUM, SAR_REGNUM, IPSW_REGNUM)
(PCOQ_HEAD_REGNUM, PCSQ_HEAD_REGNUM, PCOQ_TAIL_REGNUM, PCSQ_TAIL_REGNUM)
(EIEM_REGNUM, IIR_REGNUM, ISR_REGNUM, IOR_REGNUM, SR4_REGNUM)
(RCR_REGNUM, PID0_REGNUM, PID1_REGNUM, PID2_REGNUM, PID3_REGNUM)
(CCR_REGNUM, TR0_REGNUM, CR27_REGNUM, HPPA_FP0_REGNUM, FP4_REGNUM)
(ARG0_REGNUM, ARG1_REGNUM, ARG2_REGNUM, ARG3_REGNUM): Move *_REGNUM
definitions ...
* hppa-tdep.h: ... to here, with HPPA_ prefix.
* Makefile.in (hppah-nat.o): Add $(hppa_tdep_h)
* hppa-hpux-tdep.c (hppa32_hpux_frame_find_saved_regs_in_sig)
(hppa64_hpux_frame_find_saved_regs_in_sig)
(child_get_current_exception_event): Add HPPA_ prefix to *_REGNUM usage.
* hppa-linux-nat.c (GR_REGNUM, TR_REGNUM, greg_map): Likewise.
* hppa-linux-tdep.c (hppa_dwarf_reg_to_regnum)
(hppa_linux_target_write_pc, hppa_linux_sigtramp_frame_unwind_cache)
(hppa_linux_sigtramp_frame_prev_register): Likewise.
* hppa-tdep.c (hppa32_return_value, hppa64_return_value)
(hppa32_push_dummy_call, hppa64_push_dummy_call, hppa64_frame_align)
(hppa_target_read_pc, hppa_target_write_pc, hppa_frame_cache)
(hppa_frame_prev_register, hppa_stub_frame_unwind_cache)
(hppa_stub_frame_prev_register, hppa_unwind_dummy_id)
(hppa_skip_permanent_breakpoint, hppa_instruction_nullified)
(hppa32_register_type, hppa_cannot_store_register)
(hppa_fetch_pointer_argument, hppa_pseudo_register_read): Likewise.
* hppah-nat.c (store_inferior_registers, fetch_register): Likewise.
* hpread.c (hpread_process_one_debug_symbol): Likewise.
* pa64solib.c (pa64_solib_have_load_event)
(pa64_solib_have_unload_event, pa64_solib_loaded_library_pathname)
(pa64_solib_unloaded_library_pathname): Likewise.
* somsolib.c (som_solib_have_load_event, som_solib_have_unload_event)
(som_solib_library_pathname): Likewise.
2004-05-07 05:48:50 +00:00
|
|
|
|
+ (DEPRECATED_REGISTER_BYTE (regno) - DEPRECATED_REGISTER_BYTE (HPPA_FP0_REGNUM)));
|
1999-07-19 23:30:11 +00:00
|
|
|
|
|
|
|
|
|
/* Wide registers come from the ss_wide area.
|
|
|
|
|
I think it's more PC to test (ss_flags & SS_WIDEREGS) to select
|
|
|
|
|
between ss_wide and ss_narrow than to use the raw register size.
|
|
|
|
|
But checking ss_flags would require an extra ptrace call for
|
|
|
|
|
every register reference. Bleah. */
|
|
|
|
|
else if (len == 8)
|
|
|
|
|
addr = (HPPAH_OFFSETOF (save_state_t, ss_wide)
|
2003-09-17 Andrew Cagney <cagney@redhat.com>
* gdbarch.sh (DEPRECATED_REGISTER_BYTE): Rename REGISTER_BYTE.
* gdbarch.h, gdbarch.c: Regenerate.
* arm-linux-tdep.c, core-sol2.c, cris-tdep.c: Update.
* d10v-tdep.c, frame.c: Update.
* hppa-tdep.c, hppab-nat.c, hppah-nat.c, hppam3-nat.c: Update.
* hpux-thread.c, i386gnu-nat.c, ia64-aix-nat.c: Update.
* ia64-linux-nat.c, irix5-nat.c, lynx-nat.c, m68knbsd-nat.c: Update.
* mcore-tdep.c, mips-linux-tdep.c, mips-tdep.c: Update.
* mipsv4-nat.c, mn10300-tdep.c, ns32k-tdep.c: Update.
* ns32knbsd-nat.c, ppc-bdm.c, regcache.c, remote-sds.c: Update.
* remote-vx68.c, remote-vxmips.c, remote-vxsparc.c: Update.
* remote.c, rs6000-tdep.c, s390-tdep.c, sh64-tdep.c: Update.
* sparc-nat.c, sparc-tdep.c, sun3-nat.c, v850-tdep.c: Update.
* v850ice.c, vax-tdep.c, xstormy16-tdep.c: Update.
* config/m68k/tm-cisco.h, config/m68k/tm-delta68.h: Update.
* config/pa/nm-hppah.h: Update.
2003-09-17 Andrew Cagney <cagney@redhat.com>
* mi/mi-main.c: Rename REGISTER_BYTE to DEPRECATED_REGISTER_BYTE.
2003-09-17 14:24:31 +00:00
|
|
|
|
+ DEPRECATED_REGISTER_BYTE (regno));
|
1999-07-19 23:30:11 +00:00
|
|
|
|
|
|
|
|
|
/* Narrow registers come from the ss_narrow area. Note that
|
|
|
|
|
ss_narrow starts with gr1, not gr0. */
|
|
|
|
|
else if (len == 4)
|
|
|
|
|
addr = (HPPAH_OFFSETOF (save_state_t, ss_narrow)
|
2003-09-17 Andrew Cagney <cagney@redhat.com>
* gdbarch.sh (DEPRECATED_REGISTER_BYTE): Rename REGISTER_BYTE.
* gdbarch.h, gdbarch.c: Regenerate.
* arm-linux-tdep.c, core-sol2.c, cris-tdep.c: Update.
* d10v-tdep.c, frame.c: Update.
* hppa-tdep.c, hppab-nat.c, hppah-nat.c, hppam3-nat.c: Update.
* hpux-thread.c, i386gnu-nat.c, ia64-aix-nat.c: Update.
* ia64-linux-nat.c, irix5-nat.c, lynx-nat.c, m68knbsd-nat.c: Update.
* mcore-tdep.c, mips-linux-tdep.c, mips-tdep.c: Update.
* mipsv4-nat.c, mn10300-tdep.c, ns32k-tdep.c: Update.
* ns32knbsd-nat.c, ppc-bdm.c, regcache.c, remote-sds.c: Update.
* remote-vx68.c, remote-vxmips.c, remote-vxsparc.c: Update.
* remote.c, rs6000-tdep.c, s390-tdep.c, sh64-tdep.c: Update.
* sparc-nat.c, sparc-tdep.c, sun3-nat.c, v850-tdep.c: Update.
* v850ice.c, vax-tdep.c, xstormy16-tdep.c: Update.
* config/m68k/tm-cisco.h, config/m68k/tm-delta68.h: Update.
* config/pa/nm-hppah.h: Update.
2003-09-17 Andrew Cagney <cagney@redhat.com>
* mi/mi-main.c: Rename REGISTER_BYTE to DEPRECATED_REGISTER_BYTE.
2003-09-17 14:24:31 +00:00
|
|
|
|
+ (DEPRECATED_REGISTER_BYTE (regno) - DEPRECATED_REGISTER_BYTE (1)));
|
1999-04-16 01:35:26 +00:00
|
|
|
|
|
1999-07-19 23:30:11 +00:00
|
|
|
|
else
|
2001-02-08 06:03:54 +00:00
|
|
|
|
internal_error (__FILE__, __LINE__,
|
|
|
|
|
"hppa-nat.c (fetch_register): unexpected register size");
|
1999-07-19 23:30:11 +00:00
|
|
|
|
|
|
|
|
|
for (i = 0; i < len; i += sizeof (int))
|
1999-04-16 01:35:26 +00:00
|
|
|
|
{
|
|
|
|
|
errno = 0;
|
1999-07-19 23:30:11 +00:00
|
|
|
|
/* Copy an int from the U area to buf. Fill the least
|
|
|
|
|
significant end if len != raw_size. */
|
|
|
|
|
* (int *) &buf[offset + i] =
|
2001-05-04 04:15:33 +00:00
|
|
|
|
call_ptrace (PT_RUREGS, PIDGET (inferior_ptid),
|
1999-07-19 23:30:11 +00:00
|
|
|
|
(PTRACE_ARG3_TYPE) addr + i, 0);
|
1999-04-16 01:35:26 +00:00
|
|
|
|
if (errno != 0)
|
|
|
|
|
{
|
1999-07-19 23:30:11 +00:00
|
|
|
|
/* Warning, not error, in case we are attached; sometimes
|
|
|
|
|
the kernel doesn't let us at the registers. */
|
1999-04-16 01:35:26 +00:00
|
|
|
|
char *err = safe_strerror (errno);
|
|
|
|
|
char *msg = alloca (strlen (err) + 128);
|
1999-07-19 23:30:11 +00:00
|
|
|
|
sprintf (msg, "reading `%s' register: %s",
|
|
|
|
|
REGISTER_NAME (regno), err);
|
1999-04-16 01:35:26 +00:00
|
|
|
|
warning (msg);
|
1999-07-19 23:30:11 +00:00
|
|
|
|
return;
|
1999-04-16 01:35:26 +00:00
|
|
|
|
}
|
|
|
|
|
}
|
1999-07-19 23:30:11 +00:00
|
|
|
|
|
|
|
|
|
/* If we're reading an address from the instruction address queue,
|
|
|
|
|
mask out the bottom two bits --- they contain the privilege
|
|
|
|
|
level. */
|
2004-05-06 Randolph Chung <tausq@debian.org>
* config/pa/tm-hppa.h (RO_REGNUM, FLAGS_REGNUM, RP_REGNUM)
(HPPA_FP_REGNUM, HPPA_SP_REGNUM, SAR_REGNUM, IPSW_REGNUM)
(PCOQ_HEAD_REGNUM, PCSQ_HEAD_REGNUM, PCOQ_TAIL_REGNUM, PCSQ_TAIL_REGNUM)
(EIEM_REGNUM, IIR_REGNUM, ISR_REGNUM, IOR_REGNUM, SR4_REGNUM)
(RCR_REGNUM, PID0_REGNUM, PID1_REGNUM, PID2_REGNUM, PID3_REGNUM)
(CCR_REGNUM, TR0_REGNUM, CR27_REGNUM, HPPA_FP0_REGNUM, FP4_REGNUM)
(ARG0_REGNUM, ARG1_REGNUM, ARG2_REGNUM, ARG3_REGNUM): Move *_REGNUM
definitions ...
* hppa-tdep.h: ... to here, with HPPA_ prefix.
* Makefile.in (hppah-nat.o): Add $(hppa_tdep_h)
* hppa-hpux-tdep.c (hppa32_hpux_frame_find_saved_regs_in_sig)
(hppa64_hpux_frame_find_saved_regs_in_sig)
(child_get_current_exception_event): Add HPPA_ prefix to *_REGNUM usage.
* hppa-linux-nat.c (GR_REGNUM, TR_REGNUM, greg_map): Likewise.
* hppa-linux-tdep.c (hppa_dwarf_reg_to_regnum)
(hppa_linux_target_write_pc, hppa_linux_sigtramp_frame_unwind_cache)
(hppa_linux_sigtramp_frame_prev_register): Likewise.
* hppa-tdep.c (hppa32_return_value, hppa64_return_value)
(hppa32_push_dummy_call, hppa64_push_dummy_call, hppa64_frame_align)
(hppa_target_read_pc, hppa_target_write_pc, hppa_frame_cache)
(hppa_frame_prev_register, hppa_stub_frame_unwind_cache)
(hppa_stub_frame_prev_register, hppa_unwind_dummy_id)
(hppa_skip_permanent_breakpoint, hppa_instruction_nullified)
(hppa32_register_type, hppa_cannot_store_register)
(hppa_fetch_pointer_argument, hppa_pseudo_register_read): Likewise.
* hppah-nat.c (store_inferior_registers, fetch_register): Likewise.
* hpread.c (hpread_process_one_debug_symbol): Likewise.
* pa64solib.c (pa64_solib_have_load_event)
(pa64_solib_have_unload_event, pa64_solib_loaded_library_pathname)
(pa64_solib_unloaded_library_pathname): Likewise.
* somsolib.c (som_solib_have_load_event, som_solib_have_unload_event)
(som_solib_library_pathname): Likewise.
2004-05-07 05:48:50 +00:00
|
|
|
|
if (regno == HPPA_PCOQ_HEAD_REGNUM || regno == HPPA_PCOQ_TAIL_REGNUM)
|
1999-07-19 23:30:11 +00:00
|
|
|
|
buf[len - 1] &= ~0x3;
|
|
|
|
|
|
2004-07-21 Andrew Cagney <cagney@gnu.org>
Use regcache_raw_supply instead of supply_register.
* regcache.h (supply_register): Delete declaration.
* regcache.c (supply_register): Delete function.
* wince.c (do_child_fetch_inferior_registers): Update.
* win32-nat.c (do_child_fetch_inferior_registers)
(fetch_elf_core_registers): Update.
* v850ice.c (v850ice_fetch_registers): Update.
* thread-db.c (thread_db_store_registers): Update.
* sol-thread.c (sol_thread_store_registers): Update.
* shnbsd-tdep.c (shnbsd_supply_reg): Update.
* rs6000-nat.c (fetch_register): Update.
* rom68k-rom.c (rom68k_supply_one_register): Update.
* remote.c (remote_wait, remote_async_wait): Update.
* remote-st.c (get_hex_regs): Update.
* remote-sim.c (gdbsim_fetch_register): Update.
* remote-sds.c (sds_fetch_registers): Update.
* remote-rdp.c (remote_rdp_fetch_register): Update.
* remote-rdi.c (arm_rdi_fetch_registers): Update.
* remote-mips.c (mips_wait, mips_fetch_registers): Update.
* remote-m32r-sdi.c (m32r_fetch_register): Update.
* remote-hms.c (init_hms_cmds): Update.
* remote-est.c (init_est_cmds): Update.
* remote-e7000.c (get_hex_regs, fetch_regs_from_dump)
(e7000_fetch_registers, sub2_from_pc, e7000_wait): Update.
* ppcnbsd-tdep.c (ppcnbsd_supply_reg, ppcnbsd_supply_fpreg): Update.
* ppc-linux-nat.c (fetch_altivec_register, fetch_spe_register)
(fetch_register, supply_vrregset, supply_vrregset)
(fetch_spe_registers): Update.
* ppc-bdm.c (bdm_ppc_fetch_registers): Update.
* monitor.c (monitor_supply_register): Update.
* mipsv4-nat.c (supply_gregset, supply_fpregset): Update.
* mipsnbsd-tdep.c (mipsnbsd_supply_reg)
(mipsnbsd_supply_fpreg): Update.
* mips-nat.c (fetch_inferior_registers)
(fetch_core_registers): Update.
* mips-linux-tdep.c (supply_32bit_reg, supply_gregset)
(supply_fpregset, mips64_supply_gregset)
(mips64_supply_fpregset): Update.
* m68klinux-nat.c (fetch_register, supply_gregset)
(supply_fpregset): Update.
* m68k-tdep.c (supply_gregset, supply_fpregset): Update.
* m32r-rom.c (init_m32r_cmds, init_mon2000_cmds): Update.
* lynx-nat.c (fetch_inferior_registers, fetch_core_registers): Update.
* irix5-nat.c (supply_gregset, supply_fpregset): Update.
* infptrace.c (fetch_register): Update.
* ia64-linux-nat.c (supply_gregset, supply_fpregset): Update.
* ia64-aix-nat.c (supply_gregset, supply_fpregset): Update.
* i386gnu-nat.c (fetch_fpregs, supply_gregset)
(gnu_fetch_registers, gnu_store_registers): Update.
* i386-nto-tdep.c (i386nto_supply_gregset): Update.
* i386-linux-nat.c (fetch_register, supply_gregset)
(dummy_sse_values): Update.
* hpux-thread.c (hpux_thread_fetch_registers): Update.
* hppah-nat.c (fetch_register): Update.
* hppa-linux-nat.c (fetch_register, supply_gregset)
(supply_fpregset): Update.
* go32-nat.c (fetch_register): Update.
* dve3900-rom.c (fetch_bitmapped_register)
(_initialize_r3900_rom): Update.
* cris-tdep.c (supply_gregset): Update.
* abug-rom.c (init_abug_cmds): Update.
* core-aout.c (fetch_core_registers): Update.
* armnbsd-nat.c (supply_gregset, supply_fparegset)
(fetch_register, fetch_fp_register): Update.
* arm-linux-nat.c (fetch_nwfpe_single, fetch_nwfpe_none)
(fetch_nwfpe_extended, fetch_fpregister, fetch_fpregs)
(fetch_register, fetch_regs, supply_gregset, supply_fpregset): Update.
* alphanbsd-tdep.c (fetch_core_registers): Update.
* alpha-tdep.c (alpha_supply_int_regs, alpha_supply_fp_regs): Update.
* alpha-nat.c (fetch_osf_core_registers)
(fetch_osf_core_registers, fetch_osf_core_registers): Update.
* aix-thread.c (supply_gprs64, supply_reg32, supply_fprs)
(supply_sprs64, supply_sprs32, fetch_regs_kernel_thread): Update.
2004-07-22 01:31:49 +00:00
|
|
|
|
regcache_raw_supply (current_regcache, regno, buf);
|
1999-04-16 01:35:26 +00:00
|
|
|
|
}
|
|
|
|
|
|
1999-07-19 23:30:11 +00:00
|
|
|
|
|
1999-04-16 01:35:26 +00:00
|
|
|
|
/* Copy LEN bytes to or from inferior's memory starting at MEMADDR
|
|
|
|
|
to debugger memory starting at MYADDR. Copy to inferior if
|
|
|
|
|
WRITE is nonzero.
|
1999-07-07 20:19:36 +00:00
|
|
|
|
|
2004-10-05 21:53:33 +00:00
|
|
|
|
Returns the length copied, which is either the LEN argument or
|
|
|
|
|
zero. This xfer function does not do partial moves, since
|
|
|
|
|
deprecated_child_ops doesn't allow memory operations to cross below
|
|
|
|
|
us in the target stack anyway. TARGET is ignored. */
|
1999-04-16 01:35:26 +00:00
|
|
|
|
|
|
|
|
|
int
|
2000-09-02 00:07:32 +00:00
|
|
|
|
child_xfer_memory (CORE_ADDR memaddr, char *myaddr, int len, int write,
|
2001-02-05 21:09:21 +00:00
|
|
|
|
struct mem_attrib *mem,
|
2000-09-02 00:07:32 +00:00
|
|
|
|
struct target_ops *target)
|
1999-04-16 01:35:26 +00:00
|
|
|
|
{
|
2003-09-14 Andrew Cagney <cagney@redhat.com>
* alpha-nat.c: Remove some occurances of "register".
* alpha-tdep.c, arm-tdep.c, blockframe.c, breakpoint.c: Ditto.
* buildsym.c, c-typeprint.c, c-valprint.c, coffread.c: Ditto.
* corefile.c, cp-support.c, cp-valprint.c, cris-tdep.c: Ditto.
* dbxread.c, dcache.c, dwarf2read.c, elfread.c: Ditto.
* environ.c, eval.c, event-top.c, f-typeprint.c: Ditto.
* f-valprint.c, findvar.c, frame.c, gdbtypes.c: Ditto.
* h8300-tdep.c, hppa-tdep.c, hppab-nat.c, hppah-nat.c: Ditto.
* hppam3-nat.c, hpread.c, ia64-aix-nat.c, ia64-linux-nat.c: Ditto.
* infcall.c, infcmd.c, inflow.c, infptrace.c, infrun.c: Ditto.
* infttrace.c, irix5-nat.c, jv-typeprint.c: Ditto.
* jv-valprint.c, m68k-tdep.c, m68klinux-nat.c, main.c: Ditto.
* mdebugread.c, minsyms.c, mips-linux-tdep.c: Ditto.
* mips-nat.c, mips-tdep.c, mipsread.c, mipsv4-nat.c: Ditto.
* ns32k-tdep.c, objfiles.c, p-typeprint.c: Ditto.
* p-valprint.c, ppc-linux-nat.c, printcmd.c: Ditto.
* remote-mips.c, remote-vx.c, rs6000-nat.c: Ditto.
* rs6000-tdep.c, scm-exp.c, sh-tdep.c, sh64-tdep.c: Ditto.
* solib.c, somread.c, source.c, sparc-tdep.c: Ditto.
* stabsread.c, stack.c, standalone.c, symfile.c: Ditto.
* symmisc.c, symtab.c, top.c, tracepoint.c: Ditto.
* typeprint.c, utils.c, valarith.c, valops.c: Ditto.
* values.c, vax-tdep.c, xcoffread.c: Ditto.
2003-09-14 16:32:14 +00:00
|
|
|
|
int i;
|
1999-04-16 01:35:26 +00:00
|
|
|
|
/* Round starting address down to longword boundary. */
|
2003-09-14 Andrew Cagney <cagney@redhat.com>
* alpha-nat.c: Remove some occurances of "register".
* alpha-tdep.c, arm-tdep.c, blockframe.c, breakpoint.c: Ditto.
* buildsym.c, c-typeprint.c, c-valprint.c, coffread.c: Ditto.
* corefile.c, cp-support.c, cp-valprint.c, cris-tdep.c: Ditto.
* dbxread.c, dcache.c, dwarf2read.c, elfread.c: Ditto.
* environ.c, eval.c, event-top.c, f-typeprint.c: Ditto.
* f-valprint.c, findvar.c, frame.c, gdbtypes.c: Ditto.
* h8300-tdep.c, hppa-tdep.c, hppab-nat.c, hppah-nat.c: Ditto.
* hppam3-nat.c, hpread.c, ia64-aix-nat.c, ia64-linux-nat.c: Ditto.
* infcall.c, infcmd.c, inflow.c, infptrace.c, infrun.c: Ditto.
* infttrace.c, irix5-nat.c, jv-typeprint.c: Ditto.
* jv-valprint.c, m68k-tdep.c, m68klinux-nat.c, main.c: Ditto.
* mdebugread.c, minsyms.c, mips-linux-tdep.c: Ditto.
* mips-nat.c, mips-tdep.c, mipsread.c, mipsv4-nat.c: Ditto.
* ns32k-tdep.c, objfiles.c, p-typeprint.c: Ditto.
* p-valprint.c, ppc-linux-nat.c, printcmd.c: Ditto.
* remote-mips.c, remote-vx.c, rs6000-nat.c: Ditto.
* rs6000-tdep.c, scm-exp.c, sh-tdep.c, sh64-tdep.c: Ditto.
* solib.c, somread.c, source.c, sparc-tdep.c: Ditto.
* stabsread.c, stack.c, standalone.c, symfile.c: Ditto.
* symmisc.c, symtab.c, top.c, tracepoint.c: Ditto.
* typeprint.c, utils.c, valarith.c, valops.c: Ditto.
* values.c, vax-tdep.c, xcoffread.c: Ditto.
2003-09-14 16:32:14 +00:00
|
|
|
|
CORE_ADDR addr = memaddr & - (CORE_ADDR)(sizeof (int));
|
1999-04-16 01:35:26 +00:00
|
|
|
|
/* Round ending address up; get number of longwords that makes. */
|
2003-09-14 Andrew Cagney <cagney@redhat.com>
* alpha-nat.c: Remove some occurances of "register".
* alpha-tdep.c, arm-tdep.c, blockframe.c, breakpoint.c: Ditto.
* buildsym.c, c-typeprint.c, c-valprint.c, coffread.c: Ditto.
* corefile.c, cp-support.c, cp-valprint.c, cris-tdep.c: Ditto.
* dbxread.c, dcache.c, dwarf2read.c, elfread.c: Ditto.
* environ.c, eval.c, event-top.c, f-typeprint.c: Ditto.
* f-valprint.c, findvar.c, frame.c, gdbtypes.c: Ditto.
* h8300-tdep.c, hppa-tdep.c, hppab-nat.c, hppah-nat.c: Ditto.
* hppam3-nat.c, hpread.c, ia64-aix-nat.c, ia64-linux-nat.c: Ditto.
* infcall.c, infcmd.c, inflow.c, infptrace.c, infrun.c: Ditto.
* infttrace.c, irix5-nat.c, jv-typeprint.c: Ditto.
* jv-valprint.c, m68k-tdep.c, m68klinux-nat.c, main.c: Ditto.
* mdebugread.c, minsyms.c, mips-linux-tdep.c: Ditto.
* mips-nat.c, mips-tdep.c, mipsread.c, mipsv4-nat.c: Ditto.
* ns32k-tdep.c, objfiles.c, p-typeprint.c: Ditto.
* p-valprint.c, ppc-linux-nat.c, printcmd.c: Ditto.
* remote-mips.c, remote-vx.c, rs6000-nat.c: Ditto.
* rs6000-tdep.c, scm-exp.c, sh-tdep.c, sh64-tdep.c: Ditto.
* solib.c, somread.c, source.c, sparc-tdep.c: Ditto.
* stabsread.c, stack.c, standalone.c, symfile.c: Ditto.
* symmisc.c, symtab.c, top.c, tracepoint.c: Ditto.
* typeprint.c, utils.c, valarith.c, valops.c: Ditto.
* values.c, vax-tdep.c, xcoffread.c: Ditto.
2003-09-14 16:32:14 +00:00
|
|
|
|
int count
|
1999-07-07 20:19:36 +00:00
|
|
|
|
= (((memaddr + len) - addr) + sizeof (int) - 1) / sizeof (int);
|
1999-04-16 01:35:26 +00:00
|
|
|
|
|
1999-05-05 14:45:51 +00:00
|
|
|
|
/* Allocate buffer of that many longwords.
|
|
|
|
|
Note -- do not use alloca to allocate this buffer since there is no
|
|
|
|
|
guarantee of when the buffer will actually be deallocated.
|
|
|
|
|
|
|
|
|
|
This routine can be called over and over with the same call chain;
|
|
|
|
|
this (in effect) would pile up all those alloca requests until a call
|
|
|
|
|
to alloca was made from a point higher than this routine in the
|
|
|
|
|
call chain. */
|
2003-09-14 Andrew Cagney <cagney@redhat.com>
* alpha-nat.c: Remove some occurances of "register".
* alpha-tdep.c, arm-tdep.c, blockframe.c, breakpoint.c: Ditto.
* buildsym.c, c-typeprint.c, c-valprint.c, coffread.c: Ditto.
* corefile.c, cp-support.c, cp-valprint.c, cris-tdep.c: Ditto.
* dbxread.c, dcache.c, dwarf2read.c, elfread.c: Ditto.
* environ.c, eval.c, event-top.c, f-typeprint.c: Ditto.
* f-valprint.c, findvar.c, frame.c, gdbtypes.c: Ditto.
* h8300-tdep.c, hppa-tdep.c, hppab-nat.c, hppah-nat.c: Ditto.
* hppam3-nat.c, hpread.c, ia64-aix-nat.c, ia64-linux-nat.c: Ditto.
* infcall.c, infcmd.c, inflow.c, infptrace.c, infrun.c: Ditto.
* infttrace.c, irix5-nat.c, jv-typeprint.c: Ditto.
* jv-valprint.c, m68k-tdep.c, m68klinux-nat.c, main.c: Ditto.
* mdebugread.c, minsyms.c, mips-linux-tdep.c: Ditto.
* mips-nat.c, mips-tdep.c, mipsread.c, mipsv4-nat.c: Ditto.
* ns32k-tdep.c, objfiles.c, p-typeprint.c: Ditto.
* p-valprint.c, ppc-linux-nat.c, printcmd.c: Ditto.
* remote-mips.c, remote-vx.c, rs6000-nat.c: Ditto.
* rs6000-tdep.c, scm-exp.c, sh-tdep.c, sh64-tdep.c: Ditto.
* solib.c, somread.c, source.c, sparc-tdep.c: Ditto.
* stabsread.c, stack.c, standalone.c, symfile.c: Ditto.
* symmisc.c, symtab.c, top.c, tracepoint.c: Ditto.
* typeprint.c, utils.c, valarith.c, valops.c: Ditto.
* values.c, vax-tdep.c, xcoffread.c: Ditto.
2003-09-14 16:32:14 +00:00
|
|
|
|
int *buffer = (int *) xmalloc (count * sizeof (int));
|
1999-04-16 01:35:26 +00:00
|
|
|
|
|
|
|
|
|
if (write)
|
|
|
|
|
{
|
|
|
|
|
/* Fill start and end extra bytes of buffer with existing memory data. */
|
1999-07-07 20:19:36 +00:00
|
|
|
|
if (addr != memaddr || len < (int) sizeof (int))
|
1999-05-05 14:45:51 +00:00
|
|
|
|
{
|
|
|
|
|
/* Need part of initial word -- fetch it. */
|
1999-07-07 20:19:36 +00:00
|
|
|
|
buffer[0] = call_ptrace (addr < text_end ? PT_RIUSER : PT_RDUSER,
|
2001-05-04 04:15:33 +00:00
|
|
|
|
PIDGET (inferior_ptid),
|
|
|
|
|
(PTRACE_ARG3_TYPE) addr, 0);
|
1999-05-05 14:45:51 +00:00
|
|
|
|
}
|
1999-04-16 01:35:26 +00:00
|
|
|
|
|
|
|
|
|
if (count > 1) /* FIXME, avoid if even boundary */
|
|
|
|
|
{
|
|
|
|
|
buffer[count - 1]
|
1999-05-05 14:45:51 +00:00
|
|
|
|
= call_ptrace (addr < text_end ? PT_RIUSER : PT_RDUSER,
|
2001-05-04 04:15:33 +00:00
|
|
|
|
PIDGET (inferior_ptid),
|
1999-05-05 14:45:51 +00:00
|
|
|
|
(PTRACE_ARG3_TYPE) (addr
|
|
|
|
|
+ (count - 1) * sizeof (int)),
|
|
|
|
|
0);
|
1999-04-16 01:35:26 +00:00
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
/* Copy data to be written over corresponding part of buffer */
|
|
|
|
|
memcpy ((char *) buffer + (memaddr & (sizeof (int) - 1)), myaddr, len);
|
|
|
|
|
|
|
|
|
|
/* Write the entire buffer. */
|
|
|
|
|
for (i = 0; i < count; i++, addr += sizeof (int))
|
|
|
|
|
{
|
1999-05-05 14:45:51 +00:00
|
|
|
|
int pt_status;
|
|
|
|
|
int pt_request;
|
|
|
|
|
/* The HP-UX kernel crashes if you use PT_WDUSER to write into the
|
|
|
|
|
text segment. FIXME -- does it work to write into the data
|
|
|
|
|
segment using WIUSER, or do these idiots really expect us to
|
|
|
|
|
figure out which segment the address is in, so we can use a
|
|
|
|
|
separate system call for it??! */
|
1999-04-16 01:35:26 +00:00
|
|
|
|
errno = 0;
|
1999-05-05 14:45:51 +00:00
|
|
|
|
pt_request = (addr < text_end) ? PT_WIUSER : PT_WDUSER;
|
1999-04-16 01:35:26 +00:00
|
|
|
|
pt_status = call_ptrace (pt_request,
|
2001-05-04 04:15:33 +00:00
|
|
|
|
PIDGET (inferior_ptid),
|
1999-05-05 14:45:51 +00:00
|
|
|
|
(PTRACE_ARG3_TYPE) addr,
|
|
|
|
|
buffer[i]);
|
|
|
|
|
|
|
|
|
|
/* Did we fail? Might we've guessed wrong about which
|
|
|
|
|
segment this address resides in? Try the other request,
|
|
|
|
|
and see if that works... */
|
|
|
|
|
if ((pt_status == -1) && errno)
|
|
|
|
|
{
|
|
|
|
|
errno = 0;
|
|
|
|
|
pt_request = (pt_request == PT_WIUSER) ? PT_WDUSER : PT_WIUSER;
|
|
|
|
|
pt_status = call_ptrace (pt_request,
|
2001-05-04 04:15:33 +00:00
|
|
|
|
PIDGET (inferior_ptid),
|
1999-05-05 14:45:51 +00:00
|
|
|
|
(PTRACE_ARG3_TYPE) addr,
|
|
|
|
|
buffer[i]);
|
|
|
|
|
|
|
|
|
|
/* No, we still fail. Okay, time to punt. */
|
|
|
|
|
if ((pt_status == -1) && errno)
|
|
|
|
|
{
|
2000-12-15 01:01:51 +00:00
|
|
|
|
xfree (buffer);
|
1999-05-05 14:45:51 +00:00
|
|
|
|
return 0;
|
|
|
|
|
}
|
|
|
|
|
}
|
1999-04-16 01:35:26 +00:00
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
else
|
|
|
|
|
{
|
|
|
|
|
/* Read all the longwords */
|
|
|
|
|
for (i = 0; i < count; i++, addr += sizeof (int))
|
|
|
|
|
{
|
|
|
|
|
errno = 0;
|
1999-07-07 20:19:36 +00:00
|
|
|
|
buffer[i] = call_ptrace (addr < text_end ? PT_RIUSER : PT_RDUSER,
|
2001-05-04 04:15:33 +00:00
|
|
|
|
PIDGET (inferior_ptid),
|
|
|
|
|
(PTRACE_ARG3_TYPE) addr, 0);
|
1999-05-05 14:45:51 +00:00
|
|
|
|
if (errno)
|
|
|
|
|
{
|
2000-12-15 01:01:51 +00:00
|
|
|
|
xfree (buffer);
|
1999-05-05 14:45:51 +00:00
|
|
|
|
return 0;
|
|
|
|
|
}
|
1999-04-16 01:35:26 +00:00
|
|
|
|
QUIT;
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
/* Copy appropriate bytes out of the buffer. */
|
|
|
|
|
memcpy (myaddr, (char *) buffer + (memaddr & (sizeof (int) - 1)), len);
|
|
|
|
|
}
|
2000-12-15 01:01:51 +00:00
|
|
|
|
xfree (buffer);
|
1999-04-16 01:35:26 +00:00
|
|
|
|
return len;
|
|
|
|
|
}
|
|
|
|
|
|
2002-12-11 02:02:03 +00:00
|
|
|
|
char *saved_child_execd_pathname = NULL;
|
2002-12-11 02:04:45 +00:00
|
|
|
|
int saved_vfork_pid;
|
2002-12-11 02:02:03 +00:00
|
|
|
|
enum {
|
|
|
|
|
STATE_NONE,
|
|
|
|
|
STATE_GOT_CHILD,
|
|
|
|
|
STATE_GOT_EXEC,
|
|
|
|
|
STATE_GOT_PARENT,
|
|
|
|
|
STATE_FAKE_EXEC
|
|
|
|
|
} saved_vfork_state = STATE_NONE;
|
1999-04-16 01:35:26 +00:00
|
|
|
|
|
2002-12-11 02:04:45 +00:00
|
|
|
|
int
|
|
|
|
|
child_follow_fork (int follow_child)
|
1999-04-16 01:35:26 +00:00
|
|
|
|
{
|
2002-12-11 02:04:45 +00:00
|
|
|
|
ptid_t last_ptid;
|
|
|
|
|
struct target_waitstatus last_status;
|
|
|
|
|
int has_vforked;
|
|
|
|
|
int parent_pid, child_pid;
|
|
|
|
|
|
|
|
|
|
get_last_target_status (&last_ptid, &last_status);
|
|
|
|
|
has_vforked = (last_status.kind == TARGET_WAITKIND_VFORKED);
|
|
|
|
|
parent_pid = ptid_get_pid (last_ptid);
|
|
|
|
|
child_pid = last_status.value.related_pid;
|
|
|
|
|
|
|
|
|
|
/* At this point, if we are vforking, breakpoints were already
|
|
|
|
|
detached from the child in child_wait; and the child has already
|
|
|
|
|
called execve(). If we are forking, both the parent and child
|
|
|
|
|
have breakpoints inserted. */
|
|
|
|
|
|
|
|
|
|
if (! follow_child)
|
1999-04-16 01:35:26 +00:00
|
|
|
|
{
|
2002-12-11 02:04:45 +00:00
|
|
|
|
if (! has_vforked)
|
|
|
|
|
{
|
|
|
|
|
detach_breakpoints (child_pid);
|
|
|
|
|
#ifdef SOLIB_REMOVE_INFERIOR_HOOK
|
|
|
|
|
SOLIB_REMOVE_INFERIOR_HOOK (child_pid);
|
|
|
|
|
#endif
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
/* Detach from the child. */
|
* corelow.c (init_core_ops): Delete references to to_require_attach
and to_require_detach.
* exec.c (init_exec_ops): Likewise.
* hppah-nat.c (child_follow_fork): Call hppa_require_attach and
hppa_require_detach directly.
* inferior.h (REQUIRE_ATTACH, REQUIRE_DETACH): Delete.
* inftarg.c (child_detach): Remove.
(child_detach_from_process): Rename to child_detach, remove
after_fork argument.
(child_attach): Remove.
(child_attach_to_process): Rename to child_attach, remove after_fork
argument.
(init_child_ops): Delete references to to_require_attach
and to_require_detach.
* infttrace.c (hppa_require_attach): Update comment.
* target.c (cleanup_target, update_current_target)
(init_dummy_target, setup_target_debug): Delete references to
to_require_attach and to_require_detach.
(find_default_require_detach, find_default_require_attach)
(debug_to_require_attach, debug_to_require_detach): Remove
functions.
* target.h (struct target_ops): Remove to_require_attach
and to_require_detach.
(target_require_attach, target_require_detach): Delete macros.
(find_default_require_detach, find_default_require_attach): Delete
prototypes.
* config/pa/nm-hppah.h (REQUIRE_ATTACH, REQUIRE_DETACH): Delete.
2002-12-12 01:39:34 +00:00
|
|
|
|
printf_unfiltered ("Detaching after fork from %s\n",
|
|
|
|
|
target_pid_to_str (pid_to_ptid (child_pid)));
|
|
|
|
|
hppa_require_detach (child_pid, 0);
|
2002-12-11 02:04:45 +00:00
|
|
|
|
|
|
|
|
|
/* The parent and child of a vfork share the same address space.
|
|
|
|
|
Also, on some targets the order in which vfork and exec events
|
|
|
|
|
are received for parent in child requires some delicate handling
|
|
|
|
|
of the events.
|
|
|
|
|
|
|
|
|
|
For instance, on ptrace-based HPUX we receive the child's vfork
|
|
|
|
|
event first, at which time the parent has been suspended by the
|
|
|
|
|
OS and is essentially untouchable until the child's exit or second
|
|
|
|
|
exec event arrives. At that time, the parent's vfork event is
|
|
|
|
|
delivered to us, and that's when we see and decide how to follow
|
|
|
|
|
the vfork. But to get to that point, we must continue the child
|
|
|
|
|
until it execs or exits. To do that smoothly, all breakpoints
|
|
|
|
|
must be removed from the child, in case there are any set between
|
|
|
|
|
the vfork() and exec() calls. But removing them from the child
|
|
|
|
|
also removes them from the parent, due to the shared-address-space
|
|
|
|
|
nature of a vfork'd parent and child. On HPUX, therefore, we must
|
|
|
|
|
take care to restore the bp's to the parent before we continue it.
|
|
|
|
|
Else, it's likely that we may not stop in the expected place. (The
|
|
|
|
|
worst scenario is when the user tries to step over a vfork() call;
|
|
|
|
|
the step-resume bp must be restored for the step to properly stop
|
|
|
|
|
in the parent after the call completes!)
|
|
|
|
|
|
|
|
|
|
Sequence of events, as reported to gdb from HPUX:
|
|
|
|
|
|
|
|
|
|
Parent Child Action for gdb to take
|
|
|
|
|
-------------------------------------------------------
|
|
|
|
|
1 VFORK Continue child
|
|
|
|
|
2 EXEC
|
|
|
|
|
3 EXEC or EXIT
|
|
|
|
|
4 VFORK
|
|
|
|
|
|
|
|
|
|
Now that the child has safely exec'd or exited, we must restore
|
|
|
|
|
the parent's breakpoints before we continue it. Else, we may
|
|
|
|
|
cause it run past expected stopping points. */
|
|
|
|
|
|
|
|
|
|
if (has_vforked)
|
|
|
|
|
reattach_breakpoints (parent_pid);
|
1999-04-16 01:35:26 +00:00
|
|
|
|
}
|
2002-12-11 02:04:45 +00:00
|
|
|
|
else
|
|
|
|
|
{
|
|
|
|
|
/* Needed to keep the breakpoint lists in sync. */
|
|
|
|
|
if (! has_vforked)
|
|
|
|
|
detach_breakpoints (child_pid);
|
2002-12-11 02:02:03 +00:00
|
|
|
|
|
2002-12-11 02:04:45 +00:00
|
|
|
|
/* Before detaching from the parent, remove all breakpoints from it. */
|
|
|
|
|
remove_breakpoints ();
|
|
|
|
|
|
|
|
|
|
/* Also reset the solib inferior hook from the parent. */
|
|
|
|
|
#ifdef SOLIB_REMOVE_INFERIOR_HOOK
|
|
|
|
|
SOLIB_REMOVE_INFERIOR_HOOK (PIDGET (inferior_ptid));
|
|
|
|
|
#endif
|
2002-12-11 02:02:03 +00:00
|
|
|
|
|
2002-12-11 02:04:45 +00:00
|
|
|
|
/* Detach from the parent. */
|
|
|
|
|
target_detach (NULL, 1);
|
|
|
|
|
|
|
|
|
|
/* Attach to the child. */
|
* corelow.c (init_core_ops): Delete references to to_require_attach
and to_require_detach.
* exec.c (init_exec_ops): Likewise.
* hppah-nat.c (child_follow_fork): Call hppa_require_attach and
hppa_require_detach directly.
* inferior.h (REQUIRE_ATTACH, REQUIRE_DETACH): Delete.
* inftarg.c (child_detach): Remove.
(child_detach_from_process): Rename to child_detach, remove
after_fork argument.
(child_attach): Remove.
(child_attach_to_process): Rename to child_attach, remove after_fork
argument.
(init_child_ops): Delete references to to_require_attach
and to_require_detach.
* infttrace.c (hppa_require_attach): Update comment.
* target.c (cleanup_target, update_current_target)
(init_dummy_target, setup_target_debug): Delete references to
to_require_attach and to_require_detach.
(find_default_require_detach, find_default_require_attach)
(debug_to_require_attach, debug_to_require_detach): Remove
functions.
* target.h (struct target_ops): Remove to_require_attach
and to_require_detach.
(target_require_attach, target_require_detach): Delete macros.
(find_default_require_detach, find_default_require_attach): Delete
prototypes.
* config/pa/nm-hppah.h (REQUIRE_ATTACH, REQUIRE_DETACH): Delete.
2002-12-12 01:39:34 +00:00
|
|
|
|
printf_unfiltered ("Attaching after fork to %s\n",
|
|
|
|
|
target_pid_to_str (pid_to_ptid (child_pid)));
|
|
|
|
|
hppa_require_attach (child_pid);
|
2002-12-11 02:04:45 +00:00
|
|
|
|
inferior_ptid = pid_to_ptid (child_pid);
|
|
|
|
|
|
|
|
|
|
/* If we vforked, then we've also execed by now. The exec will be
|
|
|
|
|
reported momentarily. follow_exec () will handle breakpoints, so
|
|
|
|
|
we don't have to.. */
|
|
|
|
|
if (!has_vforked)
|
|
|
|
|
follow_inferior_reset_breakpoints ();
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
if (has_vforked)
|
1999-04-16 01:35:26 +00:00
|
|
|
|
{
|
2002-12-11 02:04:45 +00:00
|
|
|
|
/* If we followed the parent, don't try to follow the child's exec. */
|
|
|
|
|
if (saved_vfork_state != STATE_GOT_PARENT
|
|
|
|
|
&& saved_vfork_state != STATE_FAKE_EXEC)
|
|
|
|
|
fprintf_unfiltered (gdb_stdout,
|
|
|
|
|
"hppa: post follow vfork: confused state\n");
|
|
|
|
|
|
|
|
|
|
if (! follow_child || saved_vfork_state == STATE_GOT_PARENT)
|
|
|
|
|
saved_vfork_state = STATE_NONE;
|
|
|
|
|
else
|
|
|
|
|
return 1;
|
1999-04-16 01:35:26 +00:00
|
|
|
|
}
|
2002-12-11 02:04:45 +00:00
|
|
|
|
return 0;
|
1999-04-16 01:35:26 +00:00
|
|
|
|
}
|
|
|
|
|
|
1999-05-05 14:45:51 +00:00
|
|
|
|
/* Format a process id, given PID. Be sure to terminate
|
|
|
|
|
this with a null--it's going to be printed via a "%s". */
|
1999-04-16 01:35:26 +00:00
|
|
|
|
char *
|
2001-05-04 04:15:33 +00:00
|
|
|
|
child_pid_to_str (ptid_t ptid)
|
1999-04-16 01:35:26 +00:00
|
|
|
|
{
|
1999-07-07 20:19:36 +00:00
|
|
|
|
/* Static because address returned */
|
|
|
|
|
static char buf[30];
|
2001-05-04 04:15:33 +00:00
|
|
|
|
pid_t pid = PIDGET (ptid);
|
1999-04-16 01:35:26 +00:00
|
|
|
|
|
2001-10-24 02:53:48 +00:00
|
|
|
|
/* Extra NUL for paranoia's sake */
|
|
|
|
|
sprintf (buf, "process %d%c", pid, '\0');
|
1999-07-07 20:19:36 +00:00
|
|
|
|
|
|
|
|
|
return buf;
|
1999-04-16 01:35:26 +00:00
|
|
|
|
}
|
|
|
|
|
|
1999-05-05 14:45:51 +00:00
|
|
|
|
/* Format a thread id, given TID. Be sure to terminate
|
|
|
|
|
this with a null--it's going to be printed via a "%s".
|
|
|
|
|
|
|
|
|
|
Note: This is a core-gdb tid, not the actual system tid.
|
1999-07-07 20:19:36 +00:00
|
|
|
|
See infttrace.c for details. */
|
1999-04-16 01:35:26 +00:00
|
|
|
|
char *
|
2001-05-04 04:15:33 +00:00
|
|
|
|
hppa_tid_to_str (ptid_t ptid)
|
1999-04-16 01:35:26 +00:00
|
|
|
|
{
|
1999-07-07 20:19:36 +00:00
|
|
|
|
/* Static because address returned */
|
|
|
|
|
static char buf[30];
|
2001-05-04 04:15:33 +00:00
|
|
|
|
/* This seems strange, but when I did the ptid conversion, it looked
|
|
|
|
|
as though a pid was always being passed. - Kevin Buettner */
|
|
|
|
|
pid_t tid = PIDGET (ptid);
|
1999-07-07 20:19:36 +00:00
|
|
|
|
|
|
|
|
|
/* Extra NULLs for paranoia's sake */
|
2001-10-24 02:53:48 +00:00
|
|
|
|
sprintf (buf, "system thread %d%c", tid, '\0');
|
1999-04-16 01:35:26 +00:00
|
|
|
|
|
1999-07-07 20:19:36 +00:00
|
|
|
|
return buf;
|
1999-04-16 01:35:26 +00:00
|
|
|
|
}
|
|
|
|
|
|
* breakpoint.c (bpstat_stop_status): Call inferior_has_forked,
inferior_has_vforked, and inferior_has_execd instead of
target_has_forked, target_has_vforked, and target_has_execd.
* config/pa/nm-hppah.h (CHILD_HAS_FORKED, CHILD_HAS_VFORKED)
(CHILD_HAS_EXECD, CHILD_HAS_SYSCALL_EVENT): Don't define.
(CHILD_WAIT): Define.
(child_wait): Add prototype.
* hppah-nat.c (hpux_has_forked): Rename from child_has_forked.
Add prototype.
(hpux_has_vforked): Likewise, from child_has_vforked.
(hpux_has_execd): Likewise, from child_has_execd.
(hpux_has_syscall_event): Likewise, from child_has_syscall_event.
(not_same_real_pid, child_wait): New, copied from inftarg.c.
Call hpux_has_forked, hpux_has_vforked, hpux_has_execd,
and hpux_has_syscall_event instead of the target hooks.
* infrun.c (inferior_has_forked, inferior_has_vforked)
(inferior_has_execd): New functions.
* inftarg.c (not_same_real_pid): Remove.
(child_wait): Remove references to not_same_real_pid,
target_has_forked, target_has_vforked, target_has_execd,
and target_has_syscall_event.
(child_has_forked, child_has_vforked, child_has_execd)
(child_has_syscall_event): Remove.
(init_child_ops): Remove references to child_has_forked,
child_has_vforked, child_has_execd, and child_has_syscall_event.
* infttrace.c (hpux_has_forked): Rename from child_has_forked.
(hpux_has_vforked): Likewise, from child_has_vforked.
(hpux_has_execd): Likewise, from child_has_execd.
(hpux_has_syscall_event): Likewise, from child_has_syscall_event.
* target.c (cleanup_target): Remove references to
to_has_forked, to_has_vforked, to_has_execd, and
to_has_syscall_event.
(update_current_target): Likewise.
(setup_target_debug): Likewise.
(debug_to_has_forked): Remove.
(debug_to_has_vforked): Remove.
(debug_to_has_execd): Remove.
(debug_to_has_syscall_event): Remove.
* target.h (struct target_ops): Remove to_has_forked.
to_has_vforked, to_has_execd, and to_has_syscall_event.
(child_has_forked, child_has_vforked, child_has_execd)
(child_has_syscall_event): Remove prototypes.
(inferior_has_forked, inferior_has_vforked, inferior_has_execd): Add
prototypes.
(target_has_forked, target_has_vforked, target_has_execd)
(target_has_syscall_event): Remove macros.
2002-11-16 19:22:59 +00:00
|
|
|
|
/*## */
|
|
|
|
|
/* Enable HACK for ttrace work. In
|
|
|
|
|
* infttrace.c/require_notification_of_events,
|
|
|
|
|
* this is set to 0 so that the loop in child_wait
|
|
|
|
|
* won't loop.
|
|
|
|
|
*/
|
|
|
|
|
int not_same_real_pid = 1;
|
|
|
|
|
/*## */
|
|
|
|
|
|
|
|
|
|
/* Wait for child to do something. Return pid of child, or -1 in case
|
|
|
|
|
of error; store status through argument pointer OURSTATUS. */
|
|
|
|
|
|
|
|
|
|
ptid_t
|
|
|
|
|
child_wait (ptid_t ptid, struct target_waitstatus *ourstatus)
|
|
|
|
|
{
|
|
|
|
|
int save_errno;
|
|
|
|
|
int status;
|
|
|
|
|
char *execd_pathname = NULL;
|
|
|
|
|
int exit_status;
|
|
|
|
|
int related_pid;
|
|
|
|
|
int syscall_id;
|
|
|
|
|
enum target_waitkind kind;
|
|
|
|
|
int pid;
|
|
|
|
|
|
2002-12-11 02:02:03 +00:00
|
|
|
|
if (saved_vfork_state == STATE_FAKE_EXEC)
|
|
|
|
|
{
|
|
|
|
|
saved_vfork_state = STATE_NONE;
|
|
|
|
|
ourstatus->kind = TARGET_WAITKIND_EXECD;
|
|
|
|
|
ourstatus->value.execd_pathname = saved_child_execd_pathname;
|
|
|
|
|
return inferior_ptid;
|
|
|
|
|
}
|
|
|
|
|
|
* breakpoint.c (bpstat_stop_status): Call inferior_has_forked,
inferior_has_vforked, and inferior_has_execd instead of
target_has_forked, target_has_vforked, and target_has_execd.
* config/pa/nm-hppah.h (CHILD_HAS_FORKED, CHILD_HAS_VFORKED)
(CHILD_HAS_EXECD, CHILD_HAS_SYSCALL_EVENT): Don't define.
(CHILD_WAIT): Define.
(child_wait): Add prototype.
* hppah-nat.c (hpux_has_forked): Rename from child_has_forked.
Add prototype.
(hpux_has_vforked): Likewise, from child_has_vforked.
(hpux_has_execd): Likewise, from child_has_execd.
(hpux_has_syscall_event): Likewise, from child_has_syscall_event.
(not_same_real_pid, child_wait): New, copied from inftarg.c.
Call hpux_has_forked, hpux_has_vforked, hpux_has_execd,
and hpux_has_syscall_event instead of the target hooks.
* infrun.c (inferior_has_forked, inferior_has_vforked)
(inferior_has_execd): New functions.
* inftarg.c (not_same_real_pid): Remove.
(child_wait): Remove references to not_same_real_pid,
target_has_forked, target_has_vforked, target_has_execd,
and target_has_syscall_event.
(child_has_forked, child_has_vforked, child_has_execd)
(child_has_syscall_event): Remove.
(init_child_ops): Remove references to child_has_forked,
child_has_vforked, child_has_execd, and child_has_syscall_event.
* infttrace.c (hpux_has_forked): Rename from child_has_forked.
(hpux_has_vforked): Likewise, from child_has_vforked.
(hpux_has_execd): Likewise, from child_has_execd.
(hpux_has_syscall_event): Likewise, from child_has_syscall_event.
* target.c (cleanup_target): Remove references to
to_has_forked, to_has_vforked, to_has_execd, and
to_has_syscall_event.
(update_current_target): Likewise.
(setup_target_debug): Likewise.
(debug_to_has_forked): Remove.
(debug_to_has_vforked): Remove.
(debug_to_has_execd): Remove.
(debug_to_has_syscall_event): Remove.
* target.h (struct target_ops): Remove to_has_forked.
to_has_vforked, to_has_execd, and to_has_syscall_event.
(child_has_forked, child_has_vforked, child_has_execd)
(child_has_syscall_event): Remove prototypes.
(inferior_has_forked, inferior_has_vforked, inferior_has_execd): Add
prototypes.
(target_has_forked, target_has_vforked, target_has_execd)
(target_has_syscall_event): Remove macros.
2002-11-16 19:22:59 +00:00
|
|
|
|
do
|
|
|
|
|
{
|
|
|
|
|
set_sigint_trap (); /* Causes SIGINT to be passed on to the
|
|
|
|
|
attached process. */
|
|
|
|
|
set_sigio_trap ();
|
|
|
|
|
|
|
|
|
|
pid = ptrace_wait (inferior_ptid, &status);
|
|
|
|
|
|
|
|
|
|
save_errno = errno;
|
|
|
|
|
|
|
|
|
|
clear_sigio_trap ();
|
|
|
|
|
|
|
|
|
|
clear_sigint_trap ();
|
|
|
|
|
|
|
|
|
|
if (pid == -1)
|
|
|
|
|
{
|
|
|
|
|
if (save_errno == EINTR)
|
|
|
|
|
continue;
|
|
|
|
|
|
|
|
|
|
fprintf_unfiltered (gdb_stderr, "Child process unexpectedly missing: %s.\n",
|
|
|
|
|
safe_strerror (save_errno));
|
|
|
|
|
|
|
|
|
|
/* Claim it exited with unknown signal. */
|
|
|
|
|
ourstatus->kind = TARGET_WAITKIND_SIGNALLED;
|
|
|
|
|
ourstatus->value.sig = TARGET_SIGNAL_UNKNOWN;
|
|
|
|
|
return pid_to_ptid (-1);
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
/* Did it exit?
|
|
|
|
|
*/
|
|
|
|
|
if (target_has_exited (pid, status, &exit_status))
|
|
|
|
|
{
|
|
|
|
|
/* ??rehrauer: For now, ignore this. */
|
|
|
|
|
continue;
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
if (!target_thread_alive (pid_to_ptid (pid)))
|
|
|
|
|
{
|
|
|
|
|
ourstatus->kind = TARGET_WAITKIND_SPURIOUS;
|
|
|
|
|
return pid_to_ptid (pid);
|
|
|
|
|
}
|
|
|
|
|
|
2002-12-11 01:25:19 +00:00
|
|
|
|
if (hpux_has_forked (pid, &related_pid))
|
* breakpoint.c (bpstat_stop_status): Call inferior_has_forked,
inferior_has_vforked, and inferior_has_execd instead of
target_has_forked, target_has_vforked, and target_has_execd.
* config/pa/nm-hppah.h (CHILD_HAS_FORKED, CHILD_HAS_VFORKED)
(CHILD_HAS_EXECD, CHILD_HAS_SYSCALL_EVENT): Don't define.
(CHILD_WAIT): Define.
(child_wait): Add prototype.
* hppah-nat.c (hpux_has_forked): Rename from child_has_forked.
Add prototype.
(hpux_has_vforked): Likewise, from child_has_vforked.
(hpux_has_execd): Likewise, from child_has_execd.
(hpux_has_syscall_event): Likewise, from child_has_syscall_event.
(not_same_real_pid, child_wait): New, copied from inftarg.c.
Call hpux_has_forked, hpux_has_vforked, hpux_has_execd,
and hpux_has_syscall_event instead of the target hooks.
* infrun.c (inferior_has_forked, inferior_has_vforked)
(inferior_has_execd): New functions.
* inftarg.c (not_same_real_pid): Remove.
(child_wait): Remove references to not_same_real_pid,
target_has_forked, target_has_vforked, target_has_execd,
and target_has_syscall_event.
(child_has_forked, child_has_vforked, child_has_execd)
(child_has_syscall_event): Remove.
(init_child_ops): Remove references to child_has_forked,
child_has_vforked, child_has_execd, and child_has_syscall_event.
* infttrace.c (hpux_has_forked): Rename from child_has_forked.
(hpux_has_vforked): Likewise, from child_has_vforked.
(hpux_has_execd): Likewise, from child_has_execd.
(hpux_has_syscall_event): Likewise, from child_has_syscall_event.
* target.c (cleanup_target): Remove references to
to_has_forked, to_has_vforked, to_has_execd, and
to_has_syscall_event.
(update_current_target): Likewise.
(setup_target_debug): Likewise.
(debug_to_has_forked): Remove.
(debug_to_has_vforked): Remove.
(debug_to_has_execd): Remove.
(debug_to_has_syscall_event): Remove.
* target.h (struct target_ops): Remove to_has_forked.
to_has_vforked, to_has_execd, and to_has_syscall_event.
(child_has_forked, child_has_vforked, child_has_execd)
(child_has_syscall_event): Remove prototypes.
(inferior_has_forked, inferior_has_vforked, inferior_has_execd): Add
prototypes.
(target_has_forked, target_has_vforked, target_has_execd)
(target_has_syscall_event): Remove macros.
2002-11-16 19:22:59 +00:00
|
|
|
|
{
|
2002-12-11 01:25:19 +00:00
|
|
|
|
/* Ignore the parent's fork event. */
|
|
|
|
|
if (pid == PIDGET (inferior_ptid))
|
|
|
|
|
{
|
|
|
|
|
ourstatus->kind = TARGET_WAITKIND_IGNORE;
|
|
|
|
|
return inferior_ptid;
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
/* If this is the child's fork event, report that the
|
|
|
|
|
process has forked. */
|
|
|
|
|
if (related_pid == PIDGET (inferior_ptid))
|
|
|
|
|
{
|
|
|
|
|
ourstatus->kind = TARGET_WAITKIND_FORKED;
|
|
|
|
|
ourstatus->value.related_pid = pid;
|
|
|
|
|
return inferior_ptid;
|
|
|
|
|
}
|
* breakpoint.c (bpstat_stop_status): Call inferior_has_forked,
inferior_has_vforked, and inferior_has_execd instead of
target_has_forked, target_has_vforked, and target_has_execd.
* config/pa/nm-hppah.h (CHILD_HAS_FORKED, CHILD_HAS_VFORKED)
(CHILD_HAS_EXECD, CHILD_HAS_SYSCALL_EVENT): Don't define.
(CHILD_WAIT): Define.
(child_wait): Add prototype.
* hppah-nat.c (hpux_has_forked): Rename from child_has_forked.
Add prototype.
(hpux_has_vforked): Likewise, from child_has_vforked.
(hpux_has_execd): Likewise, from child_has_execd.
(hpux_has_syscall_event): Likewise, from child_has_syscall_event.
(not_same_real_pid, child_wait): New, copied from inftarg.c.
Call hpux_has_forked, hpux_has_vforked, hpux_has_execd,
and hpux_has_syscall_event instead of the target hooks.
* infrun.c (inferior_has_forked, inferior_has_vforked)
(inferior_has_execd): New functions.
* inftarg.c (not_same_real_pid): Remove.
(child_wait): Remove references to not_same_real_pid,
target_has_forked, target_has_vforked, target_has_execd,
and target_has_syscall_event.
(child_has_forked, child_has_vforked, child_has_execd)
(child_has_syscall_event): Remove.
(init_child_ops): Remove references to child_has_forked,
child_has_vforked, child_has_execd, and child_has_syscall_event.
* infttrace.c (hpux_has_forked): Rename from child_has_forked.
(hpux_has_vforked): Likewise, from child_has_vforked.
(hpux_has_execd): Likewise, from child_has_execd.
(hpux_has_syscall_event): Likewise, from child_has_syscall_event.
* target.c (cleanup_target): Remove references to
to_has_forked, to_has_vforked, to_has_execd, and
to_has_syscall_event.
(update_current_target): Likewise.
(setup_target_debug): Likewise.
(debug_to_has_forked): Remove.
(debug_to_has_vforked): Remove.
(debug_to_has_execd): Remove.
(debug_to_has_syscall_event): Remove.
* target.h (struct target_ops): Remove to_has_forked.
to_has_vforked, to_has_execd, and to_has_syscall_event.
(child_has_forked, child_has_vforked, child_has_execd)
(child_has_syscall_event): Remove prototypes.
(inferior_has_forked, inferior_has_vforked, inferior_has_execd): Add
prototypes.
(target_has_forked, target_has_vforked, target_has_execd)
(target_has_syscall_event): Remove macros.
2002-11-16 19:22:59 +00:00
|
|
|
|
}
|
|
|
|
|
|
2002-12-11 02:02:03 +00:00
|
|
|
|
if (hpux_has_vforked (pid, &related_pid))
|
* breakpoint.c (bpstat_stop_status): Call inferior_has_forked,
inferior_has_vforked, and inferior_has_execd instead of
target_has_forked, target_has_vforked, and target_has_execd.
* config/pa/nm-hppah.h (CHILD_HAS_FORKED, CHILD_HAS_VFORKED)
(CHILD_HAS_EXECD, CHILD_HAS_SYSCALL_EVENT): Don't define.
(CHILD_WAIT): Define.
(child_wait): Add prototype.
* hppah-nat.c (hpux_has_forked): Rename from child_has_forked.
Add prototype.
(hpux_has_vforked): Likewise, from child_has_vforked.
(hpux_has_execd): Likewise, from child_has_execd.
(hpux_has_syscall_event): Likewise, from child_has_syscall_event.
(not_same_real_pid, child_wait): New, copied from inftarg.c.
Call hpux_has_forked, hpux_has_vforked, hpux_has_execd,
and hpux_has_syscall_event instead of the target hooks.
* infrun.c (inferior_has_forked, inferior_has_vforked)
(inferior_has_execd): New functions.
* inftarg.c (not_same_real_pid): Remove.
(child_wait): Remove references to not_same_real_pid,
target_has_forked, target_has_vforked, target_has_execd,
and target_has_syscall_event.
(child_has_forked, child_has_vforked, child_has_execd)
(child_has_syscall_event): Remove.
(init_child_ops): Remove references to child_has_forked,
child_has_vforked, child_has_execd, and child_has_syscall_event.
* infttrace.c (hpux_has_forked): Rename from child_has_forked.
(hpux_has_vforked): Likewise, from child_has_vforked.
(hpux_has_execd): Likewise, from child_has_execd.
(hpux_has_syscall_event): Likewise, from child_has_syscall_event.
* target.c (cleanup_target): Remove references to
to_has_forked, to_has_vforked, to_has_execd, and
to_has_syscall_event.
(update_current_target): Likewise.
(setup_target_debug): Likewise.
(debug_to_has_forked): Remove.
(debug_to_has_vforked): Remove.
(debug_to_has_execd): Remove.
(debug_to_has_syscall_event): Remove.
* target.h (struct target_ops): Remove to_has_forked.
to_has_vforked, to_has_execd, and to_has_syscall_event.
(child_has_forked, child_has_vforked, child_has_execd)
(child_has_syscall_event): Remove prototypes.
(inferior_has_forked, inferior_has_vforked, inferior_has_execd): Add
prototypes.
(target_has_forked, target_has_vforked, target_has_execd)
(target_has_syscall_event): Remove macros.
2002-11-16 19:22:59 +00:00
|
|
|
|
{
|
2002-12-11 02:02:03 +00:00
|
|
|
|
if (pid == PIDGET (inferior_ptid))
|
|
|
|
|
{
|
|
|
|
|
if (saved_vfork_state == STATE_GOT_CHILD)
|
|
|
|
|
saved_vfork_state = STATE_GOT_PARENT;
|
|
|
|
|
else if (saved_vfork_state == STATE_GOT_EXEC)
|
|
|
|
|
saved_vfork_state = STATE_FAKE_EXEC;
|
|
|
|
|
else
|
|
|
|
|
fprintf_unfiltered (gdb_stdout,
|
|
|
|
|
"hppah: parent vfork: confused\n");
|
|
|
|
|
}
|
|
|
|
|
else if (related_pid == PIDGET (inferior_ptid))
|
|
|
|
|
{
|
|
|
|
|
if (saved_vfork_state == STATE_NONE)
|
|
|
|
|
saved_vfork_state = STATE_GOT_CHILD;
|
|
|
|
|
else
|
|
|
|
|
fprintf_unfiltered (gdb_stdout,
|
|
|
|
|
"hppah: child vfork: confused\n");
|
|
|
|
|
}
|
|
|
|
|
else
|
|
|
|
|
fprintf_unfiltered (gdb_stdout,
|
|
|
|
|
"hppah: unknown vfork: confused\n");
|
|
|
|
|
|
|
|
|
|
if (saved_vfork_state == STATE_GOT_CHILD)
|
|
|
|
|
{
|
|
|
|
|
child_post_startup_inferior (pid_to_ptid (pid));
|
2002-12-11 02:04:45 +00:00
|
|
|
|
detach_breakpoints (pid);
|
|
|
|
|
#ifdef SOLIB_REMOVE_INFERIOR_HOOK
|
|
|
|
|
SOLIB_REMOVE_INFERIOR_HOOK (pid);
|
|
|
|
|
#endif
|
|
|
|
|
child_resume (pid_to_ptid (pid), 0, TARGET_SIGNAL_0);
|
|
|
|
|
ourstatus->kind = TARGET_WAITKIND_IGNORE;
|
|
|
|
|
return pid_to_ptid (related_pid);
|
2002-12-11 02:02:03 +00:00
|
|
|
|
}
|
2002-12-11 02:04:45 +00:00
|
|
|
|
else if (saved_vfork_state == STATE_FAKE_EXEC)
|
2002-12-11 02:02:03 +00:00
|
|
|
|
{
|
|
|
|
|
ourstatus->kind = TARGET_WAITKIND_VFORKED;
|
|
|
|
|
ourstatus->value.related_pid = related_pid;
|
|
|
|
|
return pid_to_ptid (pid);
|
|
|
|
|
}
|
2002-12-11 02:04:45 +00:00
|
|
|
|
else
|
|
|
|
|
{
|
|
|
|
|
/* We saw the parent's vfork, but we haven't seen the exec yet.
|
|
|
|
|
Wait for it, for simplicity's sake. It should be pending. */
|
|
|
|
|
saved_vfork_pid = related_pid;
|
|
|
|
|
ourstatus->kind = TARGET_WAITKIND_IGNORE;
|
|
|
|
|
return pid_to_ptid (pid);
|
|
|
|
|
}
|
* breakpoint.c (bpstat_stop_status): Call inferior_has_forked,
inferior_has_vforked, and inferior_has_execd instead of
target_has_forked, target_has_vforked, and target_has_execd.
* config/pa/nm-hppah.h (CHILD_HAS_FORKED, CHILD_HAS_VFORKED)
(CHILD_HAS_EXECD, CHILD_HAS_SYSCALL_EVENT): Don't define.
(CHILD_WAIT): Define.
(child_wait): Add prototype.
* hppah-nat.c (hpux_has_forked): Rename from child_has_forked.
Add prototype.
(hpux_has_vforked): Likewise, from child_has_vforked.
(hpux_has_execd): Likewise, from child_has_execd.
(hpux_has_syscall_event): Likewise, from child_has_syscall_event.
(not_same_real_pid, child_wait): New, copied from inftarg.c.
Call hpux_has_forked, hpux_has_vforked, hpux_has_execd,
and hpux_has_syscall_event instead of the target hooks.
* infrun.c (inferior_has_forked, inferior_has_vforked)
(inferior_has_execd): New functions.
* inftarg.c (not_same_real_pid): Remove.
(child_wait): Remove references to not_same_real_pid,
target_has_forked, target_has_vforked, target_has_execd,
and target_has_syscall_event.
(child_has_forked, child_has_vforked, child_has_execd)
(child_has_syscall_event): Remove.
(init_child_ops): Remove references to child_has_forked,
child_has_vforked, child_has_execd, and child_has_syscall_event.
* infttrace.c (hpux_has_forked): Rename from child_has_forked.
(hpux_has_vforked): Likewise, from child_has_vforked.
(hpux_has_execd): Likewise, from child_has_execd.
(hpux_has_syscall_event): Likewise, from child_has_syscall_event.
* target.c (cleanup_target): Remove references to
to_has_forked, to_has_vforked, to_has_execd, and
to_has_syscall_event.
(update_current_target): Likewise.
(setup_target_debug): Likewise.
(debug_to_has_forked): Remove.
(debug_to_has_vforked): Remove.
(debug_to_has_execd): Remove.
(debug_to_has_syscall_event): Remove.
* target.h (struct target_ops): Remove to_has_forked.
to_has_vforked, to_has_execd, and to_has_syscall_event.
(child_has_forked, child_has_vforked, child_has_execd)
(child_has_syscall_event): Remove prototypes.
(inferior_has_forked, inferior_has_vforked, inferior_has_execd): Add
prototypes.
(target_has_forked, target_has_vforked, target_has_execd)
(target_has_syscall_event): Remove macros.
2002-11-16 19:22:59 +00:00
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
if (hpux_has_execd (pid, &execd_pathname))
|
|
|
|
|
{
|
2002-12-11 02:02:03 +00:00
|
|
|
|
/* On HP-UX, events associated with a vforking inferior come in
|
|
|
|
|
threes: a vfork event for the child (always first), followed
|
|
|
|
|
a vfork event for the parent and an exec event for the child.
|
2002-12-11 02:04:45 +00:00
|
|
|
|
The latter two can come in either order. Make sure we get
|
|
|
|
|
both. */
|
|
|
|
|
if (saved_vfork_state != STATE_NONE)
|
2002-12-11 02:02:03 +00:00
|
|
|
|
{
|
2002-12-11 02:04:45 +00:00
|
|
|
|
if (saved_vfork_state == STATE_GOT_CHILD)
|
|
|
|
|
{
|
|
|
|
|
saved_vfork_state = STATE_GOT_EXEC;
|
|
|
|
|
/* On HP/UX with ptrace, the child must be resumed before
|
|
|
|
|
the parent vfork event is delivered. A single-step
|
|
|
|
|
suffices. */
|
|
|
|
|
if (RESUME_EXECD_VFORKING_CHILD_TO_GET_PARENT_VFORK ())
|
|
|
|
|
target_resume (pid_to_ptid (pid), 1, TARGET_SIGNAL_0);
|
|
|
|
|
ourstatus->kind = TARGET_WAITKIND_IGNORE;
|
|
|
|
|
}
|
|
|
|
|
else if (saved_vfork_state == STATE_GOT_PARENT)
|
|
|
|
|
{
|
|
|
|
|
saved_vfork_state = STATE_FAKE_EXEC;
|
|
|
|
|
ourstatus->kind = TARGET_WAITKIND_VFORKED;
|
|
|
|
|
ourstatus->value.related_pid = saved_vfork_pid;
|
|
|
|
|
}
|
|
|
|
|
else
|
|
|
|
|
fprintf_unfiltered (gdb_stdout,
|
|
|
|
|
"hppa: exec: unexpected state\n");
|
2002-12-11 02:02:03 +00:00
|
|
|
|
|
2002-12-11 02:04:45 +00:00
|
|
|
|
saved_child_execd_pathname = execd_pathname;
|
2002-12-11 02:02:03 +00:00
|
|
|
|
|
|
|
|
|
return inferior_ptid;
|
|
|
|
|
}
|
|
|
|
|
|
* breakpoint.c (bpstat_stop_status): Call inferior_has_forked,
inferior_has_vforked, and inferior_has_execd instead of
target_has_forked, target_has_vforked, and target_has_execd.
* config/pa/nm-hppah.h (CHILD_HAS_FORKED, CHILD_HAS_VFORKED)
(CHILD_HAS_EXECD, CHILD_HAS_SYSCALL_EVENT): Don't define.
(CHILD_WAIT): Define.
(child_wait): Add prototype.
* hppah-nat.c (hpux_has_forked): Rename from child_has_forked.
Add prototype.
(hpux_has_vforked): Likewise, from child_has_vforked.
(hpux_has_execd): Likewise, from child_has_execd.
(hpux_has_syscall_event): Likewise, from child_has_syscall_event.
(not_same_real_pid, child_wait): New, copied from inftarg.c.
Call hpux_has_forked, hpux_has_vforked, hpux_has_execd,
and hpux_has_syscall_event instead of the target hooks.
* infrun.c (inferior_has_forked, inferior_has_vforked)
(inferior_has_execd): New functions.
* inftarg.c (not_same_real_pid): Remove.
(child_wait): Remove references to not_same_real_pid,
target_has_forked, target_has_vforked, target_has_execd,
and target_has_syscall_event.
(child_has_forked, child_has_vforked, child_has_execd)
(child_has_syscall_event): Remove.
(init_child_ops): Remove references to child_has_forked,
child_has_vforked, child_has_execd, and child_has_syscall_event.
* infttrace.c (hpux_has_forked): Rename from child_has_forked.
(hpux_has_vforked): Likewise, from child_has_vforked.
(hpux_has_execd): Likewise, from child_has_execd.
(hpux_has_syscall_event): Likewise, from child_has_syscall_event.
* target.c (cleanup_target): Remove references to
to_has_forked, to_has_vforked, to_has_execd, and
to_has_syscall_event.
(update_current_target): Likewise.
(setup_target_debug): Likewise.
(debug_to_has_forked): Remove.
(debug_to_has_vforked): Remove.
(debug_to_has_execd): Remove.
(debug_to_has_syscall_event): Remove.
* target.h (struct target_ops): Remove to_has_forked.
to_has_vforked, to_has_execd, and to_has_syscall_event.
(child_has_forked, child_has_vforked, child_has_execd)
(child_has_syscall_event): Remove prototypes.
(inferior_has_forked, inferior_has_vforked, inferior_has_execd): Add
prototypes.
(target_has_forked, target_has_vforked, target_has_execd)
(target_has_syscall_event): Remove macros.
2002-11-16 19:22:59 +00:00
|
|
|
|
/* Are we ignoring initial exec events? (This is likely because
|
|
|
|
|
we're in the process of starting up the inferior, and another
|
|
|
|
|
(older) mechanism handles those.) If so, we'll report this
|
|
|
|
|
as a regular stop, not an exec.
|
|
|
|
|
*/
|
|
|
|
|
if (inferior_ignoring_startup_exec_events)
|
|
|
|
|
{
|
|
|
|
|
inferior_ignoring_startup_exec_events--;
|
|
|
|
|
}
|
|
|
|
|
else
|
|
|
|
|
{
|
|
|
|
|
ourstatus->kind = TARGET_WAITKIND_EXECD;
|
|
|
|
|
ourstatus->value.execd_pathname = execd_pathname;
|
|
|
|
|
return pid_to_ptid (pid);
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
/* All we must do with these is communicate their occurrence
|
|
|
|
|
to wait_for_inferior...
|
|
|
|
|
*/
|
|
|
|
|
if (hpux_has_syscall_event (pid, &kind, &syscall_id))
|
|
|
|
|
{
|
|
|
|
|
ourstatus->kind = kind;
|
|
|
|
|
ourstatus->value.syscall_id = syscall_id;
|
|
|
|
|
return pid_to_ptid (pid);
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
/*## } while (pid != PIDGET (inferior_ptid)); ## *//* Some other child died or stopped */
|
|
|
|
|
/* hack for thread testing */
|
|
|
|
|
}
|
|
|
|
|
while ((pid != PIDGET (inferior_ptid)) && not_same_real_pid);
|
|
|
|
|
/*## */
|
|
|
|
|
|
|
|
|
|
store_waitstatus (ourstatus, status);
|
|
|
|
|
return pid_to_ptid (pid);
|
|
|
|
|
}
|
|
|
|
|
|
1999-04-16 01:35:26 +00:00
|
|
|
|
#if !defined (GDB_NATIVE_HPUX_11)
|
|
|
|
|
|
|
|
|
|
/* The following code is a substitute for the infttrace.c versions used
|
|
|
|
|
with ttrace() in HPUX 11. */
|
|
|
|
|
|
|
|
|
|
/* This value is an arbitrary integer. */
|
|
|
|
|
#define PT_VERSION 123456
|
|
|
|
|
|
|
|
|
|
/* This semaphore is used to coordinate the child and parent processes
|
|
|
|
|
after a fork(), and before an exec() by the child. See
|
|
|
|
|
parent_attach_all for details. */
|
|
|
|
|
|
1999-07-07 20:19:36 +00:00
|
|
|
|
typedef struct
|
|
|
|
|
{
|
|
|
|
|
int parent_channel[2]; /* Parent "talks" to [1], child "listens" to [0] */
|
|
|
|
|
int child_channel[2]; /* Child "talks" to [1], parent "listens" to [0] */
|
|
|
|
|
}
|
|
|
|
|
startup_semaphore_t;
|
1999-04-16 01:35:26 +00:00
|
|
|
|
|
|
|
|
|
#define SEM_TALK (1)
|
|
|
|
|
#define SEM_LISTEN (0)
|
|
|
|
|
|
1999-07-07 20:19:36 +00:00
|
|
|
|
static startup_semaphore_t startup_semaphore;
|
1999-04-16 01:35:26 +00:00
|
|
|
|
|
|
|
|
|
#ifdef PT_SETTRC
|
|
|
|
|
/* This function causes the caller's process to be traced by its
|
|
|
|
|
parent. This is intended to be called after GDB forks itself,
|
|
|
|
|
and before the child execs the target.
|
|
|
|
|
|
|
|
|
|
Note that HP-UX ptrace is rather funky in how this is done.
|
|
|
|
|
If the parent wants to get the initial exec event of a child,
|
|
|
|
|
it must set the ptrace event mask of the child to include execs.
|
|
|
|
|
(The child cannot do this itself.) This must be done after the
|
|
|
|
|
child is forked, but before it execs.
|
|
|
|
|
|
|
|
|
|
To coordinate the parent and child, we implement a semaphore using
|
|
|
|
|
pipes. After SETTRC'ing itself, the child tells the parent that
|
|
|
|
|
it is now traceable by the parent, and waits for the parent's
|
|
|
|
|
acknowledgement. The parent can then set the child's event mask,
|
|
|
|
|
and notify the child that it can now exec.
|
|
|
|
|
|
|
|
|
|
(The acknowledgement by parent happens as a result of a call to
|
|
|
|
|
child_acknowledge_created_inferior.) */
|
|
|
|
|
|
|
|
|
|
int
|
2000-07-30 01:48:28 +00:00
|
|
|
|
parent_attach_all (int pid, PTRACE_ARG3_TYPE addr, int data)
|
1999-04-16 01:35:26 +00:00
|
|
|
|
{
|
|
|
|
|
int pt_status = 0;
|
|
|
|
|
|
|
|
|
|
/* We need a memory home for a constant. */
|
|
|
|
|
int tc_magic_child = PT_VERSION;
|
|
|
|
|
int tc_magic_parent = 0;
|
|
|
|
|
|
|
|
|
|
/* The remainder of this function is only useful for HPUX 10.0 and
|
|
|
|
|
later, as it depends upon the ability to request notification
|
|
|
|
|
of specific kinds of events by the kernel. */
|
|
|
|
|
#if defined(PT_SET_EVENT_MASK)
|
|
|
|
|
|
|
|
|
|
/* Notify the parent that we're potentially ready to exec(). */
|
|
|
|
|
write (startup_semaphore.child_channel[SEM_TALK],
|
1999-05-05 14:45:51 +00:00
|
|
|
|
&tc_magic_child,
|
|
|
|
|
sizeof (tc_magic_child));
|
1999-04-16 01:35:26 +00:00
|
|
|
|
|
|
|
|
|
/* Wait for acknowledgement from the parent. */
|
|
|
|
|
read (startup_semaphore.parent_channel[SEM_LISTEN],
|
1999-05-05 14:45:51 +00:00
|
|
|
|
&tc_magic_parent,
|
|
|
|
|
sizeof (tc_magic_parent));
|
1999-04-16 01:35:26 +00:00
|
|
|
|
if (tc_magic_child != tc_magic_parent)
|
1999-07-07 20:19:36 +00:00
|
|
|
|
warning ("mismatched semaphore magic");
|
1999-04-16 01:35:26 +00:00
|
|
|
|
|
|
|
|
|
/* Discard our copy of the semaphore. */
|
|
|
|
|
(void) close (startup_semaphore.parent_channel[SEM_LISTEN]);
|
|
|
|
|
(void) close (startup_semaphore.parent_channel[SEM_TALK]);
|
|
|
|
|
(void) close (startup_semaphore.child_channel[SEM_LISTEN]);
|
|
|
|
|
(void) close (startup_semaphore.child_channel[SEM_TALK]);
|
|
|
|
|
#endif
|
1999-07-07 20:19:36 +00:00
|
|
|
|
|
1999-04-16 01:35:26 +00:00
|
|
|
|
return 0;
|
|
|
|
|
}
|
|
|
|
|
#endif
|
|
|
|
|
|
|
|
|
|
int
|
2000-07-30 01:48:28 +00:00
|
|
|
|
hppa_require_attach (int pid)
|
1999-04-16 01:35:26 +00:00
|
|
|
|
{
|
|
|
|
|
int pt_status;
|
1999-05-05 14:45:51 +00:00
|
|
|
|
CORE_ADDR pc;
|
|
|
|
|
CORE_ADDR pc_addr;
|
1999-04-16 01:35:26 +00:00
|
|
|
|
unsigned int regs_offset;
|
|
|
|
|
|
|
|
|
|
/* Are we already attached? There appears to be no explicit way to
|
|
|
|
|
answer this via ptrace, so we try something which should be
|
|
|
|
|
innocuous if we are attached. If that fails, then we assume
|
|
|
|
|
we're not attached, and so attempt to make it so. */
|
|
|
|
|
|
|
|
|
|
errno = 0;
|
|
|
|
|
regs_offset = U_REGS_OFFSET;
|
|
|
|
|
pc_addr = register_addr (PC_REGNUM, regs_offset);
|
|
|
|
|
pc = call_ptrace (PT_READ_U, pid, (PTRACE_ARG3_TYPE) pc_addr, 0);
|
|
|
|
|
|
|
|
|
|
if (errno)
|
|
|
|
|
{
|
|
|
|
|
errno = 0;
|
|
|
|
|
pt_status = call_ptrace (PT_ATTACH, pid, (PTRACE_ARG3_TYPE) 0, 0);
|
|
|
|
|
|
|
|
|
|
if (errno)
|
1999-05-05 14:45:51 +00:00
|
|
|
|
return -1;
|
1999-04-16 01:35:26 +00:00
|
|
|
|
|
|
|
|
|
/* Now we really are attached. */
|
|
|
|
|
errno = 0;
|
|
|
|
|
}
|
|
|
|
|
attach_flag = 1;
|
|
|
|
|
return pid;
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
int
|
2000-07-30 01:48:28 +00:00
|
|
|
|
hppa_require_detach (int pid, int signal)
|
1999-04-16 01:35:26 +00:00
|
|
|
|
{
|
|
|
|
|
errno = 0;
|
|
|
|
|
call_ptrace (PT_DETACH, pid, (PTRACE_ARG3_TYPE) 1, signal);
|
1999-07-07 20:19:36 +00:00
|
|
|
|
errno = 0; /* Ignore any errors. */
|
1999-04-16 01:35:26 +00:00
|
|
|
|
return pid;
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
/* Since ptrace doesn't support memory page-protection events, which
|
|
|
|
|
are used to implement "hardware" watchpoints on HP-UX, these are
|
|
|
|
|
dummy versions, which perform no useful work. */
|
|
|
|
|
|
|
|
|
|
void
|
2000-07-30 01:48:28 +00:00
|
|
|
|
hppa_enable_page_protection_events (int pid)
|
1999-04-16 01:35:26 +00:00
|
|
|
|
{
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
void
|
2000-07-30 01:48:28 +00:00
|
|
|
|
hppa_disable_page_protection_events (int pid)
|
1999-04-16 01:35:26 +00:00
|
|
|
|
{
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
int
|
2000-07-30 01:48:28 +00:00
|
|
|
|
hppa_insert_hw_watchpoint (int pid, CORE_ADDR start, LONGEST len, int type)
|
1999-04-16 01:35:26 +00:00
|
|
|
|
{
|
|
|
|
|
error ("Hardware watchpoints not implemented on this platform.");
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
int
|
2003-03-29 23:29:47 +00:00
|
|
|
|
hppa_remove_hw_watchpoint (int pid, CORE_ADDR start, LONGEST len, int type)
|
1999-04-16 01:35:26 +00:00
|
|
|
|
{
|
|
|
|
|
error ("Hardware watchpoints not implemented on this platform.");
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
int
|
2003-03-29 23:29:47 +00:00
|
|
|
|
hppa_can_use_hw_watchpoint (int type, int cnt, int ot)
|
1999-04-16 01:35:26 +00:00
|
|
|
|
{
|
|
|
|
|
return 0;
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
int
|
2000-07-30 01:48:28 +00:00
|
|
|
|
hppa_range_profitable_for_hw_watchpoint (int pid, CORE_ADDR start, LONGEST len)
|
1999-04-16 01:35:26 +00:00
|
|
|
|
{
|
|
|
|
|
error ("Hardware watchpoints not implemented on this platform.");
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
char *
|
2001-05-04 04:15:33 +00:00
|
|
|
|
hppa_pid_or_tid_to_str (ptid_t id)
|
1999-04-16 01:35:26 +00:00
|
|
|
|
{
|
|
|
|
|
/* In the ptrace world, there are only processes. */
|
1999-12-22 21:45:38 +00:00
|
|
|
|
return child_pid_to_str (id);
|
1999-04-16 01:35:26 +00:00
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
void
|
2000-07-30 01:48:28 +00:00
|
|
|
|
hppa_ensure_vforking_parent_remains_stopped (int pid)
|
1999-04-16 01:35:26 +00:00
|
|
|
|
{
|
|
|
|
|
/* This assumes that the vforked parent is presently stopped, and
|
|
|
|
|
that the vforked child has just delivered its first exec event.
|
|
|
|
|
Calling kill() this way will cause the SIGTRAP to be delivered as
|
|
|
|
|
soon as the parent is resumed, which happens as soon as the
|
|
|
|
|
vforked child is resumed. See wait_for_inferior for the use of
|
|
|
|
|
this function. */
|
|
|
|
|
kill (pid, SIGTRAP);
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
int
|
2000-07-30 01:48:28 +00:00
|
|
|
|
hppa_resume_execd_vforking_child_to_get_parent_vfork (void)
|
1999-04-16 01:35:26 +00:00
|
|
|
|
{
|
1999-07-07 20:19:36 +00:00
|
|
|
|
return 1; /* Yes, the child must be resumed. */
|
1999-04-16 01:35:26 +00:00
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
void
|
2000-07-30 01:48:28 +00:00
|
|
|
|
require_notification_of_events (int pid)
|
1999-04-16 01:35:26 +00:00
|
|
|
|
{
|
|
|
|
|
#if defined(PT_SET_EVENT_MASK)
|
|
|
|
|
int pt_status;
|
|
|
|
|
ptrace_event_t ptrace_events;
|
1999-12-07 03:56:43 +00:00
|
|
|
|
int nsigs;
|
|
|
|
|
int signum;
|
1999-04-16 01:35:26 +00:00
|
|
|
|
|
|
|
|
|
/* Instruct the kernel as to the set of events we wish to be
|
|
|
|
|
informed of. (This support does not exist before HPUX 10.0.
|
|
|
|
|
We'll assume if PT_SET_EVENT_MASK has not been defined by
|
1999-05-05 14:45:51 +00:00
|
|
|
|
<sys/ptrace.h>, then we're being built on pre-10.0.) */
|
1999-04-16 01:35:26 +00:00
|
|
|
|
memset (&ptrace_events, 0, sizeof (ptrace_events));
|
|
|
|
|
|
|
|
|
|
/* Note: By default, all signals are visible to us. If we wish
|
|
|
|
|
the kernel to keep certain signals hidden from us, we do it
|
|
|
|
|
by calling sigdelset (ptrace_events.pe_signals, signal) for
|
1999-05-05 14:45:51 +00:00
|
|
|
|
each such signal here, before doing PT_SET_EVENT_MASK. */
|
1999-12-07 03:56:43 +00:00
|
|
|
|
/* RM: The above comment is no longer true. We start with ignoring
|
|
|
|
|
all signals, and then add the ones we are interested in. We could
|
|
|
|
|
do it the other way: start by looking at all signals and then
|
|
|
|
|
deleting the ones that we aren't interested in, except that
|
|
|
|
|
multiple gdb signals may be mapped to the same host signal
|
|
|
|
|
(eg. TARGET_SIGNAL_IO and TARGET_SIGNAL_POLL both get mapped to
|
|
|
|
|
signal 22 on HPUX 10.20) We want to be notified if we are
|
|
|
|
|
interested in either signal. */
|
|
|
|
|
sigfillset (&ptrace_events.pe_signals);
|
|
|
|
|
|
|
|
|
|
/* RM: Let's not bother with signals we don't care about */
|
|
|
|
|
nsigs = (int) TARGET_SIGNAL_LAST;
|
|
|
|
|
for (signum = nsigs; signum > 0; signum--)
|
|
|
|
|
{
|
|
|
|
|
if ((signal_stop_state (signum)) ||
|
|
|
|
|
(signal_print_state (signum)) ||
|
|
|
|
|
(!signal_pass_state (signum)))
|
|
|
|
|
{
|
|
|
|
|
if (target_signal_to_host_p (signum))
|
|
|
|
|
sigdelset (&ptrace_events.pe_signals,
|
|
|
|
|
target_signal_to_host (signum));
|
|
|
|
|
}
|
|
|
|
|
}
|
1999-04-16 01:35:26 +00:00
|
|
|
|
|
|
|
|
|
ptrace_events.pe_set_event = 0;
|
|
|
|
|
|
|
|
|
|
ptrace_events.pe_set_event |= PTRACE_SIGNAL;
|
|
|
|
|
ptrace_events.pe_set_event |= PTRACE_EXEC;
|
|
|
|
|
ptrace_events.pe_set_event |= PTRACE_FORK;
|
|
|
|
|
ptrace_events.pe_set_event |= PTRACE_VFORK;
|
|
|
|
|
/* ??rehrauer: Add this one when we're prepared to catch it...
|
1999-07-07 20:19:36 +00:00
|
|
|
|
ptrace_events.pe_set_event |= PTRACE_EXIT;
|
|
|
|
|
*/
|
1999-04-16 01:35:26 +00:00
|
|
|
|
|
|
|
|
|
errno = 0;
|
|
|
|
|
pt_status = call_ptrace (PT_SET_EVENT_MASK,
|
1999-07-07 20:19:36 +00:00
|
|
|
|
pid,
|
|
|
|
|
(PTRACE_ARG3_TYPE) & ptrace_events,
|
|
|
|
|
sizeof (ptrace_events));
|
1999-04-16 01:35:26 +00:00
|
|
|
|
if (errno)
|
|
|
|
|
perror_with_name ("ptrace");
|
|
|
|
|
if (pt_status < 0)
|
|
|
|
|
return;
|
|
|
|
|
#endif
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
void
|
2000-07-30 01:48:28 +00:00
|
|
|
|
require_notification_of_exec_events (int pid)
|
1999-04-16 01:35:26 +00:00
|
|
|
|
{
|
|
|
|
|
#if defined(PT_SET_EVENT_MASK)
|
|
|
|
|
int pt_status;
|
|
|
|
|
ptrace_event_t ptrace_events;
|
|
|
|
|
|
|
|
|
|
/* Instruct the kernel as to the set of events we wish to be
|
|
|
|
|
informed of. (This support does not exist before HPUX 10.0.
|
|
|
|
|
We'll assume if PT_SET_EVENT_MASK has not been defined by
|
1999-05-05 14:45:51 +00:00
|
|
|
|
<sys/ptrace.h>, then we're being built on pre-10.0.) */
|
1999-04-16 01:35:26 +00:00
|
|
|
|
memset (&ptrace_events, 0, sizeof (ptrace_events));
|
|
|
|
|
|
|
|
|
|
/* Note: By default, all signals are visible to us. If we wish
|
|
|
|
|
the kernel to keep certain signals hidden from us, we do it
|
|
|
|
|
by calling sigdelset (ptrace_events.pe_signals, signal) for
|
1999-05-05 14:45:51 +00:00
|
|
|
|
each such signal here, before doing PT_SET_EVENT_MASK. */
|
1999-04-16 01:35:26 +00:00
|
|
|
|
sigemptyset (&ptrace_events.pe_signals);
|
|
|
|
|
|
|
|
|
|
ptrace_events.pe_set_event = 0;
|
|
|
|
|
|
|
|
|
|
ptrace_events.pe_set_event |= PTRACE_EXEC;
|
|
|
|
|
/* ??rehrauer: Add this one when we're prepared to catch it...
|
1999-07-07 20:19:36 +00:00
|
|
|
|
ptrace_events.pe_set_event |= PTRACE_EXIT;
|
|
|
|
|
*/
|
1999-04-16 01:35:26 +00:00
|
|
|
|
|
|
|
|
|
errno = 0;
|
|
|
|
|
pt_status = call_ptrace (PT_SET_EVENT_MASK,
|
1999-07-07 20:19:36 +00:00
|
|
|
|
pid,
|
|
|
|
|
(PTRACE_ARG3_TYPE) & ptrace_events,
|
|
|
|
|
sizeof (ptrace_events));
|
1999-04-16 01:35:26 +00:00
|
|
|
|
if (errno)
|
|
|
|
|
perror_with_name ("ptrace");
|
|
|
|
|
if (pt_status < 0)
|
|
|
|
|
return;
|
|
|
|
|
#endif
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
/* This function is called by the parent process, with pid being the
|
|
|
|
|
ID of the child process, after the debugger has forked. */
|
|
|
|
|
|
|
|
|
|
void
|
2000-07-30 01:48:28 +00:00
|
|
|
|
child_acknowledge_created_inferior (int pid)
|
1999-04-16 01:35:26 +00:00
|
|
|
|
{
|
|
|
|
|
/* We need a memory home for a constant. */
|
|
|
|
|
int tc_magic_parent = PT_VERSION;
|
|
|
|
|
int tc_magic_child = 0;
|
|
|
|
|
|
1999-05-05 14:45:51 +00:00
|
|
|
|
/* The remainder of this function is only useful for HPUX 10.0 and
|
|
|
|
|
later, as it depends upon the ability to request notification
|
|
|
|
|
of specific kinds of events by the kernel. */
|
|
|
|
|
#if defined(PT_SET_EVENT_MASK)
|
1999-04-16 01:35:26 +00:00
|
|
|
|
/* Wait for the child to tell us that it has forked. */
|
|
|
|
|
read (startup_semaphore.child_channel[SEM_LISTEN],
|
1999-05-05 14:45:51 +00:00
|
|
|
|
&tc_magic_child,
|
1999-07-07 20:19:36 +00:00
|
|
|
|
sizeof (tc_magic_child));
|
1999-04-16 01:35:26 +00:00
|
|
|
|
|
|
|
|
|
/* Notify the child that it can exec.
|
|
|
|
|
|
|
|
|
|
In the infttrace.c variant of this function, we set the child's
|
|
|
|
|
event mask after the fork but before the exec. In the ptrace
|
|
|
|
|
world, it seems we can't set the event mask until after the exec. */
|
|
|
|
|
write (startup_semaphore.parent_channel[SEM_TALK],
|
1999-05-05 14:45:51 +00:00
|
|
|
|
&tc_magic_parent,
|
|
|
|
|
sizeof (tc_magic_parent));
|
1999-04-16 01:35:26 +00:00
|
|
|
|
|
|
|
|
|
/* We'd better pause a bit before trying to set the event mask,
|
|
|
|
|
though, to ensure that the exec has happened. We don't want to
|
|
|
|
|
wait() on the child, because that'll screw up the upper layers
|
|
|
|
|
of gdb's execution control that expect to see the exec event.
|
|
|
|
|
|
|
|
|
|
After an exec, the child is no longer executing gdb code. Hence,
|
|
|
|
|
we can't have yet another synchronization via the pipes. We'll
|
|
|
|
|
just sleep for a second, and hope that's enough delay... */
|
|
|
|
|
sleep (1);
|
|
|
|
|
|
|
|
|
|
/* Instruct the kernel as to the set of events we wish to be
|
|
|
|
|
informed of. */
|
|
|
|
|
require_notification_of_exec_events (pid);
|
|
|
|
|
|
|
|
|
|
/* Discard our copy of the semaphore. */
|
|
|
|
|
(void) close (startup_semaphore.parent_channel[SEM_LISTEN]);
|
|
|
|
|
(void) close (startup_semaphore.parent_channel[SEM_TALK]);
|
|
|
|
|
(void) close (startup_semaphore.child_channel[SEM_LISTEN]);
|
|
|
|
|
(void) close (startup_semaphore.child_channel[SEM_TALK]);
|
1999-05-05 14:45:51 +00:00
|
|
|
|
#endif
|
1999-04-16 01:35:26 +00:00
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
void
|
2001-05-04 04:15:33 +00:00
|
|
|
|
child_post_startup_inferior (ptid_t ptid)
|
1999-04-16 01:35:26 +00:00
|
|
|
|
{
|
2001-05-04 04:15:33 +00:00
|
|
|
|
require_notification_of_events (PIDGET (ptid));
|
1999-04-16 01:35:26 +00:00
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
void
|
2000-07-30 01:48:28 +00:00
|
|
|
|
child_post_attach (int pid)
|
1999-04-16 01:35:26 +00:00
|
|
|
|
{
|
|
|
|
|
require_notification_of_events (pid);
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
int
|
2000-07-30 01:48:28 +00:00
|
|
|
|
child_insert_fork_catchpoint (int pid)
|
1999-04-16 01:35:26 +00:00
|
|
|
|
{
|
|
|
|
|
/* This request is only available on HPUX 10.0 and later. */
|
|
|
|
|
#if !defined(PT_SET_EVENT_MASK)
|
|
|
|
|
error ("Unable to catch forks prior to HPUX 10.0");
|
|
|
|
|
#else
|
|
|
|
|
/* Enable reporting of fork events from the kernel. */
|
|
|
|
|
/* ??rehrauer: For the moment, we're always enabling these events,
|
1999-05-05 14:45:51 +00:00
|
|
|
|
and just ignoring them if there's no catchpoint to catch them. */
|
1999-04-16 01:35:26 +00:00
|
|
|
|
return 0;
|
|
|
|
|
#endif
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
int
|
2000-07-30 01:48:28 +00:00
|
|
|
|
child_remove_fork_catchpoint (int pid)
|
1999-04-16 01:35:26 +00:00
|
|
|
|
{
|
|
|
|
|
/* This request is only available on HPUX 10.0 and later. */
|
|
|
|
|
#if !defined(PT_SET_EVENT_MASK)
|
|
|
|
|
error ("Unable to catch forks prior to HPUX 10.0");
|
|
|
|
|
#else
|
|
|
|
|
/* Disable reporting of fork events from the kernel. */
|
|
|
|
|
/* ??rehrauer: For the moment, we're always enabling these events,
|
|
|
|
|
and just ignoring them if there's no catchpoint to catch them. */
|
|
|
|
|
return 0;
|
|
|
|
|
#endif
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
int
|
2000-07-30 01:48:28 +00:00
|
|
|
|
child_insert_vfork_catchpoint (int pid)
|
1999-04-16 01:35:26 +00:00
|
|
|
|
{
|
|
|
|
|
/* This request is only available on HPUX 10.0 and later. */
|
|
|
|
|
#if !defined(PT_SET_EVENT_MASK)
|
|
|
|
|
error ("Unable to catch vforks prior to HPUX 10.0");
|
|
|
|
|
#else
|
|
|
|
|
/* Enable reporting of vfork events from the kernel. */
|
|
|
|
|
/* ??rehrauer: For the moment, we're always enabling these events,
|
|
|
|
|
and just ignoring them if there's no catchpoint to catch them. */
|
|
|
|
|
return 0;
|
|
|
|
|
#endif
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
int
|
2000-07-30 01:48:28 +00:00
|
|
|
|
child_remove_vfork_catchpoint (int pid)
|
1999-04-16 01:35:26 +00:00
|
|
|
|
{
|
|
|
|
|
/* This request is only available on HPUX 10.0 and later. */
|
|
|
|
|
#if !defined(PT_SET_EVENT_MASK)
|
|
|
|
|
error ("Unable to catch vforks prior to HPUX 10.0");
|
|
|
|
|
#else
|
|
|
|
|
/* Disable reporting of vfork events from the kernel. */
|
|
|
|
|
/* ??rehrauer: For the moment, we're always enabling these events,
|
|
|
|
|
and just ignoring them if there's no catchpoint to catch them. */
|
|
|
|
|
return 0;
|
|
|
|
|
#endif
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
int
|
* breakpoint.c (bpstat_stop_status): Call inferior_has_forked,
inferior_has_vforked, and inferior_has_execd instead of
target_has_forked, target_has_vforked, and target_has_execd.
* config/pa/nm-hppah.h (CHILD_HAS_FORKED, CHILD_HAS_VFORKED)
(CHILD_HAS_EXECD, CHILD_HAS_SYSCALL_EVENT): Don't define.
(CHILD_WAIT): Define.
(child_wait): Add prototype.
* hppah-nat.c (hpux_has_forked): Rename from child_has_forked.
Add prototype.
(hpux_has_vforked): Likewise, from child_has_vforked.
(hpux_has_execd): Likewise, from child_has_execd.
(hpux_has_syscall_event): Likewise, from child_has_syscall_event.
(not_same_real_pid, child_wait): New, copied from inftarg.c.
Call hpux_has_forked, hpux_has_vforked, hpux_has_execd,
and hpux_has_syscall_event instead of the target hooks.
* infrun.c (inferior_has_forked, inferior_has_vforked)
(inferior_has_execd): New functions.
* inftarg.c (not_same_real_pid): Remove.
(child_wait): Remove references to not_same_real_pid,
target_has_forked, target_has_vforked, target_has_execd,
and target_has_syscall_event.
(child_has_forked, child_has_vforked, child_has_execd)
(child_has_syscall_event): Remove.
(init_child_ops): Remove references to child_has_forked,
child_has_vforked, child_has_execd, and child_has_syscall_event.
* infttrace.c (hpux_has_forked): Rename from child_has_forked.
(hpux_has_vforked): Likewise, from child_has_vforked.
(hpux_has_execd): Likewise, from child_has_execd.
(hpux_has_syscall_event): Likewise, from child_has_syscall_event.
* target.c (cleanup_target): Remove references to
to_has_forked, to_has_vforked, to_has_execd, and
to_has_syscall_event.
(update_current_target): Likewise.
(setup_target_debug): Likewise.
(debug_to_has_forked): Remove.
(debug_to_has_vforked): Remove.
(debug_to_has_execd): Remove.
(debug_to_has_syscall_event): Remove.
* target.h (struct target_ops): Remove to_has_forked.
to_has_vforked, to_has_execd, and to_has_syscall_event.
(child_has_forked, child_has_vforked, child_has_execd)
(child_has_syscall_event): Remove prototypes.
(inferior_has_forked, inferior_has_vforked, inferior_has_execd): Add
prototypes.
(target_has_forked, target_has_vforked, target_has_execd)
(target_has_syscall_event): Remove macros.
2002-11-16 19:22:59 +00:00
|
|
|
|
hpux_has_forked (int pid, int *childpid)
|
1999-04-16 01:35:26 +00:00
|
|
|
|
{
|
|
|
|
|
/* This request is only available on HPUX 10.0 and later. */
|
|
|
|
|
#if !defined(PT_GET_PROCESS_STATE)
|
|
|
|
|
*childpid = 0;
|
|
|
|
|
return 0;
|
|
|
|
|
#else
|
|
|
|
|
int pt_status;
|
1999-07-07 20:19:36 +00:00
|
|
|
|
ptrace_state_t ptrace_state;
|
1999-04-16 01:35:26 +00:00
|
|
|
|
|
|
|
|
|
errno = 0;
|
|
|
|
|
pt_status = call_ptrace (PT_GET_PROCESS_STATE,
|
1999-05-05 14:45:51 +00:00
|
|
|
|
pid,
|
1999-07-07 20:19:36 +00:00
|
|
|
|
(PTRACE_ARG3_TYPE) & ptrace_state,
|
1999-05-05 14:45:51 +00:00
|
|
|
|
sizeof (ptrace_state));
|
1999-04-16 01:35:26 +00:00
|
|
|
|
if (errno)
|
|
|
|
|
perror_with_name ("ptrace");
|
|
|
|
|
if (pt_status < 0)
|
|
|
|
|
return 0;
|
|
|
|
|
|
|
|
|
|
if (ptrace_state.pe_report_event & PTRACE_FORK)
|
|
|
|
|
{
|
|
|
|
|
*childpid = ptrace_state.pe_other_pid;
|
|
|
|
|
return 1;
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
return 0;
|
|
|
|
|
#endif
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
int
|
* breakpoint.c (bpstat_stop_status): Call inferior_has_forked,
inferior_has_vforked, and inferior_has_execd instead of
target_has_forked, target_has_vforked, and target_has_execd.
* config/pa/nm-hppah.h (CHILD_HAS_FORKED, CHILD_HAS_VFORKED)
(CHILD_HAS_EXECD, CHILD_HAS_SYSCALL_EVENT): Don't define.
(CHILD_WAIT): Define.
(child_wait): Add prototype.
* hppah-nat.c (hpux_has_forked): Rename from child_has_forked.
Add prototype.
(hpux_has_vforked): Likewise, from child_has_vforked.
(hpux_has_execd): Likewise, from child_has_execd.
(hpux_has_syscall_event): Likewise, from child_has_syscall_event.
(not_same_real_pid, child_wait): New, copied from inftarg.c.
Call hpux_has_forked, hpux_has_vforked, hpux_has_execd,
and hpux_has_syscall_event instead of the target hooks.
* infrun.c (inferior_has_forked, inferior_has_vforked)
(inferior_has_execd): New functions.
* inftarg.c (not_same_real_pid): Remove.
(child_wait): Remove references to not_same_real_pid,
target_has_forked, target_has_vforked, target_has_execd,
and target_has_syscall_event.
(child_has_forked, child_has_vforked, child_has_execd)
(child_has_syscall_event): Remove.
(init_child_ops): Remove references to child_has_forked,
child_has_vforked, child_has_execd, and child_has_syscall_event.
* infttrace.c (hpux_has_forked): Rename from child_has_forked.
(hpux_has_vforked): Likewise, from child_has_vforked.
(hpux_has_execd): Likewise, from child_has_execd.
(hpux_has_syscall_event): Likewise, from child_has_syscall_event.
* target.c (cleanup_target): Remove references to
to_has_forked, to_has_vforked, to_has_execd, and
to_has_syscall_event.
(update_current_target): Likewise.
(setup_target_debug): Likewise.
(debug_to_has_forked): Remove.
(debug_to_has_vforked): Remove.
(debug_to_has_execd): Remove.
(debug_to_has_syscall_event): Remove.
* target.h (struct target_ops): Remove to_has_forked.
to_has_vforked, to_has_execd, and to_has_syscall_event.
(child_has_forked, child_has_vforked, child_has_execd)
(child_has_syscall_event): Remove prototypes.
(inferior_has_forked, inferior_has_vforked, inferior_has_execd): Add
prototypes.
(target_has_forked, target_has_vforked, target_has_execd)
(target_has_syscall_event): Remove macros.
2002-11-16 19:22:59 +00:00
|
|
|
|
hpux_has_vforked (int pid, int *childpid)
|
1999-04-16 01:35:26 +00:00
|
|
|
|
{
|
|
|
|
|
/* This request is only available on HPUX 10.0 and later. */
|
|
|
|
|
#if !defined(PT_GET_PROCESS_STATE)
|
|
|
|
|
*childpid = 0;
|
|
|
|
|
return 0;
|
|
|
|
|
|
|
|
|
|
#else
|
|
|
|
|
int pt_status;
|
1999-07-07 20:19:36 +00:00
|
|
|
|
ptrace_state_t ptrace_state;
|
1999-04-16 01:35:26 +00:00
|
|
|
|
|
|
|
|
|
errno = 0;
|
|
|
|
|
pt_status = call_ptrace (PT_GET_PROCESS_STATE,
|
1999-05-05 14:45:51 +00:00
|
|
|
|
pid,
|
1999-07-07 20:19:36 +00:00
|
|
|
|
(PTRACE_ARG3_TYPE) & ptrace_state,
|
1999-05-05 14:45:51 +00:00
|
|
|
|
sizeof (ptrace_state));
|
1999-04-16 01:35:26 +00:00
|
|
|
|
if (errno)
|
|
|
|
|
perror_with_name ("ptrace");
|
|
|
|
|
if (pt_status < 0)
|
|
|
|
|
return 0;
|
|
|
|
|
|
|
|
|
|
if (ptrace_state.pe_report_event & PTRACE_VFORK)
|
|
|
|
|
{
|
|
|
|
|
*childpid = ptrace_state.pe_other_pid;
|
|
|
|
|
return 1;
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
return 0;
|
|
|
|
|
#endif
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
int
|
2000-07-30 01:48:28 +00:00
|
|
|
|
child_insert_exec_catchpoint (int pid)
|
1999-04-16 01:35:26 +00:00
|
|
|
|
{
|
1999-05-05 14:45:51 +00:00
|
|
|
|
/* This request is only available on HPUX 10.0 and later. */
|
1999-04-16 01:35:26 +00:00
|
|
|
|
#if !defined(PT_SET_EVENT_MASK)
|
|
|
|
|
error ("Unable to catch execs prior to HPUX 10.0");
|
|
|
|
|
|
|
|
|
|
#else
|
1999-05-05 14:45:51 +00:00
|
|
|
|
/* Enable reporting of exec events from the kernel. */
|
1999-04-16 01:35:26 +00:00
|
|
|
|
/* ??rehrauer: For the moment, we're always enabling these events,
|
1999-05-05 14:45:51 +00:00
|
|
|
|
and just ignoring them if there's no catchpoint to catch them. */
|
1999-04-16 01:35:26 +00:00
|
|
|
|
return 0;
|
|
|
|
|
#endif
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
int
|
2000-07-30 01:48:28 +00:00
|
|
|
|
child_remove_exec_catchpoint (int pid)
|
1999-04-16 01:35:26 +00:00
|
|
|
|
{
|
1999-05-05 14:45:51 +00:00
|
|
|
|
/* This request is only available on HPUX 10.0 and later. */
|
1999-04-16 01:35:26 +00:00
|
|
|
|
#if !defined(PT_SET_EVENT_MASK)
|
|
|
|
|
error ("Unable to catch execs prior to HPUX 10.0");
|
|
|
|
|
|
|
|
|
|
#else
|
|
|
|
|
/* Disable reporting of exec events from the kernel. */
|
|
|
|
|
/* ??rehrauer: For the moment, we're always enabling these events,
|
1999-05-05 14:45:51 +00:00
|
|
|
|
and just ignoring them if there's no catchpoint to catch them. */
|
1999-04-16 01:35:26 +00:00
|
|
|
|
return 0;
|
|
|
|
|
#endif
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
int
|
* breakpoint.c (bpstat_stop_status): Call inferior_has_forked,
inferior_has_vforked, and inferior_has_execd instead of
target_has_forked, target_has_vforked, and target_has_execd.
* config/pa/nm-hppah.h (CHILD_HAS_FORKED, CHILD_HAS_VFORKED)
(CHILD_HAS_EXECD, CHILD_HAS_SYSCALL_EVENT): Don't define.
(CHILD_WAIT): Define.
(child_wait): Add prototype.
* hppah-nat.c (hpux_has_forked): Rename from child_has_forked.
Add prototype.
(hpux_has_vforked): Likewise, from child_has_vforked.
(hpux_has_execd): Likewise, from child_has_execd.
(hpux_has_syscall_event): Likewise, from child_has_syscall_event.
(not_same_real_pid, child_wait): New, copied from inftarg.c.
Call hpux_has_forked, hpux_has_vforked, hpux_has_execd,
and hpux_has_syscall_event instead of the target hooks.
* infrun.c (inferior_has_forked, inferior_has_vforked)
(inferior_has_execd): New functions.
* inftarg.c (not_same_real_pid): Remove.
(child_wait): Remove references to not_same_real_pid,
target_has_forked, target_has_vforked, target_has_execd,
and target_has_syscall_event.
(child_has_forked, child_has_vforked, child_has_execd)
(child_has_syscall_event): Remove.
(init_child_ops): Remove references to child_has_forked,
child_has_vforked, child_has_execd, and child_has_syscall_event.
* infttrace.c (hpux_has_forked): Rename from child_has_forked.
(hpux_has_vforked): Likewise, from child_has_vforked.
(hpux_has_execd): Likewise, from child_has_execd.
(hpux_has_syscall_event): Likewise, from child_has_syscall_event.
* target.c (cleanup_target): Remove references to
to_has_forked, to_has_vforked, to_has_execd, and
to_has_syscall_event.
(update_current_target): Likewise.
(setup_target_debug): Likewise.
(debug_to_has_forked): Remove.
(debug_to_has_vforked): Remove.
(debug_to_has_execd): Remove.
(debug_to_has_syscall_event): Remove.
* target.h (struct target_ops): Remove to_has_forked.
to_has_vforked, to_has_execd, and to_has_syscall_event.
(child_has_forked, child_has_vforked, child_has_execd)
(child_has_syscall_event): Remove prototypes.
(inferior_has_forked, inferior_has_vforked, inferior_has_execd): Add
prototypes.
(target_has_forked, target_has_vforked, target_has_execd)
(target_has_syscall_event): Remove macros.
2002-11-16 19:22:59 +00:00
|
|
|
|
hpux_has_execd (int pid, char **execd_pathname)
|
1999-04-16 01:35:26 +00:00
|
|
|
|
{
|
1999-05-05 14:45:51 +00:00
|
|
|
|
/* This request is only available on HPUX 10.0 and later. */
|
1999-04-16 01:35:26 +00:00
|
|
|
|
#if !defined(PT_GET_PROCESS_STATE)
|
|
|
|
|
*execd_pathname = NULL;
|
|
|
|
|
return 0;
|
|
|
|
|
|
|
|
|
|
#else
|
|
|
|
|
int pt_status;
|
1999-07-07 20:19:36 +00:00
|
|
|
|
ptrace_state_t ptrace_state;
|
1999-04-16 01:35:26 +00:00
|
|
|
|
|
|
|
|
|
errno = 0;
|
|
|
|
|
pt_status = call_ptrace (PT_GET_PROCESS_STATE,
|
1999-05-05 14:45:51 +00:00
|
|
|
|
pid,
|
1999-07-07 20:19:36 +00:00
|
|
|
|
(PTRACE_ARG3_TYPE) & ptrace_state,
|
1999-05-05 14:45:51 +00:00
|
|
|
|
sizeof (ptrace_state));
|
1999-04-16 01:35:26 +00:00
|
|
|
|
if (errno)
|
|
|
|
|
perror_with_name ("ptrace");
|
|
|
|
|
if (pt_status < 0)
|
|
|
|
|
return 0;
|
|
|
|
|
|
|
|
|
|
if (ptrace_state.pe_report_event & PTRACE_EXEC)
|
|
|
|
|
{
|
1999-07-07 20:19:36 +00:00
|
|
|
|
char *exec_file = target_pid_to_exec_file (pid);
|
1999-04-16 01:35:26 +00:00
|
|
|
|
*execd_pathname = savestring (exec_file, strlen (exec_file));
|
|
|
|
|
return 1;
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
return 0;
|
|
|
|
|
#endif
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
int
|
2000-07-30 01:48:28 +00:00
|
|
|
|
child_reported_exec_events_per_exec_call (void)
|
1999-04-16 01:35:26 +00:00
|
|
|
|
{
|
1999-07-07 20:19:36 +00:00
|
|
|
|
return 2; /* ptrace reports the event twice per call. */
|
1999-04-16 01:35:26 +00:00
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
int
|
* breakpoint.c (bpstat_stop_status): Call inferior_has_forked,
inferior_has_vforked, and inferior_has_execd instead of
target_has_forked, target_has_vforked, and target_has_execd.
* config/pa/nm-hppah.h (CHILD_HAS_FORKED, CHILD_HAS_VFORKED)
(CHILD_HAS_EXECD, CHILD_HAS_SYSCALL_EVENT): Don't define.
(CHILD_WAIT): Define.
(child_wait): Add prototype.
* hppah-nat.c (hpux_has_forked): Rename from child_has_forked.
Add prototype.
(hpux_has_vforked): Likewise, from child_has_vforked.
(hpux_has_execd): Likewise, from child_has_execd.
(hpux_has_syscall_event): Likewise, from child_has_syscall_event.
(not_same_real_pid, child_wait): New, copied from inftarg.c.
Call hpux_has_forked, hpux_has_vforked, hpux_has_execd,
and hpux_has_syscall_event instead of the target hooks.
* infrun.c (inferior_has_forked, inferior_has_vforked)
(inferior_has_execd): New functions.
* inftarg.c (not_same_real_pid): Remove.
(child_wait): Remove references to not_same_real_pid,
target_has_forked, target_has_vforked, target_has_execd,
and target_has_syscall_event.
(child_has_forked, child_has_vforked, child_has_execd)
(child_has_syscall_event): Remove.
(init_child_ops): Remove references to child_has_forked,
child_has_vforked, child_has_execd, and child_has_syscall_event.
* infttrace.c (hpux_has_forked): Rename from child_has_forked.
(hpux_has_vforked): Likewise, from child_has_vforked.
(hpux_has_execd): Likewise, from child_has_execd.
(hpux_has_syscall_event): Likewise, from child_has_syscall_event.
* target.c (cleanup_target): Remove references to
to_has_forked, to_has_vforked, to_has_execd, and
to_has_syscall_event.
(update_current_target): Likewise.
(setup_target_debug): Likewise.
(debug_to_has_forked): Remove.
(debug_to_has_vforked): Remove.
(debug_to_has_execd): Remove.
(debug_to_has_syscall_event): Remove.
* target.h (struct target_ops): Remove to_has_forked.
to_has_vforked, to_has_execd, and to_has_syscall_event.
(child_has_forked, child_has_vforked, child_has_execd)
(child_has_syscall_event): Remove prototypes.
(inferior_has_forked, inferior_has_vforked, inferior_has_execd): Add
prototypes.
(target_has_forked, target_has_vforked, target_has_execd)
(target_has_syscall_event): Remove macros.
2002-11-16 19:22:59 +00:00
|
|
|
|
hpux_has_syscall_event (int pid, enum target_waitkind *kind, int *syscall_id)
|
1999-04-16 01:35:26 +00:00
|
|
|
|
{
|
|
|
|
|
/* This request is only available on HPUX 10.30 and later, via
|
|
|
|
|
the ttrace interface. */
|
|
|
|
|
|
|
|
|
|
*kind = TARGET_WAITKIND_SPURIOUS;
|
|
|
|
|
*syscall_id = -1;
|
|
|
|
|
return 0;
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
char *
|
2000-07-30 01:48:28 +00:00
|
|
|
|
child_pid_to_exec_file (int pid)
|
1999-04-16 01:35:26 +00:00
|
|
|
|
{
|
1999-05-05 14:45:51 +00:00
|
|
|
|
static char exec_file_buffer[1024];
|
1999-04-16 01:35:26 +00:00
|
|
|
|
int pt_status;
|
1999-05-05 14:45:51 +00:00
|
|
|
|
CORE_ADDR top_of_stack;
|
|
|
|
|
char four_chars[4];
|
1999-04-16 01:35:26 +00:00
|
|
|
|
int name_index;
|
|
|
|
|
int i;
|
2001-05-04 04:15:33 +00:00
|
|
|
|
ptid_t saved_inferior_ptid;
|
2003-01-29 15:56:11 +00:00
|
|
|
|
int done;
|
1999-07-07 20:19:36 +00:00
|
|
|
|
|
1999-04-16 01:35:26 +00:00
|
|
|
|
#ifdef PT_GET_PROCESS_PATHNAME
|
|
|
|
|
/* As of 10.x HP-UX, there's an explicit request to get the pathname. */
|
|
|
|
|
pt_status = call_ptrace (PT_GET_PROCESS_PATHNAME,
|
1999-05-05 14:45:51 +00:00
|
|
|
|
pid,
|
|
|
|
|
(PTRACE_ARG3_TYPE) exec_file_buffer,
|
|
|
|
|
sizeof (exec_file_buffer) - 1);
|
1999-04-16 01:35:26 +00:00
|
|
|
|
if (pt_status == 0)
|
|
|
|
|
return exec_file_buffer;
|
|
|
|
|
#endif
|
|
|
|
|
|
|
|
|
|
/* It appears that this request is broken prior to 10.30.
|
|
|
|
|
If it fails, try a really, truly amazingly gross hack
|
|
|
|
|
that DDE uses, of pawing through the process' data
|
|
|
|
|
segment to find the pathname. */
|
|
|
|
|
|
|
|
|
|
top_of_stack = 0x7b03a000;
|
|
|
|
|
name_index = 0;
|
|
|
|
|
done = 0;
|
|
|
|
|
|
2001-05-04 04:15:33 +00:00
|
|
|
|
/* On the chance that pid != inferior_ptid, set inferior_ptid
|
|
|
|
|
to pid, so that (grrrr!) implicit uses of inferior_ptid get
|
1999-04-16 01:35:26 +00:00
|
|
|
|
the right id. */
|
|
|
|
|
|
2001-05-04 04:15:33 +00:00
|
|
|
|
saved_inferior_ptid = inferior_ptid;
|
|
|
|
|
inferior_ptid = pid_to_ptid (pid);
|
1999-04-16 01:35:26 +00:00
|
|
|
|
|
|
|
|
|
/* Try to grab a null-terminated string. */
|
1999-07-07 20:19:36 +00:00
|
|
|
|
while (!done)
|
1999-04-16 01:35:26 +00:00
|
|
|
|
{
|
|
|
|
|
if (target_read_memory (top_of_stack, four_chars, 4) != 0)
|
|
|
|
|
{
|
2001-05-04 04:15:33 +00:00
|
|
|
|
inferior_ptid = saved_inferior_ptid;
|
1999-04-16 01:35:26 +00:00
|
|
|
|
return NULL;
|
|
|
|
|
}
|
|
|
|
|
for (i = 0; i < 4; i++)
|
|
|
|
|
{
|
|
|
|
|
exec_file_buffer[name_index++] = four_chars[i];
|
|
|
|
|
done = (four_chars[i] == '\0');
|
|
|
|
|
if (done)
|
|
|
|
|
break;
|
|
|
|
|
}
|
|
|
|
|
top_of_stack += 4;
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
if (exec_file_buffer[0] == '\0')
|
|
|
|
|
{
|
2001-05-04 04:15:33 +00:00
|
|
|
|
inferior_ptid = saved_inferior_ptid;
|
1999-04-16 01:35:26 +00:00
|
|
|
|
return NULL;
|
|
|
|
|
}
|
|
|
|
|
|
2001-05-04 04:15:33 +00:00
|
|
|
|
inferior_ptid = saved_inferior_ptid;
|
1999-04-16 01:35:26 +00:00
|
|
|
|
return exec_file_buffer;
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
void
|
2000-07-30 01:48:28 +00:00
|
|
|
|
pre_fork_inferior (void)
|
1999-04-16 01:35:26 +00:00
|
|
|
|
{
|
|
|
|
|
int status;
|
|
|
|
|
|
|
|
|
|
status = pipe (startup_semaphore.parent_channel);
|
|
|
|
|
if (status < 0)
|
|
|
|
|
{
|
|
|
|
|
warning ("error getting parent pipe for startup semaphore");
|
|
|
|
|
return;
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
status = pipe (startup_semaphore.child_channel);
|
|
|
|
|
if (status < 0)
|
|
|
|
|
{
|
|
|
|
|
warning ("error getting child pipe for startup semaphore");
|
|
|
|
|
return;
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
|
1999-07-07 20:19:36 +00:00
|
|
|
|
|
1999-04-16 01:35:26 +00:00
|
|
|
|
/* Check to see if the given thread is alive.
|
|
|
|
|
|
|
|
|
|
This is a no-op, as ptrace doesn't support threads, so we just
|
|
|
|
|
return "TRUE". */
|
|
|
|
|
|
|
|
|
|
int
|
2001-05-04 04:15:33 +00:00
|
|
|
|
child_thread_alive (ptid_t ptid)
|
1999-04-16 01:35:26 +00:00
|
|
|
|
{
|
1999-07-07 20:19:36 +00:00
|
|
|
|
return 1;
|
1999-04-16 01:35:26 +00:00
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
#endif /* ! GDB_NATIVE_HPUX_11 */
|