Data-race detection algorithm
~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
+- Implement glibc version detection in drd_main.c.
- Implement segment merging, such that the number of segments per thread
remains limited even when there is no synchronization between threads.
- Find out why a race is reported on std::string::string(std::string const&)
{
assert(0);
}
-#if 0
- printf("[%ld] Requested detach state for new thread: %d\n",
- pthread_self(), vgargs.detachstate);
-#endif
}
assert(vgargs.detachstate == PTHREAD_CREATE_JOINABLE
|| vgargs.detachstate == PTHREAD_CREATE_DETACHED);
// in this file (vg_preloaded.c) would be called instead of those in
// libpthread.so. This loop is necessary because vgargs is allocated on the
// stack, and the created thread reads it.
- while (! vgargs.wrapper_started)
+ if (ret == 0)
{
- sched_yield();
+ while (! vgargs.wrapper_started)
+ {
+ sched_yield();
+ }
}
#endif
return ret;
*/
+#include "drd_error.h"
+#include "drd_segment.h"
+#include "drd_thread.h"
#include "pub_tool_basics.h" // Addr, SizeT
#include "pub_tool_errormgr.h" // VG_(unique_error)()
#include "pub_tool_libcassert.h" // tl_assert()
#include "pub_tool_libcbase.h" // VG_(strlen)()
#include "pub_tool_libcprint.h" // VG_(printf)()
#include "pub_tool_mallocfree.h" // VG_(malloc)(), VG_(free)()
-#include "drd_error.h"
-#include "drd_segment.h"
-#include "drd_thread.h"
+#include "pub_tool_threadstate.h" // VG_INVALID_THREADID
// Local variables.
DrdThreadId const created)
{
Segment* creator_sg;
+ ThreadId vg_created = DrdThreadIdToVgThreadId(created);
tl_assert(sg);
tl_assert(creator == DRD_INVALID_THREADID || IsValidDrdThreadId(creator));
sg->next = 0;
sg->prev = 0;
- sg->stacktrace = VG_(record_ExeContext)(created, 0);
+ if (vg_created != VG_INVALID_THREADID)
+ sg->stacktrace = VG_(record_ExeContext)(vg_created, 0);
+ else
+ sg->stacktrace = 0;
if (creator_sg)
vc_copy(&sg->vc, &creator_sg->vc);