Thanks to visit codestin.com
Credit goes to github.com

Skip to content

Commit f64ec0f

Browse files
committed
A helper to dump info about the current frame,
assuming it is the variable f.
1 parent d46e684 commit f64ec0f

1 file changed

Lines changed: 9 additions & 0 deletions

File tree

Misc/gdbinit

Lines changed: 9 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -25,3 +25,12 @@ end
2525
define pyg
2626
print _PyGC_Dump($arg0)
2727
end
28+
29+
# If you are in an eval_frame() function, calling pyframe with no
30+
# arguments will print the filename, function name, and line number.
31+
# It assumes that f is the name of the current frame.
32+
define pyframe
33+
x/s ((PyStringObject*)f->f_code->co_filename)->ob_sval
34+
x/s ((PyStringObject*)f->f_code->co_name)->ob_sval
35+
p f->f_lineno
36+
end

0 commit comments

Comments
 (0)