[libcamera-devel] [PATCH v1 0/4] libcamera: Improve backtraces
Laurent Pinchart
laurent.pinchart at ideasonboard.com
Fri Sep 24 12:23:19 CEST 2021
Hello,
This patch series improves backtrace generation. It stems from an effort
to implement a FileDescriptor leak tracker, and I'm posting it
separately because it's useful on its own.
Patch 1/4 extracts the backtrace generation code from the logger to a
new Backtrace class. The class allows capturing a backtrace (in a way
that is as lightweight as possible), and later formatting it in a
human-readable form (which can be more expensive). Backtrace instances
can thus be created relatively frequently and stored for possible later
usage.
Patches 2/4 to 4/4 then improve the Backtrace class to use libdw and/or
libunwind when available. libunwind provides both backtrace capture and
backtrace formatting capabilities, while libdw provides the latter only,
but with support for more detailed information. In both cases C++ symbol
names can now be demangled.
libdw and libunwind are optional dependencies, they will be used
automatically if found.
Laurent Pinchart (4):
libcamera: base: Add Backtrace class
libcamera: base: backtrace: Use libdw to provide symbolic names
libcamera: base: backtrace: Use libunwind when available
libcamera: base: backtrace: Fallback to libunwind for symbolic names
include/libcamera/base/backtrace.h | 38 ++++
include/libcamera/base/meson.build | 1 +
meson.build | 4 -
src/libcamera/base/backtrace.cpp | 317 +++++++++++++++++++++++++++++
src/libcamera/base/log.cpp | 25 +--
src/libcamera/base/meson.build | 18 ++
6 files changed, 380 insertions(+), 23 deletions(-)
create mode 100644 include/libcamera/base/backtrace.h
create mode 100644 src/libcamera/base/backtrace.cpp
base-commit: 6942fb11cc01ad7d5484b52963d15861d6ca4f2a
--
Regards,
Laurent Pinchart
More information about the libcamera-devel
mailing list