[ASan] Fix StackTrace::SlowUnwindStack on Windows

llvm-svn: 196894
This commit is contained in:
Timur Iskhodzhanov 2013-12-10 08:30:39 +00:00
parent 8e6afd4785
commit 89a346c2a1
2 changed files with 4 additions and 1 deletions

View File

@ -148,7 +148,7 @@ static bool MatchPc(uptr cur_pc, uptr trace_pc, uptr threshold) {
}
void StackTrace::PopStackFrames(uptr count) {
CHECK(count < size);
CHECK_LT(count, size);
size -= count;
for (uptr i = 0; i < size; ++i) {
trace[i] = trace[i + count];

View File

@ -382,6 +382,9 @@ void StackTrace::SlowUnwindStack(uptr pc, uptr max_depth) {
// FIXME: Look at LLVMUnhandledExceptionFilter in Signals.inc
size = CaptureStackBackTrace(2, Min(max_depth, kStackTraceMax),
(void**)trace, 0);
if (size == 0)
return;
// Skip the RTL frames by searching for the PC in the stacktrace.
uptr pc_location = LocatePcInTrace(pc);
PopStackFrames(pc_location);