[Lldb-commits] [PATCH] D19230: Properly unload modules from target image list when using svr4 packets

Francis Ricci via lldb-commits lldb-commits at lists.llvm.org
Mon Apr 18 16:26:00 PDT 2016


fjricci added inline comments.

================
Comment at: source/Plugins/Process/gdb-remote/ProcessGDBRemote.cpp:4907
@@ -4883,2 +4906,3 @@
+        m_process->GetTarget().ModulesDidUnload (removed_modules, false);
 
         new_modules.ForEach ([&target](const lldb::ModuleSP module_sp) -> bool
----------------
tfiala wrote:
> It looks like this code will unload any modules currently listed as loaded via m_process->GetTarget().GetImages(), if they do not appear in the module_list argument to this function.  Is that correct behavior?  (It might be, but that's not what I would have guessed without digging deeper).
> 
> I might be not following the flow here correctly, though.  Can you clarify?  Did the full test suite run with this change?  Thanks!
So yes, this will remove any existing modules that are not in the svr4 packet, provided that there were modules listed in the svr4 packet (indicating that the remote is using the packet) - if `new_modules.GetSize() == 0`, we won't remove anything.

As far as I can tell from the gdb protocol specs, the svr4 packet should contain a list of all loaded libraries, so as long as the svr4 packet contains libraries, I believe that removing modules which are no longer listed is the correct behavior.

I did run the full suite on linux (with lldb-server), and it passes with this change.

As a side note, the module_list argument is actually an output parameter, filled by GetLoadedModuleList().


http://reviews.llvm.org/D19230





More information about the lldb-commits mailing list