diff --git a/src/userprog/process.c b/src/userprog/process.c index d6bf6c8..301bb66 100644 --- a/src/userprog/process.c +++ b/src/userprog/process.c @@ -155,7 +155,6 @@ start_process (void *proc_start_data) /* If stack initialization failed, free process resources and quit. */ if (!success) { - process_exit (); thread_exit (); } @@ -297,7 +296,10 @@ process_wait (tid_t child_tid UNUSED) break; } if (child_result == NULL) - return -1; + { + printf ("-1 due to: child_result == NULL\n"); + return -1; + } /* Wait for child to die. */ sema_down (&child_result->sema); /* We need lock release in process_exit, so we need to acquire (and possibly @@ -311,6 +313,12 @@ process_wait (tid_t child_tid UNUSED) int exit_status = child_result->exit_status; lock_release (&child_result->lock); free (child_result); + + if (exit_status == -1) + { + printf ("-1 due to: child exit status wrong!\n"); + } + return exit_status; } @@ -318,6 +326,9 @@ process_wait (tid_t child_tid UNUSED) void process_exit (void) { + + printf("(%s) EXIT STATUS: %d\n", thread_name (), thread_current ()->exit_status); + struct thread *cur = thread_current (); uint32_t *pd;