[Lldb-commits] [PATCH] D11295: [asan] Display ASan history threads in reverse chronological order
Kuba Brecka
kuba.brecka at gmail.com
Fri Jul 17 06:58:59 PDT 2015
kubabrecka created this revision.
kubabrecka added subscribers: lldb-commits, jasonmolenda, jingham, granata.enrico, zaks.anna.
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.
http://reviews.llvm.org/D11295
Files:
source/Plugins/MemoryHistory/asan/MemoryHistoryASan.cpp
test/functionalities/asan/TestMemoryHistory.py
Index: test/functionalities/asan/TestMemoryHistory.py
===================================================================
--- test/functionalities/asan/TestMemoryHistory.py
+++ test/functionalities/asan/TestMemoryHistory.py
@@ -86,18 +86,18 @@
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")
Index: source/Plugins/MemoryHistory/asan/MemoryHistoryASan.cpp
===================================================================
--- source/Plugins/MemoryHistory/asan/MemoryHistoryASan.cpp
+++ source/Plugins/MemoryHistory/asan/MemoryHistoryASan.cpp
@@ -176,8 +176,8 @@
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;
}
-------------- next part --------------
A non-text attachment was scrubbed...
Name: D11295.29999.patch
Type: text/x-patch
Size: 2337 bytes
Desc: not available
URL: <http://lists.llvm.org/pipermail/lldb-commits/attachments/20150717/4023c4ca/attachment.bin>
More information about the lldb-commits
mailing list