Re: ARAnyM VMs with Debian hanging at 100% CPU usage
Hi again,
I’ve got a reduced testcase now.
For the record, on i386 Kubuntu Hardy, it works:
tglase@tglase:~ $ ./t
old: 12345678
new: 12345679
On Debian/m68k, this freezes the VM so hard that
not even the “Enter” keypress after “si” ends up
being echo’d. (Not single-stepping is the same.)
Full GNU screen log attached, for the curious.
Ideas and info how to further debug this (now we
are entering territory unknown to me) welcome.
bye,
//mirabilos
--
> Hi, does anyone sell openbsd stickers by themselves and not packaged
> with other products?
No, the only way I've seen them sold is for $40 with a free OpenBSD CD.
-- Haroon Khalid and Steve Shockley in gmane.os.openbsd.misc
root@aranym:~ # cat t.c
#include <stdio.h>
volatile int ctr = 0x12345678;
int
main(void)
{
printf("old: %08X\n", ctr); fflush(NULL);
__sync_add_and_fetch(&ctr, 1);
printf("new: %08X\n", ctr); fflush(NULL);
return (0);
}
root@aranym:~ # gcc -O2 -g3 -Wall -o t t.c
root@aranym:~ # gdb ./t
GNU gdb (GDB) 7.4.1-debian
Copyright (C) 2012 Free Software Foundation, Inc.
License GPLv3+: GNU GPL version 3 or later <http://gnu.org/licenses/gpl.html>
This is free software: you are free to change and redistribute it.
There is NO WARRANTY, to the extent permitted by law. Type "show copying"
and "show warranty" for details.
This GDB was configured as "m68k-linux-gnu".
For bug reporting instructions, please see:
<http://www.gnu.org/software/gdb/bugs/>...
Reading symbols from /root/t...done.
(gdb) b main
Breakpoint 1 at 0x80000388: file t.c, line 8.
(gdb)
[K(gdb) r
Starting program: /root/t
Breakpoint 1, main () at t.c:8
8 printf("old: %08X\n", ctr); fflush(NULL);
(gdb) s
old: 12345678
9 __sync_add_and_fetch(&ctr, 1);
(gdb) disas
Dump of assembler code for function main:
0x80000380 <+0>: linkw %fp,#0
0x80000384 <+4>: movel %a3,%sp@-
0x80000386 <+6>: movel %a2,%sp@-
0x80000388 <+8>: movel 0x80003bc0 <ctr>,%d0
0x8000038e <+14>: movel %d0,%sp@-
0x80000390 <+16>: pea 0x800012ae
0x80000396 <+22>: lea 0x80000330 <printf@plt>,%a3
0x8000039c <+28>: jsr %a3@
0x8000039e <+30>: clrl %sp@-
0x800003a0 <+32>: lea 0x80000344 <fflush@plt>,%a2
0x800003a6 <+38>: jsr %a2@
=> 0x800003a8 <+40>: pea 0x1
0x800003ac <+44>: pea 0x80003bc0 <ctr>
0x800003b2 <+50>: jsr 0x80000a16 <__sync_add_and_fetch_4>
---Type <return> to continue, or q <return> to quit---q
Quit
(gdb) si
0x800003ac 9 __sync_add_and_fetch(&ctr, 1);
(gdb) si
0x800003b2 9 __sync_add_and_fetch(&ctr, 1);
(gdb) disas
Dump of assembler code for function main:
0x80000380 <+0>: linkw %fp,#0
0x80000384 <+4>: movel %a3,%sp@-
0x80000386 <+6>: movel %a2,%sp@-
0x80000388 <+8>: movel 0x80003bc0 <ctr>,%d0
0x8000038e <+14>: movel %d0,%sp@-
0x80000390 <+16>: pea 0x800012ae
0x80000396 <+22>: lea 0x80000330 <printf@plt>,%a3
0x8000039c <+28>: jsr %a3@
0x8000039e <+30>: clrl %sp@-
0x800003a0 <+32>: lea 0x80000344 <fflush@plt>,%a2
0x800003a6 <+38>: jsr %a2@
0x800003a8 <+40>: pea 0x1
0x800003ac <+44>: pea 0x80003bc0 <ctr>
=> 0x800003b2 <+50>: jsr 0x80000a16 <__sync_add_and_fetch_4>
---Type <return> to continue, or q <return> to quit---q
Quit
(gdb) si
0x80000a16 in __sync_add_and_fetch_4 ()
(gdb) disas
Dump of assembler code for function __sync_add_and_fetch_4:
=> 0x80000a16 <+0>: linkw %fp,#0
0x80000a1a <+4>: moveml %d2-%d4/%a2,%sp@-
0x80000a1e <+8>: moveal %fp@(8),%a2
0x80000a22 <+12>: movel %fp@(12),%d4
0x80000a26 <+16>: movel %a2@,%d2
0x80000a28 <+18>: movel %d2,%d3
0x80000a2a <+20>: addl %d4,%d3
0x80000a2c <+22>: moveal %a2,%a0
0x80000a2e <+24>: movel %d3,%d1
0x80000a30 <+26>: movel #335,%d0
0x80000a36 <+32>: trap #0
0x80000a38 <+34>: cmpl %d2,%d0
0x80000a3a <+36>: bnes 0x80000a46 <__sync_add_and_fetch_4+48>
0x80000a3c <+38>: movel %d3,%d0
---Type <return> to continue, or q <return> to quit---q
Quit
(gdb) si
0x80000a1a in __sync_add_and_fetch_4 ()
(gdb)
0x80000a1e in __sync_add_and_fetch_4 ()
(gdb)
0x80000a22 in __sync_add_and_fetch_4 ()
(gdb)
0x80000a26 in __sync_add_and_fetch_4 ()
(gdb)
0x80000a28 in __sync_add_and_fetch_4 ()
(gdb)
0x80000a2a in __sync_add_and_fetch_4 ()
(gdb)
0x80000a2c in __sync_add_and_fetch_4 ()
(gdb)
0x80000a2e in __sync_add_and_fetch_4 ()
(gdb)
0x80000a30 in __sync_add_and_fetch_4 ()
(gdb)
0x80000a36 in __sync_add_and_fetch_4 ()
(gdb) info r
d0 0x14f 335
d1 0x12345679 305419897
d2 0x12345678 305419896
d3 0x12345679 305419897
d4 0x1 1
d5 0xd004eeec -804983060
d6 0xd004edec -804983316
d7 0xc 12
a0 0x80003bc0 0x80003bc0
a1 0xc014b7f4 0xc014b7f4
a2 0x80003bc0 0x80003bc0
a3 0x80000330 0x80000330
a4 0x800003dc 0x800003dc
a5 0xc0148000 0xc0148000
fp 0xefa3cb60 0xefa3cb60
---Type <return> to continue, or q <return> to quit---
sp 0xefa3cb50 0xefa3cb50
ps 0x8300 [ I0 I1 T1 ]
pc 0x80000a36 0x80000a36 <__sync_add_and_fetch_4+32>
fpcontrol 0x0 0
fpstatus 0x0 0
fpiaddr 0x0 0
(gdb) si
Reply to: