Add a syscall.name expression function

This commit is contained in:
Duncan Ogilvie 2024-02-19 02:29:08 +01:00
parent 517a855e9a
commit 9e4c1a4d26
3 changed files with 11 additions and 0 deletions

View File

@ -169,6 +169,8 @@ void ExpressionFunctions::Init()
ExpressionFunctions::Register("streq", ValueTypeNumber, { ValueTypeString, ValueTypeString }, Exprfunc::streq);
ExpressionFunctions::Register("strieq", ValueTypeNumber, { ValueTypeString, ValueTypeString }, Exprfunc::strieq);
ExpressionFunctions::Register("strlen", ValueTypeNumber, { ValueTypeString }, Exprfunc::strlen);
ExpressionFunctions::Register("syscall.name", ValueTypeString, { ValueTypeNumber }, Exprfunc::syscall_name);
}
bool ExpressionFunctions::Register(const String & name, const ValueType & returnType, const std::vector<ValueType> & argTypes, const CBEXPRESSIONFUNCTION & cbFunction, void* userdata)

View File

@ -11,6 +11,7 @@
#include "value.h"
#include "TraceRecord.h"
#include "exhandlerinfo.h"
#include "exception.h"
#include <vector>
#include <regex>
#include <string>
@ -812,4 +813,10 @@ namespace Exprfunc
{
return utf16<true>(result, argc, argv, userdata);
}
bool syscall_name(ExpressionValue* result, int argc, const ExpressionValue* argv, void* userdata)
{
*result = ValueString(SyscallToName(argv[0].number));
return true;
}
}

View File

@ -101,4 +101,6 @@ namespace Exprfunc
bool utf8_strict(ExpressionValue* result, int argc, const ExpressionValue* argv, void* userdata);
bool utf16(ExpressionValue* result, int argc, const ExpressionValue* argv, void* userdata);
bool utf16_strict(ExpressionValue* result, int argc, const ExpressionValue* argv, void* userdata);
bool syscall_name(ExpressionValue* result, int argc, const ExpressionValue* argv, void* userdata);
}