[asan] get rid of the last operator new call in asan rtl
llvm-svn: 160347
This commit is contained in:
parent
f579beca6d
commit
78713bc574
|
|
@ -48,7 +48,7 @@ void Die() {
|
|||
}
|
||||
|
||||
void CheckFailed(const char *file, int line, const char *cond, u64 v1, u64 v2) {
|
||||
AsanReport("AddressSanitizer CHECK failed: %s:%d \"%s\" (%zx, %zx)\n",
|
||||
AsanReport("AddressSanitizer CHECK failed: %s:%d \"%s\" (0x%zx, 0x%zx)\n",
|
||||
file, line, cond, (uptr)v1, (uptr)v2);
|
||||
PRINT_CURRENT_STACK();
|
||||
ShowStatsAndAbort();
|
||||
|
|
|
|||
|
|
@ -26,6 +26,9 @@ AsanThread::AsanThread(LinkerInitialized x)
|
|||
malloc_storage_(x),
|
||||
stats_(x) { }
|
||||
|
||||
static AsanLock mu_for_thread_summary(LINKER_INITIALIZED);
|
||||
static LowLevelAllocator allocator_for_thread_summary(LINKER_INITIALIZED);
|
||||
|
||||
AsanThread *AsanThread::Create(u32 parent_tid, thread_callback_t start_routine,
|
||||
void *arg, AsanStackTrace *stack) {
|
||||
uptr size = RoundUpTo(sizeof(AsanThread), kPageSize);
|
||||
|
|
@ -33,7 +36,15 @@ AsanThread *AsanThread::Create(u32 parent_tid, thread_callback_t start_routine,
|
|||
thread->start_routine_ = start_routine;
|
||||
thread->arg_ = arg;
|
||||
|
||||
AsanThreadSummary *summary = new AsanThreadSummary(parent_tid, stack);
|
||||
const uptr kSummaryAllocSize = 1024;
|
||||
CHECK_LE(sizeof(AsanThreadSummary), kSummaryAllocSize);
|
||||
AsanThreadSummary *summary;
|
||||
{
|
||||
ScopedLock lock(&mu_for_thread_summary);
|
||||
summary = (AsanThreadSummary*)
|
||||
allocator_for_thread_summary.Allocate(kSummaryAllocSize);
|
||||
}
|
||||
summary->Init(parent_tid, stack);
|
||||
summary->set_thread(thread);
|
||||
thread->set_summary(summary);
|
||||
|
||||
|
|
|
|||
|
|
@ -18,6 +18,7 @@
|
|||
#include "asan_internal.h"
|
||||
#include "asan_stack.h"
|
||||
#include "asan_stats.h"
|
||||
#include "sanitizer_common/sanitizer_libc.h"
|
||||
|
||||
namespace __asan {
|
||||
|
||||
|
|
@ -30,12 +31,12 @@ class AsanThread;
|
|||
class AsanThreadSummary {
|
||||
public:
|
||||
explicit AsanThreadSummary(LinkerInitialized) { } // for T0.
|
||||
AsanThreadSummary(u32 parent_tid, AsanStackTrace *stack)
|
||||
: parent_tid_(parent_tid),
|
||||
announced_(false) {
|
||||
void Init(u32 parent_tid, AsanStackTrace *stack) {
|
||||
parent_tid_ = parent_tid;
|
||||
announced_ = false;
|
||||
tid_ = kInvalidTid;
|
||||
if (stack) {
|
||||
stack_ = *stack;
|
||||
internal_memcpy(&stack_, stack, sizeof(*stack));
|
||||
}
|
||||
thread_ = 0;
|
||||
}
|
||||
|
|
|
|||
Loading…
Reference in New Issue