[Lldb-commits] [lldb] r116944 - in /lldb/trunk: include/lldb/API/ include/lldb/Core/ lldb.xcodeproj/ source/API/ source/Commands/ source/Core/ source/Host/common/ source/Host/macosx/ source/Interpreter/ source/Plugins/DynamicLoader/MacOSX-DYLD/ source/Plugins/ObjectFile/ELF/ source/Plugins/ObjectFile/Mach-O/ source/Plugins/Process/MacOSX-User/source/ source/Plugins/Process/gdb-remote/ source/Plugins/SymbolFile/DWARF/ source/Symbol/

Greg Clayton gclayton at apple.com
Wed Oct 20 13:54:39 PDT 2010


Author: gclayton
Date: Wed Oct 20 15:54:39 2010
New Revision: 116944

URL: http://llvm.org/viewvc/llvm-project?rev=116944&view=rev
Log:
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.


Modified:
    lldb/trunk/include/lldb/API/SBFileSpec.h
    lldb/trunk/include/lldb/Core/FileSpec.h
    lldb/trunk/lldb.xcodeproj/project.pbxproj
    lldb/trunk/source/API/SBDebugger.cpp
    lldb/trunk/source/API/SBFileSpec.cpp
    lldb/trunk/source/API/SBTarget.cpp
    lldb/trunk/source/Commands/CommandCompletions.cpp
    lldb/trunk/source/Commands/CommandObjectBreakpoint.cpp
    lldb/trunk/source/Commands/CommandObjectCommands.cpp
    lldb/trunk/source/Commands/CommandObjectFile.cpp
    lldb/trunk/source/Commands/CommandObjectImage.cpp
    lldb/trunk/source/Commands/CommandObjectMemory.cpp
    lldb/trunk/source/Commands/CommandObjectSource.cpp
    lldb/trunk/source/Core/FileSpec.cpp
    lldb/trunk/source/Core/Module.cpp
    lldb/trunk/source/Core/ModuleList.cpp
    lldb/trunk/source/Host/common/Host.cpp
    lldb/trunk/source/Host/macosx/Host.mm
    lldb/trunk/source/Host/macosx/Symbols.cpp
    lldb/trunk/source/Interpreter/CommandInterpreter.cpp
    lldb/trunk/source/Interpreter/Options.cpp
    lldb/trunk/source/Plugins/DynamicLoader/MacOSX-DYLD/DynamicLoaderMacOSXDYLD.cpp
    lldb/trunk/source/Plugins/ObjectFile/ELF/ObjectFileELF.cpp
    lldb/trunk/source/Plugins/ObjectFile/Mach-O/ObjectFileMachO.cpp
    lldb/trunk/source/Plugins/Process/MacOSX-User/source/ThreadMacOSX.cpp
    lldb/trunk/source/Plugins/Process/gdb-remote/ProcessGDBRemote.cpp
    lldb/trunk/source/Plugins/SymbolFile/DWARF/SymbolFileDWARFDebugMap.cpp
    lldb/trunk/source/Symbol/CompileUnit.cpp
    lldb/trunk/source/Symbol/ObjectFile.cpp

Modified: lldb/trunk/include/lldb/API/SBFileSpec.h
URL: http://llvm.org/viewvc/llvm-project/lldb/trunk/include/lldb/API/SBFileSpec.h?rev=116944&r1=116943&r2=116944&view=diff
==============================================================================
--- lldb/trunk/include/lldb/API/SBFileSpec.h (original)
+++ lldb/trunk/include/lldb/API/SBFileSpec.h Wed Oct 20 15:54:39 2010
@@ -21,7 +21,9 @@
 
     SBFileSpec (const lldb::SBFileSpec &rhs);
 
-    SBFileSpec (const char *path);
+    SBFileSpec (const char *path);// Deprected, use SBFileSpec (const char *path, bool resolve)
+
+    SBFileSpec (const char *path, bool resolve);
 
     ~SBFileSpec ();
 

Modified: lldb/trunk/include/lldb/Core/FileSpec.h
URL: http://llvm.org/viewvc/llvm-project/lldb/trunk/include/lldb/Core/FileSpec.h?rev=116944&r1=116943&r2=116944&view=diff
==============================================================================
--- lldb/trunk/include/lldb/Core/FileSpec.h (original)
+++ lldb/trunk/include/lldb/Core/FileSpec.h Wed Oct 20 15:54:39 2010
@@ -53,23 +53,11 @@
     FileSpec();
 
     //------------------------------------------------------------------
-    /// Default constructor.
+    /// Constructor with path.
     ///
-    /// Takes an optional full path to a file. If \a path is valid,
-    /// this function will call FileSpec::SetFile (\a path).
-    ///
-    /// @param[in] path
-    ///     The full or partial path to a file.
-    ///
-    /// @see FileSpec::SetFile ()
-    //------------------------------------------------------------------
-    explicit FileSpec (const char *path);
-
-    //------------------------------------------------------------------
-    /// Default constructor.
-    ///
-    /// Takes an optional full path to a file. If \a path is valid,
-    /// this function will call FileSpec::SetFile (\a path).
+    /// Takes an path to a file which can be just a filename, or a full
+    /// path. If \a path is not NULL or empty, this function will call
+    /// FileSpec::SetFile (const char *path, bool resolve).
     ///
     /// @param[in] path
     ///     The full or partial path to a file.
@@ -78,7 +66,7 @@
     ///     If \b true, then we resolve the path with realpath,
     ///     if \b false we trust the path is in canonical form already.
     ///
-    /// @see FileSpec::SetFile ()
+    /// @see FileSpec::SetFile (const char *path, bool resolve)
     //------------------------------------------------------------------
     explicit FileSpec (const char *path, bool resolve_path);
 
@@ -463,7 +451,7 @@
     ///     the static FileSpec::Resolve.
     //------------------------------------------------------------------
     void
-    SetFile (const char *path, bool resolve = true);
+    SetFile (const char *path, bool resolve);
 
     //------------------------------------------------------------------
     /// Read the file into an array of strings, one per line.

Modified: lldb/trunk/lldb.xcodeproj/project.pbxproj
URL: http://llvm.org/viewvc/llvm-project/lldb/trunk/lldb.xcodeproj/project.pbxproj?rev=116944&r1=116943&r2=116944&view=diff
==============================================================================
--- lldb/trunk/lldb.xcodeproj/project.pbxproj (original)
+++ lldb/trunk/lldb.xcodeproj/project.pbxproj Wed Oct 20 15:54:39 2010
@@ -2976,7 +2976,7 @@
 				GCC_WARN_ABOUT_RETURN_TYPE = YES;
 				GCC_WARN_HIDDEN_VIRTUAL_FUNCTIONS = YES;
 				GCC_WARN_UNUSED_VARIABLE = YES;
-				ONLY_ACTIVE_ARCH = YES;
+				ONLY_ACTIVE_ARCH = NO;
 				PREBINDING = NO;
 				VALID_ARCHS = "x86_64 i386";
 			};

Modified: lldb/trunk/source/API/SBDebugger.cpp
URL: http://llvm.org/viewvc/llvm-project/lldb/trunk/source/API/SBDebugger.cpp?rev=116944&r1=116943&r2=116944&view=diff
==============================================================================
--- lldb/trunk/source/API/SBDebugger.cpp (original)
+++ lldb/trunk/source/API/SBDebugger.cpp Wed Oct 20 15:54:39 2010
@@ -381,7 +381,7 @@
     if (m_opaque_sp)
     {
         ArchSpec arch;
-        FileSpec file_spec (filename);
+        FileSpec file_spec (filename, true);
         arch.SetArchFromTargetTriple(target_triple);
         TargetSP target_sp;
         Error error (m_opaque_sp->GetTargetList().CreateTarget (*m_opaque_sp, file_spec, arch, NULL, true, target_sp));
@@ -396,7 +396,7 @@
     SBTarget target;
     if (m_opaque_sp)
     {
-        FileSpec file (filename);
+        FileSpec file (filename, true);
         ArchSpec arch = lldb_private::Target::GetDefaultArchitecture ();
         TargetSP target_sp;
         Error error;
@@ -439,7 +439,7 @@
     SBTarget target;
     if (m_opaque_sp)
     {
-        FileSpec file (filename);
+        FileSpec file (filename, true);
         ArchSpec arch = lldb_private::Target::GetDefaultArchitecture ();
         TargetSP target_sp;
         Error error;
@@ -495,7 +495,7 @@
         ArchSpec arch;
         if (arch_name)
             arch.SetArch(arch_name);
-        TargetSP target_sp (m_opaque_sp->GetTargetList().FindTargetWithExecutableAndArchitecture (FileSpec(filename), arch_name ? &arch : NULL));
+        TargetSP target_sp (m_opaque_sp->GetTargetList().FindTargetWithExecutableAndArchitecture (FileSpec(filename, false), arch_name ? &arch : NULL));
         sb_target.reset(target_sp);
     }
     return sb_target;

Modified: lldb/trunk/source/API/SBFileSpec.cpp
URL: http://llvm.org/viewvc/llvm-project/lldb/trunk/source/API/SBFileSpec.cpp?rev=116944&r1=116943&r2=116944&view=diff
==============================================================================
--- lldb/trunk/source/API/SBFileSpec.cpp (original)
+++ lldb/trunk/source/API/SBFileSpec.cpp Wed Oct 20 15:54:39 2010
@@ -28,8 +28,14 @@
         m_opaque_ap.reset (new FileSpec (rhs.get()));
 }
 
+// Deprected!!!
 SBFileSpec::SBFileSpec (const char *path) :
-    m_opaque_ap(new FileSpec (path))
+    m_opaque_ap(new FileSpec (path, true))
+{
+}
+
+SBFileSpec::SBFileSpec (const char *path, bool resolve) :
+    m_opaque_ap(new FileSpec (path, resolve))
 {
 }
 

Modified: lldb/trunk/source/API/SBTarget.cpp
URL: http://llvm.org/viewvc/llvm-project/lldb/trunk/source/API/SBTarget.cpp?rev=116944&r1=116943&r2=116944&view=diff
==============================================================================
--- lldb/trunk/source/API/SBTarget.cpp (original)
+++ lldb/trunk/source/API/SBTarget.cpp Wed Oct 20 15:54:39 2010
@@ -355,7 +355,7 @@
     {
         if (module_name && module_name[0])
         {
-            FileSpec module_file_spec(module_name);
+            FileSpec module_file_spec(module_name, false);
             *sb_bp = m_opaque_sp->CreateBreakpoint (&module_file_spec, symbol_name, eFunctionNameTypeFull | eFunctionNameTypeBase, false);
         }
         else
@@ -376,7 +376,7 @@
         
         if (module_name && module_name[0])
         {
-            FileSpec module_file_spec(module_name);
+            FileSpec module_file_spec(module_name, false);
             
             *sb_bp = m_opaque_sp->CreateBreakpoint (&module_file_spec, regexp, false);
         }
@@ -523,7 +523,7 @@
         ModuleSP module_sp;
         if (module_name != NULL)
         {
-            FileSpec module_file_spec (module_name);
+            FileSpec module_file_spec (module_name, false);
             module_sp = m_opaque_sp->GetImages().FindFirstModuleForFileSpec (module_file_spec, NULL);
         }
         
@@ -602,7 +602,7 @@
         ModuleSP module_sp;
         if (module_name != NULL)
         {
-            FileSpec module_file_spec (module_name);
+            FileSpec module_file_spec (module_name, false);
             module_sp = m_opaque_sp->GetImages().FindFirstModuleForFileSpec (module_file_spec, NULL);
         }
 

Modified: lldb/trunk/source/Commands/CommandCompletions.cpp
URL: http://llvm.org/viewvc/llvm-project/lldb/trunk/source/Commands/CommandCompletions.cpp?rev=116944&r1=116943&r2=116944&view=diff
==============================================================================
--- lldb/trunk/source/Commands/CommandCompletions.cpp (original)
+++ lldb/trunk/source/Commands/CommandCompletions.cpp Wed Oct 20 15:54:39 2010
@@ -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();
 }

Modified: lldb/trunk/source/Commands/CommandObjectBreakpoint.cpp
URL: http://llvm.org/viewvc/llvm-project/lldb/trunk/source/Commands/CommandObjectBreakpoint.cpp?rev=116944&r1=116943&r2=116944&view=diff
==============================================================================
--- lldb/trunk/source/Commands/CommandObjectBreakpoint.cpp (original)
+++ lldb/trunk/source/Commands/CommandObjectBreakpoint.cpp Wed Oct 20 15:54:39 2010
@@ -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();

Modified: lldb/trunk/source/Commands/CommandObjectCommands.cpp
URL: http://llvm.org/viewvc/llvm-project/lldb/trunk/source/Commands/CommandObjectCommands.cpp?rev=116944&r1=116943&r2=116944&view=diff
==============================================================================
--- lldb/trunk/source/Commands/CommandObjectCommands.cpp (original)
+++ lldb/trunk/source/Commands/CommandObjectCommands.cpp Wed Oct 20 15:54:39 2010
@@ -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;

Modified: lldb/trunk/source/Commands/CommandObjectFile.cpp
URL: http://llvm.org/viewvc/llvm-project/lldb/trunk/source/Commands/CommandObjectFile.cpp?rev=116944&r1=116943&r2=116944&view=diff
==============================================================================
--- lldb/trunk/source/Commands/CommandObjectFile.cpp (original)
+++ lldb/trunk/source/Commands/CommandObjectFile.cpp Wed Oct 20 15:54:39 2010
@@ -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())
         {

Modified: lldb/trunk/source/Commands/CommandObjectImage.cpp
URL: http://llvm.org/viewvc/llvm-project/lldb/trunk/source/Commands/CommandObjectImage.cpp?rev=116944&r1=116943&r2=116944&view=diff
==============================================================================
--- lldb/trunk/source/Commands/CommandObjectImage.cpp (original)
+++ lldb/trunk/source/Commands/CommandObjectImage.cpp Wed Oct 20 15:54:39 2010
@@ -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);
 

Modified: lldb/trunk/source/Commands/CommandObjectMemory.cpp
URL: http://llvm.org/viewvc/llvm-project/lldb/trunk/source/Commands/CommandObjectMemory.cpp?rev=116944&r1=116943&r2=116944&view=diff
==============================================================================
--- lldb/trunk/source/Commands/CommandObjectMemory.cpp (original)
+++ lldb/trunk/source/Commands/CommandObjectMemory.cpp Wed Oct 20 15:54:39 2010
@@ -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();

Modified: lldb/trunk/source/Commands/CommandObjectSource.cpp
URL: http://llvm.org/viewvc/llvm-project/lldb/trunk/source/Commands/CommandObjectSource.cpp?rev=116944&r1=116943&r2=116944&view=diff
==============================================================================
--- lldb/trunk/source/Commands/CommandObjectSource.cpp (original)
+++ lldb/trunk/source/Commands/CommandObjectSource.cpp Wed Oct 20 15:54:39 2010
@@ -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();

Modified: lldb/trunk/source/Core/FileSpec.cpp
URL: http://llvm.org/viewvc/llvm-project/lldb/trunk/source/Core/FileSpec.cpp?rev=116944&r1=116943&r2=116944&view=diff
==============================================================================
--- lldb/trunk/source/Core/FileSpec.cpp (original)
+++ lldb/trunk/source/Core/FileSpec.cpp Wed Oct 20 15:54:39 2010
@@ -174,18 +174,6 @@
 // Default constructor that can take an optional full path to a
 // file on disk.
 //------------------------------------------------------------------
-FileSpec::FileSpec(const char *pathname) :
-    m_directory(),
-    m_filename()
-{
-    if (pathname && pathname[0])
-        SetFile(pathname);
-}
-
-//------------------------------------------------------------------
-// Default constructor that can take an optional full path to a
-// file on disk.
-//------------------------------------------------------------------
 FileSpec::FileSpec(const char *pathname, bool resolve_path) :
     m_directory(),
     m_filename()
@@ -447,7 +435,7 @@
 bool
 FileSpec::ResolveExecutableLocation ()
 {
-    if (m_directory.GetLength() == 0)
+    if (!m_directory)
     {
         const std::string file_str (m_filename.AsCString());
         llvm::sys::Path path = llvm::sys::Program::FindProgramByName (file_str);
@@ -465,7 +453,7 @@
             {
                 // If FindProgramByName found the file, it returns the directory + filename in its return results.
                 // We need to separate them.
-                FileSpec tmp_file (dir_ref.data());
+                FileSpec tmp_file (dir_ref.data(), false);
                 if (tmp_file.Exists())
                 {
                     m_directory = tmp_file.m_directory;

Modified: lldb/trunk/source/Core/Module.cpp
URL: http://llvm.org/viewvc/llvm-project/lldb/trunk/source/Core/Module.cpp?rev=116944&r1=116943&r2=116944&view=diff
==============================================================================
--- lldb/trunk/source/Core/Module.cpp (original)
+++ lldb/trunk/source/Core/Module.cpp Wed Oct 20 15:54:39 2010
@@ -241,9 +241,16 @@
 }
 
 uint32_t
-Module::ResolveSymbolContextForFilePath (const char *file_path, uint32_t line, bool check_inlines, uint32_t resolve_scope, SymbolContextList& sc_list)
+Module::ResolveSymbolContextForFilePath 
+(
+    const char *file_path, 
+    uint32_t line, 
+    bool check_inlines, 
+    uint32_t resolve_scope, 
+    SymbolContextList& sc_list
+)
 {
-    FileSpec file_spec(file_path);
+    FileSpec file_spec(file_path, false);
     return ResolveSymbolContextsForFileSpec (file_spec, line, check_inlines, resolve_scope, sc_list);
 }
 

Modified: lldb/trunk/source/Core/ModuleList.cpp
URL: http://llvm.org/viewvc/llvm-project/lldb/trunk/source/Core/ModuleList.cpp?rev=116944&r1=116943&r2=116944&view=diff
==============================================================================
--- lldb/trunk/source/Core/ModuleList.cpp (original)
+++ lldb/trunk/source/Core/ModuleList.cpp Wed Oct 20 15:54:39 2010
@@ -405,9 +405,16 @@
 }
 
 uint32_t
-ModuleList::ResolveSymbolContextForFilePath (const char *file_path, uint32_t line, bool check_inlines, uint32_t resolve_scope, SymbolContextList& sc_list)
+ModuleList::ResolveSymbolContextForFilePath 
+(
+    const char *file_path, 
+    uint32_t line, 
+    bool check_inlines, 
+    uint32_t resolve_scope, 
+    SymbolContextList& sc_list
+)
 {
-    FileSpec file_spec(file_path);
+    FileSpec file_spec(file_path, false);
     return ResolveSymbolContextsForFileSpec (file_spec, line, check_inlines, resolve_scope, sc_list);
 }
 

Modified: lldb/trunk/source/Host/common/Host.cpp
URL: http://llvm.org/viewvc/llvm-project/lldb/trunk/source/Host/common/Host.cpp?rev=116944&r1=116943&r2=116944&view=diff
==============================================================================
--- lldb/trunk/source/Host/common/Host.cpp (original)
+++ lldb/trunk/source/Host/common/Host.cpp Wed Oct 20 15:54:39 2010
@@ -581,14 +581,14 @@
         uint32_t len = sizeof(program_fullpath);
         int err = _NSGetExecutablePath (program_fullpath, &len);
         if (err == 0)
-            g_program_filespec.SetFile (program_fullpath);
+            g_program_filespec.SetFile (program_fullpath, true);
         else if (err == -1)
         {
             char *large_program_fullpath = (char *)::malloc (len + 1);
 
             err = _NSGetExecutablePath (large_program_fullpath, &len);
             if (err == 0)
-                g_program_filespec.SetFile (large_program_fullpath);
+                g_program_filespec.SetFile (large_program_fullpath, true);
 
             ::free (large_program_fullpath);
         }
@@ -619,7 +619,7 @@
     if (::dladdr (host_addr, &info))
     {
         if (info.dli_fname)
-            module_filespec.SetFile(info.dli_fname);
+            module_filespec.SetFile(info.dli_fname, true);
     }
     return module_filespec;
 }

Modified: lldb/trunk/source/Host/macosx/Host.mm
URL: http://llvm.org/viewvc/llvm-project/lldb/trunk/source/Host/macosx/Host.mm?rev=116944&r1=116943&r2=116944&view=diff
==============================================================================
--- lldb/trunk/source/Host/macosx/Host.mm (original)
+++ lldb/trunk/source/Host/macosx/Host.mm Wed Oct 20 15:54:39 2010
@@ -116,7 +116,7 @@
             {
                 if (::CFURLGetFileSystemRepresentation (url.get(), YES, (UInt8*)path, sizeof(path)))
                 {
-                    file.SetFile(path);
+                    file.SetFile(path, false);
                     return true;
                 }
             }
@@ -232,7 +232,7 @@
 
     OSStatus error = 0;
     
-    FileSpec program (argv[0]);
+    FileSpec program (argv[0], false);
     
     
     std::string unix_socket_name;

Modified: lldb/trunk/source/Host/macosx/Symbols.cpp
URL: http://llvm.org/viewvc/llvm-project/lldb/trunk/source/Host/macosx/Symbols.cpp?rev=116944&r1=116943&r2=116944&view=diff
==============================================================================
--- lldb/trunk/source/Host/macosx/Symbols.cpp (original)
+++ lldb/trunk/source/Host/macosx/Symbols.cpp Wed Oct 20 15:54:39 2010
@@ -239,8 +239,7 @@
         DIR* dirp = ::opendir(path);
         if (dirp != NULL)
         {
-            const size_t path_len = strlen(path);
-            const int bytes_left = sizeof(path) - path_len - 1;
+            dsym_fspec.GetDirectory().SetCString(path);
             struct dirent* dp;
             while ((dp = readdir(dirp)) != NULL)
             {
@@ -256,9 +255,7 @@
 
                 if (dp->d_type == DT_REG || dp->d_type == DT_UNKNOWN)
                 {
-                    ::strncpy (&path[path_len], dp->d_name, bytes_left);
-
-                    dsym_fspec.SetFile(path);
+                    dsym_fspec.GetFilename().SetCString(dp->d_name);
                     if (FileAtPathContainsArchAndUUID (dsym_fspec, arch, uuid))
                         return dsym_fspec;
                 }
@@ -334,7 +331,7 @@
                     {
                         if (::CFURLGetFileSystemRepresentation (dsym_url.get(), true, (UInt8*)path, sizeof(path)-1))
                         {
-                            out_dsym_fspec->SetFile(path);
+                            out_dsym_fspec->SetFile(path, false);
 
                             if (out_dsym_fspec->GetFileType () == FileSpec::eFileTypeDirectory)
                             {
@@ -358,7 +355,7 @@
                             if (exec_cf_path && ::CFStringGetFileSystemRepresentation (exec_cf_path, path, sizeof(path)))
                             {
                                 ++items_found;
-                                out_dsym_fspec->SetFile(path);
+                                out_dsym_fspec->SetFile(path, false);
                             }
                         }
                     }
@@ -384,7 +381,7 @@
                 strncat(path, ".dSYM/Contents/Resources/DWARF/", sizeof(path));
                 strncat(path, exec_fspec->GetFilename().AsCString(), sizeof(path));
 
-                dsym_fspec.SetFile(path);
+                dsym_fspec.SetFile(path, false);
 
                 if (FileAtPathContainsArchAndUUID (dsym_fspec, arch, uuid))
                 {
@@ -403,7 +400,7 @@
                             *next_slash = '\0';
                             strncat(path, ".dSYM/Contents/Resources/DWARF/", sizeof(path));
                             strncat(path, exec_fspec->GetFilename().AsCString(), sizeof(path));
-                            dsym_fspec.SetFile(path);
+                            dsym_fspec.SetFile(path, false);
                             if (dsym_fspec.Exists())
                                 return true;
                             else

Modified: lldb/trunk/source/Interpreter/CommandInterpreter.cpp
URL: http://llvm.org/viewvc/llvm-project/lldb/trunk/source/Interpreter/CommandInterpreter.cpp?rev=116944&r1=116943&r2=116944&view=diff
==============================================================================
--- lldb/trunk/source/Interpreter/CommandInterpreter.cpp (original)
+++ lldb/trunk/source/Interpreter/CommandInterpreter.cpp Wed Oct 20 15:54:39 2010
@@ -1074,7 +1074,7 @@
         return;
 
     const char *init_file_path = in_cwd ? "./.lldbinit" : "~/.lldbinit";
-    FileSpec init_file (init_file_path);
+    FileSpec init_file (init_file_path, true);
     // If the file exists, tell HandleCommand to 'source' it; this will do the actual broadcasting
     // of the commands back to any appropriate listener (see CommandObjectSource::Execute for more details).
 

Modified: lldb/trunk/source/Interpreter/Options.cpp
URL: http://llvm.org/viewvc/llvm-project/lldb/trunk/source/Interpreter/Options.cpp?rev=116944&r1=116943&r2=116944&view=diff
==============================================================================
--- lldb/trunk/source/Interpreter/Options.cpp (original)
+++ lldb/trunk/source/Interpreter/Options.cpp Wed Oct 20 15:54:39 2010
@@ -866,7 +866,7 @@
                 const char *module_name = input.GetArgumentAtIndex(cur_arg_pos);
                 if (module_name)
                 {
-                    FileSpec module_spec(module_name);
+                    FileSpec module_spec(module_name, false);
                     lldb::TargetSP target_sp = interpreter.GetDebugger().GetSelectedTarget();
                     // Search filters require a target...
                     if (target_sp != NULL)

Modified: lldb/trunk/source/Plugins/DynamicLoader/MacOSX-DYLD/DynamicLoaderMacOSXDYLD.cpp
URL: http://llvm.org/viewvc/llvm-project/lldb/trunk/source/Plugins/DynamicLoader/MacOSX-DYLD/DynamicLoaderMacOSXDYLD.cpp?rev=116944&r1=116943&r2=116944&view=diff
==============================================================================
--- lldb/trunk/source/Plugins/DynamicLoader/MacOSX-DYLD/DynamicLoaderMacOSXDYLD.cpp (original)
+++ lldb/trunk/source/Plugins/DynamicLoader/MacOSX-DYLD/DynamicLoaderMacOSXDYLD.cpp Wed Oct 20 15:54:39 2010
@@ -543,7 +543,7 @@
 
                         char raw_path[PATH_MAX];
                         m_process->ReadMemory (path_addr, raw_path, sizeof(raw_path), error);
-                        m_dyld_image_infos[i].file_spec.SetFile(raw_path);
+                        m_dyld_image_infos[i].file_spec.SetFile(raw_path, true);
                     }
                     assert(i == m_dyld_all_image_infos.dylib_info_count);
 
@@ -787,7 +787,7 @@
                 {
                     uint32_t name_offset = load_cmd_offset + data.GetU32 (&offset);
                     const char *path = data.PeekCStr (name_offset);
-                    lc_id_dylinker->SetFile (path);
+                    lc_id_dylinker->SetFile (path, true);
                 }
                 break;
 

Modified: lldb/trunk/source/Plugins/ObjectFile/ELF/ObjectFileELF.cpp
URL: http://llvm.org/viewvc/llvm-project/lldb/trunk/source/Plugins/ObjectFile/ELF/ObjectFileELF.cpp?rev=116944&r1=116943&r2=116944&view=diff
==============================================================================
--- lldb/trunk/source/Plugins/ObjectFile/ELF/ObjectFileELF.cpp (original)
+++ lldb/trunk/source/Plugins/ObjectFile/ELF/ObjectFileELF.cpp Wed Oct 20 15:54:39 2010
@@ -271,7 +271,7 @@
 
             uint32_t str_index = static_cast<uint32_t>(symbol.d_val);
             const char *lib_name = dynstr_data.PeekCStr(str_index);
-            m_filespec_ap->Append(FileSpec(lib_name));
+            m_filespec_ap->Append(FileSpec(lib_name, true));
         }
     }
 

Modified: lldb/trunk/source/Plugins/ObjectFile/Mach-O/ObjectFileMachO.cpp
URL: http://llvm.org/viewvc/llvm-project/lldb/trunk/source/Plugins/ObjectFile/Mach-O/ObjectFileMachO.cpp?rev=116944&r1=116943&r2=116944&view=diff
==============================================================================
--- lldb/trunk/source/Plugins/ObjectFile/Mach-O/ObjectFileMachO.cpp (original)
+++ lldb/trunk/source/Plugins/ObjectFile/Mach-O/ObjectFileMachO.cpp Wed Oct 20 15:54:39 2010
@@ -1412,7 +1412,7 @@
                 // @rpath/.../file
                 if (path && path[0] != '@')
                 {
-                    FileSpec file_spec(path);
+                    FileSpec file_spec(path, true);
                     if (files.AppendIfUnique(file_spec))
                         count++;
                 }

Modified: lldb/trunk/source/Plugins/Process/MacOSX-User/source/ThreadMacOSX.cpp
URL: http://llvm.org/viewvc/llvm-project/lldb/trunk/source/Plugins/Process/MacOSX-User/source/ThreadMacOSX.cpp?rev=116944&r1=116943&r2=116944&view=diff
==============================================================================
--- lldb/trunk/source/Plugins/Process/MacOSX-User/source/ThreadMacOSX.cpp (original)
+++ lldb/trunk/source/Plugins/Process/MacOSX-User/source/ThreadMacOSX.cpp Wed Oct 20 15:54:39 2010
@@ -111,13 +111,13 @@
         DataExtractor data(memory_buffer, sizeof(memory_buffer), m_process.GetByteOrder(), m_process.GetAddressByteSize());
         static ConstString g_dispatch_queue_offsets_symbol_name ("dispatch_queue_offsets");
         const Symbol *dispatch_queue_offsets_symbol = NULL;
-        ModuleSP module_sp(m_process.GetTarget().GetImages().FindFirstModuleForFileSpec (FileSpec("libSystem.B.dylib")));
+        ModuleSP module_sp(m_process.GetTarget().GetImages().FindFirstModuleForFileSpec (FileSpec("libSystem.B.dylib", false)));
         if (module_sp)
             dispatch_queue_offsets_symbol = module_sp->FindFirstSymbolWithNameAndType (g_dispatch_queue_offsets_symbol_name, eSymbolTypeData);
         
         if (dispatch_queue_offsets_symbol == NULL)
         {
-            module_sp = m_process.GetTarget().GetImages().FindFirstModuleForFileSpec (FileSpec("libdispatch.dylib"));
+            module_sp = m_process.GetTarget().GetImages().FindFirstModuleForFileSpec (FileSpec("libdispatch.dylib", false));
             if (module_sp)
                 dispatch_queue_offsets_symbol = module_sp->FindFirstSymbolWithNameAndType (g_dispatch_queue_offsets_symbol_name, eSymbolTypeData);
         }

Modified: lldb/trunk/source/Plugins/Process/gdb-remote/ProcessGDBRemote.cpp
URL: http://llvm.org/viewvc/llvm-project/lldb/trunk/source/Plugins/Process/gdb-remote/ProcessGDBRemote.cpp?rev=116944&r1=116943&r2=116944&view=diff
==============================================================================
--- lldb/trunk/source/Plugins/Process/gdb-remote/ProcessGDBRemote.cpp (original)
+++ lldb/trunk/source/Plugins/Process/gdb-remote/ProcessGDBRemote.cpp Wed Oct 20 15:54:39 2010
@@ -1674,7 +1674,7 @@
         // to the debugserver to use and use it if we do.
         const char *env_debugserver_path = getenv("LLDB_DEBUGSERVER_PATH");
         if (env_debugserver_path)
-            debugserver_file_spec.SetFile (env_debugserver_path);
+            debugserver_file_spec.SetFile (env_debugserver_path, false);
         else
             debugserver_file_spec = g_debugserver_file_spec;
         bool debugserver_exists = debugserver_file_spec.Exists();
@@ -2236,13 +2236,13 @@
         {
             static ConstString g_dispatch_queue_offsets_symbol_name ("dispatch_queue_offsets");
             const Symbol *dispatch_queue_offsets_symbol = NULL;
-            ModuleSP module_sp(GetTarget().GetImages().FindFirstModuleForFileSpec (FileSpec("libSystem.B.dylib")));
+            ModuleSP module_sp(GetTarget().GetImages().FindFirstModuleForFileSpec (FileSpec("libSystem.B.dylib", false)));
             if (module_sp)
                 dispatch_queue_offsets_symbol = module_sp->FindFirstSymbolWithNameAndType (g_dispatch_queue_offsets_symbol_name, eSymbolTypeData);
             
             if (dispatch_queue_offsets_symbol == NULL)
             {
-                module_sp = GetTarget().GetImages().FindFirstModuleForFileSpec (FileSpec("libdispatch.dylib"));
+                module_sp = GetTarget().GetImages().FindFirstModuleForFileSpec (FileSpec("libdispatch.dylib", false));
                 if (module_sp)
                     dispatch_queue_offsets_symbol = module_sp->FindFirstSymbolWithNameAndType (g_dispatch_queue_offsets_symbol_name, eSymbolTypeData);
             }

Modified: lldb/trunk/source/Plugins/SymbolFile/DWARF/SymbolFileDWARFDebugMap.cpp
URL: http://llvm.org/viewvc/llvm-project/lldb/trunk/source/Plugins/SymbolFile/DWARF/SymbolFileDWARFDebugMap.cpp?rev=116944&r1=116943&r2=116944&view=diff
==============================================================================
--- lldb/trunk/source/Plugins/SymbolFile/DWARF/SymbolFileDWARFDebugMap.cpp (original)
+++ lldb/trunk/source/Plugins/SymbolFile/DWARF/SymbolFileDWARFDebugMap.cpp Wed Oct 20 15:54:39 2010
@@ -137,7 +137,7 @@
         Symbol *oso_symbol = comp_unit_info->oso_symbol;
         if (oso_symbol)
         {
-            FileSpec oso_file_spec(oso_symbol->GetMangled().GetName().AsCString());
+            FileSpec oso_file_spec(oso_symbol->GetMangled().GetName().AsCString(), true);
 
             ModuleList::GetSharedModule (oso_file_spec,
                                          m_obj_file->GetModule()->GetArchitecture(),
@@ -168,7 +168,7 @@
             std::string so_path (m_compile_unit_infos[oso_idx].so_symbol->GetMangled().GetName().AsCString());
             if (m_compile_unit_infos[oso_idx].so_symbol[1].GetType() == eSymbolTypeSourceFile)
                 so_path += m_compile_unit_infos[oso_idx].so_symbol[1].GetMangled().GetName().AsCString();
-            m_compile_unit_infos[oso_idx].so_file.SetFile(so_path.c_str());
+            m_compile_unit_infos[oso_idx].so_file.SetFile(so_path.c_str(), true);
         }
         file_spec = m_compile_unit_infos[oso_idx].so_file;
         return true;

Modified: lldb/trunk/source/Symbol/CompileUnit.cpp
URL: http://llvm.org/viewvc/llvm-project/lldb/trunk/source/Symbol/CompileUnit.cpp?rev=116944&r1=116943&r2=116944&view=diff
==============================================================================
--- lldb/trunk/source/Symbol/CompileUnit.cpp (original)
+++ lldb/trunk/source/Symbol/CompileUnit.cpp Wed Oct 20 15:54:39 2010
@@ -18,7 +18,7 @@
 
 CompileUnit::CompileUnit (Module *module, void *user_data, const char *pathname, const lldb::user_id_t cu_sym_id, lldb::LanguageType language) :
     ModuleChild(module),
-    FileSpec (pathname),
+    FileSpec (pathname, false),
     UserID(cu_sym_id),
     Language (language),
     m_user_data (user_data),

Modified: lldb/trunk/source/Symbol/ObjectFile.cpp
URL: http://llvm.org/viewvc/llvm-project/lldb/trunk/source/Symbol/ObjectFile.cpp?rev=116944&r1=116943&r2=116944&view=diff
==============================================================================
--- lldb/trunk/source/Symbol/ObjectFile.cpp (original)
+++ lldb/trunk/source/Symbol/ObjectFile.cpp Wed Oct 20 15:54:39 2010
@@ -51,7 +51,7 @@
                     if (g_object_regex.GetMatchAtIndex (path_with_object, 1, path) &&
                         g_object_regex.GetMatchAtIndex (path_with_object, 2, object))
                     {
-                        archive_file.SetFile (path.c_str());
+                        archive_file.SetFile (path.c_str(), false);
                         file_size = archive_file.GetByteSize();
                         if (file_size > 0)
                             module->SetFileSpecAndObjectName (archive_file, ConstString(object.c_str()));





More information about the lldb-commits mailing list