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 ENABLE_INTERNAL_MALLOC 0x0001
60 #define ENABLE_SNAPSHOT 0x0002
62 #define LOG(FORMAT, ...) \
65 sprintf(buf, FORMAT, __VA_ARGS__); \
69 #define SCREENSHOT_LOCK() \
72 pthread_mutex_lock(&(gTraceInfo.screenshot.ssMutex)); \
73 old = gTraceInfo.screenshot.state; \
74 gTraceInfo.screenshot.state = -1; \
75 pthread_mutex_unlock(&(gTraceInfo.screenshot.ssMutex)); \
77 if(isOptionEnabled(OPT_SNAPSHOT)) \
82 #define SCREENSHOT_UNLOCK() \
84 pthread_mutex_lock(&(gTraceInfo.screenshot.ssMutex)); \
85 if(gTraceInfo.screenshot.state < 0) \
86 gTraceInfo.screenshot.state = 1; \
87 pthread_mutex_unlock(&(gTraceInfo.screenshot.ssMutex)); \
90 #define SCREENSHOT_SET() \
93 pthread_mutex_lock(&(gTraceInfo.screenshot.ssMutex)); \
94 old = gTraceInfo.screenshot.state; \
95 if(gTraceInfo.screenshot.state >= 0) \
96 gTraceInfo.screenshot.state = 1; \
97 pthread_mutex_unlock(&(gTraceInfo.screenshot.ssMutex)); \
99 if(isOptionEnabled(OPT_SNAPSHOT)) \
104 #define SCREENSHOT_UNSET() \
106 pthread_mutex_lock(&(gTraceInfo.screenshot.ssMutex)); \
107 if(gTraceInfo.screenshot.state >= 0) \
108 gTraceInfo.screenshot.state = 0; \
109 pthread_mutex_unlock(&(gTraceInfo.screenshot.ssMutex)); \
112 #define SCREENSHOT_DONE() \
115 pthread_mutex_lock(&(gTraceInfo.screenshot.ssMutex)); \
116 old = gTraceInfo.screenshot.state; \
117 if(gTraceInfo.screenshot.state == 1) \
118 gTraceInfo.screenshot.state = 2; \
119 pthread_mutex_unlock(&(gTraceInfo.screenshot.ssMutex)); \
121 activateCaptureTimer(); \
125 #define SCREENSHOT_TIMEOUT() \
128 pthread_mutex_lock(&(gTraceInfo.screenshot.ssMutex)); \
129 old = gTraceInfo.screenshot.state; \
130 if(gTraceInfo.screenshot.state == 2) \
131 gTraceInfo.screenshot.state = 0; \
132 pthread_mutex_unlock(&(gTraceInfo.screenshot.ssMutex)); \
134 if(isOptionEnabled(OPT_SNAPSHOT)) \
139 #define NUM_ORIGINAL_LIBRARY 9
149 LIBECORE_INPUT_EVAS = 6,
151 LIBCAPI_APPFW_APPLICATION = 8
154 extern char *lib_string[NUM_ORIGINAL_LIBRARY];
155 extern void *lib_handle[NUM_ORIGINAL_LIBRARY];
157 // type definition for global variable
161 pthread_mutex_t eventMutex;
167 pthread_mutex_t sockMutex;
173 unsigned int startTime;
179 pthread_mutex_t ssMutex;
193 __screenshotInfo screenshot;
197 int custom_chart_callback_count;
198 unsigned long optionflag;
201 extern __traceInfo gTraceInfo;
203 int get_map_address(void* symbol, void** map_start, void** map_end);
204 char** da_backtrace_symbols (void* const* array, int size);
205 char** cached_backtrace_symbols (void* const* array, int size);
208 int __profil(int mode);
211 void WcharToChar(char* pstrDest, const wchar_t* pwstrSrc);
213 // screen capture functions
214 int initialize_screencapture();
215 int finalize_screencapture();
217 int activateCaptureTimer();
218 void _cb_render_post(void* data, Evas* e, void* eventinfo);
220 // event related functions
221 int initialize_event();
222 int finalize_event();
223 int getOrientation();
224 void on_orientation_changed(int angle, bool capi);
226 int remove_indir(const char* dirname);
229 #define isOptionEnabled(OPT) ((gTraceInfo.optionflag & OPT) != 0)
235 #endif // _DAHELPER_H_