Made "target modules add" flush the process to
reset stack frames etc.

<rdar://problem/12842024>


git-svn-id: https://llvm.org/svn/llvm-project/lldb/trunk@170079 91177308-0d34-0410-b5e6-96231b3b80d8
diff --git a/source/Commands/CommandObjectTarget.cpp b/source/Commands/CommandObjectTarget.cpp
index 4286d96..028bce5 100644
--- a/source/Commands/CommandObjectTarget.cpp
+++ b/source/Commands/CommandObjectTarget.cpp
@@ -2644,6 +2644,8 @@
         }
         else
         {
+            bool flush = false;
+            
             const size_t argc = args.GetArgumentCount();
             if (argc == 0)
             {
@@ -2664,6 +2666,8 @@
                         }
                         else
                         {
+                            flush = true;
+                            
                             StreamString strm;
                             module_spec.GetUUID().Dump (&strm);
                             if (module_spec.GetFileSpec())
@@ -2737,6 +2741,10 @@
                                 result.SetStatus (eReturnStatusFailed);
                                 return false;
                             }
+                            else
+                            {
+                                flush = true;
+                            }
                             result.SetStatus (eReturnStatusSuccessFinishResult);
                         }
                         else
@@ -2757,7 +2765,15 @@
                     }
                 }
             }
+            
+            if (flush)
+            {
+                ProcessSP process = target->GetProcessSP();
+                if (process)
+                    process->Flush();
+            }
         }
+        
         return result.Succeeded();
     }