tsan: align report style with Go internal format

llvm-svn: 160672
This commit is contained in:
Dmitry Vyukov 2012-07-24 12:29:43 +00:00
parent 65d842ae51
commit bcf0b7002b
3 changed files with 14 additions and 16 deletions

View File

@ -4,7 +4,7 @@ void __tsan_init();
void __tsan_fini(); void __tsan_fini();
void __tsan_event(int typ, int tid, void *pc, void *addr, int info); void __tsan_event(int typ, int tid, void *pc, void *addr, int info);
int goCallbackCommentPc(void *pc, char **img, char **rtn, char **file, int *l) { int __tsan_symbolize(void *pc, char **img, char **rtn, char **file, int *l) {
return 0; return 0;
} }

View File

@ -37,24 +37,22 @@ bool IsExpectedReport(uptr addr, uptr size) {
void internal_start_thread(void(*func)(void*), void *arg) { void internal_start_thread(void(*func)(void*), void *arg) {
} }
extern "C" int goCallbackCommentPc(uptr pc, char **img, char **rtn, extern "C" int __tsan_symbolize(uptr pc, char **func, char **file,
char **filename, int *lineno); int *line, int *off);
extern "C" void free(void *p); extern "C" void free(void *p);
ReportStack *SymbolizeCode(uptr addr) { ReportStack *SymbolizeCode(uptr addr) {
ReportStack *s = NewReportStackEntry(addr); ReportStack *s = NewReportStackEntry(addr);
char *img, *rtn, *filename; char *func, *file;
int lineno; int line, off;
if (goCallbackCommentPc(addr, &img, &rtn, &filename, &lineno)) { if (__tsan_symbolize(addr, &func, &file, &line, &off)) {
s->module = internal_strdup(img); s->offset = off;
s->offset = addr; s->func = internal_strdup(func);
s->func = internal_strdup(rtn); s->file = internal_strdup(file);
s->file = internal_strdup(filename); s->line = line;
s->line = lineno;
s->col = 0; s->col = 0;
free(img); free(func);
free(rtn); free(file);
free(filename);
} }
return s; return s;
} }

View File

@ -131,8 +131,8 @@ void PrintReport(const ReportDesc *rep) {
static void PrintStack(const ReportStack *ent) { static void PrintStack(const ReportStack *ent) {
for (int i = 0; ent; ent = ent->next, i++) { for (int i = 0; ent; ent = ent->next, i++) {
TsanPrintf(" %s()\n %s:%d +%p\n", TsanPrintf(" %s()\n %s:%d +0x%zx\n",
ent->func, ent->file, ent->line, (void*)ent->pc); ent->func, ent->file, ent->line, (void*)ent->offset);
} }
} }