當前位置: 首頁>>代碼示例>>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;未經允許,請勿轉載。