]> id.pley.net Git - dotfiles.git/blobdiff - lldb/kdpReboot.py
Added lldbinit and kdp-remote commands.
[dotfiles.git] / lldb / kdpReboot.py
diff --git a/lldb/kdpReboot.py b/lldb/kdpReboot.py
new file mode 100644 (file)
index 0000000..13e6d62
--- /dev/null
@@ -0,0 +1,14 @@
+import lldb
+
+def kdpReboot(debugger, command, result, internal_dict):
+    if not "kdp" in debugger.GetSelectedTarget().GetProcess().GetPluginName().lower():
+        print "Target is not connected over kdp. Connect to a remote machine with `kdp-remote <hostname>[:<portnum>]`."
+        return False
+
+    print "Rebooting the remote machine."
+    debugger.HandleCommand('process plugin packet send --command 0x13')
+    debugger.HandleCommand('detach')
+    return True
+
+def __lldb_init_module(debugger, internal_dict):
+    debugger.HandleCommand('command script add -f kdpReboot.kdpReboot kdp-reboot')