{"record":{"id":"2343c98e55b18fbd","repo":"NationalSecurityAgency/ghidra","slug":"unsupported-language","errorCode":null,"errorMessage":"Unsupported language.","messagePattern":"Unsupported language\\.","errorType":"exception","errorClass":"RuntimeException","httpStatus":null,"severity":"warning","filePath":"Ghidra/Features/Base/ghidra_scripts/FindUndefinedFunctionsScript.java","lineNumber":125,"sourceCode":"\t\t\t\t(byte) 0x02, (byte) 0xa6 }, false),//\n\t\t\t};\n\t\t}\n\t\tif (processor.equals(Processor.findOrPossiblyCreateProcessor(\"ARM\"))) {\n\t\t\treturn new PatternMatcher[] {\n\t\t\t\t//new PatternMatcher(new byte[]{(byte)0x00,(byte)0x00,(byte)0x50,(byte)0xe3}, true),//only check 'cmp' at function entry\n\t\t\t\t//new PatternMatcher(new byte[]{(byte)0x00,(byte)0x00,(byte)0x51,(byte)0xe3}, true),//only check 'cmp' at function entry\n\t\t\t\t//new PatternMatcher(new byte[]{(byte)0x00,(byte)0x00,(byte)0x53,(byte)0xe3}, true),//only check 'cmp' at function entry\n\t\t\t\tnew PatternMatcher(\n\t\t\t\t\tnew byte[] { (byte) 0xf0, (byte) 0x40, (byte) 0x2d, (byte) 0xe9 }, false),//stmdb sp!{r4 r5 r6 r7 lr}\n\t\t\t\tnew PatternMatcher(\n\t\t\t\t\tnew byte[] { (byte) 0xb0, (byte) 0x40, (byte) 0x2d, (byte) 0xe9 }, false),//stmdb sp!{r4 r5 r7 lr}\n\t\t\t\tnew PatternMatcher(\n\t\t\t\t\tnew byte[] { (byte) 0x90, (byte) 0x40, (byte) 0x2d, (byte) 0xe9 }, false),//stmdb sp!{r4 r7 lr}\n\t\t\t\tnew PatternMatcher(\n\t\t\t\t\tnew byte[] { (byte) 0x80, (byte) 0x40, (byte) 0x2d, (byte) 0xe9 }, false),//stmdb sp!{r7 lr}\n\t\t\t};\n\t\t}\n\t\tthrow new RuntimeException(\"Unsupported language.\");\n\t}\n\n\tprivate class PatternMatcher {\n\t\tbyte[] expectedBytes;\n\t\tboolean requiresEntyPoint;\n\n\t\tPatternMatcher(byte[] expectedBytes, boolean requiresEntryPoint) {\n\t\t\tthis.expectedBytes = expectedBytes;\n\t\t\tthis.requiresEntyPoint = requiresEntryPoint;\n\t\t}\n\n\t\tboolean isMatch(Address undefinedAddress) throws MemoryAccessException {\n\t\t\tbyte[] actualBytes = new byte[expectedBytes.length];\n\t\t\tcurrentProgram.getMemory().getBytes(undefinedAddress, actualBytes);\n\n\t\t\tif (equals(expectedBytes, actualBytes)) {\n\t\t\t\tif (requiresEntyPoint) {\n//\t\t\t\t\treturn currentProgram.getSymbolTable().isExternalEntryPoint(undefinedAddress);","sourceCodeStart":107,"sourceCodeEnd":143,"githubUrl":"https://github.com/NationalSecurityAgency/ghidra/blob/d5f144c24d6bc53c9cbf4448c6d11143e7696206/Ghidra/Features/Base/ghidra_scripts/FindUndefinedFunctionsScript.java#L107-L143","documentation":"Thrown by FindUndefinedFunctionsScript.getPatterns when the current program's processor is not x86 (windows/gcc), PowerPC, or ARM. The script only knows compiler function-prologue byte patterns for those architectures; anything else (MIPS, AARCH64, RISC-V, etc.) falls through all the if-blocks and hits RuntimeException.","triggerScenarios":"Running FindUndefinedFunctionsScript against a program whose language processor is not in the supported set. The method iterates known prologue signatures and throws if none matched.","commonSituations":"Loading a MIPS, AARCH64, RISC-V, or other unsupported binary. Using a custom Sleigh language whose Processor name doesn't match 'x86'/'PowerPC'/'ARM'.","solutions":["Confirm the program's processor is x86/PowerPC/ARM; for others, this script will not help.","Extend getPatterns with byte signatures for the new architecture and rebuild the script.","Skip the script for unsupported languages: check currentProgram.getLanguage().getProcessor() first and exit cleanly.","Use Ghidra's auto-analysis 'Subroutine References' or 'Function Recovery' for architectures this script doesn't cover."],"exampleFix":"// before\n// falls through x86/PowerPC/ARM checks\nthrow new RuntimeException(\"Unsupported language.\");\n\n// after\nProcessor p = currentProgram.getLanguage().getProcessor();\nif (!p.equals(Processor.findOrPossiblyCreateProcessor(\"x86\")) &&\n    !p.equals(Processor.findOrPossiblyCreateProcessor(\"PowerPC\")) &&\n    !p.equals(Processor.findOrPossiblyCreateProcessor(\"ARM\"))) {\n    println(\"Unsupported processor: \" + p + \" - nothing to do.\");\n    return new PatternMatcher[0];\n}","handlingStrategy":"validation","validationCode":"Processor p = currentProgram.getLanguage().getProcessor();\nboolean supported =\n    p.equals(Processor.findOrPossiblyCreateProcessor(\"x86\")) ||\n    p.equals(Processor.findOrPossiblyCreateProcessor(\"PowerPC\")) ||\n    p.equals(Processor.findOrPossiblyCreateProcessor(\"ARM\"));\nif (!supported) {\n    // do not run getPatterns / the script\n}","typeGuard":"static boolean isSupportedProcessor(Program prog) {\n    Processor p = prog.getLanguage().getProcessor();\n    return p.equals(Processor.findOrPossiblyCreateProcessor(\"x86\")) ||\n           p.equals(Processor.findOrPossiblyCreateProcessor(\"PowerPC\")) ||\n           p.equals(Processor.findOrPossiblyCreateProcessor(\"ARM\"));\n}","tryCatchPattern":"try {\n    run();\n} catch (RuntimeException e) {\n    if (\"Unsupported language.\".equals(e.getMessage())) {\n        println(\"Processor not supported by this script.\");\n    } else throw e;\n}","preventionTips":["Check the program's processor before running FindUndefinedFunctionsScript.","Extend getPatterns with prologues for new architectures if you need them.","Prefer Ghidra auto-analysis function recovery for unsupported architectures."],"tags":["script","architecture","function-discovery","patterns"],"backgroundTag":null,"analyzedSha":"d5f144c24d6bc53c9cbf4448c6d11143e7696206","analyzedAt":"2026-08-14T01:00:57.564Z","schemaVersion":2},"datasetVersion":"2026-08-14T05:17:29.042Z"}