[Lldb-commits] [lldb] r156511 - in /lldb/branches/lldb-platform-work: ./ source/Core/ConstString.cpp test/redo.py tools/driver/Driver.cpp tools/driver/IOChannel.cpp tools/driver/IOChannel.h

Johnny Chen johnny.chen at apple.com
Wed May 9 14:07:36 PDT 2012


Author: johnny
Date: Wed May  9 16:07:36 2012
New Revision: 156511

URL: http://llvm.org/viewvc/llvm-project?rev=156511&view=rev
Log:
Merge changes from TOT trunk.

Modified:
    lldb/branches/lldb-platform-work/   (props changed)
    lldb/branches/lldb-platform-work/source/Core/ConstString.cpp
    lldb/branches/lldb-platform-work/test/redo.py
    lldb/branches/lldb-platform-work/tools/driver/Driver.cpp
    lldb/branches/lldb-platform-work/tools/driver/IOChannel.cpp
    lldb/branches/lldb-platform-work/tools/driver/IOChannel.h

Propchange: lldb/branches/lldb-platform-work/
------------------------------------------------------------------------------
--- svn:mergeinfo (original)
+++ svn:mergeinfo Wed May  9 16:07:36 2012
@@ -1 +1 @@
-/lldb/trunk:154223-156439
+/lldb/trunk:154223-156510

Modified: lldb/branches/lldb-platform-work/source/Core/ConstString.cpp
URL: http://llvm.org/viewvc/llvm-project/lldb/branches/lldb-platform-work/source/Core/ConstString.cpp?rev=156511&r1=156510&r2=156511&view=diff
==============================================================================
--- lldb/branches/lldb-platform-work/source/Core/ConstString.cpp (original)
+++ lldb/branches/lldb-platform-work/source/Core/ConstString.cpp Wed May  9 16:07:36 2012
@@ -167,12 +167,32 @@
 // initializers so we hide the string pool in a static function so
 // that it will get initialized on the first call to this static
 // function.
+//
+// Note, for now we make the string pool a pointer to the pool, because
+// we can't guarantee that some objects won't get destroyed after the
+// global destructor chain is run, and trying to make sure no destructors
+// touch ConstStrings is difficult.  So we leak the pool instead.
+//
+// FIXME: If we are going to keep it this way we should come up with some
+// abstraction to "pthread_once" so we don't have to check the pointer
+// every time.
 //----------------------------------------------------------------------
 static Pool &
 StringPool()
 {
-    static Pool string_pool;
-    return string_pool;
+    static Mutex g_pool_initialization_mutex;
+    static Pool *g_string_pool = NULL;
+
+    if (g_string_pool == NULL)
+    {
+        Mutex::Locker initialization_locker(g_pool_initialization_mutex);
+        if (g_string_pool == NULL)
+        {
+            g_string_pool = new Pool();
+        }
+    }
+    
+    return *g_string_pool;
 }
 
 ConstString::ConstString (const char *cstr) :

Modified: lldb/branches/lldb-platform-work/test/redo.py
URL: http://llvm.org/viewvc/llvm-project/lldb/branches/lldb-platform-work/test/redo.py?rev=156511&r1=156510&r2=156511&view=diff
==============================================================================
--- lldb/branches/lldb-platform-work/test/redo.py (original)
+++ lldb/branches/lldb-platform-work/test/redo.py Wed May  9 16:07:36 2012
@@ -117,6 +117,9 @@
         print "This script expects to reside in lldb's test directory."
         sys.exit(-1)
 
+    if not len(sys.argv) > 1:
+        usage()
+
     index = 1
     while index < len(sys.argv):
         if sys.argv[index].startswith('-h'):
@@ -129,16 +132,16 @@
             # End of option processing.
             break
 
-        if sys.argv[index].startswith('-F'):
+        if sys.argv[index] == '-F':
             # Increment by 1 to fetch the filename component spec.
             index += 1
             if index >= len(sys.argv) or sys.argv[index].startswith('-'):
                 usage()
             filename_components.append(sys.argv[index])
-            index += 1
         elif sys.argv[index] == '-n':
             no_trace = True
-            index += 1
+
+        index += 1
 
     if index < len(sys.argv):
         # Get the specified session directory.
@@ -147,6 +150,9 @@
         # Use heuristic to find the latest session directory.
         name = datetime.datetime.now().strftime("%Y-%m-%d-")
         dirs = [d for d in os.listdir(os.getcwd()) if d.startswith(name)]
+        if len(dirs) == 0:
+            print "No default session directory found, please specify it explicitly."
+            usage()
         session_dir = max(dirs, key=os.path.getmtime)
         if not session_dir or not os.path.exists(session_dir):
             print "No default session directory found, please specify it explicitly."

Modified: lldb/branches/lldb-platform-work/tools/driver/Driver.cpp
URL: http://llvm.org/viewvc/llvm-project/lldb/branches/lldb-platform-work/tools/driver/Driver.cpp?rev=156511&r1=156510&r2=156511&view=diff
==============================================================================
--- lldb/branches/lldb-platform-work/tools/driver/Driver.cpp (original)
+++ lldb/branches/lldb-platform-work/tools/driver/Driver.cpp Wed May  9 16:07:36 2012
@@ -1081,6 +1081,8 @@
         if (driver->m_io_channel_ap.get() != NULL)
         {
             driver->m_io_channel_ap->OutWrite ("^C\n", 3, NO_ASYNC);
+            // I wish I could erase the entire input line, but there's no public API for that.
+            driver->m_io_channel_ap->EraseCharsBeforeCursor();
             driver->m_io_channel_ap->RefreshPrompt();
         }
         break;

Modified: lldb/branches/lldb-platform-work/tools/driver/IOChannel.cpp
URL: http://llvm.org/viewvc/llvm-project/lldb/branches/lldb-platform-work/tools/driver/IOChannel.cpp?rev=156511&r1=156510&r2=156511&view=diff
==============================================================================
--- lldb/branches/lldb-platform-work/tools/driver/IOChannel.cpp (original)
+++ lldb/branches/lldb-platform-work/tools/driver/IOChannel.cpp Wed May  9 16:07:36 2012
@@ -50,6 +50,13 @@
     return pos->second.c_str();
 }
 
+void
+IOChannel::EraseCharsBeforeCursor ()
+{
+    const LineInfo *line_info  = el_line(m_edit_line);
+    el_deletestr(m_edit_line, line_info->cursor - line_info->buffer);
+}
+
 unsigned char
 IOChannel::ElCompletionFn (EditLine *e, int ch)
 {

Modified: lldb/branches/lldb-platform-work/tools/driver/IOChannel.h
URL: http://llvm.org/viewvc/llvm-project/lldb/branches/lldb-platform-work/tools/driver/IOChannel.h?rev=156511&r1=156510&r2=156511&view=diff
==============================================================================
--- lldb/branches/lldb-platform-work/tools/driver/IOChannel.h (original)
+++ lldb/branches/lldb-platform-work/tools/driver/IOChannel.h Wed May  9 16:07:36 2012
@@ -96,6 +96,9 @@
     const char *
     GetPrompt ();
 
+    void
+    EraseCharsBeforeCursor ();
+
     static unsigned char 
     ElCompletionFn (EditLine *e, int ch);
 





More information about the lldb-commits mailing list