File indexing completed on 2024-05-12 09:46:30
0001 /* 0002 Copyright (C) 2015 Volker Krause <vkrause@kde.org> 0003 0004 This program is free software; you can redistribute it and/or modify it 0005 under the terms of the GNU Library General Public License as published by 0006 the Free Software Foundation; either version 2 of the License, or (at your 0007 option) any later version. 0008 0009 This program is distributed in the hope that it will be useful, but WITHOUT 0010 ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or 0011 FITNESS FOR A PARTICULAR PURPOSE. See the GNU Library General Public 0012 License for more details. 0013 0014 You should have received a copy of the GNU General Public License 0015 along with this program. If not, see <https://www.gnu.org/licenses/>. 0016 */ 0017 0018 #include <config-elf-dissector-version.h> 0019 0020 #include <checks/dependenciescheck.h> 0021 0022 #include <elf/elffileset.h> 0023 0024 #include <QCoreApplication> 0025 #include <QCommandLineParser> 0026 0027 int main(int argc, char** argv) 0028 { 0029 QCoreApplication::setApplicationName(QStringLiteral("ELF Dissector")); 0030 QCoreApplication::setOrganizationName(QStringLiteral("KDE")); 0031 QCoreApplication::setOrganizationDomain(QStringLiteral("kde.org")); 0032 QCoreApplication::setApplicationVersion(QStringLiteral(ELF_DISSECTOR_VERSION_STRING)); 0033 0034 QCoreApplication app(argc, argv); 0035 0036 QCommandLineParser parser; 0037 parser.addHelpOption(); 0038 parser.addVersionOption(); 0039 QCommandLineOption recursiveOption(QStringList() << QStringLiteral("r") << QStringLiteral("recursive"), QStringLiteral("Check all dependencies recursively as well")); 0040 parser.addOption(recursiveOption); 0041 parser.addPositionalArgument(QStringLiteral("elf"), QStringLiteral("ELF library to open"), QStringLiteral("<elf>")); 0042 parser.process(app); 0043 0044 foreach (const auto &fileName, parser.positionalArguments()) { 0045 ElfFileSet set; 0046 set.addFile(fileName); 0047 if (set.size() == 0) 0048 continue; 0049 const auto unusedDeps = DependenciesCheck::unusedDependencies(&set, parser.isSet(recursiveOption) ? -1 : 0); 0050 DependenciesCheck::printUnusedDependencies(&set, unusedDeps); 0051 } 0052 0053 return 0; 0054 }