PDA

View Full Version : Can you Debug in REAL time, while the program is running ?



jubei_GL
06-10-2002, 02:22 PM
Ok Im almost done with collision detection between my Camera and Walls . However, I made small change, bud don't know where in my program that corrupts my Collision data.. When I position my camera Near the Wall, and Run Debug, the collision detects intersection, and sends collision Flag.. However in my Program after 1st collision, for some reason I can go through walls . .I was wondering If it is possible to run the program ( you know Key interaction, moving my camera ) while at the same time looking at the Debug Data, trying to pin point the mistake ?????????

Is this even Possible ?

Omaha
06-10-2002, 02:31 PM
To an extent, depending on your development environment. What are you packing?

jubei_GL
06-10-2002, 02:46 PM
Im using VC++ 6.0... In my program I have interactions with the keyboard. While debugging in VC++, I can't use my program, only can see what whether collision happens or not, from my Defaul camera values .. I would like to run my program, and try to see a after which function my data gets corrupted, while changing Position of the camera..

I know the program is good, because it Run perfectly when I only had 1 wall .. Then I decided to add 3 crating Rectangular inclusion... My Idea was to crate couple of Structures, linked together to the main Structure which would define the Individual Wall..

Ex

Wall[0].info.CrossPvector.x
or
Wall[2].coordinates[3].x

This way I could just crate Linked structures, and then Easily assign coordinates for 4 walls, and using the same Function compute Cross Product, Vectors, Normalize etc .....

And its works, but somewhere I made a BOOBOO, and I don't see where.

secnuop
06-10-2002, 04:23 PM
Just a thought... can you use asserts or conditional breakpoints to try and trap your error? Sometimes these are the best tools to find mistakes like these.

rts
06-10-2002, 08:16 PM
One word:

printf()


http://www.opengl.org/discussion_boards/ubb/smile.gif

06-10-2002, 09:44 PM
You could also put a breakpoint on the memory address that is getting corrupted, and then when it changes your program will break. To do this, go to the breakpoints menu (ctrl-b I think) and go to the data tab and type in the memory address

jmg
06-11-2002, 07:51 AM
> Is this even Possible ?

If you can run your program in windowed mode, I know you can debug this sort of thing with the gnu tools (under, say, Linux) quite nicely.

The way it works there is; you open up a terminal window and run your program from there. printf()'s get printed out to the window from where you ran the program (as usual).

Then you open up a 2nd terminal window and run gdb from there -- you run gdb in such a way as to attach to the already-running process (which you've got paused perhaps, or maybe just looping or waiting for input).

Dunno how you'd do this sort of thing from VC++.

nickels
06-11-2002, 08:40 AM
Or in unix you could just print the address of your variable:
printf("var:%0x\n", (int) &var);

Then in another program open /proc/pid (where pid is your process id)

-fseek to the address printed.
-read(&var, sizeof(var),...)
printf var

I know there is an analogue to this in windows where you can open the process space, but I have not done it.