[Lldb-commits] [lldb] r223497 - Load / unload modules in the target when the OS events occur.

Zachary Turner zturner at google.com
Fri Dec 5 10:46:04 PST 2014


Author: zturner
Date: Fri Dec  5 12:46:04 2014
New Revision: 223497

URL: http://llvm.org/viewvc/llvm-project?rev=223497&view=rev
Log:
Load / unload modules in the target when the OS events occur.

This causes all deferred breakpoints to be correctly resolved as
the modules that they reside in are loaded.

Modified:
    lldb/trunk/source/Plugins/Process/Windows/ProcessWindows.cpp
    lldb/trunk/source/Plugins/Process/Windows/ProcessWindows.h

Modified: lldb/trunk/source/Plugins/Process/Windows/ProcessWindows.cpp
URL: http://llvm.org/viewvc/llvm-project/lldb/trunk/source/Plugins/Process/Windows/ProcessWindows.cpp?rev=223497&r1=223496&r2=223497&view=diff
==============================================================================
--- lldb/trunk/source/Plugins/Process/Windows/ProcessWindows.cpp (original)
+++ lldb/trunk/source/Plugins/Process/Windows/ProcessWindows.cpp Fri Dec  5 12:46:04 2014
@@ -16,7 +16,9 @@
 
 // Other libraries and framework includes
 #include "lldb/Core/Module.h"
+#include "lldb/Core/ModuleSpec.h"
 #include "lldb/Core/PluginManager.h"
+#include "lldb/Core/Section.h"
 #include "lldb/Core/State.h"
 #include "lldb/Host/Host.h"
 #include "lldb/Host/HostProcess.h"
@@ -521,13 +523,26 @@ ProcessWindows::OnLoadDll(const ModuleSp
     ModuleSP module = GetTarget().GetSharedModule(module_spec, &error);
     bool load_addr_changed = false;
     module->SetLoadAddress(GetTarget(), module_addr, false, load_addr_changed);
+
+    ModuleList loaded_modules;
+    loaded_modules.Append(module);
+    GetTarget().ModulesDidLoad(loaded_modules);
 }
 
 void
 ProcessWindows::OnUnloadDll(lldb::addr_t module_addr)
 {
-    // TODO: Figure out how to get the ModuleSP loaded at the specified address and remove
-    // it from the target's module list.
+    Address resolved_addr;
+    if (GetTarget().ResolveLoadAddress(module_addr, resolved_addr))
+    {
+        ModuleSP module = resolved_addr.GetModule();
+        if (module)
+        {
+            ModuleList unloaded_modules;
+            unloaded_modules.Append(module);
+            GetTarget().ModulesDidUnload(unloaded_modules, false);
+        }
+    }
 }
 
 void

Modified: lldb/trunk/source/Plugins/Process/Windows/ProcessWindows.h
URL: http://llvm.org/viewvc/llvm-project/lldb/trunk/source/Plugins/Process/Windows/ProcessWindows.h?rev=223497&r1=223496&r2=223497&view=diff
==============================================================================
--- lldb/trunk/source/Plugins/Process/Windows/ProcessWindows.h (original)
+++ lldb/trunk/source/Plugins/Process/Windows/ProcessWindows.h Fri Dec  5 12:46:04 2014
@@ -13,7 +13,6 @@
 // C Includes
 
 // C++ Includes
-#include <map>
 #include <memory>
 #include <queue>
 





More information about the lldb-commits mailing list