diff --git a/bridge/hopper_bridge.py b/bridge/hopper_bridge.py index 0b0a85d2a..18548fac1 100644 --- a/bridge/hopper_bridge.py +++ b/bridge/hopper_bridge.py @@ -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) diff --git a/tests/bridgeTruthfulness.test.ts b/tests/bridgeTruthfulness.test.ts index dd9ad2d02..3b16d0c27 100644 --- a/tests/bridgeTruthfulness.test.ts +++ b/tests/bridgeTruthfulness.test.ts @@ -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()", + ); + }); });