4 * Copyright (c) 2000 - 2011 Samsung Electronics Co., Ltd. All rights reserved.
8 * Jaewon Lim <jaewon81.lim@samsung.com>
9 * Woojin Jung <woojin2.jung@samsung.com>
10 * Juyoung Kim <j0.kim@samsung.com>
12 * This library is free software; you can redistribute it and/or modify it under
13 * the terms of the GNU Lesser General Public License as published by the
14 * Free Software Foundation; either version 2.1 of the License, or (at your option)
17 * This library is distributed in the hope that it will be useful, but WITHOUT ANY
18 * WARRANTY; without even the implied warranty of MERCHANTABILITY or
19 * FITNESS FOR A PARTICULAR PURPOSE. See the GNU Lesser General Public
20 * License for more details.
22 * You should have received a copy of the GNU Lesser General Public License
23 * along with this library; if not, write to the Free Software Foundation, Inc., 51
24 * Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA
35 #include <pthread.h> // for pthread_mutex_t
45 #define MAX_PATH_LENGTH 256
46 #define MAX_STACK_DEPTH 128
47 #define TRIM_STACK_DEPTH 2
50 #define WIN_RENDER_POST 0
51 #define CONTROLBAR_RENDER_POST 1
52 #define NAVIFRAME_RENDER_POST 2
53 #define PAGER_RENDER_POST 3
54 #define RENDER_POST_COUNT 4
56 #define SNAPSHOT_WAIT_TIME_MAX 10000
59 #define TS_NONE 0x00000000
60 #define TS_PROBE 0x00000001
61 #define TS_INIT 0x00000002
62 #define TS_FINIT 0x00000004
63 #define TS_ENTER_PROBE_BLOCK 0x00000008
64 #define TS_SET_PROBE_POINT 0x00000010
65 #define TS_PRINT_LOG 0x00000020
66 #define TS_PRINT_SAMPLE_LOG 0x00000040
67 #define TS_APPEND_TYPE_LOG 0x00000080
68 #define TS_BACKTRACE 0x00000100
69 #define TS_HASHFUNC 0x00000200
70 #define TS_PROFIL_THREAD 0x00000400
71 #define TS_PROFIL_COUNT 0x00000800
72 #define TS_DETECT_TOUCH 0x00001000
73 #define TS_REGIST_SCREEN_CHANGE 0x00002000
74 #define TS_POSSIBLE_CAPTURE 0x00004000
75 #define TS_RECV_THREAD 0x00008000
76 #define TS_CUSTOM_CHART_THREAD 0x00010000
77 #define TRACE_STATE_SET(value) ((gSTrace) |= (value))
78 #define TRACE_STATE_UNSET(value) ((gSTrace) &= (~value))
80 #define ENABLE_INTERNAL_MALLOC 0x0001
81 #define ENABLE_SNAPSHOT 0x0002
83 #define SCREENSHOT_LOCK() \
86 pthread_mutex_lock(&(gTraceInfo.screenshot.ssMutex)); \
87 old = gTraceInfo.screenshot.state; \
88 gTraceInfo.screenshot.state = -1; \
89 pthread_mutex_unlock(&(gTraceInfo.screenshot.ssMutex)); \
91 if(isOptionEnabled(OPT_SNAPSHOT)) \
96 #define SCREENSHOT_UNLOCK() \
98 pthread_mutex_lock(&(gTraceInfo.screenshot.ssMutex)); \
99 gTraceInfo.screenshot.state = 1; \
100 pthread_mutex_unlock(&(gTraceInfo.screenshot.ssMutex)); \
103 #define SCREENSHOT_SET() \
106 pthread_mutex_lock(&(gTraceInfo.screenshot.ssMutex)); \
107 old = gTraceInfo.screenshot.state; \
108 if(gTraceInfo.screenshot.state >= 0) \
109 gTraceInfo.screenshot.state = 1; \
110 pthread_mutex_unlock(&(gTraceInfo.screenshot.ssMutex)); \
112 if(isOptionEnabled(OPT_SNAPSHOT)) \
117 #define SCREENSHOT_UNSET() \
119 pthread_mutex_lock(&(gTraceInfo.screenshot.ssMutex)); \
120 if(gTraceInfo.screenshot.state >= 0) \
121 gTraceInfo.screenshot.state = 0; \
122 pthread_mutex_unlock(&(gTraceInfo.screenshot.ssMutex)); \
125 #define SCREENSHOT_DONE() \
128 pthread_mutex_lock(&(gTraceInfo.screenshot.ssMutex)); \
129 old = gTraceInfo.screenshot.state; \
130 if(gTraceInfo.screenshot.state == 1) { \
131 gTraceInfo.screenshot.state = 2; \
132 } else if(gTraceInfo.screenshot.state == 2) { \
133 gTraceInfo.screenshot.state = 0; \
136 pthread_mutex_unlock(&(gTraceInfo.screenshot.ssMutex)); \
138 activateCaptureTimer(); \
139 } else if(old == 2) { \
140 if(isOptionEnabled(OPT_SNAPSHOT)) \
145 #define NUM_ORIGINAL_LIBRARY 9
155 LIBECORE_INPUT_EVAS = 6,
157 LIBCAPI_APPFW_APPLICATION = 8
160 extern char *lib_string[NUM_ORIGINAL_LIBRARY];
161 extern void *lib_handle[NUM_ORIGINAL_LIBRARY];
163 // type definition for global variable
167 pthread_mutex_t eventMutex;
173 pthread_mutex_t sockMutex;
179 unsigned int startTime;
185 pthread_mutex_t ssMutex;
199 __screenshotInfo screenshot;
203 int custom_chart_callback_count;
204 unsigned long optionflag;
207 extern __thread unsigned long gSTrace;
208 extern __traceInfo gTraceInfo;
210 int get_map_address(void* symbol, void** map_start, void** map_end);
211 char** da_backtrace_symbols (void* const* array, int size);
212 char** cached_backtrace_symbols (void* const* array, int size);
215 int __profil(int mode);
218 void WcharToChar(char* pstrDest, const wchar_t* pwstrSrc);
220 // screen capture functions
221 int initialize_screencapture();
222 int finalize_screencapture();
224 int activateCaptureTimer();
225 void _cb_render_post(void* data, Evas* e, void* eventinfo);
227 // event related functions
228 int initialize_event();
229 int finalize_event();
230 int getOrientation();
231 void orientationEnabled();
232 void on_orientation_changed(int angle, bool capi);
234 int remove_indir(const char* dirname);
237 #define isOptionEnabled(OPT) ((gTraceInfo.optionflag & OPT) != 0)
243 #endif // _DAHELPER_H_