This is the mail archive of the gdb-prs@sourceware.org mailing list for the GDB project.


Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]
Other format: [Raw text]

[Bug gdb/17286] New: checkpoints and multi-inferior don't play nice together


https://sourceware.org/bugzilla/show_bug.cgi?id=17286

            Bug ID: 17286
           Summary: checkpoints and multi-inferior don't play nice
                    together
           Product: gdb
           Version: HEAD
            Status: NEW
          Severity: normal
          Priority: P2
         Component: gdb
          Assignee: unassigned at sourceware dot org
          Reporter: xdje42 at gmail dot com

I was looking at this code in linux-nat.c:linux_nat_detach

  if (forks_exist_p ())
    {
      /* Multi-fork case.  The current inferior_ptid is being detached          
         from, but there are other viable forks to debug.  Detach from          
         the current fork, and context-switch to the first                      
         available.  */
      linux_fork_detach (args, from_tty);
    }
  else
    linux_ops->to_detach (ops, args, from_tty);

and thought "That's odd.  What if there are several inferiors, one with
checkpoints(forks), but it's not the current inferior?"

So then I did the following experiment:

bash$ make run
(gdb) file ~/src/play/hello.x64
(gdb) start
(gdb) add-infer -exec ~/src/play/hello.x64
(gdb) infer 2
(gdb) start
(gdb) infer 1
(gdb) checkpoint
checkpoint: fork returned pid 16841.
(gdb) i check
  1 process 16841 at 0x4005f4, file hello.c, line 6
* 0 process 16835 (main process) at 0x4005f4, file hello.c, line 6
(gdb) i infer
  Num  Description       Executable
  2    process 16839     /home/dje/src/play/hello.x64
* 1    process 16835     /home/dje/src/play/hello.x64
(gdb) infer 2
[Switching to inferior 2 [process 16839] (/home/dje/src/play/hello.x64)]
[Switching to thread 2 (process 16839)]
#0  main () at hello.c:6
6               printf ("hello\n");
(gdb) i check
  1 process 16841 at 0x4005f4, file hello.c, line 6
hello
hello
make: *** [run] Segmentation fault (core dumped)

side discussion:
The "checkpoint" set of commands has its use, but it's embedded into gdb, and
AIUI is marked as experimental.  And it has limits like not supporting
multithreaded apps.
Stuff like this would be nice to implement outside of core gdb.
How hard would it be to move to Python?

-- 
You are receiving this mail because:
You are on the CC list for the bug.


Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]