MCPcopy Create free account
hub / github.com/lief-project/LIEF / print_binary

Function print_binary

examples/cpp/macho_reader.cpp:23–64  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

21using namespace LIEF::MachO;
22
23void 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
66int main(int argc, char **argv) {
67 LIEF::logging::set_level(LIEF::logging::LEVEL::DEBUG);

Callers 1

mainFunction · 0.70

Calls 8

headerMethod · 0.45
librariesMethod · 0.45
sectionsMethod · 0.45
commandsMethod · 0.45
symbolsMethod · 0.45
exported_symbolsMethod · 0.45
imported_symbolsMethod · 0.45
relocationsMethod · 0.45

Tested by

no test coverage detected