X-Git-Url: https://pintos-os.org/cgi-bin/gitweb.cgi?a=blobdiff_plain;f=doc%2Fdebug.texi;h=82f001ffbe91ffbdb2dedc912c4c08f202ba6059;hb=60a1a1711ca8e81e59f2e6531ed27a80c1b1d072;hp=68318fdc855f03638206a1150089fbd59bf045c8;hpb=01679e7fec5244d137cc9b2cfc2d72e946c4d9d2;p=pintos-anon diff --git a/doc/debug.texi b/doc/debug.texi index 68318fd..82f001f 100644 --- a/doc/debug.texi +++ b/doc/debug.texi @@ -8,6 +8,7 @@ introduces you to a few of them. * printf:: * ASSERT:: * DEBUG:: +* UNUSED NO_RETURN NO_INLINE PRINTF_FORMAT:: * Backtraces:: * i386-elf-gdb:: * Modifying Bochs:: @@ -15,7 +16,7 @@ introduces you to a few of them. @end menu @node printf -@section @func{printf} +@section @code{@code{printf()}} Don't underestimate the value of @func{printf}. The way @func{printf} is implemented in Pintos, you can call it from @@ -39,7 +40,7 @@ Eventually you can narrow the problem down to a single statement. Assertions are useful because they can catch problems early, before they'd otherwise be notices. Pintos provides a macro for assertions -named @code{ASSERT}, defined in @code{}, that you can use for +named @code{ASSERT}, defined in @file{}, that you can use for this purpose. Ideally, each function should begin with a set of assertions that check its arguments for validity. (Initializers for functions' local variables are evaluated before assertions are @@ -54,7 +55,7 @@ backtraces below for more information. @node DEBUG @section @code{DEBUG} -The @code{DEBUG} macro, also defined in @code{}, is a sort of +The @code{DEBUG} macro, also defined in @file{}, is a sort of conditional @func{printf}. It takes as its arguments the name of a ``message class'' and a @func{printf}-like format string and arguments. The message class is used to filter the messages that are @@ -76,6 +77,39 @@ a command line like this: pintos run -d thread @end example +@node UNUSED NO_RETURN NO_INLINE PRINTF_FORMAT +@section UNUSED, NO_RETURN, NO_INLINE, and PRINTF_FORMAT + +These macros defined in @file{} tell the compiler special +attributes of a function or function parameter. Their expansions are +GCC-specific. + +@defmac UNUSED +Appended to a function parameter to tell the compiler that the +parameter might not be used within the function. It suppresses the +warning that would otherwise appear. +@end defmac + +@defmac NO_RETURN +Appended to a function prototype to tell the compiler that the +function never returns. It allows the compiler to fine-tune its +warnings and its code generation. +@end defmac + +@defmac NO_INLINE +Appended to a function prototype to tell the compiler to never emit +the function in-line. Occasionally useful to improve the quality of +backtraces (see below). +@end defmac + +@defmac PRINTF_FORMAT (@var{format}, @var{first}) +Appended to a function prototype to tell the compiler that the +function takes a @func{printf}-like format string as its +@var{format}th argument and that the corresponding value arguments +start at the @var{first}th argument. This lets the compiler tell you +if you pass the wrong argument types. +@end defmac + @node Backtraces @section Backtraces