jankratochvil updated this revision to Diff 189333.
jankratochvil added a comment.
Herald added a reviewer: serge-sans-paille.

There is no `not` as `lldb-server` still had+has exit code 0 during this error.
I have no idea what to put to the `FIXME` string there. Failure (with old 
`lldb-server`) looks as:

  FAIL: LLDB :: Driver/TestGdbserverPort.test (8 of 1551)
  ******************** TEST 'LLDB :: Driver/TestGdbserverPort.test' FAILED 
********************
  Script:
  --
  : 'RUN: at line 1';   
/home/jkratoch/redhat/llvm-monorepo-clangassert/bin/lldb-server platform p 
--server --listen :1234 --min-gdbserver-port 1234 --max-gdbserver-port 1234 
2>&1 | /home/jkratoch/redhat/llvm-monorepo-clangassert/bin/FileCheck 
/home/jkratoch/redhat/llvm-monorepo/lldb/lit/Driver/TestGdbserverPort.test
  --
  Exit Code: 1
  
  Command Output (stderr):
  --
  
/home/jkratoch/redhat/llvm-monorepo/lldb/lit/Driver/TestGdbserverPort.test:2:10:
 error: CHECK: expected string not found in input
  # CHECK: error: --min-gdbserver-port (1234) is not lower than 
--max-gdbserver-port (1234)
           ^
  <stdin>:1:1: note: scanning from here
  failed to listen: Address already in use
  ^


Repository:
  rLLDB LLDB

CHANGES SINCE LAST ACTION
  https://reviews.llvm.org/D58962/new/

https://reviews.llvm.org/D58962

Files:
  lldb/lit/Driver/TestGdbserverPort.test
  lldb/lit/helper/toolchain.py
  lldb/tools/lldb-server/lldb-platform.cpp


Index: lldb/tools/lldb-server/lldb-platform.cpp
===================================================================
--- lldb/tools/lldb-server/lldb-platform.cpp
+++ lldb/tools/lldb-server/lldb-platform.cpp
@@ -241,11 +241,11 @@
     return -1;
 
   // Make a port map for a port range that was specified.
-  if (min_gdbserver_port < max_gdbserver_port) {
+  if (min_gdbserver_port && min_gdbserver_port < max_gdbserver_port) {
     for (uint16_t port = min_gdbserver_port; port < max_gdbserver_port; ++port)
       gdbserver_portmap[port] = LLDB_INVALID_PROCESS_ID;
-  } else if (min_gdbserver_port != max_gdbserver_port) {
-    fprintf(stderr, "error: --min-gdbserver-port (%u) is greater than "
+  } else if (min_gdbserver_port || max_gdbserver_port) {
+    fprintf(stderr, "error: --min-gdbserver-port (%u) is not lower than "
                     "--max-gdbserver-port (%u)\n",
             min_gdbserver_port, max_gdbserver_port);
     option_error = 3;
Index: lldb/lit/helper/toolchain.py
===================================================================
--- lldb/lit/helper/toolchain.py
+++ lldb/lit/helper/toolchain.py
@@ -16,6 +16,7 @@
 
     dsname = 'debugserver' if platform.system() in ['Darwin'] else 
'lldb-server'
     dsargs = [] if platform.system() in ['Darwin'] else ['gdbserver']
+    psargs = ['FIXME'] if platform.system() in ['Darwin'] else ['platform']
     lldbmi = ToolSubst('%lldbmi',
                        command=FindTool('lldb-mi'),
                        extra_args=['--synchronous'],
@@ -43,6 +44,10 @@
                   command=FindTool(dsname),
                   extra_args=dsargs,
                   unresolved='ignore'),
+        ToolSubst('%platformserver',
+                  command=FindTool(dsname),
+                  extra_args=psargs,
+                  unresolved='ignore'),
         'lldb-test',
         'lldb-instr',
         ToolSubst('%build',
Index: lldb/lit/Driver/TestGdbserverPort.test
===================================================================
--- /dev/null
+++ lldb/lit/Driver/TestGdbserverPort.test
@@ -0,0 +1,2 @@
+# RUN: %platformserver p --server --listen :1234 --min-gdbserver-port 1234 
--max-gdbserver-port 1234 2>&1 | FileCheck %s
+# CHECK: error: --min-gdbserver-port (1234) is not lower than 
--max-gdbserver-port (1234)


Index: lldb/tools/lldb-server/lldb-platform.cpp
===================================================================
--- lldb/tools/lldb-server/lldb-platform.cpp
+++ lldb/tools/lldb-server/lldb-platform.cpp
@@ -241,11 +241,11 @@
     return -1;
 
   // Make a port map for a port range that was specified.
-  if (min_gdbserver_port < max_gdbserver_port) {
+  if (min_gdbserver_port && min_gdbserver_port < max_gdbserver_port) {
     for (uint16_t port = min_gdbserver_port; port < max_gdbserver_port; ++port)
       gdbserver_portmap[port] = LLDB_INVALID_PROCESS_ID;
-  } else if (min_gdbserver_port != max_gdbserver_port) {
-    fprintf(stderr, "error: --min-gdbserver-port (%u) is greater than "
+  } else if (min_gdbserver_port || max_gdbserver_port) {
+    fprintf(stderr, "error: --min-gdbserver-port (%u) is not lower than "
                     "--max-gdbserver-port (%u)\n",
             min_gdbserver_port, max_gdbserver_port);
     option_error = 3;
Index: lldb/lit/helper/toolchain.py
===================================================================
--- lldb/lit/helper/toolchain.py
+++ lldb/lit/helper/toolchain.py
@@ -16,6 +16,7 @@
 
     dsname = 'debugserver' if platform.system() in ['Darwin'] else 'lldb-server'
     dsargs = [] if platform.system() in ['Darwin'] else ['gdbserver']
+    psargs = ['FIXME'] if platform.system() in ['Darwin'] else ['platform']
     lldbmi = ToolSubst('%lldbmi',
                        command=FindTool('lldb-mi'),
                        extra_args=['--synchronous'],
@@ -43,6 +44,10 @@
                   command=FindTool(dsname),
                   extra_args=dsargs,
                   unresolved='ignore'),
+        ToolSubst('%platformserver',
+                  command=FindTool(dsname),
+                  extra_args=psargs,
+                  unresolved='ignore'),
         'lldb-test',
         'lldb-instr',
         ToolSubst('%build',
Index: lldb/lit/Driver/TestGdbserverPort.test
===================================================================
--- /dev/null
+++ lldb/lit/Driver/TestGdbserverPort.test
@@ -0,0 +1,2 @@
+# RUN: %platformserver p --server --listen :1234 --min-gdbserver-port 1234 --max-gdbserver-port 1234 2>&1 | FileCheck %s
+# CHECK: error: --min-gdbserver-port (1234) is not lower than --max-gdbserver-port (1234)
_______________________________________________
lldb-commits mailing list
lldb-commits@lists.llvm.org
https://lists.llvm.org/cgi-bin/mailman/listinfo/lldb-commits

Reply via email to