MCPcopy Create free account
hub / github.com/Vector35/binaryninja-api / DemangleSymbol

Method DemangleSymbol

demangler/msvc/demangle_msvc.cpp:1696–1790  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

1694
1695
1696Demangle::DemangleContext Demangle::DemangleSymbol()
1697{
1698 m_logger->LogDebug("%s: '%s'\n", __FUNCTION__, reader.GetRaw());
1699 m_logger->Indent();
1700 BNNameType classFunctionType = NoNameType;
1701 QualifiedName varName;
1702
1703 if (reader.Peek() == '.')
1704 {
1705 reader.Consume();
1706
1707 return { DemangleTypeInfoName(), NoAccess, NoScope };
1708 }
1709
1710 if (reader.Read() != '?')
1711 {
1712 throw DemangleException();
1713 }
1714
1715 DemangleName(varName, classFunctionType, m_backrefList);
1716 m_logger->LogDebug("Done demangling Name: '%s' - '%s'", varName.GetString().c_str(), reader.GetRaw());
1717 m_varName = varName;
1718
1719 DemangleContext context;
1720
1721 if (classFunctionType == StringNameType)
1722 {
1723 context = { DemangleString(), NoAccess, NoScope };
1724 return context;
1725 }
1726
1727 char funcType = reader.Read();
1728 switch(funcType)
1729 {
1730 case '0': context = {DemangleData(), PrivateAccess, StaticScope }; break;
1731 case '1': context = {DemangleData(), ProtectedAccess, StaticScope }; break;
1732 case '2': context = {DemangleData(), PublicAccess, StaticScope }; break;
1733 case '3': context = {DemangleData(), NoAccess, NoScope }; break;
1734 case '4': context = {DemangleData(), NoAccess, NoScope }; break;
1735 case '5': context = {DemangleVTable(), NoAccess, NoScope }; break;
1736 case '6': context = {DemangleVTable(), NoAccess, NoScope }; break;
1737 case '7': context = {DemangleVTable(), NoAccess, NoScope }; break;
1738 case '8': context = {DemanagleRTTI(classFunctionType), NoAccess, NoScope }; break;
1739 case '9': context = {DemanagleRTTI(classFunctionType), NoAccess, NoScope }; break;
1740 case 'A': context = {DemangleFunction(classFunctionType, true, m_backrefList, PrivateFunctionClass), PrivateAccess, NoScope }; break;
1741 case 'B': context = {DemangleFunction(classFunctionType, true, m_backrefList, PrivateFunctionClass), PrivateAccess, NoScope }; break;
1742 case 'C': context = {DemangleFunction(classFunctionType, false, m_backrefList, PrivateFunctionClass | StaticFunctionClass), PrivateAccess, StaticScope }; break;
1743 case 'D': context = {DemangleFunction(classFunctionType, false, m_backrefList, PrivateFunctionClass | StaticFunctionClass), PrivateAccess, StaticScope }; break;
1744 case 'E': context = {DemangleFunction(classFunctionType, true, m_backrefList, PrivateFunctionClass | VirtualFunctionClass), PrivateAccess, VirtualScope}; break;
1745 case 'F': context = {DemangleFunction(classFunctionType, true, m_backrefList, PrivateFunctionClass | VirtualFunctionClass), PrivateAccess, VirtualScope}; break;
1746 case 'G': context = {DemangleFunction(classFunctionType, true, m_backrefList, PrivateFunctionClass | StaticThunkFunctionClass), PrivateAccess, ThunkScope }; break;
1747 case 'H': context = {DemangleFunction(classFunctionType, true, m_backrefList, PrivateFunctionClass | StaticThunkFunctionClass), PrivateAccess, ThunkScope }; break;
1748 case 'I': context = {DemangleFunction(classFunctionType, true, m_backrefList, ProtectedFunctionClass), ProtectedAccess, NoScope }; break;
1749 case 'J': context = {DemangleFunction(classFunctionType, true, m_backrefList, ProtectedFunctionClass), ProtectedAccess, NoScope }; break;
1750 case 'K': context = {DemangleFunction(classFunctionType, false, m_backrefList, ProtectedFunctionClass | StaticFunctionClass), ProtectedAccess, StaticScope }; break;
1751 case 'L': context = {DemangleFunction(classFunctionType, false, m_backrefList, ProtectedFunctionClass | StaticFunctionClass), ProtectedAccess, StaticScope }; break;
1752 case 'M': context = {DemangleFunction(classFunctionType, true, m_backrefList, ProtectedFunctionClass | VirtualFunctionClass), ProtectedAccess, VirtualScope}; break;
1753 case 'N': context = {DemangleFunction(classFunctionType, true, m_backrefList, ProtectedFunctionClass | VirtualFunctionClass), ProtectedAccess, VirtualScope}; break;

Callers 1

DemangleMSMethod · 0.45

Calls 9

LogDebugMethod · 0.80
IndentMethod · 0.80
c_strMethod · 0.80
DemangleExceptionClass · 0.70
GetRawMethod · 0.45
PeekMethod · 0.45
ConsumeMethod · 0.45
ReadMethod · 0.45
GetStringMethod · 0.45

Tested by

no test coverage detected