I want to understand the functioning of Python Interpreter. I understand the process of generation on opcode and want to better understand the interpreter part. For that I read a lot on internet and got to know about for (;;) loop in ceval.c file in python interpreter(Cpython).
Now I want to interpret the following python code a.py:
a = 4
b = 5
c = a + b
when i do python -m dis a.py
1 0 LOAD_CONST 0 (4)
2 STORE_NAME 0 (a)
2 4 LOAD_CONST 1 (5)
6 STORE_NAME 1 (b)
3 8 LOAD_NAME 0 (a)
10 LOAD_NAME 1 (b)
12 BINARY_ADD
14 STORE_NAME 2 (c)
16 LOAD_CONST 2 (None)
18 RETURN_VALUE
Now I have put the debug point in switch(opcode) line in ceval.c. And now when i start the debugger it comes to this position for more than 2000 times. I think this is because before starting, python has to do some other interpretations stuff as well. So, my question is how do I debug only the relevant opcodes instructions?
Basically, how do i know the instruction I am debugging are actually from the program I created?
Please help me out with the same. Thanks in advance.