rdar://problem/10227672
There were two problems associated with this radar:
1. "settings show target.source-map" failed to show the source-map after, for example,
"settings set target.source-map /Volumes/data/lldb/svn/trunk/test/source-manager /Volumes/data/lldb/svn/trunk/test/source-manager/hidden"
has been executed to set the source-map.
2. "list -n main" failed to display the source of the main() function after we properly set the source-map.
The first was fixed by adding the missing functionality to TargetInstanceSettings::GetInstanceSettingsValue (Target.cpp)
and updating the support files PathMappingList.h/.cpp; the second by modifying SourceManager.cpp to fix several places
with incorrect logic.
Also added a test case test_move_and_then_display_source() to TestSourceManager.py, which moves main.c to hidden/main.c,
sets target.source-map to perform the directory mapping, and then verifies that "list -n main" can still show the main()
function.
git-svn-id: https://llvm.org/svn/llvm-project/lldb/trunk@146422 91177308-0d34-0410-b5e6-96231b3b80d8
diff --git a/source/Target/Target.cpp b/source/Target/Target.cpp
index a887866..902ffc7 100644
--- a/source/Target/Target.cpp
+++ b/source/Target/Target.cpp
@@ -2486,6 +2486,15 @@
}
else if (var_name == GetSettingNameForSourcePathMap ())
{
+ if (m_source_map.GetSize())
+ {
+ size_t i;
+ for (i = 0; i < m_source_map.GetSize(); ++i) {
+ StreamString sstr;
+ m_source_map.Dump(&sstr, i);
+ value.AppendString(sstr.GetData());
+ }
+ }
}
else if (var_name == GetSettingNameForMaxChildren())
{