Rollup merge of #65369 - tmiasko:sanitizers-keep-names, r=varkor
Don't discard value names when using address or memory sanitizer The value names are used when reporting issues found by address sanitizer or memory sanitizer. Avoid discarding names when those sanitizers are enabled, unless explicitly requested to do otherwise.
This commit is contained in:
commit
77f685390c
2 changed files with 12 additions and 1 deletions
|
@ -7,7 +7,7 @@ use rustc_data_structures::fingerprint::Fingerprint;
|
|||
|
||||
use crate::lint;
|
||||
use crate::lint::builtin::BuiltinLintDiagnostics;
|
||||
use crate::session::config::{OutputType, PrintRequest, SwitchWithOptPath};
|
||||
use crate::session::config::{OutputType, PrintRequest, Sanitizer, SwitchWithOptPath};
|
||||
use crate::session::search_paths::{PathKind, SearchPath};
|
||||
use crate::util::nodemap::{FxHashMap, FxHashSet};
|
||||
use crate::util::common::{duration_to_secs_str, ErrorReported};
|
||||
|
@ -626,6 +626,14 @@ impl Session {
|
|||
.output_types
|
||||
.contains_key(&OutputType::LlvmAssembly)
|
||||
|| self.opts.output_types.contains_key(&OutputType::Bitcode);
|
||||
|
||||
// Address sanitizer and memory sanitizer use alloca name when reporting an issue.
|
||||
let more_names = match self.opts.debugging_opts.sanitizer {
|
||||
Some(Sanitizer::Address) => true,
|
||||
Some(Sanitizer::Memory) => true,
|
||||
_ => more_names,
|
||||
};
|
||||
|
||||
self.opts.debugging_opts.fewer_names || !more_names
|
||||
}
|
||||
|
||||
|
|
|
@ -24,4 +24,7 @@ endif
|
|||
|
||||
all:
|
||||
$(RUSTC) -g -Z sanitizer=address -Z print-link-args $(EXTRA_RUSTFLAG) overflow.rs | $(CGREP) librustc_asan
|
||||
# Verify that stack buffer overflow is detected:
|
||||
$(TMPDIR)/overflow 2>&1 | $(CGREP) stack-buffer-overflow
|
||||
# Verify that variable name is included in address sanitizer report:
|
||||
$(TMPDIR)/overflow 2>&1 | $(CGREP) "'xs'"
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue