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_bundle/pydevd_dont_trace.py
clear_trace_filter_cache
def clear_trace_filter_cache(): ''' Clear the trace filter cache. Call this after reloading. ''' global should_trace_hook try: # Need to temporarily disable a hook because otherwise # _filename_to_ignored_lines.clear() will never complete. old_hook = should_trace_hook should_trace_hook = None # Clear the linecache linecache.clearcache() _filename_to_ignored_lines.clear() finally: should_trace_hook = old_hook
python
def clear_trace_filter_cache(): ''' Clear the trace filter cache. Call this after reloading. ''' global should_trace_hook try: # Need to temporarily disable a hook because otherwise # _filename_to_ignored_lines.clear() will never complete. old_hook = should_trace_hook should_trace_hook = None # Clear the linecache linecache.clearcache() _filename_to_ignored_lines.clear() finally: should_trace_hook = old_hook
[ "def", "clear_trace_filter_cache", "(", ")", ":", "global", "should_trace_hook", "try", ":", "# Need to temporarily disable a hook because otherwise", "# _filename_to_ignored_lines.clear() will never complete.", "old_hook", "=", "should_trace_hook", "should_trace_hook", "=", "None", ...
Clear the trace filter cache. Call this after reloading.
[ "Clear", "the", "trace", "filter", "cache", ".", "Call", "this", "after", "reloading", "." ]
ed9c4307662a5593b8a7f1f3389ecd0e79b8c503
https://github.com/fabioz/PyDev.Debugger/blob/ed9c4307662a5593b8a7f1f3389ecd0e79b8c503/_pydevd_bundle/pydevd_dont_trace.py#L84-L101
train
209,400
fabioz/PyDev.Debugger
_pydevd_bundle/pydevd_dont_trace.py
trace_filter
def trace_filter(mode): ''' Set the trace filter mode. mode: Whether to enable the trace hook. True: Trace filtering on (skipping methods tagged @DontTrace) False: Trace filtering off (trace methods tagged @DontTrace) None/default: Toggle trace filtering. ''' global should_trace_hook if mode is None: mode = should_trace_hook is None if mode: should_trace_hook = default_should_trace_hook else: should_trace_hook = None return mode
python
def trace_filter(mode): ''' Set the trace filter mode. mode: Whether to enable the trace hook. True: Trace filtering on (skipping methods tagged @DontTrace) False: Trace filtering off (trace methods tagged @DontTrace) None/default: Toggle trace filtering. ''' global should_trace_hook if mode is None: mode = should_trace_hook is None if mode: should_trace_hook = default_should_trace_hook else: should_trace_hook = None return mode
[ "def", "trace_filter", "(", "mode", ")", ":", "global", "should_trace_hook", "if", "mode", "is", "None", ":", "mode", "=", "should_trace_hook", "is", "None", "if", "mode", ":", "should_trace_hook", "=", "default_should_trace_hook", "else", ":", "should_trace_hook"...
Set the trace filter mode. mode: Whether to enable the trace hook. True: Trace filtering on (skipping methods tagged @DontTrace) False: Trace filtering off (trace methods tagged @DontTrace) None/default: Toggle trace filtering.
[ "Set", "the", "trace", "filter", "mode", "." ]
ed9c4307662a5593b8a7f1f3389ecd0e79b8c503
https://github.com/fabioz/PyDev.Debugger/blob/ed9c4307662a5593b8a7f1f3389ecd0e79b8c503/_pydevd_bundle/pydevd_dont_trace.py#L104-L122
train
209,401
fabioz/PyDev.Debugger
pydevd_attach_to_process/winappdbg/plugins/do_symfix.py
do
def do(self, arg): ".symfix - Set the default Microsoft Symbol Store settings if missing" self.debug.system.fix_symbol_store_path(remote = True, force = False)
python
def do(self, arg): ".symfix - Set the default Microsoft Symbol Store settings if missing" self.debug.system.fix_symbol_store_path(remote = True, force = False)
[ "def", "do", "(", "self", ",", "arg", ")", ":", "self", ".", "debug", ".", "system", ".", "fix_symbol_store_path", "(", "remote", "=", "True", ",", "force", "=", "False", ")" ]
.symfix - Set the default Microsoft Symbol Store settings if missing
[ ".", "symfix", "-", "Set", "the", "default", "Microsoft", "Symbol", "Store", "settings", "if", "missing" ]
ed9c4307662a5593b8a7f1f3389ecd0e79b8c503
https://github.com/fabioz/PyDev.Debugger/blob/ed9c4307662a5593b8a7f1f3389ecd0e79b8c503/pydevd_attach_to_process/winappdbg/plugins/do_symfix.py#L35-L37
train
209,402
fabioz/PyDev.Debugger
third_party/pep8/lib2to3/lib2to3/pgen2/grammar.py
Grammar.dump
def dump(self, filename): """Dump the grammar tables to a pickle file.""" f = open(filename, "wb") pickle.dump(self.__dict__, f, 2) f.close()
python
def dump(self, filename): """Dump the grammar tables to a pickle file.""" f = open(filename, "wb") pickle.dump(self.__dict__, f, 2) f.close()
[ "def", "dump", "(", "self", ",", "filename", ")", ":", "f", "=", "open", "(", "filename", ",", "\"wb\"", ")", "pickle", ".", "dump", "(", "self", ".", "__dict__", ",", "f", ",", "2", ")", "f", ".", "close", "(", ")" ]
Dump the grammar tables to a pickle file.
[ "Dump", "the", "grammar", "tables", "to", "a", "pickle", "file", "." ]
ed9c4307662a5593b8a7f1f3389ecd0e79b8c503
https://github.com/fabioz/PyDev.Debugger/blob/ed9c4307662a5593b8a7f1f3389ecd0e79b8c503/third_party/pep8/lib2to3/lib2to3/pgen2/grammar.py#L87-L91
train
209,403
fabioz/PyDev.Debugger
third_party/pep8/lib2to3/lib2to3/pgen2/grammar.py
Grammar.load
def load(self, filename): """Load the grammar tables from a pickle file.""" f = open(filename, "rb") d = pickle.load(f) f.close() self.__dict__.update(d)
python
def load(self, filename): """Load the grammar tables from a pickle file.""" f = open(filename, "rb") d = pickle.load(f) f.close() self.__dict__.update(d)
[ "def", "load", "(", "self", ",", "filename", ")", ":", "f", "=", "open", "(", "filename", ",", "\"rb\"", ")", "d", "=", "pickle", ".", "load", "(", "f", ")", "f", ".", "close", "(", ")", "self", ".", "__dict__", ".", "update", "(", "d", ")" ]
Load the grammar tables from a pickle file.
[ "Load", "the", "grammar", "tables", "from", "a", "pickle", "file", "." ]
ed9c4307662a5593b8a7f1f3389ecd0e79b8c503
https://github.com/fabioz/PyDev.Debugger/blob/ed9c4307662a5593b8a7f1f3389ecd0e79b8c503/third_party/pep8/lib2to3/lib2to3/pgen2/grammar.py#L93-L98
train
209,404
fabioz/PyDev.Debugger
third_party/pep8/lib2to3/lib2to3/pgen2/grammar.py
Grammar.copy
def copy(self): """ Copy the grammar. """ new = self.__class__() for dict_attr in ("symbol2number", "number2symbol", "dfas", "keywords", "tokens", "symbol2label"): setattr(new, dict_attr, getattr(self, dict_attr).copy()) new.labels = self.labels[:] new.states = self.states[:] new.start = self.start return new
python
def copy(self): """ Copy the grammar. """ new = self.__class__() for dict_attr in ("symbol2number", "number2symbol", "dfas", "keywords", "tokens", "symbol2label"): setattr(new, dict_attr, getattr(self, dict_attr).copy()) new.labels = self.labels[:] new.states = self.states[:] new.start = self.start return new
[ "def", "copy", "(", "self", ")", ":", "new", "=", "self", ".", "__class__", "(", ")", "for", "dict_attr", "in", "(", "\"symbol2number\"", ",", "\"number2symbol\"", ",", "\"dfas\"", ",", "\"keywords\"", ",", "\"tokens\"", ",", "\"symbol2label\"", ")", ":", ...
Copy the grammar.
[ "Copy", "the", "grammar", "." ]
ed9c4307662a5593b8a7f1f3389ecd0e79b8c503
https://github.com/fabioz/PyDev.Debugger/blob/ed9c4307662a5593b8a7f1f3389ecd0e79b8c503/third_party/pep8/lib2to3/lib2to3/pgen2/grammar.py#L100-L111
train
209,405
fabioz/PyDev.Debugger
third_party/pep8/lib2to3/lib2to3/pgen2/grammar.py
Grammar.report
def report(self): """Dump the grammar tables to standard output, for debugging.""" from pprint import pprint print "s2n" pprint(self.symbol2number) print "n2s" pprint(self.number2symbol) print "states" pprint(self.states) print "dfas" pprint(self.dfas) print "labels" pprint(self.labels) print "start", self.start
python
def report(self): """Dump the grammar tables to standard output, for debugging.""" from pprint import pprint print "s2n" pprint(self.symbol2number) print "n2s" pprint(self.number2symbol) print "states" pprint(self.states) print "dfas" pprint(self.dfas) print "labels" pprint(self.labels) print "start", self.start
[ "def", "report", "(", "self", ")", ":", "from", "pprint", "import", "pprint", "print", "\"s2n\"", "pprint", "(", "self", ".", "symbol2number", ")", "print", "\"n2s\"", "pprint", "(", "self", ".", "number2symbol", ")", "print", "\"states\"", "pprint", "(", ...
Dump the grammar tables to standard output, for debugging.
[ "Dump", "the", "grammar", "tables", "to", "standard", "output", "for", "debugging", "." ]
ed9c4307662a5593b8a7f1f3389ecd0e79b8c503
https://github.com/fabioz/PyDev.Debugger/blob/ed9c4307662a5593b8a7f1f3389ecd0e79b8c503/third_party/pep8/lib2to3/lib2to3/pgen2/grammar.py#L113-L126
train
209,406
fabioz/PyDev.Debugger
third_party/wrapped_for_pydev/ctypes/macholib/dyld.py
dyld_image_suffix_search
def dyld_image_suffix_search(iterator, env=None): """For a potential path iterator, add DYLD_IMAGE_SUFFIX semantics""" suffix = dyld_image_suffix(env) if suffix is None: return iterator def _inject(iterator=iterator, suffix=suffix): for path in iterator: if path.endswith('.dylib'): yield path[:-len('.dylib')] + suffix + '.dylib' else: yield path + suffix yield path return _inject()
python
def dyld_image_suffix_search(iterator, env=None): """For a potential path iterator, add DYLD_IMAGE_SUFFIX semantics""" suffix = dyld_image_suffix(env) if suffix is None: return iterator def _inject(iterator=iterator, suffix=suffix): for path in iterator: if path.endswith('.dylib'): yield path[:-len('.dylib')] + suffix + '.dylib' else: yield path + suffix yield path return _inject()
[ "def", "dyld_image_suffix_search", "(", "iterator", ",", "env", "=", "None", ")", ":", "suffix", "=", "dyld_image_suffix", "(", "env", ")", "if", "suffix", "is", "None", ":", "return", "iterator", "def", "_inject", "(", "iterator", "=", "iterator", ",", "s...
For a potential path iterator, add DYLD_IMAGE_SUFFIX semantics
[ "For", "a", "potential", "path", "iterator", "add", "DYLD_IMAGE_SUFFIX", "semantics" ]
ed9c4307662a5593b8a7f1f3389ecd0e79b8c503
https://github.com/fabioz/PyDev.Debugger/blob/ed9c4307662a5593b8a7f1f3389ecd0e79b8c503/third_party/wrapped_for_pydev/ctypes/macholib/dyld.py#L63-L75
train
209,407
fabioz/PyDev.Debugger
third_party/pep8/lib2to3/lib2to3/fixes/fix_import.py
traverse_imports
def traverse_imports(names): """ Walks over all the names imported in a dotted_as_names node. """ pending = [names] while pending: node = pending.pop() if node.type == token.NAME: yield node.value elif node.type == syms.dotted_name: yield "".join([ch.value for ch in node.children]) elif node.type == syms.dotted_as_name: pending.append(node.children[0]) elif node.type == syms.dotted_as_names: pending.extend(node.children[::-2]) else: raise AssertionError("unkown node type")
python
def traverse_imports(names): """ Walks over all the names imported in a dotted_as_names node. """ pending = [names] while pending: node = pending.pop() if node.type == token.NAME: yield node.value elif node.type == syms.dotted_name: yield "".join([ch.value for ch in node.children]) elif node.type == syms.dotted_as_name: pending.append(node.children[0]) elif node.type == syms.dotted_as_names: pending.extend(node.children[::-2]) else: raise AssertionError("unkown node type")
[ "def", "traverse_imports", "(", "names", ")", ":", "pending", "=", "[", "names", "]", "while", "pending", ":", "node", "=", "pending", ".", "pop", "(", ")", "if", "node", ".", "type", "==", "token", ".", "NAME", ":", "yield", "node", ".", "value", ...
Walks over all the names imported in a dotted_as_names node.
[ "Walks", "over", "all", "the", "names", "imported", "in", "a", "dotted_as_names", "node", "." ]
ed9c4307662a5593b8a7f1f3389ecd0e79b8c503
https://github.com/fabioz/PyDev.Debugger/blob/ed9c4307662a5593b8a7f1f3389ecd0e79b8c503/third_party/pep8/lib2to3/lib2to3/fixes/fix_import.py#L19-L35
train
209,408
fabioz/PyDev.Debugger
third_party/isort_container/isort/pie_slice.py
unmodified_isinstance
def unmodified_isinstance(*bases): """When called in the form MyOverrideClass(unmodified_isinstance(BuiltInClass)) it allows calls against passed in built in instances to pass even if there not a subclass """ class UnmodifiedIsInstance(type): if sys.version_info[0] == 2 and sys.version_info[1] <= 6: @classmethod def __instancecheck__(cls, instance): if cls.__name__ in (str(base.__name__) for base in bases): return isinstance(instance, bases) subclass = getattr(instance, '__class__', None) subtype = type(instance) instance_type = getattr(abc, '_InstanceType', None) if not instance_type: class test_object: pass instance_type = type(test_object) if subtype is instance_type: subtype = subclass if subtype is subclass or subclass is None: return cls.__subclasscheck__(subtype) return (cls.__subclasscheck__(subclass) or cls.__subclasscheck__(subtype)) else: @classmethod def __instancecheck__(cls, instance): if cls.__name__ in (str(base.__name__) for base in bases): return isinstance(instance, bases) return type.__instancecheck__(cls, instance) return with_metaclass(UnmodifiedIsInstance, *bases)
python
def unmodified_isinstance(*bases): """When called in the form MyOverrideClass(unmodified_isinstance(BuiltInClass)) it allows calls against passed in built in instances to pass even if there not a subclass """ class UnmodifiedIsInstance(type): if sys.version_info[0] == 2 and sys.version_info[1] <= 6: @classmethod def __instancecheck__(cls, instance): if cls.__name__ in (str(base.__name__) for base in bases): return isinstance(instance, bases) subclass = getattr(instance, '__class__', None) subtype = type(instance) instance_type = getattr(abc, '_InstanceType', None) if not instance_type: class test_object: pass instance_type = type(test_object) if subtype is instance_type: subtype = subclass if subtype is subclass or subclass is None: return cls.__subclasscheck__(subtype) return (cls.__subclasscheck__(subclass) or cls.__subclasscheck__(subtype)) else: @classmethod def __instancecheck__(cls, instance): if cls.__name__ in (str(base.__name__) for base in bases): return isinstance(instance, bases) return type.__instancecheck__(cls, instance) return with_metaclass(UnmodifiedIsInstance, *bases)
[ "def", "unmodified_isinstance", "(", "*", "bases", ")", ":", "class", "UnmodifiedIsInstance", "(", "type", ")", ":", "if", "sys", ".", "version_info", "[", "0", "]", "==", "2", "and", "sys", ".", "version_info", "[", "1", "]", "<=", "6", ":", "@", "c...
When called in the form MyOverrideClass(unmodified_isinstance(BuiltInClass)) it allows calls against passed in built in instances to pass even if there not a subclass
[ "When", "called", "in", "the", "form" ]
ed9c4307662a5593b8a7f1f3389ecd0e79b8c503
https://github.com/fabioz/PyDev.Debugger/blob/ed9c4307662a5593b8a7f1f3389ecd0e79b8c503/third_party/isort_container/isort/pie_slice.py#L79-L115
train
209,409
fabioz/PyDev.Debugger
pydevd_attach_to_process/winappdbg/plugins/do_exchain.py
do
def do(self, arg): ".exchain - Show the SEH chain" thread = self.get_thread_from_prefix() print "Exception handlers for thread %d" % thread.get_tid() print table = Table() table.addRow("Block", "Function") bits = thread.get_bits() for (seh, seh_func) in thread.get_seh_chain(): if seh is not None: seh = HexDump.address(seh, bits) if seh_func is not None: seh_func = HexDump.address(seh_func, bits) table.addRow(seh, seh_func) print table.getOutput()
python
def do(self, arg): ".exchain - Show the SEH chain" thread = self.get_thread_from_prefix() print "Exception handlers for thread %d" % thread.get_tid() print table = Table() table.addRow("Block", "Function") bits = thread.get_bits() for (seh, seh_func) in thread.get_seh_chain(): if seh is not None: seh = HexDump.address(seh, bits) if seh_func is not None: seh_func = HexDump.address(seh_func, bits) table.addRow(seh, seh_func) print table.getOutput()
[ "def", "do", "(", "self", ",", "arg", ")", ":", "thread", "=", "self", ".", "get_thread_from_prefix", "(", ")", "print", "\"Exception handlers for thread %d\"", "%", "thread", ".", "get_tid", "(", ")", "print", "table", "=", "Table", "(", ")", "table", "."...
.exchain - Show the SEH chain
[ ".", "exchain", "-", "Show", "the", "SEH", "chain" ]
ed9c4307662a5593b8a7f1f3389ecd0e79b8c503
https://github.com/fabioz/PyDev.Debugger/blob/ed9c4307662a5593b8a7f1f3389ecd0e79b8c503/pydevd_attach_to_process/winappdbg/plugins/do_exchain.py#L37-L51
train
209,410
fabioz/PyDev.Debugger
_pydevd_bundle/pydevd_json_debug_options.py
_parse_debug_options
def _parse_debug_options(opts): """Debug options are semicolon separated key=value pairs WAIT_ON_ABNORMAL_EXIT=True|False WAIT_ON_NORMAL_EXIT=True|False REDIRECT_OUTPUT=True|False VERSION=string INTERPRETER_OPTIONS=string WEB_BROWSER_URL=string url DJANGO_DEBUG=True|False CLIENT_OS_TYPE=WINDOWS|UNIX DEBUG_STDLIB=True|False """ options = {} if not opts: return options for opt in opts.split(';'): try: key, value = opt.split('=') except ValueError: continue try: options[key] = DEBUG_OPTIONS_PARSER[key](value) except KeyError: continue return options
python
def _parse_debug_options(opts): """Debug options are semicolon separated key=value pairs WAIT_ON_ABNORMAL_EXIT=True|False WAIT_ON_NORMAL_EXIT=True|False REDIRECT_OUTPUT=True|False VERSION=string INTERPRETER_OPTIONS=string WEB_BROWSER_URL=string url DJANGO_DEBUG=True|False CLIENT_OS_TYPE=WINDOWS|UNIX DEBUG_STDLIB=True|False """ options = {} if not opts: return options for opt in opts.split(';'): try: key, value = opt.split('=') except ValueError: continue try: options[key] = DEBUG_OPTIONS_PARSER[key](value) except KeyError: continue return options
[ "def", "_parse_debug_options", "(", "opts", ")", ":", "options", "=", "{", "}", "if", "not", "opts", ":", "return", "options", "for", "opt", "in", "opts", ".", "split", "(", "';'", ")", ":", "try", ":", "key", ",", "value", "=", "opt", ".", "split"...
Debug options are semicolon separated key=value pairs WAIT_ON_ABNORMAL_EXIT=True|False WAIT_ON_NORMAL_EXIT=True|False REDIRECT_OUTPUT=True|False VERSION=string INTERPRETER_OPTIONS=string WEB_BROWSER_URL=string url DJANGO_DEBUG=True|False CLIENT_OS_TYPE=WINDOWS|UNIX DEBUG_STDLIB=True|False
[ "Debug", "options", "are", "semicolon", "separated", "key", "=", "value", "pairs", "WAIT_ON_ABNORMAL_EXIT", "=", "True|False", "WAIT_ON_NORMAL_EXIT", "=", "True|False", "REDIRECT_OUTPUT", "=", "True|False", "VERSION", "=", "string", "INTERPRETER_OPTIONS", "=", "string",...
ed9c4307662a5593b8a7f1f3389ecd0e79b8c503
https://github.com/fabioz/PyDev.Debugger/blob/ed9c4307662a5593b8a7f1f3389ecd0e79b8c503/_pydevd_bundle/pydevd_json_debug_options.py#L74-L100
train
209,411
fabioz/PyDev.Debugger
pydevd_attach_to_process/winappdbg/sql.py
_compile_varchar_mysql
def _compile_varchar_mysql(element, compiler, **kw): """MySQL hack to avoid the "VARCHAR requires a length" error.""" if not element.length or element.length == 'max': return "TEXT" else: return compiler.visit_VARCHAR(element, **kw)
python
def _compile_varchar_mysql(element, compiler, **kw): """MySQL hack to avoid the "VARCHAR requires a length" error.""" if not element.length or element.length == 'max': return "TEXT" else: return compiler.visit_VARCHAR(element, **kw)
[ "def", "_compile_varchar_mysql", "(", "element", ",", "compiler", ",", "*", "*", "kw", ")", ":", "if", "not", "element", ".", "length", "or", "element", ".", "length", "==", "'max'", ":", "return", "\"TEXT\"", "else", ":", "return", "compiler", ".", "vis...
MySQL hack to avoid the "VARCHAR requires a length" error.
[ "MySQL", "hack", "to", "avoid", "the", "VARCHAR", "requires", "a", "length", "error", "." ]
ed9c4307662a5593b8a7f1f3389ecd0e79b8c503
https://github.com/fabioz/PyDev.Debugger/blob/ed9c4307662a5593b8a7f1f3389ecd0e79b8c503/pydevd_attach_to_process/winappdbg/sql.py#L83-L88
train
209,412
fabioz/PyDev.Debugger
pydevd_attach_to_process/winappdbg/sql.py
Transactional
def Transactional(fn, self, *argv, **argd): """ Decorator that wraps DAO methods to handle transactions automatically. It may only work with subclasses of L{BaseDAO}. """ return self._transactional(fn, *argv, **argd)
python
def Transactional(fn, self, *argv, **argd): """ Decorator that wraps DAO methods to handle transactions automatically. It may only work with subclasses of L{BaseDAO}. """ return self._transactional(fn, *argv, **argd)
[ "def", "Transactional", "(", "fn", ",", "self", ",", "*", "argv", ",", "*", "*", "argd", ")", ":", "return", "self", ".", "_transactional", "(", "fn", ",", "*", "argv", ",", "*", "*", "argd", ")" ]
Decorator that wraps DAO methods to handle transactions automatically. It may only work with subclasses of L{BaseDAO}.
[ "Decorator", "that", "wraps", "DAO", "methods", "to", "handle", "transactions", "automatically", "." ]
ed9c4307662a5593b8a7f1f3389ecd0e79b8c503
https://github.com/fabioz/PyDev.Debugger/blob/ed9c4307662a5593b8a7f1f3389ecd0e79b8c503/pydevd_attach_to_process/winappdbg/sql.py#L314-L320
train
209,413
fabioz/PyDev.Debugger
pydevd_attach_to_process/winappdbg/sql.py
_SQLitePatch.connect
def connect(dbapi_connection, connection_record): """ Called once by SQLAlchemy for each new SQLite DB-API connection. Here is where we issue some PRAGMA statements to configure how we're going to access the SQLite database. @param dbapi_connection: A newly connected raw SQLite DB-API connection. @param connection_record: Unused by this method. """ try: cursor = dbapi_connection.cursor() try: cursor.execute("PRAGMA foreign_keys = ON;") cursor.execute("PRAGMA foreign_keys;") if cursor.fetchone()[0] != 1: raise Exception() finally: cursor.close() except Exception: dbapi_connection.close() raise sqlite3.Error()
python
def connect(dbapi_connection, connection_record): """ Called once by SQLAlchemy for each new SQLite DB-API connection. Here is where we issue some PRAGMA statements to configure how we're going to access the SQLite database. @param dbapi_connection: A newly connected raw SQLite DB-API connection. @param connection_record: Unused by this method. """ try: cursor = dbapi_connection.cursor() try: cursor.execute("PRAGMA foreign_keys = ON;") cursor.execute("PRAGMA foreign_keys;") if cursor.fetchone()[0] != 1: raise Exception() finally: cursor.close() except Exception: dbapi_connection.close() raise sqlite3.Error()
[ "def", "connect", "(", "dbapi_connection", ",", "connection_record", ")", ":", "try", ":", "cursor", "=", "dbapi_connection", ".", "cursor", "(", ")", "try", ":", "cursor", ".", "execute", "(", "\"PRAGMA foreign_keys = ON;\"", ")", "cursor", ".", "execute", "(...
Called once by SQLAlchemy for each new SQLite DB-API connection. Here is where we issue some PRAGMA statements to configure how we're going to access the SQLite database. @param dbapi_connection: A newly connected raw SQLite DB-API connection. @param connection_record: Unused by this method.
[ "Called", "once", "by", "SQLAlchemy", "for", "each", "new", "SQLite", "DB", "-", "API", "connection", "." ]
ed9c4307662a5593b8a7f1f3389ecd0e79b8c503
https://github.com/fabioz/PyDev.Debugger/blob/ed9c4307662a5593b8a7f1f3389ecd0e79b8c503/pydevd_attach_to_process/winappdbg/sql.py#L101-L125
train
209,414
fabioz/PyDev.Debugger
pydevd_attach_to_process/winappdbg/sql.py
BaseDAO._transactional
def _transactional(self, method, *argv, **argd): """ Begins a transaction and calls the given DAO method. If the method executes successfully the transaction is commited. If the method fails, the transaction is rolled back. @type method: callable @param method: Bound method of this class or one of its subclasses. The first argument will always be C{self}. @return: The return value of the method call. @raise Exception: Any exception raised by the method. """ self._session.begin(subtransactions = True) try: result = method(self, *argv, **argd) self._session.commit() return result except: self._session.rollback() raise
python
def _transactional(self, method, *argv, **argd): """ Begins a transaction and calls the given DAO method. If the method executes successfully the transaction is commited. If the method fails, the transaction is rolled back. @type method: callable @param method: Bound method of this class or one of its subclasses. The first argument will always be C{self}. @return: The return value of the method call. @raise Exception: Any exception raised by the method. """ self._session.begin(subtransactions = True) try: result = method(self, *argv, **argd) self._session.commit() return result except: self._session.rollback() raise
[ "def", "_transactional", "(", "self", ",", "method", ",", "*", "argv", ",", "*", "*", "argd", ")", ":", "self", ".", "_session", ".", "begin", "(", "subtransactions", "=", "True", ")", "try", ":", "result", "=", "method", "(", "self", ",", "*", "ar...
Begins a transaction and calls the given DAO method. If the method executes successfully the transaction is commited. If the method fails, the transaction is rolled back. @type method: callable @param method: Bound method of this class or one of its subclasses. The first argument will always be C{self}. @return: The return value of the method call. @raise Exception: Any exception raised by the method.
[ "Begins", "a", "transaction", "and", "calls", "the", "given", "DAO", "method", "." ]
ed9c4307662a5593b8a7f1f3389ecd0e79b8c503
https://github.com/fabioz/PyDev.Debugger/blob/ed9c4307662a5593b8a7f1f3389ecd0e79b8c503/pydevd_attach_to_process/winappdbg/sql.py#L286-L309
train
209,415
fabioz/PyDev.Debugger
pydevd_attach_to_process/winappdbg/sql.py
CrashDAO.add
def add(self, crash, allow_duplicates = True): """ Add a new crash dump to the database, optionally filtering them by signature to avoid duplicates. @type crash: L{Crash} @param crash: Crash object. @type allow_duplicates: bool @param allow_duplicates: (Optional) C{True} to always add the new crash dump. C{False} to only add the crash dump if no other crash with the same signature is found in the database. Sometimes, your fuzzer turns out to be I{too} good. Then you find youself browsing through gigabytes of crash dumps, only to find a handful of actual bugs in them. This simple heuristic filter saves you the trouble by discarding crashes that seem to be similar to another one you've already found. """ # Filter out duplicated crashes, if requested. if not allow_duplicates: signature = pickle.dumps(crash.signature, protocol = 0) if self._session.query(CrashDTO.id) \ .filter_by(signature = signature) \ .count() > 0: return # Fill out a new row for the crashes table. crash_id = self.__add_crash(crash) # Fill out new rows for the memory dump. self.__add_memory(crash_id, crash.memoryMap) # On success set the row ID for the Crash object. # WARNING: In nested calls, make sure to delete # this property before a session rollback! crash._rowid = crash_id
python
def add(self, crash, allow_duplicates = True): """ Add a new crash dump to the database, optionally filtering them by signature to avoid duplicates. @type crash: L{Crash} @param crash: Crash object. @type allow_duplicates: bool @param allow_duplicates: (Optional) C{True} to always add the new crash dump. C{False} to only add the crash dump if no other crash with the same signature is found in the database. Sometimes, your fuzzer turns out to be I{too} good. Then you find youself browsing through gigabytes of crash dumps, only to find a handful of actual bugs in them. This simple heuristic filter saves you the trouble by discarding crashes that seem to be similar to another one you've already found. """ # Filter out duplicated crashes, if requested. if not allow_duplicates: signature = pickle.dumps(crash.signature, protocol = 0) if self._session.query(CrashDTO.id) \ .filter_by(signature = signature) \ .count() > 0: return # Fill out a new row for the crashes table. crash_id = self.__add_crash(crash) # Fill out new rows for the memory dump. self.__add_memory(crash_id, crash.memoryMap) # On success set the row ID for the Crash object. # WARNING: In nested calls, make sure to delete # this property before a session rollback! crash._rowid = crash_id
[ "def", "add", "(", "self", ",", "crash", ",", "allow_duplicates", "=", "True", ")", ":", "# Filter out duplicated crashes, if requested.", "if", "not", "allow_duplicates", ":", "signature", "=", "pickle", ".", "dumps", "(", "crash", ".", "signature", ",", "proto...
Add a new crash dump to the database, optionally filtering them by signature to avoid duplicates. @type crash: L{Crash} @param crash: Crash object. @type allow_duplicates: bool @param allow_duplicates: (Optional) C{True} to always add the new crash dump. C{False} to only add the crash dump if no other crash with the same signature is found in the database. Sometimes, your fuzzer turns out to be I{too} good. Then you find youself browsing through gigabytes of crash dumps, only to find a handful of actual bugs in them. This simple heuristic filter saves you the trouble by discarding crashes that seem to be similar to another one you've already found.
[ "Add", "a", "new", "crash", "dump", "to", "the", "database", "optionally", "filtering", "them", "by", "signature", "to", "avoid", "duplicates", "." ]
ed9c4307662a5593b8a7f1f3389ecd0e79b8c503
https://github.com/fabioz/PyDev.Debugger/blob/ed9c4307662a5593b8a7f1f3389ecd0e79b8c503/pydevd_attach_to_process/winappdbg/sql.py#L737-L775
train
209,416
fabioz/PyDev.Debugger
pydevd_attach_to_process/winappdbg/sql.py
CrashDAO.find_by_example
def find_by_example(self, crash, offset = None, limit = None): """ Find all crash dumps that have common properties with the crash dump provided. Results can be paged to avoid consuming too much memory if the database is large. @see: L{find} @type crash: L{Crash} @param crash: Crash object to compare with. Fields set to C{None} are ignored, all other fields but the signature are used in the comparison. To search for signature instead use the L{find} method. @type offset: int @param offset: (Optional) Skip the first I{offset} results. @type limit: int @param limit: (Optional) Return at most I{limit} results. @rtype: list(L{Crash}) @return: List of similar crash dumps found. """ # Validate the parameters. if limit is not None and not limit: warnings.warn("CrashDAO.find_by_example() was set a limit of 0" " results, returning without executing a query.") return [] # Build the query. query = self._session.query(CrashDTO) # Order by row ID to get consistent results. # Also some database engines require ordering when using offsets. query = query.asc(CrashDTO.id) # Build a CrashDTO from the Crash object. dto = CrashDTO(crash) # Filter all the fields in the crashes table that are present in the # CrashDTO object and not set to None, except for the row ID. for name, column in compat.iteritems(CrashDTO.__dict__): if not name.startswith('__') and name not in ('id', 'signature', 'data'): if isinstance(column, Column): value = getattr(dto, name, None) if value is not None: query = query.filter(column == value) # Page the query. if offset: query = query.offset(offset) if limit: query = query.limit(limit) # Execute the SQL query and convert the results. try: return [dto.toCrash() for dto in query.all()] except NoResultFound: return []
python
def find_by_example(self, crash, offset = None, limit = None): """ Find all crash dumps that have common properties with the crash dump provided. Results can be paged to avoid consuming too much memory if the database is large. @see: L{find} @type crash: L{Crash} @param crash: Crash object to compare with. Fields set to C{None} are ignored, all other fields but the signature are used in the comparison. To search for signature instead use the L{find} method. @type offset: int @param offset: (Optional) Skip the first I{offset} results. @type limit: int @param limit: (Optional) Return at most I{limit} results. @rtype: list(L{Crash}) @return: List of similar crash dumps found. """ # Validate the parameters. if limit is not None and not limit: warnings.warn("CrashDAO.find_by_example() was set a limit of 0" " results, returning without executing a query.") return [] # Build the query. query = self._session.query(CrashDTO) # Order by row ID to get consistent results. # Also some database engines require ordering when using offsets. query = query.asc(CrashDTO.id) # Build a CrashDTO from the Crash object. dto = CrashDTO(crash) # Filter all the fields in the crashes table that are present in the # CrashDTO object and not set to None, except for the row ID. for name, column in compat.iteritems(CrashDTO.__dict__): if not name.startswith('__') and name not in ('id', 'signature', 'data'): if isinstance(column, Column): value = getattr(dto, name, None) if value is not None: query = query.filter(column == value) # Page the query. if offset: query = query.offset(offset) if limit: query = query.limit(limit) # Execute the SQL query and convert the results. try: return [dto.toCrash() for dto in query.all()] except NoResultFound: return []
[ "def", "find_by_example", "(", "self", ",", "crash", ",", "offset", "=", "None", ",", "limit", "=", "None", ")", ":", "# Validate the parameters.", "if", "limit", "is", "not", "None", "and", "not", "limit", ":", "warnings", ".", "warn", "(", "\"CrashDAO.fi...
Find all crash dumps that have common properties with the crash dump provided. Results can be paged to avoid consuming too much memory if the database is large. @see: L{find} @type crash: L{Crash} @param crash: Crash object to compare with. Fields set to C{None} are ignored, all other fields but the signature are used in the comparison. To search for signature instead use the L{find} method. @type offset: int @param offset: (Optional) Skip the first I{offset} results. @type limit: int @param limit: (Optional) Return at most I{limit} results. @rtype: list(L{Crash}) @return: List of similar crash dumps found.
[ "Find", "all", "crash", "dumps", "that", "have", "common", "properties", "with", "the", "crash", "dump", "provided", "." ]
ed9c4307662a5593b8a7f1f3389ecd0e79b8c503
https://github.com/fabioz/PyDev.Debugger/blob/ed9c4307662a5593b8a7f1f3389ecd0e79b8c503/pydevd_attach_to_process/winappdbg/sql.py#L898-L962
train
209,417
fabioz/PyDev.Debugger
pydevd_attach_to_process/winappdbg/sql.py
CrashDAO.count
def count(self, signature = None): """ Counts how many crash dumps have been stored in this database. Optionally filters the count by heuristic signature. @type signature: object @param signature: (Optional) Count only the crashes that match this signature. See L{Crash.signature} for more details. @rtype: int @return: Count of crash dumps stored in this database. """ query = self._session.query(CrashDTO.id) if signature: sig_pickled = pickle.dumps(signature, protocol = 0) query = query.filter_by(signature = sig_pickled) return query.count()
python
def count(self, signature = None): """ Counts how many crash dumps have been stored in this database. Optionally filters the count by heuristic signature. @type signature: object @param signature: (Optional) Count only the crashes that match this signature. See L{Crash.signature} for more details. @rtype: int @return: Count of crash dumps stored in this database. """ query = self._session.query(CrashDTO.id) if signature: sig_pickled = pickle.dumps(signature, protocol = 0) query = query.filter_by(signature = sig_pickled) return query.count()
[ "def", "count", "(", "self", ",", "signature", "=", "None", ")", ":", "query", "=", "self", ".", "_session", ".", "query", "(", "CrashDTO", ".", "id", ")", "if", "signature", ":", "sig_pickled", "=", "pickle", ".", "dumps", "(", "signature", ",", "pr...
Counts how many crash dumps have been stored in this database. Optionally filters the count by heuristic signature. @type signature: object @param signature: (Optional) Count only the crashes that match this signature. See L{Crash.signature} for more details. @rtype: int @return: Count of crash dumps stored in this database.
[ "Counts", "how", "many", "crash", "dumps", "have", "been", "stored", "in", "this", "database", ".", "Optionally", "filters", "the", "count", "by", "heuristic", "signature", "." ]
ed9c4307662a5593b8a7f1f3389ecd0e79b8c503
https://github.com/fabioz/PyDev.Debugger/blob/ed9c4307662a5593b8a7f1f3389ecd0e79b8c503/pydevd_attach_to_process/winappdbg/sql.py#L965-L981
train
209,418
fabioz/PyDev.Debugger
pydevd_attach_to_process/winappdbg/sql.py
CrashDAO.delete
def delete(self, crash): """ Remove the given crash dump from the database. @type crash: L{Crash} @param crash: Crash dump to remove. """ query = self._session.query(CrashDTO).filter_by(id = crash._rowid) query.delete(synchronize_session = False) del crash._rowid
python
def delete(self, crash): """ Remove the given crash dump from the database. @type crash: L{Crash} @param crash: Crash dump to remove. """ query = self._session.query(CrashDTO).filter_by(id = crash._rowid) query.delete(synchronize_session = False) del crash._rowid
[ "def", "delete", "(", "self", ",", "crash", ")", ":", "query", "=", "self", ".", "_session", ".", "query", "(", "CrashDTO", ")", ".", "filter_by", "(", "id", "=", "crash", ".", "_rowid", ")", "query", ".", "delete", "(", "synchronize_session", "=", "...
Remove the given crash dump from the database. @type crash: L{Crash} @param crash: Crash dump to remove.
[ "Remove", "the", "given", "crash", "dump", "from", "the", "database", "." ]
ed9c4307662a5593b8a7f1f3389ecd0e79b8c503
https://github.com/fabioz/PyDev.Debugger/blob/ed9c4307662a5593b8a7f1f3389ecd0e79b8c503/pydevd_attach_to_process/winappdbg/sql.py#L984-L993
train
209,419
fabioz/PyDev.Debugger
_pydevd_bundle/pydevd_safe_repr.py
SafeRepr._repr
def _repr(self, obj, level): '''Returns an iterable of the parts in the final repr string.''' try: obj_repr = type(obj).__repr__ except Exception: obj_repr = None def has_obj_repr(t): r = t.__repr__ try: return obj_repr == r except Exception: return obj_repr is r for t, prefix, suffix, comma in self.collection_types: if isinstance(obj, t) and has_obj_repr(t): return self._repr_iter(obj, level, prefix, suffix, comma) for t, prefix, suffix, item_prefix, item_sep, item_suffix in self.dict_types: # noqa if isinstance(obj, t) and has_obj_repr(t): return self._repr_dict(obj, level, prefix, suffix, item_prefix, item_sep, item_suffix) for t in self.string_types: if isinstance(obj, t) and has_obj_repr(t): return self._repr_str(obj, level) if self._is_long_iter(obj): return self._repr_long_iter(obj) return self._repr_other(obj, level)
python
def _repr(self, obj, level): '''Returns an iterable of the parts in the final repr string.''' try: obj_repr = type(obj).__repr__ except Exception: obj_repr = None def has_obj_repr(t): r = t.__repr__ try: return obj_repr == r except Exception: return obj_repr is r for t, prefix, suffix, comma in self.collection_types: if isinstance(obj, t) and has_obj_repr(t): return self._repr_iter(obj, level, prefix, suffix, comma) for t, prefix, suffix, item_prefix, item_sep, item_suffix in self.dict_types: # noqa if isinstance(obj, t) and has_obj_repr(t): return self._repr_dict(obj, level, prefix, suffix, item_prefix, item_sep, item_suffix) for t in self.string_types: if isinstance(obj, t) and has_obj_repr(t): return self._repr_str(obj, level) if self._is_long_iter(obj): return self._repr_long_iter(obj) return self._repr_other(obj, level)
[ "def", "_repr", "(", "self", ",", "obj", ",", "level", ")", ":", "try", ":", "obj_repr", "=", "type", "(", "obj", ")", ".", "__repr__", "except", "Exception", ":", "obj_repr", "=", "None", "def", "has_obj_repr", "(", "t", ")", ":", "r", "=", "t", ...
Returns an iterable of the parts in the final repr string.
[ "Returns", "an", "iterable", "of", "the", "parts", "in", "the", "final", "repr", "string", "." ]
ed9c4307662a5593b8a7f1f3389ecd0e79b8c503
https://github.com/fabioz/PyDev.Debugger/blob/ed9c4307662a5593b8a7f1f3389ecd0e79b8c503/_pydevd_bundle/pydevd_safe_repr.py#L85-L116
train
209,420
fabioz/PyDev.Debugger
third_party/pep8/lib2to3/lib2to3/btm_utils.py
MinNode.leaf_to_root
def leaf_to_root(self): """Internal method. Returns a characteristic path of the pattern tree. This method must be run for all leaves until the linear subpatterns are merged into a single""" node = self subp = [] while node: if node.type == TYPE_ALTERNATIVES: node.alternatives.append(subp) if len(node.alternatives) == len(node.children): #last alternative subp = [tuple(node.alternatives)] node.alternatives = [] node = node.parent continue else: node = node.parent subp = None break if node.type == TYPE_GROUP: node.group.append(subp) #probably should check the number of leaves if len(node.group) == len(node.children): subp = get_characteristic_subpattern(node.group) node.group = [] node = node.parent continue else: node = node.parent subp = None break if node.type == token_labels.NAME and node.name: #in case of type=name, use the name instead subp.append(node.name) else: subp.append(node.type) node = node.parent return subp
python
def leaf_to_root(self): """Internal method. Returns a characteristic path of the pattern tree. This method must be run for all leaves until the linear subpatterns are merged into a single""" node = self subp = [] while node: if node.type == TYPE_ALTERNATIVES: node.alternatives.append(subp) if len(node.alternatives) == len(node.children): #last alternative subp = [tuple(node.alternatives)] node.alternatives = [] node = node.parent continue else: node = node.parent subp = None break if node.type == TYPE_GROUP: node.group.append(subp) #probably should check the number of leaves if len(node.group) == len(node.children): subp = get_characteristic_subpattern(node.group) node.group = [] node = node.parent continue else: node = node.parent subp = None break if node.type == token_labels.NAME and node.name: #in case of type=name, use the name instead subp.append(node.name) else: subp.append(node.type) node = node.parent return subp
[ "def", "leaf_to_root", "(", "self", ")", ":", "node", "=", "self", "subp", "=", "[", "]", "while", "node", ":", "if", "node", ".", "type", "==", "TYPE_ALTERNATIVES", ":", "node", ".", "alternatives", ".", "append", "(", "subp", ")", "if", "len", "(",...
Internal method. Returns a characteristic path of the pattern tree. This method must be run for all leaves until the linear subpatterns are merged into a single
[ "Internal", "method", ".", "Returns", "a", "characteristic", "path", "of", "the", "pattern", "tree", ".", "This", "method", "must", "be", "run", "for", "all", "leaves", "until", "the", "linear", "subpatterns", "are", "merged", "into", "a", "single" ]
ed9c4307662a5593b8a7f1f3389ecd0e79b8c503
https://github.com/fabioz/PyDev.Debugger/blob/ed9c4307662a5593b8a7f1f3389ecd0e79b8c503/third_party/pep8/lib2to3/lib2to3/btm_utils.py#L33-L73
train
209,421
fabioz/PyDev.Debugger
third_party/pep8/lib2to3/lib2to3/btm_utils.py
MinNode.leaves
def leaves(self): "Generator that returns the leaves of the tree" for child in self.children: for x in child.leaves(): yield x if not self.children: yield self
python
def leaves(self): "Generator that returns the leaves of the tree" for child in self.children: for x in child.leaves(): yield x if not self.children: yield self
[ "def", "leaves", "(", "self", ")", ":", "for", "child", "in", "self", ".", "children", ":", "for", "x", "in", "child", ".", "leaves", "(", ")", ":", "yield", "x", "if", "not", "self", ".", "children", ":", "yield", "self" ]
Generator that returns the leaves of the tree
[ "Generator", "that", "returns", "the", "leaves", "of", "the", "tree" ]
ed9c4307662a5593b8a7f1f3389ecd0e79b8c503
https://github.com/fabioz/PyDev.Debugger/blob/ed9c4307662a5593b8a7f1f3389ecd0e79b8c503/third_party/pep8/lib2to3/lib2to3/btm_utils.py#L96-L102
train
209,422
fabioz/PyDev.Debugger
third_party/pep8/lib2to3/lib2to3/patcomp.py
tokenize_wrapper
def tokenize_wrapper(input): """Tokenizes a string suppressing significant whitespace.""" skip = set((token.NEWLINE, token.INDENT, token.DEDENT)) tokens = tokenize.generate_tokens(StringIO.StringIO(input).readline) for quintuple in tokens: type, value, start, end, line_text = quintuple if type not in skip: yield quintuple
python
def tokenize_wrapper(input): """Tokenizes a string suppressing significant whitespace.""" skip = set((token.NEWLINE, token.INDENT, token.DEDENT)) tokens = tokenize.generate_tokens(StringIO.StringIO(input).readline) for quintuple in tokens: type, value, start, end, line_text = quintuple if type not in skip: yield quintuple
[ "def", "tokenize_wrapper", "(", "input", ")", ":", "skip", "=", "set", "(", "(", "token", ".", "NEWLINE", ",", "token", ".", "INDENT", ",", "token", ".", "DEDENT", ")", ")", "tokens", "=", "tokenize", ".", "generate_tokens", "(", "StringIO", ".", "Stri...
Tokenizes a string suppressing significant whitespace.
[ "Tokenizes", "a", "string", "suppressing", "significant", "whitespace", "." ]
ed9c4307662a5593b8a7f1f3389ecd0e79b8c503
https://github.com/fabioz/PyDev.Debugger/blob/ed9c4307662a5593b8a7f1f3389ecd0e79b8c503/third_party/pep8/lib2to3/lib2to3/patcomp.py#L33-L40
train
209,423
fabioz/PyDev.Debugger
third_party/pep8/lib2to3/lib2to3/patcomp.py
pattern_convert
def pattern_convert(grammar, raw_node_info): """Converts raw node information to a Node or Leaf instance.""" type, value, context, children = raw_node_info if children or type in grammar.number2symbol: return pytree.Node(type, children, context=context) else: return pytree.Leaf(type, value, context=context)
python
def pattern_convert(grammar, raw_node_info): """Converts raw node information to a Node or Leaf instance.""" type, value, context, children = raw_node_info if children or type in grammar.number2symbol: return pytree.Node(type, children, context=context) else: return pytree.Leaf(type, value, context=context)
[ "def", "pattern_convert", "(", "grammar", ",", "raw_node_info", ")", ":", "type", ",", "value", ",", "context", ",", "children", "=", "raw_node_info", "if", "children", "or", "type", "in", "grammar", ".", "number2symbol", ":", "return", "pytree", ".", "Node"...
Converts raw node information to a Node or Leaf instance.
[ "Converts", "raw", "node", "information", "to", "a", "Node", "or", "Leaf", "instance", "." ]
ed9c4307662a5593b8a7f1f3389ecd0e79b8c503
https://github.com/fabioz/PyDev.Debugger/blob/ed9c4307662a5593b8a7f1f3389ecd0e79b8c503/third_party/pep8/lib2to3/lib2to3/patcomp.py#L195-L201
train
209,424
fabioz/PyDev.Debugger
third_party/pep8/lib2to3/lib2to3/patcomp.py
PatternCompiler.compile_node
def compile_node(self, node): """Compiles a node, recursively. This is one big switch on the node type. """ # XXX Optimize certain Wildcard-containing-Wildcard patterns # that can be merged if node.type == self.syms.Matcher: node = node.children[0] # Avoid unneeded recursion if node.type == self.syms.Alternatives: # Skip the odd children since they are just '|' tokens alts = [self.compile_node(ch) for ch in node.children[::2]] if len(alts) == 1: return alts[0] p = pytree.WildcardPattern([[a] for a in alts], min=1, max=1) return p.optimize() if node.type == self.syms.Alternative: units = [self.compile_node(ch) for ch in node.children] if len(units) == 1: return units[0] p = pytree.WildcardPattern([units], min=1, max=1) return p.optimize() if node.type == self.syms.NegatedUnit: pattern = self.compile_basic(node.children[1:]) p = pytree.NegatedPattern(pattern) return p.optimize() assert node.type == self.syms.Unit name = None nodes = node.children if len(nodes) >= 3 and nodes[1].type == token.EQUAL: name = nodes[0].value nodes = nodes[2:] repeat = None if len(nodes) >= 2 and nodes[-1].type == self.syms.Repeater: repeat = nodes[-1] nodes = nodes[:-1] # Now we've reduced it to: STRING | NAME [Details] | (...) | [...] pattern = self.compile_basic(nodes, repeat) if repeat is not None: assert repeat.type == self.syms.Repeater children = repeat.children child = children[0] if child.type == token.STAR: min = 0 max = pytree.HUGE elif child.type == token.PLUS: min = 1 max = pytree.HUGE elif child.type == token.LBRACE: assert children[-1].type == token.RBRACE assert len(children) in (3, 5) min = max = self.get_int(children[1]) if len(children) == 5: max = self.get_int(children[3]) else: assert False if min != 1 or max != 1: pattern = pattern.optimize() pattern = pytree.WildcardPattern([[pattern]], min=min, max=max) if name is not None: pattern.name = name return pattern.optimize()
python
def compile_node(self, node): """Compiles a node, recursively. This is one big switch on the node type. """ # XXX Optimize certain Wildcard-containing-Wildcard patterns # that can be merged if node.type == self.syms.Matcher: node = node.children[0] # Avoid unneeded recursion if node.type == self.syms.Alternatives: # Skip the odd children since they are just '|' tokens alts = [self.compile_node(ch) for ch in node.children[::2]] if len(alts) == 1: return alts[0] p = pytree.WildcardPattern([[a] for a in alts], min=1, max=1) return p.optimize() if node.type == self.syms.Alternative: units = [self.compile_node(ch) for ch in node.children] if len(units) == 1: return units[0] p = pytree.WildcardPattern([units], min=1, max=1) return p.optimize() if node.type == self.syms.NegatedUnit: pattern = self.compile_basic(node.children[1:]) p = pytree.NegatedPattern(pattern) return p.optimize() assert node.type == self.syms.Unit name = None nodes = node.children if len(nodes) >= 3 and nodes[1].type == token.EQUAL: name = nodes[0].value nodes = nodes[2:] repeat = None if len(nodes) >= 2 and nodes[-1].type == self.syms.Repeater: repeat = nodes[-1] nodes = nodes[:-1] # Now we've reduced it to: STRING | NAME [Details] | (...) | [...] pattern = self.compile_basic(nodes, repeat) if repeat is not None: assert repeat.type == self.syms.Repeater children = repeat.children child = children[0] if child.type == token.STAR: min = 0 max = pytree.HUGE elif child.type == token.PLUS: min = 1 max = pytree.HUGE elif child.type == token.LBRACE: assert children[-1].type == token.RBRACE assert len(children) in (3, 5) min = max = self.get_int(children[1]) if len(children) == 5: max = self.get_int(children[3]) else: assert False if min != 1 or max != 1: pattern = pattern.optimize() pattern = pytree.WildcardPattern([[pattern]], min=min, max=max) if name is not None: pattern.name = name return pattern.optimize()
[ "def", "compile_node", "(", "self", ",", "node", ")", ":", "# XXX Optimize certain Wildcard-containing-Wildcard patterns", "# that can be merged", "if", "node", ".", "type", "==", "self", ".", "syms", ".", "Matcher", ":", "node", "=", "node", ".", "children", "[",...
Compiles a node, recursively. This is one big switch on the node type.
[ "Compiles", "a", "node", "recursively", "." ]
ed9c4307662a5593b8a7f1f3389ecd0e79b8c503
https://github.com/fabioz/PyDev.Debugger/blob/ed9c4307662a5593b8a7f1f3389ecd0e79b8c503/third_party/pep8/lib2to3/lib2to3/patcomp.py#L68-L137
train
209,425
fabioz/PyDev.Debugger
pydevd_attach_to_process/winappdbg/win32/user32.py
MAKE_WPARAM
def MAKE_WPARAM(wParam): """ Convert arguments to the WPARAM type. Used automatically by SendMessage, PostMessage, etc. You shouldn't need to call this function. """ wParam = ctypes.cast(wParam, LPVOID).value if wParam is None: wParam = 0 return wParam
python
def MAKE_WPARAM(wParam): """ Convert arguments to the WPARAM type. Used automatically by SendMessage, PostMessage, etc. You shouldn't need to call this function. """ wParam = ctypes.cast(wParam, LPVOID).value if wParam is None: wParam = 0 return wParam
[ "def", "MAKE_WPARAM", "(", "wParam", ")", ":", "wParam", "=", "ctypes", ".", "cast", "(", "wParam", ",", "LPVOID", ")", ".", "value", "if", "wParam", "is", "None", ":", "wParam", "=", "0", "return", "wParam" ]
Convert arguments to the WPARAM type. Used automatically by SendMessage, PostMessage, etc. You shouldn't need to call this function.
[ "Convert", "arguments", "to", "the", "WPARAM", "type", ".", "Used", "automatically", "by", "SendMessage", "PostMessage", "etc", ".", "You", "shouldn", "t", "need", "to", "call", "this", "function", "." ]
ed9c4307662a5593b8a7f1f3389ecd0e79b8c503
https://github.com/fabioz/PyDev.Debugger/blob/ed9c4307662a5593b8a7f1f3389ecd0e79b8c503/pydevd_attach_to_process/winappdbg/win32/user32.py#L50-L59
train
209,426
fabioz/PyDev.Debugger
pydevd_attach_to_process/winappdbg/registry.py
RegistryKey.iterchildren
def iterchildren(self): """ Iterates the subkeys for this Registry key. @rtype: iter of L{RegistryKey} @return: Iterator of subkeys. """ handle = self.handle index = 0 while 1: subkey = win32.RegEnumKey(handle, index) if subkey is None: break yield self.child(subkey) index += 1
python
def iterchildren(self): """ Iterates the subkeys for this Registry key. @rtype: iter of L{RegistryKey} @return: Iterator of subkeys. """ handle = self.handle index = 0 while 1: subkey = win32.RegEnumKey(handle, index) if subkey is None: break yield self.child(subkey) index += 1
[ "def", "iterchildren", "(", "self", ")", ":", "handle", "=", "self", ".", "handle", "index", "=", "0", "while", "1", ":", "subkey", "=", "win32", ".", "RegEnumKey", "(", "handle", ",", "index", ")", "if", "subkey", "is", "None", ":", "break", "yield"...
Iterates the subkeys for this Registry key. @rtype: iter of L{RegistryKey} @return: Iterator of subkeys.
[ "Iterates", "the", "subkeys", "for", "this", "Registry", "key", "." ]
ed9c4307662a5593b8a7f1f3389ecd0e79b8c503
https://github.com/fabioz/PyDev.Debugger/blob/ed9c4307662a5593b8a7f1f3389ecd0e79b8c503/pydevd_attach_to_process/winappdbg/registry.py#L294-L308
train
209,427
fabioz/PyDev.Debugger
pydevd_attach_to_process/winappdbg/registry.py
RegistryKey.children
def children(self): """ Returns a list of subkeys for this Registry key. @rtype: list(L{RegistryKey}) @return: List of subkeys. """ # return list(self.iterchildren()) # that can't be optimized by psyco handle = self.handle result = [] index = 0 while 1: subkey = win32.RegEnumKey(handle, index) if subkey is None: break result.append( self.child(subkey) ) index += 1 return result
python
def children(self): """ Returns a list of subkeys for this Registry key. @rtype: list(L{RegistryKey}) @return: List of subkeys. """ # return list(self.iterchildren()) # that can't be optimized by psyco handle = self.handle result = [] index = 0 while 1: subkey = win32.RegEnumKey(handle, index) if subkey is None: break result.append( self.child(subkey) ) index += 1 return result
[ "def", "children", "(", "self", ")", ":", "# return list(self.iterchildren()) # that can't be optimized by psyco", "handle", "=", "self", ".", "handle", "result", "=", "[", "]", "index", "=", "0", "while", "1", ":", "subkey", "=", "win32", ".", "RegEnumKey", "("...
Returns a list of subkeys for this Registry key. @rtype: list(L{RegistryKey}) @return: List of subkeys.
[ "Returns", "a", "list", "of", "subkeys", "for", "this", "Registry", "key", "." ]
ed9c4307662a5593b8a7f1f3389ecd0e79b8c503
https://github.com/fabioz/PyDev.Debugger/blob/ed9c4307662a5593b8a7f1f3389ecd0e79b8c503/pydevd_attach_to_process/winappdbg/registry.py#L310-L327
train
209,428
fabioz/PyDev.Debugger
pydevd_attach_to_process/winappdbg/registry.py
RegistryKey.child
def child(self, subkey): """ Retrieves a subkey for this Registry key, given its name. @type subkey: str @param subkey: Name of the subkey. @rtype: L{RegistryKey} @return: Subkey. """ path = self._path + '\\' + subkey handle = win32.RegOpenKey(self.handle, subkey) return RegistryKey(path, handle)
python
def child(self, subkey): """ Retrieves a subkey for this Registry key, given its name. @type subkey: str @param subkey: Name of the subkey. @rtype: L{RegistryKey} @return: Subkey. """ path = self._path + '\\' + subkey handle = win32.RegOpenKey(self.handle, subkey) return RegistryKey(path, handle)
[ "def", "child", "(", "self", ",", "subkey", ")", ":", "path", "=", "self", ".", "_path", "+", "'\\\\'", "+", "subkey", "handle", "=", "win32", ".", "RegOpenKey", "(", "self", ".", "handle", ",", "subkey", ")", "return", "RegistryKey", "(", "path", ",...
Retrieves a subkey for this Registry key, given its name. @type subkey: str @param subkey: Name of the subkey. @rtype: L{RegistryKey} @return: Subkey.
[ "Retrieves", "a", "subkey", "for", "this", "Registry", "key", "given", "its", "name", "." ]
ed9c4307662a5593b8a7f1f3389ecd0e79b8c503
https://github.com/fabioz/PyDev.Debugger/blob/ed9c4307662a5593b8a7f1f3389ecd0e79b8c503/pydevd_attach_to_process/winappdbg/registry.py#L329-L341
train
209,429
fabioz/PyDev.Debugger
pydevd_attach_to_process/winappdbg/registry.py
Registry._split_path
def _split_path(self, path): """ Splits a Registry path and returns the hive and key. @type path: str @param path: Registry path. @rtype: tuple( int, str ) @return: Tuple containing the hive handle and the subkey path. The hive handle is always one of the following integer constants: - L{win32.HKEY_CLASSES_ROOT} - L{win32.HKEY_CURRENT_USER} - L{win32.HKEY_LOCAL_MACHINE} - L{win32.HKEY_USERS} - L{win32.HKEY_PERFORMANCE_DATA} - L{win32.HKEY_CURRENT_CONFIG} """ if '\\' in path: p = path.find('\\') hive = path[:p] path = path[p+1:] else: hive = path path = None handle = self._hives_by_name[ hive.upper() ] return handle, path
python
def _split_path(self, path): """ Splits a Registry path and returns the hive and key. @type path: str @param path: Registry path. @rtype: tuple( int, str ) @return: Tuple containing the hive handle and the subkey path. The hive handle is always one of the following integer constants: - L{win32.HKEY_CLASSES_ROOT} - L{win32.HKEY_CURRENT_USER} - L{win32.HKEY_LOCAL_MACHINE} - L{win32.HKEY_USERS} - L{win32.HKEY_PERFORMANCE_DATA} - L{win32.HKEY_CURRENT_CONFIG} """ if '\\' in path: p = path.find('\\') hive = path[:p] path = path[p+1:] else: hive = path path = None handle = self._hives_by_name[ hive.upper() ] return handle, path
[ "def", "_split_path", "(", "self", ",", "path", ")", ":", "if", "'\\\\'", "in", "path", ":", "p", "=", "path", ".", "find", "(", "'\\\\'", ")", "hive", "=", "path", "[", ":", "p", "]", "path", "=", "path", "[", "p", "+", "1", ":", "]", "else"...
Splits a Registry path and returns the hive and key. @type path: str @param path: Registry path. @rtype: tuple( int, str ) @return: Tuple containing the hive handle and the subkey path. The hive handle is always one of the following integer constants: - L{win32.HKEY_CLASSES_ROOT} - L{win32.HKEY_CURRENT_USER} - L{win32.HKEY_LOCAL_MACHINE} - L{win32.HKEY_USERS} - L{win32.HKEY_PERFORMANCE_DATA} - L{win32.HKEY_CURRENT_CONFIG}
[ "Splits", "a", "Registry", "path", "and", "returns", "the", "hive", "and", "key", "." ]
ed9c4307662a5593b8a7f1f3389ecd0e79b8c503
https://github.com/fabioz/PyDev.Debugger/blob/ed9c4307662a5593b8a7f1f3389ecd0e79b8c503/pydevd_attach_to_process/winappdbg/registry.py#L429-L454
train
209,430
fabioz/PyDev.Debugger
pydevd_attach_to_process/winappdbg/registry.py
Registry._parse_path
def _parse_path(self, path): """ Parses a Registry path and returns the hive and key. @type path: str @param path: Registry path. @rtype: tuple( int, str ) @return: Tuple containing the hive handle and the subkey path. For a local Registry, the hive handle is an integer. For a remote Registry, the hive handle is a L{RegistryKeyHandle}. """ handle, path = self._split_path(path) if self._machine is not None: handle = self._connect_hive(handle) return handle, path
python
def _parse_path(self, path): """ Parses a Registry path and returns the hive and key. @type path: str @param path: Registry path. @rtype: tuple( int, str ) @return: Tuple containing the hive handle and the subkey path. For a local Registry, the hive handle is an integer. For a remote Registry, the hive handle is a L{RegistryKeyHandle}. """ handle, path = self._split_path(path) if self._machine is not None: handle = self._connect_hive(handle) return handle, path
[ "def", "_parse_path", "(", "self", ",", "path", ")", ":", "handle", ",", "path", "=", "self", ".", "_split_path", "(", "path", ")", "if", "self", ".", "_machine", "is", "not", "None", ":", "handle", "=", "self", ".", "_connect_hive", "(", "handle", "...
Parses a Registry path and returns the hive and key. @type path: str @param path: Registry path. @rtype: tuple( int, str ) @return: Tuple containing the hive handle and the subkey path. For a local Registry, the hive handle is an integer. For a remote Registry, the hive handle is a L{RegistryKeyHandle}.
[ "Parses", "a", "Registry", "path", "and", "returns", "the", "hive", "and", "key", "." ]
ed9c4307662a5593b8a7f1f3389ecd0e79b8c503
https://github.com/fabioz/PyDev.Debugger/blob/ed9c4307662a5593b8a7f1f3389ecd0e79b8c503/pydevd_attach_to_process/winappdbg/registry.py#L456-L471
train
209,431
fabioz/PyDev.Debugger
pydevd_attach_to_process/winappdbg/registry.py
Registry._join_path
def _join_path(self, hive, subkey): """ Joins the hive and key to make a Registry path. @type hive: int @param hive: Registry hive handle. The hive handle must be one of the following integer constants: - L{win32.HKEY_CLASSES_ROOT} - L{win32.HKEY_CURRENT_USER} - L{win32.HKEY_LOCAL_MACHINE} - L{win32.HKEY_USERS} - L{win32.HKEY_PERFORMANCE_DATA} - L{win32.HKEY_CURRENT_CONFIG} @type subkey: str @param subkey: Subkey path. @rtype: str @return: Registry path. """ path = self._hives_by_value[hive] if subkey: path = path + '\\' + subkey return path
python
def _join_path(self, hive, subkey): """ Joins the hive and key to make a Registry path. @type hive: int @param hive: Registry hive handle. The hive handle must be one of the following integer constants: - L{win32.HKEY_CLASSES_ROOT} - L{win32.HKEY_CURRENT_USER} - L{win32.HKEY_LOCAL_MACHINE} - L{win32.HKEY_USERS} - L{win32.HKEY_PERFORMANCE_DATA} - L{win32.HKEY_CURRENT_CONFIG} @type subkey: str @param subkey: Subkey path. @rtype: str @return: Registry path. """ path = self._hives_by_value[hive] if subkey: path = path + '\\' + subkey return path
[ "def", "_join_path", "(", "self", ",", "hive", ",", "subkey", ")", ":", "path", "=", "self", ".", "_hives_by_value", "[", "hive", "]", "if", "subkey", ":", "path", "=", "path", "+", "'\\\\'", "+", "subkey", "return", "path" ]
Joins the hive and key to make a Registry path. @type hive: int @param hive: Registry hive handle. The hive handle must be one of the following integer constants: - L{win32.HKEY_CLASSES_ROOT} - L{win32.HKEY_CURRENT_USER} - L{win32.HKEY_LOCAL_MACHINE} - L{win32.HKEY_USERS} - L{win32.HKEY_PERFORMANCE_DATA} - L{win32.HKEY_CURRENT_CONFIG} @type subkey: str @param subkey: Subkey path. @rtype: str @return: Registry path.
[ "Joins", "the", "hive", "and", "key", "to", "make", "a", "Registry", "path", "." ]
ed9c4307662a5593b8a7f1f3389ecd0e79b8c503
https://github.com/fabioz/PyDev.Debugger/blob/ed9c4307662a5593b8a7f1f3389ecd0e79b8c503/pydevd_attach_to_process/winappdbg/registry.py#L473-L496
train
209,432
fabioz/PyDev.Debugger
pydevd_attach_to_process/winappdbg/registry.py
Registry._connect_hive
def _connect_hive(self, hive): """ Connect to the specified hive of a remote Registry. @note: The connection will be cached, to close all connections and erase this cache call the L{close} method. @type hive: int @param hive: Hive to connect to. @rtype: L{win32.RegistryKeyHandle} @return: Open handle to the remote Registry hive. """ try: handle = self._remote_hives[hive] except KeyError: handle = win32.RegConnectRegistry(self._machine, hive) self._remote_hives[hive] = handle return handle
python
def _connect_hive(self, hive): """ Connect to the specified hive of a remote Registry. @note: The connection will be cached, to close all connections and erase this cache call the L{close} method. @type hive: int @param hive: Hive to connect to. @rtype: L{win32.RegistryKeyHandle} @return: Open handle to the remote Registry hive. """ try: handle = self._remote_hives[hive] except KeyError: handle = win32.RegConnectRegistry(self._machine, hive) self._remote_hives[hive] = handle return handle
[ "def", "_connect_hive", "(", "self", ",", "hive", ")", ":", "try", ":", "handle", "=", "self", ".", "_remote_hives", "[", "hive", "]", "except", "KeyError", ":", "handle", "=", "win32", ".", "RegConnectRegistry", "(", "self", ".", "_machine", ",", "hive"...
Connect to the specified hive of a remote Registry. @note: The connection will be cached, to close all connections and erase this cache call the L{close} method. @type hive: int @param hive: Hive to connect to. @rtype: L{win32.RegistryKeyHandle} @return: Open handle to the remote Registry hive.
[ "Connect", "to", "the", "specified", "hive", "of", "a", "remote", "Registry", "." ]
ed9c4307662a5593b8a7f1f3389ecd0e79b8c503
https://github.com/fabioz/PyDev.Debugger/blob/ed9c4307662a5593b8a7f1f3389ecd0e79b8c503/pydevd_attach_to_process/winappdbg/registry.py#L510-L528
train
209,433
fabioz/PyDev.Debugger
pydevd_attach_to_process/winappdbg/registry.py
Registry.close
def close(self): """ Closes all open connections to the remote Registry. No exceptions are raised, even if an error occurs. This method has no effect when opening the local Registry. The remote Registry will still be accessible after calling this method (new connections will be opened automatically on access). """ while self._remote_hives: hive = self._remote_hives.popitem()[1] try: hive.close() except Exception: try: e = sys.exc_info()[1] msg = "Cannot close registry hive handle %s, reason: %s" msg %= (hive.value, str(e)) warnings.warn(msg) except Exception: pass
python
def close(self): """ Closes all open connections to the remote Registry. No exceptions are raised, even if an error occurs. This method has no effect when opening the local Registry. The remote Registry will still be accessible after calling this method (new connections will be opened automatically on access). """ while self._remote_hives: hive = self._remote_hives.popitem()[1] try: hive.close() except Exception: try: e = sys.exc_info()[1] msg = "Cannot close registry hive handle %s, reason: %s" msg %= (hive.value, str(e)) warnings.warn(msg) except Exception: pass
[ "def", "close", "(", "self", ")", ":", "while", "self", ".", "_remote_hives", ":", "hive", "=", "self", ".", "_remote_hives", ".", "popitem", "(", ")", "[", "1", "]", "try", ":", "hive", ".", "close", "(", ")", "except", "Exception", ":", "try", ":...
Closes all open connections to the remote Registry. No exceptions are raised, even if an error occurs. This method has no effect when opening the local Registry. The remote Registry will still be accessible after calling this method (new connections will be opened automatically on access).
[ "Closes", "all", "open", "connections", "to", "the", "remote", "Registry", "." ]
ed9c4307662a5593b8a7f1f3389ecd0e79b8c503
https://github.com/fabioz/PyDev.Debugger/blob/ed9c4307662a5593b8a7f1f3389ecd0e79b8c503/pydevd_attach_to_process/winappdbg/registry.py#L530-L552
train
209,434
fabioz/PyDev.Debugger
pydevd_attach_to_process/winappdbg/registry.py
Registry.create
def create(self, path): """ Creates a new Registry key. @type path: str @param path: Registry key path. @rtype: L{RegistryKey} @return: The newly created Registry key. """ path = self._sanitize_path(path) hive, subpath = self._parse_path(path) handle = win32.RegCreateKey(hive, subpath) return RegistryKey(path, handle)
python
def create(self, path): """ Creates a new Registry key. @type path: str @param path: Registry key path. @rtype: L{RegistryKey} @return: The newly created Registry key. """ path = self._sanitize_path(path) hive, subpath = self._parse_path(path) handle = win32.RegCreateKey(hive, subpath) return RegistryKey(path, handle)
[ "def", "create", "(", "self", ",", "path", ")", ":", "path", "=", "self", ".", "_sanitize_path", "(", "path", ")", "hive", ",", "subpath", "=", "self", ".", "_parse_path", "(", "path", ")", "handle", "=", "win32", ".", "RegCreateKey", "(", "hive", ",...
Creates a new Registry key. @type path: str @param path: Registry key path. @rtype: L{RegistryKey} @return: The newly created Registry key.
[ "Creates", "a", "new", "Registry", "key", "." ]
ed9c4307662a5593b8a7f1f3389ecd0e79b8c503
https://github.com/fabioz/PyDev.Debugger/blob/ed9c4307662a5593b8a7f1f3389ecd0e79b8c503/pydevd_attach_to_process/winappdbg/registry.py#L620-L633
train
209,435
fabioz/PyDev.Debugger
pydevd_attach_to_process/winappdbg/registry.py
Registry.subkeys
def subkeys(self, path): """ Returns a list of subkeys for the given Registry key. @type path: str @param path: Registry key path. @rtype: list(str) @return: List of subkey names. """ result = list() hive, subpath = self._parse_path(path) with win32.RegOpenKey(hive, subpath) as handle: index = 0 while 1: name = win32.RegEnumKey(handle, index) if name is None: break result.append(name) index += 1 return result
python
def subkeys(self, path): """ Returns a list of subkeys for the given Registry key. @type path: str @param path: Registry key path. @rtype: list(str) @return: List of subkey names. """ result = list() hive, subpath = self._parse_path(path) with win32.RegOpenKey(hive, subpath) as handle: index = 0 while 1: name = win32.RegEnumKey(handle, index) if name is None: break result.append(name) index += 1 return result
[ "def", "subkeys", "(", "self", ",", "path", ")", ":", "result", "=", "list", "(", ")", "hive", ",", "subpath", "=", "self", ".", "_parse_path", "(", "path", ")", "with", "win32", ".", "RegOpenKey", "(", "hive", ",", "subpath", ")", "as", "handle", ...
Returns a list of subkeys for the given Registry key. @type path: str @param path: Registry key path. @rtype: list(str) @return: List of subkey names.
[ "Returns", "a", "list", "of", "subkeys", "for", "the", "given", "Registry", "key", "." ]
ed9c4307662a5593b8a7f1f3389ecd0e79b8c503
https://github.com/fabioz/PyDev.Debugger/blob/ed9c4307662a5593b8a7f1f3389ecd0e79b8c503/pydevd_attach_to_process/winappdbg/registry.py#L635-L655
train
209,436
fabioz/PyDev.Debugger
pydevd_attach_to_process/winappdbg/registry.py
Registry.iterate
def iterate(self, path): """ Returns a recursive iterator on the specified key and its subkeys. @type path: str @param path: Registry key path. @rtype: iterator @return: Recursive iterator that returns Registry key paths. @raise KeyError: The specified path does not exist. """ if path.endswith('\\'): path = path[:-1] if not self.has_key(path): raise KeyError(path) stack = collections.deque() stack.appendleft(path) return self.__iterate(stack)
python
def iterate(self, path): """ Returns a recursive iterator on the specified key and its subkeys. @type path: str @param path: Registry key path. @rtype: iterator @return: Recursive iterator that returns Registry key paths. @raise KeyError: The specified path does not exist. """ if path.endswith('\\'): path = path[:-1] if not self.has_key(path): raise KeyError(path) stack = collections.deque() stack.appendleft(path) return self.__iterate(stack)
[ "def", "iterate", "(", "self", ",", "path", ")", ":", "if", "path", ".", "endswith", "(", "'\\\\'", ")", ":", "path", "=", "path", "[", ":", "-", "1", "]", "if", "not", "self", ".", "has_key", "(", "path", ")", ":", "raise", "KeyError", "(", "p...
Returns a recursive iterator on the specified key and its subkeys. @type path: str @param path: Registry key path. @rtype: iterator @return: Recursive iterator that returns Registry key paths. @raise KeyError: The specified path does not exist.
[ "Returns", "a", "recursive", "iterator", "on", "the", "specified", "key", "and", "its", "subkeys", "." ]
ed9c4307662a5593b8a7f1f3389ecd0e79b8c503
https://github.com/fabioz/PyDev.Debugger/blob/ed9c4307662a5593b8a7f1f3389ecd0e79b8c503/pydevd_attach_to_process/winappdbg/registry.py#L657-L675
train
209,437
fabioz/PyDev.Debugger
pydevd_attach_to_process/winappdbg/registry.py
Registry.iterkeys
def iterkeys(self): """ Returns an iterator that crawls the entire Windows Registry. """ stack = collections.deque(self._hives) stack.reverse() return self.__iterate(stack)
python
def iterkeys(self): """ Returns an iterator that crawls the entire Windows Registry. """ stack = collections.deque(self._hives) stack.reverse() return self.__iterate(stack)
[ "def", "iterkeys", "(", "self", ")", ":", "stack", "=", "collections", ".", "deque", "(", "self", ".", "_hives", ")", "stack", ".", "reverse", "(", ")", "return", "self", ".", "__iterate", "(", "stack", ")" ]
Returns an iterator that crawls the entire Windows Registry.
[ "Returns", "an", "iterator", "that", "crawls", "the", "entire", "Windows", "Registry", "." ]
ed9c4307662a5593b8a7f1f3389ecd0e79b8c503
https://github.com/fabioz/PyDev.Debugger/blob/ed9c4307662a5593b8a7f1f3389ecd0e79b8c503/pydevd_attach_to_process/winappdbg/registry.py#L677-L683
train
209,438
fabioz/PyDev.Debugger
_pydevd_bundle/pydevd_command_line_handling.py
process_command_line
def process_command_line(argv): """ parses the arguments. removes our arguments from the command line """ setup = {} for handler in ACCEPTED_ARG_HANDLERS: setup[handler.arg_name] = handler.default_val setup['file'] = '' setup['qt-support'] = '' i = 0 del argv[0] while i < len(argv): handler = ARGV_REP_TO_HANDLER.get(argv[i]) if handler is not None: handler.handle_argv(argv, i, setup) elif argv[i].startswith('--qt-support'): # The --qt-support is special because we want to keep backward compatibility: # Previously, just passing '--qt-support' meant that we should use the auto-discovery mode # whereas now, if --qt-support is passed, it should be passed as --qt-support=<mode>, where # mode can be one of 'auto', 'none', 'pyqt5', 'pyqt4', 'pyside'. if argv[i] == '--qt-support': setup['qt-support'] = 'auto' elif argv[i].startswith('--qt-support='): qt_support = argv[i][len('--qt-support='):] valid_modes = ('none', 'auto', 'pyqt5', 'pyqt4', 'pyside') if qt_support not in valid_modes: raise ValueError("qt-support mode invalid: " + qt_support) if qt_support == 'none': # On none, actually set an empty string to evaluate to False. setup['qt-support'] = '' else: setup['qt-support'] = qt_support else: raise ValueError("Unexpected definition for qt-support flag: " + argv[i]) del argv[i] elif argv[i] == '--file': # --file is special because it's the last one (so, no handler for it). del argv[i] setup['file'] = argv[i] i = len(argv) # pop out, file is our last argument elif argv[i] == '--DEBUG': from pydevd import set_debug del argv[i] set_debug(setup) else: raise ValueError("Unexpected option: " + argv[i]) return setup
python
def process_command_line(argv): """ parses the arguments. removes our arguments from the command line """ setup = {} for handler in ACCEPTED_ARG_HANDLERS: setup[handler.arg_name] = handler.default_val setup['file'] = '' setup['qt-support'] = '' i = 0 del argv[0] while i < len(argv): handler = ARGV_REP_TO_HANDLER.get(argv[i]) if handler is not None: handler.handle_argv(argv, i, setup) elif argv[i].startswith('--qt-support'): # The --qt-support is special because we want to keep backward compatibility: # Previously, just passing '--qt-support' meant that we should use the auto-discovery mode # whereas now, if --qt-support is passed, it should be passed as --qt-support=<mode>, where # mode can be one of 'auto', 'none', 'pyqt5', 'pyqt4', 'pyside'. if argv[i] == '--qt-support': setup['qt-support'] = 'auto' elif argv[i].startswith('--qt-support='): qt_support = argv[i][len('--qt-support='):] valid_modes = ('none', 'auto', 'pyqt5', 'pyqt4', 'pyside') if qt_support not in valid_modes: raise ValueError("qt-support mode invalid: " + qt_support) if qt_support == 'none': # On none, actually set an empty string to evaluate to False. setup['qt-support'] = '' else: setup['qt-support'] = qt_support else: raise ValueError("Unexpected definition for qt-support flag: " + argv[i]) del argv[i] elif argv[i] == '--file': # --file is special because it's the last one (so, no handler for it). del argv[i] setup['file'] = argv[i] i = len(argv) # pop out, file is our last argument elif argv[i] == '--DEBUG': from pydevd import set_debug del argv[i] set_debug(setup) else: raise ValueError("Unexpected option: " + argv[i]) return setup
[ "def", "process_command_line", "(", "argv", ")", ":", "setup", "=", "{", "}", "for", "handler", "in", "ACCEPTED_ARG_HANDLERS", ":", "setup", "[", "handler", ".", "arg_name", "]", "=", "handler", ".", "default_val", "setup", "[", "'file'", "]", "=", "''", ...
parses the arguments. removes our arguments from the command line
[ "parses", "the", "arguments", ".", "removes", "our", "arguments", "from", "the", "command", "line" ]
ed9c4307662a5593b8a7f1f3389ecd0e79b8c503
https://github.com/fabioz/PyDev.Debugger/blob/ed9c4307662a5593b8a7f1f3389ecd0e79b8c503/_pydevd_bundle/pydevd_command_line_handling.py#L94-L146
train
209,439
fabioz/PyDev.Debugger
_pydevd_bundle/pydevd_vars.py
getVariable
def getVariable(dbg, thread_id, frame_id, scope, attrs): """ returns the value of a variable :scope: can be BY_ID, EXPRESSION, GLOBAL, LOCAL, FRAME BY_ID means we'll traverse the list of all objects alive to get the object. :attrs: after reaching the proper scope, we have to get the attributes until we find the proper location (i.e.: obj\tattr1\tattr2) :note: when BY_ID is used, the frame_id is considered the id of the object to find and not the frame (as we don't care about the frame in this case). """ if scope == 'BY_ID': if thread_id != get_current_thread_id(threading.currentThread()): raise VariableError("getVariable: must execute on same thread") try: import gc objects = gc.get_objects() except: pass # Not all python variants have it. else: frame_id = int(frame_id) for var in objects: if id(var) == frame_id: if attrs is not None: attrList = attrs.split('\t') for k in attrList: _type, _typeName, resolver = get_type(var) var = resolver.resolve(var, k) return var # If it didn't return previously, we coudn't find it by id (i.e.: alrceady garbage collected). sys.stderr.write('Unable to find object with id: %s\n' % (frame_id,)) return None frame = dbg.find_frame(thread_id, frame_id) if frame is None: return {} if attrs is not None: attrList = attrs.split('\t') else: attrList = [] for attr in attrList: attr.replace("@_@TAB_CHAR@_@", '\t') if scope == 'EXPRESSION': for count in xrange(len(attrList)): if count == 0: # An Expression can be in any scope (globals/locals), therefore it needs to evaluated as an expression var = evaluate_expression(dbg, frame, attrList[count], False) else: _type, _typeName, resolver = get_type(var) var = resolver.resolve(var, attrList[count]) else: if scope == "GLOBAL": var = frame.f_globals del attrList[0] # globals are special, and they get a single dummy unused attribute else: # in a frame access both locals and globals as Python does var = {} var.update(frame.f_globals) var.update(frame.f_locals) for k in attrList: _type, _typeName, resolver = get_type(var) var = resolver.resolve(var, k) return var
python
def getVariable(dbg, thread_id, frame_id, scope, attrs): """ returns the value of a variable :scope: can be BY_ID, EXPRESSION, GLOBAL, LOCAL, FRAME BY_ID means we'll traverse the list of all objects alive to get the object. :attrs: after reaching the proper scope, we have to get the attributes until we find the proper location (i.e.: obj\tattr1\tattr2) :note: when BY_ID is used, the frame_id is considered the id of the object to find and not the frame (as we don't care about the frame in this case). """ if scope == 'BY_ID': if thread_id != get_current_thread_id(threading.currentThread()): raise VariableError("getVariable: must execute on same thread") try: import gc objects = gc.get_objects() except: pass # Not all python variants have it. else: frame_id = int(frame_id) for var in objects: if id(var) == frame_id: if attrs is not None: attrList = attrs.split('\t') for k in attrList: _type, _typeName, resolver = get_type(var) var = resolver.resolve(var, k) return var # If it didn't return previously, we coudn't find it by id (i.e.: alrceady garbage collected). sys.stderr.write('Unable to find object with id: %s\n' % (frame_id,)) return None frame = dbg.find_frame(thread_id, frame_id) if frame is None: return {} if attrs is not None: attrList = attrs.split('\t') else: attrList = [] for attr in attrList: attr.replace("@_@TAB_CHAR@_@", '\t') if scope == 'EXPRESSION': for count in xrange(len(attrList)): if count == 0: # An Expression can be in any scope (globals/locals), therefore it needs to evaluated as an expression var = evaluate_expression(dbg, frame, attrList[count], False) else: _type, _typeName, resolver = get_type(var) var = resolver.resolve(var, attrList[count]) else: if scope == "GLOBAL": var = frame.f_globals del attrList[0] # globals are special, and they get a single dummy unused attribute else: # in a frame access both locals and globals as Python does var = {} var.update(frame.f_globals) var.update(frame.f_locals) for k in attrList: _type, _typeName, resolver = get_type(var) var = resolver.resolve(var, k) return var
[ "def", "getVariable", "(", "dbg", ",", "thread_id", ",", "frame_id", ",", "scope", ",", "attrs", ")", ":", "if", "scope", "==", "'BY_ID'", ":", "if", "thread_id", "!=", "get_current_thread_id", "(", "threading", ".", "currentThread", "(", ")", ")", ":", ...
returns the value of a variable :scope: can be BY_ID, EXPRESSION, GLOBAL, LOCAL, FRAME BY_ID means we'll traverse the list of all objects alive to get the object. :attrs: after reaching the proper scope, we have to get the attributes until we find the proper location (i.e.: obj\tattr1\tattr2) :note: when BY_ID is used, the frame_id is considered the id of the object to find and not the frame (as we don't care about the frame in this case).
[ "returns", "the", "value", "of", "a", "variable" ]
ed9c4307662a5593b8a7f1f3389ecd0e79b8c503
https://github.com/fabioz/PyDev.Debugger/blob/ed9c4307662a5593b8a7f1f3389ecd0e79b8c503/_pydevd_bundle/pydevd_vars.py#L46-L119
train
209,440
fabioz/PyDev.Debugger
_pydevd_bundle/pydevd_vars.py
resolve_compound_variable_fields
def resolve_compound_variable_fields(dbg, thread_id, frame_id, scope, attrs): """ Resolve compound variable in debugger scopes by its name and attributes :param thread_id: id of the variable's thread :param frame_id: id of the variable's frame :param scope: can be BY_ID, EXPRESSION, GLOBAL, LOCAL, FRAME :param attrs: after reaching the proper scope, we have to get the attributes until we find the proper location (i.e.: obj\tattr1\tattr2) :return: a dictionary of variables's fields """ var = getVariable(dbg, thread_id, frame_id, scope, attrs) try: _type, _typeName, resolver = get_type(var) return _typeName, resolver.get_dictionary(var) except: pydev_log.exception('Error evaluating: thread_id: %s\nframe_id: %s\nscope: %s\nattrs: %s.', thread_id, frame_id, scope, attrs)
python
def resolve_compound_variable_fields(dbg, thread_id, frame_id, scope, attrs): """ Resolve compound variable in debugger scopes by its name and attributes :param thread_id: id of the variable's thread :param frame_id: id of the variable's frame :param scope: can be BY_ID, EXPRESSION, GLOBAL, LOCAL, FRAME :param attrs: after reaching the proper scope, we have to get the attributes until we find the proper location (i.e.: obj\tattr1\tattr2) :return: a dictionary of variables's fields """ var = getVariable(dbg, thread_id, frame_id, scope, attrs) try: _type, _typeName, resolver = get_type(var) return _typeName, resolver.get_dictionary(var) except: pydev_log.exception('Error evaluating: thread_id: %s\nframe_id: %s\nscope: %s\nattrs: %s.', thread_id, frame_id, scope, attrs)
[ "def", "resolve_compound_variable_fields", "(", "dbg", ",", "thread_id", ",", "frame_id", ",", "scope", ",", "attrs", ")", ":", "var", "=", "getVariable", "(", "dbg", ",", "thread_id", ",", "frame_id", ",", "scope", ",", "attrs", ")", "try", ":", "_type", ...
Resolve compound variable in debugger scopes by its name and attributes :param thread_id: id of the variable's thread :param frame_id: id of the variable's frame :param scope: can be BY_ID, EXPRESSION, GLOBAL, LOCAL, FRAME :param attrs: after reaching the proper scope, we have to get the attributes until we find the proper location (i.e.: obj\tattr1\tattr2) :return: a dictionary of variables's fields
[ "Resolve", "compound", "variable", "in", "debugger", "scopes", "by", "its", "name", "and", "attributes" ]
ed9c4307662a5593b8a7f1f3389ecd0e79b8c503
https://github.com/fabioz/PyDev.Debugger/blob/ed9c4307662a5593b8a7f1f3389ecd0e79b8c503/_pydevd_bundle/pydevd_vars.py#L122-L141
train
209,441
fabioz/PyDev.Debugger
_pydevd_bundle/pydevd_vars.py
resolve_var_object
def resolve_var_object(var, attrs): """ Resolve variable's attribute :param var: an object of variable :param attrs: a sequence of variable's attributes separated by \t (i.e.: obj\tattr1\tattr2) :return: a value of resolved variable's attribute """ if attrs is not None: attr_list = attrs.split('\t') else: attr_list = [] for k in attr_list: type, _typeName, resolver = get_type(var) var = resolver.resolve(var, k) return var
python
def resolve_var_object(var, attrs): """ Resolve variable's attribute :param var: an object of variable :param attrs: a sequence of variable's attributes separated by \t (i.e.: obj\tattr1\tattr2) :return: a value of resolved variable's attribute """ if attrs is not None: attr_list = attrs.split('\t') else: attr_list = [] for k in attr_list: type, _typeName, resolver = get_type(var) var = resolver.resolve(var, k) return var
[ "def", "resolve_var_object", "(", "var", ",", "attrs", ")", ":", "if", "attrs", "is", "not", "None", ":", "attr_list", "=", "attrs", ".", "split", "(", "'\\t'", ")", "else", ":", "attr_list", "=", "[", "]", "for", "k", "in", "attr_list", ":", "type",...
Resolve variable's attribute :param var: an object of variable :param attrs: a sequence of variable's attributes separated by \t (i.e.: obj\tattr1\tattr2) :return: a value of resolved variable's attribute
[ "Resolve", "variable", "s", "attribute" ]
ed9c4307662a5593b8a7f1f3389ecd0e79b8c503
https://github.com/fabioz/PyDev.Debugger/blob/ed9c4307662a5593b8a7f1f3389ecd0e79b8c503/_pydevd_bundle/pydevd_vars.py#L144-L159
train
209,442
fabioz/PyDev.Debugger
_pydevd_bundle/pydevd_vars.py
resolve_compound_var_object_fields
def resolve_compound_var_object_fields(var, attrs): """ Resolve compound variable by its object and attributes :param var: an object of variable :param attrs: a sequence of variable's attributes separated by \t (i.e.: obj\tattr1\tattr2) :return: a dictionary of variables's fields """ attr_list = attrs.split('\t') for k in attr_list: type, _typeName, resolver = get_type(var) var = resolver.resolve(var, k) try: type, _typeName, resolver = get_type(var) return resolver.get_dictionary(var) except: pydev_log.exception()
python
def resolve_compound_var_object_fields(var, attrs): """ Resolve compound variable by its object and attributes :param var: an object of variable :param attrs: a sequence of variable's attributes separated by \t (i.e.: obj\tattr1\tattr2) :return: a dictionary of variables's fields """ attr_list = attrs.split('\t') for k in attr_list: type, _typeName, resolver = get_type(var) var = resolver.resolve(var, k) try: type, _typeName, resolver = get_type(var) return resolver.get_dictionary(var) except: pydev_log.exception()
[ "def", "resolve_compound_var_object_fields", "(", "var", ",", "attrs", ")", ":", "attr_list", "=", "attrs", ".", "split", "(", "'\\t'", ")", "for", "k", "in", "attr_list", ":", "type", ",", "_typeName", ",", "resolver", "=", "get_type", "(", "var", ")", ...
Resolve compound variable by its object and attributes :param var: an object of variable :param attrs: a sequence of variable's attributes separated by \t (i.e.: obj\tattr1\tattr2) :return: a dictionary of variables's fields
[ "Resolve", "compound", "variable", "by", "its", "object", "and", "attributes" ]
ed9c4307662a5593b8a7f1f3389ecd0e79b8c503
https://github.com/fabioz/PyDev.Debugger/blob/ed9c4307662a5593b8a7f1f3389ecd0e79b8c503/_pydevd_bundle/pydevd_vars.py#L162-L180
train
209,443
fabioz/PyDev.Debugger
_pydevd_bundle/pydevd_vars.py
custom_operation
def custom_operation(dbg, thread_id, frame_id, scope, attrs, style, code_or_file, operation_fn_name): """ We'll execute the code_or_file and then search in the namespace the operation_fn_name to execute with the given var. code_or_file: either some code (i.e.: from pprint import pprint) or a file to be executed. operation_fn_name: the name of the operation to execute after the exec (i.e.: pprint) """ expressionValue = getVariable(dbg, thread_id, frame_id, scope, attrs) try: namespace = {'__name__': '<custom_operation>'} if style == "EXECFILE": namespace['__file__'] = code_or_file execfile(code_or_file, namespace, namespace) else: # style == EXEC namespace['__file__'] = '<customOperationCode>' Exec(code_or_file, namespace, namespace) return str(namespace[operation_fn_name](expressionValue)) except: pydev_log.exception()
python
def custom_operation(dbg, thread_id, frame_id, scope, attrs, style, code_or_file, operation_fn_name): """ We'll execute the code_or_file and then search in the namespace the operation_fn_name to execute with the given var. code_or_file: either some code (i.e.: from pprint import pprint) or a file to be executed. operation_fn_name: the name of the operation to execute after the exec (i.e.: pprint) """ expressionValue = getVariable(dbg, thread_id, frame_id, scope, attrs) try: namespace = {'__name__': '<custom_operation>'} if style == "EXECFILE": namespace['__file__'] = code_or_file execfile(code_or_file, namespace, namespace) else: # style == EXEC namespace['__file__'] = '<customOperationCode>' Exec(code_or_file, namespace, namespace) return str(namespace[operation_fn_name](expressionValue)) except: pydev_log.exception()
[ "def", "custom_operation", "(", "dbg", ",", "thread_id", ",", "frame_id", ",", "scope", ",", "attrs", ",", "style", ",", "code_or_file", ",", "operation_fn_name", ")", ":", "expressionValue", "=", "getVariable", "(", "dbg", ",", "thread_id", ",", "frame_id", ...
We'll execute the code_or_file and then search in the namespace the operation_fn_name to execute with the given var. code_or_file: either some code (i.e.: from pprint import pprint) or a file to be executed. operation_fn_name: the name of the operation to execute after the exec (i.e.: pprint)
[ "We", "ll", "execute", "the", "code_or_file", "and", "then", "search", "in", "the", "namespace", "the", "operation_fn_name", "to", "execute", "with", "the", "given", "var", "." ]
ed9c4307662a5593b8a7f1f3389ecd0e79b8c503
https://github.com/fabioz/PyDev.Debugger/blob/ed9c4307662a5593b8a7f1f3389ecd0e79b8c503/_pydevd_bundle/pydevd_vars.py#L183-L203
train
209,444
fabioz/PyDev.Debugger
_pydevd_bundle/pydevd_vars.py
evaluate_expression
def evaluate_expression(dbg, frame, expression, is_exec): '''returns the result of the evaluated expression @param is_exec: determines if we should do an exec or an eval ''' if frame is None: return # Not using frame.f_globals because of https://sourceforge.net/tracker2/?func=detail&aid=2541355&group_id=85796&atid=577329 # (Names not resolved in generator expression in method) # See message: http://mail.python.org/pipermail/python-list/2009-January/526522.html updated_globals = {} updated_globals.update(frame.f_globals) updated_globals.update(frame.f_locals) # locals later because it has precedence over the actual globals try: expression = str(expression.replace('@LINE@', '\n')) if is_exec: try: # try to make it an eval (if it is an eval we can print it, otherwise we'll exec it and # it will have whatever the user actually did) compiled = compile(expression, '<string>', 'eval') except: Exec(expression, updated_globals, frame.f_locals) pydevd_save_locals.save_locals(frame) else: result = eval(compiled, updated_globals, frame.f_locals) if result is not None: # Only print if it's not None (as python does) sys.stdout.write('%s\n' % (result,)) return else: return eval_in_context(expression, updated_globals, frame.f_locals) finally: # Should not be kept alive if an exception happens and this frame is kept in the stack. del updated_globals del frame
python
def evaluate_expression(dbg, frame, expression, is_exec): '''returns the result of the evaluated expression @param is_exec: determines if we should do an exec or an eval ''' if frame is None: return # Not using frame.f_globals because of https://sourceforge.net/tracker2/?func=detail&aid=2541355&group_id=85796&atid=577329 # (Names not resolved in generator expression in method) # See message: http://mail.python.org/pipermail/python-list/2009-January/526522.html updated_globals = {} updated_globals.update(frame.f_globals) updated_globals.update(frame.f_locals) # locals later because it has precedence over the actual globals try: expression = str(expression.replace('@LINE@', '\n')) if is_exec: try: # try to make it an eval (if it is an eval we can print it, otherwise we'll exec it and # it will have whatever the user actually did) compiled = compile(expression, '<string>', 'eval') except: Exec(expression, updated_globals, frame.f_locals) pydevd_save_locals.save_locals(frame) else: result = eval(compiled, updated_globals, frame.f_locals) if result is not None: # Only print if it's not None (as python does) sys.stdout.write('%s\n' % (result,)) return else: return eval_in_context(expression, updated_globals, frame.f_locals) finally: # Should not be kept alive if an exception happens and this frame is kept in the stack. del updated_globals del frame
[ "def", "evaluate_expression", "(", "dbg", ",", "frame", ",", "expression", ",", "is_exec", ")", ":", "if", "frame", "is", "None", ":", "return", "# Not using frame.f_globals because of https://sourceforge.net/tracker2/?func=detail&aid=2541355&group_id=85796&atid=577329", "# (Na...
returns the result of the evaluated expression @param is_exec: determines if we should do an exec or an eval
[ "returns", "the", "result", "of", "the", "evaluated", "expression" ]
ed9c4307662a5593b8a7f1f3389ecd0e79b8c503
https://github.com/fabioz/PyDev.Debugger/blob/ed9c4307662a5593b8a7f1f3389ecd0e79b8c503/_pydevd_bundle/pydevd_vars.py#L243-L279
train
209,445
fabioz/PyDev.Debugger
_pydevd_bundle/pydevd_vars.py
change_attr_expression
def change_attr_expression(frame, attr, expression, dbg, value=SENTINEL_VALUE): '''Changes some attribute in a given frame. ''' if frame is None: return try: expression = expression.replace('@LINE@', '\n') if dbg.plugin and value is SENTINEL_VALUE: result = dbg.plugin.change_variable(frame, attr, expression) if result: return result if attr[:7] == "Globals": attr = attr[8:] if attr in frame.f_globals: if value is SENTINEL_VALUE: value = eval(expression, frame.f_globals, frame.f_locals) frame.f_globals[attr] = value return frame.f_globals[attr] else: if '.' not in attr: # i.e.: if we have a '.', we're changing some attribute of a local var. if pydevd_save_locals.is_save_locals_available(): if value is SENTINEL_VALUE: value = eval(expression, frame.f_globals, frame.f_locals) frame.f_locals[attr] = value pydevd_save_locals.save_locals(frame) return frame.f_locals[attr] # default way (only works for changing it in the topmost frame) if value is SENTINEL_VALUE: value = eval(expression, frame.f_globals, frame.f_locals) result = value Exec('%s=%s' % (attr, expression), frame.f_globals, frame.f_locals) return result except Exception: pydev_log.exception()
python
def change_attr_expression(frame, attr, expression, dbg, value=SENTINEL_VALUE): '''Changes some attribute in a given frame. ''' if frame is None: return try: expression = expression.replace('@LINE@', '\n') if dbg.plugin and value is SENTINEL_VALUE: result = dbg.plugin.change_variable(frame, attr, expression) if result: return result if attr[:7] == "Globals": attr = attr[8:] if attr in frame.f_globals: if value is SENTINEL_VALUE: value = eval(expression, frame.f_globals, frame.f_locals) frame.f_globals[attr] = value return frame.f_globals[attr] else: if '.' not in attr: # i.e.: if we have a '.', we're changing some attribute of a local var. if pydevd_save_locals.is_save_locals_available(): if value is SENTINEL_VALUE: value = eval(expression, frame.f_globals, frame.f_locals) frame.f_locals[attr] = value pydevd_save_locals.save_locals(frame) return frame.f_locals[attr] # default way (only works for changing it in the topmost frame) if value is SENTINEL_VALUE: value = eval(expression, frame.f_globals, frame.f_locals) result = value Exec('%s=%s' % (attr, expression), frame.f_globals, frame.f_locals) return result except Exception: pydev_log.exception()
[ "def", "change_attr_expression", "(", "frame", ",", "attr", ",", "expression", ",", "dbg", ",", "value", "=", "SENTINEL_VALUE", ")", ":", "if", "frame", "is", "None", ":", "return", "try", ":", "expression", "=", "expression", ".", "replace", "(", "'@LINE@...
Changes some attribute in a given frame.
[ "Changes", "some", "attribute", "in", "a", "given", "frame", "." ]
ed9c4307662a5593b8a7f1f3389ecd0e79b8c503
https://github.com/fabioz/PyDev.Debugger/blob/ed9c4307662a5593b8a7f1f3389ecd0e79b8c503/_pydevd_bundle/pydevd_vars.py#L282-L320
train
209,446
fabioz/PyDev.Debugger
pydevd_attach_to_process/winappdbg/breakpoint.py
Breakpoint.set_condition
def set_condition(self, condition = True): """ Sets a new condition callback for the breakpoint. @see: L{__init__} @type condition: function @param condition: (Optional) Condition callback function. """ if condition is None: self.__condition = True else: self.__condition = condition
python
def set_condition(self, condition = True): """ Sets a new condition callback for the breakpoint. @see: L{__init__} @type condition: function @param condition: (Optional) Condition callback function. """ if condition is None: self.__condition = True else: self.__condition = condition
[ "def", "set_condition", "(", "self", ",", "condition", "=", "True", ")", ":", "if", "condition", "is", "None", ":", "self", ".", "__condition", "=", "True", "else", ":", "self", ".", "__condition", "=", "condition" ]
Sets a new condition callback for the breakpoint. @see: L{__init__} @type condition: function @param condition: (Optional) Condition callback function.
[ "Sets", "a", "new", "condition", "callback", "for", "the", "breakpoint", "." ]
ed9c4307662a5593b8a7f1f3389ecd0e79b8c503
https://github.com/fabioz/PyDev.Debugger/blob/ed9c4307662a5593b8a7f1f3389ecd0e79b8c503/pydevd_attach_to_process/winappdbg/breakpoint.py#L318-L330
train
209,447
fabioz/PyDev.Debugger
pydevd_attach_to_process/winappdbg/breakpoint.py
Breakpoint.eval_condition
def eval_condition(self, event): """ Evaluates the breakpoint condition, if any was set. @type event: L{Event} @param event: Debug event triggered by the breakpoint. @rtype: bool @return: C{True} to dispatch the event, C{False} otherwise. """ condition = self.get_condition() if condition is True: # shortcut for unconditional breakpoints return True if callable(condition): try: return bool( condition(event) ) except Exception: e = sys.exc_info()[1] msg = ("Breakpoint condition callback %r" " raised an exception: %s") msg = msg % (condition, traceback.format_exc(e)) warnings.warn(msg, BreakpointCallbackWarning) return False return bool( condition )
python
def eval_condition(self, event): """ Evaluates the breakpoint condition, if any was set. @type event: L{Event} @param event: Debug event triggered by the breakpoint. @rtype: bool @return: C{True} to dispatch the event, C{False} otherwise. """ condition = self.get_condition() if condition is True: # shortcut for unconditional breakpoints return True if callable(condition): try: return bool( condition(event) ) except Exception: e = sys.exc_info()[1] msg = ("Breakpoint condition callback %r" " raised an exception: %s") msg = msg % (condition, traceback.format_exc(e)) warnings.warn(msg, BreakpointCallbackWarning) return False return bool( condition )
[ "def", "eval_condition", "(", "self", ",", "event", ")", ":", "condition", "=", "self", ".", "get_condition", "(", ")", "if", "condition", "is", "True", ":", "# shortcut for unconditional breakpoints", "return", "True", "if", "callable", "(", "condition", ")", ...
Evaluates the breakpoint condition, if any was set. @type event: L{Event} @param event: Debug event triggered by the breakpoint. @rtype: bool @return: C{True} to dispatch the event, C{False} otherwise.
[ "Evaluates", "the", "breakpoint", "condition", "if", "any", "was", "set", "." ]
ed9c4307662a5593b8a7f1f3389ecd0e79b8c503
https://github.com/fabioz/PyDev.Debugger/blob/ed9c4307662a5593b8a7f1f3389ecd0e79b8c503/pydevd_attach_to_process/winappdbg/breakpoint.py#L332-L355
train
209,448
fabioz/PyDev.Debugger
pydevd_attach_to_process/winappdbg/breakpoint.py
Breakpoint.run_action
def run_action(self, event): """ Executes the breakpoint action callback, if any was set. @type event: L{Event} @param event: Debug event triggered by the breakpoint. """ action = self.get_action() if action is not None: try: return bool( action(event) ) except Exception: e = sys.exc_info()[1] msg = ("Breakpoint action callback %r" " raised an exception: %s") msg = msg % (action, traceback.format_exc(e)) warnings.warn(msg, BreakpointCallbackWarning) return False return True
python
def run_action(self, event): """ Executes the breakpoint action callback, if any was set. @type event: L{Event} @param event: Debug event triggered by the breakpoint. """ action = self.get_action() if action is not None: try: return bool( action(event) ) except Exception: e = sys.exc_info()[1] msg = ("Breakpoint action callback %r" " raised an exception: %s") msg = msg % (action, traceback.format_exc(e)) warnings.warn(msg, BreakpointCallbackWarning) return False return True
[ "def", "run_action", "(", "self", ",", "event", ")", ":", "action", "=", "self", ".", "get_action", "(", ")", "if", "action", "is", "not", "None", ":", "try", ":", "return", "bool", "(", "action", "(", "event", ")", ")", "except", "Exception", ":", ...
Executes the breakpoint action callback, if any was set. @type event: L{Event} @param event: Debug event triggered by the breakpoint.
[ "Executes", "the", "breakpoint", "action", "callback", "if", "any", "was", "set", "." ]
ed9c4307662a5593b8a7f1f3389ecd0e79b8c503
https://github.com/fabioz/PyDev.Debugger/blob/ed9c4307662a5593b8a7f1f3389ecd0e79b8c503/pydevd_attach_to_process/winappdbg/breakpoint.py#L391-L409
train
209,449
fabioz/PyDev.Debugger
pydevd_attach_to_process/winappdbg/breakpoint.py
Breakpoint.hit
def hit(self, event): """ Notify a breakpoint that it's been hit. This triggers the corresponding state transition and sets the C{breakpoint} property of the given L{Event} object. @see: L{disable}, L{enable}, L{one_shot}, L{running} @type event: L{Event} @param event: Debug event to handle (depends on the breakpoint type). @raise AssertionError: Disabled breakpoints can't be hit. """ aProcess = event.get_process() aThread = event.get_thread() state = self.get_state() event.breakpoint = self if state == self.ENABLED: self.running(aProcess, aThread) elif state == self.RUNNING: self.enable(aProcess, aThread) elif state == self.ONESHOT: self.disable(aProcess, aThread) elif state == self.DISABLED: # this should not happen msg = "Hit a disabled breakpoint at address %s" msg = msg % HexDump.address( self.get_address() ) warnings.warn(msg, BreakpointWarning)
python
def hit(self, event): """ Notify a breakpoint that it's been hit. This triggers the corresponding state transition and sets the C{breakpoint} property of the given L{Event} object. @see: L{disable}, L{enable}, L{one_shot}, L{running} @type event: L{Event} @param event: Debug event to handle (depends on the breakpoint type). @raise AssertionError: Disabled breakpoints can't be hit. """ aProcess = event.get_process() aThread = event.get_thread() state = self.get_state() event.breakpoint = self if state == self.ENABLED: self.running(aProcess, aThread) elif state == self.RUNNING: self.enable(aProcess, aThread) elif state == self.ONESHOT: self.disable(aProcess, aThread) elif state == self.DISABLED: # this should not happen msg = "Hit a disabled breakpoint at address %s" msg = msg % HexDump.address( self.get_address() ) warnings.warn(msg, BreakpointWarning)
[ "def", "hit", "(", "self", ",", "event", ")", ":", "aProcess", "=", "event", ".", "get_process", "(", ")", "aThread", "=", "event", ".", "get_thread", "(", ")", "state", "=", "self", ".", "get_state", "(", ")", "event", ".", "breakpoint", "=", "self"...
Notify a breakpoint that it's been hit. This triggers the corresponding state transition and sets the C{breakpoint} property of the given L{Event} object. @see: L{disable}, L{enable}, L{one_shot}, L{running} @type event: L{Event} @param event: Debug event to handle (depends on the breakpoint type). @raise AssertionError: Disabled breakpoints can't be hit.
[ "Notify", "a", "breakpoint", "that", "it", "s", "been", "hit", "." ]
ed9c4307662a5593b8a7f1f3389ecd0e79b8c503
https://github.com/fabioz/PyDev.Debugger/blob/ed9c4307662a5593b8a7f1f3389ecd0e79b8c503/pydevd_attach_to_process/winappdbg/breakpoint.py#L498-L531
train
209,450
fabioz/PyDev.Debugger
pydevd_attach_to_process/winappdbg/breakpoint.py
CodeBreakpoint.__set_bp
def __set_bp(self, aProcess): """ Writes a breakpoint instruction at the target address. @type aProcess: L{Process} @param aProcess: Process object. """ address = self.get_address() self.__previousValue = aProcess.read(address, len(self.bpInstruction)) if self.__previousValue == self.bpInstruction: msg = "Possible overlapping code breakpoints at %s" msg = msg % HexDump.address(address) warnings.warn(msg, BreakpointWarning) aProcess.write(address, self.bpInstruction)
python
def __set_bp(self, aProcess): """ Writes a breakpoint instruction at the target address. @type aProcess: L{Process} @param aProcess: Process object. """ address = self.get_address() self.__previousValue = aProcess.read(address, len(self.bpInstruction)) if self.__previousValue == self.bpInstruction: msg = "Possible overlapping code breakpoints at %s" msg = msg % HexDump.address(address) warnings.warn(msg, BreakpointWarning) aProcess.write(address, self.bpInstruction)
[ "def", "__set_bp", "(", "self", ",", "aProcess", ")", ":", "address", "=", "self", ".", "get_address", "(", ")", "self", ".", "__previousValue", "=", "aProcess", ".", "read", "(", "address", ",", "len", "(", "self", ".", "bpInstruction", ")", ")", "if"...
Writes a breakpoint instruction at the target address. @type aProcess: L{Process} @param aProcess: Process object.
[ "Writes", "a", "breakpoint", "instruction", "at", "the", "target", "address", "." ]
ed9c4307662a5593b8a7f1f3389ecd0e79b8c503
https://github.com/fabioz/PyDev.Debugger/blob/ed9c4307662a5593b8a7f1f3389ecd0e79b8c503/pydevd_attach_to_process/winappdbg/breakpoint.py#L576-L589
train
209,451
fabioz/PyDev.Debugger
pydevd_attach_to_process/winappdbg/breakpoint.py
PageBreakpoint.__set_bp
def __set_bp(self, aProcess): """ Sets the target pages as guard pages. @type aProcess: L{Process} @param aProcess: Process object. """ lpAddress = self.get_address() dwSize = self.get_size() flNewProtect = aProcess.mquery(lpAddress).Protect flNewProtect = flNewProtect | win32.PAGE_GUARD aProcess.mprotect(lpAddress, dwSize, flNewProtect)
python
def __set_bp(self, aProcess): """ Sets the target pages as guard pages. @type aProcess: L{Process} @param aProcess: Process object. """ lpAddress = self.get_address() dwSize = self.get_size() flNewProtect = aProcess.mquery(lpAddress).Protect flNewProtect = flNewProtect | win32.PAGE_GUARD aProcess.mprotect(lpAddress, dwSize, flNewProtect)
[ "def", "__set_bp", "(", "self", ",", "aProcess", ")", ":", "lpAddress", "=", "self", ".", "get_address", "(", ")", "dwSize", "=", "self", ".", "get_size", "(", ")", "flNewProtect", "=", "aProcess", ".", "mquery", "(", "lpAddress", ")", ".", "Protect", ...
Sets the target pages as guard pages. @type aProcess: L{Process} @param aProcess: Process object.
[ "Sets", "the", "target", "pages", "as", "guard", "pages", "." ]
ed9c4307662a5593b8a7f1f3389ecd0e79b8c503
https://github.com/fabioz/PyDev.Debugger/blob/ed9c4307662a5593b8a7f1f3389ecd0e79b8c503/pydevd_attach_to_process/winappdbg/breakpoint.py#L701-L712
train
209,452
fabioz/PyDev.Debugger
pydevd_attach_to_process/winappdbg/breakpoint.py
PageBreakpoint.__clear_bp
def __clear_bp(self, aProcess): """ Restores the original permissions of the target pages. @type aProcess: L{Process} @param aProcess: Process object. """ lpAddress = self.get_address() flNewProtect = aProcess.mquery(lpAddress).Protect flNewProtect = flNewProtect & (0xFFFFFFFF ^ win32.PAGE_GUARD) # DWORD aProcess.mprotect(lpAddress, self.get_size(), flNewProtect)
python
def __clear_bp(self, aProcess): """ Restores the original permissions of the target pages. @type aProcess: L{Process} @param aProcess: Process object. """ lpAddress = self.get_address() flNewProtect = aProcess.mquery(lpAddress).Protect flNewProtect = flNewProtect & (0xFFFFFFFF ^ win32.PAGE_GUARD) # DWORD aProcess.mprotect(lpAddress, self.get_size(), flNewProtect)
[ "def", "__clear_bp", "(", "self", ",", "aProcess", ")", ":", "lpAddress", "=", "self", ".", "get_address", "(", ")", "flNewProtect", "=", "aProcess", ".", "mquery", "(", "lpAddress", ")", ".", "Protect", "flNewProtect", "=", "flNewProtect", "&", "(", "0xFF...
Restores the original permissions of the target pages. @type aProcess: L{Process} @param aProcess: Process object.
[ "Restores", "the", "original", "permissions", "of", "the", "target", "pages", "." ]
ed9c4307662a5593b8a7f1f3389ecd0e79b8c503
https://github.com/fabioz/PyDev.Debugger/blob/ed9c4307662a5593b8a7f1f3389ecd0e79b8c503/pydevd_attach_to_process/winappdbg/breakpoint.py#L714-L724
train
209,453
fabioz/PyDev.Debugger
pydevd_attach_to_process/winappdbg/breakpoint.py
HardwareBreakpoint.__clear_bp
def __clear_bp(self, aThread): """ Clears this breakpoint from the debug registers. @type aThread: L{Thread} @param aThread: Thread object. """ if self.__slot is not None: aThread.suspend() try: ctx = aThread.get_context(win32.CONTEXT_DEBUG_REGISTERS) DebugRegister.clear_bp(ctx, self.__slot) aThread.set_context(ctx) self.__slot = None finally: aThread.resume()
python
def __clear_bp(self, aThread): """ Clears this breakpoint from the debug registers. @type aThread: L{Thread} @param aThread: Thread object. """ if self.__slot is not None: aThread.suspend() try: ctx = aThread.get_context(win32.CONTEXT_DEBUG_REGISTERS) DebugRegister.clear_bp(ctx, self.__slot) aThread.set_context(ctx) self.__slot = None finally: aThread.resume()
[ "def", "__clear_bp", "(", "self", ",", "aThread", ")", ":", "if", "self", ".", "__slot", "is", "not", "None", ":", "aThread", ".", "suspend", "(", ")", "try", ":", "ctx", "=", "aThread", ".", "get_context", "(", "win32", ".", "CONTEXT_DEBUG_REGISTERS", ...
Clears this breakpoint from the debug registers. @type aThread: L{Thread} @param aThread: Thread object.
[ "Clears", "this", "breakpoint", "from", "the", "debug", "registers", "." ]
ed9c4307662a5593b8a7f1f3389ecd0e79b8c503
https://github.com/fabioz/PyDev.Debugger/blob/ed9c4307662a5593b8a7f1f3389ecd0e79b8c503/pydevd_attach_to_process/winappdbg/breakpoint.py#L895-L910
train
209,454
fabioz/PyDev.Debugger
pydevd_attach_to_process/winappdbg/breakpoint.py
HardwareBreakpoint.__set_bp
def __set_bp(self, aThread): """ Sets this breakpoint in the debug registers. @type aThread: L{Thread} @param aThread: Thread object. """ if self.__slot is None: aThread.suspend() try: ctx = aThread.get_context(win32.CONTEXT_DEBUG_REGISTERS) self.__slot = DebugRegister.find_slot(ctx) if self.__slot is None: msg = "No available hardware breakpoint slots for thread ID %d" msg = msg % aThread.get_tid() raise RuntimeError(msg) DebugRegister.set_bp(ctx, self.__slot, self.get_address(), self.__trigger, self.__watch) aThread.set_context(ctx) finally: aThread.resume()
python
def __set_bp(self, aThread): """ Sets this breakpoint in the debug registers. @type aThread: L{Thread} @param aThread: Thread object. """ if self.__slot is None: aThread.suspend() try: ctx = aThread.get_context(win32.CONTEXT_DEBUG_REGISTERS) self.__slot = DebugRegister.find_slot(ctx) if self.__slot is None: msg = "No available hardware breakpoint slots for thread ID %d" msg = msg % aThread.get_tid() raise RuntimeError(msg) DebugRegister.set_bp(ctx, self.__slot, self.get_address(), self.__trigger, self.__watch) aThread.set_context(ctx) finally: aThread.resume()
[ "def", "__set_bp", "(", "self", ",", "aThread", ")", ":", "if", "self", ".", "__slot", "is", "None", ":", "aThread", ".", "suspend", "(", ")", "try", ":", "ctx", "=", "aThread", ".", "get_context", "(", "win32", ".", "CONTEXT_DEBUG_REGISTERS", ")", "se...
Sets this breakpoint in the debug registers. @type aThread: L{Thread} @param aThread: Thread object.
[ "Sets", "this", "breakpoint", "in", "the", "debug", "registers", "." ]
ed9c4307662a5593b8a7f1f3389ecd0e79b8c503
https://github.com/fabioz/PyDev.Debugger/blob/ed9c4307662a5593b8a7f1f3389ecd0e79b8c503/pydevd_attach_to_process/winappdbg/breakpoint.py#L912-L932
train
209,455
fabioz/PyDev.Debugger
pydevd_attach_to_process/winappdbg/breakpoint.py
Hook.__postCallAction_hwbp
def __postCallAction_hwbp(self, event): """ Handles hardware breakpoint events on return from the function. @type event: L{ExceptionEvent} @param event: Single step event. """ # Remove the one shot hardware breakpoint # at the return address location in the stack. tid = event.get_tid() address = event.breakpoint.get_address() event.debug.erase_hardware_breakpoint(tid, address) # Call the "post" callback. try: self.__postCallAction(event) # Forget the parameters. finally: self.__pop_params(tid)
python
def __postCallAction_hwbp(self, event): """ Handles hardware breakpoint events on return from the function. @type event: L{ExceptionEvent} @param event: Single step event. """ # Remove the one shot hardware breakpoint # at the return address location in the stack. tid = event.get_tid() address = event.breakpoint.get_address() event.debug.erase_hardware_breakpoint(tid, address) # Call the "post" callback. try: self.__postCallAction(event) # Forget the parameters. finally: self.__pop_params(tid)
[ "def", "__postCallAction_hwbp", "(", "self", ",", "event", ")", ":", "# Remove the one shot hardware breakpoint", "# at the return address location in the stack.", "tid", "=", "event", ".", "get_tid", "(", ")", "address", "=", "event", ".", "breakpoint", ".", "get_addre...
Handles hardware breakpoint events on return from the function. @type event: L{ExceptionEvent} @param event: Single step event.
[ "Handles", "hardware", "breakpoint", "events", "on", "return", "from", "the", "function", "." ]
ed9c4307662a5593b8a7f1f3389ecd0e79b8c503
https://github.com/fabioz/PyDev.Debugger/blob/ed9c4307662a5593b8a7f1f3389ecd0e79b8c503/pydevd_attach_to_process/winappdbg/breakpoint.py#L1250-L1270
train
209,456
fabioz/PyDev.Debugger
pydevd_attach_to_process/winappdbg/breakpoint.py
Hook.__postCallAction_codebp
def __postCallAction_codebp(self, event): """ Handles code breakpoint events on return from the function. @type event: L{ExceptionEvent} @param event: Breakpoint hit event. """ # If the breakpoint was accidentally hit by another thread, # pass it to the debugger instead of calling the "post" callback. # # XXX FIXME: # I suppose this check will fail under some weird conditions... # tid = event.get_tid() if tid not in self.__paramStack: return True # Remove the code breakpoint at the return address. pid = event.get_pid() address = event.breakpoint.get_address() event.debug.dont_break_at(pid, address) # Call the "post" callback. try: self.__postCallAction(event) # Forget the parameters. finally: self.__pop_params(tid)
python
def __postCallAction_codebp(self, event): """ Handles code breakpoint events on return from the function. @type event: L{ExceptionEvent} @param event: Breakpoint hit event. """ # If the breakpoint was accidentally hit by another thread, # pass it to the debugger instead of calling the "post" callback. # # XXX FIXME: # I suppose this check will fail under some weird conditions... # tid = event.get_tid() if tid not in self.__paramStack: return True # Remove the code breakpoint at the return address. pid = event.get_pid() address = event.breakpoint.get_address() event.debug.dont_break_at(pid, address) # Call the "post" callback. try: self.__postCallAction(event) # Forget the parameters. finally: self.__pop_params(tid)
[ "def", "__postCallAction_codebp", "(", "self", ",", "event", ")", ":", "# If the breakpoint was accidentally hit by another thread,", "# pass it to the debugger instead of calling the \"post\" callback.", "#", "# XXX FIXME:", "# I suppose this check will fail under some weird conditions...",...
Handles code breakpoint events on return from the function. @type event: L{ExceptionEvent} @param event: Breakpoint hit event.
[ "Handles", "code", "breakpoint", "events", "on", "return", "from", "the", "function", "." ]
ed9c4307662a5593b8a7f1f3389ecd0e79b8c503
https://github.com/fabioz/PyDev.Debugger/blob/ed9c4307662a5593b8a7f1f3389ecd0e79b8c503/pydevd_attach_to_process/winappdbg/breakpoint.py#L1272-L1301
train
209,457
fabioz/PyDev.Debugger
pydevd_attach_to_process/winappdbg/breakpoint.py
Hook.__postCallAction
def __postCallAction(self, event): """ Calls the "post" callback. @type event: L{ExceptionEvent} @param event: Breakpoint hit event. """ aThread = event.get_thread() retval = self._get_return_value(aThread) self.__callHandler(self.__postCB, event, retval)
python
def __postCallAction(self, event): """ Calls the "post" callback. @type event: L{ExceptionEvent} @param event: Breakpoint hit event. """ aThread = event.get_thread() retval = self._get_return_value(aThread) self.__callHandler(self.__postCB, event, retval)
[ "def", "__postCallAction", "(", "self", ",", "event", ")", ":", "aThread", "=", "event", ".", "get_thread", "(", ")", "retval", "=", "self", ".", "_get_return_value", "(", "aThread", ")", "self", ".", "__callHandler", "(", "self", ".", "__postCB", ",", "...
Calls the "post" callback. @type event: L{ExceptionEvent} @param event: Breakpoint hit event.
[ "Calls", "the", "post", "callback", "." ]
ed9c4307662a5593b8a7f1f3389ecd0e79b8c503
https://github.com/fabioz/PyDev.Debugger/blob/ed9c4307662a5593b8a7f1f3389ecd0e79b8c503/pydevd_attach_to_process/winappdbg/breakpoint.py#L1303-L1312
train
209,458
fabioz/PyDev.Debugger
pydevd_attach_to_process/winappdbg/breakpoint.py
Hook.__callHandler
def __callHandler(self, callback, event, *params): """ Calls a "pre" or "post" handler, if set. @type callback: function @param callback: Callback function to call. @type event: L{ExceptionEvent} @param event: Breakpoint hit event. @type params: tuple @param params: Parameters for the callback function. """ if callback is not None: event.hook = self callback(event, *params)
python
def __callHandler(self, callback, event, *params): """ Calls a "pre" or "post" handler, if set. @type callback: function @param callback: Callback function to call. @type event: L{ExceptionEvent} @param event: Breakpoint hit event. @type params: tuple @param params: Parameters for the callback function. """ if callback is not None: event.hook = self callback(event, *params)
[ "def", "__callHandler", "(", "self", ",", "callback", ",", "event", ",", "*", "params", ")", ":", "if", "callback", "is", "not", "None", ":", "event", ".", "hook", "=", "self", "callback", "(", "event", ",", "*", "params", ")" ]
Calls a "pre" or "post" handler, if set. @type callback: function @param callback: Callback function to call. @type event: L{ExceptionEvent} @param event: Breakpoint hit event. @type params: tuple @param params: Parameters for the callback function.
[ "Calls", "a", "pre", "or", "post", "handler", "if", "set", "." ]
ed9c4307662a5593b8a7f1f3389ecd0e79b8c503
https://github.com/fabioz/PyDev.Debugger/blob/ed9c4307662a5593b8a7f1f3389ecd0e79b8c503/pydevd_attach_to_process/winappdbg/breakpoint.py#L1314-L1329
train
209,459
fabioz/PyDev.Debugger
pydevd_attach_to_process/winappdbg/breakpoint.py
Hook.__push_params
def __push_params(self, tid, params): """ Remembers the arguments tuple for the last call to the hooked function from this thread. @type tid: int @param tid: Thread global ID. @type params: tuple( arg, arg, arg... ) @param params: Tuple of arguments. """ stack = self.__paramStack.get( tid, [] ) stack.append(params) self.__paramStack[tid] = stack
python
def __push_params(self, tid, params): """ Remembers the arguments tuple for the last call to the hooked function from this thread. @type tid: int @param tid: Thread global ID. @type params: tuple( arg, arg, arg... ) @param params: Tuple of arguments. """ stack = self.__paramStack.get( tid, [] ) stack.append(params) self.__paramStack[tid] = stack
[ "def", "__push_params", "(", "self", ",", "tid", ",", "params", ")", ":", "stack", "=", "self", ".", "__paramStack", ".", "get", "(", "tid", ",", "[", "]", ")", "stack", ".", "append", "(", "params", ")", "self", ".", "__paramStack", "[", "tid", "]...
Remembers the arguments tuple for the last call to the hooked function from this thread. @type tid: int @param tid: Thread global ID. @type params: tuple( arg, arg, arg... ) @param params: Tuple of arguments.
[ "Remembers", "the", "arguments", "tuple", "for", "the", "last", "call", "to", "the", "hooked", "function", "from", "this", "thread", "." ]
ed9c4307662a5593b8a7f1f3389ecd0e79b8c503
https://github.com/fabioz/PyDev.Debugger/blob/ed9c4307662a5593b8a7f1f3389ecd0e79b8c503/pydevd_attach_to_process/winappdbg/breakpoint.py#L1331-L1344
train
209,460
fabioz/PyDev.Debugger
pydevd_attach_to_process/winappdbg/breakpoint.py
Hook.__pop_params
def __pop_params(self, tid): """ Forgets the arguments tuple for the last call to the hooked function from this thread. @type tid: int @param tid: Thread global ID. """ stack = self.__paramStack[tid] stack.pop() if not stack: del self.__paramStack[tid]
python
def __pop_params(self, tid): """ Forgets the arguments tuple for the last call to the hooked function from this thread. @type tid: int @param tid: Thread global ID. """ stack = self.__paramStack[tid] stack.pop() if not stack: del self.__paramStack[tid]
[ "def", "__pop_params", "(", "self", ",", "tid", ")", ":", "stack", "=", "self", ".", "__paramStack", "[", "tid", "]", "stack", ".", "pop", "(", ")", "if", "not", "stack", ":", "del", "self", ".", "__paramStack", "[", "tid", "]" ]
Forgets the arguments tuple for the last call to the hooked function from this thread. @type tid: int @param tid: Thread global ID.
[ "Forgets", "the", "arguments", "tuple", "for", "the", "last", "call", "to", "the", "hooked", "function", "from", "this", "thread", "." ]
ed9c4307662a5593b8a7f1f3389ecd0e79b8c503
https://github.com/fabioz/PyDev.Debugger/blob/ed9c4307662a5593b8a7f1f3389ecd0e79b8c503/pydevd_attach_to_process/winappdbg/breakpoint.py#L1346-L1357
train
209,461
fabioz/PyDev.Debugger
pydevd_attach_to_process/winappdbg/breakpoint.py
Hook.get_params
def get_params(self, tid): """ Returns the parameters found in the stack when the hooked function was last called by this thread. @type tid: int @param tid: Thread global ID. @rtype: tuple( arg, arg, arg... ) @return: Tuple of arguments. """ try: params = self.get_params_stack(tid)[-1] except IndexError: msg = "Hooked function called from thread %d already returned" raise IndexError(msg % tid) return params
python
def get_params(self, tid): """ Returns the parameters found in the stack when the hooked function was last called by this thread. @type tid: int @param tid: Thread global ID. @rtype: tuple( arg, arg, arg... ) @return: Tuple of arguments. """ try: params = self.get_params_stack(tid)[-1] except IndexError: msg = "Hooked function called from thread %d already returned" raise IndexError(msg % tid) return params
[ "def", "get_params", "(", "self", ",", "tid", ")", ":", "try", ":", "params", "=", "self", ".", "get_params_stack", "(", "tid", ")", "[", "-", "1", "]", "except", "IndexError", ":", "msg", "=", "\"Hooked function called from thread %d already returned\"", "rai...
Returns the parameters found in the stack when the hooked function was last called by this thread. @type tid: int @param tid: Thread global ID. @rtype: tuple( arg, arg, arg... ) @return: Tuple of arguments.
[ "Returns", "the", "parameters", "found", "in", "the", "stack", "when", "the", "hooked", "function", "was", "last", "called", "by", "this", "thread", "." ]
ed9c4307662a5593b8a7f1f3389ecd0e79b8c503
https://github.com/fabioz/PyDev.Debugger/blob/ed9c4307662a5593b8a7f1f3389ecd0e79b8c503/pydevd_attach_to_process/winappdbg/breakpoint.py#L1359-L1375
train
209,462
fabioz/PyDev.Debugger
pydevd_attach_to_process/winappdbg/breakpoint.py
Hook.get_params_stack
def get_params_stack(self, tid): """ Returns the parameters found in the stack each time the hooked function was called by this thread and hasn't returned yet. @type tid: int @param tid: Thread global ID. @rtype: list of tuple( arg, arg, arg... ) @return: List of argument tuples. """ try: stack = self.__paramStack[tid] except KeyError: msg = "Hooked function was not called from thread %d" raise KeyError(msg % tid) return stack
python
def get_params_stack(self, tid): """ Returns the parameters found in the stack each time the hooked function was called by this thread and hasn't returned yet. @type tid: int @param tid: Thread global ID. @rtype: list of tuple( arg, arg, arg... ) @return: List of argument tuples. """ try: stack = self.__paramStack[tid] except KeyError: msg = "Hooked function was not called from thread %d" raise KeyError(msg % tid) return stack
[ "def", "get_params_stack", "(", "self", ",", "tid", ")", ":", "try", ":", "stack", "=", "self", ".", "__paramStack", "[", "tid", "]", "except", "KeyError", ":", "msg", "=", "\"Hooked function was not called from thread %d\"", "raise", "KeyError", "(", "msg", "...
Returns the parameters found in the stack each time the hooked function was called by this thread and hasn't returned yet. @type tid: int @param tid: Thread global ID. @rtype: list of tuple( arg, arg, arg... ) @return: List of argument tuples.
[ "Returns", "the", "parameters", "found", "in", "the", "stack", "each", "time", "the", "hooked", "function", "was", "called", "by", "this", "thread", "and", "hasn", "t", "returned", "yet", "." ]
ed9c4307662a5593b8a7f1f3389ecd0e79b8c503
https://github.com/fabioz/PyDev.Debugger/blob/ed9c4307662a5593b8a7f1f3389ecd0e79b8c503/pydevd_attach_to_process/winappdbg/breakpoint.py#L1377-L1393
train
209,463
fabioz/PyDev.Debugger
pydevd_attach_to_process/winappdbg/breakpoint.py
Hook.hook
def hook(self, debug, pid, address): """ Installs the function hook at a given process and address. @see: L{unhook} @warning: Do not call from an function hook callback. @type debug: L{Debug} @param debug: Debug object. @type pid: int @param pid: Process ID. @type address: int @param address: Function address. """ return debug.break_at(pid, address, self)
python
def hook(self, debug, pid, address): """ Installs the function hook at a given process and address. @see: L{unhook} @warning: Do not call from an function hook callback. @type debug: L{Debug} @param debug: Debug object. @type pid: int @param pid: Process ID. @type address: int @param address: Function address. """ return debug.break_at(pid, address, self)
[ "def", "hook", "(", "self", ",", "debug", ",", "pid", ",", "address", ")", ":", "return", "debug", ".", "break_at", "(", "pid", ",", "address", ",", "self", ")" ]
Installs the function hook at a given process and address. @see: L{unhook} @warning: Do not call from an function hook callback. @type debug: L{Debug} @param debug: Debug object. @type pid: int @param pid: Process ID. @type address: int @param address: Function address.
[ "Installs", "the", "function", "hook", "at", "a", "given", "process", "and", "address", "." ]
ed9c4307662a5593b8a7f1f3389ecd0e79b8c503
https://github.com/fabioz/PyDev.Debugger/blob/ed9c4307662a5593b8a7f1f3389ecd0e79b8c503/pydevd_attach_to_process/winappdbg/breakpoint.py#L1395-L1412
train
209,464
fabioz/PyDev.Debugger
pydevd_attach_to_process/winappdbg/breakpoint.py
ApiHook.hook
def hook(self, debug, pid): """ Installs the API hook on a given process and module. @warning: Do not call from an API hook callback. @type debug: L{Debug} @param debug: Debug object. @type pid: int @param pid: Process ID. """ label = "%s!%s" % (self.__modName, self.__procName) try: hook = self.__hook[pid] except KeyError: try: aProcess = debug.system.get_process(pid) except KeyError: aProcess = Process(pid) hook = Hook(self.__preCB, self.__postCB, self.__paramCount, self.__signature, aProcess.get_arch() ) self.__hook[pid] = hook hook.hook(debug, pid, label)
python
def hook(self, debug, pid): """ Installs the API hook on a given process and module. @warning: Do not call from an API hook callback. @type debug: L{Debug} @param debug: Debug object. @type pid: int @param pid: Process ID. """ label = "%s!%s" % (self.__modName, self.__procName) try: hook = self.__hook[pid] except KeyError: try: aProcess = debug.system.get_process(pid) except KeyError: aProcess = Process(pid) hook = Hook(self.__preCB, self.__postCB, self.__paramCount, self.__signature, aProcess.get_arch() ) self.__hook[pid] = hook hook.hook(debug, pid, label)
[ "def", "hook", "(", "self", ",", "debug", ",", "pid", ")", ":", "label", "=", "\"%s!%s\"", "%", "(", "self", ".", "__modName", ",", "self", ".", "__procName", ")", "try", ":", "hook", "=", "self", ".", "__hook", "[", "pid", "]", "except", "KeyError...
Installs the API hook on a given process and module. @warning: Do not call from an API hook callback. @type debug: L{Debug} @param debug: Debug object. @type pid: int @param pid: Process ID.
[ "Installs", "the", "API", "hook", "on", "a", "given", "process", "and", "module", "." ]
ed9c4307662a5593b8a7f1f3389ecd0e79b8c503
https://github.com/fabioz/PyDev.Debugger/blob/ed9c4307662a5593b8a7f1f3389ecd0e79b8c503/pydevd_attach_to_process/winappdbg/breakpoint.py#L1708-L1732
train
209,465
fabioz/PyDev.Debugger
pydevd_attach_to_process/winappdbg/breakpoint.py
ApiHook.unhook
def unhook(self, debug, pid): """ Removes the API hook from the given process and module. @warning: Do not call from an API hook callback. @type debug: L{Debug} @param debug: Debug object. @type pid: int @param pid: Process ID. """ try: hook = self.__hook[pid] except KeyError: return label = "%s!%s" % (self.__modName, self.__procName) hook.unhook(debug, pid, label) del self.__hook[pid]
python
def unhook(self, debug, pid): """ Removes the API hook from the given process and module. @warning: Do not call from an API hook callback. @type debug: L{Debug} @param debug: Debug object. @type pid: int @param pid: Process ID. """ try: hook = self.__hook[pid] except KeyError: return label = "%s!%s" % (self.__modName, self.__procName) hook.unhook(debug, pid, label) del self.__hook[pid]
[ "def", "unhook", "(", "self", ",", "debug", ",", "pid", ")", ":", "try", ":", "hook", "=", "self", ".", "__hook", "[", "pid", "]", "except", "KeyError", ":", "return", "label", "=", "\"%s!%s\"", "%", "(", "self", ".", "__modName", ",", "self", ".",...
Removes the API hook from the given process and module. @warning: Do not call from an API hook callback. @type debug: L{Debug} @param debug: Debug object. @type pid: int @param pid: Process ID.
[ "Removes", "the", "API", "hook", "from", "the", "given", "process", "and", "module", "." ]
ed9c4307662a5593b8a7f1f3389ecd0e79b8c503
https://github.com/fabioz/PyDev.Debugger/blob/ed9c4307662a5593b8a7f1f3389ecd0e79b8c503/pydevd_attach_to_process/winappdbg/breakpoint.py#L1734-L1752
train
209,466
fabioz/PyDev.Debugger
pydevd_attach_to_process/winappdbg/breakpoint.py
_BufferWatchCondition.remove
def remove(self, bw): """ Removes a buffer watch identifier. @type bw: L{BufferWatch} @param bw: Buffer watch identifier. @raise KeyError: The buffer watch identifier was already removed. """ try: self.__ranges.remove(bw) except KeyError: if not bw.oneshot: raise
python
def remove(self, bw): """ Removes a buffer watch identifier. @type bw: L{BufferWatch} @param bw: Buffer watch identifier. @raise KeyError: The buffer watch identifier was already removed. """ try: self.__ranges.remove(bw) except KeyError: if not bw.oneshot: raise
[ "def", "remove", "(", "self", ",", "bw", ")", ":", "try", ":", "self", ".", "__ranges", ".", "remove", "(", "bw", ")", "except", "KeyError", ":", "if", "not", "bw", ".", "oneshot", ":", "raise" ]
Removes a buffer watch identifier. @type bw: L{BufferWatch} @param bw: Buffer watch identifier. @raise KeyError: The buffer watch identifier was already removed.
[ "Removes", "a", "buffer", "watch", "identifier", "." ]
ed9c4307662a5593b8a7f1f3389ecd0e79b8c503
https://github.com/fabioz/PyDev.Debugger/blob/ed9c4307662a5593b8a7f1f3389ecd0e79b8c503/pydevd_attach_to_process/winappdbg/breakpoint.py#L1840-L1854
train
209,467
fabioz/PyDev.Debugger
pydevd_attach_to_process/winappdbg/breakpoint.py
_BufferWatchCondition.remove_last_match
def remove_last_match(self, address, size): """ Removes the last buffer from the watch object to match the given address and size. @type address: int @param address: Memory address of buffer to stop watching. @type size: int @param size: Size in bytes of buffer to stop watching. @rtype: int @return: Number of matching elements found. Only the last one to be added is actually deleted upon calling this method. This counter allows you to know if there are more matching elements and how many. """ count = 0 start = address end = address + size - 1 matched = None for item in self.__ranges: if item.match(start) and item.match(end): matched = item count += 1 self.__ranges.remove(matched) return count
python
def remove_last_match(self, address, size): """ Removes the last buffer from the watch object to match the given address and size. @type address: int @param address: Memory address of buffer to stop watching. @type size: int @param size: Size in bytes of buffer to stop watching. @rtype: int @return: Number of matching elements found. Only the last one to be added is actually deleted upon calling this method. This counter allows you to know if there are more matching elements and how many. """ count = 0 start = address end = address + size - 1 matched = None for item in self.__ranges: if item.match(start) and item.match(end): matched = item count += 1 self.__ranges.remove(matched) return count
[ "def", "remove_last_match", "(", "self", ",", "address", ",", "size", ")", ":", "count", "=", "0", "start", "=", "address", "end", "=", "address", "+", "size", "-", "1", "matched", "=", "None", "for", "item", "in", "self", ".", "__ranges", ":", "if",...
Removes the last buffer from the watch object to match the given address and size. @type address: int @param address: Memory address of buffer to stop watching. @type size: int @param size: Size in bytes of buffer to stop watching. @rtype: int @return: Number of matching elements found. Only the last one to be added is actually deleted upon calling this method. This counter allows you to know if there are more matching elements and how many.
[ "Removes", "the", "last", "buffer", "from", "the", "watch", "object", "to", "match", "the", "given", "address", "and", "size", "." ]
ed9c4307662a5593b8a7f1f3389ecd0e79b8c503
https://github.com/fabioz/PyDev.Debugger/blob/ed9c4307662a5593b8a7f1f3389ecd0e79b8c503/pydevd_attach_to_process/winappdbg/breakpoint.py#L1856-L1883
train
209,468
fabioz/PyDev.Debugger
pydevd_attach_to_process/winappdbg/breakpoint.py
_BreakpointContainer.define_code_breakpoint
def define_code_breakpoint(self, dwProcessId, address, condition = True, action = None): """ Creates a disabled code breakpoint at the given address. @see: L{has_code_breakpoint}, L{get_code_breakpoint}, L{enable_code_breakpoint}, L{enable_one_shot_code_breakpoint}, L{disable_code_breakpoint}, L{erase_code_breakpoint} @type dwProcessId: int @param dwProcessId: Process global ID. @type address: int @param address: Memory address of the code instruction to break at. @type condition: function @param condition: (Optional) Condition callback function. The callback signature is:: def condition_callback(event): return True # returns True or False Where B{event} is an L{Event} object, and the return value is a boolean (C{True} to dispatch the event, C{False} otherwise). @type action: function @param action: (Optional) Action callback function. If specified, the event is handled by this callback instead of being dispatched normally. The callback signature is:: def action_callback(event): pass # no return value Where B{event} is an L{Event} object, and the return value is a boolean (C{True} to dispatch the event, C{False} otherwise). @rtype: L{CodeBreakpoint} @return: The code breakpoint object. """ process = self.system.get_process(dwProcessId) bp = CodeBreakpoint(address, condition, action) key = (dwProcessId, bp.get_address()) if key in self.__codeBP: msg = "Already exists (PID %d) : %r" raise KeyError(msg % (dwProcessId, self.__codeBP[key])) self.__codeBP[key] = bp return bp
python
def define_code_breakpoint(self, dwProcessId, address, condition = True, action = None): """ Creates a disabled code breakpoint at the given address. @see: L{has_code_breakpoint}, L{get_code_breakpoint}, L{enable_code_breakpoint}, L{enable_one_shot_code_breakpoint}, L{disable_code_breakpoint}, L{erase_code_breakpoint} @type dwProcessId: int @param dwProcessId: Process global ID. @type address: int @param address: Memory address of the code instruction to break at. @type condition: function @param condition: (Optional) Condition callback function. The callback signature is:: def condition_callback(event): return True # returns True or False Where B{event} is an L{Event} object, and the return value is a boolean (C{True} to dispatch the event, C{False} otherwise). @type action: function @param action: (Optional) Action callback function. If specified, the event is handled by this callback instead of being dispatched normally. The callback signature is:: def action_callback(event): pass # no return value Where B{event} is an L{Event} object, and the return value is a boolean (C{True} to dispatch the event, C{False} otherwise). @rtype: L{CodeBreakpoint} @return: The code breakpoint object. """ process = self.system.get_process(dwProcessId) bp = CodeBreakpoint(address, condition, action) key = (dwProcessId, bp.get_address()) if key in self.__codeBP: msg = "Already exists (PID %d) : %r" raise KeyError(msg % (dwProcessId, self.__codeBP[key])) self.__codeBP[key] = bp return bp
[ "def", "define_code_breakpoint", "(", "self", ",", "dwProcessId", ",", "address", ",", "condition", "=", "True", ",", "action", "=", "None", ")", ":", "process", "=", "self", ".", "system", ".", "get_process", "(", "dwProcessId", ")", "bp", "=", "CodeBreak...
Creates a disabled code breakpoint at the given address. @see: L{has_code_breakpoint}, L{get_code_breakpoint}, L{enable_code_breakpoint}, L{enable_one_shot_code_breakpoint}, L{disable_code_breakpoint}, L{erase_code_breakpoint} @type dwProcessId: int @param dwProcessId: Process global ID. @type address: int @param address: Memory address of the code instruction to break at. @type condition: function @param condition: (Optional) Condition callback function. The callback signature is:: def condition_callback(event): return True # returns True or False Where B{event} is an L{Event} object, and the return value is a boolean (C{True} to dispatch the event, C{False} otherwise). @type action: function @param action: (Optional) Action callback function. If specified, the event is handled by this callback instead of being dispatched normally. The callback signature is:: def action_callback(event): pass # no return value Where B{event} is an L{Event} object, and the return value is a boolean (C{True} to dispatch the event, C{False} otherwise). @rtype: L{CodeBreakpoint} @return: The code breakpoint object.
[ "Creates", "a", "disabled", "code", "breakpoint", "at", "the", "given", "address", "." ]
ed9c4307662a5593b8a7f1f3389ecd0e79b8c503
https://github.com/fabioz/PyDev.Debugger/blob/ed9c4307662a5593b8a7f1f3389ecd0e79b8c503/pydevd_attach_to_process/winappdbg/breakpoint.py#L2217-L2273
train
209,469
fabioz/PyDev.Debugger
pydevd_attach_to_process/winappdbg/breakpoint.py
_BreakpointContainer.define_page_breakpoint
def define_page_breakpoint(self, dwProcessId, address, pages = 1, condition = True, action = None): """ Creates a disabled page breakpoint at the given address. @see: L{has_page_breakpoint}, L{get_page_breakpoint}, L{enable_page_breakpoint}, L{enable_one_shot_page_breakpoint}, L{disable_page_breakpoint}, L{erase_page_breakpoint} @type dwProcessId: int @param dwProcessId: Process global ID. @type address: int @param address: Memory address of the first page to watch. @type pages: int @param pages: Number of pages to watch. @type condition: function @param condition: (Optional) Condition callback function. The callback signature is:: def condition_callback(event): return True # returns True or False Where B{event} is an L{Event} object, and the return value is a boolean (C{True} to dispatch the event, C{False} otherwise). @type action: function @param action: (Optional) Action callback function. If specified, the event is handled by this callback instead of being dispatched normally. The callback signature is:: def action_callback(event): pass # no return value Where B{event} is an L{Event} object, and the return value is a boolean (C{True} to dispatch the event, C{False} otherwise). @rtype: L{PageBreakpoint} @return: The page breakpoint object. """ process = self.system.get_process(dwProcessId) bp = PageBreakpoint(address, pages, condition, action) begin = bp.get_address() end = begin + bp.get_size() address = begin pageSize = MemoryAddresses.pageSize while address < end: key = (dwProcessId, address) if key in self.__pageBP: msg = "Already exists (PID %d) : %r" msg = msg % (dwProcessId, self.__pageBP[key]) raise KeyError(msg) address = address + pageSize address = begin while address < end: key = (dwProcessId, address) self.__pageBP[key] = bp address = address + pageSize return bp
python
def define_page_breakpoint(self, dwProcessId, address, pages = 1, condition = True, action = None): """ Creates a disabled page breakpoint at the given address. @see: L{has_page_breakpoint}, L{get_page_breakpoint}, L{enable_page_breakpoint}, L{enable_one_shot_page_breakpoint}, L{disable_page_breakpoint}, L{erase_page_breakpoint} @type dwProcessId: int @param dwProcessId: Process global ID. @type address: int @param address: Memory address of the first page to watch. @type pages: int @param pages: Number of pages to watch. @type condition: function @param condition: (Optional) Condition callback function. The callback signature is:: def condition_callback(event): return True # returns True or False Where B{event} is an L{Event} object, and the return value is a boolean (C{True} to dispatch the event, C{False} otherwise). @type action: function @param action: (Optional) Action callback function. If specified, the event is handled by this callback instead of being dispatched normally. The callback signature is:: def action_callback(event): pass # no return value Where B{event} is an L{Event} object, and the return value is a boolean (C{True} to dispatch the event, C{False} otherwise). @rtype: L{PageBreakpoint} @return: The page breakpoint object. """ process = self.system.get_process(dwProcessId) bp = PageBreakpoint(address, pages, condition, action) begin = bp.get_address() end = begin + bp.get_size() address = begin pageSize = MemoryAddresses.pageSize while address < end: key = (dwProcessId, address) if key in self.__pageBP: msg = "Already exists (PID %d) : %r" msg = msg % (dwProcessId, self.__pageBP[key]) raise KeyError(msg) address = address + pageSize address = begin while address < end: key = (dwProcessId, address) self.__pageBP[key] = bp address = address + pageSize return bp
[ "def", "define_page_breakpoint", "(", "self", ",", "dwProcessId", ",", "address", ",", "pages", "=", "1", ",", "condition", "=", "True", ",", "action", "=", "None", ")", ":", "process", "=", "self", ".", "system", ".", "get_process", "(", "dwProcessId", ...
Creates a disabled page breakpoint at the given address. @see: L{has_page_breakpoint}, L{get_page_breakpoint}, L{enable_page_breakpoint}, L{enable_one_shot_page_breakpoint}, L{disable_page_breakpoint}, L{erase_page_breakpoint} @type dwProcessId: int @param dwProcessId: Process global ID. @type address: int @param address: Memory address of the first page to watch. @type pages: int @param pages: Number of pages to watch. @type condition: function @param condition: (Optional) Condition callback function. The callback signature is:: def condition_callback(event): return True # returns True or False Where B{event} is an L{Event} object, and the return value is a boolean (C{True} to dispatch the event, C{False} otherwise). @type action: function @param action: (Optional) Action callback function. If specified, the event is handled by this callback instead of being dispatched normally. The callback signature is:: def action_callback(event): pass # no return value Where B{event} is an L{Event} object, and the return value is a boolean (C{True} to dispatch the event, C{False} otherwise). @rtype: L{PageBreakpoint} @return: The page breakpoint object.
[ "Creates", "a", "disabled", "page", "breakpoint", "at", "the", "given", "address", "." ]
ed9c4307662a5593b8a7f1f3389ecd0e79b8c503
https://github.com/fabioz/PyDev.Debugger/blob/ed9c4307662a5593b8a7f1f3389ecd0e79b8c503/pydevd_attach_to_process/winappdbg/breakpoint.py#L2276-L2348
train
209,470
fabioz/PyDev.Debugger
pydevd_attach_to_process/winappdbg/breakpoint.py
_BreakpointContainer.define_hardware_breakpoint
def define_hardware_breakpoint(self, dwThreadId, address, triggerFlag = BP_BREAK_ON_ACCESS, sizeFlag = BP_WATCH_DWORD, condition = True, action = None): """ Creates a disabled hardware breakpoint at the given address. @see: L{has_hardware_breakpoint}, L{get_hardware_breakpoint}, L{enable_hardware_breakpoint}, L{enable_one_shot_hardware_breakpoint}, L{disable_hardware_breakpoint}, L{erase_hardware_breakpoint} @note: Hardware breakpoints do not seem to work properly on VirtualBox. See U{http://www.virtualbox.org/ticket/477}. @type dwThreadId: int @param dwThreadId: Thread global ID. @type address: int @param address: Memory address to watch. @type triggerFlag: int @param triggerFlag: Trigger of breakpoint. Must be one of the following: - L{BP_BREAK_ON_EXECUTION} Break on code execution. - L{BP_BREAK_ON_WRITE} Break on memory read or write. - L{BP_BREAK_ON_ACCESS} Break on memory write. @type sizeFlag: int @param sizeFlag: Size of breakpoint. Must be one of the following: - L{BP_WATCH_BYTE} One (1) byte in size. - L{BP_WATCH_WORD} Two (2) bytes in size. - L{BP_WATCH_DWORD} Four (4) bytes in size. - L{BP_WATCH_QWORD} Eight (8) bytes in size. @type condition: function @param condition: (Optional) Condition callback function. The callback signature is:: def condition_callback(event): return True # returns True or False Where B{event} is an L{Event} object, and the return value is a boolean (C{True} to dispatch the event, C{False} otherwise). @type action: function @param action: (Optional) Action callback function. If specified, the event is handled by this callback instead of being dispatched normally. The callback signature is:: def action_callback(event): pass # no return value Where B{event} is an L{Event} object, and the return value is a boolean (C{True} to dispatch the event, C{False} otherwise). @rtype: L{HardwareBreakpoint} @return: The hardware breakpoint object. """ thread = self.system.get_thread(dwThreadId) bp = HardwareBreakpoint(address, triggerFlag, sizeFlag, condition, action) begin = bp.get_address() end = begin + bp.get_size() if dwThreadId in self.__hardwareBP: bpSet = self.__hardwareBP[dwThreadId] for oldbp in bpSet: old_begin = oldbp.get_address() old_end = old_begin + oldbp.get_size() if MemoryAddresses.do_ranges_intersect(begin, end, old_begin, old_end): msg = "Already exists (TID %d) : %r" % (dwThreadId, oldbp) raise KeyError(msg) else: bpSet = set() self.__hardwareBP[dwThreadId] = bpSet bpSet.add(bp) return bp
python
def define_hardware_breakpoint(self, dwThreadId, address, triggerFlag = BP_BREAK_ON_ACCESS, sizeFlag = BP_WATCH_DWORD, condition = True, action = None): """ Creates a disabled hardware breakpoint at the given address. @see: L{has_hardware_breakpoint}, L{get_hardware_breakpoint}, L{enable_hardware_breakpoint}, L{enable_one_shot_hardware_breakpoint}, L{disable_hardware_breakpoint}, L{erase_hardware_breakpoint} @note: Hardware breakpoints do not seem to work properly on VirtualBox. See U{http://www.virtualbox.org/ticket/477}. @type dwThreadId: int @param dwThreadId: Thread global ID. @type address: int @param address: Memory address to watch. @type triggerFlag: int @param triggerFlag: Trigger of breakpoint. Must be one of the following: - L{BP_BREAK_ON_EXECUTION} Break on code execution. - L{BP_BREAK_ON_WRITE} Break on memory read or write. - L{BP_BREAK_ON_ACCESS} Break on memory write. @type sizeFlag: int @param sizeFlag: Size of breakpoint. Must be one of the following: - L{BP_WATCH_BYTE} One (1) byte in size. - L{BP_WATCH_WORD} Two (2) bytes in size. - L{BP_WATCH_DWORD} Four (4) bytes in size. - L{BP_WATCH_QWORD} Eight (8) bytes in size. @type condition: function @param condition: (Optional) Condition callback function. The callback signature is:: def condition_callback(event): return True # returns True or False Where B{event} is an L{Event} object, and the return value is a boolean (C{True} to dispatch the event, C{False} otherwise). @type action: function @param action: (Optional) Action callback function. If specified, the event is handled by this callback instead of being dispatched normally. The callback signature is:: def action_callback(event): pass # no return value Where B{event} is an L{Event} object, and the return value is a boolean (C{True} to dispatch the event, C{False} otherwise). @rtype: L{HardwareBreakpoint} @return: The hardware breakpoint object. """ thread = self.system.get_thread(dwThreadId) bp = HardwareBreakpoint(address, triggerFlag, sizeFlag, condition, action) begin = bp.get_address() end = begin + bp.get_size() if dwThreadId in self.__hardwareBP: bpSet = self.__hardwareBP[dwThreadId] for oldbp in bpSet: old_begin = oldbp.get_address() old_end = old_begin + oldbp.get_size() if MemoryAddresses.do_ranges_intersect(begin, end, old_begin, old_end): msg = "Already exists (TID %d) : %r" % (dwThreadId, oldbp) raise KeyError(msg) else: bpSet = set() self.__hardwareBP[dwThreadId] = bpSet bpSet.add(bp) return bp
[ "def", "define_hardware_breakpoint", "(", "self", ",", "dwThreadId", ",", "address", ",", "triggerFlag", "=", "BP_BREAK_ON_ACCESS", ",", "sizeFlag", "=", "BP_WATCH_DWORD", ",", "condition", "=", "True", ",", "action", "=", "None", ")", ":", "thread", "=", "sel...
Creates a disabled hardware breakpoint at the given address. @see: L{has_hardware_breakpoint}, L{get_hardware_breakpoint}, L{enable_hardware_breakpoint}, L{enable_one_shot_hardware_breakpoint}, L{disable_hardware_breakpoint}, L{erase_hardware_breakpoint} @note: Hardware breakpoints do not seem to work properly on VirtualBox. See U{http://www.virtualbox.org/ticket/477}. @type dwThreadId: int @param dwThreadId: Thread global ID. @type address: int @param address: Memory address to watch. @type triggerFlag: int @param triggerFlag: Trigger of breakpoint. Must be one of the following: - L{BP_BREAK_ON_EXECUTION} Break on code execution. - L{BP_BREAK_ON_WRITE} Break on memory read or write. - L{BP_BREAK_ON_ACCESS} Break on memory write. @type sizeFlag: int @param sizeFlag: Size of breakpoint. Must be one of the following: - L{BP_WATCH_BYTE} One (1) byte in size. - L{BP_WATCH_WORD} Two (2) bytes in size. - L{BP_WATCH_DWORD} Four (4) bytes in size. - L{BP_WATCH_QWORD} Eight (8) bytes in size. @type condition: function @param condition: (Optional) Condition callback function. The callback signature is:: def condition_callback(event): return True # returns True or False Where B{event} is an L{Event} object, and the return value is a boolean (C{True} to dispatch the event, C{False} otherwise). @type action: function @param action: (Optional) Action callback function. If specified, the event is handled by this callback instead of being dispatched normally. The callback signature is:: def action_callback(event): pass # no return value Where B{event} is an L{Event} object, and the return value is a boolean (C{True} to dispatch the event, C{False} otherwise). @rtype: L{HardwareBreakpoint} @return: The hardware breakpoint object.
[ "Creates", "a", "disabled", "hardware", "breakpoint", "at", "the", "given", "address", "." ]
ed9c4307662a5593b8a7f1f3389ecd0e79b8c503
https://github.com/fabioz/PyDev.Debugger/blob/ed9c4307662a5593b8a7f1f3389ecd0e79b8c503/pydevd_attach_to_process/winappdbg/breakpoint.py#L2351-L2459
train
209,471
fabioz/PyDev.Debugger
pydevd_attach_to_process/winappdbg/breakpoint.py
_BreakpointContainer.has_hardware_breakpoint
def has_hardware_breakpoint(self, dwThreadId, address): """ Checks if a hardware breakpoint is defined at the given address. @see: L{define_hardware_breakpoint}, L{get_hardware_breakpoint}, L{erase_hardware_breakpoint}, L{enable_hardware_breakpoint}, L{enable_one_shot_hardware_breakpoint}, L{disable_hardware_breakpoint} @type dwThreadId: int @param dwThreadId: Thread global ID. @type address: int @param address: Memory address of breakpoint. @rtype: bool @return: C{True} if the breakpoint is defined, C{False} otherwise. """ if dwThreadId in self.__hardwareBP: bpSet = self.__hardwareBP[dwThreadId] for bp in bpSet: if bp.get_address() == address: return True return False
python
def has_hardware_breakpoint(self, dwThreadId, address): """ Checks if a hardware breakpoint is defined at the given address. @see: L{define_hardware_breakpoint}, L{get_hardware_breakpoint}, L{erase_hardware_breakpoint}, L{enable_hardware_breakpoint}, L{enable_one_shot_hardware_breakpoint}, L{disable_hardware_breakpoint} @type dwThreadId: int @param dwThreadId: Thread global ID. @type address: int @param address: Memory address of breakpoint. @rtype: bool @return: C{True} if the breakpoint is defined, C{False} otherwise. """ if dwThreadId in self.__hardwareBP: bpSet = self.__hardwareBP[dwThreadId] for bp in bpSet: if bp.get_address() == address: return True return False
[ "def", "has_hardware_breakpoint", "(", "self", ",", "dwThreadId", ",", "address", ")", ":", "if", "dwThreadId", "in", "self", ".", "__hardwareBP", ":", "bpSet", "=", "self", ".", "__hardwareBP", "[", "dwThreadId", "]", "for", "bp", "in", "bpSet", ":", "if"...
Checks if a hardware breakpoint is defined at the given address. @see: L{define_hardware_breakpoint}, L{get_hardware_breakpoint}, L{erase_hardware_breakpoint}, L{enable_hardware_breakpoint}, L{enable_one_shot_hardware_breakpoint}, L{disable_hardware_breakpoint} @type dwThreadId: int @param dwThreadId: Thread global ID. @type address: int @param address: Memory address of breakpoint. @rtype: bool @return: C{True} if the breakpoint is defined, C{False} otherwise.
[ "Checks", "if", "a", "hardware", "breakpoint", "is", "defined", "at", "the", "given", "address", "." ]
ed9c4307662a5593b8a7f1f3389ecd0e79b8c503
https://github.com/fabioz/PyDev.Debugger/blob/ed9c4307662a5593b8a7f1f3389ecd0e79b8c503/pydevd_attach_to_process/winappdbg/breakpoint.py#L2511-L2537
train
209,472
fabioz/PyDev.Debugger
pydevd_attach_to_process/winappdbg/breakpoint.py
_BreakpointContainer.get_page_breakpoint
def get_page_breakpoint(self, dwProcessId, address): """ Returns the internally used breakpoint object, for the page breakpoint defined at the given address. @warning: It's usually best to call the L{Debug} methods instead of accessing the breakpoint objects directly. @see: L{define_page_breakpoint}, L{has_page_breakpoint}, L{enable_page_breakpoint}, L{enable_one_shot_page_breakpoint}, L{disable_page_breakpoint}, L{erase_page_breakpoint} @type dwProcessId: int @param dwProcessId: Process global ID. @type address: int @param address: Memory address where the breakpoint is defined. @rtype: L{PageBreakpoint} @return: The page breakpoint object. """ key = (dwProcessId, address) if key not in self.__pageBP: msg = "No breakpoint at process %d, address %s" address = HexDump.addresS(address) raise KeyError(msg % (dwProcessId, address)) return self.__pageBP[key]
python
def get_page_breakpoint(self, dwProcessId, address): """ Returns the internally used breakpoint object, for the page breakpoint defined at the given address. @warning: It's usually best to call the L{Debug} methods instead of accessing the breakpoint objects directly. @see: L{define_page_breakpoint}, L{has_page_breakpoint}, L{enable_page_breakpoint}, L{enable_one_shot_page_breakpoint}, L{disable_page_breakpoint}, L{erase_page_breakpoint} @type dwProcessId: int @param dwProcessId: Process global ID. @type address: int @param address: Memory address where the breakpoint is defined. @rtype: L{PageBreakpoint} @return: The page breakpoint object. """ key = (dwProcessId, address) if key not in self.__pageBP: msg = "No breakpoint at process %d, address %s" address = HexDump.addresS(address) raise KeyError(msg % (dwProcessId, address)) return self.__pageBP[key]
[ "def", "get_page_breakpoint", "(", "self", ",", "dwProcessId", ",", "address", ")", ":", "key", "=", "(", "dwProcessId", ",", "address", ")", "if", "key", "not", "in", "self", ".", "__pageBP", ":", "msg", "=", "\"No breakpoint at process %d, address %s\"", "ad...
Returns the internally used breakpoint object, for the page breakpoint defined at the given address. @warning: It's usually best to call the L{Debug} methods instead of accessing the breakpoint objects directly. @see: L{define_page_breakpoint}, L{has_page_breakpoint}, L{enable_page_breakpoint}, L{enable_one_shot_page_breakpoint}, L{disable_page_breakpoint}, L{erase_page_breakpoint} @type dwProcessId: int @param dwProcessId: Process global ID. @type address: int @param address: Memory address where the breakpoint is defined. @rtype: L{PageBreakpoint} @return: The page breakpoint object.
[ "Returns", "the", "internally", "used", "breakpoint", "object", "for", "the", "page", "breakpoint", "defined", "at", "the", "given", "address", "." ]
ed9c4307662a5593b8a7f1f3389ecd0e79b8c503
https://github.com/fabioz/PyDev.Debugger/blob/ed9c4307662a5593b8a7f1f3389ecd0e79b8c503/pydevd_attach_to_process/winappdbg/breakpoint.py#L2575-L2605
train
209,473
fabioz/PyDev.Debugger
pydevd_attach_to_process/winappdbg/breakpoint.py
_BreakpointContainer.enable_code_breakpoint
def enable_code_breakpoint(self, dwProcessId, address): """ Enables the code breakpoint at the given address. @see: L{define_code_breakpoint}, L{has_code_breakpoint}, L{enable_one_shot_code_breakpoint}, L{disable_code_breakpoint} L{erase_code_breakpoint}, @type dwProcessId: int @param dwProcessId: Process global ID. @type address: int @param address: Memory address of breakpoint. """ p = self.system.get_process(dwProcessId) bp = self.get_code_breakpoint(dwProcessId, address) if bp.is_running(): self.__del_running_bp_from_all_threads(bp) bp.enable(p, None)
python
def enable_code_breakpoint(self, dwProcessId, address): """ Enables the code breakpoint at the given address. @see: L{define_code_breakpoint}, L{has_code_breakpoint}, L{enable_one_shot_code_breakpoint}, L{disable_code_breakpoint} L{erase_code_breakpoint}, @type dwProcessId: int @param dwProcessId: Process global ID. @type address: int @param address: Memory address of breakpoint. """ p = self.system.get_process(dwProcessId) bp = self.get_code_breakpoint(dwProcessId, address) if bp.is_running(): self.__del_running_bp_from_all_threads(bp) bp.enable(p, None)
[ "def", "enable_code_breakpoint", "(", "self", ",", "dwProcessId", ",", "address", ")", ":", "p", "=", "self", ".", "system", ".", "get_process", "(", "dwProcessId", ")", "bp", "=", "self", ".", "get_code_breakpoint", "(", "dwProcessId", ",", "address", ")", ...
Enables the code breakpoint at the given address. @see: L{define_code_breakpoint}, L{has_code_breakpoint}, L{enable_one_shot_code_breakpoint}, L{disable_code_breakpoint} L{erase_code_breakpoint}, @type dwProcessId: int @param dwProcessId: Process global ID. @type address: int @param address: Memory address of breakpoint.
[ "Enables", "the", "code", "breakpoint", "at", "the", "given", "address", "." ]
ed9c4307662a5593b8a7f1f3389ecd0e79b8c503
https://github.com/fabioz/PyDev.Debugger/blob/ed9c4307662a5593b8a7f1f3389ecd0e79b8c503/pydevd_attach_to_process/winappdbg/breakpoint.py#L2646-L2667
train
209,474
fabioz/PyDev.Debugger
pydevd_attach_to_process/winappdbg/breakpoint.py
_BreakpointContainer.enable_page_breakpoint
def enable_page_breakpoint(self, dwProcessId, address): """ Enables the page breakpoint at the given address. @see: L{define_page_breakpoint}, L{has_page_breakpoint}, L{get_page_breakpoint}, L{enable_one_shot_page_breakpoint}, L{disable_page_breakpoint} L{erase_page_breakpoint}, @type dwProcessId: int @param dwProcessId: Process global ID. @type address: int @param address: Memory address of breakpoint. """ p = self.system.get_process(dwProcessId) bp = self.get_page_breakpoint(dwProcessId, address) if bp.is_running(): self.__del_running_bp_from_all_threads(bp) bp.enable(p, None)
python
def enable_page_breakpoint(self, dwProcessId, address): """ Enables the page breakpoint at the given address. @see: L{define_page_breakpoint}, L{has_page_breakpoint}, L{get_page_breakpoint}, L{enable_one_shot_page_breakpoint}, L{disable_page_breakpoint} L{erase_page_breakpoint}, @type dwProcessId: int @param dwProcessId: Process global ID. @type address: int @param address: Memory address of breakpoint. """ p = self.system.get_process(dwProcessId) bp = self.get_page_breakpoint(dwProcessId, address) if bp.is_running(): self.__del_running_bp_from_all_threads(bp) bp.enable(p, None)
[ "def", "enable_page_breakpoint", "(", "self", ",", "dwProcessId", ",", "address", ")", ":", "p", "=", "self", ".", "system", ".", "get_process", "(", "dwProcessId", ")", "bp", "=", "self", ".", "get_page_breakpoint", "(", "dwProcessId", ",", "address", ")", ...
Enables the page breakpoint at the given address. @see: L{define_page_breakpoint}, L{has_page_breakpoint}, L{get_page_breakpoint}, L{enable_one_shot_page_breakpoint}, L{disable_page_breakpoint} L{erase_page_breakpoint}, @type dwProcessId: int @param dwProcessId: Process global ID. @type address: int @param address: Memory address of breakpoint.
[ "Enables", "the", "page", "breakpoint", "at", "the", "given", "address", "." ]
ed9c4307662a5593b8a7f1f3389ecd0e79b8c503
https://github.com/fabioz/PyDev.Debugger/blob/ed9c4307662a5593b8a7f1f3389ecd0e79b8c503/pydevd_attach_to_process/winappdbg/breakpoint.py#L2669-L2691
train
209,475
fabioz/PyDev.Debugger
pydevd_attach_to_process/winappdbg/breakpoint.py
_BreakpointContainer.enable_hardware_breakpoint
def enable_hardware_breakpoint(self, dwThreadId, address): """ Enables the hardware breakpoint at the given address. @see: L{define_hardware_breakpoint}, L{has_hardware_breakpoint}, L{get_hardware_breakpoint}, L{enable_one_shot_hardware_breakpoint}, L{disable_hardware_breakpoint} L{erase_hardware_breakpoint}, @note: Do not set hardware breakpoints while processing the system breakpoint event. @type dwThreadId: int @param dwThreadId: Thread global ID. @type address: int @param address: Memory address of breakpoint. """ t = self.system.get_thread(dwThreadId) bp = self.get_hardware_breakpoint(dwThreadId, address) if bp.is_running(): self.__del_running_bp_from_all_threads(bp) bp.enable(None, t)
python
def enable_hardware_breakpoint(self, dwThreadId, address): """ Enables the hardware breakpoint at the given address. @see: L{define_hardware_breakpoint}, L{has_hardware_breakpoint}, L{get_hardware_breakpoint}, L{enable_one_shot_hardware_breakpoint}, L{disable_hardware_breakpoint} L{erase_hardware_breakpoint}, @note: Do not set hardware breakpoints while processing the system breakpoint event. @type dwThreadId: int @param dwThreadId: Thread global ID. @type address: int @param address: Memory address of breakpoint. """ t = self.system.get_thread(dwThreadId) bp = self.get_hardware_breakpoint(dwThreadId, address) if bp.is_running(): self.__del_running_bp_from_all_threads(bp) bp.enable(None, t)
[ "def", "enable_hardware_breakpoint", "(", "self", ",", "dwThreadId", ",", "address", ")", ":", "t", "=", "self", ".", "system", ".", "get_thread", "(", "dwThreadId", ")", "bp", "=", "self", ".", "get_hardware_breakpoint", "(", "dwThreadId", ",", "address", "...
Enables the hardware breakpoint at the given address. @see: L{define_hardware_breakpoint}, L{has_hardware_breakpoint}, L{get_hardware_breakpoint}, L{enable_one_shot_hardware_breakpoint}, L{disable_hardware_breakpoint} L{erase_hardware_breakpoint}, @note: Do not set hardware breakpoints while processing the system breakpoint event. @type dwThreadId: int @param dwThreadId: Thread global ID. @type address: int @param address: Memory address of breakpoint.
[ "Enables", "the", "hardware", "breakpoint", "at", "the", "given", "address", "." ]
ed9c4307662a5593b8a7f1f3389ecd0e79b8c503
https://github.com/fabioz/PyDev.Debugger/blob/ed9c4307662a5593b8a7f1f3389ecd0e79b8c503/pydevd_attach_to_process/winappdbg/breakpoint.py#L2693-L2718
train
209,476
fabioz/PyDev.Debugger
pydevd_attach_to_process/winappdbg/breakpoint.py
_BreakpointContainer.enable_one_shot_code_breakpoint
def enable_one_shot_code_breakpoint(self, dwProcessId, address): """ Enables the code breakpoint at the given address for only one shot. @see: L{define_code_breakpoint}, L{has_code_breakpoint}, L{get_code_breakpoint}, L{enable_code_breakpoint}, L{disable_code_breakpoint} L{erase_code_breakpoint}, @type dwProcessId: int @param dwProcessId: Process global ID. @type address: int @param address: Memory address of breakpoint. """ p = self.system.get_process(dwProcessId) bp = self.get_code_breakpoint(dwProcessId, address) if bp.is_running(): self.__del_running_bp_from_all_threads(bp) bp.one_shot(p, None)
python
def enable_one_shot_code_breakpoint(self, dwProcessId, address): """ Enables the code breakpoint at the given address for only one shot. @see: L{define_code_breakpoint}, L{has_code_breakpoint}, L{get_code_breakpoint}, L{enable_code_breakpoint}, L{disable_code_breakpoint} L{erase_code_breakpoint}, @type dwProcessId: int @param dwProcessId: Process global ID. @type address: int @param address: Memory address of breakpoint. """ p = self.system.get_process(dwProcessId) bp = self.get_code_breakpoint(dwProcessId, address) if bp.is_running(): self.__del_running_bp_from_all_threads(bp) bp.one_shot(p, None)
[ "def", "enable_one_shot_code_breakpoint", "(", "self", ",", "dwProcessId", ",", "address", ")", ":", "p", "=", "self", ".", "system", ".", "get_process", "(", "dwProcessId", ")", "bp", "=", "self", ".", "get_code_breakpoint", "(", "dwProcessId", ",", "address"...
Enables the code breakpoint at the given address for only one shot. @see: L{define_code_breakpoint}, L{has_code_breakpoint}, L{get_code_breakpoint}, L{enable_code_breakpoint}, L{disable_code_breakpoint} L{erase_code_breakpoint}, @type dwProcessId: int @param dwProcessId: Process global ID. @type address: int @param address: Memory address of breakpoint.
[ "Enables", "the", "code", "breakpoint", "at", "the", "given", "address", "for", "only", "one", "shot", "." ]
ed9c4307662a5593b8a7f1f3389ecd0e79b8c503
https://github.com/fabioz/PyDev.Debugger/blob/ed9c4307662a5593b8a7f1f3389ecd0e79b8c503/pydevd_attach_to_process/winappdbg/breakpoint.py#L2720-L2742
train
209,477
fabioz/PyDev.Debugger
pydevd_attach_to_process/winappdbg/breakpoint.py
_BreakpointContainer.enable_one_shot_page_breakpoint
def enable_one_shot_page_breakpoint(self, dwProcessId, address): """ Enables the page breakpoint at the given address for only one shot. @see: L{define_page_breakpoint}, L{has_page_breakpoint}, L{get_page_breakpoint}, L{enable_page_breakpoint}, L{disable_page_breakpoint} L{erase_page_breakpoint}, @type dwProcessId: int @param dwProcessId: Process global ID. @type address: int @param address: Memory address of breakpoint. """ p = self.system.get_process(dwProcessId) bp = self.get_page_breakpoint(dwProcessId, address) if bp.is_running(): self.__del_running_bp_from_all_threads(bp) bp.one_shot(p, None)
python
def enable_one_shot_page_breakpoint(self, dwProcessId, address): """ Enables the page breakpoint at the given address for only one shot. @see: L{define_page_breakpoint}, L{has_page_breakpoint}, L{get_page_breakpoint}, L{enable_page_breakpoint}, L{disable_page_breakpoint} L{erase_page_breakpoint}, @type dwProcessId: int @param dwProcessId: Process global ID. @type address: int @param address: Memory address of breakpoint. """ p = self.system.get_process(dwProcessId) bp = self.get_page_breakpoint(dwProcessId, address) if bp.is_running(): self.__del_running_bp_from_all_threads(bp) bp.one_shot(p, None)
[ "def", "enable_one_shot_page_breakpoint", "(", "self", ",", "dwProcessId", ",", "address", ")", ":", "p", "=", "self", ".", "system", ".", "get_process", "(", "dwProcessId", ")", "bp", "=", "self", ".", "get_page_breakpoint", "(", "dwProcessId", ",", "address"...
Enables the page breakpoint at the given address for only one shot. @see: L{define_page_breakpoint}, L{has_page_breakpoint}, L{get_page_breakpoint}, L{enable_page_breakpoint}, L{disable_page_breakpoint} L{erase_page_breakpoint}, @type dwProcessId: int @param dwProcessId: Process global ID. @type address: int @param address: Memory address of breakpoint.
[ "Enables", "the", "page", "breakpoint", "at", "the", "given", "address", "for", "only", "one", "shot", "." ]
ed9c4307662a5593b8a7f1f3389ecd0e79b8c503
https://github.com/fabioz/PyDev.Debugger/blob/ed9c4307662a5593b8a7f1f3389ecd0e79b8c503/pydevd_attach_to_process/winappdbg/breakpoint.py#L2744-L2766
train
209,478
fabioz/PyDev.Debugger
pydevd_attach_to_process/winappdbg/breakpoint.py
_BreakpointContainer.enable_one_shot_hardware_breakpoint
def enable_one_shot_hardware_breakpoint(self, dwThreadId, address): """ Enables the hardware breakpoint at the given address for only one shot. @see: L{define_hardware_breakpoint}, L{has_hardware_breakpoint}, L{get_hardware_breakpoint}, L{enable_hardware_breakpoint}, L{disable_hardware_breakpoint} L{erase_hardware_breakpoint}, @type dwThreadId: int @param dwThreadId: Thread global ID. @type address: int @param address: Memory address of breakpoint. """ t = self.system.get_thread(dwThreadId) bp = self.get_hardware_breakpoint(dwThreadId, address) if bp.is_running(): self.__del_running_bp_from_all_threads(bp) bp.one_shot(None, t)
python
def enable_one_shot_hardware_breakpoint(self, dwThreadId, address): """ Enables the hardware breakpoint at the given address for only one shot. @see: L{define_hardware_breakpoint}, L{has_hardware_breakpoint}, L{get_hardware_breakpoint}, L{enable_hardware_breakpoint}, L{disable_hardware_breakpoint} L{erase_hardware_breakpoint}, @type dwThreadId: int @param dwThreadId: Thread global ID. @type address: int @param address: Memory address of breakpoint. """ t = self.system.get_thread(dwThreadId) bp = self.get_hardware_breakpoint(dwThreadId, address) if bp.is_running(): self.__del_running_bp_from_all_threads(bp) bp.one_shot(None, t)
[ "def", "enable_one_shot_hardware_breakpoint", "(", "self", ",", "dwThreadId", ",", "address", ")", ":", "t", "=", "self", ".", "system", ".", "get_thread", "(", "dwThreadId", ")", "bp", "=", "self", ".", "get_hardware_breakpoint", "(", "dwThreadId", ",", "addr...
Enables the hardware breakpoint at the given address for only one shot. @see: L{define_hardware_breakpoint}, L{has_hardware_breakpoint}, L{get_hardware_breakpoint}, L{enable_hardware_breakpoint}, L{disable_hardware_breakpoint} L{erase_hardware_breakpoint}, @type dwThreadId: int @param dwThreadId: Thread global ID. @type address: int @param address: Memory address of breakpoint.
[ "Enables", "the", "hardware", "breakpoint", "at", "the", "given", "address", "for", "only", "one", "shot", "." ]
ed9c4307662a5593b8a7f1f3389ecd0e79b8c503
https://github.com/fabioz/PyDev.Debugger/blob/ed9c4307662a5593b8a7f1f3389ecd0e79b8c503/pydevd_attach_to_process/winappdbg/breakpoint.py#L2768-L2790
train
209,479
fabioz/PyDev.Debugger
pydevd_attach_to_process/winappdbg/breakpoint.py
_BreakpointContainer.disable_code_breakpoint
def disable_code_breakpoint(self, dwProcessId, address): """ Disables the code breakpoint at the given address. @see: L{define_code_breakpoint}, L{has_code_breakpoint}, L{get_code_breakpoint}, L{enable_code_breakpoint} L{enable_one_shot_code_breakpoint}, L{erase_code_breakpoint}, @type dwProcessId: int @param dwProcessId: Process global ID. @type address: int @param address: Memory address of breakpoint. """ p = self.system.get_process(dwProcessId) bp = self.get_code_breakpoint(dwProcessId, address) if bp.is_running(): self.__del_running_bp_from_all_threads(bp) bp.disable(p, None)
python
def disable_code_breakpoint(self, dwProcessId, address): """ Disables the code breakpoint at the given address. @see: L{define_code_breakpoint}, L{has_code_breakpoint}, L{get_code_breakpoint}, L{enable_code_breakpoint} L{enable_one_shot_code_breakpoint}, L{erase_code_breakpoint}, @type dwProcessId: int @param dwProcessId: Process global ID. @type address: int @param address: Memory address of breakpoint. """ p = self.system.get_process(dwProcessId) bp = self.get_code_breakpoint(dwProcessId, address) if bp.is_running(): self.__del_running_bp_from_all_threads(bp) bp.disable(p, None)
[ "def", "disable_code_breakpoint", "(", "self", ",", "dwProcessId", ",", "address", ")", ":", "p", "=", "self", ".", "system", ".", "get_process", "(", "dwProcessId", ")", "bp", "=", "self", ".", "get_code_breakpoint", "(", "dwProcessId", ",", "address", ")",...
Disables the code breakpoint at the given address. @see: L{define_code_breakpoint}, L{has_code_breakpoint}, L{get_code_breakpoint}, L{enable_code_breakpoint} L{enable_one_shot_code_breakpoint}, L{erase_code_breakpoint}, @type dwProcessId: int @param dwProcessId: Process global ID. @type address: int @param address: Memory address of breakpoint.
[ "Disables", "the", "code", "breakpoint", "at", "the", "given", "address", "." ]
ed9c4307662a5593b8a7f1f3389ecd0e79b8c503
https://github.com/fabioz/PyDev.Debugger/blob/ed9c4307662a5593b8a7f1f3389ecd0e79b8c503/pydevd_attach_to_process/winappdbg/breakpoint.py#L2792-L2814
train
209,480
fabioz/PyDev.Debugger
pydevd_attach_to_process/winappdbg/breakpoint.py
_BreakpointContainer.disable_page_breakpoint
def disable_page_breakpoint(self, dwProcessId, address): """ Disables the page breakpoint at the given address. @see: L{define_page_breakpoint}, L{has_page_breakpoint}, L{get_page_breakpoint}, L{enable_page_breakpoint} L{enable_one_shot_page_breakpoint}, L{erase_page_breakpoint}, @type dwProcessId: int @param dwProcessId: Process global ID. @type address: int @param address: Memory address of breakpoint. """ p = self.system.get_process(dwProcessId) bp = self.get_page_breakpoint(dwProcessId, address) if bp.is_running(): self.__del_running_bp_from_all_threads(bp) bp.disable(p, None)
python
def disable_page_breakpoint(self, dwProcessId, address): """ Disables the page breakpoint at the given address. @see: L{define_page_breakpoint}, L{has_page_breakpoint}, L{get_page_breakpoint}, L{enable_page_breakpoint} L{enable_one_shot_page_breakpoint}, L{erase_page_breakpoint}, @type dwProcessId: int @param dwProcessId: Process global ID. @type address: int @param address: Memory address of breakpoint. """ p = self.system.get_process(dwProcessId) bp = self.get_page_breakpoint(dwProcessId, address) if bp.is_running(): self.__del_running_bp_from_all_threads(bp) bp.disable(p, None)
[ "def", "disable_page_breakpoint", "(", "self", ",", "dwProcessId", ",", "address", ")", ":", "p", "=", "self", ".", "system", ".", "get_process", "(", "dwProcessId", ")", "bp", "=", "self", ".", "get_page_breakpoint", "(", "dwProcessId", ",", "address", ")",...
Disables the page breakpoint at the given address. @see: L{define_page_breakpoint}, L{has_page_breakpoint}, L{get_page_breakpoint}, L{enable_page_breakpoint} L{enable_one_shot_page_breakpoint}, L{erase_page_breakpoint}, @type dwProcessId: int @param dwProcessId: Process global ID. @type address: int @param address: Memory address of breakpoint.
[ "Disables", "the", "page", "breakpoint", "at", "the", "given", "address", "." ]
ed9c4307662a5593b8a7f1f3389ecd0e79b8c503
https://github.com/fabioz/PyDev.Debugger/blob/ed9c4307662a5593b8a7f1f3389ecd0e79b8c503/pydevd_attach_to_process/winappdbg/breakpoint.py#L2816-L2838
train
209,481
fabioz/PyDev.Debugger
pydevd_attach_to_process/winappdbg/breakpoint.py
_BreakpointContainer.disable_hardware_breakpoint
def disable_hardware_breakpoint(self, dwThreadId, address): """ Disables the hardware breakpoint at the given address. @see: L{define_hardware_breakpoint}, L{has_hardware_breakpoint}, L{get_hardware_breakpoint}, L{enable_hardware_breakpoint} L{enable_one_shot_hardware_breakpoint}, L{erase_hardware_breakpoint}, @type dwThreadId: int @param dwThreadId: Thread global ID. @type address: int @param address: Memory address of breakpoint. """ t = self.system.get_thread(dwThreadId) p = t.get_process() bp = self.get_hardware_breakpoint(dwThreadId, address) if bp.is_running(): self.__del_running_bp(dwThreadId, bp) bp.disable(p, t)
python
def disable_hardware_breakpoint(self, dwThreadId, address): """ Disables the hardware breakpoint at the given address. @see: L{define_hardware_breakpoint}, L{has_hardware_breakpoint}, L{get_hardware_breakpoint}, L{enable_hardware_breakpoint} L{enable_one_shot_hardware_breakpoint}, L{erase_hardware_breakpoint}, @type dwThreadId: int @param dwThreadId: Thread global ID. @type address: int @param address: Memory address of breakpoint. """ t = self.system.get_thread(dwThreadId) p = t.get_process() bp = self.get_hardware_breakpoint(dwThreadId, address) if bp.is_running(): self.__del_running_bp(dwThreadId, bp) bp.disable(p, t)
[ "def", "disable_hardware_breakpoint", "(", "self", ",", "dwThreadId", ",", "address", ")", ":", "t", "=", "self", ".", "system", ".", "get_thread", "(", "dwThreadId", ")", "p", "=", "t", ".", "get_process", "(", ")", "bp", "=", "self", ".", "get_hardware...
Disables the hardware breakpoint at the given address. @see: L{define_hardware_breakpoint}, L{has_hardware_breakpoint}, L{get_hardware_breakpoint}, L{enable_hardware_breakpoint} L{enable_one_shot_hardware_breakpoint}, L{erase_hardware_breakpoint}, @type dwThreadId: int @param dwThreadId: Thread global ID. @type address: int @param address: Memory address of breakpoint.
[ "Disables", "the", "hardware", "breakpoint", "at", "the", "given", "address", "." ]
ed9c4307662a5593b8a7f1f3389ecd0e79b8c503
https://github.com/fabioz/PyDev.Debugger/blob/ed9c4307662a5593b8a7f1f3389ecd0e79b8c503/pydevd_attach_to_process/winappdbg/breakpoint.py#L2840-L2863
train
209,482
fabioz/PyDev.Debugger
pydevd_attach_to_process/winappdbg/breakpoint.py
_BreakpointContainer.erase_code_breakpoint
def erase_code_breakpoint(self, dwProcessId, address): """ Erases the code breakpoint at the given address. @see: L{define_code_breakpoint}, L{has_code_breakpoint}, L{get_code_breakpoint}, L{enable_code_breakpoint}, L{enable_one_shot_code_breakpoint}, L{disable_code_breakpoint} @type dwProcessId: int @param dwProcessId: Process global ID. @type address: int @param address: Memory address of breakpoint. """ bp = self.get_code_breakpoint(dwProcessId, address) if not bp.is_disabled(): self.disable_code_breakpoint(dwProcessId, address) del self.__codeBP[ (dwProcessId, address) ]
python
def erase_code_breakpoint(self, dwProcessId, address): """ Erases the code breakpoint at the given address. @see: L{define_code_breakpoint}, L{has_code_breakpoint}, L{get_code_breakpoint}, L{enable_code_breakpoint}, L{enable_one_shot_code_breakpoint}, L{disable_code_breakpoint} @type dwProcessId: int @param dwProcessId: Process global ID. @type address: int @param address: Memory address of breakpoint. """ bp = self.get_code_breakpoint(dwProcessId, address) if not bp.is_disabled(): self.disable_code_breakpoint(dwProcessId, address) del self.__codeBP[ (dwProcessId, address) ]
[ "def", "erase_code_breakpoint", "(", "self", ",", "dwProcessId", ",", "address", ")", ":", "bp", "=", "self", ".", "get_code_breakpoint", "(", "dwProcessId", ",", "address", ")", "if", "not", "bp", ".", "is_disabled", "(", ")", ":", "self", ".", "disable_c...
Erases the code breakpoint at the given address. @see: L{define_code_breakpoint}, L{has_code_breakpoint}, L{get_code_breakpoint}, L{enable_code_breakpoint}, L{enable_one_shot_code_breakpoint}, L{disable_code_breakpoint} @type dwProcessId: int @param dwProcessId: Process global ID. @type address: int @param address: Memory address of breakpoint.
[ "Erases", "the", "code", "breakpoint", "at", "the", "given", "address", "." ]
ed9c4307662a5593b8a7f1f3389ecd0e79b8c503
https://github.com/fabioz/PyDev.Debugger/blob/ed9c4307662a5593b8a7f1f3389ecd0e79b8c503/pydevd_attach_to_process/winappdbg/breakpoint.py#L2869-L2890
train
209,483
fabioz/PyDev.Debugger
pydevd_attach_to_process/winappdbg/breakpoint.py
_BreakpointContainer.erase_page_breakpoint
def erase_page_breakpoint(self, dwProcessId, address): """ Erases the page breakpoint at the given address. @see: L{define_page_breakpoint}, L{has_page_breakpoint}, L{get_page_breakpoint}, L{enable_page_breakpoint}, L{enable_one_shot_page_breakpoint}, L{disable_page_breakpoint} @type dwProcessId: int @param dwProcessId: Process global ID. @type address: int @param address: Memory address of breakpoint. """ bp = self.get_page_breakpoint(dwProcessId, address) begin = bp.get_address() end = begin + bp.get_size() if not bp.is_disabled(): self.disable_page_breakpoint(dwProcessId, address) address = begin pageSize = MemoryAddresses.pageSize while address < end: del self.__pageBP[ (dwProcessId, address) ] address = address + pageSize
python
def erase_page_breakpoint(self, dwProcessId, address): """ Erases the page breakpoint at the given address. @see: L{define_page_breakpoint}, L{has_page_breakpoint}, L{get_page_breakpoint}, L{enable_page_breakpoint}, L{enable_one_shot_page_breakpoint}, L{disable_page_breakpoint} @type dwProcessId: int @param dwProcessId: Process global ID. @type address: int @param address: Memory address of breakpoint. """ bp = self.get_page_breakpoint(dwProcessId, address) begin = bp.get_address() end = begin + bp.get_size() if not bp.is_disabled(): self.disable_page_breakpoint(dwProcessId, address) address = begin pageSize = MemoryAddresses.pageSize while address < end: del self.__pageBP[ (dwProcessId, address) ] address = address + pageSize
[ "def", "erase_page_breakpoint", "(", "self", ",", "dwProcessId", ",", "address", ")", ":", "bp", "=", "self", ".", "get_page_breakpoint", "(", "dwProcessId", ",", "address", ")", "begin", "=", "bp", ".", "get_address", "(", ")", "end", "=", "begin", "+", ...
Erases the page breakpoint at the given address. @see: L{define_page_breakpoint}, L{has_page_breakpoint}, L{get_page_breakpoint}, L{enable_page_breakpoint}, L{enable_one_shot_page_breakpoint}, L{disable_page_breakpoint} @type dwProcessId: int @param dwProcessId: Process global ID. @type address: int @param address: Memory address of breakpoint.
[ "Erases", "the", "page", "breakpoint", "at", "the", "given", "address", "." ]
ed9c4307662a5593b8a7f1f3389ecd0e79b8c503
https://github.com/fabioz/PyDev.Debugger/blob/ed9c4307662a5593b8a7f1f3389ecd0e79b8c503/pydevd_attach_to_process/winappdbg/breakpoint.py#L2892-L2919
train
209,484
fabioz/PyDev.Debugger
pydevd_attach_to_process/winappdbg/breakpoint.py
_BreakpointContainer.erase_hardware_breakpoint
def erase_hardware_breakpoint(self, dwThreadId, address): """ Erases the hardware breakpoint at the given address. @see: L{define_hardware_breakpoint}, L{has_hardware_breakpoint}, L{get_hardware_breakpoint}, L{enable_hardware_breakpoint}, L{enable_one_shot_hardware_breakpoint}, L{disable_hardware_breakpoint} @type dwThreadId: int @param dwThreadId: Thread global ID. @type address: int @param address: Memory address of breakpoint. """ bp = self.get_hardware_breakpoint(dwThreadId, address) if not bp.is_disabled(): self.disable_hardware_breakpoint(dwThreadId, address) bpSet = self.__hardwareBP[dwThreadId] bpSet.remove(bp) if not bpSet: del self.__hardwareBP[dwThreadId]
python
def erase_hardware_breakpoint(self, dwThreadId, address): """ Erases the hardware breakpoint at the given address. @see: L{define_hardware_breakpoint}, L{has_hardware_breakpoint}, L{get_hardware_breakpoint}, L{enable_hardware_breakpoint}, L{enable_one_shot_hardware_breakpoint}, L{disable_hardware_breakpoint} @type dwThreadId: int @param dwThreadId: Thread global ID. @type address: int @param address: Memory address of breakpoint. """ bp = self.get_hardware_breakpoint(dwThreadId, address) if not bp.is_disabled(): self.disable_hardware_breakpoint(dwThreadId, address) bpSet = self.__hardwareBP[dwThreadId] bpSet.remove(bp) if not bpSet: del self.__hardwareBP[dwThreadId]
[ "def", "erase_hardware_breakpoint", "(", "self", ",", "dwThreadId", ",", "address", ")", ":", "bp", "=", "self", ".", "get_hardware_breakpoint", "(", "dwThreadId", ",", "address", ")", "if", "not", "bp", ".", "is_disabled", "(", ")", ":", "self", ".", "dis...
Erases the hardware breakpoint at the given address. @see: L{define_hardware_breakpoint}, L{has_hardware_breakpoint}, L{get_hardware_breakpoint}, L{enable_hardware_breakpoint}, L{enable_one_shot_hardware_breakpoint}, L{disable_hardware_breakpoint} @type dwThreadId: int @param dwThreadId: Thread global ID. @type address: int @param address: Memory address of breakpoint.
[ "Erases", "the", "hardware", "breakpoint", "at", "the", "given", "address", "." ]
ed9c4307662a5593b8a7f1f3389ecd0e79b8c503
https://github.com/fabioz/PyDev.Debugger/blob/ed9c4307662a5593b8a7f1f3389ecd0e79b8c503/pydevd_attach_to_process/winappdbg/breakpoint.py#L2921-L2945
train
209,485
fabioz/PyDev.Debugger
pydevd_attach_to_process/winappdbg/breakpoint.py
_BreakpointContainer.get_all_breakpoints
def get_all_breakpoints(self): """ Returns all breakpoint objects as a list of tuples. Each tuple contains: - Process global ID to which the breakpoint applies. - Thread global ID to which the breakpoint applies, or C{None}. - The L{Breakpoint} object itself. @note: If you're only interested in a specific breakpoint type, or in breakpoints for a specific process or thread, it's probably faster to call one of the following methods: - L{get_all_code_breakpoints} - L{get_all_page_breakpoints} - L{get_all_hardware_breakpoints} - L{get_process_code_breakpoints} - L{get_process_page_breakpoints} - L{get_process_hardware_breakpoints} - L{get_thread_hardware_breakpoints} @rtype: list of tuple( pid, tid, bp ) @return: List of all breakpoints. """ bplist = list() # Get the code breakpoints. for (pid, bp) in self.get_all_code_breakpoints(): bplist.append( (pid, None, bp) ) # Get the page breakpoints. for (pid, bp) in self.get_all_page_breakpoints(): bplist.append( (pid, None, bp) ) # Get the hardware breakpoints. for (tid, bp) in self.get_all_hardware_breakpoints(): pid = self.system.get_thread(tid).get_pid() bplist.append( (pid, tid, bp) ) # Return the list of breakpoints. return bplist
python
def get_all_breakpoints(self): """ Returns all breakpoint objects as a list of tuples. Each tuple contains: - Process global ID to which the breakpoint applies. - Thread global ID to which the breakpoint applies, or C{None}. - The L{Breakpoint} object itself. @note: If you're only interested in a specific breakpoint type, or in breakpoints for a specific process or thread, it's probably faster to call one of the following methods: - L{get_all_code_breakpoints} - L{get_all_page_breakpoints} - L{get_all_hardware_breakpoints} - L{get_process_code_breakpoints} - L{get_process_page_breakpoints} - L{get_process_hardware_breakpoints} - L{get_thread_hardware_breakpoints} @rtype: list of tuple( pid, tid, bp ) @return: List of all breakpoints. """ bplist = list() # Get the code breakpoints. for (pid, bp) in self.get_all_code_breakpoints(): bplist.append( (pid, None, bp) ) # Get the page breakpoints. for (pid, bp) in self.get_all_page_breakpoints(): bplist.append( (pid, None, bp) ) # Get the hardware breakpoints. for (tid, bp) in self.get_all_hardware_breakpoints(): pid = self.system.get_thread(tid).get_pid() bplist.append( (pid, tid, bp) ) # Return the list of breakpoints. return bplist
[ "def", "get_all_breakpoints", "(", "self", ")", ":", "bplist", "=", "list", "(", ")", "# Get the code breakpoints.", "for", "(", "pid", ",", "bp", ")", "in", "self", ".", "get_all_code_breakpoints", "(", ")", ":", "bplist", ".", "append", "(", "(", "pid", ...
Returns all breakpoint objects as a list of tuples. Each tuple contains: - Process global ID to which the breakpoint applies. - Thread global ID to which the breakpoint applies, or C{None}. - The L{Breakpoint} object itself. @note: If you're only interested in a specific breakpoint type, or in breakpoints for a specific process or thread, it's probably faster to call one of the following methods: - L{get_all_code_breakpoints} - L{get_all_page_breakpoints} - L{get_all_hardware_breakpoints} - L{get_process_code_breakpoints} - L{get_process_page_breakpoints} - L{get_process_hardware_breakpoints} - L{get_thread_hardware_breakpoints} @rtype: list of tuple( pid, tid, bp ) @return: List of all breakpoints.
[ "Returns", "all", "breakpoint", "objects", "as", "a", "list", "of", "tuples", "." ]
ed9c4307662a5593b8a7f1f3389ecd0e79b8c503
https://github.com/fabioz/PyDev.Debugger/blob/ed9c4307662a5593b8a7f1f3389ecd0e79b8c503/pydevd_attach_to_process/winappdbg/breakpoint.py#L2951-L2990
train
209,486
fabioz/PyDev.Debugger
pydevd_attach_to_process/winappdbg/breakpoint.py
_BreakpointContainer.get_process_breakpoints
def get_process_breakpoints(self, dwProcessId): """ Returns all breakpoint objects for the given process as a list of tuples. Each tuple contains: - Process global ID to which the breakpoint applies. - Thread global ID to which the breakpoint applies, or C{None}. - The L{Breakpoint} object itself. @note: If you're only interested in a specific breakpoint type, or in breakpoints for a specific process or thread, it's probably faster to call one of the following methods: - L{get_all_code_breakpoints} - L{get_all_page_breakpoints} - L{get_all_hardware_breakpoints} - L{get_process_code_breakpoints} - L{get_process_page_breakpoints} - L{get_process_hardware_breakpoints} - L{get_thread_hardware_breakpoints} @type dwProcessId: int @param dwProcessId: Process global ID. @rtype: list of tuple( pid, tid, bp ) @return: List of all breakpoints for the given process. """ bplist = list() # Get the code breakpoints. for bp in self.get_process_code_breakpoints(dwProcessId): bplist.append( (dwProcessId, None, bp) ) # Get the page breakpoints. for bp in self.get_process_page_breakpoints(dwProcessId): bplist.append( (dwProcessId, None, bp) ) # Get the hardware breakpoints. for (tid, bp) in self.get_process_hardware_breakpoints(dwProcessId): pid = self.system.get_thread(tid).get_pid() bplist.append( (dwProcessId, tid, bp) ) # Return the list of breakpoints. return bplist
python
def get_process_breakpoints(self, dwProcessId): """ Returns all breakpoint objects for the given process as a list of tuples. Each tuple contains: - Process global ID to which the breakpoint applies. - Thread global ID to which the breakpoint applies, or C{None}. - The L{Breakpoint} object itself. @note: If you're only interested in a specific breakpoint type, or in breakpoints for a specific process or thread, it's probably faster to call one of the following methods: - L{get_all_code_breakpoints} - L{get_all_page_breakpoints} - L{get_all_hardware_breakpoints} - L{get_process_code_breakpoints} - L{get_process_page_breakpoints} - L{get_process_hardware_breakpoints} - L{get_thread_hardware_breakpoints} @type dwProcessId: int @param dwProcessId: Process global ID. @rtype: list of tuple( pid, tid, bp ) @return: List of all breakpoints for the given process. """ bplist = list() # Get the code breakpoints. for bp in self.get_process_code_breakpoints(dwProcessId): bplist.append( (dwProcessId, None, bp) ) # Get the page breakpoints. for bp in self.get_process_page_breakpoints(dwProcessId): bplist.append( (dwProcessId, None, bp) ) # Get the hardware breakpoints. for (tid, bp) in self.get_process_hardware_breakpoints(dwProcessId): pid = self.system.get_thread(tid).get_pid() bplist.append( (dwProcessId, tid, bp) ) # Return the list of breakpoints. return bplist
[ "def", "get_process_breakpoints", "(", "self", ",", "dwProcessId", ")", ":", "bplist", "=", "list", "(", ")", "# Get the code breakpoints.", "for", "bp", "in", "self", ".", "get_process_code_breakpoints", "(", "dwProcessId", ")", ":", "bplist", ".", "append", "(...
Returns all breakpoint objects for the given process as a list of tuples. Each tuple contains: - Process global ID to which the breakpoint applies. - Thread global ID to which the breakpoint applies, or C{None}. - The L{Breakpoint} object itself. @note: If you're only interested in a specific breakpoint type, or in breakpoints for a specific process or thread, it's probably faster to call one of the following methods: - L{get_all_code_breakpoints} - L{get_all_page_breakpoints} - L{get_all_hardware_breakpoints} - L{get_process_code_breakpoints} - L{get_process_page_breakpoints} - L{get_process_hardware_breakpoints} - L{get_thread_hardware_breakpoints} @type dwProcessId: int @param dwProcessId: Process global ID. @rtype: list of tuple( pid, tid, bp ) @return: List of all breakpoints for the given process.
[ "Returns", "all", "breakpoint", "objects", "for", "the", "given", "process", "as", "a", "list", "of", "tuples", "." ]
ed9c4307662a5593b8a7f1f3389ecd0e79b8c503
https://github.com/fabioz/PyDev.Debugger/blob/ed9c4307662a5593b8a7f1f3389ecd0e79b8c503/pydevd_attach_to_process/winappdbg/breakpoint.py#L3021-L3063
train
209,487
fabioz/PyDev.Debugger
pydevd_attach_to_process/winappdbg/breakpoint.py
_BreakpointContainer.enable_all_breakpoints
def enable_all_breakpoints(self): """ Enables all disabled breakpoints in all processes. @see: enable_code_breakpoint, enable_page_breakpoint, enable_hardware_breakpoint """ # disable code breakpoints for (pid, bp) in self.get_all_code_breakpoints(): if bp.is_disabled(): self.enable_code_breakpoint(pid, bp.get_address()) # disable page breakpoints for (pid, bp) in self.get_all_page_breakpoints(): if bp.is_disabled(): self.enable_page_breakpoint(pid, bp.get_address()) # disable hardware breakpoints for (tid, bp) in self.get_all_hardware_breakpoints(): if bp.is_disabled(): self.enable_hardware_breakpoint(tid, bp.get_address())
python
def enable_all_breakpoints(self): """ Enables all disabled breakpoints in all processes. @see: enable_code_breakpoint, enable_page_breakpoint, enable_hardware_breakpoint """ # disable code breakpoints for (pid, bp) in self.get_all_code_breakpoints(): if bp.is_disabled(): self.enable_code_breakpoint(pid, bp.get_address()) # disable page breakpoints for (pid, bp) in self.get_all_page_breakpoints(): if bp.is_disabled(): self.enable_page_breakpoint(pid, bp.get_address()) # disable hardware breakpoints for (tid, bp) in self.get_all_hardware_breakpoints(): if bp.is_disabled(): self.enable_hardware_breakpoint(tid, bp.get_address())
[ "def", "enable_all_breakpoints", "(", "self", ")", ":", "# disable code breakpoints", "for", "(", "pid", ",", "bp", ")", "in", "self", ".", "get_all_code_breakpoints", "(", ")", ":", "if", "bp", ".", "is_disabled", "(", ")", ":", "self", ".", "enable_code_br...
Enables all disabled breakpoints in all processes. @see: enable_code_breakpoint, enable_page_breakpoint, enable_hardware_breakpoint
[ "Enables", "all", "disabled", "breakpoints", "in", "all", "processes", "." ]
ed9c4307662a5593b8a7f1f3389ecd0e79b8c503
https://github.com/fabioz/PyDev.Debugger/blob/ed9c4307662a5593b8a7f1f3389ecd0e79b8c503/pydevd_attach_to_process/winappdbg/breakpoint.py#L3153-L3176
train
209,488
fabioz/PyDev.Debugger
pydevd_attach_to_process/winappdbg/breakpoint.py
_BreakpointContainer.enable_one_shot_all_breakpoints
def enable_one_shot_all_breakpoints(self): """ Enables for one shot all disabled breakpoints in all processes. @see: enable_one_shot_code_breakpoint, enable_one_shot_page_breakpoint, enable_one_shot_hardware_breakpoint """ # disable code breakpoints for one shot for (pid, bp) in self.get_all_code_breakpoints(): if bp.is_disabled(): self.enable_one_shot_code_breakpoint(pid, bp.get_address()) # disable page breakpoints for one shot for (pid, bp) in self.get_all_page_breakpoints(): if bp.is_disabled(): self.enable_one_shot_page_breakpoint(pid, bp.get_address()) # disable hardware breakpoints for one shot for (tid, bp) in self.get_all_hardware_breakpoints(): if bp.is_disabled(): self.enable_one_shot_hardware_breakpoint(tid, bp.get_address())
python
def enable_one_shot_all_breakpoints(self): """ Enables for one shot all disabled breakpoints in all processes. @see: enable_one_shot_code_breakpoint, enable_one_shot_page_breakpoint, enable_one_shot_hardware_breakpoint """ # disable code breakpoints for one shot for (pid, bp) in self.get_all_code_breakpoints(): if bp.is_disabled(): self.enable_one_shot_code_breakpoint(pid, bp.get_address()) # disable page breakpoints for one shot for (pid, bp) in self.get_all_page_breakpoints(): if bp.is_disabled(): self.enable_one_shot_page_breakpoint(pid, bp.get_address()) # disable hardware breakpoints for one shot for (tid, bp) in self.get_all_hardware_breakpoints(): if bp.is_disabled(): self.enable_one_shot_hardware_breakpoint(tid, bp.get_address())
[ "def", "enable_one_shot_all_breakpoints", "(", "self", ")", ":", "# disable code breakpoints for one shot", "for", "(", "pid", ",", "bp", ")", "in", "self", ".", "get_all_code_breakpoints", "(", ")", ":", "if", "bp", ".", "is_disabled", "(", ")", ":", "self", ...
Enables for one shot all disabled breakpoints in all processes. @see: enable_one_shot_code_breakpoint, enable_one_shot_page_breakpoint, enable_one_shot_hardware_breakpoint
[ "Enables", "for", "one", "shot", "all", "disabled", "breakpoints", "in", "all", "processes", "." ]
ed9c4307662a5593b8a7f1f3389ecd0e79b8c503
https://github.com/fabioz/PyDev.Debugger/blob/ed9c4307662a5593b8a7f1f3389ecd0e79b8c503/pydevd_attach_to_process/winappdbg/breakpoint.py#L3178-L3201
train
209,489
fabioz/PyDev.Debugger
pydevd_attach_to_process/winappdbg/breakpoint.py
_BreakpointContainer.disable_all_breakpoints
def disable_all_breakpoints(self): """ Disables all breakpoints in all processes. @see: disable_code_breakpoint, disable_page_breakpoint, disable_hardware_breakpoint """ # disable code breakpoints for (pid, bp) in self.get_all_code_breakpoints(): self.disable_code_breakpoint(pid, bp.get_address()) # disable page breakpoints for (pid, bp) in self.get_all_page_breakpoints(): self.disable_page_breakpoint(pid, bp.get_address()) # disable hardware breakpoints for (tid, bp) in self.get_all_hardware_breakpoints(): self.disable_hardware_breakpoint(tid, bp.get_address())
python
def disable_all_breakpoints(self): """ Disables all breakpoints in all processes. @see: disable_code_breakpoint, disable_page_breakpoint, disable_hardware_breakpoint """ # disable code breakpoints for (pid, bp) in self.get_all_code_breakpoints(): self.disable_code_breakpoint(pid, bp.get_address()) # disable page breakpoints for (pid, bp) in self.get_all_page_breakpoints(): self.disable_page_breakpoint(pid, bp.get_address()) # disable hardware breakpoints for (tid, bp) in self.get_all_hardware_breakpoints(): self.disable_hardware_breakpoint(tid, bp.get_address())
[ "def", "disable_all_breakpoints", "(", "self", ")", ":", "# disable code breakpoints", "for", "(", "pid", ",", "bp", ")", "in", "self", ".", "get_all_code_breakpoints", "(", ")", ":", "self", ".", "disable_code_breakpoint", "(", "pid", ",", "bp", ".", "get_add...
Disables all breakpoints in all processes. @see: disable_code_breakpoint, disable_page_breakpoint, disable_hardware_breakpoint
[ "Disables", "all", "breakpoints", "in", "all", "processes", "." ]
ed9c4307662a5593b8a7f1f3389ecd0e79b8c503
https://github.com/fabioz/PyDev.Debugger/blob/ed9c4307662a5593b8a7f1f3389ecd0e79b8c503/pydevd_attach_to_process/winappdbg/breakpoint.py#L3203-L3223
train
209,490
fabioz/PyDev.Debugger
pydevd_attach_to_process/winappdbg/breakpoint.py
_BreakpointContainer.erase_all_breakpoints
def erase_all_breakpoints(self): """ Erases all breakpoints in all processes. @see: erase_code_breakpoint, erase_page_breakpoint, erase_hardware_breakpoint """ # This should be faster but let's not trust the GC so much :P # self.disable_all_breakpoints() # self.__codeBP = dict() # self.__pageBP = dict() # self.__hardwareBP = dict() # self.__runningBP = dict() # self.__hook_objects = dict() ## # erase hooks ## for (pid, address, hook) in self.get_all_hooks(): ## self.dont_hook_function(pid, address) # erase code breakpoints for (pid, bp) in self.get_all_code_breakpoints(): self.erase_code_breakpoint(pid, bp.get_address()) # erase page breakpoints for (pid, bp) in self.get_all_page_breakpoints(): self.erase_page_breakpoint(pid, bp.get_address()) # erase hardware breakpoints for (tid, bp) in self.get_all_hardware_breakpoints(): self.erase_hardware_breakpoint(tid, bp.get_address())
python
def erase_all_breakpoints(self): """ Erases all breakpoints in all processes. @see: erase_code_breakpoint, erase_page_breakpoint, erase_hardware_breakpoint """ # This should be faster but let's not trust the GC so much :P # self.disable_all_breakpoints() # self.__codeBP = dict() # self.__pageBP = dict() # self.__hardwareBP = dict() # self.__runningBP = dict() # self.__hook_objects = dict() ## # erase hooks ## for (pid, address, hook) in self.get_all_hooks(): ## self.dont_hook_function(pid, address) # erase code breakpoints for (pid, bp) in self.get_all_code_breakpoints(): self.erase_code_breakpoint(pid, bp.get_address()) # erase page breakpoints for (pid, bp) in self.get_all_page_breakpoints(): self.erase_page_breakpoint(pid, bp.get_address()) # erase hardware breakpoints for (tid, bp) in self.get_all_hardware_breakpoints(): self.erase_hardware_breakpoint(tid, bp.get_address())
[ "def", "erase_all_breakpoints", "(", "self", ")", ":", "# This should be faster but let's not trust the GC so much :P", "# self.disable_all_breakpoints()", "# self.__codeBP = dict()", "# self.__pageBP = dict()", "# self.__hardwareBP = dict()", "# self.__runningBP = dict()", ...
Erases all breakpoints in all processes. @see: erase_code_breakpoint, erase_page_breakpoint, erase_hardware_breakpoint
[ "Erases", "all", "breakpoints", "in", "all", "processes", "." ]
ed9c4307662a5593b8a7f1f3389ecd0e79b8c503
https://github.com/fabioz/PyDev.Debugger/blob/ed9c4307662a5593b8a7f1f3389ecd0e79b8c503/pydevd_attach_to_process/winappdbg/breakpoint.py#L3225-L3257
train
209,491
fabioz/PyDev.Debugger
pydevd_attach_to_process/winappdbg/breakpoint.py
_BreakpointContainer.enable_process_breakpoints
def enable_process_breakpoints(self, dwProcessId): """ Enables all disabled breakpoints for the given process. @type dwProcessId: int @param dwProcessId: Process global ID. """ # enable code breakpoints for bp in self.get_process_code_breakpoints(dwProcessId): if bp.is_disabled(): self.enable_code_breakpoint(dwProcessId, bp.get_address()) # enable page breakpoints for bp in self.get_process_page_breakpoints(dwProcessId): if bp.is_disabled(): self.enable_page_breakpoint(dwProcessId, bp.get_address()) # enable hardware breakpoints if self.system.has_process(dwProcessId): aProcess = self.system.get_process(dwProcessId) else: aProcess = Process(dwProcessId) aProcess.scan_threads() for aThread in aProcess.iter_threads(): dwThreadId = aThread.get_tid() for bp in self.get_thread_hardware_breakpoints(dwThreadId): if bp.is_disabled(): self.enable_hardware_breakpoint(dwThreadId, bp.get_address())
python
def enable_process_breakpoints(self, dwProcessId): """ Enables all disabled breakpoints for the given process. @type dwProcessId: int @param dwProcessId: Process global ID. """ # enable code breakpoints for bp in self.get_process_code_breakpoints(dwProcessId): if bp.is_disabled(): self.enable_code_breakpoint(dwProcessId, bp.get_address()) # enable page breakpoints for bp in self.get_process_page_breakpoints(dwProcessId): if bp.is_disabled(): self.enable_page_breakpoint(dwProcessId, bp.get_address()) # enable hardware breakpoints if self.system.has_process(dwProcessId): aProcess = self.system.get_process(dwProcessId) else: aProcess = Process(dwProcessId) aProcess.scan_threads() for aThread in aProcess.iter_threads(): dwThreadId = aThread.get_tid() for bp in self.get_thread_hardware_breakpoints(dwThreadId): if bp.is_disabled(): self.enable_hardware_breakpoint(dwThreadId, bp.get_address())
[ "def", "enable_process_breakpoints", "(", "self", ",", "dwProcessId", ")", ":", "# enable code breakpoints", "for", "bp", "in", "self", ".", "get_process_code_breakpoints", "(", "dwProcessId", ")", ":", "if", "bp", ".", "is_disabled", "(", ")", ":", "self", ".",...
Enables all disabled breakpoints for the given process. @type dwProcessId: int @param dwProcessId: Process global ID.
[ "Enables", "all", "disabled", "breakpoints", "for", "the", "given", "process", "." ]
ed9c4307662a5593b8a7f1f3389ecd0e79b8c503
https://github.com/fabioz/PyDev.Debugger/blob/ed9c4307662a5593b8a7f1f3389ecd0e79b8c503/pydevd_attach_to_process/winappdbg/breakpoint.py#L3263-L3291
train
209,492
fabioz/PyDev.Debugger
pydevd_attach_to_process/winappdbg/breakpoint.py
_BreakpointContainer.enable_one_shot_process_breakpoints
def enable_one_shot_process_breakpoints(self, dwProcessId): """ Enables for one shot all disabled breakpoints for the given process. @type dwProcessId: int @param dwProcessId: Process global ID. """ # enable code breakpoints for one shot for bp in self.get_process_code_breakpoints(dwProcessId): if bp.is_disabled(): self.enable_one_shot_code_breakpoint(dwProcessId, bp.get_address()) # enable page breakpoints for one shot for bp in self.get_process_page_breakpoints(dwProcessId): if bp.is_disabled(): self.enable_one_shot_page_breakpoint(dwProcessId, bp.get_address()) # enable hardware breakpoints for one shot if self.system.has_process(dwProcessId): aProcess = self.system.get_process(dwProcessId) else: aProcess = Process(dwProcessId) aProcess.scan_threads() for aThread in aProcess.iter_threads(): dwThreadId = aThread.get_tid() for bp in self.get_thread_hardware_breakpoints(dwThreadId): if bp.is_disabled(): self.enable_one_shot_hardware_breakpoint(dwThreadId, bp.get_address())
python
def enable_one_shot_process_breakpoints(self, dwProcessId): """ Enables for one shot all disabled breakpoints for the given process. @type dwProcessId: int @param dwProcessId: Process global ID. """ # enable code breakpoints for one shot for bp in self.get_process_code_breakpoints(dwProcessId): if bp.is_disabled(): self.enable_one_shot_code_breakpoint(dwProcessId, bp.get_address()) # enable page breakpoints for one shot for bp in self.get_process_page_breakpoints(dwProcessId): if bp.is_disabled(): self.enable_one_shot_page_breakpoint(dwProcessId, bp.get_address()) # enable hardware breakpoints for one shot if self.system.has_process(dwProcessId): aProcess = self.system.get_process(dwProcessId) else: aProcess = Process(dwProcessId) aProcess.scan_threads() for aThread in aProcess.iter_threads(): dwThreadId = aThread.get_tid() for bp in self.get_thread_hardware_breakpoints(dwThreadId): if bp.is_disabled(): self.enable_one_shot_hardware_breakpoint(dwThreadId, bp.get_address())
[ "def", "enable_one_shot_process_breakpoints", "(", "self", ",", "dwProcessId", ")", ":", "# enable code breakpoints for one shot", "for", "bp", "in", "self", ".", "get_process_code_breakpoints", "(", "dwProcessId", ")", ":", "if", "bp", ".", "is_disabled", "(", ")", ...
Enables for one shot all disabled breakpoints for the given process. @type dwProcessId: int @param dwProcessId: Process global ID.
[ "Enables", "for", "one", "shot", "all", "disabled", "breakpoints", "for", "the", "given", "process", "." ]
ed9c4307662a5593b8a7f1f3389ecd0e79b8c503
https://github.com/fabioz/PyDev.Debugger/blob/ed9c4307662a5593b8a7f1f3389ecd0e79b8c503/pydevd_attach_to_process/winappdbg/breakpoint.py#L3293-L3321
train
209,493
fabioz/PyDev.Debugger
pydevd_attach_to_process/winappdbg/breakpoint.py
_BreakpointContainer.disable_process_breakpoints
def disable_process_breakpoints(self, dwProcessId): """ Disables all breakpoints for the given process. @type dwProcessId: int @param dwProcessId: Process global ID. """ # disable code breakpoints for bp in self.get_process_code_breakpoints(dwProcessId): self.disable_code_breakpoint(dwProcessId, bp.get_address()) # disable page breakpoints for bp in self.get_process_page_breakpoints(dwProcessId): self.disable_page_breakpoint(dwProcessId, bp.get_address()) # disable hardware breakpoints if self.system.has_process(dwProcessId): aProcess = self.system.get_process(dwProcessId) else: aProcess = Process(dwProcessId) aProcess.scan_threads() for aThread in aProcess.iter_threads(): dwThreadId = aThread.get_tid() for bp in self.get_thread_hardware_breakpoints(dwThreadId): self.disable_hardware_breakpoint(dwThreadId, bp.get_address())
python
def disable_process_breakpoints(self, dwProcessId): """ Disables all breakpoints for the given process. @type dwProcessId: int @param dwProcessId: Process global ID. """ # disable code breakpoints for bp in self.get_process_code_breakpoints(dwProcessId): self.disable_code_breakpoint(dwProcessId, bp.get_address()) # disable page breakpoints for bp in self.get_process_page_breakpoints(dwProcessId): self.disable_page_breakpoint(dwProcessId, bp.get_address()) # disable hardware breakpoints if self.system.has_process(dwProcessId): aProcess = self.system.get_process(dwProcessId) else: aProcess = Process(dwProcessId) aProcess.scan_threads() for aThread in aProcess.iter_threads(): dwThreadId = aThread.get_tid() for bp in self.get_thread_hardware_breakpoints(dwThreadId): self.disable_hardware_breakpoint(dwThreadId, bp.get_address())
[ "def", "disable_process_breakpoints", "(", "self", ",", "dwProcessId", ")", ":", "# disable code breakpoints", "for", "bp", "in", "self", ".", "get_process_code_breakpoints", "(", "dwProcessId", ")", ":", "self", ".", "disable_code_breakpoint", "(", "dwProcessId", ","...
Disables all breakpoints for the given process. @type dwProcessId: int @param dwProcessId: Process global ID.
[ "Disables", "all", "breakpoints", "for", "the", "given", "process", "." ]
ed9c4307662a5593b8a7f1f3389ecd0e79b8c503
https://github.com/fabioz/PyDev.Debugger/blob/ed9c4307662a5593b8a7f1f3389ecd0e79b8c503/pydevd_attach_to_process/winappdbg/breakpoint.py#L3323-L3348
train
209,494
fabioz/PyDev.Debugger
pydevd_attach_to_process/winappdbg/breakpoint.py
_BreakpointContainer.erase_process_breakpoints
def erase_process_breakpoints(self, dwProcessId): """ Erases all breakpoints for the given process. @type dwProcessId: int @param dwProcessId: Process global ID. """ # disable breakpoints first # if an error occurs, no breakpoint is erased self.disable_process_breakpoints(dwProcessId) ## # erase hooks ## for address, hook in self.get_process_hooks(dwProcessId): ## self.dont_hook_function(dwProcessId, address) # erase code breakpoints for bp in self.get_process_code_breakpoints(dwProcessId): self.erase_code_breakpoint(dwProcessId, bp.get_address()) # erase page breakpoints for bp in self.get_process_page_breakpoints(dwProcessId): self.erase_page_breakpoint(dwProcessId, bp.get_address()) # erase hardware breakpoints if self.system.has_process(dwProcessId): aProcess = self.system.get_process(dwProcessId) else: aProcess = Process(dwProcessId) aProcess.scan_threads() for aThread in aProcess.iter_threads(): dwThreadId = aThread.get_tid() for bp in self.get_thread_hardware_breakpoints(dwThreadId): self.erase_hardware_breakpoint(dwThreadId, bp.get_address())
python
def erase_process_breakpoints(self, dwProcessId): """ Erases all breakpoints for the given process. @type dwProcessId: int @param dwProcessId: Process global ID. """ # disable breakpoints first # if an error occurs, no breakpoint is erased self.disable_process_breakpoints(dwProcessId) ## # erase hooks ## for address, hook in self.get_process_hooks(dwProcessId): ## self.dont_hook_function(dwProcessId, address) # erase code breakpoints for bp in self.get_process_code_breakpoints(dwProcessId): self.erase_code_breakpoint(dwProcessId, bp.get_address()) # erase page breakpoints for bp in self.get_process_page_breakpoints(dwProcessId): self.erase_page_breakpoint(dwProcessId, bp.get_address()) # erase hardware breakpoints if self.system.has_process(dwProcessId): aProcess = self.system.get_process(dwProcessId) else: aProcess = Process(dwProcessId) aProcess.scan_threads() for aThread in aProcess.iter_threads(): dwThreadId = aThread.get_tid() for bp in self.get_thread_hardware_breakpoints(dwThreadId): self.erase_hardware_breakpoint(dwThreadId, bp.get_address())
[ "def", "erase_process_breakpoints", "(", "self", ",", "dwProcessId", ")", ":", "# disable breakpoints first", "# if an error occurs, no breakpoint is erased", "self", ".", "disable_process_breakpoints", "(", "dwProcessId", ")", "## # erase hooks", "## for address, hoo...
Erases all breakpoints for the given process. @type dwProcessId: int @param dwProcessId: Process global ID.
[ "Erases", "all", "breakpoints", "for", "the", "given", "process", "." ]
ed9c4307662a5593b8a7f1f3389ecd0e79b8c503
https://github.com/fabioz/PyDev.Debugger/blob/ed9c4307662a5593b8a7f1f3389ecd0e79b8c503/pydevd_attach_to_process/winappdbg/breakpoint.py#L3350-L3383
train
209,495
fabioz/PyDev.Debugger
pydevd_attach_to_process/winappdbg/breakpoint.py
_BreakpointContainer._notify_guard_page
def _notify_guard_page(self, event): """ Notify breakpoints of a guard page exception event. @type event: L{ExceptionEvent} @param event: Guard page exception event. @rtype: bool @return: C{True} to call the user-defined handle, C{False} otherwise. """ address = event.get_fault_address() pid = event.get_pid() bCallHandler = True # Align address to page boundary. mask = ~(MemoryAddresses.pageSize - 1) address = address & mask # Do we have an active page breakpoint there? key = (pid, address) if key in self.__pageBP: bp = self.__pageBP[key] if bp.is_enabled() or bp.is_one_shot(): # Breakpoint is ours. event.continueStatus = win32.DBG_CONTINUE ## event.continueStatus = win32.DBG_EXCEPTION_HANDLED # Hit the breakpoint. bp.hit(event) # Remember breakpoints in RUNNING state. if bp.is_running(): tid = event.get_tid() self.__add_running_bp(tid, bp) # Evaluate the breakpoint condition. bCondition = bp.eval_condition(event) # If the breakpoint is automatic, run the action. # If not, notify the user. if bCondition and bp.is_automatic(): bp.run_action(event) bCallHandler = False else: bCallHandler = bCondition # If we don't have a breakpoint here pass the exception to the debugee. # This is a normally occurring exception so we shouldn't swallow it. else: event.continueStatus = win32.DBG_EXCEPTION_NOT_HANDLED return bCallHandler
python
def _notify_guard_page(self, event): """ Notify breakpoints of a guard page exception event. @type event: L{ExceptionEvent} @param event: Guard page exception event. @rtype: bool @return: C{True} to call the user-defined handle, C{False} otherwise. """ address = event.get_fault_address() pid = event.get_pid() bCallHandler = True # Align address to page boundary. mask = ~(MemoryAddresses.pageSize - 1) address = address & mask # Do we have an active page breakpoint there? key = (pid, address) if key in self.__pageBP: bp = self.__pageBP[key] if bp.is_enabled() or bp.is_one_shot(): # Breakpoint is ours. event.continueStatus = win32.DBG_CONTINUE ## event.continueStatus = win32.DBG_EXCEPTION_HANDLED # Hit the breakpoint. bp.hit(event) # Remember breakpoints in RUNNING state. if bp.is_running(): tid = event.get_tid() self.__add_running_bp(tid, bp) # Evaluate the breakpoint condition. bCondition = bp.eval_condition(event) # If the breakpoint is automatic, run the action. # If not, notify the user. if bCondition and bp.is_automatic(): bp.run_action(event) bCallHandler = False else: bCallHandler = bCondition # If we don't have a breakpoint here pass the exception to the debugee. # This is a normally occurring exception so we shouldn't swallow it. else: event.continueStatus = win32.DBG_EXCEPTION_NOT_HANDLED return bCallHandler
[ "def", "_notify_guard_page", "(", "self", ",", "event", ")", ":", "address", "=", "event", ".", "get_fault_address", "(", ")", "pid", "=", "event", ".", "get_pid", "(", ")", "bCallHandler", "=", "True", "# Align address to page boundary.", "mask", "=", "~", ...
Notify breakpoints of a guard page exception event. @type event: L{ExceptionEvent} @param event: Guard page exception event. @rtype: bool @return: C{True} to call the user-defined handle, C{False} otherwise.
[ "Notify", "breakpoints", "of", "a", "guard", "page", "exception", "event", "." ]
ed9c4307662a5593b8a7f1f3389ecd0e79b8c503
https://github.com/fabioz/PyDev.Debugger/blob/ed9c4307662a5593b8a7f1f3389ecd0e79b8c503/pydevd_attach_to_process/winappdbg/breakpoint.py#L3389-L3441
train
209,496
fabioz/PyDev.Debugger
pydevd_attach_to_process/winappdbg/breakpoint.py
_BreakpointContainer._notify_breakpoint
def _notify_breakpoint(self, event): """ Notify breakpoints of a breakpoint exception event. @type event: L{ExceptionEvent} @param event: Breakpoint exception event. @rtype: bool @return: C{True} to call the user-defined handle, C{False} otherwise. """ address = event.get_exception_address() pid = event.get_pid() bCallHandler = True # Do we have an active code breakpoint there? key = (pid, address) if key in self.__codeBP: bp = self.__codeBP[key] if not bp.is_disabled(): # Change the program counter (PC) to the exception address. # This accounts for the change in PC caused by # executing the breakpoint instruction, no matter # the size of it. aThread = event.get_thread() aThread.set_pc(address) # Swallow the exception. event.continueStatus = win32.DBG_CONTINUE # Hit the breakpoint. bp.hit(event) # Remember breakpoints in RUNNING state. if bp.is_running(): tid = event.get_tid() self.__add_running_bp(tid, bp) # Evaluate the breakpoint condition. bCondition = bp.eval_condition(event) # If the breakpoint is automatic, run the action. # If not, notify the user. if bCondition and bp.is_automatic(): bCallHandler = bp.run_action(event) else: bCallHandler = bCondition # Handle the system breakpoint. # TODO: examine the stack trace to figure out if it's really a # system breakpoint or an antidebug trick. The caller should be # inside ntdll if it's legit. elif event.get_process().is_system_defined_breakpoint(address): event.continueStatus = win32.DBG_CONTINUE # In hostile mode, if we don't have a breakpoint here pass the # exception to the debugee. In normal mode assume all breakpoint # exceptions are to be handled by the debugger. else: if self.in_hostile_mode(): event.continueStatus = win32.DBG_EXCEPTION_NOT_HANDLED else: event.continueStatus = win32.DBG_CONTINUE return bCallHandler
python
def _notify_breakpoint(self, event): """ Notify breakpoints of a breakpoint exception event. @type event: L{ExceptionEvent} @param event: Breakpoint exception event. @rtype: bool @return: C{True} to call the user-defined handle, C{False} otherwise. """ address = event.get_exception_address() pid = event.get_pid() bCallHandler = True # Do we have an active code breakpoint there? key = (pid, address) if key in self.__codeBP: bp = self.__codeBP[key] if not bp.is_disabled(): # Change the program counter (PC) to the exception address. # This accounts for the change in PC caused by # executing the breakpoint instruction, no matter # the size of it. aThread = event.get_thread() aThread.set_pc(address) # Swallow the exception. event.continueStatus = win32.DBG_CONTINUE # Hit the breakpoint. bp.hit(event) # Remember breakpoints in RUNNING state. if bp.is_running(): tid = event.get_tid() self.__add_running_bp(tid, bp) # Evaluate the breakpoint condition. bCondition = bp.eval_condition(event) # If the breakpoint is automatic, run the action. # If not, notify the user. if bCondition and bp.is_automatic(): bCallHandler = bp.run_action(event) else: bCallHandler = bCondition # Handle the system breakpoint. # TODO: examine the stack trace to figure out if it's really a # system breakpoint or an antidebug trick. The caller should be # inside ntdll if it's legit. elif event.get_process().is_system_defined_breakpoint(address): event.continueStatus = win32.DBG_CONTINUE # In hostile mode, if we don't have a breakpoint here pass the # exception to the debugee. In normal mode assume all breakpoint # exceptions are to be handled by the debugger. else: if self.in_hostile_mode(): event.continueStatus = win32.DBG_EXCEPTION_NOT_HANDLED else: event.continueStatus = win32.DBG_CONTINUE return bCallHandler
[ "def", "_notify_breakpoint", "(", "self", ",", "event", ")", ":", "address", "=", "event", ".", "get_exception_address", "(", ")", "pid", "=", "event", ".", "get_pid", "(", ")", "bCallHandler", "=", "True", "# Do we have an active code breakpoint there?", "key", ...
Notify breakpoints of a breakpoint exception event. @type event: L{ExceptionEvent} @param event: Breakpoint exception event. @rtype: bool @return: C{True} to call the user-defined handle, C{False} otherwise.
[ "Notify", "breakpoints", "of", "a", "breakpoint", "exception", "event", "." ]
ed9c4307662a5593b8a7f1f3389ecd0e79b8c503
https://github.com/fabioz/PyDev.Debugger/blob/ed9c4307662a5593b8a7f1f3389ecd0e79b8c503/pydevd_attach_to_process/winappdbg/breakpoint.py#L3443-L3507
train
209,497
fabioz/PyDev.Debugger
pydevd_attach_to_process/winappdbg/breakpoint.py
_BreakpointContainer.__set_deferred_breakpoints
def __set_deferred_breakpoints(self, event): """ Used internally. Sets all deferred breakpoints for a DLL when it's loaded. @type event: L{LoadDLLEvent} @param event: Load DLL event. """ pid = event.get_pid() try: deferred = self.__deferredBP[pid] except KeyError: return aProcess = event.get_process() for (label, (action, oneshot)) in deferred.items(): try: address = aProcess.resolve_label(label) except Exception: continue del deferred[label] try: self.__set_break(pid, address, action, oneshot) except Exception: msg = "Can't set deferred breakpoint %s at process ID %d" msg = msg % (label, pid) warnings.warn(msg, BreakpointWarning)
python
def __set_deferred_breakpoints(self, event): """ Used internally. Sets all deferred breakpoints for a DLL when it's loaded. @type event: L{LoadDLLEvent} @param event: Load DLL event. """ pid = event.get_pid() try: deferred = self.__deferredBP[pid] except KeyError: return aProcess = event.get_process() for (label, (action, oneshot)) in deferred.items(): try: address = aProcess.resolve_label(label) except Exception: continue del deferred[label] try: self.__set_break(pid, address, action, oneshot) except Exception: msg = "Can't set deferred breakpoint %s at process ID %d" msg = msg % (label, pid) warnings.warn(msg, BreakpointWarning)
[ "def", "__set_deferred_breakpoints", "(", "self", ",", "event", ")", ":", "pid", "=", "event", ".", "get_pid", "(", ")", "try", ":", "deferred", "=", "self", ".", "__deferredBP", "[", "pid", "]", "except", "KeyError", ":", "return", "aProcess", "=", "eve...
Used internally. Sets all deferred breakpoints for a DLL when it's loaded. @type event: L{LoadDLLEvent} @param event: Load DLL event.
[ "Used", "internally", ".", "Sets", "all", "deferred", "breakpoints", "for", "a", "DLL", "when", "it", "s", "loaded", "." ]
ed9c4307662a5593b8a7f1f3389ecd0e79b8c503
https://github.com/fabioz/PyDev.Debugger/blob/ed9c4307662a5593b8a7f1f3389ecd0e79b8c503/pydevd_attach_to_process/winappdbg/breakpoint.py#L3817-L3842
train
209,498
fabioz/PyDev.Debugger
pydevd_attach_to_process/winappdbg/breakpoint.py
_BreakpointContainer.stalk_at
def stalk_at(self, pid, address, action = None): """ Sets a one shot code breakpoint at the given process and address. If instead of an address you pass a label, the breakpoint may be deferred until the DLL it points to is loaded. @see: L{break_at}, L{dont_stalk_at} @type pid: int @param pid: Process global ID. @type 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 = True) return bp is not None
python
def stalk_at(self, pid, address, action = None): """ Sets a one shot code breakpoint at the given process and address. If instead of an address you pass a label, the breakpoint may be deferred until the DLL it points to is loaded. @see: L{break_at}, L{dont_stalk_at} @type pid: int @param pid: Process global ID. @type 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 = True) return bp is not None
[ "def", "stalk_at", "(", "self", ",", "pid", ",", "address", ",", "action", "=", "None", ")", ":", "bp", "=", "self", ".", "__set_break", "(", "pid", ",", "address", ",", "action", ",", "oneshot", "=", "True", ")", "return", "bp", "is", "not", "None...
Sets a one shot code breakpoint at the given process and address. If instead of an address you pass a label, the breakpoint may be deferred until the DLL it points to is loaded. @see: L{break_at}, L{dont_stalk_at} @type pid: int @param pid: Process global ID. @type 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", "one", "shot", "code", "breakpoint", "at", "the", "given", "process", "and", "address", "." ]
ed9c4307662a5593b8a7f1f3389ecd0e79b8c503
https://github.com/fabioz/PyDev.Debugger/blob/ed9c4307662a5593b8a7f1f3389ecd0e79b8c503/pydevd_attach_to_process/winappdbg/breakpoint.py#L3878-L3906
train
209,499