mirror of
https://github.com/eclipse-cdt/cdt
synced 2025-04-22 14:12:10 +02:00
Bug 379225: Address FindBugs issues for DSF-GDB
Change-Id: Id0bb91c7aaef0e356d1989e1dc949542813d2309
This commit is contained in:
parent
be16270d15
commit
a66ccee4f0
2 changed files with 32 additions and 16 deletions
|
@ -243,6 +243,20 @@ public class MIBreakpointDMData implements IBreakpointDMData {
|
||||||
return (fNature == other.fNature) && (fProperties.equals(other.fProperties));
|
return (fNature == other.fNature) && (fProperties.equals(other.fProperties));
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public boolean equals(Object other) {
|
||||||
|
if (this == other) return true;
|
||||||
|
if (!(other instanceof MIBreakpointDMData)) return false;
|
||||||
|
MIBreakpointDMData bpData = (MIBreakpointDMData)other;
|
||||||
|
|
||||||
|
return (fNature == bpData.fNature) && (fProperties.equals(bpData.fProperties));
|
||||||
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public int hashCode() {
|
||||||
|
return fNature.hashCode() ^ fProperties.hashCode();
|
||||||
|
}
|
||||||
|
|
||||||
///////////////////////////////////////////////////////////////////////////
|
///////////////////////////////////////////////////////////////////////////
|
||||||
// IBreakpointDMData
|
// IBreakpointDMData
|
||||||
///////////////////////////////////////////////////////////////////////////
|
///////////////////////////////////////////////////////////////////////////
|
||||||
|
|
|
@ -283,14 +283,7 @@ public abstract class AbstractMIControl extends AbstractDsfService
|
||||||
/*
|
/*
|
||||||
* Now go through the commands which are outstanding in that they have been sent to the backend.
|
* Now go through the commands which are outstanding in that they have been sent to the backend.
|
||||||
*/
|
*/
|
||||||
synchronized(fRxCommands) {
|
cancelRxCommands();
|
||||||
for (CommandHandle commandHandle : fRxCommands.values()) {
|
|
||||||
if (commandHandle.getRequestMonitor() == null) continue;
|
|
||||||
commandHandle.getRequestMonitor().setStatus(genStatus( "Connection is shut down")); //$NON-NLS-1$
|
|
||||||
commandHandle.getRequestMonitor().done();
|
|
||||||
}
|
|
||||||
fRxCommands.clear();
|
|
||||||
}
|
|
||||||
|
|
||||||
/*
|
/*
|
||||||
* Now handle any requests which have not been transmitted, but weconsider them handed off.
|
* Now handle any requests which have not been transmitted, but weconsider them handed off.
|
||||||
|
@ -307,6 +300,15 @@ public abstract class AbstractMIControl extends AbstractDsfService
|
||||||
fTxCommands.add(fTerminatorHandle);
|
fTxCommands.add(fTerminatorHandle);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
private synchronized void cancelRxCommands() {
|
||||||
|
for (CommandHandle commandHandle : fRxCommands.values()) {
|
||||||
|
if (commandHandle.getRequestMonitor() == null) continue;
|
||||||
|
commandHandle.getRequestMonitor().setStatus(genStatus( "Connection is shut down")); //$NON-NLS-1$
|
||||||
|
commandHandle.getRequestMonitor().done();
|
||||||
|
}
|
||||||
|
fRxCommands.clear();
|
||||||
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Queues the given MI command to be sent to the debugger back end.
|
* Queues the given MI command to be sent to the debugger back end.
|
||||||
*
|
*
|
||||||
|
@ -621,10 +623,6 @@ public abstract class AbstractMIControl extends AbstractDsfService
|
||||||
while (true) {
|
while (true) {
|
||||||
CommandHandle commandHandle = null;
|
CommandHandle commandHandle = null;
|
||||||
|
|
||||||
/*
|
|
||||||
* Note: Acquiring locks for both fRxCommands and fTxCommands collections.
|
|
||||||
*/
|
|
||||||
synchronized(fTxCommands) {
|
|
||||||
try {
|
try {
|
||||||
commandHandle = fTxCommands.take();
|
commandHandle = fTxCommands.take();
|
||||||
} catch (InterruptedException e) {
|
} catch (InterruptedException e) {
|
||||||
|
@ -632,7 +630,12 @@ public abstract class AbstractMIControl extends AbstractDsfService
|
||||||
}
|
}
|
||||||
|
|
||||||
if (commandHandle == fTerminatorHandle) {
|
if (commandHandle == fTerminatorHandle) {
|
||||||
|
// There is a small possibility that a new command was inserted
|
||||||
|
// in the fRxCommands map after we cleared that map.
|
||||||
|
// Just to be safe, clear it again.
|
||||||
|
// We do this to avoid synchronizing the handling of fRxCommands
|
||||||
|
// because this is more efficient, as it happens only once at shutdown.
|
||||||
|
cancelRxCommands();
|
||||||
break; // Null command is an indicator that we're shutting down.
|
break; // Null command is an indicator that we're shutting down.
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -643,7 +646,6 @@ public abstract class AbstractMIControl extends AbstractDsfService
|
||||||
// RawCommands will not get an answer, so we cannot put them in the receive queue.
|
// RawCommands will not get an answer, so we cannot put them in the receive queue.
|
||||||
fRxCommands.put(commandHandle.getTokenId(), commandHandle);
|
fRxCommands.put(commandHandle.getTokenId(), commandHandle);
|
||||||
}
|
}
|
||||||
}
|
|
||||||
|
|
||||||
/*
|
/*
|
||||||
* Construct the new command and push this command out the pipeline.
|
* Construct the new command and push this command out the pipeline.
|
||||||
|
|
Loading…
Add table
Reference in a new issue