3
0
mirror of https://github.com/pragma-/pbot.git synced 2024-12-23 11:12:42 +01:00

modules/compiler_vm: ASAN now works

This commit is contained in:
Pragmatic Software 2021-10-19 21:03:34 -07:00
parent abd6abcc6c
commit 9a01b1c433
2 changed files with 10 additions and 2 deletions

View File

@ -14,7 +14,7 @@ sub initialize {
$self->{sourcefile} = 'prog.c';
$self->{execfile} = 'prog';
$self->{default_options} = '-Wextra -Wall -Wno-unused -pedantic -Wfloat-equal -Wshadow -std=c11 -lm -Wfatal-errors -fsanitize=alignment,undefined';
$self->{default_options} = '-Wextra -Wall -Wno-unused -pedantic -Wfloat-equal -Wshadow -std=c11 -lm -Wfatal-errors -fsanitize=alignment,undefined -fsanitize-address-use-after-scope -fno-omit-frame-pointer';
$self->{options_paste} = '-fdiagnostics-show-caret';
$self->{options_nopaste} = '-fno-diagnostics-show-caret';
$self->{cmdline} = 'gcc -ggdb -g3 $sourcefile $options -o $execfile';

View File

@ -79,7 +79,15 @@ sub postprocess {
print "Executing gdb\n";
my @args = $self->split_line($self->{arguments}, strip_quotes => 1, preserve_escapes => 0);
my ($exitval, $stdout, $stderr) = $self->execute(60, undef, 'compiler_watchdog.pl', @args);
my ($exitval, $stdout, $stderr);
if ($self->{cmdline} =~ /-fsanitize=(?:[^ ]+,)?address/) {
# leak sanitizer doesn't work under ptrace/gdb
# ASAN_OPTIONS=strict_string_checks=1:detect_stack_use_after_return=1:check_initialization_order=1:strict_init_order=1
($exitval, $stdout, $stderr) = $self->execute(60, undef, './prog', @args);
} else {
($exitval, $stdout, $stderr) = $self->execute(60, undef, 'compiler_watchdog.pl', @args);
}
my $result = $stderr;
$result .= ' ' if length $result;