From patchwork Mon Sep 26 15:25:14 2022 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Kieran Bingham X-Patchwork-Id: 17410 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 5B38CC0DA4 for ; Mon, 26 Sep 2022 15:25:21 +0000 (UTC) Received: from lancelot.ideasonboard.com (localhost [IPv6:::1]) by lancelot.ideasonboard.com (Postfix) with ESMTP id 98BC76225F; Mon, 26 Sep 2022 17:25:20 +0200 (CEST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=libcamera.org; s=mail; t=1664205920; bh=q4UZ/66y9SClKskwselCl6QxfNr6+If51Aw4PS/tLHc=; h=To:Date:Subject:List-Id:List-Unsubscribe:List-Archive:List-Post: List-Help:List-Subscribe:From:Reply-To:From; b=TfVzemmBtm/VHIrqslbPgMlU42/3xURRou1c1WnLthW6QcEJ4xLdWiXto3VkjNWeB einzNYzmYdhk87EqZza3yBuF7hK5F68lj7pvOWwlR7t4qBCs6z3S+V39wZHfNjVV6C F/zM3wqCq4mbj5psKbgcui2majBUznpKBpOYx5U3kCfkwP+kyFi0OnKRgv1slrOzJ/ ECIvWY0GqJ+e2j4RxolDIrvvpX9+59ImeteNoZxl8Sr7+i+TIjf8LeRw1c0S0mTV3Z UAESQoOcMTg20DlZ1N4Xisox4Uzg59JTm+azxHPSRkUizaFE/PPRIDL31KLV0bcesA A2uQTRHgLHSbw== 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 1640A62254 for ; Mon, 26 Sep 2022 17:25:19 +0200 (CEST) Authentication-Results: lancelot.ideasonboard.com; dkim=pass (1024-bit key; unprotected) header.d=ideasonboard.com header.i=@ideasonboard.com header.b="fqtW7eMj"; dkim-atps=neutral Received: from Monstersaurus.local (cpc89244-aztw30-2-0-cust3082.18-1.cable.virginm.net [86.31.172.11]) by perceval.ideasonboard.com (Postfix) with ESMTPSA id 8D11E107; Mon, 26 Sep 2022 17:25:18 +0200 (CEST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=ideasonboard.com; s=mail; t=1664205918; bh=q4UZ/66y9SClKskwselCl6QxfNr6+If51Aw4PS/tLHc=; h=From:To:Cc:Subject:Date:From; b=fqtW7eMjAjTDyWgM6+O/Ub9IfIc+WzmEQ6eZYZAV6AmTazEpNNp9NFGNFFL6kXp6o +HEjXJ2vL3FoK0JklpO+V2X3mgpKPrGewpbRvPdC3OtpQ3hvL9qoygpRqXYcxK79HC uNnUKZiL9tU7cQ9S523gvoaIRiSAxQV8Me1hhKAA= To: libcamera devel Date: Mon, 26 Sep 2022 16:25:14 +0100 Message-Id: <20220926152514.479598-1-kieran.bingham@ideasonboard.com> X-Mailer: git-send-email 2.34.1 MIME-Version: 1.0 Subject: [libcamera-devel] [PATCH] utils: Provide lcdebug helper script 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: , X-Patchwork-Original-From: Kieran Bingham via libcamera-devel From: Kieran Bingham Reply-To: Kieran Bingham Errors-To: libcamera-devel-bounces@lists.libcamera.org Sender: "libcamera-devel" Provide a utility script to make it easy to debug issues using libcamera. The lcdebug can be prefixed to enable the libcamera debug levels by default, while still allow customising them. It makes it easy to identify the available debug levels from a libcamera source tree with the -h/--help option. Finally, it facilitates stracing ioctls to see what operations are performed during the running of a libcamera based application to highlight kernel interactions and calls. Signed-off-by: Kieran Bingham --- Example usage: ./utils/lcdebug -s qcam -c1 -s pixelformat=RGB565 To help debugging pixel format selection issues. This could be extended with a '-g' in the future to wrap with GDB too? utils/lcdebug | 45 +++++++++++++++++++++++++++++++++++++++++++++ 1 file changed, 45 insertions(+) create mode 100755 utils/lcdebug diff --git a/utils/lcdebug b/utils/lcdebug new file mode 100755 index 000000000000..5477dba4cbe0 --- /dev/null +++ b/utils/lcdebug @@ -0,0 +1,45 @@ +#!/bin/bash + +# SPDX-License-Identifier: GPL-2.0-or-later +# Support debugging libcamera commands and applications. + +# We default to enabling the most debug +# (that's why we're being used right) + +FILTER="*" +LEVEL="0" +STRACE="" + +while [[ $# -gt 0 ]] +do +case $1 in + -x) + set -x; + shift; + ;; + -s|--strace) + STRACE="strace -e ioctl -f --" + shift; + ;; + -f|--filter) + FILTER="$2"; + shift; shift; + ;; + -l|--level) + LEVEL="$2"; + shift; shift; + ;; + -h|--help) + echo "The following filters are available:" + git grep "^LOG_DEFINE_CATEGORY" | \ + awk -F '[()]' '{print $2}' | \ + sort + exit + ;; + *|--) # unknown option, The rest belongs to the command + break; + ;; +esac +done + +LIBCAMERA_LOG_LEVELS=$FILTER:$LEVEL $STRACE "${@}"