repo
stringlengths
7
55
path
stringlengths
4
127
func_name
stringlengths
1
88
original_string
stringlengths
75
19.8k
language
stringclasses
1 value
code
stringlengths
75
19.8k
code_tokens
listlengths
20
707
docstring
stringlengths
3
17.3k
docstring_tokens
listlengths
3
222
sha
stringlengths
40
40
url
stringlengths
87
242
partition
stringclasses
1 value
idx
int64
0
252k
fabioz/PyDev.Debugger
pydevd_attach_to_process/winappdbg/breakpoint.py
_BreakpointContainer.break_at
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: 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 to be resolved. @type action: function @param action: (Optional) Action callback function. See L{define_code_breakpoint} for more details. @rtype: bool @return: C{True} if the breakpoint was set immediately, or C{False} if it was deferred. """ bp = self.__set_break(pid, address, action, oneshot = False) return bp is not None
python
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: 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 to be resolved. @type action: function @param action: (Optional) Action callback function. See L{define_code_breakpoint} for more details. @rtype: bool @return: C{True} if the breakpoint was set immediately, or C{False} if it was deferred. """ bp = self.__set_break(pid, address, action, oneshot = False) return bp is not None
[ "def", "break_at", "(", "self", ",", "pid", ",", "address", ",", "action", "=", "None", ")", ":", "bp", "=", "self", ".", "__set_break", "(", "pid", ",", "address", ",", "action", ",", "oneshot", "=", "False", ")", "return", "bp", "is", "not", "Non...
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: 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 to be resolved. @type action: function @param action: (Optional) Action callback function. See L{define_code_breakpoint} for more details. @rtype: bool @return: C{True} if the breakpoint was set immediately, or C{False} if it was deferred.
[ "Sets", "a", "code", "breakpoint", "at", "the", "given", "process", "and", "address", "." ]
ed9c4307662a5593b8a7f1f3389ecd0e79b8c503
https://github.com/fabioz/PyDev.Debugger/blob/ed9c4307662a5593b8a7f1f3389ecd0e79b8c503/pydevd_attach_to_process/winappdbg/breakpoint.py#L3908-L3936
train
209,500
fabioz/PyDev.Debugger
pydevd_attach_to_process/winappdbg/breakpoint.py
_BreakpointContainer.hook_function
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 code instruction to break at. It can be an integer value for the actual address or a string with a label to be resolved. @type preCB: function @param preCB: (Optional) Callback triggered on function entry. The signature for the callback should be something like this:: def pre_LoadLibraryEx(event, ra, lpFilename, hFile, dwFlags): # return address ra = params[0] # function arguments start from here... szFilename = event.get_process().peek_string(lpFilename) # (...) Note that all pointer types are treated like void pointers, so your callback won't get the string or structure pointed to by it, but the remote memory address instead. This is so to prevent the ctypes library from being "too helpful" and trying to dereference the pointer. To get the actual data being pointed to, use one of the L{Process.read} methods. @type postCB: function @param postCB: (Optional) Callback triggered on function exit. The signature for the callback should be something like this:: def post_LoadLibraryEx(event, return_value): # (...) @type paramCount: int @param paramCount: (Optional) Number of parameters for the C{preCB} callback, not counting the return address. Parameters are read from the stack and assumed to be DWORDs in 32 bits and QWORDs in 64. This is a faster way to pull stack parameters in 32 bits, but in 64 bits (or with some odd APIs in 32 bits) it won't be useful, since not all arguments to the hooked function will be of the same size. For a more reliable and cross-platform way of hooking use the C{signature} argument instead. @type signature: tuple @param signature: (Optional) Tuple of C{ctypes} data types that constitute the hooked function signature. When the function is called, this will be used to parse the arguments from the stack. Overrides the C{paramCount} argument. @rtype: bool @return: C{True} if the hook was set immediately, or C{False} if it was deferred. """ 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
python
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 code instruction to break at. It can be an integer value for the actual address or a string with a label to be resolved. @type preCB: function @param preCB: (Optional) Callback triggered on function entry. The signature for the callback should be something like this:: def pre_LoadLibraryEx(event, ra, lpFilename, hFile, dwFlags): # return address ra = params[0] # function arguments start from here... szFilename = event.get_process().peek_string(lpFilename) # (...) Note that all pointer types are treated like void pointers, so your callback won't get the string or structure pointed to by it, but the remote memory address instead. This is so to prevent the ctypes library from being "too helpful" and trying to dereference the pointer. To get the actual data being pointed to, use one of the L{Process.read} methods. @type postCB: function @param postCB: (Optional) Callback triggered on function exit. The signature for the callback should be something like this:: def post_LoadLibraryEx(event, return_value): # (...) @type paramCount: int @param paramCount: (Optional) Number of parameters for the C{preCB} callback, not counting the return address. Parameters are read from the stack and assumed to be DWORDs in 32 bits and QWORDs in 64. This is a faster way to pull stack parameters in 32 bits, but in 64 bits (or with some odd APIs in 32 bits) it won't be useful, since not all arguments to the hooked function will be of the same size. For a more reliable and cross-platform way of hooking use the C{signature} argument instead. @type signature: tuple @param signature: (Optional) Tuple of C{ctypes} data types that constitute the hooked function signature. When the function is called, this will be used to parse the arguments from the stack. Overrides the C{paramCount} argument. @rtype: bool @return: C{True} if the hook was set immediately, or C{False} if it was deferred. """ 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", ")", ":", "try", ":", "aProcess", "=", "self", ".", "system", ".", ...
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 code instruction to break at. It can be an integer value for the actual address or a string with a label to be resolved. @type preCB: function @param preCB: (Optional) Callback triggered on function entry. The signature for the callback should be something like this:: def pre_LoadLibraryEx(event, ra, lpFilename, hFile, dwFlags): # return address ra = params[0] # function arguments start from here... szFilename = event.get_process().peek_string(lpFilename) # (...) Note that all pointer types are treated like void pointers, so your callback won't get the string or structure pointed to by it, but the remote memory address instead. This is so to prevent the ctypes library from being "too helpful" and trying to dereference the pointer. To get the actual data being pointed to, use one of the L{Process.read} methods. @type postCB: function @param postCB: (Optional) Callback triggered on function exit. The signature for the callback should be something like this:: def post_LoadLibraryEx(event, return_value): # (...) @type paramCount: int @param paramCount: (Optional) Number of parameters for the C{preCB} callback, not counting the return address. Parameters are read from the stack and assumed to be DWORDs in 32 bits and QWORDs in 64. This is a faster way to pull stack parameters in 32 bits, but in 64 bits (or with some odd APIs in 32 bits) it won't be useful, since not all arguments to the hooked function will be of the same size. For a more reliable and cross-platform way of hooking use the C{signature} argument instead. @type signature: tuple @param signature: (Optional) Tuple of C{ctypes} data types that constitute the hooked function signature. When the function is called, this will be used to parse the arguments from the stack. Overrides the C{paramCount} argument. @rtype: bool @return: C{True} if the hook was set immediately, or C{False} if it was deferred.
[ "Sets", "a", "function", "hook", "at", "the", "given", "address", "." ]
ed9c4307662a5593b8a7f1f3389ecd0e79b8c503
https://github.com/fabioz/PyDev.Debugger/blob/ed9c4307662a5593b8a7f1f3389ecd0e79b8c503/pydevd_attach_to_process/winappdbg/breakpoint.py#L3972-L4052
train
209,501
fabioz/PyDev.Debugger
pydevd_attach_to_process/winappdbg/breakpoint.py
_BreakpointContainer.watch_variable
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 to watch. The only supported sizes are: byte (1), word (2), dword (4) and qword (8). @type action: function @param action: (Optional) Action callback function. See L{define_hardware_breakpoint} for more details. """ bp = self.__set_variable_watch(tid, address, size, action) if not bp.is_enabled(): self.enable_hardware_breakpoint(tid, address)
python
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 to watch. The only supported sizes are: byte (1), word (2), dword (4) and qword (8). @type action: function @param action: (Optional) Action callback function. See L{define_hardware_breakpoint} for more details. """ 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", ")", ":", "bp", "=", "self", ".", "__set_variable_watch", "(", "tid", ",", "address", ",", "size", ",", "action", ")", "if", "not", "bp", ".", ...
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 to watch. The only supported sizes are: byte (1), word (2), dword (4) and qword (8). @type action: function @param action: (Optional) Action callback function. See L{define_hardware_breakpoint} for more details.
[ "Sets", "a", "hardware", "breakpoint", "at", "the", "given", "thread", "address", "and", "size", "." ]
ed9c4307662a5593b8a7f1f3389ecd0e79b8c503
https://github.com/fabioz/PyDev.Debugger/blob/ed9c4307662a5593b8a7f1f3389ecd0e79b8c503/pydevd_attach_to_process/winappdbg/breakpoint.py#L4247-L4270
train
209,502
fabioz/PyDev.Debugger
pydevd_attach_to_process/winappdbg/breakpoint.py
_BreakpointContainer.stalk_variable
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: Size of variable to watch. The only supported sizes are: byte (1), word (2), dword (4) and qword (8). @type action: function @param action: (Optional) Action callback function. See L{define_hardware_breakpoint} for more details. """ bp = self.__set_variable_watch(tid, address, size, action) if not bp.is_one_shot(): self.enable_one_shot_hardware_breakpoint(tid, address)
python
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: Size of variable to watch. The only supported sizes are: byte (1), word (2), dword (4) and qword (8). @type action: function @param action: (Optional) Action callback function. See L{define_hardware_breakpoint} for more details. """ 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", ")", ":", "bp", "=", "self", ".", "__set_variable_watch", "(", "tid", ",", "address", ",", "size", ",", "action", ")", "if", "not", "bp", ".", ...
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: Size of variable to watch. The only supported sizes are: byte (1), word (2), dword (4) and qword (8). @type action: function @param action: (Optional) Action callback function. See L{define_hardware_breakpoint} for more details.
[ "Sets", "a", "one", "-", "shot", "hardware", "breakpoint", "at", "the", "given", "thread", "address", "and", "size", "." ]
ed9c4307662a5593b8a7f1f3389ecd0e79b8c503
https://github.com/fabioz/PyDev.Debugger/blob/ed9c4307662a5593b8a7f1f3389ecd0e79b8c503/pydevd_attach_to_process/winappdbg/breakpoint.py#L4272-L4296
train
209,503
fabioz/PyDev.Debugger
pydevd_attach_to_process/winappdbg/breakpoint.py
_BreakpointContainer.watch_buffer
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 bytes of buffer to watch. @type action: function @param action: (Optional) Action callback function. See L{define_page_breakpoint} for more details. @rtype: L{BufferWatch} @return: Buffer watch identifier. """ self.__set_buffer_watch(pid, address, size, action, False)
python
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 bytes of buffer to watch. @type action: function @param action: (Optional) Action callback function. See L{define_page_breakpoint} for more details. @rtype: L{BufferWatch} @return: Buffer watch identifier. """ self.__set_buffer_watch(pid, address, size, action, False)
[ "def", "watch_buffer", "(", "self", ",", "pid", ",", "address", ",", "size", ",", "action", "=", "None", ")", ":", "self", ".", "__set_buffer_watch", "(", "pid", ",", "address", ",", "size", ",", "action", ",", "False", ")" ]
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 bytes of buffer to watch. @type action: function @param action: (Optional) Action callback function. See L{define_page_breakpoint} for more details. @rtype: L{BufferWatch} @return: Buffer watch identifier.
[ "Sets", "a", "page", "breakpoint", "and", "notifies", "when", "the", "given", "buffer", "is", "accessed", "." ]
ed9c4307662a5593b8a7f1f3389ecd0e79b8c503
https://github.com/fabioz/PyDev.Debugger/blob/ed9c4307662a5593b8a7f1f3389ecd0e79b8c503/pydevd_attach_to_process/winappdbg/breakpoint.py#L4521-L4544
train
209,504
fabioz/PyDev.Debugger
pydevd_attach_to_process/winappdbg/breakpoint.py
_BreakpointContainer.stalk_buffer
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 size: Size in bytes of buffer to watch. @type action: function @param action: (Optional) Action callback function. See L{define_page_breakpoint} for more details. @rtype: L{BufferWatch} @return: Buffer watch identifier. """ self.__set_buffer_watch(pid, address, size, action, True)
python
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 size: Size in bytes of buffer to watch. @type action: function @param action: (Optional) Action callback function. See L{define_page_breakpoint} for more details. @rtype: L{BufferWatch} @return: Buffer watch identifier. """ self.__set_buffer_watch(pid, address, size, action, True)
[ "def", "stalk_buffer", "(", "self", ",", "pid", ",", "address", ",", "size", ",", "action", "=", "None", ")", ":", "self", ".", "__set_buffer_watch", "(", "pid", ",", "address", ",", "size", ",", "action", ",", "True", ")" ]
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 size: Size in bytes of buffer to watch. @type action: function @param action: (Optional) Action callback function. See L{define_page_breakpoint} for more details. @rtype: L{BufferWatch} @return: Buffer watch identifier.
[ "Sets", "a", "one", "-", "shot", "page", "breakpoint", "and", "notifies", "when", "the", "given", "buffer", "is", "accessed", "." ]
ed9c4307662a5593b8a7f1f3389ecd0e79b8c503
https://github.com/fabioz/PyDev.Debugger/blob/ed9c4307662a5593b8a7f1f3389ecd0e79b8c503/pydevd_attach_to_process/winappdbg/breakpoint.py#L4546-L4570
train
209,505
fabioz/PyDev.Debugger
pydevd_attach_to_process/winappdbg/breakpoint.py
_BreakpointContainer.start_tracing
def start_tracing(self, tid): """ Start tracing mode in the given thread. @type tid: int @param tid: Global ID of thread to start tracing. """ if not self.is_tracing(tid): thread = self.system.get_thread(tid) self.__start_tracing(thread)
python
def start_tracing(self, tid): """ Start tracing mode in the given thread. @type tid: int @param tid: Global ID of thread to start tracing. """ if not self.is_tracing(tid): thread = self.system.get_thread(tid) self.__start_tracing(thread)
[ "def", "start_tracing", "(", "self", ",", "tid", ")", ":", "if", "not", "self", ".", "is_tracing", "(", "tid", ")", ":", "thread", "=", "self", ".", "system", ".", "get_thread", "(", "tid", ")", "self", ".", "__start_tracing", "(", "thread", ")" ]
Start tracing mode in the given thread. @type tid: int @param tid: Global ID of thread to start tracing.
[ "Start", "tracing", "mode", "in", "the", "given", "thread", "." ]
ed9c4307662a5593b8a7f1f3389ecd0e79b8c503
https://github.com/fabioz/PyDev.Debugger/blob/ed9c4307662a5593b8a7f1f3389ecd0e79b8c503/pydevd_attach_to_process/winappdbg/breakpoint.py#L4662-L4671
train
209,506
fabioz/PyDev.Debugger
pydevd_attach_to_process/winappdbg/breakpoint.py
_BreakpointContainer.stop_tracing
def stop_tracing(self, tid): """ Stop tracing mode in the given thread. @type tid: int @param tid: Global ID of thread to stop tracing. """ if self.is_tracing(tid): thread = self.system.get_thread(tid) self.__stop_tracing(thread)
python
def stop_tracing(self, tid): """ Stop tracing mode in the given thread. @type tid: int @param tid: Global ID of thread to stop tracing. """ if self.is_tracing(tid): thread = self.system.get_thread(tid) self.__stop_tracing(thread)
[ "def", "stop_tracing", "(", "self", ",", "tid", ")", ":", "if", "self", ".", "is_tracing", "(", "tid", ")", ":", "thread", "=", "self", ".", "system", ".", "get_thread", "(", "tid", ")", "self", ".", "__stop_tracing", "(", "thread", ")" ]
Stop tracing mode in the given thread. @type tid: int @param tid: Global ID of thread to stop tracing.
[ "Stop", "tracing", "mode", "in", "the", "given", "thread", "." ]
ed9c4307662a5593b8a7f1f3389ecd0e79b8c503
https://github.com/fabioz/PyDev.Debugger/blob/ed9c4307662a5593b8a7f1f3389ecd0e79b8c503/pydevd_attach_to_process/winappdbg/breakpoint.py#L4673-L4682
train
209,507
fabioz/PyDev.Debugger
pydevd_attach_to_process/winappdbg/breakpoint.py
_BreakpointContainer.start_tracing_process
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. """ for thread in self.system.get_process(pid).iter_threads(): self.__start_tracing(thread)
python
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. """ for thread in self.system.get_process(pid).iter_threads(): self.__start_tracing(thread)
[ "def", "start_tracing_process", "(", "self", ",", "pid", ")", ":", "for", "thread", "in", "self", ".", "system", ".", "get_process", "(", "pid", ")", ".", "iter_threads", "(", ")", ":", "self", ".", "__start_tracing", "(", "thread", ")" ]
Start tracing mode for all threads in the given process. @type pid: int @param pid: Global ID of process to start tracing.
[ "Start", "tracing", "mode", "for", "all", "threads", "in", "the", "given", "process", "." ]
ed9c4307662a5593b8a7f1f3389ecd0e79b8c503
https://github.com/fabioz/PyDev.Debugger/blob/ed9c4307662a5593b8a7f1f3389ecd0e79b8c503/pydevd_attach_to_process/winappdbg/breakpoint.py#L4684-L4692
train
209,508
fabioz/PyDev.Debugger
pydevd_attach_to_process/winappdbg/breakpoint.py
_BreakpointContainer.stop_tracing_process
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. """ for thread in self.system.get_process(pid).iter_threads(): self.__stop_tracing(thread)
python
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. """ for thread in self.system.get_process(pid).iter_threads(): self.__stop_tracing(thread)
[ "def", "stop_tracing_process", "(", "self", ",", "pid", ")", ":", "for", "thread", "in", "self", ".", "system", ".", "get_process", "(", "pid", ")", ".", "iter_threads", "(", ")", ":", "self", ".", "__stop_tracing", "(", "thread", ")" ]
Stop tracing mode for all threads in the given process. @type pid: int @param pid: Global ID of process to stop tracing.
[ "Stop", "tracing", "mode", "for", "all", "threads", "in", "the", "given", "process", "." ]
ed9c4307662a5593b8a7f1f3389ecd0e79b8c503
https://github.com/fabioz/PyDev.Debugger/blob/ed9c4307662a5593b8a7f1f3389ecd0e79b8c503/pydevd_attach_to_process/winappdbg/breakpoint.py#L4694-L4702
train
209,509
fabioz/PyDev.Debugger
pydevd_attach_to_process/winappdbg/breakpoint.py
_BreakpointContainer.break_on_error
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 functionality is only available since Windows Server 2003. In 2003 it only breaks on error values set externally to the kernel32.dll library, but this was fixed in Windows Vista. @warn: This method will fail if the debug symbols for ntdll (kernel32 in Windows 2003) are not present. For more information see: L{System.fix_symbol_store_path}. @see: U{http://www.nynaeve.net/?p=147} @type pid: int @param pid: Process ID. @type errorCode: int @param errorCode: Win32 error code to stop on. Set to C{0} or C{ERROR_SUCCESS} to clear the breakpoint instead. @raise NotImplementedError: The functionality is not supported in this system. @raise WindowsError: An error occurred while processing this request. """ 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)
python
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 functionality is only available since Windows Server 2003. In 2003 it only breaks on error values set externally to the kernel32.dll library, but this was fixed in Windows Vista. @warn: This method will fail if the debug symbols for ntdll (kernel32 in Windows 2003) are not present. For more information see: L{System.fix_symbol_store_path}. @see: U{http://www.nynaeve.net/?p=147} @type pid: int @param pid: Process ID. @type errorCode: int @param errorCode: Win32 error code to stop on. Set to C{0} or C{ERROR_SUCCESS} to clear the breakpoint instead. @raise NotImplementedError: The functionality is not supported in this system. @raise WindowsError: An error occurred while processing this request. """ 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", ")", ":", "aProcess", "=", "self", ".", "system", ".", "get_process", "(", "pid", ")", "address", "=", "aProcess", ".", "get_break_on_error_ptr", "(", ")", "if", "not", "address", ":", "...
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 functionality is only available since Windows Server 2003. In 2003 it only breaks on error values set externally to the kernel32.dll library, but this was fixed in Windows Vista. @warn: This method will fail if the debug symbols for ntdll (kernel32 in Windows 2003) are not present. For more information see: L{System.fix_symbol_store_path}. @see: U{http://www.nynaeve.net/?p=147} @type pid: int @param pid: Process ID. @type errorCode: int @param errorCode: Win32 error code to stop on. Set to C{0} or C{ERROR_SUCCESS} to clear the breakpoint instead. @raise NotImplementedError: The functionality is not supported in this system. @raise WindowsError: An error occurred while processing this request.
[ "Sets", "or", "clears", "the", "system", "breakpoint", "for", "a", "given", "Win32", "error", "code", "." ]
ed9c4307662a5593b8a7f1f3389ecd0e79b8c503
https://github.com/fabioz/PyDev.Debugger/blob/ed9c4307662a5593b8a7f1f3389ecd0e79b8c503/pydevd_attach_to_process/winappdbg/breakpoint.py#L4722-L4758
train
209,510
fabioz/PyDev.Debugger
pydevd_attach_to_process/winappdbg/breakpoint.py
_BreakpointContainer.resolve_exported_function
def resolve_exported_function(self, pid, modName, procName): """ Resolves the exported DLL function for the given process. @type pid: int @param pid: Process global ID. @type modName: str @param modName: Name of the module that exports the function. @type procName: str @param procName: Name of the exported function to resolve. @rtype: int, None @return: On success, the address of the exported function. On failure, returns C{None}. """ aProcess = self.system.get_process(pid) aModule = aProcess.get_module_by_name(modName) if not aModule: aProcess.scan_modules() aModule = aProcess.get_module_by_name(modName) if aModule: address = aModule.resolve(procName) return address return None
python
def resolve_exported_function(self, pid, modName, procName): """ Resolves the exported DLL function for the given process. @type pid: int @param pid: Process global ID. @type modName: str @param modName: Name of the module that exports the function. @type procName: str @param procName: Name of the exported function to resolve. @rtype: int, None @return: On success, the address of the exported function. On failure, returns C{None}. """ aProcess = self.system.get_process(pid) aModule = aProcess.get_module_by_name(modName) if not aModule: aProcess.scan_modules() aModule = aProcess.get_module_by_name(modName) if aModule: address = aModule.resolve(procName) return address return None
[ "def", "resolve_exported_function", "(", "self", ",", "pid", ",", "modName", ",", "procName", ")", ":", "aProcess", "=", "self", ".", "system", ".", "get_process", "(", "pid", ")", "aModule", "=", "aProcess", ".", "get_module_by_name", "(", "modName", ")", ...
Resolves the exported DLL function for the given process. @type pid: int @param pid: Process global ID. @type modName: str @param modName: Name of the module that exports the function. @type procName: str @param procName: Name of the exported function to resolve. @rtype: int, None @return: On success, the address of the exported function. On failure, returns C{None}.
[ "Resolves", "the", "exported", "DLL", "function", "for", "the", "given", "process", "." ]
ed9c4307662a5593b8a7f1f3389ecd0e79b8c503
https://github.com/fabioz/PyDev.Debugger/blob/ed9c4307662a5593b8a7f1f3389ecd0e79b8c503/pydevd_attach_to_process/winappdbg/breakpoint.py#L4779-L4804
train
209,511
fabioz/PyDev.Debugger
_pydevd_bundle/pydevd_process_net_command.py
_PyDevCommandProcessor.process_net_command
def process_net_command(self, py_db, cmd_id, seq, text): '''Processes a command received from the Java side @param cmd_id: the id of the command @param seq: the sequence of the command @param text: the text received in the command ''' meaning = ID_TO_MEANING[str(cmd_id)] # print('Handling %s (%s)' % (meaning, text)) method_name = meaning.lower() on_command = getattr(self, method_name.lower(), None) if on_command is None: # I have no idea what this is all about cmd = py_db.cmd_factory.make_error_message(seq, "unexpected command " + str(cmd_id)) py_db.writer.add_command(cmd) return py_db._main_lock.acquire() try: cmd = on_command(py_db, cmd_id, seq, text) if cmd is not None: py_db.writer.add_command(cmd) except: if traceback is not None and sys is not None and pydev_log_exception is not None: pydev_log_exception() stream = StringIO() traceback.print_exc(file=stream) cmd = py_db.cmd_factory.make_error_message( seq, "Unexpected exception in process_net_command.\nInitial params: %s. Exception: %s" % ( ((cmd_id, seq, text), stream.getvalue()) ) ) if cmd is not None: py_db.writer.add_command(cmd) finally: py_db._main_lock.release()
python
def process_net_command(self, py_db, cmd_id, seq, text): '''Processes a command received from the Java side @param cmd_id: the id of the command @param seq: the sequence of the command @param text: the text received in the command ''' meaning = ID_TO_MEANING[str(cmd_id)] # print('Handling %s (%s)' % (meaning, text)) method_name = meaning.lower() on_command = getattr(self, method_name.lower(), None) if on_command is None: # I have no idea what this is all about cmd = py_db.cmd_factory.make_error_message(seq, "unexpected command " + str(cmd_id)) py_db.writer.add_command(cmd) return py_db._main_lock.acquire() try: cmd = on_command(py_db, cmd_id, seq, text) if cmd is not None: py_db.writer.add_command(cmd) except: if traceback is not None and sys is not None and pydev_log_exception is not None: pydev_log_exception() stream = StringIO() traceback.print_exc(file=stream) cmd = py_db.cmd_factory.make_error_message( seq, "Unexpected exception in process_net_command.\nInitial params: %s. Exception: %s" % ( ((cmd_id, seq, text), stream.getvalue()) ) ) if cmd is not None: py_db.writer.add_command(cmd) finally: py_db._main_lock.release()
[ "def", "process_net_command", "(", "self", ",", "py_db", ",", "cmd_id", ",", "seq", ",", "text", ")", ":", "meaning", "=", "ID_TO_MEANING", "[", "str", "(", "cmd_id", ")", "]", "# print('Handling %s (%s)' % (meaning, text))", "method_name", "=", "meaning", ".", ...
Processes a command received from the Java side @param cmd_id: the id of the command @param seq: the sequence of the command @param text: the text received in the command
[ "Processes", "a", "command", "received", "from", "the", "Java", "side" ]
ed9c4307662a5593b8a7f1f3389ecd0e79b8c503
https://github.com/fabioz/PyDev.Debugger/blob/ed9c4307662a5593b8a7f1f3389ecd0e79b8c503/_pydevd_bundle/pydevd_process_net_command.py#L25-L66
train
209,512
fabioz/PyDev.Debugger
third_party/pep8/lib2to3/lib2to3/fixer_base.py
BaseFix.compile_pattern
def compile_pattern(self): """Compiles self.PATTERN into self.pattern. Subclass may override if it doesn't want to use self.{pattern,PATTERN} in .match(). """ if self.PATTERN is not None: PC = PatternCompiler() self.pattern, self.pattern_tree = PC.compile_pattern(self.PATTERN, with_tree=True)
python
def compile_pattern(self): """Compiles self.PATTERN into self.pattern. Subclass may override if it doesn't want to use self.{pattern,PATTERN} in .match(). """ if self.PATTERN is not None: PC = PatternCompiler() self.pattern, self.pattern_tree = PC.compile_pattern(self.PATTERN, with_tree=True)
[ "def", "compile_pattern", "(", "self", ")", ":", "if", "self", ".", "PATTERN", "is", "not", "None", ":", "PC", "=", "PatternCompiler", "(", ")", "self", ".", "pattern", ",", "self", ".", "pattern_tree", "=", "PC", ".", "compile_pattern", "(", "self", "...
Compiles self.PATTERN into self.pattern. Subclass may override if it doesn't want to use self.{pattern,PATTERN} in .match().
[ "Compiles", "self", ".", "PATTERN", "into", "self", ".", "pattern", "." ]
ed9c4307662a5593b8a7f1f3389ecd0e79b8c503
https://github.com/fabioz/PyDev.Debugger/blob/ed9c4307662a5593b8a7f1f3389ecd0e79b8c503/third_party/pep8/lib2to3/lib2to3/fixer_base.py#L61-L70
train
209,513
fabioz/PyDev.Debugger
third_party/pep8/lib2to3/lib2to3/fixer_base.py
BaseFix.set_filename
def set_filename(self, filename): """Set the filename, and a logger derived from it. The main refactoring tool should call this. """ self.filename = filename self.logger = logging.getLogger(filename)
python
def set_filename(self, filename): """Set the filename, and a logger derived from it. The main refactoring tool should call this. """ self.filename = filename self.logger = logging.getLogger(filename)
[ "def", "set_filename", "(", "self", ",", "filename", ")", ":", "self", ".", "filename", "=", "filename", "self", ".", "logger", "=", "logging", ".", "getLogger", "(", "filename", ")" ]
Set the filename, and a logger derived from it. The main refactoring tool should call this.
[ "Set", "the", "filename", "and", "a", "logger", "derived", "from", "it", "." ]
ed9c4307662a5593b8a7f1f3389ecd0e79b8c503
https://github.com/fabioz/PyDev.Debugger/blob/ed9c4307662a5593b8a7f1f3389ecd0e79b8c503/third_party/pep8/lib2to3/lib2to3/fixer_base.py#L72-L78
train
209,514
fabioz/PyDev.Debugger
third_party/pep8/lib2to3/lib2to3/fixer_base.py
BaseFix.match
def match(self, node): """Returns match for a given parse tree node. Should return a true or false object (not necessarily a bool). It may return a non-empty dict of matching sub-nodes as returned by a matching pattern. Subclass may override. """ results = {"node": node} return self.pattern.match(node, results) and results
python
def match(self, node): """Returns match for a given parse tree node. Should return a true or false object (not necessarily a bool). It may return a non-empty dict of matching sub-nodes as returned by a matching pattern. Subclass may override. """ results = {"node": node} return self.pattern.match(node, results) and results
[ "def", "match", "(", "self", ",", "node", ")", ":", "results", "=", "{", "\"node\"", ":", "node", "}", "return", "self", ".", "pattern", ".", "match", "(", "node", ",", "results", ")", "and", "results" ]
Returns match for a given parse tree node. Should return a true or false object (not necessarily a bool). It may return a non-empty dict of matching sub-nodes as returned by a matching pattern. Subclass may override.
[ "Returns", "match", "for", "a", "given", "parse", "tree", "node", "." ]
ed9c4307662a5593b8a7f1f3389ecd0e79b8c503
https://github.com/fabioz/PyDev.Debugger/blob/ed9c4307662a5593b8a7f1f3389ecd0e79b8c503/third_party/pep8/lib2to3/lib2to3/fixer_base.py#L80-L90
train
209,515
fabioz/PyDev.Debugger
third_party/pep8/lib2to3/lib2to3/fixer_base.py
BaseFix.new_name
def new_name(self, template=u"xxx_todo_changeme"): """Return a string suitable for use as an identifier The new name is guaranteed not to conflict with other identifiers. """ name = template while name in self.used_names: name = template + unicode(self.numbers.next()) self.used_names.add(name) return name
python
def new_name(self, template=u"xxx_todo_changeme"): """Return a string suitable for use as an identifier The new name is guaranteed not to conflict with other identifiers. """ name = template while name in self.used_names: name = template + unicode(self.numbers.next()) self.used_names.add(name) return name
[ "def", "new_name", "(", "self", ",", "template", "=", "u\"xxx_todo_changeme\"", ")", ":", "name", "=", "template", "while", "name", "in", "self", ".", "used_names", ":", "name", "=", "template", "+", "unicode", "(", "self", ".", "numbers", ".", "next", "...
Return a string suitable for use as an identifier The new name is guaranteed not to conflict with other identifiers.
[ "Return", "a", "string", "suitable", "for", "use", "as", "an", "identifier" ]
ed9c4307662a5593b8a7f1f3389ecd0e79b8c503
https://github.com/fabioz/PyDev.Debugger/blob/ed9c4307662a5593b8a7f1f3389ecd0e79b8c503/third_party/pep8/lib2to3/lib2to3/fixer_base.py#L108-L117
train
209,516
fabioz/PyDev.Debugger
third_party/pep8/lib2to3/lib2to3/fixer_base.py
BaseFix.cannot_convert
def cannot_convert(self, node, reason=None): """Warn the user that a given chunk of code is not valid Python 3, but that it cannot be converted automatically. First argument is the top-level node for the code in question. Optional second argument is why it can't be converted. """ lineno = node.get_lineno() for_output = node.clone() for_output.prefix = u"" msg = "Line %d: could not convert: %s" self.log_message(msg % (lineno, for_output)) if reason: self.log_message(reason)
python
def cannot_convert(self, node, reason=None): """Warn the user that a given chunk of code is not valid Python 3, but that it cannot be converted automatically. First argument is the top-level node for the code in question. Optional second argument is why it can't be converted. """ lineno = node.get_lineno() for_output = node.clone() for_output.prefix = u"" msg = "Line %d: could not convert: %s" self.log_message(msg % (lineno, for_output)) if reason: self.log_message(reason)
[ "def", "cannot_convert", "(", "self", ",", "node", ",", "reason", "=", "None", ")", ":", "lineno", "=", "node", ".", "get_lineno", "(", ")", "for_output", "=", "node", ".", "clone", "(", ")", "for_output", ".", "prefix", "=", "u\"\"", "msg", "=", "\"...
Warn the user that a given chunk of code is not valid Python 3, but that it cannot be converted automatically. First argument is the top-level node for the code in question. Optional second argument is why it can't be converted.
[ "Warn", "the", "user", "that", "a", "given", "chunk", "of", "code", "is", "not", "valid", "Python", "3", "but", "that", "it", "cannot", "be", "converted", "automatically", "." ]
ed9c4307662a5593b8a7f1f3389ecd0e79b8c503
https://github.com/fabioz/PyDev.Debugger/blob/ed9c4307662a5593b8a7f1f3389ecd0e79b8c503/third_party/pep8/lib2to3/lib2to3/fixer_base.py#L125-L138
train
209,517
fabioz/PyDev.Debugger
third_party/pep8/lib2to3/lib2to3/fixer_base.py
BaseFix.warning
def warning(self, node, reason): """Used for warning the user about possible uncertainty in the translation. First argument is the top-level node for the code in question. Optional second argument is why it can't be converted. """ lineno = node.get_lineno() self.log_message("Line %d: %s" % (lineno, reason))
python
def warning(self, node, reason): """Used for warning the user about possible uncertainty in the translation. First argument is the top-level node for the code in question. Optional second argument is why it can't be converted. """ lineno = node.get_lineno() self.log_message("Line %d: %s" % (lineno, reason))
[ "def", "warning", "(", "self", ",", "node", ",", "reason", ")", ":", "lineno", "=", "node", ".", "get_lineno", "(", ")", "self", ".", "log_message", "(", "\"Line %d: %s\"", "%", "(", "lineno", ",", "reason", ")", ")" ]
Used for warning the user about possible uncertainty in the translation. First argument is the top-level node for the code in question. Optional second argument is why it can't be converted.
[ "Used", "for", "warning", "the", "user", "about", "possible", "uncertainty", "in", "the", "translation", "." ]
ed9c4307662a5593b8a7f1f3389ecd0e79b8c503
https://github.com/fabioz/PyDev.Debugger/blob/ed9c4307662a5593b8a7f1f3389ecd0e79b8c503/third_party/pep8/lib2to3/lib2to3/fixer_base.py#L140-L148
train
209,518
fabioz/PyDev.Debugger
third_party/pep8/lib2to3/lib2to3/fixer_base.py
BaseFix.start_tree
def start_tree(self, tree, filename): """Some fixers need to maintain tree-wide state. This method is called once, at the start of tree fix-up. tree - the root node of the tree to be processed. filename - the name of the file the tree came from. """ self.used_names = tree.used_names self.set_filename(filename) self.numbers = itertools.count(1) self.first_log = True
python
def start_tree(self, tree, filename): """Some fixers need to maintain tree-wide state. This method is called once, at the start of tree fix-up. tree - the root node of the tree to be processed. filename - the name of the file the tree came from. """ self.used_names = tree.used_names self.set_filename(filename) self.numbers = itertools.count(1) self.first_log = True
[ "def", "start_tree", "(", "self", ",", "tree", ",", "filename", ")", ":", "self", ".", "used_names", "=", "tree", ".", "used_names", "self", ".", "set_filename", "(", "filename", ")", "self", ".", "numbers", "=", "itertools", ".", "count", "(", "1", ")...
Some fixers need to maintain tree-wide state. This method is called once, at the start of tree fix-up. tree - the root node of the tree to be processed. filename - the name of the file the tree came from.
[ "Some", "fixers", "need", "to", "maintain", "tree", "-", "wide", "state", ".", "This", "method", "is", "called", "once", "at", "the", "start", "of", "tree", "fix", "-", "up", "." ]
ed9c4307662a5593b8a7f1f3389ecd0e79b8c503
https://github.com/fabioz/PyDev.Debugger/blob/ed9c4307662a5593b8a7f1f3389ecd0e79b8c503/third_party/pep8/lib2to3/lib2to3/fixer_base.py#L150-L160
train
209,519
fabioz/PyDev.Debugger
pydevd_attach_to_process/winappdbg/interactive.py
ConsoleDebugger.do_quit
def do_quit(self, arg): """ quit - close the debugging session q - close the debugging session """ if self.cmdprefix: raise CmdError("prefix not allowed") if arg: raise CmdError("too many arguments") if self.confirm_quit: count = self.debug.get_debugee_count() if count > 0: if count == 1: msg = "There's a program still running." else: msg = "There are %s programs still running." % count if not self.ask_user(msg): return False self.debuggerExit = True return True
python
def do_quit(self, arg): """ quit - close the debugging session q - close the debugging session """ if self.cmdprefix: raise CmdError("prefix not allowed") if arg: raise CmdError("too many arguments") if self.confirm_quit: count = self.debug.get_debugee_count() if count > 0: if count == 1: msg = "There's a program still running." else: msg = "There are %s programs still running." % count if not self.ask_user(msg): return False self.debuggerExit = True return True
[ "def", "do_quit", "(", "self", ",", "arg", ")", ":", "if", "self", ".", "cmdprefix", ":", "raise", "CmdError", "(", "\"prefix not allowed\"", ")", "if", "arg", ":", "raise", "CmdError", "(", "\"too many arguments\"", ")", "if", "self", ".", "confirm_quit", ...
quit - close the debugging session q - close the debugging session
[ "quit", "-", "close", "the", "debugging", "session", "q", "-", "close", "the", "debugging", "session" ]
ed9c4307662a5593b8a7f1f3389ecd0e79b8c503
https://github.com/fabioz/PyDev.Debugger/blob/ed9c4307662a5593b8a7f1f3389ecd0e79b8c503/pydevd_attach_to_process/winappdbg/interactive.py#L1206-L1225
train
209,520
fabioz/PyDev.Debugger
pydevd_attach_to_process/winappdbg/interactive.py
ConsoleDebugger.do_continue
def do_continue(self, arg): """ continue - continue execution g - continue execution go - continue execution """ if self.cmdprefix: raise CmdError("prefix not allowed") if arg: raise CmdError("too many arguments") if self.debug.get_debugee_count() > 0: return True
python
def do_continue(self, arg): """ continue - continue execution g - continue execution go - continue execution """ if self.cmdprefix: raise CmdError("prefix not allowed") if arg: raise CmdError("too many arguments") if self.debug.get_debugee_count() > 0: return True
[ "def", "do_continue", "(", "self", ",", "arg", ")", ":", "if", "self", ".", "cmdprefix", ":", "raise", "CmdError", "(", "\"prefix not allowed\"", ")", "if", "arg", ":", "raise", "CmdError", "(", "\"too many arguments\"", ")", "if", "self", ".", "debug", "....
continue - continue execution g - continue execution go - continue execution
[ "continue", "-", "continue", "execution", "g", "-", "continue", "execution", "go", "-", "continue", "execution" ]
ed9c4307662a5593b8a7f1f3389ecd0e79b8c503
https://github.com/fabioz/PyDev.Debugger/blob/ed9c4307662a5593b8a7f1f3389ecd0e79b8c503/pydevd_attach_to_process/winappdbg/interactive.py#L1301-L1312
train
209,521
fabioz/PyDev.Debugger
pydevd_attach_to_process/winappdbg/interactive.py
ConsoleDebugger.do_gh
def do_gh(self, arg): """ gh - go with exception handled """ if self.cmdprefix: raise CmdError("prefix not allowed") if arg: raise CmdError("too many arguments") if self.lastEvent: self.lastEvent.continueStatus = win32.DBG_EXCEPTION_HANDLED return self.do_go(arg)
python
def do_gh(self, arg): """ gh - go with exception handled """ if self.cmdprefix: raise CmdError("prefix not allowed") if arg: raise CmdError("too many arguments") if self.lastEvent: self.lastEvent.continueStatus = win32.DBG_EXCEPTION_HANDLED return self.do_go(arg)
[ "def", "do_gh", "(", "self", ",", "arg", ")", ":", "if", "self", ".", "cmdprefix", ":", "raise", "CmdError", "(", "\"prefix not allowed\"", ")", "if", "arg", ":", "raise", "CmdError", "(", "\"too many arguments\"", ")", "if", "self", ".", "lastEvent", ":",...
gh - go with exception handled
[ "gh", "-", "go", "with", "exception", "handled" ]
ed9c4307662a5593b8a7f1f3389ecd0e79b8c503
https://github.com/fabioz/PyDev.Debugger/blob/ed9c4307662a5593b8a7f1f3389ecd0e79b8c503/pydevd_attach_to_process/winappdbg/interactive.py#L1317-L1327
train
209,522
fabioz/PyDev.Debugger
pydevd_attach_to_process/winappdbg/interactive.py
ConsoleDebugger.do_gn
def do_gn(self, arg): """ gn - go with exception not handled """ if self.cmdprefix: raise CmdError("prefix not allowed") if arg: raise CmdError("too many arguments") if self.lastEvent: self.lastEvent.continueStatus = win32.DBG_EXCEPTION_NOT_HANDLED return self.do_go(arg)
python
def do_gn(self, arg): """ gn - go with exception not handled """ if self.cmdprefix: raise CmdError("prefix not allowed") if arg: raise CmdError("too many arguments") if self.lastEvent: self.lastEvent.continueStatus = win32.DBG_EXCEPTION_NOT_HANDLED return self.do_go(arg)
[ "def", "do_gn", "(", "self", ",", "arg", ")", ":", "if", "self", ".", "cmdprefix", ":", "raise", "CmdError", "(", "\"prefix not allowed\"", ")", "if", "arg", ":", "raise", "CmdError", "(", "\"too many arguments\"", ")", "if", "self", ".", "lastEvent", ":",...
gn - go with exception not handled
[ "gn", "-", "go", "with", "exception", "not", "handled" ]
ed9c4307662a5593b8a7f1f3389ecd0e79b8c503
https://github.com/fabioz/PyDev.Debugger/blob/ed9c4307662a5593b8a7f1f3389ecd0e79b8c503/pydevd_attach_to_process/winappdbg/interactive.py#L1329-L1339
train
209,523
fabioz/PyDev.Debugger
pydevd_attach_to_process/winappdbg/interactive.py
ConsoleDebugger.do_processlist
def do_processlist(self, arg): """ pl - show the processes being debugged processlist - show the processes being debugged """ if self.cmdprefix: raise CmdError("prefix not allowed") if arg: raise CmdError("too many arguments") system = self.debug.system pid_list = self.debug.get_debugee_pids() if pid_list: print("Process ID File name") for pid in pid_list: if pid == 0: filename = "System Idle Process" elif pid == 4: filename = "System" else: filename = system.get_process(pid).get_filename() filename = PathOperations.pathname_to_filename(filename) print("%-12d %s" % (pid, filename))
python
def do_processlist(self, arg): """ pl - show the processes being debugged processlist - show the processes being debugged """ if self.cmdprefix: raise CmdError("prefix not allowed") if arg: raise CmdError("too many arguments") system = self.debug.system pid_list = self.debug.get_debugee_pids() if pid_list: print("Process ID File name") for pid in pid_list: if pid == 0: filename = "System Idle Process" elif pid == 4: filename = "System" else: filename = system.get_process(pid).get_filename() filename = PathOperations.pathname_to_filename(filename) print("%-12d %s" % (pid, filename))
[ "def", "do_processlist", "(", "self", ",", "arg", ")", ":", "if", "self", ".", "cmdprefix", ":", "raise", "CmdError", "(", "\"prefix not allowed\"", ")", "if", "arg", ":", "raise", "CmdError", "(", "\"too many arguments\"", ")", "system", "=", "self", ".", ...
pl - show the processes being debugged processlist - show the processes being debugged
[ "pl", "-", "show", "the", "processes", "being", "debugged", "processlist", "-", "show", "the", "processes", "being", "debugged" ]
ed9c4307662a5593b8a7f1f3389ecd0e79b8c503
https://github.com/fabioz/PyDev.Debugger/blob/ed9c4307662a5593b8a7f1f3389ecd0e79b8c503/pydevd_attach_to_process/winappdbg/interactive.py#L1354-L1375
train
209,524
fabioz/PyDev.Debugger
pydevd_attach_to_process/winappdbg/interactive.py
ConsoleDebugger.do_threadlist
def do_threadlist(self, arg): """ tl - show the threads being debugged threadlist - show the threads being debugged """ if arg: raise CmdError("too many arguments") if self.cmdprefix: process = self.get_process_from_prefix() for thread in process.iter_threads(): tid = thread.get_tid() name = thread.get_name() print("%-12d %s" % (tid, name)) else: system = self.debug.system pid_list = self.debug.get_debugee_pids() if pid_list: print("Thread ID Thread name") for pid in pid_list: process = system.get_process(pid) for thread in process.iter_threads(): tid = thread.get_tid() name = thread.get_name() print("%-12d %s" % (tid, name))
python
def do_threadlist(self, arg): """ tl - show the threads being debugged threadlist - show the threads being debugged """ if arg: raise CmdError("too many arguments") if self.cmdprefix: process = self.get_process_from_prefix() for thread in process.iter_threads(): tid = thread.get_tid() name = thread.get_name() print("%-12d %s" % (tid, name)) else: system = self.debug.system pid_list = self.debug.get_debugee_pids() if pid_list: print("Thread ID Thread name") for pid in pid_list: process = system.get_process(pid) for thread in process.iter_threads(): tid = thread.get_tid() name = thread.get_name() print("%-12d %s" % (tid, name))
[ "def", "do_threadlist", "(", "self", ",", "arg", ")", ":", "if", "arg", ":", "raise", "CmdError", "(", "\"too many arguments\"", ")", "if", "self", ".", "cmdprefix", ":", "process", "=", "self", ".", "get_process_from_prefix", "(", ")", "for", "thread", "i...
tl - show the threads being debugged threadlist - show the threads being debugged
[ "tl", "-", "show", "the", "threads", "being", "debugged", "threadlist", "-", "show", "the", "threads", "being", "debugged" ]
ed9c4307662a5593b8a7f1f3389ecd0e79b8c503
https://github.com/fabioz/PyDev.Debugger/blob/ed9c4307662a5593b8a7f1f3389ecd0e79b8c503/pydevd_attach_to_process/winappdbg/interactive.py#L1379-L1402
train
209,525
fabioz/PyDev.Debugger
pydevd_attach_to_process/winappdbg/interactive.py
ConsoleDebugger.do_step
def do_step(self, arg): """ p - step on the current assembly instruction next - step on the current assembly instruction step - step on the current assembly instruction """ if self.cmdprefix: raise CmdError("prefix not allowed") if self.lastEvent is None: raise CmdError("no current process set") if arg: # XXX this check is to be removed raise CmdError("too many arguments") pid = self.lastEvent.get_pid() thread = self.lastEvent.get_thread() pc = thread.get_pc() code = thread.disassemble(pc, 16)[0] size = code[1] opcode = code[2].lower() if ' ' in opcode: opcode = opcode[ : opcode.find(' ') ] if opcode in self.jump_instructions or opcode in ('int', 'ret', 'retn'): return self.do_trace(arg) address = pc + size ## print(hex(pc), hex(address), size # XXX DEBUG self.debug.stalk_at(pid, address) return True
python
def do_step(self, arg): """ p - step on the current assembly instruction next - step on the current assembly instruction step - step on the current assembly instruction """ if self.cmdprefix: raise CmdError("prefix not allowed") if self.lastEvent is None: raise CmdError("no current process set") if arg: # XXX this check is to be removed raise CmdError("too many arguments") pid = self.lastEvent.get_pid() thread = self.lastEvent.get_thread() pc = thread.get_pc() code = thread.disassemble(pc, 16)[0] size = code[1] opcode = code[2].lower() if ' ' in opcode: opcode = opcode[ : opcode.find(' ') ] if opcode in self.jump_instructions or opcode in ('int', 'ret', 'retn'): return self.do_trace(arg) address = pc + size ## print(hex(pc), hex(address), size # XXX DEBUG self.debug.stalk_at(pid, address) return True
[ "def", "do_step", "(", "self", ",", "arg", ")", ":", "if", "self", ".", "cmdprefix", ":", "raise", "CmdError", "(", "\"prefix not allowed\"", ")", "if", "self", ".", "lastEvent", "is", "None", ":", "raise", "CmdError", "(", "\"no current process set\"", ")",...
p - step on the current assembly instruction next - step on the current assembly instruction step - step on the current assembly instruction
[ "p", "-", "step", "on", "the", "current", "assembly", "instruction", "next", "-", "step", "on", "the", "current", "assembly", "instruction", "step", "-", "step", "on", "the", "current", "assembly", "instruction" ]
ed9c4307662a5593b8a7f1f3389ecd0e79b8c503
https://github.com/fabioz/PyDev.Debugger/blob/ed9c4307662a5593b8a7f1f3389ecd0e79b8c503/pydevd_attach_to_process/winappdbg/interactive.py#L1531-L1556
train
209,526
fabioz/PyDev.Debugger
pydevd_attach_to_process/winappdbg/interactive.py
ConsoleDebugger.do_trace
def do_trace(self, arg): """ t - trace at the current assembly instruction trace - trace at the current assembly instruction """ if arg: # XXX this check is to be removed raise CmdError("too many arguments") if self.lastEvent is None: raise CmdError("no current thread set") self.lastEvent.get_thread().set_tf() return True
python
def do_trace(self, arg): """ t - trace at the current assembly instruction trace - trace at the current assembly instruction """ if arg: # XXX this check is to be removed raise CmdError("too many arguments") if self.lastEvent is None: raise CmdError("no current thread set") self.lastEvent.get_thread().set_tf() return True
[ "def", "do_trace", "(", "self", ",", "arg", ")", ":", "if", "arg", ":", "# XXX this check is to be removed", "raise", "CmdError", "(", "\"too many arguments\"", ")", "if", "self", ".", "lastEvent", "is", "None", ":", "raise", "CmdError", "(", "\"no current threa...
t - trace at the current assembly instruction trace - trace at the current assembly instruction
[ "t", "-", "trace", "at", "the", "current", "assembly", "instruction", "trace", "-", "trace", "at", "the", "current", "assembly", "instruction" ]
ed9c4307662a5593b8a7f1f3389ecd0e79b8c503
https://github.com/fabioz/PyDev.Debugger/blob/ed9c4307662a5593b8a7f1f3389ecd0e79b8c503/pydevd_attach_to_process/winappdbg/interactive.py#L1561-L1571
train
209,527
fabioz/PyDev.Debugger
pydevd_attach_to_process/winappdbg/textio.py
HexInput.integer
def integer(token): """ Convert numeric strings into integers. @type token: str @param token: String to parse. @rtype: int @return: Parsed integer value. """ token = token.strip() neg = False if token.startswith(compat.b('-')): token = token[1:] neg = True if token.startswith(compat.b('0x')): result = int(token, 16) # hexadecimal elif token.startswith(compat.b('0b')): result = int(token[2:], 2) # binary elif token.startswith(compat.b('0o')): result = int(token, 8) # octal else: try: result = int(token) # decimal except ValueError: result = int(token, 16) # hexadecimal (no "0x" prefix) if neg: result = -result return result
python
def integer(token): """ Convert numeric strings into integers. @type token: str @param token: String to parse. @rtype: int @return: Parsed integer value. """ token = token.strip() neg = False if token.startswith(compat.b('-')): token = token[1:] neg = True if token.startswith(compat.b('0x')): result = int(token, 16) # hexadecimal elif token.startswith(compat.b('0b')): result = int(token[2:], 2) # binary elif token.startswith(compat.b('0o')): result = int(token, 8) # octal else: try: result = int(token) # decimal except ValueError: result = int(token, 16) # hexadecimal (no "0x" prefix) if neg: result = -result return result
[ "def", "integer", "(", "token", ")", ":", "token", "=", "token", ".", "strip", "(", ")", "neg", "=", "False", "if", "token", ".", "startswith", "(", "compat", ".", "b", "(", "'-'", ")", ")", ":", "token", "=", "token", "[", "1", ":", "]", "neg"...
Convert numeric strings into integers. @type token: str @param token: String to parse. @rtype: int @return: Parsed integer value.
[ "Convert", "numeric", "strings", "into", "integers", "." ]
ed9c4307662a5593b8a7f1f3389ecd0e79b8c503
https://github.com/fabioz/PyDev.Debugger/blob/ed9c4307662a5593b8a7f1f3389ecd0e79b8c503/pydevd_attach_to_process/winappdbg/textio.py#L77-L105
train
209,528
fabioz/PyDev.Debugger
pydevd_attach_to_process/winappdbg/textio.py
HexInput.hexadecimal
def hexadecimal(token): """ Convert a strip of hexadecimal numbers into binary data. @type token: str @param token: String to parse. @rtype: str @return: Parsed string value. """ token = ''.join([ c for c in token if c.isalnum() ]) if len(token) % 2 != 0: raise ValueError("Missing characters in hex data") data = '' for i in compat.xrange(0, len(token), 2): x = token[i:i+2] d = int(x, 16) s = struct.pack('<B', d) data += s return data
python
def hexadecimal(token): """ Convert a strip of hexadecimal numbers into binary data. @type token: str @param token: String to parse. @rtype: str @return: Parsed string value. """ token = ''.join([ c for c in token if c.isalnum() ]) if len(token) % 2 != 0: raise ValueError("Missing characters in hex data") data = '' for i in compat.xrange(0, len(token), 2): x = token[i:i+2] d = int(x, 16) s = struct.pack('<B', d) data += s return data
[ "def", "hexadecimal", "(", "token", ")", ":", "token", "=", "''", ".", "join", "(", "[", "c", "for", "c", "in", "token", "if", "c", ".", "isalnum", "(", ")", "]", ")", "if", "len", "(", "token", ")", "%", "2", "!=", "0", ":", "raise", "ValueE...
Convert a strip of hexadecimal numbers into binary data. @type token: str @param token: String to parse. @rtype: str @return: Parsed string value.
[ "Convert", "a", "strip", "of", "hexadecimal", "numbers", "into", "binary", "data", "." ]
ed9c4307662a5593b8a7f1f3389ecd0e79b8c503
https://github.com/fabioz/PyDev.Debugger/blob/ed9c4307662a5593b8a7f1f3389ecd0e79b8c503/pydevd_attach_to_process/winappdbg/textio.py#L121-L140
train
209,529
fabioz/PyDev.Debugger
pydevd_attach_to_process/winappdbg/textio.py
HexInput.pattern
def pattern(token): """ Convert an hexadecimal search pattern into a POSIX regular expression. For example, the following pattern:: "B8 0? ?0 ?? ??" Would match the following data:: "B8 0D F0 AD BA" # mov eax, 0xBAADF00D @type token: str @param token: String to parse. @rtype: str @return: Parsed string value. """ token = ''.join([ c for c in token if c == '?' or c.isalnum() ]) if len(token) % 2 != 0: raise ValueError("Missing characters in hex data") regexp = '' for i in compat.xrange(0, len(token), 2): x = token[i:i+2] if x == '??': regexp += '.' elif x[0] == '?': f = '\\x%%.1x%s' % x[1] x = ''.join([ f % c for c in compat.xrange(0, 0x10) ]) regexp = '%s[%s]' % (regexp, x) elif x[1] == '?': f = '\\x%s%%.1x' % x[0] x = ''.join([ f % c for c in compat.xrange(0, 0x10) ]) regexp = '%s[%s]' % (regexp, x) else: regexp = '%s\\x%s' % (regexp, x) return regexp
python
def pattern(token): """ Convert an hexadecimal search pattern into a POSIX regular expression. For example, the following pattern:: "B8 0? ?0 ?? ??" Would match the following data:: "B8 0D F0 AD BA" # mov eax, 0xBAADF00D @type token: str @param token: String to parse. @rtype: str @return: Parsed string value. """ token = ''.join([ c for c in token if c == '?' or c.isalnum() ]) if len(token) % 2 != 0: raise ValueError("Missing characters in hex data") regexp = '' for i in compat.xrange(0, len(token), 2): x = token[i:i+2] if x == '??': regexp += '.' elif x[0] == '?': f = '\\x%%.1x%s' % x[1] x = ''.join([ f % c for c in compat.xrange(0, 0x10) ]) regexp = '%s[%s]' % (regexp, x) elif x[1] == '?': f = '\\x%s%%.1x' % x[0] x = ''.join([ f % c for c in compat.xrange(0, 0x10) ]) regexp = '%s[%s]' % (regexp, x) else: regexp = '%s\\x%s' % (regexp, x) return regexp
[ "def", "pattern", "(", "token", ")", ":", "token", "=", "''", ".", "join", "(", "[", "c", "for", "c", "in", "token", "if", "c", "==", "'?'", "or", "c", ".", "isalnum", "(", ")", "]", ")", "if", "len", "(", "token", ")", "%", "2", "!=", "0",...
Convert an hexadecimal search pattern into a POSIX regular expression. For example, the following pattern:: "B8 0? ?0 ?? ??" Would match the following data:: "B8 0D F0 AD BA" # mov eax, 0xBAADF00D @type token: str @param token: String to parse. @rtype: str @return: Parsed string value.
[ "Convert", "an", "hexadecimal", "search", "pattern", "into", "a", "POSIX", "regular", "expression", "." ]
ed9c4307662a5593b8a7f1f3389ecd0e79b8c503
https://github.com/fabioz/PyDev.Debugger/blob/ed9c4307662a5593b8a7f1f3389ecd0e79b8c503/pydevd_attach_to_process/winappdbg/textio.py#L143-L179
train
209,530
fabioz/PyDev.Debugger
pydevd_attach_to_process/winappdbg/textio.py
HexInput.integer_list_file
def integer_list_file(cls, filename): """ Read a list of integers from a file. The file format is: - # anywhere in the line begins a comment - leading and trailing spaces are ignored - empty lines are ignored - integers can be specified as: - decimal numbers ("100" is 100) - hexadecimal numbers ("0x100" is 256) - binary numbers ("0b100" is 4) - octal numbers ("0100" is 64) @type filename: str @param filename: Name of the file to read. @rtype: list( int ) @return: List of integers read from the file. """ count = 0 result = list() fd = open(filename, 'r') for line in fd: count = count + 1 if '#' in line: line = line[ : line.find('#') ] line = line.strip() if line: try: value = cls.integer(line) except ValueError: e = sys.exc_info()[1] msg = "Error in line %d of %s: %s" msg = msg % (count, filename, str(e)) raise ValueError(msg) result.append(value) return result
python
def integer_list_file(cls, filename): """ Read a list of integers from a file. The file format is: - # anywhere in the line begins a comment - leading and trailing spaces are ignored - empty lines are ignored - integers can be specified as: - decimal numbers ("100" is 100) - hexadecimal numbers ("0x100" is 256) - binary numbers ("0b100" is 4) - octal numbers ("0100" is 64) @type filename: str @param filename: Name of the file to read. @rtype: list( int ) @return: List of integers read from the file. """ count = 0 result = list() fd = open(filename, 'r') for line in fd: count = count + 1 if '#' in line: line = line[ : line.find('#') ] line = line.strip() if line: try: value = cls.integer(line) except ValueError: e = sys.exc_info()[1] msg = "Error in line %d of %s: %s" msg = msg % (count, filename, str(e)) raise ValueError(msg) result.append(value) return result
[ "def", "integer_list_file", "(", "cls", ",", "filename", ")", ":", "count", "=", "0", "result", "=", "list", "(", ")", "fd", "=", "open", "(", "filename", ",", "'r'", ")", "for", "line", "in", "fd", ":", "count", "=", "count", "+", "1", "if", "'#...
Read a list of integers from a file. The file format is: - # anywhere in the line begins a comment - leading and trailing spaces are ignored - empty lines are ignored - integers can be specified as: - decimal numbers ("100" is 100) - hexadecimal numbers ("0x100" is 256) - binary numbers ("0b100" is 4) - octal numbers ("0100" is 64) @type filename: str @param filename: Name of the file to read. @rtype: list( int ) @return: List of integers read from the file.
[ "Read", "a", "list", "of", "integers", "from", "a", "file", "." ]
ed9c4307662a5593b8a7f1f3389ecd0e79b8c503
https://github.com/fabioz/PyDev.Debugger/blob/ed9c4307662a5593b8a7f1f3389ecd0e79b8c503/pydevd_attach_to_process/winappdbg/textio.py#L197-L235
train
209,531
fabioz/PyDev.Debugger
pydevd_attach_to_process/winappdbg/textio.py
HexInput.string_list_file
def string_list_file(cls, filename): """ Read a list of string values from a file. The file format is: - # anywhere in the line begins a comment - leading and trailing spaces are ignored - empty lines are ignored - strings cannot span over a single line @type filename: str @param filename: Name of the file to read. @rtype: list @return: List of integers and strings read from the file. """ count = 0 result = list() fd = open(filename, 'r') for line in fd: count = count + 1 if '#' in line: line = line[ : line.find('#') ] line = line.strip() if line: result.append(line) return result
python
def string_list_file(cls, filename): """ Read a list of string values from a file. The file format is: - # anywhere in the line begins a comment - leading and trailing spaces are ignored - empty lines are ignored - strings cannot span over a single line @type filename: str @param filename: Name of the file to read. @rtype: list @return: List of integers and strings read from the file. """ count = 0 result = list() fd = open(filename, 'r') for line in fd: count = count + 1 if '#' in line: line = line[ : line.find('#') ] line = line.strip() if line: result.append(line) return result
[ "def", "string_list_file", "(", "cls", ",", "filename", ")", ":", "count", "=", "0", "result", "=", "list", "(", ")", "fd", "=", "open", "(", "filename", ",", "'r'", ")", "for", "line", "in", "fd", ":", "count", "=", "count", "+", "1", "if", "'#'...
Read a list of string values from a file. The file format is: - # anywhere in the line begins a comment - leading and trailing spaces are ignored - empty lines are ignored - strings cannot span over a single line @type filename: str @param filename: Name of the file to read. @rtype: list @return: List of integers and strings read from the file.
[ "Read", "a", "list", "of", "string", "values", "from", "a", "file", "." ]
ed9c4307662a5593b8a7f1f3389ecd0e79b8c503
https://github.com/fabioz/PyDev.Debugger/blob/ed9c4307662a5593b8a7f1f3389ecd0e79b8c503/pydevd_attach_to_process/winappdbg/textio.py#L238-L265
train
209,532
fabioz/PyDev.Debugger
pydevd_attach_to_process/winappdbg/textio.py
HexInput.mixed_list_file
def mixed_list_file(cls, filename): """ Read a list of mixed values from a file. The file format is: - # anywhere in the line begins a comment - leading and trailing spaces are ignored - empty lines are ignored - strings cannot span over a single line - integers can be specified as: - decimal numbers ("100" is 100) - hexadecimal numbers ("0x100" is 256) - binary numbers ("0b100" is 4) - octal numbers ("0100" is 64) @type filename: str @param filename: Name of the file to read. @rtype: list @return: List of integers and strings read from the file. """ count = 0 result = list() fd = open(filename, 'r') for line in fd: count = count + 1 if '#' in line: line = line[ : line.find('#') ] line = line.strip() if line: try: value = cls.integer(line) except ValueError: value = line result.append(value) return result
python
def mixed_list_file(cls, filename): """ Read a list of mixed values from a file. The file format is: - # anywhere in the line begins a comment - leading and trailing spaces are ignored - empty lines are ignored - strings cannot span over a single line - integers can be specified as: - decimal numbers ("100" is 100) - hexadecimal numbers ("0x100" is 256) - binary numbers ("0b100" is 4) - octal numbers ("0100" is 64) @type filename: str @param filename: Name of the file to read. @rtype: list @return: List of integers and strings read from the file. """ count = 0 result = list() fd = open(filename, 'r') for line in fd: count = count + 1 if '#' in line: line = line[ : line.find('#') ] line = line.strip() if line: try: value = cls.integer(line) except ValueError: value = line result.append(value) return result
[ "def", "mixed_list_file", "(", "cls", ",", "filename", ")", ":", "count", "=", "0", "result", "=", "list", "(", ")", "fd", "=", "open", "(", "filename", ",", "'r'", ")", "for", "line", "in", "fd", ":", "count", "=", "count", "+", "1", "if", "'#'"...
Read a list of mixed values from a file. The file format is: - # anywhere in the line begins a comment - leading and trailing spaces are ignored - empty lines are ignored - strings cannot span over a single line - integers can be specified as: - decimal numbers ("100" is 100) - hexadecimal numbers ("0x100" is 256) - binary numbers ("0b100" is 4) - octal numbers ("0100" is 64) @type filename: str @param filename: Name of the file to read. @rtype: list @return: List of integers and strings read from the file.
[ "Read", "a", "list", "of", "mixed", "values", "from", "a", "file", "." ]
ed9c4307662a5593b8a7f1f3389ecd0e79b8c503
https://github.com/fabioz/PyDev.Debugger/blob/ed9c4307662a5593b8a7f1f3389ecd0e79b8c503/pydevd_attach_to_process/winappdbg/textio.py#L268-L304
train
209,533
fabioz/PyDev.Debugger
pydevd_attach_to_process/winappdbg/textio.py
HexOutput.integer_list_file
def integer_list_file(cls, filename, values, bits = None): """ Write a list of integers to a file. If a file of the same name exists, it's contents are replaced. See L{HexInput.integer_list_file} for a description of the file format. @type filename: str @param filename: Name of the file to write. @type values: list( int ) @param values: List of integers to write to the file. @type bits: int @param bits: (Optional) Number of bits of the target architecture. The default is platform dependent. See: L{HexOutput.integer_size} """ fd = open(filename, 'w') for integer in values: print >> fd, cls.integer(integer, bits) fd.close()
python
def integer_list_file(cls, filename, values, bits = None): """ Write a list of integers to a file. If a file of the same name exists, it's contents are replaced. See L{HexInput.integer_list_file} for a description of the file format. @type filename: str @param filename: Name of the file to write. @type values: list( int ) @param values: List of integers to write to the file. @type bits: int @param bits: (Optional) Number of bits of the target architecture. The default is platform dependent. See: L{HexOutput.integer_size} """ fd = open(filename, 'w') for integer in values: print >> fd, cls.integer(integer, bits) fd.close()
[ "def", "integer_list_file", "(", "cls", ",", "filename", ",", "values", ",", "bits", "=", "None", ")", ":", "fd", "=", "open", "(", "filename", ",", "'w'", ")", "for", "integer", "in", "values", ":", "print", ">>", "fd", ",", "cls", ".", "integer", ...
Write a list of integers to a file. If a file of the same name exists, it's contents are replaced. See L{HexInput.integer_list_file} for a description of the file format. @type filename: str @param filename: Name of the file to write. @type values: list( int ) @param values: List of integers to write to the file. @type bits: int @param bits: (Optional) Number of bits of the target architecture. The default is platform dependent. See: L{HexOutput.integer_size}
[ "Write", "a", "list", "of", "integers", "to", "a", "file", ".", "If", "a", "file", "of", "the", "same", "name", "exists", "it", "s", "contents", "are", "replaced", "." ]
ed9c4307662a5593b8a7f1f3389ecd0e79b8c503
https://github.com/fabioz/PyDev.Debugger/blob/ed9c4307662a5593b8a7f1f3389ecd0e79b8c503/pydevd_attach_to_process/winappdbg/textio.py#L384-L405
train
209,534
fabioz/PyDev.Debugger
pydevd_attach_to_process/winappdbg/textio.py
HexOutput.string_list_file
def string_list_file(cls, filename, values): """ Write a list of strings to a file. If a file of the same name exists, it's contents are replaced. See L{HexInput.string_list_file} for a description of the file format. @type filename: str @param filename: Name of the file to write. @type values: list( int ) @param values: List of strings to write to the file. """ fd = open(filename, 'w') for string in values: print >> fd, string fd.close()
python
def string_list_file(cls, filename, values): """ Write a list of strings to a file. If a file of the same name exists, it's contents are replaced. See L{HexInput.string_list_file} for a description of the file format. @type filename: str @param filename: Name of the file to write. @type values: list( int ) @param values: List of strings to write to the file. """ fd = open(filename, 'w') for string in values: print >> fd, string fd.close()
[ "def", "string_list_file", "(", "cls", ",", "filename", ",", "values", ")", ":", "fd", "=", "open", "(", "filename", ",", "'w'", ")", "for", "string", "in", "values", ":", "print", ">>", "fd", ",", "string", "fd", ".", "close", "(", ")" ]
Write a list of strings to a file. If a file of the same name exists, it's contents are replaced. See L{HexInput.string_list_file} for a description of the file format. @type filename: str @param filename: Name of the file to write. @type values: list( int ) @param values: List of strings to write to the file.
[ "Write", "a", "list", "of", "strings", "to", "a", "file", ".", "If", "a", "file", "of", "the", "same", "name", "exists", "it", "s", "contents", "are", "replaced", "." ]
ed9c4307662a5593b8a7f1f3389ecd0e79b8c503
https://github.com/fabioz/PyDev.Debugger/blob/ed9c4307662a5593b8a7f1f3389ecd0e79b8c503/pydevd_attach_to_process/winappdbg/textio.py#L408-L424
train
209,535
fabioz/PyDev.Debugger
pydevd_attach_to_process/winappdbg/textio.py
HexOutput.mixed_list_file
def mixed_list_file(cls, filename, values, bits): """ Write a list of mixed values to a file. If a file of the same name exists, it's contents are replaced. See L{HexInput.mixed_list_file} for a description of the file format. @type filename: str @param filename: Name of the file to write. @type values: list( int ) @param values: List of mixed values to write to the file. @type bits: int @param bits: (Optional) Number of bits of the target architecture. The default is platform dependent. See: L{HexOutput.integer_size} """ fd = open(filename, 'w') for original in values: try: parsed = cls.integer(original, bits) except TypeError: parsed = repr(original) print >> fd, parsed fd.close()
python
def mixed_list_file(cls, filename, values, bits): """ Write a list of mixed values to a file. If a file of the same name exists, it's contents are replaced. See L{HexInput.mixed_list_file} for a description of the file format. @type filename: str @param filename: Name of the file to write. @type values: list( int ) @param values: List of mixed values to write to the file. @type bits: int @param bits: (Optional) Number of bits of the target architecture. The default is platform dependent. See: L{HexOutput.integer_size} """ fd = open(filename, 'w') for original in values: try: parsed = cls.integer(original, bits) except TypeError: parsed = repr(original) print >> fd, parsed fd.close()
[ "def", "mixed_list_file", "(", "cls", ",", "filename", ",", "values", ",", "bits", ")", ":", "fd", "=", "open", "(", "filename", ",", "'w'", ")", "for", "original", "in", "values", ":", "try", ":", "parsed", "=", "cls", ".", "integer", "(", "original...
Write a list of mixed values to a file. If a file of the same name exists, it's contents are replaced. See L{HexInput.mixed_list_file} for a description of the file format. @type filename: str @param filename: Name of the file to write. @type values: list( int ) @param values: List of mixed values to write to the file. @type bits: int @param bits: (Optional) Number of bits of the target architecture. The default is platform dependent. See: L{HexOutput.integer_size}
[ "Write", "a", "list", "of", "mixed", "values", "to", "a", "file", ".", "If", "a", "file", "of", "the", "same", "name", "exists", "it", "s", "contents", "are", "replaced", "." ]
ed9c4307662a5593b8a7f1f3389ecd0e79b8c503
https://github.com/fabioz/PyDev.Debugger/blob/ed9c4307662a5593b8a7f1f3389ecd0e79b8c503/pydevd_attach_to_process/winappdbg/textio.py#L427-L452
train
209,536
fabioz/PyDev.Debugger
pydevd_attach_to_process/winappdbg/textio.py
HexDump.printable
def printable(data): """ Replace unprintable characters with dots. @type data: str @param data: Binary data. @rtype: str @return: Printable text. """ result = '' for c in data: if 32 < ord(c) < 128: result += c else: result += '.' return result
python
def printable(data): """ Replace unprintable characters with dots. @type data: str @param data: Binary data. @rtype: str @return: Printable text. """ result = '' for c in data: if 32 < ord(c) < 128: result += c else: result += '.' return result
[ "def", "printable", "(", "data", ")", ":", "result", "=", "''", "for", "c", "in", "data", ":", "if", "32", "<", "ord", "(", "c", ")", "<", "128", ":", "result", "+=", "c", "else", ":", "result", "+=", "'.'", "return", "result" ]
Replace unprintable characters with dots. @type data: str @param data: Binary data. @rtype: str @return: Printable text.
[ "Replace", "unprintable", "characters", "with", "dots", "." ]
ed9c4307662a5593b8a7f1f3389ecd0e79b8c503
https://github.com/fabioz/PyDev.Debugger/blob/ed9c4307662a5593b8a7f1f3389ecd0e79b8c503/pydevd_attach_to_process/winappdbg/textio.py#L516-L532
train
209,537
fabioz/PyDev.Debugger
pydevd_attach_to_process/winappdbg/textio.py
HexDump.hexa_word
def hexa_word(data, separator = ' '): """ Convert binary data to a string of hexadecimal WORDs. @type data: str @param data: Binary data. @type separator: str @param separator: Separator between the hexadecimal representation of each WORD. @rtype: str @return: Hexadecimal representation. """ if len(data) & 1 != 0: data += '\0' return separator.join( [ '%.4x' % struct.unpack('<H', data[i:i+2])[0] \ for i in compat.xrange(0, len(data), 2) ] )
python
def hexa_word(data, separator = ' '): """ Convert binary data to a string of hexadecimal WORDs. @type data: str @param data: Binary data. @type separator: str @param separator: Separator between the hexadecimal representation of each WORD. @rtype: str @return: Hexadecimal representation. """ if len(data) & 1 != 0: data += '\0' return separator.join( [ '%.4x' % struct.unpack('<H', data[i:i+2])[0] \ for i in compat.xrange(0, len(data), 2) ] )
[ "def", "hexa_word", "(", "data", ",", "separator", "=", "' '", ")", ":", "if", "len", "(", "data", ")", "&", "1", "!=", "0", ":", "data", "+=", "'\\0'", "return", "separator", ".", "join", "(", "[", "'%.4x'", "%", "struct", ".", "unpack", "(", "'...
Convert binary data to a string of hexadecimal WORDs. @type data: str @param data: Binary data. @type separator: str @param separator: Separator between the hexadecimal representation of each WORD. @rtype: str @return: Hexadecimal representation.
[ "Convert", "binary", "data", "to", "a", "string", "of", "hexadecimal", "WORDs", "." ]
ed9c4307662a5593b8a7f1f3389ecd0e79b8c503
https://github.com/fabioz/PyDev.Debugger/blob/ed9c4307662a5593b8a7f1f3389ecd0e79b8c503/pydevd_attach_to_process/winappdbg/textio.py#L552-L569
train
209,538
fabioz/PyDev.Debugger
pydevd_attach_to_process/winappdbg/textio.py
HexDump.hexline
def hexline(cls, data, separator = ' ', width = None): """ Dump a line of hexadecimal numbers from binary data. @type data: str @param data: Binary data. @type separator: str @param separator: Separator between the hexadecimal representation of each character. @type width: int @param width: (Optional) Maximum number of characters to convert per text line. This value is also used for padding. @rtype: str @return: Multiline output text. """ if width is None: fmt = '%s %s' else: fmt = '%%-%ds %%-%ds' % ((len(separator)+2)*width-1, width) return fmt % (cls.hexadecimal(data, separator), cls.printable(data))
python
def hexline(cls, data, separator = ' ', width = None): """ Dump a line of hexadecimal numbers from binary data. @type data: str @param data: Binary data. @type separator: str @param separator: Separator between the hexadecimal representation of each character. @type width: int @param width: (Optional) Maximum number of characters to convert per text line. This value is also used for padding. @rtype: str @return: Multiline output text. """ if width is None: fmt = '%s %s' else: fmt = '%%-%ds %%-%ds' % ((len(separator)+2)*width-1, width) return fmt % (cls.hexadecimal(data, separator), cls.printable(data))
[ "def", "hexline", "(", "cls", ",", "data", ",", "separator", "=", "' '", ",", "width", "=", "None", ")", ":", "if", "width", "is", "None", ":", "fmt", "=", "'%s %s'", "else", ":", "fmt", "=", "'%%-%ds %%-%ds'", "%", "(", "(", "len", "(", "separat...
Dump a line of hexadecimal numbers from binary data. @type data: str @param data: Binary data. @type separator: str @param separator: Separator between the hexadecimal representation of each character. @type width: int @param width: (Optional) Maximum number of characters to convert per text line. This value is also used for padding. @rtype: str @return: Multiline output text.
[ "Dump", "a", "line", "of", "hexadecimal", "numbers", "from", "binary", "data", "." ]
ed9c4307662a5593b8a7f1f3389ecd0e79b8c503
https://github.com/fabioz/PyDev.Debugger/blob/ed9c4307662a5593b8a7f1f3389ecd0e79b8c503/pydevd_attach_to_process/winappdbg/textio.py#L612-L635
train
209,539
fabioz/PyDev.Debugger
pydevd_attach_to_process/winappdbg/textio.py
HexDump.hexblock
def hexblock(cls, data, address = None, bits = None, separator = ' ', width = 8): """ Dump a block of hexadecimal numbers from binary data. Also show a printable text version of the data. @type data: str @param data: Binary data. @type address: str @param address: Memory address where the data was read from. @type bits: int @param bits: (Optional) Number of bits of the target architecture. The default is platform dependent. See: L{HexDump.address_size} @type separator: str @param separator: Separator between the hexadecimal representation of each character. @type width: int @param width: (Optional) Maximum number of characters to convert per text line. @rtype: str @return: Multiline output text. """ return cls.hexblock_cb(cls.hexline, data, address, bits, width, cb_kwargs = {'width' : width, 'separator' : separator})
python
def hexblock(cls, data, address = None, bits = None, separator = ' ', width = 8): """ Dump a block of hexadecimal numbers from binary data. Also show a printable text version of the data. @type data: str @param data: Binary data. @type address: str @param address: Memory address where the data was read from. @type bits: int @param bits: (Optional) Number of bits of the target architecture. The default is platform dependent. See: L{HexDump.address_size} @type separator: str @param separator: Separator between the hexadecimal representation of each character. @type width: int @param width: (Optional) Maximum number of characters to convert per text line. @rtype: str @return: Multiline output text. """ return cls.hexblock_cb(cls.hexline, data, address, bits, width, cb_kwargs = {'width' : width, 'separator' : separator})
[ "def", "hexblock", "(", "cls", ",", "data", ",", "address", "=", "None", ",", "bits", "=", "None", ",", "separator", "=", "' '", ",", "width", "=", "8", ")", ":", "return", "cls", ".", "hexblock_cb", "(", "cls", ".", "hexline", ",", "data", ",", ...
Dump a block of hexadecimal numbers from binary data. Also show a printable text version of the data. @type data: str @param data: Binary data. @type address: str @param address: Memory address where the data was read from. @type bits: int @param bits: (Optional) Number of bits of the target architecture. The default is platform dependent. See: L{HexDump.address_size} @type separator: str @param separator: Separator between the hexadecimal representation of each character. @type width: int @param width: (Optional) Maximum number of characters to convert per text line. @rtype: str @return: Multiline output text.
[ "Dump", "a", "block", "of", "hexadecimal", "numbers", "from", "binary", "data", ".", "Also", "show", "a", "printable", "text", "version", "of", "the", "data", "." ]
ed9c4307662a5593b8a7f1f3389ecd0e79b8c503
https://github.com/fabioz/PyDev.Debugger/blob/ed9c4307662a5593b8a7f1f3389ecd0e79b8c503/pydevd_attach_to_process/winappdbg/textio.py#L638-L669
train
209,540
fabioz/PyDev.Debugger
pydevd_attach_to_process/winappdbg/textio.py
HexDump.hexblock_cb
def hexblock_cb(cls, callback, data, address = None, bits = None, width = 16, cb_args = (), cb_kwargs = {}): """ Dump a block of binary data using a callback function to convert each line of text. @type callback: function @param callback: Callback function to convert each line of data. @type data: str @param data: Binary data. @type address: str @param address: (Optional) Memory address where the data was read from. @type bits: int @param bits: (Optional) Number of bits of the target architecture. The default is platform dependent. See: L{HexDump.address_size} @type cb_args: str @param cb_args: (Optional) Arguments to pass to the callback function. @type cb_kwargs: str @param cb_kwargs: (Optional) Keyword arguments to pass to the callback function. @type width: int @param width: (Optional) Maximum number of bytes to convert per text line. @rtype: str @return: Multiline output text. """ result = '' if address is None: for i in compat.xrange(0, len(data), width): result = '%s%s\n' % ( result, \ callback(data[i:i+width], *cb_args, **cb_kwargs) ) else: for i in compat.xrange(0, len(data), width): result = '%s%s: %s\n' % ( result, cls.address(address, bits), callback(data[i:i+width], *cb_args, **cb_kwargs) ) address += width return result
python
def hexblock_cb(cls, callback, data, address = None, bits = None, width = 16, cb_args = (), cb_kwargs = {}): """ Dump a block of binary data using a callback function to convert each line of text. @type callback: function @param callback: Callback function to convert each line of data. @type data: str @param data: Binary data. @type address: str @param address: (Optional) Memory address where the data was read from. @type bits: int @param bits: (Optional) Number of bits of the target architecture. The default is platform dependent. See: L{HexDump.address_size} @type cb_args: str @param cb_args: (Optional) Arguments to pass to the callback function. @type cb_kwargs: str @param cb_kwargs: (Optional) Keyword arguments to pass to the callback function. @type width: int @param width: (Optional) Maximum number of bytes to convert per text line. @rtype: str @return: Multiline output text. """ result = '' if address is None: for i in compat.xrange(0, len(data), width): result = '%s%s\n' % ( result, \ callback(data[i:i+width], *cb_args, **cb_kwargs) ) else: for i in compat.xrange(0, len(data), width): result = '%s%s: %s\n' % ( result, cls.address(address, bits), callback(data[i:i+width], *cb_args, **cb_kwargs) ) address += width return result
[ "def", "hexblock_cb", "(", "cls", ",", "callback", ",", "data", ",", "address", "=", "None", ",", "bits", "=", "None", ",", "width", "=", "16", ",", "cb_args", "=", "(", ")", ",", "cb_kwargs", "=", "{", "}", ")", ":", "result", "=", "''", "if", ...
Dump a block of binary data using a callback function to convert each line of text. @type callback: function @param callback: Callback function to convert each line of data. @type data: str @param data: Binary data. @type address: str @param address: (Optional) Memory address where the data was read from. @type bits: int @param bits: (Optional) Number of bits of the target architecture. The default is platform dependent. See: L{HexDump.address_size} @type cb_args: str @param cb_args: (Optional) Arguments to pass to the callback function. @type cb_kwargs: str @param cb_kwargs: (Optional) Keyword arguments to pass to the callback function. @type width: int @param width: (Optional) Maximum number of bytes to convert per text line. @rtype: str @return: Multiline output text.
[ "Dump", "a", "block", "of", "binary", "data", "using", "a", "callback", "function", "to", "convert", "each", "line", "of", "text", "." ]
ed9c4307662a5593b8a7f1f3389ecd0e79b8c503
https://github.com/fabioz/PyDev.Debugger/blob/ed9c4307662a5593b8a7f1f3389ecd0e79b8c503/pydevd_attach_to_process/winappdbg/textio.py#L672-L724
train
209,541
fabioz/PyDev.Debugger
pydevd_attach_to_process/winappdbg/textio.py
HexDump.hexblock_byte
def hexblock_byte(cls, data, address = None, bits = None, separator = ' ', width = 16): """ Dump a block of hexadecimal BYTEs from binary data. @type data: str @param data: Binary data. @type address: str @param address: Memory address where the data was read from. @type bits: int @param bits: (Optional) Number of bits of the target architecture. The default is platform dependent. See: L{HexDump.address_size} @type separator: str @param separator: Separator between the hexadecimal representation of each BYTE. @type width: int @param width: (Optional) Maximum number of BYTEs to convert per text line. @rtype: str @return: Multiline output text. """ return cls.hexblock_cb(cls.hexadecimal, data, address, bits, width, cb_kwargs = {'separator': separator})
python
def hexblock_byte(cls, data, address = None, bits = None, separator = ' ', width = 16): """ Dump a block of hexadecimal BYTEs from binary data. @type data: str @param data: Binary data. @type address: str @param address: Memory address where the data was read from. @type bits: int @param bits: (Optional) Number of bits of the target architecture. The default is platform dependent. See: L{HexDump.address_size} @type separator: str @param separator: Separator between the hexadecimal representation of each BYTE. @type width: int @param width: (Optional) Maximum number of BYTEs to convert per text line. @rtype: str @return: Multiline output text. """ return cls.hexblock_cb(cls.hexadecimal, data, address, bits, width, cb_kwargs = {'separator': separator})
[ "def", "hexblock_byte", "(", "cls", ",", "data", ",", "address", "=", "None", ",", "bits", "=", "None", ",", "separator", "=", "' '", ",", "width", "=", "16", ")", ":", "return", "cls", ".", "hexblock_cb", "(", "cls", ".", "hexadecimal", ",", "data",...
Dump a block of hexadecimal BYTEs from binary data. @type data: str @param data: Binary data. @type address: str @param address: Memory address where the data was read from. @type bits: int @param bits: (Optional) Number of bits of the target architecture. The default is platform dependent. See: L{HexDump.address_size} @type separator: str @param separator: Separator between the hexadecimal representation of each BYTE. @type width: int @param width: (Optional) Maximum number of BYTEs to convert per text line. @rtype: str @return: Multiline output text.
[ "Dump", "a", "block", "of", "hexadecimal", "BYTEs", "from", "binary", "data", "." ]
ed9c4307662a5593b8a7f1f3389ecd0e79b8c503
https://github.com/fabioz/PyDev.Debugger/blob/ed9c4307662a5593b8a7f1f3389ecd0e79b8c503/pydevd_attach_to_process/winappdbg/textio.py#L727-L758
train
209,542
fabioz/PyDev.Debugger
pydevd_attach_to_process/winappdbg/textio.py
HexDump.hexblock_word
def hexblock_word(cls, data, address = None, bits = None, separator = ' ', width = 8): """ Dump a block of hexadecimal WORDs from binary data. @type data: str @param data: Binary data. @type address: str @param address: Memory address where the data was read from. @type bits: int @param bits: (Optional) Number of bits of the target architecture. The default is platform dependent. See: L{HexDump.address_size} @type separator: str @param separator: Separator between the hexadecimal representation of each WORD. @type width: int @param width: (Optional) Maximum number of WORDs to convert per text line. @rtype: str @return: Multiline output text. """ return cls.hexblock_cb(cls.hexa_word, data, address, bits, width * 2, cb_kwargs = {'separator': separator})
python
def hexblock_word(cls, data, address = None, bits = None, separator = ' ', width = 8): """ Dump a block of hexadecimal WORDs from binary data. @type data: str @param data: Binary data. @type address: str @param address: Memory address where the data was read from. @type bits: int @param bits: (Optional) Number of bits of the target architecture. The default is platform dependent. See: L{HexDump.address_size} @type separator: str @param separator: Separator between the hexadecimal representation of each WORD. @type width: int @param width: (Optional) Maximum number of WORDs to convert per text line. @rtype: str @return: Multiline output text. """ return cls.hexblock_cb(cls.hexa_word, data, address, bits, width * 2, cb_kwargs = {'separator': separator})
[ "def", "hexblock_word", "(", "cls", ",", "data", ",", "address", "=", "None", ",", "bits", "=", "None", ",", "separator", "=", "' '", ",", "width", "=", "8", ")", ":", "return", "cls", ".", "hexblock_cb", "(", "cls", ".", "hexa_word", ",", "data", ...
Dump a block of hexadecimal WORDs from binary data. @type data: str @param data: Binary data. @type address: str @param address: Memory address where the data was read from. @type bits: int @param bits: (Optional) Number of bits of the target architecture. The default is platform dependent. See: L{HexDump.address_size} @type separator: str @param separator: Separator between the hexadecimal representation of each WORD. @type width: int @param width: (Optional) Maximum number of WORDs to convert per text line. @rtype: str @return: Multiline output text.
[ "Dump", "a", "block", "of", "hexadecimal", "WORDs", "from", "binary", "data", "." ]
ed9c4307662a5593b8a7f1f3389ecd0e79b8c503
https://github.com/fabioz/PyDev.Debugger/blob/ed9c4307662a5593b8a7f1f3389ecd0e79b8c503/pydevd_attach_to_process/winappdbg/textio.py#L761-L792
train
209,543
fabioz/PyDev.Debugger
pydevd_attach_to_process/winappdbg/textio.py
HexDump.hexblock_dword
def hexblock_dword(cls, data, address = None, bits = None, separator = ' ', width = 4): """ Dump a block of hexadecimal DWORDs from binary data. @type data: str @param data: Binary data. @type address: str @param address: Memory address where the data was read from. @type bits: int @param bits: (Optional) Number of bits of the target architecture. The default is platform dependent. See: L{HexDump.address_size} @type separator: str @param separator: Separator between the hexadecimal representation of each DWORD. @type width: int @param width: (Optional) Maximum number of DWORDs to convert per text line. @rtype: str @return: Multiline output text. """ return cls.hexblock_cb(cls.hexa_dword, data, address, bits, width * 4, cb_kwargs = {'separator': separator})
python
def hexblock_dword(cls, data, address = None, bits = None, separator = ' ', width = 4): """ Dump a block of hexadecimal DWORDs from binary data. @type data: str @param data: Binary data. @type address: str @param address: Memory address where the data was read from. @type bits: int @param bits: (Optional) Number of bits of the target architecture. The default is platform dependent. See: L{HexDump.address_size} @type separator: str @param separator: Separator between the hexadecimal representation of each DWORD. @type width: int @param width: (Optional) Maximum number of DWORDs to convert per text line. @rtype: str @return: Multiline output text. """ return cls.hexblock_cb(cls.hexa_dword, data, address, bits, width * 4, cb_kwargs = {'separator': separator})
[ "def", "hexblock_dword", "(", "cls", ",", "data", ",", "address", "=", "None", ",", "bits", "=", "None", ",", "separator", "=", "' '", ",", "width", "=", "4", ")", ":", "return", "cls", ".", "hexblock_cb", "(", "cls", ".", "hexa_dword", ",", "data", ...
Dump a block of hexadecimal DWORDs from binary data. @type data: str @param data: Binary data. @type address: str @param address: Memory address where the data was read from. @type bits: int @param bits: (Optional) Number of bits of the target architecture. The default is platform dependent. See: L{HexDump.address_size} @type separator: str @param separator: Separator between the hexadecimal representation of each DWORD. @type width: int @param width: (Optional) Maximum number of DWORDs to convert per text line. @rtype: str @return: Multiline output text.
[ "Dump", "a", "block", "of", "hexadecimal", "DWORDs", "from", "binary", "data", "." ]
ed9c4307662a5593b8a7f1f3389ecd0e79b8c503
https://github.com/fabioz/PyDev.Debugger/blob/ed9c4307662a5593b8a7f1f3389ecd0e79b8c503/pydevd_attach_to_process/winappdbg/textio.py#L795-L826
train
209,544
fabioz/PyDev.Debugger
pydevd_attach_to_process/winappdbg/textio.py
HexDump.hexblock_qword
def hexblock_qword(cls, data, address = None, bits = None, separator = ' ', width = 2): """ Dump a block of hexadecimal QWORDs from binary data. @type data: str @param data: Binary data. @type address: str @param address: Memory address where the data was read from. @type bits: int @param bits: (Optional) Number of bits of the target architecture. The default is platform dependent. See: L{HexDump.address_size} @type separator: str @param separator: Separator between the hexadecimal representation of each QWORD. @type width: int @param width: (Optional) Maximum number of QWORDs to convert per text line. @rtype: str @return: Multiline output text. """ return cls.hexblock_cb(cls.hexa_qword, data, address, bits, width * 8, cb_kwargs = {'separator': separator})
python
def hexblock_qword(cls, data, address = None, bits = None, separator = ' ', width = 2): """ Dump a block of hexadecimal QWORDs from binary data. @type data: str @param data: Binary data. @type address: str @param address: Memory address where the data was read from. @type bits: int @param bits: (Optional) Number of bits of the target architecture. The default is platform dependent. See: L{HexDump.address_size} @type separator: str @param separator: Separator between the hexadecimal representation of each QWORD. @type width: int @param width: (Optional) Maximum number of QWORDs to convert per text line. @rtype: str @return: Multiline output text. """ return cls.hexblock_cb(cls.hexa_qword, data, address, bits, width * 8, cb_kwargs = {'separator': separator})
[ "def", "hexblock_qword", "(", "cls", ",", "data", ",", "address", "=", "None", ",", "bits", "=", "None", ",", "separator", "=", "' '", ",", "width", "=", "2", ")", ":", "return", "cls", ".", "hexblock_cb", "(", "cls", ".", "hexa_qword", ",", "data", ...
Dump a block of hexadecimal QWORDs from binary data. @type data: str @param data: Binary data. @type address: str @param address: Memory address where the data was read from. @type bits: int @param bits: (Optional) Number of bits of the target architecture. The default is platform dependent. See: L{HexDump.address_size} @type separator: str @param separator: Separator between the hexadecimal representation of each QWORD. @type width: int @param width: (Optional) Maximum number of QWORDs to convert per text line. @rtype: str @return: Multiline output text.
[ "Dump", "a", "block", "of", "hexadecimal", "QWORDs", "from", "binary", "data", "." ]
ed9c4307662a5593b8a7f1f3389ecd0e79b8c503
https://github.com/fabioz/PyDev.Debugger/blob/ed9c4307662a5593b8a7f1f3389ecd0e79b8c503/pydevd_attach_to_process/winappdbg/textio.py#L829-L860
train
209,545
fabioz/PyDev.Debugger
pydevd_attach_to_process/winappdbg/textio.py
Color.default
def default(cls): "Make the current foreground color the default." wAttributes = cls._get_text_attributes() wAttributes &= ~win32.FOREGROUND_MASK wAttributes |= win32.FOREGROUND_GREY wAttributes &= ~win32.FOREGROUND_INTENSITY cls._set_text_attributes(wAttributes)
python
def default(cls): "Make the current foreground color the default." wAttributes = cls._get_text_attributes() wAttributes &= ~win32.FOREGROUND_MASK wAttributes |= win32.FOREGROUND_GREY wAttributes &= ~win32.FOREGROUND_INTENSITY cls._set_text_attributes(wAttributes)
[ "def", "default", "(", "cls", ")", ":", "wAttributes", "=", "cls", ".", "_get_text_attributes", "(", ")", "wAttributes", "&=", "~", "win32", ".", "FOREGROUND_MASK", "wAttributes", "|=", "win32", ".", "FOREGROUND_GREY", "wAttributes", "&=", "~", "win32", ".", ...
Make the current foreground color the default.
[ "Make", "the", "current", "foreground", "color", "the", "default", "." ]
ed9c4307662a5593b8a7f1f3389ecd0e79b8c503
https://github.com/fabioz/PyDev.Debugger/blob/ed9c4307662a5593b8a7f1f3389ecd0e79b8c503/pydevd_attach_to_process/winappdbg/textio.py#L920-L926
train
209,546
fabioz/PyDev.Debugger
pydevd_attach_to_process/winappdbg/textio.py
Color.light
def light(cls): "Make the current foreground color light." wAttributes = cls._get_text_attributes() wAttributes |= win32.FOREGROUND_INTENSITY cls._set_text_attributes(wAttributes)
python
def light(cls): "Make the current foreground color light." wAttributes = cls._get_text_attributes() wAttributes |= win32.FOREGROUND_INTENSITY cls._set_text_attributes(wAttributes)
[ "def", "light", "(", "cls", ")", ":", "wAttributes", "=", "cls", ".", "_get_text_attributes", "(", ")", "wAttributes", "|=", "win32", ".", "FOREGROUND_INTENSITY", "cls", ".", "_set_text_attributes", "(", "wAttributes", ")" ]
Make the current foreground color light.
[ "Make", "the", "current", "foreground", "color", "light", "." ]
ed9c4307662a5593b8a7f1f3389ecd0e79b8c503
https://github.com/fabioz/PyDev.Debugger/blob/ed9c4307662a5593b8a7f1f3389ecd0e79b8c503/pydevd_attach_to_process/winappdbg/textio.py#L929-L933
train
209,547
fabioz/PyDev.Debugger
pydevd_attach_to_process/winappdbg/textio.py
Color.dark
def dark(cls): "Make the current foreground color dark." wAttributes = cls._get_text_attributes() wAttributes &= ~win32.FOREGROUND_INTENSITY cls._set_text_attributes(wAttributes)
python
def dark(cls): "Make the current foreground color dark." wAttributes = cls._get_text_attributes() wAttributes &= ~win32.FOREGROUND_INTENSITY cls._set_text_attributes(wAttributes)
[ "def", "dark", "(", "cls", ")", ":", "wAttributes", "=", "cls", ".", "_get_text_attributes", "(", ")", "wAttributes", "&=", "~", "win32", ".", "FOREGROUND_INTENSITY", "cls", ".", "_set_text_attributes", "(", "wAttributes", ")" ]
Make the current foreground color dark.
[ "Make", "the", "current", "foreground", "color", "dark", "." ]
ed9c4307662a5593b8a7f1f3389ecd0e79b8c503
https://github.com/fabioz/PyDev.Debugger/blob/ed9c4307662a5593b8a7f1f3389ecd0e79b8c503/pydevd_attach_to_process/winappdbg/textio.py#L936-L940
train
209,548
fabioz/PyDev.Debugger
pydevd_attach_to_process/winappdbg/textio.py
Color.black
def black(cls): "Make the text foreground color black." wAttributes = cls._get_text_attributes() wAttributes &= ~win32.FOREGROUND_MASK #wAttributes |= win32.FOREGROUND_BLACK cls._set_text_attributes(wAttributes)
python
def black(cls): "Make the text foreground color black." wAttributes = cls._get_text_attributes() wAttributes &= ~win32.FOREGROUND_MASK #wAttributes |= win32.FOREGROUND_BLACK cls._set_text_attributes(wAttributes)
[ "def", "black", "(", "cls", ")", ":", "wAttributes", "=", "cls", ".", "_get_text_attributes", "(", ")", "wAttributes", "&=", "~", "win32", ".", "FOREGROUND_MASK", "#wAttributes |= win32.FOREGROUND_BLACK", "cls", ".", "_set_text_attributes", "(", "wAttributes", ")" ...
Make the text foreground color black.
[ "Make", "the", "text", "foreground", "color", "black", "." ]
ed9c4307662a5593b8a7f1f3389ecd0e79b8c503
https://github.com/fabioz/PyDev.Debugger/blob/ed9c4307662a5593b8a7f1f3389ecd0e79b8c503/pydevd_attach_to_process/winappdbg/textio.py#L943-L948
train
209,549
fabioz/PyDev.Debugger
pydevd_attach_to_process/winappdbg/textio.py
Color.white
def white(cls): "Make the text foreground color white." wAttributes = cls._get_text_attributes() wAttributes &= ~win32.FOREGROUND_MASK wAttributes |= win32.FOREGROUND_GREY cls._set_text_attributes(wAttributes)
python
def white(cls): "Make the text foreground color white." wAttributes = cls._get_text_attributes() wAttributes &= ~win32.FOREGROUND_MASK wAttributes |= win32.FOREGROUND_GREY cls._set_text_attributes(wAttributes)
[ "def", "white", "(", "cls", ")", ":", "wAttributes", "=", "cls", ".", "_get_text_attributes", "(", ")", "wAttributes", "&=", "~", "win32", ".", "FOREGROUND_MASK", "wAttributes", "|=", "win32", ".", "FOREGROUND_GREY", "cls", ".", "_set_text_attributes", "(", "w...
Make the text foreground color white.
[ "Make", "the", "text", "foreground", "color", "white", "." ]
ed9c4307662a5593b8a7f1f3389ecd0e79b8c503
https://github.com/fabioz/PyDev.Debugger/blob/ed9c4307662a5593b8a7f1f3389ecd0e79b8c503/pydevd_attach_to_process/winappdbg/textio.py#L951-L956
train
209,550
fabioz/PyDev.Debugger
pydevd_attach_to_process/winappdbg/textio.py
Color.red
def red(cls): "Make the text foreground color red." wAttributes = cls._get_text_attributes() wAttributes &= ~win32.FOREGROUND_MASK wAttributes |= win32.FOREGROUND_RED cls._set_text_attributes(wAttributes)
python
def red(cls): "Make the text foreground color red." wAttributes = cls._get_text_attributes() wAttributes &= ~win32.FOREGROUND_MASK wAttributes |= win32.FOREGROUND_RED cls._set_text_attributes(wAttributes)
[ "def", "red", "(", "cls", ")", ":", "wAttributes", "=", "cls", ".", "_get_text_attributes", "(", ")", "wAttributes", "&=", "~", "win32", ".", "FOREGROUND_MASK", "wAttributes", "|=", "win32", ".", "FOREGROUND_RED", "cls", ".", "_set_text_attributes", "(", "wAtt...
Make the text foreground color red.
[ "Make", "the", "text", "foreground", "color", "red", "." ]
ed9c4307662a5593b8a7f1f3389ecd0e79b8c503
https://github.com/fabioz/PyDev.Debugger/blob/ed9c4307662a5593b8a7f1f3389ecd0e79b8c503/pydevd_attach_to_process/winappdbg/textio.py#L959-L964
train
209,551
fabioz/PyDev.Debugger
pydevd_attach_to_process/winappdbg/textio.py
Color.green
def green(cls): "Make the text foreground color green." wAttributes = cls._get_text_attributes() wAttributes &= ~win32.FOREGROUND_MASK wAttributes |= win32.FOREGROUND_GREEN cls._set_text_attributes(wAttributes)
python
def green(cls): "Make the text foreground color green." wAttributes = cls._get_text_attributes() wAttributes &= ~win32.FOREGROUND_MASK wAttributes |= win32.FOREGROUND_GREEN cls._set_text_attributes(wAttributes)
[ "def", "green", "(", "cls", ")", ":", "wAttributes", "=", "cls", ".", "_get_text_attributes", "(", ")", "wAttributes", "&=", "~", "win32", ".", "FOREGROUND_MASK", "wAttributes", "|=", "win32", ".", "FOREGROUND_GREEN", "cls", ".", "_set_text_attributes", "(", "...
Make the text foreground color green.
[ "Make", "the", "text", "foreground", "color", "green", "." ]
ed9c4307662a5593b8a7f1f3389ecd0e79b8c503
https://github.com/fabioz/PyDev.Debugger/blob/ed9c4307662a5593b8a7f1f3389ecd0e79b8c503/pydevd_attach_to_process/winappdbg/textio.py#L967-L972
train
209,552
fabioz/PyDev.Debugger
pydevd_attach_to_process/winappdbg/textio.py
Color.blue
def blue(cls): "Make the text foreground color blue." wAttributes = cls._get_text_attributes() wAttributes &= ~win32.FOREGROUND_MASK wAttributes |= win32.FOREGROUND_BLUE cls._set_text_attributes(wAttributes)
python
def blue(cls): "Make the text foreground color blue." wAttributes = cls._get_text_attributes() wAttributes &= ~win32.FOREGROUND_MASK wAttributes |= win32.FOREGROUND_BLUE cls._set_text_attributes(wAttributes)
[ "def", "blue", "(", "cls", ")", ":", "wAttributes", "=", "cls", ".", "_get_text_attributes", "(", ")", "wAttributes", "&=", "~", "win32", ".", "FOREGROUND_MASK", "wAttributes", "|=", "win32", ".", "FOREGROUND_BLUE", "cls", ".", "_set_text_attributes", "(", "wA...
Make the text foreground color blue.
[ "Make", "the", "text", "foreground", "color", "blue", "." ]
ed9c4307662a5593b8a7f1f3389ecd0e79b8c503
https://github.com/fabioz/PyDev.Debugger/blob/ed9c4307662a5593b8a7f1f3389ecd0e79b8c503/pydevd_attach_to_process/winappdbg/textio.py#L975-L980
train
209,553
fabioz/PyDev.Debugger
pydevd_attach_to_process/winappdbg/textio.py
Color.cyan
def cyan(cls): "Make the text foreground color cyan." wAttributes = cls._get_text_attributes() wAttributes &= ~win32.FOREGROUND_MASK wAttributes |= win32.FOREGROUND_CYAN cls._set_text_attributes(wAttributes)
python
def cyan(cls): "Make the text foreground color cyan." wAttributes = cls._get_text_attributes() wAttributes &= ~win32.FOREGROUND_MASK wAttributes |= win32.FOREGROUND_CYAN cls._set_text_attributes(wAttributes)
[ "def", "cyan", "(", "cls", ")", ":", "wAttributes", "=", "cls", ".", "_get_text_attributes", "(", ")", "wAttributes", "&=", "~", "win32", ".", "FOREGROUND_MASK", "wAttributes", "|=", "win32", ".", "FOREGROUND_CYAN", "cls", ".", "_set_text_attributes", "(", "wA...
Make the text foreground color cyan.
[ "Make", "the", "text", "foreground", "color", "cyan", "." ]
ed9c4307662a5593b8a7f1f3389ecd0e79b8c503
https://github.com/fabioz/PyDev.Debugger/blob/ed9c4307662a5593b8a7f1f3389ecd0e79b8c503/pydevd_attach_to_process/winappdbg/textio.py#L983-L988
train
209,554
fabioz/PyDev.Debugger
pydevd_attach_to_process/winappdbg/textio.py
Color.magenta
def magenta(cls): "Make the text foreground color magenta." wAttributes = cls._get_text_attributes() wAttributes &= ~win32.FOREGROUND_MASK wAttributes |= win32.FOREGROUND_MAGENTA cls._set_text_attributes(wAttributes)
python
def magenta(cls): "Make the text foreground color magenta." wAttributes = cls._get_text_attributes() wAttributes &= ~win32.FOREGROUND_MASK wAttributes |= win32.FOREGROUND_MAGENTA cls._set_text_attributes(wAttributes)
[ "def", "magenta", "(", "cls", ")", ":", "wAttributes", "=", "cls", ".", "_get_text_attributes", "(", ")", "wAttributes", "&=", "~", "win32", ".", "FOREGROUND_MASK", "wAttributes", "|=", "win32", ".", "FOREGROUND_MAGENTA", "cls", ".", "_set_text_attributes", "(",...
Make the text foreground color magenta.
[ "Make", "the", "text", "foreground", "color", "magenta", "." ]
ed9c4307662a5593b8a7f1f3389ecd0e79b8c503
https://github.com/fabioz/PyDev.Debugger/blob/ed9c4307662a5593b8a7f1f3389ecd0e79b8c503/pydevd_attach_to_process/winappdbg/textio.py#L991-L996
train
209,555
fabioz/PyDev.Debugger
pydevd_attach_to_process/winappdbg/textio.py
Color.yellow
def yellow(cls): "Make the text foreground color yellow." wAttributes = cls._get_text_attributes() wAttributes &= ~win32.FOREGROUND_MASK wAttributes |= win32.FOREGROUND_YELLOW cls._set_text_attributes(wAttributes)
python
def yellow(cls): "Make the text foreground color yellow." wAttributes = cls._get_text_attributes() wAttributes &= ~win32.FOREGROUND_MASK wAttributes |= win32.FOREGROUND_YELLOW cls._set_text_attributes(wAttributes)
[ "def", "yellow", "(", "cls", ")", ":", "wAttributes", "=", "cls", ".", "_get_text_attributes", "(", ")", "wAttributes", "&=", "~", "win32", ".", "FOREGROUND_MASK", "wAttributes", "|=", "win32", ".", "FOREGROUND_YELLOW", "cls", ".", "_set_text_attributes", "(", ...
Make the text foreground color yellow.
[ "Make", "the", "text", "foreground", "color", "yellow", "." ]
ed9c4307662a5593b8a7f1f3389ecd0e79b8c503
https://github.com/fabioz/PyDev.Debugger/blob/ed9c4307662a5593b8a7f1f3389ecd0e79b8c503/pydevd_attach_to_process/winappdbg/textio.py#L999-L1004
train
209,556
fabioz/PyDev.Debugger
pydevd_attach_to_process/winappdbg/textio.py
Color.bk_default
def bk_default(cls): "Make the current background color the default." wAttributes = cls._get_text_attributes() wAttributes &= ~win32.BACKGROUND_MASK #wAttributes |= win32.BACKGROUND_BLACK wAttributes &= ~win32.BACKGROUND_INTENSITY cls._set_text_attributes(wAttributes)
python
def bk_default(cls): "Make the current background color the default." wAttributes = cls._get_text_attributes() wAttributes &= ~win32.BACKGROUND_MASK #wAttributes |= win32.BACKGROUND_BLACK wAttributes &= ~win32.BACKGROUND_INTENSITY cls._set_text_attributes(wAttributes)
[ "def", "bk_default", "(", "cls", ")", ":", "wAttributes", "=", "cls", ".", "_get_text_attributes", "(", ")", "wAttributes", "&=", "~", "win32", ".", "BACKGROUND_MASK", "#wAttributes |= win32.BACKGROUND_BLACK", "wAttributes", "&=", "~", "win32", ".", "BACKGROUND_INTE...
Make the current background color the default.
[ "Make", "the", "current", "background", "color", "the", "default", "." ]
ed9c4307662a5593b8a7f1f3389ecd0e79b8c503
https://github.com/fabioz/PyDev.Debugger/blob/ed9c4307662a5593b8a7f1f3389ecd0e79b8c503/pydevd_attach_to_process/winappdbg/textio.py#L1009-L1015
train
209,557
fabioz/PyDev.Debugger
pydevd_attach_to_process/winappdbg/textio.py
Color.bk_light
def bk_light(cls): "Make the current background color light." wAttributes = cls._get_text_attributes() wAttributes |= win32.BACKGROUND_INTENSITY cls._set_text_attributes(wAttributes)
python
def bk_light(cls): "Make the current background color light." wAttributes = cls._get_text_attributes() wAttributes |= win32.BACKGROUND_INTENSITY cls._set_text_attributes(wAttributes)
[ "def", "bk_light", "(", "cls", ")", ":", "wAttributes", "=", "cls", ".", "_get_text_attributes", "(", ")", "wAttributes", "|=", "win32", ".", "BACKGROUND_INTENSITY", "cls", ".", "_set_text_attributes", "(", "wAttributes", ")" ]
Make the current background color light.
[ "Make", "the", "current", "background", "color", "light", "." ]
ed9c4307662a5593b8a7f1f3389ecd0e79b8c503
https://github.com/fabioz/PyDev.Debugger/blob/ed9c4307662a5593b8a7f1f3389ecd0e79b8c503/pydevd_attach_to_process/winappdbg/textio.py#L1018-L1022
train
209,558
fabioz/PyDev.Debugger
pydevd_attach_to_process/winappdbg/textio.py
Color.bk_dark
def bk_dark(cls): "Make the current background color dark." wAttributes = cls._get_text_attributes() wAttributes &= ~win32.BACKGROUND_INTENSITY cls._set_text_attributes(wAttributes)
python
def bk_dark(cls): "Make the current background color dark." wAttributes = cls._get_text_attributes() wAttributes &= ~win32.BACKGROUND_INTENSITY cls._set_text_attributes(wAttributes)
[ "def", "bk_dark", "(", "cls", ")", ":", "wAttributes", "=", "cls", ".", "_get_text_attributes", "(", ")", "wAttributes", "&=", "~", "win32", ".", "BACKGROUND_INTENSITY", "cls", ".", "_set_text_attributes", "(", "wAttributes", ")" ]
Make the current background color dark.
[ "Make", "the", "current", "background", "color", "dark", "." ]
ed9c4307662a5593b8a7f1f3389ecd0e79b8c503
https://github.com/fabioz/PyDev.Debugger/blob/ed9c4307662a5593b8a7f1f3389ecd0e79b8c503/pydevd_attach_to_process/winappdbg/textio.py#L1025-L1029
train
209,559
fabioz/PyDev.Debugger
pydevd_attach_to_process/winappdbg/textio.py
Color.bk_black
def bk_black(cls): "Make the text background color black." wAttributes = cls._get_text_attributes() wAttributes &= ~win32.BACKGROUND_MASK #wAttributes |= win32.BACKGROUND_BLACK cls._set_text_attributes(wAttributes)
python
def bk_black(cls): "Make the text background color black." wAttributes = cls._get_text_attributes() wAttributes &= ~win32.BACKGROUND_MASK #wAttributes |= win32.BACKGROUND_BLACK cls._set_text_attributes(wAttributes)
[ "def", "bk_black", "(", "cls", ")", ":", "wAttributes", "=", "cls", ".", "_get_text_attributes", "(", ")", "wAttributes", "&=", "~", "win32", ".", "BACKGROUND_MASK", "#wAttributes |= win32.BACKGROUND_BLACK", "cls", ".", "_set_text_attributes", "(", "wAttributes", ")...
Make the text background color black.
[ "Make", "the", "text", "background", "color", "black", "." ]
ed9c4307662a5593b8a7f1f3389ecd0e79b8c503
https://github.com/fabioz/PyDev.Debugger/blob/ed9c4307662a5593b8a7f1f3389ecd0e79b8c503/pydevd_attach_to_process/winappdbg/textio.py#L1032-L1037
train
209,560
fabioz/PyDev.Debugger
pydevd_attach_to_process/winappdbg/textio.py
Color.bk_white
def bk_white(cls): "Make the text background color white." wAttributes = cls._get_text_attributes() wAttributes &= ~win32.BACKGROUND_MASK wAttributes |= win32.BACKGROUND_GREY cls._set_text_attributes(wAttributes)
python
def bk_white(cls): "Make the text background color white." wAttributes = cls._get_text_attributes() wAttributes &= ~win32.BACKGROUND_MASK wAttributes |= win32.BACKGROUND_GREY cls._set_text_attributes(wAttributes)
[ "def", "bk_white", "(", "cls", ")", ":", "wAttributes", "=", "cls", ".", "_get_text_attributes", "(", ")", "wAttributes", "&=", "~", "win32", ".", "BACKGROUND_MASK", "wAttributes", "|=", "win32", ".", "BACKGROUND_GREY", "cls", ".", "_set_text_attributes", "(", ...
Make the text background color white.
[ "Make", "the", "text", "background", "color", "white", "." ]
ed9c4307662a5593b8a7f1f3389ecd0e79b8c503
https://github.com/fabioz/PyDev.Debugger/blob/ed9c4307662a5593b8a7f1f3389ecd0e79b8c503/pydevd_attach_to_process/winappdbg/textio.py#L1040-L1045
train
209,561
fabioz/PyDev.Debugger
pydevd_attach_to_process/winappdbg/textio.py
Color.bk_red
def bk_red(cls): "Make the text background color red." wAttributes = cls._get_text_attributes() wAttributes &= ~win32.BACKGROUND_MASK wAttributes |= win32.BACKGROUND_RED cls._set_text_attributes(wAttributes)
python
def bk_red(cls): "Make the text background color red." wAttributes = cls._get_text_attributes() wAttributes &= ~win32.BACKGROUND_MASK wAttributes |= win32.BACKGROUND_RED cls._set_text_attributes(wAttributes)
[ "def", "bk_red", "(", "cls", ")", ":", "wAttributes", "=", "cls", ".", "_get_text_attributes", "(", ")", "wAttributes", "&=", "~", "win32", ".", "BACKGROUND_MASK", "wAttributes", "|=", "win32", ".", "BACKGROUND_RED", "cls", ".", "_set_text_attributes", "(", "w...
Make the text background color red.
[ "Make", "the", "text", "background", "color", "red", "." ]
ed9c4307662a5593b8a7f1f3389ecd0e79b8c503
https://github.com/fabioz/PyDev.Debugger/blob/ed9c4307662a5593b8a7f1f3389ecd0e79b8c503/pydevd_attach_to_process/winappdbg/textio.py#L1048-L1053
train
209,562
fabioz/PyDev.Debugger
pydevd_attach_to_process/winappdbg/textio.py
Color.bk_green
def bk_green(cls): "Make the text background color green." wAttributes = cls._get_text_attributes() wAttributes &= ~win32.BACKGROUND_MASK wAttributes |= win32.BACKGROUND_GREEN cls._set_text_attributes(wAttributes)
python
def bk_green(cls): "Make the text background color green." wAttributes = cls._get_text_attributes() wAttributes &= ~win32.BACKGROUND_MASK wAttributes |= win32.BACKGROUND_GREEN cls._set_text_attributes(wAttributes)
[ "def", "bk_green", "(", "cls", ")", ":", "wAttributes", "=", "cls", ".", "_get_text_attributes", "(", ")", "wAttributes", "&=", "~", "win32", ".", "BACKGROUND_MASK", "wAttributes", "|=", "win32", ".", "BACKGROUND_GREEN", "cls", ".", "_set_text_attributes", "(", ...
Make the text background color green.
[ "Make", "the", "text", "background", "color", "green", "." ]
ed9c4307662a5593b8a7f1f3389ecd0e79b8c503
https://github.com/fabioz/PyDev.Debugger/blob/ed9c4307662a5593b8a7f1f3389ecd0e79b8c503/pydevd_attach_to_process/winappdbg/textio.py#L1056-L1061
train
209,563
fabioz/PyDev.Debugger
pydevd_attach_to_process/winappdbg/textio.py
Color.bk_blue
def bk_blue(cls): "Make the text background color blue." wAttributes = cls._get_text_attributes() wAttributes &= ~win32.BACKGROUND_MASK wAttributes |= win32.BACKGROUND_BLUE cls._set_text_attributes(wAttributes)
python
def bk_blue(cls): "Make the text background color blue." wAttributes = cls._get_text_attributes() wAttributes &= ~win32.BACKGROUND_MASK wAttributes |= win32.BACKGROUND_BLUE cls._set_text_attributes(wAttributes)
[ "def", "bk_blue", "(", "cls", ")", ":", "wAttributes", "=", "cls", ".", "_get_text_attributes", "(", ")", "wAttributes", "&=", "~", "win32", ".", "BACKGROUND_MASK", "wAttributes", "|=", "win32", ".", "BACKGROUND_BLUE", "cls", ".", "_set_text_attributes", "(", ...
Make the text background color blue.
[ "Make", "the", "text", "background", "color", "blue", "." ]
ed9c4307662a5593b8a7f1f3389ecd0e79b8c503
https://github.com/fabioz/PyDev.Debugger/blob/ed9c4307662a5593b8a7f1f3389ecd0e79b8c503/pydevd_attach_to_process/winappdbg/textio.py#L1064-L1069
train
209,564
fabioz/PyDev.Debugger
pydevd_attach_to_process/winappdbg/textio.py
Color.bk_cyan
def bk_cyan(cls): "Make the text background color cyan." wAttributes = cls._get_text_attributes() wAttributes &= ~win32.BACKGROUND_MASK wAttributes |= win32.BACKGROUND_CYAN cls._set_text_attributes(wAttributes)
python
def bk_cyan(cls): "Make the text background color cyan." wAttributes = cls._get_text_attributes() wAttributes &= ~win32.BACKGROUND_MASK wAttributes |= win32.BACKGROUND_CYAN cls._set_text_attributes(wAttributes)
[ "def", "bk_cyan", "(", "cls", ")", ":", "wAttributes", "=", "cls", ".", "_get_text_attributes", "(", ")", "wAttributes", "&=", "~", "win32", ".", "BACKGROUND_MASK", "wAttributes", "|=", "win32", ".", "BACKGROUND_CYAN", "cls", ".", "_set_text_attributes", "(", ...
Make the text background color cyan.
[ "Make", "the", "text", "background", "color", "cyan", "." ]
ed9c4307662a5593b8a7f1f3389ecd0e79b8c503
https://github.com/fabioz/PyDev.Debugger/blob/ed9c4307662a5593b8a7f1f3389ecd0e79b8c503/pydevd_attach_to_process/winappdbg/textio.py#L1072-L1077
train
209,565
fabioz/PyDev.Debugger
pydevd_attach_to_process/winappdbg/textio.py
Color.bk_magenta
def bk_magenta(cls): "Make the text background color magenta." wAttributes = cls._get_text_attributes() wAttributes &= ~win32.BACKGROUND_MASK wAttributes |= win32.BACKGROUND_MAGENTA cls._set_text_attributes(wAttributes)
python
def bk_magenta(cls): "Make the text background color magenta." wAttributes = cls._get_text_attributes() wAttributes &= ~win32.BACKGROUND_MASK wAttributes |= win32.BACKGROUND_MAGENTA cls._set_text_attributes(wAttributes)
[ "def", "bk_magenta", "(", "cls", ")", ":", "wAttributes", "=", "cls", ".", "_get_text_attributes", "(", ")", "wAttributes", "&=", "~", "win32", ".", "BACKGROUND_MASK", "wAttributes", "|=", "win32", ".", "BACKGROUND_MAGENTA", "cls", ".", "_set_text_attributes", "...
Make the text background color magenta.
[ "Make", "the", "text", "background", "color", "magenta", "." ]
ed9c4307662a5593b8a7f1f3389ecd0e79b8c503
https://github.com/fabioz/PyDev.Debugger/blob/ed9c4307662a5593b8a7f1f3389ecd0e79b8c503/pydevd_attach_to_process/winappdbg/textio.py#L1080-L1085
train
209,566
fabioz/PyDev.Debugger
pydevd_attach_to_process/winappdbg/textio.py
Color.bk_yellow
def bk_yellow(cls): "Make the text background color yellow." wAttributes = cls._get_text_attributes() wAttributes &= ~win32.BACKGROUND_MASK wAttributes |= win32.BACKGROUND_YELLOW cls._set_text_attributes(wAttributes)
python
def bk_yellow(cls): "Make the text background color yellow." wAttributes = cls._get_text_attributes() wAttributes &= ~win32.BACKGROUND_MASK wAttributes |= win32.BACKGROUND_YELLOW cls._set_text_attributes(wAttributes)
[ "def", "bk_yellow", "(", "cls", ")", ":", "wAttributes", "=", "cls", ".", "_get_text_attributes", "(", ")", "wAttributes", "&=", "~", "win32", ".", "BACKGROUND_MASK", "wAttributes", "|=", "win32", ".", "BACKGROUND_YELLOW", "cls", ".", "_set_text_attributes", "("...
Make the text background color yellow.
[ "Make", "the", "text", "background", "color", "yellow", "." ]
ed9c4307662a5593b8a7f1f3389ecd0e79b8c503
https://github.com/fabioz/PyDev.Debugger/blob/ed9c4307662a5593b8a7f1f3389ecd0e79b8c503/pydevd_attach_to_process/winappdbg/textio.py#L1088-L1093
train
209,567
fabioz/PyDev.Debugger
pydevd_attach_to_process/winappdbg/textio.py
Table.addRow
def addRow(self, *row): """ Add a row to the table. All items are converted to strings. @type row: tuple @keyword row: Each argument is a cell in the table. """ row = [ str(item) for item in row ] len_row = [ len(item) for item in row ] width = self.__width len_old = len(width) len_new = len(row) known = min(len_old, len_new) missing = len_new - len_old if missing > 0: width.extend( len_row[ -missing : ] ) elif missing < 0: len_row.extend( [0] * (-missing) ) self.__width = [ max( width[i], len_row[i] ) for i in compat.xrange(len(len_row)) ] self.__cols.append(row)
python
def addRow(self, *row): """ Add a row to the table. All items are converted to strings. @type row: tuple @keyword row: Each argument is a cell in the table. """ row = [ str(item) for item in row ] len_row = [ len(item) for item in row ] width = self.__width len_old = len(width) len_new = len(row) known = min(len_old, len_new) missing = len_new - len_old if missing > 0: width.extend( len_row[ -missing : ] ) elif missing < 0: len_row.extend( [0] * (-missing) ) self.__width = [ max( width[i], len_row[i] ) for i in compat.xrange(len(len_row)) ] self.__cols.append(row)
[ "def", "addRow", "(", "self", ",", "*", "row", ")", ":", "row", "=", "[", "str", "(", "item", ")", "for", "item", "in", "row", "]", "len_row", "=", "[", "len", "(", "item", ")", "for", "item", "in", "row", "]", "width", "=", "self", ".", "__w...
Add a row to the table. All items are converted to strings. @type row: tuple @keyword row: Each argument is a cell in the table.
[ "Add", "a", "row", "to", "the", "table", ".", "All", "items", "are", "converted", "to", "strings", "." ]
ed9c4307662a5593b8a7f1f3389ecd0e79b8c503
https://github.com/fabioz/PyDev.Debugger/blob/ed9c4307662a5593b8a7f1f3389ecd0e79b8c503/pydevd_attach_to_process/winappdbg/textio.py#L1114-L1133
train
209,568
fabioz/PyDev.Debugger
pydevd_attach_to_process/winappdbg/textio.py
Table.justify
def justify(self, column, direction): """ Make the text in a column left or right justified. @type column: int @param column: Index of the column. @type direction: int @param direction: C{-1} to justify left, C{1} to justify right. @raise IndexError: Bad column index. @raise ValueError: Bad direction value. """ if direction == -1: self.__width[column] = abs(self.__width[column]) elif direction == 1: self.__width[column] = - abs(self.__width[column]) else: raise ValueError("Bad direction value.")
python
def justify(self, column, direction): """ Make the text in a column left or right justified. @type column: int @param column: Index of the column. @type direction: int @param direction: C{-1} to justify left, C{1} to justify right. @raise IndexError: Bad column index. @raise ValueError: Bad direction value. """ if direction == -1: self.__width[column] = abs(self.__width[column]) elif direction == 1: self.__width[column] = - abs(self.__width[column]) else: raise ValueError("Bad direction value.")
[ "def", "justify", "(", "self", ",", "column", ",", "direction", ")", ":", "if", "direction", "==", "-", "1", ":", "self", ".", "__width", "[", "column", "]", "=", "abs", "(", "self", ".", "__width", "[", "column", "]", ")", "elif", "direction", "==...
Make the text in a column left or right justified. @type column: int @param column: Index of the column. @type direction: int @param direction: C{-1} to justify left, C{1} to justify right. @raise IndexError: Bad column index. @raise ValueError: Bad direction value.
[ "Make", "the", "text", "in", "a", "column", "left", "or", "right", "justified", "." ]
ed9c4307662a5593b8a7f1f3389ecd0e79b8c503
https://github.com/fabioz/PyDev.Debugger/blob/ed9c4307662a5593b8a7f1f3389ecd0e79b8c503/pydevd_attach_to_process/winappdbg/textio.py#L1135-L1155
train
209,569
fabioz/PyDev.Debugger
pydevd_attach_to_process/winappdbg/textio.py
Table.getWidth
def getWidth(self): """ Get the width of the text output for the table. @rtype: int @return: Width in characters for the text output, including the newline character. """ width = 0 if self.__width: width = sum( abs(x) for x in self.__width ) width = width + len(self.__width) * len(self.__sep) + 1 return width
python
def getWidth(self): """ Get the width of the text output for the table. @rtype: int @return: Width in characters for the text output, including the newline character. """ width = 0 if self.__width: width = sum( abs(x) for x in self.__width ) width = width + len(self.__width) * len(self.__sep) + 1 return width
[ "def", "getWidth", "(", "self", ")", ":", "width", "=", "0", "if", "self", ".", "__width", ":", "width", "=", "sum", "(", "abs", "(", "x", ")", "for", "x", "in", "self", ".", "__width", ")", "width", "=", "width", "+", "len", "(", "self", ".", ...
Get the width of the text output for the table. @rtype: int @return: Width in characters for the text output, including the newline character.
[ "Get", "the", "width", "of", "the", "text", "output", "for", "the", "table", "." ]
ed9c4307662a5593b8a7f1f3389ecd0e79b8c503
https://github.com/fabioz/PyDev.Debugger/blob/ed9c4307662a5593b8a7f1f3389ecd0e79b8c503/pydevd_attach_to_process/winappdbg/textio.py#L1157-L1169
train
209,570
fabioz/PyDev.Debugger
pydevd_attach_to_process/winappdbg/textio.py
Table.yieldOutput
def yieldOutput(self): """ Generate the text output for the table. @rtype: generator of str @return: Text output. """ width = self.__width if width: num_cols = len(width) fmt = ['%%%ds' % -w for w in width] if width[-1] > 0: fmt[-1] = '%s' fmt = self.__sep.join(fmt) for row in self.__cols: row.extend( [''] * (num_cols - len(row)) ) yield fmt % tuple(row)
python
def yieldOutput(self): """ Generate the text output for the table. @rtype: generator of str @return: Text output. """ width = self.__width if width: num_cols = len(width) fmt = ['%%%ds' % -w for w in width] if width[-1] > 0: fmt[-1] = '%s' fmt = self.__sep.join(fmt) for row in self.__cols: row.extend( [''] * (num_cols - len(row)) ) yield fmt % tuple(row)
[ "def", "yieldOutput", "(", "self", ")", ":", "width", "=", "self", ".", "__width", "if", "width", ":", "num_cols", "=", "len", "(", "width", ")", "fmt", "=", "[", "'%%%ds'", "%", "-", "w", "for", "w", "in", "width", "]", "if", "width", "[", "-", ...
Generate the text output for the table. @rtype: generator of str @return: Text output.
[ "Generate", "the", "text", "output", "for", "the", "table", "." ]
ed9c4307662a5593b8a7f1f3389ecd0e79b8c503
https://github.com/fabioz/PyDev.Debugger/blob/ed9c4307662a5593b8a7f1f3389ecd0e79b8c503/pydevd_attach_to_process/winappdbg/textio.py#L1180-L1196
train
209,571
fabioz/PyDev.Debugger
pydevd_attach_to_process/winappdbg/textio.py
CrashDump.dump_registers_peek
def dump_registers_peek(registers, data, separator = ' ', width = 16): """ Dump data pointed to by the given registers, if any. @type registers: dict( str S{->} int ) @param registers: Dictionary mapping register names to their values. This value is returned by L{Thread.get_context}. @type data: dict( str S{->} str ) @param data: Dictionary mapping register names to the data they point to. This value is returned by L{Thread.peek_pointers_in_registers}. @rtype: str @return: Text suitable for logging. """ if None in (registers, data): return '' names = compat.keys(data) names.sort() result = '' for reg_name in names: tag = reg_name.lower() dumped = HexDump.hexline(data[reg_name], separator, width) result += '%s -> %s\n' % (tag, dumped) return result
python
def dump_registers_peek(registers, data, separator = ' ', width = 16): """ Dump data pointed to by the given registers, if any. @type registers: dict( str S{->} int ) @param registers: Dictionary mapping register names to their values. This value is returned by L{Thread.get_context}. @type data: dict( str S{->} str ) @param data: Dictionary mapping register names to the data they point to. This value is returned by L{Thread.peek_pointers_in_registers}. @rtype: str @return: Text suitable for logging. """ if None in (registers, data): return '' names = compat.keys(data) names.sort() result = '' for reg_name in names: tag = reg_name.lower() dumped = HexDump.hexline(data[reg_name], separator, width) result += '%s -> %s\n' % (tag, dumped) return result
[ "def", "dump_registers_peek", "(", "registers", ",", "data", ",", "separator", "=", "' '", ",", "width", "=", "16", ")", ":", "if", "None", "in", "(", "registers", ",", "data", ")", ":", "return", "''", "names", "=", "compat", ".", "keys", "(", "data...
Dump data pointed to by the given registers, if any. @type registers: dict( str S{->} int ) @param registers: Dictionary mapping register names to their values. This value is returned by L{Thread.get_context}. @type data: dict( str S{->} str ) @param data: Dictionary mapping register names to the data they point to. This value is returned by L{Thread.peek_pointers_in_registers}. @rtype: str @return: Text suitable for logging.
[ "Dump", "data", "pointed", "to", "by", "the", "given", "registers", "if", "any", "." ]
ed9c4307662a5593b8a7f1f3389ecd0e79b8c503
https://github.com/fabioz/PyDev.Debugger/blob/ed9c4307662a5593b8a7f1f3389ecd0e79b8c503/pydevd_attach_to_process/winappdbg/textio.py#L1331-L1355
train
209,572
fabioz/PyDev.Debugger
pydevd_attach_to_process/winappdbg/textio.py
CrashDump.dump_data_peek
def dump_data_peek(data, base = 0, separator = ' ', width = 16, bits = None): """ Dump data from pointers guessed within the given binary data. @type data: str @param data: Dictionary mapping offsets to the data they point to. @type base: int @param base: Base offset. @type bits: int @param bits: (Optional) Number of bits of the target architecture. The default is platform dependent. See: L{HexDump.address_size} @rtype: str @return: Text suitable for logging. """ if data is None: return '' pointers = compat.keys(data) pointers.sort() result = '' for offset in pointers: dumped = HexDump.hexline(data[offset], separator, width) address = HexDump.address(base + offset, bits) result += '%s -> %s\n' % (address, dumped) return result
python
def dump_data_peek(data, base = 0, separator = ' ', width = 16, bits = None): """ Dump data from pointers guessed within the given binary data. @type data: str @param data: Dictionary mapping offsets to the data they point to. @type base: int @param base: Base offset. @type bits: int @param bits: (Optional) Number of bits of the target architecture. The default is platform dependent. See: L{HexDump.address_size} @rtype: str @return: Text suitable for logging. """ if data is None: return '' pointers = compat.keys(data) pointers.sort() result = '' for offset in pointers: dumped = HexDump.hexline(data[offset], separator, width) address = HexDump.address(base + offset, bits) result += '%s -> %s\n' % (address, dumped) return result
[ "def", "dump_data_peek", "(", "data", ",", "base", "=", "0", ",", "separator", "=", "' '", ",", "width", "=", "16", ",", "bits", "=", "None", ")", ":", "if", "data", "is", "None", ":", "return", "''", "pointers", "=", "compat", ".", "keys", "(", ...
Dump data from pointers guessed within the given binary data. @type data: str @param data: Dictionary mapping offsets to the data they point to. @type base: int @param base: Base offset. @type bits: int @param bits: (Optional) Number of bits of the target architecture. The default is platform dependent. See: L{HexDump.address_size} @rtype: str @return: Text suitable for logging.
[ "Dump", "data", "from", "pointers", "guessed", "within", "the", "given", "binary", "data", "." ]
ed9c4307662a5593b8a7f1f3389ecd0e79b8c503
https://github.com/fabioz/PyDev.Debugger/blob/ed9c4307662a5593b8a7f1f3389ecd0e79b8c503/pydevd_attach_to_process/winappdbg/textio.py#L1358-L1388
train
209,573
fabioz/PyDev.Debugger
pydevd_attach_to_process/winappdbg/textio.py
CrashDump.dump_stack_peek
def dump_stack_peek(data, separator = ' ', width = 16, arch = None): """ Dump data from pointers guessed within the given stack dump. @type data: str @param data: Dictionary mapping stack offsets to the data they point to. @type separator: str @param separator: Separator between the hexadecimal representation of each character. @type width: int @param width: (Optional) Maximum number of characters to convert per text line. This value is also used for padding. @type arch: str @param arch: Architecture of the machine whose registers were dumped. Defaults to the current architecture. @rtype: str @return: Text suitable for logging. """ if data is None: return '' if arch is None: arch = win32.arch pointers = compat.keys(data) pointers.sort() result = '' if pointers: if arch == win32.ARCH_I386: spreg = 'esp' elif arch == win32.ARCH_AMD64: spreg = 'rsp' else: spreg = 'STACK' # just a generic tag tag_fmt = '[%s+0x%%.%dx]' % (spreg, len( '%x' % pointers[-1] ) ) for offset in pointers: dumped = HexDump.hexline(data[offset], separator, width) tag = tag_fmt % offset result += '%s -> %s\n' % (tag, dumped) return result
python
def dump_stack_peek(data, separator = ' ', width = 16, arch = None): """ Dump data from pointers guessed within the given stack dump. @type data: str @param data: Dictionary mapping stack offsets to the data they point to. @type separator: str @param separator: Separator between the hexadecimal representation of each character. @type width: int @param width: (Optional) Maximum number of characters to convert per text line. This value is also used for padding. @type arch: str @param arch: Architecture of the machine whose registers were dumped. Defaults to the current architecture. @rtype: str @return: Text suitable for logging. """ if data is None: return '' if arch is None: arch = win32.arch pointers = compat.keys(data) pointers.sort() result = '' if pointers: if arch == win32.ARCH_I386: spreg = 'esp' elif arch == win32.ARCH_AMD64: spreg = 'rsp' else: spreg = 'STACK' # just a generic tag tag_fmt = '[%s+0x%%.%dx]' % (spreg, len( '%x' % pointers[-1] ) ) for offset in pointers: dumped = HexDump.hexline(data[offset], separator, width) tag = tag_fmt % offset result += '%s -> %s\n' % (tag, dumped) return result
[ "def", "dump_stack_peek", "(", "data", ",", "separator", "=", "' '", ",", "width", "=", "16", ",", "arch", "=", "None", ")", ":", "if", "data", "is", "None", ":", "return", "''", "if", "arch", "is", "None", ":", "arch", "=", "win32", ".", "arch", ...
Dump data from pointers guessed within the given stack dump. @type data: str @param data: Dictionary mapping stack offsets to the data they point to. @type separator: str @param separator: Separator between the hexadecimal representation of each character. @type width: int @param width: (Optional) Maximum number of characters to convert per text line. This value is also used for padding. @type arch: str @param arch: Architecture of the machine whose registers were dumped. Defaults to the current architecture. @rtype: str @return: Text suitable for logging.
[ "Dump", "data", "from", "pointers", "guessed", "within", "the", "given", "stack", "dump", "." ]
ed9c4307662a5593b8a7f1f3389ecd0e79b8c503
https://github.com/fabioz/PyDev.Debugger/blob/ed9c4307662a5593b8a7f1f3389ecd0e79b8c503/pydevd_attach_to_process/winappdbg/textio.py#L1391-L1433
train
209,574
fabioz/PyDev.Debugger
pydevd_attach_to_process/winappdbg/textio.py
CrashDump.dump_code
def dump_code(disassembly, pc = None, bLowercase = True, bits = None): """ Dump a disassembly. Optionally mark where the program counter is. @type disassembly: list of tuple( int, int, str, str ) @param disassembly: Disassembly dump as returned by L{Process.disassemble} or L{Thread.disassemble_around_pc}. @type pc: int @param pc: (Optional) Program counter. @type bLowercase: bool @param bLowercase: (Optional) If C{True} convert the code to lowercase. @type bits: int @param bits: (Optional) Number of bits of the target architecture. The default is platform dependent. See: L{HexDump.address_size} @rtype: str @return: Text suitable for logging. """ if not disassembly: return '' table = Table(sep = ' | ') for (addr, size, code, dump) in disassembly: if bLowercase: code = code.lower() if addr == pc: addr = ' * %s' % HexDump.address(addr, bits) else: addr = ' %s' % HexDump.address(addr, bits) table.addRow(addr, dump, code) table.justify(1, 1) return table.getOutput()
python
def dump_code(disassembly, pc = None, bLowercase = True, bits = None): """ Dump a disassembly. Optionally mark where the program counter is. @type disassembly: list of tuple( int, int, str, str ) @param disassembly: Disassembly dump as returned by L{Process.disassemble} or L{Thread.disassemble_around_pc}. @type pc: int @param pc: (Optional) Program counter. @type bLowercase: bool @param bLowercase: (Optional) If C{True} convert the code to lowercase. @type bits: int @param bits: (Optional) Number of bits of the target architecture. The default is platform dependent. See: L{HexDump.address_size} @rtype: str @return: Text suitable for logging. """ if not disassembly: return '' table = Table(sep = ' | ') for (addr, size, code, dump) in disassembly: if bLowercase: code = code.lower() if addr == pc: addr = ' * %s' % HexDump.address(addr, bits) else: addr = ' %s' % HexDump.address(addr, bits) table.addRow(addr, dump, code) table.justify(1, 1) return table.getOutput()
[ "def", "dump_code", "(", "disassembly", ",", "pc", "=", "None", ",", "bLowercase", "=", "True", ",", "bits", "=", "None", ")", ":", "if", "not", "disassembly", ":", "return", "''", "table", "=", "Table", "(", "sep", "=", "' | '", ")", "for", "(", "...
Dump a disassembly. Optionally mark where the program counter is. @type disassembly: list of tuple( int, int, str, str ) @param disassembly: Disassembly dump as returned by L{Process.disassemble} or L{Thread.disassemble_around_pc}. @type pc: int @param pc: (Optional) Program counter. @type bLowercase: bool @param bLowercase: (Optional) If C{True} convert the code to lowercase. @type bits: int @param bits: (Optional) Number of bits of the target architecture. The default is platform dependent. See: L{HexDump.address_size} @rtype: str @return: Text suitable for logging.
[ "Dump", "a", "disassembly", ".", "Optionally", "mark", "where", "the", "program", "counter", "is", "." ]
ed9c4307662a5593b8a7f1f3389ecd0e79b8c503
https://github.com/fabioz/PyDev.Debugger/blob/ed9c4307662a5593b8a7f1f3389ecd0e79b8c503/pydevd_attach_to_process/winappdbg/textio.py#L1496-L1532
train
209,575
fabioz/PyDev.Debugger
pydevd_attach_to_process/winappdbg/textio.py
CrashDump.dump_memory_map
def dump_memory_map(memoryMap, mappedFilenames = None, bits = None): """ Dump the memory map of a process. Optionally show the filenames for memory mapped files as well. @type memoryMap: list( L{win32.MemoryBasicInformation} ) @param memoryMap: Memory map returned by L{Process.get_memory_map}. @type mappedFilenames: dict( int S{->} str ) @param mappedFilenames: (Optional) Memory mapped filenames returned by L{Process.get_mapped_filenames}. @type bits: int @param bits: (Optional) Number of bits of the target architecture. The default is platform dependent. See: L{HexDump.address_size} @rtype: str @return: Text suitable for logging. """ if not memoryMap: return '' table = Table() if mappedFilenames: table.addRow("Address", "Size", "State", "Access", "Type", "File") else: table.addRow("Address", "Size", "State", "Access", "Type") # For each memory block in the map... for mbi in memoryMap: # Address and size of memory block. BaseAddress = HexDump.address(mbi.BaseAddress, bits) RegionSize = HexDump.address(mbi.RegionSize, bits) # State (free or allocated). mbiState = mbi.State if mbiState == win32.MEM_RESERVE: State = "Reserved" elif mbiState == win32.MEM_COMMIT: State = "Commited" elif mbiState == win32.MEM_FREE: State = "Free" else: State = "Unknown" # Page protection bits (R/W/X/G). if mbiState != win32.MEM_COMMIT: Protect = "" else: mbiProtect = mbi.Protect if mbiProtect & win32.PAGE_NOACCESS: Protect = "--- " elif mbiProtect & win32.PAGE_READONLY: Protect = "R-- " elif mbiProtect & win32.PAGE_READWRITE: Protect = "RW- " elif mbiProtect & win32.PAGE_WRITECOPY: Protect = "RC- " elif mbiProtect & win32.PAGE_EXECUTE: Protect = "--X " elif mbiProtect & win32.PAGE_EXECUTE_READ: Protect = "R-X " elif mbiProtect & win32.PAGE_EXECUTE_READWRITE: Protect = "RWX " elif mbiProtect & win32.PAGE_EXECUTE_WRITECOPY: Protect = "RCX " else: Protect = "??? " if mbiProtect & win32.PAGE_GUARD: Protect += "G" else: Protect += "-" if mbiProtect & win32.PAGE_NOCACHE: Protect += "N" else: Protect += "-" if mbiProtect & win32.PAGE_WRITECOMBINE: Protect += "W" else: Protect += "-" # Type (file mapping, executable image, or private memory). mbiType = mbi.Type if mbiType == win32.MEM_IMAGE: Type = "Image" elif mbiType == win32.MEM_MAPPED: Type = "Mapped" elif mbiType == win32.MEM_PRIVATE: Type = "Private" elif mbiType == 0: Type = "" else: Type = "Unknown" # Output a row in the table. if mappedFilenames: FileName = mappedFilenames.get(mbi.BaseAddress, '') table.addRow( BaseAddress, RegionSize, State, Protect, Type, FileName ) else: table.addRow( BaseAddress, RegionSize, State, Protect, Type ) # Return the table output. return table.getOutput()
python
def dump_memory_map(memoryMap, mappedFilenames = None, bits = None): """ Dump the memory map of a process. Optionally show the filenames for memory mapped files as well. @type memoryMap: list( L{win32.MemoryBasicInformation} ) @param memoryMap: Memory map returned by L{Process.get_memory_map}. @type mappedFilenames: dict( int S{->} str ) @param mappedFilenames: (Optional) Memory mapped filenames returned by L{Process.get_mapped_filenames}. @type bits: int @param bits: (Optional) Number of bits of the target architecture. The default is platform dependent. See: L{HexDump.address_size} @rtype: str @return: Text suitable for logging. """ if not memoryMap: return '' table = Table() if mappedFilenames: table.addRow("Address", "Size", "State", "Access", "Type", "File") else: table.addRow("Address", "Size", "State", "Access", "Type") # For each memory block in the map... for mbi in memoryMap: # Address and size of memory block. BaseAddress = HexDump.address(mbi.BaseAddress, bits) RegionSize = HexDump.address(mbi.RegionSize, bits) # State (free or allocated). mbiState = mbi.State if mbiState == win32.MEM_RESERVE: State = "Reserved" elif mbiState == win32.MEM_COMMIT: State = "Commited" elif mbiState == win32.MEM_FREE: State = "Free" else: State = "Unknown" # Page protection bits (R/W/X/G). if mbiState != win32.MEM_COMMIT: Protect = "" else: mbiProtect = mbi.Protect if mbiProtect & win32.PAGE_NOACCESS: Protect = "--- " elif mbiProtect & win32.PAGE_READONLY: Protect = "R-- " elif mbiProtect & win32.PAGE_READWRITE: Protect = "RW- " elif mbiProtect & win32.PAGE_WRITECOPY: Protect = "RC- " elif mbiProtect & win32.PAGE_EXECUTE: Protect = "--X " elif mbiProtect & win32.PAGE_EXECUTE_READ: Protect = "R-X " elif mbiProtect & win32.PAGE_EXECUTE_READWRITE: Protect = "RWX " elif mbiProtect & win32.PAGE_EXECUTE_WRITECOPY: Protect = "RCX " else: Protect = "??? " if mbiProtect & win32.PAGE_GUARD: Protect += "G" else: Protect += "-" if mbiProtect & win32.PAGE_NOCACHE: Protect += "N" else: Protect += "-" if mbiProtect & win32.PAGE_WRITECOMBINE: Protect += "W" else: Protect += "-" # Type (file mapping, executable image, or private memory). mbiType = mbi.Type if mbiType == win32.MEM_IMAGE: Type = "Image" elif mbiType == win32.MEM_MAPPED: Type = "Mapped" elif mbiType == win32.MEM_PRIVATE: Type = "Private" elif mbiType == 0: Type = "" else: Type = "Unknown" # Output a row in the table. if mappedFilenames: FileName = mappedFilenames.get(mbi.BaseAddress, '') table.addRow( BaseAddress, RegionSize, State, Protect, Type, FileName ) else: table.addRow( BaseAddress, RegionSize, State, Protect, Type ) # Return the table output. return table.getOutput()
[ "def", "dump_memory_map", "(", "memoryMap", ",", "mappedFilenames", "=", "None", ",", "bits", "=", "None", ")", ":", "if", "not", "memoryMap", ":", "return", "''", "table", "=", "Table", "(", ")", "if", "mappedFilenames", ":", "table", ".", "addRow", "("...
Dump the memory map of a process. Optionally show the filenames for memory mapped files as well. @type memoryMap: list( L{win32.MemoryBasicInformation} ) @param memoryMap: Memory map returned by L{Process.get_memory_map}. @type mappedFilenames: dict( int S{->} str ) @param mappedFilenames: (Optional) Memory mapped filenames returned by L{Process.get_mapped_filenames}. @type bits: int @param bits: (Optional) Number of bits of the target architecture. The default is platform dependent. See: L{HexDump.address_size} @rtype: str @return: Text suitable for logging.
[ "Dump", "the", "memory", "map", "of", "a", "process", ".", "Optionally", "show", "the", "filenames", "for", "memory", "mapped", "files", "as", "well", "." ]
ed9c4307662a5593b8a7f1f3389ecd0e79b8c503
https://github.com/fabioz/PyDev.Debugger/blob/ed9c4307662a5593b8a7f1f3389ecd0e79b8c503/pydevd_attach_to_process/winappdbg/textio.py#L1598-L1702
train
209,576
fabioz/PyDev.Debugger
pydevd_attach_to_process/winappdbg/textio.py
DebugLog.log_text
def log_text(text): """ Log lines of text, inserting a timestamp. @type text: str @param text: Text to log. @rtype: str @return: Log line. """ if text.endswith('\n'): text = text[:-len('\n')] #text = text.replace('\n', '\n\t\t') # text CSV ltime = time.strftime("%X") msecs = (time.time() % 1) * 1000 return '[%s.%04d] %s' % (ltime, msecs, text)
python
def log_text(text): """ Log lines of text, inserting a timestamp. @type text: str @param text: Text to log. @rtype: str @return: Log line. """ if text.endswith('\n'): text = text[:-len('\n')] #text = text.replace('\n', '\n\t\t') # text CSV ltime = time.strftime("%X") msecs = (time.time() % 1) * 1000 return '[%s.%04d] %s' % (ltime, msecs, text)
[ "def", "log_text", "(", "text", ")", ":", "if", "text", ".", "endswith", "(", "'\\n'", ")", ":", "text", "=", "text", "[", ":", "-", "len", "(", "'\\n'", ")", "]", "#text = text.replace('\\n', '\\n\\t\\t') # text CSV", "ltime", "=", "time", ".", ...
Log lines of text, inserting a timestamp. @type text: str @param text: Text to log. @rtype: str @return: Log line.
[ "Log", "lines", "of", "text", "inserting", "a", "timestamp", "." ]
ed9c4307662a5593b8a7f1f3389ecd0e79b8c503
https://github.com/fabioz/PyDev.Debugger/blob/ed9c4307662a5593b8a7f1f3389ecd0e79b8c503/pydevd_attach_to_process/winappdbg/textio.py#L1710-L1725
train
209,577
fabioz/PyDev.Debugger
pydevd_attach_to_process/winappdbg/textio.py
Logger.__logfile_error
def __logfile_error(self, e): """ Shows an error message to standard error if the log file can't be written to. Used internally. @type e: Exception @param e: Exception raised when trying to write to the log file. """ from sys import stderr msg = "Warning, error writing log file %s: %s\n" msg = msg % (self.logfile, str(e)) stderr.write(DebugLog.log_text(msg)) self.logfile = None self.fd = None
python
def __logfile_error(self, e): """ Shows an error message to standard error if the log file can't be written to. Used internally. @type e: Exception @param e: Exception raised when trying to write to the log file. """ from sys import stderr msg = "Warning, error writing log file %s: %s\n" msg = msg % (self.logfile, str(e)) stderr.write(DebugLog.log_text(msg)) self.logfile = None self.fd = None
[ "def", "__logfile_error", "(", "self", ",", "e", ")", ":", "from", "sys", "import", "stderr", "msg", "=", "\"Warning, error writing log file %s: %s\\n\"", "msg", "=", "msg", "%", "(", "self", ".", "logfile", ",", "str", "(", "e", ")", ")", "stderr", ".", ...
Shows an error message to standard error if the log file can't be written to. Used internally. @type e: Exception @param e: Exception raised when trying to write to the log file.
[ "Shows", "an", "error", "message", "to", "standard", "error", "if", "the", "log", "file", "can", "t", "be", "written", "to", "." ]
ed9c4307662a5593b8a7f1f3389ecd0e79b8c503
https://github.com/fabioz/PyDev.Debugger/blob/ed9c4307662a5593b8a7f1f3389ecd0e79b8c503/pydevd_attach_to_process/winappdbg/textio.py#L1799-L1814
train
209,578
fabioz/PyDev.Debugger
_pydev_imps/_pydev_SimpleXMLRPCServer.py
SimpleXMLRPCRequestHandler.log_request
def log_request(self, code='-', size='-'): """Selectively log an accepted request.""" if self.server.logRequests: BaseHTTPServer.BaseHTTPRequestHandler.log_request(self, code, size)
python
def log_request(self, code='-', size='-'): """Selectively log an accepted request.""" if self.server.logRequests: BaseHTTPServer.BaseHTTPRequestHandler.log_request(self, code, size)
[ "def", "log_request", "(", "self", ",", "code", "=", "'-'", ",", "size", "=", "'-'", ")", ":", "if", "self", ".", "server", ".", "logRequests", ":", "BaseHTTPServer", ".", "BaseHTTPRequestHandler", ".", "log_request", "(", "self", ",", "code", ",", "size...
Selectively log an accepted request.
[ "Selectively", "log", "an", "accepted", "request", "." ]
ed9c4307662a5593b8a7f1f3389ecd0e79b8c503
https://github.com/fabioz/PyDev.Debugger/blob/ed9c4307662a5593b8a7f1f3389ecd0e79b8c503/_pydev_imps/_pydev_SimpleXMLRPCServer.py#L504-L508
train
209,579
fabioz/PyDev.Debugger
_pydev_bundle/pydev_versioncheck.py
versionok_for_gui
def versionok_for_gui(): ''' Return True if running Python is suitable for GUI Event Integration and deeper IPython integration ''' # We require Python 2.6+ ... if sys.hexversion < 0x02060000: return False # Or Python 3.2+ if sys.hexversion >= 0x03000000 and sys.hexversion < 0x03020000: return False # Not supported under Jython nor IronPython if sys.platform.startswith("java") or sys.platform.startswith('cli'): return False return True
python
def versionok_for_gui(): ''' Return True if running Python is suitable for GUI Event Integration and deeper IPython integration ''' # We require Python 2.6+ ... if sys.hexversion < 0x02060000: return False # Or Python 3.2+ if sys.hexversion >= 0x03000000 and sys.hexversion < 0x03020000: return False # Not supported under Jython nor IronPython if sys.platform.startswith("java") or sys.platform.startswith('cli'): return False return True
[ "def", "versionok_for_gui", "(", ")", ":", "# We require Python 2.6+ ...", "if", "sys", ".", "hexversion", "<", "0x02060000", ":", "return", "False", "# Or Python 3.2+", "if", "sys", ".", "hexversion", ">=", "0x03000000", "and", "sys", ".", "hexversion", "<", "0...
Return True if running Python is suitable for GUI Event Integration and deeper IPython integration
[ "Return", "True", "if", "running", "Python", "is", "suitable", "for", "GUI", "Event", "Integration", "and", "deeper", "IPython", "integration" ]
ed9c4307662a5593b8a7f1f3389ecd0e79b8c503
https://github.com/fabioz/PyDev.Debugger/blob/ed9c4307662a5593b8a7f1f3389ecd0e79b8c503/_pydev_bundle/pydev_versioncheck.py#L3-L15
train
209,580
fabioz/PyDev.Debugger
pydevd_attach_to_process/winappdbg/win32/defines.py
RaiseIfNotErrorSuccess
def RaiseIfNotErrorSuccess(result, func = None, arguments = ()): """ Error checking for Win32 Registry API calls. The function is assumed to return a Win32 error code. If the code is not C{ERROR_SUCCESS} then a C{WindowsError} exception is raised. """ if result != ERROR_SUCCESS: raise ctypes.WinError(result) return result
python
def RaiseIfNotErrorSuccess(result, func = None, arguments = ()): """ Error checking for Win32 Registry API calls. The function is assumed to return a Win32 error code. If the code is not C{ERROR_SUCCESS} then a C{WindowsError} exception is raised. """ if result != ERROR_SUCCESS: raise ctypes.WinError(result) return result
[ "def", "RaiseIfNotErrorSuccess", "(", "result", ",", "func", "=", "None", ",", "arguments", "=", "(", ")", ")", ":", "if", "result", "!=", "ERROR_SUCCESS", ":", "raise", "ctypes", ".", "WinError", "(", "result", ")", "return", "result" ]
Error checking for Win32 Registry API calls. The function is assumed to return a Win32 error code. If the code is not C{ERROR_SUCCESS} then a C{WindowsError} exception is raised.
[ "Error", "checking", "for", "Win32", "Registry", "API", "calls", "." ]
ed9c4307662a5593b8a7f1f3389ecd0e79b8c503
https://github.com/fabioz/PyDev.Debugger/blob/ed9c4307662a5593b8a7f1f3389ecd0e79b8c503/pydevd_attach_to_process/winappdbg/win32/defines.py#L148-L157
train
209,581
fabioz/PyDev.Debugger
pydevd_attach_to_process/winappdbg/plugins/do_example.py
do
def do(self, arg): ".example - This is an example plugin for the command line debugger" print "This is an example command." print "%s.do(%r, %r):" % (__name__, self, arg) print " last event", self.lastEvent print " prefix", self.cmdprefix print " arguments", self.split_tokens(arg)
python
def do(self, arg): ".example - This is an example plugin for the command line debugger" print "This is an example command." print "%s.do(%r, %r):" % (__name__, self, arg) print " last event", self.lastEvent print " prefix", self.cmdprefix print " arguments", self.split_tokens(arg)
[ "def", "do", "(", "self", ",", "arg", ")", ":", "print", "\"This is an example command.\"", "print", "\"%s.do(%r, %r):\"", "%", "(", "__name__", ",", "self", ",", "arg", ")", "print", "\" last event\"", ",", "self", ".", "lastEvent", "print", "\" prefix\"", ...
.example - This is an example plugin for the command line debugger
[ ".", "example", "-", "This", "is", "an", "example", "plugin", "for", "the", "command", "line", "debugger" ]
ed9c4307662a5593b8a7f1f3389ecd0e79b8c503
https://github.com/fabioz/PyDev.Debugger/blob/ed9c4307662a5593b8a7f1f3389ecd0e79b8c503/pydevd_attach_to_process/winappdbg/plugins/do_example.py#L35-L41
train
209,582
fabioz/PyDev.Debugger
pydevd_attach_to_process/winappdbg/thread.py
Thread.set_process
def set_process(self, process = None): """ Manually set the parent Process object. Use with care! @type process: L{Process} @param process: (Optional) Process object. Use C{None} for no process. """ if process is None: self.dwProcessId = None self.__process = None else: self.__load_Process_class() if not isinstance(process, Process): msg = "Parent process must be a Process instance, " msg += "got %s instead" % type(process) raise TypeError(msg) self.dwProcessId = process.get_pid() self.__process = process
python
def set_process(self, process = None): """ Manually set the parent Process object. Use with care! @type process: L{Process} @param process: (Optional) Process object. Use C{None} for no process. """ if process is None: self.dwProcessId = None self.__process = None else: self.__load_Process_class() if not isinstance(process, Process): msg = "Parent process must be a Process instance, " msg += "got %s instead" % type(process) raise TypeError(msg) self.dwProcessId = process.get_pid() self.__process = process
[ "def", "set_process", "(", "self", ",", "process", "=", "None", ")", ":", "if", "process", "is", "None", ":", "self", ".", "dwProcessId", "=", "None", "self", ".", "__process", "=", "None", "else", ":", "self", ".", "__load_Process_class", "(", ")", "i...
Manually set the parent Process object. Use with care! @type process: L{Process} @param process: (Optional) Process object. Use C{None} for no process.
[ "Manually", "set", "the", "parent", "Process", "object", ".", "Use", "with", "care!" ]
ed9c4307662a5593b8a7f1f3389ecd0e79b8c503
https://github.com/fabioz/PyDev.Debugger/blob/ed9c4307662a5593b8a7f1f3389ecd0e79b8c503/pydevd_attach_to_process/winappdbg/thread.py#L183-L200
train
209,583
fabioz/PyDev.Debugger
pydevd_attach_to_process/winappdbg/thread.py
Thread.open_handle
def open_handle(self, dwDesiredAccess = win32.THREAD_ALL_ACCESS): """ Opens a new handle to the thread, closing the previous one. The new handle is stored in the L{hThread} property. @warn: Normally you should call L{get_handle} instead, since it's much "smarter" and tries to reuse handles and merge access rights. @type dwDesiredAccess: int @param dwDesiredAccess: Desired access rights. Defaults to L{win32.THREAD_ALL_ACCESS}. See: U{http://msdn.microsoft.com/en-us/library/windows/desktop/ms686769(v=vs.85).aspx} @raise WindowsError: It's not possible to open a handle to the thread with the requested access rights. This tipically happens because the target thread belongs to system process and the debugger is not runnning with administrative rights. """ hThread = win32.OpenThread(dwDesiredAccess, win32.FALSE, self.dwThreadId) # In case hThread was set to an actual handle value instead of a Handle # object. This shouldn't happen unless the user tinkered with it. if not hasattr(self.hThread, '__del__'): self.close_handle() self.hThread = hThread
python
def open_handle(self, dwDesiredAccess = win32.THREAD_ALL_ACCESS): """ Opens a new handle to the thread, closing the previous one. The new handle is stored in the L{hThread} property. @warn: Normally you should call L{get_handle} instead, since it's much "smarter" and tries to reuse handles and merge access rights. @type dwDesiredAccess: int @param dwDesiredAccess: Desired access rights. Defaults to L{win32.THREAD_ALL_ACCESS}. See: U{http://msdn.microsoft.com/en-us/library/windows/desktop/ms686769(v=vs.85).aspx} @raise WindowsError: It's not possible to open a handle to the thread with the requested access rights. This tipically happens because the target thread belongs to system process and the debugger is not runnning with administrative rights. """ hThread = win32.OpenThread(dwDesiredAccess, win32.FALSE, self.dwThreadId) # In case hThread was set to an actual handle value instead of a Handle # object. This shouldn't happen unless the user tinkered with it. if not hasattr(self.hThread, '__del__'): self.close_handle() self.hThread = hThread
[ "def", "open_handle", "(", "self", ",", "dwDesiredAccess", "=", "win32", ".", "THREAD_ALL_ACCESS", ")", ":", "hThread", "=", "win32", ".", "OpenThread", "(", "dwDesiredAccess", ",", "win32", ".", "FALSE", ",", "self", ".", "dwThreadId", ")", "# In case hThread...
Opens a new handle to the thread, closing the previous one. The new handle is stored in the L{hThread} property. @warn: Normally you should call L{get_handle} instead, since it's much "smarter" and tries to reuse handles and merge access rights. @type dwDesiredAccess: int @param dwDesiredAccess: Desired access rights. Defaults to L{win32.THREAD_ALL_ACCESS}. See: U{http://msdn.microsoft.com/en-us/library/windows/desktop/ms686769(v=vs.85).aspx} @raise WindowsError: It's not possible to open a handle to the thread with the requested access rights. This tipically happens because the target thread belongs to system process and the debugger is not runnning with administrative rights.
[ "Opens", "a", "new", "handle", "to", "the", "thread", "closing", "the", "previous", "one", "." ]
ed9c4307662a5593b8a7f1f3389ecd0e79b8c503
https://github.com/fabioz/PyDev.Debugger/blob/ed9c4307662a5593b8a7f1f3389ecd0e79b8c503/pydevd_attach_to_process/winappdbg/thread.py#L269-L295
train
209,584
fabioz/PyDev.Debugger
pydevd_attach_to_process/winappdbg/thread.py
Thread.close_handle
def close_handle(self): """ Closes the handle to the thread. @note: Normally you don't need to call this method. All handles created by I{WinAppDbg} are automatically closed when the garbage collector claims them. """ try: if hasattr(self.hThread, 'close'): self.hThread.close() elif self.hThread not in (None, win32.INVALID_HANDLE_VALUE): win32.CloseHandle(self.hThread) finally: self.hThread = None
python
def close_handle(self): """ Closes the handle to the thread. @note: Normally you don't need to call this method. All handles created by I{WinAppDbg} are automatically closed when the garbage collector claims them. """ try: if hasattr(self.hThread, 'close'): self.hThread.close() elif self.hThread not in (None, win32.INVALID_HANDLE_VALUE): win32.CloseHandle(self.hThread) finally: self.hThread = None
[ "def", "close_handle", "(", "self", ")", ":", "try", ":", "if", "hasattr", "(", "self", ".", "hThread", ",", "'close'", ")", ":", "self", ".", "hThread", ".", "close", "(", ")", "elif", "self", ".", "hThread", "not", "in", "(", "None", ",", "win32"...
Closes the handle to the thread. @note: Normally you don't need to call this method. All handles created by I{WinAppDbg} are automatically closed when the garbage collector claims them.
[ "Closes", "the", "handle", "to", "the", "thread", "." ]
ed9c4307662a5593b8a7f1f3389ecd0e79b8c503
https://github.com/fabioz/PyDev.Debugger/blob/ed9c4307662a5593b8a7f1f3389ecd0e79b8c503/pydevd_attach_to_process/winappdbg/thread.py#L297-L311
train
209,585
fabioz/PyDev.Debugger
pydevd_attach_to_process/winappdbg/thread.py
Thread.kill
def kill(self, dwExitCode = 0): """ Terminates the thread execution. @note: If the C{lpInjectedMemory} member contains a valid pointer, the memory is freed. @type dwExitCode: int @param dwExitCode: (Optional) Thread exit code. """ hThread = self.get_handle(win32.THREAD_TERMINATE) win32.TerminateThread(hThread, dwExitCode) # Ugliest hack ever, won't work if many pieces of code are injected. # Seriously, what was I thinking? Lame! :( if self.pInjectedMemory is not None: try: self.get_process().free(self.pInjectedMemory) self.pInjectedMemory = None except Exception: ## raise # XXX DEBUG pass
python
def kill(self, dwExitCode = 0): """ Terminates the thread execution. @note: If the C{lpInjectedMemory} member contains a valid pointer, the memory is freed. @type dwExitCode: int @param dwExitCode: (Optional) Thread exit code. """ hThread = self.get_handle(win32.THREAD_TERMINATE) win32.TerminateThread(hThread, dwExitCode) # Ugliest hack ever, won't work if many pieces of code are injected. # Seriously, what was I thinking? Lame! :( if self.pInjectedMemory is not None: try: self.get_process().free(self.pInjectedMemory) self.pInjectedMemory = None except Exception: ## raise # XXX DEBUG pass
[ "def", "kill", "(", "self", ",", "dwExitCode", "=", "0", ")", ":", "hThread", "=", "self", ".", "get_handle", "(", "win32", ".", "THREAD_TERMINATE", ")", "win32", ".", "TerminateThread", "(", "hThread", ",", "dwExitCode", ")", "# Ugliest hack ever, won't work ...
Terminates the thread execution. @note: If the C{lpInjectedMemory} member contains a valid pointer, the memory is freed. @type dwExitCode: int @param dwExitCode: (Optional) Thread exit code.
[ "Terminates", "the", "thread", "execution", "." ]
ed9c4307662a5593b8a7f1f3389ecd0e79b8c503
https://github.com/fabioz/PyDev.Debugger/blob/ed9c4307662a5593b8a7f1f3389ecd0e79b8c503/pydevd_attach_to_process/winappdbg/thread.py#L364-L385
train
209,586
fabioz/PyDev.Debugger
pydevd_attach_to_process/winappdbg/thread.py
Thread.suspend
def suspend(self): """ Suspends the thread execution. @rtype: int @return: Suspend count. If zero, the thread is running. """ hThread = self.get_handle(win32.THREAD_SUSPEND_RESUME) if self.is_wow64(): # FIXME this will be horribly slow on XP 64 # since it'll try to resolve a missing API every time try: return win32.Wow64SuspendThread(hThread) except AttributeError: pass return win32.SuspendThread(hThread)
python
def suspend(self): """ Suspends the thread execution. @rtype: int @return: Suspend count. If zero, the thread is running. """ hThread = self.get_handle(win32.THREAD_SUSPEND_RESUME) if self.is_wow64(): # FIXME this will be horribly slow on XP 64 # since it'll try to resolve a missing API every time try: return win32.Wow64SuspendThread(hThread) except AttributeError: pass return win32.SuspendThread(hThread)
[ "def", "suspend", "(", "self", ")", ":", "hThread", "=", "self", ".", "get_handle", "(", "win32", ".", "THREAD_SUSPEND_RESUME", ")", "if", "self", ".", "is_wow64", "(", ")", ":", "# FIXME this will be horribly slow on XP 64", "# since it'll try to resolve a missing AP...
Suspends the thread execution. @rtype: int @return: Suspend count. If zero, the thread is running.
[ "Suspends", "the", "thread", "execution", "." ]
ed9c4307662a5593b8a7f1f3389ecd0e79b8c503
https://github.com/fabioz/PyDev.Debugger/blob/ed9c4307662a5593b8a7f1f3389ecd0e79b8c503/pydevd_attach_to_process/winappdbg/thread.py#L391-L406
train
209,587
fabioz/PyDev.Debugger
pydevd_attach_to_process/winappdbg/thread.py
Thread.resume
def resume(self): """ Resumes the thread execution. @rtype: int @return: Suspend count. If zero, the thread is running. """ hThread = self.get_handle(win32.THREAD_SUSPEND_RESUME) return win32.ResumeThread(hThread)
python
def resume(self): """ Resumes the thread execution. @rtype: int @return: Suspend count. If zero, the thread is running. """ hThread = self.get_handle(win32.THREAD_SUSPEND_RESUME) return win32.ResumeThread(hThread)
[ "def", "resume", "(", "self", ")", ":", "hThread", "=", "self", ".", "get_handle", "(", "win32", ".", "THREAD_SUSPEND_RESUME", ")", "return", "win32", ".", "ResumeThread", "(", "hThread", ")" ]
Resumes the thread execution. @rtype: int @return: Suspend count. If zero, the thread is running.
[ "Resumes", "the", "thread", "execution", "." ]
ed9c4307662a5593b8a7f1f3389ecd0e79b8c503
https://github.com/fabioz/PyDev.Debugger/blob/ed9c4307662a5593b8a7f1f3389ecd0e79b8c503/pydevd_attach_to_process/winappdbg/thread.py#L408-L416
train
209,588
fabioz/PyDev.Debugger
pydevd_attach_to_process/winappdbg/thread.py
Thread.set_context
def set_context(self, context, bSuspend = False): """ Sets the values of the registers. @see: L{get_context} @type context: dict( str S{->} int ) @param context: Dictionary mapping register names to their values. @type bSuspend: bool @param bSuspend: C{True} to automatically suspend the thread before setting its context, C{False} otherwise. Defaults to C{False} because suspending the thread during some debug events (like thread creation or destruction) may lead to strange errors. Note that WinAppDbg 1.4 used to suspend the thread automatically always. This behavior was changed in version 1.5. """ # Get the thread handle. dwAccess = win32.THREAD_SET_CONTEXT if bSuspend: dwAccess = dwAccess | win32.THREAD_SUSPEND_RESUME hThread = self.get_handle(dwAccess) # Suspend the thread if requested. if bSuspend: self.suspend() # No fix for the exit process event bug. # Setting the context of a dead thread is pointless anyway. # Set the thread context. try: if win32.bits == 64 and self.is_wow64(): win32.Wow64SetThreadContext(hThread, context) else: win32.SetThreadContext(hThread, context) # Resume the thread if we suspended it. finally: if bSuspend: self.resume()
python
def set_context(self, context, bSuspend = False): """ Sets the values of the registers. @see: L{get_context} @type context: dict( str S{->} int ) @param context: Dictionary mapping register names to their values. @type bSuspend: bool @param bSuspend: C{True} to automatically suspend the thread before setting its context, C{False} otherwise. Defaults to C{False} because suspending the thread during some debug events (like thread creation or destruction) may lead to strange errors. Note that WinAppDbg 1.4 used to suspend the thread automatically always. This behavior was changed in version 1.5. """ # Get the thread handle. dwAccess = win32.THREAD_SET_CONTEXT if bSuspend: dwAccess = dwAccess | win32.THREAD_SUSPEND_RESUME hThread = self.get_handle(dwAccess) # Suspend the thread if requested. if bSuspend: self.suspend() # No fix for the exit process event bug. # Setting the context of a dead thread is pointless anyway. # Set the thread context. try: if win32.bits == 64 and self.is_wow64(): win32.Wow64SetThreadContext(hThread, context) else: win32.SetThreadContext(hThread, context) # Resume the thread if we suspended it. finally: if bSuspend: self.resume()
[ "def", "set_context", "(", "self", ",", "context", ",", "bSuspend", "=", "False", ")", ":", "# Get the thread handle.", "dwAccess", "=", "win32", ".", "THREAD_SET_CONTEXT", "if", "bSuspend", ":", "dwAccess", "=", "dwAccess", "|", "win32", ".", "THREAD_SUSPEND_RE...
Sets the values of the registers. @see: L{get_context} @type context: dict( str S{->} int ) @param context: Dictionary mapping register names to their values. @type bSuspend: bool @param bSuspend: C{True} to automatically suspend the thread before setting its context, C{False} otherwise. Defaults to C{False} because suspending the thread during some debug events (like thread creation or destruction) may lead to strange errors. Note that WinAppDbg 1.4 used to suspend the thread automatically always. This behavior was changed in version 1.5.
[ "Sets", "the", "values", "of", "the", "registers", "." ]
ed9c4307662a5593b8a7f1f3389ecd0e79b8c503
https://github.com/fabioz/PyDev.Debugger/blob/ed9c4307662a5593b8a7f1f3389ecd0e79b8c503/pydevd_attach_to_process/winappdbg/thread.py#L564-L607
train
209,589
fabioz/PyDev.Debugger
pydevd_attach_to_process/winappdbg/thread.py
Thread.set_register
def set_register(self, register, value): """ Sets the value of a specific register. @type register: str @param register: Register name. @rtype: int @return: Register value. """ context = self.get_context() context[register] = value self.set_context(context)
python
def set_register(self, register, value): """ Sets the value of a specific register. @type register: str @param register: Register name. @rtype: int @return: Register value. """ context = self.get_context() context[register] = value self.set_context(context)
[ "def", "set_register", "(", "self", ",", "register", ",", "value", ")", ":", "context", "=", "self", ".", "get_context", "(", ")", "context", "[", "register", "]", "=", "value", "self", ".", "set_context", "(", "context", ")" ]
Sets the value of a specific register. @type register: str @param register: Register name. @rtype: int @return: Register value.
[ "Sets", "the", "value", "of", "a", "specific", "register", "." ]
ed9c4307662a5593b8a7f1f3389ecd0e79b8c503
https://github.com/fabioz/PyDev.Debugger/blob/ed9c4307662a5593b8a7f1f3389ecd0e79b8c503/pydevd_attach_to_process/winappdbg/thread.py#L621-L633
train
209,590
fabioz/PyDev.Debugger
pydevd_attach_to_process/winappdbg/thread.py
Thread.is_wow64
def is_wow64(self): """ Determines if the thread is running under WOW64. @rtype: bool @return: C{True} if the thread is running under WOW64. That is, it belongs to a 32-bit application running in a 64-bit Windows. C{False} if the thread belongs to either a 32-bit application running in a 32-bit Windows, or a 64-bit application running in a 64-bit Windows. @raise WindowsError: On error an exception is raised. @see: U{http://msdn.microsoft.com/en-us/library/aa384249(VS.85).aspx} """ try: wow64 = self.__wow64 except AttributeError: if (win32.bits == 32 and not win32.wow64): wow64 = False else: wow64 = self.get_process().is_wow64() self.__wow64 = wow64 return wow64
python
def is_wow64(self): """ Determines if the thread is running under WOW64. @rtype: bool @return: C{True} if the thread is running under WOW64. That is, it belongs to a 32-bit application running in a 64-bit Windows. C{False} if the thread belongs to either a 32-bit application running in a 32-bit Windows, or a 64-bit application running in a 64-bit Windows. @raise WindowsError: On error an exception is raised. @see: U{http://msdn.microsoft.com/en-us/library/aa384249(VS.85).aspx} """ try: wow64 = self.__wow64 except AttributeError: if (win32.bits == 32 and not win32.wow64): wow64 = False else: wow64 = self.get_process().is_wow64() self.__wow64 = wow64 return wow64
[ "def", "is_wow64", "(", "self", ")", ":", "try", ":", "wow64", "=", "self", ".", "__wow64", "except", "AttributeError", ":", "if", "(", "win32", ".", "bits", "==", "32", "and", "not", "win32", ".", "wow64", ")", ":", "wow64", "=", "False", "else", ...
Determines if the thread is running under WOW64. @rtype: bool @return: C{True} if the thread is running under WOW64. That is, it belongs to a 32-bit application running in a 64-bit Windows. C{False} if the thread belongs to either a 32-bit application running in a 32-bit Windows, or a 64-bit application running in a 64-bit Windows. @raise WindowsError: On error an exception is raised. @see: U{http://msdn.microsoft.com/en-us/library/aa384249(VS.85).aspx}
[ "Determines", "if", "the", "thread", "is", "running", "under", "WOW64", "." ]
ed9c4307662a5593b8a7f1f3389ecd0e79b8c503
https://github.com/fabioz/PyDev.Debugger/blob/ed9c4307662a5593b8a7f1f3389ecd0e79b8c503/pydevd_attach_to_process/winappdbg/thread.py#L849-L874
train
209,591
fabioz/PyDev.Debugger
pydevd_attach_to_process/winappdbg/thread.py
Thread.get_teb_address
def get_teb_address(self): """ Returns a remote pointer to the TEB. @rtype: int @return: Remote pointer to the L{TEB} structure. @raise WindowsError: An exception is raised on error. """ try: return self._teb_ptr except AttributeError: try: hThread = self.get_handle(win32.THREAD_QUERY_INFORMATION) tbi = win32.NtQueryInformationThread( hThread, win32.ThreadBasicInformation) address = tbi.TebBaseAddress except WindowsError: address = self.get_linear_address('SegFs', 0) # fs:[0] if not address: raise self._teb_ptr = address return address
python
def get_teb_address(self): """ Returns a remote pointer to the TEB. @rtype: int @return: Remote pointer to the L{TEB} structure. @raise WindowsError: An exception is raised on error. """ try: return self._teb_ptr except AttributeError: try: hThread = self.get_handle(win32.THREAD_QUERY_INFORMATION) tbi = win32.NtQueryInformationThread( hThread, win32.ThreadBasicInformation) address = tbi.TebBaseAddress except WindowsError: address = self.get_linear_address('SegFs', 0) # fs:[0] if not address: raise self._teb_ptr = address return address
[ "def", "get_teb_address", "(", "self", ")", ":", "try", ":", "return", "self", ".", "_teb_ptr", "except", "AttributeError", ":", "try", ":", "hThread", "=", "self", ".", "get_handle", "(", "win32", ".", "THREAD_QUERY_INFORMATION", ")", "tbi", "=", "win32", ...
Returns a remote pointer to the TEB. @rtype: int @return: Remote pointer to the L{TEB} structure. @raise WindowsError: An exception is raised on error.
[ "Returns", "a", "remote", "pointer", "to", "the", "TEB", "." ]
ed9c4307662a5593b8a7f1f3389ecd0e79b8c503
https://github.com/fabioz/PyDev.Debugger/blob/ed9c4307662a5593b8a7f1f3389ecd0e79b8c503/pydevd_attach_to_process/winappdbg/thread.py#L927-L948
train
209,592
fabioz/PyDev.Debugger
pydevd_attach_to_process/winappdbg/thread.py
Thread.get_linear_address
def get_linear_address(self, segment, address): """ Translates segment-relative addresses to linear addresses. Linear addresses can be used to access a process memory, calling L{Process.read} and L{Process.write}. @type segment: str @param segment: Segment register name. @type address: int @param address: Segment relative memory address. @rtype: int @return: Linear memory address. @raise ValueError: Address is too large for selector. @raise WindowsError: The current architecture does not support selectors. Selectors only exist in x86-based systems. """ hThread = self.get_handle(win32.THREAD_QUERY_INFORMATION) selector = self.get_register(segment) ldt = win32.GetThreadSelectorEntry(hThread, selector) BaseLow = ldt.BaseLow BaseMid = ldt.HighWord.Bytes.BaseMid << 16 BaseHi = ldt.HighWord.Bytes.BaseHi << 24 Base = BaseLow | BaseMid | BaseHi LimitLow = ldt.LimitLow LimitHi = ldt.HighWord.Bits.LimitHi << 16 Limit = LimitLow | LimitHi if address > Limit: msg = "Address %s too large for segment %s (selector %d)" msg = msg % (HexDump.address(address, self.get_bits()), segment, selector) raise ValueError(msg) return Base + address
python
def get_linear_address(self, segment, address): """ Translates segment-relative addresses to linear addresses. Linear addresses can be used to access a process memory, calling L{Process.read} and L{Process.write}. @type segment: str @param segment: Segment register name. @type address: int @param address: Segment relative memory address. @rtype: int @return: Linear memory address. @raise ValueError: Address is too large for selector. @raise WindowsError: The current architecture does not support selectors. Selectors only exist in x86-based systems. """ hThread = self.get_handle(win32.THREAD_QUERY_INFORMATION) selector = self.get_register(segment) ldt = win32.GetThreadSelectorEntry(hThread, selector) BaseLow = ldt.BaseLow BaseMid = ldt.HighWord.Bytes.BaseMid << 16 BaseHi = ldt.HighWord.Bytes.BaseHi << 24 Base = BaseLow | BaseMid | BaseHi LimitLow = ldt.LimitLow LimitHi = ldt.HighWord.Bits.LimitHi << 16 Limit = LimitLow | LimitHi if address > Limit: msg = "Address %s too large for segment %s (selector %d)" msg = msg % (HexDump.address(address, self.get_bits()), segment, selector) raise ValueError(msg) return Base + address
[ "def", "get_linear_address", "(", "self", ",", "segment", ",", "address", ")", ":", "hThread", "=", "self", ".", "get_handle", "(", "win32", ".", "THREAD_QUERY_INFORMATION", ")", "selector", "=", "self", ".", "get_register", "(", "segment", ")", "ldt", "=", ...
Translates segment-relative addresses to linear addresses. Linear addresses can be used to access a process memory, calling L{Process.read} and L{Process.write}. @type segment: str @param segment: Segment register name. @type address: int @param address: Segment relative memory address. @rtype: int @return: Linear memory address. @raise ValueError: Address is too large for selector. @raise WindowsError: The current architecture does not support selectors. Selectors only exist in x86-based systems.
[ "Translates", "segment", "-", "relative", "addresses", "to", "linear", "addresses", "." ]
ed9c4307662a5593b8a7f1f3389ecd0e79b8c503
https://github.com/fabioz/PyDev.Debugger/blob/ed9c4307662a5593b8a7f1f3389ecd0e79b8c503/pydevd_attach_to_process/winappdbg/thread.py#L950-L987
train
209,593
fabioz/PyDev.Debugger
pydevd_attach_to_process/winappdbg/thread.py
Thread.get_seh_chain_pointer
def get_seh_chain_pointer(self): """ Get the pointer to the first structured exception handler block. @rtype: int @return: Remote pointer to the first block of the structured exception handlers linked list. If the list is empty, the returned value is C{0xFFFFFFFF}. @raise NotImplementedError: This method is only supported in 32 bits versions of Windows. """ if win32.arch != win32.ARCH_I386: raise NotImplementedError( "SEH chain parsing is only supported in 32-bit Windows.") process = self.get_process() address = self.get_linear_address( 'SegFs', 0 ) return process.read_pointer( address )
python
def get_seh_chain_pointer(self): """ Get the pointer to the first structured exception handler block. @rtype: int @return: Remote pointer to the first block of the structured exception handlers linked list. If the list is empty, the returned value is C{0xFFFFFFFF}. @raise NotImplementedError: This method is only supported in 32 bits versions of Windows. """ if win32.arch != win32.ARCH_I386: raise NotImplementedError( "SEH chain parsing is only supported in 32-bit Windows.") process = self.get_process() address = self.get_linear_address( 'SegFs', 0 ) return process.read_pointer( address )
[ "def", "get_seh_chain_pointer", "(", "self", ")", ":", "if", "win32", ".", "arch", "!=", "win32", ".", "ARCH_I386", ":", "raise", "NotImplementedError", "(", "\"SEH chain parsing is only supported in 32-bit Windows.\"", ")", "process", "=", "self", ".", "get_process",...
Get the pointer to the first structured exception handler block. @rtype: int @return: Remote pointer to the first block of the structured exception handlers linked list. If the list is empty, the returned value is C{0xFFFFFFFF}. @raise NotImplementedError: This method is only supported in 32 bits versions of Windows.
[ "Get", "the", "pointer", "to", "the", "first", "structured", "exception", "handler", "block", "." ]
ed9c4307662a5593b8a7f1f3389ecd0e79b8c503
https://github.com/fabioz/PyDev.Debugger/blob/ed9c4307662a5593b8a7f1f3389ecd0e79b8c503/pydevd_attach_to_process/winappdbg/thread.py#L996-L1014
train
209,594
fabioz/PyDev.Debugger
pydevd_attach_to_process/winappdbg/thread.py
Thread.set_seh_chain_pointer
def set_seh_chain_pointer(self, value): """ Change the pointer to the first structured exception handler block. @type value: int @param value: Value of the remote pointer to the first block of the structured exception handlers linked list. To disable SEH set the value C{0xFFFFFFFF}. @raise NotImplementedError: This method is only supported in 32 bits versions of Windows. """ if win32.arch != win32.ARCH_I386: raise NotImplementedError( "SEH chain parsing is only supported in 32-bit Windows.") process = self.get_process() address = self.get_linear_address( 'SegFs', 0 ) process.write_pointer( address, value )
python
def set_seh_chain_pointer(self, value): """ Change the pointer to the first structured exception handler block. @type value: int @param value: Value of the remote pointer to the first block of the structured exception handlers linked list. To disable SEH set the value C{0xFFFFFFFF}. @raise NotImplementedError: This method is only supported in 32 bits versions of Windows. """ if win32.arch != win32.ARCH_I386: raise NotImplementedError( "SEH chain parsing is only supported in 32-bit Windows.") process = self.get_process() address = self.get_linear_address( 'SegFs', 0 ) process.write_pointer( address, value )
[ "def", "set_seh_chain_pointer", "(", "self", ",", "value", ")", ":", "if", "win32", ".", "arch", "!=", "win32", ".", "ARCH_I386", ":", "raise", "NotImplementedError", "(", "\"SEH chain parsing is only supported in 32-bit Windows.\"", ")", "process", "=", "self", "."...
Change the pointer to the first structured exception handler block. @type value: int @param value: Value of the remote pointer to the first block of the structured exception handlers linked list. To disable SEH set the value C{0xFFFFFFFF}. @raise NotImplementedError: This method is only supported in 32 bits versions of Windows.
[ "Change", "the", "pointer", "to", "the", "first", "structured", "exception", "handler", "block", "." ]
ed9c4307662a5593b8a7f1f3389ecd0e79b8c503
https://github.com/fabioz/PyDev.Debugger/blob/ed9c4307662a5593b8a7f1f3389ecd0e79b8c503/pydevd_attach_to_process/winappdbg/thread.py#L1016-L1034
train
209,595
fabioz/PyDev.Debugger
pydevd_attach_to_process/winappdbg/thread.py
Thread.get_stack_frame_range
def get_stack_frame_range(self): """ Returns the starting and ending addresses of the stack frame. Only works for functions with standard prologue and epilogue. @rtype: tuple( int, int ) @return: Stack frame range. May not be accurate, depending on the compiler used. @raise RuntimeError: The stack frame is invalid, or the function doesn't have a standard prologue and epilogue. @raise WindowsError: An error occured when getting the thread context. """ st, sb = self.get_stack_range() # top, bottom sp = self.get_sp() fp = self.get_fp() size = fp - sp if not st <= sp < sb: raise RuntimeError('Stack pointer lies outside the stack') if not st <= fp < sb: raise RuntimeError('Frame pointer lies outside the stack') if sp > fp: raise RuntimeError('No valid stack frame found') return (sp, fp)
python
def get_stack_frame_range(self): """ Returns the starting and ending addresses of the stack frame. Only works for functions with standard prologue and epilogue. @rtype: tuple( int, int ) @return: Stack frame range. May not be accurate, depending on the compiler used. @raise RuntimeError: The stack frame is invalid, or the function doesn't have a standard prologue and epilogue. @raise WindowsError: An error occured when getting the thread context. """ st, sb = self.get_stack_range() # top, bottom sp = self.get_sp() fp = self.get_fp() size = fp - sp if not st <= sp < sb: raise RuntimeError('Stack pointer lies outside the stack') if not st <= fp < sb: raise RuntimeError('Frame pointer lies outside the stack') if sp > fp: raise RuntimeError('No valid stack frame found') return (sp, fp)
[ "def", "get_stack_frame_range", "(", "self", ")", ":", "st", ",", "sb", "=", "self", ".", "get_stack_range", "(", ")", "# top, bottom", "sp", "=", "self", ".", "get_sp", "(", ")", "fp", "=", "self", ".", "get_fp", "(", ")", "size", "=", "fp", "-", ...
Returns the starting and ending addresses of the stack frame. Only works for functions with standard prologue and epilogue. @rtype: tuple( int, int ) @return: Stack frame range. May not be accurate, depending on the compiler used. @raise RuntimeError: The stack frame is invalid, or the function doesn't have a standard prologue and epilogue. @raise WindowsError: An error occured when getting the thread context.
[ "Returns", "the", "starting", "and", "ending", "addresses", "of", "the", "stack", "frame", ".", "Only", "works", "for", "functions", "with", "standard", "prologue", "and", "epilogue", "." ]
ed9c4307662a5593b8a7f1f3389ecd0e79b8c503
https://github.com/fabioz/PyDev.Debugger/blob/ed9c4307662a5593b8a7f1f3389ecd0e79b8c503/pydevd_attach_to_process/winappdbg/thread.py#L1288-L1313
train
209,596
fabioz/PyDev.Debugger
pydevd_attach_to_process/winappdbg/thread.py
Thread.get_stack_frame
def get_stack_frame(self, max_size = None): """ Reads the contents of the current stack frame. Only works for functions with standard prologue and epilogue. @type max_size: int @param max_size: (Optional) Maximum amount of bytes to read. @rtype: str @return: Stack frame data. May not be accurate, depending on the compiler used. May return an empty string. @raise RuntimeError: The stack frame is invalid, or the function doesn't have a standard prologue and epilogue. @raise WindowsError: An error occured when getting the thread context or reading data from the process memory. """ sp, fp = self.get_stack_frame_range() size = fp - sp if max_size and size > max_size: size = max_size return self.get_process().peek(sp, size)
python
def get_stack_frame(self, max_size = None): """ Reads the contents of the current stack frame. Only works for functions with standard prologue and epilogue. @type max_size: int @param max_size: (Optional) Maximum amount of bytes to read. @rtype: str @return: Stack frame data. May not be accurate, depending on the compiler used. May return an empty string. @raise RuntimeError: The stack frame is invalid, or the function doesn't have a standard prologue and epilogue. @raise WindowsError: An error occured when getting the thread context or reading data from the process memory. """ sp, fp = self.get_stack_frame_range() size = fp - sp if max_size and size > max_size: size = max_size return self.get_process().peek(sp, size)
[ "def", "get_stack_frame", "(", "self", ",", "max_size", "=", "None", ")", ":", "sp", ",", "fp", "=", "self", ".", "get_stack_frame_range", "(", ")", "size", "=", "fp", "-", "sp", "if", "max_size", "and", "size", ">", "max_size", ":", "size", "=", "ma...
Reads the contents of the current stack frame. Only works for functions with standard prologue and epilogue. @type max_size: int @param max_size: (Optional) Maximum amount of bytes to read. @rtype: str @return: Stack frame data. May not be accurate, depending on the compiler used. May return an empty string. @raise RuntimeError: The stack frame is invalid, or the function doesn't have a standard prologue and epilogue. @raise WindowsError: An error occured when getting the thread context or reading data from the process memory.
[ "Reads", "the", "contents", "of", "the", "current", "stack", "frame", ".", "Only", "works", "for", "functions", "with", "standard", "prologue", "and", "epilogue", "." ]
ed9c4307662a5593b8a7f1f3389ecd0e79b8c503
https://github.com/fabioz/PyDev.Debugger/blob/ed9c4307662a5593b8a7f1f3389ecd0e79b8c503/pydevd_attach_to_process/winappdbg/thread.py#L1315-L1339
train
209,597
fabioz/PyDev.Debugger
pydevd_attach_to_process/winappdbg/thread.py
Thread.read_stack_data
def read_stack_data(self, size = 128, offset = 0): """ Reads the contents of the top of the stack. @type size: int @param size: Number of bytes to read. @type offset: int @param offset: Offset from the stack pointer to begin reading. @rtype: str @return: Stack data. @raise WindowsError: Could not read the requested data. """ aProcess = self.get_process() return aProcess.read(self.get_sp() + offset, size)
python
def read_stack_data(self, size = 128, offset = 0): """ Reads the contents of the top of the stack. @type size: int @param size: Number of bytes to read. @type offset: int @param offset: Offset from the stack pointer to begin reading. @rtype: str @return: Stack data. @raise WindowsError: Could not read the requested data. """ aProcess = self.get_process() return aProcess.read(self.get_sp() + offset, size)
[ "def", "read_stack_data", "(", "self", ",", "size", "=", "128", ",", "offset", "=", "0", ")", ":", "aProcess", "=", "self", ".", "get_process", "(", ")", "return", "aProcess", ".", "read", "(", "self", ".", "get_sp", "(", ")", "+", "offset", ",", "...
Reads the contents of the top of the stack. @type size: int @param size: Number of bytes to read. @type offset: int @param offset: Offset from the stack pointer to begin reading. @rtype: str @return: Stack data. @raise WindowsError: Could not read the requested data.
[ "Reads", "the", "contents", "of", "the", "top", "of", "the", "stack", "." ]
ed9c4307662a5593b8a7f1f3389ecd0e79b8c503
https://github.com/fabioz/PyDev.Debugger/blob/ed9c4307662a5593b8a7f1f3389ecd0e79b8c503/pydevd_attach_to_process/winappdbg/thread.py#L1341-L1357
train
209,598
fabioz/PyDev.Debugger
pydevd_attach_to_process/winappdbg/thread.py
Thread.peek_stack_data
def peek_stack_data(self, size = 128, offset = 0): """ Tries to read the contents of the top of the stack. @type size: int @param size: Number of bytes to read. @type offset: int @param offset: Offset from the stack pointer to begin reading. @rtype: str @return: Stack data. Returned data may be less than the requested size. """ aProcess = self.get_process() return aProcess.peek(self.get_sp() + offset, size)
python
def peek_stack_data(self, size = 128, offset = 0): """ Tries to read the contents of the top of the stack. @type size: int @param size: Number of bytes to read. @type offset: int @param offset: Offset from the stack pointer to begin reading. @rtype: str @return: Stack data. Returned data may be less than the requested size. """ aProcess = self.get_process() return aProcess.peek(self.get_sp() + offset, size)
[ "def", "peek_stack_data", "(", "self", ",", "size", "=", "128", ",", "offset", "=", "0", ")", ":", "aProcess", "=", "self", ".", "get_process", "(", ")", "return", "aProcess", ".", "peek", "(", "self", ".", "get_sp", "(", ")", "+", "offset", ",", "...
Tries to read the contents of the top of the stack. @type size: int @param size: Number of bytes to read. @type offset: int @param offset: Offset from the stack pointer to begin reading. @rtype: str @return: Stack data. Returned data may be less than the requested size.
[ "Tries", "to", "read", "the", "contents", "of", "the", "top", "of", "the", "stack", "." ]
ed9c4307662a5593b8a7f1f3389ecd0e79b8c503
https://github.com/fabioz/PyDev.Debugger/blob/ed9c4307662a5593b8a7f1f3389ecd0e79b8c503/pydevd_attach_to_process/winappdbg/thread.py#L1359-L1374
train
209,599