Skip to content

ctrace: define instruction trace design and correct OpenCSD Thumb-16 reads - #2698

Draft
thorstendb-ARM wants to merge 7 commits into
mainfrom
feat/ctrace-instruction-trace
Draft

thorstendb-ARM wants to merge 7 commits into
mainfrom
feat/ctrace-instruction-trace

Conversation

@thorstendb-ARM

@thorstendb-ARM thorstendb-ARM commented Nov 10, 2026 •

Copy link
Copy Markdown
Contributor

Changes

OpenCSD 1.8.3 rejects complete Thumb-16 instructions when fewer than four image bytes remain. Apply a separate patch for ETMv3, ETMv4 and PTM, with automatic CMake integration and boundary regressions.

The instruction trace implementation spec defines M4/M7 configuration, CSV output, completion and acceptance criteria. The OpenCSD issue notes describe decoder defects and reproduction evidence; the third-party notices document the applied patches. Production ctrace ETM integration remains pending.

Validation

macOS arm64 Release: all 21 boundary regressions and all seven ctrace CTest entries pass. Eight valid Thumb-16 cases fail before the patch; repeated CMake configuration preserves both patches.

Checklist

  • Unit tests added and passing.
  • Manual validation: host reproductions and patch-application checks.
  • Security impacts considered; incomplete instructions remain rejected.
  • Documentation updated.
  • Third-party notices updated; dependency pin unchanged.

@github-actions

github-actions Bot commented Nov 10, 2026 •

Copy link
Copy Markdown

Test Results

    6 files     12 suites   16s ⏱️
  584 tests   584 ✅  0 💤 0 ❌
1 752 runs  1 734 ✅ 18 💤 0 ❌

Results for commit a5e008c.

♻️ This comment has been updated with latest results.

@codecov

codecov Bot commented Nov 10, 2026

Copy link
Copy Markdown

Codecov Report

✅ All modified and coverable lines are covered by tests.
✅ Project coverage is 87.45%. Comparing base (839502c) to head (a5e008c).

Additional details and impacted files
@@            Coverage Diff             @@
##             main    #2698      +/-   ##
==========================================
- Coverage   87.53%   87.45%   -0.08%     
==========================================
  Files         208      208              
  Lines       33657    33552     -105     
==========================================
- Hits        29462    29344     -118     
- Misses       4195     4208      +13     
Flag Coverage Δ
ctrace-cov 100.00% <ø> (ø)

Flags with carried forward coverage won't be shown. Click here to find out more.
see 4 files with indirect coverage changes

🚀 New features to boost your workflow:
  • ❄️ Test Analytics: Detect flaky tests, report on failures, and find test suite problems.

Copilot AI left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

🔵 Needs a closer look

Trace-domain owner review is needed to validate the cancellation, EOT, and hardware acceptance contracts against reference artifacts unavailable in this repository.

No open issues 🎉

What changed in this PR

This PR prepares ctrace for future instruction-trace support by defining its implementation contract and fixing OpenCSD’s rejection of complete Thumb-16 instructions at image boundaries. Production ctrace ETM integration remains pending.

Changes:

  • Adds an independently applied OpenCSD patch for short instruction reads in ETMv3, ETMv4 and PTM, while preserving rejection of incomplete instructions.
  • Adds 21 boundary regression tests covering Thumb instructions and fixed-width instruction controls.
  • Documents M4/M7 configuration, CSV output, completion behavior, acceptance criteria and remaining decoder limitations.
File Description
tools/​ctrace/​test/​unit/​src/​decode/​OpenCsdInstructionBoundaryTests.cpp Adds instruction-boundary regression coverage.
tools/​ctrace/​test/​unit/​CMakeLists.txt Registers the new regression test source.
tools/​ctrace/​docs/​THIRD_PARTY_NOTICES.md Documents both local OpenCSD patches.
tools/​ctrace/​docs/​opencsd-issues.md Records decoder defects, reproduction evidence and patch validation.
tools/​ctrace/​docs/​instruction-trace-design.md Defines the instruction-trace implementation contract and qualification gates.
tools/​ctrace/​cmake/​dependencies/​OpenCSD-thumb-fetch.patch Allows complete Thumb-16 instructions after short memory reads.
tools/​ctrace/​cmake/​dependencies/​ConfigureOpenCSD.cmake Applies each OpenCSD patch independently during configuration.

Review effort: Balanced

This branch has not been deployed

No deployments
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

3 participants