mirror of
https://github.com/verilator/verilator.git
synced 2025-01-06 06:37:45 +00:00
Add --asan option that enables address sanitizer to the test driver (#2700)
* Experimentally add --vltasan which enables address sanitizer Co-authored-by: Wilson Snyder <wsnyder@wsnyder.org>
This commit is contained in:
parent
7821da6ad5
commit
176cc5a196
@ -69,6 +69,7 @@ our $Vltmt_threads = 3;
|
||||
$Debug = 0;
|
||||
my $opt_benchmark;
|
||||
my @opt_tests;
|
||||
my $opt_asan;
|
||||
my $opt_dist;
|
||||
my $opt_gdb;
|
||||
my $opt_rr;
|
||||
@ -92,6 +93,7 @@ our @Opt_Driver_Verilator_Flags;
|
||||
|
||||
Getopt::Long::config("pass_through");
|
||||
if (! GetOptions(
|
||||
"asan!" => \$opt_asan,
|
||||
"benchmark:i" => sub { $opt_benchmark = $_[1] ? $_[1] : 1; },
|
||||
"debug" => \&debug,
|
||||
#debugi see parameter()
|
||||
@ -878,6 +880,7 @@ sub compile_vlt_flags {
|
||||
unshift @verilator_flags, "--trace-threads 1" if $param{vltmt} && $checkflags =~ /-trace /;
|
||||
unshift @verilator_flags, "--trace-threads 2" if $param{vltmt} && $checkflags =~ /-trace-fst /;
|
||||
unshift @verilator_flags, "--debug-partition" if $param{vltmt};
|
||||
unshift @verilator_flags, "-CFLAGS -fsanitize=address -LDFLAGS -fsanitize=address" if $opt_asan;
|
||||
unshift @verilator_flags, "--make gmake" if $param{verilator_make_gmake};
|
||||
unshift @verilator_flags, "--make cmake" if $param{verilator_make_cmake};
|
||||
unshift @verilator_flags, "--exe" if
|
||||
@ -2599,6 +2602,12 @@ output.
|
||||
|
||||
=over 4
|
||||
|
||||
=item --asan
|
||||
|
||||
Enable address sanitizer to compile Verilated C++ code.
|
||||
This may detect misuses of memory, such as out-of-bound accesses, use-after-free,
|
||||
and memory leaks.
|
||||
|
||||
=item --benchmark [<cycles>]
|
||||
|
||||
Show execution times of each step. If an optional number is given,
|
||||
|
Loading…
Reference in New Issue
Block a user