Class LanguageTranslatorFactory


  • public class LanguageTranslatorFactory
    extends java.lang.Object
    LanguageTranslatorFactory manages all language translators within Ghidra. Language translators support either a version translation for a single language, or a language transition from one language to another. The following types of translators are supported:
    • Simple translators are established based upon a translator XML specification file (*.trans).
    • Explicit translators are class implementations of the LanguageTranslator interface. The abstract LanguageTranslatorAdapter has been supplied for this purpose so that default mappings can be used if needed. Such custom translator classes should not be created within the 'ghidra.program.util' package since they will be ignored by the factory.
    • Default translators can be instantiated for languages whose address spaces map to one-another. Such default translations may be lossy with register mappings and could result in lost register variables and references.
    • Field Detail

      • LANGUAGE_TRANSLATOR_FILE_EXT

        public static final java.lang.String LANGUAGE_TRANSLATOR_FILE_EXT
        See Also:
        Constant Field Values
    • Method Detail

      • getLanguageTranslatorFactory

        public static LanguageTranslatorFactory getLanguageTranslatorFactory()
        Returns the single instance of the OldLanguageFactory.
      • getLanguageTranslator

        public LanguageTranslator getLanguageTranslator​(Language fromLanguage,
                                                        Language toLanguage)
        Returns a language translator for the transition from an oldLanguage to a newLanguage. The toLanguage may be a different language or a newer version of fromLanguage.
        Parameters:
        fromLanguage - old language
        toLanguage - new language
        Returns:
        language translator if transition is supported, otherwise null is returned.
      • getLanguageTranslator

        public LanguageTranslator getLanguageTranslator​(LanguageID languageName,
                                                        int majorVersion)
        Returns a language translation for a language version which is no longer supported.
        Parameters:
        languageName - old unsupported language name
        majorVersion - language major version within program
        Returns:
        language translator if one can be determined, otherwise null is returned.