forked from OSchip/llvm-project
Correct the usage of DataInfo structure in TSan
llvm-svn: 221297
This commit is contained in:
parent
f5b34e535d
commit
0b622f1d64
|
@ -61,13 +61,23 @@ struct AddressInfo {
|
||||||
}
|
}
|
||||||
};
|
};
|
||||||
|
|
||||||
|
// For now, DataInfo is used to describe global variable.
|
||||||
struct DataInfo {
|
struct DataInfo {
|
||||||
uptr address;
|
|
||||||
char *module;
|
char *module;
|
||||||
uptr module_offset;
|
uptr module_offset;
|
||||||
char *name;
|
char *name;
|
||||||
uptr start;
|
uptr start;
|
||||||
uptr size;
|
uptr size;
|
||||||
|
|
||||||
|
DataInfo() {
|
||||||
|
internal_memset(this, 0, sizeof(DataInfo));
|
||||||
|
}
|
||||||
|
|
||||||
|
void Clear() {
|
||||||
|
InternalFree(module);
|
||||||
|
InternalFree(name);
|
||||||
|
internal_memset(this, 0, sizeof(DataInfo));
|
||||||
|
}
|
||||||
};
|
};
|
||||||
|
|
||||||
class Symbolizer {
|
class Symbolizer {
|
||||||
|
|
|
@ -589,8 +589,7 @@ class POSIXSymbolizer : public Symbolizer {
|
||||||
return false;
|
return false;
|
||||||
const char *module_name = module->full_name();
|
const char *module_name = module->full_name();
|
||||||
uptr module_offset = addr - module->base_address();
|
uptr module_offset = addr - module->base_address();
|
||||||
internal_memset(info, 0, sizeof(*info));
|
info->Clear();
|
||||||
info->address = addr;
|
|
||||||
info->module = internal_strdup(module_name);
|
info->module = internal_strdup(module_name);
|
||||||
info->module_offset = module_offset;
|
info->module_offset = module_offset;
|
||||||
// First, try to use libbacktrace symbolizer (if it's available).
|
// First, try to use libbacktrace symbolizer (if it's available).
|
||||||
|
|
|
@ -110,6 +110,7 @@ ReportLocation *SymbolizeData(uptr addr) {
|
||||||
ent->name = internal_strdup(info.name);
|
ent->name = internal_strdup(info.name);
|
||||||
ent->addr = info.start;
|
ent->addr = info.start;
|
||||||
ent->size = info.size;
|
ent->size = info.size;
|
||||||
|
info.Clear();
|
||||||
return ent;
|
return ent;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
Loading…
Reference in New Issue