Skip to main content
Glama

Trace Object Lifetime

debug_trace_lifetime
Destructive

Trace pointer or object lifetime to diagnose use-after-free, stale ownership, or unexpected pointer replacement via forward tracing and optional reverse stepping.

Instructions

Trace lifetime evidence for one debugger-visible pointer or object handle using the current snapshot, sanitizer/runtime output, bounded forward writer tracing, and optional reverse stepping when supported. Use this for suspected use-after-free, stale ownership, or unexpected pointer replacement. Do not use forward tracing on a frozen dump or when resuming the target is unsafe.

Input Schema

TableJSON Schema
NameRequiredDescriptionDefault
nameYesDebugger-visible pointer/object expression whose lifetime should be investigated.
maxStopsNoMaximum forward writer observations.
directionNoForward uses writer watchpoints, reverse uses stepBack, and hybrid collects both when supported.forward
sessionIdNoOptional DAP session ID. Omit to use the backward-compatible default session.
timeoutMsNoAggregate bound for forward temporal tracing.
reverseStepsNoMaximum reverse stepBack operations when reverse or hybrid is selected.

Output Schema

TableJSON Schema
NameRequiredDescriptionDefault
queryYes
initialYes
guidanceYes
sanitizerYes
memoryHazardsYes
forwardTimelineNo
reverseTimelineNo
allocationDeallocationHintsYes

Schema Changelog

Changes observed during successful MCP inspections.

  1. Addedv0.18.1

TDQS

A4.1/5.0
Behavior4/5

Does the description disclose side effects, auth requirements, rate limits, or destructive behavior?

The description discloses meaningful behavioral details beyond the annotations: it uses the current snapshot, sanitizer/runtime output, bounded forward writer tracing, and optional reverse stepping. It also warns about the safety implications of forward tracing on frozen dumps or unsafe resume conditions. This complements the destructiveHint annotation rather than merely restating it.

Agents need to know what a tool does to the world before calling it. Descriptions should go beyond structured annotations to explain consequences.

Conciseness5/5

Is the description appropriately sized, front-loaded, and free of redundancy?

The description is three sentences with no wasted words. It front-loads the core action, then gives usage guidance, and ends with a critical safety exclusion. Every sentence adds distinct value.

Shorter descriptions cost fewer tokens and are easier for agents to parse. Every sentence should earn its place.

Completeness5/5

Given the tool's complexity, does the description cover enough for an agent to succeed on first attempt?

For a moderately complex tool with six parameters and a present output schema, the description covers the essential context: what it traces, why an agent would choose it, and an important safety constraint. The presence of a full output schema and 100% parameter schema coverage means the remaining details are already available without burdening the description.

Complex tools with many parameters or behaviors need more documentation. Simple tools need less. This dimension scales expectations accordingly.

Parameters3/5

Does the description clarify parameter syntax, constraints, interactions, or defaults beyond what the schema provides?

Schema description coverage is 100%, with each parameter already well documented (e.g., direction explains forward vs. reverse, maxStops explains the bound). The tool description adds contextual phrases like 'bounded forward writer tracing' but does not materially add parameter-level meaning beyond what the schema already provides. Baseline 3 is appropriate.

Input schemas describe structure but not intent. Descriptions should explain non-obvious parameter relationships and valid value ranges.

Purpose4/5

Does the description clearly state what the tool does and how it differs from similar tools?

The description clearly identifies a specific verb and resource: 'Trace lifetime evidence for one debugger-visible pointer or object handle.' It also names concrete use cases such as use-after-free and stale ownership, making the purpose actionable. However, it does not explicitly differentiate itself from sibling tools like debug_find_writer or debug_trace_value by name.

Agents choose between tools based on descriptions. A clear purpose with a specific verb and resource helps agents select the right tool.

Usage Guidelines4/5

Does the description explain when to use this tool, when not to, or what alternatives exist?

The description provides explicit guidance on when to use the tool: 'suspected use-after-free, stale ownership, or unexpected pointer replacement.' It also gives a clear exclusion: 'Do not use forward tracing on a frozen dump or when resuming the target is unsafe.' It stops short of naming alternative sibling tools or explaining when those alternatives should be preferred.

Agents often have multiple tools that could apply. Explicit usage guidance like "use X instead of Y when Z" prevents misuse.