code string | signature string | docstring string | loss_without_docstring float64 | loss_with_docstring float64 | factor float64 |
|---|---|---|---|---|---|
if attrs is not None:
attr_list = attrs.split('\t')
else:
attr_list = []
for k in attr_list:
type, _typeName, resolver = get_type(var)
var = resolver.resolve(var, k)
return var | def resolve_var_object(var, attrs) | Resolve variable's attribute
:param var: an object of variable
:param attrs: a sequence of variable's attributes separated by \t (i.e.: obj\tattr1\tattr2)
:return: a value of resolved variable's attribute | 5.691906 | 5.552417 | 1.025122 |
attr_list = attrs.split('\t')
for k in attr_list:
type, _typeName, resolver = get_type(var)
var = resolver.resolve(var, k)
try:
type, _typeName, resolver = get_type(var)
return resolver.get_dictionary(var)
except:
pydev_log.exception() | def resolve_compound_var_object_fields(var, attrs) | Resolve compound variable by its object and attributes
:param var: an object of variable
:param attrs: a sequence of variable's attributes separated by \t (i.e.: obj\tattr1\tattr2)
:return: a dictionary of variables's fields | 6.425297 | 6.264072 | 1.025738 |
expressionValue = getVariable(dbg, thread_id, frame_id, scope, attrs)
try:
namespace = {'__name__': '<custom_operation>'}
if style == "EXECFILE":
namespace['__file__'] = code_or_file
execfile(code_or_file, namespace, namespace)
else: # style == EXEC
... | def custom_operation(dbg, thread_id, frame_id, scope, attrs, style, code_or_file, operation_fn_name) | We'll execute the code_or_file and then search in the namespace the operation_fn_name to execute with the given var.
code_or_file: either some code (i.e.: from pprint import pprint) or a file to be executed.
operation_fn_name: the name of the operation to execute after the exec (i.e.: pprint) | 4.074064 | 4.529767 | 0.899398 |
'''returns the result of the evaluated expression
@param is_exec: determines if we should do an exec or an eval
'''
if frame is None:
return
# Not using frame.f_globals because of https://sourceforge.net/tracker2/?func=detail&aid=2541355&group_id=85796&atid=577329
# (Names not resolved ... | def evaluate_expression(dbg, frame, expression, is_exec) | returns the result of the evaluated expression
@param is_exec: determines if we should do an exec or an eval | 5.308849 | 4.810874 | 1.10351 |
'''Changes some attribute in a given frame.
'''
if frame is None:
return
try:
expression = expression.replace('@LINE@', '\n')
if dbg.plugin and value is SENTINEL_VALUE:
result = dbg.plugin.change_variable(frame, attr, expression)
if result:
... | def change_attr_expression(frame, attr, expression, dbg, value=SENTINEL_VALUE) | Changes some attribute in a given frame. | 3.430086 | 3.355423 | 1.022251 |
num_rows = min(df.shape[0], MAX_SLICE_SIZE)
num_cols = min(df.shape[1], MAX_SLICE_SIZE)
if (num_rows, num_cols) != df.shape:
df = df.iloc[0:num_rows, 0: num_cols]
slice = '.iloc[0:%s, 0:%s]' % (num_rows, num_cols)
else:
slice = ''
slice = name + slice
xml = '<array s... | def dataframe_to_xml(df, name, roffset, coffset, rows, cols, format) | :type df: pandas.core.frame.DataFrame
:type name: str
:type coffset: int
:type roffset: int
:type rows: int
:type cols: int
:type format: str | 2.617035 | 2.616261 | 1.000296 |
opts = []
prog_args = []
if type('') == type(longopts):
longopts = [longopts]
else:
longopts = list(longopts)
# Allow options after non-option arguments?
all_options_first = False
if shortopts.startswith('+'):
shortopts = shortopts[1:]
all_options_first... | def gnu_getopt(args, shortopts, longopts=[]) | getopt(args, options[, long_options]) -> opts, args
This function works like getopt(), except that GNU style scanning
mode is used by default. This means that option and non-option
arguments may be intermixed. The getopt() function stops
processing options as soon as a non-option argument is
encoun... | 2.537329 | 2.573336 | 0.986008 |
'''
:return list(NetCommand):
Returns a list with the module events to be sent.
'''
if filename_in_utf8 in self._modules:
return []
module_events = []
with self._lock:
# Must check again after getting the lock.
if filename_... | def track_module(self, filename_in_utf8, module_name, frame) | :return list(NetCommand):
Returns a list with the module events to be sent. | 4.176206 | 3.492389 | 1.195802 |
'''
This method patches qt (PySide, PyQt4, PyQt5) so that we have hooks to set the tracing for QThread.
'''
if not qt_support_mode:
return
if qt_support_mode is True or qt_support_mode == 'True':
# do not break backward compatibility
qt_support_mode = 'auto'
if qt_suppo... | def patch_qt(qt_support_mode) | This method patches qt (PySide, PyQt4, PyQt5) so that we have hooks to set the tracing for QThread. | 2.738098 | 2.447614 | 1.11868 |
if condition is None:
self.__condition = True
else:
self.__condition = condition | def set_condition(self, condition = True) | Sets a new condition callback for the breakpoint.
@see: L{__init__}
@type condition: function
@param condition: (Optional) Condition callback function. | 4.220912 | 7.283286 | 0.579534 |
condition = self.get_condition()
if condition is True: # shortcut for unconditional breakpoints
return True
if callable(condition):
try:
return bool( condition(event) )
except Exception:
e = sys.exc_info()[1]
... | def eval_condition(self, event) | Evaluates the breakpoint condition, if any was set.
@type event: L{Event}
@param event: Debug event triggered by the breakpoint.
@rtype: bool
@return: C{True} to dispatch the event, C{False} otherwise. | 4.376669 | 4.011612 | 1.091 |
action = self.get_action()
if action is not None:
try:
return bool( action(event) )
except Exception:
e = sys.exc_info()[1]
msg = ("Breakpoint action callback %r"
" raised an exception: %s")
... | def run_action(self, event) | Executes the breakpoint action callback, if any was set.
@type event: L{Event}
@param event: Debug event triggered by the breakpoint. | 4.032647 | 3.710428 | 1.086841 |
statemsg = ""
oldState = self.stateNames[ self.get_state() ]
newState = self.stateNames[ state ]
msg = "Invalid state transition (%s -> %s)" \
" for breakpoint at address %s"
msg = msg % (oldState, newState, HexDump.address(self.get_address()))
rais... | def __bad_transition(self, state) | Raises an C{AssertionError} exception for an invalid state transition.
@see: L{stateNames}
@type state: int
@param state: Intended breakpoint state.
@raise Exception: Always. | 5.863133 | 5.101508 | 1.149294 |
if self.__state != self.ENABLED:
self.__bad_transition(self.RUNNING)
self.__state = self.RUNNING | def running(self, aProcess, aThread) | Transition to L{RUNNING} state.
- When hit: Enabled S{->} Running
@type aProcess: L{Process}
@param aProcess: Process object.
@type aThread: L{Thread}
@param aThread: Thread object. | 9.482327 | 10.710483 | 0.885331 |
aProcess = event.get_process()
aThread = event.get_thread()
state = self.get_state()
event.breakpoint = self
if state == self.ENABLED:
self.running(aProcess, aThread)
elif state == self.RUNNING:
self.enable(aProcess, aThread)
... | def hit(self, event) | Notify a breakpoint that it's been hit.
This triggers the corresponding state transition and sets the
C{breakpoint} property of the given L{Event} object.
@see: L{disable}, L{enable}, L{one_shot}, L{running}
@type event: L{Event}
@param event: Debug event to handle (depends o... | 4.140731 | 3.556406 | 1.164302 |
address = self.get_address()
self.__previousValue = aProcess.read(address, len(self.bpInstruction))
if self.__previousValue == self.bpInstruction:
msg = "Possible overlapping code breakpoints at %s"
msg = msg % HexDump.address(address)
warnings.warn(m... | def __set_bp(self, aProcess) | Writes a breakpoint instruction at the target address.
@type aProcess: L{Process}
@param aProcess: Process object. | 5.584427 | 5.579705 | 1.000846 |
lpAddress = self.get_address()
dwSize = self.get_size()
flNewProtect = aProcess.mquery(lpAddress).Protect
flNewProtect = flNewProtect | win32.PAGE_GUARD
aProcess.mprotect(lpAddress, dwSize, flNewProtect) | def __set_bp(self, aProcess) | Sets the target pages as guard pages.
@type aProcess: L{Process}
@param aProcess: Process object. | 5.50681 | 5.598097 | 0.983693 |
lpAddress = self.get_address()
flNewProtect = aProcess.mquery(lpAddress).Protect
flNewProtect = flNewProtect & (0xFFFFFFFF ^ win32.PAGE_GUARD) # DWORD
aProcess.mprotect(lpAddress, self.get_size(), flNewProtect) | def __clear_bp(self, aProcess) | Restores the original permissions of the target pages.
@type aProcess: L{Process}
@param aProcess: Process object. | 7.97949 | 8.376807 | 0.952569 |
if self.__slot is not None:
aThread.suspend()
try:
ctx = aThread.get_context(win32.CONTEXT_DEBUG_REGISTERS)
DebugRegister.clear_bp(ctx, self.__slot)
aThread.set_context(ctx)
self.__slot = None
finally:
... | def __clear_bp(self, aThread) | Clears this breakpoint from the debug registers.
@type aThread: L{Thread}
@param aThread: Thread object. | 4.37407 | 4.322608 | 1.011905 |
if self.__slot is None:
aThread.suspend()
try:
ctx = aThread.get_context(win32.CONTEXT_DEBUG_REGISTERS)
self.__slot = DebugRegister.find_slot(ctx)
if self.__slot is None:
msg = "No available hardware breakpoint ... | def __set_bp(self, aThread) | Sets this breakpoint in the debug registers.
@type aThread: L{Thread}
@param aThread: Thread object. | 4.476732 | 4.23931 | 1.056005 |
# Remove the one shot hardware breakpoint
# at the return address location in the stack.
tid = event.get_tid()
address = event.breakpoint.get_address()
event.debug.erase_hardware_breakpoint(tid, address)
# Call the "post" callback.
try:
... | def __postCallAction_hwbp(self, event) | Handles hardware breakpoint events on return from the function.
@type event: L{ExceptionEvent}
@param event: Single step event. | 9.812172 | 10.17052 | 0.964766 |
# If the breakpoint was accidentally hit by another thread,
# pass it to the debugger instead of calling the "post" callback.
#
# XXX FIXME:
# I suppose this check will fail under some weird conditions...
#
tid = event.get_tid()
if tid not in sel... | def __postCallAction_codebp(self, event) | Handles code breakpoint events on return from the function.
@type event: L{ExceptionEvent}
@param event: Breakpoint hit event. | 7.718584 | 7.653957 | 1.008444 |
aThread = event.get_thread()
retval = self._get_return_value(aThread)
self.__callHandler(self.__postCB, event, retval) | def __postCallAction(self, event) | Calls the "post" callback.
@type event: L{ExceptionEvent}
@param event: Breakpoint hit event. | 12.445451 | 11.260678 | 1.105213 |
if callback is not None:
event.hook = self
callback(event, *params) | def __callHandler(self, callback, event, *params) | Calls a "pre" or "post" handler, if set.
@type callback: function
@param callback: Callback function to call.
@type event: L{ExceptionEvent}
@param event: Breakpoint hit event.
@type params: tuple
@param params: Parameters for the callback function. | 6.97246 | 12.095637 | 0.576444 |
stack = self.__paramStack.get( tid, [] )
stack.append(params)
self.__paramStack[tid] = stack | def __push_params(self, tid, params) | Remembers the arguments tuple for the last call to the hooked function
from this thread.
@type tid: int
@param tid: Thread global ID.
@type params: tuple( arg, arg, arg... )
@param params: Tuple of arguments. | 4.993876 | 4.999563 | 0.998862 |
stack = self.__paramStack[tid]
stack.pop()
if not stack:
del self.__paramStack[tid] | def __pop_params(self, tid) | Forgets the arguments tuple for the last call to the hooked function
from this thread.
@type tid: int
@param tid: Thread global ID. | 4.669552 | 5.279793 | 0.884419 |
try:
params = self.get_params_stack(tid)[-1]
except IndexError:
msg = "Hooked function called from thread %d already returned"
raise IndexError(msg % tid)
return params | def get_params(self, tid) | Returns the parameters found in the stack when the hooked function
was last called by this thread.
@type tid: int
@param tid: Thread global ID.
@rtype: tuple( arg, arg, arg... )
@return: Tuple of arguments. | 7.315278 | 5.908704 | 1.238051 |
try:
stack = self.__paramStack[tid]
except KeyError:
msg = "Hooked function was not called from thread %d"
raise KeyError(msg % tid)
return stack | def get_params_stack(self, tid) | Returns the parameters found in the stack each time the hooked function
was called by this thread and hasn't returned yet.
@type tid: int
@param tid: Thread global ID.
@rtype: list of tuple( arg, arg, arg... )
@return: List of argument tuples. | 6.17933 | 5.555169 | 1.112357 |
return debug.break_at(pid, address, self) | def hook(self, debug, pid, address) | Installs the function hook at a given process and address.
@see: L{unhook}
@warning: Do not call from an function hook callback.
@type debug: L{Debug}
@param debug: Debug object.
@type pid: int
@param pid: Process ID.
@type address: int
@param addr... | 12.488619 | 35.041004 | 0.3564 |
label = "%s!%s" % (self.__modName, self.__procName)
try:
hook = self.__hook[pid]
except KeyError:
try:
aProcess = debug.system.get_process(pid)
except KeyError:
aProcess = Process(pid)
hook = Hook(self.__pre... | def hook(self, debug, pid) | Installs the API hook on a given process and module.
@warning: Do not call from an API hook callback.
@type debug: L{Debug}
@param debug: Debug object.
@type pid: int
@param pid: Process ID. | 4.928633 | 5.265504 | 0.936023 |
try:
hook = self.__hook[pid]
except KeyError:
return
label = "%s!%s" % (self.__modName, self.__procName)
hook.unhook(debug, pid, label)
del self.__hook[pid] | def unhook(self, debug, pid) | Removes the API hook from the given process and module.
@warning: Do not call from an API hook callback.
@type debug: L{Debug}
@param debug: Debug object.
@type pid: int
@param pid: Process ID. | 4.161103 | 4.71226 | 0.883038 |
try:
self.__ranges.remove(bw)
except KeyError:
if not bw.oneshot:
raise | def remove(self, bw) | Removes a buffer watch identifier.
@type bw: L{BufferWatch}
@param bw:
Buffer watch identifier.
@raise KeyError: The buffer watch identifier was already removed. | 9.012104 | 10.084964 | 0.893618 |
count = 0
start = address
end = address + size - 1
matched = None
for item in self.__ranges:
if item.match(start) and item.match(end):
matched = item
count += 1
self.__ranges.remove(matched)
return count | def remove_last_match(self, address, size) | Removes the last buffer from the watch object
to match the given address and size.
@type address: int
@param address: Memory address of buffer to stop watching.
@type size: int
@param size: Size in bytes of buffer to stop watching.
@rtype: int
@return: Numbe... | 3.718291 | 4.579928 | 0.811867 |
"Auxiliary method."
if tid not in self.__runningBP:
self.__runningBP[tid] = set()
self.__runningBP[tid].add(bp) | def __add_running_bp(self, tid, bp) | Auxiliary method. | 4.424758 | 3.300995 | 1.340432 |
"Auxiliary method."
self.__runningBP[tid].remove(bp)
if not self.__runningBP[tid]:
del self.__runningBP[tid] | def __del_running_bp(self, tid, bp) | Auxiliary method. | 4.921762 | 3.719149 | 1.323357 |
"Auxiliary method."
for (tid, bpset) in compat.iteritems(self.__runningBP):
if bp in bpset:
bpset.remove(bp)
self.system.get_thread(tid).clear_tf() | def __del_running_bp_from_all_threads(self, bp) | Auxiliary method. | 9.52494 | 7.778145 | 1.224577 |
"Auxiliary method."
try:
process = event.get_process()
thread = event.get_thread()
bp.disable(process, thread) # clear the debug regs / trap flag
except Exception:
pass
bp.set_condition(True) # break possible circular reference
bp... | def __cleanup_breakpoint(self, event, bp) | Auxiliary method. | 13.900511 | 11.997692 | 1.158599 |
tid = event.get_tid()
# Cleanup running breakpoints
try:
for bp in self.__runningBP[tid]:
self.__cleanup_breakpoint(event, bp)
del self.__runningBP[tid]
except KeyError:
pass
# Cleanup hardware breakpoints
try... | def __cleanup_thread(self, event) | Auxiliary method for L{_notify_exit_thread}
and L{_notify_exit_process}. | 3.166552 | 3.258835 | 0.971682 |
pid = event.get_pid()
process = event.get_process()
# Cleanup code breakpoints
for (bp_pid, bp_address) in compat.keys(self.__codeBP):
if bp_pid == pid:
bp = self.__codeBP[ (bp_pid, bp_address) ]
self.__cleanup_breakpoint(event, b... | def __cleanup_process(self, event) | Auxiliary method for L{_notify_exit_process}. | 2.357041 | 2.342477 | 1.006217 |
pid = event.get_pid()
process = event.get_process()
module = event.get_module()
# Cleanup thread breakpoints on this module
for tid in process.iter_thread_ids():
thread = process.get_thread(tid)
# Running breakpoints
if tid in s... | def __cleanup_module(self, event) | Auxiliary method for L{_notify_unload_dll}. | 1.861851 | 1.862713 | 0.999537 |
process = self.system.get_process(dwProcessId)
bp = CodeBreakpoint(address, condition, action)
key = (dwProcessId, bp.get_address())
if key in self.__codeBP:
msg = "Already exists (PID %d) : %r"
raise KeyError(msg % (dwProcessId, self.__codeBP[key]))
... | def define_code_breakpoint(self, dwProcessId, address, condition = True,
action = None) | Creates a disabled code breakpoint at the given address.
@see:
L{has_code_breakpoint},
L{get_code_breakpoint},
L{enable_code_breakpoint},
L{enable_one_shot_code_breakpoint},
L{disable_code_breakpoint},
L{erase_code_breakpoint}
@ty... | 3.746364 | 4.846557 | 0.772995 |
process = self.system.get_process(dwProcessId)
bp = PageBreakpoint(address, pages, condition, action)
begin = bp.get_address()
end = begin + bp.get_size()
address = begin
pageSize = MemoryAddresses.pageSize
while address < end:
ke... | def define_page_breakpoint(self, dwProcessId, address, pages = 1,
condition = True,
action = None) | Creates a disabled page breakpoint at the given address.
@see:
L{has_page_breakpoint},
L{get_page_breakpoint},
L{enable_page_breakpoint},
L{enable_one_shot_page_breakpoint},
L{disable_page_breakpoint},
L{erase_page_breakpoint}
@ty... | 3.613643 | 4.192008 | 0.862032 |
thread = self.system.get_thread(dwThreadId)
bp = HardwareBreakpoint(address, triggerFlag, sizeFlag, condition,
action)
begin = bp.get_address()
end = begin + bp.get_size()
if dwThreadId ... | def define_hardware_breakpoint(self, dwThreadId, address,
triggerFlag = BP_BREAK_ON_ACCESS,
sizeFlag = BP_WATCH_DWORD,
condition = True,
... | Creates a disabled hardware breakpoint at the given address.
@see:
L{has_hardware_breakpoint},
L{get_hardware_breakpoint},
L{enable_hardware_breakpoint},
L{enable_one_shot_hardware_breakpoint},
L{disable_hardware_breakpoint},
L{erase_hardw... | 3.157345 | 3.629705 | 0.869863 |
if dwThreadId in self.__hardwareBP:
bpSet = self.__hardwareBP[dwThreadId]
for bp in bpSet:
if bp.get_address() == address:
return True
return False | def has_hardware_breakpoint(self, dwThreadId, address) | Checks if a hardware breakpoint is defined at the given address.
@see:
L{define_hardware_breakpoint},
L{get_hardware_breakpoint},
L{erase_hardware_breakpoint},
L{enable_hardware_breakpoint},
L{enable_one_shot_hardware_breakpoint},
L{disabl... | 2.81304 | 4.197259 | 0.670209 |
key = (dwProcessId, address)
if key not in self.__codeBP:
msg = "No breakpoint at process %d, address %s"
address = HexDump.address(address)
raise KeyError(msg % (dwProcessId, address))
return self.__codeBP[key] | def get_code_breakpoint(self, dwProcessId, address) | Returns the internally used breakpoint object,
for the code breakpoint defined at the given address.
@warning: It's usually best to call the L{Debug} methods
instead of accessing the breakpoint objects directly.
@see:
L{define_code_breakpoint},
L{has_code_br... | 4.147412 | 5.38447 | 0.770254 |
key = (dwProcessId, address)
if key not in self.__pageBP:
msg = "No breakpoint at process %d, address %s"
address = HexDump.addresS(address)
raise KeyError(msg % (dwProcessId, address))
return self.__pageBP[key] | def get_page_breakpoint(self, dwProcessId, address) | Returns the internally used breakpoint object,
for the page breakpoint defined at the given address.
@warning: It's usually best to call the L{Debug} methods
instead of accessing the breakpoint objects directly.
@see:
L{define_page_breakpoint},
L{has_page_br... | 5.173157 | 6.768175 | 0.764336 |
if dwThreadId not in self.__hardwareBP:
msg = "No hardware breakpoints set for thread %d"
raise KeyError(msg % dwThreadId)
for bp in self.__hardwareBP[dwThreadId]:
if bp.is_here(address):
return bp
msg = "No hardware breakpoint at thre... | def get_hardware_breakpoint(self, dwThreadId, address) | Returns the internally used breakpoint object,
for the code breakpoint defined at the given address.
@warning: It's usually best to call the L{Debug} methods
instead of accessing the breakpoint objects directly.
@see:
L{define_hardware_breakpoint},
L{has_har... | 2.891399 | 3.507923 | 0.824248 |
p = self.system.get_process(dwProcessId)
bp = self.get_code_breakpoint(dwProcessId, address)
if bp.is_running():
self.__del_running_bp_from_all_threads(bp)
bp.enable(p, None) | def enable_code_breakpoint(self, dwProcessId, address) | Enables the code breakpoint at the given address.
@see:
L{define_code_breakpoint},
L{has_code_breakpoint},
L{enable_one_shot_code_breakpoint},
L{disable_code_breakpoint}
L{erase_code_breakpoint},
@type dwProcessId: int
@param dwProce... | 5.571438 | 6.974843 | 0.79879 |
p = self.system.get_process(dwProcessId)
bp = self.get_page_breakpoint(dwProcessId, address)
if bp.is_running():
self.__del_running_bp_from_all_threads(bp)
bp.enable(p, None) | def enable_page_breakpoint(self, dwProcessId, address) | Enables the page breakpoint at the given address.
@see:
L{define_page_breakpoint},
L{has_page_breakpoint},
L{get_page_breakpoint},
L{enable_one_shot_page_breakpoint},
L{disable_page_breakpoint}
L{erase_page_breakpoint},
@type dwP... | 5.668414 | 6.811791 | 0.832147 |
t = self.system.get_thread(dwThreadId)
bp = self.get_hardware_breakpoint(dwThreadId, address)
if bp.is_running():
self.__del_running_bp_from_all_threads(bp)
bp.enable(None, t) | def enable_hardware_breakpoint(self, dwThreadId, address) | Enables the hardware breakpoint at the given address.
@see:
L{define_hardware_breakpoint},
L{has_hardware_breakpoint},
L{get_hardware_breakpoint},
L{enable_one_shot_hardware_breakpoint},
L{disable_hardware_breakpoint}
L{erase_hardware_brea... | 5.418971 | 6.885668 | 0.786993 |
p = self.system.get_process(dwProcessId)
bp = self.get_code_breakpoint(dwProcessId, address)
if bp.is_running():
self.__del_running_bp_from_all_threads(bp)
bp.one_shot(p, None) | def enable_one_shot_code_breakpoint(self, dwProcessId, address) | Enables the code breakpoint at the given address for only one shot.
@see:
L{define_code_breakpoint},
L{has_code_breakpoint},
L{get_code_breakpoint},
L{enable_code_breakpoint},
L{disable_code_breakpoint}
L{erase_code_breakpoint},
@... | 5.832613 | 6.720672 | 0.867862 |
p = self.system.get_process(dwProcessId)
bp = self.get_page_breakpoint(dwProcessId, address)
if bp.is_running():
self.__del_running_bp_from_all_threads(bp)
bp.one_shot(p, None) | def enable_one_shot_page_breakpoint(self, dwProcessId, address) | Enables the page breakpoint at the given address for only one shot.
@see:
L{define_page_breakpoint},
L{has_page_breakpoint},
L{get_page_breakpoint},
L{enable_page_breakpoint},
L{disable_page_breakpoint}
L{erase_page_breakpoint},
@... | 5.954497 | 6.766942 | 0.879939 |
t = self.system.get_thread(dwThreadId)
bp = self.get_hardware_breakpoint(dwThreadId, address)
if bp.is_running():
self.__del_running_bp_from_all_threads(bp)
bp.one_shot(None, t) | def enable_one_shot_hardware_breakpoint(self, dwThreadId, address) | Enables the hardware breakpoint at the given address for only one shot.
@see:
L{define_hardware_breakpoint},
L{has_hardware_breakpoint},
L{get_hardware_breakpoint},
L{enable_hardware_breakpoint},
L{disable_hardware_breakpoint}
L{erase_hard... | 5.692925 | 6.757734 | 0.842431 |
p = self.system.get_process(dwProcessId)
bp = self.get_code_breakpoint(dwProcessId, address)
if bp.is_running():
self.__del_running_bp_from_all_threads(bp)
bp.disable(p, None) | def disable_code_breakpoint(self, dwProcessId, address) | Disables the code breakpoint at the given address.
@see:
L{define_code_breakpoint},
L{has_code_breakpoint},
L{get_code_breakpoint},
L{enable_code_breakpoint}
L{enable_one_shot_code_breakpoint},
L{erase_code_breakpoint},
@type dwP... | 5.682651 | 6.928556 | 0.820178 |
p = self.system.get_process(dwProcessId)
bp = self.get_page_breakpoint(dwProcessId, address)
if bp.is_running():
self.__del_running_bp_from_all_threads(bp)
bp.disable(p, None) | def disable_page_breakpoint(self, dwProcessId, address) | Disables the page breakpoint at the given address.
@see:
L{define_page_breakpoint},
L{has_page_breakpoint},
L{get_page_breakpoint},
L{enable_page_breakpoint}
L{enable_one_shot_page_breakpoint},
L{erase_page_breakpoint},
@type dwP... | 5.86162 | 6.967922 | 0.841229 |
t = self.system.get_thread(dwThreadId)
p = t.get_process()
bp = self.get_hardware_breakpoint(dwThreadId, address)
if bp.is_running():
self.__del_running_bp(dwThreadId, bp)
bp.disable(p, t) | def disable_hardware_breakpoint(self, dwThreadId, address) | Disables the hardware breakpoint at the given address.
@see:
L{define_hardware_breakpoint},
L{has_hardware_breakpoint},
L{get_hardware_breakpoint},
L{enable_hardware_breakpoint}
L{enable_one_shot_hardware_breakpoint},
L{erase_hardware_brea... | 4.498186 | 5.122736 | 0.878083 |
bp = self.get_code_breakpoint(dwProcessId, address)
if not bp.is_disabled():
self.disable_code_breakpoint(dwProcessId, address)
del self.__codeBP[ (dwProcessId, address) ] | def erase_code_breakpoint(self, dwProcessId, address) | Erases the code breakpoint at the given address.
@see:
L{define_code_breakpoint},
L{has_code_breakpoint},
L{get_code_breakpoint},
L{enable_code_breakpoint},
L{enable_one_shot_code_breakpoint},
L{disable_code_breakpoint}
@type dwP... | 3.725616 | 3.895465 | 0.956398 |
bp = self.get_page_breakpoint(dwProcessId, address)
begin = bp.get_address()
end = begin + bp.get_size()
if not bp.is_disabled():
self.disable_page_breakpoint(dwProcessId, address)
address = begin
pageSize = MemoryAddresses.pageSize
whil... | def erase_page_breakpoint(self, dwProcessId, address) | Erases the page breakpoint at the given address.
@see:
L{define_page_breakpoint},
L{has_page_breakpoint},
L{get_page_breakpoint},
L{enable_page_breakpoint},
L{enable_one_shot_page_breakpoint},
L{disable_page_breakpoint}
@type dwP... | 4.482564 | 4.55809 | 0.98343 |
bp = self.get_hardware_breakpoint(dwThreadId, address)
if not bp.is_disabled():
self.disable_hardware_breakpoint(dwThreadId, address)
bpSet = self.__hardwareBP[dwThreadId]
bpSet.remove(bp)
if not bpSet:
del self.__hardwareBP[dwThreadId] | def erase_hardware_breakpoint(self, dwThreadId, address) | Erases the hardware breakpoint at the given address.
@see:
L{define_hardware_breakpoint},
L{has_hardware_breakpoint},
L{get_hardware_breakpoint},
L{enable_hardware_breakpoint},
L{enable_one_shot_hardware_breakpoint},
L{disable_hardware_bre... | 2.903352 | 3.065543 | 0.947093 |
bplist = list()
# Get the code breakpoints.
for (pid, bp) in self.get_all_code_breakpoints():
bplist.append( (pid, None, bp) )
# Get the page breakpoints.
for (pid, bp) in self.get_all_page_breakpoints():
bplist.append( (pid, None, bp) )
... | def get_all_breakpoints(self) | Returns all breakpoint objects as a list of tuples.
Each tuple contains:
- Process global ID to which the breakpoint applies.
- Thread global ID to which the breakpoint applies, or C{None}.
- The L{Breakpoint} object itself.
@note: If you're only interested in a specific bre... | 2.473413 | 2.084213 | 1.186738 |
bplist = list()
# Get the code breakpoints.
for bp in self.get_process_code_breakpoints(dwProcessId):
bplist.append( (dwProcessId, None, bp) )
# Get the page breakpoints.
for bp in self.get_process_page_breakpoints(dwProcessId):
bplist.append( (... | def get_process_breakpoints(self, dwProcessId) | Returns all breakpoint objects for the given process as a list of tuples.
Each tuple contains:
- Process global ID to which the breakpoint applies.
- Thread global ID to which the breakpoint applies, or C{None}.
- The L{Breakpoint} object itself.
@note: If you're only intere... | 2.494033 | 2.180642 | 1.143715 |
return [ bp for ((pid, address), bp) in compat.iteritems(self.__codeBP) \
if pid == dwProcessId ] | def get_process_code_breakpoints(self, dwProcessId) | @type dwProcessId: int
@param dwProcessId: Process global ID.
@rtype: list of L{CodeBreakpoint}
@return: All code breakpoints for the given process. | 13.414317 | 12.336326 | 1.087384 |
return [ bp for ((pid, address), bp) in compat.iteritems(self.__pageBP) \
if pid == dwProcessId ] | def get_process_page_breakpoints(self, dwProcessId) | @type dwProcessId: int
@param dwProcessId: Process global ID.
@rtype: list of L{PageBreakpoint}
@return: All page breakpoints for the given process. | 14.085694 | 11.980301 | 1.175738 |
result = list()
for (tid, bplist) in compat.iteritems(self.__hardwareBP):
if tid == dwThreadId:
for bp in bplist:
result.append(bp)
return result | def get_thread_hardware_breakpoints(self, dwThreadId) | @see: L{get_process_hardware_breakpoints}
@type dwThreadId: int
@param dwThreadId: Thread global ID.
@rtype: list of L{HardwareBreakpoint}
@return: All hardware breakpoints for the given thread. | 4.685938 | 5.409008 | 0.866321 |
result = list()
aProcess = self.system.get_process(dwProcessId)
for dwThreadId in aProcess.iter_thread_ids():
if dwThreadId in self.__hardwareBP:
bplist = self.__hardwareBP[dwThreadId]
for bp in bplist:
result.append( (dwTh... | def get_process_hardware_breakpoints(self, dwProcessId) | @see: L{get_thread_hardware_breakpoints}
@type dwProcessId: int
@param dwProcessId: Process global ID.
@rtype: list of tuple( int, L{HardwareBreakpoint} )
@return: All hardware breakpoints for each thread in the given process
as a list of tuples (tid, bp). | 3.478422 | 3.546037 | 0.980932 |
# disable code breakpoints
for (pid, bp) in self.get_all_code_breakpoints():
if bp.is_disabled():
self.enable_code_breakpoint(pid, bp.get_address())
# disable page breakpoints
for (pid, bp) in self.get_all_page_breakpoints():
if bp.is_di... | def enable_all_breakpoints(self) | Enables all disabled breakpoints in all processes.
@see:
enable_code_breakpoint,
enable_page_breakpoint,
enable_hardware_breakpoint | 2.09095 | 1.836907 | 1.1383 |
# disable code breakpoints for one shot
for (pid, bp) in self.get_all_code_breakpoints():
if bp.is_disabled():
self.enable_one_shot_code_breakpoint(pid, bp.get_address())
# disable page breakpoints for one shot
for (pid, bp) in self.get_all_page_bre... | def enable_one_shot_all_breakpoints(self) | Enables for one shot all disabled breakpoints in all processes.
@see:
enable_one_shot_code_breakpoint,
enable_one_shot_page_breakpoint,
enable_one_shot_hardware_breakpoint | 2.093281 | 1.805934 | 1.159113 |
# disable code breakpoints
for (pid, bp) in self.get_all_code_breakpoints():
self.disable_code_breakpoint(pid, bp.get_address())
# disable page breakpoints
for (pid, bp) in self.get_all_page_breakpoints():
self.disable_page_breakpoint(pid, bp.get_addres... | def disable_all_breakpoints(self) | Disables all breakpoints in all processes.
@see:
disable_code_breakpoint,
disable_page_breakpoint,
disable_hardware_breakpoint | 2.166529 | 1.886447 | 1.14847 |
# This should be faster but let's not trust the GC so much :P
# self.disable_all_breakpoints()
# self.__codeBP = dict()
# self.__pageBP = dict()
# self.__hardwareBP = dict()
# self.__runningBP = dict()
# self.__hook_objects = dict()
## ... | def erase_all_breakpoints(self) | Erases all breakpoints in all processes.
@see:
erase_code_breakpoint,
erase_page_breakpoint,
erase_hardware_breakpoint | 3.229486 | 2.900975 | 1.113241 |
# enable code breakpoints
for bp in self.get_process_code_breakpoints(dwProcessId):
if bp.is_disabled():
self.enable_code_breakpoint(dwProcessId, bp.get_address())
# enable page breakpoints
for bp in self.get_process_page_breakpoints(dwProcessId):
... | def enable_process_breakpoints(self, dwProcessId) | Enables all disabled breakpoints for the given process.
@type dwProcessId: int
@param dwProcessId: Process global ID. | 2.144084 | 2.239525 | 0.957383 |
# enable code breakpoints for one shot
for bp in self.get_process_code_breakpoints(dwProcessId):
if bp.is_disabled():
self.enable_one_shot_code_breakpoint(dwProcessId, bp.get_address())
# enable page breakpoints for one shot
for bp in self.get_proce... | def enable_one_shot_process_breakpoints(self, dwProcessId) | Enables for one shot all disabled breakpoints for the given process.
@type dwProcessId: int
@param dwProcessId: Process global ID. | 2.17039 | 2.22107 | 0.977182 |
# disable code breakpoints
for bp in self.get_process_code_breakpoints(dwProcessId):
self.disable_code_breakpoint(dwProcessId, bp.get_address())
# disable page breakpoints
for bp in self.get_process_page_breakpoints(dwProcessId):
self.disable_page_break... | def disable_process_breakpoints(self, dwProcessId) | Disables all breakpoints for the given process.
@type dwProcessId: int
@param dwProcessId: Process global ID. | 2.23174 | 2.339921 | 0.953767 |
# disable breakpoints first
# if an error occurs, no breakpoint is erased
self.disable_process_breakpoints(dwProcessId)
## # erase hooks
## for address, hook in self.get_process_hooks(dwProcessId):
## self.dont_hook_function(dwProcessId, address)
# er... | def erase_process_breakpoints(self, dwProcessId) | Erases all breakpoints for the given process.
@type dwProcessId: int
@param dwProcessId: Process global ID. | 2.659903 | 2.672037 | 0.995459 |
address = event.get_fault_address()
pid = event.get_pid()
bCallHandler = True
# Align address to page boundary.
mask = ~(MemoryAddresses.pageSize - 1)
address = address & mask
# Do we have an active page breakpoint there?
... | def _notify_guard_page(self, event) | Notify breakpoints of a guard page exception event.
@type event: L{ExceptionEvent}
@param event: Guard page exception event.
@rtype: bool
@return: C{True} to call the user-defined handle, C{False} otherwise. | 5.370009 | 5.210385 | 1.030636 |
address = event.get_exception_address()
pid = event.get_pid()
bCallHandler = True
# Do we have an active code breakpoint there?
key = (pid, address)
if key in self.__codeBP:
bp = self.__codeBP[key]
if not bp.is_disa... | def _notify_breakpoint(self, event) | Notify breakpoints of a breakpoint exception event.
@type event: L{ExceptionEvent}
@param event: Breakpoint exception event.
@rtype: bool
@return: C{True} to call the user-defined handle, C{False} otherwise. | 5.340581 | 5.420141 | 0.985322 |
self.__cleanup_process(event)
self.__cleanup_thread(event)
return True | def _notify_exit_process(self, event) | Notify the termination of a process.
@type event: L{ExitProcessEvent}
@param event: Exit process event.
@rtype: bool
@return: C{True} to call the user-defined handler, C{False} otherwise. | 10.472287 | 15.024755 | 0.697002 |
if type(address) not in (int, long):
label = address
try:
address = self.system.get_process(pid).resolve_label(address)
if not address:
raise Exception()
except Exception:
try:
de... | def __set_break(self, pid, address, action, oneshot) | Used by L{break_at} and L{stalk_at}.
@type pid: int
@param pid: Process global ID.
@type address: int or str
@param address:
Memory address of code instruction to break at. It can be an
integer value for the actual address or a string with a label
... | 2.80388 | 2.610191 | 1.074205 |
if type(address) not in (int, long):
unknown = True
label = address
try:
deferred = self.__deferredBP[pid]
del deferred[label]
unknown = False
except KeyError:
## traceback.print_last() #... | def __clear_break(self, pid, address) | Used by L{dont_break_at} and L{dont_stalk_at}.
@type pid: int
@param pid: Process global ID.
@type address: int or str
@param address:
Memory address of code instruction to break at. It can be an
integer value for the actual address or a string with a label
... | 4.552371 | 4.569491 | 0.996253 |
pid = event.get_pid()
try:
deferred = self.__deferredBP[pid]
except KeyError:
return
aProcess = event.get_process()
for (label, (action, oneshot)) in deferred.items():
try:
address = aProcess.resolve_label(label)
... | def __set_deferred_breakpoints(self, event) | Used internally. Sets all deferred breakpoints for a DLL when it's
loaded.
@type event: L{LoadDLLEvent}
@param event: Load DLL event. | 4.068249 | 4.37355 | 0.930194 |
result = []
for pid, deferred in compat.iteritems(self.__deferredBP):
for (label, (action, oneshot)) in compat.iteritems(deferred):
result.add( (pid, label, action, oneshot) )
return result | def get_all_deferred_code_breakpoints(self) | Returns a list of deferred code breakpoints.
@rtype: tuple of (int, str, callable, bool)
@return: Tuple containing the following elements:
- Process ID where to set the breakpoint.
- Label pointing to the address where to set the breakpoint.
- Action callback for... | 7.668014 | 6.089727 | 1.259172 |
return [ (label, action, oneshot)
for (label, (action, oneshot))
in compat.iteritems(self.__deferredBP.get(dwProcessId, {})) ] | def get_process_deferred_code_breakpoints(self, dwProcessId) | Returns a list of deferred code breakpoints.
@type dwProcessId: int
@param dwProcessId: Process ID.
@rtype: tuple of (int, str, callable, bool)
@return: Tuple containing the following elements:
- Label pointing to the address where to set the breakpoint.
- A... | 9.404759 | 8.56925 | 1.097501 |
bp = self.__set_break(pid, address, action, oneshot = True)
return bp is not None | def stalk_at(self, pid, address, action = None) | Sets a one shot code breakpoint at the given process and address.
If instead of an address you pass a label, the breakpoint may be
deferred until the DLL it points to is loaded.
@see: L{break_at}, L{dont_stalk_at}
@type pid: int
@param pid: Process global ID.
@type ... | 10.342963 | 14.393719 | 0.718575 |
bp = self.__set_break(pid, address, action, oneshot = False)
return bp is not None | def break_at(self, pid, address, action = None) | Sets a code breakpoint at the given process and address.
If instead of an address you pass a label, the breakpoint may be
deferred until the DLL it points to is loaded.
@see: L{stalk_at}, L{dont_break_at}
@type pid: int
@param pid: Process global ID.
@type address: ... | 8.511882 | 15.250539 | 0.558136 |
try:
aProcess = self.system.get_process(pid)
except KeyError:
aProcess = Process(pid)
arch = aProcess.get_arch()
hookObj = Hook(preCB, postCB, paramCount, signature, arch)
bp = self.break_at(pid, address, hookObj)
return bp is not None | def hook_function(self, pid, address,
preCB = None, postCB = None,
paramCount = None, signature = None) | Sets a function hook at the given address.
If instead of an address you pass a label, the hook may be
deferred until the DLL it points to is loaded.
@type pid: int
@param pid: Process global ID.
@type address: int or str
@param address:
Memory address of ... | 4.691179 | 5.24737 | 0.894006 |
# TODO
# We should merge the breakpoints instead of overwriting them.
# We'll have the same problem as watch_buffer and we'll need to change
# the API again.
if size == 1:
sizeFlag = self.BP_WATCH_BYTE
elif size == 2:
sizeFlag = self.BP_... | def __set_variable_watch(self, tid, address, size, action) | Used by L{watch_variable} and L{stalk_variable}.
@type tid: int
@param tid: Thread global ID.
@type address: int
@param address: Memory address of variable to watch.
@type size: int
@param size: Size of variable to watch. The only supported sizes are:
by... | 3.387813 | 3.174936 | 1.067049 |
if self.has_hardware_breakpoint(tid, address):
self.erase_hardware_breakpoint(tid, address) | def __clear_variable_watch(self, tid, address) | Used by L{dont_watch_variable} and L{dont_stalk_variable}.
@type tid: int
@param tid: Thread global ID.
@type address: int
@param address: Memory address of variable to stop watching. | 5.919147 | 8.697912 | 0.680525 |
bp = self.__set_variable_watch(tid, address, size, action)
if not bp.is_enabled():
self.enable_hardware_breakpoint(tid, address) | def watch_variable(self, tid, address, size, action = None) | Sets a hardware breakpoint at the given thread, address and size.
@see: L{dont_watch_variable}
@type tid: int
@param tid: Thread global ID.
@type address: int
@param address: Memory address of variable to watch.
@type size: int
@param size: Size of variable... | 7.908926 | 7.046922 | 1.122323 |
bp = self.__set_variable_watch(tid, address, size, action)
if not bp.is_one_shot():
self.enable_one_shot_hardware_breakpoint(tid, address) | def stalk_variable(self, tid, address, size, action = None) | Sets a one-shot hardware breakpoint at the given thread,
address and size.
@see: L{dont_watch_variable}
@type tid: int
@param tid: Thread global ID.
@type address: int
@param address: Memory address of variable to watch.
@type size: int
@param size:... | 8.278051 | 6.413811 | 1.29066 |
# Check the size isn't zero or negative.
if size < 1:
raise ValueError("Bad size for buffer watch: %r" % size)
# Create the buffer watch identifier.
bw = BufferWatch(pid, address, address + size, action, bOneShot)
# Get the base address and size in pages r... | def __set_buffer_watch(self, pid, address, size, action, bOneShot) | Used by L{watch_buffer} and L{stalk_buffer}.
@type pid: int
@param pid: Process global ID.
@type address: int
@param address: Memory address of buffer to watch.
@type size: int
@param size: Size in bytes of buffer to watch.
@type action: function
@... | 3.828564 | 3.798367 | 1.00795 |
warnings.warn("Deprecated since WinAppDbg 1.5", DeprecationWarning)
# Check the size isn't zero or negative.
if size < 1:
raise ValueError("Bad size for buffer watch: %r" % size)
# Get the base address and size in pages required for this buffer.
base = Mem... | def __clear_buffer_watch_old_method(self, pid, address, size) | Used by L{dont_watch_buffer} and L{dont_stalk_buffer}.
@warn: Deprecated since WinAppDbg 1.5.
@type pid: int
@param pid: Process global ID.
@type address: int
@param address: Memory address of buffer to stop watching.
@type size: int
@param size: Size in by... | 4.700775 | 4.467979 | 1.052103 |
# Get the PID and the start and end addresses of the buffer.
pid = bw.pid
start = bw.start
end = bw.end
# Get the base address and size in pages required for the buffer.
base = MemoryAddresses.align_address_to_page_start(start)
limit = MemoryAddres... | def __clear_buffer_watch(self, bw) | Used by L{dont_watch_buffer} and L{dont_stalk_buffer}.
@type bw: L{BufferWatch}
@param bw: Buffer watch identifier. | 4.579767 | 4.515738 | 1.014179 |
self.__set_buffer_watch(pid, address, size, action, False) | def watch_buffer(self, pid, address, size, action = None) | Sets a page breakpoint and notifies when the given buffer is accessed.
@see: L{dont_watch_variable}
@type pid: int
@param pid: Process global ID.
@type address: int
@param address: Memory address of buffer to watch.
@type size: int
@param size: Size in byte... | 6.536692 | 9.82322 | 0.665433 |
self.__set_buffer_watch(pid, address, size, action, True) | def stalk_buffer(self, pid, address, size, action = None) | Sets a one-shot page breakpoint and notifies
when the given buffer is accessed.
@see: L{dont_watch_variable}
@type pid: int
@param pid: Process global ID.
@type address: int
@param address: Memory address of buffer to watch.
@type size: int
@param s... | 8.827766 | 9.458909 | 0.933275 |
# The sane way to do it.
if not (argv or argd):
self.__clear_buffer_watch(bw)
# Backwards compatibility with WinAppDbg 1.4.
else:
argv = list(argv)
argv.insert(0, bw)
if 'pid' in argd:
argv.insert(0, argd.pop('pid... | def dont_watch_buffer(self, bw, *argv, **argd) | Clears a page breakpoint set by L{watch_buffer}.
@type bw: L{BufferWatch}
@param bw:
Buffer watch identifier returned by L{watch_buffer}. | 2.963659 | 2.821725 | 1.0503 |
self.dont_watch_buffer(bw, *argv, **argd) | def dont_stalk_buffer(self, bw, *argv, **argd) | Clears a page breakpoint set by L{stalk_buffer}.
@type bw: L{BufferWatch}
@param bw:
Buffer watch identifier returned by L{stalk_buffer}. | 4.467585 | 7.373798 | 0.605873 |
if not self.is_tracing(tid):
thread = self.system.get_thread(tid)
self.__start_tracing(thread) | def start_tracing(self, tid) | Start tracing mode in the given thread.
@type tid: int
@param tid: Global ID of thread to start tracing. | 4.630805 | 5.708797 | 0.81117 |
if self.is_tracing(tid):
thread = self.system.get_thread(tid)
self.__stop_tracing(thread) | def stop_tracing(self, tid) | Stop tracing mode in the given thread.
@type tid: int
@param tid: Global ID of thread to stop tracing. | 4.971953 | 5.785863 | 0.859328 |
for thread in self.system.get_process(pid).iter_threads():
self.__start_tracing(thread) | def start_tracing_process(self, pid) | Start tracing mode for all threads in the given process.
@type pid: int
@param pid: Global ID of process to start tracing. | 7.511324 | 8.492778 | 0.884437 |
for thread in self.system.get_process(pid).iter_threads():
self.__stop_tracing(thread) | def stop_tracing_process(self, pid) | Stop tracing mode for all threads in the given process.
@type pid: int
@param pid: Global ID of process to stop tracing. | 9.436123 | 9.328311 | 1.011557 |
aProcess = self.system.get_process(pid)
address = aProcess.get_break_on_error_ptr()
if not address:
raise NotImplementedError(
"The functionality is not supported in this system.")
aProcess.write_dword(address, errorCode) | def break_on_error(self, pid, errorCode) | Sets or clears the system breakpoint for a given Win32 error code.
Use L{Process.is_system_defined_breakpoint} to tell if a breakpoint
exception was caused by a system breakpoint or by the application
itself (for example because of a failed assertion in the code).
@note: This functiona... | 7.018945 | 5.488801 | 1.278775 |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.