0
0
Fork 0
mirror of https://github.com/matrix-construct/construct synced 2024-09-30 20:58:51 +02:00
construct/include/ircd/backtrace.h

46 lines
969 B
C
Raw Normal View History

2019-09-20 07:02:57 +02:00
// Matrix Construct
//
// Copyright (C) Matrix Construct Developers, Authors & Contributors
// Copyright (C) 2016-2019 Jason Volk <jason@zemos.net>
//
// Permission to use, copy, modify, and/or distribute this software for any
// purpose with or without fee is hereby granted, provided that the above
// copyright notice and this permission notice is present in all copies. The
// full license for this software is available in the LICENSE file.
#pragma once
#define HAVE_IRCD_BACKTRACE_H
namespace ircd
{
struct backtrace;
}
struct ircd::backtrace
{
2020-05-02 22:39:39 +02:00
const void **array;
2019-09-20 07:02:57 +02:00
size_t count;
public:
2020-05-02 22:39:39 +02:00
const void *operator[](const size_t &) const;
2019-09-20 07:02:57 +02:00
const size_t &size() const;
2020-05-02 22:39:39 +02:00
backtrace(const void **const &, const size_t &);
2019-09-20 07:02:57 +02:00
backtrace(const mutable_buffer &);
backtrace();
};
2020-05-02 22:39:39 +02:00
inline const void *
2019-09-20 07:02:57 +02:00
ircd::backtrace::operator[](const size_t &i)
const
{
return i < count? array[i] : nullptr;
}
inline const size_t &
ircd::backtrace::size()
const
{
return count;
}