1. platform project support (handling debug info/source rpm package) for Windows, Mac
2. md5sum utility for Windows, Mac
3. default location for FileExplorer of debuginfo file : user home directory of each OS
4. other code modification considering multi OS
Change-Id: I8fb01db558f3d58d0993fcb5b89ed22284ab3d4f
Signed-off-by: woojin <woojin2.jung@samsung.com>
private static final String LINUX = "linux"; //$NON-NLS-1$
private static final String MAC = "mac"; //$NON-NLS-1$
private static final String WIN = "win"; //$NON-NLS-1$
+ private static final String USER_HOME = "user.home"; //$NON-NLS-1$
private static String pid = null;
private static String getOS() {
return System.getProperty(OS_KEY).toLowerCase();
}
+
+ public static String getHomeDirectory() {
+ return System.getProperty(USER_HOME);
+ }
public static String getCurrentPid() {
if (pid == null) {
--- /dev/null
+set WshShell=WScript.CreateObject("WScript.Shell")\r
+set lnk = WshShell.CreateShortcut(WScript.Arguments.item(0))\r
+'WScript.Echo lnk.TargetPath\r
+WScript.Echo lnk.Description
\ No newline at end of file
--- /dev/null
+@echo off\r
+set base_dir=%~dp0\r
+\r
+if "%1"=="-f" (\r
+shift\r
+goto :find_file\r
+) else (\r
+if "%1"=="-d" (\r
+shift\r
+goto :extract_pkg\r
+) else (\r
+if "%1"=="-r" (\r
+shift\r
+goto :extract_2pkgs\r
+) else (\r
+echo "unknown option!"\r
+exit /b 1\r
+)\r
+)\r
+)\r
+goto :eof\r
+\r
+\r
+:find_file\r
+cd %1\r
+%base_dir%\find . -name %2\r
+exit /b\r
+\r
+:extract_pkg\r
+echo %1\r
+echo %2\r
+cd %1\r
+%base_dir%\rpm2cpio %2\r
+exit /b\r
+\r
+:extract_2pkgs\r
+echo %1\r
+echo %2\r
+echo %3\r
+cd %1\r
+call %base_dir%\rpm2cpio %2\r
+call %base_dir%\rpm2cpio %3\r
+exit /b\r
#!/bin/bash
+BASE_DIR=$(dirname $0)
FIND=/usr/bin/find
-RPM_COMMAND=/usr/bin/rpm2cpio
+RPM_COMMAND_UBUNTU=/usr/bin/rpm2cpio
+RPM_COMMAND_MAC=$BASE_DIR/rpm2cpio.sh
print_usage()
{
- echo "Usage: debuginfo [options] [arguments]"
+ echo "Usage: debuginfo -u|-m [options] [arguments]"
+ echo "-u ubuntu command"
+ echo "-m macos command"
echo "Options:"
echo "-r extract two rpm package"
echo "-d extract one rpm package"
find . -name $2
}
-extract()
+extract_2pkgs()
{
echo $1
echo $2
echo $3
cd $1
- rpm2cpio $2 | cpio -imd
- rpm2cpio $3 | cpio -imd
+
+ case "$OS" in
+ ubuntu)
+ $RPM_COMMAND_UBUNTU $2 | cpio -imd
+ $RPM_COMMAND_UBUNTU $3 | cpio -imd
+ ;;
+ mac)
+ $RPM_COMMAND_MAC $2 | cpio -imd
+ $RPM_COMMAND_MAC $3 | cpio -imd
+ ;;
+ *)
+ echo "unknown OS"
+ print_usage
+ exit 1
+ ;;
+ esac
}
-extract2()
+extract_pkg()
{
echo $1
echo $2
cd $1
- rpm2cpio $2 | cpio -imd
+
+ case "$OS" in
+ ubuntu)
+ $RPM_COMMAND_UBUNTU $2 | cpio -imd
+ ;;
+ mac)
+ $RPM_COMMAND_MAC $2 | cpio -imd
+ ;;
+ *)
+ echo "unknown OS"
+ print_usage
+ exit 1
+ ;;
+ esac
}
if [[ -n $1 ]]; then
case "$1" in
+ -u)
+ OS=ubuntu
+ shift
+ ;;
+ -m)
+ OS=mac
+ shift
+ ;;
+ *)
+ echo "must specify host OS"
+ print_usage
+ exit 1
+ ;;
+ esac
+else
+ print_usage
+fi
+
+if [[ -n $1 ]]; then
+ case "$1" in
-f)
if [[ "$#" -ne 3 ]]; then
echo "find needs two arguments!"
exit 1
fi
shift
- extract $@
+ extract_2pkgs $@
;;
-d)
if [[ "$#" -ne 3 ]]; then
exit 1
fi
shift
- extract2 $@
+ extract_pkg $@
;;
*)
echo "unknown option!"
--- /dev/null
+@echo off\r
+set base_dir=%~dp0\r
+\r
+if not '%1'=='' (\r
+if exist %1 goto args_ok\r
+)\r
+echo "no package supplied"\r
+exit /b 1\r
+\r
+:args_ok\r
+set pkg=%1\r
+\r
+setlocal enabledelayedexpansion\r
+set count=1\r
+set leadsize=96\r
+set /a o=%leadsize%+8\r
+for /f "tokens=2-9" %%a in ('%base_dir%\od -j %o% -N 8 -t u1 %pkg%') do (\r
+if !count!==2 goto endod\r
+set var1=%%a\r
+set var2=%%b\r
+set var3=%%c\r
+set var4=%%d\r
+set var5=%%e\r
+set var6=%%f\r
+set var7=%%g\r
+set var8=%%h\r
+set /a count=!count!+1\r
+)\r
+:endod\r
+\r
+set /a il=256 * ( 256 * ( 256 * %var1% + %var2% ) + %var3% ) + %var4%\r
+set /a dl=256 * ( 256 * ( 256 * %var5% + %var6% ) + %var7% ) + %var8%\r
+\r
+endlocal & set o=%o% & set il=%il% & set dl=%dl%\r
+\r
+set /a sigsize=8 + 16 * %il% + %dl%\r
+set /a o=%o% + %sigsize% + ( 8 - ( %sigsize% %% 8 ) ) %% 8 + 8\r
+setlocal enabledelayedexpansion\r
+set count=1\r
+for /f "tokens=2-9" %%a in ('%base_dir%\od -j %o% -N 8 -t u1 %pkg%') do (\r
+if !count!==2 goto end2od\r
+set var1=%%a\r
+set var2=%%b\r
+set var3=%%c\r
+set var4=%%d\r
+set var5=%%e\r
+set var6=%%f\r
+set var7=%%g\r
+set var8=%%h\r
+set /a count=!count!+1\r
+)\r
+:end2od\r
+\r
+set /a il=256 * ( 256 * ( 256 * %var1% + %var2% ) + %var3% ) + %var4%\r
+set /a dl=256 * ( 256 * ( 256 * %var5% + %var6% ) + %var7% ) + %var8%\r
+\r
+endlocal & set il=%il% & set dl=%dl%\r
+\r
+set /a hdrsize=8 + 16 * %il% + %dl%\r
+set /a o=%o% + %hdrsize%\r
+\r
+%base_dir%\dd if=%pkg% ibs=%o% skip=1 2>nul | %base_dir%\gzip -d | %base_dir%\cpio -i --make-directories --preserve-modification-time 2>nul\r
--- /dev/null
+#!/bin/sh
+
+pkg=$1
+if [ "$pkg" = "" -o ! -e "$pkg" ]; then
+echo "no package supplied" 1>&2
+exit 1
+fi
+
+leadsize=96
+o=`expr $leadsize + 8`
+set `od -j $o -N 8 -t u1 $pkg`
+il=`expr 256 \* \( 256 \* \( 256 \* $2 + $3 \) + $4 \) + $5`
+dl=`expr 256 \* \( 256 \* \( 256 \* $6 + $7 \) + $8 \) + $9`
+
+sigsize=`expr 8 + 16 \* $il + $dl`
+o=`expr $o + $sigsize + \( 8 - \( $sigsize \% 8 \) \) \% 8 + 8`
+set `od -j $o -N 8 -t u1 $pkg`
+il=`expr 256 \* \( 256 \* \( 256 \* $2 + $3 \) + $4 \) + $5`
+dl=`expr 256 \* \( 256 \* \( 256 \* $6 + $7 \) + $8 \) + $9`
+
+hdrsize=`expr 8 + 16 \* $il + $dl`
+o=`expr $o + $hdrsize`
+
+dd if=$pkg ibs=$o skip=1 2>/dev/null | gunzip
public static final String WINDOW_ACTIVATOR_WINDOWS = "windowactivator.bat";//$NON-NLS-1$
public static final String WINDOW_ACTIVATOR_MACOS = "macoswindowactivator.sh";//$NON-NLS-1$
+ // debug info script
+ public static final String DEBUGINFO_LINUX_MAC = "debuginfo.sh";//$NON-NLS-1$
+ public static final String DEBUGINFO_WINDOWS = "debuginfo.bat";//$NON-NLS-1$
+
// paths
// DA_REMOTE_PROBE_PATH : to drop sample log from probe library [function profiling]
public static final String DA_REMOTE_PROBE_PATH = "/usr/lib/da_probe"; //$NON-NLS-1$
import java.io.FilenameFilter;
import org.tizen.common.core.application.InstallPathConfig;
import org.tizen.dynamicanalyzer.util.CommonUtil;
+import org.tizen.dynamicanalyzer.util.Logger;
// All paths of PathManager should not be ended with File.separater
public class PathManager {
return returnstr + File.separator + PathConstants.DYNAMIC_ANALYZER_FOLDER_NAME
+ File.separator + PathConstants.TEST_FOLDER_NAME;
}
+
+ public static String getDebugInfoScript() {
+ String path = null;
+
+ if (CommonUtil.isLinux() || CommonUtil.isMac()) {
+ path = DA_TOOL_FOLDER_PATH + File.separator
+ + PathConstants.DEBUGINFO_LINUX_MAC;
+ } else if (CommonUtil.isWin()) {
+ path = DA_TOOL_FOLDER_PATH + File.separator
+ + PathConstants.DEBUGINFO_WINDOWS;
+ } else { // should never be here
+ Logger.error("Unknown host OS!\n");
+ }
+
+ return path;
+ }
}
public static final String CMD_CAT_PORT_FILE = "cat /tmp/port.da"; //$NON-NLS-1$
public static final String CMD_DA_MD_5_SUM = "da md5sum "; //$NON-NLS-1$
- public static final String CMD_MD_5_SUM = "/usr/bin/md5sum"; //$NON-NLS-1$
+ public static final String CMD_LINUX_MD_5_SUM = "/usr/bin/md5sum"; //$NON-NLS-1$
+ public static final String CMD_MAC_MD_5_SUM = "/sbin/md5"; //$NON-NLS-1$
}
}
private String getSourceFilePath(String sourcePath) {
- int index = sourcePath.lastIndexOf("src/");
+ String separator = "src" + File.separator;
+ int index = sourcePath.lastIndexOf(separator);
String filePath = sourcePath.substring(index + 4, sourcePath.length());
return filePath;
}
import org.tizen.dynamicanalyzer.model.AddrSymbolPair;
import org.tizen.dynamicanalyzer.util.Logger;
import org.tizen.dynamicanalyzer.utils.AnalyzerUtil;
+import org.tizen.dynamicanalyzer.utils.RpmUtil;
import org.tizen.sdblib.receiver.MultiLineReceiver;
public class AppInfo {
// extract rpm file
if (null != copiedRpmPath) {
- String toolPath = PathManager.DA_TOOL_FOLDER_PATH + File.separator
- + "debuginfo.sh";
+ String toolPath = PathManager.getDebugInfoScript();
String[] command = null;
- command = new String[] { toolPath, "-d", rpmPath, debugRpmPath };
+ command = new String[] { toolPath, RpmUtil.getDebugInfoOption(), "-d", rpmPath, debugRpmPath };
try {
Runtime rt = Runtime.getRuntime();
Process process = rt.exec(command);
// check debuginfo file path
if (debugInfoRpmFile.getName().contains(DEBUGPKGTYPE_DEBUGINFO)) {
- String debugCmd = PathManager.DA_TOOL_FOLDER_PATH + File.separator
- + "debuginfo.sh -f " + rpmPath + CommonConstants.SPACE
- + getExecFileName() + ".debug";
+ String debugCmd = PathManager.getDebugInfoScript() + " "
+ + RpmUtil.getDebugInfoOption() + " -f " + rpmPath
+ + CommonConstants.SPACE + getExecFileName() + ".debug";
try {
Runtime rt = Runtime.getRuntime();
Process process = rt.exec(debugCmd);
// future extension for applications with normal debug package
} else if (debugInfoRpmFile.getName().contains(DEBUGPKGTYPE_DEBUG)) {
- String debugCmd = PathManager.DA_TOOL_FOLDER_PATH + File.separator
- + "debuginfo.sh -f " + rpmPath + CommonConstants.SPACE
- + getExecFileName();
+ String debugCmd = PathManager.getDebugInfoScript() + " "
+ + RpmUtil.getDebugInfoOption() + " -f "
+ + rpmPath + CommonConstants.SPACE + getExecFileName();
try {
Runtime rt = Runtime.getRuntime();
Process process = rt.exec(debugCmd);
// extract rpm file
if (null != copiedRpmPath) {
- String toolPath = PathManager.DA_TOOL_FOLDER_PATH + File.separator
- + "debuginfo.sh";
+ String toolPath = PathManager.getDebugInfoScript();
String[] command = null;
- command = new String[] { toolPath, "-d", rpmPath, sourceRpmPath };
+ command = new String[] { toolPath, RpmUtil.getDebugInfoOption(), "-d", rpmPath, sourceRpmPath };
try {
Runtime rt = Runtime.getRuntime();
}
// check debugsource file path
- String sourceCmd = PathManager.DA_TOOL_FOLDER_PATH + File.separator
- + "debuginfo.sh -f " + rpmPath + CommonConstants.SPACE + projectName
- + CommonConstants.ASTERISK;
+ String sourceCmd = PathManager.getDebugInfoScript() + " "
+ + RpmUtil.getDebugInfoOption() + " -f "
+ + rpmPath + CommonConstants.SPACE + projectName + CommonConstants.ASTERISK;
try {
Runtime rt = Runtime.getRuntime();
Process process = rt.exec(sourceCmd);
import java.util.HashMap;
import java.util.List;
import java.util.Map;
+import java.util.regex.Pattern;
+
import org.eclipse.swt.SWT;
import org.eclipse.swt.widgets.Display;
import org.eclipse.swt.widgets.Shell;
return;
}
- String[] splitLocalBinaryPath = localBinaryPath.split(CommonConstants.SLASH);
+ String[] splitLocalBinaryPath = localBinaryPath.split(Pattern.quote(File.separator));
- if (CommonUtil.isLinux()) {
- // check local binary path validation
- // host has no binary file - pull binary file from target
- if (splitLocalBinaryPath.length < 3
- || !(new File(localBinaryPath)).exists()) {
- localBinaryPath = PathManager.DA_TEMP_FOLDER_PATH + File.separator
- + getFileName(targetPath);
- result = pullTheFile(targetPath, localBinaryPath);
- if (result.isSuccess()) {
- binInfo.setTempBinaryPath(localBinaryPath);
- }
- } else {
- // if local binary exist already, then check for md5sum
- String localHashCode = null;
- try {
- Runtime rt = Runtime.getRuntime();
- Process process = rt.exec(new String[] {
- AnalyzerShellCommands.CMD_MD_5_SUM, localBinaryPath });
- process.waitFor();
- BufferedReader reader = new BufferedReader(new InputStreamReader(
- process.getInputStream()));
- BufferedReader error = new BufferedReader(new InputStreamReader(
- process.getErrorStream()));
- String line = reader.readLine();
- String errorStr = error.readLine();
- if (null == line) {
- Logger.debug("host md5sum get failed : " + errorStr);
- result = HostResult.ERR_BIN_INFO_GET_FAIL;
- } else {
- String[] splitResult = line.trim().split(
- CommonConstants.SPACE);
- localHashCode = new String(splitResult[0]);
- }
- } catch (IOException e) {
- e.printStackTrace();
- result = HostResult.ERR_BIN_INFO_GET_FAIL;
- } catch (InterruptedException e) {
- e.printStackTrace();
+ // check local binary path validation
+ // host has no binary file - pull binary file from target
+ if (splitLocalBinaryPath.length < 3
+ || !(new File(localBinaryPath)).exists()) {
+ localBinaryPath = PathManager.DA_TEMP_FOLDER_PATH + File.separator
+ + getFileName(targetPath);
+ result = pullTheFile(targetPath, localBinaryPath);
+ if (result.isSuccess()) {
+ binInfo.setTempBinaryPath(localBinaryPath);
+ }
+ } else {
+ // if local binary exist already, then check for md5sum
+ String localHashCode = null;
+ try {
+ Runtime rt = Runtime.getRuntime();
+ Process process = rt.exec(new String[] {
+ getMd5Command(), localBinaryPath });
+ process.waitFor();
+ BufferedReader reader = new BufferedReader(new InputStreamReader(
+ process.getInputStream()));
+ BufferedReader error = new BufferedReader(new InputStreamReader(
+ process.getErrorStream()));
+ String line = reader.readLine();
+ String errorStr = error.readLine();
+ if (null == line) {
+ Logger.debug("host md5sum get failed : " + errorStr);
result = HostResult.ERR_BIN_INFO_GET_FAIL;
+ } else {
+ // md5sum.exe prepend "\" when target binary is not in current directory
+ if (CommonUtil.isWin()) {
+ line = line.replace("\\", "");
+ }
+ localHashCode = parseMd5Result(line);
}
+ } catch (IOException e) {
+ e.printStackTrace();
+ result = HostResult.ERR_BIN_INFO_GET_FAIL;
+ } catch (InterruptedException e) {
+ e.printStackTrace();
+ result = HostResult.ERR_BIN_INFO_GET_FAIL;
+ }
- if (localHashCode == null
- || 0 != localHashCode.compareTo(binInfo.getMd5sumValue())) {
- localBinaryPath = PathManager.DA_TEMP_FOLDER_PATH
- + File.separator + getFileName(targetPath);
- result = pullTheFile(targetPath, localBinaryPath);
- if (result.isSuccess()) {
- binInfo.setTempBinaryPath(localBinaryPath);
- }
- } else {
+ if (localHashCode == null
+ || 0 != localHashCode.compareTo(binInfo.getMd5sumValue())) {
+ localBinaryPath = PathManager.DA_TEMP_FOLDER_PATH
+ + File.separator + getFileName(targetPath);
+ result = pullTheFile(targetPath, localBinaryPath);
+ if (result.isSuccess()) {
binInfo.setTempBinaryPath(localBinaryPath);
}
- }
- } else { // if not linux
- localBinaryPath = PathManager.DA_TEMP_FOLDER_PATH + File.separator
- + getFileName(targetPath);
- result = pullTheFile(targetPath, localBinaryPath);
- if (result.isSuccess()) {
+ } else {
binInfo.setTempBinaryPath(localBinaryPath);
}
}
}
}
+
+ private String getMd5Command() {
+ String cmd = null;
+
+ if (CommonUtil.isLinux()) {
+ cmd = AnalyzerShellCommands.CMD_LINUX_MD_5_SUM;
+ } else if (CommonUtil.isMac()) {
+ cmd = AnalyzerShellCommands.CMD_MAC_MD_5_SUM;
+ } else if (CommonUtil.isWin()) {
+ cmd = PathManager.DA_TOOL_FOLDER_PATH + File.separator
+ + "md5sum.exe";
+ } else { // should never be here
+ Logger.error("Unknown host OS!\n");
+ }
+
+ return cmd;
+ }
+
+ private String parseMd5Result(String line) {
+ String md5value = null;
+ String[] splitResult = line.trim().split(
+ CommonConstants.SPACE);
+
+ if (CommonUtil.isLinux()) {
+ md5value = new String(splitResult[0]);
+ } else if (CommonUtil.isMac()) { // In md5's output, hash value comes last
+ md5value = new String(splitResult[splitResult.length - 1]);
+ } else if (CommonUtil.isWin()) {
+ md5value = new String(splitResult[0]);
+ } else { // should never be here
+ Logger.error("Unknown host OS!\n");
+ }
+
+ return md5value;
+ }
}
\ No newline at end of file
import java.util.ArrayList;
import java.util.HashMap;
import java.util.List;
+import java.util.regex.Pattern;
import org.eclipse.swt.layout.FormAttachment;
import org.eclipse.swt.layout.FormData;
import org.tizen.dynamicanalyzer.util.CommonUtil;
import org.tizen.dynamicanalyzer.util.Logger;
import org.tizen.dynamicanalyzer.utils.AnalyzerUtil;
+import org.tizen.dynamicanalyzer.utils.RpmUtil;
public class BinarySettingManager {
private static BinarySettingManager instance = null;
// extract rpm file exists
if (null != debugRpmPath) {
- String toolPath = PathManager.DA_TOOL_FOLDER_PATH + File.separator
- + "debuginfo.sh";
+ String toolPath = PathManager.getDebugInfoScript();
String[] command = null;
if (null != debugRpmSourcePath) {
- command = new String[] { toolPath, "-r", rpmPath, debugRpmPath,
+ command = new String[] { toolPath, RpmUtil.getDebugInfoOption(), "-r", rpmPath, debugRpmPath,
debugRpmSourcePath };
} else {
- command = new String[] { toolPath, "-d", rpmPath, debugRpmPath };
+ command = new String[] { toolPath, RpmUtil.getDebugInfoOption(), "-d", rpmPath, debugRpmPath };
}
try {
Runtime rt = Runtime.getRuntime();
if (lineCount == 1) {
Logger.debug("CHANGE DIR : " + line);
} else {
- Logger.debug("EXTRACE RPM : " + line);
+ Logger.debug("EXTRACT RPM : " + line);
}
}
if (lineCount == 0) {
}
// check real debug file path
- String[] splitDebugPath = debugPath.split(CommonConstants.SLASH);
+ String[] splitDebugPath = debugPath.split(Pattern.quote(File.separator));
String debugFileName = splitDebugPath[splitDebugPath.length - 1];
if (debugFileName.contains("debuginfo")) {
String libPostFix = libFullName
.substring(index, libFullName.length());
String libVersion = libPostFix.substring(4, libPostFix.length());
- String debugCmd = PathManager.DA_TOOL_FOLDER_PATH + File.separator
- + "debuginfo.sh -f " + rpmPath + " " + "*" + libPostFix
- + ".debug";
+ String debugCmd = PathManager.getDebugInfoScript() + " "
+ + RpmUtil.getDebugInfoOption() + " -f " + rpmPath
+ + " " + "*" + libPostFix + ".debug";
String debugFilePath = null;
try {
Runtime rt = Runtime.getRuntime();
// check real source file path
if (null != debugRpmSourcePath && !debugRpmSourcePath.isEmpty()) {
String sourceFilePath = null;
- String sourceCmd = PathManager.DA_TOOL_FOLDER_PATH
- + File.separator + "debuginfo.sh -f " + rpmPath + " "
- + "*" + libVersion;
+ String sourceCmd = PathManager.getDebugInfoScript() + " "
+ + RpmUtil.getDebugInfoOption() + " -f "
+ + rpmPath + " " + "*" + libVersion;
try {
Runtime rt = Runtime.getRuntime();
Process process = rt.exec(sourceCmd);
binData.setDebugSourcePath(CommonConstants.EMPTY);
}
} else if (debugFileName.contains("debug-")) {
- String debugCmd = PathManager.DA_TOOL_FOLDER_PATH + File.separator
- + "debuginfo.sh -f " + rpmPath + CommonConstants.SPACE
- + libFullName;
+ String debugCmd = PathManager.getDebugInfoScript() + " "
+ + RpmUtil.getDebugInfoOption() + " -f "
+ + rpmPath + CommonConstants.SPACE + libFullName;
String debugFilePath = null;
try {
Runtime rt = Runtime.getRuntime();
String debugInfoToken = "*" + libFullName.substring(3, index) + "-debuginfo*.rpm";
// String rootstrapPath = PathManager.getRootStrapsPath();
List<String> lines = new ArrayList<String>();
- String toolPath = PathManager.DA_TOOL_FOLDER_PATH + File.separator
- + "debuginfo.sh";
- String[] command = new String[] { toolPath, "-f", rootPath, debugInfoToken };
+ String toolPath = PathManager.getDebugInfoScript();
+ String[] command = new String[] { toolPath, RpmUtil.getDebugInfoOption(), "-f", rootPath, debugInfoToken };
try {
Runtime rt = Runtime.getRuntime();
Process process = rt.exec(command);
debugInfoToken = "*" + libFullName.substring(3, index) + "-debug-"
+ libVersion + "*.rpm";
- command = new String[] { toolPath, "-f", rootPath, debugInfoToken };
+ command = new String[] { toolPath, RpmUtil.getDebugInfoOption(), "-f", rootPath, debugInfoToken };
try {
Runtime rt = Runtime.getRuntime();
Process process = rt.exec(command);
inputText.setText(current.getAbsolutePath());
return;
}
-
- if (!path.contains(root.getAbsolutePath())) {
- Logger.debug("Out of root range");
+// TODO: Are users allowed to select files outside user home directory?
+// if (!path.contains(root.getAbsolutePath())) {
+// Logger.debug("Out of root range");
// inputText.setBackground(ColorResources.RED);
// info.setText("Out of root range");
- inputText.setText(current.getAbsolutePath());
- return;
- }
+// inputText.setText(current.getAbsolutePath());
+// return;
+// }
int ret = setCurrent(path);
if (ret != FAIL) {
import org.tizen.dynamicanalyzer.swap.platform.BinarySettingManager;
import org.tizen.dynamicanalyzer.swap.platform.ui.FileExplorer.FileExplorerDialog;
import org.tizen.dynamicanalyzer.ui.toolbar.configuration.BinarySettingsPage;
+import org.tizen.dynamicanalyzer.util.CommonUtil;
import org.tizen.dynamicanalyzer.widgets.button.DACustomButton;
import org.tizen.dynamicanalyzer.widgets.button.DACustomButtonClickEventListener;
import org.tizen.dynamicanalyzer.widgets.da.base.DAText;
dialog.setFilter("debug");
dialog.getExplorer().setRoot(
// BinarySettingManager.getInstance().getDebugRoot());
- "/home/");
+ CommonUtil.getHomeDirectory());
Object result = dialog.open();
List<BinarySettingData> bins = new ArrayList<BinarySettingData>();
if (result != null) {
@Override
public void handleClickEvent(DACustomButton button) {
FileExplorerDialog dialog = new FileExplorerDialog(getShell());
- dialog.getExplorer().setRoot("/home/");
+ dialog.getExplorer().setRoot(CommonUtil.getHomeDirectory());
Object result = dialog.open();
if (result != null) {
@SuppressWarnings("unchecked")
@Override
public void handleClickEvent(DACustomButton button) {
FileExplorerDialog dialog = new FileExplorerDialog(getShell());
- dialog.getExplorer().setRoot("/home/");
+ dialog.getExplorer().setRoot(CommonUtil.getHomeDirectory());
Object result = dialog.open();
if (result != null) {
@SuppressWarnings("unchecked")
package org.tizen.dynamicanalyzer.utils;
import java.io.BufferedReader;
-import java.io.File;
import java.io.IOException;
import java.io.InputStreamReader;
import java.util.ArrayList;
import java.util.List;
import org.tizen.dynamicanalyzer.common.path.PathManager;
+import org.tizen.dynamicanalyzer.util.CommonUtil;
import org.tizen.dynamicanalyzer.util.Logger;
public class RpmUtil {
// extract rpm file exists
public static void extractRpm(String targetpath, String rpmpath) {
if (null != rpmpath) {
- String toolPath = PathManager.DA_TOOL_FOLDER_PATH + File.separator
- + "debuginfo.sh";
- String[] command = new String[] { toolPath, "-d", targetpath, rpmpath };
+ String toolPath = PathManager.getDebugInfoScript();
+ String[] command = new String[] { toolPath, RpmUtil.getDebugInfoOption(), "-d", targetpath, rpmpath };
try {
Runtime rt = Runtime.getRuntime();
Process process = rt.exec(command);
List<String> ret = null;
if (null != rpmpath) {
- String toolPath = PathManager.DA_TOOL_FOLDER_PATH + File.separator
- + "debuginfo.sh";
- String[] command = new String[] { toolPath, "-l", rpmpath };
+ String toolPath = PathManager.getDebugInfoScript();
+ String[] command = new String[] { toolPath, RpmUtil.getDebugInfoOption(), "-l", rpmpath };
try {
Runtime rt = Runtime.getRuntime();
Process process = rt.exec(command);
return ret;
}
+
+ public static String getDebugInfoOption() {
+ String option = null;
+
+ if (CommonUtil.isLinux()) {
+ option = "-u";
+ } else if (CommonUtil.isMac()) {
+ option = "-m";
+ } else if (CommonUtil.isWin()) {
+ option = "";
+ } else { // should never be here
+ Logger.error("Unknown host OS!\n");
+ }
+
+ return option;
+ }
}
install_ide_path=${INSTALL_DIR}/${ide_root_path_name} bfile_dir=org.tizen.dynamicanalyzer.workbench/dynamic-analyzer
##install_lib_path=${INSTALL_DIR}/${ide_lib_path_name} blib_dir=org.tizen.dynamicanalyzer.workbench/dynamic-analyzer/library
tool_dir=tool
- debugbinary=debuginfo.sh
cp -rf ${SRCDIR}/${bfile_dir}/config ${install_ide_path}/
mkdir -p ${install_ide_path}/${tool_dir}
- cp -rf ${SRCDIR}/${bfile_dir}/${tool_dir}/${debugbinary} ${install_ide_path}/${tool_dir}/
+ cp -rf ${SRCDIR}/${bfile_dir}/${tool_dir}/debuginfo.sh ${install_ide_path}/${tool_dir}/
+# for macos
+ cp -rf ${SRCDIR}/${bfile_dir}/${tool_dir}/rpm2cpio.sh ${install_ide_path}/${tool_dir}/
+# for windows
+ cp -rf ${SRCDIR}/${bfile_dir}/${tool_dir}/Shortcut.vbs ${install_ide_path}/${tool_dir}/
+ cp -rf ${SRCDIR}/${bfile_dir}/${tool_dir}/debuginfo.bat ${install_ide_path}/${tool_dir}/
+ cp -rf ${SRCDIR}/${bfile_dir}/${tool_dir}/rpm2cpio.bat ${install_ide_path}/${tool_dir}/
+ cp -rf ${SRCDIR}/${bfile_dir}/${tool_dir}/cpio.exe ${install_ide_path}/${tool_dir}/
+ cp -rf ${SRCDIR}/${bfile_dir}/${tool_dir}/dd.exe ${install_ide_path}/${tool_dir}/
+ cp -rf ${SRCDIR}/${bfile_dir}/${tool_dir}/find.exe ${install_ide_path}/${tool_dir}/
+ cp -rf ${SRCDIR}/${bfile_dir}/${tool_dir}/gzip.exe ${install_ide_path}/${tool_dir}/
+ cp -rf ${SRCDIR}/${bfile_dir}/${tool_dir}/libiconv2.dll ${install_ide_path}/${tool_dir}/
+ cp -rf ${SRCDIR}/${bfile_dir}/${tool_dir}/libintl3.dll ${install_ide_path}/${tool_dir}/
+ cp -rf ${SRCDIR}/${bfile_dir}/${tool_dir}/md5sum.exe ${install_ide_path}/${tool_dir}/
+ cp -rf ${SRCDIR}/${bfile_dir}/${tool_dir}/od.exe ${install_ide_path}/${tool_dir}/
## cp -rf ${SRCDIR}/${bfile_dir}/xml ${install_ide_path}/
## cp -rf ${SRCDIR}/${blib_dir}/* ${install_lib_path}/
}