-
Notifications
You must be signed in to change notification settings - Fork 1
Expand file tree
/
Copy pathmain.cpp
More file actions
34 lines (27 loc) · 1005 Bytes
/
main.cpp
File metadata and controls
34 lines (27 loc) · 1005 Bytes
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
#include "sym-elf.h"
#include "filemapping.h"
#include <cstdint>
#include <iomanip>
#include <iostream>
#include <memory>
#include <vector>
using namespace std;
int main(int argc, const char *argv[])
{
if (argc < 2)
return -1;
shared_ptr<const symreader::mapped_region> image = symreader::map_file(argv[1]);
cout << hex << setfill('0');
//symreader::read_sections(&image[0], image.size(), [] (const symreader::section &s) {
// cout << "Section: " << s.name << endl;
// cout << " Index: " << setw(8) << s.index << endl;
// cout << " Virtual address: " << setw(8) << s.virtual_address << endl;
// cout << " File offset: " << setw(8) << s.file_offset << endl;
// cout << " Size: " << setw(8) << s.size << endl;
// cout << " Entry size: " << setw(8) << s.entry_size << endl;
// cout << endl;
//});
symreader::read_symbols(image->first, image->second, [] (const symreader::symbol &s) {
cout << s.name << "\t" << setw(8) << s.virtual_address << "\t" << setw(8) << s.size << endl;
});
}