PKUOS - Pintos
Pintos source browser for PKU Operating System course
Functions
debug.c File Reference
#include <debug.h>
#include <console.h>
#include <stdarg.h>
#include <stdbool.h>
#include <stddef.h>
#include <stdio.h>
#include <string.h>
#include "threads/init.h"
#include "threads/interrupt.h"
#include "threads/thread.h"
#include "threads/switch.h"
#include "threads/vaddr.h"
#include "devices/serial.h"
#include "devices/shutdown.h"
Include dependency graph for debug.c:

Go to the source code of this file.

Functions

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 message. More...
 
static void print_stacktrace (struct thread *t, void *aux UNUSED)
 Print call stack of a thread. More...
 
void debug_backtrace_all (void)
 Prints call stack of all threads. More...
 

Function Documentation

◆ debug_backtrace_all()

void debug_backtrace_all ( void  )

Prints call stack of all threads.

Definition at line 117 of file debug.c.

References intr_disable(), intr_set_level(), print_stacktrace(), and thread_foreach().

Here is the call graph for this function:

◆ debug_panic()

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 message.

Definition at line 19 of file debug.c.

References console_panic(), debug_backtrace(), intr_disable(), printf(), serial_flush(), shutdown(), va_end, va_start, and vprintf().

Here is the call graph for this function:

◆ print_stacktrace()

static void print_stacktrace ( struct thread t,
void *aux  UNUSED 
)
static

Print call stack of a thread.

The thread may be running, ready, or blocked.

Definition at line 56 of file debug.c.

References switch_threads_frame::ebp, switch_threads_frame::eip, thread::name, NULL, PGSIZE, printf(), thread::stack, thread::status, switch_entry(), THREAD_BLOCKED, thread_current(), THREAD_READY, and THREAD_RUNNING.

Referenced by debug_backtrace_all().

Here is the call graph for this function:
Here is the caller graph for this function: