Received: from eggs.gnu.org ([140.186.70.92]:42843) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1RvngH-0008Qh-NW for qemu-devel@nongnu.org; Fri, 10 Feb 2012 05:26:18 -0500 Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71) (envelope-from ) id 1RvngF-0007IB-LU for qemu-devel@nongnu.org; Fri, 10 Feb 2012 05:26:17 -0500 Received: from csmailer.cs.nctu.edu.tw ([140.113.235.130]:55419) by eggs.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1RvngE-0007He-S8 for qemu-devel@nongnu.org; Fri, 10 Feb 2012 05:26:15 -0500 Date: Fri, 10 Feb 2012 18:26:04 +0800 From: =?utf-8?B?6Zmz6Z+L5Lu7?= Message-ID: <20120210102604.GA9791@cs.nctu.edu.tw> References: <20120209103316.GA94562@cs.nctu.edu.tw> <20120210081441.GA17878@stefanha-thinkpad.localdomain> MIME-Version: 1.0 Content-Type: text/plain; charset=utf-8 Content-Disposition: inline In-Reply-To: <20120210081441.GA17878@stefanha-thinkpad.localdomain> Content-Transfer-Encoding: quoted-printable Subject: Re: [Qemu-devel] How to follow a child process created in the guest OS? List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , To: Stefan Hajnoczi Cc: qemu-devel@nongnu.org, =?utf-8?B?6Zmz6Z+L5Lu7?= On Fri, Feb 10, 2012 at 08:14:41AM +0000, Stefan Hajnoczi wrote: > On Thu, Feb 09, 2012 at 06:33:16PM +0800, =E9=99=B3=E9=9F=8B=E4=BB=BB w= rote: > > The question is not so related to QEMU itself, but I want to give i= t a try. > > I am running a tiny OS on QEMU and debugging it with gdbstub. The tin= y 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] > >=20 > > Is there a way to do what I'm trying to do? Thanks! >=20 > 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 }=20 ------------------------------------------------------------ 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-mod= e child`. Thanks!=20 Regards, chenwj --=20 Wei-Ren Chen (=E9=99=B3=E9=9F=8B=E4=BB=BB) 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