| 21 | using namespace LIEF::MachO; |
| 22 | |
| 23 | void print_binary(const Binary& binary) { |
| 24 | std::cout << binary.header() << '\n'; |
| 25 | |
| 26 | std::cout << "== Library ==" << '\n'; |
| 27 | for (const DylibCommand& library : binary.libraries()) { |
| 28 | std::cout << library << '\n'; |
| 29 | } |
| 30 | std::cout << '\n'; |
| 31 | |
| 32 | std::cout << "== Sections ==" << '\n'; |
| 33 | for (const Section& section : binary.sections()) { |
| 34 | std::cout << section << '\n'; |
| 35 | } |
| 36 | |
| 37 | for (const LoadCommand& cmd : binary.commands()) { |
| 38 | std::cout << cmd << '\n'; |
| 39 | std::cout << "======================" << '\n'; |
| 40 | } |
| 41 | |
| 42 | std::cout << "== Symbols ==" << '\n'; |
| 43 | for (const Symbol& symbol : binary.symbols()) { |
| 44 | std::cout << symbol << '\n'; |
| 45 | } |
| 46 | |
| 47 | |
| 48 | std::cout << "== Exported symbols ==" << '\n'; |
| 49 | for (const Symbol& symbol : binary.exported_symbols()) { |
| 50 | std::cout << symbol << '\n'; |
| 51 | } |
| 52 | |
| 53 | std::cout << "== Imported symbols ==" << '\n'; |
| 54 | for (const Symbol& symbol : binary.imported_symbols()) { |
| 55 | std::cout << symbol << '\n'; |
| 56 | } |
| 57 | |
| 58 | |
| 59 | std::cout << "== Relocations ==" << '\n'; |
| 60 | for (const Relocation& relocation : binary.relocations()) { |
| 61 | std::cout << relocation << '\n'; |
| 62 | } |
| 63 | |
| 64 | } |
| 65 | |
| 66 | int main(int argc, char **argv) { |
| 67 | LIEF::logging::set_level(LIEF::logging::LEVEL::DEBUG); |
no test coverage detected