summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
-rw-r--r--lldb/source/Commands/CommandObjectTarget.cpp6
-rw-r--r--lldb/test/load_unload/TestLoadUnload.py35
2 files changed, 41 insertions, 0 deletions
diff --git a/lldb/source/Commands/CommandObjectTarget.cpp b/lldb/source/Commands/CommandObjectTarget.cpp
index ecbbb729047..01bdfa9a261 100644
--- a/lldb/source/Commands/CommandObjectTarget.cpp
+++ b/lldb/source/Commands/CommandObjectTarget.cpp
@@ -92,6 +92,7 @@ public:
target->GetImageSearchPathList().Append (ConstString(from),
ConstString(to),
last_pair); // Notify if this is the last pair
+ result.SetStatus (eReturnStatusSuccessFinishNoResult);
}
else
{
@@ -138,6 +139,7 @@ public:
{
bool notify = true;
target->GetImageSearchPathList().Clear(notify);
+ result.SetStatus (eReturnStatusSuccessFinishNoResult);
}
else
{
@@ -233,6 +235,7 @@ public:
ConstString(to),
insert_idx,
last_pair);
+ result.SetStatus (eReturnStatusSuccessFinishNoResult);
}
else
{
@@ -293,6 +296,7 @@ public:
}
target->GetImageSearchPathList().Dump(&result.GetOutputStream());
+ result.SetStatus (eReturnStatusSuccessFinishResult);
}
else
{
@@ -351,6 +355,8 @@ public:
result.GetOutputStream().Printf("%s\n", transformed.GetCString());
else
result.GetOutputStream().Printf("%s\n", orig.GetCString());
+
+ result.SetStatus (eReturnStatusSuccessFinishResult);
}
else
{
diff --git a/lldb/test/load_unload/TestLoadUnload.py b/lldb/test/load_unload/TestLoadUnload.py
index 98487d880fe..f4db75c961f 100644
--- a/lldb/test/load_unload/TestLoadUnload.py
+++ b/lldb/test/load_unload/TestLoadUnload.py
@@ -21,6 +21,41 @@ class LoadUnloadTestCase(TestBase):
self.line_d_function = line_number('d.c',
'// Find this line number within d_dunction().')
+ def test_image_search_paths(self):
+ """Test image list after moving libd.dylib, and verifies that it works with 'target image-search-paths add'."""
+
+ # Invoke the default build rule.
+ self.buildDefault()
+
+ if sys.platform.startswith("darwin"):
+ dylibName = 'libd.dylib'
+
+ # Now let's move the dynamic library to a different directory than $CWD.
+
+ # The directory to relocate the dynamic library to.
+ new_dir = os.path.join(os.getcwd(), "dyld_path")
+
+ # This is the function to remove the dyld_path directory after the test.
+ def remove_dyld_dir():
+ import shutil
+ shutil.rmtree(new_dir)
+
+ old_dylib = os.path.join(os.getcwd(), dylibName)
+ new_dylib = os.path.join(new_dir, dylibName)
+
+ os.mkdir(new_dir)
+ os.rename(old_dylib, new_dylib)
+ self.addTearDownHook(remove_dyld_dir)
+
+ exe = os.path.join(os.getcwd(), "a.out")
+ self.runCmd("file " + exe, CURRENT_EXECUTABLE_SET)
+ self.expect("image list",
+ substrs = [old_dylib])
+ self.runCmd("target image-search-paths add %s %s" % (os.getcwd(), new_dir))
+ self.expect("image list", "LLDB successfully locates the relocated dynamic library",
+ substrs = [new_dylib])
+
+
def test_dyld_library_path(self):
"""Test DYLD_LIBRARY_PATH after moving libd.dylib, which defines d_function, somewhere else."""
OpenPOWER on IntegriCloud