[Lldb-commits] [lldb] r181190 - A few small fixes to make things like image list not

Jason Molenda jmolenda at apple.com
Mon May 6 03:21:11 PDT 2013


Author: jmolenda
Date: Mon May  6 05:21:11 2013
New Revision: 181190

URL: http://llvm.org/viewvc/llvm-project?rev=181190&view=rev
Log:
A few small fixes to make things like image list not
print "//mach_kernel" if you are debugging an executable
in the top level directory.

Modified:
    lldb/trunk/source/Commands/CommandObjectTarget.cpp
    lldb/trunk/source/Host/common/FileSpec.cpp

Modified: lldb/trunk/source/Commands/CommandObjectTarget.cpp
URL: http://llvm.org/viewvc/llvm-project/lldb/trunk/source/Commands/CommandObjectTarget.cpp?rev=181190&r1=181189&r2=181190&view=diff
==============================================================================
--- lldb/trunk/source/Commands/CommandObjectTarget.cpp (original)
+++ lldb/trunk/source/Commands/CommandObjectTarget.cpp Mon May  6 05:21:11 2013
@@ -1385,12 +1385,9 @@ DumpFullpath (Stream &strm, const FileSp
     {
         if (width > 0)
         {
-            char fullpath[PATH_MAX];
-            if (file_spec_ptr->GetPath(fullpath, sizeof(fullpath)))
-            {
-                strm.Printf("%-*s", width, fullpath);
-                return;
-            }
+            std::string fullpath = file_spec_ptr->GetPath();
+            strm.Printf("%-*s", width, fullpath.c_str());
+            return;
         }
         else
         {

Modified: lldb/trunk/source/Host/common/FileSpec.cpp
URL: http://llvm.org/viewvc/llvm-project/lldb/trunk/source/Host/common/FileSpec.cpp?rev=181190&r1=181189&r2=181190&view=diff
==============================================================================
--- lldb/trunk/source/Host/common/FileSpec.cpp (original)
+++ lldb/trunk/source/Host/common/FileSpec.cpp Mon May  6 05:21:11 2013
@@ -523,10 +523,11 @@ FileSpec::Equal (const FileSpec& a, cons
 void
 FileSpec::Dump(Stream *s) const
 {
+    static ConstString g_slash_only ("/");
     if (s)
     {
         m_directory.Dump(s);
-        if (m_directory)
+        if (m_directory && m_directory != g_slash_only)
             s->PutChar('/');
         m_filename.Dump(s);
     }
@@ -705,13 +706,14 @@ FileSpec::GetPath(char *path, size_t pat
 std::string
 FileSpec::GetPath (void) const
 {
+    static ConstString g_slash_only ("/");
     std::string path;
     const char *dirname = m_directory.GetCString();
     const char *filename = m_filename.GetCString();
     if (dirname)
     {
         path.append (dirname);
-        if (filename)
+        if (filename && m_directory != g_slash_only)
             path.append ("/");
     }
     if (filename)





More information about the lldb-commits mailing list