PKUOS - Pintos
Pintos source browser for PKU Operating System course
debug.c
Go to the documentation of this file.
1#include <debug.h>
2#include <stdarg.h>
3#include <stdbool.h>
4#include <stdio.h>
5#include <syscall.h>
6
7/** Aborts the user program, printing the source file name, line
8 number, and function name, plus a user-specific message. */
9void
10debug_panic (const char *file, int line, const char *function,
11 const char *message, ...)
12{
13 va_list args;
14
15 printf ("User process ABORT at %s:%d in %s(): ", file, line, function);
16
17 va_start (args, message);
18 vprintf (message, args);
19 printf ("\n");
20 va_end (args);
21
23
24 exit (1);
25}
void debug_backtrace(void)
Prints the call stack, that is, a list of addresses, one in each of the functions we are nested withi...
Definition: debug.c:13
int vprintf(const char *format, va_list args)
The standard vprintf() function, which is like printf() but uses a va_list.
Definition: console.c:126
void debug_panic(const char *file, int line, const char *function, const char *message,...)
Halts the OS, printing the source file name, line number, and function name, plus a user-specific mes...
Definition: debug.c:19
int printf(const char *format,...)
Writes formatted output to the console.
Definition: stdio.c:79
void exit(int status)
Definition: syscall.c:72
#define va_end(LIST)
Definition: stdarg.h:10
#define va_start(LIST, ARG)
Definition: stdarg.h:9
__builtin_va_list va_list
GCC has <stdarg.h> functionality as built-ins, so all we need is to use it.
Definition: stdarg.h:7
An open file.
Definition: file.c:8