[compiler-rt] r221297 - Correct the usage of DataInfo structure in TSan
Alexey Samsonov
vonosmas at gmail.com
Tue Nov 4 13:26:56 PST 2014
Author: samsonov
Date: Tue Nov 4 15:26:56 2014
New Revision: 221297
URL: http://llvm.org/viewvc/llvm-project?rev=221297&view=rev
Log:
Correct the usage of DataInfo structure in TSan
Modified:
compiler-rt/trunk/lib/sanitizer_common/sanitizer_symbolizer.h
compiler-rt/trunk/lib/sanitizer_common/sanitizer_symbolizer_posix_libcdep.cc
compiler-rt/trunk/lib/tsan/rtl/tsan_symbolize.cc
Modified: compiler-rt/trunk/lib/sanitizer_common/sanitizer_symbolizer.h
URL: http://llvm.org/viewvc/llvm-project/compiler-rt/trunk/lib/sanitizer_common/sanitizer_symbolizer.h?rev=221297&r1=221296&r2=221297&view=diff
==============================================================================
--- compiler-rt/trunk/lib/sanitizer_common/sanitizer_symbolizer.h (original)
+++ compiler-rt/trunk/lib/sanitizer_common/sanitizer_symbolizer.h Tue Nov 4 15:26:56 2014
@@ -61,13 +61,23 @@ struct AddressInfo {
}
};
+// For now, DataInfo is used to describe global variable.
struct DataInfo {
- uptr address;
char *module;
uptr module_offset;
char *name;
uptr start;
uptr size;
+
+ DataInfo() {
+ internal_memset(this, 0, sizeof(DataInfo));
+ }
+
+ void Clear() {
+ InternalFree(module);
+ InternalFree(name);
+ internal_memset(this, 0, sizeof(DataInfo));
+ }
};
class Symbolizer {
Modified: compiler-rt/trunk/lib/sanitizer_common/sanitizer_symbolizer_posix_libcdep.cc
URL: http://llvm.org/viewvc/llvm-project/compiler-rt/trunk/lib/sanitizer_common/sanitizer_symbolizer_posix_libcdep.cc?rev=221297&r1=221296&r2=221297&view=diff
==============================================================================
--- compiler-rt/trunk/lib/sanitizer_common/sanitizer_symbolizer_posix_libcdep.cc (original)
+++ compiler-rt/trunk/lib/sanitizer_common/sanitizer_symbolizer_posix_libcdep.cc Tue Nov 4 15:26:56 2014
@@ -589,8 +589,7 @@ class POSIXSymbolizer : public Symbolize
return false;
const char *module_name = module->full_name();
uptr module_offset = addr - module->base_address();
- internal_memset(info, 0, sizeof(*info));
- info->address = addr;
+ info->Clear();
info->module = internal_strdup(module_name);
info->module_offset = module_offset;
// First, try to use libbacktrace symbolizer (if it's available).
Modified: compiler-rt/trunk/lib/tsan/rtl/tsan_symbolize.cc
URL: http://llvm.org/viewvc/llvm-project/compiler-rt/trunk/lib/tsan/rtl/tsan_symbolize.cc?rev=221297&r1=221296&r2=221297&view=diff
==============================================================================
--- compiler-rt/trunk/lib/tsan/rtl/tsan_symbolize.cc (original)
+++ compiler-rt/trunk/lib/tsan/rtl/tsan_symbolize.cc Tue Nov 4 15:26:56 2014
@@ -110,6 +110,7 @@ ReportLocation *SymbolizeData(uptr addr)
ent->name = internal_strdup(info.name);
ent->addr = info.start;
ent->size = info.size;
+ info.Clear();
return ent;
}
More information about the llvm-commits
mailing list