[Concept,00/10] backtrace: Add runtime support for looking at the backtrace

Message ID 20251129080014.758001-1-sjg@u-boot.org
Headers
Series backtrace: Add runtime support for looking at the backtrace |

Message

Simon Glass Nov. 29, 2025, 7:59 a.m. UTC
  From: Simon Glass <simon.glass@canonical.com>

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