本文整理汇总了Python中socorrolib.lib.util.DotDict.threads_index方法的典型用法代码示例。如果您正苦于以下问题:Python DotDict.threads_index方法的具体用法?Python DotDict.threads_index怎么用?Python DotDict.threads_index使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类socorrolib.lib.util.DotDict
的用法示例。
在下文中一共展示了DotDict.threads_index方法的1个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Python代码示例。
示例1: pipe_dump_to_json_dump
# 需要导入模块: from socorrolib.lib.util import DotDict [as 别名]
# 或者: from socorrolib.lib.util.DotDict import threads_index [as 别名]
def pipe_dump_to_json_dump(pipe_dump_iterable):
"""given a list (or any iterable) of strings representing a MDSW pipe dump,
this function will convert it into a json format."""
json_dump = DotDict()
crashing_thread = None
module_counter = 0
thread_counter = 0
for a_line in pipe_dump_iterable:
parts = a_line.split('|')
if parts[0] == 'OS':
_extract_OS_info(parts, json_dump)
elif parts[0] == 'CPU':
_extract_CPU_info(parts, json_dump)
elif parts[0] == 'Crash':
crashing_thread = _extract_crash_info(parts, json_dump)
elif parts[0] == 'Module':
_extract_module_info(parts, json_dump, module_counter)
module_counter += 1
else:
try:
thread_number = int(parts[0])
except (ValueError, IndexError):
continue # unknow line type, ignore it
_extract_frame_info(parts, json_dump)
try:
json_dump.thread_count = len(json_dump.threads)
except KeyError: # no threads were over found, 'threads' key was not made
json_dump.thread_count = 0
if crashing_thread is not None:
crashing_thread_frames = DotDict()
crashing_thread_frames.threads_index = crashing_thread
crashing_thread_frames.total_frames = \
len(json_dump.threads[crashing_thread].frames)
crashing_thread_frames.frames = \
json_dump.threads[crashing_thread].frames[:10]
json_dump.crashing_thread = crashing_thread_frames
return json_dump