use of org.eclipse.linuxtools.valgrind.core.IValgrindMessage in project linuxtools by eclipse.
the class MultiProcessTest method testNoExec.
@Test
public void testNoExec() throws Exception {
ILaunchConfiguration config = createConfiguration(proj.getProject());
// $NON-NLS-1$
doLaunch(config, "testNoExec");
IValgrindMessage[] messages = ValgrindUIPlugin.getDefault().getView().getMessages();
assertEquals(1, messages.length);
// $NON-NLS-1$
checkTestMessages(messages, "testNoExec");
}
use of org.eclipse.linuxtools.valgrind.core.IValgrindMessage in project linuxtools by eclipse.
the class WrongDeallocationResolution method getMessagesByText.
/**
* Returns all of the messages from the currently active Valgrind view that
* contains a given {@link String} in their description.
* @param text the {@link String} to match the Valgrind messages' descriptions
* @return All messages containing the given text.
*/
private IValgrindMessage[] getMessagesByText(String text) {
ValgrindViewPart valgrindView = ValgrindUIPlugin.getDefault().getView();
ArrayList<IValgrindMessage> foundMessages = new ArrayList<>();
if (valgrindView != null) {
IValgrindMessage[] messages = valgrindView.getMessages();
if (messages != null && messages.length != 0) {
for (IValgrindMessage message : messages) {
if (message.getText().contains(text)) {
foundMessages.add(message);
}
}
}
}
IValgrindMessage[] foundMessagesArray = new IValgrindMessage[foundMessages.size()];
foundMessages.toArray(foundMessagesArray);
return foundMessagesArray;
}
use of org.eclipse.linuxtools.valgrind.core.IValgrindMessage in project linuxtools by eclipse.
the class WrongDeallocationResolution method getMessage.
/**
* Returns the {@link IValgrindMessage} element from the Valgrind View that represents
* a given Marker
* @param marker the marker to which the ValgrindMessage relates
* @return {@link IValgrindMessage} that represents the {@link IMarker}
*/
private IValgrindMessage getMessage(IMarker marker) {
IValgrindMessage message = null;
String file = marker.getResource().getName();
int line = marker.getAttribute(IMarker.LINE_NUMBER, 0);
// $NON-NLS-1$
IValgrindMessage[] wrongDeallocMessages = getMessagesByText(Messages.getString("ValgrindMemcheckQuickFixes.Wrong_dealloc_message"));
for (IValgrindMessage wrongDeallocMessage : wrongDeallocMessages) {
ValgrindStackFrame stackBottom = getStackBottom(wrongDeallocMessage);
int stackBottomLine = stackBottom.getLine();
String stackBottomFile = stackBottom.getFile();
if (stackBottomLine == line && file != null && stackBottomFile.endsWith(file)) {
message = stackBottom;
}
}
return message;
}
use of org.eclipse.linuxtools.valgrind.core.IValgrindMessage in project linuxtools by eclipse.
the class WrongDeallocationResolution method getNestedStack.
/**
* Returns the nested stack from a given ValgrindMessage in the Valgrind View
* @param message The message from which the stack will be acquired
* @return {@link ValgrindError} object containing the nested stack
*/
private ValgrindError getNestedStack(IValgrindMessage message) {
ValgrindError nestedError = null;
IValgrindMessage[] children = message.getChildren();
for (IValgrindMessage child : children) {
if (child instanceof ValgrindError) {
nestedError = (ValgrindError) child;
}
}
return nestedError;
}
Aggregations