[Lldb-commits] [lldb] r354030 - [lldb] [lldb-server] Catch and report errors from main loop

Michal Gorny via lldb-commits lldb-commits at lists.llvm.org
Thu Feb 14 05:52:37 PST 2019


Author: mgorny
Date: Thu Feb 14 05:52:37 2019
New Revision: 354030

URL: http://llvm.org/viewvc/llvm-project?rev=354030&view=rev
Log:
[lldb] [lldb-server] Catch and report errors from main loop

Catch the possible error from lldb-gdbserver's main loop, and report
it verbosely.  Currently, if the loop fails the server exits normally,
rendering the problem indistinguishable from regular termination.

Differential Revision: https://reviews.llvm.org/D58228

Modified:
    lldb/trunk/tools/lldb-server/lldb-gdbserver.cpp

Modified: lldb/trunk/tools/lldb-server/lldb-gdbserver.cpp
URL: http://llvm.org/viewvc/llvm-project/lldb/trunk/tools/lldb-server/lldb-gdbserver.cpp?rev=354030&r1=354029&r2=354030&view=diff
==============================================================================
--- lldb/trunk/tools/lldb-server/lldb-gdbserver.cpp (original)
+++ lldb/trunk/tools/lldb-server/lldb-gdbserver.cpp Thu Feb 14 05:52:37 2019
@@ -533,7 +533,12 @@ int main_gdbserver(int argc, char *argv[
     return 1;
   }
 
-  mainloop.Run();
+  Status ret = mainloop.Run();
+  if (ret.Fail()) {
+    fprintf(stderr, "lldb-server terminating due to error: %s\n",
+            ret.AsCString());
+    return 1;
+  }
   fprintf(stderr, "lldb-server exiting...\n");
 
   return 0;




More information about the lldb-commits mailing list