forked from Lephenixnoir/fxos
_isc: add vspace as an option and fix it
This commit is contained in:
parent
0f5c1c2eba
commit
631482e4f5
24
shell/i.cpp
24
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 <vspace_name> 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<SyscallInfo[]>(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] [<vspace_name>]
|
||||
isc [sort=true] [vspace=<virtual_name>]
|
||||
|
||||
Prints the syscall table for the specified virtual space (defaults to the
|
||||
current one). By default, syscalls are enumerated by syscall number. If
|
||||
|
|
Loading…
Reference in New Issue