diff --git a/shell/i.cpp b/shell/i.cpp index aff5642..6c04ecc 100644 --- a/shell/i.cpp +++ b/shell/i.cpp @@ -140,16 +140,14 @@ struct _isc_args static struct _isc_args parse_isc(Session &, Parser &parser) { - struct _isc_args args - { - }; + _isc_args args; parser.option("sort", [&args](std::string const &value) { args.sort = (value == "true"); }); + parser.option("vspace", + [&args](std::string const &value) { args.vspace_name = value; }); parser.accept_options(); - args.vspace_name = parser.at_end() ? "" : parser.symbol("vspace_name"); - parser.accept_options(); parser.end(); return args; @@ -169,16 +167,18 @@ bool operator<(const SyscallInfo &left, const SyscallInfo &right) void _isc(Session &session, std::string vspace_name, bool sort) { VirtualSpace *space = session.current_space; - if(vspace_name != "") + if(!vspace_name.empty()) space = session.get_space(vspace_name); - if(!space) - return; - // TODO: is doesn't work + if(!space) + throw CommandError("virtual space '{}' does not exist", vspace_name); OS *os = space->os_analysis(); - if(!os) - throw CommandError("os analysis on '{}' failed", vspace_name); + if(!os) { + if (!vspace_name.empty()) + throw CommandError("OS analysis on '{}' failed", vspace_name); + throw CommandError("OS analysis failed"); + } int total = os->syscall_count(); auto info = std::make_unique(total); @@ -257,7 +257,7 @@ static ShellCommand _isc_cmd( _isc(s, args.vspace_name, args.sort); }, [](Session &s, Parser &p) { parse_isc(s, p); }, "Info Syscalls", R"( -isc [sort=true] [] +isc [sort=true] [vspace=] Prints the syscall table for the specified virtual space (defaults to the current one). By default, syscalls are enumerated by syscall number. If