From patchwork Fri Sep 24 10:23:19 2021 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Laurent Pinchart X-Patchwork-Id: 13919 Return-Path: X-Original-To: parsemail@patchwork.libcamera.org Delivered-To: parsemail@patchwork.libcamera.org Received: from lancelot.ideasonboard.com (lancelot.ideasonboard.com [92.243.16.209]) by patchwork.libcamera.org (Postfix) with ESMTPS id AE871BDC71 for ; Fri, 24 Sep 2021 10:23:32 +0000 (UTC) Received: from lancelot.ideasonboard.com (localhost [IPv6:::1]) by lancelot.ideasonboard.com (Postfix) with ESMTP id D56F069193; Fri, 24 Sep 2021 12:23:31 +0200 (CEST) Authentication-Results: lancelot.ideasonboard.com; dkim=fail reason="signature verification failed" (1024-bit key; unprotected) header.d=ideasonboard.com header.i=@ideasonboard.com header.b="W5NSPFen"; dkim-atps=neutral Received: from perceval.ideasonboard.com (perceval.ideasonboard.com [IPv6:2001:4b98:dc2:55:216:3eff:fef7:d647]) by lancelot.ideasonboard.com (Postfix) with ESMTPS id 27901687DD for ; Fri, 24 Sep 2021 12:23:30 +0200 (CEST) Received: from pendragon.lan (62-78-145-57.bb.dnainternet.fi [62.78.145.57]) by perceval.ideasonboard.com (Postfix) with ESMTPSA id A550C45E for ; Fri, 24 Sep 2021 12:23:29 +0200 (CEST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=ideasonboard.com; s=mail; t=1632479009; bh=iBUElzB6bzNtsj6Nf8RYjdNIvZSJU4MXXgu3/s1FCcs=; h=From:To:Subject:Date:From; b=W5NSPFenxFOV+6B/TRWtprK5KTAWap/hEL2RWPIo39sudJ+fDK+30hugTT3uvrccW 868AoqHcI0QClxpdDpA5hakZqxyJn7gneXR0UJs8E+K+PzdORwNsrZ/kacIQeNcUHl wVQll5DJjpBFdJ8E+AkkkjwMiSftG+bfcw1+TkRU= From: Laurent Pinchart To: libcamera-devel@lists.libcamera.org Date: Fri, 24 Sep 2021 13:23:19 +0300 Message-Id: <20210924102323.26787-1-laurent.pinchart@ideasonboard.com> X-Mailer: git-send-email 2.32.0 MIME-Version: 1.0 Subject: [libcamera-devel] [PATCH v1 0/4] libcamera: Improve backtraces X-BeenThere: libcamera-devel@lists.libcamera.org X-Mailman-Version: 2.1.29 Precedence: list List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Errors-To: libcamera-devel-bounces@lists.libcamera.org Sender: "libcamera-devel" 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