mirror of
https://github.com/morluto/rea.git
synced 2026-11-13 18:22:42 +00:00
fix(xrefs): guide symbol lookup recovery (#8753)
* fix(xrefs): guide ambiguous name selection * fix(xrefs): guide missing symbol lookup * fix(xrefs): name available symbol recovery paths * fix(xrefs): qualify exported address coordinates * fix(xrefs): point to procedure address lookup * fix(xrefs): keep CLI recovery focused * test(xrefs): cover CLI ambiguity recovery
This commit is contained in:
1 parent
9a79ee8e9e
commit
eac28b2047
3 files changed
+41
-11
No files matched your search
@@ -21,13 +21,21 @@ export const resolveXrefsAddress = async (
|
||||
return named.value !== null
|
||||
? ok(named.value)
|
||||
: err(
|
||||
new AnalysisInputError("xrefs", undefined, [
|
||||
new AnalysisInputError(
|
||||
"xrefs",
|
||||
{
|
||||
path: ["address"],
|
||||
reason: "invalid_value",
|
||||
message: `Unknown analyzed symbol name ${JSON.stringify(selector)}. Use an exact analyzed name or a hexadecimal address.`,
|
||||
conformsToInputContract: true,
|
||||
remediationAction:
|
||||
"For a function, use rea search --kind procedures to find an analyzed address. For exports, inspect-macho (Mach-O) or inspect-native-exports (PE/ELF) may help; exports can omit local symbols and use different address coordinates. Verify the address in the selected provider, then retry xrefs.",
|
||||
},
|
||||
]),
|
||||
[
|
||||
{
|
||||
path: ["address"],
|
||||
reason: "invalid_value",
|
||||
message: `Unknown analyzed symbol name ${JSON.stringify(selector)}. Use an exact analyzed name or a hexadecimal address.`,
|
||||
},
|
||||
],
|
||||
),
|
||||
);
|
||||
};
|
||||
|
||||
@@ -90,12 +98,20 @@ export const resolveXrefsName = async (
|
||||
const [address] = addresses;
|
||||
if (addresses.size <= 1) return ok(address ?? null);
|
||||
return err(
|
||||
new AnalysisInputError(operation, undefined, [
|
||||
new AnalysisInputError(
|
||||
operation,
|
||||
{
|
||||
path: [operation === "xrefs" ? "address" : "name"],
|
||||
reason: "invalid_value",
|
||||
message: `Analyzed symbol name ${JSON.stringify(selector)} is ambiguous at ${[...addresses].sort().join(", ")}. Select an exact address.`,
|
||||
conformsToInputContract: true,
|
||||
remediationAction:
|
||||
"Select an exact address from the candidates and call xrefs with that address.",
|
||||
},
|
||||
]),
|
||||
[
|
||||
{
|
||||
path: [operation === "xrefs" ? "address" : "name"],
|
||||
reason: "invalid_value",
|
||||
message: `Analyzed symbol name ${JSON.stringify(selector)} is ambiguous at ${[...addresses].sort().join(", ")}. Select an exact address.`,
|
||||
},
|
||||
],
|
||||
),
|
||||
);
|
||||
};
|
||||
Reference in new issue
Block a user