Repository navigation
Accept integer addresses for address-style tool params (Fixes #9) - #10
Merged
Merged
Conversation
getParamStr -> getStringField only matched the JSON .string variant, so an integer address/target silently fell back to the parameter default ("cip" in Disassemble/DisassembleFunction) or errored as "required" in the other address-taking tools. Add getAddrField/getParamAddr: strings pass through unchanged, integers are formatted as "0x{X}" before expression resolution. Applied to all 25 address/target call sites (23 address, 2 target).
Tool schemas now declare address-style params as ["string","integer"], and the Disassemble count clamp is documented as [1, 100]. Unit tests cover string passthrough, integer formatting, zero, negative integers, floats, non-address types, missing fields, and small buffers.
Fixes duty1g#9
Owner
|
Merged into main as v1.6. Clean work — thorough coverage across all 25 call sites, good tests, and the end-to-end verification was appreciated. Thanks! |
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.
As confirmed in #9,
getParamStr→json.getStringFieldonly matched the JSON.stringvariant, so an integeraddress/targetsilently fell back to the parameter default ("cip"inDisassemble/DisassembleFunction) or errored as"... is required"in the other address-taking tools — even though agents naturally pass numbers.This implements the accept-both approach:
json.getAddrField(parsed, field, buf)— JSON strings ("0x...", symbols, expressions) pass through unchanged; JSON integers are formatted as0x{X}into the caller's buffer; negative integers and non-integer/non-string values returnnull(unchanged behavior).tools.getParamAddr(params, field, buf)— thin wrapper, used at all 25 address-style call sites (23 ×address, 2 ×target):Disassemble,DisassembleFunction,ReadMemory,SetBreakpoint,DeleteBreakpoint,WriteMemToAddress,CommentOrLabelAtAddress,Assemble,SetHardwareBreakpoint,SetMemoryBreakpoint,GetReferences,RunToAddress,SetConditionalBreakpoint,FollowPointer,DumpMemory,FreeMemory,Enable/Disable/Toggle/ResetHitCount,Set/DeleteBookmark,AnalyzeCode,SetBreakpointCommand,SetBreakpointFastResume.["string","integer"], so the machine-readable contract matches what the server accepts.Disassemble.countclamp is now documented in its schema description as[1, 100].Tests
zig build test(Zig 0.14.0, as pinned by CI) — new unit tests injson.zig: string passthrough, integer formatting (5368714928→"0x1400016B0"), zero →"0x0", negative/float/bool/array/missing →null, undersized buffer →null.zig build -Doptimize=ReleaseFastbuilds both the x32 and x64 plugins (end-to-end testing below was on x64).End-to-end verification (live x64dbg, Windows)
Control = plugin built from unmodified v1.5 with the same toolchain; treatment = this branch. Same target, same flow (paused at the entry breakpoint,
target = cip + 0x200):Disassemble {"address": <int>}ReadMemory {"address": <int>}Error: address is required.SetBreakpoint/DeleteBreakpoint {"target": <int>}Error: target is required.ListBreakpoints/ deletedDisassemble {"address": "0x..."}Disassemble {"count": 500}Concrete: the control int-address call returned CIP
0x7FFA897FD78Einstead of the requested0x7FFA897FD98E; with this branch both int and string forms return the requested0x7FF670B616B0.Notes
null→ tool default / "required" error) — unchanged.mainfails to build with Zig 0.16.0 (24 errors from the WindowsBOOL→os.windows.Bool(c_int)change and thews2_32.SOCKET/WSADATAmove); the CI-pinned 0.14.0 builds cleanly. Mentioning in case the README's "Zig 0.16-dev or later" build note needs a look.Fixes #9