Author: kuba.brecka Date: Wed Jul 22 09:30:56 2015 New Revision: 242902 URL: http://llvm.org/viewvc/llvm-project?rev=242902&view=rev Log: [asan] Display ASan history threads in reverse chronological order
For use-after-free bugs caught by ASan, we show an allocation and a deallocation stack trace. Let's display them in a "most recent event first" order, this patch does that. Differential Revision: http://reviews.llvm.org/D11295 Modified: lldb/trunk/source/Plugins/MemoryHistory/asan/MemoryHistoryASan.cpp lldb/trunk/test/functionalities/asan/TestMemoryHistory.py Modified: lldb/trunk/source/Plugins/MemoryHistory/asan/MemoryHistoryASan.cpp URL: http://llvm.org/viewvc/llvm-project/lldb/trunk/source/Plugins/MemoryHistory/asan/MemoryHistoryASan.cpp?rev=242902&r1=242901&r2=242902&view=diff ============================================================================== --- lldb/trunk/source/Plugins/MemoryHistory/asan/MemoryHistoryASan.cpp (original) +++ lldb/trunk/source/Plugins/MemoryHistory/asan/MemoryHistoryASan.cpp Wed Jul 22 09:30:56 2015 @@ -176,8 +176,8 @@ MemoryHistoryASan::GetHistoryThreads(lld HistoryThreads result; - CreateHistoryThreadFromValueObject(process_sp, return_value_sp, "alloc", "Memory allocated at", result); CreateHistoryThreadFromValueObject(process_sp, return_value_sp, "free", "Memory deallocated at", result); + CreateHistoryThreadFromValueObject(process_sp, return_value_sp, "alloc", "Memory allocated at", result); return result; } Modified: lldb/trunk/test/functionalities/asan/TestMemoryHistory.py URL: http://llvm.org/viewvc/llvm-project/lldb/trunk/test/functionalities/asan/TestMemoryHistory.py?rev=242902&r1=242901&r2=242902&view=diff ============================================================================== --- lldb/trunk/test/functionalities/asan/TestMemoryHistory.py (original) +++ lldb/trunk/test/functionalities/asan/TestMemoryHistory.py Wed Jul 22 09:30:56 2015 @@ -86,18 +86,18 @@ class AsanTestCase(TestBase): history_thread = threads.GetThreadAtIndex(0) self.assertTrue(history_thread.num_frames >= 2) self.assertEqual(history_thread.frames[1].GetLineEntry().GetFileSpec().GetFilename(), "main.c") - self.assertEqual(history_thread.frames[1].GetLineEntry().GetLine(), self.line_malloc) + self.assertEqual(history_thread.frames[1].GetLineEntry().GetLine(), self.line_free) history_thread = threads.GetThreadAtIndex(1) self.assertTrue(history_thread.num_frames >= 2) self.assertEqual(history_thread.frames[1].GetLineEntry().GetFileSpec().GetFilename(), "main.c") - self.assertEqual(history_thread.frames[1].GetLineEntry().GetLine(), self.line_free) + self.assertEqual(history_thread.frames[1].GetLineEntry().GetLine(), self.line_malloc) # let's free the container (SBThreadCollection) and see if the SBThreads still live threads = None self.assertTrue(history_thread.num_frames >= 2) self.assertEqual(history_thread.frames[1].GetLineEntry().GetFileSpec().GetFilename(), "main.c") - self.assertEqual(history_thread.frames[1].GetLineEntry().GetLine(), self.line_free) + self.assertEqual(history_thread.frames[1].GetLineEntry().GetLine(), self.line_malloc) # now let's break when an ASan report occurs and try the API then self.runCmd("breakpoint set -n __asan_report_error") _______________________________________________ lldb-commits mailing list lldb-commits@cs.uiuc.edu http://lists.cs.uiuc.edu/mailman/listinfo/lldb-commits