From 9e9c3807983e50fae5fb7347eed746d453107b74 Mon Sep 17 00:00:00 2001 From: Sergey Prigogin Date: Sun, 2 Sep 2012 18:24:23 -0700 Subject: [PATCH 1/6] Cosmetics. --- .../cdt/internal/core/index/IIndexFragmentFileSet.java | 5 ++--- .../org/eclipse/cdt/internal/core/index/IndexFileSet.java | 4 ++-- .../cdt/internal/core/parser/scanner/IncludeSearchPath.java | 2 -- .../cdt/internal/core/pdom/indexer/PDOMUpdateTask.java | 6 +++--- 4 files changed, 7 insertions(+), 10 deletions(-) diff --git a/core/org.eclipse.cdt.core/parser/org/eclipse/cdt/internal/core/index/IIndexFragmentFileSet.java b/core/org.eclipse.cdt.core/parser/org/eclipse/cdt/internal/core/index/IIndexFragmentFileSet.java index bfe5d1ed5cb..c7309b66196 100644 --- a/core/org.eclipse.cdt.core/parser/org/eclipse/cdt/internal/core/index/IIndexFragmentFileSet.java +++ b/core/org.eclipse.cdt.core/parser/org/eclipse/cdt/internal/core/index/IIndexFragmentFileSet.java @@ -6,19 +6,18 @@ * http://www.eclipse.org/legal/epl-v10.html * * Contributors: - * Markus Schorn - initial API and implementation + * Markus Schorn - initial API and implementation *******************************************************************************/ package org.eclipse.cdt.internal.core.index; import org.eclipse.core.runtime.CoreException; public interface IIndexFragmentFileSet { - /** * Returns whether the file-set contains the file of the local binding. * @throws CoreException */ - boolean containsFileOfLocalBinding(IIndexFragmentBinding fb) throws CoreException; + boolean containsFileOfLocalBinding(IIndexFragmentBinding binding) throws CoreException; /** * Adds the fragment file to the file-set. diff --git a/core/org.eclipse.cdt.core/parser/org/eclipse/cdt/internal/core/index/IndexFileSet.java b/core/org.eclipse.cdt.core/parser/org/eclipse/cdt/internal/core/index/IndexFileSet.java index 854a486cc67..14489d061c3 100644 --- a/core/org.eclipse.cdt.core/parser/org/eclipse/cdt/internal/core/index/IndexFileSet.java +++ b/core/org.eclipse.cdt.core/parser/org/eclipse/cdt/internal/core/index/IndexFileSet.java @@ -6,7 +6,7 @@ * http://www.eclipse.org/legal/epl-v10.html * * Contributors: - * Markus Schorn - initial API and implementation + * Markus Schorn - initial API and implementation *******************************************************************************/ package org.eclipse.cdt.internal.core.index; @@ -150,7 +150,7 @@ public class IndexFileSet implements IIndexFileSet { int j= ok.nextSetBit(0); for (int i = 0; i < result.length; i++) { result[i]= bindings[j]; - j= ok.nextSetBit(j+1); + j= ok.nextSetBit(j + 1); } return result; } diff --git a/core/org.eclipse.cdt.core/parser/org/eclipse/cdt/internal/core/parser/scanner/IncludeSearchPath.java b/core/org.eclipse.cdt.core/parser/org/eclipse/cdt/internal/core/parser/scanner/IncludeSearchPath.java index 6345deffafd..ea0c8f4f824 100644 --- a/core/org.eclipse.cdt.core/parser/org/eclipse/cdt/internal/core/parser/scanner/IncludeSearchPath.java +++ b/core/org.eclipse.cdt.core/parser/org/eclipse/cdt/internal/core/parser/scanner/IncludeSearchPath.java @@ -12,7 +12,6 @@ package org.eclipse.cdt.internal.core.parser.scanner; import java.util.List; - /** * Represents the include search path */ @@ -20,7 +19,6 @@ public final class IncludeSearchPath { private final boolean fInhibitUseOfCurrentFileDirectory; private final IncludeSearchPathElement[] fElements; - IncludeSearchPath(List elements, boolean inhibitUseOfCurrentFileDirectory) { fElements= elements.toArray(new IncludeSearchPathElement[elements.size()]); fInhibitUseOfCurrentFileDirectory= inhibitUseOfCurrentFileDirectory; diff --git a/core/org.eclipse.cdt.core/parser/org/eclipse/cdt/internal/core/pdom/indexer/PDOMUpdateTask.java b/core/org.eclipse.cdt.core/parser/org/eclipse/cdt/internal/core/pdom/indexer/PDOMUpdateTask.java index 6948991ea8b..26fa99cd9c1 100644 --- a/core/org.eclipse.cdt.core/parser/org/eclipse/cdt/internal/core/pdom/indexer/PDOMUpdateTask.java +++ b/core/org.eclipse.cdt.core/parser/org/eclipse/cdt/internal/core/pdom/indexer/PDOMUpdateTask.java @@ -195,7 +195,7 @@ public class PDOMUpdateTask implements IPDOMIndexerTask { return tu; } - private boolean canResolveUnresolvedInclude(IIndexFile file, IScannerInfo scannerInfo, + private static boolean canResolveUnresolvedInclude(IIndexFile file, IScannerInfo scannerInfo, ProjectIndexerIncludeResolutionHeuristics includeResolutionHeuristics) { try { String filePath = IndexLocationFactory.getAbsolutePath(file.getLocation()).toOSString(); @@ -214,7 +214,7 @@ public class PDOMUpdateTask implements IPDOMIndexerTask { return false; } - private boolean canResolveInclude(IIndexInclude include, String currentFile, long timestamp, + private static boolean canResolveInclude(IIndexInclude include, String currentFile, long timestamp, IncludeSearchPath includeSearchPath, ProjectIndexerIncludeResolutionHeuristics includeResolutionHeuristics) throws CoreException { String includeName = include.getFullName(); @@ -259,7 +259,7 @@ public class PDOMUpdateTask implements IPDOMIndexerTask { /** * Returns true if the file exists and is not older than the given timestamp. */ - private boolean fileIsNotOlderThanTimestamp(String filename, long timestamp) { + private static boolean fileIsNotOlderThanTimestamp(String filename, long timestamp) { // We are subtracting 1 second from the timestamp to account for limited precision // of File.lastModified() method and possible skew between clocks on a multi-CPU // system. This may produce false positives, but they are pretty harmless. From 435b10dfdf4723ec3171a209b4cb0b7688382531 Mon Sep 17 00:00:00 2001 From: Sergey Prigogin Date: Sun, 2 Sep 2012 19:21:02 -0700 Subject: [PATCH 2/6] Protect against NPE. --- .../core/parser/scanner/CPreprocessor.java | 54 +++++++++++-------- 1 file changed, 31 insertions(+), 23 deletions(-) diff --git a/core/org.eclipse.cdt.core/parser/org/eclipse/cdt/internal/core/parser/scanner/CPreprocessor.java b/core/org.eclipse.cdt.core/parser/org/eclipse/cdt/internal/core/parser/scanner/CPreprocessor.java index 9424144941c..ad0bcd7b0aa 100644 --- a/core/org.eclipse.cdt.core/parser/org/eclipse/cdt/internal/core/parser/scanner/CPreprocessor.java +++ b/core/org.eclipse.cdt.core/parser/org/eclipse/cdt/internal/core/parser/scanner/CPreprocessor.java @@ -398,34 +398,42 @@ public class CPreprocessor implements ILexerLog, IScanner, IAdaptable { return array == null ? CharArrayUtils.EMPTY_CHAR_ARRAY : array; } + /** + * Returns include search path for a given current directory and a IScannerInfo. + * @param directory the current directory + * @param info scanner information, or {@code null} if not available + * @return the include search path + */ public static IncludeSearchPath configureIncludeSearchPath(File directory, IScannerInfo info) { boolean inhibitUseOfCurrentFileDirectory= false; List elements = new ArrayList(); - // Quote includes first - if (info instanceof IExtendedScannerInfo) { - final IExtendedScannerInfo einfo= (IExtendedScannerInfo) info; - final String[] paths= einfo.getLocalIncludePath(); - if (paths != null) { - for (String path : paths) { - if ("-".equals(path)) { //$NON-NLS-1$ - inhibitUseOfCurrentFileDirectory= true; - } else { - elements.add(new IncludeSearchPathElement(makeAbsolute(directory, path), true)); - } + if (info != null) { + // Quote includes first + if (info instanceof IExtendedScannerInfo) { + final IExtendedScannerInfo einfo= (IExtendedScannerInfo) info; + final String[] paths= einfo.getLocalIncludePath(); + if (paths != null) { + for (String path : paths) { + if ("-".equals(path)) { //$NON-NLS-1$ + inhibitUseOfCurrentFileDirectory= true; + } else { + elements.add(new IncludeSearchPathElement(makeAbsolute(directory, path), true)); + } + } + } + } + // Regular includes + String[] paths= info.getIncludePaths(); + if (paths != null) { + for (String path : paths) { + if ("-".equals(path)) { //$NON-NLS-1$ + inhibitUseOfCurrentFileDirectory= true; + } else { + elements.add(new IncludeSearchPathElement(makeAbsolute(directory, path), false)); + } } - } - } - // Regular includes - String[] paths= info.getIncludePaths(); - if (paths != null) { - for (String path : paths) { - if ("-".equals(path)) { //$NON-NLS-1$ - inhibitUseOfCurrentFileDirectory= true; - } else { - elements.add(new IncludeSearchPathElement(makeAbsolute(directory, path), false)); - } - } + } } return new IncludeSearchPath(elements, inhibitUseOfCurrentFileDirectory); } From 05a61b35bf8e306af6e8acf3940ebc855235c45a Mon Sep 17 00:00:00 2001 From: Sergey Prigogin Date: Mon, 3 Sep 2012 12:40:08 -0700 Subject: [PATCH 3/6] Cosmetics. --- .../org/eclipse/cdt/core/model/IInclude.java | 21 +++++++++++-------- .../cdt/internal/core/model/Include.java | 10 --------- .../cdt/core/index/IIndexFileLocation.java | 10 +++++---- .../org/eclipse/cdt/ui/IncludesGrouping.java | 13 +----------- 4 files changed, 19 insertions(+), 35 deletions(-) diff --git a/core/org.eclipse.cdt.core/model/org/eclipse/cdt/core/model/IInclude.java b/core/org.eclipse.cdt.core/model/org/eclipse/cdt/core/model/IInclude.java index e5a9ee76d15..18455838863 100644 --- a/core/org.eclipse.cdt.core/model/org/eclipse/cdt/core/model/IInclude.java +++ b/core/org.eclipse.cdt.core/model/org/eclipse/cdt/core/model/IInclude.java @@ -20,23 +20,26 @@ package org.eclipse.cdt.core.model; public interface IInclude extends ICElement, ISourceReference, ISourceManipulation { /** * Returns the name that of the included file. - * For example, for the statement "#include , - * this returns "stdio.h". + * For example, for the statement {@code #include }, + * this returns {@code "stdio.h"}. */ - String getIncludeName(); + public String getIncludeName(); /** * Returns whether the included was search on "standard places" like /usr/include first . - * An include is standard if it starts with "\<". - * For example, "#include \" returns true and - * "#include "foobar.h" returns false. + * An include is standard if it starts with {@code '<'}. + * For example, {@code #include } returns {@code true} and + * {@code #include "foobar.h"} returns {@code false}. */ - boolean isStandard(); - - public String getFullFileName(); + public boolean isStandard(); + /** + * The inverse of {@link #isStandard()} + */ public boolean isLocal(); + public String getFullFileName(); + /** * @return whether this include directive was resolved and followed. */ diff --git a/core/org.eclipse.cdt.core/model/org/eclipse/cdt/internal/core/model/Include.java b/core/org.eclipse.cdt.core/model/org/eclipse/cdt/internal/core/model/Include.java index 78bac12264d..4ea7e73c8a1 100644 --- a/core/org.eclipse.cdt.core/model/org/eclipse/cdt/internal/core/model/Include.java +++ b/core/org.eclipse.cdt.core/model/org/eclipse/cdt/internal/core/model/Include.java @@ -16,7 +16,6 @@ import org.eclipse.cdt.core.model.ICElement; import org.eclipse.cdt.core.model.IInclude; public class Include extends SourceManipulation implements IInclude { - private String fullPath; private final boolean standard; private boolean fIsResolved= true; @@ -44,9 +43,6 @@ public class Include extends SourceManipulation implements IInclude { return fullPath; } - /* (non-Javadoc) - * @see org.eclipse.cdt.core.model.IInclude#isLocal() - */ @Override public boolean isLocal() { return !isStandard(); @@ -64,17 +60,11 @@ public class Include extends SourceManipulation implements IInclude { fIsResolved= resolved; } - /* - * @see org.eclipse.cdt.core.model.IInclude#isResolved() - */ @Override public boolean isResolved() { return fIsResolved; } - /* - * @see org.eclipse.cdt.internal.core.model.CElement#equals(java.lang.Object) - */ @Override public boolean equals(Object other) { if (other instanceof IInclude && equals(this, (IInclude) other)) { diff --git a/core/org.eclipse.cdt.core/parser/org/eclipse/cdt/core/index/IIndexFileLocation.java b/core/org.eclipse.cdt.core/parser/org/eclipse/cdt/core/index/IIndexFileLocation.java index 4b92a5fd5e3..e170a19afa0 100644 --- a/core/org.eclipse.cdt.core/parser/org/eclipse/cdt/core/index/IIndexFileLocation.java +++ b/core/org.eclipse.cdt.core/parser/org/eclipse/cdt/core/index/IIndexFileLocation.java @@ -6,15 +6,17 @@ * http://www.eclipse.org/legal/epl-v10.html * * Contributors: - * Andrew Ferguson (Symbian) - initial API and implementation + * Andrew Ferguson (Symbian) - initial API and implementation *******************************************************************************/ package org.eclipse.cdt.core.index; import java.net.URI; /** - * Files in the index are (conceptually) partitioned into workspace and non-workspace (external) files. - * Clients can obtain instances of IIndexFileLocation implementations from {@link IndexLocationFactory} + * Files in the index are (conceptually) partitioned into workspace and non-workspace (external) + * files. Clients can obtain instances of IIndexFileLocation implementations from + * {@link IndexLocationFactory}. Two index file locations are considered equal if their URIs are + * equal. * * @noextend This interface is not intended to be extended by clients. * @noimplement This interface is not intended to be implemented by clients. @@ -26,7 +28,7 @@ public interface IIndexFileLocation { * @return the URI of the indexed file (non-null) */ public URI getURI(); - + /** * Return the workspace relative path of the indexed file or null if the file * is not in the workspace diff --git a/core/org.eclipse.cdt.ui/src/org/eclipse/cdt/ui/IncludesGrouping.java b/core/org.eclipse.cdt.ui/src/org/eclipse/cdt/ui/IncludesGrouping.java index 584a053181e..26820d133c2 100644 --- a/core/org.eclipse.cdt.ui/src/org/eclipse/cdt/ui/IncludesGrouping.java +++ b/core/org.eclipse.cdt.ui/src/org/eclipse/cdt/ui/IncludesGrouping.java @@ -8,14 +8,12 @@ * Contributors: * QNX Software Systems - Initial API and implementation *******************************************************************************/ - package org.eclipse.cdt.ui; import org.eclipse.cdt.core.model.CModelException; import org.eclipse.cdt.core.model.ICElement; import org.eclipse.cdt.core.model.ITranslationUnit; - /** * IncludesGrouping */ @@ -27,9 +25,6 @@ public class IncludesGrouping extends CElementGrouping { tu = unit; } - /* (non-Javadoc) - * @see org.eclipse.ui.model.IWorkbenchAdapter#getChildren(java.lang.Object) - */ @Override public Object[] getChildren(Object object) { try { @@ -39,24 +34,18 @@ public class IncludesGrouping extends CElementGrouping { return super.getChildren(object); } - /* (non-Javadoc) - * @see org.eclipse.ui.model.IWorkbenchAdapter#getParent(java.lang.Object) - */ @Override public Object getParent(Object object) { return tu; } - /* (non-Javadoc) - * @see java.lang.Object#equals(java.lang.Object) - */ @Override public boolean equals(Object obj) { if (this == obj) { return true; } if (obj instanceof IncludesGrouping) { - return tu.equals(((IncludesGrouping)obj).tu) ; + return tu.equals(((IncludesGrouping) obj).tu) ; } return false; } From 7660c4881e765b1f6dc5a658f02ef79e61fc0b83 Mon Sep 17 00:00:00 2001 From: Andrew Gvozdev Date: Wed, 5 Sep 2012 23:35:23 -0400 Subject: [PATCH 4/6] bug 388755: test cases differ on windows and unix --- .../efsextension/tests/EFSExtensionTests.java | 13 +++++++++++-- 1 file changed, 11 insertions(+), 2 deletions(-) diff --git a/core/org.eclipse.cdt.core.tests/misc/org/eclipse/cdt/core/internal/efsextension/tests/EFSExtensionTests.java b/core/org.eclipse.cdt.core.tests/misc/org/eclipse/cdt/core/internal/efsextension/tests/EFSExtensionTests.java index 42cfc668cf9..b3b565633e3 100644 --- a/core/org.eclipse.cdt.core.tests/misc/org/eclipse/cdt/core/internal/efsextension/tests/EFSExtensionTests.java +++ b/core/org.eclipse.cdt.core.tests/misc/org/eclipse/cdt/core/internal/efsextension/tests/EFSExtensionTests.java @@ -20,6 +20,7 @@ import junit.framework.TestSuite; import org.eclipse.cdt.utils.EFSExtensionManager; import org.eclipse.core.runtime.IPath; import org.eclipse.core.runtime.Path; +import org.eclipse.core.runtime.Platform; /** * Tests the EFSExtensionManager and EFSExtensionProvider classes, as well as the EFSExtensionProvider extension point. @@ -235,7 +236,11 @@ public class EFSExtensionTests extends TestCase { String path = EFSExtensionManager.getDefault().getMappedPath(originalURI); - assertEquals(path, "c:/foo"); + if (Platform.getOS().equals(Platform.WS_WIN32)) { + assertEquals(path, "c:/foo"); + } else { + assertEquals(path, "/c:/foo"); + } } public void testGetPathFromURI() { @@ -248,7 +253,11 @@ public class EFSExtensionTests extends TestCase { String path = EFSExtensionManager.getDefault().getMappedPath(originalURI); - assertEquals(path, "c:/foo"); + if (Platform.getOS().equals(Platform.WS_WIN32)) { + assertEquals(path, "c:/foo"); + } else { + assertEquals(path, "/c:/foo"); + } } public void testExtension() { From d62945a3d9222e73553d5d5e0b89574749a90085 Mon Sep 17 00:00:00 2001 From: Sergey Prigogin Date: Wed, 5 Sep 2012 20:03:55 -0700 Subject: [PATCH 5/6] Cosmetics. --- .../eclipse/cdt/core/index/IIndexFileSet.java | 4 ++-- .../cdt/internal/core/index/IndexFileSet.java | 3 --- .../PDOMProjectIndexLocationConverter.java | 20 +++++++------------ 3 files changed, 9 insertions(+), 18 deletions(-) diff --git a/core/org.eclipse.cdt.core/parser/org/eclipse/cdt/core/index/IIndexFileSet.java b/core/org.eclipse.cdt.core/parser/org/eclipse/cdt/core/index/IIndexFileSet.java index 61256b0efaa..093b8a1449c 100644 --- a/core/org.eclipse.cdt.core/parser/org/eclipse/cdt/core/index/IIndexFileSet.java +++ b/core/org.eclipse.cdt.core/parser/org/eclipse/cdt/core/index/IIndexFileSet.java @@ -6,8 +6,8 @@ * http://www.eclipse.org/legal/epl-v10.html * * Contributors: - * Markus Schorn - initial API and implementation - * Sergey Prigogin (Google) + * Markus Schorn - initial API and implementation + * Sergey Prigogin (Google) *******************************************************************************/ package org.eclipse.cdt.core.index; diff --git a/core/org.eclipse.cdt.core/parser/org/eclipse/cdt/internal/core/index/IndexFileSet.java b/core/org.eclipse.cdt.core/parser/org/eclipse/cdt/internal/core/index/IndexFileSet.java index 14489d061c3..1db48d50325 100644 --- a/core/org.eclipse.cdt.core/parser/org/eclipse/cdt/internal/core/index/IndexFileSet.java +++ b/core/org.eclipse.cdt.core/parser/org/eclipse/cdt/internal/core/index/IndexFileSet.java @@ -172,9 +172,6 @@ public class IndexFileSet implements IIndexFileSet { return invert; } - /* (non-Javadoc) - * @see org.eclipse.cdt.core.index.IIndexFileSet#invert() - */ @Override public IIndexFileSet invert() { if (fInverse == null) { diff --git a/core/org.eclipse.cdt.core/parser/org/eclipse/cdt/internal/core/pdom/dom/PDOMProjectIndexLocationConverter.java b/core/org.eclipse.cdt.core/parser/org/eclipse/cdt/internal/core/pdom/dom/PDOMProjectIndexLocationConverter.java index ddf959d40dd..b06f7bcf375 100644 --- a/core/org.eclipse.cdt.core/parser/org/eclipse/cdt/internal/core/pdom/dom/PDOMProjectIndexLocationConverter.java +++ b/core/org.eclipse.cdt.core/parser/org/eclipse/cdt/internal/core/pdom/dom/PDOMProjectIndexLocationConverter.java @@ -6,8 +6,8 @@ * http://www.eclipse.org/legal/epl-v10.html * * Contributors: - * Andrew Ferguson (Symbian) - initial API and implementation - * Markus Schorn (Wind River Systems) + * Andrew Ferguson (Symbian) - initial API and implementation + * Markus Schorn (Wind River Systems) *******************************************************************************/ package org.eclipse.cdt.internal.core.pdom.dom; @@ -44,23 +44,20 @@ public class PDOMProjectIndexLocationConverter implements IIndexLocationConverte fIgnoreExternal= ignoreWSExternal; } - /* (non-Javadoc) - * @see org.eclipse.cdt.internal.core.pdom.dom.IIndexLocationConverter#fromInternalFormat(java.lang.String) - */ @Override public IIndexFileLocation fromInternalFormat(String raw) { String fullPath = null; URI uri= null; - if(raw.startsWith(EXTERNAL)) { + if (raw.startsWith(EXTERNAL)) { try { uri = new URI(raw.substring(EXTERNAL.length())); - } catch(URISyntaxException use) { + } catch (URISyntaxException e) { } } else { if (raw.startsWith(WS)) { fullPath= raw.substring(WS.length()); } else { - fullPath= fFullPathPrefix+raw; + fullPath= fFullPathPrefix + raw; } final IPath path= new Path(fullPath); if (path.segmentCount() > 1) { @@ -71,13 +68,10 @@ public class PDOMProjectIndexLocationConverter implements IIndexLocationConverte return uri == null ? null : new IndexFileLocation(uri, fullPath); } - /* (non-Javadoc) - * @see org.eclipse.cdt.internal.core.pdom.dom.IIndexLocationConverter#toRaw(java.net.URI) - */ @Override public String toInternalFormat(IIndexFileLocation location) { String fullPath= location.getFullPath(); - if(fullPath!=null) { + if (fullPath != null) { if (fullPath.startsWith(fFullPathPrefix)) { return fullPath.substring(fFullPathPrefix.length()); } @@ -87,6 +81,6 @@ public class PDOMProjectIndexLocationConverter implements IIndexLocationConverte if (fIgnoreExternal) return null; - return EXTERNAL+location.getURI().toString(); + return EXTERNAL + location.getURI().toString(); } } From 1735542b2d535eb110b79d1b270d3ce711a80974 Mon Sep 17 00:00:00 2001 From: Marc Khouzam Date: Tue, 4 Sep 2012 17:41:47 -0400 Subject: [PATCH 6/6] Bug 388793: Breakpoint actions do not work with non-stop mode Change-Id: Ied37f0289d6ab6fe2ab6ac250bf4ecdce82faaff Reviewed-on: https://git.eclipse.org/r/7657 Reviewed-by: Pawel Piech IP-Clean: Pawel Piech Tested-by: Pawel Piech --- .../dsf/mi/service/MIBreakpointsManager.java | 41 +++++++++++++------ 1 file changed, 28 insertions(+), 13 deletions(-) diff --git a/dsf-gdb/org.eclipse.cdt.dsf.gdb/src/org/eclipse/cdt/dsf/mi/service/MIBreakpointsManager.java b/dsf-gdb/org.eclipse.cdt.dsf.gdb/src/org/eclipse/cdt/dsf/mi/service/MIBreakpointsManager.java index d9f92ccf869..4a1208b9ebb 100644 --- a/dsf-gdb/org.eclipse.cdt.dsf.gdb/src/org/eclipse/cdt/dsf/mi/service/MIBreakpointsManager.java +++ b/dsf-gdb/org.eclipse.cdt.dsf.gdb/src/org/eclipse/cdt/dsf/mi/service/MIBreakpointsManager.java @@ -54,6 +54,7 @@ import org.eclipse.cdt.dsf.debug.service.IDsfBreakpointExtension; import org.eclipse.cdt.dsf.debug.service.IRunControl; import org.eclipse.cdt.dsf.debug.service.IRunControl.IContainerDMContext; import org.eclipse.cdt.dsf.debug.service.IRunControl.IExecutionDMContext; +import org.eclipse.cdt.dsf.debug.service.IRunControl.ISuspendedDMEvent; import org.eclipse.cdt.dsf.debug.service.ISourceLookup; import org.eclipse.cdt.dsf.debug.service.ISourceLookup.ISourceLookupDMContext; import org.eclipse.cdt.dsf.debug.service.command.ICommandControl; @@ -65,6 +66,7 @@ import org.eclipse.cdt.dsf.mi.service.MIBreakpoints.BreakpointUpdatedEvent; import org.eclipse.cdt.dsf.mi.service.MIBreakpoints.MIBreakpointDMContext; import org.eclipse.cdt.dsf.mi.service.MIRunControl.SuspendedEvent; import org.eclipse.cdt.dsf.mi.service.breakpoint.actions.BreakpointActionAdapter; +import org.eclipse.cdt.dsf.mi.service.command.events.IMIDMEvent; import org.eclipse.cdt.dsf.mi.service.command.events.MIBreakpointHitEvent; import org.eclipse.cdt.dsf.mi.service.command.events.MIWatchpointScopeEvent; import org.eclipse.cdt.dsf.mi.service.command.events.MIWatchpointTriggerEvent; @@ -1340,21 +1342,34 @@ public class MIBreakpointsManager extends AbstractDsfService implements IBreakpo // Breakpoint actions //------------------------------------------------------------------------- + /** @since 4.2 */ @DsfServiceEventHandler + public void eventDispatched(ISuspendedDMEvent e) { + assert e instanceof IMIDMEvent; + if (e instanceof IMIDMEvent) { + Object miEvent = ((IMIDMEvent)e).getMIEvent(); + + if (miEvent instanceof MIBreakpointHitEvent) { + // This covers catchpoints, too + MIBreakpointHitEvent evt = (MIBreakpointHitEvent)miEvent; + performBreakpointAction(evt.getDMContext(), evt.getNumber()); + return; + } + + if (miEvent instanceof MIWatchpointTriggerEvent) { + MIWatchpointTriggerEvent evt = (MIWatchpointTriggerEvent)miEvent; + performBreakpointAction(evt.getDMContext(), evt.getNumber()); + return; + } + } + } + + /** + * @deprecated Replaced by the generic {@link #eventDispatched(ISuspendedDMEvent)} + */ + @Deprecated + @DsfServiceEventHandler public void eventDispatched(SuspendedEvent e) { - - if (e.getMIEvent() instanceof MIBreakpointHitEvent) { - // This covers catchpoints, too - MIBreakpointHitEvent evt = (MIBreakpointHitEvent) e.getMIEvent(); - performBreakpointAction(evt.getDMContext(), evt.getNumber()); - return; - } - - if (e.getMIEvent() instanceof MIWatchpointTriggerEvent) { - MIWatchpointTriggerEvent evt = (MIWatchpointTriggerEvent) e.getMIEvent(); - performBreakpointAction(evt.getDMContext(), evt.getNumber()); - return; - } } private void performBreakpointAction(final IDMContext context, int number) {