s32trace-analyze-coverage
Analyze an S32DS Flat Profiler code-coverage export (.flatprofiler) together with its ELF binary and project source tree to answer questions about coverage percentages, uncovered code paths, execution
Files1
View on GitHubSKILL.mdskills/s32trace/s32trace-analyze-coverage/SKILL.md
GitHubS32Trace Coverage Analysis
Answers coverage questions from an S32DS Flat Profiler export using three local inputs:
the .flatprofiler file, the ELF binary (with DWARF debug info), and the project source tree.
When to use
Trigger this skill when the user wants to:
- load a
.flatprofiler+ ELF + source tree and get a coverage overview - find which functions were never executed or are only partially covered
- identify which source lines were not reached during the test run
- rank functions by execution time (flat profile hotspot view)
- view a source snippet annotated with per-line coverage state and hit counts
- understand inline function coverage (multiple instances at different addresses)
- answer "what percentage of my code ran?"
Do not use this skill to configure S32Trace (use s32trace-create-configuration),
compile or flash firmware, or start a debug session.
Available Capabilities
| Type | Name | Purpose |
|---|---|---|
| MCP tool | search_actions |
discover available actions, their input schemas, and descriptions |
| MCP tool | execute_action |
validated dispatcher -- pass action_name + action-specific params |
All coverage operations are routed through execute_action:
| Action name | Required params | Optional params |
|---|---|---|
coverage.load |
flatprofiler_path, elf_path, source_root |
extra_source_roots, label, snippet_window |
coverage.summary |
session_id |
core, top_k, include_no_source_info |
coverage.function |
session_id, name |
core, include_source_rows |
coverage.file |
session_id, file_hint |
core |
coverage.uncovered |
session_id |
granularity (function/line/asm), sort_by, top_k, core, include_no_source_info |
coverage.hotspots |
session_id |
sort_by, granularity (function/line), top_k, core, include_no_source_info |
coverage.get_source |
session_id |
symbol, file_hint, line, core, snippet_window |
Call search_actions first (or with a focused query such as "coverage load")
to get the full parameter documentation before calling execute_action.
Typical workflow
coverage.load -> returns session_id + load summary
-> coverage.summary (overview: coverage %, uncovered count, hotspots)
-> coverage.function (per-function detail + per-line breakdown)
-> coverage.file (file-level stats + uncovered function list)
-> coverage.uncovered (ranked list of uncovered functions/lines/asm)
-> coverage.hotspots (most-executed functions or lines by time)
-> coverage.get_source (source snippet annotated with coverage + time)
Quickstart
- Call
search_actions(query="coverage load")to confirm the action name and input schema. - Ask the user for the
.flatprofiler, ELF, and source root paths. - Call
execute_action(action_name="coverage.load", params={...}). Recordsession_idfrom the result -- it is required by every subsequent call. - Unless the user has a specific question, call
execute_action(action_name="coverage.summary", params={"session_id": ...})and presentoverall.asm_coverage_pct,overall.src_coverage_pct, function counts,top_by_time, andtop_uncovered_by_size. - Answer follow-up questions using the action table above.
Workflow
Identify inputs. Confirm from the user:
- Absolute path to the
.flatprofilerfile (flatprofiler_path). Typically at<workspace>/.AnalysisData/<session>/<name>.flatprofiler. - Absolute path to the ELF with DWARF debug info (
elf_path). Must be the exact binary that was profiled. - Absolute path to the project source root (
source_root). Needed forcoverage.get_sourceto return annotated source text.
- Absolute path to the
Load the coverage session. Call:
execute_action( action_name = "coverage.load", params = { "flatprofiler_path": "<absolute path to .flatprofiler>", "elf_path": "<absolute path to .elf>", "source_root": "<absolute path to project src/>", "label": "my_coverage_session" } )Verify:
file_count > 0,function_count > 0,source.available: true. Ifsource.availableisfalseand the user supplied a source root, report the path as unresolved and offer to retry with a corrected path.Get an overview. Call
coverage.summaryunless the user has a precise question. Key fields to present:overall.asm_coverage_pctandoverall.src_coverage_pctoverall.fully_covered_functions,overall.partially_covered_functions,overall.fully_uncovered_functionstop_uncovered_by_size-- the largest functions never executedtop_by_time-- where the CPU spent the most time
Answer specific questions.
User question Action to call Key params "What is my overall coverage?" coverage.summarytop_k"How much of slow_path.cis covered?"coverage.filefile_hint="slow_path.c""Show me coverage for slow_leaf"coverage.functionname="slow_leaf""Which functions were never executed?" coverage.uncoveredgranularity="function""Show me uncovered lines in workloads.c"coverage.uncoveredgranularity="line""Where does the CPU spend most of its time?" coverage.hotspotssort_by="time""Show me mainwith coverage annotation"coverage.get_sourcesymbol="main""Show me the code around line 42 of main.c" coverage.get_sourcefile_hint="main.c", line=42Inline function handling. The S32DS profiler reports inlined functions at multiple addresses under names like
clamp_i32_0x33d83d24. When the user asks aboutclamp_i32:- Call
coverage.uncoveredorcoverage.summaryto see all instances listed. - Call
coverage.functionwith the exact mangled name for detail on a specific instance. - Note that different instances may have different coverage because they are separate copies of the inlined code placed at different call sites.
- Call
Suggest improvements. When the user asks "what code should I test?" or "why is coverage low?":
- Call
coverage.uncovered granularity=function-- rank bysizeto find the most impactful untested functions. - Call
coverage.fileon each low-coverage source file to identify the uncovered functions. - Call
coverage.functionwithinclude_source_rows=truefor partially-covered functions to see which branches/lines were missed. - Call
coverage.get_sourceto view the actual uncovered code. - Present a prioritized list of specific test-gap recommendations with file + line references.
- Call
Guardrails
Scope
- All coverage actions are read-only; no file is written, no project is modified, and no S32 Design Studio process is started.
- Do not call configurator actions (
configurator.*) from this skill.
Destructive actions
- None.
coverage.loadwrites only to an in-memory session cache keyed bysession_id; it does not touch any file.
Secrets
- No secrets or PII are involved; no redaction required.
Refuse-and-escalate
coverage.loadreturnserror: report the message verbatim and ask the user to verify the file paths.source.availableisfalseafter load: source paths in the.flatprofilerdo not match the local tree; ask the user for the correctsource_rootorextra_source_roots.coverage.functionreturnsfound: false: confirm the exact symbol name usingcoverage.uncoveredfirst.- Path escape:
coverage.get_sourcewill refuse to read files outside the declared source roots; do not attempt to bypass this by constructing absolute paths that leave the root. - Stale
session_id: if an action returns "Coverage session ... not found", the MCP server was restarted; callcoverage.loadagain and record the newsession_id.
Resource limits
- Default
top_kforuncoveredis 20 and forhotspotsis 10. Increase only when the user explicitly asks for more; never return unbounded results. get_sourcehard-limits snippets to 50 lines regardless ofsnippet_window.
_No source info bucket
- Functions with no DWARF source info (libc, newlib, startup, semihosting stubs) are
grouped under
_No source infoand excluded from all aggregate queries by default. Setinclude_no_source_info=trueto include them. Never include them unless the user explicitly asks about libc or runtime coverage.
Validation loop
- After
coverage.load, verifyfile_count > 0,function_count > 0, and (whensource_rootwas given)source.available: true. - After
coverage.summary, confirmoverall.total_functions > 0. - Pass criterion:
session_idis in hand and the load summary matches the user's expectations (correct core, function count, source available).
Out of scope
- Creating or editing S32Trace configuration XML (use
s32trace-create-configuration). - Trace event analysis from a decoded CSV (use
s32trace-analyze-trace). - Installing or updating S32 Design Studio.
- Compiling, flashing, or debugging firmware.
- Generating code from a
.mexfile (uses32ct-generate-code).
See Also
search_actions(query="coverage")-- returns the full parameter schema for all 7coverage.*actions.s32trace-analyze-trace-- sibling skill for trace event / timing analysis.s32trace-create-configuration-- skill for configuring the trace capture.