Data Structures | |
struct | Eina_Debug_Packet_Header |
Header of Eina Debug packet. More... | |
struct | Eina_Debug_Opcode |
Structure to describe information for an opcode. More... | |
Macros | |
#define | EINA_DEBUG_OPCODES_ARRAY_DEFINE(Name, ...) |
Helper for creating global opcodes arrays. More... | |
Typedefs | |
typedef struct _Eina_Debug_Session | Eina_Debug_Session |
A handle used to interact with the debug daemon. More... | |
typedef Eina_Bool(* | Eina_Debug_Cb) (Eina_Debug_Session *session, int srcid, void *buffer, int size) |
A callback invoked when a specific packet is received. More... | |
typedef void(* | Eina_Debug_Opcode_Status_Cb) (void *data, Eina_Bool status) |
When the opcodes ids are retrieved, this callback is invoked with a true status. More... | |
typedef Eina_Bool(* | Eina_Debug_Dispatch_Cb) (Eina_Debug_Session *session, void *buffer) |
Dispatcher callback prototype used to override the default dispatcher of a session. More... | |
typedef Eina_Bool(* | Eina_Debug_Timer_Cb) (void *) |
A callback for a timer. | |
typedef struct _Eina_Debug_Timer | Eina_Debug_Timer |
Enumerations | |
enum | { EINA_DEBUG_OPCODE_INVALID = -1 , EINA_DEBUG_OPCODE_REGISTER = 0 , EINA_DEBUG_OPCODE_HELLO = 1 } |
Functions | |
EINA_API void | eina_debug_disable (void) |
Disable debugging. More... | |
EINA_API Eina_Debug_Session * | eina_debug_local_connect (Eina_Bool is_master) |
Connect to the local daemon. More... | |
EINA_API Eina_Debug_Session * | eina_debug_remote_connect (int port) |
Connect to remote daemon. More... | |
EINA_API void | eina_debug_session_terminate (Eina_Debug_Session *session) |
Terminate the session. More... | |
EINA_API void | eina_debug_session_dispatch_override (Eina_Debug_Session *session, Eina_Debug_Dispatch_Cb disp_cb) |
Override the dispatcher of a specific session. More... | |
EINA_API Eina_Debug_Dispatch_Cb | eina_debug_session_dispatch_get (Eina_Debug_Session *session) |
Get the dispatcher of a specific session. More... | |
EINA_API Eina_Bool | eina_debug_dispatch (Eina_Debug_Session *session, void *buffer) |
Dispatch a given packet according to its header. More... | |
EINA_API void | eina_debug_session_data_set (Eina_Debug_Session *session, void *data) |
Set data to a session. More... | |
EINA_API void * | eina_debug_session_data_get (Eina_Debug_Session *session) |
Get the data attached to a session. More... | |
EINA_API void | eina_debug_opcodes_register (Eina_Debug_Session *session, const Eina_Debug_Opcode ops[], Eina_Debug_Opcode_Status_Cb status_cb, void *status_data) |
Register opcodes to a session. More... | |
EINA_API int | eina_debug_session_send (Eina_Debug_Session *session, int dest_id, int op, void *data, int size) |
Send a packet to the given destination. More... | |
EINA_API Eina_Debug_Timer * | eina_debug_timer_add (unsigned int timeout_ms, Eina_Debug_Timer_Cb cb, void *data) |
Add a timer. More... | |
EINA_API void | eina_debug_timer_del (Eina_Debug_Timer *timer) |
Delete a timer. More... | |
EINA_API void | eina_debug_fork_reset (void) |
Reset the eina debug system after forking. More... | |
#define EINA_DEBUG_OPCODES_ARRAY_DEFINE | ( | Name, | |
... | |||
) |
Helper for creating global opcodes arrays.
The problem is on windows where you can't declare a static array with external symbols in it, because the addresses are only known at runtime.
A handle used to interact with the debug daemon.
It contains all the information related to this connection and needed to send/receive/dispatch/...
Eina_Debug_Cb |
A callback invoked when a specific packet is received.
[in,out] | session | the session |
[in] | srcid | the source id |
[in] | buffer | the packet payload data. It doesn't contain any transport information. |
[in] | size | the packet payload size |
Eina_Debug_Opcode_Status_Cb |
When the opcodes ids are retrieved, this callback is invoked with a true status.
When a disconnection to the daemon is happening, the opcodes ids are set as invalid and this callback is invoked with a false status. The upper layer should not try to send more requests until a new connection is established.
[in,out] | data | data pointer given when registering opcodes |
[in] | status | EINA_TRUE if opcodes have been received from the daemon, EINA_FALSE otherwise. |
Eina_Debug_Dispatch_Cb |
Dispatcher callback prototype used to override the default dispatcher of a session.
[in,out] | session | the session |
[in] | buffer | the packet received |
The given packet is the entire data received, including the header.
anonymous enum |
EINA_API void eina_debug_disable | ( | void | ) |
Disable debugging.
Useful for applications that don't want debugging. The debug daemon is one of them. Need to be invoked before eina_init. Otherwise it won't have any effect.
References EINA_TRUE.
EINA_API Eina_Debug_Session * eina_debug_local_connect | ( | Eina_Bool | is_master | ) |
Connect to the local daemon.
[in] | is_master | true if the application is a debugger. EINA_FALSE otherwise. |
References eina_debug_remote_connect(), and fcntl().
EINA_API Eina_Debug_Session * eina_debug_remote_connect | ( | int | port | ) |
Connect to remote daemon.
This function connects to localhost:port.
[in] | port | the port to connect to |
References fcntl().
Referenced by eina_debug_local_connect().
EINA_API void eina_debug_session_terminate | ( | Eina_Debug_Session * | session | ) |
Terminate the session.
[in,out] | session | the session to terminate |
References eina_lock_release(), and eina_lock_take().
EINA_API void eina_debug_session_dispatch_override | ( | Eina_Debug_Session * | session, |
Eina_Debug_Dispatch_Cb | disp_cb | ||
) |
Override the dispatcher of a specific session.
For example, it can be used to forward a packet to the main thread and to use the default dispatcher there. All the packets received in this session will use this dispatcher.
[in,out] | session | the session |
[in] | disp_cb | the new dispatcher for the given session |
References eina_debug_dispatch().
EINA_API Eina_Debug_Dispatch_Cb eina_debug_session_dispatch_get | ( | Eina_Debug_Session * | session | ) |
Get the dispatcher of a specific session.
[in,out] | session | the session |
EINA_API Eina_Bool eina_debug_dispatch | ( | Eina_Debug_Session * | session, |
void * | buffer | ||
) |
Dispatch a given packet according to its header.
This function checks the header contained in the packet and invokes the correct callback according to the opcode. This is the default dispatcher.
[in,out] | session | the session |
[in] | buffer | the packet |
References EINA_FALSE, EINA_LIST_FOREACH, EINA_TRUE, Eina_Debug_Packet_Header::opcode, and Eina_Debug_Packet_Header::size.
Referenced by eina_debug_session_dispatch_override().
EINA_API void eina_debug_session_data_set | ( | Eina_Debug_Session * | session, |
void * | data | ||
) |
Set data to a session.
[in,out] | session | the session |
[in] | data | the data to set |
EINA_API void * eina_debug_session_data_get | ( | Eina_Debug_Session * | session | ) |
Get the data attached to a session.
[in,out] | session | the session |
EINA_API void eina_debug_opcodes_register | ( | Eina_Debug_Session * | session, |
const Eina_Debug_Opcode | ops[], | ||
Eina_Debug_Opcode_Status_Cb | status_cb, | ||
void * | status_data | ||
) |
Register opcodes to a session.
This function registers opcodes for the given session. If the session is not connected, the request is not sent to the daemon. Otherwise, the request for the opcodes ids is sent. On the reception from the daemon, status_cb function is invoked to inform the requester that the opcodes can now be used.
[in,out] | session | the session |
[in] | ops | the operations to register |
[in] | status_cb | a function to call when the opcodes are received |
[in] | status_data | the data to give to status_cb |
References EINA_FALSE, and eina_list_append().
EINA_API int eina_debug_session_send | ( | Eina_Debug_Session * | session, |
int | dest_id, | ||
int | op, | ||
void * | data, | ||
int | size | ||
) |
Send a packet to the given destination.
The packet will be treated by the debug thread itself.
[in,out] | session | the session to use to send the packet |
[in] | dest_id | the destination id to send the packet to |
[in] | op | the opcode for this packet |
[in] | data | payload to send |
[in] | size | payload size |
References EINA_DEBUG_OPCODE_INVALID, eina_spinlock_release(), eina_spinlock_take(), Eina_Debug_Packet_Header::opcode, and Eina_Debug_Packet_Header::size.
EINA_API Eina_Debug_Timer * eina_debug_timer_add | ( | unsigned int | timeout_ms, |
Eina_Debug_Timer_Cb | cb, | ||
void * | data | ||
) |
Add a timer.
[in] | timeout_ms | timeout in ms |
[in] | cb | callback to call when the timeout is reached |
[in] | data | user data |
References eina_spinlock_release(), eina_spinlock_take(), and EINA_TRUE.
EINA_API void eina_debug_timer_del | ( | Eina_Debug_Timer * | timer | ) |
Delete a timer.
[in,out] | timer | the timer to delete |
If the timer reaches the end and has not be renewed, trying to delete it will lead to a crash, as it has already been deleted internally.
References eina_list_data_find_list(), eina_list_remove_list(), eina_spinlock_release(), and eina_spinlock_take().
EINA_API void eina_debug_fork_reset | ( | void | ) |
Reset the eina debug system after forking.
Call this any time the application forks
References EINA_FALSE, and EINA_TRUE.
Referenced by ecore_fork_reset().