From 1320eb9ec04c8cf8c035f8a75ca9cda0aaf76b11 Mon Sep 17 00:00:00 2001 From: jooyoul_lee Date: Fri, 22 Nov 2013 16:25:43 +0900 Subject: [PATCH] [Title] search debug info fixed [Desc.] [Issue] --- .../listeners/TableTooltipListener.java | 2 +- .../swap/logparser/SWAPLogParser.java | 1 - .../swap/platform/BinarySettingData.java | 10 +- .../swap/platform/BinarySettingManager.java | 187 +++++--- .../swap/platform/ui/BinaryAddDialog.java | 518 --------------------- .../swap/platform/ui/BinarySettingProcessor.java | 11 +- .../platform/ui/DeviceExplorer/DeviceExplorer.java | 52 ++- .../platform/ui/FileExplorer/DAFileExplorer.java | 51 +- .../toolbar/configuration/BinarySettingsPage.java | 90 +--- .../widgets/table/DAWindowingTableComposite.java | 3 +- .../tizen/dynamicanalyzer/utils/AnalyzerUtil.java | 77 ++- 11 files changed, 298 insertions(+), 704 deletions(-) delete mode 100644 org.tizen.dynamicanalyzer/src/org/tizen/dynamicanalyzer/swap/platform/ui/BinaryAddDialog.java diff --git a/org.tizen.dynamicanalyzer/src/org/tizen/dynamicanalyzer/listeners/TableTooltipListener.java b/org.tizen.dynamicanalyzer/src/org/tizen/dynamicanalyzer/listeners/TableTooltipListener.java index 45533c3..d46ddde 100644 --- a/org.tizen.dynamicanalyzer/src/org/tizen/dynamicanalyzer/listeners/TableTooltipListener.java +++ b/org.tizen.dynamicanalyzer/src/org/tizen/dynamicanalyzer/listeners/TableTooltipListener.java @@ -328,7 +328,7 @@ public class TableTooltipListener implements Listener { } } } catch (FileNotFoundException e) { - e.printStackTrace(); +// e.printStackTrace(); createErrorTooltip(event, AnalyzerConstants.SOURCE_FILE_NOT_FOUND); } catch (IOException e) { diff --git a/org.tizen.dynamicanalyzer/src/org/tizen/dynamicanalyzer/swap/logparser/SWAPLogParser.java b/org.tizen.dynamicanalyzer/src/org/tizen/dynamicanalyzer/swap/logparser/SWAPLogParser.java index fbf1f0b..9637b70 100755 --- a/org.tizen.dynamicanalyzer/src/org/tizen/dynamicanalyzer/swap/logparser/SWAPLogParser.java +++ b/org.tizen.dynamicanalyzer/src/org/tizen/dynamicanalyzer/swap/logparser/SWAPLogParser.java @@ -203,7 +203,6 @@ public class SWAPLogParser implements Runnable { // + AnalyzerUtil.toHexdecimal(processInfo // .getLowestAddress())); - System.out.println("profile " + pData.getLibName()); pushLog(log, logPack); if (pcAddr >= processInfo.getLowestAddress() diff --git a/org.tizen.dynamicanalyzer/src/org/tizen/dynamicanalyzer/swap/platform/BinarySettingData.java b/org.tizen.dynamicanalyzer/src/org/tizen/dynamicanalyzer/swap/platform/BinarySettingData.java index e441b63..e668114 100644 --- a/org.tizen.dynamicanalyzer/src/org/tizen/dynamicanalyzer/swap/platform/BinarySettingData.java +++ b/org.tizen.dynamicanalyzer/src/org/tizen/dynamicanalyzer/swap/platform/BinarySettingData.java @@ -30,7 +30,7 @@ import org.tizen.dynamicanalyzer.common.CommonConstants; public class BinarySettingData { private String binaryPath = null; private String debugSourcePath = null; - private String debugPath = null; + private String debugInfoRpmPath = null; private String debugFilePath = null; private String userSourcePath = null; @@ -68,12 +68,12 @@ public class BinarySettingData { return false; } - public String getDebugPath() { - return debugPath; + public String getDebugRpmPath() { + return debugInfoRpmPath; } - public void setDebugPath(String debugPath) { - this.debugPath = debugPath; + public void setDebugRpmPath(String debugPath) { + this.debugInfoRpmPath = debugPath; } public String getDebugFilePath() { diff --git a/org.tizen.dynamicanalyzer/src/org/tizen/dynamicanalyzer/swap/platform/BinarySettingManager.java b/org.tizen.dynamicanalyzer/src/org/tizen/dynamicanalyzer/swap/platform/BinarySettingManager.java index 9ac80c9..b319aad 100644 --- a/org.tizen.dynamicanalyzer/src/org/tizen/dynamicanalyzer/swap/platform/BinarySettingManager.java +++ b/org.tizen.dynamicanalyzer/src/org/tizen/dynamicanalyzer/swap/platform/BinarySettingManager.java @@ -87,10 +87,10 @@ public class BinarySettingManager { int size = input.size(); for (int i = 0; i < size; i++) { BinarySettingData binData = input.get(i); - if (null != binData.getDebugPath() - && !binData.getDebugPath().isEmpty()) { + if (null != binData.getDebugRpmPath() + && !binData.getDebugRpmPath().isEmpty()) { // check dir exists. - String debugPath = binData.getDebugPath(); + String debugPath = binData.getDebugRpmPath(); File debugInfoFile = new File(debugPath); if (!debugInfoFile.exists() || debugInfoFile.isDirectory()) { @@ -125,6 +125,7 @@ public class BinarySettingManager { } } + // copy debug info file String from = debugPath; String to = rpmPath + File.separator + debugInfoFile.getName(); String debugRpmPath = null; @@ -135,6 +136,7 @@ public class BinarySettingManager { continue; } + // copy debug source file if (null != debugInfoSourceRpmName && !debugInfoSourceRpmName.isEmpty()) { from = debugInfoFile.getParent() + File.separator @@ -149,8 +151,14 @@ public class BinarySettingManager { if (null != debugRpmPath) { String toolPath = AnalyzerPaths.TOOL_FOLDER_PATH + File.separator + "debuginfo.sh"; - String[] command = new String[] { toolPath, "-r", rpmPath, - debugRpmPath, debugRpmSourcePath }; + String[] command = null; + if (null != debugRpmSourcePath) { + command = new String[] { toolPath, "-r", rpmPath, + debugRpmPath, debugRpmSourcePath }; + } else { + command = new String[] { toolPath, "-d", rpmPath, + debugRpmPath }; + } try { Runtime rt = Runtime.getRuntime(); Process process = rt.exec(command); @@ -187,71 +195,122 @@ public class BinarySettingManager { } // check real debug file path - String libPostFix = libFullName.substring(index, - libFullName.length()); - String libVersion = libPostFix - .substring(4, libPostFix.length()); - String debugCmd = AnalyzerPaths.TOOL_FOLDER_PATH - + File.separator + "debuginfo.sh -f " + rpmPath + " " - + "*" + libPostFix + ".debug"; - String debugFilePath = null; - try { - Runtime rt = Runtime.getRuntime(); - Process process = rt.exec(debugCmd); - process.waitFor(); - BufferedReader reader = new BufferedReader( - new InputStreamReader(process.getInputStream())); - String line = reader.readLine(); - if (null == line) { - BufferedReader error = new BufferedReader( - new InputStreamReader(process.getErrorStream())); - String errorStr = error.readLine(); - System.out - .println("debug source file extract failed... : " - + errorStr); + String[] splitDebugPath = debugPath + .split(CommonConstants.SLASH); + 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 = AnalyzerPaths.TOOL_FOLDER_PATH + + File.separator + "debuginfo.sh -f " + rpmPath + + " " + "*" + libPostFix + ".debug"; + String debugFilePath = null; + try { + Runtime rt = Runtime.getRuntime(); + Process process = rt.exec(debugCmd); + process.waitFor(); + BufferedReader reader = new BufferedReader( + new InputStreamReader(process.getInputStream())); + String line = reader.readLine(); + if (null == line) { + BufferedReader error = new BufferedReader( + new InputStreamReader( + process.getErrorStream())); + String errorStr = error.readLine(); + System.out + .println("debug source file extract failed... : " + + errorStr); + continue; + } + debugFilePath = rpmPath + + line.substring(1, line.length()); + System.out.println("DEBUG PATH : " + debugFilePath); + } catch (IOException e) { + e.printStackTrace(); + continue; + } catch (InterruptedException e) { + e.printStackTrace(); continue; } - debugFilePath = rpmPath + line.substring(1, line.length()); - System.out.println("DEBUG PATH : " + debugFilePath); - } catch (IOException e) { - e.printStackTrace(); - continue; - } catch (InterruptedException e) { - e.printStackTrace(); - continue; - } - binData.setDebugFilePath(debugFilePath); + binData.setDebugFilePath(debugFilePath); - // check real source file path - String sourceFilePath = null; - String sourceCmd = AnalyzerPaths.TOOL_FOLDER_PATH - + File.separator + "debuginfo.sh -f " + rpmPath + " " - + "*" + libVersion; - try { - Runtime rt = Runtime.getRuntime(); - Process process = rt.exec(sourceCmd); - process.waitFor(); - BufferedReader reader = new BufferedReader( - new InputStreamReader(process.getInputStream())); - String line = reader.readLine(); - if (null == line) { - BufferedReader error = new BufferedReader( - new InputStreamReader(process.getErrorStream())); - String errorStr = error.readLine(); - System.out.println("source file path get failed.. : " - + errorStr); + // check real source file path + if (null != debugRpmSourcePath + && !debugRpmSourcePath.isEmpty()) { + String sourceFilePath = null; + String sourceCmd = AnalyzerPaths.TOOL_FOLDER_PATH + + File.separator + "debuginfo.sh -f " + rpmPath + + " " + "*" + libVersion; + try { + Runtime rt = Runtime.getRuntime(); + Process process = rt.exec(sourceCmd); + process.waitFor(); + BufferedReader reader = new BufferedReader( + new InputStreamReader( + process.getInputStream())); + String line = reader.readLine(); + if (null == line) { + BufferedReader error = new BufferedReader( + new InputStreamReader( + process.getErrorStream())); + String errorStr = error.readLine(); + System.out + .println("source file path get failed.. : " + + errorStr); + continue; + } + sourceFilePath = rpmPath; + System.out.println("SOURCE PATH : " + + sourceFilePath); + } catch (IOException e) { + e.printStackTrace(); + continue; + } catch (InterruptedException e) { + e.printStackTrace(); + continue; + } + binData.setDebugSourcePath(sourceFilePath); + } else { + binData.setDebugSourcePath(CommonConstants.EMPTY); + } + } else if (debugFileName.contains("debug-")) { + String debugCmd = AnalyzerPaths.TOOL_FOLDER_PATH + + File.separator + "debuginfo.sh -f " + rpmPath + + CommonConstants.SPACE + libFullName; + String debugFilePath = null; + try { + Runtime rt = Runtime.getRuntime(); + Process process = rt.exec(debugCmd); + process.waitFor(); + BufferedReader reader = new BufferedReader( + new InputStreamReader(process.getInputStream())); + String line = reader.readLine(); + if (null == line) { + BufferedReader error = new BufferedReader( + new InputStreamReader( + process.getErrorStream())); + String errorStr = error.readLine(); + System.out + .println("debug source file extract failed... : " + + errorStr); + continue; + } + debugFilePath = rpmPath + + line.substring(1, line.length()); + System.out.println("DEBUG PATH : " + debugFilePath); + } catch (IOException e) { + e.printStackTrace(); + continue; + } catch (InterruptedException e) { + e.printStackTrace(); continue; } - sourceFilePath = rpmPath; - System.out.println("SOURCE PATH : " + sourceFilePath); - } catch (IOException e) { - e.printStackTrace(); - continue; - } catch (InterruptedException e) { - e.printStackTrace(); - continue; + binData.setDebugFilePath(debugFilePath); + } else { + binData.setDebugFilePath(CommonConstants.EMPTY); } - binData.setDebugSourcePath(sourceFilePath); } } diff --git a/org.tizen.dynamicanalyzer/src/org/tizen/dynamicanalyzer/swap/platform/ui/BinaryAddDialog.java b/org.tizen.dynamicanalyzer/src/org/tizen/dynamicanalyzer/swap/platform/ui/BinaryAddDialog.java deleted file mode 100644 index 5fcd8cb..0000000 --- a/org.tizen.dynamicanalyzer/src/org/tizen/dynamicanalyzer/swap/platform/ui/BinaryAddDialog.java +++ /dev/null @@ -1,518 +0,0 @@ -/* - * Dynamic Analyzer - * - * Copyright (c) 2013 Samsung Electronics Co., Ltd. All rights reserved. - * - * Contact: - * Jooyoul Lee - * Juyoung Kim - * - * 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.swap.platform.ui; - -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.eclipse.swt.SWT; -import org.eclipse.swt.events.ControlEvent; -import org.eclipse.swt.events.ControlListener; -import org.eclipse.swt.events.KeyEvent; -import org.eclipse.swt.events.KeyListener; -import org.eclipse.swt.events.PaintEvent; -import org.eclipse.swt.events.PaintListener; -import org.eclipse.swt.graphics.Rectangle; -import org.eclipse.swt.layout.FormAttachment; -import org.eclipse.swt.layout.FormData; -import org.eclipse.swt.layout.FormLayout; -import org.eclipse.swt.widgets.Composite; -import org.eclipse.swt.widgets.Label; -import org.eclipse.swt.widgets.Shell; -import org.eclipse.swt.widgets.Text; -import org.tizen.dynamicanalyzer.common.AnalyzerPaths; -import org.tizen.dynamicanalyzer.common.CommonConstants; -import org.tizen.dynamicanalyzer.common.DesignConstants; -import org.tizen.dynamicanalyzer.common.PathManager; -import org.tizen.dynamicanalyzer.nl.AnalyzerLabels; -import org.tizen.dynamicanalyzer.resources.ColorResources; -import org.tizen.dynamicanalyzer.swap.platform.ui.DeviceExplorer.DeviceExplorerDilaog; -import org.tizen.dynamicanalyzer.swap.platform.ui.FileExplorer.FileExplorerDialog; -import org.tizen.dynamicanalyzer.ui.widgets.DAButton; -import org.tizen.dynamicanalyzer.ui.widgets.DAMessageBox; -import org.tizen.dynamicanalyzer.utils.AnalyzerUtil; -import org.tizen.dynamicanalyzer.widgets.button.DACustomButton; -import org.tizen.dynamicanalyzer.widgets.button.DACustomButtonClickEventListener; -import org.tizen.sdblib.service.FileEntry; - -public class BinaryAddDialog extends DAMessageBox { - - private Text binaryText = null; - private Text sourceText = null; - private Text debugPackageText = null; - - private DAButton findButton = null; - private DAButton findPackageButton = null; - private DAButton findSourceButton = null; - private DAButton okButton = null; - private DAButton cancelButton = null; - - private String binaryStr = CommonConstants.EMPTY; - private String debutStr = CommonConstants.EMPTY; - - public BinaryAddDialog(Shell parentShell) { - super(parentShell); - } - - public BinaryAddDialog(Shell parentShell, String binary, String debug) { - super(parentShell); - - binaryStr = binary; - debutStr = debug; - } - - private DACustomButtonClickEventListener findButtonListener = new DACustomButtonClickEventListener() { - - @Override - public void handleClickEvent(DACustomButton button) { - DeviceExplorerDilaog dialog = new DeviceExplorerDilaog(shell); - if (!binaryText.getText().isEmpty()) { - dialog.getExplorer().setCurrent(binaryText.getText()); - } - Object result = dialog.open(); - if (result != null) { - FileEntry entry = (FileEntry) result; - binaryText.setText(entry.getFullPath()); - okButton.setButtonEnabled(true); - debugPackageText.setEnabled(true); - findPackageButton.setButtonEnabled(true); - if (!debugPackageText.getText().isEmpty()) { - sourceText.setEnabled(true); - findSourceButton.setButtonEnabled(true); - } - - String debugPath = getDebugInfoPath(binaryText.getText()); - if (null != debugPath) { - debugPackageText.setText(debugPath); - sourceText.setEnabled(true); - findSourceButton.setButtonEnabled(true); - } - } - } - }; - - private DACustomButtonClickEventListener findDebugButtonListener = new DACustomButtonClickEventListener() { - - @Override - public void handleClickEvent(DACustomButton button) { - FileExplorerDialog dialog = new FileExplorerDialog(shell); - dialog.getExplorer().setRoot(PathManager.getRootStrapsPath()); - if (!debugPackageText.getText().isEmpty()) { - dialog.getExplorer().setCurrent(debugPackageText.getText()); - } - Object result = dialog.open(); - if (result != null) { - File file = (File) result; - debugPackageText.setText(file.getAbsolutePath()); - sourceText.setEnabled(true); - findSourceButton.setButtonEnabled(true); - } - } - }; - - private DACustomButtonClickEventListener findSourceButtonListener = new DACustomButtonClickEventListener() { - - @Override - public void handleClickEvent(DACustomButton button) { - FileExplorerDialog dialog = new FileExplorerDialog(shell); -// dialog.getExplorer().setReturnDirectory(true); - dialog.getExplorer().setRoot("/home/"); - if (!sourceText.getText().isEmpty()) { - dialog.getExplorer().setCurrent(sourceText.getText()); - } - Object result = dialog.open(); - if (result != null) { - File file = (File) result; - sourceText.setText(file.getAbsolutePath()); - } - } - }; - - private DACustomButtonClickEventListener okButtonListener = new DACustomButtonClickEventListener() { - - @Override - public void handleClickEvent(DACustomButton button) { - List paths = new ArrayList(); - paths.add(binaryText.getText()); - paths.add(debugPackageText.getText()); - paths.add(sourceText.getText()); - result = paths; - shell.dispose(); - } - }; - - private DACustomButtonClickEventListener cancelButtonListener = new DACustomButtonClickEventListener() { - - @Override - public void handleClickEvent(DACustomButton button) { - shell.dispose(); - } - }; - - private KeyListener binaryKeyListener = new KeyListener() { - - @Override - public void keyReleased(KeyEvent e) { - if (binaryText.getText().isEmpty()) { - okButton.setButtonEnabled(false); - debugPackageText.setEnabled(false); - findPackageButton.setButtonEnabled(false); - sourceText.setEnabled(false); - findSourceButton.setButtonEnabled(false); - } else { - okButton.setButtonEnabled(true); - debugPackageText.setEnabled(true); - findPackageButton.setButtonEnabled(true); - if (!debugPackageText.getText().isEmpty()) { - sourceText.setEnabled(true); - findSourceButton.setButtonEnabled(true); - } - } - System.out.println("key " + e.keyCode); - if (!binaryText.getText().isEmpty() && e.keyCode == 13) // enter - { - String debugPath = getDebugInfoPath(binaryText.getText()); - if (null != debugPath) { - debugPackageText.setText(debugPath); - sourceText.setEnabled(true); - findSourceButton.setButtonEnabled(true); - } - } - } - - @Override - public void keyPressed(KeyEvent e) { - - } - }; - - private KeyListener debugKeyListener = new KeyListener() { - - @Override - public void keyReleased(KeyEvent e) { - if (debugPackageText.getText().isEmpty()) { - sourceText.setEnabled(false); - findSourceButton.setButtonEnabled(false); - } else { - sourceText.setEnabled(true); - findSourceButton.setButtonEnabled(true); - } - } - - @Override - public void keyPressed(KeyEvent e) { - - } - }; - - protected boolean run() { - shell.setLayout(new FormLayout()); - shell.setSize(446, 300); - shell.setBackground(ColorResources.DIALOG_BG_UPPER); - shell.setText("Add Binary Setting"); - AnalyzerUtil.setCenter(shell); - - Label label = new Label(shell, SWT.TRANSPARENT); - FormData data = new FormData(); - data.top = new FormAttachment(0, 11); - data.left = new FormAttachment(0, 12); - data.height = 15; - data.width = 150; - label.setLayoutData(data); - label.setForeground(ColorResources.BLACK); - label.setText("Binary Path"); - label.setBackground(ColorResources.DIALOG_BG_UPPER); - - binaryText = new Text(shell, SWT.SINGLE); - data = new FormData(); - data.top = new FormAttachment(label, 5); - data.left = new FormAttachment(0, 12); - data.height = 24; - data.width = 330; - binaryText.setLayoutData(data); - binaryText.setBackground(ColorResources.WHITE); - binaryText.addKeyListener(binaryKeyListener); - binaryText.setText(binaryStr); - binaryText.addPaintListener(new PaintListener() { - - @Override - public void paintControl(PaintEvent e) { - e.gc.setForeground(ColorResources.BUTTON_OUTLINE_HOVER_IN_COLOR); - Text text = (Text) e.widget; - Rectangle rect = text.getClientArea(); - e.gc.drawRectangle(rect.x, rect.y, rect.width - 1, - rect.height - 1); - // e.gc.drawRectangle(rect.x+1, rect.y+1, rect.width -3, - // rect.height - 3); - } - }); - - findButton = new DAButton(shell, SWT.NONE); - data = new FormData(); - data.top = new FormAttachment(label, 4); - data.left = new FormAttachment(binaryText, 5); - data.height = 30; - data.width = 80; - findButton.setLayoutData(data); - findButton.setText("Find file"); - findButton.addClickListener(findButtonListener); - - Label debugLabel = new Label(shell, SWT.TRANSPARENT); - data = new FormData(); - data.top = new FormAttachment(binaryText, 15); - data.left = new FormAttachment(0, 12); - data.height = 15; - data.width = 150; - debugLabel.setLayoutData(data); - debugLabel.setForeground(ColorResources.BLACK); - debugLabel.setText("Debug directory path"); - debugLabel.setBackground(ColorResources.DIALOG_BG_UPPER); - - debugPackageText = new Text(shell, SWT.SINGLE); - data = new FormData(); - data.top = new FormAttachment(debugLabel, 5); - data.left = new FormAttachment(0, 12); - data.height = 26; - data.width = 330; - debugPackageText.setLayoutData(data); - debugPackageText.setBackground(ColorResources.WHITE); - debugPackageText.addKeyListener(debugKeyListener); - debugPackageText.setText(debutStr); - - debugPackageText.addPaintListener(new PaintListener() { - - @Override - public void paintControl(PaintEvent e) { - e.gc.setForeground(ColorResources.BUTTON_OUTLINE_HOVER_IN_COLOR); - Text text = (Text) e.widget; - Rectangle rect = text.getClientArea(); - e.gc.drawRectangle(rect.x, rect.y, rect.width - 1, - rect.height - 1); - // e.gc.drawRectangle(rect.x+1, rect.y+1, rect.width -3, - // rect.height - 3); - } - }); - - findPackageButton = new DAButton(shell, SWT.NONE); - data = new FormData(); - data.top = new FormAttachment(debugLabel, 4); - data.left = new FormAttachment(debugPackageText, 5); - data.height = 30; - data.width = 80; - findPackageButton.setLayoutData(data); - findPackageButton.setText("Find file"); - findPackageButton.addClickListener(findDebugButtonListener); - - Label sourceLabel = new Label(shell, SWT.TRANSPARENT); - data = new FormData(); - data.top = new FormAttachment(debugPackageText, 15); - data.left = new FormAttachment(0, 12); - data.height = 15; - data.width = 200; - sourceLabel.setLayoutData(data); - sourceLabel.setForeground(ColorResources.BLACK); - sourceLabel.setText("User defined source directory"); - sourceLabel.setBackground(ColorResources.DIALOG_BG_UPPER); - - sourceText = new Text(shell, SWT.SINGLE); - data = new FormData(); - data.top = new FormAttachment(sourceLabel, 5); - data.left = new FormAttachment(0, 12); - data.height = 26; - data.width = 330; - sourceText.setLayoutData(data); - sourceText.setBackground(ColorResources.WHITE); - sourceText.addPaintListener(new PaintListener() { - - @Override - public void paintControl(PaintEvent e) { - e.gc.setForeground(ColorResources.BUTTON_OUTLINE_HOVER_IN_COLOR); - Text text = (Text) e.widget; - Rectangle rect = text.getClientArea(); - e.gc.drawRectangle(rect.x, rect.y, rect.width - 1, - rect.height - 1); - } - }); - - findSourceButton = new DAButton(shell, SWT.NONE); - data = new FormData(); - data.top = new FormAttachment(sourceLabel, 4); - data.left = new FormAttachment(debugPackageText, 5); - data.height = 30; - data.width = 80; - findSourceButton.setLayoutData(data); - findSourceButton.setText("Find Dir"); - findSourceButton.addClickListener(findSourceButtonListener); - - Composite buttonComp = new Composite(shell, SWT.NONE); - buttonComp.setLayout(new FormLayout()); - buttonComp.setBackground(ColorResources.DIALOG_BG_LOWER); - - buttonComp.addPaintListener(new PaintListener() { - - @Override - public void paintControl(PaintEvent e) { - Composite comp = (Composite) e.widget; - Rectangle rect = comp.getClientArea(); - e.gc.setForeground(ColorResources.DIALOG_SUNKEN_1); - e.gc.drawLine(rect.x, rect.y, rect.x + rect.width, rect.y); - e.gc.setForeground(ColorResources.DIALOG_SUNKEN_2); - e.gc.drawLine(rect.x, rect.y + 1, rect.x + rect.width, - rect.y + 1); - } - }); - - FormData compData = new FormData(); - compData.top = new FormAttachment(sourceText, 20); - compData.left = new FormAttachment(0, 0); - compData.right = new FormAttachment(100, 0); - compData.bottom = new FormAttachment(100, 0); - buttonComp.setLayoutData(compData); - - okButton = new DAButton(buttonComp, SWT.NONE); - data = new FormData(); - data.top = new FormAttachment(0, 11); - data.left = new FormAttachment(50, -DesignConstants.DA_BUTTON_WIDTH - 4); - data.height = DesignConstants.DA_BUTTON_HEIGHT; - data.width = DesignConstants.DA_BUTTON_WIDTH; - okButton.setLayoutData(data); - okButton.setText(AnalyzerLabels.OK); - okButton.addClickListener(okButtonListener); - if (binaryText.getText().isEmpty()) { - okButton.setButtonEnabled(false); - } - - cancelButton = new DAButton(buttonComp, SWT.NONE); - data = new FormData(); - data.top = new FormAttachment(0, 11); - data.left = new FormAttachment(50, 4); - data.height = DesignConstants.DA_BUTTON_HEIGHT; - data.width = DesignConstants.DA_BUTTON_WIDTH; - cancelButton.setLayoutData(data); - cancelButton.setText(AnalyzerLabels.CANCEL); - cancelButton.addClickListener(cancelButtonListener); - - shell.addControlListener(new ControlListener() { - - @Override - public void controlResized(ControlEvent e) { - if (binaryText.getText().isEmpty()) { - debugPackageText.setEnabled(false); - findPackageButton.setButtonEnabled(false); - sourceText.setEnabled(false); - findSourceButton.setButtonEnabled(false); - } else { - debugPackageText.setEnabled(true); - findPackageButton.setButtonEnabled(true); - sourceText.setEnabled(true); - findSourceButton.setButtonEnabled(true); - } - - if (debugPackageText.getText().isEmpty()) { - sourceText.setEnabled(false); - findSourceButton.setButtonEnabled(false); - } else { - sourceText.setEnabled(true); - findSourceButton.setButtonEnabled(true); - } - } - - @Override - public void controlMoved(ControlEvent e) { - } - }); - - return true; - } - - private String getDebugInfoPath(String libPath) { - String[] splitTargetLib = libPath.split(CommonConstants.SLASH); - String libFullName = splitTargetLib[splitTargetLib.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 lines = new ArrayList(); - String toolPath = AnalyzerPaths.TOOL_FOLDER_PATH + File.separator - + "debuginfo.sh"; - String[] command = new String[] { toolPath, "-f", rootstrapPath, - 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; - } - } - - String debugPath = null; - if (null == select) { - return null; - } else { - select = select.substring(1, select.length()); - debugPath = rootstrapPath + select; - } - return debugPath; - } -} diff --git a/org.tizen.dynamicanalyzer/src/org/tizen/dynamicanalyzer/swap/platform/ui/BinarySettingProcessor.java b/org.tizen.dynamicanalyzer/src/org/tizen/dynamicanalyzer/swap/platform/ui/BinarySettingProcessor.java index 04118d0..bdc30af 100644 --- a/org.tizen.dynamicanalyzer/src/org/tizen/dynamicanalyzer/swap/platform/ui/BinarySettingProcessor.java +++ b/org.tizen.dynamicanalyzer/src/org/tizen/dynamicanalyzer/swap/platform/ui/BinarySettingProcessor.java @@ -75,7 +75,7 @@ public class BinarySettingProcessor implements Runnable { BinarySettingData binaryData = new BinarySettingData(); binaryData.setBinaryPath(entry.getFullPath()); - binaryData.setDebugPath(AnalyzerUtil.getDebugInfoPath( + binaryData.setDebugRpmPath(AnalyzerUtil.getDebugInfoPath( entry.getFullPath(), page.getDebugRootPath())); addBinData.add(binaryData); if (addBinData.size() < 40) { @@ -135,12 +135,17 @@ public class BinarySettingProcessor implements Runnable { BinarySettingProgressManager.getInstance() .setValue(count++); } - if (null == binData.getDebugPath() || binData.getDebugPath().isEmpty()) { + if (null == binData.getDebugRpmPath() + || binData.getDebugRpmPath().isEmpty()) { String debugPath = AnalyzerUtil.getDebugInfoPath( binData.getBinaryPath(), page.getDebugRootPath()); - binData.setDebugPath(debugPath); + binData.setDebugRpmPath(debugPath); } } + BinarySettingProgressManager.getInstance().setValue(50); + BinarySettingManager.getInstance().checkSourcePath(binarySettings); + BinarySettingProgressManager.getInstance().setValue(70); + Display.getDefault().syncExec(new Runnable() { @Override public void run() { diff --git a/org.tizen.dynamicanalyzer/src/org/tizen/dynamicanalyzer/swap/platform/ui/DeviceExplorer/DeviceExplorer.java b/org.tizen.dynamicanalyzer/src/org/tizen/dynamicanalyzer/swap/platform/ui/DeviceExplorer/DeviceExplorer.java index dfd65ea..8d7cd54 100644 --- a/org.tizen.dynamicanalyzer/src/org/tizen/dynamicanalyzer/swap/platform/ui/DeviceExplorer/DeviceExplorer.java +++ b/org.tizen.dynamicanalyzer/src/org/tizen/dynamicanalyzer/swap/platform/ui/DeviceExplorer/DeviceExplorer.java @@ -33,6 +33,8 @@ import org.eclipse.nebula.widgets.grid.Grid; import org.eclipse.nebula.widgets.grid.GridColumn; import org.eclipse.nebula.widgets.grid.GridItem; import org.eclipse.swt.SWT; +import org.eclipse.swt.events.FocusEvent; +import org.eclipse.swt.events.FocusListener; import org.eclipse.swt.events.KeyEvent; import org.eclipse.swt.events.KeyListener; import org.eclipse.swt.events.MouseEvent; @@ -58,6 +60,7 @@ import org.tizen.dynamicanalyzer.widgets.button.DACustomButton; import org.tizen.dynamicanalyzer.widgets.button.DACustomButtonClickEventListener; import org.tizen.sdblib.IDevice; import org.tizen.sdblib.service.FileEntry; +import org.tizen.sdblib.service.FileEntryType; public class DeviceExplorer extends Composite { protected static int FAIL = -1; @@ -90,6 +93,10 @@ public class DeviceExplorer extends Composite { selected = file; inputText.setText(selected.getFullPath()); inputText.setBackground(ColorResources.WHITE); + + int length = inputText.getText().length(); + inputText.setSelection(length, length); + info.setText(CommonConstants.EMPTY); } @@ -129,15 +136,17 @@ public class DeviceExplorer extends Composite { String path = inputText.getText(); if (null == path || path.isEmpty()) { System.out.println("path must not empty"); - inputText.setBackground(ColorResources.RED); - info.setText("Empty path"); + // inputText.setBackground(ColorResources.RED); + // info.setText("Empty path"); + inputText.setText(current.getFullPath()); return; } if (!path.contains(root.getFullPath())) { System.out.println("Out of root range"); - inputText.setBackground(ColorResources.RED); - info.setText("Out of root range"); + // inputText.setBackground(ColorResources.RED); + // info.setText("Out of root range"); + inputText.setText(current.getFullPath()); return; } @@ -145,8 +154,9 @@ public class DeviceExplorer extends Composite { if (ret != FAIL) { inputText.setBackground(ColorResources.WHITE); } else { - inputText.setBackground(ColorResources.RED); - info.setText("Invalid path"); + // inputText.setBackground(ColorResources.RED); + // info.setText("Invalid path"); + inputText.setText(current.getFullPath()); } } }; @@ -166,6 +176,24 @@ public class DeviceExplorer extends Composite { } }; + private FocusListener inputTextFocusListener = new FocusListener() { + + @Override + public void focusLost(FocusEvent e) { + // TODO Auto-generated method stub + + } + + @Override + public void focusGained(FocusEvent e) { + GridItem[] selections = new GridItem[0]; + table.setSelection(selections); + + int length = inputText.getText().length(); + inputText.setSelection(0, length); + } + }; + public DeviceExplorer(Composite parent) { super(parent, SWT.NONE); this.setLayout(new FormLayout()); @@ -179,6 +207,7 @@ public class DeviceExplorer extends Composite { data.height = 18; inputText.setLayoutData(data); inputText.addKeyListener(inputKeyListener); + inputText.addFocusListener(inputTextFocusListener); goButton = new DAButton(this, SWT.NONE); data = new FormData(); @@ -344,6 +373,13 @@ public class DeviceExplorer extends Composite { .getData(ExplorerUtil.DATA_FIEL_KEY); fileEntries.add(entry); } + } else if (null != inputText.getText() + && !inputText.getText().isEmpty()) { + String path = inputText.getText(); + FileEntry file = device.getFileEntry(path); + if (null != file) { + fileEntries.add(file); + } } return fileEntries; } @@ -356,10 +392,10 @@ public class DeviceExplorer extends Composite { int result = FAIL; if (null != path && !path.isEmpty()) { FileEntry file = device.getFileEntry(path); - if (file == null) { + if (file == null || file.getType() == FileEntryType.Unknown) { System.out.println("invalid path"); return result; - } else if (!file.isDirectory() || !file.isRoot()) { + } else if (!file.isDirectory() && !file.isRoot()) { current = file.getParent(); selectionStr = file.getFullPath(); result = FILE; diff --git a/org.tizen.dynamicanalyzer/src/org/tizen/dynamicanalyzer/swap/platform/ui/FileExplorer/DAFileExplorer.java b/org.tizen.dynamicanalyzer/src/org/tizen/dynamicanalyzer/swap/platform/ui/FileExplorer/DAFileExplorer.java index d893723..ad45b6d 100644 --- a/org.tizen.dynamicanalyzer/src/org/tizen/dynamicanalyzer/swap/platform/ui/FileExplorer/DAFileExplorer.java +++ b/org.tizen.dynamicanalyzer/src/org/tizen/dynamicanalyzer/swap/platform/ui/FileExplorer/DAFileExplorer.java @@ -34,6 +34,8 @@ import org.eclipse.nebula.widgets.grid.Grid; import org.eclipse.nebula.widgets.grid.GridColumn; import org.eclipse.nebula.widgets.grid.GridItem; import org.eclipse.swt.SWT; +import org.eclipse.swt.events.FocusEvent; +import org.eclipse.swt.events.FocusListener; import org.eclipse.swt.events.KeyEvent; import org.eclipse.swt.events.KeyListener; import org.eclipse.swt.events.MouseEvent; @@ -84,8 +86,14 @@ public class DAFileExplorer extends Composite { File file = (File) selection.getData(ExplorerUtil.DATA_FIEL_KEY); System.out.println("Selected : " + file.getAbsolutePath()); selected = file; - inputText.setText(selected.getAbsolutePath()); + + String path = selected.getAbsolutePath(); + inputText.setText(path); inputText.setBackground(ColorResources.WHITE); + + int length = path.length(); + inputText.setSelection(length, length); + info.setText(CommonConstants.EMPTY); } @@ -125,15 +133,17 @@ public class DAFileExplorer extends Composite { String path = inputText.getText(); if (null == path || path.isEmpty()) { System.out.println("path must not empty"); - inputText.setBackground(ColorResources.RED); - info.setText("Empty path"); + // inputText.setBackground(ColorResources.RED); + // info.setText("Empty path"); + inputText.setText(current.getAbsolutePath()); return; } if (!path.contains(root.getAbsolutePath())) { System.out.println("Out of root range"); - inputText.setBackground(ColorResources.RED); - info.setText("Out of root range"); + // inputText.setBackground(ColorResources.RED); + // info.setText("Out of root range"); + inputText.setText(current.getAbsolutePath()); return; } @@ -141,8 +151,9 @@ public class DAFileExplorer extends Composite { if (ret != FAIL) { inputText.setBackground(ColorResources.WHITE); } else { - inputText.setBackground(ColorResources.RED); - info.setText("Invalid path"); + // inputText.setBackground(ColorResources.RED); + inputText.setText(current.getAbsolutePath()); + // info.setText("Invalid path"); } } }; @@ -162,6 +173,24 @@ public class DAFileExplorer extends Composite { } }; + private FocusListener inputTextFocusListener = new FocusListener() { + + @Override + public void focusLost(FocusEvent e) { + // TODO Auto-generated method stub + + } + + @Override + public void focusGained(FocusEvent e) { + GridItem[] selections = new GridItem[0]; + table.setSelection(selections); + + int length = inputText.getText().length(); + inputText.setSelection(0, length); + } + }; + public DAFileExplorer(Composite parent) { super(parent, SWT.NONE); this.setLayout(new FormLayout()); @@ -175,6 +204,7 @@ public class DAFileExplorer extends Composite { data.height = 18; inputText.setLayoutData(data); inputText.addKeyListener(inputKeyListener); + inputText.addFocusListener(inputTextFocusListener); goButton = new DAButton(this, SWT.NONE); data = new FormData(); @@ -337,6 +367,13 @@ public class DAFileExplorer extends Composite { .getData(ExplorerUtil.DATA_FIEL_KEY); files.add(entry); } + } else if (null != inputText.getText() + && !inputText.getText().isEmpty()) { + String path = inputText.getText(); + File file = new File(path); + if (null != file && file.exists()) { + files.add(file); + } } return files; } diff --git a/org.tizen.dynamicanalyzer/src/org/tizen/dynamicanalyzer/ui/toolbar/configuration/BinarySettingsPage.java b/org.tizen.dynamicanalyzer/src/org/tizen/dynamicanalyzer/ui/toolbar/configuration/BinarySettingsPage.java index 72e9ff3..d97805f 100644 --- a/org.tizen.dynamicanalyzer/src/org/tizen/dynamicanalyzer/ui/toolbar/configuration/BinarySettingsPage.java +++ b/org.tizen.dynamicanalyzer/src/org/tizen/dynamicanalyzer/ui/toolbar/configuration/BinarySettingsPage.java @@ -136,7 +136,7 @@ public class BinarySettingsPage extends DAPageComposite { BinarySettingData binaryData = new BinarySettingData(); binaryData.setBinaryPath(inputRow.getBinaryText()); - binaryData.setDebugPath(inputRow.getDebugText()); + binaryData.setDebugRpmPath(inputRow.getDebugText()); binaryData.setUserSourcePath(inputRow.getSourceText()); binarySettings.add(binaryData); } @@ -173,11 +173,12 @@ public class BinarySettingsPage extends DAPageComposite { } rootPath = file.getAbsolutePath(); } - } - if (null != rootPath) { - BinarySettingProgressManager.getInstance().startProcessStart( - "Wait for update debug path"); - BinarySettingProcessor.runUpdateDebugRoot(me); + + if (null != rootPath) { + BinarySettingProgressManager.getInstance() + .startProcessStart("Wait for update debug path"); + BinarySettingProcessor.runUpdateDebugRoot(me); + } } } }; @@ -358,7 +359,7 @@ public class BinarySettingsPage extends DAPageComposite { String source = inputRow.getSourceText(); BinarySettingData binData = BinarySettingManager.getInstance() .getRealBinarySetting(binary); - binData.setDebugPath(debug); + binData.setDebugRpmPath(debug); binData.setUserSourcePath(source); } @@ -372,87 +373,28 @@ public class BinarySettingsPage extends DAPageComposite { for (int i = 0; i < binData.size(); i++) { InputRow inputRow = new InputRow(inputComposite); inputRow.setBinaryText(binData.get(i).getBinaryPath()); - String debug = binData.get(i).getDebugPath(); + String debug = binData.get(i).getDebugFilePath(); if (null != debug && !debug.isEmpty()) { inputRow.setDebugText(debug); + } else { + inputRow.setDebugText(CommonConstants.EMPTY); } String source = binData.get(i).getUserSourcePath(); + String debugSource = binData.get(i).getDebugSourcePath(); if (null != source && !source.isEmpty()) { inputRow.setSourceText(source); + } else if (null != debugSource && !debugSource.isEmpty()) { + inputRow.setSourceText(debugSource); + } else { + inputRow.setSourceText(CommonConstants.EMPTY); } inputRowHash.put(binData.get(i).getBinaryPath(), inputRow); inputRowList.add(inputRow); } - // inputComposite.layout(); - // scrolledComposite.setMinSize(inputComposite.computeSize(SWT.DEFAULT, - // SWT.DEFAULT)); updateLayout(); } - // private String getDebugInfoPath(String libPath) { - // String[] splitTargetLib = libPath.split(CommonConstants.SLASH); - // String libFullName = splitTargetLib[splitTargetLib.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 lines = new ArrayList(); - // String toolPath = AnalyzerPaths.TOOL_FOLDER_PATH + File.separator - // + "debuginfo.sh"; - // String[] command = new String[] { toolPath, "-f", rootstrapPath, - // 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; - // } - // } - // - // String debugPath = null; - // if (null == select) { - // return null; - // } else { - // select = select.substring(1, select.length()); - // debugPath = rootstrapPath + select; - // } - // return debugPath; - // } - public void updateLayout() { int count = BinarySettingManager.getInstance().getRealBinarySettings() .size(); diff --git a/org.tizen.dynamicanalyzer/src/org/tizen/dynamicanalyzer/ui/widgets/table/DAWindowingTableComposite.java b/org.tizen.dynamicanalyzer/src/org/tizen/dynamicanalyzer/ui/widgets/table/DAWindowingTableComposite.java index cc76d0e..c08ec6b 100644 --- a/org.tizen.dynamicanalyzer/src/org/tizen/dynamicanalyzer/ui/widgets/table/DAWindowingTableComposite.java +++ b/org.tizen.dynamicanalyzer/src/org/tizen/dynamicanalyzer/ui/widgets/table/DAWindowingTableComposite.java @@ -60,6 +60,7 @@ import org.tizen.dynamicanalyzer.swap.model.data.LogData; import org.tizen.dynamicanalyzer.swap.model.data.LogDataFactory; import org.tizen.dynamicanalyzer.ui.common.PopupAnalysisMenuItemClickListener; import org.tizen.dynamicanalyzer.ui.range.RangeDataManager; +import org.tizen.dynamicanalyzer.ui.widgets.DAGrid; import org.tizen.dynamicanalyzer.ui.widgets.FindDialog; import org.tizen.dynamicanalyzer.utils.AnalyzerUtil; import org.tizen.dynamicanalyzer.widgets.popupMenu.DAPopupMenu; @@ -139,7 +140,7 @@ public abstract class DAWindowingTableComposite extends Composite { scrollbar.setVisible(false); scrollbar.addSelectionListener(scrollbarSelectionListener); - table = new Grid(scrollComp, tableStyle); + table = new DAGrid(scrollComp, tableStyle); table.setHeaderVisible(true); table.setLinesVisible(true); table.setLineColor(ColorResources.TABLE_LINE); diff --git a/org.tizen.dynamicanalyzer/src/org/tizen/dynamicanalyzer/utils/AnalyzerUtil.java b/org.tizen.dynamicanalyzer/src/org/tizen/dynamicanalyzer/utils/AnalyzerUtil.java index 02137dc..18978ba 100755 --- a/org.tizen.dynamicanalyzer/src/org/tizen/dynamicanalyzer/utils/AnalyzerUtil.java +++ b/org.tizen.dynamicanalyzer/src/org/tizen/dynamicanalyzer/utils/AnalyzerUtil.java @@ -1146,11 +1146,11 @@ public class AnalyzerUtil { public static String getFuncName(ProfileData input) { long pcAddr = input.getPcAddr(); -// HashMap funcNameMap = AnalyzerManager.getFuncNameMap(); -// String functionName = funcNameMap.get(pcAddr); -// if (null != functionName) { -// return functionName; -// } + // HashMap funcNameMap = AnalyzerManager.getFuncNameMap(); + // String functionName = funcNameMap.get(pcAddr); + // if (null != functionName) { + // return functionName; + // } String functionName = null; ProcessInfoPackage processInfoPkg = AnalyzerManager.getProject() @@ -1159,15 +1159,15 @@ public class AnalyzerUtil { .getProcessInfo(input.getTime()); /** for debug */ -// BinaryInfo binInfo1 = processInfo.getTargetBinary(input.getPcAddr()); -// 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(); + // BinaryInfo binInfo1 = processInfo.getTargetBinary(input.getPcAddr()); + // 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()) { @@ -1252,13 +1252,10 @@ public class AnalyzerUtil { return functionName; } - // public static String getTargetPathKey(String targetPath) { - // String[] splitTargetPath = targetPath.split(CommonConstants.SLASH); - // String libName = splitTargetPath[splitTargetPath.length - 1]; - // return libName; - // } - 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)) { @@ -1295,7 +1292,7 @@ public class AnalyzerUtil { new InputStreamReader(process.getErrorStream())); String errorStr = error.readLine(); System.out.println("find debug info path fail.. " + errorStr); - return null; + isDebugInfo = false; } } catch (IOException e) { e.printStackTrace(); @@ -1305,6 +1302,43 @@ public class AnalyzerUtil { return null; } + if (!isDebugInfo) { + String libVersion = libFullName.substring(index + 4, + libFullName.length()); + 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) { @@ -1314,7 +1348,6 @@ public class AnalyzerUtil { } } - String debugPath = null; if (null == select) { return null; } else { -- 2.7.4