|
From: <mat...@us...> - 2012-03-23 22:01:44
|
Revision: 173
http://bugreport.svn.sourceforge.net/bugreport/?rev=173&view=rev
Author: matt_hargett
Date: 2012-03-23 22:01:33 +0000 (Fri, 23 Mar 2012)
Log Message:
-----------
Code cleanup with latest ReSharper 7.x and VS2012 build.
Modified Paths:
--------------
AbstractBufferTest.cs
AnalysisEngine.csproj
BitMath.cs
DebuggerView.cs
InvalidOpcodeException.cs
MainTest.cs
Options.cs
RegisterCollection.cs
TextUI.csproj
X86Emulator.cs
X86EmulatorTest.cs
X86Opcode.cs
X86OpcodeTest.cs
Modified: AbstractBufferTest.cs
===================================================================
--- AbstractBufferTest.cs 2009-11-15 01:00:00 UTC (rev 172)
+++ AbstractBufferTest.cs 2012-03-23 22:01:33 UTC (rev 173)
@@ -207,7 +207,7 @@
}
[Test]
- [ExpectedException(typeof(ArgumentException))]
+ [ExpectedException(typeof(ArgumentNullException))]
public void PointerUnknownOperation()
{
new AbstractBuffer(new AbstractValue[] {}).DoOperation(OperatorEffect.Unknown, null);
Modified: AnalysisEngine.csproj
===================================================================
--- AnalysisEngine.csproj 2009-11-15 01:00:00 UTC (rev 172)
+++ AnalysisEngine.csproj 2012-03-23 22:01:33 UTC (rev 173)
@@ -59,15 +59,20 @@
<FileAlignment>4096</FileAlignment>
</PropertyGroup>
<PropertyGroup Condition="'$(Configuration)|$(Platform)' == 'Debug|AnyCPU'">
- <CodeAnalysisRuleSet>Migrated rules for AnalysisEngine.ruleset</CodeAnalysisRuleSet>
+ <CodeAnalysisRuleSet>BasicDesignGuidelineRules.ruleset</CodeAnalysisRuleSet>
<CodeAnalysisRules />
<Optimize>true</Optimize>
+ <PlatformTarget>x64</PlatformTarget>
+ <ErrorReport>send</ErrorReport>
</PropertyGroup>
<PropertyGroup Condition="'$(Configuration)|$(Platform)' == 'Release|AnyCPU'">
<CodeAnalysisRuleSet>Migrated rules for AnalysisEngine.ruleset</CodeAnalysisRuleSet>
<CodeAnalysisRules />
<Optimize>true</Optimize>
</PropertyGroup>
+ <PropertyGroup>
+ <RunPostBuildEvent>OnOutputUpdated</RunPostBuildEvent>
+ </PropertyGroup>
<Import Project="$(MSBuildBinPath)\Microsoft.CSharp.Targets" />
<ItemGroup>
<Reference Include="nunit.framework">
@@ -89,16 +94,13 @@
<Compile Include="Analyzer.cs" />
<Compile Include="AnalyzerTest.cs" />
<Compile Include="BitMathTest.cs" />
- <Compile Include="Block.cs" />
<Compile Include="Contract.cs" />
<Compile Include="CoverageExcludeAttribute.cs" />
- <Compile Include="DifferenceEngineTest.cs" />
<Compile Include="DumpFileParserTest.cs" />
<Compile Include="ElfFileParser.cs" />
<Compile Include="ElfFileParserTest.cs" />
<Compile Include="GLibcStartMainContract.cs" />
<Compile Include="GLibcStartMainContractTest.cs" />
- <Compile Include="GlobalSuppressions.cs" />
<Compile Include="InvalidOpcodeException.cs" />
<Compile Include="MachineStateTest.cs" />
<Compile Include="MallocContract.cs" />
@@ -128,13 +130,6 @@
<Compile Include="X86Opcode.cs" />
</ItemGroup>
<ItemGroup>
- <None Include="Migrated rules for AnalysisEngine.ruleset" />
- <None Include="Properties\Settings.settings">
- <Generator>SettingsSingleFileGenerator</Generator>
- <LastGenOutput>Settings.Designer.cs</LastGenOutput>
- </None>
- </ItemGroup>
- <ItemGroup>
<BootstrapperPackage Include="Microsoft.Net.Client.3.5">
<Visible>False</Visible>
<ProductName>.NET Framework 3.5 SP1 Client Profile</ProductName>
@@ -151,4 +146,10 @@
<Install>true</Install>
</BootstrapperPackage>
</ItemGroup>
+ <ItemGroup>
+ <None Include="Properties\Settings.settings">
+ <Generator>SettingsSingleFileGenerator</Generator>
+ <LastGenOutput>Settings.Designer.cs</LastGenOutput>
+ </None>
+ </ItemGroup>
</Project>
\ No newline at end of file
Modified: BitMath.cs
===================================================================
--- BitMath.cs 2009-11-15 01:00:00 UTC (rev 172)
+++ BitMath.cs 2012-03-23 22:01:33 UTC (rev 173)
@@ -25,7 +25,7 @@
for (var i = 0; i < DWORD_SIZE; ++i)
{
- result |= (UInt32)data[i + index] << (8*i);
+ result |= (UInt32)data[i + index] << (8 * i);
}
return result;
Modified: DebuggerView.cs
===================================================================
--- DebuggerView.cs 2009-11-15 01:00:00 UTC (rev 172)
+++ DebuggerView.cs 2012-03-23 22:01:33 UTC (rev 173)
@@ -84,7 +84,7 @@
}
// magic numbers that happen to look good :)
- var numberOfTabs = 3 - (code.Length/3);
+ var numberOfTabs = 3 - (code.Length / 3);
for (var i = 0; i < numberOfTabs; i++)
{
Console.Write("\t");
Modified: InvalidOpcodeException.cs
===================================================================
--- InvalidOpcodeException.cs 2009-11-15 01:00:00 UTC (rev 172)
+++ InvalidOpcodeException.cs 2012-03-23 22:01:33 UTC (rev 173)
@@ -3,6 +3,7 @@
namespace bugreport
{
+ [Serializable]
public sealed class InvalidOpcodeException : Exception
{
public InvalidOpcodeException(params Byte[] code)
Modified: MainTest.cs
===================================================================
--- MainTest.cs 2009-11-15 01:00:00 UTC (rev 172)
+++ MainTest.cs 2012-03-23 22:01:33 UTC (rev 173)
@@ -51,13 +51,13 @@
var analysisProcess = new Process
{
StartInfo =
- {
- FileName = "bugreport.exe",
- Arguments = "\"" + fileName + "\"",
- RedirectStandardOutput = true,
- UseShellExecute = false,
- CreateNoWindow = false
- }
+ {
+ FileName = "bugreport.exe",
+ Arguments = "\"" + fileName + "\"",
+ RedirectStandardOutput = true,
+ UseShellExecute = false,
+ CreateNoWindow = false
+ }
};
return analysisProcess;
Modified: Options.cs
===================================================================
--- Options.cs 2009-11-15 01:00:00 UTC (rev 172)
+++ Options.cs 2012-03-23 22:01:33 UTC (rev 173)
@@ -42,21 +42,21 @@
private static String GetFunctionToAnalyzeFrom(String[] arguments)
{
- for (var i = 0; i < arguments.Length; i++)
+ foreach (var argument in arguments)
{
- if (!arguments[i].StartsWith("--function"))
+ if (!argument.StartsWith("--function"))
{
continue;
}
- var indexOfEquals = arguments[i].IndexOf('=');
+ var indexOfEquals = argument.IndexOf('=');
if (indexOfEquals == -1)
{
throw new ArgumentException("--function malformed, should be in the form of --function=name");
}
- return arguments[i].Substring(indexOfEquals + 1);
+ return argument.Substring(indexOfEquals + 1);
}
return "_start";
Modified: RegisterCollection.cs
===================================================================
--- RegisterCollection.cs 2009-11-15 01:00:00 UTC (rev 172)
+++ RegisterCollection.cs 2012-03-23 22:01:33 UTC (rev 173)
@@ -94,7 +94,7 @@
result.Append("\t");
}
- if ((i + 1)%4 == 0)
+ if ((i + 1) % 4 == 0)
{
result.Append(Environment.NewLine);
}
Modified: TextUI.csproj
===================================================================
--- TextUI.csproj 2009-11-15 01:00:00 UTC (rev 172)
+++ TextUI.csproj 2012-03-23 22:01:33 UTC (rev 173)
@@ -61,7 +61,7 @@
<FileAlignment>4096</FileAlignment>
</PropertyGroup>
<PropertyGroup Condition="'$(Configuration)|$(Platform)' == 'Debug|AnyCPU'">
- <CodeAnalysisRuleSet>Migrated rules for AnalysisEngine.ruleset</CodeAnalysisRuleSet>
+ <CodeAnalysisRuleSet>BasicCorrectnessRules.ruleset</CodeAnalysisRuleSet>
<CodeAnalysisRules />
<Optimize>true</Optimize>
</PropertyGroup>
@@ -85,6 +85,7 @@
<Compile Include="DebuggerCommand.cs" />
<Compile Include="DebuggerView.cs" />
<Compile Include="DebuggerCommandTest.cs" />
+ <Compile Include="GlobalSuppressions.cs" />
<Compile Include="Main.cs" />
<Compile Include="MainTest.cs" />
<Compile Include="OpcodeFormatter.cs" />
@@ -97,10 +98,6 @@
</ProjectReference>
</ItemGroup>
<ItemGroup>
- <None Include="app.config" />
- <None Include="Migrated rules for TextUI.ruleset" />
- </ItemGroup>
- <ItemGroup>
<BootstrapperPackage Include="Microsoft.Net.Client.3.5">
<Visible>False</Visible>
<ProductName>.NET Framework 3.5 SP1 Client Profile</ProductName>
Modified: X86Emulator.cs
===================================================================
--- X86Emulator.cs 2009-11-15 01:00:00 UTC (rev 172)
+++ X86Emulator.cs 2012-03-23 22:01:33 UTC (rev 173)
@@ -194,7 +194,7 @@
var scaledRegisterValue = state.Registers[SIB.GetScaledRegister(code)].Value;
var scaler = SIB.GetScaler(code);
baseRegisterValue = state.Registers[SIB.GetBaseRegister(code)];
- index = (Int32)(scaledRegisterValue*scaler);
+ index = (Int32)(scaledRegisterValue * scaler);
}
else
{
Modified: X86EmulatorTest.cs
===================================================================
--- X86EmulatorTest.cs 2009-11-15 01:00:00 UTC (rev 172)
+++ X86EmulatorTest.cs 2012-03-23 22:01:33 UTC (rev 173)
@@ -597,6 +597,34 @@
}
[Test]
+ public void PushESIThenPopESI()
+ {
+ var pushCode = new Byte[] {0x56};
+ var popCode = new Byte[] {0x5e};
+
+ state.Registers[RegisterName.ESI] = one;
+ state = X86Emulator.Run(reportItems, state, pushCode);
+ Assert.AreEqual(0x1, state.InstructionPointer);
+ state.Registers[RegisterName.ESI] = null;
+ state = X86Emulator.Run(reportItems, state, popCode);
+ Assert.AreEqual(0x2, state.InstructionPointer);
+ Assert.AreEqual(one, state.Registers[RegisterName.ESI]);
+ }
+
+ [Test]
+ public void PushESPThenPopESP()
+ {
+ var pushCode = new Byte[] {0x54};
+ var popCode = new Byte[] {0x5c};
+ state = X86Emulator.Run(reportItems, state, pushCode);
+
+ Assert.AreEqual(0x1, state.InstructionPointer);
+ state = X86Emulator.Run(reportItems, state, popCode);
+ Assert.AreEqual(0x2, state.InstructionPointer);
+ Assert.AreEqual(state.Registers[RegisterName.ESP], state.Registers[RegisterName.ESP]);
+ }
+
+ [Test]
public void PushEbpThenPopEbp()
{
var pushCode = new Byte[] {0x55};
@@ -667,34 +695,6 @@
}
[Test]
- public void PushESIThenPopESI()
- {
- var pushCode = new Byte[] {0x56};
- var popCode = new Byte[] {0x5e};
-
- state.Registers[RegisterName.ESI] = one;
- state = X86Emulator.Run(reportItems, state, pushCode);
- Assert.AreEqual(0x1, state.InstructionPointer);
- state.Registers[RegisterName.ESI] = null;
- state = X86Emulator.Run(reportItems, state, popCode);
- Assert.AreEqual(0x2, state.InstructionPointer);
- Assert.AreEqual(one, state.Registers[RegisterName.ESI]);
- }
-
- [Test]
- public void PushESPThenPopESP()
- {
- var pushCode = new Byte[] {0x54};
- var popCode = new Byte[] {0x5c};
- state = X86Emulator.Run(reportItems, state, pushCode);
-
- Assert.AreEqual(0x1, state.InstructionPointer);
- state = X86Emulator.Run(reportItems, state, popCode);
- Assert.AreEqual(0x2, state.InstructionPointer);
- Assert.AreEqual(state.Registers[RegisterName.ESP], state.Registers[RegisterName.ESP]);
- }
-
- [Test]
public void PushIzThenPopEbp()
{
var pushCode = new Byte[] {0x68, 0x10, 0x84, 0x04, 0x08};
Modified: X86Opcode.cs
===================================================================
--- X86Opcode.cs 2009-11-15 01:00:00 UTC (rev 172)
+++ X86Opcode.cs 2012-03-23 22:01:33 UTC (rev 173)
@@ -9,7 +9,7 @@
namespace bugreport
{
/// <summary>
- /// Based on table at http://sandpile.org/ia32/opc_1.htm
+ /// Based on table at http://sandpile.org/ia32/opc_1.htm
/// </summary>
public sealed class X86Opcode : Opcode
{
@@ -164,7 +164,8 @@
default:
{
- throw new NotImplementedException("Don't know how to get the immediate for this opcode: " + code[0]);
+ throw new NotImplementedException("Don't know how to get the immediate for this opcode: " +
+ code[0]);
}
}
}
Modified: X86OpcodeTest.cs
===================================================================
--- X86OpcodeTest.cs 2009-11-15 01:00:00 UTC (rev 172)
+++ X86OpcodeTest.cs 2012-03-23 22:01:33 UTC (rev 173)
@@ -505,6 +505,27 @@
}
[Test]
+ [ExpectedException(typeof(InvalidOpcodeException))]
+ public void UnknownOpcode()
+ {
+ code = new Byte[] {0xf0, 0x00};
+ opcode.GetEncodingFor(code);
+ }
+
+ [Test]
+ public void XorEvGv()
+ {
+ // xor EBP,EBP
+ code = new Byte[] {0x31, 0xed};
+ Assert.AreEqual(code.Length, opcode.GetInstructionLengthFor(code));
+ encoding = opcode.GetEncodingFor(code);
+ Assert.AreEqual(OpcodeEncoding.EvGv, encoding);
+ Assert.AreEqual(OperatorEffect.Xor, opcode.GetOperatorEffectFor(code));
+ Assert.AreEqual(RegisterName.EBP, opcode.GetDestinationRegisterFor(code));
+ Assert.AreEqual(RegisterName.EBP, opcode.GetSourceRegisterFor(code));
+ }
+
+ [Test]
public void rAxIv()
{
code = new Byte[] {0xb8, 0x00, 0x00, 0x00, 0x00};
@@ -537,26 +558,5 @@
var operatorEffect = opcode.GetOperatorEffectFor(code);
Assert.AreEqual(OperatorEffect.Assignment, operatorEffect);
}
-
- [Test]
- [ExpectedException(typeof(InvalidOpcodeException))]
- public void UnknownOpcode()
- {
- code = new Byte[] {0xf0, 0x00};
- opcode.GetEncodingFor(code);
- }
-
- [Test]
- public void XorEvGv()
- {
- // xor EBP,EBP
- code = new Byte[] {0x31, 0xed};
- Assert.AreEqual(code.Length, opcode.GetInstructionLengthFor(code));
- encoding = opcode.GetEncodingFor(code);
- Assert.AreEqual(OpcodeEncoding.EvGv, encoding);
- Assert.AreEqual(OperatorEffect.Xor, opcode.GetOperatorEffectFor(code));
- Assert.AreEqual(RegisterName.EBP, opcode.GetDestinationRegisterFor(code));
- Assert.AreEqual(RegisterName.EBP, opcode.GetSourceRegisterFor(code));
- }
}
}
\ No newline at end of file
This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site.
|