本文整理匯總了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()