On Sun, Feb 12, 2012 at 3:00 AM, Wei Yang <weiyang.ker...@gmail.com> wrote: > 2012/2/11 malc <av1...@comtv.ru>: >> On Sat, 11 Feb 2012, Andreas F?rber wrote: >> >>> Am 10.02.2012 11:26, schrieb ???: >>> > On Fri, Feb 10, 2012 at 08:14:41AM +0000, Stefan Hajnoczi wrote: >>> >> On Thu, Feb 09, 2012 at 06:33:16PM +0800, ??? wrote: >>> >>> 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, >>> >>> [...] >>> >>> >>> >>> Is there a way to do what I'm trying to do? Thanks! >>> >>> > ----------------- 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, [...] >>> > > Could the Qemu gdbstub debug a user space process?
What people have been trying to explain is that, yes, gdbstub can debug user space processes but not in an easy way. It's like using a bicycle to travel from Paris to Beijing - it takes a lot of time and effort, you may want to catch a plane instead. The QEMU gdbstub is a hardware-level debugger. It shows you what the CPU is doing. It does not know about processes. Of course, if *you* understand how processes are implemented in this operating systems, *you* could do all the process-level debugging yourself without the help of the debugger. Stefan