Class DefaultLanguageService

java.lang.Object
ghidra.program.util.DefaultLanguageService
All Implemented Interfaces:
LanguageService, EventListener, ChangeListener

public class DefaultLanguageService extends Object implements LanguageService, ChangeListener
Default Language service used gather up all the languages that were found during the class search (search was for language providers)
  • Method Details

    • getLanguageService

      public static LanguageService getLanguageService()
      Returns the single instance of the DefaultLanguageService.
      Returns:
      the language service
    • getLanguageService

      public static LanguageService getLanguageService(ResourceFile sleighLdefsFile) throws Exception
      Return the single instance of the DefaultLanguageService. If not already instantiated in the default mode, the factory will be lazy and limit it set of languages to those defined by the specified Sleigh language definition file (*.ldefs) or those provided by subsequent calls to this method.
      Parameters:
      sleighLdefsFile - sleigh language definition file
      Returns:
      language factory instance
      Throws:
      Exception - if an error occurs while parsing the specified definition file
    • getLanguage

      public Language getLanguage(LanguageID languageID) throws LanguageNotFoundException
      Description copied from interface: LanguageService
      Returns the language with the given language ID
      Specified by:
      getLanguage in interface LanguageService
      Parameters:
      languageID - the ID of language to retrieve
      Returns:
      the Language matching the given ID
      Throws:
      LanguageNotFoundException - if no language can be found for the given ID
    • getLanguageDescription

      public LanguageDescription getLanguageDescription(LanguageID languageID) throws LanguageNotFoundException
      Description copied from interface: LanguageService
      Get language information for the given language ID.
      Specified by:
      getLanguageDescription in interface LanguageService
      Parameters:
      languageID - the id for the language.
      Returns:
      language information for the given language ID.
      Throws:
      LanguageNotFoundException - if there is no language for the given ID.
    • getLanguageDescriptions

      public List<LanguageDescription> getLanguageDescriptions(boolean includeDeprecatedLanguages)
      Description copied from interface: LanguageService
      Returns all known language Descriptions
      Specified by:
      getLanguageDescriptions in interface LanguageService
      Parameters:
      includeDeprecatedLanguages - TODO
      Returns:
      all know language Descriptions.
    • getLanguageDescriptions

      public List<LanguageDescription> getLanguageDescriptions(Processor processor, Endian endianess, Integer size, String variant)
      Description copied from interface: LanguageService
      Returns all known language descriptions which satisfy the criteria identify by the non-null parameters. A null value implies a don't-care wildcard value.
      Specified by:
      getLanguageDescriptions in interface LanguageService
      Parameters:
      processor - the processor for which to get a language
      endianess - big or little
      size - processor address space size (in bits)
      variant - the processor version (usually 'default')
      Returns:
      the language descriptions that fit the parameters
    • getExternalLanguageDescriptions

      public List<LanguageDescription> getExternalLanguageDescriptions(String externalProcessorName, String externalTool, Endian endianess, Integer size)
    • getLanguageCompilerSpecPairs

      public List<LanguageCompilerSpecPair> getLanguageCompilerSpecPairs(LanguageCompilerSpecQuery query)
      Description copied from interface: LanguageService
      Returns all known language/compiler spec pairs which satisfy the criteria identify by the non-null parameters. A null value implies a don't-care wildcard value. OMITS DEPRECATED LANGUAGES.
      Specified by:
      getLanguageCompilerSpecPairs in interface LanguageService
      Parameters:
      query - TODO
      Returns:
    • getLanguageCompilerSpecPairs

      public List<LanguageCompilerSpecPair> getLanguageCompilerSpecPairs(ExternalLanguageCompilerSpecQuery query)
      Description copied from interface: LanguageService
      Returns all known language/compiler spec pairs which satisfy the criteria identify by the non-null parameters. A null value implies a don't-care wildcard value. OMITS DEPRECATED LANGUAGES. This uses an ExternalLanguageCompilerSpecQuery rather than a LanguageCompilerSpecQuery.
      Specified by:
      getLanguageCompilerSpecPairs in interface LanguageService
      Returns:
    • getLanguageDescriptions

      public List<LanguageDescription> getLanguageDescriptions(Processor processor)
      Description copied from interface: LanguageService
      Returns all language Descriptions associated with the given processor.
      Specified by:
      getLanguageDescriptions in interface LanguageService
      Parameters:
      processor - the processor for which to retrieve all know language descriptions.
    • getDefinedExternalToolNames

      public static List<String> getDefinedExternalToolNames(String languageId, String tool, boolean includeDeprecated)
      Returns external names for specified language associated with other tools. For example, x86 languages are usually referred to as "metapc" by IDA-PRO.
      Parameters:
      languageId - language to search against
      tool - name of external tool to search against
      includeDeprecated - include deprecated LanguageDescriptions
      Returns:
      external names for this language associated with tool
    • getDefaultLanguage

      public Language getDefaultLanguage(Processor processor) throws LanguageNotFoundException
      Description copied from interface: LanguageService
      Returns the default Language to use for the given processor;
      Specified by:
      getDefaultLanguage in interface LanguageService
      Parameters:
      processor - the processor for which to get a language.
      Throws:
      LanguageNotFoundException - if there is no languages at all for the given processor.
    • stateChanged

      public void stateChanged(ChangeEvent e)
      Specified by:
      stateChanged in interface ChangeListener