From fcf16d187c8d36e15fc92f98129b5538a322739e Mon Sep 17 00:00:00 2001 From: zhangsizheng Date: Tue, 29 Apr 2025 17:24:37 +0800 Subject: [PATCH] Add OH_JSVM_SetDebugOption Signed-off-by: zhangsizheng --- ark_runtime/jsvm/jsvm.h | 14 ++++++++++++++ ark_runtime/jsvm/jsvm_types.h | 10 ++++++++++ 2 files changed, 24 insertions(+) diff --git a/ark_runtime/jsvm/jsvm.h b/ark_runtime/jsvm/jsvm.h index 06f4ce767..d211f329f 100644 --- a/ark_runtime/jsvm/jsvm.h +++ b/ark_runtime/jsvm/jsvm.h @@ -3567,6 +3567,20 @@ JSVM_EXTERN JSVM_Status OH_JSVM_TraceStop(JSVM_OutputStream stream, void* stream JSVM_EXTERN JSVM_Status OH_JSVM_SetHandlerForOOMError(JSVM_VM vm, JSVM_HandlerForOOMError handler); +/** + * @brief This API is used to enable/disable the given debug option for a certain JSVM_Env. + * + * @param env The environment that the API is invoked under. + * @param debugOption The debug option to be changed. + * @param isEnabled Whether to enable or disable the debug option. + * @return Returns JSVM funtions result code. + * {@link JSVM_OK } if the function executed successfully.\n + * {@link JSVM_INVALID_ARG } if env is NULL.\n + * + * @since 20 + */ +JSVM_EXTERN JSVM_Status OH_JSVM_SetDebugOption(JSVM_Env env, JSVM_DebugOption debugOption, bool isEnabled); + /** * @brief Set Handler For Fatal Error. If this function is invoked repeatedly, * only the last time takes effect. When handler is null, the previous setting is canceled. diff --git a/ark_runtime/jsvm/jsvm_types.h b/ark_runtime/jsvm/jsvm_types.h index 999214b1a..c598276f2 100644 --- a/ark_runtime/jsvm/jsvm_types.h +++ b/ark_runtime/jsvm/jsvm_types.h @@ -1015,6 +1015,16 @@ typedef void(JSVM_CDECL* JSVM_HandlerForGC)(JSVM_VM vm, * @since 18 */ typedef struct JSVM_Data__* JSVM_Data; + +/** + * @brief Debug options. + * + * @since 20 + */ +typedef enum { + /** Scope check. */ + JSVM_SCOPE_CHECK, +} JSVM_DebugOption; /** @} */ #endif /* ARK_RUNTIME_JSVM_JSVM_TYPE_H */ -- Gitee