jasonmolenda created this revision.
jasonmolenda added a reviewer: labath.
jasonmolenda added a project: LLDB.
Herald added a subscriber: llvm-commits.

When lldb-server is in platform mode and waiting for a connection, when it 
receives a connection it fork()'s and then runs an lldb-server/debugserver to 
respond to that connection.  The amount of things done between a fork() and an 
exec() should be very small, but if there is a bug in lldb-server and you're 
trying to use logging to debug it, the fact that logging does not happen in the 
child process makes it challenging to understand what is going on.

The fact that the logging re-enablement in the child will only happen when done 
by hand makes me more comfortable with this.

Pavel, do you think you're the best person to talk to about this?  I've tested 
this on darwin and on ubuntu and both exhibit the same behavior.  e.g.

terminal1% ./a.out

terminal2% bin/lldb-server platform --verbose --log-channels 'lldb 
all:gdb-remote all' --server --listen '*:11110' -m 11120 -M 11250

terminal3% lldb
(lldb) pla sel remote-linux
(lldb) pla connect connect://localhost:11110
(lldb) pla pro att -n a.out

without this patch, the only logging you'll see is lldb-server waiting for a 
connection, receiving a connection, and that's about it.


Repository:
  rL LLVM

https://reviews.llvm.org/D42210

Files:
  tools/lldb-server/lldb-platform.cpp


Index: tools/lldb-server/lldb-platform.cpp
===================================================================
--- tools/lldb-server/lldb-platform.cpp
+++ tools/lldb-server/lldb-platform.cpp
@@ -328,6 +328,10 @@
         // Parent will continue to listen for new connections.
         continue;
       } else {
+        // We lose the logging on the child side of the fork, re-enable it.  
+        if (!LLDBServerUtilities::SetupLogging(log_file, log_channels, 0))
+          return -1;
+
         // Child process will handle the connection and exit.
         g_server = 0;
         // Listening socket is owned by parent process.


Index: tools/lldb-server/lldb-platform.cpp
===================================================================
--- tools/lldb-server/lldb-platform.cpp
+++ tools/lldb-server/lldb-platform.cpp
@@ -328,6 +328,10 @@
         // Parent will continue to listen for new connections.
         continue;
       } else {
+        // We lose the logging on the child side of the fork, re-enable it.  
+        if (!LLDBServerUtilities::SetupLogging(log_file, log_channels, 0))
+          return -1;
+
         // Child process will handle the connection and exit.
         g_server = 0;
         // Listening socket is owned by parent process.
_______________________________________________
lldb-commits mailing list
lldb-commits@lists.llvm.org
http://lists.llvm.org/cgi-bin/mailman/listinfo/lldb-commits

Reply via email to