[Lldb-commits] [lldb] r238173 - Print port number that lldb-server binds to in platform mode

Vince Harron vince at nethacker.com
Mon May 25 20:08:05 PDT 2015


Author: vharron
Date: Mon May 25 22:08:05 2015
New Revision: 238173

URL: http://llvm.org/viewvc/llvm-project?rev=238173&view=rev
Log:
Print port number that lldb-server binds to in platform mode

If binding to port 0 is selected, the actual port is printed.

This improves the reliability of platform startup by ensuring that
a free port can be found.

TEST PLAN
./lldb-server platform --listen *:0

Listening for a connection from <port-number>...

Will appear on stdout (with other stuff potentially)


Modified:
    lldb/trunk/include/lldb/Symbol/Type.h
    lldb/trunk/source/Symbol/Type.cpp
    lldb/trunk/tools/lldb-server/lldb-platform.cpp

Modified: lldb/trunk/include/lldb/Symbol/Type.h
URL: http://llvm.org/viewvc/llvm-project/lldb/trunk/include/lldb/Symbol/Type.h?rev=238173&r1=238172&r2=238173&view=diff
==============================================================================
--- lldb/trunk/include/lldb/Symbol/Type.h (original)
+++ lldb/trunk/include/lldb/Symbol/Type.h Mon May 25 22:08:05 2015
@@ -305,7 +305,9 @@ protected:
     ClangASTType m_clang_type;
     
     struct Flags {
-        ResolveState    clang_type_resolve_state : 2;
+        // clang_type_resolve_state is a ResolveState enum
+        // using unsigned type here to work around a very noisy gcc warning
+        unsigned        clang_type_resolve_state : 2;
         bool            is_complete_objc_class   : 1;
     } m_flags;
 

Modified: lldb/trunk/source/Symbol/Type.cpp
URL: http://llvm.org/viewvc/llvm-project/lldb/trunk/source/Symbol/Type.cpp?rev=238173&r1=238172&r2=238173&view=diff
==============================================================================
--- lldb/trunk/source/Symbol/Type.cpp (original)
+++ lldb/trunk/source/Symbol/Type.cpp Mon May 25 22:08:05 2015
@@ -101,7 +101,7 @@ Type::Type
     m_decl (decl),
     m_clang_type (clang_type)
 {
-    m_flags.clang_type_resolve_state = (clang_type ? clang_type_resolve_state : eResolveStateUnresolved);
+    m_flags.SetResolveState(clang_type ? clang_type_resolve_state : eResolveStateUnresolved);
     m_flags.is_complete_objc_class = false;
 }
 
@@ -118,7 +118,7 @@ Type::Type () :
     m_decl (),
     m_clang_type ()
 {
-    m_flags.clang_type_resolve_state = eResolveStateUnresolved;
+    m_flags.SetResolveState(eResolveStateUnresolved);
     m_flags.is_complete_objc_class = false;
 }
 
@@ -505,7 +505,7 @@ Type::ResolveClangType (ResolveState cla
                     if (encoding_clang_type.IsValid())
                     {
                         m_clang_type = encoding_clang_type;
-                        m_flags.clang_type_resolve_state = encoding_type->m_flags.clang_type_resolve_state;
+                        m_flags.SetResolveState(encoding_type->m_flags.clang_type_resolve_state);
                     }
                 }
                 break;
@@ -594,7 +594,7 @@ Type::ResolveClangType (ResolveState cla
     // Check if we have a forward reference to a class/struct/union/enum?
     if (m_clang_type.IsValid() && m_flags.clang_type_resolve_state < clang_type_resolve_state)
     {
-        m_flags.clang_type_resolve_state = eResolveStateFull;
+        m_flags.SetResolveState(eResolveStateFull);
         if (!m_clang_type.IsDefined ())
         {
             // We have a forward declaration, we need to resolve it to a complete definition.

Modified: lldb/trunk/tools/lldb-server/lldb-platform.cpp
URL: http://llvm.org/viewvc/llvm-project/lldb/trunk/tools/lldb-server/lldb-platform.cpp?rev=238173&r1=238172&r2=238173&view=diff
==============================================================================
--- lldb/trunk/tools/lldb-server/lldb-platform.cpp (original)
+++ lldb/trunk/tools/lldb-server/lldb-platform.cpp Mon May 25 22:08:05 2015
@@ -253,7 +253,6 @@ main_platform (int argc, char *argv[])
 
     std::unique_ptr<Socket> listening_socket_up;
     Socket *socket = nullptr;
-    printf ("Listening for a connection from %s...\n", listen_host_port.c_str());
     const bool children_inherit_listen_socket = false;
 
     // the test suite makes many connections in parallel, let's not miss any.
@@ -267,6 +266,7 @@ main_platform (int argc, char *argv[])
         exit(socket_error);
     }
     listening_socket_up.reset(socket);
+    printf ("Listening for a connection from %u...\n", listening_socket_up->GetLocalPortNumber());
 
     do {
         GDBRemoteCommunicationServerPlatform platform;





More information about the lldb-commits mailing list