| 23 | using namespace LIEF::ELF; |
| 24 | |
| 25 | int main(int argc, char **argv) { |
| 26 | |
| 27 | LIEF::logging::set_level(LIEF::logging::LEVEL::DEBUG); |
| 28 | if (argc != 2) { |
| 29 | std::cerr << "Usage: " << argv[0] << " <ELF binary>" << '\n'; |
| 30 | return EXIT_FAILURE; |
| 31 | } |
| 32 | |
| 33 | |
| 34 | std::unique_ptr<const Binary> binary = std::unique_ptr<const Binary>{Parser::parse(argv[1])}; |
| 35 | if (binary == nullptr) { |
| 36 | return EXIT_FAILURE; |
| 37 | } |
| 38 | |
| 39 | binary->functions(); |
| 40 | |
| 41 | std::cout << "Binary: " << argv[1] << '\n'; |
| 42 | std::cout << "Interpreter: " << binary->interpreter() << '\n'; |
| 43 | std::cout << "== Header ==" << '\n'; |
| 44 | std::cout << binary->header() << '\n'; |
| 45 | |
| 46 | std::cout << "== Sections ==" << '\n'; |
| 47 | for (const Section& section : binary->sections()) { |
| 48 | std::cout << section << '\n'; |
| 49 | } |
| 50 | std::cout << '\n'; |
| 51 | |
| 52 | std::cout << "== Segments ==" << '\n'; |
| 53 | for (const Segment& segment : binary->segments()) { |
| 54 | std::cout << segment << '\n'; |
| 55 | } |
| 56 | std::cout << '\n'; |
| 57 | |
| 58 | std::cout << "== Dynamic entries ==" << '\n'; |
| 59 | for (const DynamicEntry& entry : binary->dynamic_entries()) { |
| 60 | std::cout << entry << '\n'; |
| 61 | } |
| 62 | |
| 63 | auto symtab_symbols = binary->symtab_symbols(); |
| 64 | if (symtab_symbols.size() > 0) { |
| 65 | std::cout << "== .symtab (debug) symbols ==" << '\n'; |
| 66 | for (const Symbol& symbol : symtab_symbols) { |
| 67 | std::cout << symbol << '\n'; |
| 68 | } |
| 69 | } |
| 70 | |
| 71 | std::cout << "== Dynamics symbols ==" << '\n'; |
| 72 | for (const Symbol& symbol : binary->dynamic_symbols()) { |
| 73 | std::cout << symbol << '\n'; |
| 74 | } |
| 75 | |
| 76 | std::cout << "== Exported symbols ==" << '\n'; |
| 77 | for (const Symbol& symbol : binary->exported_symbols()) { |
| 78 | std::cout << symbol << '\n'; |
| 79 | } |
| 80 | |
| 81 | |
| 82 | std::cout << "== Imported symbols ==" << '\n'; |
nothing calls this directly
no test coverage detected