<rdar://problem/12524607>

Flush the process when symbols are loaded/unloaded manually. This was going on in:
- "target modules load" command
- SBTarget::SetSectionLoadAddress(...)
- SBTarget::ClearSectionLoadAddress(...)
- SBTarget::SetModuleLoadAddress(...)
- SBTarget::ClearModuleLoadAddress(...)



git-svn-id: https://llvm.org/svn/llvm-project/lldb/trunk@173745 91177308-0d34-0410-b5e6-96231b3b80d8
diff --git a/source/API/SBTarget.cpp b/source/API/SBTarget.cpp
index 79b038b..f4582da 100644
--- a/source/API/SBTarget.cpp
+++ b/source/API/SBTarget.cpp
@@ -2329,7 +2329,13 @@
                 }
                 else
                 {
-                    target_sp->GetSectionLoadList().SetSectionLoadAddress (section_sp, section_base_addr);
+                    if (target_sp->GetSectionLoadList().SetSectionLoadAddress (section_sp, section_base_addr))
+                    {
+                        // Flush info in the process (stack frames, etc)
+                        ProcessSP process_sp (target_sp->GetProcessSP());
+                        if (process_sp)
+                            process_sp->Flush();
+                    }
                 }
             }
         }
@@ -2355,7 +2361,13 @@
         }
         else
         {
-            target_sp->GetSectionLoadList().SetSectionUnloaded (section.GetSP());
+            if (target_sp->GetSectionLoadList().SetSectionUnloaded (section.GetSP()))
+            {
+                // Flush info in the process (stack frames, etc)
+                ProcessSP process_sp (target_sp->GetProcessSP());
+                if (process_sp)
+                    process_sp->Flush();                
+            }
         }
     }
     else
@@ -2386,6 +2398,10 @@
                     ModuleList module_list;
                     module_list.Append(module_sp);
                     target_sp->ModulesDidLoad (module_list);
+                    // Flush info in the process (stack frames, etc)
+                    ProcessSP process_sp (target_sp->GetProcessSP());
+                    if (process_sp)
+                        process_sp->Flush();
                 }
             }
         }
@@ -2420,12 +2436,20 @@
                 SectionList *section_list = objfile->GetSectionList();
                 if (section_list)
                 {
+                    bool changed = false;
                     const size_t num_sections = section_list->GetSize();
                     for (size_t sect_idx = 0; sect_idx < num_sections; ++sect_idx)
                     {
                         SectionSP section_sp (section_list->GetSectionAtIndex(sect_idx));
                         if (section_sp)
-                            target_sp->GetSectionLoadList().SetSectionUnloaded (section_sp);
+                            changed |= target_sp->GetSectionLoadList().SetSectionUnloaded (section_sp) > 0;
+                    }
+                    if (changed)
+                    {
+                        // Flush info in the process (stack frames, etc)
+                        ProcessSP process_sp (target_sp->GetProcessSP());
+                        if (process_sp)
+                            process_sp->Flush();                        
                     }
                 }
                 else