X-Git-Url: https://git.saurik.com/apple/xnu.git/blobdiff_plain/39236c6e673c41db228275375ab7fdb0f837b292..bca245acd4c03fd752d1a45f011ad495e60fe53d:/tools/lldbmacros/kdp.py diff --git a/tools/lldbmacros/kdp.py b/tools/lldbmacros/kdp.py old mode 100644 new mode 100755 index 7c31630ea..b6d3f4f69 --- a/tools/lldbmacros/kdp.py +++ b/tools/lldbmacros/kdp.py @@ -2,6 +2,8 @@ from xnu import * from utils import * import sys +current_KDP_mode = "swhosted" + def GetKDPPacketHeaderInt(request=0, is_reply=False, seq=0, length=0, key=0): """ create a 64 bit number that could be saved as pkt_hdr_t params: @@ -174,7 +176,7 @@ def KDPResumeON(cmd_args=None): return retval @lldb_command('resume_off') -def KDPResumeON(cmd_args=None): +def KDPResumeOFF(cmd_args=None): """ The target system will not resume when detaching or exiting from lldb. """ subcmd = GetEnumValue('kdp_dumpinfo_t::KDP_DUMPINFO_SETINFO') | GetEnumValue('kdp_dumpinfo_t::KDP_DUMPINFO_NORESUME') @@ -283,3 +285,26 @@ def KDPSetDumpInfo(cmd_args=None): print "Failed to save the dumpinfo." return retval +@lldb_command('kdpmode') +def KDPMode(cmd_args=None): + """ + Change KDP mode between software hosted and hardware probe. + When lldb is connected to a KDP server backed by a hardware debug tool + setting this to 'hwprobe' enables physical memory access. + + swhosted: LLDB is connected to the target using a serial or socket connection. + hwprobe: LLDB is connected to the target using a hardware probe. + + usage: kdpmode + mode: 'swhosted' or 'hwprobe' + """ + global current_KDP_mode + + if cmd_args == None or len(cmd_args) == 0: + return current_KDP_mode + if len(cmd_args) > 1 or cmd_args[0] not in {'swhosted', 'hwprobe'}: + print "Invalid Arguments", KDPMode.__doc__ + else: + current_KDP_mode = cmd_args[0] + return +