Skip to main content
summaryrefslogtreecommitdiffstats
path: root/debug
diff options
context:
space:
mode:
authorSergey Prigogin2010-12-08 20:16:31 -0500
committerSergey Prigogin2010-12-08 20:16:31 -0500
commit82e06db2d932abb7f87250eb91f9d68402057493 (patch)
tree9a74329325d922696df30a5c38ee8a76419cb559 /debug
parentc42dcb755b87e4da1018f24e9fe3ef6b3bde8a43 (diff)
downloadorg.eclipse.cdt-82e06db2d932abb7f87250eb91f9d68402057493.tar.gz
org.eclipse.cdt-82e06db2d932abb7f87250eb91f9d68402057493.tar.xz
org.eclipse.cdt-82e06db2d932abb7f87250eb91f9d68402057493.zip
Generics.
Diffstat (limited to 'debug')
-rw-r--r--debug/org.eclipse.cdt.debug.core/src/org/eclipse/cdt/debug/internal/core/model/CDebugTarget.java976
1 files changed, 475 insertions, 501 deletions
diff --git a/debug/org.eclipse.cdt.debug.core/src/org/eclipse/cdt/debug/internal/core/model/CDebugTarget.java b/debug/org.eclipse.cdt.debug.core/src/org/eclipse/cdt/debug/internal/core/model/CDebugTarget.java
index 50aa7a03ba..16886beacf 100644
--- a/debug/org.eclipse.cdt.debug.core/src/org/eclipse/cdt/debug/internal/core/model/CDebugTarget.java
+++ b/debug/org.eclipse.cdt.debug.core/src/org/eclipse/cdt/debug/internal/core/model/CDebugTarget.java
@@ -147,7 +147,7 @@ public class CDebugTarget extends CDebugElement implements ICDebugTarget, ICDIEv
* When a thread starts it is added to the list.
* When a thread ends it is removed from the list.
*/
- private ArrayList fThreads;
+ private ArrayList<CThread> fThreads;
/**
* Associated inferior process, or <code>null</code> if not available.
@@ -240,7 +240,7 @@ public class CDebugTarget extends CDebugElement implements ICDebugTarget, ICDIEv
private IAddressFactory fAddressFactory;
/**
- * Support for the memory retrival on this target.
+ * Support for the memory retrieval on this target.
*/
private CMemoryBlockRetrievalExtension fMemoryBlockRetrieval;
@@ -254,68 +254,68 @@ public class CDebugTarget extends CDebugElement implements ICDebugTarget, ICDIEv
/**
* Constructor for CDebugTarget.
*/
- public CDebugTarget( ILaunch launch, IProject project, ICDITarget cdiTarget, String name, IProcess debuggeeProcess, IBinaryObject file, boolean allowsTerminate, boolean allowsDisconnect) {
- super( null );
- setLaunch( launch );
- setDebugTarget( this );
- setName( name );
- setProcess( debuggeeProcess );
+ public CDebugTarget(ILaunch launch, IProject project, ICDITarget cdiTarget, String name, IProcess debuggeeProcess, IBinaryObject file, boolean allowsTerminate, boolean allowsDisconnect) {
+ super(null);
+ setLaunch(launch);
+ setDebugTarget(this);
+ setName(name);
+ setProcess(debuggeeProcess);
setProject(project);
- setExecFile( file );
- setCDITarget( cdiTarget );
- setState( CDebugElementState.SUSPENDED );
+ setExecFile(file);
+ setCDITarget(cdiTarget);
+ setState(CDebugElementState.SUSPENDED);
initializePreferences();
- setConfiguration( cdiTarget.getConfiguration() );
- setThreadList( new ArrayList( 5 ) );
+ setConfiguration(cdiTarget.getConfiguration());
+ setThreadList(new ArrayList<CThread>(5));
createDisassembly();
- setModuleManager( new CModuleManager( this ) );
- setSignalManager( new CSignalManager( this ) );
- setRegisterManager( new CRegisterManager( this ) );
- setBreakpointManager( new CBreakpointManager( this ) );
- setGlobalVariableManager( new CGlobalVariableManager( this ) );
- setFormatManager( new CSettingsManager( this ) );
- setMemoryBlockRetrieval( new CMemoryBlockRetrievalExtension( this ) );
+ setModuleManager(new CModuleManager(this));
+ setSignalManager(new CSignalManager(this));
+ setRegisterManager(new CRegisterManager(this));
+ setBreakpointManager(new CBreakpointManager(this));
+ setGlobalVariableManager(new CGlobalVariableManager(this));
+ setFormatManager(new CSettingsManager(this));
+ setMemoryBlockRetrieval(new CMemoryBlockRetrievalExtension(this));
initialize();
- DebugPlugin.getDefault().getLaunchManager().addLaunchListener( this );
- DebugPlugin.getDefault().getExpressionManager().addExpressionListener( this );
- getCDISession().getEventManager().addEventListener( this );
+ DebugPlugin.getDefault().getLaunchManager().addLaunchListener(this);
+ DebugPlugin.getDefault().getExpressionManager().addExpressionListener(this);
+ getCDISession().getEventManager().addEventListener(this);
}
protected void initialize() {
initializeSourceLookupPath();
- ArrayList debugEvents = new ArrayList( 1 );
- debugEvents.add( createCreateEvent() );
- initializeThreads( debugEvents );
+ ArrayList<DebugEvent> debugEvents = new ArrayList<DebugEvent>(1);
+ debugEvents.add(createCreateEvent());
+ initializeThreads(debugEvents);
initializeBreakpoints();
initializeRegisters();
initializeSourceManager();
initializeModuleManager();
initializeMemoryBlocks();
- getLaunch().addDebugTarget( this );
- fireEventSet( (DebugEvent[])debugEvents.toArray( new DebugEvent[debugEvents.size()] ) );
+ getLaunch().addDebugTarget(this);
+ fireEventSet(debugEvents.toArray(new DebugEvent[debugEvents.size()]));
}
private void initializeBreakpoints() {
getBreakpointManager().initialize();
}
- public void start( String stopSymbol, boolean resume ) throws DebugException {
+ public void start(String stopSymbol, boolean resume) throws DebugException {
ICDITargetConfiguration config = getConfiguration();
- if ( config.supportsBreakpoints() ) {
+ if (config.supportsBreakpoints()) {
getBreakpointManager().setInitialBreakpoints();
- if ( stopSymbol != null && stopSymbol.length() != 0 ) {
+ if (stopSymbol != null && stopSymbol.length() != 0) {
// See if the expression is a numeric address
try {
IAddress address = getAddressFactory().createAddress(stopSymbol);
stopAtAddress(address);
} catch (NumberFormatException nfexc) {
// OK, expression is not a simple, absolute numeric value; keep trucking and try to resolve as expression
- stopAtSymbol( stopSymbol );
+ stopAtSymbol(stopSymbol);
}
}
}
- if ( config.supportsResume() && resume ) {
+ if (config.supportsResume() && resume) {
resume();
}
}
@@ -323,7 +323,7 @@ public class CDebugTarget extends CDebugElement implements ICDebugTarget, ICDIEv
/**
* Adds all of the pre-existing threads to this debug target.
*/
- protected void initializeThreads( List debugEvents ) {
+ protected void initializeThreads(List<DebugEvent> debugEvents) {
final ICDITarget cdiTarget = getCDITarget();
if (cdiTarget == null) {
return;
@@ -332,26 +332,24 @@ public class CDebugTarget extends CDebugElement implements ICDebugTarget, ICDIEv
ICDIThread[] cdiThreads = new ICDIThread[0];
try {
cdiThreads = cdiTarget.getThreads();
- }
- catch( CDIException e ) {
+ } catch (CDIException e) {
// ignore
}
DebugEvent suspendEvent = null;
- for( int i = 0; i < cdiThreads.length; ++i ) {
- CThread thread = createThread( cdiThreads[i] );
- debugEvents.add( thread.createCreateEvent() );
+ for (int i = 0; i < cdiThreads.length; ++i) {
+ CThread thread = createThread(cdiThreads[i]);
+ debugEvents.add(thread.createCreateEvent());
try {
- if ( cdiThreads[i].equals( cdiTarget.getCurrentThread() ) && thread.isSuspended() ) {
+ if (cdiThreads[i].equals(cdiTarget.getCurrentThread()) && thread.isSuspended()) {
// Use BREAKPOINT as a detail to force perspective switch
- suspendEvent = thread.createSuspendEvent( DebugEvent.BREAKPOINT );
+ suspendEvent = thread.createSuspendEvent(DebugEvent.BREAKPOINT);
}
- }
- catch( CDIException e ) {
+ } catch (CDIException e) {
// ignore
}
}
- if ( suspendEvent != null ) {
- debugEvents.add( suspendEvent );
+ if (suspendEvent != null) {
+ debugEvents.add(suspendEvent);
}
}
@@ -361,29 +359,29 @@ public class CDebugTarget extends CDebugElement implements ICDebugTarget, ICDIEv
protected void initializeSourceManager() {
ISourceLocator locator = getLaunch().getSourceLocator();
- if ( locator instanceof IAdaptable ) {
- ICSourceLocator clocator = (ICSourceLocator)((IAdaptable)locator).getAdapter( ICSourceLocator.class );
- if ( clocator instanceof IAdaptable ) {
- CSourceManager sm = (CSourceManager)((IAdaptable)clocator).getAdapter( CSourceManager.class );
- if ( sm != null )
- sm.setDebugTarget( this );
+ if (locator instanceof IAdaptable) {
+ ICSourceLocator clocator = (ICSourceLocator)((IAdaptable)locator).getAdapter(ICSourceLocator.class);
+ if (clocator instanceof IAdaptable) {
+ CSourceManager sm = (CSourceManager)((IAdaptable)clocator).getAdapter(CSourceManager.class);
+ if (sm != null)
+ sm.setDebugTarget(this);
}
- IResourceChangeListener listener = (IResourceChangeListener)((IAdaptable)locator).getAdapter( IResourceChangeListener.class );
- if ( listener != null )
- CCorePlugin.getWorkspace().addResourceChangeListener( listener );
+ IResourceChangeListener listener = (IResourceChangeListener)((IAdaptable)locator).getAdapter(IResourceChangeListener.class);
+ if (listener != null)
+ CCorePlugin.getWorkspace().addResourceChangeListener(listener);
}
}
protected void initializeSourceLookupPath() {
ISourceLocator locator = getLaunch().getSourceLocator();
- if ( locator instanceof ISourceLookupDirector ) {
+ if (locator instanceof ISourceLookupDirector) {
ISourceLookupParticipant[] participants = ((ISourceLookupDirector)locator).getParticipants();
- for ( int i = 0; i < participants.length; ++i ) {
- if ( participants[i] instanceof CSourceLookupParticipant ) {
- ((CSourceLookupParticipant)participants[i]).addSourceLookupChangeListener( this );
+ for (int i = 0; i < participants.length; ++i) {
+ if (participants[i] instanceof CSourceLookupParticipant) {
+ ((CSourceLookupParticipant)participants[i]).addSourceLookupChangeListener(this);
}
}
- setSourceLookupPath( ((ISourceLookupDirector)locator).getSourceContainers() );
+ setSourceLookupPath(((ISourceLookupDirector)locator).getSourceContainers());
}
}
@@ -396,21 +394,20 @@ public class CDebugTarget extends CDebugElement implements ICDebugTarget, ICDIEv
ICDISharedLibrary[] slibs = new ICDISharedLibrary[0];
try {
slibs = cdiTarget.getSharedLibraries();
- }
- catch( CDIException e ) {
- DebugPlugin.log( e );
+ } catch (CDIException e) {
+ DebugPlugin.log(e);
}
ICModule[] modules = null;
if (getExecFile() != null) {
modules = new ICModule[slibs.length + 1];
- modules[0] = CModule.createExecutable( this, getExecFile().getPath() );
- }
- else
+ modules[0] = CModule.createExecutable(this, getExecFile().getPath());
+ } else {
modules = new ICModule[slibs.length];
- for ( int i = 0; i < slibs.length; ++i ) {
- modules[i + 1] = CModule.createSharedLibrary( this, slibs[i] );
}
- getModuleManager().addModules( modules );
+ for (int i = 0; i < slibs.length; ++i) {
+ modules[i + 1] = CModule.createSharedLibrary(this, slibs[i]);
+ }
+ getModuleManager().addModules(modules);
}
protected void initializeMemoryBlocks() {
@@ -431,7 +428,7 @@ public class CDebugTarget extends CDebugElement implements ICDebugTarget, ICDIEv
* or <code>null</code> if no process is associated with this debug target
* (for a core dump debugging).
*/
- protected void setProcess( IProcess debuggeeProcess ) {
+ protected void setProcess(IProcess debuggeeProcess) {
fDebuggeeProcess = debuggeeProcess;
}
@@ -441,8 +438,8 @@ public class CDebugTarget extends CDebugElement implements ICDebugTarget, ICDIEv
* @see org.eclipse.debug.core.model.IDebugTarget#getThreads()
*/
public IThread[] getThreads() {
- List threads = getThreadList();
- return (IThread[])threads.toArray( new IThread[threads.size()] );
+ List<CThread> threads = getThreadList();
+ return threads.toArray(new IThread[threads.size()]);
}
/*
@@ -468,27 +465,27 @@ public class CDebugTarget extends CDebugElement implements ICDebugTarget, ICDIEv
*
* @param name the name of this debug target
*/
- public void setName( String name ) {
+ public void setName(String name) {
fName = name;
}
/* (non-Javadoc)
* @see org.eclipse.debug.core.model.IDebugTarget#supportsBreakpoint(org.eclipse.debug.core.model.IBreakpoint)
*/
- public boolean supportsBreakpoint( IBreakpoint breakpoint ) {
- if ( !getConfiguration().supportsBreakpoints() )
+ public boolean supportsBreakpoint(IBreakpoint breakpoint) {
+ if (!getConfiguration().supportsBreakpoints())
return false;
- return (breakpoint instanceof ICBreakpoint && getBreakpointManager().supportsBreakpoint( (ICBreakpoint)breakpoint ));
+ return (breakpoint instanceof ICBreakpoint && getBreakpointManager().supportsBreakpoint((ICBreakpoint)breakpoint));
}
/* (non-Javadoc)
* @see org.eclipse.debug.core.ILaunchListener#launchRemoved(org.eclipse.debug.core.ILaunch)
*/
- public void launchRemoved( ILaunch launch ) {
- if ( !isAvailable() ) {
+ public void launchRemoved(ILaunch launch) {
+ if (!isAvailable()) {
return;
}
- if ( launch.equals( getLaunch() ) ) {
+ if (launch.equals(getLaunch())) {
// This target has been deregistered, but it hasn't been successfully terminated.
// Update internal state to reflect that it is disconnected
disconnected();
@@ -498,13 +495,13 @@ public class CDebugTarget extends CDebugElement implements ICDebugTarget, ICDIEv
/* (non-Javadoc)
* @see org.eclipse.debug.core.ILaunchListener#launchAdded(org.eclipse.debug.core.ILaunch)
*/
- public void launchAdded( ILaunch launch ) {
+ public void launchAdded(ILaunch launch) {
}
/* (non-Javadoc)
* @see org.eclipse.debug.core.ILaunchListener#launchChanged(org.eclipse.debug.core.ILaunch)
*/
- public void launchChanged( ILaunch launch ) {
+ public void launchChanged(ILaunch launch) {
}
/* (non-Javadoc)
@@ -518,29 +515,28 @@ public class CDebugTarget extends CDebugElement implements ICDebugTarget, ICDIEv
* @see org.eclipse.debug.core.model.ITerminate#isTerminated()
*/
public boolean isTerminated() {
- return ( getState().equals( CDebugElementState.TERMINATED ) );
+ return (getState().equals(CDebugElementState.TERMINATED));
}
/* (non-Javadoc)
* @see org.eclipse.debug.core.model.ITerminate#terminate()
*/
public void terminate() throws DebugException {
- if ( !canTerminate() ) {
+ if (!canTerminate()) {
return;
}
final CDebugElementState newState = CDebugElementState.TERMINATING;
- changeState( newState );
+ changeState(newState);
try {
final ICDITarget cdiTarget = getCDITarget();
if (cdiTarget != null) {
cdiTarget.terminate();
}
- }
- catch( CDIException e ) {
- if ( getState() == newState ) {
+ } catch (CDIException e) {
+ if (getState() == newState) {
restoreOldState();
}
- targetRequestFailed( e.getMessage(), null );
+ targetRequestFailed(e.getMessage(), null);
}
}
@@ -555,13 +551,13 @@ public class CDebugTarget extends CDebugElement implements ICDebugTarget, ICDIEv
* @see org.eclipse.debug.core.model.ISuspendResume#canSuspend()
*/
public boolean canSuspend() {
- if ( !getConfiguration().supportsSuspend() )
+ if (!getConfiguration().supportsSuspend())
return false;
- if ( getState().equals( CDebugElementState.RESUMED ) ) {
+ if (getState().equals(CDebugElementState.RESUMED)) {
// only allow suspend if no threads are currently suspended
IThread[] threads = getThreads();
- for( int i = 0; i < threads.length; i++ ) {
- if ( threads[i].isSuspended() ) {
+ for (int i = 0; i < threads.length; i++) {
+ if (threads[i].isSuspended()) {
return false;
}
}
@@ -574,28 +570,27 @@ public class CDebugTarget extends CDebugElement implements ICDebugTarget, ICDIEv
* @see org.eclipse.debug.core.model.ISuspendResume#isSuspended()
*/
public boolean isSuspended() {
- return ( getState().equals( CDebugElementState.SUSPENDED ) );
+ return (getState().equals(CDebugElementState.SUSPENDED));
}
/* (non-Javadoc)
* @see org.eclipse.debug.core.model.ISuspendResume#resume()
*/
public void resume() throws DebugException {
- if ( !canResume() )
+ if (!canResume())
return;
final CDebugElementState newState = CDebugElementState.RESUMING;
- changeState( newState );
+ changeState(newState);
try {
final ICDITarget cdiTarget = getCDITarget();
if (cdiTarget != null) {
- cdiTarget.resume( false );
+ cdiTarget.resume(false);
}
- }
- catch( CDIException e ) {
- if ( getState() == newState ) {
+ } catch (CDIException e) {
+ if (getState() == newState) {
restoreOldState();
}
- targetRequestFailed( e.getMessage(), null );
+ targetRequestFailed(e.getMessage(), null);
}
}
@@ -603,57 +598,55 @@ public class CDebugTarget extends CDebugElement implements ICDebugTarget, ICDIEv
* @see org.eclipse.debug.core.model.ISuspendResume#suspend()
*/
public void suspend() throws DebugException {
- if ( !canSuspend() )
+ if (!canSuspend())
return;
final CDebugElementState newState = CDebugElementState.SUSPENDING;
- changeState( newState );
+ changeState(newState);
try {
final ICDITarget cdiTarget = getCDITarget();
if (cdiTarget != null) {
cdiTarget.suspend();
}
- }
- catch( CDIException e ) {
- if ( getState() == newState ) {
+ } catch (CDIException e) {
+ if (getState() == newState) {
restoreOldState();
}
- targetRequestFailed( e.getMessage(), null );
+ targetRequestFailed(e.getMessage(), null);
}
}
protected boolean isSuspending() {
- return ( getState().equals( CDebugElementState.SUSPENDING ) );
+ return (getState().equals(CDebugElementState.SUSPENDING));
}
/**
* Notifies threads that the target has been suspended.
*/
- protected void suspendThreads( ICDISuspendedEvent event ) {
- Iterator it = getThreadList().iterator();
- while( it.hasNext() ) {
- CThread thread = (CThread)it.next();
+ protected void suspendThreads(ICDISuspendedEvent event) {
+ Iterator<CThread> it = getThreadList().iterator();
+ while (it.hasNext()) {
+ CThread thread = it.next();
ICDIThread suspensionThread = null;
try {
final ICDITarget cdiTarget = getCDITarget();
if (cdiTarget != null) {
suspensionThread = cdiTarget.getCurrentThread();
}
- }
- catch( CDIException e ) {
+ } catch (CDIException e) {
// ignore
}
- thread.suspendByTarget( event.getReason(), suspensionThread );
+ thread.suspendByTarget(event.getReason(), suspensionThread);
}
}
/**
* Refreshes the thread list.
*/
- protected synchronized List refreshThreads() {
- ArrayList newThreads = new ArrayList( 5 );
- ArrayList list = new ArrayList( 5 );
- ArrayList debugEvents = new ArrayList( 5 );
- List oldList = (List)getThreadList().clone();
+ protected synchronized List<CThread> refreshThreads() {
+ ArrayList<CThread> newThreads = new ArrayList<CThread>(5);
+ ArrayList<CThread> list = new ArrayList<CThread>(5);
+ ArrayList<DebugEvent> debugEvents = new ArrayList<DebugEvent>(5);
+ List<CThread> oldList = (List<CThread>)getThreadList().clone();
ICDIThread[] cdiThreads = new ICDIThread[0];
ICDIThread currentCDIThread = null;
try {
@@ -662,63 +655,62 @@ public class CDebugTarget extends CDebugElement implements ICDebugTarget, ICDIEv
cdiThreads = cdiTarget.getThreads();
currentCDIThread = cdiTarget.getCurrentThread();
}
+ } catch (CDIException e) {
}
- catch( CDIException e ) {
- }
- for( int i = 0; i < cdiThreads.length; ++i ) {
- CThread thread = findThread( oldList, cdiThreads[i] );
- if ( thread == null ) {
- thread = new CThread( this, cdiThreads[i] );
- newThreads.add( thread );
+ for (int i = 0; i < cdiThreads.length; ++i) {
+ CThread thread = findThread(oldList, cdiThreads[i]);
+ if (thread == null) {
+ thread = new CThread(this, cdiThreads[i]);
+ newThreads.add(thread);
}
else {
- oldList.remove( thread );
+ oldList.remove(thread);
}
- thread.setCurrent( cdiThreads[i].equals( currentCDIThread ) );
- list.add( thread );
+ thread.setCurrent(cdiThreads[i].equals(currentCDIThread));
+ list.add(thread);
}
- Iterator it = oldList.iterator();
- while( it.hasNext() ) {
- CThread thread = (CThread)it.next();
+ Iterator<CThread> it = oldList.iterator();
+ while (it.hasNext()) {
+ CThread thread = it.next();
thread.terminated();
- debugEvents.add( thread.createTerminateEvent() );
+ debugEvents.add(thread.createTerminateEvent());
}
- setThreadList( list );
+ setThreadList(list);
it = newThreads.iterator();
- while( it.hasNext() ) {
- debugEvents.add( ((CThread)it.next()).createCreateEvent() );
+ while (it.hasNext()) {
+ debugEvents.add(it.next().createCreateEvent());
}
- if ( debugEvents.size() > 0 )
- fireEventSet( (DebugEvent[])debugEvents.toArray( new DebugEvent[debugEvents.size()] ) );
+ if (debugEvents.size() > 0)
+ fireEventSet(debugEvents.toArray(new DebugEvent[debugEvents.size()]));
return newThreads;
}
/**
* Notifies threads that the target has been resumed.
*/
- protected synchronized void resumeThreads( List debugEvents, int detail ) {
- Iterator it = getThreadList().iterator();
- while( it.hasNext() ) {
- ((CThread)it.next()).resumedByTarget( detail, debugEvents );
+ protected synchronized void resumeThreads(List<DebugEvent> debugEvents, int detail) {
+ Iterator<CThread> it = getThreadList().iterator();
+ while (it.hasNext()) {
+ it.next().resumedByTarget(detail, debugEvents);
}
}
/* (non-Javadoc)
* @see org.eclipse.debug.core.IBreakpointListener#breakpointAdded(org.eclipse.debug.core.model.IBreakpoint)
*/
- public void breakpointAdded( IBreakpoint breakpoint ) {
+ public void breakpointAdded(IBreakpoint breakpoint) {
}
/* (non-Javadoc)
* @see org.eclipse.debug.core.IBreakpointListener#breakpointRemoved(org.eclipse.debug.core.model.IBreakpoint, org.eclipse.core.resources.IMarkerDelta)
*/
- public void breakpointRemoved( IBreakpoint breakpoint, IMarkerDelta delta ) {
+ public void breakpointRemoved(IBreakpoint breakpoint, IMarkerDelta delta) {
}
/* (non-Javadoc)
* @see org.eclipse.debug.core.IBreakpointListener#breakpointChanged(org.eclipse.debug.core.model.IBreakpoint, org.eclipse.core.resources.IMarkerDelta)
*/
- public void breakpointChanged( IBreakpoint breakpoint, IMarkerDelta delta ) {
+ public void breakpointChanged(IBreakpoint breakpoint, IMarkerDelta delta) {
}
/**
@@ -750,22 +742,21 @@ public class CDebugTarget extends CDebugElement implements ICDebugTarget, ICDIEv
* @see org.eclipse.debug.core.model.IDisconnect#disconnect()
*/
public void disconnect() throws DebugException {
- if ( isDisconnecting() ) {
+ if (isDisconnecting()) {
return;
}
final CDebugElementState newState = CDebugElementState.DISCONNECTING;
- changeState( newState );
+ changeState(newState);
try {
final ICDITarget cdiTarget = getCDITarget();
if (cdiTarget != null) {
cdiTarget.disconnect();
}
- }
- catch( CDIException e ) {
- if ( getState() == newState ) {
+ } catch (CDIException e) {
+ if (getState() == newState) {
restoreOldState();
}
- targetRequestFailed( e.getMessage(), null );
+ targetRequestFailed(e.getMessage(), null);
}
}
@@ -773,7 +764,7 @@ public class CDebugTarget extends CDebugElement implements ICDebugTarget, ICDIEv
* @see org.eclipse.debug.core.model.IDisconnect#isDisconnected()
*/
public boolean isDisconnected() {
- return ( getState().equals( CDebugElementState.DISCONNECTED ) );
+ return (getState().equals(CDebugElementState.DISCONNECTED));
}
/* (non-Javadoc)
@@ -786,7 +777,7 @@ public class CDebugTarget extends CDebugElement implements ICDebugTarget, ICDIEv
/* (non-Javadoc)
* @see org.eclipse.debug.core.model.IMemoryBlockRetrieval#getMemoryBlock(long, long)
*/
- public IMemoryBlock getMemoryBlock( long startAddress, long length ) throws DebugException {
+ public IMemoryBlock getMemoryBlock(long startAddress, long length) throws DebugException {
return null;
}
@@ -803,7 +794,7 @@ public class CDebugTarget extends CDebugElement implements ICDebugTarget, ICDIEv
*
* @param launch the launch this target is contained in
*/
- private void setLaunch( ILaunch launch ) {
+ private void setLaunch(ILaunch launch) {
fLaunch = launch;
}
@@ -812,7 +803,7 @@ public class CDebugTarget extends CDebugElement implements ICDebugTarget, ICDIEv
*
* @return list of threads
*/
- protected ArrayList getThreadList() {
+ protected ArrayList<CThread> getThreadList() {
return fThreads;
}
@@ -822,11 +813,11 @@ public class CDebugTarget extends CDebugElement implements ICDebugTarget, ICDIEv
*
* @param threads empty list
*/
- private void setThreadList( ArrayList threads ) {
+ private void setThreadList(ArrayList<CThread> threads) {
fThreads = threads;
}
- private void setCDITarget( ICDITarget cdiTarget ) {
+ private void setCDITarget(ICDITarget cdiTarget) {
fCDITarget = cdiTarget;
}
@@ -834,109 +825,109 @@ public class CDebugTarget extends CDebugElement implements ICDebugTarget, ICDIEv
* @see org.eclipse.core.runtime.IAdaptable#getAdapter(java.lang.Class)
*/
@Override
- public Object getAdapter( Class adapter ) {
- if ( adapter.equals( ICDebugElement.class ) )
+ public Object getAdapter(@SuppressWarnings("rawtypes") Class adapter) {
+ if (adapter.equals(ICDebugElement.class))
return this;
- if ( adapter.equals( CDebugElement.class ) )
+ if (adapter.equals(CDebugElement.class))
return this;
- if ( adapter.equals( IDebugTarget.class ) )
+ if (adapter.equals(IDebugTarget.class))
return this;
- if ( adapter.equals( ICDebugTarget.class ) )
+ if (adapter.equals(ICDebugTarget.class))
return this;
- if ( adapter.equals( CDebugTarget.class ) )
+ if (adapter.equals(CDebugTarget.class))
return this;
- if ( adapter.equals( ICDITarget.class ) )
+ if (adapter.equals(ICDITarget.class))
return fCDITarget;
- if ( adapter.equals( IDebuggerProcessSupport.class ) )
+ if (adapter.equals(IDebuggerProcessSupport.class))
return this;
- if ( adapter.equals( IExecFileInfo.class ) )
+ if (adapter.equals(IExecFileInfo.class))
return this;
- if ( adapter.equals( CBreakpointManager.class ) )
+ if (adapter.equals(CBreakpointManager.class))
return getBreakpointManager();
- if ( adapter.equals( CSignalManager.class ) )
+ if (adapter.equals(CSignalManager.class))
return getSignalManager();
- if ( adapter.equals( CRegisterManager.class ) )
+ if (adapter.equals(CRegisterManager.class))
return getRegisterManager();
- if ( adapter.equals( ICGlobalVariableManager.class ) )
+ if (adapter.equals(ICGlobalVariableManager.class))
return getGlobalVariableManager();
- if ( adapter.equals( ICDISession.class ) )
+ if (adapter.equals(ICDISession.class))
return getCDISession();
- if ( adapter.equals( IMemoryBlockRetrievalExtension.class ) )
+ if (adapter.equals(IMemoryBlockRetrievalExtension.class))
return getMemoryBlockRetrieval();
- if ( adapter.equals( IMemoryBlockRetrieval.class ) )
+ if (adapter.equals(IMemoryBlockRetrieval.class))
return getMemoryBlockRetrieval();
- if ( adapter.equals( IModuleRetrieval.class ) )
+ if (adapter.equals(IModuleRetrieval.class))
return getModuleManager();
// Force adapters to be loaded. Otherwise the adapter manager may not find
// the model proxy adapter for CDT debug elements.
Platform.getAdapterManager().loadAdapter(this, adapter.getName());
- return super.getAdapter( adapter );
+ return super.getAdapter(adapter);
}
/* (non-Javadoc)
* @see org.eclipse.cdt.debug.core.cdi.event.ICDIEventListener#handleDebugEvents(org.eclipse.cdt.debug.core.cdi.event.ICDIEvent[])
*/
- public void handleDebugEvents( ICDIEvent[] events ) {
- for( int i = 0; i < events.length; i++ ) {
+ public void handleDebugEvents(ICDIEvent[] events) {
+ for (int i = 0; i < events.length; i++) {
ICDIEvent event = events[i];
ICDIObject source = event.getSource();
final ICDITarget cdiTarget = getCDITarget();
- if ( source == null && event instanceof ICDIDestroyedEvent ) {
- handleTerminatedEvent( (ICDIDestroyedEvent)event );
+ if (source == null && event instanceof ICDIDestroyedEvent) {
+ handleTerminatedEvent((ICDIDestroyedEvent)event);
}
- else if ( source != null && cdiTarget != null && source.getTarget().equals( cdiTarget ) ) {
- if ( event instanceof ICDICreatedEvent ) {
- if ( source instanceof ICDIThread ) {
- handleThreadCreatedEvent( (ICDICreatedEvent)event );
+ else if (source != null && cdiTarget != null && source.getTarget().equals(cdiTarget)) {
+ if (event instanceof ICDICreatedEvent) {
+ if (source instanceof ICDIThread) {
+ handleThreadCreatedEvent((ICDICreatedEvent)event);
}
- if ( source instanceof ICDISharedLibrary ) {
- getModuleManager().sharedLibraryLoaded( (ICDISharedLibrary)source );
+ if (source instanceof ICDISharedLibrary) {
+ getModuleManager().sharedLibraryLoaded((ICDISharedLibrary)source);
}
}
- else if ( event instanceof ICDISuspendedEvent ) {
- if ( source instanceof ICDITarget ) {
- handleSuspendedEvent( (ICDISuspendedEvent)event );
+ else if (event instanceof ICDISuspendedEvent) {
+ if (source instanceof ICDITarget) {
+ handleSuspendedEvent((ICDISuspendedEvent)event);
}
}
- else if ( event instanceof ICDIResumedEvent ) {
- if ( source instanceof ICDITarget ) {
- handleResumedEvent( (ICDIResumedEvent)event );
+ else if (event instanceof ICDIResumedEvent) {
+ if (source instanceof ICDITarget) {
+ handleResumedEvent((ICDIResumedEvent)event);
}
}
- else if ( event instanceof ICDIExitedEvent ) {
- if ( source instanceof ICDITarget ) {
- handleExitedEvent( (ICDIExitedEvent)event );
+ else if (event instanceof ICDIExitedEvent) {
+ if (source instanceof ICDITarget) {
+ handleExitedEvent((ICDIExitedEvent)event);
}
}
- else if ( event instanceof ICDIDestroyedEvent ) {
- if ( source instanceof ICDIThread ) {
- handleThreadTerminatedEvent( (ICDIDestroyedEvent)event );
+ else if (event instanceof ICDIDestroyedEvent) {
+ if (source instanceof ICDIThread) {
+ handleThreadTerminatedEvent((ICDIDestroyedEvent)event);
}
- if ( source instanceof ICDISharedLibrary ) {
- getModuleManager().sharedLibraryUnloaded( (ICDISharedLibrary)source );
+ if (source instanceof ICDISharedLibrary) {
+ getModuleManager().sharedLibraryUnloaded((ICDISharedLibrary)source);
}
}
- else if ( event instanceof ICDIDisconnectedEvent ) {
- if ( source instanceof ICDITarget ) {
- handleDisconnectedEvent( (ICDIDisconnectedEvent)event );
+ else if (event instanceof ICDIDisconnectedEvent) {
+ if (source instanceof ICDITarget) {
+ handleDisconnectedEvent((ICDIDisconnectedEvent)event);
}
}
- else if ( event instanceof ICDIChangedEvent ) {
- if ( source instanceof ICDITarget ) {
- handleChangedEvent( (ICDIChangedEvent)event );
+ else if (event instanceof ICDIChangedEvent) {
+ if (source instanceof ICDITarget) {
+ handleChangedEvent((ICDIChangedEvent)event);
}
- if ( source instanceof ICDISharedLibrary ) {
- handleSymbolsLoaded( (ICDISharedLibrary)source );
+ if (source instanceof ICDISharedLibrary) {
+ handleSymbolsLoaded((ICDISharedLibrary)source);
}
- if ( source instanceof ICDISignal ) {
- getSignalManager().signalChanged( (ICDISignal)source );
+ if (source instanceof ICDISignal) {
+ getSignalManager().signalChanged((ICDISignal)source);
}
}
- else if ( event instanceof ICDIRestartedEvent ) {
- if ( source instanceof ICDITarget ) {
- handleRestartedEvent( (ICDIRestartedEvent)event );
+ else if (event instanceof ICDIRestartedEvent) {
+ if (source instanceof ICDITarget) {
+ handleRestartedEvent((ICDIRestartedEvent)event);
}
}
}
@@ -954,7 +945,7 @@ public class CDebugTarget extends CDebugElement implements ICDebugTarget, ICDIEv
* @see org.eclipse.cdt.debug.core.model.IRestart#restart()
*/
public void restart() throws DebugException {
- if ( !canRestart() ) {
+ if (!canRestart()) {
return;
}
final ICDITarget cdiTarget = getCDITarget();
@@ -964,35 +955,33 @@ public class CDebugTarget extends CDebugElement implements ICDebugTarget, ICDIEv
try {
ILaunchConfiguration launchConfig = getLaunch().getLaunchConfiguration();
- if ( launchConfig.getAttribute( ICDTLaunchConfigurationConstants.ATTR_DEBUGGER_STOP_AT_MAIN, ICDTLaunchConfigurationConstants.DEBUGGER_STOP_AT_MAIN_DEFAULT ) ) {
- String mainSymbol = launchConfig.getAttribute( ICDTLaunchConfigurationConstants.ATTR_DEBUGGER_STOP_AT_MAIN_SYMBOL, ICDTLaunchConfigurationConstants.DEBUGGER_STOP_AT_MAIN_SYMBOL_DEFAULT );
+ if (launchConfig.getAttribute(ICDTLaunchConfigurationConstants.ATTR_DEBUGGER_STOP_AT_MAIN, ICDTLaunchConfigurationConstants.DEBUGGER_STOP_AT_MAIN_DEFAULT)) {
+ String mainSymbol = launchConfig.getAttribute(ICDTLaunchConfigurationConstants.ATTR_DEBUGGER_STOP_AT_MAIN_SYMBOL, ICDTLaunchConfigurationConstants.DEBUGGER_STOP_AT_MAIN_SYMBOL_DEFAULT);
ICDILocation location = null;
// See if the expression is a numeric address
try {
IAddress address = getAddressFactory().createAddress(mainSymbol);
- location = cdiTarget.createAddressLocation( address.getValue() );
+ location = cdiTarget.createAddressLocation(address.getValue());
} catch (NumberFormatException nfexc) {
// OK, expression is not a simple, absolute numeric value; keep trucking and try to resolve as expression
- location = cdiTarget.createFunctionLocation( "", mainSymbol ); //$NON-NLS-1$
+ location = cdiTarget.createFunctionLocation("", mainSymbol); //$NON-NLS-1$
}
- setInternalTemporaryBreakpoint( location );
+ setInternalTemporaryBreakpoint(location);
}
- }
- catch( CoreException e ) {
- requestFailed( e.getMessage(), e );
+ } catch (CoreException e) {
+ requestFailed(e.getMessage(), e);
}
final CDebugElementState newState = CDebugElementState.RESTARTING;
- changeState( newState );
+ changeState(newState);
try {
cdiTarget.restart();
- }
- catch( CDIException e ) {
- if ( getState() == newState ) {
+ } catch (CDIException e) {
+ if (getState() == newState) {
restoreOldState();
}
- targetRequestFailed( e.getMessage(), e );
+ targetRequestFailed(e.getMessage(), e);
}
}
@@ -1011,16 +1000,16 @@ public class CDebugTarget extends CDebugElement implements ICDebugTarget, ICDIEv
* @return whether this target is terminating
*/
protected boolean isTerminating() {
- return ( getState().equals( CDebugElementState.TERMINATING ) );
+ return (getState().equals(CDebugElementState.TERMINATING));
}
/**
* Updates the state of this target to be terminated, if not already terminated.
*/
protected void terminated() {
- if ( !isTerminated() ) {
- if ( !isDisconnected() ) {
- setState( CDebugElementState.TERMINATED );
+ if (!isTerminated()) {
+ if (!isDisconnected()) {
+ setState(CDebugElementState.TERMINATED);
}
cleanup();
fireTerminateEvent();
@@ -1033,15 +1022,15 @@ public class CDebugTarget extends CDebugElement implements ICDebugTarget, ICDIEv
* @return whether this target is terminating
*/
protected boolean isDisconnecting() {
- return ( getState().equals( CDebugElementState.DISCONNECTING ) );
+ return (getState().equals(CDebugElementState.DISCONNECTING));
}
/**
* Updates the state of this target for disconnection.
*/
protected void disconnected() {
- if ( !isDisconnected() ) {
- setState( CDebugElementState.DISCONNECTED );
+ if (!isDisconnected()) {
+ setState(CDebugElementState.DISCONNECTED);
cleanup();
fireTerminateEvent();
}
@@ -1053,9 +1042,9 @@ public class CDebugTarget extends CDebugElement implements ICDebugTarget, ICDIEv
protected void cleanup() {
resetStatus();
removeAllThreads();
- getCDISession().getEventManager().removeEventListener( this );
- DebugPlugin.getDefault().getExpressionManager().removeExpressionListener( this );
- DebugPlugin.getDefault().getLaunchManager().removeLaunchListener( this );
+ getCDISession().getEventManager().removeEventListener(this);
+ DebugPlugin.getDefault().getExpressionManager().removeExpressionListener(this);
+ DebugPlugin.getDefault().getLaunchManager().removeLaunchListener(this);
saveFormats();
saveGlobalVariables();
disposeGlobalVariableManager();
@@ -1087,16 +1076,16 @@ public class CDebugTarget extends CDebugElement implements ICDebugTarget, ICDIEv
* Removes all threads from this target's collection of threads, firing a terminate event for each.
*/
protected void removeAllThreads() {
- List threads = getThreadList();
- setThreadList( new ArrayList( 0 ) );
- ArrayList debugEvents = new ArrayList( threads.size() );
- Iterator it = threads.iterator();
- while( it.hasNext() ) {
- CThread thread = (CThread)it.next();
+ List<CThread> threads = getThreadList();
+ setThreadList(new ArrayList<CThread>(0));
+ ArrayList<DebugEvent> debugEvents = new ArrayList<DebugEvent>(threads.size());
+ Iterator<CThread> it = threads.iterator();
+ while (it.hasNext()) {
+ CThread thread = it.next();
thread.terminated();
- debugEvents.add( thread.createTerminateEvent() );
+ debugEvents.add(thread.createTerminateEvent());
}
- fireEventSet( (DebugEvent[])debugEvents.toArray( new DebugEvent[debugEvents.size()] ) );
+ fireEventSet(debugEvents.toArray(new DebugEvent[debugEvents.size()]));
}
/**
@@ -1105,9 +1094,9 @@ public class CDebugTarget extends CDebugElement implements ICDebugTarget, ICDIEv
protected void removeAllExpressions() {
IExpressionManager em = DebugPlugin.getDefault().getExpressionManager();
IExpression[] expressions = em.getExpressions();
- for( int i = 0; i < expressions.length; ++i ) {
- if ( expressions[i] instanceof CExpression && expressions[i].getDebugTarget().equals( this ) ) {
- em.removeExpression( expressions[i] );
+ for (int i = 0; i < expressions.length; ++i) {
+ if (expressions[i] instanceof CExpression && expressions[i].getDebugTarget().equals(this)) {
+ em.removeExpression(expressions[i]);
}
}
}
@@ -1119,69 +1108,68 @@ public class CDebugTarget extends CDebugElement implements ICDebugTarget, ICDIEv
* @param thread the underlying CDI thread
* @return model thread
*/
- protected CThread createThread( ICDIThread cdiThread ) {
- CThread thread = new CThread( this, cdiThread );
- getThreadList().add( thread );
+ protected CThread createThread(ICDIThread cdiThread) {
+ CThread thread = new CThread(this, cdiThread);
+ getThreadList().add(thread);
return thread;
}
- private void handleSuspendedEvent( ICDISuspendedEvent event ) {
- setState( CDebugElementState.SUSPENDED );
+ private void handleSuspendedEvent(ICDISuspendedEvent event) {
+ setState(CDebugElementState.SUSPENDED);
ICDISessionObject reason = event.getReason();
- setCurrentStateInfo( reason );
+ setCurrentStateInfo(reason);
// Reset the registers that have errors.
getRegisterManager().targetSuspended();
- getBreakpointManager().skipBreakpoints( false );
- List newThreads = refreshThreads();
+ getBreakpointManager().skipBreakpoints(false);
+ List<CThread> newThreads = refreshThreads();
if (event.getSource() instanceof ICDITarget) {
if (!(this.getConfiguration() instanceof ICDITargetConfiguration2) || !((ICDITargetConfiguration2)this.getConfiguration()).supportsThreadControl())
suspendThreads(event);
- }
- // We need this for debuggers that don't have notifications
- // for newly created threads.
- else if ( event.getSource() instanceof ICDIThread ) {
- CThread thread = findThread( (ICDIThread)event.getSource() );
- if ( thread != null && newThreads.contains( thread ) ) {
+ } else if (event.getSource() instanceof ICDIThread) {
+ // We need this for debuggers that don't have notifications
+ // for newly created threads.
+ CThread thread = findThread((ICDIThread)event.getSource());
+ if (thread != null && newThreads.contains(thread)) {
ICDIEvent[] evts = new ICDIEvent[]{ event };
- thread.handleDebugEvents( evts );
+ thread.handleDebugEvents(evts);
}
}
- if ( reason instanceof ICDIEndSteppingRange ) {
- handleEndSteppingRange( (ICDIEndSteppingRange)reason );
+ if (reason instanceof ICDIEndSteppingRange) {
+ handleEndSteppingRange((ICDIEndSteppingRange)reason);
}
- else if ( reason instanceof ICDIBreakpointHit ) {
- handleBreakpointHit( (ICDIBreakpointHit)reason );
+ else if (reason instanceof ICDIBreakpointHit) {
+ handleBreakpointHit((ICDIBreakpointHit)reason);
}
- else if ( reason instanceof ICDISignalReceived ) {
- handleSuspendedBySignal( (ICDISignalReceived)reason );
+ else if (reason instanceof ICDISignalReceived) {
+ handleSuspendedBySignal((ICDISignalReceived)reason);
}
- else if ( reason instanceof ICDIWatchpointTrigger ) {
- handleWatchpointTrigger( (ICDIWatchpointTrigger)reason );
+ else if (reason instanceof ICDIWatchpointTrigger) {
+ handleWatchpointTrigger((ICDIWatchpointTrigger)reason);
}
- else if ( reason instanceof ICDIWatchpointScope ) {
- handleWatchpointScope( (ICDIWatchpointScope)reason );
+ else if (reason instanceof ICDIWatchpointScope) {
+ handleWatchpointScope((ICDIWatchpointScope)reason);
}
- else if ( reason instanceof ICDIErrorInfo ) {
- handleErrorInfo( (ICDIErrorInfo)reason );
+ else if (reason instanceof ICDIErrorInfo) {
+ handleErrorInfo((ICDIErrorInfo)reason);
}
- else if ( reason instanceof ICDISharedLibraryEvent ) {
- handleSuspendedBySolibEvent( (ICDISharedLibraryEvent)reason );
+ else if (reason instanceof ICDISharedLibraryEvent) {
+ handleSuspendedBySolibEvent((ICDISharedLibraryEvent)reason);
}
- else if ( reason instanceof ICDIEventBreakpointHit ) {
- handleEventBreakpointHit( (ICDIEventBreakpointHit)reason );
+ else if (reason instanceof ICDIEventBreakpointHit) {
+ handleEventBreakpointHit((ICDIEventBreakpointHit)reason);
}
else { // reason is not specified
- fireSuspendEvent( DebugEvent.UNSPECIFIED );
+ fireSuspendEvent(DebugEvent.UNSPECIFIED);
}
}
- private void handleResumedEvent( ICDIResumedEvent event ) {
- setState( CDebugElementState.RESUMED );
- setCurrentStateInfo( null );
+ private void handleResumedEvent(ICDIResumedEvent event) {
+ setState(CDebugElementState.RESUMED);
+ setCurrentStateInfo(null);
resetStatus();
- ArrayList debugEvents = new ArrayList( 10 );
+ ArrayList<DebugEvent> debugEvents = new ArrayList<DebugEvent>(10);
int detail = DebugEvent.UNSPECIFIED;
- switch( event.getType() ) {
+ switch(event.getType()) {
case ICDIResumedEvent.CONTINUE:
detail = DebugEvent.CLIENT_REQUEST;
break;
@@ -1197,100 +1185,100 @@ public class CDebugTarget extends CDebugElement implements ICDebugTarget, ICDIEv
detail = DebugEvent.STEP_RETURN;
break;
}
- debugEvents.add( createResumeEvent( detail ) );
+ debugEvents.add(createResumeEvent(detail));
if (!(this.getConfiguration() instanceof ICDITargetConfiguration2) || !((ICDITargetConfiguration2)this.getConfiguration()).supportsThreadControl())
- resumeThreads( debugEvents, detail );
+ resumeThreads(debugEvents, detail);
- fireEventSet( (DebugEvent[])debugEvents.toArray( new DebugEvent[debugEvents.size()] ) );
+ fireEventSet(debugEvents.toArray(new DebugEvent[debugEvents.size()]));
}
- private void handleEndSteppingRange( ICDIEndSteppingRange endSteppingRange ) {
- fireSuspendEvent( DebugEvent.UNSPECIFIED );
+ private void handleEndSteppingRange(ICDIEndSteppingRange endSteppingRange) {
+ fireSuspendEvent(DebugEvent.UNSPECIFIED);
}
- private void handleBreakpointHit( ICDIBreakpointHit breakpointHit ) {
- fireSuspendEvent( DebugEvent.BREAKPOINT );
+ private void handleBreakpointHit(ICDIBreakpointHit breakpointHit) {
+ fireSuspendEvent(DebugEvent.BREAKPOINT);
}
- private void handleEventBreakpointHit( ICDIEventBreakpointHit breakpointHit ) {
- fireSuspendEvent( DebugEvent.BREAKPOINT );
+ private void handleEventBreakpointHit(ICDIEventBreakpointHit breakpointHit) {
+ fireSuspendEvent(DebugEvent.BREAKPOINT);
}
- private void handleWatchpointTrigger( ICDIWatchpointTrigger wt ) {
- fireSuspendEvent( DebugEvent.BREAKPOINT );
+ private void handleWatchpointTrigger(ICDIWatchpointTrigger wt) {
+ fireSuspendEvent(DebugEvent.BREAKPOINT);
}
- private void handleWatchpointScope( ICDIWatchpointScope ws ) {
- getBreakpointManager().watchpointOutOfScope( ws.getWatchpoint() );
- fireSuspendEvent( DebugEvent.BREAKPOINT );
+ private void handleWatchpointScope(ICDIWatchpointScope ws) {
+ getBreakpointManager().watchpointOutOfScope(ws.getWatchpoint());
+ fireSuspendEvent(DebugEvent.BREAKPOINT);
}
- private void handleSuspendedBySignal( ICDISignalReceived signal ) {
- fireSuspendEvent( DebugEvent.CLIENT_REQUEST );
+ private void handleSuspendedBySignal(ICDISignalReceived signal) {
+ fireSuspendEvent(DebugEvent.CLIENT_REQUEST);
}
- private void handleErrorInfo( ICDIErrorInfo info ) {
- setStatus( ICDebugElementStatus.ERROR, (info != null) ? info.getMessage() : null );
- if ( info != null ) {
- MultiStatus status = new MultiStatus( CDebugCorePlugin.getUniqueIdentifier(), ICDebugInternalConstants.STATUS_CODE_ERROR, CoreModelMessages.getString( "CDebugTarget.1" ), //$NON-NLS-1$
- null );
- StringTokenizer st = new StringTokenizer( info.getDetailMessage(), "\n\r" ); //$NON-NLS-1$
- while( st.hasMoreTokens() ) {
+ private void handleErrorInfo(ICDIErrorInfo info) {
+ setStatus(ICDebugElementStatus.ERROR, (info != null) ? info.getMessage() : null);
+ if (info != null) {
+ MultiStatus status = new MultiStatus(CDebugCorePlugin.getUniqueIdentifier(), ICDebugInternalConstants.STATUS_CODE_ERROR, CoreModelMessages.getString("CDebugTarget.1"), //$NON-NLS-1$
+ null);
+ StringTokenizer st = new StringTokenizer(info.getDetailMessage(), "\n\r"); //$NON-NLS-1$
+ while (st.hasMoreTokens()) {
String token = st.nextToken();
- if ( token.length() > 200 ) {
- token = token.substring( 0, 200 );
+ if (token.length() > 200) {
+ token = token.substring(0, 200);
}
- status.add( new Status( IStatus.ERROR, status.getPlugin(), ICDebugInternalConstants.STATUS_CODE_ERROR, token, null ) );
+ status.add(new Status(IStatus.ERROR, status.getPlugin(), ICDebugInternalConstants.STATUS_CODE_ERROR, token, null));
}
- CDebugUtils.error( status, this );
+ CDebugUtils.error(status, this);
}
- fireSuspendEvent( DebugEvent.UNSPECIFIED );
+ fireSuspendEvent(DebugEvent.UNSPECIFIED);
}
- private void handleSuspendedBySolibEvent( ICDISharedLibraryEvent solibEvent ) {
- fireSuspendEvent( DebugEvent.UNSPECIFIED );
+ private void handleSuspendedBySolibEvent(ICDISharedLibraryEvent solibEvent) {
+ fireSuspendEvent(DebugEvent.UNSPECIFIED);
}
- private void handleExitedEvent( ICDIExitedEvent event ) {
+ private void handleExitedEvent(ICDIExitedEvent event) {
removeAllThreads();
- setState( CDebugElementState.EXITED );
- setCurrentStateInfo( event.getReason() );
- fireChangeEvent( DebugEvent.CONTENT );
+ setState(CDebugElementState.EXITED);
+ setCurrentStateInfo(event.getReason());
+ fireChangeEvent(DebugEvent.CONTENT);
ICDISessionConfiguration sessionConfig = getCDISession().getConfiguration();
- if ( sessionConfig != null && sessionConfig.terminateSessionOnExit() )
+ if (sessionConfig != null && sessionConfig.terminateSessionOnExit())
terminated();
}
- private void handleTerminatedEvent( ICDIDestroyedEvent event ) {
+ private void handleTerminatedEvent(ICDIDestroyedEvent event) {
terminated();
}
- private void handleDisconnectedEvent( ICDIDisconnectedEvent event ) {
+ private void handleDisconnectedEvent(ICDIDisconnectedEvent event) {
disconnected();
}
- private void handleChangedEvent( ICDIChangedEvent event ) {
+ private void handleChangedEvent(ICDIChangedEvent event) {
}
- private void handleRestartedEvent( ICDIRestartedEvent event ) {
+ private void handleRestartedEvent(ICDIRestartedEvent event) {
}
- private void handleThreadCreatedEvent( ICDICreatedEvent event ) {
+ private void handleThreadCreatedEvent(ICDICreatedEvent event) {
ICDIThread cdiThread = (ICDIThread)event.getSource();
- CThread thread = findThread( cdiThread );
- if ( thread == null ) {
- thread = createThread( cdiThread );
+ CThread thread = findThread(cdiThread);
+ if (thread == null) {
+ thread = createThread(cdiThread);
thread.fireCreationEvent();
}
}
- private void handleThreadTerminatedEvent( ICDIDestroyedEvent event ) {
+ private void handleThreadTerminatedEvent(ICDIDestroyedEvent event) {
ICDIThread cdiThread = (ICDIThread)event.getSource();
- List threads = getThreadList();
+ List<CThread> threads = getThreadList();
List<CThread> threadsToRemove = new ArrayList<CThread>(1);
- for(int i = 0; i < threads.size(); i++) {
- CThread cthread = (CThread)threads.get(i);
+ for (int i = 0; i < threads.size(); i++) {
+ CThread cthread = threads.get(i);
// It's possible CThread has handled the thread-terminated event
// before us (by appearing first in the EventManager)
// and has disassociated itself from the ICDIThread.
@@ -1315,15 +1303,15 @@ public class CDebugTarget extends CDebugElement implements ICDebugTarget, ICDIEv
* @param the underlying CDI thread
* @return the associated model thread
*/
- public CThread findThread( ICDIThread cdiThread ) {
+ public CThread findThread(ICDIThread cdiThread) {
return findThread(getThreadList(), cdiThread);
}
- public CThread findThread( List threads, ICDIThread cdiThread ) {
- for( int i = 0; i < threads.size(); i++ ) {
- CThread t = (CThread)threads.get( i );
+ public CThread findThread(List<CThread> threads, ICDIThread cdiThread) {
+ for (int i = 0; i < threads.size(); i++) {
+ CThread t = threads.get(i);
ICDIThread thisCdiThread = t.getCDIThread();
- if ( thisCdiThread != null && thisCdiThread.equals( cdiThread ) )
+ if (thisCdiThread != null && thisCdiThread.equals(cdiThread))
return t;
}
return null;
@@ -1343,7 +1331,7 @@ public class CDebugTarget extends CDebugElement implements ICDebugTarget, ICDIEv
*
* @param config the debug configuration to set
*/
- private void setConfiguration( ICDITargetConfiguration config ) {
+ private void setConfiguration(ICDITargetConfiguration config) {
fConfig = config;
}
@@ -1354,50 +1342,49 @@ public class CDebugTarget extends CDebugElement implements ICDebugTarget, ICDIEv
/* (non-Javadoc)
* @see org.eclipse.debug.core.IExpressionListener#expressionAdded(org.eclipse.debug.core.model.IExpression)
*/
- public void expressionAdded( IExpression expression ) {
+ public void expressionAdded(IExpression expression) {
}
/* (non-Javadoc)
* @see org.eclipse.debug.core.IExpressionListener#expressionChanged(org.eclipse.debug.core.model.IExpression)
*/
- public void expressionChanged( IExpression expression ) {
+ public void expressionChanged(IExpression expression) {
}
/* (non-Javadoc)
* @see org.eclipse.debug.core.IExpressionListener#expressionRemoved(org.eclipse.debug.core.model.IExpression)
*/
- public void expressionRemoved( IExpression expression ) {
- if ( expression instanceof CExpression && expression.getDebugTarget().equals( this ) ) {
+ public void expressionRemoved(IExpression expression) {
+ if (expression instanceof CExpression && expression.getDebugTarget().equals(this)) {
((CExpression)expression).dispose();
}
}
- public void setInternalTemporaryBreakpoint( ICDILocation location ) throws DebugException {
+ public void setInternalTemporaryBreakpoint(ICDILocation location) throws DebugException {
try {
final ICDITarget cdiTarget = getCDITarget();
if (cdiTarget == null) {
return;
}
if (location instanceof ICDIFunctionLocation) {
- cdiTarget.setFunctionBreakpoint( ICBreakpointType.TEMPORARY, (ICDIFunctionLocation)location, null, false );
+ cdiTarget.setFunctionBreakpoint(ICBreakpointType.TEMPORARY, (ICDIFunctionLocation)location, null, false);
} else if (location instanceof ICDILineLocation) {
- cdiTarget.setLineBreakpoint( ICBreakpointType.TEMPORARY, (ICDILineLocation)location, null, false );
+ cdiTarget.setLineBreakpoint(ICBreakpointType.TEMPORARY, (ICDILineLocation)location, null, false);
} else if (location instanceof ICDIAddressLocation) {
- cdiTarget.setAddressBreakpoint( ICBreakpointType.TEMPORARY, (ICDIAddressLocation)location, null, false );
+ cdiTarget.setAddressBreakpoint(ICBreakpointType.TEMPORARY, (ICDIAddressLocation)location, null, false);
} else {
// ???
targetRequestFailed("not_a_location", null); //$NON-NLS-1$
}
- }
- catch( CDIException e ) {
- targetRequestFailed( e.getMessage(), null );
+ } catch (CDIException e) {
+ targetRequestFailed(e.getMessage(), null);
}
}
protected IThread getCurrentThread() {
IThread[] threads = getThreads();
- for( int i = 0; i < threads.length; ++i ) {
- if ( ((CThread)threads[i]).isCurrent() )
+ for (int i = 0; i < threads.length; ++i) {
+ if (((CThread)threads[i]).isCurrent())
return threads[i];
}
return null;
@@ -1411,17 +1398,16 @@ public class CDebugTarget extends CDebugElement implements ICDebugTarget, ICDIEv
* @see org.eclipse.cdt.debug.core.model.IExecFileInfo#isLittleEndian()
*/
public boolean isLittleEndian() {
- if ( fIsLittleEndian == null ) {
+ if (fIsLittleEndian == null) {
fIsLittleEndian = Boolean.TRUE;
IBinaryObject file;
file = getBinaryFile();
- if ( file != null ) {
- fIsLittleEndian = Boolean.valueOf( file.isLittleEndian() );
+ if (file != null) {
+ fIsLittleEndian = Boolean.valueOf(file.isLittleEndian());
}
}
return fIsLittleEndian.booleanValue();
}
-
/* (non-Javadoc)
* @see org.eclipse.cdt.debug.core.model.IExecFileInfo#getExecFile()
@@ -1434,7 +1420,7 @@ public class CDebugTarget extends CDebugElement implements ICDebugTarget, ICDIEv
return fBinaryFile;
}
- private void setExecFile( IBinaryObject file ) {
+ private void setExecFile(IBinaryObject file) {
fBinaryFile = file;
}
@@ -1454,42 +1440,39 @@ public class CDebugTarget extends CDebugElement implements ICDebugTarget, ICDIEv
IGlobalVariableDescriptor[] globals = new IGlobalVariableDescriptor[0];
// If the backend can give us the globals...
boolean hasCDIGlobals = false;
- ArrayList list = new ArrayList();
- if (cdiTarget instanceof ICDITarget2)
- {
+ ArrayList<IGlobalVariableDescriptor> list = new ArrayList<IGlobalVariableDescriptor>();
+ if (cdiTarget instanceof ICDITarget2) {
ICDIGlobalVariableDescriptor[] cdiGlobals = ((ICDITarget2) cdiTarget).getGlobalVariables();
hasCDIGlobals = cdiGlobals != null;
- if (hasCDIGlobals)
- {
+ if (hasCDIGlobals) {
for (int i = 0; i < cdiGlobals.length; i++) {
list.add(CVariableFactory.createGlobalVariableDescriptor(cdiGlobals[i].getName(), null));
}
}
}
// otherwise ask the binary
- if (!hasCDIGlobals)
- {
+ if (!hasCDIGlobals) {
IBinaryObject file = getBinaryFile();
if (file != null) {
- list.addAll( getCFileGlobals( file ) );
+ list.addAll(getCFileGlobals(file));
}
}
- globals = (IGlobalVariableDescriptor[])list.toArray( new IGlobalVariableDescriptor[list.size()] );
+ globals = list.toArray(new IGlobalVariableDescriptor[list.size()]);
return globals;
}
- private List getCFileGlobals( IBinaryObject file ) {
- ArrayList list = new ArrayList();
+ private List<IGlobalVariableDescriptor> getCFileGlobals(IBinaryObject file) {
+ ArrayList<IGlobalVariableDescriptor> list = new ArrayList<IGlobalVariableDescriptor>();
ISymbol[] symbols = file.getSymbols();
- for( int i = 0; i < symbols.length; ++i ) {
+ for (int i = 0; i < symbols.length; ++i) {
if (symbols[i].getType() == ISymbol.VARIABLE) {
- list.add( CVariableFactory.createGlobalVariableDescriptor( symbols[i] ) );
+ list.add(CVariableFactory.createGlobalVariableDescriptor(symbols[i]));
}
}
return list;
}
- protected void setModuleManager( CModuleManager mm ) {
+ protected void setModuleManager(CModuleManager mm) {
fModuleManager = mm;
}
@@ -1502,7 +1485,7 @@ public class CDebugTarget extends CDebugElement implements ICDebugTarget, ICDIEv
fModuleManager = null;
}
- protected void setSignalManager( CSignalManager sm ) {
+ protected void setSignalManager(CSignalManager sm) {
fSignalManager = sm;
}
@@ -1539,28 +1522,27 @@ public class CDebugTarget extends CDebugElement implements ICDebugTarget, ICDIEv
*/
public boolean canResumeWithoutSignal() {
// Check if the configuration supports this!!!
- return ( canResume() && getCurrentStateInfo() instanceof ICDISignalReceived );
+ return (canResume() && getCurrentStateInfo() instanceof ICDISignalReceived);
}
/* (non-Javadoc)
* @see org.eclipse.cdt.debug.core.model.IResumeWithoutSignal#resumeWithoutSignal()
*/
public void resumeWithoutSignal() throws DebugException {
- if ( !canResume() )
+ if (!canResume())
return;
final CDebugElementState newState = CDebugElementState.RESUMING;
- changeState( newState );
+ changeState(newState);
try {
final ICDITarget cdiTarget = getCDITarget();
if (cdiTarget != null) {
- cdiTarget.resume( false );
+ cdiTarget.resume(false);
}
- }
- catch( CDIException e ) {
- if ( getState() == newState ) {
+ } catch (CDIException e) {
+ if (getState() == newState) {
restoreOldState();
}
- targetRequestFailed( e.getMessage(), e );
+ targetRequestFailed(e.getMessage(), e);
}
}
@@ -1571,30 +1553,30 @@ public class CDebugTarget extends CDebugElement implements ICDebugTarget, ICDIEv
return fRegisterManager;
}
- protected void setRegisterManager( CRegisterManager registerManager ) {
+ protected void setRegisterManager(CRegisterManager registerManager) {
fRegisterManager = registerManager;
}
- public IRegisterGroup[] getRegisterGroups( CStackFrame frame ) throws DebugException {
- return getRegisterManager().getRegisterGroups( frame );
+ public IRegisterGroup[] getRegisterGroups(CStackFrame frame) throws DebugException {
+ return getRegisterManager().getRegisterGroups(frame);
}
protected void disposeSourceManager() {
ISourceLocator locator = getSourceLocator();
- if ( locator instanceof IAdaptable ) {
- IResourceChangeListener listener = (IResourceChangeListener)((IAdaptable)locator).getAdapter( IResourceChangeListener.class );
- if ( listener != null )
- CCorePlugin.getWorkspace().removeResourceChangeListener( listener );
+ if (locator instanceof IAdaptable) {
+ IResourceChangeListener listener = (IResourceChangeListener)((IAdaptable)locator).getAdapter(IResourceChangeListener.class);
+ if (listener != null)
+ CCorePlugin.getWorkspace().removeResourceChangeListener(listener);
}
}
protected void disposeSourceLookupPath() {
ISourceLocator locator = getLaunch().getSourceLocator();
- if ( locator instanceof ISourceLookupDirector ) {
+ if (locator instanceof ISourceLookupDirector) {
ISourceLookupParticipant[] participants = ((ISourceLookupDirector)locator).getParticipants();
- for ( int i = 0; i < participants.length; ++i ) {
- if ( participants[i] instanceof CSourceLookupParticipant ) {
- ((CSourceLookupParticipant)participants[i]).removeSourceLookupChangeListener( this );
+ for (int i = 0; i < participants.length; ++i) {
+ if (participants[i] instanceof CSourceLookupParticipant) {
+ ((CSourceLookupParticipant)participants[i]).removeSourceLookupChangeListener(this);
}
}
}
@@ -1612,12 +1594,12 @@ public class CDebugTarget extends CDebugElement implements ICDebugTarget, ICDIEv
return fBreakpointManager;
}
- protected void setBreakpointManager( CBreakpointManager manager ) {
+ protected void setBreakpointManager(CBreakpointManager manager) {
fBreakpointManager = manager;
}
protected void disposeBreakpointManager() {
- if ( getBreakpointManager() != null )
+ if (getBreakpointManager() != null)
getBreakpointManager().dispose();
}
@@ -1629,8 +1611,7 @@ public class CDebugTarget extends CDebugElement implements ICDebugTarget, ICDIEv
String result = ""; //$NON-NLS-1$
try {
result = getName();
- }
- catch( DebugException e ) {
+ } catch (DebugException e) {
}
return result;
}
@@ -1651,7 +1632,7 @@ public class CDebugTarget extends CDebugElement implements ICDebugTarget, ICDIEv
*/
public ICSignal[] getSignals() throws DebugException {
CSignalManager sm = getSignalManager();
- if ( sm != null ) {
+ if (sm != null) {
return sm.getSignals();
}
return new ICSignal[0];
@@ -1662,22 +1643,22 @@ public class CDebugTarget extends CDebugElement implements ICDebugTarget, ICDIEv
*/
public boolean hasSignals() throws DebugException {
CSignalManager sm = getSignalManager();
- if ( sm != null ) {
+ if (sm != null) {
return (sm.getSignals().length > 0);
}
return false;
}
private void createDisassembly() {
- this.fDisassembly = new Disassembly( this );
- this.fDisassemblyRetrieval = new DisassemblyRetrieval( this );
+ this.fDisassembly = new Disassembly(this);
+ this.fDisassemblyRetrieval = new DisassemblyRetrieval(this);
}
private void disposeDisassembly() {
- if ( fDisassembly != null )
+ if (fDisassembly != null)
fDisassembly.dispose();
fDisassembly = null;
- if ( fDisassemblyRetrieval != null )
+ if (fDisassemblyRetrieval != null)
fDisassemblyRetrieval.dispose();
fDisassemblyRetrieval = null;
}
@@ -1685,22 +1666,22 @@ public class CDebugTarget extends CDebugElement implements ICDebugTarget, ICDIEv
/* (non-Javadoc)
* @see org.eclipse.cdt.debug.core.model.IBreakpointTarget#getBreakpointAddress(org.eclipse.cdt.debug.core.model.ICLineBreakpoint)
*/
- public IAddress getBreakpointAddress( ICLineBreakpoint breakpoint ) throws DebugException {
- return (getBreakpointManager() != null) ? getBreakpointManager().getBreakpointAddress( breakpoint ) : getAddressFactory().getZero();
+ public IAddress getBreakpointAddress(ICLineBreakpoint breakpoint) throws DebugException {
+ return (getBreakpointManager() != null) ? getBreakpointManager().getBreakpointAddress(breakpoint) : getAddressFactory().getZero();
}
/* (non-Javadoc)
* @see org.eclipse.cdt.debug.core.model.ISteppingModeTarget#enableInstructionStepping(boolean)
*/
- public void enableInstructionStepping( boolean enabled ) {
- fPreferences.setValue( PREF_INSTRUCTION_STEPPING_MODE, enabled );
+ public void enableInstructionStepping(boolean enabled) {
+ fPreferences.setValue(PREF_INSTRUCTION_STEPPING_MODE, enabled);
}
/* (non-Javadoc)
* @see org.eclipse.cdt.debug.core.model.ISteppingModeTarget#isInstructionSteppingEnabled()
*/
public boolean isInstructionSteppingEnabled() {
- return fPreferences.getBoolean( PREF_INSTRUCTION_STEPPING_MODE );
+ return fPreferences.getBoolean(PREF_INSTRUCTION_STEPPING_MODE);
}
/* (non-Javadoc)
@@ -1712,13 +1693,13 @@ public class CDebugTarget extends CDebugElement implements ICDebugTarget, ICDIEv
private void initializePreferences() {
fPreferences = new Preferences();
- fPreferences.setDefault( PREF_INSTRUCTION_STEPPING_MODE, CDebugCorePlugin.getDefault().getPluginPreferences().getBoolean( ICDebugConstants.PREF_INSTRUCTION_STEP_MODE_ON ));
+ fPreferences.setDefault(PREF_INSTRUCTION_STEPPING_MODE, CDebugCorePlugin.getDefault().getPluginPreferences().getBoolean(ICDebugConstants.PREF_INSTRUCTION_STEP_MODE_ON));
}
private void disposePreferences() {
if (fPreferences != null) {
// persist current instruction stepping mode
- CDebugCorePlugin.getDefault().getPluginPreferences().setValue( ICDebugConstants.PREF_INSTRUCTION_STEP_MODE_ON, fPreferences.getBoolean( PREF_INSTRUCTION_STEPPING_MODE ) );
+ CDebugCorePlugin.getDefault().getPluginPreferences().setValue(ICDebugConstants.PREF_INSTRUCTION_STEP_MODE_ON, fPreferences.getBoolean(PREF_INSTRUCTION_STEPPING_MODE));
CDebugCorePlugin.getDefault().savePluginPreferences();
}
fPreferences = null;
@@ -1727,24 +1708,24 @@ public class CDebugTarget extends CDebugElement implements ICDebugTarget, ICDIEv
/* (non-Javadoc)
* @see org.eclipse.cdt.debug.core.model.ITargetProperties#addPropertyChangeListener(org.eclipse.core.runtime.Preferences.IPropertyChangeListener)
*/
- public void addPropertyChangeListener( IPropertyChangeListener listener ) {
- if ( fPreferences != null )
- fPreferences.addPropertyChangeListener( listener );
+ public void addPropertyChangeListener(IPropertyChangeListener listener) {
+ if (fPreferences != null)
+ fPreferences.addPropertyChangeListener(listener);
}
/* (non-Javadoc)
* @see org.eclipse.cdt.debug.core.model.ITargetProperties#removePropertyChangeListener(org.eclipse.core.runtime.Preferences.IPropertyChangeListener)
*/
- public void removePropertyChangeListener( IPropertyChangeListener listener ) {
- if ( fPreferences != null )
- fPreferences.removePropertyChangeListener( listener );
+ public void removePropertyChangeListener(IPropertyChangeListener listener) {
+ if (fPreferences != null)
+ fPreferences.removePropertyChangeListener(listener);
}
protected CGlobalVariableManager getGlobalVariableManager() {
return fGlobalVariableManager;
}
- private void setGlobalVariableManager( CGlobalVariableManager globalVariableManager ) {
+ private void setGlobalVariableManager(CGlobalVariableManager globalVariableManager) {
fGlobalVariableManager = globalVariableManager;
}
@@ -1752,7 +1733,7 @@ public class CDebugTarget extends CDebugElement implements ICDebugTarget, ICDIEv
return fFormatManager;
}
- private void setFormatManager( CSettingsManager formatManager ) {
+ private void setFormatManager(CSettingsManager formatManager) {
fFormatManager = formatManager;
}
@@ -1764,15 +1745,15 @@ public class CDebugTarget extends CDebugElement implements ICDebugTarget, ICDIEv
}
public IAddressFactory getAddressFactory() {
- if ( fAddressFactory == null ) {
+ if (fAddressFactory == null) {
// Ask CDI plug-in for the default AddressFactory.
final ICDITarget cdiTarget = getCDITarget();
if (cdiTarget instanceof ICDIAddressFactoryManagement) {
fAddressFactory = ((ICDIAddressFactoryManagement) cdiTarget).getAddressFactory();
}
// And if that doesn't work, use the one from the file.
- if ( fAddressFactory == null ){
- if ( getExecFile() != null && getProject() != null ) {
+ if (fAddressFactory == null) {
+ if (getExecFile() != null && getProject() != null) {
IBinaryObject file;
file = getBinaryFile();
if (file != null) {
@@ -1788,103 +1769,98 @@ public class CDebugTarget extends CDebugElement implements ICDebugTarget, ICDIEv
return fMemoryBlockRetrieval;
}
- private void setMemoryBlockRetrieval( CMemoryBlockRetrievalExtension memoryBlockRetrieval ) {
+ private void setMemoryBlockRetrieval(CMemoryBlockRetrievalExtension memoryBlockRetrieval) {
fMemoryBlockRetrieval = memoryBlockRetrieval;
}
- private void changeState( CDebugElementState state ) {
- setState( state );
- Iterator it = getThreadList().iterator();
- while( it.hasNext() ) {
- ((CThread)it.next()).setState( state );
+ private void changeState(CDebugElementState state) {
+ setState(state);
+ Iterator<CThread> it = getThreadList().iterator();
+ while (it.hasNext()) {
+ it.next().setState(state);
}
}
protected void restoreOldState() {
restoreState();
- Iterator it = getThreadList().iterator();
- while( it.hasNext() ) {
- ((CThread)it.next()).restoreState();
+ Iterator<CThread> it = getThreadList().iterator();
+ while (it.hasNext()) {
+ it.next().restoreState();
}
}
- private void handleSymbolsLoaded( ICDISharedLibrary library ) {
- getModuleManager().symbolsLoaded( library );
+ private void handleSymbolsLoaded(ICDISharedLibrary library) {
+ getModuleManager().symbolsLoaded(library);
}
- public ICGlobalVariable createGlobalVariable( IGlobalVariableDescriptor info ) throws DebugException {
+ public ICGlobalVariable createGlobalVariable(IGlobalVariableDescriptor info) throws DebugException {
ICDIVariableDescriptor vo = null;
try {
final ICDITarget cdiTarget = getCDITarget();
if (cdiTarget != null) {
- vo = cdiTarget.getGlobalVariableDescriptors( info.getPath().lastSegment(), null, info.getName() );
+ vo = cdiTarget.getGlobalVariableDescriptors(info.getPath().lastSegment(), null, info.getName());
}
+ } catch (CDIException e) {
+ throw new DebugException(new Status(IStatus.ERROR, CDIDebugModel.getPluginIdentifier(), DebugException.TARGET_REQUEST_FAILED, e.getMessage(), null));
}
- catch( CDIException e ) {
- throw new DebugException( new Status( IStatus.ERROR, CDIDebugModel.getPluginIdentifier(), DebugException.TARGET_REQUEST_FAILED, e.getMessage(), null ) );
- }
- return CVariableFactory.createGlobalVariable( this, info, vo );
+ return CVariableFactory.createGlobalVariable(this, info, vo);
}
- public void sourceContainersChanged( ISourceLookupDirector director ) {
- setSourceLookupPath( director.getSourceContainers() );
+ public void sourceContainersChanged(ISourceLookupDirector director) {
+ setSourceLookupPath(director.getSourceContainers());
}
- private void setSourceLookupPath( ISourceContainer[] containers ) {
+ private void setSourceLookupPath(ISourceContainer[] containers) {
// LinkedHashSet allows quick lookup and deterministic ordering. We need
// the former to efficiently prevent infinite recursion
- LinkedHashSet<String> list = new LinkedHashSet<String>( containers.length );
+ LinkedHashSet<String> list = new LinkedHashSet<String>(containers.length);
- getSourceLookupPath( list, containers );
+ getSourceLookupPath(list, containers);
try {
final ICDITarget cdiTarget = getCDITarget();
if (cdiTarget != null) {
- cdiTarget.setSourcePaths( list.toArray( new String[list.size()] ) );
+ cdiTarget.setSourcePaths(list.toArray(new String[list.size()]));
}
- }
- catch( CDIException e ) {
- CDebugCorePlugin.log( e );
+ } catch (CDIException e) {
+ CDebugCorePlugin.log(e);
}
}
- private void getSourceLookupPath( LinkedHashSet<String> list, ISourceContainer[] containers) {
- for ( ISourceContainer container : containers ) {
+ private void getSourceLookupPath(LinkedHashSet<String> list, ISourceContainer[] containers) {
+ for (ISourceContainer container : containers) {
String pathToAdd = null;
- if ( container instanceof ProjectSourceContainer ) {
- IProject project = ((ProjectSourceContainer)container).getProject();
- if ( project != null && project.exists() )
+ if (container instanceof ProjectSourceContainer) {
+ IProject project = ((ProjectSourceContainer) container).getProject();
+ if (project != null && project.exists())
pathToAdd = project.getLocation().toPortableString();
- }
- if ( container instanceof FolderSourceContainer ) {
- IContainer folderContainer = ((FolderSourceContainer)container).getContainer();
- if ( folderContainer != null && folderContainer.exists() ) {
+ } else if (container instanceof FolderSourceContainer) {
+ IContainer folderContainer = ((FolderSourceContainer) container).getContainer();
+ if (folderContainer != null && folderContainer.exists()) {
pathToAdd = folderContainer.getLocation().toPortableString();
}
- }
- if ( container instanceof DirectorySourceContainer ) {
- File dir = ((DirectorySourceContainer)container).getDirectory();
- if ( dir != null && dir.exists() ) {
- IPath path = new Path( dir.getAbsolutePath() );
+ } if (container instanceof DirectorySourceContainer) {
+ File dir = ((DirectorySourceContainer) container).getDirectory();
+ if (dir != null && dir.exists()) {
+ IPath path = new Path(dir.getAbsolutePath());
pathToAdd = path.toPortableString();
}
}
- if ( pathToAdd != null ) {
+ if (pathToAdd != null) {
// 291912. Avoid infinite recursion
- if ( list.contains(pathToAdd) ) {
+ if (list.contains(pathToAdd)) {
continue;
}
- list.add( pathToAdd );
+ list.add(pathToAdd);
}
- if ( container.isComposite() ) {
+ if (container.isComposite()) {
try {
- getSourceLookupPath( list, container.getSourceContainers() );
- }
- catch( CoreException e ) {
- CDebugCorePlugin.log( e.getStatus() );
+ getSourceLookupPath(list, container.getSourceContainers());
+ } catch (CoreException e) {
+ CDebugCorePlugin.log(e.getStatus());
}
}
}
@@ -1900,22 +1876,22 @@ public class CDebugTarget extends CDebugElement implements ICDebugTarget, ICDIEv
/* (non-Javadoc)
* @see org.eclipse.cdt.debug.core.model.ICDebugTarget#addUserDefinedRegisterGroup(java.lang.String, org.eclipse.cdt.debug.core.model.IRegisterDescriptor[])
*/
- public void addRegisterGroup( String name, IRegisterDescriptor[] descriptors ) {
- getRegisterManager().addRegisterGroup( name, descriptors );
+ public void addRegisterGroup(String name, IRegisterDescriptor[] descriptors) {
+ getRegisterManager().addRegisterGroup(name, descriptors);
}
/* (non-Javadoc)
* @see org.eclipse.cdt.debug.core.model.ICDebugTarget#removeRegisterGroups(org.eclipse.debug.core.model.IRegisterGroup[])
*/
- public void removeRegisterGroups( IRegisterGroup[] groups ) {
- getRegisterManager().removeRegisterGroups( groups );
+ public void removeRegisterGroups(IRegisterGroup[] groups) {
+ getRegisterManager().removeRegisterGroups(groups);
}
/* (non-Javadoc)
* @see org.eclipse.cdt.debug.core.model.ICDebugTarget#modifyRegisterGroup(org.eclipse.cdt.debug.core.model.IPersistableRegisterGroup, org.eclipse.cdt.debug.core.model.IRegisterDescriptor[])
*/
- public void modifyRegisterGroup( IPersistableRegisterGroup group, IRegisterDescriptor[] descriptors ) {
- getRegisterManager().modifyRegisterGroup( group, descriptors );
+ public void modifyRegisterGroup(IPersistableRegisterGroup group, IRegisterDescriptor[] descriptors) {
+ getRegisterManager().modifyRegisterGroup(group, descriptors);
}
/* (non-Javadoc)
@@ -1925,8 +1901,8 @@ public class CDebugTarget extends CDebugElement implements ICDebugTarget, ICDIEv
getRegisterManager().restoreDefaults();
}
- protected void skipBreakpoints( boolean enabled ) {
- getBreakpointManager().skipBreakpoints( enabled );
+ protected void skipBreakpoints(boolean enabled) {
+ getBreakpointManager().skipBreakpoints(enabled);
}
/**
@@ -1934,36 +1910,35 @@ public class CDebugTarget extends CDebugElement implements ICDebugTarget, ICDIEv
* fails. Where to stop is dictated entirely by 'location'
* @param symbol
*/
- private void stopAtLocation(ICDILocation location, String stopExpression ) throws DebugException {
+ private void stopAtLocation(ICDILocation location, String stopExpression) throws DebugException {
try {
- setInternalTemporaryBreakpoint( location );
- }
- catch( CoreException e ) {
+ setInternalTemporaryBreakpoint(location);
+ } catch (CoreException e) {
final ICDITarget cdiTarget = getCDITarget();
boolean isTerminated = cdiTarget != null && cdiTarget.isTerminated();
- if ( isTerminated ) {
- String message = MessageFormat.format( CoreModelMessages.getString( "CDebugTarget.0" ), new String[]{ stopExpression } ); //$NON-NLS-1$
- MultiStatus status = new MultiStatus( CDebugCorePlugin.getUniqueIdentifier(), IStatus.OK, message, null );
- status.add( e.getStatus() );
- throw new DebugException( status );
+ if (isTerminated) {
+ String message = MessageFormat.format(CoreModelMessages.getString("CDebugTarget.0"), new String[]{ stopExpression }); //$NON-NLS-1$
+ MultiStatus status = new MultiStatus(CDebugCorePlugin.getUniqueIdentifier(), IStatus.OK, message, null);
+ status.add(e.getStatus());
+ throw new DebugException(status);
}
- String message = MessageFormat.format( CoreModelMessages.getString( "CDebugTarget.2" ), new String[]{ stopExpression, e.getStatus().getMessage() } ); //$NON-NLS-1$
- IStatus newStatus = new Status( IStatus.WARNING, e.getStatus().getPlugin(), ICDebugInternalConstants.STATUS_CODE_QUESTION, message, null );
- if ( !CDebugUtils.question( newStatus, this ) ) {
- throw new DebugException( new Status( IStatus.OK, e.getStatus().getPlugin(), e.getStatus().getCode(), e.getStatus().getMessage(), null ) );
+ String message = MessageFormat.format(CoreModelMessages.getString("CDebugTarget.2"), new String[]{ stopExpression, e.getStatus().getMessage() }); //$NON-NLS-1$
+ IStatus newStatus = new Status(IStatus.WARNING, e.getStatus().getPlugin(), ICDebugInternalConstants.STATUS_CODE_QUESTION, message, null);
+ if (!CDebugUtils.question(newStatus, this)) {
+ throw new DebugException(new Status(IStatus.OK, e.getStatus().getPlugin(), e.getStatus().getCode(), e.getStatus().getMessage(), null));
}
}
}
- protected void stopAtSymbol( String stopSymbol ) throws DebugException {
+ protected void stopAtSymbol(String stopSymbol) throws DebugException {
final ICDITarget cdiTarget = getCDITarget();
if (cdiTarget != null) {
- ICDILocation location = cdiTarget.createFunctionLocation( "", stopSymbol ); //$NON-NLS-1$
+ ICDILocation location = cdiTarget.createFunctionLocation("", stopSymbol); //$NON-NLS-1$
stopAtLocation(location, stopSymbol);
}
}
- protected void stopAtAddress( IAddress address ) throws DebugException {
+ protected void stopAtAddress(IAddress address) throws DebugException {
final ICDITarget cdiTarget = getCDITarget();
if (cdiTarget != null) {
ICDIAddressLocation location = cdiTarget.createAddressLocation(address.getValue());
@@ -1972,42 +1947,41 @@ public class CDebugTarget extends CDebugElement implements ICDebugTarget, ICDIEv
}
protected void stopInMain() throws DebugException {
- String mainSymbol = new String( ICDTLaunchConfigurationConstants.DEBUGGER_STOP_AT_MAIN_SYMBOL_DEFAULT );
+ String mainSymbol = new String(ICDTLaunchConfigurationConstants.DEBUGGER_STOP_AT_MAIN_SYMBOL_DEFAULT);
try {
final ICDITarget cdiTarget = getCDITarget();
if (cdiTarget != null) {
- mainSymbol = getLaunch().getLaunchConfiguration().getAttribute( ICDTLaunchConfigurationConstants.ATTR_DEBUGGER_STOP_AT_MAIN_SYMBOL, ICDTLaunchConfigurationConstants.DEBUGGER_STOP_AT_MAIN_SYMBOL_DEFAULT );
- ICDILocation location = cdiTarget.createFunctionLocation( "", mainSymbol ); //$NON-NLS-1$
- setInternalTemporaryBreakpoint( location );
+ mainSymbol = getLaunch().getLaunchConfiguration().getAttribute(ICDTLaunchConfigurationConstants.ATTR_DEBUGGER_STOP_AT_MAIN_SYMBOL, ICDTLaunchConfigurationConstants.DEBUGGER_STOP_AT_MAIN_SYMBOL_DEFAULT);
+ ICDILocation location = cdiTarget.createFunctionLocation("", mainSymbol); //$NON-NLS-1$
+ setInternalTemporaryBreakpoint(location);
}
- }
- catch( CoreException e ) {
- String message = MessageFormat.format( CoreModelMessages.getString( "CDebugTarget.2" ), new String[]{ mainSymbol, e.getStatus().getMessage() } ); //$NON-NLS-1$
- IStatus newStatus = new Status( IStatus.WARNING, e.getStatus().getPlugin(), ICDebugInternalConstants.STATUS_CODE_QUESTION, message, null );
- if ( !CDebugUtils.question( newStatus, this ) ) {
+ } catch (CoreException e) {
+ String message = MessageFormat.format(CoreModelMessages.getString("CDebugTarget.2"), new String[]{ mainSymbol, e.getStatus().getMessage() }); //$NON-NLS-1$
+ IStatus newStatus = new Status(IStatus.WARNING, e.getStatus().getPlugin(), ICDebugInternalConstants.STATUS_CODE_QUESTION, message, null);
+ if (!CDebugUtils.question(newStatus, this)) {
terminate();
- throw new DebugException( new Status( IStatus.OK, e.getStatus().getPlugin(), e.getStatus().getCode(), e.getStatus().getMessage(), null ) );
+ throw new DebugException(new Status(IStatus.OK, e.getStatus().getPlugin(), e.getStatus().getCode(), e.getStatus().getMessage(), null));
}
}
}
public boolean hasModules() throws DebugException {
CModuleManager mm = getModuleManager();
- if ( mm != null )
+ if (mm != null)
return mm.hasModules();
return false;
}
public ICModule[] getModules() throws DebugException {
CModuleManager mm = getModuleManager();
- if ( mm != null )
+ if (mm != null)
return mm.getModules();
return new ICModule[0];
}
public void loadSymbolsForAllModules() throws DebugException {
CModuleManager mm = getModuleManager();
- if ( mm != null )
+ if (mm != null)
mm.loadSymbolsForAllModules();
}

Back to the top