Search in sources :

Example 1 with IBinaryObject

use of org.eclipse.cdt.core.IBinaryParser.IBinaryObject in project linuxtools by eclipse.

the class STSymbolManager method getLineNumber.

/**
 * @param symbol
 * @param project
 * @return the line number of the given symbol
 */
public int getLineNumber(ISymbol symbol, IProject project) {
    IBinaryObject obj = symbol.getBinaryObject();
    IAddress address = symbol.getAddress();
    return getLineNumber(obj, address, project);
}
Also used : IBinaryObject(org.eclipse.cdt.core.IBinaryParser.IBinaryObject) IAddress(org.eclipse.cdt.core.IAddress)

Example 2 with IBinaryObject

use of org.eclipse.cdt.core.IBinaryParser.IBinaryObject in project linuxtools by eclipse.

the class STSymbolManager method getFilename.

/**
 * @param symbol
 * @param project
 * @return the filename of the given symbol
 */
public String getFilename(ISymbol symbol, IProject project) {
    IBinaryObject obj = symbol.getBinaryObject();
    IAddress address = symbol.getAddress();
    return getFileName(obj, address, project);
}
Also used : IBinaryObject(org.eclipse.cdt.core.IBinaryParser.IBinaryObject) IAddress(org.eclipse.cdt.core.IAddress)

Example 3 with IBinaryObject

use of org.eclipse.cdt.core.IBinaryParser.IBinaryObject in project linuxtools by eclipse.

the class OpenGCDialog method validateBinary.

private void validateBinary() {
    binValue = binText.getText();
    IStringVariableManager mgr = VariablesPlugin.getDefault().getStringVariableManager();
    try {
        binValue = mgr.performStringSubstitution(binValue, false);
    } catch (CoreException e) {
    // do nothing: never occurs
    }
    File f = new File(binValue);
    if (f.exists()) {
        IBinaryObject binary = STSymbolManager.sharedInstance.getBinaryObject(new Path(binValue));
        if (binary == null) {
            MessageDialog.openError(PlatformUI.getWorkbench().getDisplay().getActiveShell(), Messages.OpenGCDialog_invalid_bin_error_title, NLS.bind(Messages.OpenGCDialog_invalid_bin_error_message, binText.getText()));
            return;
        }
        binaryValid = true;
        getButton(IDialogConstants.OK_ID).setEnabled(binaryValid);
        // $NON-NLS-1$
        errorLabel.setText("");
    } else {
        binaryValid = false;
        getButton(IDialogConstants.OK_ID).setEnabled(false);
        if (!binValue.isEmpty()) {
            errorLabel.setText(NLS.bind(Messages.OpenGCDialog_bin_dne_error_label, binText.getText()));
        } else {
            errorLabel.setText(Messages.OpenGCDialog_no_bin_error_label);
        }
        return;
    }
}
Also used : IPath(org.eclipse.core.runtime.IPath) Path(org.eclipse.core.runtime.Path) CoreException(org.eclipse.core.runtime.CoreException) IStringVariableManager(org.eclipse.core.variables.IStringVariableManager) IBinaryObject(org.eclipse.cdt.core.IBinaryParser.IBinaryObject) IFile(org.eclipse.core.resources.IFile) File(java.io.File)

Example 4 with IBinaryObject

use of org.eclipse.cdt.core.IBinaryParser.IBinaryObject in project linuxtools by eclipse.

the class CovManager method fillGcovView.

/**
 * fill the model by count results
 * @throws CoreException, IOException, InterruptedException
 */
public void fillGcovView() {
    // process counts for summary level
    int summaryTotal = 0, summaryInstrumented = 0, summaryExecuted = 0;
    for (Folder f : allFolders) {
        summaryTotal += f.getNumLines();
        summaryInstrumented += f.getLinesInstrumented();
        summaryExecuted += f.getLinesExecuted();
    }
    // fill rootNode model: the entry of the contentProvider
    rootNode = new CovRootTreeElement(Messages.CovManager_Summary, summaryTotal, summaryExecuted, summaryInstrumented);
    IBinaryObject binaryObject = STSymbolManager.sharedInstance.getBinaryObject(new Path(binaryPath));
    for (Folder fldr : allFolders) {
        String folderLocation = fldr.getPath();
        CovFolderTreeElement fldrTreeElem = new CovFolderTreeElement(rootNode, folderLocation, fldr.getNumLines(), fldr.getLinesExecuted(), fldr.getLinesInstrumented());
        rootNode.addChild(fldrTreeElem);
        for (SourceFile src : fldr.getSrcFiles()) {
            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, project);
                srcTreeElem.addChild(new CovFunctionTreeElement(srcTreeElem, name, fnctn.getSrcFile(), fnctn.getFirstLineNmbr(), fnctn.getCvrge().getLinesExecuted(), fnctn.getCvrge().getLinesInstrumented()));
            }
        }
    }
}
Also used : IPath(org.eclipse.core.runtime.IPath) Path(org.eclipse.core.runtime.Path) CovFunctionTreeElement(org.eclipse.linuxtools.internal.gcov.model.CovFunctionTreeElement) CovRootTreeElement(org.eclipse.linuxtools.internal.gcov.model.CovRootTreeElement) IBinaryObject(org.eclipse.cdt.core.IBinaryParser.IBinaryObject) CovFolderTreeElement(org.eclipse.linuxtools.internal.gcov.model.CovFolderTreeElement) CovFileTreeElement(org.eclipse.linuxtools.internal.gcov.model.CovFileTreeElement)

Example 5 with IBinaryObject

use of org.eclipse.cdt.core.IBinaryParser.IBinaryObject in project linuxtools by eclipse.

the class GprofParserTest method testProcessGmonFile.

@Test
public void testProcessGmonFile() throws IOException {
    IBinaryObject binary = STSymbolManager.sharedInstance.getBinaryObject(binaryFile.getAbsolutePath());
    final GmonDecoder gmondecoder = new GmonDecoder(binary, new PrintStream(parserDumpFile), null);
    gmondecoder.setShouldDump(true);
    gmondecoder.read(gmonFile.getAbsolutePath());
    STJunitUtils.compareIgnoreEOL(parserDumpFile.getAbsolutePath(), parserRefFile.getAbsolutePath(), true);
}
Also used : PrintStream(java.io.PrintStream) GmonDecoder(org.eclipse.linuxtools.internal.gprof.parser.GmonDecoder) IBinaryObject(org.eclipse.cdt.core.IBinaryParser.IBinaryObject) Test(org.junit.Test)

Aggregations

IBinaryObject (org.eclipse.cdt.core.IBinaryParser.IBinaryObject)12 Path (org.eclipse.core.runtime.Path)5 IOException (java.io.IOException)3 IAddress (org.eclipse.cdt.core.IAddress)3 IPath (org.eclipse.core.runtime.IPath)3 GmonDecoder (org.eclipse.linuxtools.internal.gprof.parser.GmonDecoder)3 File (java.io.File)2 IFile (org.eclipse.core.resources.IFile)2 CoreException (org.eclipse.core.runtime.CoreException)2 IStatus (org.eclipse.core.runtime.IStatus)2 Status (org.eclipse.core.runtime.Status)2 InputStream (java.io.InputStream)1 InputStreamReader (java.io.InputStreamReader)1 LineNumberReader (java.io.LineNumberReader)1 PrintStream (java.io.PrintStream)1 ArrayList (java.util.ArrayList)1 LinkedList (java.util.LinkedList)1 IAddressFactory (org.eclipse.cdt.core.IAddressFactory)1 IBinaryParser (org.eclipse.cdt.core.IBinaryParser)1 ISymbol (org.eclipse.cdt.core.IBinaryParser.ISymbol)1