Fixed an issue where we were resolving paths when we should have been.

So the issue here was that we have lldb_private::FileSpec that by default was 
always resolving a path when using the:

FileSpec::FileSpec (const char *path);

and in the:

void FileSpec::SetFile(const char *pathname, bool resolve = true);

This isn't what we want in many many cases. One example is you have "/tmp" on
your file system which is really "/private/tmp". You compile code in that
directory and end up with debug info that mentions "/tmp/file.c". Then you 
type:

(lldb) breakpoint set --file file.c --line 5

If your current working directory is "/tmp", then "file.c" would be turned 
into "/private/tmp/file.c" which won't match anything in the debug info.
Also, it should have been just a FileSpec with no directory and a filename
of "file.c" which could (and should) potentially match any instances of "file.c"
in the debug info.

So I removed the constructor that just takes a path:

FileSpec::FileSpec (const char *path); // REMOVED

You must now use the other constructor that has a "bool resolve" parameter that you must always supply:

FileSpec::FileSpec (const char *path, bool resolve);

I also removed the default parameter to SetFile():

void FileSpec::SetFile(const char *pathname, bool resolve);

And fixed all of the code to use the right settings.



git-svn-id: https://llvm.org/svn/llvm-project/llvdb/trunk@116944 91177308-0d34-0410-b5e6-96231b3b80d8
diff --git a/source/Commands/CommandCompletions.cpp b/source/Commands/CommandCompletions.cpp
index 42275cb..91a6cfe 100644
--- a/source/Commands/CommandCompletions.cpp
+++ b/source/Commands/CommandCompletions.cpp
@@ -469,7 +469,7 @@
     m_include_support_files (include_support_files),
     m_matching_files()
 {
-    FileSpec partial_spec (m_completion_str.c_str());
+    FileSpec partial_spec (m_completion_str.c_str(), false);
     m_file_name = partial_spec.GetFilename().GetCString();
     m_dir_name = partial_spec.GetDirectory().GetCString();
 }
@@ -661,7 +661,7 @@
 ) :
     CommandCompletions::Completer (interpreter, completion_str, match_start_point, max_return_elements, matches)
 {
-    FileSpec partial_spec (m_completion_str.c_str());
+    FileSpec partial_spec (m_completion_str.c_str(), false);
     m_file_name = partial_spec.GetFilename().GetCString();
     m_dir_name = partial_spec.GetDirectory().GetCString();
 }
diff --git a/source/Commands/CommandObjectBreakpoint.cpp b/source/Commands/CommandObjectBreakpoint.cpp
index c642ae5..55e83fe 100644
--- a/source/Commands/CommandObjectBreakpoint.cpp
+++ b/source/Commands/CommandObjectBreakpoint.cpp
@@ -307,7 +307,7 @@
 
     ModuleSP module_sp = target->GetExecutableModule();
     Breakpoint *bp = NULL;
-    FileSpec module;
+    FileSpec module_spec;
     bool use_module = false;
     int num_modules = m_options.m_modules.size();
 
@@ -354,15 +354,15 @@
                 }
                 else
                 {
-                    file.SetFile(m_options.m_filename.c_str());
+                    file.SetFile(m_options.m_filename.c_str(), false);
                 }
 
                 if (use_module)
                 {
                     for (int i = 0; i < num_modules; ++i)
                     {
-                        module.SetFile(m_options.m_modules[i].c_str());
-                        bp = target->CreateBreakpoint (&module,
+                        module_spec.SetFile(m_options.m_modules[i].c_str(), false);
+                        bp = target->CreateBreakpoint (&module_spec,
                                                        file,
                                                        m_options.m_line_num,
                                                        m_options.m_ignore_inlines).get();
@@ -405,8 +405,11 @@
                 {
                     for (int i = 0; i < num_modules; ++i)
                     {
-                        module.SetFile(m_options.m_modules[i].c_str());
-                        bp = target->CreateBreakpoint (&module, m_options.m_func_name.c_str(), name_type_mask, Breakpoint::Exact).get();
+                        module_spec.SetFile(m_options.m_modules[i].c_str(), false);
+                        bp = target->CreateBreakpoint (&module_spec, 
+                                                       m_options.m_func_name.c_str(), 
+                                                       name_type_mask, 
+                                                       Breakpoint::Exact).get();
                         if (bp)
                         {
                             StreamString &output_stream = result.GetOutputStream();
@@ -435,8 +438,8 @@
                 {
                     for (int i = 0; i < num_modules; ++i)
                     {
-                        module.SetFile(m_options.m_modules[i].c_str());
-                        bp = target->CreateBreakpoint (&module, regexp).get();
+                        module_spec.SetFile(m_options.m_modules[i].c_str(), false);
+                        bp = target->CreateBreakpoint (&module_spec, regexp).get();
                         if (bp)
                         {
                             StreamString &output_stream = result.GetOutputStream();
diff --git a/source/Commands/CommandObjectCommands.cpp b/source/Commands/CommandObjectCommands.cpp
index 349c3fc..dd5ab32 100644
--- a/source/Commands/CommandObjectCommands.cpp
+++ b/source/Commands/CommandObjectCommands.cpp
@@ -70,7 +70,7 @@
 
             result.AppendMessageWithFormat ("Executing commands in '%s'.\n", filename);
 
-            FileSpec cmd_file (filename);
+            FileSpec cmd_file (filename, false);
             if (cmd_file.Exists())
             {
                 STLStringArray commands;
diff --git a/source/Commands/CommandObjectFile.cpp b/source/Commands/CommandObjectFile.cpp
index 737b0cb..45dc2a9 100644
--- a/source/Commands/CommandObjectFile.cpp
+++ b/source/Commands/CommandObjectFile.cpp
@@ -127,7 +127,7 @@
     const int argc = command.GetArgumentCount();
     if (argc == 1)
     {
-        FileSpec file_spec (file_path);
+        FileSpec file_spec (file_path, true);
 
         if (! file_spec.Exists() && !file_spec.ResolveExecutableLocation())
         {
diff --git a/source/Commands/CommandObjectImage.cpp b/source/Commands/CommandObjectImage.cpp
index ebbc0f1..53db6df 100644
--- a/source/Commands/CommandObjectImage.cpp
+++ b/source/Commands/CommandObjectImage.cpp
@@ -656,7 +656,7 @@
                 const char *arg_cstr;
                 for (int arg_idx = 0; (arg_cstr = command.GetArgumentAtIndex(arg_idx)) != NULL; ++arg_idx)
                 {
-                    FileSpec image_file(arg_cstr);
+                    FileSpec image_file(arg_cstr, false);
                     ModuleList matching_modules;
                     size_t num_matching_modules = target->GetImages().FindModules(&image_file, NULL, NULL, NULL, matching_modules);
 
@@ -861,7 +861,7 @@
                 const char *arg_cstr;
                 for (int arg_idx = 0; (arg_cstr = command.GetArgumentAtIndex(arg_idx)) != NULL; ++arg_idx)
                 {
-                    FileSpec image_file(arg_cstr);
+                    FileSpec image_file(arg_cstr, false);
                     ModuleList matching_modules;
                     size_t num_matching_modules = target->GetImages().FindModules(&image_file, NULL, NULL, NULL, matching_modules);
 
@@ -969,7 +969,7 @@
                 const char *arg_cstr;
                 for (int arg_idx = 0; (arg_cstr = command.GetArgumentAtIndex(arg_idx)) != NULL; ++arg_idx)
                 {
-                    FileSpec image_file(arg_cstr);
+                    FileSpec image_file(arg_cstr, false);
                     ModuleList matching_modules;
                     size_t num_matching_modules = target->GetImages().FindModules(&image_file, NULL, NULL, NULL, matching_modules);
 
@@ -1062,7 +1062,7 @@
                 const char *arg_cstr;
                 for (int arg_idx = 0; (arg_cstr = command.GetArgumentAtIndex(arg_idx)) != NULL; ++arg_idx)
                 {
-                    FileSpec file_spec(arg_cstr);
+                    FileSpec file_spec(arg_cstr, false);
                     const uint32_t num_modules = target->GetImages().GetSize();
                     if (num_modules > 0)
                     {
@@ -1381,7 +1381,7 @@
                 break;
 
             case 'f':
-                m_file.SetFile (option_arg);
+                m_file.SetFile (option_arg, false);
                 m_type = eLookupTypeFileLine;
                 break;
 
@@ -1627,7 +1627,7 @@
                 const char *arg_cstr;
                 for (i = 0; (arg_cstr = command.GetArgumentAtIndex(i)) != NULL && syntax_error == false; ++i)
                 {
-                    FileSpec image_file(arg_cstr);
+                    FileSpec image_file(arg_cstr, false);
                     ModuleList matching_modules;
                     size_t num_matching_modules = target->GetImages().FindModules(&image_file, NULL, NULL, NULL, matching_modules);
 
diff --git a/source/Commands/CommandObjectMemory.cpp b/source/Commands/CommandObjectMemory.cpp
index 767b472..3020c01 100644
--- a/source/Commands/CommandObjectMemory.cpp
+++ b/source/Commands/CommandObjectMemory.cpp
@@ -143,7 +143,7 @@
                 break;
 
             case 'o':
-                m_outfile_filespec.SetFile (option_arg);
+                m_outfile_filespec.SetFile (option_arg, true);
                 break;
 
             case 'b':
@@ -462,7 +462,7 @@
                 break;
 
             case 'i':
-                m_infile.SetFile (option_arg);
+                m_infile.SetFile (option_arg, true);
                 if (!m_infile.Exists())
                 {
                     m_infile.Clear();
diff --git a/source/Commands/CommandObjectSource.cpp b/source/Commands/CommandObjectSource.cpp
index 63d319e..88c18be 100644
--- a/source/Commands/CommandObjectSource.cpp
+++ b/source/Commands/CommandObjectSource.cpp
@@ -297,7 +297,7 @@
                 ModuleList matching_modules;
                 for (unsigned i = 0, e = m_options.m_modules.size(); i != e; i++)
                 {
-                    FileSpec module_spec(m_options.m_modules[i].c_str());
+                    FileSpec module_spec(m_options.m_modules[i].c_str(), false);
                     if (module_spec)
                     {
                         matching_modules.Clear();
@@ -471,7 +471,7 @@
                 ModuleList matching_modules;
                 for (unsigned i = 0, e = m_options.m_modules.size(); i != e; i++)
                 {
-                    FileSpec module_spec(m_options.m_modules[i].c_str());
+                    FileSpec module_spec(m_options.m_modules[i].c_str(), false);
                     if (module_spec)
                     {
                         matching_modules.Clear();