forked from OSchip/llvm-project
Allow gdbremote.py to take input from STDIN and handle "c" and "s" packets.
llvm-svn: 242490
This commit is contained in:
parent
d1e2fad2e0
commit
b2273bd3d6
|
@ -495,6 +495,8 @@ def rsp_stop_reply(options, cmd, cmd_args, rsp):
|
|||
reg_info = g_register_infos[reg_num]
|
||||
key_value_pair[0] = reg_info.name()
|
||||
key_value_pair[1] = reg_info.get_value_from_hex_string (key_value_pair[1])
|
||||
elif key == 'jthreads' or key == 'jstopinfo':
|
||||
key_value_pair[1] = binascii.unhexlify(key_value_pair[1])
|
||||
key_value_pairs.insert(0, ['signal', signo])
|
||||
dump_key_value_pairs (key_value_pairs)
|
||||
elif stop_type == 'W':
|
||||
|
@ -588,6 +590,12 @@ def rsp_dump_key_value_pairs(options, cmd, cmd_args, rsp):
|
|||
else:
|
||||
print "not supported"
|
||||
|
||||
def cmd_c(options, cmd, args):
|
||||
print "continue()"
|
||||
|
||||
def cmd_s(options, cmd, args):
|
||||
print "step()"
|
||||
|
||||
def cmd_vCont(options, cmd, args):
|
||||
if args == '?':
|
||||
print "%s: get supported extended continue modes" % (cmd)
|
||||
|
@ -894,6 +902,8 @@ gdb_remote_commands = {
|
|||
'qHostInfo' : { 'cmd' : cmd_query_packet , 'rsp' : rsp_dump_key_value_pairs, 'name' : "get host information" },
|
||||
'vCont' : { 'cmd' : cmd_vCont , 'rsp' : rsp_vCont , 'name' : "extended continue command" },
|
||||
'vAttach' : { 'cmd' : cmd_vAttach , 'rsp' : rsp_stop_reply , 'name' : "attach to process" },
|
||||
'c' : { 'cmd' : cmd_c , 'rsp' : rsp_stop_reply , 'name' : "continue" },
|
||||
's' : { 'cmd' : cmd_s , 'rsp' : rsp_stop_reply , 'name' : "step" },
|
||||
'qRegisterInfo' : { 'cmd' : cmd_qRegisterInfo , 'rsp' : rsp_qRegisterInfo , 'name' : "query register info" },
|
||||
'qfThreadInfo' : { 'cmd' : cmd_qThreadInfo , 'rsp' : rsp_qThreadInfo , 'name' : "get current thread list" },
|
||||
'qsThreadInfo' : { 'cmd' : cmd_qThreadInfo , 'rsp' : rsp_qThreadInfo , 'name' : "get current thread list" },
|
||||
|
@ -918,6 +928,8 @@ gdb_remote_commands = {
|
|||
def calculate_mean_and_standard_deviation(floats):
|
||||
sum = 0.0
|
||||
count = len(floats)
|
||||
if count == 0:
|
||||
return (0.0, 0.0)
|
||||
for f in floats:
|
||||
sum += f
|
||||
mean = sum / count
|
||||
|
@ -928,8 +940,13 @@ def calculate_mean_and_standard_deviation(floats):
|
|||
|
||||
std_dev = math.sqrt(accum / (count-1));
|
||||
return (mean, std_dev)
|
||||
|
||||
def parse_gdb_log_file(path, options):
|
||||
f = open(path)
|
||||
parse_gdb_log(f)
|
||||
f.close()
|
||||
|
||||
def parse_gdb_log_file(file, options):
|
||||
def parse_gdb_log(file, options):
|
||||
'''Parse a GDB log file that was generated by enabling logging with:
|
||||
(lldb) log enable --threadsafe --timestamp --file <FILE> gdb-remote packets
|
||||
This log file will contain timestamps and this function will then normalize
|
||||
|
@ -953,7 +970,6 @@ def parse_gdb_log_file(file, options):
|
|||
packet_total_times = {}
|
||||
packet_times = []
|
||||
packet_count = {}
|
||||
file = open(file)
|
||||
lines = file.read().splitlines()
|
||||
last_command = None
|
||||
last_command_args = None
|
||||
|
@ -1100,13 +1116,16 @@ if __name__ == '__main__':
|
|||
|
||||
# This script is being run from the command line, create a debugger in case we are
|
||||
# going to use any debugger functions in our function.
|
||||
for file in args:
|
||||
print '#----------------------------------------------------------------------'
|
||||
print "# GDB remote log file: '%s'" % file
|
||||
print '#----------------------------------------------------------------------'
|
||||
parse_gdb_log_file (file, options)
|
||||
if options.symbolicator:
|
||||
print '%s' % (options.symbolicator)
|
||||
if len(args):
|
||||
for file in args:
|
||||
print '#----------------------------------------------------------------------'
|
||||
print "# GDB remote log file: '%s'" % file
|
||||
print '#----------------------------------------------------------------------'
|
||||
parse_gdb_log_file (file, options)
|
||||
if options.symbolicator:
|
||||
print '%s' % (options.symbolicator)
|
||||
else:
|
||||
parse_gdb_log(sys.stdin, options)
|
||||
|
||||
else:
|
||||
import lldb
|
||||
|
|
Loading…
Reference in New Issue