Skip to content
Projects
Groups
Snippets
Help
Loading...
Help
Support
Keyboard shortcuts
?
Submit feedback
Contribute to GitLab
Sign in / Register
Toggle navigation
C
cython
Project overview
Project overview
Details
Activity
Releases
Repository
Repository
Files
Commits
Branches
Tags
Contributors
Graph
Compare
Issues
0
Issues
0
List
Boards
Labels
Milestones
Merge Requests
0
Merge Requests
0
Analytics
Analytics
Repository
Value Stream
Wiki
Wiki
Snippets
Snippets
Members
Members
Collapse sidebar
Close sidebar
Activity
Graph
Create a new issue
Commits
Issue Boards
Open sidebar
Gwenaël Samain
cython
Commits
0ca73a7e
Commit
0ca73a7e
authored
Nov 03, 2010
by
Mark Florisson
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
More graceful error handling in 'cy bt' when there is no C debug information
parent
cfe5930a
Changes
1
Hide whitespace changes
Inline
Side-by-side
Showing
1 changed file
with
17 additions
and
13 deletions
+17
-13
Cython/Debugger/libcython.py
Cython/Debugger/libcython.py
+17
-13
No files found.
Cython/Debugger/libcython.py
View file @
0ca73a7e
...
@@ -237,7 +237,7 @@ class CythonBase(object):
...
@@ -237,7 +237,7 @@ class CythonBase(object):
lexer
=
pygments
.
lexers
.
PythonLexer
()
lexer
=
pygments
.
lexers
.
PythonLexer
()
else
:
else
:
symbol_and_line_obj
=
frame
.
find_sal
()
symbol_and_line_obj
=
frame
.
find_sal
()
if
symbol_and_line_obj
is
None
:
if
not
symbol_and_line_obj
or
not
symbol_and_line_obj
.
symtab
:
filename
=
None
filename
=
None
lineno
=
0
lineno
=
0
else
:
else
:
...
@@ -279,7 +279,7 @@ class CythonBase(object):
...
@@ -279,7 +279,7 @@ class CythonBase(object):
# variable not initialized yet
# variable not initialized yet
pass
pass
@
default_selected_gdb_frame
()
@
default_selected_gdb_frame
(
err
=
False
)
def
print_stackframe
(
self
,
frame
,
index
,
is_c
=
False
):
def
print_stackframe
(
self
,
frame
,
index
,
is_c
=
False
):
"""
"""
Print a C, Cython or Python stack frame and the line of source code
Print a C, Cython or Python stack frame and the line of source code
...
@@ -290,8 +290,12 @@ class CythonBase(object):
...
@@ -290,8 +290,12 @@ class CythonBase(object):
selected_frame
=
gdb
.
selected_frame
()
selected_frame
=
gdb
.
selected_frame
()
frame
.
select
()
frame
.
select
()
source_desc
,
lineno
=
self
.
get_source_desc
(
frame
)
try
:
source_desc
,
lineno
=
self
.
get_source_desc
(
frame
)
except
NoFunctionNameInFrameError
:
print
'#%-2d Unknown Frame (compile with -g)'
%
index
return
if
not
is_c
and
self
.
is_python_function
(
frame
):
if
not
is_c
and
self
.
is_python_function
(
frame
):
pyframe
=
libpython
.
Frame
(
frame
).
get_pyop
()
pyframe
=
libpython
.
Frame
(
frame
).
get_pyop
()
if
pyframe
is
None
or
pyframe
.
is_optimized_out
():
if
pyframe
is
None
or
pyframe
.
is_optimized_out
():
...
@@ -318,13 +322,13 @@ class CythonBase(object):
...
@@ -318,13 +322,13 @@ class CythonBase(object):
# Seriously? Why is the address not an int?
# Seriously? Why is the address not an int?
func_address
=
int
(
str
(
gdb_value
.
address
).
split
()[
0
],
0
)
func_address
=
int
(
str
(
gdb_value
.
address
).
split
()[
0
],
0
)
print
'#%-2d 0x%016x in %s(%s) at %s:%s'
%
(
a
=
', '
.
join
(
'%s=%s'
%
(
name
,
val
)
for
name
,
val
in
func_args
)
index
,
print
'#%-2d 0x%016x in %s(%s)'
%
(
index
,
func_address
,
func_name
,
a
)
,
func_address
,
func_name
,
if
source_desc
.
filename
is
not
None
:
', '
.
join
(
'%s=%s'
%
(
name
,
val
)
for
name
,
val
in
func_args
),
print
'at %s:%s'
%
(
source_desc
.
filename
,
lineno
),
source_desc
.
filename
,
lineno
)
print
try
:
try
:
print
' '
+
source_desc
.
get_source
(
lineno
)
print
' '
+
source_desc
.
get_source
(
lineno
)
...
@@ -498,9 +502,9 @@ class CythonCommand(gdb.Command, CythonBase):
...
@@ -498,9 +502,9 @@ class CythonCommand(gdb.Command, CythonBase):
@
classmethod
@
classmethod
def
_register
(
cls
,
clsname
,
args
,
kwargs
):
def
_register
(
cls
,
clsname
,
args
,
kwargs
):
if
not
hasattr
(
cls
,
'completer_class'
):
if
not
hasattr
(
cls
,
'completer_class'
):
return
cls
(
cls
.
name
,
cls
.
command_class
,
*
args
,
**
kwargs
)
return
cls
(
clsname
,
cls
.
command_class
,
*
args
,
**
kwargs
)
else
:
else
:
return
cls
(
cls
.
name
,
cls
.
command_class
,
cls
.
completer_class
,
return
cls
(
clsname
,
cls
.
command_class
,
cls
.
completer_class
,
*
args
,
**
kwargs
)
*
args
,
**
kwargs
)
@
classmethod
@
classmethod
...
...
Write
Preview
Markdown
is supported
0%
Try again
or
attach a new file
Attach a file
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Cancel
Please
register
or
sign in
to comment