Skip to content
Projects
Groups
Snippets
Help
Loading...
Help
Support
Keyboard shortcuts
?
Submit feedback
Contribute to GitLab
Sign in / Register
Toggle navigation
C
cpython
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
Members
Members
Collapse sidebar
Close sidebar
Activity
Graph
Create a new issue
Commits
Issue Boards
Open sidebar
Kirill Smelkov
cpython
Commits
74d07f2b
Commit
74d07f2b
authored
Apr 02, 2004
by
Skip Montanaro
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
include local variables when dumping Python stack trace
parent
456d3258
Changes
1
Hide whitespace changes
Inline
Side-by-side
Showing
1 changed file
with
36 additions
and
9 deletions
+36
-9
Misc/gdbinit
Misc/gdbinit
+36
-9
No files found.
Misc/gdbinit
View file @
74d07f2b
...
...
@@ -26,15 +26,6 @@ define pyg
print _PyGC_Dump
(
$arg0
)
end
# If you are in an eval_frame() function, calling pyframe with no
# arguments will print the filename, function name, and line number.
# It assumes that f is the name of the current frame.
define pyframe
x/s
((
PyStringObject
*
)
f->f_code->co_filename
)
->ob_sval
x/s
((
PyStringObject
*
)
f->f_code->co_name
)
->ob_sval
p f->f_lineno
end
# Here's a somewhat fragile way to print the entire Python stack from gdb.
# It's fragile because the tests for the value of $pc depend on the layout
# of specific functions in the C source code.
...
...
@@ -46,6 +37,42 @@ end
# tests succeeds as long as it's not true. In a similar fashion the if
# statement tests to see if we are in eval_frame().
# print the local variables of the current frame
define pylocals
set
$_i
=
0
while
$_i
< f->f_nlocals
if
f->f_localsplus +
$_i
!=
0
set
$_names
=
co->co_varnames
set
$_name
=
PyString_AsString
(
PyTuple_GetItem
(
$_names
,
$_i
))
printf
"%s:
\n
"
,
$_name
# side effect of calling _PyObject_Dump is to dump the object's
# info - assigning just prevents gdb from printing the
# NULL return value
set
$_val
=
_PyObject_Dump
(
f->f_localsplus[
$_i
])
end
set
$_i
=
$_i
+ 1
end
end
# print the current frame
define pyframe
set
$__fn
=
PyString_AsString
(
co->co_filename
)
set
$__n
=
PyString_AsString
(
co->co_name
)
printf
"%s (%d): %s
\n
"
,
$__fn
, f->f_lineno,
$__n
pylocals
end
# print the entire Python call stack
define pystack
while
$pc
< Py_Main
||
$pc
>
Py_GetArgcArgv
if
$pc
>
eval_frame
&&
$pc
< PyEval_EvalCodeEx
pyframe
end
up-silently 1
end
select
-frame
0
end
define pystack
while
$pc
< Py_Main
||
$pc
>
Py_GetArgcArgv
if
$pc
>
eval_frame
&&
$pc
< PyEval_EvalCodeEx
...
...
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