diff options
author | Vitaliy Cherepanov <v.cherepanov@samsung.com> | 2016-11-18 10:13:48 +0300 |
---|---|---|
committer | Vitaliy Cherepanov <v.cherepanov@samsung.com> | 2016-11-21 04:36:31 -0800 |
commit | ac1d8e2554ef47b00284a75f7c05422604509fa3 (patch) | |
tree | e782aa85346a5fdf62c31f9a22e5502b94993bd3 | |
parent | 50db0f7367ce6ab8547c77feda05a0ea0a66d30c (diff) | |
download | swap-probe-ac1d8e2554ef47b00284a75f7c05422604509fa3.tar.gz swap-probe-ac1d8e2554ef47b00284a75f7c05422604509fa3.tar.bz2 swap-probe-ac1d8e2554ef47b00284a75f7c05422604509fa3.zip |
Refactor PROBES_LIST x-macroses
Change-Id: Ic61ac7975d954e186d2a427159874992ffb95352
Signed-off-by: Vitaliy Cherepanov <v.cherepanov@samsung.com>
-rw-r--r-- | include/daprobe.h | 4 | ||||
-rw-r--r-- | probe_capi/capi_probes_list.h | 6 | ||||
-rw-r--r-- | probe_capi/probe_capi.c | 4 | ||||
-rw-r--r-- | probe_event/event_probes_list.h | 18 | ||||
-rw-r--r-- | probe_event/probe_event.c | 4 | ||||
-rw-r--r-- | probe_file/file_probes_list.h | 118 | ||||
-rw-r--r-- | probe_file/probe_file.c | 6 | ||||
-rw-r--r-- | probe_graphics/graphics_probes_list.h | 34 | ||||
-rw-r--r-- | probe_graphics/probe_graphics.c | 6 | ||||
-rw-r--r-- | probe_memory/memory_probes_list.h | 44 | ||||
-rw-r--r-- | probe_memory/probe_memory.c | 4 | ||||
-rw-r--r-- | probe_socket/probe_socket.c | 6 | ||||
-rw-r--r-- | probe_socket/socket_probes_list.h | 62 | ||||
-rw-r--r-- | probe_thread/probe_thread.c | 6 | ||||
-rw-r--r-- | probe_thread/thread_probes_list.h | 102 | ||||
-rw-r--r-- | probe_ui/probe_ui.c | 4 | ||||
-rw-r--r-- | probe_ui/ui_probes_list.h | 6 |
17 files changed, 227 insertions, 207 deletions
diff --git a/include/daprobe.h b/include/daprobe.h index 78dd94c..921062f 100644 --- a/include/daprobe.h +++ b/include/daprobe.h @@ -283,8 +283,8 @@ typedef struct { GET_REAL_FUNC(FUNCNAME, LIBNAME); \ PRE_PROBEBLOCK() -#define GET_FUNC_ID(func_name) \ - CONCAT(func_name, _ID) +#define GET_FUNC_ID(func_name, orig_name) \ + CONCAT(CONCAT(func_name, orig_name), _ID) #define GET_ORIG_FUNC(feature_desc, func_name) \ feature_desc . probes[get_ ## feature_desc ## _id((void *)& PROBE_NAME( func_name ) )] . orig_ptr diff --git a/probe_capi/capi_probes_list.h b/probe_capi/capi_probes_list.h index 28a21e3..4a9b60e 100644 --- a/probe_capi/capi_probes_list.h +++ b/probe_capi/capi_probes_list.h @@ -2,12 +2,14 @@ #define __CAPI_PROBES_LIST_H__ +/* TODO generate PROBES_LIST with api_names.txt */ + #define PROBES_LIST \ - X(PROBE_NAME(ui_app_main), "ui_app_main") + X(PROBE_NAME(ui_app_main), ui_app_main) #define X(func_name, orig_name) \ - GET_FUNC_ID(func_name), + GET_FUNC_ID(func_name, orig_name), enum capi_funcs_id_t { PROBES_LIST }; diff --git a/probe_capi/probe_capi.c b/probe_capi/probe_capi.c index 9006151..86a2824 100644 --- a/probe_capi/probe_capi.c +++ b/probe_capi/probe_capi.c @@ -19,7 +19,7 @@ PROBES_LIST /* This function returns function's id by its pointer */ #define X(func_name, orig_name) \ if (ptr == & func_name) \ - return GET_FUNC_ID(func_name); + return GET_FUNC_ID(func_name, orig_name); enum capi_funcs_id_t get_capi_feature_id(void *ptr) { @@ -36,7 +36,7 @@ enum capi_funcs_id_t get_capi_feature_id(void *ptr) /* X-macros replaced by structures defenitions */ /* Used only for probes from target file */ #define X(func_name, orig_name) \ - { (ElfW(Addr)) & func_name, orig_name, GT_TARGET_PROBE, NULL }, + { (ElfW(Addr)) & func_name, #orig_name, GT_TARGET_PROBE, NULL }, static struct probe_desc_t capi_probes[] = { PROBES_LIST diff --git a/probe_event/event_probes_list.h b/probe_event/event_probes_list.h index 8b62cd3..02b935b 100644 --- a/probe_event/event_probes_list.h +++ b/probe_event/event_probes_list.h @@ -1,19 +1,21 @@ #ifndef __EVENT_PROBES_LIST_H__ #define __EVENT_PROBES_LIST_H__ +/* TODO generate PROBES_LIST with api_names.txt */ + #define PROBES_LIST \ - X(PROBE_NAME(elm_gesture_layer_cb_set), "elm_gesture_layer_cb_set", GT_TARGET_PROBE) \ - X(PROBE_NAME(ecore_event_evas_key_down), "ecore_event_evas_key_down", GT_ALWAYS_PROBE) \ - X(PROBE_NAME(ecore_event_evas_key_up), "ecore_event_evas_key_up", GT_ALWAYS_PROBE) \ - X(PROBE_NAME(ecore_event_evas_mouse_button_down), "ecore_event_evas_mouse_button_down", GT_ALWAYS_PROBE) \ - X(PROBE_NAME(ecore_event_evas_mouse_button_up), "ecore_event_evas_mouse_button_up", GT_ALWAYS_PROBE) \ - X(PROBE_NAME(ecore_event_evas_mouse_move), "ecore_event_evas_mouse_move", GT_ALWAYS_PROBE) \ - X(PROBE_NAME(ecore_wl_init), "ecore_wl_init", GT_ALWAYS_PROBE) + X(PROBE_NAME(elm_gesture_layer_cb_set), elm_gesture_layer_cb_set, GT_TARGET_PROBE) \ + X(PROBE_NAME(ecore_event_evas_key_down), ecore_event_evas_key_down, GT_ALWAYS_PROBE) \ + X(PROBE_NAME(ecore_event_evas_key_up), ecore_event_evas_key_up, GT_ALWAYS_PROBE) \ + X(PROBE_NAME(ecore_event_evas_mouse_button_down), ecore_event_evas_mouse_button_down, GT_ALWAYS_PROBE) \ + X(PROBE_NAME(ecore_event_evas_mouse_button_up), ecore_event_evas_mouse_button_up, GT_ALWAYS_PROBE) \ + X(PROBE_NAME(ecore_event_evas_mouse_move), ecore_event_evas_mouse_move, GT_ALWAYS_PROBE) \ + X(PROBE_NAME(ecore_wl_init), ecore_wl_init, GT_ALWAYS_PROBE) /* X-macros replaced with func id's enumeration */ #define X(func_name, orig_name, type) \ - GET_FUNC_ID(func_name), + GET_FUNC_ID(func_name, orig_name), enum event_funcs_id_t { PROBES_LIST diff --git a/probe_event/probe_event.c b/probe_event/probe_event.c index 07b1a2a..9368fb4 100644 --- a/probe_event/probe_event.c +++ b/probe_event/probe_event.c @@ -21,7 +21,7 @@ PROBES_LIST /* This function returns function's id by its pointer */ #define X(func_name, orig_name, type) \ if (ptr == & func_name) \ - return GET_FUNC_ID(func_name); + return GET_FUNC_ID(func_name, orig_name); enum event_funcs_id_t get_event_feature_id(void *ptr) { @@ -38,7 +38,7 @@ enum event_funcs_id_t get_event_feature_id(void *ptr) /* X-macros replaced with structures defenitions */ /* Used only for probes from target file */ #define X(func_name, orig_name, type) \ - { (ElfW(Addr))& func_name, orig_name, type, NULL }, + { (ElfW(Addr))& func_name, #orig_name, type, NULL }, static struct probe_desc_t event_probes[] = { PROBES_LIST diff --git a/probe_file/file_probes_list.h b/probe_file/file_probes_list.h index 2a04c4c..48da3a3 100644 --- a/probe_file/file_probes_list.h +++ b/probe_file/file_probes_list.h @@ -1,67 +1,69 @@ #ifndef __FILE_PROBES_LIST_H__ #define __FILE_PROBES_LIST_H__ +/* TODO generate PROBES_LIST with api_names.txt */ + #define PROBES_LIST \ - X(PROBE_NAME(open), "open") \ - X(PROBE_NAME(openat), "openat") \ - X(PROBE_NAME(creat), "creat") \ - X(PROBE_NAME(close), "close") \ - X(PROBE_NAME(lseek), "lseek") \ - X(PROBE_NAME(fsync), "fsync") \ - X(PROBE_NAME(fdatasync), "fdatasync") \ - X(PROBE_NAME(ftruncate), "ftruncate") \ - X(PROBE_NAME(fchown), "fchown") \ - X(PROBE_NAME(lockf), "lockf") \ - X(PROBE_NAME(fchmod), "fchmod") \ - X(PROBE_NAME(pread), "pread") \ - X(PROBE_NAME(read), "read") \ - X(PROBE_NAME(pwrite), "pwrite") \ - X(PROBE_NAME(write), "write") \ - X(PROBE_NAME(readv), "readv") \ - X(PROBE_NAME(fcntl), "fcntl") \ - X(PROBE_NAME(dup), "dup") \ - X(PROBE_NAME(dup2), "dup2") \ - X(PROBE_NAME(futimens), "futimens") \ - X(PROBE_NAME(fopen), "fopen") \ - X(PROBE_NAME(freopen), "freopen") \ - X(PROBE_NAME(fdopen), "fdopen") \ - X(PROBE_NAME(fflush), "fflush") \ - X(PROBE_NAME(fclose), "fclose") \ - X(PROBE_NAME(tmpfile), "tmpfile") \ - X(PROBE_NAME(fgetpos), "fgetpos") \ - X(PROBE_NAME(fseek), "fseek") \ - X(PROBE_NAME(fsetpos), "fsetpos") \ - X(PROBE_NAME(ftell), "ftell") \ - X(PROBE_NAME(rewind), "rewind") \ - X(PROBE_NAME(clearerr), "clearerr") \ - X(PROBE_NAME(feof), "feof") \ - X(PROBE_NAME(ferror), "ferror") \ - X(PROBE_NAME(fileno), "fileno") \ - X(PROBE_NAME(vfprintf), "vfprintf") \ - X(PROBE_NAME(vfscanf), "vfscanf") \ - X(PROBE_NAME(fgetc), "fgetc") \ - X(PROBE_NAME(fputc), "fputc") \ - X(PROBE_NAME(fputs), "fputs") \ - X(PROBE_NAME(getc), "getc") \ - X(PROBE_NAME(putc), "putc") \ - X(PROBE_NAME(ungetc), "ungetc") \ - X(PROBE_NAME(fread), "fread") \ - X(PROBE_NAME(fwrite), "fwrite") \ - X(PROBE_NAME(fprintf), "fprintf") \ - X(PROBE_NAME(fscanf), "fscanf") \ - X(PROBE_NAME(printf), "printf") \ - X(PROBE_NAME(scanf), "scanf") \ - X(PROBE_NAME(getchar), "getchar") \ - X(PROBE_NAME(putchar), "putchar") \ - X(PROBE_NAME(gets), "gets") \ - X(PROBE_NAME(puts), "puts") \ - X(PROBE_NAME(setbuf), "setbuf") \ - X(PROBE_NAME(setbuffer), "setbuffer") \ - X(PROBE_NAME(setlinebuf), "setlinebuf") \ - X(PROBE_NAME(setvbuf), "setvbuf") + X(PROBE_NAME(open), open) \ + X(PROBE_NAME(openat), openat) \ + X(PROBE_NAME(creat), creat) \ + X(PROBE_NAME(close), close) \ + X(PROBE_NAME(lseek), lseek) \ + X(PROBE_NAME(fsync), fsync) \ + X(PROBE_NAME(fdatasync), fdatasync) \ + X(PROBE_NAME(ftruncate), ftruncate) \ + X(PROBE_NAME(fchown), fchown) \ + X(PROBE_NAME(lockf), lockf) \ + X(PROBE_NAME(fchmod), fchmod) \ + X(PROBE_NAME(pread), pread) \ + X(PROBE_NAME(read), read) \ + X(PROBE_NAME(pwrite), pwrite) \ + X(PROBE_NAME(write), write) \ + X(PROBE_NAME(readv), readv) \ + X(PROBE_NAME(fcntl), fcntl) \ + X(PROBE_NAME(dup), dup) \ + X(PROBE_NAME(dup2), dup2) \ + X(PROBE_NAME(futimens), futimens) \ + X(PROBE_NAME(fopen), fopen) \ + X(PROBE_NAME(freopen), freopen) \ + X(PROBE_NAME(fdopen), fdopen) \ + X(PROBE_NAME(fflush), fflush) \ + X(PROBE_NAME(fclose), fclose) \ + X(PROBE_NAME(tmpfile), tmpfile) \ + X(PROBE_NAME(fgetpos), fgetpos) \ + X(PROBE_NAME(fseek), fseek) \ + X(PROBE_NAME(fsetpos), fsetpos) \ + X(PROBE_NAME(ftell), ftell) \ + X(PROBE_NAME(rewind), rewind) \ + X(PROBE_NAME(clearerr), clearerr) \ + X(PROBE_NAME(feof), feof) \ + X(PROBE_NAME(ferror), ferror) \ + X(PROBE_NAME(fileno), fileno) \ + X(PROBE_NAME(vfprintf), vfprintf) \ + X(PROBE_NAME(vfscanf), vfscanf) \ + X(PROBE_NAME(fgetc), fgetc) \ + X(PROBE_NAME(fputc), fputc) \ + X(PROBE_NAME(fputs), fputs) \ + X(PROBE_NAME(getc), getc) \ + X(PROBE_NAME(putc), putc) \ + X(PROBE_NAME(ungetc), ungetc) \ + X(PROBE_NAME(fread), fread) \ + X(PROBE_NAME(fwrite), fwrite) \ + X(PROBE_NAME(fprintf), fprintf) \ + X(PROBE_NAME(fscanf), fscanf) \ + X(PROBE_NAME(printf), printf) \ + X(PROBE_NAME(scanf), scanf) \ + X(PROBE_NAME(getchar), getchar) \ + X(PROBE_NAME(putchar), putchar) \ + X(PROBE_NAME(gets), gets) \ + X(PROBE_NAME(puts), puts) \ + X(PROBE_NAME(setbuf), setbuf) \ + X(PROBE_NAME(setbuffer), setbuffer) \ + X(PROBE_NAME(setlinebuf), setlinebuf) \ + X(PROBE_NAME(setvbuf), setvbuf) #define X(func_name, orig_name) \ - GET_FUNC_ID(func_name), + GET_FUNC_ID(func_name, orig_name), enum file_funcs_id_t { PROBES_LIST diff --git a/probe_file/probe_file.c b/probe_file/probe_file.c index a5dae6f..843f61d 100644 --- a/probe_file/probe_file.c +++ b/probe_file/probe_file.c @@ -28,7 +28,7 @@ PROBES_LIST /* This function returns function's id by its pointer */ #define X(func_name, orig_name) \ if (ptr == & func_name) \ - return GET_FUNC_ID(func_name); + return GET_FUNC_ID(func_name, orig_name); enum file_funcs_id_t get_file_feature_id(void *ptr) { @@ -48,7 +48,7 @@ enum file_funcs_id_t get_file_feature_always_id(void *ptr) /* X-macros replaced by structures defenitions */ /* For target binaries probes */ #define X(func_name, orig_name) \ - { (ElfW(Addr))& func_name, orig_name, GT_TARGET_PROBE, NULL }, + { (ElfW(Addr))& func_name, #orig_name, GT_TARGET_PROBE, NULL }, static struct probe_desc_t file_probes[] = { PROBES_LIST @@ -58,7 +58,7 @@ static struct probe_desc_t file_probes[] = { /* For all binaries probes */ #define X(func_name, orig_name) \ - { (ElfW(Addr))& CONCAT(func_name, _always), orig_name, \ + { (ElfW(Addr))& CONCAT(func_name, _always), #orig_name, \ GT_ALWAYS_PROBE,NULL}, static struct probe_desc_t file_always_probes[] = { diff --git a/probe_graphics/graphics_probes_list.h b/probe_graphics/graphics_probes_list.h index dc5a67a..37d7059 100644 --- a/probe_graphics/graphics_probes_list.h +++ b/probe_graphics/graphics_probes_list.h @@ -1,25 +1,27 @@ #ifndef __GRAPHICS_PROBES_LIST_H__ #define __GRAPHICS_PROBES_LIST_H__ +/* TODO generate PROBES_LIST with api_names.txt */ + #define PROBES_LIST \ - X(PROBE_NAME(evas_gl_free), "evas_gl_free") \ - X(PROBE_NAME(evas_gl_config_free), "evas_gl_config_free") \ - X(PROBE_NAME(evas_gl_surface_destroy), "evas_gl_surface_destroy") \ - X(PROBE_NAME(evas_gl_context_destroy), "evas_gl_context_destroy") \ - X(PROBE_NAME(evas_gl_new), "eval_gl_new") \ - X(PROBE_NAME(evas_gl_config_new), "evas_gl_config_new") \ - X(PROBE_NAME(evas_gl_surface_create), "evas_gl_surface_create") \ - X(PROBE_NAME(evas_gl_context_create), "evas_gl_context_create") \ - X(PROBE_NAME(evas_gl_make_current), "evas_gl_make_current") \ - X(PROBE_NAME(evas_gl_string_query), "evas_gl_string_query") \ - X(PROBE_NAME(evas_gl_proc_address_get), "evas_gl_proc_address_get") \ - X(PROBE_NAME(evas_gl_native_surface_get), "evas_gl_native_surface_get") \ - X(PROBE_NAME(evas_gl_api_get), "evas_gl_api_get") \ - X(PROBE_NAME(elm_glview_gl_api_get), "elm_glview_gl_api_get") \ - X(PROBE_NAME(evas_gl_context_api_get), "evas_gl_context_api_get") + X(PROBE_NAME(evas_gl_free), evas_gl_free) \ + X(PROBE_NAME(evas_gl_config_free), evas_gl_config_free) \ + X(PROBE_NAME(evas_gl_surface_destroy), evas_gl_surface_destroy) \ + X(PROBE_NAME(evas_gl_context_destroy), evas_gl_context_destroy) \ + X(PROBE_NAME(evas_gl_new), eval_gl_new) \ + X(PROBE_NAME(evas_gl_config_new), evas_gl_config_new) \ + X(PROBE_NAME(evas_gl_surface_create), evas_gl_surface_create) \ + X(PROBE_NAME(evas_gl_context_create), evas_gl_context_create) \ + X(PROBE_NAME(evas_gl_make_current), evas_gl_make_current) \ + X(PROBE_NAME(evas_gl_string_query), evas_gl_string_query) \ + X(PROBE_NAME(evas_gl_proc_address_get), evas_gl_proc_address_get) \ + X(PROBE_NAME(evas_gl_native_surface_get), evas_gl_native_surface_get) \ + X(PROBE_NAME(evas_gl_api_get), evas_gl_api_get) \ + X(PROBE_NAME(elm_glview_gl_api_get), elm_glview_gl_api_get) \ + X(PROBE_NAME(evas_gl_context_api_get), evas_gl_context_api_get) #define X(func_name, orig_name) \ - GET_FUNC_ID(func_name), + GET_FUNC_ID(func_name, orig_name), enum graphics_funcs_id_t { PROBES_LIST diff --git a/probe_graphics/probe_graphics.c b/probe_graphics/probe_graphics.c index c2a9072..53df82e 100644 --- a/probe_graphics/probe_graphics.c +++ b/probe_graphics/probe_graphics.c @@ -27,7 +27,7 @@ PROBES_LIST /* This function returns function's id by its pointer */ #define X(func_name, orig_name) \ if (ptr == & func_name) \ - return GET_FUNC_ID(func_name); + return GET_FUNC_ID(func_name, orig_name); enum graphics_funcs_id_t get_graphics_feature_id(void *ptr) { @@ -47,7 +47,7 @@ enum graphics_funcs_id_t get_graphics_feature_always_id(void *ptr) /* X-macros replaced by structures defenitions */ /* For target binaries probes */ #define X(func_name, orig_name) \ - { (ElfW(Addr))& func_name, orig_name, GT_TARGET_PROBE, NULL }, + { (ElfW(Addr))& func_name, #orig_name, GT_TARGET_PROBE, NULL }, static struct probe_desc_t graphics_probes[] = { PROBES_LIST @@ -57,7 +57,7 @@ static struct probe_desc_t graphics_probes[] = { /* For all binaries probes */ #define X(func_name, orig_name) \ - { (ElfW(Addr)) & CONCAT(func_name, _always), orig_name, \ + { (ElfW(Addr)) & CONCAT(func_name, _always), #orig_name, \ GT_ALWAYS_PROBE, NULL }, static struct probe_desc_t graphics_always_probes[] = { diff --git a/probe_memory/memory_probes_list.h b/probe_memory/memory_probes_list.h index 76ad4bb..737a8ea 100644 --- a/probe_memory/memory_probes_list.h +++ b/probe_memory/memory_probes_list.h @@ -1,34 +1,40 @@ #ifndef __MEMORY_PROBES_LIST_H__ #define __MEMORY_PROBES_LIST_H__ +/* TODO generate PROBES_LIST with api_names.txt */ + #define PROBES_LIST_MEMORY \ - X(PROBE_NAME(malloc), "malloc", GT_ALWAYS_PROBE) \ - X(PROBE_NAME(free), "free", GT_ALWAYS_PROBE) \ - X(PROBE_NAME(realloc), "realloc", GT_ALWAYS_PROBE) \ - X(PROBE_NAME(calloc), "calloc", GT_ALWAYS_PROBE) \ - X(PROBE_NAME(memset), "memset", GT_TARGET_PROBE) \ - X(PROBE_NAME(memcmp), "memcmp", GT_TARGET_PROBE) \ - X(PROBE_NAME(memcpy), "memcpy", GT_TARGET_PROBE) \ - X(PROBE_NAME(posix_memalign), "posix_memalign", GT_ALWAYS_PROBE) \ - X(PROBE_NAME(strdup), "strdup", GT_ALWAYS_PROBE) + X(PROBE_NAME(malloc), malloc, GT_ALWAYS_PROBE) \ + X(PROBE_NAME(free), free, GT_ALWAYS_PROBE) \ + X(PROBE_NAME(realloc), realloc, GT_ALWAYS_PROBE) \ + X(PROBE_NAME(calloc), calloc, GT_ALWAYS_PROBE) \ + X(PROBE_NAME(memset), memset, GT_TARGET_PROBE) \ + X(PROBE_NAME(memcmp), memcmp, GT_TARGET_PROBE) \ + X(PROBE_NAME(memcpy), memcpy, GT_TARGET_PROBE) \ + X(PROBE_NAME(posix_memalign), posix_memalign, GT_ALWAYS_PROBE) \ + X(PROBE_NAME(strdup), strdup, GT_ALWAYS_PROBE) + +/* TODO generate PROBES_LIST with api_names.txt */ #define PROBES_LIST_MEMORY_ALWAYS \ - X(CONCAT(PROBE_NAME(malloc), _always), "malloc", GT_ALWAYS_PROBE) \ - X(CONCAT(PROBE_NAME(free), _always), "free", GT_ALWAYS_PROBE) \ - X(CONCAT(PROBE_NAME(realloc), _always), "realloc", GT_ALWAYS_PROBE) \ - X(CONCAT(PROBE_NAME(calloc), _always), "calloc", GT_ALWAYS_PROBE) \ - X(CONCAT(PROBE_NAME(memset), _always), "memset", GT_ALWAYS_PROBE) \ - X(CONCAT(PROBE_NAME(memcmp), _always), "memcmp", GT_ALWAYS_PROBE) \ - X(CONCAT(PROBE_NAME(memcpy), _always), "memcpy", GT_ALWAYS_PROBE) \ - X(CONCAT(PROBE_NAME(posix_memalign), _always), "posix_memalign", GT_ALWAYS_PROBE) \ - X(CONCAT(PROBE_NAME(strdup), _always), "strdup", GT_ALWAYS_PROBE) + X(CONCAT(PROBE_NAME(malloc), _always), malloc, GT_ALWAYS_PROBE) \ + X(CONCAT(PROBE_NAME(free), _always), free, GT_ALWAYS_PROBE) \ + X(CONCAT(PROBE_NAME(realloc), _always), realloc, GT_ALWAYS_PROBE) \ + X(CONCAT(PROBE_NAME(calloc), _always), calloc, GT_ALWAYS_PROBE) \ + X(CONCAT(PROBE_NAME(memset), _always), memset, GT_ALWAYS_PROBE) \ + X(CONCAT(PROBE_NAME(memcmp), _always), memcmp, GT_ALWAYS_PROBE) \ + X(CONCAT(PROBE_NAME(memcpy), _always), memcpy, GT_ALWAYS_PROBE) \ + X(CONCAT(PROBE_NAME(posix_memalign), _always), posix_memalign, GT_ALWAYS_PROBE) \ + X(CONCAT(PROBE_NAME(strdup), _always), strdup, GT_ALWAYS_PROBE) + +/* TODO generate PROBES_LIST with api_names.txt */ #define PROBES_LIST \ PROBES_LIST_MEMORY #define X(func_name, orig_name, type) \ - GET_FUNC_ID(func_name), + GET_FUNC_ID(func_name, orig_name), #ifdef __cplusplus extern "C" { diff --git a/probe_memory/probe_memory.c b/probe_memory/probe_memory.c index 0c7b4aa..37eda3c 100644 --- a/probe_memory/probe_memory.c +++ b/probe_memory/probe_memory.c @@ -24,7 +24,7 @@ PROBES_LIST_MEMORY_ALWAYS /* This function returns function's id by its pointer */ #define X(func_name, orig_name, type) \ if (ptr == & func_name) \ - return GET_FUNC_ID(func_name); + return GET_FUNC_ID(func_name, orig_name); enum memory_funcs_id_t get_memory_feature_id(void *ptr) { @@ -44,7 +44,7 @@ enum memory_funcs_id_t get_memory_feature_always_id(void *ptr) /* X-macros replaced by structures defenitions */ /* For target binaries probes */ #define X(func_name, orig_name, type) \ - { (ElfW(Addr))& func_name, orig_name, type, NULL }, + { (ElfW(Addr))& func_name, #orig_name, type, NULL }, static struct probe_desc_t memory_probes[] = { PROBES_LIST_MEMORY diff --git a/probe_socket/probe_socket.c b/probe_socket/probe_socket.c index a097dde..ee8e813 100644 --- a/probe_socket/probe_socket.c +++ b/probe_socket/probe_socket.c @@ -28,7 +28,7 @@ PROBES_LIST /* This function returns function's id by its pointer */ #define X(func_name, orig_name) \ if (ptr == & func_name) \ - return GET_FUNC_ID(func_name); + return GET_FUNC_ID(func_name, orig_name); enum network_funcs_id_t get_network_feature_id(void *ptr) { @@ -48,7 +48,7 @@ enum network_funcs_id_t get_network_feature_always_id(void *ptr) /* X-macros replaced by structures defenitions */ /* For target binaries probes */ #define X(func_name, orig_name) \ - { (ElfW(Addr))& func_name, orig_name, GT_TARGET_PROBE, NULL }, + { (ElfW(Addr))& func_name, #orig_name, GT_TARGET_PROBE, NULL }, static struct probe_desc_t network_probes[] = { PROBES_LIST @@ -58,7 +58,7 @@ static struct probe_desc_t network_probes[] = { /* For all binaries probes */ #define X(func_name, orig_name) \ - { (ElfW(Addr))& CONCAT(func_name, _always), orig_name, \ + { (ElfW(Addr))& CONCAT(func_name, _always), #orig_name, \ GT_ALWAYS_PROBE, NULL }, static struct probe_desc_t network_always_probes[] = { diff --git a/probe_socket/socket_probes_list.h b/probe_socket/socket_probes_list.h index 166c96a..496524c 100644 --- a/probe_socket/socket_probes_list.h +++ b/probe_socket/socket_probes_list.h @@ -1,39 +1,41 @@ #ifndef __SOCKET_PROBES_LIST_H__ #define __SOCKET_PROBES_LIST_H__ +/* TODO generate PROBES_LIST with api_names.txt */ + #define PROBES_LIST \ - X(PROBE_NAME(socket), "socket") \ - X(PROBE_NAME(accept), "accept") \ - X(PROBE_NAME(accept4), "accept4") \ - X(PROBE_NAME(connect), "connect") \ - X(PROBE_NAME(shutdown), "shutdown") \ - X(PROBE_NAME(bind), "bind") \ - X(PROBE_NAME(listen), "listen") \ - X(PROBE_NAME(send), "send") \ - X(PROBE_NAME(recv), "recv") \ - X(PROBE_NAME(sendto), "sendto") \ - X(PROBE_NAME(recvfrom), "recvfrom") \ - X(PROBE_NAME(recvmsg), "recvmsg") \ - X(PROBE_NAME(sendmsg), "sendmsg") \ - X(PROBE_NAME(getsockopt), "getsockopt") \ - X(PROBE_NAME(setsockopt), "setsockopt") \ - X(PROBE_NAME(getpeername), "getpeername") \ - X(PROBE_NAME(getsockname), "getsockname") \ - X(PROBE_NAME(socketpair), "socketpair") \ - X(PROBE_NAME(sockatmark), "sockatmark") \ - X(PROBE_NAME(isfdtype), "isfdtype") \ - X(PROBE_NAME(select), "select") \ - X(PROBE_NAME(pselect), "pselect") \ - X(PROBE_NAME(poll), "poll") \ - X(PROBE_NAME(ppoll), "ppoll") \ - X(PROBE_NAME(epoll_create), "epoll_create") \ - X(PROBE_NAME(epoll_create1), "epoll_create1") \ - X(PROBE_NAME(epoll_wait), "epoll_wait") \ - X(PROBE_NAME(epoll_pwait), "epoll_pwait") \ - X(PROBE_NAME(epoll_ctl), "epoll_ctl") + X(PROBE_NAME(socket), socket) \ + X(PROBE_NAME(accept), accept) \ + X(PROBE_NAME(accept4), accept4) \ + X(PROBE_NAME(connect), connect) \ + X(PROBE_NAME(shutdown), shutdown) \ + X(PROBE_NAME(bind), bind) \ + X(PROBE_NAME(listen), listen) \ + X(PROBE_NAME(send), send) \ + X(PROBE_NAME(recv), recv) \ + X(PROBE_NAME(sendto), sendto) \ + X(PROBE_NAME(recvfrom), recvfrom) \ + X(PROBE_NAME(recvmsg), recvmsg) \ + X(PROBE_NAME(sendmsg), sendmsg) \ + X(PROBE_NAME(getsockopt), getsockopt) \ + X(PROBE_NAME(setsockopt), setsockopt) \ + X(PROBE_NAME(getpeername), getpeername) \ + X(PROBE_NAME(getsockname), getsockname) \ + X(PROBE_NAME(socketpair), socketpair) \ + X(PROBE_NAME(sockatmark), sockatmark) \ + X(PROBE_NAME(isfdtype), isfdtype) \ + X(PROBE_NAME(select), select) \ + X(PROBE_NAME(pselect), pselect) \ + X(PROBE_NAME(poll), poll) \ + X(PROBE_NAME(ppoll), ppoll) \ + X(PROBE_NAME(epoll_create), epoll_create) \ + X(PROBE_NAME(epoll_create1), epoll_create1) \ + X(PROBE_NAME(epoll_wait), epoll_wait) \ + X(PROBE_NAME(epoll_pwait), epoll_pwait) \ + X(PROBE_NAME(epoll_ctl), epoll_ctl) #define X(func_name, orig_name) \ - GET_FUNC_ID(func_name), + GET_FUNC_ID(func_name, orig_name), enum network_funcs_id_t { PROBES_LIST diff --git a/probe_thread/probe_thread.c b/probe_thread/probe_thread.c index 82f6980..0467442 100644 --- a/probe_thread/probe_thread.c +++ b/probe_thread/probe_thread.c @@ -28,7 +28,7 @@ PROBES_LIST /* This function returns function's id by its pointer */ #define X(func_name, orig_name) \ if (ptr == & func_name) \ - return GET_FUNC_ID(func_name); + return GET_FUNC_ID(func_name, orig_name); enum thread_funcs_id_t get_thread_feature_id(void *ptr) { @@ -48,7 +48,7 @@ enum thread_funcs_id_t get_thread_feature_always_id(void *ptr) /* X-macros replaced by structures defenitions */ /* For target binaries probes */ #define X(func_name, orig_name) \ - { (ElfW(Addr))& func_name, orig_name, GT_TARGET_PROBE, NULL }, + { (ElfW(Addr))& func_name, #orig_name, GT_TARGET_PROBE, NULL }, static struct probe_desc_t thread_probes[] = { PROBES_LIST @@ -58,7 +58,7 @@ static struct probe_desc_t thread_probes[] = { /* For all binaries probes */ #define X(func_name, orig_name) \ - { (ElfW(Addr))& CONCAT(func_name, _always), orig_name, \ + { (ElfW(Addr))& CONCAT(func_name, _always), #orig_name, \ GT_ALWAYS_PROBE, NULL }, static struct probe_desc_t thread_always_probes[] = { diff --git a/probe_thread/thread_probes_list.h b/probe_thread/thread_probes_list.h index b0aedea..72e5225 100644 --- a/probe_thread/thread_probes_list.h +++ b/probe_thread/thread_probes_list.h @@ -1,59 +1,61 @@ #ifndef __THREAD_PROBES_LIST_H__ #define __THREAD_PROBES_LIST_H__ +/* TODO generate PROBES_LIST with api_names.txt */ + #define PROBES_LIST \ - X(PROBE_NAME(pthread_create), "pthread_create") \ - X(PROBE_NAME(pthread_join), "pthread_join") \ - X(PROBE_NAME(pthread_exit), "pthread_exit") \ - X(PROBE_NAME(pthread_cancel), "pthread_cancel") \ - X(PROBE_NAME(pthread_detach), "pthread_detach") \ - X(PROBE_NAME(pthread_self), "pthread_self") \ - X(PROBE_NAME(pthread_equal), "pthread_equal") \ - X(PROBE_NAME(pthread_setcancelstate), "pthread_setcancelstate") \ - X(PROBE_NAME(pthread_setcanceltype), "pthread_setcanceltype") \ - X(PROBE_NAME(pthread_attr_init), "pthread_attr_init") \ - X(PROBE_NAME(pthread_attr_destroy), "pthread_attr_destroy") \ - X(PROBE_NAME(pthread_attr_getdetachstate), "pthread_attr_getdetachstate") \ - X(PROBE_NAME(pthread_attr_setdetachstate), "pthread_attr_setdetachstate") \ - X(PROBE_NAME(pthread_attr_getstacksize), "pthread_attr_getstacksize") \ - X(PROBE_NAME(pthread_attr_setstacksize), "pthread_attr_setstacksize") \ - X(PROBE_NAME(pthread_attr_getinheritsched), "pthread_attr_getinheritsched") \ - X(PROBE_NAME(pthread_attr_setinheritsched), "pthread_attr_setinheritsched") \ - X(PROBE_NAME(pthread_attr_getschedparam), "pthread_attr_getschedparam") \ - X(PROBE_NAME(pthread_attr_setschedparam), "pthread_attr_setschedparam") \ - X(PROBE_NAME(pthread_attr_getschedpolicy), "pthread_attr_getschedpolicy") \ - X(PROBE_NAME(pthread_attr_setschedpolicy), "pthread_attr_setschedpolicy") \ - X(PROBE_NAME(pthread_attr_getguardsize), "pthread_attr_getguardsize") \ - X(PROBE_NAME(pthread_attr_setguardsize), "pthread_attr_setguardsize") \ - X(PROBE_NAME(pthread_attr_getscope), "pthread_attr_getscope") \ - X(PROBE_NAME(pthread_attr_setscope), "pthread_attr_setscope") \ - X(PROBE_NAME(pthread_attr_getstack), "pthread_attr_getstack") \ - X(PROBE_NAME(pthread_attr_setstack), "pthread_attr_setstack") \ - X(PROBE_NAME(pthread_mutex_init), "pthread_mutex_init") \ - X(PROBE_NAME(pthread_mutex_destroy), "pthread_mutex_destroy") \ - X(PROBE_NAME(pthread_mutex_lock), "pthread_mutex_lock") \ - X(PROBE_NAME(pthread_mutex_timedlock), "pthread_mutex_timedlock") \ - X(PROBE_NAME(pthread_mutex_trylock), "pthread_mutex_trylock") \ - X(PROBE_NAME(pthread_mutex_unlock), "pthread_mutex_unlock") \ - X(PROBE_NAME(pthread_mutexattr_init), "pthread_mutexattr_init") \ - X(PROBE_NAME(pthread_mutexattr_destroy), "pthread_mutexattr_destroy") \ - X(PROBE_NAME(pthread_mutexattr_getprioceiling), "pthread_mutexattr_getprioceiling") \ - X(PROBE_NAME(pthread_mutexattr_setprioceiling), "pthread_mutexattr_setprioceiling") \ - X(PROBE_NAME(pthread_mutexattr_getprotocol), "pthread_mutexattr_getprotocol") \ - X(PROBE_NAME(pthread_mutexattr_setprotocol), "pthread_mutexattr_setprotocol") \ - X(PROBE_NAME(pthread_mutexattr_getpshared), "pthread_mutexattr_getpshared") \ - X(PROBE_NAME(pthread_mutexattr_setpshared), "pthread_mutexattr_setpshared") \ - X(PROBE_NAME(pthread_mutexattr_gettype), "pthread_mutexattr_gettype") \ - X(PROBE_NAME(pthread_mutexattr_settype), "pthread_mutexattr_settype") \ - X(PROBE_NAME(pthread_cond_init), "pthread_cond_init") \ - X(PROBE_NAME(pthread_cond_destroy), "pthread_cond_destroy") \ - X(PROBE_NAME(pthread_cond_wait), "pthread_cond_wait") \ - X(PROBE_NAME(pthread_cond_timedwait), "pthread_cond_timedwait") \ - X(PROBE_NAME(pthread_cond_signal), "pthread_cond_signal") \ - X(PROBE_NAME(pthread_cond_broadcast), "pthread_cond_broadcast") + X(PROBE_NAME(pthread_create), pthread_create) \ + X(PROBE_NAME(pthread_join), pthread_join) \ + X(PROBE_NAME(pthread_exit), pthread_exit) \ + X(PROBE_NAME(pthread_cancel), pthread_cancel) \ + X(PROBE_NAME(pthread_detach), pthread_detach) \ + X(PROBE_NAME(pthread_self), pthread_self) \ + X(PROBE_NAME(pthread_equal), pthread_equal) \ + X(PROBE_NAME(pthread_setcancelstate), pthread_setcancelstate) \ + X(PROBE_NAME(pthread_setcanceltype), pthread_setcanceltype) \ + X(PROBE_NAME(pthread_attr_init), pthread_attr_init) \ + X(PROBE_NAME(pthread_attr_destroy), pthread_attr_destroy) \ + X(PROBE_NAME(pthread_attr_getdetachstate), pthread_attr_getdetachstate) \ + X(PROBE_NAME(pthread_attr_setdetachstate), pthread_attr_setdetachstate) \ + X(PROBE_NAME(pthread_attr_getstacksize), pthread_attr_getstacksize) \ + X(PROBE_NAME(pthread_attr_setstacksize), pthread_attr_setstacksize) \ + X(PROBE_NAME(pthread_attr_getinheritsched), pthread_attr_getinheritsched) \ + X(PROBE_NAME(pthread_attr_setinheritsched), pthread_attr_setinheritsched) \ + X(PROBE_NAME(pthread_attr_getschedparam), pthread_attr_getschedparam) \ + X(PROBE_NAME(pthread_attr_setschedparam), pthread_attr_setschedparam) \ + X(PROBE_NAME(pthread_attr_getschedpolicy), pthread_attr_getschedpolicy) \ + X(PROBE_NAME(pthread_attr_setschedpolicy), pthread_attr_setschedpolicy) \ + X(PROBE_NAME(pthread_attr_getguardsize), pthread_attr_getguardsize) \ + X(PROBE_NAME(pthread_attr_setguardsize), pthread_attr_setguardsize) \ + X(PROBE_NAME(pthread_attr_getscope), pthread_attr_getscope) \ + X(PROBE_NAME(pthread_attr_setscope), pthread_attr_setscope) \ + X(PROBE_NAME(pthread_attr_getstack), pthread_attr_getstack) \ + X(PROBE_NAME(pthread_attr_setstack), pthread_attr_setstack) \ + X(PROBE_NAME(pthread_mutex_init), pthread_mutex_init) \ + X(PROBE_NAME(pthread_mutex_destroy), pthread_mutex_destroy) \ + X(PROBE_NAME(pthread_mutex_lock), pthread_mutex_lock) \ + X(PROBE_NAME(pthread_mutex_timedlock), pthread_mutex_timedlock) \ + X(PROBE_NAME(pthread_mutex_trylock), pthread_mutex_trylock) \ + X(PROBE_NAME(pthread_mutex_unlock), pthread_mutex_unlock) \ + X(PROBE_NAME(pthread_mutexattr_init), pthread_mutexattr_init) \ + X(PROBE_NAME(pthread_mutexattr_destroy), pthread_mutexattr_destroy) \ + X(PROBE_NAME(pthread_mutexattr_getprioceiling), pthread_mutexattr_getprioceiling) \ + X(PROBE_NAME(pthread_mutexattr_setprioceiling), pthread_mutexattr_setprioceiling) \ + X(PROBE_NAME(pthread_mutexattr_getprotocol), pthread_mutexattr_getprotocol) \ + X(PROBE_NAME(pthread_mutexattr_setprotocol), pthread_mutexattr_setprotocol) \ + X(PROBE_NAME(pthread_mutexattr_getpshared), pthread_mutexattr_getpshared) \ + X(PROBE_NAME(pthread_mutexattr_setpshared), pthread_mutexattr_setpshared) \ + X(PROBE_NAME(pthread_mutexattr_gettype), pthread_mutexattr_gettype) \ + X(PROBE_NAME(pthread_mutexattr_settype), pthread_mutexattr_settype) \ + X(PROBE_NAME(pthread_cond_init), pthread_cond_init) \ + X(PROBE_NAME(pthread_cond_destroy), pthread_cond_destroy) \ + X(PROBE_NAME(pthread_cond_wait), pthread_cond_wait) \ + X(PROBE_NAME(pthread_cond_timedwait), pthread_cond_timedwait) \ + X(PROBE_NAME(pthread_cond_signal), pthread_cond_signal) \ + X(PROBE_NAME(pthread_cond_broadcast), pthread_cond_broadcast) #define X(func_name, orig_name) \ - GET_FUNC_ID(func_name), + GET_FUNC_ID(func_name, orig_name), enum thread_funcs_id_t { PROBES_LIST diff --git a/probe_ui/probe_ui.c b/probe_ui/probe_ui.c index 6acc4a1..5344939 100644 --- a/probe_ui/probe_ui.c +++ b/probe_ui/probe_ui.c @@ -21,7 +21,7 @@ PROBES_LIST /* This function returns function's id by its pointer */ #define X(func_name, orig_name) \ if (ptr == & func_name) \ - return GET_FUNC_ID(func_name); + return GET_FUNC_ID(func_name, orig_name); enum ui_funcs_id_t get_ui_feature_id(void *ptr) { @@ -37,7 +37,7 @@ enum ui_funcs_id_t get_ui_feature_id(void *ptr) /* X-macros replaced by structures defenitions */ #define X(func_name, orig_name) \ - { (ElfW(Addr))& func_name, orig_name, GT_TARGET_PROBE, NULL }, + { (ElfW(Addr))& func_name, #orig_name, GT_TARGET_PROBE, NULL }, static struct probe_desc_t ui_probes[] = { PROBES_LIST diff --git a/probe_ui/ui_probes_list.h b/probe_ui/ui_probes_list.h index 1b00cec..472da65 100644 --- a/probe_ui/ui_probes_list.h +++ b/probe_ui/ui_probes_list.h @@ -1,11 +1,13 @@ #ifndef __UI_PROBES_LIST_H__ #define __UI_PROBES_LIST_H__ +/* TODO generate PROBES_LIST with api_names.txt */ + #define PROBES_LIST \ - X(PROBE_NAME(evas_object_show), "evas_object_show") + X(PROBE_NAME(evas_object_show), evas_object_show) #define X(func_name, orig_name) \ - GET_FUNC_ID(func_name), + GET_FUNC_ID(func_name, orig_name), enum ui_funcs_id_t { PROBES_LIST |