Mercurial > cpython-lru_cache-weakref
annotate Misc/gdbinit @ 79675:c0a2294de787 2.7
Issue #16199: Backport 2to3 typo fix from 3.2.
| author | Chris Jerdonek <chris.jerdonek@gmail.com> |
|---|---|
| date | Thu, 11 Oct 2012 16:15:46 -0700 |
| parents | 2e58126dbad0 |
| children |
| rev | line source |
|---|---|
|
16166
10646d092a52
A few useful definitions if you're using gdb. Copy to ~/.gdbinit to
Barry Warsaw <barry@python.org>
parents:
diff
changeset
|
1 # If you use the GNU debugger gdb to debug the Python C runtime, you |
|
10646d092a52
A few useful definitions if you're using gdb. Copy to ~/.gdbinit to
Barry Warsaw <barry@python.org>
parents:
diff
changeset
|
2 # might find some of the following commands useful. Copy this to your |
|
10646d092a52
A few useful definitions if you're using gdb. Copy to ~/.gdbinit to
Barry Warsaw <barry@python.org>
parents:
diff
changeset
|
3 # ~/.gdbinit file and it'll get loaded into gdb automatically when you |
|
10646d092a52
A few useful definitions if you're using gdb. Copy to ~/.gdbinit to
Barry Warsaw <barry@python.org>
parents:
diff
changeset
|
4 # start it up. Then, at the gdb prompt you can do things like: |
|
10646d092a52
A few useful definitions if you're using gdb. Copy to ~/.gdbinit to
Barry Warsaw <barry@python.org>
parents:
diff
changeset
|
5 # |
|
10646d092a52
A few useful definitions if you're using gdb. Copy to ~/.gdbinit to
Barry Warsaw <barry@python.org>
parents:
diff
changeset
|
6 # (gdb) pyo apyobjectptr |
|
10646d092a52
A few useful definitions if you're using gdb. Copy to ~/.gdbinit to
Barry Warsaw <barry@python.org>
parents:
diff
changeset
|
7 # <module 'foobar' (built-in)> |
|
10646d092a52
A few useful definitions if you're using gdb. Copy to ~/.gdbinit to
Barry Warsaw <barry@python.org>
parents:
diff
changeset
|
8 # refcounts: 1 |
|
10646d092a52
A few useful definitions if you're using gdb. Copy to ~/.gdbinit to
Barry Warsaw <barry@python.org>
parents:
diff
changeset
|
9 # address : 84a7a2c |
|
10646d092a52
A few useful definitions if you're using gdb. Copy to ~/.gdbinit to
Barry Warsaw <barry@python.org>
parents:
diff
changeset
|
10 # $1 = void |
|
10646d092a52
A few useful definitions if you're using gdb. Copy to ~/.gdbinit to
Barry Warsaw <barry@python.org>
parents:
diff
changeset
|
11 # (gdb) |
|
65477
3c9afa92f8fd
Merged revisions 85646 via svnmerge from
Gregory P. Smith <greg@mad-scientist.com>
parents:
58311
diff
changeset
|
12 # |
|
3c9afa92f8fd
Merged revisions 85646 via svnmerge from
Gregory P. Smith <greg@mad-scientist.com>
parents:
58311
diff
changeset
|
13 # NOTE: If you have gdb 7 or later, it supports debugging of Python directly |
|
3c9afa92f8fd
Merged revisions 85646 via svnmerge from
Gregory P. Smith <greg@mad-scientist.com>
parents:
58311
diff
changeset
|
14 # with embedded macros that you may find superior to what is in here. |
|
65488
d58ce3ffb1cb
Merged revisions 85657 via svnmerge from
Gregory P. Smith <greg@mad-scientist.com>
parents:
65480
diff
changeset
|
15 # See Tools/gdb/libpython.py and http://bugs.python.org/issue8032. |
|
65477
3c9afa92f8fd
Merged revisions 85646 via svnmerge from
Gregory P. Smith <greg@mad-scientist.com>
parents:
58311
diff
changeset
|
16 |
|
16166
10646d092a52
A few useful definitions if you're using gdb. Copy to ~/.gdbinit to
Barry Warsaw <barry@python.org>
parents:
diff
changeset
|
17 # Prints a representation of the object to stderr, along with the |
|
10646d092a52
A few useful definitions if you're using gdb. Copy to ~/.gdbinit to
Barry Warsaw <barry@python.org>
parents:
diff
changeset
|
18 # number of reference counts it current has and the hex address the |
|
10646d092a52
A few useful definitions if you're using gdb. Copy to ~/.gdbinit to
Barry Warsaw <barry@python.org>
parents:
diff
changeset
|
19 # object is allocated at. The argument must be a PyObject* |
|
10646d092a52
A few useful definitions if you're using gdb. Copy to ~/.gdbinit to
Barry Warsaw <barry@python.org>
parents:
diff
changeset
|
20 define pyo |
|
65477
3c9afa92f8fd
Merged revisions 85646 via svnmerge from
Gregory P. Smith <greg@mad-scientist.com>
parents:
58311
diff
changeset
|
21 # side effect of calling _PyObject_Dump is to dump the object's |
|
3c9afa92f8fd
Merged revisions 85646 via svnmerge from
Gregory P. Smith <greg@mad-scientist.com>
parents:
58311
diff
changeset
|
22 # info - assigning just prevents gdb from printing the |
|
3c9afa92f8fd
Merged revisions 85646 via svnmerge from
Gregory P. Smith <greg@mad-scientist.com>
parents:
58311
diff
changeset
|
23 # NULL return value |
|
3c9afa92f8fd
Merged revisions 85646 via svnmerge from
Gregory P. Smith <greg@mad-scientist.com>
parents:
58311
diff
changeset
|
24 set $_unused_void = _PyObject_Dump($arg0) |
|
16166
10646d092a52
A few useful definitions if you're using gdb. Copy to ~/.gdbinit to
Barry Warsaw <barry@python.org>
parents:
diff
changeset
|
25 end |
|
10646d092a52
A few useful definitions if you're using gdb. Copy to ~/.gdbinit to
Barry Warsaw <barry@python.org>
parents:
diff
changeset
|
26 |
|
10646d092a52
A few useful definitions if you're using gdb. Copy to ~/.gdbinit to
Barry Warsaw <barry@python.org>
parents:
diff
changeset
|
27 # Prints a representation of the object to stderr, along with the |
|
10646d092a52
A few useful definitions if you're using gdb. Copy to ~/.gdbinit to
Barry Warsaw <barry@python.org>
parents:
diff
changeset
|
28 # number of reference counts it current has and the hex address the |
|
10646d092a52
A few useful definitions if you're using gdb. Copy to ~/.gdbinit to
Barry Warsaw <barry@python.org>
parents:
diff
changeset
|
29 # object is allocated at. The argument must be a PyGC_Head* |
|
10646d092a52
A few useful definitions if you're using gdb. Copy to ~/.gdbinit to
Barry Warsaw <barry@python.org>
parents:
diff
changeset
|
30 define pyg |
|
65477
3c9afa92f8fd
Merged revisions 85646 via svnmerge from
Gregory P. Smith <greg@mad-scientist.com>
parents:
58311
diff
changeset
|
31 print _PyGC_Dump($arg0) |
|
16166
10646d092a52
A few useful definitions if you're using gdb. Copy to ~/.gdbinit to
Barry Warsaw <barry@python.org>
parents:
diff
changeset
|
32 end |
|
30639
5ea0fd26bd36
A helper to dump info about the current frame,
Jeremy Hylton <jeremy@alum.mit.edu>
parents:
16197
diff
changeset
|
33 |
|
31860
50128ff19965
include local variables when dumping Python stack trace
Skip Montanaro <skip@pobox.com>
parents:
31606
diff
changeset
|
34 # print the local variables of the current frame |
|
50128ff19965
include local variables when dumping Python stack trace
Skip Montanaro <skip@pobox.com>
parents:
31606
diff
changeset
|
35 define pylocals |
|
50128ff19965
include local variables when dumping Python stack trace
Skip Montanaro <skip@pobox.com>
parents:
31606
diff
changeset
|
36 set $_i = 0 |
|
56830
97d7cd365dd5
Merged revisions 73206,73232,73299,73683,74020,74185,74544,74643,74647,74817,74838-74839,74865,74946,75402,75459,75604,75696 via svnmerge from
Georg Brandl <georg@python.org>
parents:
52900
diff
changeset
|
37 while $_i < f->f_code->co_nlocals |
|
31860
50128ff19965
include local variables when dumping Python stack trace
Skip Montanaro <skip@pobox.com>
parents:
31606
diff
changeset
|
38 if f->f_localsplus + $_i != 0 |
|
50128ff19965
include local variables when dumping Python stack trace
Skip Montanaro <skip@pobox.com>
parents:
31606
diff
changeset
|
39 set $_names = co->co_varnames |
|
50128ff19965
include local variables when dumping Python stack trace
Skip Montanaro <skip@pobox.com>
parents:
31606
diff
changeset
|
40 set $_name = PyString_AsString(PyTuple_GetItem($_names, $_i)) |
|
50128ff19965
include local variables when dumping Python stack trace
Skip Montanaro <skip@pobox.com>
parents:
31606
diff
changeset
|
41 printf "%s:\n", $_name |
|
65477
3c9afa92f8fd
Merged revisions 85646 via svnmerge from
Gregory P. Smith <greg@mad-scientist.com>
parents:
58311
diff
changeset
|
42 pyo f->f_localsplus[$_i] |
|
31860
50128ff19965
include local variables when dumping Python stack trace
Skip Montanaro <skip@pobox.com>
parents:
31606
diff
changeset
|
43 end |
|
50128ff19965
include local variables when dumping Python stack trace
Skip Montanaro <skip@pobox.com>
parents:
31606
diff
changeset
|
44 set $_i = $_i + 1 |
|
50128ff19965
include local variables when dumping Python stack trace
Skip Montanaro <skip@pobox.com>
parents:
31606
diff
changeset
|
45 end |
|
50128ff19965
include local variables when dumping Python stack trace
Skip Montanaro <skip@pobox.com>
parents:
31606
diff
changeset
|
46 end |
|
50128ff19965
include local variables when dumping Python stack trace
Skip Montanaro <skip@pobox.com>
parents:
31606
diff
changeset
|
47 |
|
34370
ce232072eae6
Add definitions for "up" and "down" commands that print/display the current
Skip Montanaro <skip@pobox.com>
parents:
33997
diff
changeset
|
48 # A rewrite of the Python interpreter's line number calculator in GDB's |
|
ce232072eae6
Add definitions for "up" and "down" commands that print/display the current
Skip Montanaro <skip@pobox.com>
parents:
33997
diff
changeset
|
49 # command language |
|
ce232072eae6
Add definitions for "up" and "down" commands that print/display the current
Skip Montanaro <skip@pobox.com>
parents:
33997
diff
changeset
|
50 define lineno |
|
35520
9521e380380f
break sets a breakpoint rather than stopping the loop.
Neal Norwitz <nnorwitz@gmail.com>
parents:
35335
diff
changeset
|
51 set $__continue = 1 |
|
34370
ce232072eae6
Add definitions for "up" and "down" commands that print/display the current
Skip Montanaro <skip@pobox.com>
parents:
33997
diff
changeset
|
52 set $__co = f->f_code |
|
ce232072eae6
Add definitions for "up" and "down" commands that print/display the current
Skip Montanaro <skip@pobox.com>
parents:
33997
diff
changeset
|
53 set $__lasti = f->f_lasti |
|
ce232072eae6
Add definitions for "up" and "down" commands that print/display the current
Skip Montanaro <skip@pobox.com>
parents:
33997
diff
changeset
|
54 set $__sz = ((PyStringObject *)$__co->co_lnotab)->ob_size/2 |
|
ce232072eae6
Add definitions for "up" and "down" commands that print/display the current
Skip Montanaro <skip@pobox.com>
parents:
33997
diff
changeset
|
55 set $__p = (unsigned char *)((PyStringObject *)$__co->co_lnotab)->ob_sval |
|
ce232072eae6
Add definitions for "up" and "down" commands that print/display the current
Skip Montanaro <skip@pobox.com>
parents:
33997
diff
changeset
|
56 set $__li = $__co->co_firstlineno |
|
ce232072eae6
Add definitions for "up" and "down" commands that print/display the current
Skip Montanaro <skip@pobox.com>
parents:
33997
diff
changeset
|
57 set $__ad = 0 |
|
35520
9521e380380f
break sets a breakpoint rather than stopping the loop.
Neal Norwitz <nnorwitz@gmail.com>
parents:
35335
diff
changeset
|
58 while ($__sz-1 >= 0 && $__continue) |
|
34370
ce232072eae6
Add definitions for "up" and "down" commands that print/display the current
Skip Montanaro <skip@pobox.com>
parents:
33997
diff
changeset
|
59 set $__sz = $__sz - 1 |
|
ce232072eae6
Add definitions for "up" and "down" commands that print/display the current
Skip Montanaro <skip@pobox.com>
parents:
33997
diff
changeset
|
60 set $__ad = $__ad + *$__p |
|
ce232072eae6
Add definitions for "up" and "down" commands that print/display the current
Skip Montanaro <skip@pobox.com>
parents:
33997
diff
changeset
|
61 set $__p = $__p + 1 |
|
ce232072eae6
Add definitions for "up" and "down" commands that print/display the current
Skip Montanaro <skip@pobox.com>
parents:
33997
diff
changeset
|
62 if ($__ad > $__lasti) |
|
35520
9521e380380f
break sets a breakpoint rather than stopping the loop.
Neal Norwitz <nnorwitz@gmail.com>
parents:
35335
diff
changeset
|
63 set $__continue = 0 |
|
66462
835c176239d0
Merged revisions 85768-85771,85773,85777,85823,85825 via svnmerge from
Georg Brandl <georg@python.org>
parents:
65488
diff
changeset
|
64 else |
|
835c176239d0
Merged revisions 85768-85771,85773,85777,85823,85825 via svnmerge from
Georg Brandl <georg@python.org>
parents:
65488
diff
changeset
|
65 set $__li = $__li + *$__p |
|
835c176239d0
Merged revisions 85768-85771,85773,85777,85823,85825 via svnmerge from
Georg Brandl <georg@python.org>
parents:
65488
diff
changeset
|
66 set $__p = $__p + 1 |
|
34370
ce232072eae6
Add definitions for "up" and "down" commands that print/display the current
Skip Montanaro <skip@pobox.com>
parents:
33997
diff
changeset
|
67 end |
|
ce232072eae6
Add definitions for "up" and "down" commands that print/display the current
Skip Montanaro <skip@pobox.com>
parents:
33997
diff
changeset
|
68 end |
|
66465
2e58126dbad0
Merged revisions 85843,85849-85850,85867,85907,85914,86134,86187,86315-86316,86390,86424-86425,86428 via svnmerge from
Georg Brandl <georg@python.org>
parents:
66462
diff
changeset
|
69 printf "%d", $__li |
|
34370
ce232072eae6
Add definitions for "up" and "down" commands that print/display the current
Skip Montanaro <skip@pobox.com>
parents:
33997
diff
changeset
|
70 end |
|
ce232072eae6
Add definitions for "up" and "down" commands that print/display the current
Skip Montanaro <skip@pobox.com>
parents:
33997
diff
changeset
|
71 |
|
33997
e01a17bcdf28
split functionality into pystack and pystackv commands. The former will
Skip Montanaro <skip@pobox.com>
parents:
33024
diff
changeset
|
72 # print the current frame - verbose |
|
e01a17bcdf28
split functionality into pystack and pystackv commands. The former will
Skip Montanaro <skip@pobox.com>
parents:
33024
diff
changeset
|
73 define pyframev |
|
e01a17bcdf28
split functionality into pystack and pystackv commands. The former will
Skip Montanaro <skip@pobox.com>
parents:
33024
diff
changeset
|
74 pyframe |
|
e01a17bcdf28
split functionality into pystack and pystackv commands. The former will
Skip Montanaro <skip@pobox.com>
parents:
33024
diff
changeset
|
75 pylocals |
|
e01a17bcdf28
split functionality into pystack and pystackv commands. The former will
Skip Montanaro <skip@pobox.com>
parents:
33024
diff
changeset
|
76 end |
|
e01a17bcdf28
split functionality into pystack and pystackv commands. The former will
Skip Montanaro <skip@pobox.com>
parents:
33024
diff
changeset
|
77 |
|
31860
50128ff19965
include local variables when dumping Python stack trace
Skip Montanaro <skip@pobox.com>
parents:
31606
diff
changeset
|
78 define pyframe |
|
33997
e01a17bcdf28
split functionality into pystack and pystackv commands. The former will
Skip Montanaro <skip@pobox.com>
parents:
33024
diff
changeset
|
79 set $__fn = (char *)((PyStringObject *)co->co_filename)->ob_sval |
|
e01a17bcdf28
split functionality into pystack and pystackv commands. The former will
Skip Montanaro <skip@pobox.com>
parents:
33024
diff
changeset
|
80 set $__n = (char *)((PyStringObject *)co->co_name)->ob_sval |
|
34370
ce232072eae6
Add definitions for "up" and "down" commands that print/display the current
Skip Montanaro <skip@pobox.com>
parents:
33997
diff
changeset
|
81 printf "%s (", $__fn |
|
ce232072eae6
Add definitions for "up" and "down" commands that print/display the current
Skip Montanaro <skip@pobox.com>
parents:
33997
diff
changeset
|
82 lineno |
|
ce232072eae6
Add definitions for "up" and "down" commands that print/display the current
Skip Montanaro <skip@pobox.com>
parents:
33997
diff
changeset
|
83 printf "): %s\n", $__n |
|
ce232072eae6
Add definitions for "up" and "down" commands that print/display the current
Skip Montanaro <skip@pobox.com>
parents:
33997
diff
changeset
|
84 ### Uncomment these lines when using from within Emacs/XEmacs so it will |
|
ce232072eae6
Add definitions for "up" and "down" commands that print/display the current
Skip Montanaro <skip@pobox.com>
parents:
33997
diff
changeset
|
85 ### automatically track/display the current Python source line |
|
ce232072eae6
Add definitions for "up" and "down" commands that print/display the current
Skip Montanaro <skip@pobox.com>
parents:
33997
diff
changeset
|
86 # printf "%c%c%s:", 032, 032, $__fn |
|
ce232072eae6
Add definitions for "up" and "down" commands that print/display the current
Skip Montanaro <skip@pobox.com>
parents:
33997
diff
changeset
|
87 # lineno |
|
ce232072eae6
Add definitions for "up" and "down" commands that print/display the current
Skip Montanaro <skip@pobox.com>
parents:
33997
diff
changeset
|
88 # printf ":1\n" |
|
ce232072eae6
Add definitions for "up" and "down" commands that print/display the current
Skip Montanaro <skip@pobox.com>
parents:
33997
diff
changeset
|
89 end |
|
ce232072eae6
Add definitions for "up" and "down" commands that print/display the current
Skip Montanaro <skip@pobox.com>
parents:
33997
diff
changeset
|
90 |
|
ce232072eae6
Add definitions for "up" and "down" commands that print/display the current
Skip Montanaro <skip@pobox.com>
parents:
33997
diff
changeset
|
91 ### Use these at your own risk. It appears that a bug in gdb causes it |
|
ce232072eae6
Add definitions for "up" and "down" commands that print/display the current
Skip Montanaro <skip@pobox.com>
parents:
33997
diff
changeset
|
92 ### to crash in certain circumstances. |
|
ce232072eae6
Add definitions for "up" and "down" commands that print/display the current
Skip Montanaro <skip@pobox.com>
parents:
33997
diff
changeset
|
93 |
|
ce232072eae6
Add definitions for "up" and "down" commands that print/display the current
Skip Montanaro <skip@pobox.com>
parents:
33997
diff
changeset
|
94 #define up |
|
ce232072eae6
Add definitions for "up" and "down" commands that print/display the current
Skip Montanaro <skip@pobox.com>
parents:
33997
diff
changeset
|
95 # up-silently 1 |
|
ce232072eae6
Add definitions for "up" and "down" commands that print/display the current
Skip Montanaro <skip@pobox.com>
parents:
33997
diff
changeset
|
96 # printframe |
|
ce232072eae6
Add definitions for "up" and "down" commands that print/display the current
Skip Montanaro <skip@pobox.com>
parents:
33997
diff
changeset
|
97 #end |
|
ce232072eae6
Add definitions for "up" and "down" commands that print/display the current
Skip Montanaro <skip@pobox.com>
parents:
33997
diff
changeset
|
98 |
|
ce232072eae6
Add definitions for "up" and "down" commands that print/display the current
Skip Montanaro <skip@pobox.com>
parents:
33997
diff
changeset
|
99 #define down |
|
ce232072eae6
Add definitions for "up" and "down" commands that print/display the current
Skip Montanaro <skip@pobox.com>
parents:
33997
diff
changeset
|
100 # down-silently 1 |
|
ce232072eae6
Add definitions for "up" and "down" commands that print/display the current
Skip Montanaro <skip@pobox.com>
parents:
33997
diff
changeset
|
101 # printframe |
|
ce232072eae6
Add definitions for "up" and "down" commands that print/display the current
Skip Montanaro <skip@pobox.com>
parents:
33997
diff
changeset
|
102 #end |
|
ce232072eae6
Add definitions for "up" and "down" commands that print/display the current
Skip Montanaro <skip@pobox.com>
parents:
33997
diff
changeset
|
103 |
|
ce232072eae6
Add definitions for "up" and "down" commands that print/display the current
Skip Montanaro <skip@pobox.com>
parents:
33997
diff
changeset
|
104 define printframe |
|
35335
9b2227a60dae
Fix pystack command.
Neil Schemenauer <nascheme@enme.ucalgary.ca>
parents:
34370
diff
changeset
|
105 if $pc > PyEval_EvalFrameEx && $pc < PyEval_EvalCodeEx |
|
34370
ce232072eae6
Add definitions for "up" and "down" commands that print/display the current
Skip Montanaro <skip@pobox.com>
parents:
33997
diff
changeset
|
106 pyframe |
|
ce232072eae6
Add definitions for "up" and "down" commands that print/display the current
Skip Montanaro <skip@pobox.com>
parents:
33997
diff
changeset
|
107 else |
|
ce232072eae6
Add definitions for "up" and "down" commands that print/display the current
Skip Montanaro <skip@pobox.com>
parents:
33997
diff
changeset
|
108 frame |
|
ce232072eae6
Add definitions for "up" and "down" commands that print/display the current
Skip Montanaro <skip@pobox.com>
parents:
33997
diff
changeset
|
109 end |
|
31860
50128ff19965
include local variables when dumping Python stack trace
Skip Montanaro <skip@pobox.com>
parents:
31606
diff
changeset
|
110 end |
|
50128ff19965
include local variables when dumping Python stack trace
Skip Montanaro <skip@pobox.com>
parents:
31606
diff
changeset
|
111 |
|
31861
d04d786ab458
It would help if I deleted the old pystack!
Skip Montanaro <skip@pobox.com>
parents:
31860
diff
changeset
|
112 # Here's a somewhat fragile way to print the entire Python stack from gdb. |
|
d04d786ab458
It would help if I deleted the old pystack!
Skip Montanaro <skip@pobox.com>
parents:
31860
diff
changeset
|
113 # It's fragile because the tests for the value of $pc depend on the layout |
|
d04d786ab458
It would help if I deleted the old pystack!
Skip Montanaro <skip@pobox.com>
parents:
31860
diff
changeset
|
114 # of specific functions in the C source code. |
|
d04d786ab458
It would help if I deleted the old pystack!
Skip Montanaro <skip@pobox.com>
parents:
31860
diff
changeset
|
115 |
|
d04d786ab458
It would help if I deleted the old pystack!
Skip Montanaro <skip@pobox.com>
parents:
31860
diff
changeset
|
116 # Explanation of while and if tests: We want to pop up the stack until we |
|
d04d786ab458
It would help if I deleted the old pystack!
Skip Montanaro <skip@pobox.com>
parents:
31860
diff
changeset
|
117 # land in Py_Main (this is probably an incorrect assumption in an embedded |
|
d04d786ab458
It would help if I deleted the old pystack!
Skip Montanaro <skip@pobox.com>
parents:
31860
diff
changeset
|
118 # interpreter, but the test can be extended by an interested party). If |
|
d04d786ab458
It would help if I deleted the old pystack!
Skip Montanaro <skip@pobox.com>
parents:
31860
diff
changeset
|
119 # Py_Main <= $pc <= Py_GetArgcArv is true, $pc is in Py_Main(), so the while |
|
d04d786ab458
It would help if I deleted the old pystack!
Skip Montanaro <skip@pobox.com>
parents:
31860
diff
changeset
|
120 # tests succeeds as long as it's not true. In a similar fashion the if |
|
58311
10306780e5c0
Update PyEval_EvalFrame to PyEval_EvalFrameEx. This looks to have been done
Skip Montanaro <skip@pobox.com>
parents:
56830
diff
changeset
|
121 # statement tests to see if we are in PyEval_EvalFrameEx(). |
|
10306780e5c0
Update PyEval_EvalFrame to PyEval_EvalFrameEx. This looks to have been done
Skip Montanaro <skip@pobox.com>
parents:
56830
diff
changeset
|
122 |
|
10306780e5c0
Update PyEval_EvalFrame to PyEval_EvalFrameEx. This looks to have been done
Skip Montanaro <skip@pobox.com>
parents:
56830
diff
changeset
|
123 # Note: The name of the main interpreter function and the function which |
|
10306780e5c0
Update PyEval_EvalFrame to PyEval_EvalFrameEx. This looks to have been done
Skip Montanaro <skip@pobox.com>
parents:
56830
diff
changeset
|
124 # follow it has changed over time. This version of pystack works with this |
|
10306780e5c0
Update PyEval_EvalFrame to PyEval_EvalFrameEx. This looks to have been done
Skip Montanaro <skip@pobox.com>
parents:
56830
diff
changeset
|
125 # version of Python. If you try using it with older or newer versions of |
|
10306780e5c0
Update PyEval_EvalFrame to PyEval_EvalFrameEx. This looks to have been done
Skip Montanaro <skip@pobox.com>
parents:
56830
diff
changeset
|
126 # the interpreter you may will have to change the functions you compare with |
|
10306780e5c0
Update PyEval_EvalFrame to PyEval_EvalFrameEx. This looks to have been done
Skip Montanaro <skip@pobox.com>
parents:
56830
diff
changeset
|
127 # $pc. |
|
31861
d04d786ab458
It would help if I deleted the old pystack!
Skip Montanaro <skip@pobox.com>
parents:
31860
diff
changeset
|
128 |
|
31860
50128ff19965
include local variables when dumping Python stack trace
Skip Montanaro <skip@pobox.com>
parents:
31606
diff
changeset
|
129 # print the entire Python call stack |
|
50128ff19965
include local variables when dumping Python stack trace
Skip Montanaro <skip@pobox.com>
parents:
31606
diff
changeset
|
130 define pystack |
|
50128ff19965
include local variables when dumping Python stack trace
Skip Montanaro <skip@pobox.com>
parents:
31606
diff
changeset
|
131 while $pc < Py_Main || $pc > Py_GetArgcArgv |
|
58311
10306780e5c0
Update PyEval_EvalFrame to PyEval_EvalFrameEx. This looks to have been done
Skip Montanaro <skip@pobox.com>
parents:
56830
diff
changeset
|
132 if $pc > PyEval_EvalFrameEx && $pc < PyEval_EvalCodeEx |
|
31860
50128ff19965
include local variables when dumping Python stack trace
Skip Montanaro <skip@pobox.com>
parents:
31606
diff
changeset
|
133 pyframe |
|
50128ff19965
include local variables when dumping Python stack trace
Skip Montanaro <skip@pobox.com>
parents:
31606
diff
changeset
|
134 end |
|
50128ff19965
include local variables when dumping Python stack trace
Skip Montanaro <skip@pobox.com>
parents:
31606
diff
changeset
|
135 up-silently 1 |
|
50128ff19965
include local variables when dumping Python stack trace
Skip Montanaro <skip@pobox.com>
parents:
31606
diff
changeset
|
136 end |
|
50128ff19965
include local variables when dumping Python stack trace
Skip Montanaro <skip@pobox.com>
parents:
31606
diff
changeset
|
137 select-frame 0 |
|
50128ff19965
include local variables when dumping Python stack trace
Skip Montanaro <skip@pobox.com>
parents:
31606
diff
changeset
|
138 end |
|
33997
e01a17bcdf28
split functionality into pystack and pystackv commands. The former will
Skip Montanaro <skip@pobox.com>
parents:
33024
diff
changeset
|
139 |
|
e01a17bcdf28
split functionality into pystack and pystackv commands. The former will
Skip Montanaro <skip@pobox.com>
parents:
33024
diff
changeset
|
140 # print the entire Python call stack - verbose mode |
|
e01a17bcdf28
split functionality into pystack and pystackv commands. The former will
Skip Montanaro <skip@pobox.com>
parents:
33024
diff
changeset
|
141 define pystackv |
|
e01a17bcdf28
split functionality into pystack and pystackv commands. The former will
Skip Montanaro <skip@pobox.com>
parents:
33024
diff
changeset
|
142 while $pc < Py_Main || $pc > Py_GetArgcArgv |
|
58311
10306780e5c0
Update PyEval_EvalFrame to PyEval_EvalFrameEx. This looks to have been done
Skip Montanaro <skip@pobox.com>
parents:
56830
diff
changeset
|
143 if $pc > PyEval_EvalFrameEx && $pc < PyEval_EvalCodeEx |
|
33997
e01a17bcdf28
split functionality into pystack and pystackv commands. The former will
Skip Montanaro <skip@pobox.com>
parents:
33024
diff
changeset
|
144 pyframev |
|
e01a17bcdf28
split functionality into pystack and pystackv commands. The former will
Skip Montanaro <skip@pobox.com>
parents:
33024
diff
changeset
|
145 end |
|
e01a17bcdf28
split functionality into pystack and pystackv commands. The former will
Skip Montanaro <skip@pobox.com>
parents:
33024
diff
changeset
|
146 up-silently 1 |
|
e01a17bcdf28
split functionality into pystack and pystackv commands. The former will
Skip Montanaro <skip@pobox.com>
parents:
33024
diff
changeset
|
147 end |
|
e01a17bcdf28
split functionality into pystack and pystackv commands. The former will
Skip Montanaro <skip@pobox.com>
parents:
33024
diff
changeset
|
148 select-frame 0 |
|
e01a17bcdf28
split functionality into pystack and pystackv commands. The former will
Skip Montanaro <skip@pobox.com>
parents:
33024
diff
changeset
|
149 end |
|
52900
4acbbb3e65e2
Merged revisions 70866-70868,70870-70871,70893,70896,70902,70905,70907,70912,70915,70927,70933,70940,70944,70954,70963,70998,71056 via svnmerge from
Georg Brandl <georg@python.org>
parents:
35520
diff
changeset
|
150 |
|
4acbbb3e65e2
Merged revisions 70866-70868,70870-70871,70893,70896,70902,70905,70907,70912,70915,70927,70933,70940,70944,70954,70963,70998,71056 via svnmerge from
Georg Brandl <georg@python.org>
parents:
35520
diff
changeset
|
151 # generally useful macro to print a Unicode string |
|
4acbbb3e65e2
Merged revisions 70866-70868,70870-70871,70893,70896,70902,70905,70907,70912,70915,70927,70933,70940,70944,70954,70963,70998,71056 via svnmerge from
Georg Brandl <georg@python.org>
parents:
35520
diff
changeset
|
152 def pu |
|
4acbbb3e65e2
Merged revisions 70866-70868,70870-70871,70893,70896,70902,70905,70907,70912,70915,70927,70933,70940,70944,70954,70963,70998,71056 via svnmerge from
Georg Brandl <georg@python.org>
parents:
35520
diff
changeset
|
153 set $uni = $arg0 |
|
4acbbb3e65e2
Merged revisions 70866-70868,70870-70871,70893,70896,70902,70905,70907,70912,70915,70927,70933,70940,70944,70954,70963,70998,71056 via svnmerge from
Georg Brandl <georg@python.org>
parents:
35520
diff
changeset
|
154 set $i = 0 |
|
4acbbb3e65e2
Merged revisions 70866-70868,70870-70871,70893,70896,70902,70905,70907,70912,70915,70927,70933,70940,70944,70954,70963,70998,71056 via svnmerge from
Georg Brandl <georg@python.org>
parents:
35520
diff
changeset
|
155 while (*$uni && $i++<100) |
|
4acbbb3e65e2
Merged revisions 70866-70868,70870-70871,70893,70896,70902,70905,70907,70912,70915,70927,70933,70940,70944,70954,70963,70998,71056 via svnmerge from
Georg Brandl <georg@python.org>
parents:
35520
diff
changeset
|
156 if (*$uni < 0x80) |
|
4acbbb3e65e2
Merged revisions 70866-70868,70870-70871,70893,70896,70902,70905,70907,70912,70915,70927,70933,70940,70944,70954,70963,70998,71056 via svnmerge from
Georg Brandl <georg@python.org>
parents:
35520
diff
changeset
|
157 print *(char*)$uni++ |
|
4acbbb3e65e2
Merged revisions 70866-70868,70870-70871,70893,70896,70902,70905,70907,70912,70915,70927,70933,70940,70944,70954,70963,70998,71056 via svnmerge from
Georg Brandl <georg@python.org>
parents:
35520
diff
changeset
|
158 else |
|
4acbbb3e65e2
Merged revisions 70866-70868,70870-70871,70893,70896,70902,70905,70907,70912,70915,70927,70933,70940,70944,70954,70963,70998,71056 via svnmerge from
Georg Brandl <georg@python.org>
parents:
35520
diff
changeset
|
159 print /x *(short*)$uni++ |
|
4acbbb3e65e2
Merged revisions 70866-70868,70870-70871,70893,70896,70902,70905,70907,70912,70915,70927,70933,70940,70944,70954,70963,70998,71056 via svnmerge from
Georg Brandl <georg@python.org>
parents:
35520
diff
changeset
|
160 end |
|
4acbbb3e65e2
Merged revisions 70866-70868,70870-70871,70893,70896,70902,70905,70907,70912,70915,70927,70933,70940,70944,70954,70963,70998,71056 via svnmerge from
Georg Brandl <georg@python.org>
parents:
35520
diff
changeset
|
161 end |
|
4acbbb3e65e2
Merged revisions 70866-70868,70870-70871,70893,70896,70902,70905,70907,70912,70915,70927,70933,70940,70944,70954,70963,70998,71056 via svnmerge from
Georg Brandl <georg@python.org>
parents:
35520
diff
changeset
|
162 end |
