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, [...]
Since this seems to be your code, if this were PowerPC I'd simply try to
place via inline assembler a trap instruction first thing inside the
init() function. That can easily be caught in gdbstub.
Depending on what you really want to do, you could always try some
printf-style output to serial. ;)
Andreas
--
SUSE LINUX Products GmbH, Maxfeldstr. 5, 90409 Nürnberg, Germany
GF: Jeff Hawn, Jennifer Guild, Felix Imendörffer; HRB 16746 AG Nürnberg