[Lldb-commits] [PATCH] [lldb] ASan malloc/free history threads
gclayton at apple.com
Sat Jul 19 12:10:04 PDT 2014
Looks good. I would shorten your plugin-name to not contain "memory-history-" in the name:
static ConstString g_name("asan");
I know the code is inconsistent for the naming of plug-ins, but each plug-in is unique within each plug-in type so the name can just be "asan".
Great patch, and I look forward to using these new features within LLDB.
On Jul 18, 2014, at 9:32 PM, Kuba Brecka <kuba.brecka at gmail.com> wrote:
> 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.
> lldb-commits mailing list
> lldb-commits at cs.uiuc.edu
More information about the lldb-commits