fix(hopper): resolve FAT loaders and original file coordinates

This commit is contained in:
morluto
2026-10-09 05:12:36 +08:00
parent b2d5bc1109
commit 35f1ddd6bc
13 changed files with 489 additions and 112 deletions
+1 -1
View File
@@ -16,7 +16,7 @@ export const HOPPER_MEMORY_TOOL_DEFINITIONS = [
{
name: "address_to_file_offset",
description:
"Map one provider-normalized virtual address to its original nonnegative file offset. Unmapped addresses fail explicitly, and providers without an authoritative mapping API return typed capability unavailability.",
"Map one provider-normalized virtual address to its original nonnegative file offset. Hopper translates FAT Mach-O image-relative offsets using the observed loaded header, preserving its provider coordinate, image base, and source path. Unmapped addresses fail explicitly, and unavailable or ambiguous original-file mappings return typed capability unavailability.",
inputSchema: z.object({ address, document }),
},
] as const;
+24
View File
@@ -147,6 +147,30 @@ export const officialOutputSchemas: Readonly<Record<string, z.ZodObject>> = {
z.object({
address: z.string(),
file_offset: z.number().int().min(0).max(Number.MAX_SAFE_INTEGER),
provider_file_offset: z
.number()
.int()
.min(0)
.max(Number.MAX_SAFE_INTEGER)
.exactOptional()
.describe(
"Original coordinate returned by the provider's mapping API.",
),
image_base_file_offset: z
.number()
.int()
.min(0)
.max(Number.MAX_SAFE_INTEGER)
.exactOptional()
.describe(
"File offset of the loaded image within its source container; zero for a thin executable.",
),
source_path: z
.string()
.exactOptional()
.describe(
"Observed original executable path used to verify the file mapping.",
),
}),
),
procedure_references: resultOf(