id
int64
1
6.07M
name
stringlengths
1
295
code
stringlengths
12
426k
language
stringclasses
1 value
source_file
stringlengths
5
202
start_line
int64
1
158k
end_line
int64
1
158k
repo
dict
8,101
get_attr_dict
def get_attr_dict(self): ''' Get the PyDictObject ptr representing the attribute dictionary (or None if there's a problem) ''' try: typeobj = self.type() dictoffset = int_from_int(typeobj.field('tp_dictoffset')) if dictoffset != 0: ...
python
Tools/gdb/libpython.py
459
492
{ "name": "PublicHealthInformationTechnology/cpython", "url": "https://github.com/PublicHealthInformationTechnology/cpython.git", "license": "NOASSERTION", "stars": 0, "forks": 0 }
8,102
get_keys_values
def get_keys_values(self): typeobj = self.type() has_values = int_from_int(typeobj.field('tp_flags')) & Py_TPFLAGS_MANAGED_DICT if not has_values: return None obj_ptr = self._gdbval.cast(_type_char_ptr()) dict_ptr_ptr = obj_ptr + _managed_dict_offset() dict_p...
python
Tools/gdb/libpython.py
494
507
{ "name": "PublicHealthInformationTechnology/cpython", "url": "https://github.com/PublicHealthInformationTechnology/cpython.git", "license": "NOASSERTION", "stars": 0, "forks": 0 }
8,103
get_cached_keys
def get_cached_keys(self): typeobj = self.type() HeapTypePtr = gdb.lookup_type("PyHeapTypeObject").pointer() return typeobj._gdbval.cast(HeapTypePtr)['ht_cached_keys']
python
Tools/gdb/libpython.py
509
512
{ "name": "PublicHealthInformationTechnology/cpython", "url": "https://github.com/PublicHealthInformationTechnology/cpython.git", "license": "NOASSERTION", "stars": 0, "forks": 0 }
8,104
proxyval
def proxyval(self, visited): ''' Support for classes. Currently we just locate the dictionary using a transliteration to python of _PyObject_GetDictPtr, ignoring descriptors ''' # Guard against infinite loops: if self.as_address() in visited: return P...
python
Tools/gdb/libpython.py
514
538
{ "name": "PublicHealthInformationTechnology/cpython", "url": "https://github.com/PublicHealthInformationTechnology/cpython.git", "license": "NOASSERTION", "stars": 0, "forks": 0 }
8,105
write_repr
def write_repr(self, out, visited): # Guard against infinite loops: if self.as_address() in visited: out.write('<...>') return visited.add(self.as_address()) pyop_attrs = self.get_keys_values() if not pyop_attrs: pyop_attrs = self.get_attr_dic...
python
Tools/gdb/libpython.py
540
551
{ "name": "PublicHealthInformationTechnology/cpython", "url": "https://github.com/PublicHealthInformationTechnology/cpython.git", "license": "NOASSERTION", "stars": 0, "forks": 0 }
8,106
__init__
def __init__(self, tp_name, args): self.tp_name = tp_name self.args = args
python
Tools/gdb/libpython.py
554
556
{ "name": "PublicHealthInformationTechnology/cpython", "url": "https://github.com/PublicHealthInformationTechnology/cpython.git", "license": "NOASSERTION", "stars": 0, "forks": 0 }
8,107
__repr__
def __repr__(self): return '%s%r' % (self.tp_name, self.args)
python
Tools/gdb/libpython.py
558
559
{ "name": "PublicHealthInformationTechnology/cpython", "url": "https://github.com/PublicHealthInformationTechnology/cpython.git", "license": "NOASSERTION", "stars": 0, "forks": 0 }
8,108
proxyval
def proxyval(self, visited): # Guard against infinite loops: if self.as_address() in visited: return ProxyAlreadyVisited('(...)') visited.add(self.as_address()) arg_proxy = self.pyop_field('args').proxyval(visited) return ProxyException(self.safe_tp_name(), ...
python
Tools/gdb/libpython.py
568
575
{ "name": "PublicHealthInformationTechnology/cpython", "url": "https://github.com/PublicHealthInformationTechnology/cpython.git", "license": "NOASSERTION", "stars": 0, "forks": 0 }
8,109
write_repr
def write_repr(self, out, visited): # Guard against infinite loops: if self.as_address() in visited: out.write('(...)') return visited.add(self.as_address()) out.write(self.safe_tp_name()) self.write_field_repr('args', out, visited)
python
Tools/gdb/libpython.py
577
585
{ "name": "PublicHealthInformationTechnology/cpython", "url": "https://github.com/PublicHealthInformationTechnology/cpython.git", "license": "NOASSERTION", "stars": 0, "forks": 0 }
8,110
__init__
def __init__(self, ml_name): self.ml_name = ml_name
python
Tools/gdb/libpython.py
596
597
{ "name": "PublicHealthInformationTechnology/cpython", "url": "https://github.com/PublicHealthInformationTechnology/cpython.git", "license": "NOASSERTION", "stars": 0, "forks": 0 }
8,111
__repr__
def __repr__(self): return "<built-in function %s>" % self.ml_name
python
Tools/gdb/libpython.py
599
600
{ "name": "PublicHealthInformationTechnology/cpython", "url": "https://github.com/PublicHealthInformationTechnology/cpython.git", "license": "NOASSERTION", "stars": 0, "forks": 0 }
8,112
__init__
def __init__(self, ml_name, pyop_m_self): self.ml_name = ml_name self.pyop_m_self = pyop_m_self
python
Tools/gdb/libpython.py
603
605
{ "name": "PublicHealthInformationTechnology/cpython", "url": "https://github.com/PublicHealthInformationTechnology/cpython.git", "license": "NOASSERTION", "stars": 0, "forks": 0 }
8,113
__repr__
def __repr__(self): return ('<built-in method %s of %s object at remote 0x%x>' % (self.ml_name, self.pyop_m_self.safe_tp_name(), self.pyop_m_self.as_address()) )
python
Tools/gdb/libpython.py
607
612
{ "name": "PublicHealthInformationTechnology/cpython", "url": "https://github.com/PublicHealthInformationTechnology/cpython.git", "license": "NOASSERTION", "stars": 0, "forks": 0 }
8,114
proxyval
def proxyval(self, visited): m_ml = self.field('m_ml') # m_ml is a (PyMethodDef*) try: ml_name = m_ml['ml_name'].string() except UnicodeDecodeError: ml_name = '<ml_name:UnicodeDecodeError>' pyop_m_self = self.pyop_field('m_self') if pyop_m_self.is_null():...
python
Tools/gdb/libpython.py
621
632
{ "name": "PublicHealthInformationTechnology/cpython", "url": "https://github.com/PublicHealthInformationTechnology/cpython.git", "license": "NOASSERTION", "stars": 0, "forks": 0 }
8,115
read
def read(it): return ord(next(it))
python
Tools/gdb/libpython.py
635
636
{ "name": "PublicHealthInformationTechnology/cpython", "url": "https://github.com/PublicHealthInformationTechnology/cpython.git", "license": "NOASSERTION", "stars": 0, "forks": 0 }
8,116
read_varint
def read_varint(it): b = read(it) val = b & 63; shift = 0; while b & 64: b = read(it) shift += 6 val |= (b&63) << shift return val
python
Tools/gdb/libpython.py
638
646
{ "name": "PublicHealthInformationTechnology/cpython", "url": "https://github.com/PublicHealthInformationTechnology/cpython.git", "license": "NOASSERTION", "stars": 0, "forks": 0 }
8,117
read_signed_varint
def read_signed_varint(it): uval = read_varint(it) if uval & 1: return -(uval >> 1) else: return uval >> 1
python
Tools/gdb/libpython.py
648
653
{ "name": "PublicHealthInformationTechnology/cpython", "url": "https://github.com/PublicHealthInformationTechnology/cpython.git", "license": "NOASSERTION", "stars": 0, "forks": 0 }
8,118
parse_location_table
def parse_location_table(firstlineno, linetable): line = firstlineno addr = 0 it = iter(linetable) while True: try: first_byte = read(it) except StopIteration: return code = (first_byte >> 3) & 15 length = (first_byte & 7) + 1 end_addr = ad...
python
Tools/gdb/libpython.py
655
690
{ "name": "PublicHealthInformationTechnology/cpython", "url": "https://github.com/PublicHealthInformationTechnology/cpython.git", "license": "NOASSERTION", "stars": 0, "forks": 0 }
8,119
addr2line
def addr2line(self, addrq): ''' Get the line number for a given bytecode offset Analogous to PyCode_Addr2Line; translated from pseudocode in Objects/lnotab_notes.txt ''' co_linetable = self.pyop_field('co_linetable').proxyval(set()) # Initialize lineno to co_fir...
python
Tools/gdb/libpython.py
699
718
{ "name": "PublicHealthInformationTechnology/cpython", "url": "https://github.com/PublicHealthInformationTechnology/cpython.git", "license": "NOASSERTION", "stars": 0, "forks": 0 }
8,120
items_from_keys_and_values
def items_from_keys_and_values(keys, values): entries, nentries = PyDictObjectPtr._get_entries(keys) for i in safe_range(nentries): ep = entries[i] pyop_value = PyObjectPtr.from_pyobject_ptr(values[i]) if not pyop_value.is_null(): pyop_key = PyObjectPtr.from_pyobject_ptr(ep['...
python
Tools/gdb/libpython.py
721
728
{ "name": "PublicHealthInformationTechnology/cpython", "url": "https://github.com/PublicHealthInformationTechnology/cpython.git", "license": "NOASSERTION", "stars": 0, "forks": 0 }
8,121
__init__
def __init__(self, keys, values): self.keys = keys self.values = values
python
Tools/gdb/libpython.py
732
734
{ "name": "PublicHealthInformationTechnology/cpython", "url": "https://github.com/PublicHealthInformationTechnology/cpython.git", "license": "NOASSERTION", "stars": 0, "forks": 0 }
8,122
iteritems
def iteritems(self): return items_from_keys_and_values(self.keys, self.values)
python
Tools/gdb/libpython.py
736
737
{ "name": "PublicHealthInformationTechnology/cpython", "url": "https://github.com/PublicHealthInformationTechnology/cpython.git", "license": "NOASSERTION", "stars": 0, "forks": 0 }
8,123
proxyval
def proxyval(self, visited): result = {} for pyop_key, pyop_value in self.iteritems(): proxy_key = pyop_key.proxyval(visited) proxy_value = pyop_value.proxyval(visited) result[proxy_key] = proxy_value return result
python
Tools/gdb/libpython.py
739
745
{ "name": "PublicHealthInformationTechnology/cpython", "url": "https://github.com/PublicHealthInformationTechnology/cpython.git", "license": "NOASSERTION", "stars": 0, "forks": 0 }
8,124
iteritems
def iteritems(self): ''' Yields a sequence of (PyObjectPtr key, PyObjectPtr value) pairs, analogous to dict.iteritems() ''' keys = self.field('ma_keys') values = self.field('ma_values') has_values = int(values) if has_values: values = values['v...
python
Tools/gdb/libpython.py
754
774
{ "name": "PublicHealthInformationTechnology/cpython", "url": "https://github.com/PublicHealthInformationTechnology/cpython.git", "license": "NOASSERTION", "stars": 0, "forks": 0 }
8,125
proxyval
def proxyval(self, visited): # Guard against infinite loops: if self.as_address() in visited: return ProxyAlreadyVisited('{...}') visited.add(self.as_address()) result = {} for pyop_key, pyop_value in self.iteritems(): proxy_key = pyop_key.proxyval(visite...
python
Tools/gdb/libpython.py
776
787
{ "name": "PublicHealthInformationTechnology/cpython", "url": "https://github.com/PublicHealthInformationTechnology/cpython.git", "license": "NOASSERTION", "stars": 0, "forks": 0 }
8,126
write_repr
def write_repr(self, out, visited): # Guard against infinite loops: if self.as_address() in visited: out.write('{...}') return visited.add(self.as_address()) out.write('{') first = True for pyop_key, pyop_value in self.iteritems(): if ...
python
Tools/gdb/libpython.py
789
805
{ "name": "PublicHealthInformationTechnology/cpython", "url": "https://github.com/PublicHealthInformationTechnology/cpython.git", "license": "NOASSERTION", "stars": 0, "forks": 0 }
8,127
_get_entries
def _get_entries(keys): dk_nentries = int(keys['dk_nentries']) dk_size = 1<<int(keys['dk_log2_size']) if dk_size <= 0xFF: offset = dk_size elif dk_size <= 0xFFFF: offset = 2 * dk_size elif dk_size <= 0xFFFFFFFF: offset = 4 * dk_size el...
python
Tools/gdb/libpython.py
808
829
{ "name": "PublicHealthInformationTechnology/cpython", "url": "https://github.com/PublicHealthInformationTechnology/cpython.git", "license": "NOASSERTION", "stars": 0, "forks": 0 }
8,128
__getitem__
def __getitem__(self, i): # Get the gdb.Value for the (PyObject*) with the given index: field_ob_item = self.field('ob_item') return field_ob_item[i]
python
Tools/gdb/libpython.py
835
838
{ "name": "PublicHealthInformationTechnology/cpython", "url": "https://github.com/PublicHealthInformationTechnology/cpython.git", "license": "NOASSERTION", "stars": 0, "forks": 0 }
8,129
proxyval
def proxyval(self, visited): # Guard against infinite loops: if self.as_address() in visited: return ProxyAlreadyVisited('[...]') visited.add(self.as_address()) result = [PyObjectPtr.from_pyobject_ptr(self[i]).proxyval(visited) for i in safe_range(int_from_...
python
Tools/gdb/libpython.py
840
848
{ "name": "PublicHealthInformationTechnology/cpython", "url": "https://github.com/PublicHealthInformationTechnology/cpython.git", "license": "NOASSERTION", "stars": 0, "forks": 0 }
8,130
write_repr
def write_repr(self, out, visited): # Guard against infinite loops: if self.as_address() in visited: out.write('[...]') return visited.add(self.as_address()) out.write('[') for i in safe_range(int_from_int(self.field('ob_size'))): if i > 0: ...
python
Tools/gdb/libpython.py
850
863
{ "name": "PublicHealthInformationTechnology/cpython", "url": "https://github.com/PublicHealthInformationTechnology/cpython.git", "license": "NOASSERTION", "stars": 0, "forks": 0 }
8,131
proxyval
def proxyval(self, visited): ''' Python's Include/longinterpr.h has this declaration: typedef struct _PyLongValue { uintptr_t lv_tag; /* Number of digits, sign and flags */ digit ob_digit[1]; } _PyLongValue; struct _longobject { ...
python
Tools/gdb/libpython.py
868
914
{ "name": "PublicHealthInformationTechnology/cpython", "url": "https://github.com/PublicHealthInformationTechnology/cpython.git", "license": "NOASSERTION", "stars": 0, "forks": 0 }
8,132
write_repr
def write_repr(self, out, visited): # Write this out as a Python int literal proxy = self.proxyval(visited) out.write("%s" % proxy)
python
Tools/gdb/libpython.py
916
919
{ "name": "PublicHealthInformationTechnology/cpython", "url": "https://github.com/PublicHealthInformationTechnology/cpython.git", "license": "NOASSERTION", "stars": 0, "forks": 0 }
8,133
proxyval
def proxyval(self, visited): if PyLongObjectPtr.proxyval(self, visited): return True else: return False
python
Tools/gdb/libpython.py
927
931
{ "name": "PublicHealthInformationTechnology/cpython", "url": "https://github.com/PublicHealthInformationTechnology/cpython.git", "license": "NOASSERTION", "stars": 0, "forks": 0 }
8,134
proxyval
def proxyval(self, visited): return None
python
Tools/gdb/libpython.py
940
941
{ "name": "PublicHealthInformationTechnology/cpython", "url": "https://github.com/PublicHealthInformationTechnology/cpython.git", "license": "NOASSERTION", "stars": 0, "forks": 0 }
8,135
__init__
def __init__(self, gdbval, cast_to=None): PyObjectPtr.__init__(self, gdbval, cast_to) if not self.is_optimized_out(): self._frame = PyFramePtr(self.field('f_frame'))
python
Tools/gdb/libpython.py
946
950
{ "name": "PublicHealthInformationTechnology/cpython", "url": "https://github.com/PublicHealthInformationTechnology/cpython.git", "license": "NOASSERTION", "stars": 0, "forks": 0 }
8,136
iter_locals
def iter_locals(self): ''' Yield a sequence of (name,value) pairs of PyObjectPtr instances, for the local variables of this frame ''' if self.is_optimized_out(): return return self._frame.iter_locals()
python
Tools/gdb/libpython.py
952
959
{ "name": "PublicHealthInformationTechnology/cpython", "url": "https://github.com/PublicHealthInformationTechnology/cpython.git", "license": "NOASSERTION", "stars": 0, "forks": 0 }
8,137
iter_globals
def iter_globals(self): ''' Yield a sequence of (name,value) pairs of PyObjectPtr instances, for the global variables of this frame ''' if self.is_optimized_out(): return () return self._frame.iter_globals()
python
Tools/gdb/libpython.py
961
968
{ "name": "PublicHealthInformationTechnology/cpython", "url": "https://github.com/PublicHealthInformationTechnology/cpython.git", "license": "NOASSERTION", "stars": 0, "forks": 0 }
8,138
iter_builtins
def iter_builtins(self): ''' Yield a sequence of (name,value) pairs of PyObjectPtr instances, for the builtin variables ''' if self.is_optimized_out(): return () return self._frame.iter_builtins()
python
Tools/gdb/libpython.py
970
977
{ "name": "PublicHealthInformationTechnology/cpython", "url": "https://github.com/PublicHealthInformationTechnology/cpython.git", "license": "NOASSERTION", "stars": 0, "forks": 0 }
8,139
get_var_by_name
def get_var_by_name(self, name): if self.is_optimized_out(): return None, None return self._frame.get_var_by_name(name)
python
Tools/gdb/libpython.py
979
983
{ "name": "PublicHealthInformationTechnology/cpython", "url": "https://github.com/PublicHealthInformationTechnology/cpython.git", "license": "NOASSERTION", "stars": 0, "forks": 0 }
8,140
filename
def filename(self): '''Get the path of the current Python source file, as a string''' if self.is_optimized_out(): return FRAME_INFO_OPTIMIZED_OUT return self._frame.filename()
python
Tools/gdb/libpython.py
985
989
{ "name": "PublicHealthInformationTechnology/cpython", "url": "https://github.com/PublicHealthInformationTechnology/cpython.git", "license": "NOASSERTION", "stars": 0, "forks": 0 }
8,141
current_line_num
def current_line_num(self): '''Get current line number as an integer (1-based) Translated from PyFrame_GetLineNumber and PyCode_Addr2Line See Objects/lnotab_notes.txt ''' if self.is_optimized_out(): return None return self._frame.current_line_num()
python
Tools/gdb/libpython.py
991
1,000
{ "name": "PublicHealthInformationTechnology/cpython", "url": "https://github.com/PublicHealthInformationTechnology/cpython.git", "license": "NOASSERTION", "stars": 0, "forks": 0 }
8,142
current_line
def current_line(self): '''Get the text of the current source line as a string, with a trailing newline character''' if self.is_optimized_out(): return FRAME_INFO_OPTIMIZED_OUT return self._frame.current_line()
python
Tools/gdb/libpython.py
1,002
1,007
{ "name": "PublicHealthInformationTechnology/cpython", "url": "https://github.com/PublicHealthInformationTechnology/cpython.git", "license": "NOASSERTION", "stars": 0, "forks": 0 }
8,143
write_repr
def write_repr(self, out, visited): if self.is_optimized_out(): out.write(FRAME_INFO_OPTIMIZED_OUT) return return self._frame.write_repr(out, visited)
python
Tools/gdb/libpython.py
1,009
1,013
{ "name": "PublicHealthInformationTechnology/cpython", "url": "https://github.com/PublicHealthInformationTechnology/cpython.git", "license": "NOASSERTION", "stars": 0, "forks": 0 }
8,144
print_traceback
def print_traceback(self): if self.is_optimized_out(): sys.stdout.write(' %s\n' % FRAME_INFO_OPTIMIZED_OUT) return return self._frame.print_traceback()
python
Tools/gdb/libpython.py
1,015
1,019
{ "name": "PublicHealthInformationTechnology/cpython", "url": "https://github.com/PublicHealthInformationTechnology/cpython.git", "license": "NOASSERTION", "stars": 0, "forks": 0 }
8,145
__init__
def __init__(self, gdbval): self._gdbval = gdbval if not self.is_optimized_out(): try: self.co = self._f_code() self.co_name = self.co.pyop_field('co_name') self.co_filename = self.co.pyop_field('co_filename') self.f_lasti = s...
python
Tools/gdb/libpython.py
1,023
1,038
{ "name": "PublicHealthInformationTechnology/cpython", "url": "https://github.com/PublicHealthInformationTechnology/cpython.git", "license": "NOASSERTION", "stars": 0, "forks": 0 }
8,146
is_optimized_out
def is_optimized_out(self): return self._gdbval.is_optimized_out
python
Tools/gdb/libpython.py
1,040
1,041
{ "name": "PublicHealthInformationTechnology/cpython", "url": "https://github.com/PublicHealthInformationTechnology/cpython.git", "license": "NOASSERTION", "stars": 0, "forks": 0 }
8,147
iter_locals
def iter_locals(self): ''' Yield a sequence of (name,value) pairs of PyObjectPtr instances, for the local variables of this frame ''' if self.is_optimized_out(): return obj_ptr_ptr = gdb.lookup_type("PyObject").pointer().pointer() localsplus = self....
python
Tools/gdb/libpython.py
1,043
1,061
{ "name": "PublicHealthInformationTechnology/cpython", "url": "https://github.com/PublicHealthInformationTechnology/cpython.git", "license": "NOASSERTION", "stars": 0, "forks": 0 }
8,148
_f_special
def _f_special(self, name, convert=PyObjectPtr.from_pyobject_ptr): return convert(self._gdbval[name])
python
Tools/gdb/libpython.py
1,063
1,064
{ "name": "PublicHealthInformationTechnology/cpython", "url": "https://github.com/PublicHealthInformationTechnology/cpython.git", "license": "NOASSERTION", "stars": 0, "forks": 0 }
8,149
_f_globals
def _f_globals(self): return self._f_special("f_globals")
python
Tools/gdb/libpython.py
1,066
1,067
{ "name": "PublicHealthInformationTechnology/cpython", "url": "https://github.com/PublicHealthInformationTechnology/cpython.git", "license": "NOASSERTION", "stars": 0, "forks": 0 }
8,150
_f_builtins
def _f_builtins(self): return self._f_special("f_builtins")
python
Tools/gdb/libpython.py
1,069
1,070
{ "name": "PublicHealthInformationTechnology/cpython", "url": "https://github.com/PublicHealthInformationTechnology/cpython.git", "license": "NOASSERTION", "stars": 0, "forks": 0 }
8,151
_f_code
def _f_code(self): return self._f_special("f_executable", PyCodeObjectPtr.from_pyobject_ptr)
python
Tools/gdb/libpython.py
1,072
1,073
{ "name": "PublicHealthInformationTechnology/cpython", "url": "https://github.com/PublicHealthInformationTechnology/cpython.git", "license": "NOASSERTION", "stars": 0, "forks": 0 }
8,152
_f_executable
def _f_executable(self): return self._f_special("f_executable")
python
Tools/gdb/libpython.py
1,075
1,076
{ "name": "PublicHealthInformationTechnology/cpython", "url": "https://github.com/PublicHealthInformationTechnology/cpython.git", "license": "NOASSERTION", "stars": 0, "forks": 0 }
8,153
_f_nlocalsplus
def _f_nlocalsplus(self): return self._f_special("nlocalsplus", int_from_int)
python
Tools/gdb/libpython.py
1,078
1,079
{ "name": "PublicHealthInformationTechnology/cpython", "url": "https://github.com/PublicHealthInformationTechnology/cpython.git", "license": "NOASSERTION", "stars": 0, "forks": 0 }
8,154
_f_lasti
def _f_lasti(self): codeunit_p = gdb.lookup_type("_Py_CODEUNIT").pointer() instr_ptr = self._gdbval["instr_ptr"] first_instr = self._f_code().field("co_code_adaptive").cast(codeunit_p) return int(instr_ptr - first_instr)
python
Tools/gdb/libpython.py
1,081
1,085
{ "name": "PublicHealthInformationTechnology/cpython", "url": "https://github.com/PublicHealthInformationTechnology/cpython.git", "license": "NOASSERTION", "stars": 0, "forks": 0 }
8,155
is_shim
def is_shim(self): return self._f_special("owner", int) == FRAME_OWNED_BY_CSTACK
python
Tools/gdb/libpython.py
1,087
1,088
{ "name": "PublicHealthInformationTechnology/cpython", "url": "https://github.com/PublicHealthInformationTechnology/cpython.git", "license": "NOASSERTION", "stars": 0, "forks": 0 }
8,156
previous
def previous(self): return self._f_special("previous", PyFramePtr)
python
Tools/gdb/libpython.py
1,090
1,091
{ "name": "PublicHealthInformationTechnology/cpython", "url": "https://github.com/PublicHealthInformationTechnology/cpython.git", "license": "NOASSERTION", "stars": 0, "forks": 0 }
8,157
iter_globals
def iter_globals(self): ''' Yield a sequence of (name,value) pairs of PyObjectPtr instances, for the global variables of this frame ''' if self.is_optimized_out(): return () pyop_globals = self._f_globals() return pyop_globals.iteritems()
python
Tools/gdb/libpython.py
1,093
1,102
{ "name": "PublicHealthInformationTechnology/cpython", "url": "https://github.com/PublicHealthInformationTechnology/cpython.git", "license": "NOASSERTION", "stars": 0, "forks": 0 }
8,158
iter_builtins
def iter_builtins(self): ''' Yield a sequence of (name,value) pairs of PyObjectPtr instances, for the builtin variables ''' if self.is_optimized_out(): return () pyop_builtins = self._f_builtins() return pyop_builtins.iteritems()
python
Tools/gdb/libpython.py
1,104
1,113
{ "name": "PublicHealthInformationTechnology/cpython", "url": "https://github.com/PublicHealthInformationTechnology/cpython.git", "license": "NOASSERTION", "stars": 0, "forks": 0 }
8,159
get_var_by_name
def get_var_by_name(self, name): ''' Look for the named local variable, returning a (PyObjectPtr, scope) pair where scope is a string 'local', 'global', 'builtin' If not found, return (None, None) ''' for pyop_name, pyop_value in self.iter_locals(): if name =...
python
Tools/gdb/libpython.py
1,115
1,131
{ "name": "PublicHealthInformationTechnology/cpython", "url": "https://github.com/PublicHealthInformationTechnology/cpython.git", "license": "NOASSERTION", "stars": 0, "forks": 0 }
8,160
filename
def filename(self): '''Get the path of the current Python source file, as a string''' if self.is_optimized_out(): return FRAME_INFO_OPTIMIZED_OUT return self.co_filename.proxyval(set())
python
Tools/gdb/libpython.py
1,133
1,137
{ "name": "PublicHealthInformationTechnology/cpython", "url": "https://github.com/PublicHealthInformationTechnology/cpython.git", "license": "NOASSERTION", "stars": 0, "forks": 0 }
8,161
current_line_num
def current_line_num(self): '''Get current line number as an integer (1-based) Translated from PyFrame_GetLineNumber and PyCode_Addr2Line See Objects/lnotab_notes.txt ''' if self.is_optimized_out(): return None try: return self.co.addr2line(self....
python
Tools/gdb/libpython.py
1,139
1,156
{ "name": "PublicHealthInformationTechnology/cpython", "url": "https://github.com/PublicHealthInformationTechnology/cpython.git", "license": "NOASSERTION", "stars": 0, "forks": 0 }
8,162
current_line
def current_line(self): '''Get the text of the current source line as a string, with a trailing newline character''' if self.is_optimized_out(): return FRAME_INFO_OPTIMIZED_OUT lineno = self.current_line_num() if lineno is None: return '(failed to get fra...
python
Tools/gdb/libpython.py
1,158
1,179
{ "name": "PublicHealthInformationTechnology/cpython", "url": "https://github.com/PublicHealthInformationTechnology/cpython.git", "license": "NOASSERTION", "stars": 0, "forks": 0 }
8,163
write_repr
def write_repr(self, out, visited): if self.is_optimized_out(): out.write(FRAME_INFO_OPTIMIZED_OUT) return lineno = self.current_line_num() lineno = str(lineno) if lineno is not None else "?" out.write('Frame 0x%x, for file %s, line %s, in %s (' ...
python
Tools/gdb/libpython.py
1,181
1,202
{ "name": "PublicHealthInformationTechnology/cpython", "url": "https://github.com/PublicHealthInformationTechnology/cpython.git", "license": "NOASSERTION", "stars": 0, "forks": 0 }
8,164
as_address
def as_address(self): return int(self._gdbval)
python
Tools/gdb/libpython.py
1,204
1,205
{ "name": "PublicHealthInformationTechnology/cpython", "url": "https://github.com/PublicHealthInformationTechnology/cpython.git", "license": "NOASSERTION", "stars": 0, "forks": 0 }
8,165
print_traceback
def print_traceback(self): if self.is_optimized_out(): sys.stdout.write(' %s\n' % FRAME_INFO_OPTIMIZED_OUT) return visited = set() lineno = self.current_line_num() lineno = str(lineno) if lineno is not None else "?" sys.stdout.write(' File "%s", line %s,...
python
Tools/gdb/libpython.py
1,207
1,217
{ "name": "PublicHealthInformationTechnology/cpython", "url": "https://github.com/PublicHealthInformationTechnology/cpython.git", "license": "NOASSERTION", "stars": 0, "forks": 0 }
8,166
get_truncated_repr
def get_truncated_repr(self, maxlen): ''' Get a repr-like string for the data, but truncate it at "maxlen" bytes (ending the object graph traversal as soon as you do) ''' out = TruncatedStringIO(maxlen) try: self.write_repr(out, set()) except StringTru...
python
Tools/gdb/libpython.py
1,219
1,232
{ "name": "PublicHealthInformationTechnology/cpython", "url": "https://github.com/PublicHealthInformationTechnology/cpython.git", "license": "NOASSERTION", "stars": 0, "forks": 0 }
8,167
_dummy_key
def _dummy_key(self): return gdb.lookup_global_symbol('_PySet_Dummy').value()
python
Tools/gdb/libpython.py
1,238
1,239
{ "name": "PublicHealthInformationTechnology/cpython", "url": "https://github.com/PublicHealthInformationTechnology/cpython.git", "license": "NOASSERTION", "stars": 0, "forks": 0 }
8,168
__iter__
def __iter__(self): dummy_ptr = self._dummy_key() table = self.field('table') for i in safe_range(self.field('mask') + 1): setentry = table[i] key = setentry['key'] if key != 0 and key != dummy_ptr: yield PyObjectPtr.from_pyobject_ptr(key)
python
Tools/gdb/libpython.py
1,241
1,248
{ "name": "PublicHealthInformationTechnology/cpython", "url": "https://github.com/PublicHealthInformationTechnology/cpython.git", "license": "NOASSERTION", "stars": 0, "forks": 0 }
8,169
proxyval
def proxyval(self, visited): # Guard against infinite loops: if self.as_address() in visited: return ProxyAlreadyVisited('%s(...)' % self.safe_tp_name()) visited.add(self.as_address()) members = (key.proxyval(visited) for key in self) if self.safe_tp_name() == 'froze...
python
Tools/gdb/libpython.py
1,250
1,260
{ "name": "PublicHealthInformationTechnology/cpython", "url": "https://github.com/PublicHealthInformationTechnology/cpython.git", "license": "NOASSERTION", "stars": 0, "forks": 0 }
8,170
write_repr
def write_repr(self, out, visited): # Emulate Python's set_repr tp_name = self.safe_tp_name() # Guard against infinite loops: if self.as_address() in visited: out.write('(...)') return visited.add(self.as_address()) # Python's set_repr special-ca...
python
Tools/gdb/libpython.py
1,262
1,293
{ "name": "PublicHealthInformationTechnology/cpython", "url": "https://github.com/PublicHealthInformationTechnology/cpython.git", "license": "NOASSERTION", "stars": 0, "forks": 0 }
8,171
__str__
def __str__(self): field_ob_size = self.field('ob_size') field_ob_sval = self.field('ob_sval') char_ptr = field_ob_sval.address.cast(_type_unsigned_char_ptr()) return ''.join([chr(char_ptr[i]) for i in safe_range(field_ob_size)])
python
Tools/gdb/libpython.py
1,299
1,303
{ "name": "PublicHealthInformationTechnology/cpython", "url": "https://github.com/PublicHealthInformationTechnology/cpython.git", "license": "NOASSERTION", "stars": 0, "forks": 0 }
8,172
proxyval
def proxyval(self, visited): return str(self)
python
Tools/gdb/libpython.py
1,305
1,306
{ "name": "PublicHealthInformationTechnology/cpython", "url": "https://github.com/PublicHealthInformationTechnology/cpython.git", "license": "NOASSERTION", "stars": 0, "forks": 0 }
8,173
write_repr
def write_repr(self, out, visited): # Write this out as a Python bytes literal, i.e. with a "b" prefix # Get a PyStringObject* within the Python gdb process: proxy = self.proxyval(visited) # Transliteration of Python's Objects/bytesobject.c:PyBytes_Repr # to Python code: ...
python
Tools/gdb/libpython.py
1,308
1,337
{ "name": "PublicHealthInformationTechnology/cpython", "url": "https://github.com/PublicHealthInformationTechnology/cpython.git", "license": "NOASSERTION", "stars": 0, "forks": 0 }
8,174
__getitem__
def __getitem__(self, i): # Get the gdb.Value for the (PyObject*) with the given index: field_ob_item = self.field('ob_item') return field_ob_item[i]
python
Tools/gdb/libpython.py
1,342
1,345
{ "name": "PublicHealthInformationTechnology/cpython", "url": "https://github.com/PublicHealthInformationTechnology/cpython.git", "license": "NOASSERTION", "stars": 0, "forks": 0 }
8,175
proxyval
def proxyval(self, visited): # Guard against infinite loops: if self.as_address() in visited: return ProxyAlreadyVisited('(...)') visited.add(self.as_address()) result = tuple(PyObjectPtr.from_pyobject_ptr(self[i]).proxyval(visited) for i in safe_range...
python
Tools/gdb/libpython.py
1,347
1,355
{ "name": "PublicHealthInformationTechnology/cpython", "url": "https://github.com/PublicHealthInformationTechnology/cpython.git", "license": "NOASSERTION", "stars": 0, "forks": 0 }
8,176
write_repr
def write_repr(self, out, visited): # Guard against infinite loops: if self.as_address() in visited: out.write('(...)') return visited.add(self.as_address()) out.write('(') for i in safe_range(int_from_int(self.field('ob_size'))): if i > 0: ...
python
Tools/gdb/libpython.py
1,357
1,373
{ "name": "PublicHealthInformationTechnology/cpython", "url": "https://github.com/PublicHealthInformationTechnology/cpython.git", "license": "NOASSERTION", "stars": 0, "forks": 0 }
8,177
_unichr_is_printable
def _unichr_is_printable(char): # Logic adapted from Python's Tools/unicode/makeunicodedata.py if char == u" ": return True import unicodedata return unicodedata.category(char) not in ("C", "Z")
python
Tools/gdb/libpython.py
1,379
1,384
{ "name": "PublicHealthInformationTechnology/cpython", "url": "https://github.com/PublicHealthInformationTechnology/cpython.git", "license": "NOASSERTION", "stars": 0, "forks": 0 }
8,178
proxyval
def proxyval(self, visited): compact = self.field('_base') ascii = compact['_base'] state = ascii['state'] is_compact_ascii = (int(state['ascii']) and int(state['compact'])) field_length = int(ascii['length']) if is_compact_ascii: field_str = ascii.address + 1...
python
Tools/gdb/libpython.py
1,390
1,417
{ "name": "PublicHealthInformationTechnology/cpython", "url": "https://github.com/PublicHealthInformationTechnology/cpython.git", "license": "NOASSERTION", "stars": 0, "forks": 0 }
8,179
write_repr
def write_repr(self, out, visited): # Write this out as a Python str literal # Get a PyUnicodeObject* within the Python gdb process: proxy = self.proxyval(visited) # Transliteration of Python's Object/unicodeobject.c:unicode_repr # to Python: if "'" in proxy and '"' not...
python
Tools/gdb/libpython.py
1,419
1,514
{ "name": "PublicHealthInformationTechnology/cpython", "url": "https://github.com/PublicHealthInformationTechnology/cpython.git", "license": "NOASSERTION", "stars": 0, "forks": 0 }
8,180
safe_name
def safe_name(self): try: name = self.field('descr')['d_base']['name'].string() return repr(name) except (NullPyObjectPtr, RuntimeError, UnicodeDecodeError): return '<unknown name>'
python
Tools/gdb/libpython.py
1,520
1,525
{ "name": "PublicHealthInformationTechnology/cpython", "url": "https://github.com/PublicHealthInformationTechnology/cpython.git", "license": "NOASSERTION", "stars": 0, "forks": 0 }
8,181
safe_tp_name
def safe_tp_name(self): try: return self.field('self')['ob_type']['tp_name'].string() except (NullPyObjectPtr, RuntimeError, UnicodeDecodeError): return '<unknown tp_name>'
python
Tools/gdb/libpython.py
1,527
1,531
{ "name": "PublicHealthInformationTechnology/cpython", "url": "https://github.com/PublicHealthInformationTechnology/cpython.git", "license": "NOASSERTION", "stars": 0, "forks": 0 }
8,182
safe_self_addresss
def safe_self_addresss(self): try: address = int(self.field('self')) return '%#x' % address except (NullPyObjectPtr, RuntimeError): return '<failed to get self address>'
python
Tools/gdb/libpython.py
1,533
1,538
{ "name": "PublicHealthInformationTechnology/cpython", "url": "https://github.com/PublicHealthInformationTechnology/cpython.git", "license": "NOASSERTION", "stars": 0, "forks": 0 }
8,183
proxyval
def proxyval(self, visited): name = self.safe_name() tp_name = self.safe_tp_name() self_address = self.safe_self_addresss() return ("<method-wrapper %s of %s object at %s>" % (name, tp_name, self_address))
python
Tools/gdb/libpython.py
1,540
1,545
{ "name": "PublicHealthInformationTechnology/cpython", "url": "https://github.com/PublicHealthInformationTechnology/cpython.git", "license": "NOASSERTION", "stars": 0, "forks": 0 }
8,184
write_repr
def write_repr(self, out, visited): proxy = self.proxyval(visited) out.write(proxy)
python
Tools/gdb/libpython.py
1,547
1,549
{ "name": "PublicHealthInformationTechnology/cpython", "url": "https://github.com/PublicHealthInformationTechnology/cpython.git", "license": "NOASSERTION", "stars": 0, "forks": 0 }
8,185
int_from_int
def int_from_int(gdbval): return int(gdbval)
python
Tools/gdb/libpython.py
1,552
1,553
{ "name": "PublicHealthInformationTechnology/cpython", "url": "https://github.com/PublicHealthInformationTechnology/cpython.git", "license": "NOASSERTION", "stars": 0, "forks": 0 }
8,186
stringify
def stringify(val): # TODO: repr() puts everything on one line; pformat can be nicer, but # can lead to v.long results; this function isolates the choice if True: return repr(val) else: from pprint import pformat return pformat(val)
python
Tools/gdb/libpython.py
1,556
1,563
{ "name": "PublicHealthInformationTechnology/cpython", "url": "https://github.com/PublicHealthInformationTechnology/cpython.git", "license": "NOASSERTION", "stars": 0, "forks": 0 }
8,187
__init__
def __init__ (self, gdbval): self.gdbval = gdbval
python
Tools/gdb/libpython.py
1,569
1,570
{ "name": "PublicHealthInformationTechnology/cpython", "url": "https://github.com/PublicHealthInformationTechnology/cpython.git", "license": "NOASSERTION", "stars": 0, "forks": 0 }
8,188
to_string
def to_string (self): pyop = PyObjectPtr.from_pyobject_ptr(self.gdbval) if True: return pyop.get_truncated_repr(MAX_OUTPUT_LEN) else: # Generate full proxy value then stringify it. # Doing so could be expensive proxyval = pyop.proxyval(set()) ...
python
Tools/gdb/libpython.py
1,572
1,580
{ "name": "PublicHealthInformationTechnology/cpython", "url": "https://github.com/PublicHealthInformationTechnology/cpython.git", "license": "NOASSERTION", "stars": 0, "forks": 0 }
8,189
pretty_printer_lookup
def pretty_printer_lookup(gdbval): type = gdbval.type.unqualified() if type.code != gdb.TYPE_CODE_PTR: return None type = type.target().unqualified() t = str(type) if t in ("PyObject", "PyFrameObject", "PyUnicodeObject", "wrapperobject"): return PyObjectPtrPrinter(gdbval)
python
Tools/gdb/libpython.py
1,582
1,590
{ "name": "PublicHealthInformationTechnology/cpython", "url": "https://github.com/PublicHealthInformationTechnology/cpython.git", "license": "NOASSERTION", "stars": 0, "forks": 0 }
8,190
register
def register (obj): if obj is None: obj = gdb # Wire up the pretty-printer obj.pretty_printers.append(pretty_printer_lookup)
python
Tools/gdb/libpython.py
1,611
1,616
{ "name": "PublicHealthInformationTechnology/cpython", "url": "https://github.com/PublicHealthInformationTechnology/cpython.git", "license": "NOASSERTION", "stars": 0, "forks": 0 }
8,191
__init__
def __init__(self, gdbframe): self._gdbframe = gdbframe
python
Tools/gdb/libpython.py
1,630
1,631
{ "name": "PublicHealthInformationTechnology/cpython", "url": "https://github.com/PublicHealthInformationTechnology/cpython.git", "license": "NOASSERTION", "stars": 0, "forks": 0 }
8,192
older
def older(self): older = self._gdbframe.older() if older: return Frame(older) else: return None
python
Tools/gdb/libpython.py
1,633
1,638
{ "name": "PublicHealthInformationTechnology/cpython", "url": "https://github.com/PublicHealthInformationTechnology/cpython.git", "license": "NOASSERTION", "stars": 0, "forks": 0 }
8,193
newer
def newer(self): newer = self._gdbframe.newer() if newer: return Frame(newer) else: return None
python
Tools/gdb/libpython.py
1,640
1,645
{ "name": "PublicHealthInformationTechnology/cpython", "url": "https://github.com/PublicHealthInformationTechnology/cpython.git", "license": "NOASSERTION", "stars": 0, "forks": 0 }
8,194
select
def select(self): '''If supported, select this frame and return True; return False if unsupported Not all builds have a gdb.Frame.select method; seems to be present on Fedora 12 onwards, but absent on Ubuntu buildbot''' if not hasattr(self._gdbframe, 'select'): print ('Unabl...
python
Tools/gdb/libpython.py
1,647
1,657
{ "name": "PublicHealthInformationTechnology/cpython", "url": "https://github.com/PublicHealthInformationTechnology/cpython.git", "license": "NOASSERTION", "stars": 0, "forks": 0 }
8,195
get_index
def get_index(self): '''Calculate index of frame, starting at 0 for the newest frame within this thread''' index = 0 # Go down until you reach the newest frame: iter_frame = self while iter_frame.newer(): index += 1 iter_frame = iter_frame.newer() ...
python
Tools/gdb/libpython.py
1,659
1,668
{ "name": "PublicHealthInformationTechnology/cpython", "url": "https://github.com/PublicHealthInformationTechnology/cpython.git", "license": "NOASSERTION", "stars": 0, "forks": 0 }
8,196
is_python_frame
def is_python_frame(self): '''Is this a _PyEval_EvalFrameDefault frame, or some other important frame? (see is_other_python_frame for what "important" means in this context)''' if self.is_evalframe(): return True if self.is_other_python_frame(): return Tru...
python
Tools/gdb/libpython.py
1,677
1,685
{ "name": "PublicHealthInformationTechnology/cpython", "url": "https://github.com/PublicHealthInformationTechnology/cpython.git", "license": "NOASSERTION", "stars": 0, "forks": 0 }
8,197
is_evalframe
def is_evalframe(self): '''Is this a _PyEval_EvalFrameDefault frame?''' if self._gdbframe.name() == EVALFRAME: ''' I believe we also need to filter on the inline struct frame_id.inline_depth, only regarding frames with an inline depth of 0 as actually bein...
python
Tools/gdb/libpython.py
1,687
1,701
{ "name": "PublicHealthInformationTechnology/cpython", "url": "https://github.com/PublicHealthInformationTechnology/cpython.git", "license": "NOASSERTION", "stars": 0, "forks": 0 }
8,198
is_other_python_frame
def is_other_python_frame(self): '''Is this frame worth displaying in python backtraces? Examples: - waiting on the GIL - garbage-collecting - within a CFunction If it is, return a descriptive string For other frames, return False ''' if s...
python
Tools/gdb/libpython.py
1,703
1,754
{ "name": "PublicHealthInformationTechnology/cpython", "url": "https://github.com/PublicHealthInformationTechnology/cpython.git", "license": "NOASSERTION", "stars": 0, "forks": 0 }
8,199
is_waiting_for_gil
def is_waiting_for_gil(self): '''Is this frame waiting on the GIL?''' # This assumes the _POSIX_THREADS version of Python/ceval_gil.c: name = self._gdbframe.name() if name: return (name == 'take_gil')
python
Tools/gdb/libpython.py
1,756
1,761
{ "name": "PublicHealthInformationTechnology/cpython", "url": "https://github.com/PublicHealthInformationTechnology/cpython.git", "license": "NOASSERTION", "stars": 0, "forks": 0 }
8,200
is_gc_collect
def is_gc_collect(self): '''Is this frame a collector within the garbage-collector?''' return self._gdbframe.name() in ( 'collect', 'gc_collect_full', 'gc_collect_main', 'gc_collect_young', 'gc_collect_increment', )
python
Tools/gdb/libpython.py
1,763
1,768
{ "name": "PublicHealthInformationTechnology/cpython", "url": "https://github.com/PublicHealthInformationTechnology/cpython.git", "license": "NOASSERTION", "stars": 0, "forks": 0 }