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