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

Non-existent file causes coredump in loader #79

Closed saper closed 9 years ago

saper commented 9 years ago

For example:

$ gdb --args ./build/bin/vm/dis aaaa
GNU gdb (Gentoo 7.5.1 p2) 7.5.1
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 "x86_64-pc-linux-gnu".
For bug reporting instructions, please see:
<http://bugs.gentoo.org/>...
Reading symbols from /usr/home/saper/git/wudoovm/build/bin/vm/dis...done.
(gdb) run
Starting program: /usr/home/saper/git/wudoovm/build/bin/vm/dis aaaa
warning: no loadable sections found in added symbol-file system-supplied DSO at 0x7ffff7ffa000
warning: Could not load shared library symbols for linux-vdso.so.1.
Do you need "set solib-search-path" or "set sysroot"?
terminate called after throwing an instance of 'std::string'

Program received signal SIGABRT, Aborted.
0x00007ffff72cba95 in raise () from /lib64/libc.so.6
(gdb) bt
#0  0x00007ffff72cba95 in raise () from /lib64/libc.so.6
#1  0x00007ffff72ccf91 in abort () from /lib64/libc.so.6
#2  0x00007ffff7b37685 in __gnu_cxx::__verbose_terminate_handler() ()
   from /usr/lib/gcc/x86_64-pc-linux-gnu/4.8.4/libstdc++.so.6
#3  0x00007ffff7b35826 in __cxxabiv1::__terminate(void (*)()) ()
   from /usr/lib/gcc/x86_64-pc-linux-gnu/4.8.4/libstdc++.so.6
#4  0x00007ffff7b35853 in std::terminate() ()
   from /usr/lib/gcc/x86_64-pc-linux-gnu/4.8.4/libstdc++.so.6
#5  0x00007ffff7b35a72 in __cxa_throw ()
   from /usr/lib/gcc/x86_64-pc-linux-gnu/4.8.4/libstdc++.so.6
#6  0x000000000040e56b in Loader::executable (this=0x7fffffffdc90) at src/loader.cpp:130
#7  0x00000000004029a8 in main (argc=2, argv=0x7fffffffe338) at src/front/dis.cpp:115
(gdb) 
marekjm commented 9 years ago

The coredump has not been inside loader, but in the disassembler frontend. Loader correctly detected it couldn't open a file and was throwing an exception - which I did not catch in disassembler.

saper commented 9 years ago

The coredump has not been inside loader, but in the disassembler frontend. Loader correctly detected it couldn't open a file and was throwing an exception - which I did not catch in disassembler.

Close, but no cigar :)

The same problem is in other command-line utilities ...

marekjm commented 9 years ago

Should be OK now. That was some sloppy coding :-/

saper commented 9 years ago

Yep, thanks!