s32trace-analyze-trace
Analyze a decoded S32Trace Trace-view export (.csv) together with its ELF binary and optional project source tree to answer questions about instruction addresses, timing, hot functions, code snippets,
Files1
View on GitHubSKILL.mdskills/s32trace/s32trace-analyze-trace/SKILL.md
GitHubS32Trace Trace Analysis
Answers application-specific questions from a decoded S32Trace Trace-view capture using three local inputs: the decoded CSV, the ELF binary (with DWARF debug info), and an optional project source tree.
When to use
Trigger this skill when the user wants to:
- load a decoded S32Trace CSV + ELF and get an overview
- find which functions dominate execution time or instruction count
- look up what function / file / line a specific PC address belongs to
- measure the time delta between two code locations or events
- retrieve a source code snippet for a function or file:line reference
- identify optimization opportunities from trace data
- answer "what happened between t1 and t2?"
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 analysis operations are routed through execute_action:
| Action name | Required params | Optional params |
|---|---|---|
analysis.load_trace |
csv_path, elf_path |
source_root, extra_source_roots, label, time_unit_ns, snippet_window |
analysis.summary |
trace_id |
top_n |
analysis.find_event |
trace_id, selector |
limit, include_source |
analysis.address_at |
trace_id |
pc (hex string), symbol (name) |
analysis.time_between |
trace_id, from_selector, to_selector |
occurrence (first/all) |
analysis.range_events |
trace_id |
time_range, from_selector, to_selector, limit |
analysis.get_source |
trace_id |
file_hint, line, symbol, snippet_window |
Call search_actions first (or with a focused query such as "analysis load")
to get the full parameter documentation before calling execute_action.
Typical workflow
analysis.load_trace -> returns trace_id + load summary
-> analysis.summary (overview: hot functions, duration, cores)
-> analysis.find_event (filter events by symbol, address, type, ...)
-> analysis.address_at (resolve a PC to symbol + file:line + snippet)
-> analysis.time_between (measure delta between two code locations)
-> analysis.range_events (roll up all events in a time or selector window)
-> analysis.get_source (fetch a source snippet by symbol or file:line)
Quickstart
- Call
search_actions(query="analysis load trace")to confirm the action name and input schema. - Ask the user for the CSV and ELF paths. When the user provides a folder
such as
C:\..\.AnalysisData\trace_0, look for*.csvand*.elfinside. Ask forsource_rootseparately; never guess it. - Call
execute_action(action_name="analysis.load_trace", params={...}). Recordtrace_idfrom the result -- it is required by every subsequent call. - Unless the user has a specific question, call
execute_action(action_name="analysis.summary", params={"trace_id": ...})and presenttop_functions_by_events,duration_ns, andcores. - Answer follow-up questions using the action table above.
- For optimization questions, combine
analysis.range_eventsto find the dominant symbols withanalysis.get_sourceto retrieve the code, then reason about inefficiencies.
Workflow
Identify inputs. Confirm from the user:
- Absolute path to the decoded CSV (
csv_path). - Absolute path to the ELF with DWARF debug info (
elf_path). - Optional absolute path to the source root (
source_root); enabling it makes every answer show the matching source snippet. time_unit_ns: multiplier to convert raw timestamps to nanoseconds (e.g.1.0if already in ns;1000.0if in microseconds).
- Absolute path to the decoded CSV (
Load the trace session. Call:
execute_action( action_name = "analysis.load_trace", params = { "csv_path": "<absolute path to .csv>", "elf_path": "<absolute path to .elf>", "source_root": "<optional source tree root>", "time_unit_ns": 1.0, "label": "trace_0" } )Verify:
parent_event_count > 0andelf_archis non-empty. 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
analysis.summaryunless the user has a precise question. Usetop_functions_by_eventsto orient the conversation toward actual hot spots.Answer specific questions.
User question Action to call Key params "Which function ran the most?" analysis.summarytop_n"Where did function X execute?" analysis.find_eventselector={"symbol":"X"}"What is at address 0x...?" analysis.address_atpc="0x...""How long between A and B?" analysis.time_betweenfrom_selector,to_selector"What happened between t1 and t2?" analysis.range_eventstime_range=[t1,t2]"Show me the code for function X" analysis.get_sourcesymbol="X""More context around line N in file F" analysis.get_sourcefile_hint=F, line=N, snippet_window=10Suggest improvements. When the user asks "can I improve this?" or "why is X slow?":
- Call
analysis.range_eventswith selectors around the slow region to gettop_symbolsandtop_files. - Call
analysis.get_sourcefor each dominant symbol to retrieve the code. - Reason about the code: tight loops, redundant memory accesses, missed inlining, cache-unfriendly access patterns, repeated function call overhead.
- Present a prioritized list of specific suggestions with file + line references.
- Call
Guardrails
Scope
- All analysis 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.
analysis.load_tracewrites only to an in-memory session cache keyed bytrace_id; it does not touch any file.
Secrets
- No secrets or PII are involved; no redaction required.
Refuse-and-escalate
load_tracereturnserror: report the message verbatim and ask the user to verify the file paths.elf_archis empty after load: DWARF information may be absent; warn that address-to-symbol mapping will be unavailable.summaryreturns emptytop_functions_by_events: the CSV may contain only Info/Context rows with no Linear events; report and stop.address_atorget_sourcereturnsresolved: falsewith a source root supplied: DWARF paths do not match the local tree; ask the user for the correctsource_rootorextra_source_roots.- Path escape:
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
trace_id: if an action returns "trace_id not found", the MCP server was restarted; callanalysis.load_traceagain and report the newtrace_id.
Resource limits
- Default
limitforfind_eventandrange_eventsis 20 rows. Increase only when the user explicitly asks for more; never return unbounded results. get_sourcehard-limits snippets to 50 lines regardless ofsnippet_window.
Validation loop
- After
load_trace, verifyparent_event_count > 0,elf_archnon-empty, and (whensource_rootwas given)source.available: true. - After
summary, confirm at least one entry intop_functions_by_events. - Pass criterion:
trace_idis in hand and the load summary matches the user's expectations (correct core, event count, time range).
Out of scope
- Creating or editing S32Trace configuration XML (use
s32trace-create-configuration). - Installing or updating S32 Design Studio.
- Compiling, flashing, or debugging firmware.
- Generating code from a
.mexfile (uses32ct-generate-code). - Timeline, Code Coverage, Performance, and Call Tree view analysis.
See Also
search_actions(query="analysis")-- returns the full parameter schema for all 7analysis.*actions.s32trace-analyze-coverage-- sibling skill for code-coverage analysis from a.flatprofilerexport.s32trace-create-configuration-- sibling skill for configuring the trace capture (before analysis).
Selector schema
Used by analysis.find_event, analysis.time_between, and analysis.range_events:
{
"symbol": "<regex or exact function name>",
"pc_range": ["0xLO", "0xHI"],
"event_type": "Linear | Info | Software Context",
"core": "R52_0_0",
"time_range": [t_start_raw, t_end_raw],
"instruction_regex": "<regex matched against disassembly text>"
}