From patchwork Sun Oct 3 22:36:02 2021 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Laurent Pinchart X-Patchwork-Id: 14029 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 E1AC5C3243 for ; Sun, 3 Oct 2021 22:36:18 +0000 (UTC) Received: from lancelot.ideasonboard.com (localhost [IPv6:::1]) by lancelot.ideasonboard.com (Postfix) with ESMTP id D71B9691C5; Mon, 4 Oct 2021 00:36:17 +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="Pq7w01En"; dkim-atps=neutral Received: from perceval.ideasonboard.com (perceval.ideasonboard.com [213.167.242.64]) by lancelot.ideasonboard.com (Postfix) with ESMTPS id D19D6691A3 for ; Mon, 4 Oct 2021 00:36:14 +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 47002A2A for ; Mon, 4 Oct 2021 00:36:14 +0200 (CEST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=ideasonboard.com; s=mail; t=1633300574; bh=d/gdooZVxOD8zhka53RlTdtP30bihU76kBaKh5L4VBg=; h=From:To:Subject:Date:From; b=Pq7w01EnHJ/ajWVyZamB/wbNKs70/0+C7AyakLo7oEDyB4bmyiMTMlLQWatpUn//g In64JnBz6/aKRRnGxewLR2PsPe/oIls2h/sjLS9p68oCRrXuYcJq9LX41rOQGh6fDX PmOAWbE2X3P4LBziE6GzB1Iz8TMhBJfwLXhN8/aU= From: Laurent Pinchart To: libcamera-devel@lists.libcamera.org Date: Mon, 4 Oct 2021 01:36:02 +0300 Message-Id: <20211003223606.20016-1-laurent.pinchart@ideasonboard.com> X-Mailer: git-send-email 2.32.0 MIME-Version: 1.0 Subject: [libcamera-devel] [PATCH v2 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. Changes compared to v1 are minor and listed in individual changelogs. 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 | 323 +++++++++++++++++++++++++++++ src/libcamera/base/log.cpp | 27 +-- src/libcamera/base/meson.build | 18 ++ 6 files changed, 388 insertions(+), 23 deletions(-) create mode 100644 include/libcamera/base/backtrace.h create mode 100644 src/libcamera/base/backtrace.cpp base-commit: d79b41200199e03834578f5120bb8375bad37aec