Tor 0.4.9.8
Loading...
Searching...
No Matches
util_bug.c File Reference
#include "orconfig.h"
#include "lib/log/util_bug.h"
#include "lib/log/log.h"
#include "lib/err/backtrace.h"
#include "lib/err/torerr.h"
#include "lib/malloc/malloc.h"
#include "lib/string/printf.h"
#include "lib/thread/threads.h"
#include <string.h>
#include <stdlib.h>

Go to the source code of this file.

Macros

#define capturing_bugs()
 
#define add_captured_bug(s)
 

Functions

void tor_assertion_failed_ (const char *fname, unsigned int line, const char *func, const char *expr, const char *fmt,...)
 
void tor_bug_init_counter (void)
 
void tor_bug_increment_count_ (void)
 
size_t tor_bug_get_count (void)
 
void tor_bug_occurred_ (const char *fname, unsigned int line, const char *func, const char *expr, int once, const char *fmt,...)
 
void tor_abort_ (void)
 

Variables

static atomic_counter_t total_bug_reached
 

Macro Definition Documentation

◆ add_captured_bug

#define add_captured_bug ( s)
Value:
do { } while (0)

Definition at line 70 of file util_bug.c.

◆ capturing_bugs

#define capturing_bugs ( )
Value:
(0)

Definition at line 69 of file util_bug.c.

Function Documentation

◆ tor_abort_()

void tor_abort_ ( void )

Call the tor_raw_abort_() function to close raw logs, then kill the current process with a fatal error. But first, close the file-based log file descriptors, so error messages are written before process termination.

(This is a separate function so that we declare it in util_bug.h without including torerr.h in all the users of util_bug.h)

Definition at line 198 of file util_bug.c.

◆ tor_assertion_failed_()

void tor_assertion_failed_ ( const char * fname,
unsigned int line,
const char * func,
const char * expr,
const char * fmt,
... )

Helper for tor_assert: report the assertion failure.

Definition at line 75 of file util_bug.c.

◆ tor_bug_get_count()

size_t tor_bug_get_count ( void )

Definition at line 121 of file util_bug.c.

◆ tor_bug_increment_count_()

void tor_bug_increment_count_ ( void )

Helper to update BUG count in metrics.

Definition at line 115 of file util_bug.c.

Referenced by log_fn_(), and tor_bug_occurred_().

◆ tor_bug_init_counter()

void tor_bug_init_counter ( void )

Definition at line 108 of file util_bug.c.

◆ tor_bug_occurred_()

void tor_bug_occurred_ ( const char * fname,
unsigned int line,
const char * func,
const char * expr,
int once,
const char * fmt,
... )

Helper for tor_assert_nonfatal: report the assertion failure.

Definition at line 128 of file util_bug.c.

Variable Documentation

◆ total_bug_reached

atomic_counter_t total_bug_reached
static

Definition at line 105 of file util_bug.c.