org.eclipse.linuxtools.gcov_4.1.1.201310101546

rocess(stringsTool, binaryPath);
      if (p == null) {
        p = getStringsProcess("sh4-linux-strings", binaryPath);
      }
    }
    else
    {
      Process p;
      if ("stxp70".equals(cpu))
      {
        String stringsTool = "stxp70v3-strings";
        p = getStringsProcess(stringsTool, binaryPath);
      }
      else
      {
        Process p;
        if ("st200".equals(cpu))
        {
          String stringsTool = cpu + "strings";
          p = getStringsProcess(stringsTool, binaryPath);
        }
        else
        {
          String stringsTool;
          String stringsTool;
          if (OSChecker.isWindows()) {
            stringsTool = SmartBuildInterface.getMingwBinPath() + "/strings";
          } else {
            stringsTool = "strings";
          }
          p = getStringsProcess(stringsTool, binaryPath);
        }
      }
    }
    if (p == null)
    {
      Status status = new Status(4, "org.eclipse.linuxtools.gcov", 4, 
        "An error occured during analysis: unable to retrieve gcov data", new IOException());
      Activator.getDefault().getLog().log(status);
      return l;
    }
    ThreadConsumer t = new ThreadConsumer(p, l);
    t.start();
    p.waitFor();
    t.join();
    
    return l;
  }
  
  private Process getStringsProcess(String stringsTool, String binaryPath)
  {
    try
    {
      return Runtime.getRuntime().exec(new String[] { stringsTool, binaryPath });
    }
    catch (Exception localException) {}
    return null;
  }
  
  private final class ThreadConsumer
    extends Thread
  {
    private final Process p;
    private final List<String> list;
    
    ThreadConsumer(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);
          }
        }
      }
    }
  }
  
  public void dumpProcessCovFilesResult(PrintStream ps)
    throws FileNotFoundException
  {
    ps.println("Parse gcda and gcno files done, resolve graph algorithm executed, now display results");
    ps.println("- PRINT FUNCTIONS ARRAY : ");
    for (int i = 0; i < allFnctns.size(); i++)
    {
      ps.println("-- FUNCTION " + i);
      ps.println("     name = " + ((GcnoFunction)allFnctns.get(i)).getName());
      ps.println("     instrumentd lines = " + ((GcnoFunction)allFnctns.get(i)).getCvrge().getLinesInstrumented());
      ps.println("     executed lines = " + ((GcnoFunction)allFnctns.get(i)).getCvrge().getLinesExecuted());
    }
    ps.println("- PRINT SRCS ARRAY : ");
    for (int i = 0; i < allSrcs.size(); i++)
    {
      ps.println("-- FILE " + i);
      ps.println("     name = " + ((SourceFile)allSrcs.get(i)).getName());
      ps.println("     total lines = " + ((SourceFile)allSrcs.get(i)).getNumLines());
      ps.println("     instrumentd lines = " + ((SourceFile)allSrcs.get(i)).getLinesInstrumented());
      ps.println("     executed lines = " + ((SourceFile)allSrcs.get(i)).getLinesExecuted());
    }
  }
  
  public HashMap<String, SourceFile> getSourceMap()
  {
    return sourceMap;
  }
}

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

import java.io.Serializable;

public class CoverageInfo
  implements Serializable
{
  private static final long serialVersionUID = -6067335353999481231L;
  private int linesInstrumented = 0;
  private int linesExecuted = 0;
  
  public int getLinesInstrumented()
  {
    return linesInstrumented;
  }
  
  public int getLinesExecuted()
  {
    return linesExecuted;
  }
  
  public void incLinesInstrumented()
  {
    linesInstrumented += 1;
  }
  
  public void incLinesExecuted()
  {
    linesExecuted += 1;
  }
}

/* Location:
 * Qualified Name:     org.eclipse.linuxtools.gcov.parser.CoverageInfo
 * 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 Folder
  implements Serializable
{
  private static final long serialVersionUID = 5155033391199109661L;
  private final String path;
  private final ArrayList<SourceFile> srcFiles = new ArrayList();
  private int numLines = 0;
  private int linesInstrumented = 0;
  private int linesExecuted = 0;
  
  public Folder(String path)
  {
    this.path = path;
  }
  
  public void accumulateSourcesCounts()
  {
    for (int i = 0; i < srcFiles.size(); i++)
    {
      numLines += ((SourceFile)srcFiles.get(i)).getNumLines();
      linesInstrumented += ((SourceFile)srcFiles.get(i)).getLinesInstrumented();
      linesExecuted += ((SourceFile)srcFiles.get(i)).getLinesExecuted();
    }
  }
  
  public String getPath()
  {
    return path;
  }
  
  public ArrayList<SourceFile> getSrcFiles()
  {
    return srcFiles;
  }
  
  public void addSrcFiles(SourceFile srcFile)
  {
    srcFiles.add(srcFile);
  }
  
  public int getNumLines()
  {
    return numLines;
  }
  
  public int getLinesExecuted()
  {
    return linesExecuted;
  }
  
  public int getLinesInstrumented()
  {
    return linesInstrumented;
  }
}

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

import java.io.DataInput;
import java.io.DataInputStream;
import java.io.EOFException;
import java.io.IOException;
import java.util.ArrayList;
import org.eclipse.core.runtime.CoreException;
import org.eclipse.core.runtime.Status;
import org.eclipse.linuxtools.gcov.utils.BEDataInputStream;
import org.eclipse.linuxtools.gcov.utils.LEDataInputStream;

public class GcdaRecordsParser
{
  private static final int GCOV_DATA_MAGIC = 1734567009;
  private static final int GCOV_TAG_FUNCTION = 16777216;
  private static final int GCOV_COUNTER_ARCS = 27328512;
  private static final int GCOV_TAG_OBJECT_SYMMARY = -1593835520;
  private static final int GCOV_TAG_PROGRAM_SUMMARY = -1560281088;
  private final ArrayList<GcnoFunction> fnctns;
  private long objSmryNbrPgmRuns = 0L;
  private long pgmSmryChksm = 0L;
  private long objSmryChksm = 0L;
  private long objSmryArcCnts = 0L;
  private long objSmrytotalCnts = 0L;
  private long objSmryRunMax = 0L;
  private long objSmrySumMax = 0L;
  
  public GcdaRecordsParser(ArrayList<GcnoFunction> fnctns)
  {
    this.fnctns = fnctns;
  }
  
  public void parseGcdaRecord(DataInput stream)
    throws IOException, CoreException
  {
    int magic = 0;
    
    GcnoFunction currentFnctn = null;
    
    magic = stream.readInt();
    
    stream.readInt();
    
    stream.readInt();
    if (magic == 1734567009)
    {
      stream = new BEDataInputStream((DataInputStream)stream);
    }
    else
    {
      magic = magic >> 16 | magic << 16;
      magic = (magic & 0xFF00FF) << 8 | magic >> 8 & 0xFF00FF;
      if (magic == 1734567009)
      {
        stream = new LEDataInputStream((DataInputStream)stream);
      }
      else
      {
        String message = magic + " :desn't correspond to a correct data file header\n";
        Status status = new Status(4, "org.eclipse.linuxtools.gcov", message);
        throw new CoreException(status);
      }
    }
    try
    {
      for (;;)
      {
        int tag = stream.readInt();
        long length = stream.readInt() & 0xFFFFFFFF;
        switch (tag)
        {
        case 16777216: 
          long fnctnId = stream.readInt() & 0xFFFFFFFF;
          if (!fnctns.isEmpty())
          {
            boolean fnctnFound = false;
            for (GcnoFunction f : fnctns) {
              if (f.getIdent() == fnctnId)
              {
                fnctnFound = true;
                currentFnctn = f;
                long fnctnChksm = stream.readInt() & 0xFFFFFFFF;
                if (f.getCheksum() == fnctnChksm) {
                  break;
                }
                String message = "Checksums don't correspond for " + 
                  currentFnctn.getName() + " (Id: " + fnctnId + ")\n";
                Status status = new Status(4, "org.eclipse.linuxtools.gcov", message);
                throw new CoreException(status);
              }
            }
            if (!fnctnFound)
            {
              currentFnctn = null;
              String message = "Function with Id: " + fnctnId + 
                " not found in function list\n";
              Status status = new Status(4, "org.eclipse.linuxtools.gcov", message);
              throw new CoreException(status);
            }
          }
          break;
        case 27328512: 
          if (currentFnctn == null)
          {
            String message = "Missing function or duplicate counter tag\n";
            Status status = new Status(4, "org.eclipse.linuxtools.gcov", message);
            throw new CoreException(status);
          }
          if (length != 2 * currentFnctn.getNumCounts())
          {
            String message = "GCDA content is inconsistent\n";
            Status status = new Status(4, "org.eclipse.linuxtools.gcov", message);
            throw new CoreException(status);
          }
          ArrayList<Block> fnctnBlcks = currentFnctn.getFunctionBlocks();
          if (fnctnBlcks.isEmpty())
          {
            String message = "Function block list is empty\n";
            Status status = new Status(4, "org.eclipse.linuxtools.gcov", message);
            throw new CoreException(status);
          }
          for (int i = 0; i < fnctnBlcks.size(); i++)
          {
            Block b = (Block)fnctnBlcks.get(i);
            int nonFakeExit = 0;
            
            Object arcsExit = b.getExitArcs();
            for (Arc extArc : (ArrayList)arcsExit)
            {
              if (!extArc.isFake()) {
                nonFakeExit++;
              }
              if (!extArc.isOnTree())
              {
                long arcsCnts = stream.readLong();
                extArc.setCount(arcsCnts);
                extArc.setCountValid(true);
                b.decNumSuccs();
                extArc.getDstnatnBlock().decNumPreds();
              }
            }
            if (nonFakeExit == 1) {
              for (Arc extArc : (ArrayList)arcsExit) {
                if (!extArc.isFake())
                {
                  extArc.setUnconditionnal(true);
                  if ((b.isCallSite()) && 
                    (extArc.isFallthrough())) {
                    if ((((Arc)extArc.getDstnatnBlock().getEntryArcs().get(0)).equals(extArc)) && 
                      (extArc.getDstnatnBlock()
                      .getEntryArcs().size() == 1)) {
                      extArc.getDstnatnBlock().setCallReturn(true);
                    }
                  }
                }
              }
            }
          }
          currentFnctn = null;
          break;
        case -1593835520: 
          objSmryChksm = (stream.readInt() & 0xFFFFFFFF);
          objSmryArcCnts = (stream.readInt() & 0xFFFFFFFF);
          objSmryNbrPgmRuns = (stream.readInt() & 0xFFFFFFFF);
          objSmrytotalCnts = stream.readLong();
          objSmryRunMax = stream.readLong();
          objSmrySumMax = stream.readLong();
          break;
        case -1560281088: 
          pgmSmryChksm = (stream.readInt() & 0xFFFFFFFF);
          for (int i = 0; i < length - 1L; i++) {
            stream.readInt();
          }
        }
      }
      return;
    }
    catch (EOFException localEOFException) {}
  }
  
  public long getObjSmryNbrPgmRuns()
  {
    return objSmryNbrPgmRuns;
  }
  
  public long getObjSmryChksm()
  {
    return objSmryChksm;
  }
  
  public long getObjSmryArcCnts()
  {
    return objSmryArcCnts;
  }
  
  public long getObjSmrytotalCnts()
  {
    return objSmrytotalCnts;
  }
  
  public long getObjSmryRunMax()
  {
    return objSmryRunMax;
  }
  
  public long getObjSmrySumMax()
  {
    return objSmrySumMax;
  }
  
  public long getPgmSmryChksm()
  {
    return pgmSmryChksm;
  }
}

/* Location:
 * Qualified Name:     org.eclipse.linuxtools.gcov.parser.GcdaRecordsParser
 * 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 GcnoFunction
  implements Serializable, Comparable<GcnoFunction>
{
  private static final long serialVersionUID = -4159055012321132651L;
  private final long ident;
  private final long cheksum;
  private final long firstLineNmbr;
  private final String name;
  private final String srcFile;
  private ArrayList<Block> functionBlocks = new ArrayList();
  private int numCounts = 0;
  private int blocksExecuted = 0;
  private int numBlocks = 0;
  private final CoverageInfo cvrge = new CoverageInfo();
  
  public GcnoFunction(long fnctnIdent, long fnctnChksm, String fnctnName, String fnctnSrcFle, long fnctnFrstLnNmbr)
  {
    ident = fnctnIdent;
    cheksum = fnctnChksm;
    name = fnctnName;
    srcFile = fnctnSrcFle;
    firstLineNmbr = fnctnFrstLnNmbr;
  }
  
  public int compareTo(GcnoFunction o)
  {
    if (getFirstLineNmbr() > o.getFirstLineNmbr()) {
      return 1;
    }
    if (getFirstLineNmbr() < o.getFirstLineNmbr()) {
      return -1;
    }
    return 0;
  }
  
  public void addLineCounts(ArrayList<SourceFile> srcs)
  {
    for (int i = 0; i != numBlocks; i++)
    {
      Block blk = (Block)functionBlocks.get(i);
      SourceFile fileSrc = null;
      if ((blk.getCount() != 0L) && (i != 0) && (i + 1 != numBlocks)) {
        blocksExecuted += 1;
      }
      long[] enc = blk.getEncoding();
      int j = 0;
      for (int k = 0; j != blk.getLineNum(); k++)
      {
        if (enc[k] == 0L)
        {
          int srcn = (int)enc[(++k)];
          for (SourceFile sf : srcs) {
            if (sf.getIndex() == srcn)
            {
              fileSrc = sf;
              break;
            }
          }
          j++;
        }
        else if ((fileSrc != null) && (enc[k] < fileSrc.getLines().size()))
        {
          Line line = (Line)fileSrc.getLines().get((int)enc[k]);
          if (!line.isExists()) {
            cvrge.incLinesInstrumented();
          }
          if ((line.getCount() == 0L) && (blk.getCount() != 0L)) {
            cvrge.incLinesExecuted();
          }
          line.setExists(true);
          line.setCount(line.getCount() + blk.getCount());
        }
        j++;
      }
    }
  }
  
  public void solveGraphFnctn()
  {
    ArrayList<Block> fnctnBlcks = functionBlocks;
    ArrayList<Block> validBlocks = new ArrayList();
    ArrayList<Block> invalidBlocks = new ArrayList();
    if (fnctnBlcks.size() >= 2)
    {
      if (((Block)fnctnBlcks.get(0)).getNumPreds() == 0L) {
        ((Block)fnctnBlcks.get(0)).setNumPreds(50000L);
      }
      if (((Block)fnctnBlcks.get(fnctnBlcks.size() - 1)).getNumSuccs() == 0L) {
        ((Block)fnctnBlcks.get(fnctnBlcks.size() - 1)).setNumSuccs(50000L);
      }
    }
    for (int i = 0; i < fnctnBlcks.size(); i++)
    {
      Block b = (Block)fnctnBlcks.get(i);
      b.setInvalidChain(true);
      invalidBlocks.add(b);
    }
    for (; (!validBlocks.isEmpty()) || (!
          invalidBlocks.isEmpty()); !validBlocks.isEmpty()) {
      if (!invalidBlocks.isEmpty())
      {
        for (int i = invalidBlocks.size() - 1; i >= 0; i--)
        {
          Block invb = (Block)invalidBlocks.get(i);
          long total = 0L;
          invalidBlocks.remove(i);
          invb.setInvalidChain(false);
          if (invb.getNumSuccs() == 0L)
          {
            ArrayList<Arc> extArcs = invb.getExitArcs();
            for (Arc arc : extArcs) {
              total += arc.getCount();
            }
          }
          else
          {
            if (invb.getNumPreds() != 0L) {
              continue;
            }
            ArrayList<Arc> entrArcs = invb.getEntryArcs();
            for (Arc arc : entrArcs) {
              total += arc.getCount();
            }
          }
          invb.setCount(total);
          invb.setCountValid(true);
          invb.setValidChain(true);
          validBlocks.add(invb);
        }
        continue;
        int last = validBlocks.size() - 1;
        Block vb = (Block)validBlocks.get(last);
        Arc invarc = null;
        int total = 0;
        validBlocks.remove(last);
        
        vb.setValidChain(false);
        if (vb.getNumSuccs() == 1L)
        {
          total = (int)vb.getCount();
          for (Arc extAr : vb.getExitArcs())
          {
            total = (int)(total - extAr.getCount());
            if (!extAr.isCountValid()) {
              invarc = extAr;
            }
          }
          Block blcksdst = invarc.getDstnatnBlock();
          invarc.setCountValid(true);
          invarc.setCount(total);
          vb.decNumSuccs();
          blcksdst.decNumPreds();
          if (blcksdst.isCountValid())
          {
            if ((blcksdst.getNumPreds() == 1L) && 
              (!blcksdst.isValidChain()))
            {
              blcksdst.setValidChain(true);
              validBlocks.add(blcksdst);
            }
          }
          else if ((blcksdst.getNumPreds() == 0L) && 
            (!blcksdst.isInvalidChain()))
          {
            blcksdst.setInvalidChain(true);
            invalidBlocks.add(blcksdst);
          }
        }
        if (vb.getNumPreds() == 1L)
        {
          total = (int)vb.getCount();
          invarc = null;
          for (Arc entrAr : vb.getEntryArcs())
          {
            total = (int)(total - entrAr.getCount());
            if (!entrAr.isCountValid()) {
              invarc = entrAr;
            }
          }
          Block blcksrc = invarc.getSrcBlock();
          invarc.setCountValid(true);
          invarc.setCount(total);
          vb.decNumPreds();
          blcksrc.decNumSuccs();
          if (blcksrc.isCountValid())
          {
            if ((blcksrc.getNumSuccs() == 1L) && 
              (!blcksrc.isInvalidChain()))
            {
              blcksrc.setValidChain(true);
              validBlocks.add(blcksrc);
            }
          }
          else if ((blcksrc.getNumSuccs() == 0L) && 
            (!blcksrc.isInvalidChain()))
          {
            blcksrc.setInvalidChain(true);
            invalidBlocks.add(blcksrc);
          }
        }
      }
    }
  }
  
  public long getIdent()
  {
    return ident;
  }
  
  public long getCheksum()
  {
    return cheksum;
  }
  
  public String getName()
  {
    return name;
  }
  
  public String getSrcFile()
  {
    return srcFile;
  }
  
  public long getFirstLineNmbr()
  {
    return firstLineNmbr;
  }
  
  public ArrayList<Block> getFunctionBlocks()
  {
    return functionBlocks;
  }
  
  public Block getFunctionBlock(int i)
  {
    return (Block)functionBlocks.get(i);
  }
  
  public void setFunctionBlocks(ArrayList<Block> functionBlocks)
  {
    this.functionBlocks = functionBlocks;
  }
  
  public void incNumCounts()
  {
    numCounts += 1;
  }
  
  public int getNumCounts()
  {
    return numCounts;
  }
  
  public int getNumBlocks()
  {
    return numBlocks;
  }
  
  public void setNumBlocks(int numBlocks)
  {
    this.numBlocks = numBlocks;
  }
  
  public CoverageInfo getCvrge()
  {
    return cvrge;
  }
}

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

import java.io.DataInput;
import java.io.DataInputStream;
import java.io.EOFException;
import java.io.IOException;
import java.util.ArrayList;
import java.util.HashMap;
import org.eclipse.core.runtime.CoreException;
import org.eclipse.core.runtime.Status;
import org.eclipse.linuxtools.gcov.utils.BEDataInputStream;
import org.eclipse.linuxtools.gcov.utils.GcovStringReader;
import org.eclipse.linuxtools.gcov.utils.LEDataInputStream;

public class GcnoRecordsParser
{
  private static final int GCOV_NOTE_MAGIC = 1734569583;
  private static final int GCOV_TAG_FUNCTION = 16777216;
  private static final int GCOV_TAG_BLOCKS = 21037056;
  private static final int GCOV_TAG_ARCS = 21168128;
  private static final int GCOV_TAG_LINES = 21299200;
  private GcnoFunction fnctn = null;
  private final ArrayList<GcnoFunction> fnctns = new ArrayList();
  private final ArrayList<SourceFile> currentAllSrcs;
  private final HashMap<String, SourceFile> sourceMap;
  
  public GcnoRecordsParser(HashMap<String, SourceFile> sourceMap, ArrayList<SourceFile> AllSrcs)
  {
    this.sourceMap = sourceMap;
    currentAllSrcs = AllSrcs;
  }
  
  private SourceFile findOrAdd(String fileName, ArrayList<SourceFile> srcs)
  {
    SourceFile newsrc = (SourceFile)sourceMap.get(fileName);
    if (newsrc == null)
    {
      newsrc = new SourceFile(fileName, srcs.size() + 1);
      srcs.add(newsrc);
      sourceMap.put(fileName, newsrc);
    }
    return newsrc;
  }
  
  public void parseData(DataInput stream)
    throws IOException, CoreException
  {
    int magic = 0;
    
    ArrayList<Block> blocks = null;
    
    SourceFile source = null;
    
    boolean parseFirstFnctn = false;
    
    magic = stream.readInt();
    
    stream.readInt();
    
    stream.readInt();
    if (magic == 1734569583)
    {
      stream = new BEDataInputStream((DataInputStream)stream);
    }
    else
    {
      magic = magic >> 16 | magic << 16;
      magic = (magic & 0xFF00FF) << 8 | magic >> 8 & 0xFF00FF;
      if (magic == 1734569583)
      {
        stream = new LEDataInputStream((DataInputStream)stream);
      }
      else
      {
        String message = magic + " :desn't correspond to a correct note file header\n";
        Status status = new Status(4, "org.eclipse.linuxtools.gcov", message);
        throw new CoreException(status);
      }
    }
    try
    {
      for (;;)
      {
        int tag = stream.readInt();
        if ((tag == 16777216) || (tag == 21037056) || 
          (tag == 21168128) || (tag == 21299200))
        {
          int length = stream.readInt();
          if (tag == 16777216)
          {
            if (parseFirstFnctn) {
              fnctns.add(fnctn);
            }
            long fnctnIdent = stream.readInt() & 0xFFFFFFFF;
            long fnctnChksm = stream.readInt() & 0xFFFFFFFF;
            String fnctnName = GcovStringReader.readString(stream);
            String fnctnSrcFle = GcovStringReader.readString(stream);
            long fnctnFrstLnNmbr = stream.readInt() & 0xFFFFFFFF;
            
            fnctn = new GcnoFunction(fnctnIdent, fnctnChksm, fnctnName, fnctnSrcFle, fnctnFrstLnNmbr);
            SourceFile srcFle2 = findOrAdd(fnctn.getSrcFile(), currentAllSrcs);
            if (fnctn.getFirstLineNmbr() >= srcFle2.getNumLines()) {
              srcFle2.setNumLines((int)fnctn.getFirstLineNmbr() + 1);
            }
            srcFle2.addFnctn(fnctn);
            parseFirstFnctn = true;
          }
          else if (tag == 21037056)
          {
            blocks = new ArrayList();
            for (int i = 0; i < length; i++)
            {
              long BlckFlag = stream.readInt() & 0xFFFFFFFF;
              Block blck = new Block(BlckFlag);
              blocks.add(blck);
            }
            fnctn.setNumBlocks(length);
          }
          else if (tag == 21168128)
          {
            int srcBlockIndice = stream.readInt();
            int nmbrArcs = (length - 1) / 2;
            ArrayList<Arc> arcs = new ArrayList(nmbrArcs);
            long flag;
            for (int i = 0; i < nmbrArcs; i++)
            {
              int dstnatnBlockIndice = stream.readInt();
              flag = stream.readInt() & 0xFFFFFFFF;
              Arc arc = new Arc(srcBlockIndice, dstnatnBlockIndice, flag, blocks);
              arcs.add(arc);
            }
            Block srcBlk = (Block)blocks.get(srcBlockIndice);
            for (Arc a : arcs)
            {
              srcBlk.addExitArcs(a);
              srcBlk.incNumSuccs();
            }
            for (Arc a : arcs)
            {
              Block dstntnBlk = a.getDstnatnBlock();
              dstntnBlk.addEntryArcs(a);
              dstntnBlk.incNumPreds();
            }
            for (Arc a : arcs)
            {
              if (a.isFake()) {
                if (a.getSrcBlock() != null)
                {
                  srcBlk = (Block)blocks.get(srcBlockIndice);
                  srcBlk.setCallSite(true);
                  a.setCallNonReturn(true);
                }
                else
                {
                  a.setNonLoclaReturn(true);
                  Block dstntnBlk = a.getDstnatnBlock();
                  dstntnBlk.setNonLocalReturn(true);
                }
              }
              if (!a.isOnTree()) {
                fnctn.incNumCounts();
              }
            }
            fnctn.setFunctionBlocks(blocks);
          }
          else if (tag == 21299200)
          {
            int numBlock = stream.readInt();
            long[] lineNos = new long[length - 1];
            int ix = 0;
            for (;;)
            {
              long lineNumber = stream.readInt() & 0xFFFFFFFF;
              if (lineNumber != 0L)
              {
                if (ix == 0)
                {
                  lineNos[(ix++)] = 0L;
                  lineNos[(ix++)] = source.getIndex();
                }
                lineNos[(ix++)] = lineNumber;
                if (lineNumber >= source.getNumLines()) {
                  source.setNumLines((int)lineNumber + 1);
                }
              }
              else
              {
                String fileName = GcovStringReader.readString(stream);
                if (fileName == "NULL string") {
                  break;
                }
                source = findOrAdd(fileName, currentAllSrcs);
                lineNos[(ix++)] = 0L;
                lineNos[(ix++)] = source.getIndex();
              }
            }
            ((Block)fnctn.getFunctionBlocks().get(numBlock)).setEncoding(lineNos);
            
            ((Block)fnctn.getFunctionBlocks().get(numBlock))
              .setNumLine(ix);
          }
        }
      }
      return;
    }
    catch (EOFException localEOFException)
    {
      if (fnctn != null)
      {
        fnctn.setFunctionBlocks(blocks);
        fnctns.add(fnctn);
      }
    }
  }
  
  public ArrayList<GcnoFunction> getFnctns()
  {
    return fnctns;
  }
  
  public ArrayList<SourceFile> getcurrentAllSrcs()
  {
    return currentAllSrcs;
  }
}

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

import java.io.Serializable;

public class Line
  implements Serializable
{
  private static final long serialVersionUID = 8804878976767948267L;
  private boolean exists = false;
  private long count = 0L;
  
  public boolean isExists()
  {
    return exists;
  }
  
  public void setExists(boolean exists)
  {
    this.exists = exists;
  }
  
  public void setCount(long count)
  {
    this.count = count;
  }
  
  public long getCount()
  {
    return count;
  }
}

/* Location:
 * Qualified Name:     org.eclipse.linuxtools.gcov.parser.Line
 * 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;
import java.util.SortedSet;
import java.util.TreeSet;

public class SourceFile
  implements Serializable
{
  private static final long serialVersionUID = -9182882194956475711L;
  private final String name;
  private final int index;
  private final ArrayList<Line> lines = new ArrayList();
  private final TreeSet<GcnoFunction> fnctns = new TreeSet();
  private int numLines = 1;
  private final CoverageInfo cvrge = new CoverageInfo();
  private long maxCount = -1L;
  
  public SourceFile(String name, int index)
  {
    this.name = name;
    this.index = index;
  }
  
  public void accumulateLineCounts()
  {
    for (Line line : lines) {
      if (line.isExists())
      {
        cvrge.incLinesInstrumented();
        if (line.getCount() != 0L) {
          cvrge.incLinesExecuted();
        }
      }
    }
  }
  
  public long getmaxLineCount()
  {
    if (maxCount < 0L) {
      for (Line line : lines) {
        if (line.getCount() > maxCount) {
          maxCount = line.getCount();
        }
      }
    }
    return maxCount;
  }
  
  public int getLinesExecuted()
  {
    return cvrge.getLinesExecuted();
  }
  
  public int getLinesInstrumented()
  {
    return cvrge.getLinesInstrumented();
  }
  
  public String getName()
  {
    return name;
  }
  
  public ArrayList<Line> getLines()
  {
    return lines;
  }
  
  public SortedSet<GcnoFunction> getFnctns()
  {
    return fnctns;
  }
  
  public void addFnctn(GcnoFunction fnctn)
  {
    fnctns.add(fnctn);
  }
  
  public int getNumLines()
  {
    return numLines;
  }
  
  public void setNumLines(int numLines)
  {
    this.numLines = numLines;
  }
  
  public int getIndex()
  {
    return index;
  }
  
  public void createLines()
  {
    int n = getNumLines();
    lines.ensureCapacity(n);
    for (int j = 0; j < n; j++) {
      lines.add(new Line());
    }
  }
}

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

import java.io.DataInput;
import java.io.DataInputStream;
import java.io.IOException;

public class BEDataInputStream
  implements DataInput
{
  private final DataInputStream in;
  private final byte[] buffer = new byte[8];
  
  public BEDataInputStream(DataInputStream in)
  {
    this.in = in;
  }
  
  public final short readShort()
    throws IOException
  {
    return in.readShort();
  }
  
  public final int readUnsignedShort()
    throws IOException
  {
    return in.readUnsignedShort();
  }
  
  public final char readChar()
    throws IOException
  {
    return in.readChar();
  }
  
  public final int readInt()
    throws IOException
  {
    return in.readInt();
  }
  
  public final long readLong()
    throws IOException
  {
    in.readFully(buffer, 0, 8);
    return (buffer[7] << 32) + (
      (buffer[6] & 0xFF) << 40) + (
      (buffer[5] & 0xFF) << 48) + (
      (buffer[4] & 0xFF) << 56) + (
      (buffer[3] & 0xFF) << 0) + (
      (buffer[2] & 0xFF) << 8) + (
      (buffer[1] & 0xFF) << 16) + (
      (buffer[0] & 0xFF) << 24);
  }
  
  public final float readFloat()
    throws IOException
  {
    return Float.intBitsToFloat(readInt());
  }
  
  public final double readDouble()
    throws IOException
  {
    return Double.longBitsToDouble(readLong());
  }
  
  public boolean readBoolean()
    throws IOException
  {
    return in.readBoolean();
  }
  
  public byte readByte()
    throws IOException
  {
    return in.readByte();
  }
  
  public void readFully(byte[] b)
    throws IOException
  {
    in.readFully(b);
  }
  
  public void readFully(byte[] b, int off, int len)
    throws IOException
  {
    in.readFully(b, off, len);
  }
  
  @Deprecated
  public String readLine()
    throws IOException
  {
    return in.readLine();
  }
  
  public String readUTF()
    throws IOException
  {
    return in.readUTF();
  }
  
  public int readUnsignedByte()
    throws IOException
  {
    return in.readUnsignedByte();
  }
  
  public int skipBytes(int n)
    throws IOException
  {
    return in.skipBytes(n);
  }
  
  public void close()
    throws IOException
  {
    in.close();
  }
  
  public final long readUnsignedInt()
    throws IOException
  {
    in.readFully(buffer, 0, 4);
    return 
      (
      buffer[0] << 24 | 
      (buffer[1] & 0xFF) << 16 | 
      (buffer[2] & 0xFF) << 8 | 
      buffer[3] & 0xFF) & 
      
      0xFFFFFFFF;
  }
}

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

import java.io.DataInput;
import java.io.IOException;

public class GcovStringReader
{
  public static String readString(DataInput stream)
    throws IOException
  {
    String res = "NULL string";
    long length = stream.readInt() & 0xFFFFFFFF;
    if (length != 0L)
    {
      int ln = (int)length << 2;
      byte[] name = new byte[ln];
      stream.readFully(name);
      StringBuffer sb = new StringBuffer();
      for (int j = 0; j < ln; j++) {
        if (name[j] != 0)
        {
          char c = (char)name[j];
          sb.append(c);
        }
      }
      res = sb.toString();
    }
    return res;
  }
}

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

import java.io.DataInput;
import java.io.DataInputStream;
import java.io.IOException;

public class LEDataInputStream
  implements DataInput
{
  private final DataInputStream in;
  private final byte[] buffer = new byte[8];
  
  public LEDataInputStream(DataInputStream in)
  {
    this.in = in;
  }
  
  public final short readShort()
    throws IOException
  {
    in.readFully(buffer, 0, 2);
    return (short)(
      (buffer[1] & 0xFF) << 8 | 
      buffer[0] & 0xFF);
  }
  
  public final int readUnsignedShort()
    throws IOException
  {
    in.readFully(buffer, 0, 2);
    return 
      (buffer[1] & 0xFF) << 8 | 
      buffer[0] & 0xFF;
  }
  
  public final char readChar()
    throws IOException
  {
    in.readFully(buffer, 0, 2);
    return (char)(
      (buffer[1] & 0xFF) << 8 | 
      buffer[0] & 0xFF);
  }
  
  public final int readInt()
    throws IOException
  {
    in.readFully(buffer, 0, 4);
    return 
      buffer[3] << 24 | 
      (buffer[2] & 0xFF) << 16 | 
      (buffer[1] & 0xFF) << 8 | 
      buffer[0] & 0xFF;
  }
  
  public final long readLong()
    throws IOException
  {
    in.readFully(buffer, 0, 8);
    return 
      buffer[7] << 56 | 
      (buffer[6] & 0xFF) << 48 | 
      (buffer[5] & 0xFF) << 40 | 
      (buffer[4] & 0xFF) << 32 | 
      (buffer[3] & 0xFF) << 24 | 
      (buffer[2] & 0xFF) << 16 | 
      (buffer[1] & 0xFF) << 8 | 
      buffer[0] & 0xFF;
  }
  
  public final float readFloat()
    throws IOException
  {
    return Float.intBitsToFloat(readInt());
  }
  
  public final double readDouble()
    throws IOException
  {
    return Double.longBitsToDouble(readLong());
  }
  
  public boolean readBoolean()
    throws IOException
  {
    return in.readBoolean();
  }
  
  public byte readByte()
    throws IOException
  {
    return in.readByte();
  }
  
  public void readFully(byte[] b)
    throws IOException
  {
    in.readFully(b);
  }
  
  public void readFully(byte[] b, int off, int len)
    throws IOException
  {
    in.readFully(b, off, len);
  }
  
  @Deprecated
  public String readLine()
    throws IOException
  {
    return in.readLine();
  }
  
  public String readUTF()
    throws IOException
  {
    return in.readUTF();
  }
  
  public int readUnsignedByte()
    throws IOException
  {
    return in.readUnsignedByte();
  }
  
  public int skipBytes(int n)
    throws IOException
  {
    return in.skipBytes(n);
  }
  
  public void close()
    throws IOException
  {
    in.close();
  }
  
  public final long readUnsignedInt()
    throws IOException
  {
    in.readFully(buffer, 0, 4);
    return 
      (
      buffer[3] << 24 | 
      (buffer[2] & 0xFF) << 16 | 
      (buffer[1] & 0xFF) << 8 | 
      buffer[0] & 0xFF) & 
      
      0xFFFFFFFF;
  }
}

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

public class MasksGenerator
{
  public static final long UNSIGNED_INT_MASK = 4294967295L;
}

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

import java.io.File;
import java.io.IOException;
import java.util.WeakHashMap;
import org.eclipse.cdt.core.IBinaryParser.IBinaryObject;
import org.eclipse.core.runtime.IPath;
import org.eclipse.core.runtime.Path;
import org.eclipse.linuxtools.binutils.utils.STNMFactory;
import org.eclipse.linuxtools.binutils.utils.STNMSymbolsHandler;
import org.eclipse.linuxtools.binutils.utils.STSymbolManager;

public class STGcovProgramChecker
  implements STNMSymbolsHandler
{
  private boolean gcovFound = false;
  private long timestamp;
  private static final WeakHashMap<File, STGcovProgramChecker> map = new WeakHashMap();
  
  private STGcovProgramChecker(long timestamp)
  {
    this.timestamp = timestamp;
  }
  
  private static STGcovProgramChecker getProgramChecker(IBinaryParser.IBinaryObject object)
    throws IOException
  {
    File program = object.getPath().toFile();
    STGcovProgramChecker pg = (STGcovProgramChecker)map.get(program);
    if (pg == null)
    {
      pg = new STGcovProgramChecker(program.lastModified());
      STNMFactory.getNM(object.getCPU(), object.getPath().toOSString(), pg);
      map.put(program, pg);
    }
    else
    {
      long fileTime = program.lastModified();
      if (fileTime > timestamp)
      {
        timestamp = fileTime;
        gcovFound = false;
        STNMFactory.getNM(object.getCPU(), object.getPath().toOSString(), pg);
      }
    }
    return pg;
  }
  
  public static boolean isGCovCompatible(String s)
    throws IOException
  {
    IBinaryParser.IBinaryObject object = STSymbolManager.sharedInstance.getBinaryObject(new Path(s));
    if (object == null) {
      return false;
    }
    return isGCovCompatible(object);
  }
  
  public static boolean isGCovCompatible(IBinaryParser.IBinaryObject object)
    throws IOException
  {
    STGcovProgramChecker pg = getProgramChecker(object);
    return gcovFound;
  }
  
  public void foundBssSymbol(String symbol, String address) {}
  
  public void foundDataSymbol(String symbol, String address) {}
  
  public void foundTextSymbol(String symbol, String address)
  {
    if (("gcov_read_words".equals(symbol)) || ("_gcov_read_words".equals(symbol))) {
      gcovFound = true;
    }
  }
  
  public void foundUndefSymbol(String symbol) {}
}

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

import java.util.LinkedList;
import org.eclipse.linuxtools.gcov.model.CovFolderTreeElement;
import org.eclipse.linuxtools.gcov.model.CovRootTreeElement;
import org.eclipse.linuxtools.gcov.model.TreeElement;

public class CovFileContentProvider
  extends CovFolderContentProvider
{
  public static final CovFileContentProvider sharedInstance = new CovFileContentProvider();
  
  public Object[] getChildren(Object parentElement)
  {
    if ((parentElement instanceof CovRootTreeElement))
    {
      CovRootTreeElement root = (CovRootTreeElement)parentElement;
      LinkedList<? extends TreeElement> ret = getElementChildrenList(root);
      return ret.toArray();
    }
    return super.getChildren(parentElement);
  }
  
  protected LinkedList<? extends TreeElement> getElementChildrenList(CovRootTreeElement root)
  {
    LinkedList<TreeElement> ret = new LinkedList();
    LinkedList<? extends TreeElement> list = root.getChildren();
    for (TreeElemen
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