当前位置:   article > 正文

python 如何在linux进行调试_linux sh文件debug python

linux sh文件debug python

文章目录


如何在linux进行调试python,很多公司的是服务器,而服务器上面的python,打开只有shell 模式,如果你要观察某个变量是不方便的。

最方便的方式是:

> python -m pdb debug.py
  • 1

一些常用指令:

h(elp) [comman]  #打印可用指令及帮助信息

r(eturn)  #运行代码直到下一个断点或当前函数返回

b(reak) [[filename:]lineno | function[, condition]]  #指定文件某行或函数体来设置断点

l(ist) [first[, last]]  #查看指定代码段

n(ext)  #执行下一行

s(tep) #执行下一行,若为函数则进入函数体

p  #打印某个变量

a(rgs)  #打印当前函数的参数

w(here)  #打印堆栈信息

d(own)  #移至下层堆栈

u(p)  #移至上层堆栈

j(ump)  #跳转到指定行

continue / c  #继续执行

disable [bpnumber [bpnumber]] #失效断点

enable[bpnumber [bpnumber]]  #启用断点

cl(ear) [filename:lineno | bpnumber [bpnumber]] #删除断点

q(uit)/exit  #中止调试并退出
  • 1
  • 2
  • 3
  • 4
  • 5
  • 6
  • 7
  • 8
  • 9
  • 10
  • 11
  • 12
  • 13
  • 14
  • 15
  • 16
  • 17
  • 18
  • 19
  • 20
  • 21
  • 22
  • 23
  • 24
  • 25
  • 26
  • 27
  • 28
  • 29
  • 30
  • 31
  • 32
  • 33

在这里插入图片描述
参考文章:

1

声明:本文内容由网友自发贡献,不代表【wpsshop博客】立场,版权归原作者所有,本站不承担相应法律责任。如您发现有侵权的内容,请联系我们。转载请注明出处:https://www.wpsshop.cn/w/weixin_40725706/article/detail/216480
推荐阅读
相关标签
  

闽ICP备14008679号