[Lldb-commits] [PATCH] D120792: [lldb] Fix python errors in gdbremote.py
Dominic Chen via Phabricator via lldb-commits
lldb-commits at lists.llvm.org
Wed Mar 2 19:48:04 PST 2022
This revision was automatically updated to reflect the committed changes.
Closed by commit rGcd89f94aa904: [lldb] Fix python errors in gdbremote.py (authored by ddcc).
Changed prior to commit:
https://reviews.llvm.org/D120792?vs=412327&id=412594#toc
Repository:
rG LLVM Github Monorepo
CHANGES SINCE LAST ACTION
https://reviews.llvm.org/D120792/new/
https://reviews.llvm.org/D120792
Files:
lldb/examples/python/gdbremote.py
Index: lldb/examples/python/gdbremote.py
===================================================================
--- lldb/examples/python/gdbremote.py
+++ lldb/examples/python/gdbremote.py
@@ -260,6 +260,12 @@
dest='verbose',
help='display verbose debug info',
default=False)
+ parser.add_option(
+ '--plot',
+ action='store_true',
+ dest='plot',
+ help='plot packet latencies by packet type',
+ default=False)
parser.add_option(
'-q',
'--quiet',
@@ -556,11 +562,11 @@
return kvp
def split(self, ch):
- return string.split(self.str, ch)
+ return self.str.split(ch)
def split_hex(self, ch, byte_order):
hex_values = list()
- strings = string.split(self.str, ch)
+ strings = self.str.split(ch)
for str in strings:
hex_values.append(Packet(str).get_hex_uint(byte_order))
return hex_values
@@ -888,7 +894,7 @@
def cmd_vAttach(options, cmd, args):
- (extra_command, args) = string.split(args, ';')
+ (extra_command, args) = args.split(';')
if extra_command:
print("%s%s(%s)" % (cmd, extra_command, args))
else:
@@ -1212,9 +1218,13 @@
def rsp_json(options, cmd, cmd_args, rsp):
print('%s() reply:' % (cmd))
- json_tree = json.loads(rsp)
- print(json.dumps(json_tree, indent=4, separators=(',', ': ')))
-
+ if not rsp:
+ return
+ try:
+ json_tree = json.loads(rsp)
+ print(json.dumps(json_tree, indent=4, separators=(',', ': ')))
+ except json.JSONDecodeError:
+ return
def rsp_jGetLoadedDynamicLibrariesInfos(options, cmd, cmd_args, rsp):
if cmd_args:
@@ -1541,7 +1551,7 @@
print(" %24s %11.6f %5.2f%% %6d %9.6f" % (
item, packet_total_time, packet_percent, packet_count,
float(packet_total_time) / float(packet_count)))
- if options.plot:
+ if options and options.plot:
plot_latencies(packet_times)
if __name__ == '__main__':
@@ -1558,12 +1568,6 @@
dest='verbose',
help='display verbose debug info',
default=False)
- parser.add_option(
- '--plot',
- action='store_true',
- dest='plot',
- help='plot packet latencies by packet type',
- default=False)
parser.add_option(
'-q',
'--quiet',
-------------- next part --------------
A non-text attachment was scrubbed...
Name: D120792.412594.patch
Type: text/x-patch
Size: 2432 bytes
Desc: not available
URL: <http://lists.llvm.org/pipermail/lldb-commits/attachments/20220303/7176e238/attachment.bin>
More information about the lldb-commits
mailing list