#include "defs.h"
#include "inferior.h"
+#include "infrun.h"
#include "target.h"
#include "gdbcore.h"
#include "elf-bfd.h" /* for elfcore_write_* */
#ifdef HAVE_SYS_SYSCALL_H
#include <sys/syscall.h>
#endif
-#include <sys/errno.h>
#include "gdb_wait.h"
#include <signal.h>
#include <ctype.h>
#include "gdb_bfd.h"
-#include <string.h>
-#include "gdb_assert.h"
#include "inflow.h"
#include "auxv.h"
#include "procfs.h"
/* This module defines the GDB target vector and its methods. */
-static void procfs_attach (struct target_ops *, char *, int);
+static void procfs_attach (struct target_ops *, const char *, int);
static void procfs_detach (struct target_ops *, const char *, int);
static void procfs_resume (struct target_ops *,
ptid_t, int, enum gdb_signal);
static int procfs_can_use_hw_breakpoint (struct target_ops *self,
int, int, int);
-static void procfs_info_proc (struct target_ops *, char *,
+static void procfs_info_proc (struct target_ops *, const char *,
enum info_proc_what);
#if defined (PR_MODEL_NATIVE) && (PR_MODEL_NATIVE == PR_MODEL_LP64)
static void proc_trace_syscalls_1 (procinfo *pi, int syscallnum,
int entry_or_exit, int mode, int from_tty);
-/* On mips-irix, we need to insert a breakpoint at __dbx_link during
- the startup phase. The following two variables are used to record
- the address of the breakpoint, and the code that was replaced by
- a breakpoint. */
-static int dbx_link_bpt_addr = 0;
-static void *dbx_link_bpt;
-
/* Sets up the inferior to be debugged. Registers to trace signals,
hardware faults, and syscalls. Note: does not set RLC flag: caller
may want to customize that. Returns zero for success (note!
}
static void
-procfs_attach (struct target_ops *ops, char *args, int from_tty)
+procfs_attach (struct target_ops *ops, const char *args, int from_tty)
{
char *exec_file;
int pid;
fflush (stdout);
}
inferior_ptid = do_attach (pid_to_ptid (pid));
- push_target (ops);
+ if (!target_is_pushed (ops))
+ push_target (ops);
}
static void
inferior_ptid = null_ptid;
detach_inferior (pid);
- unpush_target (ops);
+ inf_child_maybe_unpush_target (ops);
}
static ptid_t
return 0;
}
-/* Remove the breakpoint that we inserted in __dbx_link().
- Does nothing if the breakpoint hasn't been inserted or has already
- been removed. */
-
-static void
-remove_dbx_link_breakpoint (void)
-{
- if (dbx_link_bpt_addr == 0)
- return;
-
- if (deprecated_remove_raw_breakpoint (target_gdbarch (), dbx_link_bpt) != 0)
- warning (_("Unable to remove __dbx_link breakpoint."));
-
- dbx_link_bpt_addr = 0;
- dbx_link_bpt = NULL;
-}
-
#ifdef SYS_syssgi
/* Return the address of the __dbx_link() function in the file
refernced by ABFD by scanning its symbol table. Return 0 if
sym_addr = dbx_link_addr (abfd);
if (sym_addr != 0)
{
+ struct breakpoint *dbx_link_bpt;
+
/* Insert the breakpoint. */
- dbx_link_bpt_addr = sym_addr;
- dbx_link_bpt = deprecated_insert_raw_breakpoint (target_gdbarch (), NULL,
- sym_addr);
+ dbx_link_bpt
+ = create_and_insert_solib_event_breakpoint (target_gdbarch (),
+ sym_addr);
if (dbx_link_bpt == NULL)
{
warning (_("Failed to insert dbx_link breakpoint."));
#if (FLTTRACE != FLTBPT) /* Avoid "duplicate case" error. */
case FLTTRACE:
#endif
- /* If we hit our __dbx_link() internal breakpoint,
- then remove it. See comments in procfs_init_inferior()
- for more details. */
- if (dbx_link_bpt_addr != 0
- && dbx_link_bpt_addr
- == regcache_read_pc (get_current_regcache ()))
- remove_dbx_link_breakpoint ();
-
wstat = (SIGTRAP << 8) | 0177;
break;
case FLTSTACK:
#endif
default:
- if (ops->beneath != NULL)
- return ops->beneath->to_xfer_partial (ops->beneath, object, annex,
- readbuf, writebuf, offset, len,
- xfered_len);
- return TARGET_XFER_E_IO;
+ return ops->beneath->to_xfer_partial (ops->beneath, object, annex,
+ readbuf, writebuf, offset, len,
+ xfered_len);
}
}
if (pi)
destroy_procinfo (pi);
}
- unpush_target (ops);
-
- if (dbx_link_bpt != NULL)
- {
- deprecated_remove_raw_breakpoint (target_gdbarch (), dbx_link_bpt);
- dbx_link_bpt_addr = 0;
- dbx_link_bpt = NULL;
- }
generic_mourn_inferior ();
+
+ inf_child_maybe_unpush_target (ops);
}
/* When GDB forks to create a runnable inferior process, this function
/* This routine called on the parent side (GDB side)
after GDB forks the inferior. */
- push_target (ops);
+ if (!target_is_pushed (ops))
+ push_target (ops);
if ((pi = create_procinfo (pid, 0)) == NULL)
perror (_("procfs: out of memory in 'init_inferior'"));
/* Implement the "info proc" command. */
static void
-procfs_info_proc (struct target_ops *ops, char *args,
+procfs_info_proc (struct target_ops *ops, const char *args,
enum info_proc_what what)
{
struct cleanup *old_chain;
/* This part is the old method for fetching registers.
It should be replaced by the newer one using regsets
once it is implemented in this platform:
- gdbarch_regset_from_core_section() and regset->collect_regset(). */
+ gdbarch_iterate_over_regset_sections(). */
old_chain = save_inferior_ptid ();
inferior_ptid = ptid;
xfree (auxv);
}
- make_cleanup (xfree, note_data);
return note_data;
}
#else /* !Solaris */