From 08c000539c3062f194aeb7a3d1136b733e8f0194 Mon Sep 17 00:00:00 2001 From: Dr-Carlos Date: Tue, 19 Apr 2022 07:32:09 +0930 Subject: [PATCH] _isc: use os->syscall_at instead of remove_if --- shell/i.cpp | 25 ++++++++++++++----------- 1 file changed, 14 insertions(+), 11 deletions(-) diff --git a/shell/i.cpp b/shell/i.cpp index 4355157..a17412d 100644 --- a/shell/i.cpp +++ b/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(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]);