Trouble debugging (python)

classic Classic list List threaded Threaded
5 messages Options
Reply | Threaded
Open this post in threaded view
|

Trouble debugging (python)

agnesi
I wrote CodeWriter in Python and I'm having a heck of time debuggin this. Anyone familiar with Python and willing to look at my code with fresh eyes to find my error?
Reply | Threaded
Open this post in threaded view
|

Re: Trouble debugging (python)

ybakos
@agnesi, can you be more specific? What is the exact issue?

Do you use "cheap" debugging by using lots of print statements in your code?

Reply | Threaded
Open this post in threaded view
|

Re: Trouble debugging (python)

cadet1620
Administrator
In reply to this post by agnesi
If you want to email me your source, I can take a look at it and see if I can spot your error.

--Mark
Reply | Threaded
Open this post in threaded view
|

Re: Trouble debugging (python)

agnesi
In reply to this post by ybakos
My code produces an .asm file just fine. when I translate StackTest.vm, the comparison in the CPUEmulator is successful. However, when I run I translate BasicTest.vm and run the file through the CPUEmulator there is a comparison failure. So, yes, I added print statements throughout my assembly code so that I can compare it with the vm code but the assembly code seems correct to me.
Any suggestions concerning debugging would be greatly appreciated

Joe

Reply | Threaded
Open this post in threaded view
|

Re: Trouble debugging (python)

cadet1620
Administrator
Start with identifying what values are miscomparing.

RAM[256] is the final result on the stack at the end of the program,
RAM[300] is the beginning of the 'local' segment,
RAM[400] is the beginning of the 'argument' segment,
RAM[3000] is the beginning of the 'this' segment,
RAM[3010] is the beginning of the 'that' segment,
RAM[11] is 'temp 6'.

Look at StackTest.vm and examine the code you generated for the commands that were supposed to set those values.

--Mark