Class CParserUtils


  • public class CParserUtils
    extends java.lang.Object
    • Method Detail

      • parseSignature

        public static FunctionDefinitionDataType parseSignature​(DataTypeManagerService service,
                                                                Program program,
                                                                java.lang.String signatureText)
        Parse the given function signature text. Any exceptions will be handled herein by showing an error dialog (null is returned in that case).
        Parameters:
        service - the service used to access DataTypeManagers or null to use only the program's data type manager.
        program - the program against which data types will be resolved
        signatureText - the signature to parse
        Returns:
        the data type that is created as a result of parsing; null if there was a problem
        See Also:
        parseSignature(DataTypeManagerService, Program, String, boolean)
      • parseSignature

        public static FunctionDefinitionDataType parseSignature​(DataTypeManagerService service,
                                                                Program program,
                                                                java.lang.String signatureText,
                                                                boolean handleExceptions)
                                                         throws ghidra.app.util.cparser.C.ParseException
        Parse the given function signature text. Any exceptions will be handled herein by showing an error dialog (null is returned in that case).
        Parameters:
        service - the service used to access DataTypeManagers or null to use only the program's data type manager.
        program - the program against which data types will be resolved
        signatureText - the signature to parse
        handleExceptions - true signals that this method should deal with exceptions, showing error messages as necessary; false signals to throw any encountered parsing exceptions. This allows clients to perform exception handling that better matches their workflow.
        Returns:
        the data type that is created as a result of parsing; null if there was a problem
        Throws:
        ghidra.app.util.cparser.C.ParseException
      • handleParseProblem

        public static java.lang.String handleParseProblem​(java.lang.Throwable t,
                                                          java.lang.String functionString)
        Given a throwable, attempt pull out the significant error parts to generate a user-friendly error message.
        Parameters:
        t - the throwable to examine, originating from the CParser.
        functionString - the full function signature text that was parsed by the parser.
        Returns:
        a user-friendly error message, or null if this class did not know how to handle the given exception.