fix(hopper): return addresses for procedure relationships

This commit is contained in:
morluto 2026-07-14 04:21:28 +08:00
parent c439b9e778
commit 2c707abb66
2 changed files with 17 additions and 2 deletions

View File

@ -753,9 +753,9 @@ def _dispatch(method, params):
if method == "procedure_pseudo_code":
return procedure.decompile()
if method == "procedure_callers":
return [_procedure_name(item) for item in procedure.getAllCallerProcedures()]
return sorted((_hex(item.getEntryPoint()) for item in procedure.getAllCallerProcedures()), key=lambda value: int(value, 16))
if method == "procedure_callees":
return [_procedure_name(item) for item in procedure.getAllCalleeProcedures()]
return sorted((_hex(item.getEntryPoint()) for item in procedure.getAllCalleeProcedures()), key=lambda value: int(value, 16))
if method == "procedure_info":
blocks = list(procedure.basicBlockIterator())
length = sum(max(0, block.getEndingAddress() - block.getStartingAddress()) for block in blocks)

View File

@ -110,4 +110,19 @@ describe("Hopper bridge truthfulness", () => {
"document_closed = _session_document() is None",
);
});
it("returns deterministic addresses for direct procedure relationships", () => {
expect(bridgeSource).toContain(
"_hex(item.getEntryPoint()) for item in procedure.getAllCallerProcedures()",
);
expect(bridgeSource).toContain(
"_hex(item.getEntryPoint()) for item in procedure.getAllCalleeProcedures()",
);
expect(bridgeSource).not.toContain(
"_procedure_name(item) for item in procedure.getAllCallerProcedures()",
);
expect(bridgeSource).not.toContain(
"_procedure_name(item) for item in procedure.getAllCalleeProcedures()",
);
});
});