Commit f960367e authored by Mark Florisson's avatar Mark Florisson

Fix converting a remote PyStringObject to a local string

parent 2aadadd0
...@@ -244,13 +244,8 @@ class CythonBase(object): ...@@ -244,13 +244,8 @@ class CythonBase(object):
if not pyframeobject: if not pyframeobject:
raise gdb.GdbError('Unable to read information on python frame') raise gdb.GdbError('Unable to read information on python frame')
try: filename = pyframeobject.filename()
filename = pyframeobject.filename() lineno = pyframeobject.current_line_num()
except RuntimeError:
filename = None
lineno = None
else:
lineno = pyframeobject.current_line_num()
if pygments: if pygments:
lexer = pygments.lexers.PythonLexer(stripall=False) lexer = pygments.lexers.PythonLexer(stripall=False)
...@@ -313,10 +308,7 @@ class CythonBase(object): ...@@ -313,10 +308,7 @@ class CythonBase(object):
# print this python function as a C function # print this python function as a C function
return self.print_stackframe(frame, index, is_c=True) return self.print_stackframe(frame, index, is_c=True)
try: func_name = pyframe.co_name
func_name = str(pyframe.co_name)
except RuntimeError:
func_name = 'Unknown Function Name'
func_cname = 'PyEval_EvalFrameEx' func_cname = 'PyEval_EvalFrameEx'
func_args = [] func_args = []
elif self.is_cython_function(frame): elif self.is_cython_function(frame):
......
...@@ -975,7 +975,9 @@ class PyStringObjectPtr(PyObjectPtr): ...@@ -975,7 +975,9 @@ class PyStringObjectPtr(PyObjectPtr):
def __str__(self): def __str__(self):
field_ob_size = self.field('ob_size') field_ob_size = self.field('ob_size')
field_ob_sval = self.field('ob_sval') field_ob_sval = self.field('ob_sval')
char_ptr = field_ob_sval.address.cast(_type_unsigned_char_ptr) char_ptr = field_ob_sval.address.cast(
gdb.lookup_type('char').pointer())
return ''.join([chr(char_ptr[i]) for i in safe_range(field_ob_size)]) return ''.join([chr(char_ptr[i]) for i in safe_range(field_ob_size)])
def proxyval(self, visited): def proxyval(self, visited):
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment