LLDB preloads some dependent modules when creating the target. On
Windows, when the target is run and the dependent DLLs are actually
loaded by the process, ProcessWindows::OnLoadDll calls
DynamicLoaderWindowsDYLD::OnLoadModule which in turn calls
Target::GetOrCreateModule to try to load the DLL module. However, it
did not properly handle the case of getting an already-preloaded module,
and as a result any dependent DLLs preloaded by LLDB will end up being
duplicated in the target module list and causing some commands to return
repeated results (e.g. target modules lookup).
This issue does not seem to affect Linux, because the codepath it uses,
which goes through DynamicLoader::FindModuleViaTarget, has an
additional check to find existing modules before calling
Target::GetOrCreateModule.
This patch adds an early return to Target::GetOrCreateModule for when
it finds a pre-existing module already in the target module list to fix
the issue for Windows.
This closing } is lacking the preceding %, i.e. it should be %}, like on the second row.