{"record":{"id":"9274173ae450e93b","repo":"NationalSecurityAgency/ghidra","slug":"couldn-t-get-remote-function-at","errorCode":null,"errorMessage":"Couldn't get remote function {} at {}.","messagePattern":"Couldn't get remote function (.+?) at (.+?)\\.","errorType":"exception","errorClass":"FunctionComparisonException","httpStatus":null,"severity":"warning","filePath":"Ghidra/Features/BSim/src/main/java/ghidra/features/bsim/gui/search/results/BSimSearchResultsProvider.java","lineNumber":544,"sourceCode":"\t}\n\n\tprivate Function getMatchFunction(BSimMatchResult resultRow, Set<Program> opened)\n\t\t\tthrows FunctionComparisonException {\n\t\t// Determine the match function (remote program's function; right side)\n\t\tProgram matchProgram = getCachedRemoteProgram(resultRow.getExecutableURLString(), opened);\n\t\tif (matchProgram == null) {\n\t\t\tthrow new FunctionComparisonException(\n\t\t\t\t\"Couldn't open remote program: \" + resultRow.getExecutableURLString() + \" for \" +\n\t\t\t\t\tresultRow.getSimilarFunctionName() + \".\");\n\t\t}\n\t\tFunctionDescription matchFunctionDescription = resultRow.getMatchFunctionDescription();\n\t\tlong matchOffset = matchFunctionDescription.getAddress();\n\t\tAddress matchEntryPoint =\n\t\t\tmatchProgram.getAddressFactory().getDefaultAddressSpace().getAddress(matchOffset);\n\t\tFunctionManager matchFunctionManager = matchProgram.getFunctionManager();\n\t\tFunction matchFunction = matchFunctionManager.getFunctionAt(matchEntryPoint);\n\t\tif (matchFunction == null) {\n\t\t\tthrow new FunctionComparisonException(\"Couldn't get remote function \" +\n\t\t\t\tmatchFunctionDescription.getFunctionName() + \" at \" + matchEntryPoint + \".\");\n\t\t}\n\t\treturn matchFunction;\n\t}\n\n\tprivate class BSimMatchesTableActionContext extends DefaultActionContext {\n\n\t\tBSimMatchesTableActionContext() {\n\t\t\tsuper(BSimSearchResultsProvider.this);\n\t\t}\n\n\t\tpublic int getSelectedRowCount() {\n\t\t\treturn matchesTable.getTable().getSelectedRowCount();\n\t\t}\n\n\t}\n\n\tprivate class ExecutableTableActionContext extends DefaultActionContext {","sourceCodeStart":526,"sourceCodeEnd":562,"githubUrl":"https://github.com/NationalSecurityAgency/ghidra/blob/d5f144c24d6bc53c9cbf4448c6d11143e7696206/Ghidra/Features/BSim/src/main/java/ghidra/features/bsim/gui/search/results/BSimSearchResultsProvider.java#L526-L562","documentation":"After successfully opening the remote program, BSimSearchResultsProvider.getMatchFunction() computes the match entry point address from the FunctionDescription and looks it up in the remote program's FunctionManager. If getFunctionAt(matchEntryPoint) returns null it throws FunctionComparisonException — the remote program was opened but the expected function at the stored offset doesn't exist.","triggerScenarios":"Calling getMatchFunction where the remote Program opened successfully but matchFunctionManager.getFunctionAt(matchEntryPoint) returns null. The address computed from matchFunctionDescription.getAddress() has no function in the remote program.","commonSituations":"The remote program version differs from what was indexed in BSim (function deleted or moved in a newer version); the remote program was re-analyzed with different function boundaries; the BSim stored offset is stale; address space mismatch between the indexed and current remote program (e.g., different base address); the remote program is a different binary than expected (same name, different content).","solutions":["Re-generate BSim signatures for the remote program and re-ingest so offsets are current.","Verify the remote program version matches the one that was indexed (compare MD5 if available).","Re-analyze the remote program if function boundaries may have changed.","Check for address base/relocation differences between the indexed and live remote program."],"exampleFix":null,"handlingStrategy":"validation","validationCode":"// After opening the remote program, verify function exists before comparing\nFunctionManager rfm = matchProgram.getFunctionManager();\nif (rfm.getFunctionAt(matchEntryPoint) == null) {\n    // remote program version mismatch — warn and skip\n}","typeGuard":null,"tryCatchPattern":"try {\n    getMatchFunction(resultRow, opened);\n} catch (FunctionComparisonException e) {\n    if (e.getMessage().startsWith(\"Couldn't get remote function\")) {\n        // skip: remote program version differs from indexed version\n    } else {\n        throw e;\n    }\n}","preventionTips":["Keep BSim signatures synchronized with the current remote program versions.","Compare MD5 hashes between indexed and live remote programs to detect version drift.","Re-analyze remote programs if function boundaries change.","Filter match results for functions that exist in the current remote program."],"tags":["bsim","function-comparison","remote-program","stale-data","address-mismatch"],"backgroundTag":null,"analyzedSha":"d5f144c24d6bc53c9cbf4448c6d11143e7696206","analyzedAt":"2026-08-14T01:00:57.564Z","schemaVersion":2},"datasetVersion":"2026-08-14T05:17:29.042Z"}