mirror of
https://git.libcamera.org/libcamera/libcamera.git
synced 2025-07-23 16:45:07 +03:00
libcamera: base: Add Backtrace class
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>
This commit is contained in:
parent
ca5fb99409
commit
bae9d2bdb3
6 changed files with 155 additions and 23 deletions
34
include/libcamera/base/backtrace.h
Normal file
34
include/libcamera/base/backtrace.h
Normal file
|
@ -0,0 +1,34 @@
|
|||
/* 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__ */
|
|
@ -3,6 +3,7 @@
|
|||
libcamera_base_include_dir = libcamera_include_dir / 'base'
|
||||
|
||||
libcamera_base_headers = files([
|
||||
'backtrace.h',
|
||||
'bound_method.h',
|
||||
'class.h',
|
||||
'event_dispatcher.h',
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue