Class DemangledObject

    • Field Detail

      • SPACE_PATTERN

        protected static final java.util.regex.Pattern SPACE_PATTERN
      • NAMESPACE_SEPARATOR

        protected static final java.lang.String NAMESPACE_SEPARATOR
        See Also:
        Constant Field Values
      • originalMangled

        protected java.lang.String originalMangled
      • utilDemangled

        protected java.lang.String utilDemangled
      • specialPrefix

        protected java.lang.String specialPrefix
      • specialMidfix

        protected java.lang.String specialMidfix
      • specialSuffix

        protected java.lang.String specialSuffix
      • visibility

        protected java.lang.String visibility
      • storageClass

        protected java.lang.String storageClass
      • isStatic

        protected boolean isStatic
      • isVirtual

        protected boolean isVirtual
      • isThunk

        protected boolean isThunk
      • isUnaligned

        protected boolean isUnaligned
      • isRestrict

        protected boolean isRestrict
      • basedName

        protected java.lang.String basedName
      • memberScope

        protected java.lang.String memberScope
    • Method Detail

      • getDemangledName

        public java.lang.String getDemangledName()
        Returns the unmodified demangled name of this object. This name may contain whitespace and other characters not supported for symbol or data type creation. See getName() for the same name modified for use within Ghidra.
        Returns:
        name of this DemangledObject
      • getName

        public java.lang.String getName()
        Returns the demangled name of this object. NOTE: unsupported symbol characters, like whitespace, will be converted to an underscore.
        Returns:
        name of this DemangledObject with unsupported characters converted to underscore
      • isConst

        public boolean isConst()
      • setConst

        public void setConst​(boolean isConst)
      • isVolatile

        public boolean isVolatile()
      • setVolatile

        public void setVolatile​(boolean isVolatile)
      • isPointer64

        public boolean isPointer64()
      • setPointer64

        public void setPointer64​(boolean isPointer64)
      • isStatic

        public boolean isStatic()
      • setStatic

        public void setStatic​(boolean isStatic)
      • isVirtual

        public boolean isVirtual()
      • setVirtual

        public void setVirtual​(boolean isVirtual)
      • isThunk

        public boolean isThunk()
      • setThunk

        public void setThunk​(boolean isThunk)
      • setUnaligned

        public void setUnaligned()
      • isUnaligned

        public boolean isUnaligned()
      • setRestrict

        public void setRestrict()
      • isRestrict

        public boolean isRestrict()
      • getBasedName

        public java.lang.String getBasedName()
      • setBasedName

        public void setBasedName​(java.lang.String basedName)
      • getMemberScope

        public java.lang.String getMemberScope()
      • setMemberScope

        public void setMemberScope​(java.lang.String memberScope)
      • setName

        public void setName​(java.lang.String name)
        Sets the name of the demangled object
        Parameters:
        name - the new name
      • setOriginalMangled

        public void setOriginalMangled​(java.lang.String mangled)
        Sets the original mangled name
        Parameters:
        mangled - the original mangled name
      • setUtilDemangled

        public void setUtilDemangled​(java.lang.String utilDemangled)
        Sets the demangled output from a supplemental utility.
        Parameters:
        utilDemangled - the demangled string
      • getUtilDemangled

        public java.lang.String getUtilDemangled()
        Gets the demangled output from a supplemental utility.
        Returns:
        the demangled String created for this object.
      • getNamespace

        public DemangledType getNamespace()
        Returns the namespace containing this demangled object.
        Returns:
        the namespace containing this demangled object
      • setNamespace

        public void setNamespace​(DemangledType namespace)
      • getVisibility

        public java.lang.String getVisibility()
      • setVisibilty

        public void setVisibilty​(java.lang.String visibility)
      • getStorageClass

        public java.lang.String getStorageClass()
      • setStorageClass

        public void setStorageClass​(java.lang.String storageClass)
      • getSpecialPrefix

        public java.lang.String getSpecialPrefix()
      • setSpecialPrefix

        public void setSpecialPrefix​(java.lang.String special)
      • getSpecialMidfix

        public java.lang.String getSpecialMidfix()
      • setSpecialMidfix

        public void setSpecialMidfix​(java.lang.String chargeType)
      • getSpecialSuffix

        public java.lang.String getSpecialSuffix()
      • setSpecialSuffix

        public void setSpecialSuffix​(java.lang.String specialSuffix)
      • getSignature

        public abstract java.lang.String getSignature​(boolean format)
        Returns a complete signature for the demangled symbol. For example: "unsigned long foo" "unsigned char * ClassA::getFoo(float, short *)" "void * getBar(int **, MyStruct &)" Note: based on the underlying mangling scheme, the return type may or may not be specified in the signature.
        Parameters:
        format - true if signature should be pretty printed
        Returns:
        a complete signature for the demangled symbol
      • setSignature

        public void setSignature​(java.lang.String signature)
        Sets the signature. Calling this method will override the auto-generated signature.
        Parameters:
        signature - the signature
      • toString

        public java.lang.String toString()
        Overrides:
        toString in class java.lang.Object
      • isAlreadyDemangled

        protected boolean isAlreadyDemangled​(Program program,
                                             Address address)
        Determine if the symbol at address has already been demangled. While memory symbols check for presence of demangledName, external symbols simply check if demangled/alternate name has already been assigned.
        Parameters:
        program - the program being modified
        address - address of demangled symbol
        Returns:
        true if symbol at address has already been demangled
      • generatePlateComment

        protected java.lang.String generatePlateComment()
      • pad

        protected java.lang.String pad​(int len)
      • createNamespace

        public static Namespace createNamespace​(Program program,
                                                DemangledType typeNamespace,
                                                Namespace parentNamespace,
                                                boolean functionPermitted)
        Get or create the specified typeNamespace. The returned namespace may only be a partial namespace if errors occurred. The caller should check the returned namespace and adjust any symbol creation accordingly. Caller should use #getResidualNamespacePath(DemangledType, Namespace) to handle the case where only a partial namespace has been returned.
        Parameters:
        program -
        typeNamespace - demangled namespace
        parentNamespace - root namespace to be used (e.g., library, global, etc.)
        functionPermitted - if true an existing function may be used as a namespace
        Returns:
        namespace or partial namespace if error occurs
      • ensureNameLength

        protected static java.lang.String ensureNameLength​(java.lang.String name)
        Ensure name does not pass the limit defined by Ghidra
        Parameters:
        name - the name whose length to restrict
        Returns:
        the name, updated as needed