Status: New
Owner: ----
Labels: Type-Defect Priority-Medium
New issue 382 by [email protected]: main thread's pthread destructors don't
run before leak checker, when in gdb
https://code.google.com/p/address-sanitizer/issues/detail?id=382
What steps will reproduce the problem?
todd@todd-ThinkPad-T540p:/tmp$ cat test.cc
#include <pthread.h>
void Cleanup(void* t) {
delete (int*)t;
}
int main(int argc, char** argv)
{
pthread_key_t key;
pthread_key_create(&key, &Cleanup);
pthread_setspecific(key, new int(12345));
return 0;
}
todd@todd-ThinkPad-T540p:/tmp$ clang++ -fsanitize=address -pthread -o test
test.cc
todd@todd-ThinkPad-T540p:/tmp$ ./test
todd@todd-ThinkPad-T540p:/tmp$ gdb --batch -ex 'run' ./test
[Thread debugging using libthread_db enabled]
Using host libthread_db library "/lib/x86_64-linux-gnu/libthread_db.so.1".
=================================================================
==32689==ERROR: LeakSanitizer: detected memory leaks
Direct leak of 4 byte(s) in 1 object(s) allocated from:
#0 0x434b3b (/tmp/test+0x434b3b)
#1 0x4b9e39 (/tmp/test+0x4b9e39)
#2 0x7ffff6becde4 (/lib/x86_64-linux-gnu/libc.so.6+0x21de4)
SUMMARY: AddressSanitizer: 4 byte(s) leaked in 1 allocation(s).
[Inferior 1 (process 32689) exited with code 027]
What is the expected output? What do you see instead?
I expect the pthread TSD destructors to run before LSAN checks for leaks.
It seems to work this way outside of gdb, but when running in gdb, it
detects a leak.
What version of the product are you using? On what operating system?
clang version 3.6.0 (trunk 223108)
GNU gdb (GDB) 7.9
--
You received this message because this project is configured to send all
issue notifications to this address.
You may adjust your notification preferences at:
https://code.google.com/hosting/settings
--
You received this message because you are subscribed to the Google Groups
"address-sanitizer" group.
To unsubscribe from this group and stop receiving emails from it, send an email
to [email protected].
For more options, visit https://groups.google.com/d/optout.