From: Ben Pfaff Date: Mon, 4 Oct 2004 00:07:39 +0000 (+0000) Subject: Explain why `break schedule' might not work and offer workarounds. X-Git-Url: https://pintos-os.org/cgi-bin/gitweb.cgi?a=commitdiff_plain;h=60a1a1711ca8e81e59f2e6531ed27a80c1b1d072;p=pintos-anon Explain why `break schedule' might not work and offer workarounds. --- diff --git a/doc/threads.texi b/doc/threads.texi index 63aed69..f219db4 100644 --- a/doc/threads.texi +++ b/doc/threads.texi @@ -73,15 +73,21 @@ thread we're switching to. Using the @command{gdb} debugger, slowly trace through a context switch to see what happens (@pxref{i386-elf-gdb}). You can set a breakpoint on the @func{schedule} function to start out, and then -single-step from there. Be sure to keep track of each thread's -address and state, and what procedures are on the call stack for each -thread. You will notice that when one thread calls -@func{switch_threads}, another thread starts running, and the first -thing the new thread does is to return from -@func{switch_threads}. We realize this comment will seem cryptic to -you at this point, but you will understand threads once you understand -why the @func{switch_threads} that gets called is different from the -@func{switch_threads} that returns. +single-step from there.@footnote{@command{gdb} might tell you that +@func{schedule} doesn't exist, which is arguably a @command{gdb} bug. +You can work around this by setting the breakpoint by filename and +line number, e.g.@: @code{break thread.c:@var{ln}} where @var{ln} is +the line number of the first declaration in @func{schedule}. +Alternatively you can recompile with optimization turned off, by +removing @samp{-O3} from the @code{CFLAGS} line in +@file{Make.config}.} Be sure to keep track of each thread's address +and state, and what procedures are on the call stack for each thread. +You will notice that when one thread calls @func{switch_threads}, +another thread starts running, and the first thing the new thread does +is to return from @func{switch_threads}. We realize this comment will +seem cryptic to you at this point, but you will understand threads +once you understand why the @func{switch_threads} that gets called is +different from the @func{switch_threads} that returns. @strong{Warning}: In Pintos, each thread is assigned a small, fixed-size execution stack just under @w{4 kB} in size. The kernel