[PATCH] D14873: [tsan] Modify the tls_race.cc and tls_race2.cc tests to pass on OS X

Kuba Brecka via llvm-commits llvm-commits at lists.llvm.org
Fri Nov 20 09:06:16 PST 2015


kubabrecka added inline comments.

================
Comment at: test/tsan/tls_race.cc:23
@@ +22,2 @@
+// CHECK-FreeBSD:   Location is TLS of main thread.
+// CHECK-Darwin:   Location is heap block of size 4
----------------
dvyukov wrote:
> How does the heap block allocation stack look like? Is it possible to figure out that this is TLS from the stack?
> 
The stack looks like this:

```
  * frame #0: 0x0000000100077890 libclang_rt.tsan_osx_dynamic.dylib`::wrap_malloc(size=4294971592) at sanitizer_malloc_mac.inc:96
    frame #1: 0x00007fff86555d7d libdyld.dylib`tlv_allocate_and_initialize_for_key + 370
    frame #2: 0x00007fff8655652c libdyld.dylib`tlv_get_addr + 296
    frame #3: 0x0000000100000dc7 tls_race.cc.tmp`main + 55 at tls_race.cc:14 [opt]
    frame #4: 0x00007fff865565ad libdyld.dylib`start + 1
```

To figure out this is a TLS, we could recognize that the caller is tlv_allocate_and_initialize_for_key, but for that we'd need to symbolicate first.  FYI, there are no other calls to malloc from tlv_allocate_and_initialize_for_key.  This function is internal (non-interceptible).  If you have any easy solution in mind, please tell me.


http://reviews.llvm.org/D14873





More information about the llvm-commits mailing list