This is an archive of the discontinued LLVM Phabricator instance.

compiler-rt/lib/tsan: allow the Go runtime to return multiple stack frames for a single PC
ClosedPublic

Authored by randall77 on Sep 17 2019, 10:57 AM.

Details

Reviewers
dvyukov
jfb
Summary

This fix allows tsan to report stack traces correctly even in the
presence of mid-stack inlining by the Go compiler.

See https://go-review.googlesource.com/c/go/+/195781 for the Go runtime side of this change.

Diff Detail

Event Timeline

randall77 created this revision.Sep 17 2019, 10:57 AM
Herald added projects: Restricted Project, Restricted Project. · View Herald TranscriptSep 17 2019, 10:57 AM
Herald added subscribers: Restricted Project, llvm-commits, dberris. · View Herald Transcript

Besides the nits, are you sure we reconstruct the list in the right order? :)
Did you test it with the Go counterpart? There is that buildgo.sh script that builds new syso file, which you can copy into Go runtime/race.
It would also be nice to have an output test for inlined frames here:
https://github.com/golang/go/blob/master/src/runtime/race/output_test.go
It needs to go with the updated syso files, but you could use it for testing now.
Fingers crossed nothing broke since last syso update.

lib/tsan/go/tsan_go.cpp
59

space before (
and generally do for (;;) for this, at least in tsan code

64

no {} around 1-statement blocks

73

no {} around 1-statement blocks

Yes, I tested that frames end up in the right order.
(The list returned by SymbolizeCode needs to go from deepest to shallowest.)

I will work on some tests on the Go side.

Fix Dmitry's comments

Upload right patch this time.

This revision is now accepted and ready to land.Sep 18 2019, 2:17 AM
dvyukov closed this revision.Sep 18 2019, 2:17 AM