-/*\r
- * Dynamic Analyzer\r
- *\r
- * Copyright (c) 2000 - 2011 Samsung Electronics Co., Ltd. All rights reserved.\r
- *\r
- * Contact: \r
- * Jooyoul Lee <jy.exe.lee@samsung.com>\r
- * Juyoung Kim <j0.kim@samsung.com>\r
- *\r
- * Licensed under the Apache License, Version 2.0 (the "License");\r
- * you may not use this file except in compliance with the License.\r
- * You may obtain a copy of the License at\r
- *\r
- * http://www.apache.org/licenses/LICENSE-2.0\r
- *\r
- * Unless required by applicable law or agreed to in writing, software\r
- * distributed under the License is distributed on an "AS IS" BASIS,\r
- * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\r
- * See the License for the specific language governing permissions and\r
- * limitations under the License.\r
- * \r
- * Contributors:\r
- * - S-Core Co., Ltd\r
- * \r
- */\r
-\r
-package org.tizen.dynamicanalyzer.common;\r
-\r
-import org.tizen.dynamicanalyzer.nl.AnalyzerLabels;\r
-\r
-public class AnalyzerConstants {\r
- // if log change occurs then increase save data version!!\r
- public static final String SAVE_DATA_VERSION = "0.88"; //$NON-NLS-1$\r
- public static final boolean CHECK_INTERNAL = true;\r
-\r
- public static final String DA_VERSION_SWAP = "3.0";\r
- public static final String DA_VERSION_OLD = "2.2";\r
-\r
- /* folder names */\r
- public static final String TEMP_FOLDER_RUN_PREFIX = ".RUN"; //$NON-NLS-1$\r
- public static final String IMAGE_FOLDER_NAME = "img"; //$NON-NLS-1$\r
- public static final String SMALL_IMAGE_FOLDER_NAME = "small"; //$NON-NLS-1$\r
- public static final String XML_FOLDER_NAME = "xml"; //$NON-NLS-1$\r
- public static final String LICENSE_FILE_NAME = "license"; //$NON-NLS-1$\r
- public static final String USER_INTERFACE_API_LIST_FILE_NAME = "user_interface_api_list"; //$NON-NLS-1$\r
-\r
- public static final String API_NAME_FILE_NAME = "apis"; //$NON-NLS-1$\r
-\r
- public static final String READELF_BIN = "readelf"; //$NON-NLS-1$\r
-\r
- public static final String VERSION_NAME = "version"; //$NON-NLS-1$\r
- public static final String DATABASE_NAME = "da.trace"; //$NON-NLS-1$\r
- public static final String DEFAULT_IMAGE_NAME = "noImage.jpg"; //$NON-NLS-1$\r
- public final static String PROBE_LIB_TIZEN = "da_probe_tizen.so"; //$NON-NLS-1$\r
- public final static String PROBE_LIB_OSP = "da_probe_osp.so"; //$NON-NLS-1$\r
-\r
- /* Save Data table */\r
- public static final String LEAK_DATA_TABLE_NAME = "LeakData"; //$NON-NLS-1$\r
- public static final String FAILED_DATA_TABLE_NAME = "FailedData"; //$NON-NLS-1$\r
-\r
- /* thread names */\r
- public static final String LOG_QUEUE_OBSERVING_THREAD = "Log Queue Observing thread"; //$NON-NLS-1$\r
- public static final String COMMUNICATOR_RECEIVE_THREAD = "Communicator Receive Thread"; //$NON-NLS-1$\r
- public static final String MESSAGE_INTERNAL_IMAGE_THREAD = "Internal Image Process Thread"; //$NON-NLS-1$\r
- public static final String STOP_LOG_THREAD = "Stop Log Thread"; //$NON-NLS-1$\r
- public static final String BATTERY_RECEIVE_THREAD = "Battery Receive Thread"; //$NON-NLS-1$\r
- public static final String SLP_APP_RUN_THREAD = "SLP App Run Thread"; //$NON-NLS-1$\r
- public static final String OPEN_TRACE_THREAD = "Open trace input thread"; //$NON-NLS-1$\r
- public static final String INSERT_LOG_THREAD = "Insert log thread"; //$NON-NLS-1$\r
- public static final String IDE_COMMUNICATOR_THREAD = "IDE Communicator thread"; //$NON-NLS-1$\r
- public static final String SEND_MESSAGE_THREAD = "Send message thread"; //$NON-NLS-1$\r
- public static final String START_STOP_THREAD = "Start stop thread"; //$NON-NLS-1$\r
- public static final String FILE_CHART_MANAGER_THREAD = "File Chart Manager thread"; //$NON-NLS-1$\r
- public static final String THREAD_CHART_MANAGER_THREAD = "Thread Chart Manager thread"; //$NON-NLS-1$\r
- public static final String NETWORK_CHART_MANAGER_THREAD = "Network Chart Manager thread"; //$NON-NLS-1$\r
- public static final String KERNEL_CHART_MANAGER_THREAD = "Kernel Chart Manager thread"; //$NON-NLS-1$\r
- public static final String FUNCTION_USAGE_PROFILING_THREAD = "Function usage profiling thread"; //$NON-NLS-1$\r
- public static final String USER_INTERFACE_PAGE_MANAGER_THREAD = "User Interface Page Managerthread"; //$NON-NLS-1$ \r
- public static final String SQL_INSERTER_THREAD = "sql_inserter_thread"; //$NON-NLS-1$\r
- public static final String HEART_BEAT_THREAD = "heart beat thread"; //$NON-NLS-1$\r
-\r
- /* log parsing token and callstack parsing token, etc... */\r
- public static final String CALLSTACK_START = "callstack_start"; //$NON-NLS-1$\r
- public static final String CALLSTACK_END = "callstack_end"; //$NON-NLS-1$\r
- public static final String CALLSTACK_CUT_MEMORY_TOKEN = "\\["; //$NON-NLS-1$\r
- public static final String CALLSTACK_API_TOKEN = "\\("; //$NON-NLS-1$\r
- public static final String CALLSTACK_API_TOKEN_STRING = "("; //$NON-NLS-1$\r
- public static final String CALLSTACK_API_EMPTY_TOKEN = "\\)"; //$NON-NLS-1$\r
- public static final String CALLSTACK_API_OFFSET_TOKEN = "\\+"; //$NON-NLS-1$\r
- public static final String CLASS = "class"; //$NON-NLS-1$\r
- public static final String DATA_PARSING_TOKEN = "`,"; //$NON-NLS-1$\r
-\r
- /* timer intervals */\r
- public static final int SOCKET_CHECK_INTERVAL = 10;\r
- public static final int DATA_SOCKET_TIMEOUT = 50000;\r
- public static final int CONTROL_SOCKET_TIMEOUT = 10000;\r
- \r
- public static final int SOCKET_FORWARD_INTERVAL = 1000;\r
- public static final int LOG_CHECK_INTERVAL = 1000;\r
- public static final int SAVE_PREPARE_TIME = 2000;\r
- public static final long TIMER_START_TIME_DEFAULT = 1000;\r
- public static final int TIMER_INTERVAL_DEFAULT = 1000;\r
-\r
- /* project save index */\r
- public static final int PROJECT_VERSION_INDEX = 0;\r
- public static final int PROJECT_DEVICE_INDEX = 1;\r
- public static final int PROJECT_PACKAGE_ID_INDEX = 2;\r
- public static final int PROJECT_APP_NAME_INDEX = 3;\r
- public static final int PROJECT_CREATE_TIME_INDEX = 4;\r
- public static final int PROJECT_LAST_TIME_INDEX = 5;\r
- public static final int PROJECT_STOP_TIME_INDEX = 6;\r
- public static final int PROJECT_PROF_START_TIME_INDEX = 7;\r
- public static final int PROJECT_LOG_COUNT_INDEX = 8;\r
- public static final int PROJECT_SYSTEM_COUNT_INDEX = 9;\r
- public static final int PROJECT_PROFILE_COUNT_INDEX = 10;\r
- public static final int PROJECT_SAVE_PATH_INDEX = 11;\r
- public static final int PROJECT_MAIN_PID_INDEX = 12;\r
- \r
-\r
- /* save return values */\r
- public static final int ERROR_EXTENSION_FAIL = -1;\r
- public static final int SUCCESS = 1;\r
- public static final int ERROR_SAVE_FAIL = 0;\r
- public static final int FAIL = -2;\r
-\r
- /* data size */\r
- public static final int INSERT_DATA_PACKAGE_SIZE = 80;\r
- public static final int MAX_REPEAT_COUNT = 5;\r
-\r
- /* log parsing size */\r
- public static final int DATABASE_READ_SIZE = 100;\r
-\r
- public static final String MSG_START = "100"; //$NON-NLS-1$\r
- public static final String MSG_STOP = "101"; //$NON-NLS-1$\r
- public static final String MSG_OPTION = "103"; //$NON-NLS-1$\r
- public static final String MSG_VERSION = "999"; //$NON-NLS-1$\r
- public static final String MSG_OK = "901"; //$NON-NLS-1$\r
- public static final String MSG_NOT_OK = "902"; //$NON-NLS-1$\r
- public static final String MSG_SCREENSHOT = "103"; //$NON-NLS-1$\r
-\r
- public static final int MSG_RECORD = 801;\r
- public static final int MSG_REPLAY = 802;\r
-\r
- public static final long FEATURE_OFF = 0x0000;\r
- public static final long FEATURE_ON = 0x1;\r
- \r
- public static final long RESERVED_1 = FEATURE_ON;\r
- public static final long RESERVED_2 = FEATURE_ON << 1;\r
- public static final long FEATURE_FUNCTION_SAMPLING = 0x80000; // 19\r
- public static final long FEATURE_FUNCTION_PROFILING = (RESERVED_1 << 2)|FEATURE_FUNCTION_SAMPLING;\r
- public static final long FEATURE_ALLOCATION = FEATURE_ON << 3;//0x0008;\r
- \r
- \r
-\r
- \r
- \r
- public static final long FEATURE_FILE_API = 0x0010; // 4\r
- public static final long FEATURE_THREAD_API = 0x0020; // 5\r
- public static final long FEATURE_OSP_UI_API = 0x0040; //6\r
- public static final long FEATURE_SCREENSHOT = 0x0080; //7\r
- public static final long FEATURE_USER_EVENT = 0x0100; //8\r
- public static final long FEATURE_RECORDING = 0x0200; //9\r
-\r
- public static final long FEATURE_SYSCALL_FILE = 0x0400; //10\r
- public static final long FEATURE_SYSCALL_IPC = 0x0800; // 11\r
- public static final long FEATURE_SYSCALL_PROCESS = 0x1000; //12\r
- public static final long FEATURE_SYSCALL_SIGNAL = 0x2000; //13\r
- public static final long FEATURE_SYSCALL_NETWORK = 0x4000; //14\r
- public static final long FEATURE_SYSCALL_DESC = 0x8000; //15\r
-\r
- public static final long FEATURE_CONTEXT_SWITCHING = 0x10000; //16\r
- public static final long FEATURE_NETWORK_API = 0x20000; //17\r
- public static final long FEATURE_OPENGL_API = 0x40000; //18\r
-\r
- public static final long SYSTEM_CPU = 0x100000; //20\r
- public static final long SYSTEM_PROCESSES = 0x200000; //21\r
- public static final long SYSTEM_MEMORY = 0x400000; //22\r
- public static final long SYSTEM_DISK = 0x800000; //23\r
- public static final long SYSTEM_NETWORK = 0x1000000; //24\r
- public static final long SYSTEM_DEVICE = 0x2000000; //25\r
- public static final long SYSTEM_RESERVED = 0x8000000; //27\r
-\r
- public static final long SYSTEM_ENERGY = 0x4000000; //26\r
- \r
- public static final long MEMORY_API_PROBING_NO_FILTER = 0x10000000; //28\r
- public static final long FILE_API_PROBING_NO_FILTER = 0x20000000; //29\r
- public static final long THREAD_API_PROBING_NO_FILTER = 0x40000000; //30\r
- public static final long OSP_UI_API_PROBING_NO_FILTER = 0x80000000; //31\r
-// public static final long NETWORK_API_PROBING_NO_FILTER = FEATURE_ON << 32; // prefeature\r
-// public static final long OPENGL_API_PROBING_NO_FILTER = FEATURE_ON << 33;// prefeaturen\r
- public static final long NETWORK_API_PROBING_NO_FILTER = FEATURE_ON; // prefeature\r
- public static final long OPENGL_API_PROBING_NO_FILTER = FEATURE_ON <<1;// prefeaturen\r
- \r
- public static final long SCREENSHOT_PERIODIC = 10;//must modification\r
- public static final long SCREENSHOT_PERIODIC_AUTO = 1;//must modification\r
- public static final long FUNCTION_PROFILING_SAMPLING_PERIODIC = 10;//must modification\r
- public static final long SYSTEM_INFOMATION_SAMPLING_PERIODIC = 1000;//must modification\r
- \r
-\r
- /* Message Type */\r
- public static final int MSG_APP_INFO = 1; //$NON-NLS-1$\r
- public static final int MSG_USER_PROFILING_SAMPLE = 3; //$NON-NLS-1$\r
- public static final int MSG_DEVICE_LOG = 4; //$NON-NLS-1$\r
- public static final int MSG_LOG = 5; //$NON-NLS-1$\r
- public static final int MSG_IMAGE = 6; //$NON-NLS-1$\r
- public static final int MSG_TERMINATE = 7; //$NON-NLS-1$\r
- public static final int MSG_DEBUG = 9; //$NON-NLS-1$\r
-\r
- public static final int SCREENSHOT_OFF = 0;\r
- public static final int SCREENSHOT_ON = 1;\r
-\r
- public static final int DAEMON_LISTEN_TRY = 50;\r
-\r
- /* app info */\r
- public static final int APP_INFO_SYSTEM_MEMORY_SIZE = 0;\r
- public static final int APP_INFO_STORAGE_SIZE = 1;\r
- public static final int APP_INFO_BLUETOOTH_SUPPORT = 2;\r
- public static final int APP_INFO_GPS_SUPPORT = 3;\r
- public static final int APP_INFO_WIFI_SUPPORT = 4;\r
- public static final int APP_INFO_CAMERA_COUNT = 5;\r
- public static final int APP_INFO_NETWORK_TYPE = 6;\r
- public static final int APP_INFO_MAX_BRIGHTNESS = 7;\r
- public static final int APP_INFO_WIDTH = 8;\r
- public static final int APP_INFO_HEIGHT = 9;\r
- public static final int APP_INFO_THEME = 10;\r
- public static final int APP_INFO_VERSION = 11;\r
- public static final int APP_INFO_SCALE = 12;\r
- public static final int APP_INFO_REMOVABLE = 13;\r
- public static final int APP_INFO_COMMENT = 14;\r
- public static final int APP_INFO_PID = 15;\r
- public static final int APP_INFO_START_TIME = 16;\r
- public static final int APP_INFO_PIE_BUILD = 17;\r
- public static final int APP_INFO_BASE_ADDRESS = 18;\r
- public static final int APP_INFO_APP_TYPE = 19;\r
- public static final int APP_INFO_BINARY_PATH = 20;\r
- public static final int APP_INFO_SIZE = 21;\r
-\r
- /* app type */\r
- public static final int APP_TYPE_TIZEN = 1;\r
- public static final int APP_TYPE_OSP = 4;\r
-\r
- /* Source Line errors */\r
- public static final int SOURCELINE_NOERROR = 0;\r
- public static final int SOURCELINE_NULL_PATH = 1;\r
- public static final int SOURCELINE_NULL_ADDRESS = 2;\r
- public static final int SOURCELINE_FILE_NOT_FOUND = 3;\r
- public static final int SOURCELINE_BAD_ADDRESS = 4;\r
- public static final int SOURCELINE_NO_SYMBOL_INFORMATION = 5;\r
- public static final int SOURCELINE_NO_MATCHING_LINE = 6;\r
- public static final int SOURCELINE_UNKNOWN_ERROR = 7;\r
- public static final int SOURCELINE_NO_SOURCELINE_DATA = 8;\r
- public static final int SOURCELINE_PIE_BUILD = 9;\r
- public static final int SOURCE_FILE_NOT_FOUND = 10;\r
-\r
- public static final String[] sourcelineErrorMsg = {\r
- AnalyzerLabels.EMPTY_STRING,\r
- AnalyzerLabels.ANALYZER_CONSTANTS_SOURCELINE_NULL_PATH,\r
- AnalyzerLabels.ANALYZER_CONSTANTS_SOURCELINE_NULL_ADDRESS,\r
- AnalyzerLabels.ANALYZER_CONSTANTS_SOURCELINE_FILE_NOT_FOUND,\r
- AnalyzerLabels.ANALYZER_CONSTANTS_SOURCELINE_BAD_ADDRESS,\r
- AnalyzerLabels.ANALYZER_CONSTANTS_SOURCELINE_NO_SYMBOL_INFORMATION,\r
- AnalyzerLabels.ANALYZER_CONSTANTS_SOURCELINE_NO_MATCHING_LINE,\r
- AnalyzerLabels.ANALYZER_CONSTANTS_SOURCELINE_UNKNOWN_ERROR,\r
- AnalyzerLabels.ANALYZER_CONSTANTS_SOURCELINE_NO_SOURCELINE_DATA,\r
- AnalyzerLabels.ANALYZER_CONSTANTS_SOURCELINE_PIE_BUILD,\r
- AnalyzerLabels.ANALYZER_CONSTANTS_SOURCELINE_NOT_FOUND };\r
-\r
- // user call check\r
- public final static String USER_BIN_POS = "/opt/usr/apps/"; //$NON-NLS-1$\r
- public final static int USER_CALL = 2;\r
- public final static int INTERNAL_CALL = 1;\r
- public final static int USER_CALL_CHECK_ERROR = -1;\r
- public final static String VIRTUAL_THUNK = "virtual base override";\r
-\r
- // comparator type\r
- public final static int SORT_TYPE_NONE = 0;\r
- public final static int SORT_TYPE_NUM = 1;\r
- public final static int SORT_TYPE_STRING = 2;\r
- public final static int SORT_TYPE_GRID = 3;\r
-\r
- // function usage profile data type\r
- public final static int FUPD_APPLICATION = 1;\r
- public final static int FUPD_DEPENDENT_LIB = 2;\r
-\r
- public final static String DAEMONLOG_PREFIX = "da_daemon_log_";//$NON-NLS-1$\r
- public final static int DAEMONLOG_COUNT = 3;\r
-\r
- /*** version 3.0 */\r
- public final static int MSG_KEEP_ALIVE = 0x0001;\r
- public final static int MSG_START_SWAP = 0x0002;\r
- public final static int MSG_STOP_SWAP = 0x0003;\r
- public final static int MSG_CONFIG = 0x0004;\r
- public final static int MSG_BINARY_INFO = 0x0005;\r
- public final static int MSG_TARGET_INFO = 0x0007;\r
- public final static int MSG_SWAP_INST_ADD = 0x0008;\r
- public final static int MSG_SWAP_INST_REMOVE = 0x0009;\r
- public final static int MSG_GET_SCREENSHOT = 0x0010;\r
-\r
- public final static int MSG_KEEP_ALIVE_ACK = 0x1001;\r
- public final static int MSG_START_ACK = 0x1002;\r
- public final static int MSG_STOP_ACK = 0x1003;\r
- public final static int MSG_CONFIG_ACK = 0x1004;\r
- public final static int MSG_BINARY_INFO_ACK = 0x1005;\r
- public final static int MSG_TARGET_INFO_ACK = 0x1007;\r
- public final static int MSG_SWAP_INST_ADD_ACK = 0x1008;\r
- public final static int MSG_SWAP_INST_REMOVE_ACK = 0x1009;\r
- public final static int MSG_WAIT_ACK = 0x1010;\r
-\r
- public final static int TYPE_TABLE_CALLSTACK = 0x0001;\r
- public final static int TYPE_TABLE_FAILED = 0x0002;\r
- public final static int TYPE_TABLE_LEAK = 0x0004;\r
- public final static int TYPE_TABLE_WARNING = 0x0008;\r
- public final static int TYPE_TABLE_NORMAL = 0x0010;\r
- public final static int TYPE_TABLE_CALLTRACE = 0x0020;\r
- public final static int TYPE_TABLE_CONTEXTSWITCH = 0x0040;\r
- public final static int TYPE_TABLE_FUNCTIONFRAGMENT = 0x0080;\r
-\r
- public final static String CALLSTACK_KEY_PID = "pid";//$NON-NLS-1$\r
- public final static String CALLSTACK_KEY_ADDR = "address";//$NON-NLS-1$\r
- public final static String CALLSTACK_KEY_TIME = "time";//$NON-NLS-1$\r
- public final static String CALLSTACK_KEY_LIBNAME = "libName";//$NON-NLS-1$\r
- \r
- public final static int SASH_WIDTH = 4;\r
-}\r
+/*
+ * Dynamic Analyzer
+ *
+ * Copyright (c) 2000 - 2011 Samsung Electronics Co., Ltd. All rights reserved.
+ *
+ * Contact:
+ * Jooyoul Lee <jy.exe.lee@samsung.com>
+ * Juyoung Kim <j0.kim@samsung.com>
+ *
+ * Licensed under the Apache License, Version 2.0 (the "License");
+ * you may not use this file except in compliance with the License.
+ * You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ *
+ * Contributors:
+ * - S-Core Co., Ltd
+ *
+ */
+
+package org.tizen.dynamicanalyzer.common;
+
+import org.tizen.dynamicanalyzer.nl.AnalyzerLabels;
+
+public class AnalyzerConstants {
+ // if log change occurs then increase save data version!!
+ public static final String SAVE_DATA_VERSION = "0.88"; //$NON-NLS-1$
+ public static final boolean CHECK_INTERNAL = true;
+
+ public static final String DA_VERSION_SWAP = "3.0";
+ public static final String DA_VERSION_OLD = "2.2";
+
+ /* folder names */
+ public static final String TEMP_FOLDER_RUN_PREFIX = ".RUN"; //$NON-NLS-1$
+ public static final String IMAGE_FOLDER_NAME = "img"; //$NON-NLS-1$
+ public static final String SMALL_IMAGE_FOLDER_NAME = "small"; //$NON-NLS-1$
+ public static final String XML_FOLDER_NAME = "xml"; //$NON-NLS-1$
+ public static final String LICENSE_FILE_NAME = "license"; //$NON-NLS-1$
+ public static final String USER_INTERFACE_API_LIST_FILE_NAME = "user_interface_api_list"; //$NON-NLS-1$
+
+ public static final String API_NAME_FILE_NAME = "apis"; //$NON-NLS-1$
+
+ public static final String READELF_BIN = "readelf"; //$NON-NLS-1$
+
+ public static final String VERSION_NAME = "version"; //$NON-NLS-1$
+ public static final String DATABASE_NAME = "da.trace"; //$NON-NLS-1$
+ public static final String DEFAULT_IMAGE_NAME = "noImage.jpg"; //$NON-NLS-1$
+ public final static String PROBE_LIB_TIZEN = "da_probe_tizen.so"; //$NON-NLS-1$
+ public final static String PROBE_LIB_OSP = "da_probe_osp.so"; //$NON-NLS-1$
+
+ /* Save Data table */
+ public static final String LEAK_DATA_TABLE_NAME = "LeakData"; //$NON-NLS-1$
+ public static final String FAILED_DATA_TABLE_NAME = "FailedData"; //$NON-NLS-1$
+
+ /* thread names */
+ public static final String LOG_QUEUE_OBSERVING_THREAD = "Log Queue Observing thread"; //$NON-NLS-1$
+ public static final String COMMUNICATOR_RECEIVE_THREAD = "Communicator Receive Thread"; //$NON-NLS-1$
+ public static final String MESSAGE_INTERNAL_IMAGE_THREAD = "Internal Image Process Thread"; //$NON-NLS-1$
+ public static final String STOP_LOG_THREAD = "Stop Log Thread"; //$NON-NLS-1$
+ public static final String BATTERY_RECEIVE_THREAD = "Battery Receive Thread"; //$NON-NLS-1$
+ public static final String SLP_APP_RUN_THREAD = "SLP App Run Thread"; //$NON-NLS-1$
+ public static final String OPEN_TRACE_THREAD = "Open trace input thread"; //$NON-NLS-1$
+ public static final String INSERT_LOG_THREAD = "Insert log thread"; //$NON-NLS-1$
+ public static final String IDE_COMMUNICATOR_THREAD = "IDE Communicator thread"; //$NON-NLS-1$
+ public static final String SEND_MESSAGE_THREAD = "Send message thread"; //$NON-NLS-1$
+ public static final String START_STOP_THREAD = "Start stop thread"; //$NON-NLS-1$
+ public static final String FILE_CHART_MANAGER_THREAD = "File Chart Manager thread"; //$NON-NLS-1$
+ public static final String THREAD_CHART_MANAGER_THREAD = "Thread Chart Manager thread"; //$NON-NLS-1$
+ public static final String NETWORK_CHART_MANAGER_THREAD = "Network Chart Manager thread"; //$NON-NLS-1$
+ public static final String KERNEL_CHART_MANAGER_THREAD = "Kernel Chart Manager thread"; //$NON-NLS-1$
+ public static final String FUNCTION_USAGE_PROFILING_THREAD = "Function usage profiling thread"; //$NON-NLS-1$
+ public static final String USER_INTERFACE_PAGE_MANAGER_THREAD = "User Interface Page Managerthread"; //$NON-NLS-1$
+ public static final String SQL_INSERTER_THREAD = "sql_inserter_thread"; //$NON-NLS-1$
+ public static final String HEART_BEAT_THREAD = "heart beat thread"; //$NON-NLS-1$
+
+ /* log parsing token and callstack parsing token, etc... */
+ public static final String CALLSTACK_START = "callstack_start"; //$NON-NLS-1$
+ public static final String CALLSTACK_END = "callstack_end"; //$NON-NLS-1$
+ public static final String CALLSTACK_CUT_MEMORY_TOKEN = "\\["; //$NON-NLS-1$
+ public static final String CALLSTACK_API_TOKEN = "\\("; //$NON-NLS-1$
+ public static final String CALLSTACK_API_TOKEN_STRING = "("; //$NON-NLS-1$
+ public static final String CALLSTACK_API_EMPTY_TOKEN = "\\)"; //$NON-NLS-1$
+ public static final String CALLSTACK_API_OFFSET_TOKEN = "\\+"; //$NON-NLS-1$
+ public static final String CLASS = "class"; //$NON-NLS-1$
+ public static final String DATA_PARSING_TOKEN = "`,"; //$NON-NLS-1$
+
+ /* timer intervals */
+ public static final int SOCKET_CHECK_INTERVAL = 10;
+ public static final int DATA_SOCKET_TIMEOUT = 50000;
+ public static final int CONTROL_SOCKET_TIMEOUT = 10000;
+
+ public static final int SOCKET_FORWARD_INTERVAL = 1000;
+ public static final int LOG_CHECK_INTERVAL = 1000;
+ public static final int SAVE_PREPARE_TIME = 2000;
+ public static final long TIMER_START_TIME_DEFAULT = 1000;
+ public static final int TIMER_INTERVAL_DEFAULT = 1000;
+
+ /* project save index */
+ public static final int PROJECT_VERSION_INDEX = 0;
+ public static final int PROJECT_DEVICE_INDEX = 1;
+ public static final int PROJECT_PACKAGE_ID_INDEX = 2;
+ public static final int PROJECT_APP_NAME_INDEX = 3;
+ public static final int PROJECT_CREATE_TIME_INDEX = 4;
+ public static final int PROJECT_LAST_TIME_INDEX = 5;
+ public static final int PROJECT_STOP_TIME_INDEX = 6;
+ public static final int PROJECT_PROF_START_TIME_INDEX = 7;
+ public static final int PROJECT_LOG_COUNT_INDEX = 8;
+ public static final int PROJECT_SYSTEM_COUNT_INDEX = 9;
+ public static final int PROJECT_PROFILE_COUNT_INDEX = 10;
+ public static final int PROJECT_SAVE_PATH_INDEX = 11;
+ public static final int PROJECT_MAIN_PID_INDEX = 12;
+
+
+ /* save return values */
+ public static final int ERROR_EXTENSION_FAIL = -1;
+ public static final int SUCCESS = 1;
+ public static final int ERROR_SAVE_FAIL = 0;
+ public static final int FAIL = -2;
+
+ /* data size */
+ public static final int INSERT_DATA_PACKAGE_SIZE = 80;
+ public static final int MAX_REPEAT_COUNT = 5;
+
+ /* log parsing size */
+ public static final int DATABASE_READ_SIZE = 100;
+
+ public static final String MSG_START = "100"; //$NON-NLS-1$
+ public static final String MSG_STOP = "101"; //$NON-NLS-1$
+ public static final String MSG_OPTION = "103"; //$NON-NLS-1$
+ public static final String MSG_VERSION = "999"; //$NON-NLS-1$
+ public static final String MSG_OK = "901"; //$NON-NLS-1$
+ public static final String MSG_NOT_OK = "902"; //$NON-NLS-1$
+ public static final String MSG_SCREENSHOT = "103"; //$NON-NLS-1$
+
+ public static final int MSG_RECORD = 801;
+ public static final int MSG_REPLAY = 802;
+
+ public static final long FEATURE_OFF = 0x0000;
+ public static final long FEATURE_ON = 0x1;
+
+ public static final long RESERVED_1 = FEATURE_ON;
+ public static final long RESERVED_2 = FEATURE_ON << 1;
+ public static final long FEATURE_FUNCTION_SAMPLING = 0x80000; // 19
+ public static final long FEATURE_FUNCTION_PROFILING = (RESERVED_1 << 2)|FEATURE_FUNCTION_SAMPLING;
+ public static final long FEATURE_ALLOCATION = FEATURE_ON << 3;//0x0008;
+
+
+
+
+
+ public static final long FEATURE_FILE_API = 0x0010; // 4
+ public static final long FEATURE_THREAD_API = 0x0020; // 5
+ public static final long FEATURE_OSP_UI_API = 0x0040; //6
+ public static final long FEATURE_SCREENSHOT = 0x0080; //7
+ public static final long FEATURE_USER_EVENT = 0x0100; //8
+ public static final long FEATURE_RECORDING = 0x0200; //9
+
+ public static final long FEATURE_SYSCALL_FILE = 0x0400; //10
+ public static final long FEATURE_SYSCALL_IPC = 0x0800; // 11
+ public static final long FEATURE_SYSCALL_PROCESS = 0x1000; //12
+ public static final long FEATURE_SYSCALL_SIGNAL = 0x2000; //13
+ public static final long FEATURE_SYSCALL_NETWORK = 0x4000; //14
+ public static final long FEATURE_SYSCALL_DESC = 0x8000; //15
+
+ public static final long FEATURE_CONTEXT_SWITCHING = 0x10000; //16
+ public static final long FEATURE_NETWORK_API = 0x20000; //17
+ public static final long FEATURE_OPENGL_API = 0x40000; //18
+
+ public static final long SYSTEM_CPU = 0x100000; //20
+ public static final long SYSTEM_PROCESSES = 0x200000; //21
+ public static final long SYSTEM_MEMORY = 0x400000; //22
+ public static final long SYSTEM_DISK = 0x800000; //23
+ public static final long SYSTEM_NETWORK = 0x1000000; //24
+ public static final long SYSTEM_DEVICE = 0x2000000; //25
+ public static final long SYSTEM_RESERVED = 0x8000000; //27
+
+ public static final long SYSTEM_ENERGY = 0x4000000; //26
+
+ public static final long MEMORY_API_PROBING_NO_FILTER = 0x10000000; //28
+ public static final long FILE_API_PROBING_NO_FILTER = 0x20000000; //29
+ public static final long THREAD_API_PROBING_NO_FILTER = 0x40000000; //30
+ public static final long OSP_UI_API_PROBING_NO_FILTER = 0x80000000; //31
+// public static final long NETWORK_API_PROBING_NO_FILTER = FEATURE_ON << 32; // prefeature
+// public static final long OPENGL_API_PROBING_NO_FILTER = FEATURE_ON << 33;// prefeaturen
+ public static final long NETWORK_API_PROBING_NO_FILTER = FEATURE_ON; // prefeature
+ public static final long OPENGL_API_PROBING_NO_FILTER = FEATURE_ON <<1;// prefeaturen
+
+ public static final long SCREENSHOT_PERIODIC = 10;//must modification
+ public static final long SCREENSHOT_PERIODIC_AUTO = 1;//must modification
+ public static final long FUNCTION_PROFILING_SAMPLING_PERIODIC = 10;//must modification
+ public static final long SYSTEM_INFOMATION_SAMPLING_PERIODIC = 1000;//must modification
+
+
+ /* Message Type */
+ public static final int MSG_APP_INFO = 1; //$NON-NLS-1$
+ public static final int MSG_USER_PROFILING_SAMPLE = 3; //$NON-NLS-1$
+ public static final int MSG_DEVICE_LOG = 4; //$NON-NLS-1$
+ public static final int MSG_LOG = 5; //$NON-NLS-1$
+ public static final int MSG_IMAGE = 6; //$NON-NLS-1$
+ public static final int MSG_TERMINATE = 7; //$NON-NLS-1$
+ public static final int MSG_DEBUG = 9; //$NON-NLS-1$
+
+ public static final int SCREENSHOT_OFF = 0;
+ public static final int SCREENSHOT_ON = 1;
+
+ public static final int DAEMON_LISTEN_TRY = 50;
+
+ /* app info */
+ public static final int APP_INFO_SYSTEM_MEMORY_SIZE = 0;
+ public static final int APP_INFO_STORAGE_SIZE = 1;
+ public static final int APP_INFO_BLUETOOTH_SUPPORT = 2;
+ public static final int APP_INFO_GPS_SUPPORT = 3;
+ public static final int APP_INFO_WIFI_SUPPORT = 4;
+ public static final int APP_INFO_CAMERA_COUNT = 5;
+ public static final int APP_INFO_NETWORK_TYPE = 6;
+ public static final int APP_INFO_MAX_BRIGHTNESS = 7;
+ public static final int APP_INFO_WIDTH = 8;
+ public static final int APP_INFO_HEIGHT = 9;
+ public static final int APP_INFO_THEME = 10;
+ public static final int APP_INFO_VERSION = 11;
+ public static final int APP_INFO_SCALE = 12;
+ public static final int APP_INFO_REMOVABLE = 13;
+ public static final int APP_INFO_COMMENT = 14;
+ public static final int APP_INFO_PID = 15;
+ public static final int APP_INFO_START_TIME = 16;
+ public static final int APP_INFO_PIE_BUILD = 17;
+ public static final int APP_INFO_BASE_ADDRESS = 18;
+ public static final int APP_INFO_APP_TYPE = 19;
+ public static final int APP_INFO_BINARY_PATH = 20;
+ public static final int APP_INFO_SIZE = 21;
+
+ /* app type */
+ public static final int APP_TYPE_TIZEN = 1;
+ public static final int APP_TYPE_OSP = 4;
+
+ /* Source Line errors */
+ public static final int SOURCELINE_NOERROR = 0;
+ public static final int SOURCELINE_NULL_PATH = 1;
+ public static final int SOURCELINE_NULL_ADDRESS = 2;
+ public static final int SOURCELINE_FILE_NOT_FOUND = 3;
+ public static final int SOURCELINE_BAD_ADDRESS = 4;
+ public static final int SOURCELINE_NO_SYMBOL_INFORMATION = 5;
+ public static final int SOURCELINE_NO_MATCHING_LINE = 6;
+ public static final int SOURCELINE_UNKNOWN_ERROR = 7;
+ public static final int SOURCELINE_NO_SOURCELINE_DATA = 8;
+ public static final int SOURCELINE_PIE_BUILD = 9;
+ public static final int SOURCE_FILE_NOT_FOUND = 10;
+
+ public static final String[] sourcelineErrorMsg = {
+ AnalyzerLabels.EMPTY_STRING,
+ AnalyzerLabels.ANALYZER_CONSTANTS_SOURCELINE_NULL_PATH,
+ AnalyzerLabels.ANALYZER_CONSTANTS_SOURCELINE_NULL_ADDRESS,
+ AnalyzerLabels.ANALYZER_CONSTANTS_SOURCELINE_FILE_NOT_FOUND,
+ AnalyzerLabels.ANALYZER_CONSTANTS_SOURCELINE_BAD_ADDRESS,
+ AnalyzerLabels.ANALYZER_CONSTANTS_SOURCELINE_NO_SYMBOL_INFORMATION,
+ AnalyzerLabels.ANALYZER_CONSTANTS_SOURCELINE_NO_MATCHING_LINE,
+ AnalyzerLabels.ANALYZER_CONSTANTS_SOURCELINE_UNKNOWN_ERROR,
+ AnalyzerLabels.ANALYZER_CONSTANTS_SOURCELINE_NO_SOURCELINE_DATA,
+ AnalyzerLabels.ANALYZER_CONSTANTS_SOURCELINE_PIE_BUILD,
+ AnalyzerLabels.ANALYZER_CONSTANTS_SOURCELINE_NOT_FOUND };
+
+ // user call check
+ public final static String USER_BIN_POS = "/opt/usr/apps/"; //$NON-NLS-1$
+ public final static int USER_CALL = 2;
+ public final static int INTERNAL_CALL = 1;
+ public final static int USER_CALL_CHECK_ERROR = -1;
+ public final static String VIRTUAL_THUNK = "virtual base override";
+
+ // comparator type
+ public final static int SORT_TYPE_NONE = 0;
+ public final static int SORT_TYPE_NUM = 1;
+ public final static int SORT_TYPE_STRING = 2;
+ public final static int SORT_TYPE_GRID = 3;
+
+ // function usage profile data type
+ public final static int FUPD_APPLICATION = 1;
+ public final static int FUPD_DEPENDENT_LIB = 2;
+
+ public final static String DAEMONLOG_PREFIX = "da_daemon_log_";//$NON-NLS-1$
+ public final static int DAEMONLOG_COUNT = 3;
+
+ /*** version 3.0 */
+ public final static int MSG_KEEP_ALIVE = 0x0001;
+ public final static int MSG_START_SWAP = 0x0002;
+ public final static int MSG_STOP_SWAP = 0x0003;
+ public final static int MSG_CONFIG = 0x0004;
+ public final static int MSG_BINARY_INFO = 0x0005;
+ public final static int MSG_TARGET_INFO = 0x0007;
+ public final static int MSG_SWAP_INST_ADD = 0x0008;
+ public final static int MSG_SWAP_INST_REMOVE = 0x0009;
+ public final static int MSG_GET_SCREENSHOT = 0x0010;
+
+ public final static int MSG_KEEP_ALIVE_ACK = 0x1001;
+ public final static int MSG_START_ACK = 0x1002;
+ public final static int MSG_STOP_ACK = 0x1003;
+ public final static int MSG_CONFIG_ACK = 0x1004;
+ public final static int MSG_BINARY_INFO_ACK = 0x1005;
+ public final static int MSG_TARGET_INFO_ACK = 0x1007;
+ public final static int MSG_SWAP_INST_ADD_ACK = 0x1008;
+ public final static int MSG_SWAP_INST_REMOVE_ACK = 0x1009;
+ public final static int MSG_WAIT_ACK = 0x1010;
+
+ public final static int TYPE_TABLE_CALLSTACK = 0x0001;
+ public final static int TYPE_TABLE_FAILED = 0x0002;
+ public final static int TYPE_TABLE_LEAK = 0x0004;
+ public final static int TYPE_TABLE_WARNING = 0x0008;
+ public final static int TYPE_TABLE_NORMAL = 0x0010;
+ public final static int TYPE_TABLE_CALLTRACE = 0x0020;
+ public final static int TYPE_TABLE_CONTEXTSWITCH = 0x0040;
+ public final static int TYPE_TABLE_FUNCTIONFRAGMENT = 0x0080;
+
+ public final static int CONTEXT_TABLE_RANGE = 0x0001;
+ public final static int CONTEXT_TABLE_SOURCE = 0x0002;
+
+ public final static String CALLSTACK_KEY_PID = "pid";//$NON-NLS-1$
+ public final static String CALLSTACK_KEY_ADDR = "address";//$NON-NLS-1$
+ public final static String CALLSTACK_KEY_TIME = "time";//$NON-NLS-1$
+ public final static String CALLSTACK_KEY_LIBNAME = "libName";//$NON-NLS-1$
+
+ public final static int SASH_WIDTH = 4;
+}
-/*\r
- * Dynamic Analyzer\r
- *\r
- * Copyright (c) 2000 - 2013 Samsung Electronics Co., Ltd. All rights reserved.\r
- *\r
- * Contact: \r
- * Jooyoul Lee <jy.exe.lee@samsung.com>\r
- * Juyoung Kim <j0.kim@samsung.com>\r
- *\r
- * Licensed under the Apache License, Version 2.0 (the "License");\r
- * you may not use this file except in compliance with the License.\r
- * You may obtain a copy of the License at\r
- *\r
- * http://www.apache.org/licenses/LICENSE-2.0\r
- *\r
- * Unless required by applicable law or agreed to in writing, software\r
- * distributed under the License is distributed on an "AS IS" BASIS,\r
- * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\r
- * See the License for the specific language governing permissions and\r
- * limitations under the License.\r
- * \r
- * Contributors:\r
- * - S-Core Co., Ltd\r
- * \r
- */\r
-package org.tizen.dynamicanalyzer.listeners;\r
-\r
-import java.io.BufferedReader;\r
-import java.io.File;\r
-import java.io.FileNotFoundException;\r
-import java.io.FileReader;\r
-import java.io.IOException;\r
-import java.util.List;\r
-\r
-import org.eclipse.nebula.widgets.grid.Grid;\r
-import org.eclipse.nebula.widgets.grid.GridItem;\r
-import org.eclipse.swt.SWT;\r
-import org.eclipse.swt.graphics.Cursor;\r
-import org.eclipse.swt.graphics.Point;\r
-import org.eclipse.swt.graphics.Rectangle;\r
-import org.eclipse.swt.layout.GridLayout;\r
-import org.eclipse.swt.widgets.Display;\r
-import org.eclipse.swt.widgets.Event;\r
-import org.eclipse.swt.widgets.Label;\r
-import org.eclipse.swt.widgets.Listener;\r
-import org.eclipse.swt.widgets.Shell;\r
-import org.tizen.dynamicanalyzer.common.AnalyzerConstants;\r
-import org.tizen.dynamicanalyzer.common.AnalyzerManager;\r
-import org.tizen.dynamicanalyzer.common.SymbolManager;\r
-import org.tizen.dynamicanalyzer.common.SymbolManager.SourceLine;\r
-import org.tizen.dynamicanalyzer.communicator.IDECommunicator;\r
-import org.tizen.dynamicanalyzer.constant.CommonConstants;\r
-import org.tizen.dynamicanalyzer.nl.AnalyzerLabels;\r
-import org.tizen.dynamicanalyzer.resources.ColorResources;\r
-import org.tizen.dynamicanalyzer.resources.FontResources;\r
-import org.tizen.dynamicanalyzer.resources.ImageResources;\r
-import org.tizen.dynamicanalyzer.swap.channel.control.BinaryInfo;\r
-import org.tizen.dynamicanalyzer.swap.channel.data.LibraryObject;\r
-import org.tizen.dynamicanalyzer.swap.channel.data.ProcessInfo;\r
-import org.tizen.dynamicanalyzer.swap.channel.data.ProcessInfoPackage;\r
-import org.tizen.dynamicanalyzer.swap.model.data.LogData;\r
-import org.tizen.dynamicanalyzer.swap.model.data.ProbeCommonData;\r
-import org.tizen.dynamicanalyzer.swap.model.data.ProfileData;\r
-import org.tizen.dynamicanalyzer.swap.model.data.UserFunctionData;\r
-import org.tizen.dynamicanalyzer.swap.platform.BinarySettingData;\r
-import org.tizen.dynamicanalyzer.swap.platform.BinarySettingManager;\r
-import org.tizen.dynamicanalyzer.ui.toolbar.ToolbarArea;\r
-import org.tizen.dynamicanalyzer.ui.widgets.table.DATableDataFormat;\r
-import org.tizen.dynamicanalyzer.util.CommonUtil;\r
-import org.tizen.dynamicanalyzer.util.WorkbenchUtil;\r
-import org.tizen.dynamicanalyzer.widgets.da.base.DADialog;\r
-\r
-public class TableTooltipListener implements Listener {\r
-\r
- private Grid grid = null;\r
- private Shell tooltip;\r
- private Object oldItem;\r
- private boolean enabled = true;\r
-\r
- private static final int MARGIN = 5;\r
- private static final int SPACING = 0;\r
- private static final int SOURCE_LINE_TOP = 5;\r
- private static final int SOURCE_LINE_BOTTOM = 11;\r
- private static final int TOOLTIP_OFFSET = 5;\r
- private static final Cursor sourceCursor = new Cursor(null,\r
- ImageResources.VIEW_SOURCE_CURSOR.getImageData(), 0, 0);\r
- private static Cursor defaultCursor = null;\r
-\r
- public TableTooltipListener(Grid table) {\r
- this.grid = table;\r
- defaultCursor = grid.getCursor();\r
- }\r
-\r
- public void handleEvent(Event event) {\r
- if (!ToolbarArea.getInstance().getSourceViewEnable()) {\r
- return;\r
- }\r
-\r
- int columnHeight = grid.getHeaderHeight();\r
- boolean isHeader = false;\r
- if (event.y < columnHeight) {\r
- isHeader = true;\r
- }\r
-\r
- boolean isToggled = ToolbarArea.getInstance().isSourceViewEnabled();\r
- if (enabled && !isHeader) {\r
- setViewCursor(isToggled);\r
- }\r
-\r
- GridItem gridItem = null;\r
- switch (event.type) {\r
- case SWT.Dispose:\r
- disposeTooltip();\r
- break;\r
- case SWT.KeyDown:\r
- break;\r
- case SWT.KeyUp:\r
- setViewCursor(isToggled);\r
- break;\r
- case SWT.MouseEnter:\r
- grid.setFocus();\r
- if (isToggled && enabled) {\r
- createTooltip(event);\r
- }\r
- break;\r
- case SWT.MouseExit:\r
- disposeTooltip();\r
- break;\r
- case SWT.MouseMove:\r
- gridItem = grid.getItem(new Point(event.x, event.y));\r
- if (null == oldItem) {\r
- oldItem = gridItem;\r
- }\r
- if (null != tooltip) {\r
- if (null != gridItem) {\r
- if (!gridItem.equals((GridItem) oldItem)) {\r
- oldItem = gridItem;\r
- } else {\r
- return;\r
- }\r
- }\r
- tooltip.dispose();\r
- tooltip = null;\r
- }\r
- break;\r
- case SWT.MouseDoubleClick:\r
- if (isToggled && enabled) {\r
- openIDE(event);\r
- }\r
- break;\r
- case SWT.MouseHover:\r
- grid.setFocus();\r
- if (isToggled && enabled) {\r
- createTooltip(event);\r
- }\r
- break;\r
- default:\r
- break;\r
- }\r
- }\r
-\r
- public void setEnable(boolean enabled) {\r
- this.enabled = enabled;\r
- }\r
-\r
- private void setViewCursor(boolean toggled) {\r
- if (!toggled) {\r
- grid.setCursor(defaultCursor);\r
- disposeTooltip();\r
- } else {\r
- grid.setCursor(sourceCursor);\r
- }\r
- }\r
-\r
- private void createErrorPopup(String message) {\r
- Shell shell = WorkbenchUtil.getWorkbenchWindow().getShell();\r
- DADialog warning = new DADialog(shell, SWT.NONE);\r
- warning.setMessage(message);\r
- warning.setIcon(ImageResources.DIALOG_WARNING_ICON);\r
- warning.open();\r
- }\r
-\r
- private void createErrorTooltip(Event event, int errno) {\r
- // Creates tooltip.\r
- Shell shell = WorkbenchUtil.getWorkbenchWindow().getShell();\r
- tooltip = new Shell(shell, SWT.ON_TOP | SWT.NO_FOCUS | SWT.TOOL);\r
- tooltip.setBackground(ColorResources.TOOLTIP);\r
- GridLayout gridLayout = new GridLayout();\r
- gridLayout.marginTop = MARGIN;\r
- gridLayout.marginBottom = MARGIN;\r
- gridLayout.marginLeft = MARGIN;\r
- gridLayout.marginRight = MARGIN;\r
- gridLayout.verticalSpacing = SPACING;\r
- tooltip.setLayout(gridLayout);\r
-\r
- // Creates tooltip title label.\r
- Label title = new Label(tooltip, SWT.NONE);\r
- title.setForeground(ColorResources.BLACK);\r
- title.setBackground(ColorResources.TOOLTIP);\r
- String text = AnalyzerConstants.sourcelineErrorMsg[errno];\r
- title.setText(text);\r
-\r
- tooltipShow(event.x, event.y);\r
- }\r
-\r
- private String getSourcePath(GridItem item, SourceLine sourceLine) {\r
- String filePath = null;\r
- String libName = getLibPath(item);\r
-\r
- BinarySettingData binData = BinarySettingManager.getInstance()\r
- .getRealBinarySetting(libName);\r
-\r
- if (null != binData && null != binData.getUserSourcePath()\r
- && !binData.getUserSourcePath().isEmpty()) {\r
- String fileName = getSourceFilePath(sourceLine.getFilePath());\r
- filePath = binData.getUserSourcePath() + File.separator + fileName;\r
- } else {\r
- if (!isLibrary(libName)) {\r
- filePath = sourceLine.getFilePath();\r
- } else {\r
- filePath = binData.getDebugSourcePath()\r
- + sourceLine.getFilePath();\r
- }\r
- }\r
- return filePath;\r
- }\r
-\r
- private String getSourceFilePath(String sourcePath) {\r
- int index = sourcePath.lastIndexOf("src/");\r
- String filePath = sourcePath.substring(index + 4, sourcePath.length());\r
- return filePath;\r
- }\r
-\r
- private void createTooltip(Event event) {\r
- GridItem item = grid.getItem(new Point(event.x, event.y));\r
- if (null != item) {\r
- disposeTooltip();\r
-\r
- // Gets source path and line.\r
- SourceLine sl = getSourceLine(item);\r
- if (null == sl\r
- || sl.getError() != AnalyzerConstants.SOURCELINE_NOERROR) {\r
- createErrorTooltip(event, sl.getError());\r
- return;\r
- }\r
-\r
- // Creates tooltip.\r
- Shell shell = WorkbenchUtil.getWorkbenchWindow().getShell();\r
- tooltip = new Shell(shell, SWT.ON_TOP | SWT.NO_FOCUS | SWT.TOOL);\r
- tooltip.setBackground(ColorResources.TOOLTIP);\r
- GridLayout gridLayout = new GridLayout();\r
- gridLayout.marginTop = MARGIN;\r
- gridLayout.marginBottom = MARGIN;\r
- gridLayout.marginLeft = MARGIN;\r
- gridLayout.marginRight = MARGIN;\r
- gridLayout.verticalSpacing = SPACING;\r
- tooltip.setLayout(gridLayout);\r
-\r
- // Creates tooltip title label.\r
- Label title = new Label(tooltip, SWT.NONE);\r
- title.setFont(FontResources.TOOLTIP);\r
- title.setForeground(ColorResources.BLACK);\r
- title.setBackground(ColorResources.TOOLTIP);\r
-\r
- // Sets tooltip title text.\r
- String filePath = getSourcePath(item, sl);\r
- int line = sl.getLineNumber();\r
- title.setText(filePath + CommonConstants.SPACE\r
- + CommonConstants.SPACE + CommonConstants.NEW_LINE);\r
-\r
- // Creates tooltip label.\r
- Label top = new Label(tooltip, SWT.NONE);\r
- top.setForeground(ColorResources.BLACK);\r
- top.setBackground(ColorResources.TOOLTIP);\r
-\r
- Label center = new Label(tooltip, SWT.NONE);\r
- center.setForeground(ColorResources.RED);\r
- center.setBackground(ColorResources.TOOLTIP);\r
-\r
- Label bottom = new Label(tooltip, SWT.NONE);\r
- bottom.setForeground(ColorResources.BLACK);\r
- bottom.setBackground(ColorResources.TOOLTIP);\r
-\r
- // Makes tooltip text.\r
- BufferedReader reader = null;\r
- StringBuilder topStr = new StringBuilder(CommonConstants.EMPTY);\r
- StringBuilder centerStr = new StringBuilder(CommonConstants.EMPTY);\r
- StringBuilder bottomStr = new StringBuilder(CommonConstants.EMPTY);\r
- try {\r
- reader = new BufferedReader(new FileReader(filePath));\r
- int topStart = line - SOURCE_LINE_TOP;\r
- if (0 > topStart - 1) {\r
- topStart = 1;\r
- }\r
- int topEnd = line;\r
- int bottomStart = line + 1;\r
- int bottomEnd = line + SOURCE_LINE_BOTTOM;\r
-\r
- for (int i = 0; i < topStart - 1; i++) {\r
- reader.readLine();\r
- }\r
-\r
- String temp = null;\r
- for (int i = topStart; i < topEnd; i++) {\r
- if (null != (temp = reader.readLine())) {\r
- topStr.append(i + CommonConstants.TAB + temp);\r
- } else {\r
- break;\r
- }\r
- if (i != topEnd - 1) {\r
- topStr.append(CommonConstants.NEW_LINE);\r
- }\r
- }\r
-\r
- if (null != (temp = reader.readLine())) {\r
- centerStr.append(line + CommonConstants.TAB + temp);\r
- }\r
-\r
- for (int i = bottomStart; i < bottomEnd; i++) {\r
- if (null != (temp = reader.readLine())) {\r
- bottomStr.append(i + CommonConstants.TAB + temp);\r
- } else {\r
- break;\r
- }\r
- if (i != bottomEnd - 1) {\r
- bottomStr.append(CommonConstants.NEW_LINE);\r
- }\r
- }\r
- } catch (FileNotFoundException e) {\r
- // e.printStackTrace();\r
- createErrorTooltip(event,\r
- AnalyzerConstants.SOURCE_FILE_NOT_FOUND);\r
- } catch (IOException e) {\r
- e.printStackTrace();\r
- } finally {\r
- CommonUtil.tryClose(reader);\r
- }\r
-\r
- // Sets tooltip text.\r
- top.setText(topStr.toString());\r
- center.setText(centerStr.toString());\r
- bottom.setText(bottomStr.toString());\r
-\r
- tooltipShow(event.x, event.y);\r
- }\r
- }\r
-\r
- private void tooltipShow(int x, int y) {\r
- Point size = tooltip.computeSize(SWT.DEFAULT, SWT.DEFAULT);\r
- Point pt = grid.toDisplay(x, y);\r
- Rectangle displayRect = Display.getCurrent().getBounds();\r
- // 1. right side check!\r
- pt.x = ((pt.x + size.x) > displayRect.width) ? pt.x - size.x\r
- - TOOLTIP_OFFSET : pt.x + TOOLTIP_OFFSET;\r
- // 2. bottom check!\r
- pt.y = ((pt.y + size.y) > displayRect.height) ? pt.y - size.y\r
- - TOOLTIP_OFFSET : pt.y + TOOLTIP_OFFSET;\r
- tooltip.setBounds(pt.x, pt.y, size.x, size.y);\r
- tooltip.setVisible(true);\r
- }\r
-\r
- private void disposeTooltip() {\r
- if (null != tooltip && !tooltip.isDisposed()) {\r
- tooltip.dispose();\r
- tooltip = null;\r
- }\r
- }\r
-\r
- private SourceLine getSourceLine(GridItem item) {\r
- // Gets source path and line.\r
- DATableDataFormat tableData = (DATableDataFormat) item.getData();\r
- LogData data = null;\r
- long addr = -1;\r
- // boolean isPieBuild = AnalyzerUtil.isPieBuild(data.getPid());\r
- boolean isPieBuild = true;\r
- int pid = -1;\r
- long time = 0;\r
- String libName = null;\r
-\r
- switch (tableData.getType()) {\r
- case AnalyzerConstants.TYPE_TABLE_CALLSTACK:\r
- addr = (Long) item.getData(AnalyzerConstants.CALLSTACK_KEY_ADDR);\r
- pid = (Integer) item.getData(AnalyzerConstants.CALLSTACK_KEY_PID);\r
- time = (Long) item.getData(AnalyzerConstants.CALLSTACK_KEY_TIME);\r
- libName = (String) item\r
- .getData(AnalyzerConstants.CALLSTACK_KEY_LIBNAME);\r
- break;\r
- case AnalyzerConstants.TYPE_TABLE_FAILED:\r
- List<String> failedData = tableData.getData();\r
- addr = Long.parseLong(failedData.get(8));\r
- pid = Integer.parseInt(failedData.get(7));\r
- time = Long.parseLong(failedData.get(1));\r
- libName = failedData.get(9);\r
- break;\r
- case AnalyzerConstants.TYPE_TABLE_LEAK:\r
- List<String> leakData = tableData.getData();\r
- addr = Long.parseLong(leakData.get(9));\r
- pid = Integer.parseInt(leakData.get(1));\r
- time = Long.parseLong(leakData.get(4));\r
- libName = leakData.get(7);\r
- break;\r
- case AnalyzerConstants.TYPE_TABLE_WARNING:\r
- data = tableData.getLogData();\r
- ProbeCommonData pData = (ProbeCommonData) data;\r
- addr = pData.getCallerPcAddr();\r
- pid = data.getPid();\r
- time = data.getTime();\r
- libName = pData.getLibName();\r
- break;\r
- case AnalyzerConstants.TYPE_TABLE_CALLTRACE:\r
- data = tableData.getLogData();\r
- if (data instanceof UserFunctionData) {\r
- addr = ((UserFunctionData) data).getCallerPcAddr();\r
- libName = ((UserFunctionData) data).getLibName();\r
- } else if (data instanceof ProfileData) {\r
- // addr = ((ProfileData) data).getPcAddr();\r
- // config\r
- addr = ((ProfileData) data).getCallerPcAddr();\r
- libName = ((ProfileData) data).getLibName();\r
- }\r
- pid = data.getPid();\r
- time = data.getTime();\r
- break;\r
- default: // normal\r
- data = tableData.getLogData();\r
- ProbeCommonData wData = (ProbeCommonData) data;\r
- addr = wData.getCallerPcAddr();\r
- pid = data.getPid();\r
- time = data.getTime();\r
- libName = wData.getLibName();\r
- }\r
-\r
- // libName = getLibPath(item);\r
-\r
- ProcessInfoPackage processInfoPkg = AnalyzerManager.getProject()\r
- .getProcessInfo(pid);\r
- ProcessInfo processInfo = processInfoPkg.getProcessInfo(time);\r
- BinaryInfo binInfo = processInfo.getTargetBinary(addr);\r
- if (binInfo == null) {\r
- SourceLine sl = new SourceLine();\r
- sl.setError(AnalyzerConstants.SOURCELINE_NO_SOURCELINE_DATA);\r
- return sl;\r
- }\r
- isPieBuild = (binInfo.getType() == 1) ? true : false;\r
-\r
- // String baseAddr = Long.toString(AnalyzerManager.getProject()\r
- // .getBaseAddress(pid, time));\r
- String baseAddr = null;\r
- String path = null;\r
- // if (libName.equals(processInfo.getMainTargetBinaryPath())) {\r
- if (!isLibrary(libName)) {\r
- baseAddr = Long.toString(processInfo.getLowestAddress());\r
- } else {\r
- LibraryObject libObj = processInfo.getLibObjHash().get(libName);\r
- if (null != libObj) {\r
- baseAddr = Long.toString(libObj.getLowestAddress());\r
- } else {\r
- SourceLine sl = new SourceLine();\r
- sl.setError(AnalyzerConstants.SOURCELINE_NO_SOURCELINE_DATA);\r
- return sl;\r
- }\r
- }\r
-\r
- BinarySettingData binData = BinarySettingManager.getInstance()\r
- .getRealBinarySetting(binInfo.getTargetBinaryPath());\r
- if (null != binData) {\r
- String debugPath = binData.getDebugFilePath();\r
- if (null != debugPath && !debugPath.isEmpty()) {\r
- path = debugPath;\r
- } else {\r
- path = binInfo.getTempBinaryPath();\r
- }\r
- } else {\r
- path = binInfo.getTempBinaryPath();\r
- }\r
- SourceLine sl = SymbolManager.addr2line(path, addr, isPieBuild,\r
- baseAddr);\r
- return sl;\r
- }\r
-\r
- private void openIDE(Event event) {\r
- SourceLine sl = null;\r
- GridItem item = grid.getItem(new Point(event.x, event.y));\r
- if (null == item) {\r
- return;\r
- }\r
- sl = getSourceLine(item);\r
-\r
- if ((null == sl) || (!sl.isValid())\r
- || (IDECommunicator.isConnected() == false)) {\r
- createErrorPopup(AnalyzerLabels.IDE_NOT_LAUNCHED);\r
- return;\r
- }\r
-\r
- String filePath = getSourcePath(item, sl);\r
- int lineNum = sl.getLineNumber();\r
- IDECommunicator.sendCodeInfoToIDE(filePath, Integer.toString(lineNum));\r
- }\r
-\r
- private String getLibPath(GridItem item) {\r
- DATableDataFormat tableData = (DATableDataFormat) item.getData();\r
- String libName = null;\r
- switch (tableData.getType()) {\r
- case AnalyzerConstants.TYPE_TABLE_CALLSTACK:\r
- // addr = (Long) tableData.getObject();\r
- libName = item.getText(2);\r
- break;\r
- case AnalyzerConstants.TYPE_TABLE_FAILED:\r
- List<String> failedData = tableData.getData();\r
- libName = failedData.get(9);\r
- break;\r
- case AnalyzerConstants.TYPE_TABLE_LEAK:\r
- List<String> leakData = tableData.getData();\r
- libName = leakData.get(7);\r
- break;\r
- case AnalyzerConstants.TYPE_TABLE_WARNING:\r
- ProbeCommonData pData = (ProbeCommonData) tableData.getLogData();\r
- libName = pData.getLibName();\r
- break;\r
- case AnalyzerConstants.TYPE_TABLE_CALLTRACE:\r
- LogData data = tableData.getLogData();\r
- if (data instanceof UserFunctionData) {\r
- libName = ((UserFunctionData) data).getLibName();\r
- } else if (data instanceof ProfileData) {\r
- libName = ((ProfileData) data).getLibName();\r
- }\r
- break;\r
- default: // normal\r
- ProbeCommonData wData = (ProbeCommonData) tableData.getLogData();\r
- libName = wData.getLibName();\r
- }\r
- return libName;\r
- }\r
-\r
- private boolean isLibrary(String binaryPath) {\r
- if (binaryPath.contains(".so")) {\r
- return true;\r
- }\r
- return false;\r
- }\r
-}\r
+/*
+ * Dynamic Analyzer
+ *
+ * Copyright (c) 2000 - 2013 Samsung Electronics Co., Ltd. All rights reserved.
+ *
+ * Contact:
+ * Jooyoul Lee <jy.exe.lee@samsung.com>
+ * Juyoung Kim <j0.kim@samsung.com>
+ *
+ * Licensed under the Apache License, Version 2.0 (the "License");
+ * you may not use this file except in compliance with the License.
+ * You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ *
+ * Contributors:
+ * - S-Core Co., Ltd
+ *
+ */
+package org.tizen.dynamicanalyzer.listeners;
+
+import java.io.BufferedReader;
+import java.io.File;
+import java.io.FileNotFoundException;
+import java.io.FileReader;
+import java.io.IOException;
+import java.util.List;
+
+import org.eclipse.nebula.widgets.grid.Grid;
+import org.eclipse.nebula.widgets.grid.GridItem;
+import org.eclipse.swt.SWT;
+import org.eclipse.swt.graphics.Cursor;
+import org.eclipse.swt.graphics.Point;
+import org.eclipse.swt.graphics.Rectangle;
+import org.eclipse.swt.layout.GridLayout;
+import org.eclipse.swt.widgets.Display;
+import org.eclipse.swt.widgets.Event;
+import org.eclipse.swt.widgets.Label;
+import org.eclipse.swt.widgets.Listener;
+import org.eclipse.swt.widgets.Shell;
+import org.tizen.dynamicanalyzer.common.AnalyzerConstants;
+import org.tizen.dynamicanalyzer.common.AnalyzerManager;
+import org.tizen.dynamicanalyzer.common.SymbolManager;
+import org.tizen.dynamicanalyzer.common.SymbolManager.SourceLine;
+import org.tizen.dynamicanalyzer.communicator.IDECommunicator;
+import org.tizen.dynamicanalyzer.constant.CommonConstants;
+import org.tizen.dynamicanalyzer.nl.AnalyzerLabels;
+import org.tizen.dynamicanalyzer.resources.ColorResources;
+import org.tizen.dynamicanalyzer.resources.FontResources;
+import org.tizen.dynamicanalyzer.resources.ImageResources;
+import org.tizen.dynamicanalyzer.swap.channel.control.BinaryInfo;
+import org.tizen.dynamicanalyzer.swap.channel.data.LibraryObject;
+import org.tizen.dynamicanalyzer.swap.channel.data.ProcessInfo;
+import org.tizen.dynamicanalyzer.swap.channel.data.ProcessInfoPackage;
+import org.tizen.dynamicanalyzer.swap.model.data.LogData;
+import org.tizen.dynamicanalyzer.swap.model.data.ProbeCommonData;
+import org.tizen.dynamicanalyzer.swap.model.data.ProfileData;
+import org.tizen.dynamicanalyzer.swap.model.data.UserFunctionData;
+import org.tizen.dynamicanalyzer.swap.platform.BinarySettingData;
+import org.tizen.dynamicanalyzer.swap.platform.BinarySettingManager;
+import org.tizen.dynamicanalyzer.ui.toolbar.ToolbarArea;
+import org.tizen.dynamicanalyzer.ui.widgets.table.DATableDataFormat;
+import org.tizen.dynamicanalyzer.util.CommonUtil;
+import org.tizen.dynamicanalyzer.util.WorkbenchUtil;
+import org.tizen.dynamicanalyzer.widgets.da.base.DADialog;
+
+public class TableTooltipListener implements Listener {
+
+ private Grid grid = null;
+ private GridItem oldItem = null;
+ private Shell tooltip;
+ private boolean enabled = true; /* source view */
+ private boolean onViewSourceFromContext = false;
+
+
+ private static final int MARGIN = 5;
+ private static final int SPACING = 0;
+ private static final int SOURCE_LINE_TOP = 5;
+ private static final int SOURCE_LINE_BOTTOM = 11;
+ private static final int TOOLTIP_OFFSET = 5;
+ private static final Cursor sourceCursor = new Cursor(null,
+ ImageResources.VIEW_SOURCE_CURSOR.getImageData(), 0, 0);
+ private static Cursor defaultCursor = null;
+
+ public TableTooltipListener(Grid table) {
+ this.grid = table;
+ defaultCursor = grid.getCursor();
+ }
+
+ public void handleEvent(Event event) {
+ if (!ToolbarArea.getInstance().getSourceViewEnable()) {
+ return;
+ }
+
+ int columnHeight = grid.getHeaderHeight();
+ boolean isHeader = false;
+ if (event.y < columnHeight) {
+ isHeader = true;
+ }
+
+ boolean isToggled = ToolbarArea.getInstance().isSourceViewEnabled();
+ if (enabled && !isHeader) {
+ setViewCursor(isToggled);
+ }
+
+ switch (event.type) {
+ case SWT.Dispose:
+ disposeTooltip();
+ break;
+ case SWT.KeyDown:
+ break;
+ case SWT.KeyUp:
+ setViewCursor(isToggled);
+ break;
+ case SWT.MouseEnter:
+// grid.setFocus();
+ if (isToggled && enabled && !onViewSourceFromContext) {
+//// createTooltip(event);
+ GridItem item = grid.getItem(new Point(event.x, event.y));
+ SourceLine sl = getCallerSourceLine(item);
+ viewSource(event.x, event.y, sl, false);
+ }
+ break;
+ case SWT.MouseExit:
+ if (!onViewSourceFromContext) {
+ disposeTooltip();
+ }
+ break;
+ case SWT.MouseMove:
+ if (!onViewSourceFromContext) {
+ GridItem gridItem = grid.getItem(new Point(event.x, event.y));
+ if (null == oldItem) {
+ oldItem = gridItem;
+ }
+ if (null != tooltip) {
+ if (null != gridItem) {
+ if (!gridItem.equals((GridItem) oldItem)) {
+ oldItem = gridItem;
+ } else {
+ return;
+ }
+ }
+ tooltip.dispose();
+ tooltip = null;
+ }
+ }
+ break;
+ case SWT.MouseDoubleClick:
+ if (isToggled && enabled) {
+// openIDE(event);
+ GridItem item = grid.getItem(new Point(event.x, event.y));
+ SourceLine sl = getCallerSourceLine(item);
+ openIDE(sl, item);
+ }
+ break;
+ case SWT.MouseHover:
+// grid.setFocus();
+ if (isToggled && enabled && !onViewSourceFromContext) {
+// createTooltip(event);
+ GridItem item = grid.getItem(new Point(event.x, event.y));
+ SourceLine sl = getCallerSourceLine(item);
+ viewSource(event.x, event.y, sl, false);
+ }
+ break;
+ default:
+ break;
+ }
+ }
+
+ public void setEnable(boolean enabled) {
+ this.enabled = enabled;
+ }
+
+ public SourceLine getCallerSourceLine(GridItem item) {
+ if (item == null) {
+ return null;
+ }
+ // Gets source path and line.
+ DATableDataFormat tableData = (DATableDataFormat) item.getData();
+ LogData data = null;
+ long addr = -1;
+ // boolean isPieBuild = AnalyzerUtil.isPieBuild(data.getPid());
+ int pid = -1;
+ long time = 0;
+ String libName = null;
+
+ switch (tableData.getType()) {
+ case AnalyzerConstants.TYPE_TABLE_CALLSTACK:
+ addr = (Long) item.getData(AnalyzerConstants.CALLSTACK_KEY_ADDR);
+ pid = (Integer) item.getData(AnalyzerConstants.CALLSTACK_KEY_PID);
+ time = (Long) item.getData(AnalyzerConstants.CALLSTACK_KEY_TIME);
+ libName = (String) item
+ .getData(AnalyzerConstants.CALLSTACK_KEY_LIBNAME);
+ break;
+ case AnalyzerConstants.TYPE_TABLE_FAILED:
+ List<String> failedData = tableData.getData();
+ addr = Long.parseLong(failedData.get(8));
+ pid = Integer.parseInt(failedData.get(7));
+ time = Long.parseLong(failedData.get(1));
+ libName = failedData.get(9);
+ break;
+ case AnalyzerConstants.TYPE_TABLE_LEAK:
+ List<String> leakData = tableData.getData();
+ addr = Long.parseLong(leakData.get(9));
+ pid = Integer.parseInt(leakData.get(1));
+ time = Long.parseLong(leakData.get(4));
+ libName = leakData.get(7);
+ break;
+ case AnalyzerConstants.TYPE_TABLE_WARNING:
+ data = tableData.getLogData();
+ ProbeCommonData pData = (ProbeCommonData) data;
+ addr = pData.getCallerPcAddr();
+ pid = data.getPid();
+ time = data.getTime();
+ libName = pData.getLibName();
+ break;
+ case AnalyzerConstants.TYPE_TABLE_CALLTRACE:
+ data = tableData.getLogData();
+ if (data instanceof UserFunctionData) {
+ addr = ((UserFunctionData) data).getCallerPcAddr();
+ libName = ((UserFunctionData) data).getLibName();
+ } else if (data instanceof ProfileData) {
+ addr = ((ProfileData) data).getCallerPcAddr();
+ libName = ((ProfileData) data).getLibName();
+ }
+ pid = data.getPid();
+ time = data.getTime();
+ break;
+ default: // normal
+ data = tableData.getLogData();
+ ProbeCommonData wData = (ProbeCommonData) data;
+ addr = wData.getCallerPcAddr();
+ pid = data.getPid();
+ time = data.getTime();
+ libName = wData.getLibName();
+ }
+ return getSourceLine(addr, pid, time, libName);
+ }
+
+ public SourceLine getDefinitionSourceLine(GridItem item) {
+ if (item == null) {
+ return null;
+ }
+ DATableDataFormat tableData = (DATableDataFormat) item.getData();
+ long addr = -1;
+ String libName = null;
+ int pid = -1;
+ long time = 0;
+
+ switch (tableData.getType()) {
+ case AnalyzerConstants.TYPE_TABLE_CALLTRACE:
+ LogData data = tableData.getLogData();
+ if (data instanceof UserFunctionData) {
+ addr = ((UserFunctionData) data).getPcAddr();
+ libName = ((UserFunctionData) data).getLibName();
+ } else if (data instanceof ProfileData) {
+ addr = ((ProfileData) data).getPcAddr();
+ libName = ((ProfileData) data).getLibName();
+ }
+ pid = data.getPid();
+ time = data.getTime();
+ break;
+ default:
+ /*
+ * Do Nothing.
+ */
+ break;
+ }
+ return getSourceLine(addr, pid, time, libName);
+ }
+
+ public void viewSource(int x, int y, SourceLine sl, boolean onViewSourceFromContext) {
+ this.onViewSourceFromContext = onViewSourceFromContext;
+ GridItem item = grid.getItem(new Point(x, y));
+ if (null != item) {
+ disposeTooltip();
+
+ if (null == sl
+ || sl.getError() != AnalyzerConstants.SOURCELINE_NOERROR) {
+ createErrorTooltip(x, y, sl.getError());
+ return;
+ }
+
+ // Creates tooltip.
+ Shell shell = WorkbenchUtil.getWorkbenchWindow().getShell();
+ final Display display = shell.getDisplay();
+ display.addFilter(SWT.FocusOut, new Listener() {
+ @Override
+ public void handleEvent(Event event) {
+ disposeTooltip();
+ display.removeFilter(SWT.FocusOut, this);
+ }
+ });
+ display.addFilter(SWT.MouseDown, new Listener() {
+ @Override
+ public void handleEvent(Event event) {
+ disposeTooltip();
+ display.removeFilter(SWT.MouseDown, this);
+ }
+ });
+ tooltip = new Shell(shell, SWT.ON_TOP | SWT.NO_FOCUS | SWT.TOOL);
+ tooltip.setBackground(ColorResources.TOOLTIP);
+ GridLayout gridLayout = new GridLayout();
+ gridLayout.marginTop = MARGIN;
+ gridLayout.marginBottom = MARGIN;
+ gridLayout.marginLeft = MARGIN;
+ gridLayout.marginRight = MARGIN;
+ gridLayout.verticalSpacing = SPACING;
+ tooltip.setLayout(gridLayout);
+
+ // Creates tooltip title label.
+ Label title = new Label(tooltip, SWT.NONE);
+ title.setFont(FontResources.TOOLTIP);
+ title.setForeground(ColorResources.BLACK);
+ title.setBackground(ColorResources.TOOLTIP);
+
+ // Sets tooltip title text.
+ String filePath = getSourcePath(item, sl);
+ int line = sl.getLineNumber();
+ title.setText(filePath + CommonConstants.SPACE
+ + CommonConstants.SPACE + CommonConstants.NEW_LINE);
+
+ // Creates tooltip label.
+ Label top = new Label(tooltip, SWT.NONE);
+ top.setForeground(ColorResources.BLACK);
+ top.setBackground(ColorResources.TOOLTIP);
+
+ Label center = new Label(tooltip, SWT.NONE);
+ center.setForeground(ColorResources.RED);
+ center.setBackground(ColorResources.TOOLTIP);
+
+ Label bottom = new Label(tooltip, SWT.NONE);
+ bottom.setForeground(ColorResources.BLACK);
+ bottom.setBackground(ColorResources.TOOLTIP);
+
+ // Makes tooltip text.
+ BufferedReader reader = null;
+ StringBuilder topStr = new StringBuilder(CommonConstants.EMPTY);
+ StringBuilder centerStr = new StringBuilder(CommonConstants.EMPTY);
+ StringBuilder bottomStr = new StringBuilder(CommonConstants.EMPTY);
+ try {
+ reader = new BufferedReader(new FileReader(filePath));
+ int topStart = line - SOURCE_LINE_TOP;
+ if (0 > topStart - 1) {
+ topStart = 1;
+ }
+ int topEnd = line;
+ int bottomStart = line + 1;
+ int bottomEnd = line + SOURCE_LINE_BOTTOM;
+
+ for (int i = 0; i < topStart - 1; i++) {
+ reader.readLine();
+ }
+
+ String temp = null;
+ for (int i = topStart; i < topEnd; i++) {
+ if (null != (temp = reader.readLine())) {
+ topStr.append(i + CommonConstants.TAB + temp);
+ } else {
+ break;
+ }
+ if (i != topEnd - 1) {
+ topStr.append(CommonConstants.NEW_LINE);
+ }
+ }
+
+ if (null != (temp = reader.readLine())) {
+ centerStr.append(line + CommonConstants.TAB + temp);
+ }
+
+ for (int i = bottomStart; i < bottomEnd; i++) {
+ if (null != (temp = reader.readLine())) {
+ bottomStr.append(i + CommonConstants.TAB + temp);
+ } else {
+ break;
+ }
+ if (i != bottomEnd - 1) {
+ bottomStr.append(CommonConstants.NEW_LINE);
+ }
+ }
+ } catch (FileNotFoundException e) {
+ // e.printStackTrace();
+ createErrorTooltip(x, y,
+ AnalyzerConstants.SOURCE_FILE_NOT_FOUND);
+ } catch (IOException e) {
+ e.printStackTrace();
+ } finally {
+ CommonUtil.tryClose(reader);
+ }
+
+ // Sets tooltip text.
+ top.setText(topStr.toString());
+ center.setText(centerStr.toString());
+ bottom.setText(bottomStr.toString());
+
+ tooltipShow(x, y);
+ }
+
+ }
+
+ public void openIDE(SourceLine sl, GridItem gridItem) {
+ if (null == gridItem) {
+ return;
+ }
+ if ((null == sl) || (!sl.isValid())
+ || (IDECommunicator.isConnected() == false)) {
+ createErrorPopup(AnalyzerLabels.IDE_NOT_LAUNCHED);
+ return;
+ }
+ String filePath = getSourcePath(gridItem, sl);
+ int lineNum = sl.getLineNumber();
+ IDECommunicator.sendCodeInfoToIDE(filePath, Integer.toString(lineNum));
+ }
+
+ private void setViewCursor(boolean toggled) {
+ if (!toggled) {
+ grid.setCursor(defaultCursor);
+// disposeTooltip();
+ } else {
+ grid.setCursor(sourceCursor);
+ }
+ }
+
+ private void createErrorPopup(String message) {
+ Shell shell = WorkbenchUtil.getWorkbenchWindow().getShell();
+ DADialog warning = new DADialog(shell, SWT.NONE);
+ warning.setMessage(message);
+ warning.setIcon(ImageResources.DIALOG_WARNING_ICON);
+ warning.open();
+ }
+
+ private void createErrorTooltip(int x, int y, int errno) {
+ // Creates tooltip.
+ Shell shell = WorkbenchUtil.getWorkbenchWindow().getShell();
+ tooltip = new Shell(shell, SWT.ON_TOP | SWT.NO_FOCUS | SWT.TOOL);
+ tooltip.setBackground(ColorResources.TOOLTIP);
+ GridLayout gridLayout = new GridLayout();
+ gridLayout.marginTop = MARGIN;
+ gridLayout.marginBottom = MARGIN;
+ gridLayout.marginLeft = MARGIN;
+ gridLayout.marginRight = MARGIN;
+ gridLayout.verticalSpacing = SPACING;
+ tooltip.setLayout(gridLayout);
+
+ // Creates tooltip title label.
+ Label title = new Label(tooltip, SWT.NONE);
+ title.setForeground(ColorResources.BLACK);
+ title.setBackground(ColorResources.TOOLTIP);
+ String text = AnalyzerConstants.sourcelineErrorMsg[errno];
+ title.setText(text);
+
+ tooltipShow(x, y);
+ }
+
+ private String getSourcePath(GridItem item, SourceLine sourceLine) {
+ String filePath = null;
+ String libName = getLibPath(item);
+
+ BinarySettingData binData = BinarySettingManager.getInstance()
+ .getRealBinarySetting(libName);
+
+ if (null != binData && null != binData.getUserSourcePath()
+ && !binData.getUserSourcePath().isEmpty()) {
+ String fileName = getSourceFilePath(sourceLine.getFilePath());
+ filePath = binData.getUserSourcePath() + File.separator + fileName;
+ } else {
+ if (!isLibrary(libName)) {
+ filePath = sourceLine.getFilePath();
+ } else {
+ filePath = binData.getDebugSourcePath()
+ + sourceLine.getFilePath();
+ }
+ }
+ return filePath;
+ }
+
+ private String getSourceFilePath(String sourcePath) {
+ int index = sourcePath.lastIndexOf("src/");
+ String filePath = sourcePath.substring(index + 4, sourcePath.length());
+ return filePath;
+ }
+
+ private void tooltipShow(int x, int y) {
+ Point size = tooltip.computeSize(SWT.DEFAULT, SWT.DEFAULT);
+ Point pt = grid.toDisplay(x, y);
+ Rectangle displayRect = Display.getCurrent().getBounds();
+ // 1. right side check!
+ pt.x = ((pt.x + size.x) > displayRect.width) ? pt.x - size.x
+ - TOOLTIP_OFFSET : pt.x + TOOLTIP_OFFSET;
+ // 2. bottom check!
+ pt.y = ((pt.y + size.y) > displayRect.height) ? pt.y - size.y
+ - TOOLTIP_OFFSET : pt.y + TOOLTIP_OFFSET;
+ tooltip.setBounds(pt.x, pt.y, size.x, size.y);
+ tooltip.setVisible(true);
+ }
+
+ private void disposeTooltip() {
+ if (null != tooltip && !tooltip.isDisposed()) {
+ tooltip.dispose();
+ tooltip = null;
+ onViewSourceFromContext = false;
+ }
+ }
+
+ private String getLibPath(GridItem item) {
+ DATableDataFormat tableData = (DATableDataFormat) item.getData();
+ String libName = null;
+ switch (tableData.getType()) {
+ case AnalyzerConstants.TYPE_TABLE_CALLSTACK:
+ // addr = (Long) tableData.getObject();
+ libName = item.getText(2);
+ break;
+ case AnalyzerConstants.TYPE_TABLE_FAILED:
+ List<String> failedData = tableData.getData();
+ libName = failedData.get(9);
+ break;
+ case AnalyzerConstants.TYPE_TABLE_LEAK:
+ List<String> leakData = tableData.getData();
+ libName = leakData.get(7);
+ break;
+ case AnalyzerConstants.TYPE_TABLE_WARNING:
+ ProbeCommonData pData = (ProbeCommonData) tableData.getLogData();
+ libName = pData.getLibName();
+ break;
+ case AnalyzerConstants.TYPE_TABLE_CALLTRACE:
+ LogData data = tableData.getLogData();
+ if (data instanceof UserFunctionData) {
+ libName = ((UserFunctionData) data).getLibName();
+ } else if (data instanceof ProfileData) {
+ libName = ((ProfileData) data).getLibName();
+ }
+ break;
+ default: // normal
+ ProbeCommonData wData = (ProbeCommonData) tableData.getLogData();
+ libName = wData.getLibName();
+ }
+ return libName;
+ }
+
+ private boolean isLibrary(String binaryPath) {
+ if (binaryPath.contains(".so")) {
+ return true;
+ }
+ return false;
+ }
+
+ private SourceLine getSourceLine(long addr, int pid, long time, String libName) {
+ ProcessInfoPackage processInfoPkg = AnalyzerManager.getProject()
+ .getProcessInfo(pid);
+ ProcessInfo processInfo = processInfoPkg.getProcessInfo(time);
+ BinaryInfo binInfo = processInfo.getTargetBinary(addr);
+ if (binInfo == null) {
+ SourceLine sl = new SourceLine();
+ sl.setError(AnalyzerConstants.SOURCELINE_NO_SOURCELINE_DATA);
+ return sl;
+ }
+ boolean isPieBuild = (binInfo.getType() == 1) ? true : false;
+
+ String baseAddr = null;
+ String path = null;
+ if (!isLibrary(libName)) {
+ baseAddr = Long.toString(processInfo.getLowestAddress());
+ } else {
+ LibraryObject libObj = processInfo.getLibObjHash().get(libName);
+ if (null != libObj) {
+ baseAddr = Long.toString(libObj.getLowestAddress());
+ } else {
+ SourceLine sl = new SourceLine();
+ sl.setError(AnalyzerConstants.SOURCELINE_NO_SOURCELINE_DATA);
+ return sl;
+ }
+ }
+
+ BinarySettingData binData = BinarySettingManager.getInstance()
+ .getRealBinarySetting(binInfo.getTargetBinaryPath());
+ if (null != binData) {
+ String debugPath = binData.getDebugFilePath();
+ if (null != debugPath && !debugPath.isEmpty()) {
+ path = debugPath;
+ } else {
+ path = binInfo.getTempBinaryPath();
+ }
+ } else {
+ path = binInfo.getTempBinaryPath();
+ }
+ SourceLine sl = SymbolManager.addr2line(path, addr, isPieBuild,
+ baseAddr);
+ return sl;
+ }
+}
public KernelListTable(Composite parent, int compStyle, int tableStyle) {
super(parent, compStyle, tableStyle);
setDataType(false, KernelDataMaker.CONTEXT_DATA_COLUMN_INDEX_STARTTIME);
- setRangePopup();
+ setContextMenu(AnalyzerConstants.CONTEXT_TABLE_RANGE);
table.addSelectionListener(new SelectionListener() {
public FailedApiTable(Composite parent, int style, int tableStyle) {
super(parent, style, tableStyle);
- setRangePopup();
+ setContextMenu(AnalyzerConstants.CONTEXT_TABLE_RANGE);
table.addSelectionListener(new SelectionListener() {
@Override
public LeakTable(Composite parent, int compStyle, int tableStyle) {
super(parent, compStyle, tableStyle);
- setRangePopup();
+ setContextMenu(AnalyzerConstants.CONTEXT_TABLE_RANGE);
table.addListener(SWT.Expand, new Listener() {
public WarningTable(Composite parent, int compStyle, int tableStyle) {
super(parent, compStyle, tableStyle);
- setRangePopup();
+ setContextMenu(AnalyzerConstants.CONTEXT_TABLE_RANGE);
table.addSelectionListener(new SelectionListener() {
@Override
public class CallTraceTable extends DAWindowingTableComposite {
public CallTraceTable(Composite parent, int compStyle, int tableStyle) {
super(parent, compStyle, tableStyle);
- setRangePopup();
+ setContextMenu(AnalyzerConstants.CONTEXT_TABLE_SOURCE | AnalyzerConstants.CONTEXT_TABLE_RANGE);
table.addSelectionListener(new SelectionListener() {
import org.eclipse.swt.events.SelectionEvent;
import org.eclipse.swt.events.SelectionListener;
import org.eclipse.swt.widgets.Composite;
+import org.tizen.dynamicanalyzer.common.AnalyzerConstants;
import org.tizen.dynamicanalyzer.common.AnalyzerManager;
import org.tizen.dynamicanalyzer.common.DASelectionData;
import org.tizen.dynamicanalyzer.model.TableInput;
public UISceneListTable(Composite parent, int style, int tableStyle) {
super(parent, style, tableStyle);
- setRangePopup();
+ setContextMenu(AnalyzerConstants.CONTEXT_TABLE_RANGE);
table.addSelectionListener(new SelectionListener() {
@Override
public void widgetSelected(SelectionEvent e) {
public DAApiListTableComposite(Composite parent, int compStyle,
int tableStyle) {
super(parent, compStyle, tableStyle);
- setRangePopup();
+ setContextMenu(AnalyzerConstants.CONTEXT_TABLE_RANGE);
setComparator(new DefaultTableComparator());
comparator.setType(AnalyzerConstants.SORT_TYPE_NUM);
import org.eclipse.swt.widgets.Event;
import org.eclipse.swt.widgets.Listener;
import org.eclipse.swt.widgets.Shell;
+import org.tizen.dynamicanalyzer.common.AnalyzerConstants;
+import org.tizen.dynamicanalyzer.common.SymbolManager.SourceLine;
+import org.tizen.dynamicanalyzer.communicator.IDECommunicator;
import org.tizen.dynamicanalyzer.constant.CommonConstants;
import org.tizen.dynamicanalyzer.listeners.TableTooltipListener;
import org.tizen.dynamicanalyzer.model.FindProperty;
import org.tizen.dynamicanalyzer.model.TableInput;
+import org.tizen.dynamicanalyzer.nl.AnalyzerLabels;
import org.tizen.dynamicanalyzer.nl.TimelineChartLabels;
import org.tizen.dynamicanalyzer.resources.ColorResources;
import org.tizen.dynamicanalyzer.resources.FontResources;
}
}
}
-
- public void setRangePopup() {
- popupMenu = new DAPopupMenu(table);
- popupMenu.setFont(FontResources.CONTEXT_MENU_ITEM_FONT);
- DAPopupMenuItem startItem = new DAPopupMenuItem(popupMenu);
+
+ public void setContextMenu(final int context) {
+ popupMenu = new DAPopupMenu(table);
+ popupMenu.setFont(FontResources.CONTEXT_MENU_ITEM_FONT);
+
+ if ((context & AnalyzerConstants.CONTEXT_TABLE_RANGE) != 0) {
+ setRangeContext();
+ }
+ if ((context & AnalyzerConstants.CONTEXT_TABLE_RANGE) != 0 &&
+ (context & AnalyzerConstants.CONTEXT_TABLE_SOURCE) != 0) {
+ new DAPopupMenuItem(popupMenu, DAPopupMenuItem.SEPARATOR);
+ }
+ if ((context & AnalyzerConstants.CONTEXT_TABLE_SOURCE) != 0) {
+ setSourceContext();
+ }
+ table.addListener(SWT.MouseDown, new Listener() {
+ @Override
+ public void handleEvent(Event event) {
+ // 3 means mouse right button click
+ if (event.button == 3) {
+ List<DAPopupMenuItem> menuItems = popupMenu.getItems();
+ int size = menuItems.size();
+ GridItem item = table.getItem(mousePoint);
+ for (int i = 0; i < size; i++) {
+ DAPopupMenuItem menuItem = menuItems.get(i);
+ if ((menuItem.getType() != DAPopupMenuItem.SEPARATOR)) {
+ setEnableContextMenuItem(menuItem, item);
+ }
+ }
+ }
+ }
+ });
+ }
+
+ private void setEnableContextMenuItem(DAPopupMenuItem menuItem, GridItem gridItem) {
+ if (gridItem == null) {
+ menuItem.setEnabled(false);
+ return; // when gridItem is null, not need to process
+ }
+
+ String text = menuItem.getText(); // TODO need to identity method instead of String
+ if (text.equals(TimelineChartLabels.RANGE_CONTEXT_SET_START)
+ || text.equals(TimelineChartLabels.RANGE_CONTEXT_SET_END)) {
+ if (!menuItem.isEnabled()) {
+ menuItem.setEnabled(true);
+ }
+ } else if (text.equals(TimelineChartLabels.RANGE_CONTEXT_ANALYSIS)) {
+ if (rangeDataManager.isAnalyzable()) {
+ menuItem.setEnabled(true);
+ } else {
+ menuItem.setEnabled(false);
+ }
+ } else if (text.equals(TimelineChartLabels.RANGE_CONTEXT_CLEAR)) {
+ if (rangeDataManager.isBeingAnalyzed()) {
+ menuItem.setEnabled(true);
+ } else {
+ menuItem.setEnabled(false);
+ }
+ } else if (text.equals("View caller source")) {
+ SourceLine sl = tableListener.getCallerSourceLine(gridItem);
+ if (null == sl || sl.getError() != AnalyzerConstants.SOURCELINE_NOERROR) {
+ menuItem.setEnabled(false);
+ } else {
+ menuItem.setEnabled(true);
+ }
+ } else if (text.equals("View declaration source")) {
+ SourceLine sl = tableListener.getDefinitionSourceLine(gridItem);
+ if (null == sl || sl.getError() != AnalyzerConstants.SOURCELINE_NOERROR) {
+ menuItem.setEnabled(false);
+ } else {
+ menuItem.setEnabled(true);
+ }
+ } else if (text.equals("Open caller source")) {
+ SourceLine sl = tableListener.getCallerSourceLine(gridItem);
+ if ((null == sl) || (!sl.isValid())
+ || (IDECommunicator.isConnected() == false)) {
+ menuItem.setEnabled(false);
+ } else {
+ menuItem.setEnabled(true);
+ }
+ } else if (text.equals("Open declaration source")) {
+ SourceLine sl = tableListener.getDefinitionSourceLine(gridItem);
+ if ((null == sl) || (!sl.isValid())
+ || (IDECommunicator.isConnected() == false)) {
+ menuItem.setEnabled(false);
+ } else {
+ menuItem.setEnabled(true);
+ }
+ }
+ }
+
+ private void setSourceContext() {
+ DAPopupMenuItem viewCallerItem = new DAPopupMenuItem(popupMenu);
+ viewCallerItem.setText("View caller source");
+ viewCallerItem.addListener(new DAPopupMenuListener() {
+ @Override
+ public void widgetSelected(DAPopupMenuItem menuItem) {
+ GridItem item = table.getItem(new Point(mousePoint.x, mousePoint.y));
+ SourceLine sl = tableListener.getCallerSourceLine(item);
+ tableListener.viewSource(mousePoint.x, mousePoint.y, sl, true);
+ }
+ });
+
+ DAPopupMenuItem viewDeclarationItem = new DAPopupMenuItem(popupMenu);
+ viewDeclarationItem.setText("View declaration source");
+ viewDeclarationItem.addListener(new DAPopupMenuListener() {
+ @Override
+ public void widgetSelected(DAPopupMenuItem menuItem) {
+ GridItem item = table.getItem(new Point(mousePoint.x, mousePoint.y));
+ SourceLine sl = tableListener.getDefinitionSourceLine(item);
+ tableListener.viewSource(mousePoint.x, mousePoint.y, sl, true);
+ }
+ });
+
+ DAPopupMenuItem openCallerItem = new DAPopupMenuItem(popupMenu);
+ openCallerItem.setText("Open caller source");
+ openCallerItem.addListener(new DAPopupMenuListener() {
+ @Override
+ public void widgetSelected(DAPopupMenuItem menuItem) {
+ GridItem item = table.getItem(new Point(mousePoint.x, mousePoint.y));
+ SourceLine sl = tableListener.getCallerSourceLine(item);
+ tableListener.openIDE(sl, item);
+ }
+ });
+
+ DAPopupMenuItem openDeclarationItem = new DAPopupMenuItem(popupMenu);
+ openDeclarationItem.setText("Open declaration source");
+ openDeclarationItem.addListener(new DAPopupMenuListener() {
+ @Override
+ public void widgetSelected(DAPopupMenuItem menuItem) {
+ GridItem item = table.getItem(new Point(mousePoint.x, mousePoint.y));
+ SourceLine sl = tableListener.getDefinitionSourceLine(item);
+ tableListener.openIDE(sl, item);
+ }
+ });
+ }
+
+ private void setRangeContext() {
+ DAPopupMenuItem startItem = new DAPopupMenuItem(popupMenu);
startItem.setText(TimelineChartLabels.RANGE_CONTEXT_SET_START);
startItem.addListener(new DAPopupMenuListener() {
@Override
rangeDataManager.initRange();
}
});
-
- table.addListener(SWT.MouseDown, new Listener() {
-
- @Override
- public void handleEvent(Event event) {
- // 3 means mouse right button click
- if (event.button == 3) {
- List<DAPopupMenuItem> menuItems = popupMenu.getItems();
- int size = menuItems.size();
- GridItem item = table.getItem(mousePoint);
-
- for (int i = 0; i < size; i++) {
- if (i == 0 || i == 1) {
- if (null != item) {
- if (!menuItems.get(i).isEnabled()) {
- menuItems.get(i).setEnabled(true);
- }
- } else {
- if (menuItems.get(i).isEnabled()) {
- menuItems.get(i).setEnabled(false);
- }
- }
- } else if (i == 2) {
- if (rangeDataManager.isAnalyzable()) {
- menuItems.get(i).setEnabled(true);
- } else {
- menuItems.get(i).setEnabled(false);
- }
- } else if (i == 3) {
- if (rangeDataManager.isBeingAnalyzed()) {
- menuItems.get(i).setEnabled(true);
- } else {
- menuItems.get(i).setEnabled(false);
- }
- }
- }
- }
- }
- });
}
-
+
public void setAutoColumnPackEnabled(boolean enabled) {
autoColumnPack = enabled;
}