Alien-libpanda

 view release on metacpan or  search on metacpan

src/panda/exception.cc  view on Meta::CPAN

#include "exception.h"
#include <cstring>
#include <memory>
#include <functional>

#if defined(__unix__)
  #include <execinfo.h>
#endif

namespace panda {


BacktraceInfo::~BacktraceInfo() {};

static BacktraceProducer* producer = nullptr;

void Backtrace::install_producer(BacktraceProducer& producer_) {
    producer = &producer_;
}

Backtrace::Backtrace (const Backtrace& other) noexcept : buffer(other.buffer) {}
	
#if defined(__unix__)

Backtrace::Backtrace () noexcept {
    buffer.resize(max_depth);
    auto depth = ::backtrace(buffer.data(), max_depth);
    buffer.resize(depth);
}

#else

Backtrace::Backtrace () noexcept {}

t/exception.cc  view on Meta::CPAN

#include "test.h"
#include <panda/exception.h>
#include <panda/from_chars.h>
#include <regex>
#include <cxxabi.h>
#include <iostream>

#if defined(__unix__)
#include <execinfo.h>

using namespace panda;

iptr<BacktraceInfo> glib_produce(const RawTrace& buffer);
static BacktraceProducer glib_producer(glib_produce);

static bool _init() {
    Backtrace::install_producer(glib_producer);
    return true;



( run in 0.669 second using v1.01-cache-2.11-cpan-39bf76dae61 )