Skip to content

ctrace initial development - #2548

Open
thorstendb-ARM wants to merge 21 commits into
mainfrom
ctrace-dev1
Open

ctrace initial development#2548
thorstendb-ARM wants to merge 21 commits into
mainfrom
ctrace-dev1

Conversation

@thorstendb-ARM

Copy link
Copy Markdown
Contributor

Implements

  • Adds the initial ctrace implementation for decoding SWO streams containing ITM and DWT data.
  • Provides CSV and CTF/Trace Compass output.
  • Includes unit and integration tests, documentation, and cross-platform build and release support.

Limitations

  • Trace Bus input, PMU events, event counters, and PC sampling are not supported in the initial release.

Checklist

  • 🤖 This change is covered by unit tests (if applicable).
  • 🤹 Manual testing has been performed (if necessary).
  • 🛡️ Security impacts have been considered (if relevant).
  • 📖 Documentation updates are complete (if required).
  • 🧠 Third-party dependencies and TPIP updated (if required).

@github-actions

github-actions Bot commented Jul 30, 2026

Copy link
Copy Markdown

Test Results

  2 files   -    39   14 suites   - 111   14m 54s ⏱️ - 2m 22s
477 tests  -   454  477 ✅  - 437  0 💤  - 17  0 ❌ ±0 
954 runs   - 1 047  954 ✅  - 996  0 💤  - 51  0 ❌ ±0 

Results for commit 52e772f. ± Comparison against base commit 37a8a8e.

This pull request removes 454 tests.
AuxCmdTests ‑ MkdirCmdTest
AuxCmdTests ‑ RmdirCmdTest
AuxCmdTests ‑ TouchCmdTest
BuildSystemGeneratorTests ‑ GenAuditFile
BuildSystemGeneratorTests ‑ GenAuditFile_WithOut_Existing_Audit_File
BuildSystemGeneratorTests ‑ GenAuditFile_With_Existing_Audit_File
BuildSystemGeneratorTests ‑ GetString
BuildSystemGeneratorTests ‑ StrConv
BuildSystemGeneratorTests ‑ StrNorm
CBuildGCCTests ‑ Asm
…

♻️ This comment has been updated with latest results.

Comment thread tools/ctrace/src/decode/OpenCsdErrorController.cpp Fixed
Comment thread tools/ctrace/src/output/OutputRequirements.cpp Fixed
Comment thread tools/ctrace/src/output/ctf/CtfMetadataWriter.cpp Fixed
Comment thread tools/ctrace/src/output/ctf/TraceCompassXmlWriter.cpp Fixed
Comment thread tools/ctrace/src/tracerun/YmlTraceRunConfigReader.cpp Fixed
Comment thread tools/ctrace/test/unit/src/cli/CliParserTests.cpp Fixed
Comment thread tools/ctrace/test/unit/src/output/OutputRequirementsTests.cpp Fixed
Comment thread tools/ctrace/test/unit/src/decode/OpenCsdPacketCollectorTests.cpp Fixed

@thorstendb-ARM thorstendb-ARM left a comment

Copy link
Copy Markdown
Contributor Author

Choose a reason for hiding this comment

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

Added unit tests

@jreineckearm jreineckearm left a comment

Copy link
Copy Markdown

Choose a reason for hiding this comment

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

Just had a look at the first few files in this PR (the GH workflows). You may want to review those first. I think some of them will impact more than ctrace.
Also, why do you make workflows sensitive to changes in subfolders of external? I don't think GitHub actions are clever enough to detect changes in git submodules. But I might be wrong.

Comment thread .github/workflows/ctrace.yml Outdated
- '.github/matrix_includes_ctrace.json'
- 'cmake/**'
- 'CMakeLists.txt'
- 'external/OpenCSD'

Copy link
Copy Markdown

Choose a reason for hiding this comment

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

I still don't think that making the workflow sensitive to changes in external makes sense. AFAIK, GitHub doesn't check if a git submodule changed.

Comment thread .github/workflows/ctrace.yml Outdated
- '!**/*.md'
- 'LICENSE'
- 'tools/ctrace/docs/OpenCSD-NOTICE.txt'
- 'tools/ctrace/docs/RUNTIME_COMPONENTS.md'

Copy link
Copy Markdown

Choose a reason for hiding this comment

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

Do you need to rebuild if your internal documentation changed?

Comment thread .github/workflows/ctrace.yml Outdated
- name: Verify Windows Arm64 binary architecture
if: (matrix.target == 'windows' && matrix.arch == 'arm64')
shell: pwsh
run: |

Copy link
Copy Markdown

Choose a reason for hiding this comment

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

Should this rather be a script that one can run easily on their local machine?

Comment thread .github/workflows/ctrace.yml Outdated
- name: Smoke-test release binary
if: |
github.event_name == 'release' &&
(matrix.target != 'windows' || matrix.arch != 'arm64')

Copy link
Copy Markdown

Choose a reason for hiding this comment

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

So, it's Linux amd64? Should we probably rather exactly write which platform this runs on. Same for other steps

Comment thread .github/workflows/ctrace.yml Outdated

- name: Archive unit tests results
if: always() && (matrix.arch != 'arm64')
if: always() && (matrix.target != 'windows' || matrix.arch != 'arm64')

Copy link
Copy Markdown

Choose a reason for hiding this comment

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

what's always()?

return;
}

// LCOV_EXCL_BR_START: generated aggregate-initializer exception edges

Copy link
Copy Markdown

Choose a reason for hiding this comment

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

Why do you exclude diagnostics from coverage? Are they not active in production?


namespace {

class RawFileReader final {

Copy link
Copy Markdown

Choose a reason for hiding this comment

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

Same (or at least very similar) code in DecodeConsumers. Refactor.


namespace {

std::uint64_t saturatingMultiply(std::uint64_t value, std::uint32_t factor)

Copy link
Copy Markdown

Choose a reason for hiding this comment

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

Also seen saturating add somewhere, perfect candidate for a utils module.


// The individual short-circuit permutations are an implementation detail;
// repeated and complementary fragments are covered as complete behaviors.
// LCOV_EXCL_BR_START

Copy link
Copy Markdown

Choose a reason for hiding this comment

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

why?


#if defined(__GNUC__) && !defined(__clang__)
#pragma GCC diagnostic push
#pragma GCC diagnostic ignored "-Wignored-qualifiers"

Copy link
Copy Markdown

Choose a reason for hiding this comment

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

Which qualifiers is that?

@thorstendb-ARM thorstendb-ARM changed the title Ctrace dev1 Ctrace initial development Aug 3, 2026
@thorstendb-ARM thorstendb-ARM changed the title Ctrace initial development ctrace initial development Aug 3, 2026

@edriouk edriouk 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.

all ctrace* project files must have Header File directory => changes in CMakeLists.txt files are required:

SET(PROJMGR_HEADER_FILES ...

@edriouk edriouk 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.

All classes and their public methods must have DOXYGEN-style comments

@edriouk

edriouk commented Aug 3, 2026

Copy link
Copy Markdown
Contributor

test/data folders contain *.license files. They probably should be removed.

Comment thread tools/ctrace/src/cli/CliParser.cpp Fixed
@codecov

codecov Bot commented Aug 3, 2026

Copy link
Copy Markdown

Codecov Report

✅ All modified and coverable lines are covered by tests.
✅ Project coverage is 72.14%. Comparing base (37a8a8e) to head (52e772f).

Additional details and impacted files
@@            Coverage Diff             @@
##             main    #2548      +/-   ##
==========================================
+ Coverage   68.34%   72.14%   +3.79%     
==========================================
  Files         141      185      +44     
  Lines       26511    30127    +3616     
  Branches    16022    17791    +1769     
==========================================
+ Hits        18118    21734    +3616     
+ Misses       6090     6087       -3     
- Partials     2303     2306       +3     
Flag Coverage Δ
buildmgr-cov 79.87% <ø> (ø)
ctrace-cov 100.00% <100.00%> (ø)
packchk-cov 69.81% <ø> (ø)
packgen-cov 82.02% <ø> (ø)
projmgr-cov 88.05% <ø> (ø)
svdconv-cov 46.82% <ø> (ø)

Flags with carried forward coverage won't be shown. Click here to find out more.

Files with missing lines Coverage Δ
tools/ctrace/src/CtraceMain.cpp 100.00% <100.00%> (ø)
tools/ctrace/src/cli/CliParser.cpp 100.00% <100.00%> (ø)
tools/ctrace/src/control/DecodeConsumers.cpp 100.00% <100.00%> (ø)
tools/ctrace/src/control/FileDecodeJob.cpp 100.00% <100.00%> (ø)
tools/ctrace/src/control/TraceDirectoryJob.cpp 100.00% <100.00%> (ø)
tools/ctrace/src/decode/CortexMPostDecoder.cpp 100.00% <100.00%> (ø)
tools/ctrace/src/decode/CortexMStreamDecoder.cpp 100.00% <100.00%> (ø)
tools/ctrace/src/decode/DecodePipeline.cpp 100.00% <100.00%> (ø)
tools/ctrace/src/decode/DecodePipeline.h 100.00% <100.00%> (ø)
tools/ctrace/src/decode/DwtPacketDecoder.cpp 100.00% <100.00%> (ø)
... and 35 more

... and 1 file with indirect coverage changes

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


void OpenCsdItmSession::createDecoder(OpenCsdPacketCollector& collector, OpenCsdErrorController& errorController)
{
auto* registry = OcsdLibDcdRegister::getDecoderRegister();
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.

4 participants