ParseFlag(str, &f->num_callers, "num_callers");
ParseFlag(str, &f->report_umrs, "report_umrs");
ParseFlag(str, &f->verbosity, "verbosity");
+ ParseFlag(str, &f->strip_path_prefix, "strip_path_prefix");
}
static void InitializeFlags(Flags *f, const char *options) {
f->num_callers = 20;
f->report_umrs = true;
f->verbosity = 0;
+ f->strip_path_prefix = "";
ParseFlagsFromString(f, options);
}
#include "sanitizer_common/sanitizer_mutex.h"
#include "sanitizer_common/sanitizer_report_decorator.h"
#include "sanitizer_common/sanitizer_stackdepot.h"
+#include "sanitizer_common/sanitizer_symbolizer.h"
using namespace __sanitizer;
const uptr *trace = StackDepotGet(origin, &size);
Printf(" %sUninitialised value was created by a heap allocation%s\n",
d.Origin(), d.End());
- StackTrace::PrintStack(trace, size, true, "", 0);
+ StackTrace::PrintStack(trace, size, true, flags()->strip_path_prefix, 0);
}
}
+static void ReportSummary(const char *error_type, StackTrace *stack) {
+ if (!stack->size || !IsSymbolizerAvailable()) return;
+ AddressInfo ai;
+ SymbolizeCode(stack->trace[0], &ai, 1);
+ ReportErrorSummary(error_type,
+ StripPathPrefix(ai.file, flags()->strip_path_prefix),
+ ai.line, ai.function);
+}
+
void ReportUMR(StackTrace *stack, u32 origin) {
if (!__msan::flags()->report_umrs) return;
Printf("%s", d.Warning());
Report(" WARNING: Use of uninitialized value\n");
Printf("%s", d.End());
- StackTrace::PrintStack(stack->trace, stack->size, true, "", 0);
+ StackTrace::PrintStack(stack->trace, stack->size, true,
+ flags()->strip_path_prefix, 0);
if (origin) {
DescribeOrigin(origin);
}
+ ReportSummary("use-of-uninitialized-value", stack);
}
void ReportExpectedUMRNotFound(StackTrace *stack) {
GenericScopedLock<StaticSpinMutex> lock(&report_mu);
Printf(" WARNING: Expected use of uninitialized value not found\n");
- StackTrace::PrintStack(stack->trace, stack->size, true, "", 0);
+ StackTrace::PrintStack(stack->trace, stack->size, true,
+ flags()->strip_path_prefix, 0);
}
void ReportAtExitStatistics() {