aboutsummaryrefslogtreecommitdiff
path: root/gdb/procfs.c
diff options
context:
space:
mode:
authorTom Tromey <tom@tromey.com>2018-06-11 12:05:27 -0600
committerTom Tromey <tom@tromey.com>2018-07-03 11:36:42 -0600
commite99b03dcf42606425eab8bd12eadb8aa4007f35a (patch)
treecce56508804d9ac552ebb678811b19008085fba7 /gdb/procfs.c
parentf2907e49910853edf3c1aec995b3c44b3bba8999 (diff)
downloadgdb-e99b03dcf42606425eab8bd12eadb8aa4007f35a.zip
gdb-e99b03dcf42606425eab8bd12eadb8aa4007f35a.tar.gz
gdb-e99b03dcf42606425eab8bd12eadb8aa4007f35a.tar.bz2
Remove ptid_get_pid
This removes ptid_get_pid in favor of calling the ptid_t::pid method. gdb/ChangeLog 2018-07-03 Tom Tromey <tom@tromey.com> * common/ptid.c (ptid_get_pid): Remove. * common/ptid.h (ptid_get_pid): Don't declare. * aarch64-linux-nat.c: Update. * ada-lang.c: Update. * aix-thread.c: Update. * alpha-bsd-nat.c: Update. * amd64-fbsd-nat.c: Update. * amd64-linux-nat.c: Update. * arm-linux-nat.c: Update. * arm-nbsd-nat.c: Update. * auxv.c: Update. * break-catch-syscall.c: Update. * breakpoint.c: Update. * bsd-uthread.c: Update. * corelow.c: Update. * ctf.c: Update. * darwin-nat.c: Update. * fbsd-nat.c: Update. * fbsd-tdep.c: Update. * gcore.c: Update. * gnu-nat.c: Update. * hppa-nbsd-nat.c: Update. * hppa-obsd-nat.c: Update. * i386-fbsd-nat.c: Update. * ia64-linux-nat.c: Update. * inf-ptrace.c: Update. * infcmd.c: Update. * inferior.c: Update. * inferior.h: Update. * inflow.c: Update. * infrun.c: Update. * linux-fork.c: Update. * linux-nat.c: Update. * linux-tdep.c: Update. * linux-thread-db.c: Update. * m68k-bsd-nat.c: Update. * mi/mi-interp.c: Update. * mi/mi-main.c: Update. * mips-linux-nat.c: Update. * mips-nbsd-nat.c: Update. * mips64-obsd-nat.c: Update. * nat/aarch64-linux-hw-point.c: Update. * nat/aarch64-linux.c: Update. * nat/linux-btrace.c: Update. * nat/linux-osdata.c: Update. * nat/linux-procfs.c: Update. * nat/x86-linux-dregs.c: Update. * nto-procfs.c: Update. * obsd-nat.c: Update. * ppc-linux-nat.c: Update. * ppc-nbsd-nat.c: Update. * ppc-obsd-nat.c: Update. * proc-service.c: Update. * procfs.c: Update. * python/py-inferior.c: Update. * python/py-infthread.c: Update. * ravenscar-thread.c: Update. * record.c: Update. * remote-sim.c: Update. * remote.c: Update. * rs6000-nat.c: Update. * s390-linux-nat.c: Update. * sh-nbsd-nat.c: Update. * sol-thread.c: Update. * sparc-nat.c: Update. * sparc64-tdep.c: Update. * spu-linux-nat.c: Update. * spu-tdep.c: Update. * target-debug.h: Update. * target.c: Update. * thread.c: Update. * tid-parse.c: Update. * tracefile-tfile.c: Update. * vax-bsd-nat.c: Update. * windows-nat.c: Update. * x86-linux-nat.c: Update. * x86-nat.c: Update. gdb/gdbserver/ChangeLog 2018-07-03 Tom Tromey <tom@tromey.com> * linux-low.c: Update. * linux-mips-low.c: Update. * lynx-low.c: Update. * mem-break.c: Update. * nto-low.c: Update. * remote-utils.c: Update. * server.c: Update. * spu-low.c: Update. * target.c: Update. * tracepoint.c: Update.
Diffstat (limited to 'gdb/procfs.c')
-rw-r--r--gdb/procfs.c74
1 files changed, 37 insertions, 37 deletions
diff --git a/gdb/procfs.c b/gdb/procfs.c
index df23966..77a679c 100644
--- a/gdb/procfs.c
+++ b/gdb/procfs.c
@@ -1635,17 +1635,17 @@ procfs_find_LDT_entry (ptid_t ptid)
procinfo *pi;
/* Find procinfo for the lwp. */
- if ((pi = find_procinfo (ptid_get_pid (ptid), ptid_get_lwp (ptid))) == NULL)
+ if ((pi = find_procinfo (ptid.pid (), ptid_get_lwp (ptid))) == NULL)
{
warning (_("procfs_find_LDT_entry: could not find procinfo for %d:%ld."),
- ptid_get_pid (ptid), ptid_get_lwp (ptid));
+ ptid.pid (), ptid_get_lwp (ptid));
return NULL;
}
/* get its general registers. */
if ((gregs = proc_get_gregs (pi)) == NULL)
{
warning (_("procfs_find_LDT_entry: could not read gregs for %d:%ld."),
- ptid_get_pid (ptid), ptid_get_lwp (ptid));
+ ptid.pid (), ptid_get_lwp (ptid));
return NULL;
}
/* Now extract the GS register's lower 16 bits. */
@@ -1910,7 +1910,7 @@ procfs_target::attach (const char *args, int from_tty)
void
procfs_target::detach (inferior *inf, int from_tty)
{
- int pid = ptid_get_pid (inferior_ptid);
+ int pid = inferior_ptid.pid ();
if (from_tty)
{
@@ -1940,14 +1940,14 @@ do_attach (ptid_t ptid)
int fail;
int lwpid;
- if ((pi = create_procinfo (ptid_get_pid (ptid), 0)) == NULL)
+ if ((pi = create_procinfo (ptid.pid (), 0)) == NULL)
perror (_("procfs: out of memory in 'attach'"));
if (!open_procinfo_files (pi, FD_CTL))
{
fprintf_filtered (gdb_stderr, "procfs:%d -- ", __LINE__);
sprintf (errmsg, "do_attach: couldn't open /proc file for process %d",
- ptid_get_pid (ptid));
+ ptid.pid ());
dead_procinfo (pi, errmsg, NOKILL);
}
@@ -2008,7 +2008,7 @@ do_detach ()
procinfo *pi;
/* Find procinfo for the main process. */
- pi = find_procinfo_or_die (ptid_get_pid (inferior_ptid),
+ pi = find_procinfo_or_die (inferior_ptid.pid (),
0); /* FIXME: threads */
if (!proc_set_traced_signals (pi, &pi->saved_sigset))
@@ -2064,7 +2064,7 @@ procfs_target::fetch_registers (struct regcache *regcache, int regnum)
gdb_gregset_t *gregs;
procinfo *pi;
ptid_t ptid = regcache->ptid ();
- int pid = ptid_get_pid (ptid);
+ int pid = ptid.pid ();
int tid = ptid_get_lwp (ptid);
struct gdbarch *gdbarch = regcache->arch ();
@@ -2113,7 +2113,7 @@ procfs_target::store_registers (struct regcache *regcache, int regnum)
gdb_gregset_t *gregs;
procinfo *pi;
ptid_t ptid = regcache->ptid ();
- int pid = ptid_get_pid (ptid);
+ int pid = ptid.pid ();
int tid = ptid_get_lwp (ptid);
struct gdbarch *gdbarch = regcache->arch ();
@@ -2211,7 +2211,7 @@ wait_again:
retval = ptid_t (-1);
/* Find procinfo for main process. */
- pi = find_procinfo_or_die (ptid_get_pid (inferior_ptid), 0);
+ pi = find_procinfo_or_die (inferior_ptid.pid (), 0);
if (pi)
{
/* We must assume that the status is stale now... */
@@ -2238,10 +2238,10 @@ wait_again:
wait_retval = ::wait (&wstat); /* "wait" for the child's exit. */
/* Wrong child? */
- if (wait_retval != ptid_get_pid (inferior_ptid))
+ if (wait_retval != inferior_ptid.pid ())
error (_("procfs: couldn't stop "
"process %d: wait returned %d."),
- ptid_get_pid (inferior_ptid), wait_retval);
+ inferior_ptid.pid (), wait_retval);
/* FIXME: might I not just use waitpid?
Or try find_procinfo to see if I know about this child? */
retval = ptid_t (wait_retval);
@@ -2524,7 +2524,7 @@ wait_again:
}
/* Got this far without error: If retval isn't in the
threads database, add it. */
- if (ptid_get_pid (retval) > 0 &&
+ if (retval.pid () > 0 &&
!ptid_equal (retval, inferior_ptid) &&
!in_thread_list (retval))
{
@@ -2532,9 +2532,9 @@ wait_again:
GDB's list and to our own. If we don't create a
procinfo, resume may be unhappy later. */
add_thread (retval);
- if (find_procinfo (ptid_get_pid (retval),
+ if (find_procinfo (retval.pid (),
ptid_get_lwp (retval)) == NULL)
- create_procinfo (ptid_get_pid (retval),
+ create_procinfo (retval.pid (),
ptid_get_lwp (retval));
}
}
@@ -2591,7 +2591,7 @@ procfs_xfer_memory (gdb_byte *readbuf, const gdb_byte *writebuf,
int nbytes;
/* Find procinfo for main process. */
- pi = find_procinfo_or_die (ptid_get_pid (inferior_ptid), 0);
+ pi = find_procinfo_or_die (inferior_ptid.pid (), 0);
if (pi->as_fd == 0 &&
open_procinfo_files (pi, FD_AS) == 0)
{
@@ -2728,7 +2728,7 @@ procfs_target::resume (ptid_t ptid, int step, enum gdb_signal signo)
to proc_run_process (for use in the prrun struct by ioctl). */
/* Find procinfo for main process. */
- pi = find_procinfo_or_die (ptid_get_pid (inferior_ptid), 0);
+ pi = find_procinfo_or_die (inferior_ptid.pid (), 0);
/* First cut: ignore pid argument. */
errno = 0;
@@ -2748,11 +2748,11 @@ procfs_target::resume (ptid_t ptid, int step, enum gdb_signal signo)
/* Void the process procinfo's caches. */
invalidate_cache (NULL, pi, NULL);
- if (ptid_get_pid (ptid) != -1)
+ if (ptid.pid () != -1)
{
/* Resume a specific thread, presumably suppressing the
others. */
- thread = find_procinfo (ptid_get_pid (ptid), ptid_get_lwp (ptid));
+ thread = find_procinfo (ptid.pid (), ptid_get_lwp (ptid));
if (thread != NULL)
{
if (thread->tid != 0)
@@ -2788,7 +2788,7 @@ void
procfs_target::pass_signals (int numsigs, unsigned char *pass_signals)
{
sigset_t signals;
- procinfo *pi = find_procinfo_or_die (ptid_get_pid (inferior_ptid), 0);
+ procinfo *pi = find_procinfo_or_die (inferior_ptid.pid (), 0);
int signo;
prfillset (&signals);
@@ -2855,7 +2855,7 @@ procfs_target::kill ()
if (!ptid_equal (inferior_ptid, null_ptid)) /* ? */
{
/* Find procinfo for main process. */
- procinfo *pi = find_procinfo (ptid_get_pid (inferior_ptid), 0);
+ procinfo *pi = find_procinfo (inferior_ptid.pid (), 0);
if (pi)
unconditionally_kill_inferior (pi);
@@ -2873,7 +2873,7 @@ procfs_target::mourn_inferior ()
if (!ptid_equal (inferior_ptid, null_ptid))
{
/* Find procinfo for main process. */
- pi = find_procinfo (ptid_get_pid (inferior_ptid), 0);
+ pi = find_procinfo (inferior_ptid.pid (), 0);
if (pi)
destroy_procinfo (pi);
}
@@ -3162,7 +3162,7 @@ procfs_target::update_thread_list ()
prune_threads ();
/* Find procinfo for main process. */
- pi = find_procinfo_or_die (ptid_get_pid (inferior_ptid), 0);
+ pi = find_procinfo_or_die (inferior_ptid.pid (), 0);
proc_update_threads (pi);
proc_iterate_over_threads (pi, procfs_notice_thread, NULL);
}
@@ -3177,7 +3177,7 @@ procfs_target::thread_alive (ptid_t ptid)
int proc, thread;
procinfo *pi;
- proc = ptid_get_pid (ptid);
+ proc = ptid.pid ();
thread = ptid_get_lwp (ptid);
/* If I don't know it, it ain't alive! */
if ((pi = find_procinfo (proc, thread)) == NULL)
@@ -3204,7 +3204,7 @@ procfs_target::pid_to_str (ptid_t ptid)
static char buf[80];
if (ptid_get_lwp (ptid) == 0)
- sprintf (buf, "process %d", ptid_get_pid (ptid));
+ sprintf (buf, "process %d", ptid.pid ());
else
sprintf (buf, "LWP %ld", ptid_get_lwp (ptid));
@@ -3220,8 +3220,8 @@ procfs_set_watchpoint (ptid_t ptid, CORE_ADDR addr, int len, int rwflag,
int pflags = 0;
procinfo *pi;
- pi = find_procinfo_or_die (ptid_get_pid (ptid) == -1 ?
- ptid_get_pid (inferior_ptid) : ptid_get_pid (ptid),
+ pi = find_procinfo_or_die (ptid.pid () == -1 ?
+ inferior_ptid.pid () : ptid.pid (),
0);
/* Translate from GDB's flags to /proc's. */
@@ -3298,7 +3298,7 @@ procfs_target::stopped_by_watchpoint ()
{
procinfo *pi;
- pi = find_procinfo_or_die (ptid_get_pid (inferior_ptid), 0);
+ pi = find_procinfo_or_die (inferior_ptid.pid (), 0);
if (proc_flags (pi) & (PR_STOPPED | PR_ISTOP))
{
@@ -3322,7 +3322,7 @@ procfs_target::stopped_data_address (CORE_ADDR *addr)
{
procinfo *pi;
- pi = find_procinfo_or_die (ptid_get_pid (inferior_ptid), 0);
+ pi = find_procinfo_or_die (inferior_ptid.pid (), 0);
return proc_watchpoint_address (pi, addr);
}
@@ -3455,7 +3455,7 @@ find_memory_regions_callback (struct prmap *map,
int
procfs_target::find_memory_regions (find_memory_region_ftype func, void *data)
{
- procinfo *pi = find_procinfo_or_die (ptid_get_pid (inferior_ptid), 0);
+ procinfo *pi = find_procinfo_or_die (inferior_ptid.pid (), 0);
return iterate_over_mappings (pi, func, data,
find_memory_regions_callback);
@@ -3584,7 +3584,7 @@ procfs_target::info_proc (const char *args, enum info_proc_what what)
}
}
if (pid == 0)
- pid = ptid_get_pid (inferior_ptid);
+ pid = inferior_ptid.pid ();
if (pid == 0)
error (_("No current process: you must name one."));
else
@@ -3678,13 +3678,13 @@ proc_trace_syscalls (const char *args, int from_tty, int entry_or_exit, int mode
{
procinfo *pi;
- if (ptid_get_pid (inferior_ptid) <= 0)
+ if (inferior_ptid.pid () <= 0)
error (_("you must be debugging a process to use this command."));
if (args == NULL || args[0] == 0)
error_no_arg (_("system call to trace"));
- pi = find_procinfo_or_die (ptid_get_pid (inferior_ptid), 0);
+ pi = find_procinfo_or_die (inferior_ptid.pid (), 0);
if (isdigit (args[0]))
{
const int syscallnum = atoi (args);
@@ -3764,7 +3764,7 @@ procfs_do_thread_registers (bfd *obfd, ptid_t ptid,
gdb_fpregset_t fpregs;
unsigned long merged_pid;
- merged_pid = ptid_get_lwp (ptid) << 16 | ptid_get_pid (ptid);
+ merged_pid = ptid_get_lwp (ptid) << 16 | ptid.pid ();
/* This part is the old method for fetching registers.
It should be replaced by the newer one using regsets
@@ -3821,7 +3821,7 @@ static int
find_signalled_thread (struct thread_info *info, void *data)
{
if (info->suspend.stop_signal != GDB_SIGNAL_0
- && ptid_get_pid (info->ptid) == ptid_get_pid (inferior_ptid))
+ && info->ptid.pid () == inferior_ptid.pid ())
return 1;
return 0;
@@ -3847,7 +3847,7 @@ procfs_target::make_corefile_notes (bfd *obfd, int *note_size)
gdb_fpregset_t fpregs;
char fname[16] = {'\0'};
char psargs[80] = {'\0'};
- procinfo *pi = find_procinfo_or_die (ptid_get_pid (inferior_ptid), 0);
+ procinfo *pi = find_procinfo_or_die (inferior_ptid.pid (), 0);
char *note_data = NULL;
char *inf_args;
struct procfs_corefile_thread_data thread_args;
@@ -3881,7 +3881,7 @@ procfs_target::make_corefile_notes (bfd *obfd, int *note_size)
fill_gregset (get_current_regcache (), &gregs, -1);
note_data = elfcore_write_pstatus (obfd, note_data, note_size,
- ptid_get_pid (inferior_ptid),
+ inferior_ptid.pid (),
stop_signal, &gregs);
thread_args.obfd = obfd;