Post

(python) pdb - 디버깅

gdb처럼 쓰면 된다.

1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
(Pdb) n            # 함수 진입 안하고 한줄 실행
(Pdb) s            # 함수 진입 하면서 한줄 실행
(Pdb) l
10     def mkList2():
11         result = [value for value in range(1000)]
12         return result
13
14
15  -> print("mkList1 : ", timeit(mkList1, number=1000), "s")
16     print("mkList2 : ", timeit(mkList2, number=1000), "s")
17
[EOF]
(Pdb) b 16
Breakpoint 1 at d:\source\rapts\test.py:16
(Pdb) c
mkList1 :  2.6512367244046393 s
> d:\source\rapts\test.py(16)<module>()
-> print("mkList2 : ", timeit(mkList2, number=1000), "s")
(Pdb) b            # break point 출력
Num Type         Disp Enb   Where
1   breakpoint   keep yes   at d:\source\rapts\test.py:16
breakpoint already hit 1 time

This post is licensed under CC BY 4.0 by the author.