org.eclipse.linuxtools.gcov_4.1.1.201310101546

16:46:06.305 INFO  jd.cli.Main - Decompiling org.eclipse.linuxtools.gcov_4.1.1.201310101546.jar
package org.eclipse.linuxtools.gcov;

import org.eclipse.jface.resource.ImageDescriptor;
import org.eclipse.ui.plugin.AbstractUIPlugin;
import org.osgi.framework.BundleContext;

public class Activator
  extends AbstractUIPlugin
{
  public static final String PLUGIN_ID = "org.eclipse.linuxtools.gcov";
  private static Activator plugin;
  
  public void start(BundleContext context)
    throws Exception
  {
    super.start(context);
    plugin = this;
  }
  
  public void stop(BundleContext context)
    throws Exception
  {
    plugin = null;
    super.stop(context);
  }
  
  public static Activator getDefault()
  {
    return plugin;
  }
  
  public static ImageDescriptor getImageDescriptor(String path)
  {
    return imageDescriptorFromPlugin("org.eclipse.linuxtools.gcov", path);
  }
}

/* Location:
 * Qualified Name:     org.eclipse.linuxtools.gcov.Activator
 * Java Class Version: 6 (50.0)
 * JD-Core Version:    0.7.1
 */
package org.eclipse.linuxtools.gcov.action;

import java.io.BufferedReader;
import java.io.File;
import java.io.FileNotFoundException;
import java.io.FileReader;
import java.io.IOException;
import org.eclipse.cdt.core.model.CModelException;
import org.eclipse.cdt.core.model.CoreModel;
import org.eclipse.cdt.core.model.IBinary;
import org.eclipse.cdt.core.model.IBinaryContainer;
import org.eclipse.cdt.core.model.ICProject;
import org.eclipse.core.resources.IFile;
import org.eclipse.core.resources.IProject;
import org.eclipse.core.resources.IResource;
import org.eclipse.core.resources.IWorkspace;
import org.eclipse.core.resources.IWorkspaceRoot;
import org.eclipse.core.resources.ResourcesPlugin;
import org.eclipse.core.runtime.ILog;
import org.eclipse.core.runtime.IPath;
import org.eclipse.core.runtime.Status;
import org.eclipse.jface.dialogs.MessageDialog;
import org.eclipse.linuxtools.gcov.Activator;
import org.eclipse.linuxtools.gcov.dialog.OpenGCDialog;
import org.eclipse.linuxtools.gcov.view.CovView;
import org.eclipse.swt.widgets.Display;
import org.eclipse.swt.widgets.Shell;
import org.eclipse.ui.IEditorLauncher;
import org.eclipse.ui.IWorkbench;
import org.eclipse.ui.PlatformUI;

public class OpenGCAction
  implements IEditorLauncher
{
  public void open(IPath file)
  {
    Shell shell = PlatformUI.getWorkbench().getDisplay().getActiveShell();
    String extension = file.getFileExtension();
    File gcda;
    if ("gcno".equals(extension))
    {
      IPath file2 = file.removeFileExtension().addFileExtension("gcda");
      File gcno = file.toFile();
      gcda = file2.toFile();
    }
    else
    {
      File gcno;
      if ("gcda".equals(extension))
      {
        IPath file2 = file.removeFileExtension().addFileExtension("gcno");
        File gcda = file.toFile();
        gcno = file2.toFile();
      }
      else
      {
        return;
      }
    }
    File gcda;
    File gcno;
    if ((gcda == null) || (!gcda.isFile()))
    {
      String msg = "File " + gcda + " does not exist.";
      msg = msg + "\nPlease run your application at least once.";
      MessageDialog.openError(shell, "gcov Error", msg);
      return;
    }
    if ((gcno == null) || (!gcno.isFile()))
    {
      String msg = "File " + gcno + " does not exist.";
      msg = msg + "\nPlease recompile your application.";
      MessageDialog.openError(shell, "gcov Error", msg);
      return;
    }
    String s = getDefaultBinary(file);
    OpenGCDialog d = new OpenGCDialog(shell, s, file);
    if (d.open() != 0) {
      return;
    }
    String binaryPath = d.getBinaryFile();
    if (d.isCompleteCoverageResultWanted()) {
      CovView.displayCovResults(binaryPath);
    } else {
      CovView.displayCovDetailedResult(binaryPath, gcda.getAbsolutePath());
    }
  }
  
  private String getDefaultBinary(IPath file)
  {
    File gmonFile = file.toFile();
    File parent = gmonFile.getParentFile();
    File info = new File(parent, "AnalysisInfo.txt");
    IProject project = null;
    IFile ifile = null;
    try
    {
      if (info.exists())
      {
        BufferedReader br = new BufferedReader(new FileReader(info.toString()));
        String line;
        while ((line = br.readLine()) != null)
        {
          String line;
          String[] tab = line.split("=");
          String name = "";String value = "";
          if (tab.length > 1)
          {
            name = tab[0];
            value = tab[1].trim();
            if (name.equals("Project Name "))
            {
              project = ResourcesPlugin.getWorkspace().getRoot().getProject(value);
            }
            else if ((name.equals("Program Name ")) && 
              (project != null))
            {
              ifile = project.getFile(value);
              br.close();
              if (ifile.exists()) {
                return ifile.getLocation().toString();
              }
            }
          }
        }
      }
      else
      {
        IFile c = ResourcesPlugin.getWorkspace().getRoot()
          .getFileForLocation(file);
        if (c != null)
        {
          project = c.getProject();
          if ((project != null) && (project.exists()))
          {
            ICProject cproject = CoreModel.getDefault().create(project);
            if (cproject != null) {
              try
              {
                IBinary[] b = cproject.getBinaryContainer()
                  .getBinaries();
                if ((b != null) && (b.length > 0) && (b[0] != null))
                {
                  IResource r = b[0].getResource();
                  return r.getLocation().toOSString();
                }
              }
              catch (CModelException localCModelException) {}
            }
          }
        }
      }
      Status status;
      Status status;
      return "";
    }
    catch (FileNotFoundException e)
    {
      status = new Status(
        2, 
        "org.eclipse.linuxtools.gcov", 
        2, 
        e.getMessage(), 
        e);
      
      Activator.getDefault().getLog().log(status);
    }
    catch (IOException e)
    {
      status = new Status(
        4, 
        "org.eclipse.linuxtools.gcov", 
        4, 
        e.getMessage(), 
        e);
      
      Activator.getDefault().getLog().log(status);
    }
  }
}

/* Location:
 * Qualified Name:     org.eclipse.linuxtools.gcov.action.OpenGCAction
 * Java Class Version: 6 (50.0)
 * JD-Core Version:    0.7.1
 */
package org.eclipse.linuxtools.gcov.action;

import org.eclipse.jface.action.Action;
import org.eclipse.jface.viewers.ColumnViewer;
import org.eclipse.jface.viewers.IContentProvider;
import org.eclipse.jface.viewers.TreeViewer;
import org.eclipse.linuxtools.gcov.Activator;
import org.eclipse.swt.widgets.Control;

public class SwitchContentProviderAction
  extends Action
{
  private final ColumnViewer viewer;
  private final IContentProvider provider;
  
  public SwitchContentProviderAction(String name, String iconPath, ColumnViewer viewer, IContentProvider provider)
  {
    super(name, 8);
    setImageDescriptor(Activator.getImageDescriptor(iconPath));
    setToolTipText(name);
    this.viewer = viewer;
    this.provider = provider;
  }
  
  public void run()
  {
    viewer.getControl().setRedraw(false);
    viewer.setContentProvider(provider);
    ((TreeViewer)viewer).expandToLevel(2);
    viewer.getControl().setRedraw(true);
  }
}

/* Location:
 * Qualified Name:     org.eclipse.linuxtools.gcov.action.SwitchContentProviderAction
 * Java Class Version: 6 (50.0)
 * JD-Core Version:    0.7.1
 */
package org.eclipse.linuxtools.gcov.dialog;

import org.eclipse.swt.events.SelectionAdapter;
import org.eclipse.swt.events.SelectionEvent;

class OpenGCDialog$1
  extends SelectionAdapter
{
  OpenGCDialog$1(OpenGCDialog paramOpenGCDialog) {}
  
  public void widgetSelected(SelectionEvent sev)
  {
    this$0.handleBrowseWorkspace("Open Binary file...", OpenGCDialog.access$1(this$0));
  }
}

/* Location:
 * Qualified Name:     org.eclipse.linuxtools.gcov.dialog.OpenGCDialog.1
 * Java Class Version: 6 (50.0)
 * JD-Core Version:    0.7.1
 */
package org.eclipse.linuxtools.gcov.dialog;

import org.eclipse.swt.events.SelectionAdapter;
import org.eclipse.swt.events.SelectionEvent;

class OpenGCDialog$2
  extends SelectionAdapter
{
  OpenGCDialog$2(OpenGCDialog paramOpenGCDialog) {}
  
  public void widgetSelected(SelectionEvent sev)
  {
    this$0.handleBrowse("Open Binary file...", OpenGCDialog.access$1(this$0));
  }
}

/* Location:
 * Qualified Name:     org.eclipse.linuxtools.gcov.dialog.OpenGCDialog.2
 * Java Class Version: 6 (50.0)
 * JD-Core Version:    0.7.1
 */
package org.eclipse.linuxtools.gcov.dialog;

import org.eclipse.swt.events.SelectionAdapter;
import org.eclipse.swt.events.SelectionEvent;
import org.eclipse.swt.widgets.Button;

class OpenGCDialog$3
  extends SelectionAdapter
{
  OpenGCDialog$3(OpenGCDialog paramOpenGCDialog) {}
  
  public void widgetSelected(SelectionEvent sev)
  {
    OpenGCDialog.access$3(this$0, OpenGCDialog.access$2(this$0).getSelection());
  }
}

/* Location:
 * Qualified Name:     org.eclipse.linuxtools.gcov.dialog.OpenGCDialog.3
 * Java Class Version: 6 (50.0)
 * JD-Core Version:    0.7.1
 */
package org.eclipse.linuxtools.gcov.dialog;

import org.eclipse.core.resources.IFile;
import org.eclipse.core.runtime.IStatus;
import org.eclipse.core.runtime.Status;
import org.eclipse.ui.dialogs.ISelectionStatusValidator;

class OpenGCDialog$4
  implements ISelectionStatusValidator
{
  OpenGCDialog$4(OpenGCDialog paramOpenGCDialog) {}
  
  public IStatus validate(Object[] selection)
  {
    if (selection.length != 1) {
      return new Status(4, "org.eclipse.linuxtools.gcov", 0, "", null);
    }
    if (!(selection[0] instanceof IFile)) {
      return new Status(4, "org.eclipse.linuxtools.gcov", 0, "", null);
    }
    return new Status(0, "org.eclipse.linuxtools.gcov", 0, "", null);
  }
}

/* Location:
 * Qualified Name:     org.eclipse.linuxtools.gcov.dialog.OpenGCDialog.4
 * Java Class Version: 6 (50.0)
 * JD-Core Version:    0.7.1
 */
package org.eclipse.linuxtools.gcov.dialog;

import org.eclipse.swt.events.ModifyEvent;
import org.eclipse.swt.events.ModifyListener;

class OpenGCDialog$BinaryModifyListener
  implements ModifyListener
{
  private OpenGCDialog$BinaryModifyListener(OpenGCDialog paramOpenGCDialog) {}
  
  public void modifyText(ModifyEvent e)
  {
    OpenGCDialog.access$0(this$0);
  }
}

/* Location:
 * Qualified Name:     org.eclipse.linuxtools.gcov.dialog.OpenGCDialog.BinaryModifyListener
 * Java Class Version: 6 (50.0)
 * JD-Core Version:    0.7.1
 */
package org.eclipse.linuxtools.gcov.dialog;

import java.io.File;
import org.eclipse.cdt.core.IBinaryParser.IBinaryObject;
import org.eclipse.core.resources.IContainer;
import org.eclipse.core.resources.IFile;
import org.eclipse.core.resources.IResource;
import org.eclipse.core.resources.IWorkspace;
import org.eclipse.core.resources.IWorkspaceRoot;
import org.eclipse.core.resources.ResourcesPlugin;
import org.eclipse.core.runtime.CoreException;
import org.eclipse.core.runtime.IPath;
import org.eclipse.core.runtime.IStatus;
import org.eclipse.core.runtime.Path;
import org.eclipse.core.runtime.Status;
import org.eclipse.core.variables.IStringVariableManager;
import org.eclipse.core.variables.VariablesPlugin;
import org.eclipse.jface.dialogs.Dialog;
import org.eclipse.jface.dialogs.MessageDialog;
import org.eclipse.linuxtools.binutils.utils.STSymbolManager;
import org.eclipse.swt.events.ModifyEvent;
import org.eclipse.swt.events.ModifyListener;
import org.eclipse.swt.events.SelectionAdapter;
import org.eclipse.swt.events.SelectionEvent;
import org.eclipse.swt.layout.GridData;
import org.eclipse.swt.layout.GridLayout;
import org.eclipse.swt.widgets.Button;
import org.eclipse.swt.widgets.Composite;
import org.eclipse.swt.widgets.Control;
import org.eclipse.swt.widgets.Display;
import org.eclipse.swt.widgets.FileDialog;
import org.eclipse.swt.widgets.Group;
import org.eclipse.swt.widgets.Label;
import org.eclipse.swt.widgets.Shell;
import org.eclipse.swt.widgets.Text;
import org.eclipse.ui.IWorkbench;
import org.eclipse.ui.PlatformUI;
import org.eclipse.ui.dialogs.ElementTreeSelectionDialog;
import org.eclipse.ui.dialogs.ISelectionStatusValidator;
import org.eclipse.ui.model.WorkbenchContentProvider;
import org.eclipse.ui.model.WorkbenchLabelProvider;
import org.eclipse.ui.views.navigator.ResourceComparator;

public class OpenGCDialog
  extends Dialog
{
  private Text binText;
  private String binValue;
  private Button openThisFileOnlyButton;
  private Button openCoverageSummaryButton;
  private boolean openCoverageSummary = true;
  private Button binBrowseWorkspaceButton;
  private Button binBrowseFileSystemButton;
  private Label errorLabel;
  private boolean binaryValid;
  private final BinaryModifyListener binModifyListener = new BinaryModifyListener(null);
  private final String defaultValue;
  private final IPath gcFile;
  
  public OpenGCDialog(Shell parentShell, String binPath, IPath gcFile)
  {
    super(parentShell);
    this.gcFile = gcFile;
    setShellStyle(getShellStyle() | 0x10);
    defaultValue = binPath;
  }
  
  public String getBinaryFile()
  {
    return binValue;
  }
  
  public boolean isCompleteCoverageResultWanted()
  {
    return openCoverageSummary;
  }
  
  protected Control createContents(Composite parent)
  {
    Control composite = super.createContents(parent);
    validateBinary();
    return composite;
  }
  
  protected Control createDialogArea(Composite parent)
  {
    getShell().setText("Gcov - Open coverage results...");
    Composite composite = (Composite)super.createDialogArea(parent);
    
    Group c = new Group(composite, 0);
    c.setText("Binary File");
    c.setToolTipText("Please enter here the binary file which produced the coverage data.");
    GridLayout layout = new GridLayout(2, false);
    c.setLayout(layout);
    GridData data = new GridData(1808);
    c.setLayoutData(data);
    
    Label binLabel = new Label(c, 0);
    binLabel.setText("Please enter here the binary file which produced the coverage data.");
    data = new GridData();
    horizontalSpan = 2;
    binLabel.setLayoutData(data);
    
    binText = new Text(c, 2048);
    binText.setText(defaultValue);
    data = new GridData(768);
    widthHint = 200;
    binText.setLayoutData(data);
    binText.addModifyListener(binModifyListener);
    
    Composite cbBin = new Composite(c, 0);
    data = new GridData(128);
    cbBin.setLayoutData(data);
    cbBin.setLayout(new GridLayout(2, true));
    binBrowseWorkspaceButton = new Button(cbBin, 8);
    binBrowseWorkspaceButton.setText("&Workspace...");
    binBrowseWorkspaceButton.addSelectionListener(
      new SelectionAdapter()
      {
        public void widgetSelected(SelectionEvent sev)
        {
          handleBrowseWorkspace("Open Binary file...", binText);
        }
      });
    binBrowseFileSystemButton = new Button(cbBin, 8);
    binBrowseFileSystemButton.setText("&File System...");
    binBrowseFileSystemButton.addSelectionListener(
      new SelectionAdapter()
      {
        public void widgetSelected(SelectionEvent sev)
        {
          handleBrowse("Open Binary file...", binText);
        }
      });
    Group covMode = new Group(composite, 0);
    covMode.setText("Coverage result");
    covMode.setToolTipText("Please choose the result scope.");
    GridData covModeData = new GridData(1808);
    covMode.setLayoutData(covModeData);
    covMode.setLayout(new GridLayout());
    openThisFileOnlyButton = new Button(covMode, 16);
    openThisFileOnlyButton.setLayoutData(new GridData());
    openCoverageSummaryButton = new Button(covMode, 16);
    openCoverageSummaryButton.setLayoutData(new GridData());
    String cFile = gcFile.removeFileExtension().lastSegment() + ".c";
    
    openThisFileOnlyButton.setText("Show coverage details for \"" + cFile + "\" only.");
    openCoverageSummaryButton.setText("Show coverage for the whole selected binary file");
    
    openCoverageSummaryButton.setSelection(true);
    
    SelectionAdapter sa = new SelectionAdapter()
    {
      public void widgetSelected(SelectionEvent sev)
      {
        openCoverageSummary = openCoverageSummaryButton.getSelection();
      }
    };
    openCoverageSummaryButton.addSelectionListener(sa);
    openThisFileOnlyButton.addSelectionListener(sa);
    
    errorLabel = new Label(composite, 0);
    data = new GridData(768);
    horizontalSpan = 3;
    errorLabel.setLayoutData(data);
    errorLabel.setForeground(getShell().getDisplay().getSystemColor(3));
    
    c.layout();
    
    return composite;
  }
  
  private void validateBinary()
  {
    binValue = binText.getText();
    IStringVariableManager mgr = VariablesPlugin.getDefault().getStringVariableManager();
    try
    {
      binValue = mgr.performStringSubstitution(binValue, false);
    }
    catch (CoreException localCoreException) {}
    File f = new File(binValue);
    if (f.exists())
    {
      IBinaryParser.IBinaryObject binary = STSymbolManager.sharedInstance.getBinaryObject(new Path(binValue));
      if (binary == null)
      {
        MessageDialog.openError(
          PlatformUI.getWorkbench().getDisplay().getActiveShell(), 
          "Invalid binary file", 
          binText.getText() + " is not a valid binary file.");
        return;
      }
      binaryValid = true;
      getButton(0).setEnabled(binaryValid);
      errorLabel.setText("");
    }
    else
    {
      binaryValid = false;
      getButton(0).setEnabled(false);
      if (!binValue.equals("")) {
        errorLabel.setText("\"" + binText.getText() + "\" doesn't exist");
      } else {
        errorLabel.setText("Please enter a binary file");
      }
      return;
    }
  }
  
  private class BinaryModifyListener
    implements ModifyListener
  {
    private BinaryModifyListener() {}
    
    public void modifyText(ModifyEvent e)
    {
      OpenGCDialog.this.validateBinary();
    }
  }
  
  protected void handleBrowseWorkspace(String msg, Text text)
  {
    ElementTreeSelectionDialog dialog = new ElementTreeSelectionDialog(getShell(), new WorkbenchLabelProvider(), new WorkbenchContentProvider());
    dialog.setTitle(msg);
    dialog.setMessage(msg);
    dialog.setInput(ResourcesPlugin.getWorkspace().getRoot());
    dialog.setComparator(new ResourceComparator(1));
    dialog.setAllowMultiple(false);
    IContainer c = ResourcesPlugin.getWorkspace().getRoot().getContainerForLocation(gcFile);
    if (c != null) {
      dialog.setInitialSelection(c.getProject());
    }
    dialog.setValidator(new ISelectionStatusValidator()
    {
      public IStatus validate(Object[] selection)
      {
        if (selection.length != 1) {
          return new Status(4, "org.eclipse.linuxtools.gcov", 0, "", null);
        }
        if (!(selection[0] instanceof IFile)) {
          return new Status(4, "org.eclipse.linuxtools.gcov", 0, "", null);
        }
        return new Status(0, "org.eclipse.linuxtools.gcov", 0, "", null);
      }
    });
    if (dialog.open() == 0)
    {
      IResource resource = (IResource)dialog.getFirstResult();
      text.setText("${resource_loc:" + resource.getFullPath() + "}");
    }
  }
  
  protected void handleBrowse(String msg, Text text)
  {
    FileDialog dialog = new FileDialog(getShell(), 4096);
    dialog.setText(msg);
    String t = text.getText();
    IStringVariableManager mgr = VariablesPlugin.getDefault().getStringVariableManager();
    try
    {
      t = mgr.performStringSubstitution(t, false);
    }
    catch (CoreException localCoreException) {}
    File f = new File(t);
    t = f.getParent();
    if ((t == null) || (t.length() == 0)) {
      t = gcFile.removeLastSegments(1).toOSString();
    }
    dialog.setFilterPath(t);
    String s = dialog.open();
    if (s != null) {
      text.setText(s);
    }
  }
}

/* Location:
 * Qualified Name:     org.eclipse.linuxtools.gcov.dialog.OpenGCDialog
 * Java Class Version: 6 (50.0)
 * JD-Core Version:    0.7.1
 */
package org.eclipse.linuxtools.gcov.model;

import java.util.LinkedList;

public abstract class AbstractTreeElement
  implements TreeElement
{
  private static final long serialVersionUID = -4911602250295116203L;
  private final TreeElement parent;
  private final LinkedList<TreeElement> children = new LinkedList();
  private final String name;
  private final int totalLines;
  private final int executedLines;
  private final int instrumentedLines;
  
  public AbstractTreeElement(TreeElement parent, String name, int totalLines, int executedLines, int instrumentedLines)
  {
    this.parent = parent;
    this.name = name;
    this.totalLines = totalLines;
    this.executedLines = executedLines;
    this.instrumentedLines = instrumentedLines;
  }
  
  public TreeElement getParent()
  {
    return parent;
  }
  
  public boolean hasChildren()
  {
    return children.size() > 0;
  }
  
  public LinkedList<? extends TreeElement> getChildren()
  {
    return children;
  }
  
  public String getName()
  {
    return name;
  }
  
  public TreeElement getRoot()
  {
    if (parent == null) {
      return this;
    }
    return parent.getRoot();
  }
  
  public int getExecutedLines()
  {
    return executedLines;
  }
  
  public int getInstrumentedLines()
  {
    return instrumentedLines;
  }
  
  public float getCoveragePercentage()
  {
    if (instrumentedLines != 0) {
      return 100.0F * executedLines / instrumentedLines;
    }
    return 0.0F;
  }
  
  public void addChild(TreeElement child)
  {
    children.add(child);
  }
  
  public int getTotalLines()
  {
    return totalLines;
  }
}

/* Location:
 * Qualified Name:     org.eclipse.linuxtools.gcov.model.AbstractTreeElement
 * Java Class Version: 6 (50.0)
 * JD-Core Version:    0.7.1
 */
package org.eclipse.linuxtools.gcov.model;

public class CovFileTreeElement
  extends AbstractTreeElement
{
  private static final long serialVersionUID = -5017234616535899796L;
  
  public CovFileTreeElement(TreeElement parent, String name, int totalLines, int executedLines, int instrumentedLines)
  {
    super(parent, name, totalLines, executedLines, instrumentedLines);
  }
}

/* Location:
 * Qualified Name:     org.eclipse.linuxtools.gcov.model.CovFileTreeElement
 * Java Class Version: 6 (50.0)
 * JD-Core Version:    0.7.1
 */
package org.eclipse.linuxtools.gcov.model;

public class CovFolderTreeElement
  extends AbstractTreeElement
{
  private static final long serialVersionUID = 583359546284716138L;
  
  public CovFolderTreeElement(TreeElement parent, String name, int totalLines, int executedLines, int instrumentedLines)
  {
    super(parent, name, totalLines, executedLines, instrumentedLines);
  }
}

/* Location:
 * Qualified Name:     org.eclipse.linuxtools.gcov.model.CovFolderTreeElement
 * Java Class Version: 6 (50.0)
 * JD-Core Version:    0.7.1
 */
package org.eclipse.linuxtools.gcov.model;

import java.util.LinkedList;

public class CovFunctionTreeElement
  extends AbstractTreeElement
{
  private static final long serialVersionUID = -2025221943523670378L;
  private final String sourceFilePath;
  private final long firstLnNmbr;
  
  public CovFunctionTreeElement(TreeElement parent, String name, String sourceFilePath, long firstLnNmbr, int executedLines, int instrumentedLines)
  {
    super(parent, name, 0, executedLines, instrumentedLines);
    this.sourceFilePath = sourceFilePath;
    this.firstLnNmbr = firstLnNmbr;
  }
  
  public boolean hasChildren()
  {
    return false;
  }
  
  public LinkedList<? extends TreeElement> getChildren()
  {
    return null;
  }
  
  public void addChild(TreeElement child) {}
  
  public String getSourceFilePath()
  {
    return sourceFilePath;
  }
  
  public long getFirstLnNmbr()
  {
    return firstLnNmbr;
  }
}

/* Location:
 * Qualified Name:     org.eclipse.linuxtools.gcov.model.CovFunctionTreeElement
 * Java Class Version: 6 (50.0)
 * JD-Core Version:    0.7.1
 */
package org.eclipse.linuxtools.gcov.model;

import java.io.Serializable;

public class CovRootTreeElement
  extends AbstractTreeElement
  implements Serializable
{
  private static final long serialVersionUID = 877070271548608926L;
  
  public CovRootTreeElement(String name, int totalLines, int executedLines, int instrumentedLines)
  {
    super(null, name, totalLines, executedLines, instrumentedLines);
  }
}

/* Location:
 * Qualified Name:     org.eclipse.linuxtools.gcov.model.CovRootTreeElement
 * Java Class Version: 6 (50.0)
 * JD-Core Version:    0.7.1
 */
package org.eclipse.linuxtools.gcov.model;

import java.io.Serializable;
import java.util.LinkedList;

public abstract interface TreeElement
  extends Serializable
{
  public abstract TreeElement getParent();
  
  public abstract LinkedList<? extends TreeElement> getChildren();
  
  public abstract boolean hasChildren();
  
  public abstract TreeElement getRoot();
  
  public abstract String getName();
  
  public abstract int getExecutedLines();
  
  public abstract int getInstrumentedLines();
  
  public abstract int getTotalLines();
  
  public abstract float getCoveragePercentage();
}

/* Location:
 * Qualified Name:     org.eclipse.linuxtools.gcov.model.TreeElement
 * Java Class Version: 6 (50.0)
 * JD-Core Version:    0.7.1
 */
package org.eclipse.linuxtools.gcov.parser;

import java.io.Serializable;
import java.util.List;

public class Arc
  implements Serializable
{
  private static final long serialVersionUID = 4104429137191407662L;
  private static final int VCOV_ARC_ON_TREE = 1;
  private static final int VCOV_ARC_FAKE = 2;
  private static final int VCOV_ARC_FALLTHROUGH = 4;
  private final Block srcBlock;
  private final Block dstnatnBlock;
  private final long flag;
  private final boolean fake;
  private final boolean onTree;
  private final boolean fallthrough;
  private long count = 0L;
  private boolean countValid = false;
  private boolean isCallNonReturn = false;
  private boolean isNonLoclaReturn = false;
  private boolean isUnconditionnal = false;
  
  public Arc(int srcBlockIndice, int dstnatnBlockIndice, long flag, List<Block> otherArcParams)
  {
    this.flag = flag;
    dstnatnBlock = ((Block)otherArcParams.get(dstnatnBlockIndice));
    srcBlock = ((Block)otherArcParams.get(srcBlockIndice));
    count = 0L;
    countValid = false;
    if ((flag & 1L) != 0L)
    {
      onTree = true;
      fake = false;
      fallthrough = false;
    }
    else if ((flag & 0x2) != 0L)
    {
      onTree = false;
      fake = true;
      fallthrough = true;
    }
    else if ((flag & 0x4) != 0L)
    {
      onTree = false;
      fake = false;
      fallthrough = true;
    }
    else
    {
      onTree = false;
      fake = false;
      fallthrough = false;
    }
  }
  
  public Block getDstnatnBlock()
  {
    return dstnatnBlock;
  }
  
  public long getFlag()
  {
    return flag;
  }
  
  public boolean isFake()
  {
    return fake;
  }
  
  public boolean isOnTree()
  {
    return onTree;
  }
  
  public boolean isFallthrough()
  {
    return fallthrough;
  }
  
  public boolean isUnconditionnal()
  {
    return isUnconditionnal;
  }
  
  public boolean isNonLoclaReturn()
  {
    return isNonLoclaReturn;
  }
  
  public boolean isCallNonReturn()
  {
    return isCallNonReturn;
  }
  
  public void setCallNonReturn(boolean isCallNonReturn)
  {
    this.isCallNonReturn = isCallNonReturn;
  }
  
  public void setNonLoclaReturn(boolean isNonLoclaReturn)
  {
    this.isNonLoclaReturn = isNonLoclaReturn;
  }
  
  public void setUnconditionnal(boolean isUnconditionnal)
  {
    this.isUnconditionnal = isUnconditionnal;
  }
  
  public Block getSrcBlock()
  {
    return srcBlock;
  }
  
  public void setCount(long count)
  {
    this.count = count;
  }
  
  public void setCountValid(boolean countValid)
  {
    this.countValid = countValid;
  }
  
  public long getCount()
  {
    return count;
  }
  
  public boolean isCountValid()
  {
    return countValid;
  }
}

/* Location:
 * Qualified Name:     org.eclipse.linuxtools.gcov.parser.Arc
 * Java Class Version: 6 (50.0)
 * JD-Core Version:    0.7.1
 */
package org.eclipse.linuxtools.gcov.parser;

import java.io.Serializable;

class Block$BlkLine
  implements Serializable
{
  private static final long serialVersionUID = 2757557929188979686L;
  public long[] encoding;
  public int num;
  
  Block$BlkLine(Block paramBlock) {}
}

/* Location:
 * Qualified Name:     org.eclipse.linuxtools.gcov.parser.Block.BlkLine
 * Java Class Version: 6 (50.0)
 * JD-Core Version:    0.7.1
 */
package org.eclipse.linuxtools.gcov.parser;

import java.io.Serializable;
import java.util.ArrayList;

public class Block
  implements Serializable
{
  private static final long serialVersionUID = -7665287885679756014L;
  private final ArrayList<Arc> entryArcs = new ArrayList();
  private final ArrayList<Arc> exitArcs = new ArrayList();
  private final long flag;
  private long numSuccs = 0L;
  private long numPreds = 0L;
  private long count = 0L;
  private boolean isCallSite = false;
  private boolean isCallReturn = false;
  private boolean isNonLocalReturn = false;
  private boolean validChain = false;
  private boolean invalidChain = false;
  private boolean countValid = false;
  private final BlkLine blkline = new BlkLine();
  
  public Block(long flag)
  {
    this.flag = flag;
  }
  
  public long getFlag()
  {
    return flag;
  }
  
  public ArrayList<Arc> getEntryArcs()
  {
    return entryArcs;
  }
  
  public ArrayList<Arc> getExitArcs()
  {
    return exitArcs;
  }
  
  public boolean isCallSite()
  {
    return isCallSite;
  }
  
  public boolean isCallReturn()
  {
    return isCallReturn;
  }
  
  public boolean isNonLocalReturn()
  {
    return isNonLocalReturn;
  }
  
  public void addEntryArcs(Arc arcEntry)
  {
    entryArcs.add(arcEntry);
  }
  
  public void addExitArcs(Arc arcExit)
  {
    exitArcs.add(arcExit);
  }
  
  public void setCallSite(boolean isCallSite)
  {
    this.isCallSite = isCallSite;
  }
  
  public void setCallReturn(boolean isCallReturn)
  {
    this.isCallReturn = isCallReturn;
  }
  
  public void setNonLocalReturn(boolean isNonLocalReturn)
  {
    this.isNonLocalReturn = isNonLocalReturn;
  }
  
  public void decNumSuccs()
  {
    numSuccs -= 1L;
  }
  
  public void decNumPreds()
  {
    numPreds -= 1L;
  }
  
  public void incNumPreds()
  {
    numPreds += 1L;
  }
  
  public void incNumSuccs()
  {
    numSuccs += 1L;
  }
  
  public boolean isValidChain()
  {
    return validChain;
  }
  
  public void setValidChain(boolean validChain)
  {
    this.validChain = validChain;
  }
  
  public boolean isInvalidChain()
  {
    return invalidChain;
  }
  
  public void setInvalidChain(boolean invalidChain)
  {
    this.invalidChain = invalidChain;
  }
  
  public long getCount()
  {
    return count;
  }
  
  public void setCount(long count)
  {
    this.count = count;
  }
  
  public void setCountValid(boolean countValid)
  {
    this.countValid = countValid;
  }
  
  public boolean isCountValid()
  {
    return countValid;
  }
  
  public long getNumSuccs()
  {
    return numSuccs;
  }
  
  public long getNumPreds()
  {
    return numPreds;
  }
  
  public void setNumSuccs(long numSuccs)
  {
    this.numSuccs = numSuccs;
  }
  
  public void setNumPreds(long numPreds)
  {
    this.numPreds = numPreds;
  }
  
  public long[] getEncoding()
  {
    return blkline.encoding;
  }
  
  public void setEncoding(long[] lineNos)
  {
    blkline.encoding = lineNos;
  }
  
  public int getLineNum()
  {
    return blkline.num;
  }
  
  public void setNumLine(int numline)
  {
    blkline.num = numline;
  }
  
  class BlkLine
    implements Serializable
  {
    private static final long serialVersionUID = 2757557929188979686L;
    public long[] encoding;
    public int num;
    
    BlkLine() {}
  }
}

/* Location:
 * Qualified Name:     org.eclipse.linuxtools.gcov.parser.Block
 * Java Class Version: 6 (50.0)
 * JD-Core Version:    0.7.1
 */
package org.eclipse.linuxtools.gcov.parser;

import java.io.IOException;
import java.io.InputStream;
import java.io.InputStreamReader;
import java.io.LineNumberReader;
import java.util.List;

final class CovManager$ThreadConsumer
  extends Thread
{
  private final Process p;
  private final List<String> list;
  
  CovManager$ThreadConsumer(Process arg1, List<String> p)
  {
    this.p = p;
    list = files;
  }
  
  public void run()
  {
    try
    {
      populateGCDAFiles(p.getInputStream());
    }
    catch (Exception localException) {}
  }
  
  private void populateGCDAFiles(InputStream s)
    throws IOException
  {
    InputStreamReader isr = new InputStreamReader(s);
    LineNumberReader lnr = new LineNumberReader(isr);
    String line = null;
    while ((line = lnr.readLine()) != null) {
      if (line.endsWith(".gcda"))
      {
        while ((line.length() > 6) && (!line.matches("^([A-Za-z]:)?[/\\\\].*"))) {
          line = line.substring(1);
        }
        if (!list.contains(line)) {
          list.add(line);
        }
      }
    }
  }
}

/* Location:
 * Qualified Name:     org.eclipse.linuxtools.gcov.parser.CovManager.ThreadConsumer
 * Java Class Version: 6 (50.0)
 * JD-Core Version:    0.7.1
 */
package org.eclipse.linuxtools.gcov.parser;

import java.io.BufferedInputStream;
import java.io.DataInput;
import java.io.DataInputStream;
import java.io.File;
import java.io.FileInputStream;
import java.io.FileNotFoundException;
import java.io.IOException;
import java.io.InputStream;
import java.io.InputStreamReader;
import java.io.LineNumberReader;
import java.io.PrintStream;
import java.io.Serializable;
import java.util.ArrayList;
import java.util.HashMap;
import java.util.Iterator;
import java.util.LinkedList;
import java.util.List;
import org.eclipse.cdt.core.IBinaryParser.IBinaryObject;
import org.eclipse.core.runtime.CoreException;
import org.eclipse.core.runtime.ILog;
import org.eclipse.core.runtime.IPath;
import org.eclipse.core.runtime.Path;
import org.eclipse.core.runtime.Status;
import org.eclipse.linuxtools.binutils.utils.STSymbolManager;
import org.eclipse.linuxtools.gcov.Activator;
import org.eclipse.linuxtools.gcov.model.CovFileTreeElement;
import org.eclipse.linuxtools.gcov.model.CovFolderTreeElement;
import org.eclipse.linuxtools.gcov.model.CovFunctionTreeElement;
import org.eclipse.linuxtools.gcov.model.CovRootTreeElement;
import org.tizen.common.util.OSChecker;
import org.tizen.nativecommon.build.SmartBuildInterface;

public class CovManager
  implements Serializable
{
  private static final long serialVersionUID = 5582066617970911413L;
  private final String binaryPath;
  private final ArrayList<Folder> allFolders = new ArrayList();
  private final ArrayList<SourceFile> allSrcs = new ArrayList();
  private final ArrayList<GcnoFunction> allFnctns = new ArrayList();
  private final HashMap<String, SourceFile> sourceMap = new HashMap();
  private long nbrPgmRuns = 0L;
  private CovRootTreeElement rootNode;
  
  public CovManager(String binaryPath)
  {
    this.binaryPath = binaryPath;
  }
  
  public void processCovFiles(List<String> covFilesPaths)
    throws CoreException, IOException, InterruptedException
  {
    GcdaRecordsParser daRcrd = null;
    for (String gcdaPath : covFilesPaths)
    {
      String gcnoPath = gcdaPath.replace(".gcda", ".gcno");
      
      DataInput traceFile = OpenTraceFileStream(gcnoPath);
      GcnoRecordsParser noRcrd = new GcnoRecordsParser(sourceMap, allSrcs);
      noRcrd.parseData(traceFile);
      for (GcnoFunction f : noRcrd.getFnctns()) {
        allFnctns.add(f);
      }
      if (traceFile.getClass() == DataInputStream.class) {
        ((DataInputStream)traceFile).close();
      }
      traceFile = OpenTraceFileStream(gcdaPath);
      if (!noRcrd.getFnctns().isEmpty())
      {
        daRcrd = new GcdaRecordsParser(noRcrd.getFnctns());
        daRcrd.parseGcdaRecord(traceFile);
        if (traceFile.getClass() == DataInputStream.class) {
          ((DataInputStream)traceFile).close();
        }
      }
    }
    if (daRcrd != null) {
      nbrPgmRuns = daRcrd.getObjSmryNbrPgmRuns();
    }
    for (GcnoFunction gf : allFnctns) {
      gf.solveGraphFnctn();
    }
    for (SourceFile sourceFile : allSrcs) {
      sourceFile.createLines();
    }
    for (GcnoFunction gf : allFnctns) {
      gf.addLineCounts(allSrcs);
    }
    for (SourceFile sf : allSrcs) {
      sf.accumulateLineCounts();
    }
    for (SourceFile sf : allSrcs)
    {
      File srcFile = new File(sf.getName());
      String folderName = srcFile.getParent();
      if (folderName == null) {
        folderName = "?";
      }
      Folder folder = null;
      for (Folder f : allFolders) {
        if (f.getPath().equals(folderName)) {
          folder = f;
        }
      }
      if (folder == null)
      {
        folder = new Folder(folderName);
        allFolders.add(folder);
      }
      folder.addSrcFiles(sf);
    }
    for (Folder f : allFolders) {
      f.accumulateSourcesCounts();
    }
  }
  
  public void fillGcovView()
  {
    int summaryTotal = 0;int summaryInstrumented = 0;int summaryExecuted = 0;
    for (Folder f : allFolders)
    {
      summaryTotal += f.getNumLines();
      summaryInstrumented += f.getLinesInstrumented();
      summaryExecuted += f.getLinesExecuted();
    }
    rootNode = new CovRootTreeElement("Summary", summaryTotal, summaryExecuted, 
      summaryInstrumented);
    IBinaryParser.IBinaryObject binaryObject = STSymbolManager.sharedInstance.getBinaryObject(new Path(binaryPath));
    Iterator localIterator3;
    for (Iterator localIterator2 = allFolders.iterator(); localIterator2.hasNext(); localIterator3.hasNext())
    {
      Folder fldr = (Folder)localIterator2.next();
      String folderLocation = fldr.getPath();
      CovFolderTreeElement fldrTreeElem = new CovFolderTreeElement(
        rootNode, folderLocation, fldr.getNumLines(), fldr.getLinesExecuted(), 
        fldr.getLinesInstrumented());
      rootNode.addChild(fldrTreeElem);
      
      localIterator3 = fldr.getSrcFiles().iterator(); continue;SourceFile src = (SourceFile)localIterator3.next();
      CovFileTreeElement srcTreeElem = new CovFileTreeElement(
        fldrTreeElem, src.getName(), src.getNumLines(), src
        .getLinesExecuted(), src.getLinesInstrumented());
      fldrTreeElem.addChild(srcTreeElem);
      for (GcnoFunction fnctn : src.getFnctns())
      {
        String name = fnctn.getName();
        name = STSymbolManager.sharedInstance.demangle(binaryObject, name);
        srcTreeElem.addChild(new CovFunctionTreeElement(
          srcTreeElem, name, fnctn.getSrcFile(), fnctn
          .getFirstLineNmbr(), fnctn.getCvrge()
          .getLinesExecuted(), fnctn.getCvrge()
          .getLinesInstrumented()));
      }
    }
  }
  
  private DataInput OpenTraceFileStream(String filePath)
    throws FileNotFoundException
  {
    FileInputStream fis = new FileInputStream(filePath);
    InputStream inputStream = new BufferedInputStream(fis);
    
    return new DataInputStream(inputStream);
  }
  
  public ArrayList<SourceFile> getAllSrcs()
  {
    return allSrcs;
  }
  
  public ArrayList<GcnoFunction> getAllFnctns()
  {
    return allFnctns;
  }
  
  public CovRootTreeElement getRootNode()
  {
    return rootNode;
  }
  
  public String getBinaryPath()
  {
    return binaryPath;
  }
  
  public SourceFile getSourceFile(String sourcePath)
  {
    return (SourceFile)sourceMap.get(sourcePath);
  }
  
  public long getNbrPgmRuns()
  {
    return nbrPgmRuns;
  }
  
  public List<String> getGCDALocations()
    throws CoreException, IOException, InterruptedException
  {
    IBinaryParser.IBinaryObject binaryObject = STSymbolManager.sharedInstance.getBinaryObject(new Path(this.binaryPath));
    String binaryPath = binaryObject.getPath().toOSString();
    List<String> l = new LinkedList();
    String cpu = binaryObject.getCPU();
    Process p;
    if ("sh".equals(cpu))
    {
      String stringsTool = "sh4strings";
      Process p = getStringsP
1 2 3

Further reading...

For more information on Java 1.5 Tiger, you may find Java 1.5 Tiger, A developer's Notebook by D. Flanagan and B. McLaughlin from O'Reilly of interest.

New!JAR listings


Copyright 2006-2017. Infinite Loop Ltd