org.tizen.codecoverage_2.0.0.201310101546

16:49:48.637 INFO  jd.cli.Main - Decompiling org.tizen.codecoverage_2.0.0.201310101546.jar
package org.tizen.codecoverage;

import org.eclipse.ui.plugin.AbstractUIPlugin;
import org.osgi.framework.BundleContext;

public class Activator
  extends AbstractUIPlugin
{
  public static final String PLUGIN_ID = "com.score.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;
  }
}

/* Location:
 * Qualified Name:     org.tizen.codecoverage.Activator
 * Java Class Version: 6 (50.0)
 * JD-Core Version:    0.7.1
 */
package org.tizen.codecoverage;

import org.eclipse.core.resources.IProject;
import org.tizen.codecoverage.helper.GcovHelper;

class StartUp$1$1
  implements Runnable
{
  StartUp$1$1(StartUp.1 param1, IProject paramIProject) {}
  
  public void run()
  {
    GcovHelper.run(val$project);
  }
}

/* Location:
 * Qualified Name:     org.tizen.codecoverage.StartUp.1.1
 * Java Class Version: 6 (50.0)
 * JD-Core Version:    0.7.1
 */
package org.tizen.codecoverage;

import org.eclipse.cdt.managedbuilder.core.IConfiguration;
import org.eclipse.cdt.managedbuilder.core.IManagedBuildInfo;
import org.eclipse.cdt.managedbuilder.core.ManagedBuildManager;
import org.eclipse.core.resources.IProject;
import org.eclipse.core.runtime.CoreException;
import org.tizen.codecoverage.helper.GcovHelper;
import org.tizen.common.util.SWTUtil;
import org.tizen.nativecommon.ProjectUtil;
import org.tizen.nativecommon.launch.IProjectLaunchCommand;
import org.tizen.nativecommon.launch.LaunchInfo;
import org.tizen.nativecommon.launch.LaunchListener;

class StartUp$1
  implements LaunchListener
{
  StartUp$1(StartUp paramStartUp) {}
  
  public void preLaunched(LaunchInfo info)
    throws CoreException
  {}
  
  public void postLaunched(LaunchInfo info)
    throws CoreException
  {
    final IProject project = info.getProject();
    IManagedBuildInfo buildInfo = ManagedBuildManager.getBuildInfo(project);
    IConfiguration defaultConfig = buildInfo.getDefaultConfiguration();
    
    IProjectLaunchCommand manifest = ProjectUtil.getProjectManifest(project);
    String cflags = manifest.getAllCFlags(defaultConfig);
    if (cflags.contains("-fprofile-arcs -ftest-coverage")) {
      SWTUtil.asyncExec(new Runnable()
      {
        public void run()
        {
          GcovHelper.run(project);
        }
      });
    }
  }
}

/* Location:
 * Qualified Name:     org.tizen.codecoverage.StartUp.1
 * Java Class Version: 6 (50.0)
 * JD-Core Version:    0.7.1
 */
package org.tizen.codecoverage;

import org.eclipse.cdt.managedbuilder.core.IConfiguration;
import org.eclipse.cdt.managedbuilder.core.IManagedBuildInfo;
import org.eclipse.cdt.managedbuilder.core.ManagedBuildManager;
import org.eclipse.core.resources.IProject;
import org.eclipse.core.runtime.CoreException;
import org.eclipse.ui.IStartup;
import org.tizen.codecoverage.helper.GcovHelper;
import org.tizen.common.util.SWTUtil;
import org.tizen.nativecommon.ProjectUtil;
import org.tizen.nativecommon.launch.AbstractTizenCLaunchDelegate;
import org.tizen.nativecommon.launch.IProjectLaunchCommand;
import org.tizen.nativecommon.launch.LaunchInfo;
import org.tizen.nativecommon.launch.LaunchListener;

public class StartUp
  implements IStartup
{
  public void earlyStartup()
  {
    AbstractTizenCLaunchDelegate.addListener(new LaunchListener()
    {
      public void preLaunched(LaunchInfo info)
        throws CoreException
      {}
      
      public void postLaunched(LaunchInfo info)
        throws CoreException
      {
        final IProject project = info.getProject();
        IManagedBuildInfo buildInfo = ManagedBuildManager.getBuildInfo(project);
        IConfiguration defaultConfig = buildInfo.getDefaultConfiguration();
        
        IProjectLaunchCommand manifest = ProjectUtil.getProjectManifest(project);
        String cflags = manifest.getAllCFlags(defaultConfig);
        if (cflags.contains("-fprofile-arcs -ftest-coverage")) {
          SWTUtil.asyncExec(new Runnable()
          {
            public void run()
            {
              GcovHelper.run(project);
            }
          });
        }
      }
    });
  }
}

/* Location:
 * Qualified Name:     org.tizen.codecoverage.StartUp
 * Java Class Version: 6 (50.0)
 * JD-Core Version:    0.7.1
 */
package org.tizen.codecoverage.actions;

import org.eclipse.cdt.core.model.ICElement;
import org.eclipse.core.resources.IProject;
import org.eclipse.core.resources.IResource;
import org.eclipse.jface.action.IAction;
import org.eclipse.jface.viewers.ISelection;
import org.eclipse.jface.viewers.TreeSelection;
import org.eclipse.ui.IWorkbenchWindow;
import org.eclipse.ui.IWorkbenchWindowActionDelegate;
import org.tizen.codecoverage.helper.GcovHelper;

public class GcovAction
  implements IWorkbenchWindowActionDelegate
{
  private IProject project;
  
  public GcovAction()
  {
    project = null;
  }
  
  public void run(IAction action)
  {
    GcovHelper.run(project);
  }
  
  public void selectionChanged(IAction action, ISelection selection)
  {
    Object obj = null;
    if ((selection instanceof TreeSelection))
    {
      TreeSelection _selection = (TreeSelection)selection;
      if (_selection != null) {
        obj = _selection.getFirstElement();
      }
    }
    if (obj != null) {
      if ((obj instanceof IResource))
      {
        project = ((IResource)obj).getProject();
      }
      else if ((obj instanceof ICElement))
      {
        IResource resource = ((ICElement)obj).getResource();
        if (resource != null) {
          project = resource.getProject();
        }
      }
    }
  }
  
  public void dispose() {}
  
  public void init(IWorkbenchWindow window) {}
}

/* Location:
 * Qualified Name:     org.tizen.codecoverage.actions.GcovAction
 * Java Class Version: 6 (50.0)
 * JD-Core Version:    0.7.1
 */
package org.tizen.codecoverage.helper;

import java.util.LinkedList;
import java.util.List;
import org.eclipse.cdt.managedbuilder.core.IConfiguration;
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.IPath;
import org.eclipse.core.runtime.Path;
import org.eclipse.jface.dialogs.MessageDialog;
import org.eclipse.linuxtools.gcov.parser.CovManager;
import org.eclipse.linuxtools.gcov.view.CovView;
import org.eclipse.swt.widgets.Display;
import org.eclipse.swt.widgets.Shell;
import org.eclipse.ui.IWorkbench;
import org.eclipse.ui.PlatformUI;
import org.tizen.common.connection.ConnectionPlugin;
import org.tizen.nativecommon.ProjectUtil;
import org.tizen.sdblib.IDevice;

public class GcovHelper
{
  static final String DATA_DIR = "/data/";
  
  public static void run(IProject project)
  {
    if ((project == null) || (!project.exists()))
    {
      Shell s = PlatformUI.getWorkbench().getDisplay().getActiveShell();
      MessageDialog.openInformation(s, "Project not found", "Please select a project.");
      return;
    }
    IDevice currentDevice = ConnectionPlugin.getDefault().getCurrentDevice();
    if (currentDevice == null) {
      return;
    }
    String binary = getBinary(project);
    if (binary == null)
    {
      Shell s = PlatformUI.getWorkbench().getDisplay().getActiveShell();
      MessageDialog.openError(s, "Gcov Error", "Gcov failed. Binary file not found.\nPlease check Build Settings");
      return;
    }
    try
    {
      downloadGcdaFile(binary);
    }
    catch (Exception localException)
    {
      Shell s = PlatformUI.getWorkbench().getDisplay().getActiveShell();
      MessageDialog.openError(s, "Gcov Error", "Gcov failed. Coverage data file not found.");
      return;
    }
    CovView.displayCovResults(binary);
  }
  
  private static String getBinary(IResource binary, String target)
  {
    if ((binary.getLocation().toOSString().contains(target)) && (binary.getLocation().lastSegment().contains(binary.getProject().getName()))) {
      return binary.getLocation().toOSString();
    }
    return null;
  }
  
  public static String getBinary(IProject project)
  {
    String binaryName = ProjectUtil.getBinaryName(project);
    IConfiguration config = ProjectUtil.getDefaultConfiguration(project);
    IFile binaryFile = project.getFile(config.getName() + "/" + binaryName);
    if (binaryFile.exists()) {
      return binaryFile.getLocation().toString();
    }
    return null;
  }
  
  static IProject getProject(IPath file)
  {
    IFile c = ResourcesPlugin.getWorkspace().getRoot().getFileForLocation(file);
    return c.getProject();
  }
  
  public static void downloadGcdaFile(String binaryPath)
    throws Exception
  {
    CovManager cvrgeMnger = null;
    List<String> gcdaPaths = new LinkedList();
    cvrgeMnger = new CovManager(binaryPath);
    IPath binaryFile = new Path(binaryPath);
    boolean isLLVM = false;
    try
    {
      gcdaPaths = cvrgeMnger.getGCDALocations();
    }
    catch (Exception localException)
    {
      Shell s = PlatformUI.getWorkbench().getDisplay().getActiveShell();
      MessageDialog.openError(s, "Gcov Error", "Gcov failed. Binary not found.");
      return;
    }
    IProject project = getProject(binaryFile);
    
    downloadGcda(gcdaPaths, binaryFile, project, isLLVM);
  }
  
  /* Error */
  public static void downloadGcda(List<String> gcdaPathsInGcno, IPath binaryPath, IProject project, boolean isLLVM)
    throws Exception
  {
    // Byte code:
    //   0: invokestatic 55	org/tizen/common/connection/ConnectionPlugin:getDefault	()Lorg/tizen/common/connection/ConnectionPlugin;
    //   3: invokevirtual 61	org/tizen/common/connection/ConnectionPlugin:getCurrentDevice	()Lorg/tizen/sdblib/IDevice;
    //   6: astore 4
    //   8: aload 4
    //   10: invokeinterface 232 1 0
    //   15: astore 5
    //   17: ldc -20
    //   19: astore 6
    //   21: ldc -20
    //   23: astore 7
    //   25: aload_2
    //   26: aload 4
    //   28: invokestatic 238	org/tizen/codecoverage/helper/GcovHelper:getGcdaPath	(Lorg/eclipse/core/resources/IProject;Lorg/tizen/sdblib/IDevice;)Ljava/lang/String;
    //   31: astore 8
    //   33: aload_0
    //   34: invokeinterface 242 1 0
    //   39: astore 10
    //   41: goto +197 -> 238
    //   44: aload 10
    //   46: invokeinterface 246 1 0
    //   51: checkcast 100	java/lang/String
    //   54: astore 9
    //   56: new 204	org/eclipse/core/runtime/Path
    //   59: dup
    //   60: aload 9
    //   62: invokespecial 206	org/eclipse/core/runtime/Path:<init>	(Ljava/lang/String;)V
    //   65: iconst_1
    //   66: invokevirtual 252	org/eclipse/core/runtime/Path:removeLastSegments	(I)Lorg/eclipse/core/runtime/IPath;
    //   69: invokeinterface 168 1 0
    //   74: astore 6
    //   76: new 140	java/lang/StringBuilder
    //   79: dup
    //   80: aload 8
    //   82: invokestatic 145	java/lang/String:valueOf	(Ljava/lang/Object;)Ljava/lang/String;
    //   85: invokespecial 149	java/lang/StringBuilder:<init>	(Ljava/lang/String;)V
    //   88: aload 9
    //   90: invokevirtual 153	java/lang/StringBuilder:append	(Ljava/lang/String;)Ljava/lang/StringBuilder;
    //   93: invokevirtual 157	java/lang/StringBuilder:toString	()Ljava/lang/String;
    //   96: astore 7
    //   98: aload 7
    //   100: ldc_w 256
    //   103: ldc -105
    //   105: invokevirtual 258	java/lang/String:replaceAll	(Ljava/lang/String;Ljava/lang/String;)Ljava/lang/String;
    //   108: astore 7
    //   110: aload 7
    //   112: ldc -105
    //   114: ldc_w 262
    //   117: invokevirtual 258	java/lang/String:replaceAll	(Ljava/lang/String;Ljava/lang/String;)Ljava/lang/String;
    //   120: astore 7
    //   122: iconst_0
    //   123: istore 11
    //   125: aload 7
    //   127: invokevirtual 264	java/lang/String:length	()I
    //   130: istore 12
    //   132: aload 7
    //   134: ldc_w 268
    //   137: invokevirtual 270	java/lang/String:startsWith	(Ljava/lang/String;)Z
    //   140: ifeq +6 -> 146
    //   143: iinc 11 1
    //   146: aload 7
    //   148: ldc_w 274
    //   151: invokevirtual 276	java/lang/String:endsWith	(Ljava/lang/String;)Z
    //   154: ifeq +9 -> 163
    //   157: iinc 12 -1
    //   160: goto +29 -> 189
    //   163: new 140	java/lang/StringBuilder
    //   166: dup
    //   167: aload 7
    //   169: invokestatic 145	java/lang/String:valueOf	(Ljava/lang/Object;)Ljava/lang/String;
    //   172: invokespecial 149	java/lang/StringBuilder:<init>	(Ljava/lang/String;)V
    //   175: ldc_w 279
    //   178: invokevirtual 153	java/lang/StringBuilder:append	(Ljava/lang/String;)Ljava/lang/StringBuilder;
    //   181: invokevirtual 157	java/lang/StringBuilder:toString	()Ljava/lang/String;
    //   184: astore 7
    //   186: iinc 12 1
    //   189: aload 7
    //   191: iload 11
    //   193: iload 12
    //   195: invokevirtual 281	java/lang/String:substring	(II)Ljava/lang/String;
    //   198: astore 7
    //   200: aload 5
    //   202: aload 4
    //   204: aload 7
    //   206: invokeinterface 285 2 0
    //   211: aload 6
    //   213: invokevirtual 289	org/tizen/sdblib/service/SyncService:pull	(Lorg/tizen/sdblib/service/FileEntry;Ljava/lang/String;)Lorg/tizen/sdblib/service/SyncResult;
    //   216: astore 13
    //   218: aload 13
    //   220: invokevirtual 295	org/tizen/sdblib/service/SyncResult:isOk	()Z
    //   223: ifne +15 -> 238
    //   226: new 88	java/lang/Exception
    //   229: dup
    //   230: invokespecial 300	java/lang/Exception:<init>	()V
    //   233: astore 14
    //   235: aload 14
    //   237: athrow
    //   238: aload 10
    //   240: invokeinterface 301 1 0
    //   245: ifne -201 -> 44
    //   248: goto +20 -> 268
    //   251: astore 15
    //   253: iconst_1
    //   254: anewarray 3	java/lang/Object
    //   257: dup
    //   258: iconst_0
    //   259: aload 5
    //   261: aastore
    //   262: invokestatic 304	org/tizen/common/util/IOUtil:tryClose	([Ljava/lang/Object;)V
    //   265: aload 15
    //   267: athrow
    //   268: iconst_1
    //   269: anewarray 3	java/lang/Object
    //   272: dup
    //   273: iconst_0
    //   274: aload 5
    //   276: aastore
    //   277: invokestatic 304	org/tizen/common/util/IOUtil:tryClose	([Ljava/lang/Object;)V
    //   280: return
    // Line number table:
    //   Java source line #134	-> byte code offset #0
    //   Java source line #135	-> byte code offset #8
    //   Java source line #136	-> byte code offset #17
    //   Java source line #137	-> byte code offset #21
    //   Java source line #139	-> byte code offset #25
    //   Java source line #142	-> byte code offset #33
    //   Java source line #143	-> byte code offset #56
    //   Java source line #144	-> byte code offset #76
    //   Java source line #146	-> byte code offset #98
    //   Java source line #147	-> byte code offset #110
    //   Java source line #148	-> byte code offset #122
    //   Java source line #149	-> byte code offset #125
    //   Java source line #150	-> byte code offset #132
    //   Java source line #151	-> byte code offset #143
    //   Java source line #153	-> byte code offset #146
    //   Java source line #154	-> byte code offset #157
    //   Java source line #157	-> byte code offset #163
    //   Java source line #158	-> byte code offset #186
    //   Java source line #161	-> byte code offset #189
    //   Java source line #163	-> byte code offset #200
    //   Java source line #164	-> byte code offset #218
    //   Java source line #165	-> byte code offset #226
    //   Java source line #166	-> byte code offset #235
    //   Java source line #142	-> byte code offset #238
    //   Java source line #169	-> byte code offset #251
    //   Java source line #173	-> byte code offset #259
    //   Java source line #174	-> byte code offset #265
    //   Java source line #169	-> byte code offset #268
    //   Java source line #173	-> byte code offset #274
    //   Java source line #176	-> byte code offset #280
    // Local variable table:
    //   start	length	slot	name	signature
    //   0	281	0	gcdaPathsInGcno	List<String>
    //   0	281	1	binaryPath	IPath
    //   0	281	2	project	IProject
    //   0	281	3	isLLVM	boolean
    //   6	197	4	currentDevice	IDevice
    //   15	260	5	syncService	org.tizen.sdblib.service.SyncService
    //   19	193	6	dstFile	String
    //   23	182	7	srcFile	String
    //   31	50	8	targetPath	String
    //   54	35	9	gcdaPath	String
    //   39	200	10	localIterator	java.util.Iterator
    //   123	69	11	startPos	int
    //   130	64	12	endPos	int
    //   216	3	13	syncSuccess	org.tizen.sdblib.service.SyncResult
    //   233	3	14	e	Exception
    //   251	15	15	localObject	Object
    // Exception table:
    //   from	to	target	type
    //   33	251	251	finally
  }
  
  private static String getGcdaPath(IProject project, IDevice device)
  {
    String parrentDirectory = ProjectUtil.getRootTmpDirectory(project);
    String gcdaPath = parrentDirectory + "/data/";
    return gcdaPath;
  }
}

/* Location:
 * Qualified Name:     org.tizen.codecoverage.helper.GcovHelper
 * Java Class Version: 6 (50.0)
 * JD-Core Version:    0.7.1
 */
1

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