1
0
Fork 0
mirror of https://github.com/eclipse-cdt/cdt synced 2025-07-01 14:15:23 +02:00

Merge remote-tracking branch 'cdt/master' into sd90

This commit is contained in:
Andrew Gvozdev 2012-01-03 23:05:13 -05:00
commit 19e8854089
20 changed files with 273 additions and 87 deletions

View file

@ -120,12 +120,12 @@ public abstract class IndexBindingResolutionTestBase extends BaseTestCase {
len= section.length()+len;
}
IASTName name= findName(section, len);
assertNotNull("name not found for \""+section+"\"", name);
assertNotNull("Name not found for \"" + section + "\"", name);
assertEquals(section.substring(0, len), name.getRawSignature());
IBinding binding = name.resolveBinding();
assertNotNull("No binding for "+name.getRawSignature(), binding);
assertFalse("Binding is a ProblemBinding for name "+name.getRawSignature(), IProblemBinding.class.isAssignableFrom(name.resolveBinding().getClass()));
assertNotNull("No binding for " + name.getRawSignature(), binding);
assertFalse("Binding is a ProblemBinding for name \"" + name.getRawSignature() + "\"", IProblemBinding.class.isAssignableFrom(name.resolveBinding().getClass()));
assertInstance(binding, clazz, cs);
return clazz.cast(binding);
}
@ -135,15 +135,15 @@ public abstract class IndexBindingResolutionTestBase extends BaseTestCase {
*/
protected <T extends IBinding> T getBindingFromASTName(String section, int len) {
if (len <= 0)
len+= section.length();
len += section.length();
IASTName name= findName(section, len);
assertNotNull("name not found for \""+section+"\"", name);
assertNotNull("Name not found for \"" + section + "\"", name);
assertEquals(section.substring(0, len), name.getRawSignature());
IBinding binding = name.resolveBinding();
assertNotNull("No binding for "+name.getRawSignature(), binding);
assertFalse("Binding is a ProblemBinding for name "+name.getRawSignature(), IProblemBinding.class.isAssignableFrom(name.resolveBinding().getClass()));
assertNotNull("No binding for " + name.getRawSignature(), binding);
assertFalse("Binding is a ProblemBinding for name \"" + name.getRawSignature() + "\"", IProblemBinding.class.isAssignableFrom(name.resolveBinding().getClass()));
return (T) binding;
}
@ -155,12 +155,12 @@ public abstract class IndexBindingResolutionTestBase extends BaseTestCase {
*/
protected IBinding getProblemFromASTName(String section, int len) {
IASTName name= findName(section, len);
assertNotNull("name not found for \""+section+"\"", name);
assertNotNull("Name not found for \"" + section + "\"", name);
assertEquals(section.substring(0, len), name.getRawSignature());
IBinding binding = name.resolveBinding();
assertNotNull("No binding for "+name.getRawSignature(), binding);
assertTrue("Binding is not a ProblemBinding for name "+name.getRawSignature(), IProblemBinding.class.isAssignableFrom(name.resolveBinding().getClass()));
assertNotNull("No binding for " + name.getRawSignature(), binding);
assertTrue("Binding is not a ProblemBinding for name \"" + name.getRawSignature() + "\"", IProblemBinding.class.isAssignableFrom(name.resolveBinding().getClass()));
return name.resolveBinding();
}
@ -200,10 +200,10 @@ public abstract class IndexBindingResolutionTestBase extends BaseTestCase {
}
protected static <T> T assertInstance(Object o, Class<T> clazz, Class ... cs) {
assertNotNull("Expected "+clazz.getName()+" but got null", o);
assertTrue("Expected "+clazz.getName()+" but got "+o.getClass().getName(), clazz.isInstance(o));
assertNotNull("Expected " + clazz.getName() + " but got null", o);
assertTrue("Expected " + clazz.getName() + " but got " + o.getClass().getName(), clazz.isInstance(o));
for (Class c : cs) {
assertTrue("Expected "+clazz.getName()+" but got "+o.getClass().getName(), c.isInstance(o));
assertTrue("Expected " + clazz.getName() + " but got " + o.getClass().getName(), c.isInstance(o));
}
return clazz.cast(o);
}

View file

@ -16,8 +16,11 @@ public class IndexCPPBindingResolutionBugsSingleProjectFirstAST extends IndexCPP
public IndexCPPBindingResolutionBugsSingleProjectFirstAST() {
setStrategy(new SinglePDOMTestFirstASTStrategy(true));
}
public static TestSuite suite() {return suite(IndexCPPBindingResolutionBugsSingleProjectFirstAST.class);}
// invalid tests for this strategy, they assume that the second file is already indexed.
public static TestSuite suite() {
return suite(IndexCPPBindingResolutionBugsSingleProjectFirstAST.class);
}
// Invalid tests for this strategy, they assume that the second file is already indexed.
@Override public void testBug208558() {}
@Override public void testBug176708_CCE() {}
@Override public void testIsSameAnonymousType_Bug193962() {}

View file

@ -23,7 +23,6 @@ import java.util.ArrayList;
import java.util.List;
import junit.framework.Assert;
import junit.framework.TestCase;
import org.eclipse.cdt.core.CCorePlugin;
import org.eclipse.cdt.core.dom.ILinkage;
@ -54,10 +53,10 @@ import org.osgi.framework.Bundle;
* Utilities for reading test source code from plug-in .java sources
*/
public class TestSourceReader {
/**
* Returns an array of StringBuilder objects for each comment section found preceding the named
* test in the source code.
* test in the source code.
*
* @param bundle the bundle containing the source, if null can try to load using classpath
* (source folder has to be in the classpath for this to work)
* @param srcRoot the directory inside the bundle containing the packages
@ -71,54 +70,61 @@ public class TestSourceReader {
*/
public static StringBuilder[] getContentsForTest(Bundle bundle, String srcRoot, Class clazz,
final String testName, int sections) throws IOException {
String fqn = clazz.getName().replace('.', '/');
fqn = fqn.indexOf("$") == -1 ? fqn : fqn.substring(0, fqn.indexOf("$"));
String classFile = fqn + ".java";
IPath filePath= new Path(srcRoot + '/' + classFile);
InputStream in;
try {
if (bundle != null) {
in = FileLocator.openStream(bundle, filePath, false);
} else {
in = clazz.getResourceAsStream('/' + classFile);
while (true) {
String fqn = clazz.getName().replace('.', '/');
fqn = fqn.indexOf("$") == -1 ? fqn : fqn.substring(0, fqn.indexOf("$"));
String classFile = fqn + ".java";
IPath filePath= new Path(srcRoot + '/' + classFile);
InputStream in;
Class superclass = clazz.getSuperclass();
try {
if (bundle != null) {
in = FileLocator.openStream(bundle, filePath, false);
} else {
in = clazz.getResourceAsStream('/' + classFile);
}
} catch (IOException e) {
if (superclass == null || !superclass.getPackage().equals(clazz.getPackage())) {
throw e;
}
clazz = superclass;
continue;
}
} catch (IOException e) {
if (clazz.getSuperclass() != null && !clazz.equals(TestCase.class)) {
return getContentsForTest(bundle, srcRoot, clazz.getSuperclass(), testName, sections);
BufferedReader br = new BufferedReader(new InputStreamReader(in));
try {
List<StringBuilder> contents = new ArrayList<StringBuilder>();
StringBuilder content = new StringBuilder();
for (String line = br.readLine(); line != null; line = br.readLine()) {
line = line.replaceFirst("^\\s*", ""); // Replace leading whitespace, preserve trailing
if (line.startsWith("//")) {
content.append(line.substring(2) + "\n");
} else {
if (content.length() > 0) {
contents.add(content);
if (sections > 0 && contents.size() == sections + 1)
contents.remove(0);
content = new StringBuilder();
}
if (line.length() > 0 && !contents.isEmpty()) {
int idx= line.indexOf(testName);
if (idx != -1 && !Character.isJavaIdentifierPart(line.charAt(idx + testName.length()))) {
return contents.toArray(new StringBuilder[contents.size()]);
}
contents.clear();
}
}
}
} finally {
br.close();
}
throw e;
if (superclass == null || !superclass.getPackage().equals(clazz.getPackage())) {
throw new IOException("Test data not found for " + clazz.getName() + "." + testName);
}
clazz = superclass;
}
BufferedReader br = new BufferedReader(new InputStreamReader(in));
List<StringBuilder> contents = new ArrayList<StringBuilder>();
StringBuilder content = new StringBuilder();
for (String line = br.readLine(); line != null; line = br.readLine()) {
line = line.replaceFirst("^\\s*", ""); // replace leading whitespace, preserve trailing
if (line.startsWith("//")) {
content.append(line.substring(2) + "\n");
} else {
if (content.length() > 0) {
contents.add(content);
if (sections > 0 && contents.size() == sections + 1)
contents.remove(0);
content = new StringBuilder();
}
if (line.length() > 0 && !contents.isEmpty()) {
int idx= line.indexOf(testName);
if (idx != -1 && !Character.isJavaIdentifierPart(line.charAt(idx + testName.length()))) {
return contents.toArray(new StringBuilder[contents.size()]);
}
contents.clear();
}
}
}
if (clazz.getSuperclass() != null && !clazz.equals(TestCase.class)) {
return getContentsForTest(bundle, srcRoot, clazz.getSuperclass(), testName, sections);
}
throw new IOException("Test data not found for " + clazz + " " + testName);
}
/**
@ -251,6 +257,7 @@ public class TestSourceReader {
}
result[0]= file;
}
private void createFolders(IResource res) throws CoreException {
IContainer container= res.getParent();
if (!container.exists() && container instanceof IFolder) {
@ -305,7 +312,7 @@ public class TestSourceReader {
Thread.sleep(50);
timeLeft= (int) (endTime - System.currentTimeMillis());
}
Assert.fail("Indexing " + file.getFullPath() + " did not complete in time!");
Assert.fail("Indexing " + file.getFullPath() + " did not complete in " + maxmillis / 1000. + " sec");
}
private static boolean areAllFilesNotOlderThan(IIndexFile[] files, long timestamp) throws CoreException {
@ -323,7 +330,7 @@ public class TestSourceReader {
ITranslationUnit tu= (ITranslationUnit) elem;
return tu.getAST(index, ITranslationUnit.AST_SKIP_INDEXED_HEADERS);
}
Assert.fail("Could not create ast for " + file.getFullPath());
Assert.fail("Could not create AST for " + file.getFullPath());
return null;
}
}

View file

@ -6,10 +6,10 @@
* http://www.eclipse.org/legal/epl-v10.html
*
* Contributors:
* Andrew Ferguson (Symbian) - Initial implementation
* Markus Schorn (Wind River Systems)
* IBM Corporation
* Ed Swartz (Nokia)
* Andrew Ferguson (Symbian) - Initial implementation
* Markus Schorn (Wind River Systems)
* IBM Corporation
* Ed Swartz (Nokia)
*******************************************************************************/
package org.eclipse.cdt.ui.tests.search;
@ -67,9 +67,10 @@ public class BasicSearchTest extends BaseUITestCase {
@Override
protected void setUp() throws Exception {
super.setUp();
fCProject = CProjectHelper.createCCProject(getName()+System.currentTimeMillis(), "bin", IPDOMManager.ID_NO_INDEXER);
fCProject = CProjectHelper.createCCProject(getName() + System.currentTimeMillis(), "bin", IPDOMManager.ID_NO_INDEXER);
Bundle b = CTestPlugin.getDefault().getBundle();
testData = TestSourceReader.getContentsForTest(b, "ui", this.getClass(), getName(), 2);
assertEquals("Incomplete test data", 2, testData.length);
IFile file = TestSourceReader.createFile(fCProject.getProject(), new Path("header.h"), testData[0].toString());
CCorePlugin.getIndexManager().setIndexerId(fCProject, IPDOMManager.ID_FAST_INDEXER);
@ -142,7 +143,8 @@ public class BasicSearchTest extends BaseUITestCase {
}
// int x, y, xx, yy;
// // empty
public void testNoIndexerEnabled_158955() throws Exception {
// rebuild the index with no indexer
CCorePlugin.getIndexManager().setIndexerId(fCProject, IPDOMManager.ID_NO_INDEXER);
@ -156,7 +158,7 @@ public class BasicSearchTest extends BaseUITestCase {
ISearchResultViewPart vp= NewSearchUI.getSearchResultView();
ISearchResultPage page= vp.getActivePage();
assertTrue(""+page, page instanceof PDOMSearchViewPage);
assertTrue("" + page, page instanceof PDOMSearchViewPage);
PDOMSearchViewPage pdomsvp= (PDOMSearchViewPage) page;
StructuredViewer viewer= pdomsvp.getViewer();
@ -177,7 +179,8 @@ public class BasicSearchTest extends BaseUITestCase {
final int INDEXER_IN_PROGRESS_STRUCT_COUNT = 100;
// #include "hugeHeader0.h"
// // empty
public void testIndexerInProgress() throws Exception {
// make an external file
File dir= CProjectHelper.freshDir();

View file

@ -7,10 +7,9 @@
*
* Contributors:
* Anton Leherbauer (Wind River Systems) - initial API and implementation
* Sergey Prigogin, Google
* Sergey Prigogin (Google)
* Andrew Ferguson (Symbian)
*******************************************************************************/
package org.eclipse.cdt.ui.tests.text;
import java.util.HashMap;
@ -36,12 +35,11 @@ import org.eclipse.cdt.ui.text.doctools.DefaultMultilineCommentAutoEditStrategy;
import org.eclipse.cdt.internal.ui.text.CAutoIndentStrategy;
import org.eclipse.cdt.internal.ui.text.CTextTools;
/**
* Testing the auto indent strategies.
*/
public class DefaultCCommentAutoEditStrategyTest extends AbstractAutoEditTest {
private HashMap<String,String> fOptions;
private HashMap<String, String> fOptions;
/**
* @param name

View file

@ -7,11 +7,13 @@
*
* Contributors:
* Anton Leherbauer (Wind River Systems) - initial API and implementation
* Sergey Prigogin, Google
* Sergey Prigogin (Google)
* Andrew Ferguson (Symbian)
*******************************************************************************/
package org.eclipse.cdt.ui.tests.text.doctools.doxygen;
import java.util.HashMap;
import junit.framework.Test;
import org.eclipse.core.resources.IFile;
@ -20,13 +22,14 @@ import org.eclipse.jface.text.BadLocationException;
import org.eclipse.jface.text.Document;
import org.eclipse.jface.text.IDocument;
import org.eclipse.cdt.core.CCorePlugin;
import org.eclipse.cdt.core.dom.ast.IASTTranslationUnit;
import org.eclipse.cdt.core.model.CoreModel;
import org.eclipse.cdt.core.model.ICProject;
import org.eclipse.cdt.core.testplugin.CProjectHelper;
import org.eclipse.cdt.core.testplugin.util.TestSourceReader;
import org.eclipse.cdt.ui.CUIPlugin;
import org.eclipse.cdt.ui.tests.text.DefaultCCommentAutoEditStrategyTest;
import org.eclipse.cdt.ui.tests.text.AbstractAutoEditTest;
import org.eclipse.cdt.ui.text.ICPartitions;
import org.eclipse.cdt.ui.text.doctools.DefaultMultilineCommentAutoEditStrategy;
import org.eclipse.cdt.ui.text.doctools.doxygen.DoxygenMultilineAutoEditStrategy;
@ -36,13 +39,13 @@ import org.eclipse.cdt.internal.core.model.TranslationUnit;
import org.eclipse.cdt.internal.ui.text.CAutoIndentStrategy;
import org.eclipse.cdt.internal.ui.text.CTextTools;
/**
* Testing the auto indent strategies.
*/
public class DoxygenCCommentAutoEditStrategyTest extends DefaultCCommentAutoEditStrategyTest {
public class DoxygenCCommentAutoEditStrategyTest extends AbstractAutoEditTest {
private HashMap<String, String> fOptions;
protected ICProject fCProject;
/**
* @param name
*/
@ -57,7 +60,8 @@ public class DoxygenCCommentAutoEditStrategyTest extends DefaultCCommentAutoEdit
@Override
protected void setUp() throws Exception {
super.setUp();
fCProject= CProjectHelper.createCCProject("test"+System.currentTimeMillis(), null);
fOptions= CCorePlugin.getOptions();
fCProject= CProjectHelper.createCCProject("test" + System.currentTimeMillis(), null);
}
/*
@ -65,6 +69,7 @@ public class DoxygenCCommentAutoEditStrategyTest extends DefaultCCommentAutoEdit
*/
@Override
protected void tearDown() throws Exception {
CCorePlugin.setOptions(fOptions);
CProjectHelper.delete(fCProject);
super.tearDown();
}
@ -75,7 +80,6 @@ public class DoxygenCCommentAutoEditStrategyTest extends DefaultCCommentAutoEdit
textTools.setupCDocument(doc);
AutoEditTester tester = new AutoEditTester(doc, ICPartitions.C_PARTITIONING);
tester.setAutoEditStrategy(IDocument.DEFAULT_CONTENT_TYPE, new CAutoIndentStrategy(ICPartitions.C_PARTITIONING, null));
tester.setAutoEditStrategy(ICPartitions.C_MULTI_LINE_COMMENT, new DefaultMultilineCommentAutoEditStrategy());
tester.setAutoEditStrategy(ICPartitions.C_PREPROCESSOR, new CAutoIndentStrategy(ICPartitions.C_PARTITIONING, null));

View file

@ -84,6 +84,7 @@ public class GdbServerDebuggerPage extends GdbDebuggerPage {
field.setItems(fConnections);
field.setDialogFieldListener(new IDialogFieldListener() {
@Override
public void dialogFieldChanged(DialogField f) {
if (!isInitializing())
connectionTypeChanged();

View file

@ -102,6 +102,7 @@ public class SerialPortSettingsBlock extends Observable {
field.setLabelText(LaunchUIMessages.getString("SerialPortSettingsBlock.0")); //$NON-NLS-1$
field.setDialogFieldListener(new IDialogFieldListener() {
@Override
public void dialogFieldChanged(DialogField f) {
deviceFieldChanged();
}
@ -115,6 +116,7 @@ public class SerialPortSettingsBlock extends Observable {
field.setItems(fSpeedChoices);
field.setDialogFieldListener(new IDialogFieldListener() {
@Override
public void dialogFieldChanged(DialogField f) {
speedFieldChanged();
}

View file

@ -108,6 +108,7 @@ public class SolibSearchPathBlock extends Observable implements IMILaunchConfigu
fText.setLayoutData(new GridData(GridData.GRAB_HORIZONTAL | GridData.HORIZONTAL_ALIGN_FILL));
fText.addModifyListener(new ModifyListener() {
@Override
public void modifyText(ModifyEvent e) {
updateOKButton();
}
@ -243,9 +244,11 @@ public class SolibSearchPathBlock extends Observable implements IMILaunchConfigu
buttonLabels[i] = customButtonLabels[i - fgStaticButtonLabels.length];
}
IListAdapter listAdapter = new IListAdapter() {
@Override
public void customButtonPressed(DialogField field, int index) {
buttonPressed(index);
}
@Override
public void selectionChanged(DialogField field) {
}
};

View file

@ -97,6 +97,7 @@ public class TCPSettingsBlock extends Observable {
field.setLabelText(LaunchUIMessages.getString("TCPSettingsBlock.0")); //$NON-NLS-1$
field.setDialogFieldListener(new IDialogFieldListener() {
@Override
public void dialogFieldChanged(DialogField f) {
hostNameFieldChanged();
}
@ -109,6 +110,7 @@ public class TCPSettingsBlock extends Observable {
field.setLabelText(LaunchUIMessages.getString("TCPSettingsBlock.1")); //$NON-NLS-1$
field.setDialogFieldListener(new IDialogFieldListener() {
@Override
public void dialogFieldChanged(DialogField f) {
portNumberFieldChanged();
}

View file

@ -199,6 +199,7 @@ public class GDBBackend extends AbstractDsfService implements IGDBBackend {
return gdbCommandLine.toString();
}
@Override
public String getGDBInitFile() throws CoreException {
if (fGDBInitFile == null) {
String defaultGdbInit = Platform.getPreferencesService().getString(GdbPlugin.PLUGIN_ID,
@ -211,6 +212,7 @@ public class GDBBackend extends AbstractDsfService implements IGDBBackend {
return fGDBInitFile;
}
@Override
public IPath getGDBWorkingDirectory() throws CoreException {
if (fGDBWorkingDirectory == null) {
@ -268,6 +270,7 @@ public class GDBBackend extends AbstractDsfService implements IGDBBackend {
return fGDBWorkingDirectory;
}
@Override
public String getProgramArguments() throws CoreException {
if (fProgramArguments == null) {
fProgramArguments = fLaunchConfiguration.getAttribute(
@ -282,11 +285,13 @@ public class GDBBackend extends AbstractDsfService implements IGDBBackend {
return fProgramArguments;
}
@Override
public IPath getProgramPath() {
return fProgramPath;
}
@SuppressWarnings("unchecked")
@Override
public List<String> getSharedLibraryPaths() throws CoreException {
if (fSharedLibPaths == null) {
fSharedLibPaths = fLaunchConfiguration.getAttribute(IGDBLaunchConfigurationConstants.ATTR_DEBUGGER_SOLIB_PATH,
@ -297,6 +302,7 @@ public class GDBBackend extends AbstractDsfService implements IGDBBackend {
}
/** @since 3.0 */
@Override
public Properties getEnvironmentVariables() throws CoreException {
if (fEnvVariables == null) {
fEnvVariables = new Properties();
@ -340,11 +346,13 @@ public class GDBBackend extends AbstractDsfService implements IGDBBackend {
}
/** @since 3.0 */
@Override
public boolean getClearEnvironment() throws CoreException {
return !fLaunchConfiguration.getAttribute(ILaunchManager.ATTR_APPEND_ENVIRONMENT_VARIABLES, true);
}
/** @since 3.0 */
@Override
public boolean getUpdateThreadListOnSuspend() throws CoreException {
return fLaunchConfiguration
.getAttribute(
@ -372,18 +380,22 @@ public class GDBBackend extends AbstractDsfService implements IGDBBackend {
return fProcess;
}
@Override
public OutputStream getMIOutputStream() {
return fProcess.getOutputStream();
};
@Override
public InputStream getMIInputStream() {
return fProcess.getInputStream();
};
@Override
public String getId() {
return fBackendId;
}
@Override
public void interrupt() {
if (fProcess instanceof Spawner) {
Spawner gdbSpawner = (Spawner) fProcess;
@ -405,6 +417,7 @@ public class GDBBackend extends AbstractDsfService implements IGDBBackend {
/**
* @since 3.0
*/
@Override
public void interruptAndWait(int timeout, RequestMonitor rm) {
if (fProcess instanceof Spawner) {
Spawner gdbSpawner = (Spawner) fProcess;
@ -430,6 +443,7 @@ public class GDBBackend extends AbstractDsfService implements IGDBBackend {
/**
* @since 3.0
*/
@Override
public void interruptInferiorAndWait(long pid, int timeout, RequestMonitor rm) {
if (fProcess instanceof Spawner) {
Spawner gdbSpawner = (Spawner) fProcess;
@ -441,6 +455,7 @@ public class GDBBackend extends AbstractDsfService implements IGDBBackend {
}
}
@Override
public void destroy() {
// Don't close the streams ourselves as it may be too early.
// Wait for the actual user of the streams to close it.
@ -452,14 +467,17 @@ public class GDBBackend extends AbstractDsfService implements IGDBBackend {
}
}
@Override
public State getState() {
return fBackendState;
}
@Override
public int getExitCode() {
return fGDBExitValue;
}
@Override
public SessionType getSessionType() {
if (fSessionType == null) {
fSessionType = LaunchUtils.getSessionType(fLaunchConfiguration);
@ -467,6 +485,7 @@ public class GDBBackend extends AbstractDsfService implements IGDBBackend {
return fSessionType;
}
@Override
public boolean getIsAttachSession() {
if (fAttach == null) {
fAttach = LaunchUtils.getIsAttach(fLaunchConfiguration);
@ -523,6 +542,7 @@ public class GDBBackend extends AbstractDsfService implements IGDBBackend {
// Need to do this on the executor for thread-safety
getExecutor().submit(
new DsfRunnable() {
@Override
public void run() { fBackendState = State.STARTED; }
});
// Don't send the backendStarted event yet. We wait until we have registered this service
@ -556,6 +576,7 @@ public class GDBBackend extends AbstractDsfService implements IGDBBackend {
startGdbJob.schedule();
getExecutor().schedule(new Runnable() {
@Override
public void run() {
// Only process the event if we have not finished yet (hit the breakpoint).
if (!fGDBLaunchMonitor.fLaunched) {
@ -593,6 +614,7 @@ public class GDBBackend extends AbstractDsfService implements IGDBBackend {
// check if the killing of GDB worked.
getExecutor().submit(
new DsfRunnable() {
@Override
public void run() {
destroy();
@ -644,6 +666,7 @@ public class GDBBackend extends AbstractDsfService implements IGDBBackend {
fMonitorJob = new MonitorJob(
fProcess,
new DsfRunnable() {
@Override
public void run() {
requestMonitor.done();
}
@ -715,6 +738,7 @@ public class GDBBackend extends AbstractDsfService implements IGDBBackend {
// Need to do this on the executor for thread-safety
getExecutor().submit(
new DsfRunnable() {
@Override
public void run() {
destroy();
fBackendState = State.TERMINATED;
@ -789,6 +813,7 @@ public class GDBBackend extends AbstractDsfService implements IGDBBackend {
protected IStatus run(IProgressMonitor monitor) {
getExecutor().submit(
new DsfRunnable() {
@Override
public void run() {
fInterruptFailedJob = null;
fRequestMonitor.setStatus(new Status(IStatus.ERROR, GdbPlugin.PLUGIN_ID, IDsfStatusConstants.REQUEST_FAILED, "Interrupt failed.", null)); //$NON-NLS-1$

View file

@ -230,6 +230,7 @@ public class GDBProcesses extends MIProcesses implements IGDBProcesses {
/**
* @since 4.0
*/
@Override
public void attachDebuggerToProcess(final IProcessDMContext procCtx, String binaryPath, final DataRequestMonitor<IDMContext> rm) {
final IMIContainerDMContext containerDmc = createContainerContext(procCtx, MIProcesses.UNIQUE_GROUP_ID);
@ -406,12 +407,14 @@ public class GDBProcesses extends MIProcesses implements IGDBProcesses {
}
/** @since 4.0 */
@Override
public IMIExecutionDMContext[] getExecutionContexts(IMIContainerDMContext containerDmc) {
assert false; // This is not being used before GDB 7.0
return null;
}
/** @since 4.0 */
@Override
public void canRestart(IContainerDMContext containerDmc, DataRequestMonitor<Boolean> rm) {
if (fBackend.getIsAttachSession() || fBackend.getSessionType() == SessionType.CORE) {
rm.setData(false);
@ -436,6 +439,7 @@ public class GDBProcesses extends MIProcesses implements IGDBProcesses {
}
/** @since 4.0 */
@Override
public void restart(IContainerDMContext containerDmc, Map<String, Object> attributes, DataRequestMonitor<IContainerDMContext> rm) {
// Before performing the restart, check if the process is properly suspended.
// Don't need to worry about non-stop before GDB 7.0, so we can simply
@ -456,6 +460,7 @@ public class GDBProcesses extends MIProcesses implements IGDBProcesses {
}
/** @since 4.0 */
@Override
public void start(IContainerDMContext containerDmc, Map<String, Object> attributes, DataRequestMonitor<IContainerDMContext> rm) {
startOrRestart(containerDmc, attributes, false, rm);
}
@ -518,6 +523,7 @@ public class GDBProcesses extends MIProcesses implements IGDBProcesses {
// Add the inferior to the launch.
// This cannot be done on the executor or things deadlock.
DebugPlugin.getDefault().asyncExec(new Runnable() {
@Override
public void run() {
if (restart) {
// For a restart, remove the old inferior

View file

@ -149,6 +149,7 @@ public class GDBProcesses_7_0 extends AbstractDsfService
* Returns the GDB/MI thread identifier of this context.
* @return
*/
@Override
public int getThreadId(){
try {
return Integer.parseInt(fThreadId);
@ -205,6 +206,7 @@ public class GDBProcesses_7_0 extends AbstractDsfService
/**
* Returns the GDB/MI thread group identifier of this context.
*/
@Override
public String getGroupId(){ return fId; }
@Override
@ -299,6 +301,7 @@ public class GDBProcesses_7_0 extends AbstractDsfService
fId = id;
}
@Override
public String getProcId() { return fId; }
@Override
@ -352,8 +355,13 @@ public class GDBProcesses_7_0 extends AbstractDsfService
fId = id;
}
@Override
public String getId() { return fId; }
@Override
public String getName() { return fName; }
@Override
public boolean isDebuggerAttached() {
return true;
}
@ -379,14 +387,21 @@ public class GDBProcesses_7_0 extends AbstractDsfService
fOwner = owner;
}
@Override
public String getId() { return getProcId(); }
public String getName() { return fName; }
public boolean isDebuggerAttached() {
@Override
public String getName() { return fName; }
@Override
public boolean isDebuggerAttached() {
return true;
}
@Override
public String[] getCores() { return fCores; }
@Override
public String getOwner() { return fOwner; }
@Override
@ -622,25 +637,30 @@ public class GDBProcesses_7_0 extends AbstractDsfService
return null;
}
@Override
public IThreadDMContext createThreadContext(IProcessDMContext processDmc, String threadId) {
return new MIThreadDMC(getSession().getId(), processDmc, threadId);
}
@Override
public IProcessDMContext createProcessContext(ICommandControlDMContext controlDmc, String pid) {
return new MIProcessDMC(getSession().getId(), controlDmc, pid);
}
@Override
public IMIExecutionDMContext createExecutionContext(IContainerDMContext containerDmc,
IThreadDMContext threadDmc,
String threadId) {
return new MIExecutionDMC(getSession().getId(), containerDmc, threadDmc, threadId);
}
@Override
public IMIContainerDMContext createContainerContext(IProcessDMContext processDmc,
String groupId) {
return new GDBContainerDMC(getSession().getId(), processDmc, groupId);
}
@Override
public IMIContainerDMContext createContainerContextFromThreadId(ICommandControlDMContext controlDmc, String threadId) {
String groupId = getThreadToGroupMap().get(threadId);
if (groupId == null) {
@ -664,6 +684,7 @@ public class GDBProcesses_7_0 extends AbstractDsfService
}
/** @since 4.0 */
@Override
public IMIContainerDMContext createContainerContextFromGroupId(ICommandControlDMContext controlDmc, String groupId) {
if (groupId == null || groupId.length() == 0) {
// This happens when we are doing non-attach, so for GDB < 7.2, we know that in that case
@ -686,6 +707,7 @@ public class GDBProcesses_7_0 extends AbstractDsfService
return createContainerContext(processDmc, groupId);
}
@Override
public IMIExecutionDMContext[] getExecutionContexts(IMIContainerDMContext containerDmc) {
String groupId = containerDmc.getGroupId();
List<IMIExecutionDMContext> execDmcList = new ArrayList<IMIExecutionDMContext>();
@ -704,6 +726,7 @@ public class GDBProcesses_7_0 extends AbstractDsfService
return execDmcList.toArray(new IMIExecutionDMContext[0]);
}
@Override
public void getExecutionData(IThreadDMContext dmc, final DataRequestMonitor<IThreadDMData> rm) {
if (dmc instanceof IMIProcessDMContext) {
String id = ((IMIProcessDMContext)dmc).getProcId();
@ -775,6 +798,7 @@ public class GDBProcesses_7_0 extends AbstractDsfService
}
}
@Override
public void getDebuggingContext(IThreadDMContext dmc, DataRequestMonitor<IDMContext> rm) {
if (dmc instanceof MIProcessDMC) {
MIProcessDMC procDmc = (MIProcessDMC)dmc;
@ -797,11 +821,13 @@ public class GDBProcesses_7_0 extends AbstractDsfService
return fBackend.getIsAttachSession() && fNumConnected == 0;
}
@Override
public void isDebuggerAttachSupported(IDMContext dmc, DataRequestMonitor<Boolean> rm) {
rm.setData(doIsDebuggerAttachSupported());
rm.done();
}
@Override
public void attachDebuggerToProcess(IProcessDMContext procCtx, DataRequestMonitor<IDMContext> rm) {
attachDebuggerToProcess(procCtx, null, rm);
}
@ -809,6 +835,7 @@ public class GDBProcesses_7_0 extends AbstractDsfService
/**
* @since 4.0
*/
@Override
public void attachDebuggerToProcess(final IProcessDMContext procCtx, final String binaryPath, final DataRequestMonitor<IDMContext> dataRm) {
if (procCtx instanceof IMIProcessDMContext) {
if (!doIsDebuggerAttachSupported()) {
@ -920,11 +947,13 @@ public class GDBProcesses_7_0 extends AbstractDsfService
return fNumConnected > 0;
}
@Override
public void canDetachDebuggerFromProcess(IDMContext dmc, DataRequestMonitor<Boolean> rm) {
rm.setData(doCanDetachDebuggerFromProcess());
rm.done();
}
@Override
public void detachDebuggerFromProcess(final IDMContext dmc, final RequestMonitor rm) {
ICommandControlDMContext controlDmc = DMContexts.getAncestorOfType(dmc, ICommandControlDMContext.class);
@ -951,11 +980,13 @@ public class GDBProcesses_7_0 extends AbstractDsfService
}
}
@Override
public void canTerminate(IThreadDMContext thread, DataRequestMonitor<Boolean> rm) {
rm.setData(true);
rm.done();
}
@Override
public void isDebugNewProcessSupported(IDMContext dmc, DataRequestMonitor<Boolean> rm) {
rm.setData(doIsDebugNewProcessSupported());
rm.done();
@ -966,6 +997,7 @@ public class GDBProcesses_7_0 extends AbstractDsfService
return false;
}
@Override
public void debugNewProcess(IDMContext dmc, String file,
Map<String, Object> attributes, DataRequestMonitor<IDMContext> rm) {
@ -997,6 +1029,7 @@ public class GDBProcesses_7_0 extends AbstractDsfService
return new DebugNewProcessSequence(executor, isInitial, dmc, file, attributes, rm);
}
@Override
public void getProcessesBeingDebugged(final IDMContext dmc, final DataRequestMonitor<IDMContext[]> rm) {
final ICommandControlDMContext controlDmc = DMContexts.getAncestorOfType(dmc, ICommandControlDMContext.class);
final IMIContainerDMContext containerDmc = DMContexts.getAncestorOfType(dmc, IMIContainerDMContext.class);
@ -1087,6 +1120,7 @@ public class GDBProcesses_7_0 extends AbstractDsfService
return containerDmcs.toArray(new IMIContainerDMContext[containerDmcs.size()]);
}
@Override
public void getRunningProcesses(final IDMContext dmc, final DataRequestMonitor<IProcessDMContext[]> rm) {
final ICommandControlDMContext controlDmc = DMContexts.getAncestorOfType(dmc, ICommandControlDMContext.class);
if (controlDmc != null) {
@ -1171,11 +1205,13 @@ public class GDBProcesses_7_0 extends AbstractDsfService
return procDmcs;
}
@Override
public void isRunNewProcessSupported(IDMContext dmc, DataRequestMonitor<Boolean> rm) {
rm.setData(false);
rm.done();
}
@Override
public void runNewProcess(IDMContext dmc, String file,
Map<String, Object> attributes, DataRequestMonitor<IProcessDMContext> rm) {
rm.setStatus(new Status(IStatus.ERROR, GdbPlugin.PLUGIN_ID,
@ -1183,6 +1219,7 @@ public class GDBProcesses_7_0 extends AbstractDsfService
rm.done();
}
@Override
public void terminate(IThreadDMContext thread, final RequestMonitor rm) {
// If we will terminate GDB as soon as the last inferior terminates, then let's
// just terminate GDB itself if this is the last inferior.
@ -1223,6 +1260,7 @@ public class GDBProcesses_7_0 extends AbstractDsfService
}
/** @since 4.0 */
@Override
public void canRestart(IContainerDMContext containerDmc, DataRequestMonitor<Boolean> rm) {
if (fBackend.getIsAttachSession() || fBackend.getSessionType() == SessionType.CORE) {
rm.setData(false);
@ -1263,6 +1301,7 @@ public class GDBProcesses_7_0 extends AbstractDsfService
}
/** @since 4.0 */
@Override
public void restart(IContainerDMContext containerDmc, final Map<String, Object> attributes, final DataRequestMonitor<IContainerDMContext> rm) {
fProcRestarting = true;
@ -1313,6 +1352,7 @@ public class GDBProcesses_7_0 extends AbstractDsfService
}
/** @since 4.0 */
@Override
public void start(IContainerDMContext containerDmc, Map<String, Object> attributes, DataRequestMonitor<IContainerDMContext> rm) {
startOrRestart(containerDmc, attributes, false, rm);
}
@ -1425,6 +1465,7 @@ public class GDBProcesses_7_0 extends AbstractDsfService
}
}
@Override
public void flushCache(IDMContext context) {
fContainerCommandCache.reset(context);
fThreadCommandCache.reset(context);
@ -1434,6 +1475,7 @@ public class GDBProcesses_7_0 extends AbstractDsfService
* Catch =thread-created/exited and =thread-group-exited events to update our
* groupId to threadId map.
*/
@Override
public void eventReceived(Object output) {
for (MIOOBRecord oobr : ((MIOutput)output).getMIOOBRecords()) {
if (oobr instanceof MINotifyAsyncOutput) {

View file

@ -57,8 +57,10 @@ public class GDBProcesses_7_1 extends GDBProcesses_7_0 {
fCores = cores;
}
@Override
public String[] getCores() { return fCores; }
@Override
public String getOwner() { return null; }
}

View file

@ -251,12 +251,14 @@ public class GDBRunControl_7_0 extends MIRunControl implements IReverseRunContro
}
/** @since 2.0 */
@Override
public void canReverseResume(IExecutionDMContext context, DataRequestMonitor<Boolean> rm) {
rm.setData(fReverseModeEnabled && doCanResume(context));
rm.done();
}
/** @since 2.0 */
@Override
public void canReverseStep(final IExecutionDMContext context, StepType stepType, final DataRequestMonitor<Boolean> rm) {
if (context instanceof IContainerDMContext) {
rm.setData(false);
@ -299,11 +301,13 @@ public class GDBRunControl_7_0 extends MIRunControl implements IReverseRunContro
}
/** @since 2.0 */
@Override
public boolean isReverseStepping(IExecutionDMContext context) {
return !isTerminated() && fReverseStepping;
}
/** @since 2.0 */
@Override
public void reverseResume(final IExecutionDMContext context, final RequestMonitor rm) {
if (fReverseModeEnabled && doCanResume(context)) {
ICommand<MIInfo> cmd = null;
@ -340,6 +344,7 @@ public class GDBRunControl_7_0 extends MIRunControl implements IReverseRunContro
}
/** @since 2.0 */
@Override
public void reverseStep(final IExecutionDMContext context, StepType stepType, final RequestMonitor rm) {
assert context != null;
@ -408,18 +413,21 @@ public class GDBRunControl_7_0 extends MIRunControl implements IReverseRunContro
}
/** @since 2.0 */
@Override
public void canEnableReverseMode(ICommandControlDMContext context, DataRequestMonitor<Boolean> rm) {
rm.setData(fReverseSupported);
rm.done();
}
/** @since 2.0 */
@Override
public void isReverseModeEnabled(ICommandControlDMContext context, DataRequestMonitor<Boolean> rm) {
rm.setData(fReverseModeEnabled);
rm.done();
}
/** @since 2.0 */
@Override
public void enableReverseMode(ICommandControlDMContext context, final boolean enable, final RequestMonitor rm) {
if (!fReverseSupported) {
rm.setStatus(new Status(IStatus.ERROR, GdbPlugin.PLUGIN_ID, NOT_SUPPORTED, "Reverse mode is not supported.", null)); //$NON-NLS-1$

View file

@ -114,7 +114,11 @@ public class GDBRunControl_7_0_NS extends AbstractDsfService implements IMIRunCo
fReason = reason;
fDetails = details;
}
@Override
public StateChangeReason getStateChangeReason() { return fReason; }
@Override
public String getDetails() { return fDetails; }
}
@ -137,6 +141,7 @@ public class GDBRunControl_7_0_NS extends AbstractDsfService implements IMIRunCo
fMIInfo = miInfo;
}
@Override
public T getMIEvent() { return fMIInfo; }
}
@ -152,6 +157,7 @@ public class GDBRunControl_7_0_NS extends AbstractDsfService implements IMIRunCo
super(ctx, miInfo);
}
@Override
public StateChangeReason getReason() {
if (getMIEvent() instanceof MICatchpointHitEvent) { // must precede MIBreakpointHitEvent
return StateChangeReason.EVENT_BREAKPOINT;
@ -212,6 +218,7 @@ public class GDBRunControl_7_0_NS extends AbstractDsfService implements IMIRunCo
fBreakpoints = new IBreakpointDMContext[] { bpCtx };
}
@Override
public IBreakpointDMContext[] getBreakpoints() {
return fBreakpoints;
}
@ -228,6 +235,7 @@ public class GDBRunControl_7_0_NS extends AbstractDsfService implements IMIRunCo
super(ctx, miInfo);
}
@Override
public StateChangeReason getReason() {
if (getMIEvent() != null) {
switch(getMIEvent().getType()) {
@ -431,6 +439,7 @@ public class GDBRunControl_7_0_NS extends AbstractDsfService implements IMIRunCo
// Suspend
// ------------------------------------------------------------------------
@Override
public boolean isSuspended(IExecutionDMContext context) {
// Thread case
@ -458,6 +467,7 @@ public class GDBRunControl_7_0_NS extends AbstractDsfService implements IMIRunCo
return false;
}
@Override
public void canSuspend(IExecutionDMContext context, DataRequestMonitor<Boolean> rm) {
if (fRunControlOperationsEnabled == false) {
rm.setData(false);
@ -495,6 +505,7 @@ public class GDBRunControl_7_0_NS extends AbstractDsfService implements IMIRunCo
return (threadState == null) ? false : !fTerminated && !threadState.fSuspended;
}
@Override
public void suspend(IExecutionDMContext context, final RequestMonitor rm) {
assert context != null;
@ -539,6 +550,7 @@ public class GDBRunControl_7_0_NS extends AbstractDsfService implements IMIRunCo
// Resume
// ------------------------------------------------------------------------
@Override
public void canResume(IExecutionDMContext context, DataRequestMonitor<Boolean> rm) {
if (fRunControlOperationsEnabled == false) {
rm.setData(false);
@ -576,6 +588,7 @@ public class GDBRunControl_7_0_NS extends AbstractDsfService implements IMIRunCo
return (threadState == null) ? false : !fTerminated && threadState.fSuspended && !threadState.fResumePending;
}
@Override
public void resume(IExecutionDMContext context, final RequestMonitor rm) {
assert context != null;
@ -635,6 +648,7 @@ public class GDBRunControl_7_0_NS extends AbstractDsfService implements IMIRunCo
// Step
// ------------------------------------------------------------------------
@Override
public boolean isStepping(IExecutionDMContext context) {
// If it's a thread, just look it up
@ -647,6 +661,7 @@ public class GDBRunControl_7_0_NS extends AbstractDsfService implements IMIRunCo
return false;
}
@Override
public void canStep(final IExecutionDMContext context, StepType stepType, final DataRequestMonitor<Boolean> rm) {
if (fRunControlOperationsEnabled == false) {
rm.setData(false);
@ -687,6 +702,7 @@ public class GDBRunControl_7_0_NS extends AbstractDsfService implements IMIRunCo
rm.done();
}
@Override
public void step(IExecutionDMContext context, StepType stepType, final RequestMonitor rm) {
assert context != null;
@ -874,6 +890,7 @@ public class GDBRunControl_7_0_NS extends AbstractDsfService implements IMIRunCo
// Support functions
// ------------------------------------------------------------------------
@Override
public void getExecutionContexts(final IContainerDMContext containerDmc, final DataRequestMonitor<IExecutionDMContext[]> rm) {
IMIProcesses procService = getServicesTracker().getService(IMIProcesses.class);
procService.getProcessesBeingDebugged(
@ -891,6 +908,7 @@ public class GDBRunControl_7_0_NS extends AbstractDsfService implements IMIRunCo
});
}
@Override
public void getExecutionData(IExecutionDMContext dmc, DataRequestMonitor<IExecutionDMData> rm) {
MIThreadRunState threadState = fThreadRunStates.get(dmc);
if (threadState == null) {
@ -1134,6 +1152,7 @@ public class GDBRunControl_7_0_NS extends AbstractDsfService implements IMIRunCo
/**
* @since 3.0
*/
@Override
public void executeWithTargetAvailable(IDMContext ctx, final Sequence.Step[] steps, final RequestMonitor rm) {
if (!fOngoingOperation) {
// We are the first operation of this kind currently requested
@ -1610,6 +1629,7 @@ public class GDBRunControl_7_0_NS extends AbstractDsfService implements IMIRunCo
public void eventDispatched(ITraceRecordSelectedChangedDMEvent e) {
}
@Override
public void flushCache(IDMContext context) {
refreshThreadStates();
}
@ -1693,6 +1713,7 @@ public class GDBRunControl_7_0_NS extends AbstractDsfService implements IMIRunCo
/**
* @since 3.0
*/
@Override
public void canRunToLine(IExecutionDMContext context, String sourceFile,
int lineNumber, DataRequestMonitor<Boolean> rm) {
canResume(context, rm);
@ -1704,6 +1725,7 @@ public class GDBRunControl_7_0_NS extends AbstractDsfService implements IMIRunCo
/**
* @since 3.0
*/
@Override
public void runToLine(IExecutionDMContext context, String sourceFile,
int lineNumber, boolean skipBreakpoints, RequestMonitor rm) {
@ -1719,6 +1741,7 @@ public class GDBRunControl_7_0_NS extends AbstractDsfService implements IMIRunCo
/**
* @since 3.0
*/
@Override
public void canRunToAddress(IExecutionDMContext context, IAddress address,
DataRequestMonitor<Boolean> rm) {
canResume(context, rm);
@ -1730,6 +1753,7 @@ public class GDBRunControl_7_0_NS extends AbstractDsfService implements IMIRunCo
/**
* @since 3.0
*/
@Override
public void runToAddress(IExecutionDMContext context, IAddress address,
boolean skipBreakpoints, RequestMonitor rm) {
runToLocation(context, "*0x" + address.toString(16), skipBreakpoints, rm); //$NON-NLS-1$
@ -1741,6 +1765,7 @@ public class GDBRunControl_7_0_NS extends AbstractDsfService implements IMIRunCo
/**
* @since 3.0
*/
@Override
public void canMoveToLine(IExecutionDMContext context, String sourceFile,
int lineNumber, boolean resume, DataRequestMonitor<Boolean> rm) {
canResume(context, rm); }
@ -1751,6 +1776,7 @@ public class GDBRunControl_7_0_NS extends AbstractDsfService implements IMIRunCo
/**
* @since 3.0
*/
@Override
public void moveToLine(IExecutionDMContext context, String sourceFile,
int lineNumber, boolean resume, RequestMonitor rm) {
IMIExecutionDMContext threadExecDmc = DMContexts.getAncestorOfType(context, IMIExecutionDMContext.class);
@ -1784,6 +1810,7 @@ public class GDBRunControl_7_0_NS extends AbstractDsfService implements IMIRunCo
/**
* @since 3.0
*/
@Override
public void canMoveToAddress(IExecutionDMContext context, IAddress address,
boolean resume, DataRequestMonitor<Boolean> rm) {
canResume(context, rm);
@ -1793,6 +1820,7 @@ public class GDBRunControl_7_0_NS extends AbstractDsfService implements IMIRunCo
* @see org.eclipse.cdt.dsf.debug.service.IRunControl2#moveToAddress(org.eclipse.cdt.dsf.debug.service.IRunControl.IExecutionDMContext, org.eclipse.cdt.core.IAddress, boolean, org.eclipse.cdt.dsf.concurrent.RequestMonitor)
* @since 3.0
*/
@Override
public void moveToAddress(IExecutionDMContext context, IAddress address,
boolean resume, RequestMonitor rm) {
IMIExecutionDMContext threadExecDmc = DMContexts.getAncestorOfType(context, IMIExecutionDMContext.class);
@ -1821,11 +1849,13 @@ public class GDBRunControl_7_0_NS extends AbstractDsfService implements IMIRunCo
}
/** @since 4.0 */
@Override
public IRunMode getRunMode() {
return MIRunMode.NON_STOP;
}
/** @since 4.0 */
@Override
public boolean isTargetAcceptingCommands() {
// Always accepting commands in non-stop mode
return true;

View file

@ -74,6 +74,7 @@ public class GDBTraceControl_7_2 extends AbstractDsfService implements IGDBTrace
}
/** @since 4.0 */
@Override
public String getRecordId() {
return fReference;
}
@ -120,6 +121,7 @@ public class GDBTraceControl_7_2 extends AbstractDsfService implements IGDBTrace
}
/** @since 4.0 */
@Override
public String getRecordId() {
return null;
}
@ -160,14 +162,17 @@ public class GDBTraceControl_7_2 extends AbstractDsfService implements IGDBTrace
fValue = value;
}
@Override
public String getName() {
return fName;
}
@Override
public String getValue() {
return fValue;
}
@Override
public String getInitialValue() {
return fInitialValue;
}
@ -186,18 +191,22 @@ public class GDBTraceControl_7_2 extends AbstractDsfService implements IGDBTrace
fFrameNumber = frameNumber;
}
@Override
public String getContent() {
return fContent;
}
@Override
public String getTracepointNumber() {
return fTracepointNum;
}
@Override
public String getRecordId() {
return fFrameNumber;
}
@Override
public String getTimestamp() {
return fTimestamp;
}
@ -241,30 +250,37 @@ public class GDBTraceControl_7_2 extends AbstractDsfService implements IGDBTrace
fTracingSupported = false;
}
@Override
public int getFreeBufferSize() {
return fFreeBufferSize;
}
@Override
public int getNumberOfCollectedFrame() {
return fNumberOfCollectedFrames;
}
@Override
public int getTotalBufferSize() {
return fTotalBufferSize;
}
@Override
public boolean isTracingActive() {
return fTracingActive;
}
@Override
public boolean isTracingSupported() {
return fTracingSupported;
}
@Override
public STOP_REASON_ENUM getStopReason() {
return fStopReason;
}
@Override
public Integer getStoppingTracepoint() {
if (fStopReason == null) {
return null;
@ -338,6 +354,7 @@ public class GDBTraceControl_7_2 extends AbstractDsfService implements IGDBTrace
fTracingSupported = supported;
}
@Override
public boolean isTracingSupported() {
return fTracingSupported;
}
@ -366,6 +383,7 @@ public class GDBTraceControl_7_2 extends AbstractDsfService implements IGDBTrace
fVisualModeEnabled = !(context instanceof InvalidTraceRecordDMContext);
}
@Override
public boolean isVisualizationModeEnabled() {
return fVisualModeEnabled;
}
@ -449,6 +467,7 @@ public class GDBTraceControl_7_2 extends AbstractDsfService implements IGDBTrace
return GdbPlugin.getBundleContext();
}
@Override
public void canStartTracing(ITraceTargetDMContext context, final DataRequestMonitor<Boolean> rm) {
if (context == null) {
rm.setStatus(new Status(IStatus.ERROR, GdbPlugin.PLUGIN_ID, INVALID_STATE, "Invalid context", null)); //$NON-NLS-1$
@ -479,6 +498,7 @@ public class GDBTraceControl_7_2 extends AbstractDsfService implements IGDBTrace
rm.done();
}
@Override
public void startTracing(final ITraceTargetDMContext context, final RequestMonitor rm) {
if (context == null) {
rm.setStatus(new Status(IStatus.ERROR, GdbPlugin.PLUGIN_ID, INVALID_STATE, "Invalid context", null)); //$NON-NLS-1$
@ -521,6 +541,7 @@ public class GDBTraceControl_7_2 extends AbstractDsfService implements IGDBTrace
});
}
@Override
public void canStopTracing(ITraceTargetDMContext context, DataRequestMonitor<Boolean> rm) {
if (context == null) {
rm.setStatus(new Status(IStatus.ERROR, GdbPlugin.PLUGIN_ID, INVALID_STATE, "Invalid context", null)); //$NON-NLS-1$
@ -550,6 +571,7 @@ public class GDBTraceControl_7_2 extends AbstractDsfService implements IGDBTrace
isTracing(context, rm);
}
@Override
public void stopTracing(final ITraceTargetDMContext context, final RequestMonitor rm) {
if (context == null) {
rm.setStatus(new Status(IStatus.ERROR, GdbPlugin.PLUGIN_ID, INVALID_STATE, "Invalid context", null)); //$NON-NLS-1$
@ -589,6 +611,7 @@ public class GDBTraceControl_7_2 extends AbstractDsfService implements IGDBTrace
});
}
@Override
public void isTracing(ITraceTargetDMContext context, final DataRequestMonitor<Boolean> rm) {
if (context == null) {
rm.setStatus(new Status(IStatus.ERROR, GdbPlugin.PLUGIN_ID, INVALID_STATE, "Invalid context", null)); //$NON-NLS-1$
@ -611,6 +634,7 @@ public class GDBTraceControl_7_2 extends AbstractDsfService implements IGDBTrace
rm.done();
}
@Override
public void canSaveTraceData(ITraceTargetDMContext context, DataRequestMonitor<Boolean> rm) {
if (context == null) {
rm.setStatus(new Status(IStatus.ERROR, GdbPlugin.PLUGIN_ID, INVALID_STATE, "Invalid context", null)); //$NON-NLS-1$
@ -634,6 +658,7 @@ public class GDBTraceControl_7_2 extends AbstractDsfService implements IGDBTrace
rm.done();
}
@Override
public void saveTraceData(final ITraceTargetDMContext context, final String file,
final boolean remoteSave, final RequestMonitor rm) {
if (context == null) {
@ -658,6 +683,7 @@ public class GDBTraceControl_7_2 extends AbstractDsfService implements IGDBTrace
});
}
@Override
public void canLoadTraceData(ITraceTargetDMContext context, DataRequestMonitor<Boolean> rm) {
if (context == null) {
rm.setStatus(new Status(IStatus.ERROR, GdbPlugin.PLUGIN_ID, INVALID_STATE, "Invalid context", null)); //$NON-NLS-1$
@ -672,6 +698,7 @@ public class GDBTraceControl_7_2 extends AbstractDsfService implements IGDBTrace
rm.done();
}
@Override
public void loadTraceData(final ITraceTargetDMContext context, final String file, final RequestMonitor rm) {
if (context == null) {
rm.setStatus(new Status(IStatus.ERROR, GdbPlugin.PLUGIN_ID, INVALID_STATE, "Invalid context", null)); //$NON-NLS-1$
@ -712,6 +739,7 @@ public class GDBTraceControl_7_2 extends AbstractDsfService implements IGDBTrace
});
}
@Override
public void getTraceStatus(final ITraceTargetDMContext context, final DataRequestMonitor<ITraceStatusDMData> rm) {
if (context == null) {
rm.setStatus(new Status(IStatus.ERROR, GdbPlugin.PLUGIN_ID, INVALID_STATE, "Invalid context", null)); //$NON-NLS-1$
@ -780,6 +808,7 @@ public class GDBTraceControl_7_2 extends AbstractDsfService implements IGDBTrace
});
}
@Override
public void createTraceVariable(ITraceTargetDMContext context,
String varName,
String varValue,
@ -808,6 +837,7 @@ public class GDBTraceControl_7_2 extends AbstractDsfService implements IGDBTrace
}
@Override
public void getTraceVariables(ITraceTargetDMContext context, final DataRequestMonitor<ITraceVariableDMData[]> rm) {
if (context == null) {
rm.setStatus(new Status(IStatus.ERROR, GdbPlugin.PLUGIN_ID, INVALID_STATE, "Invalid context", null)); //$NON-NLS-1$
@ -846,10 +876,12 @@ public class GDBTraceControl_7_2 extends AbstractDsfService implements IGDBTrace
* Create a trace record context
* @since 4.0
*/
@Override
public ITraceRecordDMContext createTraceRecordContext(ITraceTargetDMContext ctx, String recordId) {
return new MITraceRecordDMContext(getSession(), ctx, recordId);
}
@Override
public ITraceRecordDMContext createNextRecordContext(ITraceRecordDMContext ctx) {
ITraceTargetDMContext targetDmc = DMContexts.getAncestorOfType(ctx, ITraceTargetDMContext.class);
if (ctx instanceof InvalidTraceRecordDMContext) {
@ -871,6 +903,7 @@ public class GDBTraceControl_7_2 extends AbstractDsfService implements IGDBTrace
return null;
}
@Override
public ITraceRecordDMContext createPrevRecordContext(ITraceRecordDMContext ctx) {
if (ctx instanceof MITraceRecordDMContext) {
ITraceTargetDMContext targetDmc = DMContexts.getAncestorOfType(ctx, ITraceTargetDMContext.class);
@ -889,6 +922,7 @@ public class GDBTraceControl_7_2 extends AbstractDsfService implements IGDBTrace
}
@Override
public void getCurrentTraceRecordContext(ITraceTargetDMContext context, DataRequestMonitor<ITraceRecordDMContext> drm) {
if (fCurrentRecordDmc == null) {
drm.setData(new InvalidTraceRecordDMContext(getSession(), context));
@ -898,6 +932,7 @@ public class GDBTraceControl_7_2 extends AbstractDsfService implements IGDBTrace
drm.done();
}
@Override
public void selectTraceRecord(final ITraceRecordDMContext context, final RequestMonitor rm) {
if (fIsTracingCurrentlySupported == false) {
rm.setStatus(new Status(IStatus.ERROR, GdbPlugin.PLUGIN_ID, NOT_SUPPORTED, "Tracing not supported", null)); //$NON-NLS-1$
@ -1042,6 +1077,7 @@ public class GDBTraceControl_7_2 extends AbstractDsfService implements IGDBTrace
});
}
@Override
public void getTraceRecordData(final ITraceRecordDMContext context, final DataRequestMonitor<ITraceRecordDMData> rm) {
if (context instanceof MITraceRecordDMContext) {
@ -1082,6 +1118,7 @@ public class GDBTraceControl_7_2 extends AbstractDsfService implements IGDBTrace
}
}
@Override
public void flushCache(IDMContext context) {
fTraceCache.reset(context);
}

View file

@ -328,6 +328,7 @@ public class StartOrRestartProcessSequence_7_0 extends ReflectionSequence {
// Add the inferior to the launch.
// This cannot be done on the executor or things deadlock.
DebugPlugin.getDefault().asyncExec(new Runnable() {
@Override
public void run() {
String label = pathLabel;

View file

@ -46,7 +46,7 @@ public class GDBBackendCLIProcess extends MIBackendCLIProcess {
// in Debug View. We need to kill inferior too. Fix bug
// https://bugs.eclipse.org/bugs/show_bug.cgi?id=234467
//
getSession().getExecutor().execute(new DsfRunnable() { public void run() {
getSession().getExecutor().execute(new DsfRunnable() { @Override public void run() {
if (!DsfSession.isSessionActive(getSession().getId())) return;
if (isDisposed()) return;

View file

@ -169,6 +169,7 @@ public class GDBControl extends AbstractMIControl implements IGDBControl {
}
@Override
public String getId() {
return fMIBackend.getId();
}
@ -178,10 +179,12 @@ public class GDBControl extends AbstractMIControl implements IGDBControl {
return fControlDmc;
}
@Override
public ICommandControlDMContext getContext() {
return fControlDmc;
}
@Override
public void terminate(final RequestMonitor rm) {
if (fTerminated) {
rm.done();
@ -203,6 +206,7 @@ public class GDBControl extends AbstractMIControl implements IGDBControl {
// runnable will kill the task.
final Future<?> forceQuitTask = getExecutor().schedule(
new DsfRunnable() {
@Override
public void run() {
fMIBackend.destroy();
rm.done();
@ -233,6 +237,7 @@ public class GDBControl extends AbstractMIControl implements IGDBControl {
);
}
@Override
public AbstractCLIProcess getCLIProcess() {
return fCLIProcess;
}
@ -240,11 +245,13 @@ public class GDBControl extends AbstractMIControl implements IGDBControl {
/**
* @since 2.0
*/
@Override
public void setTracingStream(OutputStream tracingStream) {
setMITracingStream(tracingStream);
}
/** @since 3.0 */
@Override
public void setEnvironment(Properties props, boolean clear, final RequestMonitor rm) {
int count = 0;
CountingRequestMonitor countingRm = new CountingRequestMonitor(getExecutor(), rm);
@ -273,6 +280,7 @@ public class GDBControl extends AbstractMIControl implements IGDBControl {
* @since 4.0
*/
@SuppressWarnings("unchecked")
@Override
public void completeInitialization(final RequestMonitor rm) {
// We take the attributes from the launchConfiguration
ILaunch launch = (ILaunch)getSession().getModelAdapter(ILaunch.class);
@ -441,7 +449,9 @@ public class GDBControl extends AbstractMIControl implements IGDBControl {
* return empty list.
*/
private final List<String> fFeatures = new ArrayList<String>();
/** @since 4.0 */
@Override
public List<String> getFeatures() {
return fFeatures;
}
@ -449,6 +459,7 @@ public class GDBControl extends AbstractMIControl implements IGDBControl {
/**
* @since 4.0
*/
@Override
public void enablePrettyPrintingForMIVariableObjects(RequestMonitor rm) {
rm.done();
}
@ -456,6 +467,7 @@ public class GDBControl extends AbstractMIControl implements IGDBControl {
/**
* @since 4.0
*/
@Override
public void setPrintPythonErrors(boolean enabled, RequestMonitor rm) {
rm.done();
}