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_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;
}

View File

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

View File

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