ATLAS Offline Software
Loading...
Searching...
No Matches
exctrace_collector.cxx File Reference

Generate stack trace backs from a caught exception — collector module. More...

#include <dlfcn.h>
#include <execinfo.h>
#include <cstdio>
#include <typeinfo>
#include <utility>
#include <algorithm>
#include <exception>
#include "CxxUtils/checker_macros.h"
Include dependency graph for exctrace_collector.cxx:

Go to the source code of this file.

Classes

struct  CxxUtils::extrace_init

Namespaces

namespace  CxxUtils

Typedefs

typedef void throwfn(void *, void *, void(*dest) (void *))

Functions

void extrace_force_libstd_link ()
int exctrace_get_last_trace (int max_depth, void *trace[])
void __cxa_throw (void *thrown_exception, void *tinfo, void(*dest)(void *))

Variables

static const int bt_depth = 100
static thread_local int exctrace_last_depth = 0
static thread_local void * exctrace_last_trace [bt_depth]
static throwfnold_throw
static extrace_init CxxUtils::initer

Detailed Description

Generate stack trace backs from a caught exception — collector module.

Author
scott snyder snyde.nosp@m.r@bn.nosp@m.l.gov
Date
Oct, 2009

When preloaded, this module hooks into the __cxa_throw function used by the abi to throw exceptions so that it records stack back traces in static variables. These can later be accessed with CxxUtils::exctrace.

Definition in file exctrace_collector.cxx.

Typedef Documentation

◆ throwfn

typedef void throwfn(void *, void *, void(*dest)(void *))

Definition at line 36 of file exctrace_collector.cxx.

Function Documentation

◆ __cxa_throw()

void __cxa_throw ( void * thrown_exception,
void * tinfo,
void(* dest )(void *) )

Definition at line 63 of file exctrace_collector.cxx.

66{
68 old_throw (thrown_exception, tinfo, dest);
69 // not reached
70 std::abort();
71}
static thread_local void * exctrace_last_trace[bt_depth]
static const int bt_depth
static thread_local int exctrace_last_depth
static throwfn * old_throw
list backtrace
Definition check_log.py:58

◆ exctrace_get_last_trace()

int exctrace_get_last_trace ( int max_depth,
void * trace[] )

Definition at line 52 of file exctrace_collector.cxx.

53 {
54 int ncopy = std::min (exctrace_last_depth, max_depth);
55 std::copy (exctrace_last_trace, exctrace_last_trace+ncopy, trace);
56 return ncopy;
57 }

◆ extrace_force_libstd_link()

void extrace_force_libstd_link ( )

Definition at line 43 of file exctrace_collector.cxx.

44{
45 std::terminate();
46}

Variable Documentation

◆ bt_depth

const int bt_depth = 100
static

Definition at line 29 of file exctrace_collector.cxx.

◆ exctrace_last_depth

thread_local int exctrace_last_depth = 0
static

Definition at line 32 of file exctrace_collector.cxx.

◆ exctrace_last_trace

thread_local void* exctrace_last_trace[bt_depth]
static

Definition at line 33 of file exctrace_collector.cxx.

◆ old_throw

throwfn* old_throw
static

Definition at line 37 of file exctrace_collector.cxx.