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;
40 WSLUA_DEBUGGER_THEME_AUTO = 0,
41 WSLUA_DEBUGGER_THEME_DARK = 1,
42 WSLUA_DEBUGGER_THEME_LIGHT = 2
43 } wslua_debugger_theme_t;
57 WSLUA_HIT_COUNT_MODE_FROM = 0,
59 WSLUA_HIT_COUNT_MODE_EVERY = 1,
61 WSLUA_HIT_COUNT_MODE_ONCE = 2,
62 } wslua_hit_count_mode_t;
108 WS_DLL_PUBLIC
void wslua_debugger_init(lua_State *L);
114 WS_DLL_PUBLIC
bool wslua_debugger_is_enabled(
void);
120 WS_DLL_PUBLIC
void wslua_debugger_set_enabled(
bool enabled);
132 wslua_debugger_set_user_explicitly_disabled(
bool user_wants_debugger_stay_off);
146 wslua_debugger_get_user_explicitly_disabled(
void);
160 wslua_debugger_may_auto_enable_for_breakpoints(
void);
167 typedef void (*wslua_debugger_ui_update_cb_t)(
const char *file_path,
175 wslua_debugger_register_ui_callback(wslua_debugger_ui_update_cb_t cb);
180 WS_DLL_PUBLIC
void wslua_debugger_continue(
void);
188 WS_DLL_PUBLIC
void wslua_debugger_step_in(
void);
196 WS_DLL_PUBLIC
void wslua_debugger_step_over(
void);
204 WS_DLL_PUBLIC
void wslua_debugger_step_out(
void);
214 WS_DLL_PUBLIC
void wslua_debugger_set_variable_stack_level(int32_t level);
221 WS_DLL_PUBLIC
void wslua_debugger_run_to_line(
const char *file_path,
229 WS_DLL_PUBLIC
void wslua_debugger_add_breakpoint(
const char *file_path,
237 WS_DLL_PUBLIC
void wslua_debugger_remove_breakpoint(
const char *file_path,
247 wslua_debugger_set_breakpoint_active(
const char *file_path, int64_t line,
253 WS_DLL_PUBLIC
void wslua_debugger_clear_breakpoints(
void);
270 wslua_debugger_set_breakpoint_condition(
const char *file_path, int64_t line,
271 const char *condition);
285 wslua_debugger_set_breakpoint_hit_count_target(
const char *file_path,
298 wslua_debugger_set_breakpoint_hit_count_mode(
const char *file_path,
300 wslua_hit_count_mode_t mode);
314 wslua_debugger_set_breakpoint_log_message(
const char *file_path,
316 const char *message);
328 wslua_debugger_set_breakpoint_log_also_pause(
const char *file_path,
336 wslua_debugger_reset_breakpoint_hit_count(
const char *file_path,
342 WS_DLL_PUBLIC
void wslua_debugger_reset_all_breakpoint_hit_counts(
void);
358 wslua_debugger_check_condition_syntax(
const char *expression,
377 wslua_debugger_set_breakpoint_condition_error(
const char *file_path,
379 const char *err_msg);
387 WS_DLL_PUBLIC int32_t
388 wslua_debugger_get_breakpoint_state(
const char *file_path, int64_t line);
395 WS_DLL_PUBLIC
char *wslua_debugger_canonical_path(
const char *file_path);
430 wslua_debugger_get_stack(int32_t *frame_count);
438 int32_t frame_count);
449 wslua_debugger_get_variables(
const char *path, int32_t *variable_count);
457 int32_t variable_count);
463 WS_DLL_PUBLIC
unsigned wslua_debugger_get_breakpoint_count(
void);
473 WS_DLL_PUBLIC
bool wslua_debugger_get_breakpoint(
unsigned idx,
474 const char **file_path,
487 WS_DLL_PUBLIC
bool wslua_debugger_get_breakpoint_extended(
488 unsigned idx,
const char **file_path, int64_t *line,
bool *active,
489 const char **condition, int64_t *hit_count_target,
490 int64_t *hit_count,
bool *condition_error,
491 const char **log_message,
492 wslua_hit_count_mode_t *hit_count_mode,
493 bool *log_also_pause);
513 wslua_debugger_get_breakpoint_condition_error_message(
unsigned idx);
528 WS_DLL_PUBLIC int32_t
529 wslua_debugger_get_breakpoint_state_canonical(
const char *canonical_path,
543 typedef void (*wslua_debugger_log_emit_callback_t)(
const char *file_path,
545 const char *message);
550 WS_DLL_PUBLIC
void wslua_debugger_register_log_emit_callback(
551 wslua_debugger_log_emit_callback_t callback);
577 typedef void (*wslua_debugger_breakpoint_state_dirty_callback_t)(void);
582 WS_DLL_PUBLIC
void wslua_debugger_register_breakpoint_state_dirty_callback(
583 wslua_debugger_breakpoint_state_dirty_callback_t callback);
593 WS_DLL_PUBLIC
void wslua_debugger_clear_breakpoint_state_dirty(
void);
601 typedef void (*wslua_debugger_reload_callback_t)(void);
614 WS_DLL_PUBLIC
void wslua_debugger_register_reload_callback(
615 wslua_debugger_reload_callback_t callback);
631 WS_DLL_PUBLIC
bool wslua_debugger_notify_reload(
void);
639 typedef void (*wslua_debugger_post_reload_callback_t)(void);
651 WS_DLL_PUBLIC
void wslua_debugger_register_post_reload_callback(
652 wslua_debugger_post_reload_callback_t callback);
662 WS_DLL_PUBLIC
void wslua_debugger_prepare_for_reload_init(
void);
671 WS_DLL_PUBLIC
void wslua_debugger_notify_post_reload(
void);
688 WS_DLL_PUBLIC
char *wslua_debugger_evaluate(
const char *expression,
695 WS_DLL_PUBLIC
bool wslua_debugger_is_paused(
void);
705 WS_DLL_PUBLIC
void wslua_debugger_forget_lua_thread(lua_State *L);
716 typedef void (*wslua_debugger_script_loaded_callback_t)(
717 const char *file_path);
727 WS_DLL_PUBLIC
void wslua_debugger_register_script_loaded_callback(
728 wslua_debugger_script_loaded_callback_t callback);
739 wslua_debugger_notify_script_loaded(
const char *file_path);
747 typedef void (*wslua_debugger_loaded_script_callback_t)(
748 const char *file_path,
void *user_data);
763 WS_DLL_PUBLIC
void wslua_debugger_foreach_loaded_script(
764 wslua_debugger_loaded_script_callback_t callback,
void *user_data);
775 WS_DLL_PUBLIC
void wslua_debugger_set_error_break_enabled(
bool enabled);
781 WS_DLL_PUBLIC
bool wslua_debugger_get_error_break_enabled(
void);
795 WS_DLL_PUBLIC
bool wslua_debugger_capture_runtime_error(lua_State *L,
808 WS_DLL_PUBLIC
bool wslua_debugger_after_pcall_failure(lua_State *L);
821 WS_DLL_PUBLIC
const char *wslua_debugger_consume_error_text(
void);
833#define WSLUA_WATCH_MAX_PATH_SEGMENTS 32
845 WS_DLL_PUBLIC
bool wslua_debugger_watch_spec_uses_path_resolution(
853 WS_DLL_PUBLIC
char *wslua_debugger_watch_variable_path_for_spec(
866 WS_DLL_PUBLIC
char *wslua_debugger_watch_resolved_variable_path_for_spec(
880 WS_DLL_PUBLIC
bool wslua_debugger_watch_read_root(
881 const char *spec,
char **value_out,
char **type_out,
882 bool *can_expand_out,
char **error_msg);
909 WS_DLL_PUBLIC
bool wslua_debugger_read_variable_value_full(
910 const char *variable_path,
char **value_out,
char **error_msg);
939 WS_DLL_PUBLIC
bool wslua_debugger_watch_expr_read_root(
940 const char *spec,
char **value_out,
char **type_out,
941 bool *can_expand_out,
char **error_msg);
956 WS_DLL_PUBLIC
bool wslua_debugger_watch_expr_get_variables(
957 const char *spec,
const char *subpath,
971 WS_DLL_PUBLIC
bool wslua_debugger_watch_expr_read_full(
972 const char *spec,
const char *subpath,
char **value_out,
Breakpoint structure for in-memory storage.
Definition wslua_debugger.h:80
char * log_message
Definition wslua_debugger.h:95
wslua_hit_count_mode_t hit_count_mode
Definition wslua_debugger.h:87
int64_t hit_count
Definition wslua_debugger.h:86
bool condition_error
Definition wslua_debugger.h:91
char * condition_error_msg
Definition wslua_debugger.h:92
int64_t hit_count_target
Definition wslua_debugger.h:85
bool active
Definition wslua_debugger.h:83
bool log_also_pause
Definition wslua_debugger.h:96
char * condition
Definition wslua_debugger.h:84
char * file_path
Definition wslua_debugger.h:81
int64_t last_fired_us
Definition wslua_debugger.h:101
int64_t line
Definition wslua_debugger.h:82
Stack frame structure.
Definition wslua_debugger.h:412
int64_t linedefined
Definition wslua_debugger.h:415
char * source
Definition wslua_debugger.h:413
int64_t line
Definition wslua_debugger.h:414
char * name
Definition wslua_debugger.h:420
Variable structure for inspection.
Definition wslua_debugger.h:401
char * value
Definition wslua_debugger.h:403
char * name
Definition wslua_debugger.h:402
char * type
Definition wslua_debugger.h:404
bool can_expand
Definition wslua_debugger.h:405