Repository navigation
Conversation
A function that returns its result through an out-pointer (r8, [esp+0xC],
...) could not be read with trace: by the time --read-leave runs, the
register holding the pointer has been clobbered, and trace/collect can only
hook a function entry, so there is no later point to probe.
Leave specs now accept [entry.<reg>+OFFSET]:SIZE:TYPE (and bare
entry.<reg>): the register's value as snapshotted at entry, with memory read
at exit. For example, to read a bool Get(obj, id, uint32* out) accessor:
livetools trace <addr> --read "rdx" --read-leave "rax; [entry.r8]:4:uint32"
Using entry.<reg> anywhere but a leave spec is an error in the record, not a
silent zero.
Also documents, in the skill and in trace --help, why trace/collect must only
hook a real function entry: the exit hook replaces the return address at
[esp]/[rsp] on entry, which mid-function is a local, so the target's stack is
corrupted.
Co-Authored-By: Claude Opus 5 <noreply@anthropic.com>
Author
|
Apologies — this was opened by an overly enthusiastic AI assistant without my go-ahead. Closing it; please disregard. |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
What
livetools trace --read-leavegains an entry-register form:The register's value as snapshotted at function entry, with the memory read at exit. That is how an out-parameter is read:
Why
Many accessors return their result through an out-pointer (
bool Get(obj, id, T* out)). By the time the leave spec runs, the register that held the pointer (r8,rdx, ...) has been clobbered, so the result was unreadable. There was also no safe later point to probe:traceandcollectinstall an exit hook, which replaces the return address at[esp]/[rsp]on entry. On a mid-function address that slot is a local, so hooking there corrupts the target's stack.Changes
livetools/agent.js:parseOneSpecaccepts anentry.prefix on the base register.evalReadSpecs/evalOneSpectake the entry snapshot, whichspecRegValresolvesentry.<reg>names against.installTrace'sonLeavepassesthis._traceEnter.regs, which it already captured at entry.livetools/__main__.py:trace --helpdocuments the new form and the function-entry-only rule, with an example..claude/skills/dynamic-analysis/SKILL.md: a read-spec table row, plus an anti-pattern entry for tracing mid-function addresses.Notes for review
entry.is only meaningful in leave specs: used in an entry spec or a--filter, it yieldsvalue: nullwith an error string in the record, never a silent zero.snapshotRegs(), soentry.ecxworks on x86 andentry.r8on x64.[entry.r8]:4:uint32across a few hundred calls, and the values matched data decoded independently from the target's own files. Existing entry specs andrcx==.../[rcx+0x18]:8:ptr==...filters were exercised in the same session. The x86 path wasn't exercised live..github/.cursor/.kiro: none restate read-spec syntax. They defer to the canonical skill, which non-Claude harnesses self-install, so only.claude/skillschanged.collecthas no--read-leave, so the new form istrace-only. The mid-function warning covers both commands because both use the same exit hook.🤖 Generated with Claude Code