/* GNU/Linux native-dependent code for debugging multiple forks.
- Copyright (C) 2005-2020 Free Software Foundation, Inc.
+ Copyright (C) 2005-2021 Free Software Foundation, Inc.
This file is part of GDB.
if (savedregs)
delete savedregs;
- if (filepos)
- xfree (filepos);
+
+ xfree (filepos);
}
ptid_t ptid = null_ptid;
static bool
one_fork_p ()
{
- return (!fork_list.empty ()
- && &fork_list.front () == &fork_list.back ());
+ return fork_list.size () == 1;
}
/* Add a new fork to the internal fork list. */
static void
fork_load_infrun_state (struct fork_info *fp)
{
- extern void nullify_last_target_wait_ptid ();
int i;
linux_nat_switch_fork (fp->ptid);
list, waitpid the ptid.
If fi->parent_ptid is a part of lwp and it is stopped, waitpid the
ptid. */
- thread_info *parent = find_thread_ptid (pptid);
+ thread_info *parent = find_thread_ptid (linux_target, pptid);
if ((parent == NULL && find_fork_ptid (pptid))
|| (parent != NULL && parent->state == THREAD_STOPPED))
{
if (inferior_call_waitpid (pptid, ptid.pid ()))
- warning (_("Unable to wait pid %s"),
+ warning (_("Unable to wait pid %s"),
target_pid_to_str (ptid).c_str ());
}
}
struct fork_info *fp;
pid_t retpid;
- if (!target_has_execution)
+ if (!target_has_execution ())
error (_("The program is not being run."));
/* Ensure that the inferior is not multithreaded. */
if (!fork_fn)
error (_("checkpoint: can't find fork function in inferior."));
- gdbarch = get_objfile_arch (fork_objf);
+ gdbarch = fork_objf->arch ();
ret = value_from_longest (builtin_type (gdbarch)->builtin_int, 0);
/* Tell linux-nat.c that we're checkpointing this inferior. */
error (_("checkpoint: call_function_by_hand returned null."));
retpid = value_as_long (ret);
- get_last_target_status (&last_target_ptid, &last_target_waitstatus);
+ get_last_target_status (nullptr, &last_target_ptid, &last_target_waitstatus);
fp = find_fork_pid (retpid);
linux_fork_context (fp, from_tty);
}
+void _initialize_linux_fork ();
void
-_initialize_linux_fork (void)
+_initialize_linux_fork ()
{
/* Checkpoint command: create a fork of the inferior process
and set it aside for later debugging. */