<br><br><div class="gmail_quote">On Thu Dec 04 2014 at 2:35:40 PM Zachary Turner <<a href="mailto:zturner@google.com">zturner@google.com</a>> wrote:<br><blockquote class="gmail_quote" style="margin:0 0 0 .8ex;border-left:1px #ccc solid;padding-left:1ex"><div class="gmail_quote">On Thu Dec 04 2014 at 2:29:45 PM Greg Clayton <<a href="mailto:gclayton@apple.com" target="_blank">gclayton@apple.com</a>> wrote:<br><blockquote class="gmail_quote" style="margin:0 0 0 .8ex;border-left:1px #ccc solid;padding-left:1ex"><br>
One thing you might actually need to do in the DynamicLoaderWindows is find out all the shared libraries that are loaded when you attach to a process. When you attach to a running process in windows, does it give you a bunch of callbacks for each shared library that is already loaded? Just like when you are running and a shared library loads/unloads? Or must you discover them in a different way?<br></blockquote></div><div class="gmail_quote"><div>That's a good question and it's actually still an unknown. There's still a bit more work I need to do before being able to attach to a process. It might give me a module load notification for each existing module right when I load, and I might have to enumerate them. Even if I have to enumerate them, the code to do that is pretty simple. But it might make sense to put that code in the DynamicLoader::DidAttach method anyway. For that matter, it might also make sense to add the main executable's module in DynamicLoader::DidLaunch, if nothing else for consistency. But modules that load or unload while the debugger is connected seem to be a natural fit to just calling ModulesDidLoad.</div></div></blockquote><div><br></div><div>Actually I checked the documentation, and it's <a href="http://msdn.microsoft.com/en-us/library/windows/desktop/ms679295%28v=vs.85%29.aspx">documented</a> what the behavior is. When attaching to a process, the system will automatically send a load dll event for every currently loaded dll in the process. So the same code that works for creating processes will also be able to populate the initial DLL set when attaching as well.</div></div>