本文整理汇总了Python中ipdb.launch_ipdb_on_exception方法的典型用法代码示例。如果您正苦于以下问题:Python ipdb.launch_ipdb_on_exception方法的具体用法?Python ipdb.launch_ipdb_on_exception怎么用?Python ipdb.launch_ipdb_on_exception使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类ipdb
的用法示例。
在下文中一共展示了ipdb.launch_ipdb_on_exception方法的3个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Python代码示例。
示例1: run_in_ipdb
# 需要导入模块: import ipdb [as 别名]
# 或者: from ipdb import launch_ipdb_on_exception [as 别名]
def run_in_ipdb(func, args):
import ipdb
with ipdb.launch_ipdb_on_exception():
func(args)
示例2: main
# 需要导入模块: import ipdb [as 别名]
# 或者: from ipdb import launch_ipdb_on_exception [as 别名]
def main(argv: List[str] = sys.argv) -> Any:
args = parse_arguments(argv)
if args.debug:
from ipdb import launch_ipdb_on_exception
with launch_ipdb_on_exception():
return args.func(args)
return args.func(args)
示例3: build_cfg
# 需要导入模块: import ipdb [as 别名]
# 或者: from ipdb import launch_ipdb_on_exception [as 别名]
def build_cfg(instructions: List[Instruction], loader: Loader) -> CFG:
"""
Check that calls matches returns and that syscalls and non-jumps do not change the control flow.
"""
stack = [] # type: List[int]
builder = CfgBuilder(instructions)
for (i, instruction) in enumerate(instructions):
if i > 0:
previous = instructions[i - 1]
if (
previous.iclass in BLOCK_TERMINATORS
or previous.ip + previous.size != instruction.ip
):
builder.add_edge(previous, instruction)
if previous.iclass == InstructionClass.ptic_return:
if len(stack) != 0:
return_ip = stack.pop()
if return_ip != instruction.ip:
previous_loc = loader.find_location(instructions[i - 1].ip)
instruction_loc = loader.find_location(instruction.ip)
return_loc = loader.find_location(return_ip)
l.warning(
"unexpected call return {} from {} found: expected {}".format(
instruction_loc, previous_loc, return_loc
)
)
stack = []
if instruction.iclass == InstructionClass.ptic_call:
return_ip = instruction.ip + instruction.size
stack.append(return_ip)
from ipdb import launch_ipdb_on_exception
with launch_ipdb_on_exception():
return builder.cfg()