split out debug
This commit is contained in:
29
source/qjs_debug.c
Normal file
29
source/qjs_debug.c
Normal file
@@ -0,0 +1,29 @@
|
||||
#include "qjs_debug.h"
|
||||
#include "qjs_macros.h"
|
||||
#include "jsffi.h"
|
||||
|
||||
// Debug function implementations
|
||||
|
||||
JSC_CCALL(debug_stack_depth, return number2js(js,js_debugger_stack_depth(js)))
|
||||
JSC_CCALL(debug_build_backtrace, return js_debugger_build_backtrace(js,NULL))
|
||||
JSC_CCALL(debug_closure_vars, return js_debugger_closure_variables(js,argv[0]))
|
||||
JSC_CCALL(debug_local_vars, return js_debugger_local_variables(js, js2number(js,argv[0])))
|
||||
JSC_CCALL(debug_fn_info, return js_debugger_fn_info(js, argv[0]))
|
||||
JSC_CCALL(debug_backtrace_fns, return js_debugger_backtrace_fns(js,NULL))
|
||||
JSC_CCALL(debug_dump_obj, return js_dump_value(js, argv[0]))
|
||||
|
||||
static const JSCFunctionListEntry js_debug_funcs[] = {
|
||||
MIST_FUNC_DEF(debug, stack_depth, 0),
|
||||
MIST_FUNC_DEF(debug, build_backtrace, 0),
|
||||
MIST_FUNC_DEF(debug, closure_vars, 1),
|
||||
MIST_FUNC_DEF(debug, local_vars, 1),
|
||||
MIST_FUNC_DEF(debug, fn_info, 1),
|
||||
MIST_FUNC_DEF(debug, backtrace_fns,0),
|
||||
MIST_FUNC_DEF(debug, dump_obj, 1),
|
||||
};
|
||||
|
||||
JSValue js_debug_use(JSContext *js) {
|
||||
JSValue mod = JS_NewObject(js);
|
||||
JS_SetPropertyFunctionList(js,mod,js_debug_funcs,countof(js_debug_funcs));
|
||||
return mod;
|
||||
}
|
||||
8
source/qjs_debug.h
Normal file
8
source/qjs_debug.h
Normal file
@@ -0,0 +1,8 @@
|
||||
#ifndef QJS_DEBUG_H
|
||||
#define QJS_DEBUG_H
|
||||
|
||||
#include <quickjs.h>
|
||||
|
||||
JSValue js_debug_use(JSContext *ctx);
|
||||
|
||||
#endif
|
||||
Reference in New Issue
Block a user