/* Machine independent support for SVR4 /proc (process file system) for GDB.
- Copyright (C) 1999, 2000, 2001, 2002, 2003, 2006, 2007, 2008, 2009, 2010
- Free Software Foundation, Inc.
+ Copyright (C) 1999, 2000, 2001, 2002, 2003, 2006, 2007, 2008, 2009, 2010,
+ 2011 Free Software Foundation, Inc.
Written by Michael Snyder at Cygnus Solutions.
Based on work by Fred Fish, Stu Grossman, Geoff Noer, and others.
static LONGEST procfs_xfer_partial (struct target_ops *ops,
enum target_object object,
const char *annex,
- gdb_byte *readbuf, const gdb_byte *writebuf,
+ gdb_byte *readbuf,
+ const gdb_byte *writebuf,
ULONGEST offset, LONGEST len);
static int procfs_thread_alive (struct target_ops *ops, ptid_t);
static int find_syscall (procinfo *pi, char *name);
#endif /* DYNAMIC_SYSCALLS */
-/* A function type used as a callback back iterate_over_mappings. */
-typedef int (iterate_over_mappings_cb_ftype)
- (CORE_ADDR vaddr, unsigned long size, int read, int write, int execute,
- void *data);
-
static int iterate_over_mappings
- (procinfo *pi,
- iterate_over_mappings_cb_ftype *child_func,
- void *data,
- int (*func) (struct prmap *map,
- iterate_over_mappings_cb_ftype *child_func,
+ (procinfo *pi, find_memory_region_ftype child_func, void *data,
+ int (*func) (struct prmap *map, find_memory_region_ftype child_func,
void *data));
/* The head of the procinfo list: */
if (pi == NULL)
{
if (tid)
- error (_("\
-procfs: couldn't find pid %d (kernel thread %d) in procinfo list."),
+ error (_("procfs: couldn't find pid %d "
+ "(kernel thread %d) in procinfo list."),
pid, tid);
else
error (_("procfs: couldn't find pid %d in procinfo list."), pid);
if (header.pr_nsyscalls == 0)
{
- error (_("\
-load_syscalls: /proc/%d/sysent contains no syscalls!"), pi->pid);
+ error (_("load_syscalls: /proc/%d/sysent contains no syscalls!"),
+ pi->pid);
}
size = header.pr_nsyscalls * sizeof (prsyscall_t);
gdb_sigset_t *proc_get_traced_signals (procinfo * pi, gdb_sigset_t * save);
gdb_sigset_t *proc_get_held_signals (procinfo * pi, gdb_sigset_t * save);
gdb_sigset_t *proc_get_pending_signals (procinfo * pi, gdb_sigset_t * save);
-gdb_sigaction_t *proc_get_signal_actions (procinfo * pi, gdb_sigaction_t *save);
+gdb_sigaction_t *proc_get_signal_actions (procinfo * pi,
+ gdb_sigaction_t *save);
void proc_warn (procinfo * pi, char *func, int line);
void proc_error (procinfo * pi, char *func, int line);
static int
insert_dbx_link_bpt_in_region (struct prmap *map,
- iterate_over_mappings_cb_ftype *child_func,
+ find_memory_region_ftype child_func,
void *data)
{
procinfo *pi = (procinfo *) data;
wait_retval = wait (&wstat); /* "wait" for the child's exit */
if (wait_retval != PIDGET (inferior_ptid)) /* wrong child? */
- error (_("procfs: couldn't stop process %d: wait returned %d."),
+ error (_("procfs: couldn't stop "
+ "process %d: wait returned %d."),
PIDGET (inferior_ptid), wait_retval);
/* FIXME: might I not just use waitpid?
Or try find_procinfo to see if I know about this child? */
if ((nsysargs = proc_nsysarg (pi)) > 0 &&
(sysargs = proc_sysargs (pi)) != NULL)
{
- printf_filtered (_("%ld syscall arguments:\n"), nsysargs);
+ printf_filtered (_("%ld syscall arguments:\n"),
+ nsysargs);
for (i = 0; i < nsysargs; i++)
printf_filtered ("#%ld: 0x%08lx\n",
i, sysargs[i]);
#endif
wstat = (SIGFPE << 8) | 0177;
break;
- case FLTPAGE: /* Recoverable page fault */
- default: /* FIXME: use si_signo if possible for fault */
+ case FLTPAGE: /* Recoverable page fault */
+ default: /* FIXME: use si_signo if possible for fault */
retval = pid_to_ptid (-1);
printf_filtered ("procfs:%d -- ", __LINE__);
printf_filtered (_("child stopped for unknown reason:\n"));
from the callback function, or zero. */
static int
-iterate_over_mappings (procinfo *pi,
- iterate_over_mappings_cb_ftype *child_func,
+iterate_over_mappings (procinfo *pi, find_memory_region_ftype child_func,
void *data,
int (*func) (struct prmap *map,
- iterate_over_mappings_cb_ftype *child_func,
+ find_memory_region_ftype child_func,
void *data))
{
char pathname[MAX_PROC_NAME_SIZE];
}
/* Implements the to_find_memory_regions method. Calls an external
- function for each memory region. The external function will have
- the signature:
-
- int callback (CORE_ADDR vaddr,
- unsigned long size,
- int read, int write, int execute,
- void *data);
-
+ function for each memory region.
Returns the integer value returned by the callback. */
static int
find_memory_regions_callback (struct prmap *map,
- int (*func) (CORE_ADDR,
- unsigned long,
- int, int, int,
- void *),
- void *data)
+ find_memory_region_ftype func, void *data)
{
return (*func) ((CORE_ADDR) map->pr_vaddr,
map->pr_size,
the callback. */
static int
-proc_find_memory_regions (int (*func) (CORE_ADDR,
- unsigned long,
- int, int, int,
- void *),
- void *data)
+proc_find_memory_regions (find_memory_region_ftype func, void *data)
{
procinfo *pi = find_procinfo_or_die (PIDGET (inferior_ptid), 0);
mappings'. */
static int
-info_mappings_callback (struct prmap *map,
- iterate_over_mappings_cb_ftype *ignore,
+info_mappings_callback (struct prmap *map, find_memory_region_ftype ignore,
void *unused)
{
unsigned int pr_off;
static int
find_signalled_thread (struct thread_info *info, void *data)
{
- if (info->stop_signal != TARGET_SIGNAL_0
+ if (info->suspend.stop_signal != TARGET_SIGNAL_0
&& ptid_get_pid (info->ptid) == ptid_get_pid (inferior_ptid))
return 1;
iterate_over_threads (find_signalled_thread, NULL);
if (info)
- return info->stop_signal;
+ return info->suspend.stop_signal;
else
return TARGET_SIGNAL_0;
}
thread_args.note_data = note_data;
thread_args.note_size = note_size;
thread_args.stop_signal = stop_signal;
- proc_iterate_over_threads (pi, procfs_corefile_thread_callback, &thread_args);
+ proc_iterate_over_threads (pi, procfs_corefile_thread_callback,
+ &thread_args);
/* There should be always at least one thread. */
gdb_assert (thread_args.note_data != note_data);