fjricci updated this revision to Diff 47806.
fjricci added a comment.

Remove unnecessary special-case logic for reverse connecting


http://reviews.llvm.org/D17099

Files:
  source/Interpreter/CommandInterpreter.cpp

Index: source/Interpreter/CommandInterpreter.cpp
===================================================================
--- source/Interpreter/CommandInterpreter.cpp
+++ source/Interpreter/CommandInterpreter.cpp
@@ -624,18 +624,21 @@
         }
     }
 
-    std::unique_ptr<CommandObjectRegexCommand>
-    connect_gdb_remote_cmd_ap(new CommandObjectRegexCommand (*this,
-                                                             "gdb-remote",
-                                                             "Connect to a 
remote GDB server.  If no hostname is provided, localhost is assumed.",
-                                                             "gdb-remote 
[<hostname>:]<portnum>",
-                                                             2,
-                                                             0,
-                                                             false));
+    std::unique_ptr<CommandObjectRegexCommand> connect_gdb_remote_cmd_ap(
+        new CommandObjectRegexCommand(*this, "gdb-remote", "Connect to a 
remote GDB server.  If no "
+                                                           "hostname is 
provided, localhost is assumed.",
+                                      "gdb-remote [<hostname>:]<portnum> 
[reverse]", 2, 0, false));
     if (connect_gdb_remote_cmd_ap.get())
     {
-        if 
(connect_gdb_remote_cmd_ap->AddRegexCommand("^([^:]+:[[:digit:]]+)$", "process 
connect --plugin gdb-remote connect://%1") &&
-            connect_gdb_remote_cmd_ap->AddRegexCommand("^([[:digit:]]+)$", 
"process connect --plugin gdb-remote connect://localhost:%1"))
+        if 
(connect_gdb_remote_cmd_ap->AddRegexCommand("^([^:]+:[[:digit:]]+)$",
+                                                       "process connect 
--plugin gdb-remote connect://%1") &&
+            connect_gdb_remote_cmd_ap->AddRegexCommand("^([[:digit:]]+)$",
+                                                       "process connect 
--plugin gdb-remote connect://localhost:%1") &&
+            connect_gdb_remote_cmd_ap->AddRegexCommand("^([^:]+:[[:digit:]]+) 
reverse$",
+                                                       "process connect 
--plugin gdb-remote listen://%1") &&
+            connect_gdb_remote_cmd_ap->AddRegexCommand("^([[:digit:]]+) 
reverse$",
+                                                       "process connect 
--plugin gdb-remote "
+                                                       
"listen://localhost:%1"))
         {
             CommandObjectSP command_sp(connect_gdb_remote_cmd_ap.release());
             m_command_dict[command_sp->GetCommandName ()] = command_sp;


Index: source/Interpreter/CommandInterpreter.cpp
===================================================================
--- source/Interpreter/CommandInterpreter.cpp
+++ source/Interpreter/CommandInterpreter.cpp
@@ -624,18 +624,21 @@
         }
     }
 
-    std::unique_ptr<CommandObjectRegexCommand>
-    connect_gdb_remote_cmd_ap(new CommandObjectRegexCommand (*this,
-                                                             "gdb-remote",
-                                                             "Connect to a remote GDB server.  If no hostname is provided, localhost is assumed.",
-                                                             "gdb-remote [<hostname>:]<portnum>",
-                                                             2,
-                                                             0,
-                                                             false));
+    std::unique_ptr<CommandObjectRegexCommand> connect_gdb_remote_cmd_ap(
+        new CommandObjectRegexCommand(*this, "gdb-remote", "Connect to a remote GDB server.  If no "
+                                                           "hostname is provided, localhost is assumed.",
+                                      "gdb-remote [<hostname>:]<portnum> [reverse]", 2, 0, false));
     if (connect_gdb_remote_cmd_ap.get())
     {
-        if (connect_gdb_remote_cmd_ap->AddRegexCommand("^([^:]+:[[:digit:]]+)$", "process connect --plugin gdb-remote connect://%1") &&
-            connect_gdb_remote_cmd_ap->AddRegexCommand("^([[:digit:]]+)$", "process connect --plugin gdb-remote connect://localhost:%1"))
+        if (connect_gdb_remote_cmd_ap->AddRegexCommand("^([^:]+:[[:digit:]]+)$",
+                                                       "process connect --plugin gdb-remote connect://%1") &&
+            connect_gdb_remote_cmd_ap->AddRegexCommand("^([[:digit:]]+)$",
+                                                       "process connect --plugin gdb-remote connect://localhost:%1") &&
+            connect_gdb_remote_cmd_ap->AddRegexCommand("^([^:]+:[[:digit:]]+) reverse$",
+                                                       "process connect --plugin gdb-remote listen://%1") &&
+            connect_gdb_remote_cmd_ap->AddRegexCommand("^([[:digit:]]+) reverse$",
+                                                       "process connect --plugin gdb-remote "
+                                                       "listen://localhost:%1"))
         {
             CommandObjectSP command_sp(connect_gdb_remote_cmd_ap.release());
             m_command_dict[command_sp->GetCommandName ()] = command_sp;
_______________________________________________
lldb-commits mailing list
lldb-commits@lists.llvm.org
http://lists.llvm.org/cgi-bin/mailman/listinfo/lldb-commits

Reply via email to