On Fri, Feb 10, 2012 at 08:14:41AM +0000, Stefan Hajnoczi wrote: > On Thu, Feb 09, 2012 at 06:33:16PM +0800, 陳韋任 wrote: > > The question is not so related to QEMU itself, but I want to give it a > > try. > > I am running a tiny OS on QEMU and debugging it with gdbstub. The tiny OS > > will > > fork process 1, 2, ... and so on. I want to follow the child process, but > > the > > GDB command `set follow-fork-mode child` doesn't work. This seems to be a > > bug > > or missing feature in GDB remote protocol. [1] > > > > Is there a way to do what I'm trying to do? Thanks! > > I'm confused. If you are running a system emulator with a guest OS > inside then GDB's process-level features are not available. The QEMU > gdbstub gives you access at the system-level. If you want to debug > guest processes, run gdb inside the guest.
Hope the code snip below can clarify what I am trying to do. ----------------- Tiny OS code ----------------------------- void main(void) /* This really IS void, no error here. */ { /* initialize enviroment */ sti(); move_to_user_mode(); if (!fork()) { /* we count on this going ok */ init(); // task 1 } for(;;) pause(); // task 0 } ------------------------------------------------------------ I am running this tiny OS on QEMU then using GDB to connect it. I want to follow task 1 after the forking, but it seems that GDB stick with task 0 and cannot follow task 1 even I do `set follow-fork-mode child`. Thanks! Regards, chenwj -- Wei-Ren Chen (陳韋任) Computer Systems Lab, Institute of Information Science, Academia Sinica, Taiwan (R.O.C.) Tel:886-2-2788-3799 #1667 Homepage: http://people.cs.nctu.edu.tw/~chenwj