From patchwork Sat Nov 29 07:59:45 2025 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Simon Glass X-Patchwork-Id: 54 Return-Path: X-Original-To: u-boot-concept@u-boot.org Delivered-To: u-boot-concept@u-boot.org DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=u-boot.org; s=default; t=1764403237; bh=KJb/iTQUzKqP/OKP5DleRki4o4Ndcj32zob1Xtqm3as=; h=From:To:Date:CC:Subject:List-Id:List-Archive:List-Help:List-Owner: List-Post:List-Subscribe:List-Unsubscribe:From; b=KhyYi1hhl2vdMYo2eTOYRp/fOu5EC7SLKPFOkymbygkJJIGb3SVVmVQAiSrI5sqXf 9aGa4nje9Cnxe1DIZCo9H7nTxmJDtzxFNUKgTi64KMUhXt71f4ukaLIdp7HhbCtuHd yUiLx3XNDHQBBOYql9BMaDCDDph/qTMDQ84G0efYwtj/Z4Q/vAlhVz8CTyGEwkV0h4 Hguo3lwjv5du4TwbedRfImV3YA3ELVZRaQHNIW0SQvB69x7Ir+BtRL9hxeOMU2Wpu/ CcN5/otR8QTg7AI5NkO9JGo+cfeZd6xtaAzZ74lcYCvd65p4pFvHfkpt3dn7nd8d39 89hJ0Avh+oHAQ== Received: from localhost (localhost [127.0.0.1]) by mail.u-boot.org (Postfix) with ESMTP id 0822F687C8 for ; Sat, 29 Nov 2025 01:00:37 -0700 (MST) X-Virus-Scanned: Debian amavis at Received: from mail.u-boot.org ([127.0.0.1]) by localhost (mail.u-boot.org [127.0.0.1]) (amavis, port 10024) with ESMTP id JyXA5XXbBDwh for ; Sat, 29 Nov 2025 01:00:36 -0700 (MST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=u-boot.org; s=default; t=1764403236; bh=KJb/iTQUzKqP/OKP5DleRki4o4Ndcj32zob1Xtqm3as=; h=From:To:Date:CC:Subject:List-Id:List-Archive:List-Help:List-Owner: List-Post:List-Subscribe:List-Unsubscribe:From; b=IaDYeVfLhW78zDnjKvQP7SiqvzL28LNVWMDImKKGc5iVIgjWoHbdsU3OB8X06d/44 b0qv4Lq2WtHjjCozHJcA9S+Ep0jZywI53jQ6udvF9YSrYUHXmcWO5kTTIuDfZNjCXA k7kL2ZO1eM2rwkfrH2i9iXUCsvRjlLdorkSFx7hcqoxU/hYRDyYMUVSHJbvLxqmSLu yTs2dmX7iZBbQZcYwYtxo6IZ2eJAvnaczEGeE+YueXwnH6oOI6STtza7NCLbEDP5lc c3+UeyLRtnhQPi+NnpfhkIC7AtYX7QMKd4KwcrL9ZPhxQGVI8q6egshZ9cW8R4/Ony inccdyWbmueAg== Received: from mail.u-boot.org (localhost [127.0.0.1]) by mail.u-boot.org (Postfix) with ESMTP id EAD10687BA for ; Sat, 29 Nov 2025 01:00:36 -0700 (MST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=u-boot.org; s=default; t=1764403235; bh=zDo13e798m2GzmB+uLTAXeHC1gr/iP/LIOmz86Dja+c=; h=From:To:Cc:Subject:Date:From; b=Qjnbszn6E2zDjSTpzu2BcZiKKricaAjN+zCOFEV03vWbR1FMzrfM17M+a1Cc7WaSs uOCEBrXY8YCD35mG4Ku4FG0KP53uO5pXnY5iFxzySfa+Bbqj+4n5wcwoPiNX4kvm94 ZRRCqTYb9p9CaBX4NRgM6Z+Tfhaqnk3qjUtdeiRJo7GCIK2xl9bYGtQSfDcOTMsBL8 /4vrM3i4ZirC+JAA6hLAlp6MJNvG/rFV0mfjFnNxj9tE6/Mhls4R5E0kCo5vE7bSWu igLFaGcCwgYV8NjXrWEcQMj3V8eJa2SVW2FGffI5gE0qf8ibkveS9rQH6kzZok/NQP V842gp0KmVjNA== Received: from localhost (localhost [127.0.0.1]) by mail.u-boot.org (Postfix) with ESMTP id 683646876F; Sat, 29 Nov 2025 01:00:35 -0700 (MST) X-Virus-Scanned: Debian amavis at Received: from mail.u-boot.org ([127.0.0.1]) by localhost (mail.u-boot.org [127.0.0.1]) (amavis, port 10026) with ESMTP id zWlLu6l8PhTz; Sat, 29 Nov 2025 01:00:35 -0700 (MST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=u-boot.org; s=default; t=1764403231; bh=r34kDnmL6pQ/y3m1N1LkgEibP57JO2JuSULsn9ErPYg=; h=From:To:Cc:Subject:Date:From; b=L0LTM310+tBOUznQQl6G6NG6xYqGqMJLi8ZSZ8TCsLmWKC5E3ek4jl+rbF0jN1k82 hb8N6qdsCxD3VX4Ha+So3C0QI9py0VnkeeHkIx7nb7Y5Y100h37gUP+/SQD5YiB34F YWkdmR2NAycNz/KieybiFvK0Q8OhI2nR1z/UAhVM+2hU1Szr78aJPVzOim2S+w7srk 4BoCMvIsL+GkISucyaTM9It8kXMPDrDD4A4210u560bI3mVvMbhWTqYoAxXeFhkzPP Mvd1c8ItAmHftzxrg5feL4KxKikFP5JsNB0OktLcCQD27LQNawCxXl2+t2B6SluQU2 YbxbptpIMeL8g== Received: from u-boot.org (unknown [73.34.74.121]) by mail.u-boot.org (Postfix) with ESMTPSA id 302435FFC7; Sat, 29 Nov 2025 01:00:31 -0700 (MST) From: Simon Glass To: U-Boot Concept Date: Sat, 29 Nov 2025 00:59:45 -0700 Message-ID: <20251129080014.758001-1-sjg@u-boot.org> X-Mailer: git-send-email 2.43.0 MIME-Version: 1.0 Message-ID-Hash: QIJC7UWRXJMFLCLLJCVJYF3PY6WMNXKR X-Message-ID-Hash: QIJC7UWRXJMFLCLLJCVJYF3PY6WMNXKR X-MailFrom: sjg@u-boot.org X-Mailman-Rule-Misses: dmarc-mitigation; no-senders; approved; loop; banned-address; emergency; member-moderation; nonmember-moderation; administrivia; implicit-dest; max-recipients; max-size; news-moderation; no-subject; digests; suspicious-header CC: Heinrich Schuchardt , Simon Glass X-Mailman-Version: 3.3.10 Precedence: list Subject: [Concept] [PATCH 00/10] backtrace: Add runtime support for looking at the backtrace List-Id: Discussion and patches related to U-Boot Concept Archived-At: List-Archive: List-Help: List-Owner: List-Post: List-Subscribe: List-Unsubscribe: From: Simon Glass In some cases the backtrace contains useful information, such as whether a particular function was called earlier in the stack. This series provides a very simple backtrace library, along with some sandbox-specific functions to allow it to work. It is designed such that another arch could implement it. A new 'backtrace' command provides access to the backtrace. Simon Glass (10): claude: Tell it about my crosfw script being silent backtrace: Add a library to access the backtrace CI: Disable backtrace for the trace test backtrace: sandbox: Add support for obtaining symbols backtrace: sandbox: Link with libbacktraces backtrace: sandbox: Add -rdynamic to export symbols backtrace: Add a test backtrace: Add a command backtrace: doc: Mention the feature backtrace: Strip the source tree prefix from filenames .gitlab-ci.yml | 2 +- CLAUDE.md | 1 + arch/sandbox/config.mk | 13 +++- arch/sandbox/cpu/Makefile | 7 +- arch/sandbox/cpu/backtrace.c | 122 +++++++++++++++++++++++++++++++++++ arch/sandbox/lib/Makefile | 1 + arch/sandbox/lib/backtrace.c | 71 ++++++++++++++++++++ cmd/Kconfig | 8 +++ cmd/Makefile | 1 + cmd/backtrace.c | 30 +++++++++ configs/sandbox_defconfig | 1 + doc/arch/sandbox/sandbox.rst | 17 +++++ doc/usage/cmd/backtrace.rst | 51 +++++++++++++++ doc/usage/index.rst | 1 + examples/rust/build.rs | 3 + examples/ulib/config.mk | 2 +- include/backtrace.h | 72 +++++++++++++++++++++ include/os.h | 34 ++++++++++ lib/Kconfig | 8 +++ lib/Makefile | 2 + lib/backtrace.c | 55 ++++++++++++++++ test/cmd/Makefile | 1 + test/cmd/backtrace.c | 27 ++++++++ test/lib/Makefile | 1 + test/lib/backtrace.c | 47 ++++++++++++++ 25 files changed, 574 insertions(+), 4 deletions(-) create mode 100644 arch/sandbox/cpu/backtrace.c create mode 100644 arch/sandbox/lib/backtrace.c create mode 100644 cmd/backtrace.c create mode 100644 doc/usage/cmd/backtrace.rst create mode 100644 include/backtrace.h create mode 100644 lib/backtrace.c create mode 100644 test/cmd/backtrace.c create mode 100644 test/lib/backtrace.c