Homework 1, Problem 9 Output
[3:34pm] cse451> smartgdb ../userprog/nachos
GDB is free software and you are welcome to distribute copies of it
under certain conditions; type "show copying" to see the conditions.
There is absolutely no warranty for GDB; type "show warranty" for details.
GDB 4.16.1 (SmartGDB 0.9) (i686-unknown-linux),
Copyright 1996 Free Software Foundation, Inc...
(gdb) conf args -x fork
(gdb) source ~/prob8-routines.tcl
(gdb) r
Starting program: /d2/rprojects/nachos/nachos-3.4/code/test/../userprog/nachos -x fork
Breakpoint 5, Thread::Thread (this=0x8077710, threadName=0x80743f9 "main")
at ../threads/thread.cc:103
103 {
No current thread
(gdb) c
Continuing.
Breakpoint 1, Machine::RaiseException (this=0x8077918,
which=PageFaultException, badVAddr=704) at ../machine/machine.cc:103
103 DEBUG('m', "Exception: %s\n", exceptionNames[which]);
currentThread->ThreadID = 0
which = PageFaultException
(gdb) c
Continuing.
Breakpoint 2, ExceptionHandler (which=PageFaultException)
at ../userprog/exception.cc:57
57 if (which == SyscallException) {
currentThread->ThreadID = 0
which = PageFaultException
type = 0
(gdb) c
Continuing.
Breakpoint 1, Machine::RaiseException (this=0x8077918,
which=PageFaultException, badVAddr=484) at ../machine/machine.cc:103
103 DEBUG('m', "Exception: %s\n", exceptionNames[which]);
currentThread->ThreadID = 0
which = PageFaultException
(gdb) c
Continuing.
Breakpoint 2, ExceptionHandler (which=PageFaultException)
at ../userprog/exception.cc:57
57 if (which == SyscallException) {
currentThread->ThreadID = 0
which = PageFaultException
type = 0
(gdb) c
Continuing.
Breakpoint 1, Machine::RaiseException (this=0x8077918, which=SyscallException,
badVAddr=0) at ../machine/machine.cc:103
103 DEBUG('m', "Exception: %s\n", exceptionNames[which]);
currentThread->ThreadID = 0
which = SyscallException
(gdb) c
Continuing.
Breakpoint 2, ExceptionHandler (which=SyscallException)
at ../userprog/exception.cc:57
57 if (which == SyscallException) {
currentThread->ThreadID = 0
which = SyscallException
type = 9
(gdb) c
Continuing.
Breakpoint 3, do_system_call (syscall_num=9) at ../userprog/systemcall.cc:30
30 switch (syscall_num) {
currentThread->ThreadID = 0
syscall_num = 9
reg4 = 0
reg5 = 0
reg6 = 0
reg7 = 0
(gdb) c
Continuing.
Breakpoint 4, System_Fork () at ../userprog/systemcall.cc:422
422 char * filename = new char[MAXFILENAMELENGTH];
currentThread->ThreadID = 0
(gdb) c
Continuing.
Breakpoint 5, Thread::Thread (this=0x807f3d8, threadName=0x807f380 "main")
at ../threads/thread.cc:103
103 {
currentThread->ThreadID = 0
(gdb) c
Continuing.
Breakpoint 8, AddrSpace::CopyFrom (this=0x807f5e0, voidOurThread=0x807f3d8)
at ../userprog/addrspace.cc:342
342 OpenFile *swapfile = swap->file ();
currentThread->ThreadID = 0
((Thread*)voidOurThread)->ThreadID = 1
(gdb) c
Continuing.
Breakpoint 6, Thread::Fork (this=0x807f3d8,
func=0x804fef8 , arg=40) at ../threads/thread.cc:203
203 name, (size_t) func, arg);
func = (void (*)()) 0x804fef8
arg = 40
(gdb) c
Continuing.
Breakpoint 1, Machine::RaiseException (this=0x8077918,
which=PageFaultException, badVAddr=520) at ../machine/machine.cc:103
103 DEBUG('m', "Exception: %s\n", exceptionNames[which]);
currentThread->ThreadID = 0
which = PageFaultException
(gdb) c
Continuing.
Breakpoint 2, ExceptionHandler (which=PageFaultException)
at ../userprog/exception.cc:57
57 if (which == SyscallException) {
currentThread->ThreadID = 0
which = PageFaultException
type = 2
(gdb) c
Continuing.
Breakpoint 1, Machine::RaiseException (this=0x8077918,
which=PageFaultException, badVAddr=768) at ../machine/machine.cc:103
103 DEBUG('m', "Exception: %s\n", exceptionNames[which]);
currentThread->ThreadID = 0
which = PageFaultException
(gdb) c
Continuing.
Breakpoint 2, ExceptionHandler (which=PageFaultException)
at ../userprog/exception.cc:57
57 if (which == SyscallException) {
currentThread->ThreadID = 0
which = PageFaultException
type = 2
(gdb) c
Continuing.
Breakpoint 1, Machine::RaiseException (this=0x8077918, which=SyscallException,
badVAddr=0) at ../machine/machine.cc:103
103 DEBUG('m', "Exception: %s\n", exceptionNames[which]);
currentThread->ThreadID = 0
which = SyscallException
(gdb) c
Continuing.
Breakpoint 2, ExceptionHandler (which=SyscallException)
at ../userprog/exception.cc:57
57 if (which == SyscallException) {
currentThread->ThreadID = 0
which = SyscallException
type = 1
(gdb) c
Continuing.
Breakpoint 3, do_system_call (syscall_num=1) at ../userprog/systemcall.cc:30
30 switch (syscall_num) {
currentThread->ThreadID = 0
syscall_num = 1
reg4 = 0
reg5 = 0
reg6 = 0
reg7 = 0
(gdb) c
Continuing.
Breakpoint 7, Do_Fork (dummy=40) at ../userprog/systemcall.cc:527
527 dummy = 0; // Keep gcc happy
currentThread->ThreadID = 1
(gdb) c
Continuing.
Breakpoint 1, Machine::RaiseException (this=0x8077918,
which=PageFaultException, badVAddr=520) at ../machine/machine.cc:103
103 DEBUG('m', "Exception: %s\n", exceptionNames[which]);
currentThread->ThreadID = 1
which = PageFaultException
(gdb) c
Continuing.
Breakpoint 2, ExceptionHandler (which=PageFaultException)
at ../userprog/exception.cc:57
57 if (which == SyscallException) {
currentThread->ThreadID = 1
which = PageFaultException
type = 0
(gdb) c
Continuing.
Breakpoint 1, Machine::RaiseException (this=0x8077918,
which=PageFaultException, badVAddr=768) at ../machine/machine.cc:103
103 DEBUG('m', "Exception: %s\n", exceptionNames[which]);
currentThread->ThreadID = 1
which = PageFaultException
(gdb) c
Continuing.
Breakpoint 2, ExceptionHandler (which=PageFaultException)
at ../userprog/exception.cc:57
57 if (which == SyscallException) {
currentThread->ThreadID = 1
which = PageFaultException
type = 0
(gdb) c
Continuing.
Breakpoint 1, Machine::RaiseException (this=0x8077918, which=SyscallException,
badVAddr=0) at ../machine/machine.cc:103
103 DEBUG('m', "Exception: %s\n", exceptionNames[which]);
currentThread->ThreadID = 1
which = SyscallException
(gdb) c
Continuing.
Breakpoint 2, ExceptionHandler (which=SyscallException)
at ../userprog/exception.cc:57
57 if (which == SyscallException) {
currentThread->ThreadID = 1
which = SyscallException
type = 1
(gdb) c
Continuing.
Breakpoint 3, do_system_call (syscall_num=1) at ../userprog/systemcall.cc:30
30 switch (syscall_num) {
currentThread->ThreadID = 1
syscall_num = 1
reg4 = 0
reg5 = 0
reg6 = 0
reg7 = 0
(gdb) c
Continuing.
Machine halting!
Ticks: total 111, idle 0, system 70, user 41
Context switches: 2
Disk I/O: reads 0, writes 0
Console I/O: reads 0, writes 0
Paging: faults 6, pageins 8, pageouts 0
Network I/O: packets received 0, sent 0
Cleaning up...
Program exited normally.
(gdb) quit
Script done on Wed Mar 4 15:35:14 1998
Steve Goddard
Last modified: Tue Oct 20 10:56:24 CDT 1998