From 65bce588e4e70fe8fd9ef350e91167e3b02f99ba Mon Sep 17 00:00:00 2001 From: Wilson Snyder Date: Fri, 24 Dec 2010 13:15:46 -0500 Subject: [PATCH] Add fatalSrc debug dump check --- src/V3Options.cpp | 5 +++-- test_regress/t/t_debug_fatalsrc_bad.pl | 22 ++++++++++++++++++++++ test_regress/t/t_debug_fatalsrc_bt_bad.pl | 21 +++++++++++++++++++++ test_regress/t/t_debug_sigsegv_bad.pl | 2 +- test_regress/t/t_debug_sigsegv_bt_bad.pl | 21 +++++++++++++++++++++ 5 files changed, 68 insertions(+), 3 deletions(-) create mode 100755 test_regress/t/t_debug_fatalsrc_bad.pl create mode 100755 test_regress/t/t_debug_fatalsrc_bt_bad.pl create mode 100755 test_regress/t/t_debug_sigsegv_bt_bad.pl diff --git a/src/V3Options.cpp b/src/V3Options.cpp index b6ddae2ea..0fa7df808 100644 --- a/src/V3Options.cpp +++ b/src/V3Options.cpp @@ -622,9 +622,10 @@ void V3Options::parseOptsList(FileLine* fl, const string& optdir, int argc, char else if ( onoff (sw, "-coverage-underscore", flag/*ref*/) ){ m_coverageUnderscore = flag; } else if ( onoff (sw, "-coverage-user", flag/*ref*/) ){ m_coverageUser = flag; } else if ( onoff (sw, "-covsp", flag/*ref*/) ) { } // TBD - else if ( !strcmp (sw, "-debug-abort") ) { abort(); } // Undocumented, see also --debug-core-dump + else if ( !strcmp (sw, "-debug-abort") ) { abort(); } // Undocumented, see also --debug-sigsegv else if ( onoff (sw, "-debug-check", flag/*ref*/) ){ m_debugCheck = flag; } - else if ( !strcmp (sw, "-debug-core-dump") ) { char* zp=NULL; *zp=0; } // Undocumented, see also --debug-abort + else if ( !strcmp (sw, "-debug-sigsegv") ) { char* zp=NULL; *zp=0; } // Undocumented, see also --debug-abort + else if ( !strcmp (sw, "-debug-fatalsrc") ) { v3fatalSrc("--debug-fatal-src"); } // Undocumented, see also --debug-abort else if ( onoff (sw, "-dump-tree", flag/*ref*/) ) { m_dumpTree = flag; } else if ( onoff (sw, "-exe", flag/*ref*/) ) { m_exe = flag; } else if ( onoff (sw, "-ignc", flag/*ref*/) ) { m_ignc = flag; } diff --git a/test_regress/t/t_debug_fatalsrc_bad.pl b/test_regress/t/t_debug_fatalsrc_bad.pl new file mode 100755 index 000000000..3cee656fa --- /dev/null +++ b/test_regress/t/t_debug_fatalsrc_bad.pl @@ -0,0 +1,22 @@ +#!/usr/bin/perl +if (!$::Driver) { use FindBin; exec("$FindBin::Bin/bootstrap.pl", @ARGV, $0); die; } +# DESCRIPTION: Verilator: Verilog Test driver/expect definition +# +# Copyright 2003 by Wilson Snyder. This program is free software; you can +# redistribute it and/or modify it under the terms of either the GNU +# Lesser General Public License Version 3 or the Perl Artistic License +# Version 2.0. + +$Self->{vlt} or $Self->skip("Verilator only test"); + +compile ( + v_flags2 => ["--debug-fatalsrc"], + fails=>$Self->{v3}, + expect=> +'%Error: Internal Error: .*: --debug-fatal-src +%Error: Internal Error: See the manual and http://www.veripool.org/verilator for more assistance. +%Error: Command Failed.*', + ); + +ok(1); +1; diff --git a/test_regress/t/t_debug_fatalsrc_bt_bad.pl b/test_regress/t/t_debug_fatalsrc_bt_bad.pl new file mode 100755 index 000000000..dabacdc98 --- /dev/null +++ b/test_regress/t/t_debug_fatalsrc_bt_bad.pl @@ -0,0 +1,21 @@ +#!/usr/bin/perl +if (!$::Driver) { use FindBin; exec("$FindBin::Bin/bootstrap.pl", @ARGV, $0); die; } +# DESCRIPTION: Verilator: Verilog Test driver/expect definition +# +# Copyright 2010 by Wilson Snyder. This program is free software; you can +# redistribute it and/or modify it under the terms of either the GNU +# Lesser General Public License Version 3 or the Perl Artistic License +# Version 2.0. + +compile ( + v_flags2 => ["--lint-only --debug --gdbbt --debug-fatalsrc"], + fails=>$Self->{v3}, + expect=> +'%Error: Internal Error: .*: --debug-fatal-src +%Error: Internal Error: See the manual and http://www.veripool.org/verilator for more assistance. +.*in V3Options::.* +.*%Error: Command Failed.*', + ); + +ok(1); +1; diff --git a/test_regress/t/t_debug_sigsegv_bad.pl b/test_regress/t/t_debug_sigsegv_bad.pl index 7e15d231e..65a56e933 100755 --- a/test_regress/t/t_debug_sigsegv_bad.pl +++ b/test_regress/t/t_debug_sigsegv_bad.pl @@ -10,7 +10,7 @@ if (!$::Driver) { use FindBin; exec("$FindBin::Bin/bootstrap.pl", @ARGV, $0); di $Self->{vlt} or $Self->skip("Verilator only test"); compile ( - v_flags2 => ["--debug-core-dump"], + v_flags2 => ["--debug-sigsegv"], fails=>$Self->{v3}, expect=> '%Error: Verilator internal fault, sorry. Consider trying --debug --gdbbt diff --git a/test_regress/t/t_debug_sigsegv_bt_bad.pl b/test_regress/t/t_debug_sigsegv_bt_bad.pl new file mode 100755 index 000000000..206685e59 --- /dev/null +++ b/test_regress/t/t_debug_sigsegv_bt_bad.pl @@ -0,0 +1,21 @@ +#!/usr/bin/perl +if (!$::Driver) { use FindBin; exec("$FindBin::Bin/bootstrap.pl", @ARGV, $0); die; } +# DESCRIPTION: Verilator: Verilog Test driver/expect definition +# +# Copyright 2010 by Wilson Snyder. This program is free software; you can +# redistribute it and/or modify it under the terms of either the GNU +# Lesser General Public License Version 3 or the Perl Artistic License +# Version 2.0. + +compile ( + v_flags2 => ["--lint-only --debug --gdbbt --debug-sigsegv"], + fails=>$Self->{v3}, + expect=> +'.* +Program received signal SIGSEGV, Segmentation fault. +.*in V3Options::.* +.*%Error: Command Failed.*', + ); + +ok(1); +1;