Looks good. I would shorten your plugin-name to not contain "memory-history-" 
in the name:

ConstString
MemoryHistoryASan::GetPluginNameStatic()
{
    static ConstString g_name("asan");
    return g_name;
}

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.

Greg

On Jul 18, 2014, at 9:32 PM, Kuba Brecka <[email protected]> wrote:

> Hi,
> 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.
> 
> http://reviews.llvm.org/D4596
> 
> Files:
>  include/lldb/Core/PluginManager.h
>  include/lldb/Target/MemoryHistory.h
>  include/lldb/lldb-forward.h
>  include/lldb/lldb-private-interfaces.h
>  lldb.xcodeproj/project.pbxproj
>  source/CMakeLists.txt
>  source/Commands/CommandObjectMemory.cpp
>  source/Core/PluginManager.cpp
>  source/Plugins/CMakeLists.txt
>  source/Plugins/Makefile
>  source/Plugins/MemoryHistory/CMakeLists.txt
>  source/Plugins/MemoryHistory/asan/CMakeLists.txt
>  source/Plugins/MemoryHistory/asan/Makefile
>  source/Plugins/MemoryHistory/asan/MemoryHistoryASan.cpp
>  source/Plugins/MemoryHistory/asan/MemoryHistoryASan.h
>  source/Plugins/Process/Utility/HistoryThread.h
>  source/Target/CMakeLists.txt
>  source/Target/MemoryHistory.cpp
>  source/lldb.cpp
>  test/functionalities/asan/Makefile
>  test/functionalities/asan/TestAsan.py
>  test/functionalities/asan/main.c
> <D4596.11684.patch>_______________________________________________
> lldb-commits mailing list
> [email protected]
> http://lists.cs.uiuc.edu/mailman/listinfo/lldb-commits

_______________________________________________
lldb-commits mailing list
[email protected]
http://lists.cs.uiuc.edu/mailman/listinfo/lldb-commits

Reply via email to