#include "gdbthread.h"
#include "regcache.h"
#include "inf-child.h"
+#include "nat/fork-inferior.h"
#include "filestuff.h"
#if defined (NEW_PROC_API)
struct cleanup *old_chain;
procinfo *process = NULL;
procinfo *thread = NULL;
- char **argv = NULL;
char *tmp = NULL;
int pid = 0;
int tid = 0;
}
old_chain = make_cleanup (null_cleanup, 0);
- if (args)
- {
- argv = gdb_buildargv (args);
- make_cleanup_freeargv (argv);
- }
- while (argv != NULL && *argv != NULL)
+ gdb_argv built_argv (args);
+ for (char *arg : built_argv)
{
- if (isdigit (argv[0][0]))
+ if (isdigit (arg[0]))
{
- pid = strtoul (argv[0], &tmp, 10);
+ pid = strtoul (arg, &tmp, 10);
if (*tmp == '/')
tid = strtoul (++tmp, NULL, 10);
}
- else if (argv[0][0] == '/')
+ else if (arg[0] == '/')
{
- tid = strtoul (argv[0] + 1, NULL, 10);
+ tid = strtoul (arg + 1, NULL, 10);
}
- argv++;
}
if (pid == 0)
pid = ptid_get_pid (inferior_ptid);
proc_trace_syscalls (args, from_tty, PR_SYSEXIT, FLAG_RESET);
}
-
-/* Provide a prototype to silence -Wmissing-prototypes. */
-extern void _initialize_procfs (void);
-
void
_initialize_procfs (void)
{
gdb_gregset_t gregs;
gdb_fpregset_t fpregs;
unsigned long merged_pid;
- struct cleanup *old_chain;
merged_pid = ptid_get_lwp (ptid) << 16 | ptid_get_pid (ptid);
once it is implemented in this platform:
gdbarch_iterate_over_regset_sections(). */
- old_chain = save_inferior_ptid ();
+ scoped_restore save_inferior_ptid = make_scoped_restore (&inferior_ptid);
inferior_ptid = ptid;
target_fetch_registers (regcache, -1);
&fpregs,
sizeof (fpregs));
- do_cleanups (old_chain);
-
return note_data;
}