On 26.11.2015 15:33, Peter Maydell wrote:
> On 25 November 2015 at 18:02, Sergey Fedorov <[email protected]> wrote:
>> The AArch32 translation completion code for singlestep enabled/active
>> case was a way more confusing and too repetitive then it needs to be.
>> Probably that was the cause for a bug to be introduced into it at some
>> point. The bug was that SWI/HVC/SMC exception would be generated in
>> condition-failed instruction code path whereas it shouldn't.
> So I did some testing, and I think this is a bug that's not actually
> really visible to Linux guests. For both QEMU's gdbstub and for gdb
> running within a system emulation, gdb for 32-bit ARM will prefer to
> do singlestep via setting breakpoints rather than trying to use the
> gdbstub's singlestep command. So while we should definitely fix it
> (and the code cleanup is nice) I think we don't need to do this for 2.5,
> and I'm going to put this on my review-for-2.6 list. Do you agree?
Sure, that's okay. I just wanted to finish this before I move on to
something else.
BTW, I used the following quick-and-dirty Perl script to do testing (it
was helpful to detect some bugs in my first attempts):
#!/usr/bin/perl
use strict;
use warnings;
use IO::Socket::INET;
our $addr = 'localhost:1234';
sub recv_pack {
my $sock = shift;
my $c = $sock->getc() || die();
if ($c eq '+') {
return $c;
}
if ($c eq '-') {
die;
}
if ($c eq '$') {
my $packet = $c;
while (($c = $sock->getc()) ne '#') {
defined($c) || die();
$packet .= $c;
}
$sock->getc();
$sock->getc();
$sock->print('+') || die();
return $packet;
}
return "";
}
sub wait_ack {
my $sock = shift;
my $pack = recv_pack($sock);
while ($pack ne "+") {
$pack = recv_pack($sock);
}
}
sub send_pack {
my $sock = shift;
my $packet = shift;
my $sum = unpack("%8C*", $packet);
$packet = '$' . $packet . '#' . sprintf("%hhx", $sum);
$sock->print($packet) || die();
wait_ack($sock);
}
our $sock = IO::Socket::INET->new($addr) || die();
our $quit = 0;
$SIG{INT} = sub { $quit = 1; };
my $nr_packets = 0;
while (!$quit) {
send_pack($sock, 's');
recv_pack($sock);
printf("\r%d packets sent", ++$nr_packets);
STDOUT->flush();
}
print("\n");
send_pack($sock, 'c');
Best regards,
Sergey