-
Notifications
You must be signed in to change notification settings - Fork 3
Expand file tree
/
Copy pathcallers_callees.cpp
More file actions
31 lines (27 loc) · 946 Bytes
/
callers_callees.cpp
File metadata and controls
31 lines (27 loc) · 946 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
// Show callers and callees of the first function.
using namespace ida;
int main() {
auto fn = function::by_index(0);
if (!fn) {
msg("No functions found\n");
return 1;
}
auto addr = fn->start();
auto nm = function::name_at(addr).value_or("???");
msg("=== %s (%a) ===\n", nm.c_str(), addr);
if (auto callers = function::callers(addr); callers && !callers->empty()) {
msg("Callers (%zu):\n", callers->size());
for (auto ea : *callers)
msg(" %a %s\n", ea, function::name_at(ea).value_or("???").c_str());
} else {
msg("Callers: (none)\n");
}
if (auto callees = function::callees(addr); callees && !callees->empty()) {
msg("Callees (%zu):\n", callees->size());
for (auto ea : *callees)
msg(" %a %s\n", ea, function::name_at(ea).value_or("???").c_str());
} else {
msg("Callees: (none)\n");
}
return 0;
}