加入 Gitee
与超过 1200万 开发者一起发现、参与优秀开源项目,私有仓库也完全免费 :)
免费加入
文件
克隆/下载
fblldbinputhelpers.py 1.23 KB
一键复制 编辑 原始数据 按行查看 历史
Dave Lee 提交于 2014-11-08 00:01 . Remove superfluous if parens
#!/usr/bin/python
# Copyright (c) 2014, Facebook, Inc.
# All rights reserved.
#
# This source code is licensed under the BSD-style license found in the
# LICENSE file in the root directory of this source tree. An additional grant
# of patent rights can be found in the PATENTS file in the same directory.
import lldb
class FBInputHandler:
def __init__(self, debugger, callback):
self.debugger = debugger
self.callback = callback
self.inputReader = lldb.SBInputReader()
self.inputReader.Initialize(
debugger,
self.handleInput,
lldb.eInputReaderGranularityLine,
None,
None, # prompt
True # echo
)
def isValid(self):
return not self.inputReader.IsDone()
def start(self):
self.debugger.PushInputReader(self.inputReader)
def stop(self):
self.inputReader.SetIsDone(True)
def handleInput(self, inputReader, notification, bytes):
if notification == lldb.eInputReaderGotToken:
self.callback(bytes)
elif notification == lldb.eInputReaderInterrupt:
self.stop()
return len(bytes)
Loading...
马建仓 AI 助手
尝试更多
代码解读
代码找茬
代码优化