[Lldb-commits] [PATCH] [lldb] ASan malloc/free history threads
kuba.brecka at gmail.com
Fri Jul 18 21:32:26 PDT 2014
I'm sending a patch that is a first take on implementing the ASan debugging facilities into LLDB, namely retrieving malloc/free recorded stack traces for a given address. This has been somewhat discussed in http://lists.cs.uiuc.edu/pipermail/lldb-dev/2014-July/004491.html. What this patch does is:
* Creates a new plugin type, MemoryHistory, and its implementation, MemoryHistoryASan. The reason for a plugin is that we might want to reuse it for other sources of recorded stack frames, like malloc_history (Darwin only).
* The plugin can only be instantiated for a process that has the ASan runtime library loaded. Right now, I'm detecting the presence of the library by checking that a specific symbol exists. Is there a better way?
* Extended the "memory" command and added "memory history [address]" which will call the plugin's GetHistoryThreads function and print out the HistoryThread objects.
* A test case that uses a simple ASanified binary and issues the "memory history" command, validates that the returned stack trace contains the correct line number of where a memory was allocated and freed. The test case requires your compiler to understand -fsanitize=address and basically it should be a very recently build clang (so it has the debugging API from this week).
There's a couple of things that I still need to do. I haven't yet exposed this to the SB API, because the patch is already getting quite big. The instance of MemoryHistory should probably be tied to the Process object (same way LanguageRuntime is), so it doesn't get created for every command.
-------------- next part --------------
A non-text attachment was scrubbed...
Size: 35751 bytes
Desc: not available
More information about the lldb-commits