diff options
| author | Greg Clayton <gclayton@apple.com> | 2013-11-05 23:28:00 +0000 |
|---|---|---|
| committer | Greg Clayton <gclayton@apple.com> | 2013-11-05 23:28:00 +0000 |
| commit | 095eeaa0250161c3912f07c4c43ddb2a00a91faf (patch) | |
| tree | 5750b5eef2aba484d7a513203d7575a89eb999ae /lldb/source/Target | |
| parent | 5ede5cc9ba0293bf0764e83cc264c40920bf1d7d (diff) | |
| download | bcm5719-llvm-095eeaa0250161c3912f07c4c43ddb2a00a91faf.tar.gz bcm5719-llvm-095eeaa0250161c3912f07c4c43ddb2a00a91faf.zip | |
<rdar://problem/15367122>
Fixed the test case for "test/functionalities/exec/TestExec.py" on Darwin.
The issue was breakpoints were persisting and causing problems. When we exec, we need to clear out the process and target and start fresh with nothing and let the breakpoints populate themselves again. This patch correctly clears out the breakpoints and also flushes the process so that the objects (process/thread/frame) give out valid information.
llvm-svn: 194106
Diffstat (limited to 'lldb/source/Target')
| -rw-r--r-- | lldb/source/Target/Process.cpp | 8 | ||||
| -rw-r--r-- | lldb/source/Target/Target.cpp | 36 |
2 files changed, 23 insertions, 21 deletions
diff --git a/lldb/source/Target/Process.cpp b/lldb/source/Target/Process.cpp index d5d1456d2a5..700afdb7981 100644 --- a/lldb/source/Target/Process.cpp +++ b/lldb/source/Target/Process.cpp @@ -5633,9 +5633,7 @@ Process::DidExec () { Target &target = GetTarget(); target.CleanupProcess (); - ModuleList unloaded_modules (target.GetImages()); - target.ModulesDidUnload (unloaded_modules); - target.GetSectionLoadList().Clear(); + target.ClearModules(); m_dynamic_checkers_ap.reset(); m_abi_sp.reset(); m_system_runtime_ap.reset(); @@ -5648,4 +5646,8 @@ Process::DidExec () m_memory_cache.Clear(true); DoDidExec(); CompleteAttach (); + // Flush the process (threads and all stack frames) after running CompleteAttach() + // in case the dynamic loader loaded things in new locations. + Flush(); } + diff --git a/lldb/source/Target/Target.cpp b/lldb/source/Target/Target.cpp index c512a05279c..18efd8cb724 100644 --- a/lldb/source/Target/Target.cpp +++ b/lldb/source/Target/Target.cpp @@ -192,7 +192,7 @@ Target::Destroy() DeleteCurrentProcess (); m_platform_sp.reset(); m_arch.Clear(); - m_images.Clear(); + ClearModules(); m_section_load_list.Clear(); const bool notify = false; m_breakpoint_list.RemoveAll(notify); @@ -201,9 +201,6 @@ Target::Destroy() m_last_created_watchpoint.reset(); m_search_filter_sp.reset(); m_image_search_paths.Clear(notify); - m_scratch_ast_context_ap.reset(); - m_scratch_ast_source_ap.reset(); - m_ast_importer_ap.reset(); m_persistent_variables.Clear(); m_stop_hooks.clear(); m_stop_hook_next_id = 0; @@ -1017,13 +1014,21 @@ LoadScriptingResourceForModule (const ModuleSP &module_sp, Target *target) } void -Target::SetExecutableModule (ModuleSP& executable_sp, bool get_dependent_files) +Target::ClearModules() { - Log *log(lldb_private::GetLogIfAllCategoriesSet (LIBLLDB_LOG_TARGET)); + ModulesDidUnload (m_images, true); + GetSectionLoadList().Clear(); m_images.Clear(); m_scratch_ast_context_ap.reset(); m_scratch_ast_source_ap.reset(); m_ast_importer_ap.reset(); +} + +void +Target::SetExecutableModule (ModuleSP& executable_sp, bool get_dependent_files) +{ + Log *log(lldb_private::GetLogIfAllCategoriesSet (LIBLLDB_LOG_TARGET)); + ClearModules(); if (executable_sp.get()) { @@ -1092,10 +1097,8 @@ Target::SetArchitecture (const ArchSpec &arch_spec) log->Printf ("Target::SetArchitecture changing architecture to %s (%s)", arch_spec.GetArchitectureName(), arch_spec.GetTriple().getTriple().c_str()); m_arch = arch_spec; ModuleSP executable_sp = GetExecutableModule (); - m_images.Clear(); - m_scratch_ast_context_ap.reset(); - m_scratch_ast_source_ap.reset(); - m_ast_importer_ap.reset(); + + ClearModules(); // Need to do something about unsetting breakpoints. if (executable_sp) @@ -1140,7 +1143,7 @@ Target::ModuleRemoved (const ModuleList& module_list, const ModuleSP &module_sp) // A module is being added to this target for the first time ModuleList my_module_list; my_module_list.Append(module_sp); - ModulesDidUnload (my_module_list); + ModulesDidUnload (my_module_list, false); } void @@ -1155,7 +1158,7 @@ Target::ModulesDidLoad (ModuleList &module_list) { if (module_list.GetSize()) { - m_breakpoint_list.UpdateBreakpoints (module_list, true); + m_breakpoint_list.UpdateBreakpoints (module_list, true, false); if (m_process_sp) { SystemRuntime *sys_runtime = m_process_sp->GetSystemRuntime(); @@ -1184,17 +1187,17 @@ Target::SymbolsDidLoad (ModuleList &module_list) } } - m_breakpoint_list.UpdateBreakpoints (module_list, true); + m_breakpoint_list.UpdateBreakpoints (module_list, true, false); BroadcastEvent(eBroadcastBitSymbolsLoaded, NULL); } } void -Target::ModulesDidUnload (ModuleList &module_list) +Target::ModulesDidUnload (ModuleList &module_list, bool delete_locations) { if (module_list.GetSize()) { - m_breakpoint_list.UpdateBreakpoints (module_list, false); + m_breakpoint_list.UpdateBreakpoints (module_list, false, delete_locations); // TODO: make event data that packages up the module_list BroadcastEvent (eBroadcastBitModulesUnloaded, NULL); } @@ -1737,10 +1740,7 @@ Target::ImageSearchPathsChanged Target *target = (Target *)baton; ModuleSP exe_module_sp (target->GetExecutableModule()); if (exe_module_sp) - { - target->m_images.Clear(); target->SetExecutableModule (exe_module_sp, true); - } } ClangASTContext * |

