| 1030 | } |
| 1031 | |
| 1032 | void Decoder::initConfigFunctions() |
| 1033 | { |
| 1034 | for (auto& p : _fnc2addr) |
| 1035 | { |
| 1036 | llvm::Function* f = p.first; |
| 1037 | |
| 1038 | if (_config->getConfigFunction(p.second)) // functions from IDA |
| 1039 | { |
| 1040 | continue; |
| 1041 | } |
| 1042 | |
| 1043 | Address start = p.second; |
| 1044 | Address end = getFunctionEndAddress(f); |
| 1045 | end = end > start ? end : Address(start + 1); |
| 1046 | |
| 1047 | // TODO: this is really bad, should be solved by better design of config |
| 1048 | // updates |
| 1049 | common::Function* cf = const_cast<common::Function*>( |
| 1050 | _config->insertFunction(f, start, end)); |
| 1051 | |
| 1052 | if (_imports.count(start)) |
| 1053 | { |
| 1054 | cf->setIsDynamicallyLinked(); |
| 1055 | f->deleteBody(); |
| 1056 | } |
| 1057 | else if (_staticFncs.count(start)) |
| 1058 | { |
| 1059 | cf->setIsStaticallyLinked(); |
| 1060 | // Can not delete body here because of main detection. |
| 1061 | //f->deleteBody(); |
| 1062 | } |
| 1063 | |
| 1064 | std::string realName = _names->getPreferredNameForAddress(start); |
| 1065 | if (cf->getName() != realName) |
| 1066 | { |
| 1067 | cf->setRealName(realName); |
| 1068 | } |
| 1069 | |
| 1070 | cf->setIsExported(_exports.count(start)); |
| 1071 | |
| 1072 | auto dbgIt = _debugFncs.find(start); |
| 1073 | if (dbgIt != _debugFncs.end()) |
| 1074 | { |
| 1075 | auto* df = dbgIt->second; |
| 1076 | cf->setIsFromDebug(true); |
| 1077 | cf->setStartLine(df->getStartLine()); |
| 1078 | cf->setEndLine(df->getEndLine()); |
| 1079 | cf->setSourceFileName(df->getSourceFileName()); |
| 1080 | } |
| 1081 | } |
| 1082 | |
| 1083 | for (auto* f : _c2l->getPseudoAsmFunctions()) |
| 1084 | { |
| 1085 | _config->addPseudoAsmFunction(f); |
| 1086 | } |
| 1087 | } |
| 1088 | |
| 1089 | } // namespace bin2llvmir |
nothing calls this directly
no test coverage detected