- struct fork_info *next;
- ptid_t ptid;
- ptid_t parent_ptid;
- int num; /* Convenient handle (GDB fork id). */
- readonly_detached_regcache *savedregs; /* Convenient for info fork, saves
- having to actually switch contexts. */
- CORE_ADDR pc;
- int clobber_regs; /* True if we should restore saved regs. */
- off_t *filepos; /* Set of open file descriptors' offsets. */
- int maxfd;
+ explicit fork_info (pid_t pid)
+ : ptid (pid, pid, 0)
+ {
+ }
+
+ ~fork_info ()
+ {
+ /* Notes on step-resume breakpoints: since this is a concern for
+ threads, let's convince ourselves that it's not a concern for
+ forks. There are two ways for a fork_info to be created.
+ First, by the checkpoint command, in which case we're at a gdb
+ prompt and there can't be any step-resume breakpoint. Second,
+ by a fork in the user program, in which case we *may* have
+ stepped into the fork call, but regardless of whether we follow
+ the parent or the child, we will return to the same place and
+ the step-resume breakpoint, if any, will take care of itself as
+ usual. And unlike threads, we do not save a private copy of
+ the step-resume breakpoint -- so we're OK. */
+
+ if (savedregs)
+ delete savedregs;
+ if (filepos)
+ xfree (filepos);
+ }
+
+ ptid_t ptid = null_ptid;
+ ptid_t parent_ptid = null_ptid;
+
+ /* Convenient handle (GDB fork id). */
+ int num = 0;
+
+ /* Convenient for info fork, saves having to actually switch
+ contexts. */
+ readonly_detached_regcache *savedregs = nullptr;
+
+ CORE_ADDR pc = 0;
+
+ /* Set of open file descriptors' offsets. */
+ off_t *filepos = nullptr;
+
+ int maxfd = 0;