forked from Lephenixnoir/fxos
_isc: use os->syscall_at instead of remove_if
This commit is contained in:
parent
e037d5889c
commit
08c000539c
25
shell/i.cpp
25
shell/i.cpp
|
@ -189,23 +189,26 @@ void _isc(Session &session, std::string vspace_name, bool sort,
|
|||
return;
|
||||
}
|
||||
|
||||
if(!addresses.empty()) {
|
||||
for(uint32_t address: addresses) {
|
||||
int syscall = os->find_syscall(address);
|
||||
if(syscall == -1)
|
||||
continue;
|
||||
|
||||
fmt::print(theme(3), " 0x{:08x}", address);
|
||||
fmt::print(theme(10), " %{:01x}", syscall);
|
||||
fmt::print("\n");
|
||||
}
|
||||
|
||||
return;
|
||||
}
|
||||
|
||||
int total = os->syscall_count();
|
||||
auto info = std::make_unique<SyscallInfo[]>(total);
|
||||
|
||||
for(int i = 0; i < total; i++)
|
||||
info[i] = (SyscallInfo) {.address = os->syscall(i), .id = i};
|
||||
|
||||
if(!addresses.empty())
|
||||
std::remove_if(&info[0], &info[total],
|
||||
[addresses, &total](const SyscallInfo &item) {
|
||||
if(std::find(addresses.begin(), addresses.end(), item.address)
|
||||
== addresses.end()) {
|
||||
total--;
|
||||
return true;
|
||||
}
|
||||
return false;
|
||||
});
|
||||
|
||||
if(sort)
|
||||
std::sort(&info[0], &info[total]);
|
||||
|
||||
|
|
Loading…
Reference in New Issue