10#ifndef __WSLUA_DEBUGGER_H__
11#define __WSLUA_DEBUGGER_H__
13#include "ws_symbol_export.h"
17typedef struct lua_State lua_State;
30 WSLUA_DEBUGGER_RUNNING,
33 } wslua_debugger_state_t;
47 WSLUA_HIT_COUNT_MODE_FROM = 0,
49 WSLUA_HIT_COUNT_MODE_EVERY = 1,
51 WSLUA_HIT_COUNT_MODE_ONCE = 2,
52 } wslua_hit_count_mode_t;
98 WS_DLL_PUBLIC
void wslua_debugger_init(lua_State *L);
104 WS_DLL_PUBLIC
bool wslua_debugger_is_enabled(
void);
110 WS_DLL_PUBLIC
void wslua_debugger_set_enabled(
bool enabled);
122 wslua_debugger_set_user_explicitly_disabled(
bool user_wants_debugger_stay_off);
136 wslua_debugger_get_user_explicitly_disabled(
void);
150 wslua_debugger_may_auto_enable_for_breakpoints(
void);
157 typedef void (*wslua_debugger_ui_update_cb_t)(
const char *file_path,
165 wslua_debugger_register_ui_callback(wslua_debugger_ui_update_cb_t cb);
170 WS_DLL_PUBLIC
void wslua_debugger_continue(
void);
178 WS_DLL_PUBLIC
void wslua_debugger_step_in(
void);
186 WS_DLL_PUBLIC
void wslua_debugger_step_over(
void);
194 WS_DLL_PUBLIC
void wslua_debugger_step_out(
void);
204 WS_DLL_PUBLIC
void wslua_debugger_set_variable_stack_level(int32_t level);
211 WS_DLL_PUBLIC
void wslua_debugger_run_to_line(
const char *file_path,
219 WS_DLL_PUBLIC
void wslua_debugger_add_breakpoint(
const char *file_path,
227 WS_DLL_PUBLIC
void wslua_debugger_remove_breakpoint(
const char *file_path,
237 wslua_debugger_set_breakpoint_active(
const char *file_path, int64_t line,
243 WS_DLL_PUBLIC
void wslua_debugger_clear_breakpoints(
void);
260 wslua_debugger_set_breakpoint_condition(
const char *file_path, int64_t line,
261 const char *condition);
275 wslua_debugger_set_breakpoint_hit_count_target(
const char *file_path,
288 wslua_debugger_set_breakpoint_hit_count_mode(
const char *file_path,
290 wslua_hit_count_mode_t mode);
304 wslua_debugger_set_breakpoint_log_message(
const char *file_path,
306 const char *message);
318 wslua_debugger_set_breakpoint_log_also_pause(
const char *file_path,
326 wslua_debugger_reset_breakpoint_hit_count(
const char *file_path,
332 WS_DLL_PUBLIC
void wslua_debugger_reset_all_breakpoint_hit_counts(
void);
348 wslua_debugger_check_condition_syntax(
const char *expression,
367 wslua_debugger_set_breakpoint_condition_error(
const char *file_path,
369 const char *err_msg);
377 WS_DLL_PUBLIC int32_t
378 wslua_debugger_get_breakpoint_state(
const char *file_path, int64_t line);
385 WS_DLL_PUBLIC
char *wslua_debugger_canonical_path(
const char *file_path);
420 wslua_debugger_get_stack(int32_t *frame_count);
428 int32_t frame_count);
439 wslua_debugger_get_variables(
const char *path, int32_t *variable_count);
447 int32_t variable_count);
453 WS_DLL_PUBLIC
unsigned wslua_debugger_get_breakpoint_count(
void);
463 WS_DLL_PUBLIC
bool wslua_debugger_get_breakpoint(
unsigned idx,
464 const char **file_path,
477 WS_DLL_PUBLIC
bool wslua_debugger_get_breakpoint_extended(
478 unsigned idx,
const char **file_path, int64_t *line,
bool *active,
479 const char **condition, int64_t *hit_count_target,
480 int64_t *hit_count,
bool *condition_error,
481 const char **log_message,
482 wslua_hit_count_mode_t *hit_count_mode,
483 bool *log_also_pause);
503 wslua_debugger_get_breakpoint_condition_error_message(
unsigned idx);
518 WS_DLL_PUBLIC int32_t
519 wslua_debugger_get_breakpoint_state_canonical(
const char *canonical_path,
533 typedef void (*wslua_debugger_log_emit_callback_t)(
const char *file_path,
535 const char *message);
540 WS_DLL_PUBLIC
void wslua_debugger_register_log_emit_callback(
541 wslua_debugger_log_emit_callback_t callback);
567 typedef void (*wslua_debugger_breakpoint_state_dirty_callback_t)(void);
572 WS_DLL_PUBLIC
void wslua_debugger_register_breakpoint_state_dirty_callback(
573 wslua_debugger_breakpoint_state_dirty_callback_t callback);
583 WS_DLL_PUBLIC
void wslua_debugger_clear_breakpoint_state_dirty(
void);
591 typedef void (*wslua_debugger_reload_callback_t)(void);
604 WS_DLL_PUBLIC
void wslua_debugger_register_reload_callback(
605 wslua_debugger_reload_callback_t callback);
621 WS_DLL_PUBLIC
bool wslua_debugger_notify_reload(
void);
629 typedef void (*wslua_debugger_post_reload_callback_t)(void);
641 WS_DLL_PUBLIC
void wslua_debugger_register_post_reload_callback(
642 wslua_debugger_post_reload_callback_t callback);
652 WS_DLL_PUBLIC
void wslua_debugger_prepare_for_reload_init(
void);
661 WS_DLL_PUBLIC
void wslua_debugger_notify_post_reload(
void);
678 WS_DLL_PUBLIC
char *wslua_debugger_evaluate(
const char *expression,
685 WS_DLL_PUBLIC
bool wslua_debugger_is_paused(
void);
695 WS_DLL_PUBLIC
void wslua_debugger_forget_lua_thread(lua_State *L);
706 typedef void (*wslua_debugger_script_loaded_callback_t)(
707 const char *file_path);
717 WS_DLL_PUBLIC
void wslua_debugger_register_script_loaded_callback(
718 wslua_debugger_script_loaded_callback_t callback);
729 wslua_debugger_notify_script_loaded(
const char *file_path);
737 typedef void (*wslua_debugger_loaded_script_callback_t)(
738 const char *file_path,
void *user_data);
753 WS_DLL_PUBLIC
void wslua_debugger_foreach_loaded_script(
754 wslua_debugger_loaded_script_callback_t callback,
void *user_data);
765 WS_DLL_PUBLIC
void wslua_debugger_set_error_break_enabled(
bool enabled);
771 WS_DLL_PUBLIC
bool wslua_debugger_get_error_break_enabled(
void);
785 WS_DLL_PUBLIC
bool wslua_debugger_capture_runtime_error(lua_State *L,
798 WS_DLL_PUBLIC
bool wslua_debugger_after_pcall_failure(lua_State *L);
811 WS_DLL_PUBLIC
const char *wslua_debugger_consume_error_text(
void);
823#define WSLUA_WATCH_MAX_PATH_SEGMENTS 32
835 WS_DLL_PUBLIC
bool wslua_debugger_watch_spec_uses_path_resolution(
843 WS_DLL_PUBLIC
char *wslua_debugger_watch_variable_path_for_spec(
856 WS_DLL_PUBLIC
char *wslua_debugger_watch_resolved_variable_path_for_spec(
870 WS_DLL_PUBLIC
bool wslua_debugger_watch_read_root(
871 const char *spec,
char **value_out,
char **type_out,
872 bool *can_expand_out,
char **error_msg);
899 WS_DLL_PUBLIC
bool wslua_debugger_read_variable_value_full(
900 const char *variable_path,
char **value_out,
char **error_msg);
929 WS_DLL_PUBLIC
bool wslua_debugger_watch_expr_read_root(
930 const char *spec,
char **value_out,
char **type_out,
931 bool *can_expand_out,
char **error_msg);
946 WS_DLL_PUBLIC
bool wslua_debugger_watch_expr_get_variables(
947 const char *spec,
const char *subpath,
961 WS_DLL_PUBLIC
bool wslua_debugger_watch_expr_read_full(
962 const char *spec,
const char *subpath,
char **value_out,
Breakpoint structure for in-memory storage.
Definition wslua_debugger.h:70
char * log_message
Definition wslua_debugger.h:85
wslua_hit_count_mode_t hit_count_mode
Definition wslua_debugger.h:77
int64_t hit_count
Definition wslua_debugger.h:76
bool condition_error
Definition wslua_debugger.h:81
char * condition_error_msg
Definition wslua_debugger.h:82
int64_t hit_count_target
Definition wslua_debugger.h:75
bool active
Definition wslua_debugger.h:73
bool log_also_pause
Definition wslua_debugger.h:86
char * condition
Definition wslua_debugger.h:74
char * file_path
Definition wslua_debugger.h:71
int64_t last_fired_us
Definition wslua_debugger.h:91
int64_t line
Definition wslua_debugger.h:72
Stack frame structure.
Definition wslua_debugger.h:402
int64_t linedefined
Definition wslua_debugger.h:405
char * source
Definition wslua_debugger.h:403
int64_t line
Definition wslua_debugger.h:404
char * name
Definition wslua_debugger.h:410
Variable structure for inspection.
Definition wslua_debugger.h:391
char * value
Definition wslua_debugger.h:393
char * name
Definition wslua_debugger.h:392
char * type
Definition wslua_debugger.h:394
bool can_expand
Definition wslua_debugger.h:395