IWorkbenchWindowConfigurer configurer = getWindowConfigurer();
configurer.setInitialSize(new Point(width, height));
configurer.setShowStatusLine(false);
- configurer.setShellStyle(SWT.SHELL_TRIM/* | SWT.NO_BACKGROUND */);
+ configurer.setShellStyle(SWT.SHELL_TRIM);
configurer.setShowFastViewBars(false);
}
WelcomeDialog dialog = new WelcomeDialog(shell); // FIXME
dialog.open();
}
+ // for pairing : da log - da daemon log
PathManager.setLogPostFix(WorkbenchUtils.getLogPostFix());
}
+++ /dev/null
-/*
- * 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.workbench;
-
-import java.io.BufferedReader;
-import java.io.File;
-import java.io.FileInputStream;
-import java.io.IOException;
-import java.io.InputStreamReader;
-
-public class WorkbenchPathManager {
-
- public static final String WIN_INSTALL_NODE = "HKEY_CURRENT_USER\\Software\\Microsoft\\Windows\\CurrentVersion\\Explorer\\Shell Folders";//$NON-NLS-1$
- public static final String WIN_INSTALL_KEY = "Local AppData"; //$NON-NLS-1$
-
- public static final String LINUX_INSTALL_ENV = "HOME";//$NON-NLS-1$
- public static final String TIZEN_SDK_DATA = "tizen-sdk-data";//$NON-NLS-1$
- public static final String TIZEN_SDK_DATA_PATH = getTizenSdkDataPath();
- public static final String INSTALL = "tizensdkpath"; //$NON-NLS-1$
- public static final String TIZEN_ROOT_PATH = getDefaultRoot();
- public static final String TOOLS_FOLDER_NAME = "tools"; //$NON-NLS-1$
- public static final String DYNAMIC_ANALYZER_FOLDER_NAME = "dynamic-analyzer"; //$NON-NLS-1$
- public static final String SAVE_FOLDER_NAME = "save"; //$NON-NLS-1$
- public static final String LOG_FOLDER_NAME = "logs"; //$NON-NLS-1$
- public static final String DYNAMIC_ANALYZER_INSTALL_PATH = getInstallPath();
- public static final String CONFIG_FOLDER_NAME = "config"; //$NON-NLS-1$
- public static final String CONFIG_FOLDER_PATH = getConfigFolderPath();
- public static final String CONFIG_FILE_NAME = "config"; //$NON-NLS-1$
-
- public static final String OS_KEY = "os.name"; //$NON-NLS-1$
- public static final String LINUX = "linux"; //$NON-NLS-1$
- public static final String MAC = "mac"; //$NON-NLS-1$
- public static final String WIN = "win"; //$NON-NLS-1$
-
- private static String logPostFix = null;
-
- public static String getLogPostFix() {
- return logPostFix;
- }
-
- public static void setLogPostFix(String postFix) {
- logPostFix = postFix;
- }
-
- public static String getRegistryValue(String node, String key) {
- BufferedReader br = null;
- String value = ""; //$NON-NLS-1$
-
- String query = "reg query " + "\"" + node + "\" /v " + "\"" + key + "\""; //$NON-NLS-1$ //$NON-NLS-2$ //$NON-NLS-3$ //$NON-NLS-4$ //$NON-NLS-5$
- try {
- Process process = Runtime.getRuntime().exec(query);
- String encoding = System.getProperty("sun.jnu.encoding"); //$NON-NLS-1$
-
- br = new BufferedReader(new InputStreamReader(
- process.getInputStream(), encoding));
-
- String line = null;
- while ((line = br.readLine()) != null) {
- int index = line.indexOf("REG_SZ"); //$NON-NLS-1$
- if (index >= 0) {
- value = line.substring(index + "REG_SZ".length()).trim(); //$NON-NLS-1$
- }
- }
- } catch (IOException e) {
- e.printStackTrace();
- } finally {
- if (br != null) {
- try {
- br.close();
- } catch (IOException e) {
- e.printStackTrace();
- }
- }
- }
-
- return value;
- }
-
- public static String getTizenSdkDataPath() {
- String defaultPath = null;
- if (isWin()) {
- defaultPath = getRegistryValue(WIN_INSTALL_NODE, WIN_INSTALL_KEY)
- + File.separator + TIZEN_SDK_DATA;
- } else if (isMac()) {
- defaultPath = System.getenv(LINUX_INSTALL_ENV) + File.separator
- + TIZEN_SDK_DATA;
- } else if (isLinux()) {
- defaultPath = System.getenv(LINUX_INSTALL_ENV) + File.separator
- + TIZEN_SDK_DATA;
- } else {
- System.out.println("Please check OS and install the Tizen SDK"); //$NON-NLS-1$
- System.exit(-1);
- }
- return defaultPath;
- }
-
- public static String getDefaultRoot() {
- String rootPath = null;
- BufferedReader br = null;
- String line = null;
- try {
- rootPath = TIZEN_SDK_DATA_PATH + File.separator + INSTALL;
- File file = new File(rootPath);
- if (!file.isFile()) {
- return null;
- }
- br = new BufferedReader(new InputStreamReader(new FileInputStream(
- file)));
- line = br.readLine();
- return line.substring(line.indexOf("=") + 1); //$NON-NLS-1$
- } catch (IOException e) {
- System.out.println("Fail to read."); //$NON-NLS-1$
- e.printStackTrace();
- } finally {
- if (null != br) {
- try {
- br.close();
- } catch (IOException e) {
- e.printStackTrace();
- }
- }
- }
-
- return rootPath;
- }
-
- public static String getInstallPath() {
- String installPath = TIZEN_ROOT_PATH;
- if (null != installPath) {
- installPath += File.separator + TOOLS_FOLDER_NAME + File.separator
- + DYNAMIC_ANALYZER_FOLDER_NAME;
- }
- return installPath;
- }
-
- public static String getSavePath() {
- String savePath = TIZEN_SDK_DATA_PATH;
- if (null != savePath) {
- savePath += File.separator + DYNAMIC_ANALYZER_FOLDER_NAME
- + File.separator + SAVE_FOLDER_NAME;
- }
- return savePath;
- }
-
- public static String getLogsPath() {
- String savePath = TIZEN_SDK_DATA_PATH + File.separator
- + DYNAMIC_ANALYZER_FOLDER_NAME + File.separator;
- if (null != savePath) {
- savePath += LOG_FOLDER_NAME;
- }
- return savePath;
- }
-
- public static String getSdbPath() {
- String path = TIZEN_ROOT_PATH;
- if (null != path) {
- path += File.separator + "tools" + File.separator + "sdb"; //$NON-NLS-1$ //$NON-NLS-2$
- }
- return path;
- }
-
- public static String getConfigFolderPath() {
- String configFolderPath = DYNAMIC_ANALYZER_INSTALL_PATH;
- if (null != configFolderPath) {
- configFolderPath += File.separator + CONFIG_FOLDER_NAME;
- }
- return configFolderPath;
- }
-
- public static String getConfigFilePath() {
- String configFilePath = CONFIG_FOLDER_PATH;
-
- if (null != configFilePath) {
- configFilePath += File.separator + CONFIG_FILE_NAME;
- }
- return configFilePath;
- }
-
- public static void pathCheck() {
- if (null == TIZEN_ROOT_PATH) {
- System.out.println("Tizen Root Path is null"); //$NON-NLS-1$
- System.exit(-1);
- }
- }
-
- private static String getOS() {
- return System.getProperty(OS_KEY).toLowerCase();
- }
-
- public static boolean isLinux() {
- return getOS().indexOf(LINUX) >= 0;
- }
-
- public static boolean isMac() {
- return getOS().indexOf(MAC) >= 0;
- }
-
- public static boolean isWin() {
- return getOS().indexOf(WIN) >= 0;
- }
-}
</view>
</perspectiveExtension>
</extension>
- <extension
- point="org.eclipse.ui.themes">
- <theme
- id="org.tizen.dynamicanalyzer.theme"
- name="%DynamicAnalyzerTheme">
- <colorOverride
- id="org.eclipse.ui.workbench.ACTIVE_NOFOCUS_TAB_BG_END"
- value="102,102,102">
- </colorOverride>
- <colorOverride
- id="org.eclipse.ui.workbench.ACTIVE_NOFOCUS_TAB_BG_START"
- value="153,153,153">
- </colorOverride>
- <colorOverride
- id="org.eclipse.ui.workbench.ACTIVE_NOFOCUS_TAB_TEXT_COLOR"
- value="255,255,255">
- </colorOverride>
- <colorOverride
- id="org.eclipse.ui.workbench.ACTIVE_TAB_BG_END"
- value="051,051,255">
- </colorOverride>
- <colorOverride
- id="org.eclipse.ui.workbench.ACTIVE_TAB_BG_START"
- value="153,153,255">
- </colorOverride>
- <colorOverride
- id="org.eclipse.ui.workbench.ACTIVE_TAB_TEXT_COLOR"
- value="255,255,255">
- </colorOverride>
- <colorOverride
- id="org.eclipse.ui.workbench.INACTIVE_TAB_BG_END"
- value="102,102,102">
- </colorOverride>
- <colorOverride
- id="org.eclipse.ui.workbench.INACTIVE_TAB_BG_START"
- value="153,153,153">
- </colorOverride>
- <colorOverride
- id="org.eclipse.ui.workbench.INACTIVE_TAB_TEXT_COLOR"
- value="255,255,255">
- </colorOverride>
- </theme>
- </extension>
+
<extension
point="org.eclipse.ui.views">
<view
exit = e;
}
- public static List<String> getProjectList() {
+ public static synchronized List<String> getProjectList() {
if (null == projectList) {
projectList = new ArrayList<String>();
}
import org.eclipse.swt.SWT;\r
import org.eclipse.swt.widgets.Event;\r
import org.eclipse.swt.widgets.Listener;\r
-import org.eclipse.swt.widgets.Shell;\r
import org.eclipse.ui.IPartService;\r
import org.eclipse.ui.IWorkbench;\r
import org.eclipse.ui.IWorkbenchListener;\r
import org.osgi.framework.BundleContext;\r
import org.tizen.dynamicanalyzer.listeners.AnalyzerPartListener;\r
import org.tizen.dynamicanalyzer.listeners.AnalyzerPerspectiveListener;\r
-import org.tizen.dynamicanalyzer.resources.ColorResources;\r
import org.tizen.dynamicanalyzer.shortcut.ShortCutManager;\r
import org.tizen.dynamicanalyzer.sql.SqlManager;\r
import org.tizen.dynamicanalyzer.utils.AnalyzerUtil;\r
\r
public class AnalyzerPlugin extends AbstractUIPlugin {\r
\r
- private static final String THEME_ID = "org.tizen.dynamicanalyzer.theme"; //$NON-NLS-1$\r
private static AnalyzerPlugin plugin;\r
\r
public static AnalyzerPlugin getDefault() {\r
workbench.addWorkbenchListener(new IWorkbenchListener() {\r
@Override\r
public void postShutdown(IWorkbench workbench) {\r
+ // for manage temp projects\r
List<String> tempProjects = AnalyzerManager.getProjectList();\r
int size = tempProjects.size();\r
for (int i = 0; i < size; i++) {\r
IWorkbenchWindow window = workbench.getActiveWorkbenchWindow();\r
window.addPerspectiveListener(new AnalyzerPerspectiveListener());\r
\r
- // Sets theme and color.\r
- workbench.getThemeManager().setCurrentTheme(THEME_ID);\r
- Shell shell = window.getShell();\r
- shell.setBackgroundMode(SWT.INHERIT_FORCE);\r
- shell.setBackground(ColorResources.WINDOW_BG_COLOR);\r
-\r
File saveFolder = new File(AnalyzerPaths.TEMP_FOLDER_PATH);\r
if (saveFolder.exists()) {\r
if (AnalyzerUtil.deleteFile(saveFolder)) {\r
import org.tizen.dynamicanalyzer.swap.channel.control.ReplayEvent;
import org.tizen.dynamicanalyzer.ui.file.FileChartManager;
import org.tizen.dynamicanalyzer.ui.network.NetworkChartManager;
+import org.tizen.dynamicanalyzer.ui.page.UpdateViewTimer;
import org.tizen.dynamicanalyzer.ui.summary.profiling.FunctionUsageProfiler;
import org.tizen.dynamicanalyzer.ui.thread.ThreadChartManager;
import org.tizen.dynamicanalyzer.ui.toolbar.ConfigureManager;
import org.tizen.dynamicanalyzer.ui.userinterface.UIDataManager;
import org.tizen.dynamicanalyzer.uirecorder.UIRecorderTool;
import org.tizen.dynamicanalyzer.utils.AnalyzerUtil;
-import org.tizen.dynamicanalyzer.utils.UpdateViewTimer;
public class Communicator22 extends BaseCommunicator {
import static org.tizen.sdblib.util.DeviceUtil.isOnline;
import static org.tizen.sdblib.util.IOUtil.tryClose;
+import java.io.BufferedReader;
import java.io.File;
+import java.io.FileInputStream;
+import java.io.FileNotFoundException;
import java.io.FileOutputStream;
import java.io.IOException;
+import java.io.InputStreamReader;
import java.util.ArrayList;
import java.util.List;
}
return null;
}
+
+ public static List<String> getApiMap(IDevice device) {
+ String apiFilePath = AnalyzerPaths.TEMP_FOLDER_PATH + File.separator
+ + device.getSerialNumber() + CommonConstants.UNDERBAR
+ + AnalyzerConstants.API_NAME_FILE_NAME;
+ try {
+ device.setRootUser(true);
+ } catch (TimeoutException e) {
+ e.printStackTrace();
+ } catch (SdbCommandRejectedException e) {
+ e.printStackTrace();
+ } catch (IOException e) {
+ e.printStackTrace();
+ }
+
+ SyncResult res = CommunicatorUtils.pull(device,
+ AnalyzerPaths.DA_API_MAP_PATH, apiFilePath);
+ if (null != res && res.isOk()) {
+ System.out.println("api map copying success!!");//$NON-NLS-1$
+ } else {
+ System.out.println("Failed to get " + apiFilePath); //$NON-NLS-1$
+ return null;
+ }
+
+ List<String> apiMap = new ArrayList<String>();
+ apiMap.add("unknown");
+
+ File file = new File(apiFilePath);
+ if (!file.exists()) {
+ System.out.println("file open failed...");
+ return null;
+ }
+ try {
+ FileInputStream fis = new FileInputStream(file);
+ InputStreamReader isr = new InputStreamReader(fis);
+ BufferedReader reader = new BufferedReader(isr);
+
+ String input = null;
+ while (null != (input = reader.readLine())) {
+ String[] splitLine = input.trim().split(CommonConstants.SPACE,
+ 2);
+ apiMap.add(new String(splitLine[1]));
+ }
+
+ } catch (FileNotFoundException e) {
+ e.printStackTrace();
+ return null;
+ } catch (IOException e) {
+ e.printStackTrace();
+ return null;
+ } catch (ArrayIndexOutOfBoundsException e) {
+ e.printStackTrace();
+ }
+ return apiMap;
+ }
}
import org.tizen.dynamicanalyzer.logparser.LogInserter;
import org.tizen.dynamicanalyzer.sql.SqlManager;
import org.tizen.dynamicanalyzer.ui.page.BaseView;
+import org.tizen.dynamicanalyzer.ui.page.UpdateViewTimer;
import org.tizen.dynamicanalyzer.ui.toolbar.StopLogProcessor;
import org.tizen.dynamicanalyzer.ui.toolbar.ToolbarArea;
import org.tizen.dynamicanalyzer.utils.AnalyzerUtil;
-import org.tizen.dynamicanalyzer.utils.UpdateViewTimer;
public class ClearHandler extends AbstractHandler {
import org.tizen.dynamicanalyzer.communicator.IDECommunicator;
import org.tizen.dynamicanalyzer.logparser.LogInserter;
import org.tizen.dynamicanalyzer.swap.logparser.SWAPLogParser;
+import org.tizen.dynamicanalyzer.ui.page.UpdateViewTimer;
import org.tizen.dynamicanalyzer.ui.toolbar.StopLogProcessor;
import org.tizen.dynamicanalyzer.ui.toolbar.ToolbarArea;
import org.tizen.dynamicanalyzer.ui.toolbar.opentrace.OpenTraceInputReader;
-import org.tizen.dynamicanalyzer.utils.UpdateViewTimer;
public class ExitHandler extends AbstractHandler {
appInfoHash = new HashMap<String, AppInfo>();
pkgInfoHash = new HashMap<String, PackageInfo>();
targetInfo = new TargetInfo();
- apiList = AnalyzerUtil.getApiMap(device);
+ apiList = CommunicatorUtils.getApiMap(device);
}
public void setSelectedAppName(String name) {
import org.tizen.dynamicanalyzer.common.AnalyzerConstants;
import org.tizen.dynamicanalyzer.common.AnalyzerManager;
import org.tizen.dynamicanalyzer.common.SymbolManager;
+import org.tizen.dynamicanalyzer.communicator.DACommunicator;
import org.tizen.dynamicanalyzer.logparser.LogCenterConstants;
+import org.tizen.dynamicanalyzer.swap.channel.control.BinaryInfo;
+import org.tizen.dynamicanalyzer.swap.channel.data.ProcessInfo;
+import org.tizen.dynamicanalyzer.swap.channel.data.ProcessInfoPackage;
import org.tizen.dynamicanalyzer.swap.logparser.SWAPLogParser;
import org.tizen.dynamicanalyzer.swap.model.data.LogData;
import org.tizen.dynamicanalyzer.swap.model.data.ProbeCommonData;
ProfileData log = (ProfileData) input;
int pid = log.getPid();
long time = log.getTime();
-
+
HashMap<Long, CallStackUnit> addrMap = getCallStackApiAddrByPidMap(pid);
boolean isPieBuild = AnalyzerUtil.isPieBuild(pid, time);
String baseAddr = Long.toString(AnalyzerManager.getProject()
long selfAddr = log.getPcAddr();
long callerAddr = log.getCallerPcAddr();
-
+
String strSelfAddr = Long.toString(selfAddr);
- String strCallerAddr = Long.toString(callerAddr);
+ String strCallerAddr = Long.toString(callerAddr);
CallStackData callstackData = new CallStackData(seq);
CallStackUnit selfCallstackUnit = addrMap.get(selfAddr);
List<CallStackItem> userCallstack = getUserCallstack(tid);
int size = userCallstack.size();
TreeMap<Long, Integer> seqByTimeMap = getSeqTimeByTidMap(tid);
-
+
CallStackUnit callerCallstackUnit = addrMap.get(callerAddr);
if (null == callerCallstackUnit) {
String strCallerFuncName = SymbolManager.addr2func(sourceBinPath,
if (size == 0) {
userCallstack.add(new CallStackItem(selfCallstackUnit, time));
} else {
- if (!AnalyzerUtil.isAddrInBinaryRange(pid, time, callerAddr)) {
+ if (!isAddrInBinaryRange(pid, time, callerAddr)) {
CallStackUnit callbackApi = new CallStackUnit(
LogCenterConstants.USER_FUNCTION_CALLBACK_FUNC_ADDR,
LogCenterConstants.USER_FUNCTION_CALLBACK_FUNC_SYMBOL,
LogCenterConstants.USER_FUNCTION_CALLBACK_FUNC_ADDR,
defaultCallstackUnit);
}
-// } else if (callerCallstackUnit.getFunctionName().contains(
-// AnalyzerConstants.VIRTUAL_THUNK)) {
-// CallStackUnit callbackApi = new CallStackUnit(
-// LogCenterConstants.USER_FUNCTION_CALLBACK_FUNC_ADDR,
-// LogCenterConstants.USER_FUNCTION_CALLBACK_FUNC_SYMBOL,
-// log);
-// userCallstack.add(new CallStackItem(callbackApi));
-// if (addrMap
-// .get(LogCenterConstants.USER_FUNCTION_CALLBACK_FUNC_ADDR) == null) {
-// CallStackUnit defaultCallstackUnit = new CallStackUnit(
-// LogCenterConstants.USER_FUNCTION_CALLBACK_FUNC_ADDR,
-// LogCenterConstants.USER_FUNCTION_CALLBACK_FUNC_SYMBOL,
-// log);
-// addrMap.put(
-// LogCenterConstants.USER_FUNCTION_CALLBACK_FUNC_ADDR,
-// defaultCallstackUnit);
-// }
-// userCallstack.add(new CallStackItem(callerCallstackUnit));
+ // } else if
+ // (callerCallstackUnit.getFunctionName().contains(
+ // AnalyzerConstants.VIRTUAL_THUNK)) {
+ // CallStackUnit callbackApi = new CallStackUnit(
+ // LogCenterConstants.USER_FUNCTION_CALLBACK_FUNC_ADDR,
+ // LogCenterConstants.USER_FUNCTION_CALLBACK_FUNC_SYMBOL,
+ // log);
+ // userCallstack.add(new CallStackItem(callbackApi));
+ // if (addrMap
+ // .get(LogCenterConstants.USER_FUNCTION_CALLBACK_FUNC_ADDR)
+ // == null) {
+ // CallStackUnit defaultCallstackUnit = new CallStackUnit(
+ // LogCenterConstants.USER_FUNCTION_CALLBACK_FUNC_ADDR,
+ // LogCenterConstants.USER_FUNCTION_CALLBACK_FUNC_SYMBOL,
+ // log);
+ // addrMap.put(
+ // LogCenterConstants.USER_FUNCTION_CALLBACK_FUNC_ADDR,
+ // defaultCallstackUnit);
+ // }
+ // userCallstack.add(new
+ // CallStackItem(callerCallstackUnit));
} else {
CallStackUnit callerCsa = addrMap.get(callerAddr);
if (null == callerCsa) {
- callerCsa = userCallstack.get(size - 1).getCallStackUnit();
+ callerCsa = userCallstack.get(size - 1)
+ .getCallStackUnit();
callerCsa.setFunctionStartAddr(callerCsa.getAddr());
callerCsa.setAddr(callerAddr);
} else {
- CallStackItem topCallstackItem = userCallstack.get(
- size - 1);
- callerCsa.setFunctionStartAddr(topCallstackItem.getCallStackUnit().getAddr());
- userCallstack.set(size - 1, new CallStackItem(callerCsa, topCallstackItem.getStartTime()));
+ CallStackItem topCallstackItem = userCallstack
+ .get(size - 1);
+ callerCsa.setFunctionStartAddr(topCallstackItem
+ .getCallStackUnit().getAddr());
+ userCallstack.set(size - 1, new CallStackItem(
+ callerCsa, topCallstackItem.getStartTime()));
}
}
userCallstack.add(new CallStackItem(selfCallstackUnit, time));
}
size = userCallstack.size();
for (int i = size - 1; i >= 0; i--) {
- callstackData.getAddrs().add(userCallstack.get(i).getCallStackUnit().getAddr());
+ callstackData.getAddrs().add(
+ userCallstack.get(i).getCallStackUnit().getAddr());
}
getCallStackDataBySeqMap().put(seq, callstackData);
- seqByTimeMap.put(time, seq);
+ seqByTimeMap.put(time, seq);
} else if (eventType == MSG_FUNCTION_EXIT) {
if (size == 0) {
// this case only range profiling, other time is bug
return;
}
- CallStackUnit removeCallStackUnit = userCallstack.get(size - 1).getCallStackUnit();
+ CallStackUnit removeCallStackUnit = userCallstack.get(size - 1)
+ .getCallStackUnit();
if (selfCallstackUnit.getFunctionName().equals(
removeCallStackUnit.getFunctionName())) {
userCallstack.remove(size - 1);
-// if (size - 2 > 0) {
-// if (callerCallstackUnit.getFunctionName().contains(
-// AnalyzerConstants.VIRTUAL_THUNK)) {
-// if (callerCallstackUnit.getFunctionName().equals(
-// userCallstack.get(size - 2).getCallStackUnit().getFunctionName())) {
-// userCallstack.remove(size - 2);
-// } else {
-// System.out
-// .println("makeUserCallstack : [virtual thunk] EXIT caller is not the same"
-// + "as top of user callstack after remove EXIT self");
-// }
-// }
-// }
+ // if (size - 2 > 0) {
+ // if (callerCallstackUnit.getFunctionName().contains(
+ // AnalyzerConstants.VIRTUAL_THUNK)) {
+ // if (callerCallstackUnit.getFunctionName().equals(
+ // userCallstack.get(size -
+ // 2).getCallStackUnit().getFunctionName())) {
+ // userCallstack.remove(size - 2);
+ // } else {
+ // System.out
+ // .println("makeUserCallstack : [virtual thunk] EXIT caller is not the same"
+ // + "as top of user callstack after remove EXIT self");
+ // }
+ // }
+ // }
size = userCallstack.size();
if (size - 1 > 0) {
- CallStackUnit checkCallStackUnit = userCallstack
- .get(size - 1).getCallStackUnit();
+ CallStackUnit checkCallStackUnit = userCallstack.get(
+ size - 1).getCallStackUnit();
if (checkCallStackUnit.getFunctionName().equals(
LogCenterConstants.USER_FUNCTION_CALLBACK_FUNC)) {
userCallstack.remove(size - 1);
.getFunctionStartAddr();
CallStackUnit callerCsa = addrMap.get(prevSelfAddr);
if (null == callerCsa) {
- prevCallstackItem.getCallStackUnit().setAddr(prevSelfAddr);
+ prevCallstackItem.getCallStackUnit().setAddr(
+ prevSelfAddr);
} else {
- userCallstack.set(size - 1, new CallStackItem(callerCsa, prevCallstackItem.getStartTime()));
+ userCallstack.set(size - 1, new CallStackItem(
+ callerCsa, prevCallstackItem.getStartTime()));
}
}
for (int i = size - 1; i >= 0; i--) {
- callstackData.getAddrs().add(userCallstack.get(i).getCallStackUnit().getAddr());
+ callstackData.getAddrs().add(
+ userCallstack.get(i).getCallStackUnit().getAddr());
}
getCallStackDataBySeqMap().put(seq, callstackData);
- seqByTimeMap.put(time, seq);
+ seqByTimeMap.put(time, seq);
} else {
System.out
.println("makeUserCallstack : EXIT self is not the same as top of user callstack");
}
if (AnalyzerManager.isOsp()) {
- // String apiName = input[LogCenterConstants.APINAME_INDEX];
+ // String apiName = input[LogCenterConstants.APINAME_INDEX];
String apiName = log.getApiName();
if (apiName.equals("OspMain")) { //$NON-NLS-1$
SWAPLogParser.setDropCallTraceLog(true);
pData = (ProfileData) inputData;
isProfileData = true;
} else {
- log = (ProbeCommonData) inputData;
+ log = (ProbeCommonData) inputData;
}
-
- HashMap<Long, CallStackUnit> addrMap = getCallStackApiAddrByPidMap(inputData.getPid());
+
+ HashMap<Long, CallStackUnit> addrMap = getCallStackApiAddrByPidMap(inputData
+ .getPid());
int pid;
long time;
boolean isPieBuild;
String baseAddr, sourceBinPath;
- if(isProfileData) {
+ if (isProfileData) {
pid = pData.getPid();
time = pData.getTime();
- isPieBuild = AnalyzerUtil.isPieBuild(pid, time);
+ isPieBuild = isPieBuild(pid, time);
baseAddr = Long.toString(AnalyzerManager.getProject()
.getBaseAddress(pid, time));
sourceBinPath = AnalyzerUtil.getBinarySourcePath(pid, time);
} else {
pid = log.getPid();
- time = log.getTime();
- isPieBuild = AnalyzerUtil.isPieBuild(pid, time);
+ time = log.getTime();
+ isPieBuild = isPieBuild(pid, time);
baseAddr = Long.toString(AnalyzerManager.getProject()
.getBaseAddress(pid, time));
sourceBinPath = AnalyzerUtil.getBinarySourcePath(pid, time);
int seq = inputData.getSeq();
int tid;
long callerAddr;
- if(isProfileData) {
+ if (isProfileData) {
tid = pData.getTid();
- callerAddr = pData.getCallerPcAddr();
+ callerAddr = pData.getCallerPcAddr();
} else {
tid = log.getTid();
- callerAddr = log.getCallerPcAddr();
+ callerAddr = log.getCallerPcAddr();
}
// if (!strCallerAddr.isEmpty()) {
CallStackData callstackData = new CallStackData(seq);
- if ((size == 0) ||
- (!AnalyzerUtil.isAddrInBinaryRange(pid, time, callerAddr))) {
+ if ((size == 0) || (!isAddrInBinaryRange(pid, time, callerAddr))) {
CallStackUnit callbackApi = new CallStackUnit(
LogCenterConstants.USER_FUNCTION_CALLBACK_FUNC_ADDR,
- LogCenterConstants.USER_FUNCTION_CALLBACK_FUNC_SYMBOL, inputData);
+ LogCenterConstants.USER_FUNCTION_CALLBACK_FUNC_SYMBOL,
+ inputData);
probeCallstack.add(new CallStackItem(callbackApi));
if (addrMap
.get(LogCenterConstants.USER_FUNCTION_CALLBACK_FUNC_ADDR) == null) {
} else {
CallStackUnit callerCallstackUnit = addrMap.get(callerAddr);
if (null == callerCallstackUnit) {
- String strCallerFuncName = SymbolManager.addr2func(sourceBinPath,
- strCallerAddr, isPieBuild, baseAddr);
+ String strCallerFuncName = SymbolManager.addr2func(
+ sourceBinPath, strCallerAddr, isPieBuild, baseAddr);
String strCallerSymbol = getUserFunctionPosition(pid, time)
+ AnalyzerConstants.CALLSTACK_API_TOKEN_STRING
+ strCallerFuncName;
addrMap.put(callerAddr, callerCallstackUnit);
}
- CallStackUnit topUserCallstack = probeCallstack.get(size - 1).getCallStackUnit();
+ CallStackUnit topUserCallstack = probeCallstack.get(size - 1)
+ .getCallStackUnit();
if (callerCallstackUnit.getFunctionName().equals(
topUserCallstack.getFunctionName())) {
- probeCallstack.set(size - 1, new CallStackItem(callerCallstackUnit));
+ probeCallstack.set(size - 1, new CallStackItem(
+ callerCallstackUnit));
} else {
System.out
.println("bug : probe caller is not the same as top of user callstack"); //$NON-NLS-1$
size = probeCallstack.size();
for (int i = size - 1; i >= 0; i--) {
- callstackData.getAddrs().add(probeCallstack.get(i).getCallStackUnit().getAddr());
+ callstackData.getAddrs().add(
+ probeCallstack.get(i).getCallStackUnit().getAddr());
}
getCallStackDataBySeqMap().put(seq, callstackData);
// check irregular enter/exit log (multiple logs from 1 function call)
public boolean isIrregularUserCall(LogData log) {
ProfileData input = (ProfileData) log;
- HashMap<Long, CallStackUnit> addrMap = getCallStackApiAddrByPidMap(input.getPid());
+ HashMap<Long, CallStackUnit> addrMap = getCallStackApiAddrByPidMap(input
+ .getPid());
HashMap<Integer, DuplicateUserCall> dupUserCallMap = getDupUserCallByTidMap();
- boolean isPieBuild = AnalyzerUtil.isPieBuild(input.getPid(),
+ boolean isPieBuild = isPieBuild(input.getPid(),
input.getTime());
String baseAddr = Long.toString(AnalyzerManager.getProject()
.getBaseAddress(input.getPid(), log.getTime()));
if (null == selfCallstackUnit) {
String strSelfFuncName = SymbolManager.addr2func(sourceBinPath,
strSelfAddr, isPieBuild, baseAddr);
- String strSelfSymbol = getUserFunctionPosition(
- input.getPid(), input.getTime())
+ String strSelfSymbol = getUserFunctionPosition(input.getPid(),
+ input.getTime())
+ AnalyzerConstants.CALLSTACK_API_TOKEN_STRING
+ strSelfFuncName;
selfCallstackUnit = new CallStackUnit(selfAddr, strSelfSymbol, log);
int eventType = input.getId();
if (size > 0) {
if (eventType == MSG_FUNCTION_ENTRY) {
- CallStackUnit topCallstackUnit = userCallstack.get(size - 1).getCallStackUnit();
+ CallStackUnit topCallstackUnit = userCallstack.get(size - 1)
+ .getCallStackUnit();
if (topCallstackUnit.equals(selfCallstackUnit)) {
DuplicateUserCall dupUserCall = dupUserCallMap.get(tid);
if (null == dupUserCall) {
seqTimeByTidMap.clear();
}
+ public boolean isAddrInBinaryRange(int pid, long time, long addr) {
+ ProcessInfoPackage processInfoPkg = AnalyzerManager.getProject()
+ .getProcessInfo(pid);
+ ProcessInfo processInfo = processInfoPkg.getProcessInfo(time);
+ if (null == processInfo) {
+ return false;
+ }
+
+ if (addr >= processInfo.getLowestAddress()
+ && addr <= processInfo.getHighestAddress()) {
+ return true;
+ } else {
+ return false;
+ }
+ }
+
+ public boolean isPieBuild(int pid, long time) {
+ ProcessInfoPackage processInfoPkg = AnalyzerManager.getProject()
+ .getProcessInfo(pid);
+ ProcessInfo processInfo = processInfoPkg.getProcessInfo(time);
+ if (null == processInfo) {
+ return false;
+ }
+
+ String path = processInfo.getMainTargetBinaryPath();
+ String key = AnalyzerUtil.getTargetPathKey(path);
+ BinaryInfo binInfo = DACommunicator.getSelectedApp().getBinaryInfo(key);
+ if (null == binInfo) {
+ return false;
+ }
+ if (binInfo.getType() == 1) {
+ return true;
+ }
+ return false;
+ }
}
import org.tizen.dynamicanalyzer.ui.info.snapshot.SocketClient;
import org.tizen.dynamicanalyzer.ui.kernel.data.KernelDataManager;
import org.tizen.dynamicanalyzer.ui.network.NetworkChartManager;
+import org.tizen.dynamicanalyzer.ui.page.UpdateViewTimer;
import org.tizen.dynamicanalyzer.ui.summary.profiling.FunctionUsageProfiler;
import org.tizen.dynamicanalyzer.ui.thread.ThreadChartManager;
import org.tizen.dynamicanalyzer.ui.toolbar.ConfigureManager;
import org.tizen.dynamicanalyzer.ui.widgets.DADialog;
import org.tizen.dynamicanalyzer.uirecorder.UIRecorderTool;
import org.tizen.dynamicanalyzer.utils.AnalyzerUtil;
-import org.tizen.dynamicanalyzer.utils.UpdateViewTimer;
import org.tizen.sdblib.exception.SdbCommandRejectedException;
import org.tizen.sdblib.exception.TimeoutException;
import org.tizen.sdblib.service.SyncResult;
package org.tizen.dynamicanalyzer.swap.logparser;
import java.io.File;
+import java.util.ArrayList;
+import java.util.HashMap;
import java.util.List;
import org.tizen.dynamicanalyzer.common.AnalyzerConstants;
import org.tizen.dynamicanalyzer.common.AnalyzerManager;
import org.tizen.dynamicanalyzer.common.CommonConstants;
+import org.tizen.dynamicanalyzer.common.SymbolManager;
import org.tizen.dynamicanalyzer.communicator.CommunicatorUtils;
import org.tizen.dynamicanalyzer.communicator.DACommunicator;
import org.tizen.dynamicanalyzer.logparser.LogInserter;
import org.tizen.dynamicanalyzer.model.ImageInfo;
+import org.tizen.dynamicanalyzer.nl.InformationViewLabels;
+import org.tizen.dynamicanalyzer.swap.channel.control.BinaryInfo;
+import org.tizen.dynamicanalyzer.swap.channel.data.ApiNameManager;
import org.tizen.dynamicanalyzer.swap.channel.data.DataChannelConstants;
+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.ContextSwitchData;
import org.tizen.dynamicanalyzer.swap.model.data.ReplayData;
import org.tizen.dynamicanalyzer.swap.model.data.ScreenShotData;
import org.tizen.dynamicanalyzer.swap.model.data.SystemData;
+import org.tizen.dynamicanalyzer.swap.platform.BinarySettingManager;
import org.tizen.dynamicanalyzer.ui.info.snapshot.SocketClient;
import org.tizen.dynamicanalyzer.ui.page.BaseView;
import org.tizen.dynamicanalyzer.ui.summary.profiling.FunctionUsageProfiler;
String apiName = pData.getApiName();
if (null == apiName || apiName.isEmpty()
|| apiName.equals("_end")) { //$NON-NLS-1$
- apiName = AnalyzerUtil.getFuncName(pData);
+ apiName = getFuncName(pData);
if (apiName == null
|| apiName.equals("<unknown function>")) {
- // necessary? pData.setApiName(apiName);
continue;
} else {
pData.setApiName(apiName);
// + " base addr : "
// + AnalyzerUtil.toHexdecimal(processInfo
// .getLowestAddress()));
-
+
pushLog(log, logPack);
if (pcAddr >= processInfo.getLowestAddress()
&& pcAddr <= processInfo.getHighestAddress()) {
// + " time " + input.getTime());
// System.out.println(" ]");
// }
+
+ private String getFuncName(ProfileData input) {
+ long pcAddr = input.getPcAddr();
+ HashMap<Long, String> funcNameMap = AnalyzerManager
+ .getFuncNameMapByPid(input.getPid());
+ String functionName = funcNameMap.get(pcAddr);
+ if (null != functionName) {
+ return functionName;
+ }
+
+ // String functionName = null;
+ ProcessInfoPackage processInfoPkg = AnalyzerManager.getProject()
+ .getProcessInfo(input.getPid());
+ ProcessInfo processInfo = processInfoPkg
+ .getProcessInfo(input.getTime());
+
+ /** for debug */
+ BinaryInfo binInfo1 = processInfo.getTargetBinary(input.getPcAddr());
+ if (binInfo1 == null) {
+ System.out.println("[Get functino name bug : "
+ + "Can't find binary info]");
+ System.out
+ .println("msg id : "
+ + AnalyzerUtil.toHexdecimal(input.getId())
+ + " pid : "
+ + processInfo.getPid()
+ + " low : "
+ + AnalyzerUtil.toHexdecimal(processInfo
+ .getLowestAddress())
+ + " input addr : "
+ + AnalyzerUtil.toHexdecimal(input.getPcAddr())
+ + " high : "
+ + AnalyzerUtil.toHexdecimal(processInfo
+ .getHighestAddress()));
+ return null;
+ }
+ // String binPath1 = binInfo1.getTargetBinaryPath();
+ // System.out.print("binary : " + binPath1 + " ==> ");
+ // AnalyzerUtil.printHexdecimal(processInfo.getLowestAddress());
+ // System.out.print(" < ");
+ // AnalyzerUtil.printHexdecimal(pcAddr);
+ // System.out.print(" < ");
+ // AnalyzerUtil.printHexdecimal(processInfo.getHighestAddress());
+ // System.out.println();
+
+ if (pcAddr >= processInfo.getLowestAddress()
+ && pcAddr <= processInfo.getHighestAddress()) {
+ String baseAddr = Long.toString(processInfo.getLowestAddress());
+ String pcStr = Long.toString(pcAddr);
+ BinaryInfo binInfo = processInfo.getTargetBinary(pcAddr);
+ String localPath = binInfo.getTempBinaryPath();
+ input.setBuildType(binInfo.getType());
+ input.setBinaryPath(binInfo.getTargetBinaryPath());
+ boolean isPieBuild = true;
+ if (binInfo.getType() != 1) {
+ isPieBuild = false;
+ }
+ functionName = SymbolManager.addr2func(localPath, pcStr,
+ isPieBuild, baseAddr);
+ } else {
+ HashMap<String, BinaryInfo> binInfoMap = BinarySettingManager
+ .getInstance().getTargetBinInfoMap();
+ List<String> binPaths = new ArrayList<String>();
+ binPaths.addAll(binInfoMap.keySet());
+
+ HashMap<String, LibraryObject> libHash = processInfo
+ .getLibObjHash();
+ LibraryObject libraryObject = null;
+ int size = binPaths.size();
+ for (int i = 0; i < size; i++) {
+ String binPath = binPaths.get(i);
+ LibraryObject libObj = libHash.get(binPath);
+ if (null == libObj) {
+ continue;
+ }
+ long lowAddr = libObj.getLowestAddress();
+ long highAddr = libObj.getHighestAddress();
+
+ /** for debug */
+ // if (lowAddr > pcAddr || highAddr < pcAddr) {
+ // System.out.print(input.getId() + " lib : " + binPath
+ // + " ==> ");
+ // AnalyzerUtil.printHexdecimal(lowAddr);
+ // System.out.print(" < ");
+ // AnalyzerUtil.printHexdecimal(pcAddr);
+ // System.out.print(" < ");
+ // AnalyzerUtil.printHexdecimal(highAddr);
+ // System.out.println();
+ // }
+
+ if (pcAddr >= lowAddr && pcAddr <= highAddr) {
+ libraryObject = libObj;
+ break;
+ }
+ }
+ if (null != libraryObject) {
+ String path = libraryObject.getLibPath();
+ BinaryInfo binInfo = binInfoMap.get(path);
+ if (null != binInfo) {
+ String localPath = binInfo.getTempBinaryPath();
+ String baseAddr = Long.toString(libraryObject
+ .getLowestAddress());
+ String pcStr = Long.toString(pcAddr);
+ boolean isPieBuild = true;
+ if (binInfo.getType() != 1) {
+ isPieBuild = false;
+ }
+ functionName = SymbolManager.addr2func(localPath, pcStr,
+ isPieBuild, baseAddr);
+ }
+ }
+ }
+
+ if (null == functionName || functionName.isEmpty()
+ || functionName.equals("_end")) { //$NON-NLS-1$
+ functionName = InformationViewLabels.CALLSTACK_TABLE_UNKNOWN_FUNCTION;
+ ApiNameManager.getApiId(functionName);
+ } else {
+ String prevFunctionName = functionName;
+ functionName = SymbolManager
+ .demanglingFunctionName(prevFunctionName);
+ ApiNameManager.getApiId(functionName);
+ }
+ funcNameMap.put(pcAddr, functionName);
+ return functionName;
+ }
}
import org.tizen.dynamicanalyzer.common.CommonConstants;
import org.tizen.dynamicanalyzer.common.PathManager;
import org.tizen.dynamicanalyzer.swap.channel.control.BinaryInfo;
-import org.tizen.dynamicanalyzer.swap.platform.ui.BinarySettingProcessor;
-import org.tizen.dynamicanalyzer.swap.platform.ui.BinarySettingProgressManager;
import org.tizen.dynamicanalyzer.swap.platform.ui.InputRow;
import org.tizen.dynamicanalyzer.utils.AnalyzerUtil;
AnalyzerUtil.tryClose(br);
}
}
+
+ public String getDebugInfoPath(String libPath, String rootPath) {
+ boolean isDebugInfo = true;
+ String debugPath = null;
+
+ String[] splitTargetLib = libPath.split(CommonConstants.SLASH);
+ String libFullName = splitTargetLib[splitTargetLib.length - 1];
+ if (rootPath.endsWith(CommonConstants.SLASH)) {
+ rootPath = rootPath.substring(0, rootPath.length() - 1);
+ }
+ int index = libFullName.indexOf(".so");
+ if (index < 0) {
+ return null;
+ }
+ // 3 means remove "lib" string
+ String debugInfoToken = "*" + libFullName.substring(3, index)
+ + "-debuginfo*.rpm";
+ // String rootstrapPath = PathManager.getRootStrapsPath();
+ List<String> lines = new ArrayList<String>();
+ String toolPath = AnalyzerPaths.TOOL_FOLDER_PATH + File.separator
+ + "debuginfo.sh";
+ String[] command = new String[] { toolPath, "-f", rootPath,
+ debugInfoToken };
+ try {
+ Runtime rt = Runtime.getRuntime();
+ Process process = rt.exec(command);
+ process.waitFor();
+ BufferedReader reader = new BufferedReader(new InputStreamReader(
+ process.getInputStream()));
+ int lineCount = 0;
+ String line = null;
+ while (null != (line = reader.readLine())) {
+ lineCount++;
+ System.out.println("LINE (" + lineCount + ") : " + line);
+ lines.add(line);
+ }
+ if (lineCount == 0) {
+ BufferedReader error = new BufferedReader(
+ new InputStreamReader(process.getErrorStream()));
+ String errorStr = error.readLine();
+ System.out.println("find debug info path fail.. " + errorStr);
+ isDebugInfo = false;
+ }
+ } catch (IOException e) {
+ e.printStackTrace();
+ return null;
+ } catch (InterruptedException e) {
+ e.printStackTrace();
+ return null;
+ }
+
+ if (!isDebugInfo) {
+
+ String libVersion = null;
+ if (libFullName.length() > index + 4) {
+ libVersion = libFullName.substring(index + 4,
+ libFullName.length());
+ } else {
+ libVersion = CommonConstants.EMPTY;
+ }
+ debugInfoToken = "*" + libFullName.substring(3, index) + "-debug-"
+ + libVersion + "*.rpm";
+
+ command = new String[] { toolPath, "-f", rootPath, debugInfoToken };
+ try {
+ Runtime rt = Runtime.getRuntime();
+ Process process = rt.exec(command);
+ process.waitFor();
+ BufferedReader reader = new BufferedReader(
+ new InputStreamReader(process.getInputStream()));
+ int lineCount = 0;
+ String line = null;
+ while (null != (line = reader.readLine())) {
+ lineCount++;
+ System.out.println("LINE (" + lineCount + ") : " + line);
+ lines.add(line);
+ }
+ if (lineCount == 0) {
+ BufferedReader error = new BufferedReader(
+ new InputStreamReader(process.getErrorStream()));
+ String errorStr = error.readLine();
+ System.out.println("find debug info path fail.. "
+ + errorStr);
+ return null;
+ }
+ } catch (IOException e) {
+ e.printStackTrace();
+ return null;
+ } catch (InterruptedException e) {
+ e.printStackTrace();
+ return null;
+ }
+ }
+
+ String select = null;
+ for (String line : lines) {
+ if (null == select) {
+ select = line;
+ } else if (select.length() > line.length()) {
+ select = line;
+ }
+ }
+
+ if (null == select) {
+ return null;
+ } else {
+ debugPath = rootPath + select.substring(1, select.length());
+ }
+ return debugPath;
+ }
}
import org.tizen.dynamicanalyzer.swap.platform.BinarySettingData;
import org.tizen.dynamicanalyzer.swap.platform.BinarySettingManager;
import org.tizen.dynamicanalyzer.ui.toolbar.configuration.BinarySettingsPage;
-import org.tizen.dynamicanalyzer.utils.AnalyzerUtil;
import org.tizen.sdblib.service.FileEntry;
public class BinarySettingProcessor implements Runnable {
BinarySettingData binaryData = new BinarySettingData();
binaryData.setBinaryPath(entry.getFullPath());
- binaryData.setDebugRpmPath(AnalyzerUtil.getDebugInfoPath(
- entry.getFullPath(), page.getDebugRootPath()));
+ binaryData.setDebugRpmPath(BinarySettingManager.getInstance()
+ .getDebugInfoPath(entry.getFullPath(),
+ page.getDebugRootPath()));
addBinData.add(binaryData);
if (addBinData.size() < 40) {
BinarySettingProgressManager.getInstance().setValue(
}
if (null == binData.getDebugRpmPath()
|| binData.getDebugRpmPath().isEmpty()) {
- String debugPath = AnalyzerUtil.getDebugInfoPath(
- binData.getBinaryPath(), page.getDebugRootPath());
+ String debugPath = BinarySettingManager.getInstance()
+ .getDebugInfoPath(binData.getBinaryPath(),
+ page.getDebugRootPath());
binData.setDebugRpmPath(debugPath);
}
}
inputText.getControl().setSelection(
inputText.getText().length());
}
+ else
+ {
+
+ }
}
@Override
*
*/
-package org.tizen.dynamicanalyzer.utils;
+package org.tizen.dynamicanalyzer.ui.page;
import java.util.Timer;
import org.tizen.dynamicanalyzer.swap.logparser.SWAPLogParser;
import org.tizen.dynamicanalyzer.ui.file.FileChartManager;
import org.tizen.dynamicanalyzer.ui.network.NetworkChartManager;
+import org.tizen.dynamicanalyzer.ui.page.UpdateViewTimer;
import org.tizen.dynamicanalyzer.ui.summary.profiling.FunctionUsageProfiler;
import org.tizen.dynamicanalyzer.ui.thread.ThreadChartManager;
import org.tizen.dynamicanalyzer.ui.userinterface.UIDataManager;
import org.tizen.dynamicanalyzer.uirecorder.UIRecorderTool;
-import org.tizen.dynamicanalyzer.utils.UpdateViewTimer;
public class StopLogProcessor implements Runnable {
private static Thread stopLogProcessThread = null;
return processCombo;
}
- public int setCursor(int oldStyle, int newStyle) {
- if (oldStyle == newStyle) {
- return newStyle;
- }
- if (null != cursor) {
- cursor.dispose();
- }
- cursor = new Cursor(null, newStyle);
- shell.setCursor(cursor);
- return newStyle;
- }
-
private ToolbarArea(IWorkbenchWindowConfigurer configurer, Shell sh) {
shell = sh;
package org.tizen.dynamicanalyzer.utils;
-import java.io.BufferedReader;
import java.io.Closeable;
import java.io.File;
import java.io.FileInputStream;
import java.io.FileOutputStream;
import java.io.IOException;
import java.io.InputStream;
-import java.io.InputStreamReader;
import java.io.OutputStream;
import java.net.ServerSocket;
import java.net.Socket;
import org.eclipse.ui.part.ViewPart;
import org.tizen.dynamicanalyzer.common.AnalyzerConstants;
import org.tizen.dynamicanalyzer.common.AnalyzerManager;
-import org.tizen.dynamicanalyzer.common.AnalyzerPaths;
import org.tizen.dynamicanalyzer.common.CommonConstants;
-import org.tizen.dynamicanalyzer.common.SymbolManager;
-import org.tizen.dynamicanalyzer.communicator.CommunicatorUtils;
import org.tizen.dynamicanalyzer.communicator.DACommunicator;
import org.tizen.dynamicanalyzer.handlers.RealtimePerspectiveHandler;
-import org.tizen.dynamicanalyzer.nl.InformationViewLabels;
import org.tizen.dynamicanalyzer.swap.channel.control.BinaryInfo;
-import org.tizen.dynamicanalyzer.swap.channel.data.ApiNameManager;
-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.ProfileData;
-import org.tizen.dynamicanalyzer.swap.platform.BinarySettingManager;
import org.tizen.dynamicanalyzer.ui.page.BaseView;
import org.tizen.dynamicanalyzer.ui.page.DAPageComposite;
import org.tizen.dynamicanalyzer.ui.page.ViewAction;
import org.tizen.dynamicanalyzer.ui.timeline.common.TimelineView;
import org.tizen.dynamicanalyzer.ui.widgets.DATabComposite;
-import org.tizen.sdblib.IDevice;
-import org.tizen.sdblib.exception.SdbCommandRejectedException;
-import org.tizen.sdblib.exception.TimeoutException;
-import org.tizen.sdblib.service.SyncResult;
public class AnalyzerUtil {
private static IWorkbenchWindow window = null;
return num;
}
- public static List<String> getApiMap(IDevice device) {
- String apiFilePath = AnalyzerPaths.TEMP_FOLDER_PATH + File.separator
- + device.getSerialNumber() + CommonConstants.UNDERBAR
- + AnalyzerConstants.API_NAME_FILE_NAME;
- try {
- device.setRootUser(true);
- } catch (TimeoutException e) {
- e.printStackTrace();
- } catch (SdbCommandRejectedException e) {
- e.printStackTrace();
- } catch (IOException e) {
- e.printStackTrace();
- }
-
- SyncResult res = CommunicatorUtils.pull(device,
- AnalyzerPaths.DA_API_MAP_PATH, apiFilePath);
- if (null != res && res.isOk()) {
- System.out.println("api map copying success!!");//$NON-NLS-1$
- } else {
- System.out.println("Failed to get " + apiFilePath); //$NON-NLS-1$
- return null;
- }
-
- List<String> apiMap = new ArrayList<String>();
- apiMap.add("unknown");
-
- File file = new File(apiFilePath);
- if (!file.exists()) {
- System.out.println("file open failed...");
- return null;
- }
- try {
- FileInputStream fis = new FileInputStream(file);
- InputStreamReader isr = new InputStreamReader(fis);
- BufferedReader reader = new BufferedReader(isr);
-
- String input = null;
- while (null != (input = reader.readLine())) {
- String[] splitLine = input.trim().split(CommonConstants.SPACE,
- 2);
- apiMap.add(new String(splitLine[1]));
- }
-
- } catch (FileNotFoundException e) {
- e.printStackTrace();
- return null;
- } catch (IOException e) {
- e.printStackTrace();
- return null;
- } catch (ArrayIndexOutOfBoundsException e) {
- e.printStackTrace();
- }
- return apiMap;
- }
-
public static void printHexdecimal(long value) {
String output = String.format("%x", value);
System.out.print(output);
return binInfo;
}
+ // for tizen 2.2
public static boolean isPieBuild(int pid, long time) {
ProcessInfoPackage processInfoPkg = AnalyzerManager.getProject()
.getProcessInfo(pid);
return false;
}
- public static boolean isAddrInBinaryRange(int pid, long time, long addr) {
- ProcessInfoPackage processInfoPkg = AnalyzerManager.getProject()
- .getProcessInfo(pid);
- ProcessInfo processInfo = processInfoPkg.getProcessInfo(time);
- if (null == processInfo) {
- return false;
- }
-
- if (addr >= processInfo.getLowestAddress()
- && addr <= processInfo.getHighestAddress()) {
- return true;
- } else {
- return false;
- }
- }
-
public static boolean getBinaryBuildType(String localBinaryPath) {
HashMap<String, BinaryInfo> binMap = DACommunicator.getSelectedApp()
.getBinaryInfoMap();
return false;
}
- public static String getFuncName(ProfileData input) {
- long pcAddr = input.getPcAddr();
- HashMap<Long, String> funcNameMap = AnalyzerManager
- .getFuncNameMapByPid(input.getPid());
- String functionName = funcNameMap.get(pcAddr);
- if (null != functionName) {
- return functionName;
- }
-
- // String functionName = null;
- ProcessInfoPackage processInfoPkg = AnalyzerManager.getProject()
- .getProcessInfo(input.getPid());
- ProcessInfo processInfo = processInfoPkg
- .getProcessInfo(input.getTime());
-
- /** for debug */
- BinaryInfo binInfo1 = processInfo.getTargetBinary(input.getPcAddr());
- if (binInfo1 == null) {
-// System.out.println("msg id : " + toHexdecimal(input.getId())
-// + " pid : " + processInfo.getPid() + " low : "
-// + toHexdecimal(processInfo.getLowestAddress())
-// + " input addr : " + toHexdecimal(input.getPcAddr())
-// + " high : "
-// + toHexdecimal(processInfo.getHighestAddress()));
- return null;
- }
- // String binPath1 = binInfo1.getTargetBinaryPath();
- // System.out.print("binary : " + binPath1 + " ==> ");
- // AnalyzerUtil.printHexdecimal(processInfo.getLowestAddress());
- // System.out.print(" < ");
- // AnalyzerUtil.printHexdecimal(pcAddr);
- // System.out.print(" < ");
- // AnalyzerUtil.printHexdecimal(processInfo.getHighestAddress());
- // System.out.println();
-
- if (pcAddr >= processInfo.getLowestAddress()
- && pcAddr <= processInfo.getHighestAddress()) {
- String baseAddr = Long.toString(processInfo.getLowestAddress());
- String pcStr = Long.toString(pcAddr);
- BinaryInfo binInfo = processInfo.getTargetBinary(pcAddr);
- String localPath = binInfo.getTempBinaryPath();
- input.setBuildType(binInfo.getType());
- input.setBinaryPath(binInfo.getTargetBinaryPath());
- boolean isPieBuild = true;
- if (binInfo.getType() != 1) {
- isPieBuild = false;
- }
- functionName = SymbolManager.addr2func(localPath, pcStr,
- isPieBuild, baseAddr);
- } else {
- HashMap<String, BinaryInfo> binInfoMap = BinarySettingManager
- .getInstance().getTargetBinInfoMap();
- List<String> binPaths = new ArrayList<String>();
- binPaths.addAll(binInfoMap.keySet());
-
- HashMap<String, LibraryObject> libHash = processInfo
- .getLibObjHash();
- LibraryObject libraryObject = null;
- int size = binPaths.size();
- for (int i = 0; i < size; i++) {
- String binPath = binPaths.get(i);
- LibraryObject libObj = libHash.get(binPath);
- if (null == libObj) {
- continue;
- }
- long lowAddr = libObj.getLowestAddress();
- long highAddr = libObj.getHighestAddress();
-
- /** for debug */
- // if (lowAddr > pcAddr || highAddr < pcAddr) {
- // System.out.print(input.getId() + " lib : " + binPath
- // + " ==> ");
- // AnalyzerUtil.printHexdecimal(lowAddr);
- // System.out.print(" < ");
- // AnalyzerUtil.printHexdecimal(pcAddr);
- // System.out.print(" < ");
- // AnalyzerUtil.printHexdecimal(highAddr);
- // System.out.println();
- // }
-
- if (pcAddr >= lowAddr && pcAddr <= highAddr) {
- libraryObject = libObj;
- break;
- }
- }
- if (null != libraryObject) {
- String path = libraryObject.getLibPath();
- BinaryInfo binInfo = binInfoMap.get(path);
- if (null != binInfo) {
- String localPath = binInfo.getTempBinaryPath();
- String baseAddr = Long.toString(libraryObject
- .getLowestAddress());
- String pcStr = Long.toString(pcAddr);
- boolean isPieBuild = true;
- if (binInfo.getType() != 1) {
- isPieBuild = false;
- }
- functionName = SymbolManager.addr2func(localPath, pcStr,
- isPieBuild, baseAddr);
- }
- }
- }
-
- if (null == functionName || functionName.isEmpty()
- || functionName.equals("_end")) { //$NON-NLS-1$
- functionName = InformationViewLabels.CALLSTACK_TABLE_UNKNOWN_FUNCTION;
- ApiNameManager.getApiId(functionName);
- } else {
- String prevFunctionName = functionName;
- functionName = SymbolManager
- .demanglingFunctionName(prevFunctionName);
- ApiNameManager.getApiId(functionName);
- }
- funcNameMap.put(pcAddr, functionName);
- return functionName;
- }
-
- public static String getDebugInfoPath(String libPath, String rootPath) {
- boolean isDebugInfo = true;
- String debugPath = null;
-
- String[] splitTargetLib = libPath.split(CommonConstants.SLASH);
- String libFullName = splitTargetLib[splitTargetLib.length - 1];
- if (rootPath.endsWith(CommonConstants.SLASH)) {
- rootPath = rootPath.substring(0, rootPath.length() - 1);
- }
- int index = libFullName.indexOf(".so");
- if (index < 0) {
- return null;
- }
- // 3 means remove "lib" string
- String debugInfoToken = "*" + libFullName.substring(3, index)
- + "-debuginfo*.rpm";
- // String rootstrapPath = PathManager.getRootStrapsPath();
- List<String> lines = new ArrayList<String>();
- String toolPath = AnalyzerPaths.TOOL_FOLDER_PATH + File.separator
- + "debuginfo.sh";
- String[] command = new String[] { toolPath, "-f", rootPath,
- debugInfoToken };
- try {
- Runtime rt = Runtime.getRuntime();
- Process process = rt.exec(command);
- process.waitFor();
- BufferedReader reader = new BufferedReader(new InputStreamReader(
- process.getInputStream()));
- int lineCount = 0;
- String line = null;
- while (null != (line = reader.readLine())) {
- lineCount++;
- System.out.println("LINE (" + lineCount + ") : " + line);
- lines.add(line);
- }
- if (lineCount == 0) {
- BufferedReader error = new BufferedReader(
- new InputStreamReader(process.getErrorStream()));
- String errorStr = error.readLine();
- System.out.println("find debug info path fail.. " + errorStr);
- isDebugInfo = false;
- }
- } catch (IOException e) {
- e.printStackTrace();
- return null;
- } catch (InterruptedException e) {
- e.printStackTrace();
- return null;
- }
-
- if (!isDebugInfo) {
-
- String libVersion = null;
- if (libFullName.length() > index + 4) {
- libVersion = libFullName.substring(index + 4,
- libFullName.length());
- } else {
- libVersion = CommonConstants.EMPTY;
- }
- debugInfoToken = "*" + libFullName.substring(3, index) + "-debug-"
- + libVersion + "*.rpm";
-
- command = new String[] { toolPath, "-f", rootPath, debugInfoToken };
- try {
- Runtime rt = Runtime.getRuntime();
- Process process = rt.exec(command);
- process.waitFor();
- BufferedReader reader = new BufferedReader(
- new InputStreamReader(process.getInputStream()));
- int lineCount = 0;
- String line = null;
- while (null != (line = reader.readLine())) {
- lineCount++;
- System.out.println("LINE (" + lineCount + ") : " + line);
- lines.add(line);
- }
- if (lineCount == 0) {
- BufferedReader error = new BufferedReader(
- new InputStreamReader(process.getErrorStream()));
- String errorStr = error.readLine();
- System.out.println("find debug info path fail.. "
- + errorStr);
- return null;
- }
- } catch (IOException e) {
- e.printStackTrace();
- return null;
- } catch (InterruptedException e) {
- e.printStackTrace();
- return null;
- }
- }
-
- String select = null;
- for (String line : lines) {
- if (null == select) {
- select = line;
- } else if (select.length() > line.length()) {
- select = line;
- }
- }
-
- if (null == select) {
- return null;
- } else {
- debugPath = rootPath + select.substring(1, select.length());
- }
- return debugPath;
- }
public static String getTargetPathKey(String targetPath) {
String returnStr = null;