marekjm / viuavm

Parallel virtual machine designed to reliably run massively concurrent programs
https://viuavm.org/
GNU General Public License v3.0
71 stars 11 forks source link

FunctionTests.testStaticRegisters and SampleProgramsTests.testIterativeFibonacciNumbers: SIGBUS in ~CPU #72

Closed saper closed 9 years ago

saper commented 9 years ago

(Similar to https://github.com/marekjm/wudoovm/issues/71):

Script started on Sat Jul 18 19:18:31 2015
command: gdb --args ./build/bin/vm/cpu ./tests/compiled/sample_asm_functions_static_registers.asm.bin
GNU gdb 6.1.1 [FreeBSD]
Copyright 2004 Free Software Foundation, Inc.
GDB is free software, covered by the GNU General Public License, and you are
welcome to change it and/or distribute copies of it under certain conditions.
Type "show copying" to see the conditions.
There is absolutely no warranty for GDB.  Type "show warranty" for details.
This GDB was configured as "amd64-marcel-freebsd"...
(gdb) run
Starting program: /home/saper/sw/wudoovm/build/bin/vm/cpu ./tests/compiled/sample_asm_functions_static_registers.asm.bin
0
1
2
3
4
5
6
7
8
9

Program received signal SIGBUS, Bus error.
0x000000000040a7ad in std::__1::__tree_next<std::__1::__tree_node_base<void*>*> (__x=0x4395f0)
    at __tree:68
68      return __x == __x->__parent_->__left_;
(gdb) print *__x
$1 = {<std::__1::__tree_end_node<std::__1::__tree_node_base<void *> *>> = {
    __left_ = 0x10ec8348e5894855}, __right_ = 0x48f8758948f88948, __parent_ = 0x89480e8b48f8758b, 
  __is_black_ = 69}
(gdb) print __x
$2 = (std::__1::__tree_node_base<void *> *) 0x4395f0
(gdb) The program is running.  Exit anyway? (y or n) y

Script done on Sat Jul 18 19:19:51 2015
saper commented 9 years ago

Same failure with: sample_asm_iterfib.asm.bin

script /tmp/z gdb --args ./build/bin/vm/cpu ./tests/compiled/sample_asm_iterfib.asm.bin
Script started, output file is /tmp/z
GNU gdb 6.1.1 [FreeBSD]
Copyright 2004 Free Software Foundation, Inc.
GDB is free software, covered by the GNU General Public License, and you are
welcome to change it and/or distribute copies of it under certain conditions.
Type "show copying" to see the conditions.
There is absolutely no warranty for GDB.  Type "show warranty" for details.
This GDB was configured as "amd64-marcel-freebsd"...
(gdb) run
Starting program: /home/saper/sw/wudoovm/build/bin/vm/cpu ./tests/compiled/sample_asm_iterfib.asm.bin
1134903170

Program received signal SIGBUS, Bus error.
0x000000000040a7ad in std::__1::__tree_next<std::__1::__tree_node_base<void*>*> (__x=0x4395f0)
    at __tree:68
68      return __x == __x->__parent_->__left_;
(gdb) bt
#0  0x000000000040a7ad in std::__1::__tree_next<std::__1::__tree_node_base<void*>*> (__x=0x4395f0)
    at __tree:68
#1  0x0000000000409000 in ~CPU (this=0x7fffffffd538) at __tree:656
#2  0x000000000040744a in main (argc=2, argv=0x7fffffffe8a8) at src/front/cpu.cpp:148
(gdb) print __x
$1 = (std::__1::__tree_node_base<void *> *) 0x4395f0
(gdb) print *__x
$2 = {<std::__1::__tree_end_node<std::__1::__tree_node_base<void *> *>> = {
    __left_ = 0x10ec8348e5894855}, __right_ = 0x48f8758948f88948, __parent_ = 0x89480e8b48f8758b, 
  __is_black_ = 69}
saper commented 9 years ago

gdb 7.8.2 gives a bit better stacktrace:

m> script /tmp/z gdb782 --args ./build/bin/vm/cpu ./tests/compiled/sample_asm_iterfib.asm.bin
Script started, output file is /tmp/z
GNU gdb (GDB) 7.8.2 [GDB v7.8.2 for FreeBSD]
Copyright (C) 2014 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 "x86_64-portbld-freebsd10.1".
Type "show configuration" for configuration details.
For bug reporting instructions, please see:
<http://www.gnu.org/software/gdb/bugs/>.
Find the GDB manual and other documentation resources online at:
<http://www.gnu.org/software/gdb/documentation/>.
For help, type "help".
Type "apropos word" to search for commands related to "word"...
Reading symbols from ./build/bin/vm/cpu...done.
(gdb) run
Starting program: /home/saper/sw/wudoovm/build/bin/vm/cpu ./tests/compiled/sample_asm_iterfib.asm.bin
1134903170

Program received signal SIGBUS, Bus error.
0x000000000040a7ad in __tree_is_left_child<std::__1::__tree_node_base<void*>*> (__x=
    0x4395f0 <Type::repr() const>) at /usr/include/c++/v1/__tree:68
68      return __x == __x->__parent_->__left_;
(gdb) bt
#0  0x000000000040a7ad in __tree_is_left_child<std::__1::__tree_node_base<void*>*> (
    __x=0x4395f0 <Type::repr() const>) at /usr/include/c++/v1/__tree:68
#1  std::__1::__tree_next<std::__1::__tree_node_base<void*>*> (
    __x=0x4395f0 <Type::repr() const>) at /usr/include/c++/v1/__tree:159
#2  0x0000000000409000 in operator++ (this=0x7fffffffcbc8)
    at /usr/include/c++/v1/__tree:656
#3  begin (this=0x7fffffffcbc8, this=0x7fffffffcbc8, __x=..., this=0x7fffffffcbc8, 
    this=0x7fffffffcbc8, this=0x7fffffffcbc8, __y=..., __p=...)
    at /usr/include/c++/v1/map:680
#4  CPU::~CPU (this=0x7fffffffd538) at ./include/viua/cpu/cpu.h:263
#5  0x000000000040744a in main (argc=2, argv=0x7fffffffe8a8) at src/front/cpu.cpp:148
marekjm commented 9 years ago

Fixed by #74.