当前位置: 首页>>代码示例>>Python>>正文


Python lldb.SBExpressionOptions方法代码示例

本文整理汇总了Python中lldb.SBExpressionOptions方法的典型用法代码示例。如果您正苦于以下问题:Python lldb.SBExpressionOptions方法的具体用法?Python lldb.SBExpressionOptions怎么用?Python lldb.SBExpressionOptions使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在lldb的用法示例。


在下文中一共展示了lldb.SBExpressionOptions方法的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Python代码示例。

示例1: executeCommand

# 需要导入模块: import lldb [as 别名]
# 或者: from lldb import SBExpressionOptions [as 别名]
def executeCommand(command):
    debugger = lldb.debugger
    process = debugger.GetSelectedTarget().GetProcess()
    frame = process.GetSelectedThread().GetSelectedFrame()
    target = debugger.GetSelectedTarget()

    expr_options = lldb.SBExpressionOptions()
    expr_options.SetIgnoreBreakpoints(False);
    expr_options.SetFetchDynamicValue(lldb.eDynamicCanRunTarget);
    expr_options.SetTimeoutInMicroSeconds (30*1000*1000) # 30 second timeout
    expr_options.SetTryAllThreads (True)
    expr_options.SetUnwindOnError(False)
    expr_options.SetGenerateDebugInfo(True)
    expr_options.SetLanguage (lldb.eLanguageTypeObjC)
    expr_options.SetCoerceResultToId(True)
    return frame.EvaluateExpression(command, expr_options) 
开发者ID:DerekSelander,项目名称:LLDB,代码行数:18,代码来源:ddp.py

示例2: evaluateInputExpression

# 需要导入模块: import lldb [as 别名]
# 或者: from lldb import SBExpressionOptions [as 别名]
def evaluateInputExpression(expression, printErrors=True):
    # HACK
    if expression.startswith("(id)"):
        return evaluateExpressionValue(expression, printErrors=printErrors).GetValue()

    frame = (
        lldb.debugger.GetSelectedTarget()
        .GetProcess()
        .GetSelectedThread()
        .GetSelectedFrame()
    )
    options = lldb.SBExpressionOptions()
    options.SetTrapExceptions(False)
    value = frame.EvaluateExpression(expression, options)
    error = value.GetError()

    if printErrors and error.Fail():
        print(error)

    return value.GetValue() 
开发者ID:facebook,项目名称:chisel,代码行数:22,代码来源:fbchisellldbbase.py

示例3: generateOptions

# 需要导入模块: import lldb [as 别名]
# 或者: from lldb import SBExpressionOptions [as 别名]
def generateOptions():
    expr_options = lldb.SBExpressionOptions()
    expr_options.SetUnwindOnError(True)
    expr_options.SetLanguage (lldb.eLanguageTypeObjC_plus_plus)
    expr_options.SetCoerceResultToId(False)
    return expr_options 
开发者ID:DerekSelander,项目名称:LLDB,代码行数:8,代码来源:sbt.py

示例4: generateOptions

# 需要导入模块: import lldb [as 别名]
# 或者: from lldb import SBExpressionOptions [as 别名]
def generateOptions():
    expr_options = lldb.SBExpressionOptions()
    expr_options.SetUnwindOnError(True)
    expr_options.SetLanguage (lldb.eLanguageTypeObjC_plus_plus)
    expr_options.SetCoerceResultToId(True)
    expr_options.SetGenerateDebugInfo(True)
    return expr_options 
开发者ID:DerekSelander,项目名称:LLDB,代码行数:9,代码来源:msl.py

示例5: genExpressionOptions

# 需要导入模块: import lldb [as 别名]
# 或者: from lldb import SBExpressionOptions [as 别名]
def genExpressionOptions(useSwift=False, ignoreBreakpoints=False, useID=True):
    options = lldb.SBExpressionOptions()
    options.SetIgnoreBreakpoints(ignoreBreakpoints);
    options.SetTrapExceptions(False);
    options.SetFetchDynamicValue(lldb.eDynamicCanRunTarget);
    options.SetTimeoutInMicroSeconds (30*1000*1000) # 30 second timeout
    options.SetTryAllThreads (True)
    options.SetUnwindOnError(True)
    options.SetGenerateDebugInfo(True)
    if useSwift:
        options.SetLanguage (lldb.eLanguageTypeSwift)
    else:
        options.SetLanguage (lldb.eLanguageTypeObjC_plus_plus)
    options.SetCoerceResultToId(useID)
    return options 
开发者ID:DerekSelander,项目名称:LLDB,代码行数:17,代码来源:ds.py

示例6: setupIfiOS11

# 需要导入模块: import lldb [as 别名]
# 或者: from lldb import SBExpressionOptions [as 别名]
def setupIfiOS11(target):
    options = lldb.SBExpressionOptions()
    options.SetLanguage (lldb.eLanguageTypeObjC_plus_plus)
    options.SetCoerceResultToId()

    versionval = target.EvaluateExpression('[[UIDevice currentDevice] systemVersion]', options)
    versionvalstr = versionval.description 

    if "11." in versionvalstr:
        tweakiOS11Memory(target, "UIKit")
    elif "12." in versionvalstr:
        tweakiOS11Memory(target, "UIKitCore")
    else:
        "print unknown version, exiting..." 
开发者ID:DerekSelander,项目名称:LLDB,代码行数:16,代码来源:overlaydbg.py

示例7: load_lib_and_attach

# 需要导入模块: import lldb [as 别名]
# 或者: from lldb import SBExpressionOptions [as 别名]
def load_lib_and_attach(debugger, command, result, internal_dict):
    import shlex
    args = shlex.split(command)

    dll = args[0]
    is_debug = args[1]
    python_code = args[2]
    show_debug_info = args[3]

    import lldb
    options = lldb.SBExpressionOptions()
    options.SetFetchDynamicValue()
    options.SetTryAllThreads(run_others=False)
    options.SetTimeoutInMicroSeconds(timeout=10000000)

    print(dll)
    target = debugger.GetSelectedTarget()
    res = target.EvaluateExpression("(void*)dlopen(\"%s\", 2);" % (
        dll), options)
    error = res.GetError()
    if error:
        print(error)

    print(python_code)
    res = target.EvaluateExpression("(int)DoAttach(%s, \"%s\", %s);" % (
        is_debug, python_code.replace('"', "'"), show_debug_info), options)
    error = res.GetError()
    if error:
        print(error) 
开发者ID:fabioz,项目名称:PyDev.Debugger,代码行数:31,代码来源:lldb_prepare.py

示例8: importModule

# 需要导入模块: import lldb [as 别名]
# 或者: from lldb import SBExpressionOptions [as 别名]
def importModule(frame, module):
    options = lldb.SBExpressionOptions()
    options.SetLanguage(lldb.eLanguageTypeObjC)
    value = frame.EvaluateExpression("@import " + module, options)
    return isSuccess(value.error)


# evaluates expression in Objective-C++ context, so it will work even for
# Swift projects 
开发者ID:facebook,项目名称:chisel,代码行数:11,代码来源:fbchisellldbbase.py

示例9: evaluate

# 需要导入模块: import lldb [as 别名]
# 或者: from lldb import SBExpressionOptions [as 别名]
def evaluate(expr):
    result = lldb.debugger.GetSelectedTarget().EvaluateExpression(expr, lldb.SBExpressionOptions())
    log("{} => {}".format(expr, result))
    return result 
开发者ID:touchlab,项目名称:xcode-kotlin,代码行数:6,代码来源:konan_lldb_initial.py

示例10: evaluate

# 需要导入模块: import lldb [as 别名]
# 或者: from lldb import SBExpressionOptions [as 别名]
def evaluate(expr):
    result = lldb.debugger.GetSelectedTarget().EvaluateExpression(expr, lldb.SBExpressionOptions())
    # print "evaluate '" + expr +"' - "+ str(result)
    return result 
开发者ID:touchlab,项目名称:xcode-kotlin,代码行数:6,代码来源:konan_lldb_fast.py

示例11: evaluate

# 需要导入模块: import lldb [as 别名]
# 或者: from lldb import SBExpressionOptions [as 别名]
def evaluate(expr):
    result = lldb.debugger.GetSelectedTarget().EvaluateExpression(expr, lldb.SBExpressionOptions())
    evallog = lambda : "{} => {}".format(expr, result)
    log(evallog)
    exelog(evallog)
    return result 
开发者ID:touchlab,项目名称:xcode-kotlin,代码行数:8,代码来源:konan_lldb.py

示例12: evaluate

# 需要导入模块: import lldb [as 别名]
# 或者: from lldb import SBExpressionOptions [as 别名]
def evaluate(expr):
    result = lldb.debugger.GetSelectedTarget().EvaluateExpression(expr, lldb.SBExpressionOptions())
    evallog = "{} => {}".format(expr, result)
    log(evallog)
    exelog(evallog)
    return result 
开发者ID:touchlab,项目名称:xcode-kotlin,代码行数:8,代码来源:konan_lldb_compare.py

示例13: run

# 需要导入模块: import lldb [as 别名]
# 或者: from lldb import SBExpressionOptions [as 别名]
def run(self, arguments, options):
        # This command is like `expression --synthetic-type false`,
        # except only showing nested heap references.
        var = self.context.frame.var(arguments[0])
        if not var or not var.IsValid():
            self.result.SetError('No variable named "{}"'.format(arguments[0]))
            return

        # Use the actual underlying structure of the variable,
        # not the human friendly (synthetic) one.
        root = var.GetNonSyntheticValue()

        # Traversal of SBValue tree to get leaf nodes, which is where heap
        # pointers will be.
        leafs = []
        queue = [root]
        while queue:
            node = queue.pop(0)
            if node.num_children == 0:
                leafs.append(node)
            else:
                queue += [node.GetChildAtIndex(i) for i in range(node.num_children)]

        pointers = {}
        for node in leafs:
            # Assumption: an addr that has no value means a pointer.
            if node.addr and not node.value:
                pointers[node.load_addr] = node.path

        options = lldb.SBExpressionOptions()
        options.SetLanguage(lldb.eLanguageTypeC)

        def isHeap(addr):
            lookup = "(int)malloc_size({})".format(addr)
            return self.context.frame.EvaluateExpression(lookup, options).unsigned != 0

        allocations = (addr for addr in pointers if isHeap(addr))
        for addr in allocations:
            print(
                "0x{addr:x} {path}".format(addr=addr, path=pointers[addr]),
                file=self.result,
            )
        if not allocations:
            print("No heap addresses found", file=self.result) 
开发者ID:facebook,项目名称:chisel,代码行数:46,代码来源:FBDebugCommands.py

示例14: evaluateExpressionValue

# 需要导入模块: import lldb [as 别名]
# 或者: from lldb import SBExpressionOptions [as 别名]
def evaluateExpressionValue(
    expression,
    printErrors=True,
    language=lldb.eLanguageTypeObjC_plus_plus,
    tryAllThreads=False,
):
    frame = (
        lldb.debugger.GetSelectedTarget()
        .GetProcess()
        .GetSelectedThread()
        .GetSelectedFrame()
    )
    options = lldb.SBExpressionOptions()
    options.SetLanguage(language)

    # Allow evaluation that contains a @throw/@catch.
    #   By default, ObjC @throw will cause evaluation to be aborted. At the time
    #   of a @throw, it's not known if the exception will be handled by a @catch.
    #   An exception that's caught, should not cause evaluation to fail.
    options.SetTrapExceptions(False)

    # Give evaluation more time.
    options.SetTimeoutInMicroSeconds(5000000)  # 5s

    # Most Chisel commands are not multithreaded.
    options.SetTryAllThreads(tryAllThreads)

    value = frame.EvaluateExpression(expression, options)
    error = value.GetError()

    # Retry if the error could be resolved by first importing UIKit.
    if (
        error.type == lldb.eErrorTypeExpression
        and error.value == lldb.eExpressionParseError
        and importModule(frame, "UIKit")
    ):
        value = frame.EvaluateExpression(expression, options)
        error = value.GetError()

    if printErrors and not isSuccess(error):
        print(error)

    return value 
开发者ID:facebook,项目名称:chisel,代码行数:45,代码来源:fbchisellldbbase.py

示例15: _init_repl_process

# 需要导入模块: import lldb [as 别名]
# 或者: from lldb import SBExpressionOptions [as 别名]
def _init_repl_process(self):
        self.debugger = lldb.SBDebugger.Create()
        if not self.debugger:
            raise Exception('Could not start debugger')
        self.debugger.SetAsync(False)

        # LLDB crashes while trying to load some Python stuff on Mac. Maybe
        # something is misconfigured? This works around the problem by telling
        # LLDB not to load the Python scripting stuff, which we don't use
        # anyways.
        self.debugger.SetScriptLanguage(lldb.eScriptLanguageNone)

        repl_swift = os.environ['REPL_SWIFT_PATH']
        self.target = self.debugger.CreateTargetWithFileAndArch(repl_swift, '')
        if not self.target:
            raise Exception('Could not create target %s' % repl_swift)

        self.main_bp = self.target.BreakpointCreateByName(
            'repl_main', self.target.GetExecutable().GetFilename())
        if not self.main_bp:
            raise Exception('Could not set breakpoint')

        repl_env = []
        script_dir = os.path.dirname(os.path.realpath(sys.argv[0]))
        repl_env.append('PYTHONPATH=%s' % script_dir)
        env_var_blacklist = [
            'PYTHONPATH',
            'REPL_SWIFT_PATH'
        ]
        for key in os.environ:
            if key in env_var_blacklist:
                continue
            repl_env.append('%s=%s' % (key, os.environ[key]))

        self.process = self.target.LaunchSimple(None,
                                                repl_env,
                                                os.getcwd())
        if not self.process:
            raise Exception('Could not launch process')

        self.expr_opts = lldb.SBExpressionOptions()
        self.swift_language = lldb.SBLanguageRuntime.GetLanguageTypeFromString(
            'swift')
        self.expr_opts.SetLanguage(self.swift_language)
        self.expr_opts.SetREPLMode(True)
        self.expr_opts.SetUnwindOnError(False)
        self.expr_opts.SetGenerateDebugInfo(True)

        # Sets an infinite timeout so that users can run aribtrarily long
        # computations.
        self.expr_opts.SetTimeoutInMicroSeconds(0)

        self.main_thread = self.process.GetThreadAtIndex(0) 
开发者ID:google,项目名称:swift-jupyter,代码行数:55,代码来源:swift_kernel.py


注:本文中的lldb.SBExpressionOptions方法示例由纯净天空整理自Github/MSDocs等开源代码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。