1 #ifndef _UCODE_DEBUG_REMOTE_H 2 #define _UCODE_DEBUG_REMOTE_H 3 4 #include <ucode/types.h> 5 #include <ucode/vm.h> 6 7 int debug_remote_create_attach_socket(void); 8 const char *debug_remote_get_socket_path(void); 9 void debug_remote_cleanup_attach_socket(void); 10 11 /* Accept a single connection on an arbitrary, caller-supplied Unix domain 12 * socket path, blocking indefinitely. Returns the accepted client fd, or -1 13 * on error. Used by debug.listen(path) for the explicit-path case. */ 14 int debug_remote_accept_on_path(const char *path); 15 16 /* Push unsolicited notifications to a connected debugger client, if any, as 17 * "EVENT {json}" protocol messages (see debug_proto.h) - the JSON payload 18 * always carries a discriminating "event" field ("exception"/"exit"). */ 19 void debug_remote_notify_exception(uc_vm_t *vm, uc_exception_t *ex); 20 void debug_remote_notify_exit(uc_vm_t *vm, uc_vm_status_t status, int32_t exit_code, 21 uc_value_t *exception_obj); 22 23 /* Mark the given fd as the currently attached debugger session connection 24 * (or -1 for none), used by debug_remote_has_active_connection() and the 25 * notify helpers above - shared by both the remote and local (-x) cases, 26 * since both ultimately just hand a connected fd to bk_enter_session(). 27 * Owned by whoever is currently driving the session (debug_run_session()). */ 28 void debug_remote_set_active_fd(int fd); 29 bool debug_remote_has_active_connection(void); 30 int debug_remote_get_active_fd(void); 31 32 /* Wait for a udbg client to connect to the SIGUSR1 attach socket, with a 33 * 30s timeout. Returns the accepted client fd on success, -1 on timeout or 34 * disconnect (caller should resume execution unattended), or -2 on a fatal 35 * socket error (caller should give up). */ 36 int debug_remote_handle_break(uc_vm_t *vm); 37 38 /* Provided by debug.c: run a full interactive debugger session over an 39 * already-connected client socket, speaking the line-based debug protocol 40 * (see debug_proto.h). Takes ownership of client_fd (closes it) and resumes 41 * script execution before returning. */ 42 void debug_run_session(uc_vm_t *vm, int client_fd); 43 44 #endif 45
This page was automatically generated by LXR 0.3.1. • OpenWrt