| Absolute File Name: | /home/qt/qt5_coco/qt5/qtbase/src/corelib/plugin/qlibrary_unix.cpp |
| Switch to Source code | Preprocessed file |
| Line | Source | Count | ||||||||||||||||||
|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|
| 1 | - | |||||||||||||||||||
| 2 | - | |||||||||||||||||||
| 3 | - | |||||||||||||||||||
| 4 | - | |||||||||||||||||||
| 5 | - | |||||||||||||||||||
| 6 | - | |||||||||||||||||||
| 7 | - | |||||||||||||||||||
| 8 | - | |||||||||||||||||||
| 9 | static QString qdlerror() | - | ||||||||||||||||||
| 10 | { | - | ||||||||||||||||||
| 11 | - | |||||||||||||||||||
| 12 | - | |||||||||||||||||||
| 13 | - | |||||||||||||||||||
| 14 | const char *err = dlerror(); | - | ||||||||||||||||||
| 15 | - | |||||||||||||||||||
| 16 | - | |||||||||||||||||||
| 17 | - | |||||||||||||||||||
| 18 | return executed 33 times by 26 tests: err ? QLatin1Char('(') + QString::fromLocal8Bit(err) + QLatin1Char(')'): QString();return err ? QLatin1Char('(') + QString::fromLocal8Bit(err) + QLatin1Char(')'): QString();Executed by:
executed 33 times by 26 tests: return err ? QLatin1Char('(') + QString::fromLocal8Bit(err) + QLatin1Char(')'): QString();Executed by:
| 33 | ||||||||||||||||||
| 19 | } | - | ||||||||||||||||||
| 20 | - | |||||||||||||||||||
| 21 | QStringList QLibraryPrivate::suffixes_sys(const QString& fullVersion) | - | ||||||||||||||||||
| 22 | { | - | ||||||||||||||||||
| 23 | QStringList suffixes; | - | ||||||||||||||||||
| 24 | if (!fullVersion.isEmpty()
| 57-70 | ||||||||||||||||||
| 25 | suffixes << QString::fromLatin1(".so.%1").arg(fullVersion); | - | ||||||||||||||||||
| 26 | } executed 70 times by 26 tests: else {end of blockExecuted by:
| 70 | ||||||||||||||||||
| 27 | suffixes << QLatin1String(".so"); | - | ||||||||||||||||||
| 28 | } executed 57 times by 28 tests: end of blockExecuted by:
| 57 | ||||||||||||||||||
| 29 | return executed 127 times by 42 tests: suffixes;return suffixes;Executed by:
executed 127 times by 42 tests: return suffixes;Executed by:
| 127 | ||||||||||||||||||
| 30 | } | - | ||||||||||||||||||
| 31 | - | |||||||||||||||||||
| 32 | QStringList QLibraryPrivate::prefixes_sys() | - | ||||||||||||||||||
| 33 | { | - | ||||||||||||||||||
| 34 | return executed 127 times by 42 tests: QStringList() << QLatin1String("lib");return QStringList() << QLatin1String("lib");Executed by:
executed 127 times by 42 tests: return QStringList() << QLatin1String("lib");Executed by:
| 127 | ||||||||||||||||||
| 35 | } | - | ||||||||||||||||||
| 36 | - | |||||||||||||||||||
| 37 | bool QLibraryPrivate::load_sys() | - | ||||||||||||||||||
| 38 | { | - | ||||||||||||||||||
| 39 | QString attempt; | - | ||||||||||||||||||
| 40 | - | |||||||||||||||||||
| 41 | QFileSystemEntry fsEntry(fileName); | - | ||||||||||||||||||
| 42 | - | |||||||||||||||||||
| 43 | QString path = fsEntry.path(); | - | ||||||||||||||||||
| 44 | QString name = fsEntry.fileName(); | - | ||||||||||||||||||
| 45 | if (path == QLatin1String(".")
| 0-436 | ||||||||||||||||||
| 46 | path.clear(); executed 94 times by 40 tests: path.clear();Executed by:
| 94 | ||||||||||||||||||
| 47 | else | - | ||||||||||||||||||
| 48 | path += QLatin1Char('/'); executed 436 times by 113 tests: path += QLatin1Char('/');Executed by:
| 436 | ||||||||||||||||||
| 49 | - | |||||||||||||||||||
| 50 | QStringList suffixes; | - | ||||||||||||||||||
| 51 | QStringList prefixes; | - | ||||||||||||||||||
| 52 | if (pluginState != IsAPlugin
| 123-407 | ||||||||||||||||||
| 53 | prefixes = prefixes_sys(); | - | ||||||||||||||||||
| 54 | suffixes = suffixes_sys(fullVersion); | - | ||||||||||||||||||
| 55 | } executed 123 times by 42 tests: end of blockExecuted by:
| 123 | ||||||||||||||||||
| 56 | int dlFlags = 0; | - | ||||||||||||||||||
| 57 | int loadHints = this->loadHints(); | - | ||||||||||||||||||
| 58 | if (loadHints & QLibrary::ResolveAllSymbolsHint
| 3-527 | ||||||||||||||||||
| 59 | dlFlags |= 0x00002; | - | ||||||||||||||||||
| 60 | } executed 3 times by 1 test: else {end of blockExecuted by:
| 3 | ||||||||||||||||||
| 61 | dlFlags |= 0x00001; | - | ||||||||||||||||||
| 62 | } executed 527 times by 134 tests: end of blockExecuted by:
| 527 | ||||||||||||||||||
| 63 | if (loadHints & QLibrary::ExportExternalSymbolsHint
| 0-530 | ||||||||||||||||||
| 64 | dlFlags |= 0x00100; | - | ||||||||||||||||||
| 65 | } never executed: end of block | 0 | ||||||||||||||||||
| 66 | - | |||||||||||||||||||
| 67 | else { | - | ||||||||||||||||||
| 68 | - | |||||||||||||||||||
| 69 | - | |||||||||||||||||||
| 70 | - | |||||||||||||||||||
| 71 | dlFlags |= 0; | - | ||||||||||||||||||
| 72 | } executed 530 times by 134 tests: end of blockExecuted by:
| 530 | ||||||||||||||||||
| 73 | - | |||||||||||||||||||
| 74 | - | |||||||||||||||||||
| 75 | if (loadHints & QLibrary::DeepBindHint
| 0-530 | ||||||||||||||||||
| 76 | dlFlags |= 0x00008; never executed: dlFlags |= 0x00008; | 0 | ||||||||||||||||||
| 77 | if (loadHints & QLibrary::PreventUnloadHint
| 123-407 | ||||||||||||||||||
| 78 | dlFlags |= 0x01000; | - | ||||||||||||||||||
| 79 | } executed 407 times by 111 tests: end of blockExecuted by:
| 407 | ||||||||||||||||||
| 80 | if (fsEntry.isAbsolute()
| 94-436 | ||||||||||||||||||
| 81 | suffixes.prepend(QString()); | - | ||||||||||||||||||
| 82 | prefixes.prepend(QString()); | - | ||||||||||||||||||
| 83 | } executed 436 times by 113 tests: else {end of blockExecuted by:
| 436 | ||||||||||||||||||
| 84 | suffixes.append(QString()); | - | ||||||||||||||||||
| 85 | prefixes.append(QString()); | - | ||||||||||||||||||
| 86 | } executed 94 times by 40 tests: end of blockExecuted by:
| 94 | ||||||||||||||||||
| 87 | - | |||||||||||||||||||
| 88 | bool retry = true; | - | ||||||||||||||||||
| 89 | for(int prefix = 0; retry
| 2-1100 | ||||||||||||||||||
| 90 | for(int suffix = 0; retry
| 2-1226 | ||||||||||||||||||
| 91 | if (!prefixes.at(prefix).isEmpty()
| 50-504 | ||||||||||||||||||
| 92 | continue; executed 50 times by 25 tests: continue;Executed by:
| 50 | ||||||||||||||||||
| 93 | if (!suffixes.at(suffix).isEmpty()
| 0-479 | ||||||||||||||||||
| 94 | continue; never executed: continue; | 0 | ||||||||||||||||||
| 95 | if (loadHints & QLibrary::LoadArchiveMemberHint
| 0-606 | ||||||||||||||||||
| 96 | attempt = name; | - | ||||||||||||||||||
| 97 | int lparen = attempt.indexOf(QLatin1Char('(')); | - | ||||||||||||||||||
| 98 | if (lparen == -1
| 0 | ||||||||||||||||||
| 99 | lparen = attempt.count(); never executed: lparen = attempt.count(); | 0 | ||||||||||||||||||
| 100 | attempt = path + prefixes.at(prefix) + attempt.insert(lparen, suffixes.at(suffix)); | - | ||||||||||||||||||
| 101 | } never executed: else {end of block | 0 | ||||||||||||||||||
| 102 | attempt = path + prefixes.at(prefix) + name + suffixes.at(suffix); | - | ||||||||||||||||||
| 103 | } executed 606 times by 134 tests: end of blockExecuted by:
| 606 | ||||||||||||||||||
| 104 | - | |||||||||||||||||||
| 105 | - | |||||||||||||||||||
| 106 | - | |||||||||||||||||||
| 107 | pHnd = dlopen(QFile::encodeName(attempt), dlFlags); | - | ||||||||||||||||||
| 108 | - | |||||||||||||||||||
| 109 | - | |||||||||||||||||||
| 110 | if (!pHnd
| 2-524 | ||||||||||||||||||
| 111 | - | |||||||||||||||||||
| 112 | - | |||||||||||||||||||
| 113 | - | |||||||||||||||||||
| 114 | - | |||||||||||||||||||
| 115 | retry = false; | - | ||||||||||||||||||
| 116 | } executed 2 times by 2 tests: end of blockExecuted by:
| 2 | ||||||||||||||||||
| 117 | } executed 606 times by 134 tests: end of blockExecuted by:
| 606 | ||||||||||||||||||
| 118 | } executed 572 times by 134 tests: end of blockExecuted by:
| 572 | ||||||||||||||||||
| 119 | if (!pHnd
| 6-524 | ||||||||||||||||||
| 120 | errorString = QLibrary::tr("Cannot load library %1: %2").arg(fileName).arg(qdlerror()); | - | ||||||||||||||||||
| 121 | } executed 6 times by 2 tests: end of blockExecuted by:
| 6 | ||||||||||||||||||
| 122 | if (pHnd
| 6-524 | ||||||||||||||||||
| 123 | qualifiedFileName = attempt; | - | ||||||||||||||||||
| 124 | errorString.clear(); | - | ||||||||||||||||||
| 125 | } executed 524 times by 134 tests: end of blockExecuted by:
| 524 | ||||||||||||||||||
| 126 | return executed 530 times by 134 tests: (pHnd != 0);return (pHnd != 0);Executed by:
executed 530 times by 134 tests: return (pHnd != 0);Executed by:
| 530 | ||||||||||||||||||
| 127 | } | - | ||||||||||||||||||
| 128 | - | |||||||||||||||||||
| 129 | bool QLibraryPrivate::unload_sys() | - | ||||||||||||||||||
| 130 | { | - | ||||||||||||||||||
| 131 | - | |||||||||||||||||||
| 132 | - | |||||||||||||||||||
| 133 | - | |||||||||||||||||||
| 134 | - | |||||||||||||||||||
| 135 | if (dlclose(pHnd)
| 0-1076 | ||||||||||||||||||
| 136 | errorString = QLibrary::tr("Cannot unload library %1: %2").arg(fileName).arg(qdlerror()); | - | ||||||||||||||||||
| 137 | - | |||||||||||||||||||
| 138 | return never executed: false;return false;never executed: return false; | 0 | ||||||||||||||||||
| 139 | } | - | ||||||||||||||||||
| 140 | - | |||||||||||||||||||
| 141 | errorString.clear(); | - | ||||||||||||||||||
| 142 | return executed 1076 times by 248 tests: true;return true;Executed by:
executed 1076 times by 248 tests: return true;Executed by:
| 1076 | ||||||||||||||||||
| 143 | } | - | ||||||||||||||||||
| 144 | - | |||||||||||||||||||
| 145 | - | |||||||||||||||||||
| 146 | __attribute__((visibility("default"))) QFunctionPointer qt_linux_find_symbol_sys(const char *symbol) | - | ||||||||||||||||||
| 147 | { | - | ||||||||||||||||||
| 148 | return never executed: QFunctionPointer(dlsym(((void *) 0), symbol));return QFunctionPointer(dlsym(((void *) 0), symbol));never executed: return QFunctionPointer(dlsym(((void *) 0), symbol)); | 0 | ||||||||||||||||||
| 149 | } | - | ||||||||||||||||||
| 150 | QFunctionPointer QLibraryPrivate::resolve_sys(const char* symbol) | - | ||||||||||||||||||
| 151 | { | - | ||||||||||||||||||
| 152 | QFunctionPointer address = QFunctionPointer(dlsym(pHnd, symbol)); | - | ||||||||||||||||||
| 153 | - | |||||||||||||||||||
| 154 | if (!address
| 27-3600 | ||||||||||||||||||
| 155 | errorString = QLibrary::tr("Cannot resolve symbol \"%1\" in %2: %3").arg( | - | ||||||||||||||||||
| 156 | QString::fromLatin1(symbol)).arg(fileName).arg(qdlerror()); | - | ||||||||||||||||||
| 157 | } executed 27 times by 26 tests: else {end of blockExecuted by:
| 27 | ||||||||||||||||||
| 158 | errorString.clear(); | - | ||||||||||||||||||
| 159 | } executed 3600 times by 134 tests: end of blockExecuted by:
| 3600 | ||||||||||||||||||
| 160 | return executed 3627 times by 134 tests: address;return address;Executed by:
executed 3627 times by 134 tests: return address;Executed by:
| 3627 | ||||||||||||||||||
| 161 | } | - | ||||||||||||||||||
| 162 | - | |||||||||||||||||||
| 163 | - | |||||||||||||||||||
| Switch to Source code | Preprocessed file |