mirror of
https://github.com/eclipse-cdt/cdt
synced 2025-07-27 02:45:32 +02:00
Generics.
This commit is contained in:
parent
c42dcb755b
commit
82e06db2d9
1 changed files with 475 additions and 501 deletions
|
@ -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 starts it is added to the list.
|
||||||
* When a thread ends it is removed from 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.
|
* 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;
|
private IAddressFactory fAddressFactory;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Support for the memory retrival on this target.
|
* Support for the memory retrieval on this target.
|
||||||
*/
|
*/
|
||||||
private CMemoryBlockRetrievalExtension fMemoryBlockRetrieval;
|
private CMemoryBlockRetrievalExtension fMemoryBlockRetrieval;
|
||||||
|
|
||||||
|
@ -266,7 +266,7 @@ public class CDebugTarget extends CDebugElement implements ICDebugTarget, ICDIEv
|
||||||
setState(CDebugElementState.SUSPENDED);
|
setState(CDebugElementState.SUSPENDED);
|
||||||
initializePreferences();
|
initializePreferences();
|
||||||
setConfiguration(cdiTarget.getConfiguration());
|
setConfiguration(cdiTarget.getConfiguration());
|
||||||
setThreadList( new ArrayList( 5 ) );
|
setThreadList(new ArrayList<CThread>(5));
|
||||||
createDisassembly();
|
createDisassembly();
|
||||||
setModuleManager(new CModuleManager(this));
|
setModuleManager(new CModuleManager(this));
|
||||||
setSignalManager(new CSignalManager(this));
|
setSignalManager(new CSignalManager(this));
|
||||||
|
@ -283,7 +283,7 @@ public class CDebugTarget extends CDebugElement implements ICDebugTarget, ICDIEv
|
||||||
|
|
||||||
protected void initialize() {
|
protected void initialize() {
|
||||||
initializeSourceLookupPath();
|
initializeSourceLookupPath();
|
||||||
ArrayList debugEvents = new ArrayList( 1 );
|
ArrayList<DebugEvent> debugEvents = new ArrayList<DebugEvent>(1);
|
||||||
debugEvents.add(createCreateEvent());
|
debugEvents.add(createCreateEvent());
|
||||||
initializeThreads(debugEvents);
|
initializeThreads(debugEvents);
|
||||||
initializeBreakpoints();
|
initializeBreakpoints();
|
||||||
|
@ -292,7 +292,7 @@ public class CDebugTarget extends CDebugElement implements ICDebugTarget, ICDIEv
|
||||||
initializeModuleManager();
|
initializeModuleManager();
|
||||||
initializeMemoryBlocks();
|
initializeMemoryBlocks();
|
||||||
getLaunch().addDebugTarget(this);
|
getLaunch().addDebugTarget(this);
|
||||||
fireEventSet( (DebugEvent[])debugEvents.toArray( new DebugEvent[debugEvents.size()] ) );
|
fireEventSet(debugEvents.toArray(new DebugEvent[debugEvents.size()]));
|
||||||
}
|
}
|
||||||
|
|
||||||
private void initializeBreakpoints() {
|
private void initializeBreakpoints() {
|
||||||
|
@ -323,7 +323,7 @@ public class CDebugTarget extends CDebugElement implements ICDebugTarget, ICDIEv
|
||||||
/**
|
/**
|
||||||
* Adds all of the pre-existing threads to this debug target.
|
* 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();
|
final ICDITarget cdiTarget = getCDITarget();
|
||||||
if (cdiTarget == null) {
|
if (cdiTarget == null) {
|
||||||
return;
|
return;
|
||||||
|
@ -332,8 +332,7 @@ public class CDebugTarget extends CDebugElement implements ICDebugTarget, ICDIEv
|
||||||
ICDIThread[] cdiThreads = new ICDIThread[0];
|
ICDIThread[] cdiThreads = new ICDIThread[0];
|
||||||
try {
|
try {
|
||||||
cdiThreads = cdiTarget.getThreads();
|
cdiThreads = cdiTarget.getThreads();
|
||||||
}
|
} catch (CDIException e) {
|
||||||
catch( CDIException e ) {
|
|
||||||
// ignore
|
// ignore
|
||||||
}
|
}
|
||||||
DebugEvent suspendEvent = null;
|
DebugEvent suspendEvent = null;
|
||||||
|
@ -345,8 +344,7 @@ public class CDebugTarget extends CDebugElement implements ICDebugTarget, ICDIEv
|
||||||
// Use BREAKPOINT as a detail to force perspective switch
|
// 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
|
// ignore
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@ -396,17 +394,16 @@ public class CDebugTarget extends CDebugElement implements ICDebugTarget, ICDIEv
|
||||||
ICDISharedLibrary[] slibs = new ICDISharedLibrary[0];
|
ICDISharedLibrary[] slibs = new ICDISharedLibrary[0];
|
||||||
try {
|
try {
|
||||||
slibs = cdiTarget.getSharedLibraries();
|
slibs = cdiTarget.getSharedLibraries();
|
||||||
}
|
} catch (CDIException e) {
|
||||||
catch( CDIException e ) {
|
|
||||||
DebugPlugin.log(e);
|
DebugPlugin.log(e);
|
||||||
}
|
}
|
||||||
ICModule[] modules = null;
|
ICModule[] modules = null;
|
||||||
if (getExecFile() != null) {
|
if (getExecFile() != null) {
|
||||||
modules = new ICModule[slibs.length + 1];
|
modules = new ICModule[slibs.length + 1];
|
||||||
modules[0] = CModule.createExecutable(this, getExecFile().getPath());
|
modules[0] = CModule.createExecutable(this, getExecFile().getPath());
|
||||||
}
|
} else {
|
||||||
else
|
|
||||||
modules = new ICModule[slibs.length];
|
modules = new ICModule[slibs.length];
|
||||||
|
}
|
||||||
for (int i = 0; i < slibs.length; ++i) {
|
for (int i = 0; i < slibs.length; ++i) {
|
||||||
modules[i + 1] = CModule.createSharedLibrary(this, slibs[i]);
|
modules[i + 1] = CModule.createSharedLibrary(this, slibs[i]);
|
||||||
}
|
}
|
||||||
|
@ -441,8 +438,8 @@ public class CDebugTarget extends CDebugElement implements ICDebugTarget, ICDIEv
|
||||||
* @see org.eclipse.debug.core.model.IDebugTarget#getThreads()
|
* @see org.eclipse.debug.core.model.IDebugTarget#getThreads()
|
||||||
*/
|
*/
|
||||||
public IThread[] getThreads() {
|
public IThread[] getThreads() {
|
||||||
List threads = getThreadList();
|
List<CThread> threads = getThreadList();
|
||||||
return (IThread[])threads.toArray( new IThread[threads.size()] );
|
return threads.toArray(new IThread[threads.size()]);
|
||||||
}
|
}
|
||||||
|
|
||||||
/*
|
/*
|
||||||
|
@ -535,8 +532,7 @@ public class CDebugTarget extends CDebugElement implements ICDebugTarget, ICDIEv
|
||||||
if (cdiTarget != null) {
|
if (cdiTarget != null) {
|
||||||
cdiTarget.terminate();
|
cdiTarget.terminate();
|
||||||
}
|
}
|
||||||
}
|
} catch (CDIException e) {
|
||||||
catch( CDIException e ) {
|
|
||||||
if (getState() == newState) {
|
if (getState() == newState) {
|
||||||
restoreOldState();
|
restoreOldState();
|
||||||
}
|
}
|
||||||
|
@ -590,8 +586,7 @@ public class CDebugTarget extends CDebugElement implements ICDebugTarget, ICDIEv
|
||||||
if (cdiTarget != null) {
|
if (cdiTarget != null) {
|
||||||
cdiTarget.resume(false);
|
cdiTarget.resume(false);
|
||||||
}
|
}
|
||||||
}
|
} catch (CDIException e) {
|
||||||
catch( CDIException e ) {
|
|
||||||
if (getState() == newState) {
|
if (getState() == newState) {
|
||||||
restoreOldState();
|
restoreOldState();
|
||||||
}
|
}
|
||||||
|
@ -612,8 +607,7 @@ public class CDebugTarget extends CDebugElement implements ICDebugTarget, ICDIEv
|
||||||
if (cdiTarget != null) {
|
if (cdiTarget != null) {
|
||||||
cdiTarget.suspend();
|
cdiTarget.suspend();
|
||||||
}
|
}
|
||||||
}
|
} catch (CDIException e) {
|
||||||
catch( CDIException e ) {
|
|
||||||
if (getState() == newState) {
|
if (getState() == newState) {
|
||||||
restoreOldState();
|
restoreOldState();
|
||||||
}
|
}
|
||||||
|
@ -629,17 +623,16 @@ public class CDebugTarget extends CDebugElement implements ICDebugTarget, ICDIEv
|
||||||
* Notifies threads that the target has been suspended.
|
* Notifies threads that the target has been suspended.
|
||||||
*/
|
*/
|
||||||
protected void suspendThreads(ICDISuspendedEvent event) {
|
protected void suspendThreads(ICDISuspendedEvent event) {
|
||||||
Iterator it = getThreadList().iterator();
|
Iterator<CThread> it = getThreadList().iterator();
|
||||||
while (it.hasNext()) {
|
while (it.hasNext()) {
|
||||||
CThread thread = (CThread)it.next();
|
CThread thread = it.next();
|
||||||
ICDIThread suspensionThread = null;
|
ICDIThread suspensionThread = null;
|
||||||
try {
|
try {
|
||||||
final ICDITarget cdiTarget = getCDITarget();
|
final ICDITarget cdiTarget = getCDITarget();
|
||||||
if (cdiTarget != null) {
|
if (cdiTarget != null) {
|
||||||
suspensionThread = cdiTarget.getCurrentThread();
|
suspensionThread = cdiTarget.getCurrentThread();
|
||||||
}
|
}
|
||||||
}
|
} catch (CDIException e) {
|
||||||
catch( CDIException e ) {
|
|
||||||
// ignore
|
// ignore
|
||||||
}
|
}
|
||||||
thread.suspendByTarget(event.getReason(), suspensionThread);
|
thread.suspendByTarget(event.getReason(), suspensionThread);
|
||||||
|
@ -649,11 +642,11 @@ public class CDebugTarget extends CDebugElement implements ICDebugTarget, ICDIEv
|
||||||
/**
|
/**
|
||||||
* Refreshes the thread list.
|
* Refreshes the thread list.
|
||||||
*/
|
*/
|
||||||
protected synchronized List refreshThreads() {
|
protected synchronized List<CThread> refreshThreads() {
|
||||||
ArrayList newThreads = new ArrayList( 5 );
|
ArrayList<CThread> newThreads = new ArrayList<CThread>(5);
|
||||||
ArrayList list = new ArrayList( 5 );
|
ArrayList<CThread> list = new ArrayList<CThread>(5);
|
||||||
ArrayList debugEvents = new ArrayList( 5 );
|
ArrayList<DebugEvent> debugEvents = new ArrayList<DebugEvent>(5);
|
||||||
List oldList = (List)getThreadList().clone();
|
List<CThread> oldList = (List<CThread>)getThreadList().clone();
|
||||||
ICDIThread[] cdiThreads = new ICDIThread[0];
|
ICDIThread[] cdiThreads = new ICDIThread[0];
|
||||||
ICDIThread currentCDIThread = null;
|
ICDIThread currentCDIThread = null;
|
||||||
try {
|
try {
|
||||||
|
@ -662,8 +655,7 @@ public class CDebugTarget extends CDebugElement implements ICDebugTarget, ICDIEv
|
||||||
cdiThreads = cdiTarget.getThreads();
|
cdiThreads = cdiTarget.getThreads();
|
||||||
currentCDIThread = cdiTarget.getCurrentThread();
|
currentCDIThread = cdiTarget.getCurrentThread();
|
||||||
}
|
}
|
||||||
}
|
} catch (CDIException e) {
|
||||||
catch( CDIException e ) {
|
|
||||||
}
|
}
|
||||||
for (int i = 0; i < cdiThreads.length; ++i) {
|
for (int i = 0; i < cdiThreads.length; ++i) {
|
||||||
CThread thread = findThread(oldList, cdiThreads[i]);
|
CThread thread = findThread(oldList, cdiThreads[i]);
|
||||||
|
@ -677,29 +669,29 @@ public class CDebugTarget extends CDebugElement implements ICDebugTarget, ICDIEv
|
||||||
thread.setCurrent(cdiThreads[i].equals(currentCDIThread));
|
thread.setCurrent(cdiThreads[i].equals(currentCDIThread));
|
||||||
list.add(thread);
|
list.add(thread);
|
||||||
}
|
}
|
||||||
Iterator it = oldList.iterator();
|
Iterator<CThread> it = oldList.iterator();
|
||||||
while (it.hasNext()) {
|
while (it.hasNext()) {
|
||||||
CThread thread = (CThread)it.next();
|
CThread thread = it.next();
|
||||||
thread.terminated();
|
thread.terminated();
|
||||||
debugEvents.add(thread.createTerminateEvent());
|
debugEvents.add(thread.createTerminateEvent());
|
||||||
}
|
}
|
||||||
setThreadList(list);
|
setThreadList(list);
|
||||||
it = newThreads.iterator();
|
it = newThreads.iterator();
|
||||||
while (it.hasNext()) {
|
while (it.hasNext()) {
|
||||||
debugEvents.add( ((CThread)it.next()).createCreateEvent() );
|
debugEvents.add(it.next().createCreateEvent());
|
||||||
}
|
}
|
||||||
if (debugEvents.size() > 0)
|
if (debugEvents.size() > 0)
|
||||||
fireEventSet( (DebugEvent[])debugEvents.toArray( new DebugEvent[debugEvents.size()] ) );
|
fireEventSet(debugEvents.toArray(new DebugEvent[debugEvents.size()]));
|
||||||
return newThreads;
|
return newThreads;
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Notifies threads that the target has been resumed.
|
* Notifies threads that the target has been resumed.
|
||||||
*/
|
*/
|
||||||
protected synchronized void resumeThreads( List debugEvents, int detail ) {
|
protected synchronized void resumeThreads(List<DebugEvent> debugEvents, int detail) {
|
||||||
Iterator it = getThreadList().iterator();
|
Iterator<CThread> it = getThreadList().iterator();
|
||||||
while (it.hasNext()) {
|
while (it.hasNext()) {
|
||||||
((CThread)it.next()).resumedByTarget( detail, debugEvents );
|
it.next().resumedByTarget(detail, debugEvents);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -760,8 +752,7 @@ public class CDebugTarget extends CDebugElement implements ICDebugTarget, ICDIEv
|
||||||
if (cdiTarget != null) {
|
if (cdiTarget != null) {
|
||||||
cdiTarget.disconnect();
|
cdiTarget.disconnect();
|
||||||
}
|
}
|
||||||
}
|
} catch (CDIException e) {
|
||||||
catch( CDIException e ) {
|
|
||||||
if (getState() == newState) {
|
if (getState() == newState) {
|
||||||
restoreOldState();
|
restoreOldState();
|
||||||
}
|
}
|
||||||
|
@ -812,7 +803,7 @@ public class CDebugTarget extends CDebugElement implements ICDebugTarget, ICDIEv
|
||||||
*
|
*
|
||||||
* @return list of threads
|
* @return list of threads
|
||||||
*/
|
*/
|
||||||
protected ArrayList getThreadList() {
|
protected ArrayList<CThread> getThreadList() {
|
||||||
return fThreads;
|
return fThreads;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -822,7 +813,7 @@ public class CDebugTarget extends CDebugElement implements ICDebugTarget, ICDIEv
|
||||||
*
|
*
|
||||||
* @param threads empty list
|
* @param threads empty list
|
||||||
*/
|
*/
|
||||||
private void setThreadList( ArrayList threads ) {
|
private void setThreadList(ArrayList<CThread> threads) {
|
||||||
fThreads = threads;
|
fThreads = threads;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -834,7 +825,7 @@ public class CDebugTarget extends CDebugElement implements ICDebugTarget, ICDIEv
|
||||||
* @see org.eclipse.core.runtime.IAdaptable#getAdapter(java.lang.Class)
|
* @see org.eclipse.core.runtime.IAdaptable#getAdapter(java.lang.Class)
|
||||||
*/
|
*/
|
||||||
@Override
|
@Override
|
||||||
public Object getAdapter( Class adapter ) {
|
public Object getAdapter(@SuppressWarnings("rawtypes") Class adapter) {
|
||||||
if (adapter.equals(ICDebugElement.class))
|
if (adapter.equals(ICDebugElement.class))
|
||||||
return this;
|
return this;
|
||||||
if (adapter.equals(CDebugElement.class))
|
if (adapter.equals(CDebugElement.class))
|
||||||
|
@ -978,8 +969,7 @@ public class CDebugTarget extends CDebugElement implements ICDebugTarget, ICDIEv
|
||||||
|
|
||||||
setInternalTemporaryBreakpoint(location);
|
setInternalTemporaryBreakpoint(location);
|
||||||
}
|
}
|
||||||
}
|
} catch (CoreException e) {
|
||||||
catch( CoreException e ) {
|
|
||||||
requestFailed(e.getMessage(), e);
|
requestFailed(e.getMessage(), e);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -987,8 +977,7 @@ public class CDebugTarget extends CDebugElement implements ICDebugTarget, ICDIEv
|
||||||
changeState(newState);
|
changeState(newState);
|
||||||
try {
|
try {
|
||||||
cdiTarget.restart();
|
cdiTarget.restart();
|
||||||
}
|
} catch (CDIException e) {
|
||||||
catch( CDIException e ) {
|
|
||||||
if (getState() == newState) {
|
if (getState() == newState) {
|
||||||
restoreOldState();
|
restoreOldState();
|
||||||
}
|
}
|
||||||
|
@ -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.
|
* Removes all threads from this target's collection of threads, firing a terminate event for each.
|
||||||
*/
|
*/
|
||||||
protected void removeAllThreads() {
|
protected void removeAllThreads() {
|
||||||
List threads = getThreadList();
|
List<CThread> threads = getThreadList();
|
||||||
setThreadList( new ArrayList( 0 ) );
|
setThreadList(new ArrayList<CThread>(0));
|
||||||
ArrayList debugEvents = new ArrayList( threads.size() );
|
ArrayList<DebugEvent> debugEvents = new ArrayList<DebugEvent>(threads.size());
|
||||||
Iterator it = threads.iterator();
|
Iterator<CThread> it = threads.iterator();
|
||||||
while (it.hasNext()) {
|
while (it.hasNext()) {
|
||||||
CThread thread = (CThread)it.next();
|
CThread thread = it.next();
|
||||||
thread.terminated();
|
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()]));
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
|
@ -1132,14 +1121,13 @@ public class CDebugTarget extends CDebugElement implements ICDebugTarget, ICDIEv
|
||||||
// Reset the registers that have errors.
|
// Reset the registers that have errors.
|
||||||
getRegisterManager().targetSuspended();
|
getRegisterManager().targetSuspended();
|
||||||
getBreakpointManager().skipBreakpoints(false);
|
getBreakpointManager().skipBreakpoints(false);
|
||||||
List newThreads = refreshThreads();
|
List<CThread> newThreads = refreshThreads();
|
||||||
if (event.getSource() instanceof ICDITarget) {
|
if (event.getSource() instanceof ICDITarget) {
|
||||||
if (!(this.getConfiguration() instanceof ICDITargetConfiguration2) || !((ICDITargetConfiguration2)this.getConfiguration()).supportsThreadControl())
|
if (!(this.getConfiguration() instanceof ICDITargetConfiguration2) || !((ICDITargetConfiguration2)this.getConfiguration()).supportsThreadControl())
|
||||||
suspendThreads(event);
|
suspendThreads(event);
|
||||||
}
|
} else if (event.getSource() instanceof ICDIThread) {
|
||||||
// We need this for debuggers that don't have notifications
|
// We need this for debuggers that don't have notifications
|
||||||
// for newly created threads.
|
// for newly created threads.
|
||||||
else if ( event.getSource() instanceof ICDIThread ) {
|
|
||||||
CThread thread = findThread((ICDIThread)event.getSource());
|
CThread thread = findThread((ICDIThread)event.getSource());
|
||||||
if (thread != null && newThreads.contains(thread)) {
|
if (thread != null && newThreads.contains(thread)) {
|
||||||
ICDIEvent[] evts = new ICDIEvent[]{ event };
|
ICDIEvent[] evts = new ICDIEvent[]{ event };
|
||||||
|
@ -1179,7 +1167,7 @@ public class CDebugTarget extends CDebugElement implements ICDebugTarget, ICDIEv
|
||||||
setState(CDebugElementState.RESUMED);
|
setState(CDebugElementState.RESUMED);
|
||||||
setCurrentStateInfo(null);
|
setCurrentStateInfo(null);
|
||||||
resetStatus();
|
resetStatus();
|
||||||
ArrayList debugEvents = new ArrayList( 10 );
|
ArrayList<DebugEvent> debugEvents = new ArrayList<DebugEvent>(10);
|
||||||
int detail = DebugEvent.UNSPECIFIED;
|
int detail = DebugEvent.UNSPECIFIED;
|
||||||
switch(event.getType()) {
|
switch(event.getType()) {
|
||||||
case ICDIResumedEvent.CONTINUE:
|
case ICDIResumedEvent.CONTINUE:
|
||||||
|
@ -1202,7 +1190,7 @@ public class CDebugTarget extends CDebugElement implements ICDebugTarget, ICDIEv
|
||||||
if (!(this.getConfiguration() instanceof ICDITargetConfiguration2) || !((ICDITargetConfiguration2)this.getConfiguration()).supportsThreadControl())
|
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) {
|
private void handleEndSteppingRange(ICDIEndSteppingRange endSteppingRange) {
|
||||||
|
@ -1287,10 +1275,10 @@ public class CDebugTarget extends CDebugElement implements ICDebugTarget, ICDIEv
|
||||||
|
|
||||||
private void handleThreadTerminatedEvent(ICDIDestroyedEvent event) {
|
private void handleThreadTerminatedEvent(ICDIDestroyedEvent event) {
|
||||||
ICDIThread cdiThread = (ICDIThread)event.getSource();
|
ICDIThread cdiThread = (ICDIThread)event.getSource();
|
||||||
List threads = getThreadList();
|
List<CThread> threads = getThreadList();
|
||||||
List<CThread> threadsToRemove = new ArrayList<CThread>(1);
|
List<CThread> threadsToRemove = new ArrayList<CThread>(1);
|
||||||
for (int i = 0; i < threads.size(); i++) {
|
for (int i = 0; i < threads.size(); i++) {
|
||||||
CThread cthread = (CThread)threads.get(i);
|
CThread cthread = threads.get(i);
|
||||||
// It's possible CThread has handled the thread-terminated event
|
// It's possible CThread has handled the thread-terminated event
|
||||||
// before us (by appearing first in the EventManager)
|
// before us (by appearing first in the EventManager)
|
||||||
// and has disassociated itself from the ICDIThread.
|
// and has disassociated itself from the ICDIThread.
|
||||||
|
@ -1319,9 +1307,9 @@ public class CDebugTarget extends CDebugElement implements ICDebugTarget, ICDIEv
|
||||||
return findThread(getThreadList(), cdiThread);
|
return findThread(getThreadList(), cdiThread);
|
||||||
}
|
}
|
||||||
|
|
||||||
public CThread findThread( List threads, ICDIThread cdiThread ) {
|
public CThread findThread(List<CThread> threads, ICDIThread cdiThread) {
|
||||||
for (int i = 0; i < threads.size(); i++) {
|
for (int i = 0; i < threads.size(); i++) {
|
||||||
CThread t = (CThread)threads.get( i );
|
CThread t = threads.get(i);
|
||||||
ICDIThread thisCdiThread = t.getCDIThread();
|
ICDIThread thisCdiThread = t.getCDIThread();
|
||||||
if (thisCdiThread != null && thisCdiThread.equals(cdiThread))
|
if (thisCdiThread != null && thisCdiThread.equals(cdiThread))
|
||||||
return t;
|
return t;
|
||||||
|
@ -1388,8 +1376,7 @@ public class CDebugTarget extends CDebugElement implements ICDebugTarget, ICDIEv
|
||||||
// ???
|
// ???
|
||||||
targetRequestFailed("not_a_location", null); //$NON-NLS-1$
|
targetRequestFailed("not_a_location", null); //$NON-NLS-1$
|
||||||
}
|
}
|
||||||
}
|
} catch (CDIException e) {
|
||||||
catch( CDIException e ) {
|
|
||||||
targetRequestFailed(e.getMessage(), null);
|
targetRequestFailed(e.getMessage(), null);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@ -1422,7 +1409,6 @@ public class CDebugTarget extends CDebugElement implements ICDebugTarget, ICDIEv
|
||||||
return fIsLittleEndian.booleanValue();
|
return fIsLittleEndian.booleanValue();
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
/* (non-Javadoc)
|
/* (non-Javadoc)
|
||||||
* @see org.eclipse.cdt.debug.core.model.IExecFileInfo#getExecFile()
|
* @see org.eclipse.cdt.debug.core.model.IExecFileInfo#getExecFile()
|
||||||
*/
|
*/
|
||||||
|
@ -1454,32 +1440,29 @@ public class CDebugTarget extends CDebugElement implements ICDebugTarget, ICDIEv
|
||||||
IGlobalVariableDescriptor[] globals = new IGlobalVariableDescriptor[0];
|
IGlobalVariableDescriptor[] globals = new IGlobalVariableDescriptor[0];
|
||||||
// If the backend can give us the globals...
|
// If the backend can give us the globals...
|
||||||
boolean hasCDIGlobals = false;
|
boolean hasCDIGlobals = false;
|
||||||
ArrayList list = new ArrayList();
|
ArrayList<IGlobalVariableDescriptor> list = new ArrayList<IGlobalVariableDescriptor>();
|
||||||
if (cdiTarget instanceof ICDITarget2)
|
if (cdiTarget instanceof ICDITarget2) {
|
||||||
{
|
|
||||||
ICDIGlobalVariableDescriptor[] cdiGlobals = ((ICDITarget2) cdiTarget).getGlobalVariables();
|
ICDIGlobalVariableDescriptor[] cdiGlobals = ((ICDITarget2) cdiTarget).getGlobalVariables();
|
||||||
hasCDIGlobals = cdiGlobals != null;
|
hasCDIGlobals = cdiGlobals != null;
|
||||||
if (hasCDIGlobals)
|
if (hasCDIGlobals) {
|
||||||
{
|
|
||||||
for (int i = 0; i < cdiGlobals.length; i++) {
|
for (int i = 0; i < cdiGlobals.length; i++) {
|
||||||
list.add(CVariableFactory.createGlobalVariableDescriptor(cdiGlobals[i].getName(), null));
|
list.add(CVariableFactory.createGlobalVariableDescriptor(cdiGlobals[i].getName(), null));
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
// otherwise ask the binary
|
// otherwise ask the binary
|
||||||
if (!hasCDIGlobals)
|
if (!hasCDIGlobals) {
|
||||||
{
|
|
||||||
IBinaryObject file = getBinaryFile();
|
IBinaryObject file = getBinaryFile();
|
||||||
if (file != null) {
|
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;
|
return globals;
|
||||||
}
|
}
|
||||||
|
|
||||||
private List getCFileGlobals( IBinaryObject file ) {
|
private List<IGlobalVariableDescriptor> getCFileGlobals(IBinaryObject file) {
|
||||||
ArrayList list = new ArrayList();
|
ArrayList<IGlobalVariableDescriptor> list = new ArrayList<IGlobalVariableDescriptor>();
|
||||||
ISymbol[] symbols = file.getSymbols();
|
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) {
|
if (symbols[i].getType() == ISymbol.VARIABLE) {
|
||||||
|
@ -1555,8 +1538,7 @@ public class CDebugTarget extends CDebugElement implements ICDebugTarget, ICDIEv
|
||||||
if (cdiTarget != null) {
|
if (cdiTarget != null) {
|
||||||
cdiTarget.resume(false);
|
cdiTarget.resume(false);
|
||||||
}
|
}
|
||||||
}
|
} catch (CDIException e) {
|
||||||
catch( CDIException e ) {
|
|
||||||
if (getState() == newState) {
|
if (getState() == newState) {
|
||||||
restoreOldState();
|
restoreOldState();
|
||||||
}
|
}
|
||||||
|
@ -1629,8 +1611,7 @@ public class CDebugTarget extends CDebugElement implements ICDebugTarget, ICDIEv
|
||||||
String result = ""; //$NON-NLS-1$
|
String result = ""; //$NON-NLS-1$
|
||||||
try {
|
try {
|
||||||
result = getName();
|
result = getName();
|
||||||
}
|
} catch (DebugException e) {
|
||||||
catch( DebugException e ) {
|
|
||||||
}
|
}
|
||||||
return result;
|
return result;
|
||||||
}
|
}
|
||||||
|
@ -1794,17 +1775,17 @@ public class CDebugTarget extends CDebugElement implements ICDebugTarget, ICDIEv
|
||||||
|
|
||||||
private void changeState(CDebugElementState state) {
|
private void changeState(CDebugElementState state) {
|
||||||
setState(state);
|
setState(state);
|
||||||
Iterator it = getThreadList().iterator();
|
Iterator<CThread> it = getThreadList().iterator();
|
||||||
while (it.hasNext()) {
|
while (it.hasNext()) {
|
||||||
((CThread)it.next()).setState( state );
|
it.next().setState(state);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
protected void restoreOldState() {
|
protected void restoreOldState() {
|
||||||
restoreState();
|
restoreState();
|
||||||
Iterator it = getThreadList().iterator();
|
Iterator<CThread> it = getThreadList().iterator();
|
||||||
while (it.hasNext()) {
|
while (it.hasNext()) {
|
||||||
((CThread)it.next()).restoreState();
|
it.next().restoreState();
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -1819,8 +1800,7 @@ public class CDebugTarget extends CDebugElement implements ICDebugTarget, ICDIEv
|
||||||
if (cdiTarget != null) {
|
if (cdiTarget != null) {
|
||||||
vo = cdiTarget.getGlobalVariableDescriptors(info.getPath().lastSegment(), null, info.getName());
|
vo = cdiTarget.getGlobalVariableDescriptors(info.getPath().lastSegment(), null, info.getName());
|
||||||
}
|
}
|
||||||
}
|
} catch (CDIException e) {
|
||||||
catch( CDIException e ) {
|
|
||||||
throw new DebugException(new Status(IStatus.ERROR, CDIDebugModel.getPluginIdentifier(), DebugException.TARGET_REQUEST_FAILED, e.getMessage(), null));
|
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);
|
||||||
|
@ -1841,8 +1821,7 @@ public class CDebugTarget extends CDebugElement implements ICDebugTarget, ICDIEv
|
||||||
if (cdiTarget != null) {
|
if (cdiTarget != null) {
|
||||||
cdiTarget.setSourcePaths(list.toArray(new String[list.size()]));
|
cdiTarget.setSourcePaths(list.toArray(new String[list.size()]));
|
||||||
}
|
}
|
||||||
}
|
} catch (CDIException e) {
|
||||||
catch( CDIException e ) {
|
|
||||||
CDebugCorePlugin.log(e);
|
CDebugCorePlugin.log(e);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@ -1855,14 +1834,12 @@ public class CDebugTarget extends CDebugElement implements ICDebugTarget, ICDIEv
|
||||||
IProject project = ((ProjectSourceContainer) container).getProject();
|
IProject project = ((ProjectSourceContainer) container).getProject();
|
||||||
if (project != null && project.exists())
|
if (project != null && project.exists())
|
||||||
pathToAdd = project.getLocation().toPortableString();
|
pathToAdd = project.getLocation().toPortableString();
|
||||||
}
|
} else if (container instanceof FolderSourceContainer) {
|
||||||
if ( container instanceof FolderSourceContainer ) {
|
|
||||||
IContainer folderContainer = ((FolderSourceContainer) container).getContainer();
|
IContainer folderContainer = ((FolderSourceContainer) container).getContainer();
|
||||||
if (folderContainer != null && folderContainer.exists()) {
|
if (folderContainer != null && folderContainer.exists()) {
|
||||||
pathToAdd = folderContainer.getLocation().toPortableString();
|
pathToAdd = folderContainer.getLocation().toPortableString();
|
||||||
}
|
}
|
||||||
}
|
} if (container instanceof DirectorySourceContainer) {
|
||||||
if ( container instanceof DirectorySourceContainer ) {
|
|
||||||
File dir = ((DirectorySourceContainer) container).getDirectory();
|
File dir = ((DirectorySourceContainer) container).getDirectory();
|
||||||
if (dir != null && dir.exists()) {
|
if (dir != null && dir.exists()) {
|
||||||
IPath path = new Path(dir.getAbsolutePath());
|
IPath path = new Path(dir.getAbsolutePath());
|
||||||
|
@ -1882,8 +1859,7 @@ public class CDebugTarget extends CDebugElement implements ICDebugTarget, ICDIEv
|
||||||
if (container.isComposite()) {
|
if (container.isComposite()) {
|
||||||
try {
|
try {
|
||||||
getSourceLookupPath(list, container.getSourceContainers());
|
getSourceLookupPath(list, container.getSourceContainers());
|
||||||
}
|
} catch (CoreException e) {
|
||||||
catch( CoreException e ) {
|
|
||||||
CDebugCorePlugin.log(e.getStatus());
|
CDebugCorePlugin.log(e.getStatus());
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@ -1937,8 +1913,7 @@ public class CDebugTarget extends CDebugElement implements ICDebugTarget, ICDIEv
|
||||||
private void stopAtLocation(ICDILocation location, String stopExpression) throws DebugException {
|
private void stopAtLocation(ICDILocation location, String stopExpression) throws DebugException {
|
||||||
try {
|
try {
|
||||||
setInternalTemporaryBreakpoint(location);
|
setInternalTemporaryBreakpoint(location);
|
||||||
}
|
} catch (CoreException e) {
|
||||||
catch( CoreException e ) {
|
|
||||||
final ICDITarget cdiTarget = getCDITarget();
|
final ICDITarget cdiTarget = getCDITarget();
|
||||||
boolean isTerminated = cdiTarget != null && cdiTarget.isTerminated();
|
boolean isTerminated = cdiTarget != null && cdiTarget.isTerminated();
|
||||||
if (isTerminated) {
|
if (isTerminated) {
|
||||||
|
@ -1980,8 +1955,7 @@ public class CDebugTarget extends CDebugElement implements ICDebugTarget, ICDIEv
|
||||||
ICDILocation location = cdiTarget.createFunctionLocation("", mainSymbol); //$NON-NLS-1$
|
ICDILocation location = cdiTarget.createFunctionLocation("", mainSymbol); //$NON-NLS-1$
|
||||||
setInternalTemporaryBreakpoint(location);
|
setInternalTemporaryBreakpoint(location);
|
||||||
}
|
}
|
||||||
}
|
} catch (CoreException e) {
|
||||||
catch( CoreException e ) {
|
|
||||||
String message = MessageFormat.format(CoreModelMessages.getString("CDebugTarget.2"), new String[]{ mainSymbol, e.getStatus().getMessage() }); //$NON-NLS-1$
|
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);
|
IStatus newStatus = new Status(IStatus.WARNING, e.getStatus().getPlugin(), ICDebugInternalConstants.STATUS_CODE_QUESTION, message, null);
|
||||||
if (!CDebugUtils.question(newStatus, this)) {
|
if (!CDebugUtils.question(newStatus, this)) {
|
||||||
|
|
Loading…
Add table
Reference in a new issue