/* GNU/Linux native-dependent code for debugging multiple forks.
- Copyright (C) 2005-2015 Free Software Foundation, Inc.
+ Copyright (C) 2005-2017 Free Software Foundation, Inc.
This file is part of GDB.
struct value *fork_fn = NULL, *ret;
struct fork_info *fp;
pid_t retpid;
- struct cleanup *old_chain;
if (!target_has_execution)
error (_("The program is not being run."));
ret = value_from_longest (builtin_type (gdbarch)->builtin_int, 0);
/* Tell linux-nat.c that we're checkpointing this inferior. */
- old_chain = make_cleanup_restore_integer (&checkpointing_pid);
- checkpointing_pid = ptid_get_pid (inferior_ptid);
+ {
+ scoped_restore save_pid
+ = make_scoped_restore (&checkpointing_pid, ptid_get_pid (inferior_ptid));
+
+ ret = call_function_by_hand (fork_fn, 0, &ret);
+ }
- ret = call_function_by_hand (fork_fn, 0, &ret);
- do_cleanups (old_chain);
if (!ret) /* Probably can't happen. */
error (_("checkpoint: call_function_by_hand returned null."));