[Lldb-commits] [lldb] r269707 - Make sure we notify that the section module was loaded when SBTarget::SetSectionLoadAddress() is called. Also make sure that the section module is unloaded when SBTarget::ClearSectionLoadAddress() or SBTarget::ClearModuleLoadAddress() is called.

Greg Clayton via lldb-commits lldb-commits at lists.llvm.org
Mon May 16 14:14:44 PDT 2016


Author: gclayton
Date: Mon May 16 16:14:44 2016
New Revision: 269707

URL: http://llvm.org/viewvc/llvm-project?rev=269707&view=rev
Log:
Make sure we notify that the section module was loaded when SBTarget::SetSectionLoadAddress() is called. Also make sure that the section module is unloaded when SBTarget::ClearSectionLoadAddress() or SBTarget::ClearModuleLoadAddress() is called.

<rdar://problem/25119335>

Modified:
    lldb/trunk/source/API/SBTarget.cpp

Modified: lldb/trunk/source/API/SBTarget.cpp
URL: http://llvm.org/viewvc/llvm-project/lldb/trunk/source/API/SBTarget.cpp?rev=269707&r1=269706&r2=269707&view=diff
==============================================================================
--- lldb/trunk/source/API/SBTarget.cpp (original)
+++ lldb/trunk/source/API/SBTarget.cpp Mon May 16 16:14:44 2016
@@ -2204,6 +2204,13 @@ SBTarget::SetSectionLoadAddress (lldb::S
                     ProcessSP process_sp (target_sp->GetProcessSP());
                     if (target_sp->SetSectionLoadAddress (section_sp, section_base_addr))
                     {
+                        ModuleSP module_sp(section_sp->GetModule());
+                        if (module_sp)
+                        {
+                            ModuleList module_list;
+                            module_list.Append(module_sp);
+                            target_sp->ModulesDidLoad (module_list);
+                        }
                         // Flush info in the process (stack frames, etc)
                         if (process_sp)
                             process_sp->Flush();
@@ -2233,12 +2240,27 @@ SBTarget::ClearSectionLoadAddress (lldb:
         }
         else
         {
-            ProcessSP process_sp (target_sp->GetProcessSP());
-            if (target_sp->SetSectionUnloaded (section.GetSP()))
+            SectionSP section_sp (section.GetSP());
+            if (section_sp)
             {
-                // Flush info in the process (stack frames, etc)
-                if (process_sp)
-                    process_sp->Flush();                
+                ProcessSP process_sp (target_sp->GetProcessSP());
+                if (target_sp->SetSectionUnloaded(section_sp))
+                {
+                    ModuleSP module_sp(section_sp->GetModule());
+                    if (module_sp)
+                    {
+                        ModuleList module_list;
+                        module_list.Append(module_sp);
+                        target_sp->ModulesDidUnload(module_list, false);
+                    }
+                    // Flush info in the process (stack frames, etc)
+                    if (process_sp)
+                        process_sp->Flush();                
+                }
+            }
+            else
+            {
+                sb_error.SetErrorStringWithFormat ("invalid section");
             }
         }
     }
@@ -2320,6 +2342,9 @@ SBTarget::ClearModuleLoadAddress (lldb::
                     }
                     if (changed)
                     {
+                        ModuleList module_list;
+                        module_list.Append(module_sp);
+                        target_sp->ModulesDidUnload(module_list, false);
                         // Flush info in the process (stack frames, etc)
                         ProcessSP process_sp (target_sp->GetProcessSP());
                         if (process_sp)




More information about the lldb-commits mailing list