Add convenience aliases to allow easy attaching to a remote gdb server or kdp (darwin...
authorGreg Clayton <gclayton@apple.com>
Wed, 26 Sep 2012 22:26:47 +0000 (22:26 +0000)
committerGreg Clayton <gclayton@apple.com>
Wed, 26 Sep 2012 22:26:47 +0000 (22:26 +0000)
llvm-svn: 164729

lldb/source/Interpreter/CommandInterpreter.cpp

index 18db69c..9cec1f3 100644 (file)
@@ -459,6 +459,36 @@ CommandInterpreter::LoadCommandDictionary ()
         }
     }
 
+    std::auto_ptr<CommandObjectRegexCommand>
+    connect_gdb_remote_cmd_ap(new CommandObjectRegexCommand (*this,
+                                                      "gdb-remote",
+                                                      "Connect to a remote GDB server.",
+                                                      "gdb-remote [<host>:<port>]\ngdb-remote [<port>]", 2));
+    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"))
+        {
+            CommandObjectSP command_sp(connect_gdb_remote_cmd_ap.release());
+            m_command_dict[command_sp->GetCommandName ()] = command_sp;
+        }
+    }
+
+    std::auto_ptr<CommandObjectRegexCommand>
+    connect_kdp_remote_cmd_ap(new CommandObjectRegexCommand (*this,
+                                                             "kdp-remote",
+                                                             "Connect to a remote KDP server.",
+                                                             "kdp-remote [<host>]\nkdp-remote [<host>:<port>]", 2));
+    if (connect_kdp_remote_cmd_ap.get())
+    {
+        if (connect_kdp_remote_cmd_ap->AddRegexCommand("^([^:]+:[[:digit:]]+)$", "process connect --plugin kdp-remote udp://%1") &&
+            connect_kdp_remote_cmd_ap->AddRegexCommand("^(.*)$", "process connect --plugin kdp-remote udp://%1:41139"))
+        {
+            CommandObjectSP command_sp(connect_kdp_remote_cmd_ap.release());
+            m_command_dict[command_sp->GetCommandName ()] = command_sp;
+        }
+    }
+
 }
 
 int