本文整理汇总了Python中gdb.Breakpoint方法的典型用法代码示例。如果您正苦于以下问题:Python gdb.Breakpoint方法的具体用法?Python gdb.Breakpoint怎么用?Python gdb.Breakpoint使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类gdb
的用法示例。
在下文中一共展示了gdb.Breakpoint方法的6个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Python代码示例。
示例1: info
# 需要导入模块: import gdb [as 别名]
# 或者: from gdb import Breakpoint [as 别名]
def info(entry, *args):
"""In most cases, simply execute given arguments
and return results as string.
When `entry` is:
* locals/args: Return dict{variable=value}
* breakpoints: Return a list of gdb.Breakpoint
* threads: Return a list of (is_current_thread, num, ptid, name, frame)
"""
if entry.startswith(('ar', 'lo')):
info = gdb.execute('info ' + entry, to_string=True).splitlines()
# No arguments or No locals
if len(info) == 1 and info[0].startswith('No '):
return {}
group = {}
for line in info:
variable, _, value = line.partition('=')
group[variable.rstrip()] = value.lstrip()
return group
elif entry.startswith('b'):
return gdb.breakpoints()
elif entry.startswith('th'):
return info_threads(*args)
return gdb.execute(
'info %s %s' % (entry, args_to_string(*args)), to_string=True)
示例2: __init__
# 需要导入模块: import gdb [as 别名]
# 或者: from gdb import Breakpoint [as 别名]
def __init__(self):
gdb.Breakpoint.__init__(self, "ResetLevel")
self.cnt = 24
示例3: __init__
# 需要导入模块: import gdb [as 别名]
# 或者: from gdb import Breakpoint [as 别名]
def __init__(self, spec, twin, typ=None):
self._stop = twin.stop
self.companion = twin
gdb.Breakpoint.__init__(self, spec, internal=True)
示例4: br
# 需要导入模块: import gdb [as 别名]
# 或者: from gdb import Breakpoint [as 别名]
def br(location, threadnum='', condition='', commands=None,
temporary=False, probe_modifier=''):
"""Return a gdb.Breakpoint object
br('main.cpp:2') # break main.cpp:2
# break 2 thread 2 if result != NULL
br('2', threadnum=2, condition='result != NULL')
# threadnum can be the name of specific thread.
# We only set breakpoint on single thread, so make sure this name is unique.
br('2', threadnum='foo')
# break 2 and run the given function `callback`
br('2', commands=callback)
# temporary break
br('2', temporary=True)
"""
if commands is not None:
if not hasattr(commands, '__call__'):
raise TypeError('commands argument should be a function')
if threadnum != '':
if isinstance(threadnum, str):
thread_name = find_first_threadnum_with_name(threadnum)
if thread_name is None:
raise gdb.GdbError('Given thread name is not found')
threadnum = 'thread %d' % threadnum
if condition != '':
condition = 'if ' + condition
if temporary:
gdb.execute('tbreak ' + args_to_string(
probe_modifier, location, threadnum, condition))
else:
gdb.execute('break ' + args_to_string(
probe_modifier, location, threadnum, condition))
if commands is not None:
bp = get_last_breakpoint()
register_callback_to_breakpoint_num(bp.number, commands)
return bp
return get_last_breakpoint()
示例5: delete
# 需要导入模块: import gdb [as 别名]
# 或者: from gdb import Breakpoint [as 别名]
def delete(*args):
"""
delete() # delete all breakpoints
delete('1') # delete breakpoint 1
delete('bookmark', 1) # delete bookmark 1
delete(gdb.Breakpoint) # delete given Breakpoint object
"""
if len(args) == 0:
gdb.execute('delete')
elif isinstance(args[0], gdb.Breakpoint):
args[0].delete()
else:
gdb.execute('delete ' + args_to_string(*filter(None, args)))
示例6: stop
# 需要导入模块: import gdb [as 别名]
# 或者: from gdb import Breakpoint [as 别名]
def stop(callback, breakpoint=None, remove=False):
"""Run callback while gdb stops on breakpoints.
If `breakpoint` is given, run it while specific breakpoint is hit.
If `remove` is True, remove callback instead of adding it.
"""
if not remove:
if isinstance(breakpoint, gdb.Breakpoint):
register_callback_to_breakpoint_num(breakpoint.number, callback)
else:
gdb.events.stop.connect(callback)
else:
if isinstance(breakpoint, gdb.Breakpoint):
remove_callback_to_breakpoint_num(breakpoint.number, callback)
else:
gdb.events.stop.disconnect(callback)