Print port number that lldb-server binds to in platform mode
authorVince Harron <vince@nethacker.com>
Tue, 26 May 2015 03:08:05 +0000 (03:08 +0000)
committerVince Harron <vince@nethacker.com>
Tue, 26 May 2015 03:08:05 +0000 (03:08 +0000)
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)

llvm-svn: 238173

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

index 64cd3c0..02393c5 100644 (file)
@@ -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;
 
index 6e67f46..125448d 100644 (file)
@@ -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 clang_type_resolve_state)
                     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 clang_type_resolve_state)
     // 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.
index 54c219a..6f5dfbc 100644 (file)
@@ -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;