forked from enlightenment/efl
Support opcodes registration for Windows
A standard static array with symbols whose addresses are only known at runtime is not supported in Windows.
This commit is contained in:
parent
ab01f3f696
commit
758bb0557c
|
@ -225,19 +225,18 @@ _args_handle(void *data EINA_UNUSED, Eina_Bool flag)
|
|||
}
|
||||
}
|
||||
|
||||
static const Eina_Debug_Opcode ops[] =
|
||||
{
|
||||
{"Daemon/Client/register_observer", &_cl_stat_reg_opcode, NULL},
|
||||
{"Daemon/Client/added", NULL, &_clients_info_added_cb},
|
||||
{"Daemon/Client/deleted", NULL, &_clients_info_deleted_cb},
|
||||
{"Daemon/Client/cid_from_pid", &_cid_from_pid_opcode, &_cid_get_cb},
|
||||
{"Profiler/on", &_prof_on_opcode, NULL},
|
||||
{"Profiler/off", &_prof_off_opcode, NULL},
|
||||
{"CPU/Freq/on", &_cpufreq_on_opcode, NULL},
|
||||
{"CPU/Freq/off", &_cpufreq_off_opcode, NULL},
|
||||
{"EvLog/get", &_evlog_get_opcode, _evlog_get_cb},
|
||||
{NULL, NULL, NULL}
|
||||
};
|
||||
EINA_DEBUG_OPCODES_ARRAY_DEFINE(ops,
|
||||
{"Daemon/Client/register_observer", &_cl_stat_reg_opcode, NULL},
|
||||
{"Daemon/Client/added", NULL, &_clients_info_added_cb},
|
||||
{"Daemon/Client/deleted", NULL, &_clients_info_deleted_cb},
|
||||
{"Daemon/Client/cid_from_pid", &_cid_from_pid_opcode, &_cid_get_cb},
|
||||
{"Profiler/on", &_prof_on_opcode, NULL},
|
||||
{"Profiler/off", &_prof_off_opcode, NULL},
|
||||
{"CPU/Freq/on", &_cpufreq_on_opcode, NULL},
|
||||
{"CPU/Freq/off", &_cpufreq_off_opcode, NULL},
|
||||
{"EvLog/get", &_evlog_get_opcode, _evlog_get_cb},
|
||||
{NULL, NULL, NULL}
|
||||
);
|
||||
|
||||
int
|
||||
main(int argc EINA_UNUSED, char **argv EINA_UNUSED)
|
||||
|
@ -254,7 +253,7 @@ main(int argc EINA_UNUSED, char **argv EINA_UNUSED)
|
|||
fprintf(stderr, "ERROR: Cannot connect to debug daemon.\n");
|
||||
return -1;
|
||||
}
|
||||
eina_debug_opcodes_register(_session, ops, _args_handle, NULL);
|
||||
eina_debug_opcodes_register(_session, ops(), _args_handle, NULL);
|
||||
|
||||
ecore_main_loop_begin();
|
||||
|
||||
|
|
|
@ -121,6 +121,25 @@ typedef struct
|
|||
int opcode; /**< Opcode of the packet */
|
||||
} Eina_Debug_Packet_Header;
|
||||
|
||||
/**
|
||||
* 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.
|
||||
*/
|
||||
#define EINA_DEBUG_OPCODES_ARRAY_DEFINE(Name, ...) \
|
||||
static Eina_Debug_Opcode * \
|
||||
Name(void) \
|
||||
{ \
|
||||
Eina_Debug_Opcode tmp[] = { __VA_ARGS__ }; \
|
||||
static Eina_Debug_Opcode internal[EINA_C_ARRAY_LENGTH(tmp) + 1] = \
|
||||
{ { 0, 0, 0 } }; \
|
||||
if (internal[0].opcode_name == NULL) \
|
||||
{ \
|
||||
memcpy(internal, tmp, sizeof(tmp)); \
|
||||
} \
|
||||
return internal; \
|
||||
}
|
||||
|
||||
/**
|
||||
* @typedef Eina_Debug_Opcode
|
||||
*
|
||||
|
|
|
@ -256,19 +256,18 @@ _prof_off_cb(Eina_Debug_Session *session EINA_UNUSED, int cid EINA_UNUSED, void
|
|||
return EINA_TRUE;
|
||||
}
|
||||
|
||||
static const Eina_Debug_Opcode _OPS[] =
|
||||
{
|
||||
{"Profiler/on", NULL, &_prof_on_cb},
|
||||
{"Profiler/off", NULL, &_prof_off_cb},
|
||||
{NULL, NULL, NULL}
|
||||
};
|
||||
EINA_DEBUG_OPCODES_ARRAY_DEFINE(_OPS,
|
||||
{"Profiler/on", NULL, &_prof_on_cb},
|
||||
{"Profiler/off", NULL, &_prof_off_cb},
|
||||
{NULL, NULL, NULL}
|
||||
);
|
||||
|
||||
Eina_Bool
|
||||
_eina_debug_bt_init(void)
|
||||
{
|
||||
_signal_init();
|
||||
eina_semaphore_new(&_wait_for_bts_sem, 0);
|
||||
eina_debug_opcodes_register(NULL, _OPS, NULL, NULL);
|
||||
eina_debug_opcodes_register(NULL, _OPS(), NULL, NULL);
|
||||
return EINA_TRUE;
|
||||
}
|
||||
|
||||
|
|
|
@ -272,12 +272,11 @@ _cpufreq_off_cb(Eina_Debug_Session *session EINA_UNUSED, int cid EINA_UNUSED, vo
|
|||
return EINA_TRUE;
|
||||
}
|
||||
|
||||
static const Eina_Debug_Opcode _OPS[] =
|
||||
{
|
||||
{"CPU/Freq/on", NULL, &_cpufreq_on_cb},
|
||||
{"CPU/Freq/off", NULL, &_cpufreq_off_cb},
|
||||
{NULL, NULL, NULL}
|
||||
};
|
||||
EINA_DEBUG_OPCODES_ARRAY_DEFINE(_OPS,
|
||||
{"CPU/Freq/on", NULL, &_cpufreq_on_cb},
|
||||
{"CPU/Freq/off", NULL, &_cpufreq_off_cb},
|
||||
{NULL, NULL, NULL}
|
||||
);
|
||||
|
||||
Eina_Bool
|
||||
_eina_debug_cpu_init(void)
|
||||
|
@ -296,7 +295,7 @@ _eina_debug_cpu_init(void)
|
|||
}
|
||||
_sysmon_thread_runs = EINA_TRUE;
|
||||
}
|
||||
eina_debug_opcodes_register(NULL, _OPS, NULL, NULL);
|
||||
eina_debug_opcodes_register(NULL, _OPS(), NULL, NULL);
|
||||
return EINA_TRUE;
|
||||
}
|
||||
|
||||
|
|
|
@ -249,13 +249,12 @@ _stop_cb(Eina_Debug_Session *session EINA_UNUSED, int cid EINA_UNUSED, void *buf
|
|||
return EINA_TRUE;
|
||||
}
|
||||
|
||||
static const Eina_Debug_Opcode _EINA_DEBUG_EVLOG_OPS[] =
|
||||
{
|
||||
{"EvLog/on", NULL, &_start_cb},
|
||||
{"EvLog/off", NULL, &_stop_cb},
|
||||
{"EvLog/get", &_evlog_get_opcode, &_get_cb},
|
||||
{NULL, NULL, NULL}
|
||||
};
|
||||
EINA_DEBUG_OPCODES_ARRAY_DEFINE(_EINA_DEBUG_EVLOG_OPS,
|
||||
{"EvLog/on", NULL, &_start_cb},
|
||||
{"EvLog/off", NULL, &_stop_cb},
|
||||
{"EvLog/get", &_evlog_get_opcode, &_get_cb},
|
||||
{NULL, NULL, NULL}
|
||||
);
|
||||
|
||||
Eina_Bool
|
||||
eina_evlog_init(void)
|
||||
|
@ -273,7 +272,7 @@ eina_evlog_init(void)
|
|||
}
|
||||
#endif
|
||||
eina_evlog("+eina_init", NULL, 0.0, NULL);
|
||||
eina_debug_opcodes_register(NULL, _EINA_DEBUG_EVLOG_OPS, NULL, NULL);
|
||||
eina_debug_opcodes_register(NULL, _EINA_DEBUG_EVLOG_OPS(), NULL, NULL);
|
||||
return EINA_TRUE;
|
||||
}
|
||||
|
||||
|
|
Loading…
Reference in New Issue