1
0
Fork 0
mirror of https://github.com/eclipse-cdt/cdt synced 2025-07-31 21:05:37 +02:00

MIStack correct code style

- removed trailing whitespace
- added/removed curly braces according to cdt style
- corrected indentation using tabs only policy

Change-Id: I605f68ed47753e0486aef42049f2e7392cadf9d0
Signed-off-by: Alena Laskavaia <elaskavaia.cdt@gmail.com>
This commit is contained in:
Alena Laskavaia 2015-01-29 10:58:54 -05:00 committed by Gerrit Code Review @ Eclipse.org
parent 196d978624
commit 5df84dcfe0

View file

@ -120,9 +120,13 @@ public class MIStack extends AbstractDsfService
@Override
public int hashCode() {
int typeFactor = 0;
if (fType == Type.LOCAL) typeFactor = 2;
else if (fType == Type.ARGUMENT) typeFactor = 3;
else if (fType == Type.RETURN_VALUES) typeFactor = 4;
if (fType == Type.LOCAL) {
typeFactor = 2;
} else if (fType == Type.ARGUMENT) {
typeFactor = 3;
} else if (fType == Type.RETURN_VALUES) {
typeFactor = 4;
}
return super.baseHashCode() ^ typeFactor ^ fIndex;
}
@ -222,8 +226,7 @@ public class MIStack extends AbstractDsfService
}
@Override
protected BundleContext getBundleContext()
{
protected BundleContext getBundleContext() {
return GdbPlugin.getBundleContext();
}
@ -429,18 +432,16 @@ public class MIStack extends AbstractDsfService
@Override
public IAddress getAddress() {
String addr = getMIFrame().getAddress();
if (addr == null || addr.length() == 0) {
if (addr == null || addr.length() == 0)
return new Addr32(0);
}
if (addr.startsWith("0x")) { //$NON-NLS-1$
addr = addr.substring(2);
}
if (addr.length() <= 8) {
if (addr.length() <= 8)
return new Addr32(getMIFrame().getAddress());
} else {
else
return new Addr64(getMIFrame().getAddress());
}
}
@Override
public int getColumn() { return 0; }
@ -591,7 +592,9 @@ public class MIStack extends AbstractDsfService
// Create the variable array out of MIArg array.
MIArg[] args = getData().getMIFrames()[idx].getArgs();
if (args == null) args = new MIArg[0];
if (args == null) {
args = new MIArg[0];
}
rm.setData(makeVariableDMCs(frameDmc, MIVariableDMC.Type.ARGUMENT, args));
rm.done();
}
@ -618,7 +621,9 @@ public class MIStack extends AbstractDsfService
// Create the variable array out of MIArg array.
MIArg[] args = getData().getMIFrames()[idx].getArgs();
if (args == null) args = new MIArg[0];
if (args == null) {
args = new MIArg[0];
}
rm.setData(makeVariableDMCs(frameDmc, MIVariableDMC.Type.ARGUMENT, args));
rm.done();
}
@ -722,7 +727,6 @@ public class MIStack extends AbstractDsfService
new DataRequestMonitor<MIStackListLocalsInfo>(getExecutor(), rm) {
@Override
protected void handleSuccess() {
// Create the data object.
MIArg[] locals = getData().getLocals();
if (locals.length > miVariableDmc.fIndex) {
@ -741,7 +745,6 @@ public class MIStack extends AbstractDsfService
new DataRequestMonitor<MIStackListLocalsInfo>(getExecutor(), rm) {
@Override
protected void handleSuccess() {
// Create the data object.
MIArg[] locals = getData().getLocals();
if (locals.length > miVariableDmc.fIndex) {
@ -789,10 +792,9 @@ public class MIStack extends AbstractDsfService
private int findFrameIndex(MIFrame[] frames, int level) {
for (int idx = 0; idx < frames.length; idx++) {
if (frames[idx].getLevel() == level) {
if (frames[idx].getLevel() == level)
return idx;
}
}
return -1;
}
@ -911,8 +913,11 @@ public class MIStack extends AbstractDsfService
}
ICommand<MIStackInfoDepthInfo> depthCommand = null;
if (maxDepth > 0) depthCommand = fCommandFactory.createMIStackInfoDepth(execDmc, maxDepth);
else depthCommand = fCommandFactory.createMIStackInfoDepth(execDmc);
if (maxDepth > 0) {
depthCommand = fCommandFactory.createMIStackInfoDepth(execDmc, maxDepth);
} else {
depthCommand = fCommandFactory.createMIStackInfoDepth(execDmc);
}
fMICommandCache.execute(
depthCommand,
@ -944,10 +949,11 @@ public class MIStack extends AbstractDsfService
// being asked for the stack depth but stack frames command succeeds
// it seems like an overkill but it will cached and ui later will ask for it anyway
ICommand<MIStackListFramesInfo> listFramesCommand;
if (maxDepth <= 0)
if (maxDepth <= 0) {
listFramesCommand = fCommandFactory.createMIStackListFrames(execDmc);
else
} else {
listFramesCommand = fCommandFactory.createMIStackListFrames(execDmc, 0, maxDepth - 1);
}
fMICommandCache.execute(
listFramesCommand,
new DataRequestMonitor<MIStackListFramesInfo>(getExecutor(), rm) {
@ -958,9 +964,10 @@ public class MIStack extends AbstractDsfService
MIFrame[] miFrames = getData().getMIFrames();
int level = 0;
for (MIFrame miFrame : miFrames) {
if (miFrame.getLevel() > level)
if (miFrame.getLevel() > level) {
level = miFrame.getLevel();
}
}
// Create the data object. Depth is +1 of maximum frame level
int depth = level + 1;
fStackDepthCache.put(execDmc.getThreadId(), new StackDepthInfo(maxDepth, depth));