[sanitizer] use simpler symbolizer interface (GetModuleNameForPc) where applicable

git-svn-id: https://llvm.org/svn/llvm-project/compiler-rt/trunk@231337 91177308-0d34-0410-b5e6-96231b3b80d8
This commit is contained in:
Kostya Serebryany 2015-03-05 01:30:36 +00:00
parent 533f45d369
commit 80343a3361
2 changed files with 7 additions and 13 deletions

View File

@ -81,14 +81,10 @@ bool IsStackTraceSuppressed(const StackTrace *stack) {
uptr addr = stack->trace[i];
if (suppression_ctx->HasSuppressionType(kInterceptorViaLibrary)) {
const char *module_name;
uptr module_offset;
// Match "interceptor_via_lib" suppressions.
if (symbolizer->GetModuleNameAndOffsetForPC(addr, &module_name,
&module_offset) &&
suppression_ctx->Match(module_name, kInterceptorViaLibrary, &s)) {
return true;
}
if (const char *module_name = symbolizer->GetModuleNameForPc(addr))
if (suppression_ctx->Match(module_name, kInterceptorViaLibrary, &s))
return true;
}
if (suppression_ctx->HasSuppressionType(kInterceptorViaFunction)) {

View File

@ -435,13 +435,11 @@ static Suppression *GetSuppressionForAddr(uptr addr) {
Suppression *s = nullptr;
// Suppress by module name.
const char *module_name;
uptr module_offset;
SuppressionContext *suppressions = GetSuppressionContext();
if (Symbolizer::GetOrInit()->GetModuleNameAndOffsetForPC(addr, &module_name,
&module_offset) &&
suppressions->Match(module_name, kSuppressionLeak, &s))
return s;
if (const char *module_name =
Symbolizer::GetOrInit()->GetModuleNameForPc(addr))
if (suppressions->Match(module_name, kSuppressionLeak, &s))
return s;
// Suppress by file or function name.
SymbolizedStack *frames = Symbolizer::GetOrInit()->SymbolizePC(addr);