列出当前帧和更高帧中的变量
我正在尝试使用 perl -d ...
调试脚本。在我想要的地方中断之后,我想打印出当前环境和更高帧的环境。
我通过 T
查看堆栈。现在,如果我尝试 V
,我会得到所有内容的列表,这几乎没有用,因为它包括 SO_BROADCAST
常量等内容。我如何过滤掉这些内容并且只获取本地的?
如何对更高的帧执行相同的操作?
另外,如何在较高堆栈帧的行周围打印代码? v
/ l
仅执行当前操作。
I'm trying to debug a script with perl -d ...
. After I break where I want, I'd like to print out the current environment and the environment from higher frames.
I see the stack via T
. Now, if I try V
, I get a list of everything, which is pretty much useless, since it includes stuff like SO_BROADCAST
constants, etc. How can I filter those out and get only local ones?
How do I do the same for higher frames?
Also, how do I print the code around the line of a higher stack frame? v
/ l
do only the current one.
如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。
绑定邮箱获取回复消息
由于您还没有绑定你的真实邮箱,如果其他用户或者作者回复了您的评论,将不能在第一时间通知您!
发布评论
评论(2)
您是否尝试过
y [level]
,它显示当前或更高级别(由level
指定)的词法(我的)变量?当然,前提是你所说的“只获取本地的”。
Have you tried
y [level]
, which shows the lexical (my) variables at the current or higher (specified bylevel
)?Provided that's what you mean by "getting only local ones", of course.
您还可以使用 PadWalker 模块为您提供给定范围内的词汇列表。
peek_my
和peek_our
函数返回相对调用帧范围内变量的哈希引用(0 - 当前帧,1 - 调用帧,...)You can also use the PadWalker module to give you a list of lexicals at a given scope. The
peek_my
andpeek_our
functions return a hashref of the variables in scope at a relative call frame (0 - current frame, 1 - calling frame, ...)