[Lldb-commits] [lldb] r273960 - fix invalid assumption about the executable module in Target::Install()
Todd Fiala via lldb-commits
lldb-commits at lists.llvm.org
Mon Jun 27 16:21:50 PDT 2016
Author: tfiala
Date: Mon Jun 27 18:21:49 2016
New Revision: 273960
URL: http://llvm.org/viewvc/llvm-project?rev=273960&view=rev
Log:
fix invalid assumption about the executable module in Target::Install()
Target::Install() was assuming the module at index 0 was the executable.
This is often true, but not guaranteed to be the case. The
TestInferiorChanged.py test highlighted this when run against iOS.
After the binary is replaced in the middle of the test, it becomes the
last module in the list. The rest of the Target::Install() logic then
clobbers the executable file by using whatever happens to be the first
module in the target module list.
This change also marks the TestInferiorChanged.py test as a no-debug-info
test.
Modified:
lldb/trunk/packages/Python/lldbsuite/test/functionalities/inferior-changed/TestInferiorChanged.py
lldb/trunk/source/Target/Target.cpp
Modified: lldb/trunk/packages/Python/lldbsuite/test/functionalities/inferior-changed/TestInferiorChanged.py
URL: http://llvm.org/viewvc/llvm-project/lldb/trunk/packages/Python/lldbsuite/test/functionalities/inferior-changed/TestInferiorChanged.py?rev=273960&r1=273959&r2=273960&view=diff
==============================================================================
--- lldb/trunk/packages/Python/lldbsuite/test/functionalities/inferior-changed/TestInferiorChanged.py (original)
+++ lldb/trunk/packages/Python/lldbsuite/test/functionalities/inferior-changed/TestInferiorChanged.py Mon Jun 27 18:21:49 2016
@@ -16,6 +16,7 @@ class ChangedInferiorTestCase(TestBase):
mydir = TestBase.compute_mydir(__file__)
@skipIf(hostoslist=["windows"])
+ @no_debug_info_test
def test_inferior_crashing(self):
"""Test lldb reloads the inferior after it was changed during the session."""
self.build()
Modified: lldb/trunk/source/Target/Target.cpp
URL: http://llvm.org/viewvc/llvm-project/lldb/trunk/source/Target/Target.cpp?rev=273960&r1=273959&r2=273960&view=diff
==============================================================================
--- lldb/trunk/source/Target/Target.cpp (original)
+++ lldb/trunk/source/Target/Target.cpp Mon Jun 27 18:21:49 2016
@@ -2838,10 +2838,10 @@ Target::Install (ProcessLaunchInfo *laun
const size_t num_images = modules.GetSize();
for (size_t idx = 0; idx < num_images; ++idx)
{
- const bool is_main_executable = idx == 0;
ModuleSP module_sp(modules.GetModuleAtIndex(idx));
if (module_sp)
{
+ const bool is_main_executable = module_sp == GetExecutableModule();
FileSpec local_file (module_sp->GetFileSpec());
if (local_file)
{
More information about the lldb-commits
mailing list