mirror of
https://github.com/pleonex/NitroDebugger.git
synced 2025-06-20 06:05:38 -04:00
Implemented continue execution command
This commit is contained in:
parent
dfdf5ebdb1
commit
cc85ea73fb
@ -27,6 +27,7 @@ using Moq;
|
|||||||
using Moq.Protected;
|
using Moq.Protected;
|
||||||
using NitroDebugger;
|
using NitroDebugger;
|
||||||
using System.Threading;
|
using System.Threading;
|
||||||
|
using System.Text;
|
||||||
|
|
||||||
namespace UnitTests
|
namespace UnitTests
|
||||||
{
|
{
|
||||||
@ -224,6 +225,23 @@ namespace UnitTests
|
|||||||
StopSignal reason = this.client.AskHaltedReason();
|
StopSignal reason = this.client.AskHaltedReason();
|
||||||
Assert.IsTrue(reason.HasFlag(StopSignal.HostBreak));
|
Assert.IsTrue(reason.HasFlag(StopSignal.HostBreak));
|
||||||
}
|
}
|
||||||
|
|
||||||
|
[Test]
|
||||||
|
public void ContinueExecution()
|
||||||
|
{
|
||||||
|
this.serverStream.WriteByte(RawPacket.Ack);
|
||||||
|
this.client.ContinueExecution();
|
||||||
|
string rcv = this.Read();
|
||||||
|
Assert.AreEqual("c", rcv.Substring(1, rcv.Length - 4));
|
||||||
|
}
|
||||||
|
|
||||||
|
private string Read()
|
||||||
|
{
|
||||||
|
Thread.Sleep(50);
|
||||||
|
byte[] buffer = new byte[10 * 1024];
|
||||||
|
int read = this.serverStream.Read(buffer, 0, buffer.Length);
|
||||||
|
return Encoding.ASCII.GetString(buffer, 0, read);
|
||||||
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -137,6 +137,15 @@ namespace UnitTests
|
|||||||
{
|
{
|
||||||
HaltedReasonCommand cmd = new HaltedReasonCommand();
|
HaltedReasonCommand cmd = new HaltedReasonCommand();
|
||||||
Assert.AreEqual("?", cmd.Command);
|
Assert.AreEqual("?", cmd.Command);
|
||||||
|
Assert.AreEqual("?", cmd.Pack());
|
||||||
|
}
|
||||||
|
|
||||||
|
[Test]
|
||||||
|
public void CreateContinueCommand()
|
||||||
|
{
|
||||||
|
ContinueCommand cmd = new ContinueCommand();
|
||||||
|
Assert.AreEqual("c", cmd.Command);
|
||||||
|
Assert.AreEqual("c", cmd.Pack());
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@ -50,6 +50,7 @@
|
|||||||
<Compile Include="RSP\Packets\OkReply.cs" />
|
<Compile Include="RSP\Packets\OkReply.cs" />
|
||||||
<Compile Include="RSP\Packets\HaltedReasonCommand.cs" />
|
<Compile Include="RSP\Packets\HaltedReasonCommand.cs" />
|
||||||
<Compile Include="RSP\Packets\StopSignalReply.cs" />
|
<Compile Include="RSP\Packets\StopSignalReply.cs" />
|
||||||
|
<Compile Include="RSP\Packets\ContinueCommand.cs" />
|
||||||
</ItemGroup>
|
</ItemGroup>
|
||||||
<Import Project="$(MSBuildBinPath)\Microsoft.CSharp.targets" />
|
<Import Project="$(MSBuildBinPath)\Microsoft.CSharp.targets" />
|
||||||
<ItemGroup>
|
<ItemGroup>
|
||||||
|
@ -109,6 +109,12 @@ namespace NitroDebugger.RSP
|
|||||||
return ((StopSignalReply)response).Signal.HasFlag(StopSignal.HostBreak);
|
return ((StopSignalReply)response).Signal.HasFlag(StopSignal.HostBreak);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
public void ContinueExecution()
|
||||||
|
{
|
||||||
|
ContinueCommand cont = new ContinueCommand();
|
||||||
|
this.SafeSending(cont);
|
||||||
|
}
|
||||||
|
|
||||||
private ReplyPacket SafeInterruption()
|
private ReplyPacket SafeInterruption()
|
||||||
{
|
{
|
||||||
ReplyPacket response = null;
|
ReplyPacket response = null;
|
||||||
@ -139,6 +145,8 @@ namespace NitroDebugger.RSP
|
|||||||
|
|
||||||
try {
|
try {
|
||||||
this.presentation.SendCommand(command);
|
this.presentation.SendCommand(command);
|
||||||
|
|
||||||
|
if (validReplyTypes.Length > 0)
|
||||||
response = this.presentation.ReceiveReply();
|
response = this.presentation.ReceiveReply();
|
||||||
} catch (SocketException) {
|
} catch (SocketException) {
|
||||||
error = true;
|
error = true;
|
||||||
|
39
NitroDebugger/RSP/Packets/ContinueCommand.cs
Normal file
39
NitroDebugger/RSP/Packets/ContinueCommand.cs
Normal file
@ -0,0 +1,39 @@
|
|||||||
|
//
|
||||||
|
// ContinueCommand.cs
|
||||||
|
//
|
||||||
|
// Author:
|
||||||
|
// Benito Palacios Sánchez <benito356@gmail.com>
|
||||||
|
//
|
||||||
|
// Copyright (c) 2014 Benito Palacios Sánchez
|
||||||
|
//
|
||||||
|
// This program is free software: you can redistribute it and/or modify
|
||||||
|
// it under the terms of the GNU General Public License as published by
|
||||||
|
// the Free Software Foundation, either version 3 of the License, or
|
||||||
|
// (at your option) any later version.
|
||||||
|
//
|
||||||
|
// This program is distributed in the hope that it will be useful,
|
||||||
|
// but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||||
|
// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
||||||
|
// GNU General Public License for more details.
|
||||||
|
//
|
||||||
|
// You should have received a copy of the GNU General Public License
|
||||||
|
// along with this program. If not, see <http://www.gnu.org/licenses/>.
|
||||||
|
using System;
|
||||||
|
using NitroDebugger.RSP;
|
||||||
|
|
||||||
|
namespace NitroDebugger.RSP.Packets
|
||||||
|
{
|
||||||
|
public class ContinueCommand : CommandPacket
|
||||||
|
{
|
||||||
|
public ContinueCommand()
|
||||||
|
: base("c")
|
||||||
|
{
|
||||||
|
}
|
||||||
|
|
||||||
|
protected override string PackArguments()
|
||||||
|
{
|
||||||
|
return "";
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
Loading…
Reference in New Issue
Block a user