Create a new class to abstract generation and access to call stack backtraces. The current implementation depends on the glibc backtrace() implementation and is copied from the logger. Future development will bring support for libunwind, transparently for the users of the class. The logger backtrace implementation is dropped, replaced by usage of the new Backtrace class. Signed-off-by: Laurent Pinchart <laurent.pinchart@ideasonboard.com> Reviewed-by: Kieran Bingham <kieran.bingham@ideasonboard.com>
35 lines
605 B
C++
35 lines
605 B
C++
/* SPDX-License-Identifier: LGPL-2.1-or-later */
|
|
/*
|
|
* Copyright (C) 2021, Ideas on Board Oy
|
|
*
|
|
* backtrace.h - Call stack backtraces
|
|
*/
|
|
#ifndef __LIBCAMERA_BASE_BACKTRACE_H__
|
|
#define __LIBCAMERA_BASE_BACKTRACE_H__
|
|
|
|
#include <string>
|
|
#include <vector>
|
|
|
|
#include <libcamera/base/private.h>
|
|
|
|
#include <libcamera/base/class.h>
|
|
|
|
namespace libcamera {
|
|
|
|
class Backtrace
|
|
{
|
|
public:
|
|
Backtrace();
|
|
|
|
std::string toString(unsigned int skipLevels = 0) const;
|
|
|
|
private:
|
|
LIBCAMERA_DISABLE_COPY(Backtrace)
|
|
|
|
std::vector<void *> backtrace_;
|
|
};
|
|
|
|
} /* namespace libcamera */
|
|
|
|
#endif /* __LIBCAMERA_BASE_BACKTRACE_H__ */
|