Previous frame inner to this frame (corrupt stack?)
I keep getting this error message when I debug my program: "Previous frame inner to this frame (corrupt stack?)"
I have no clue what it means, but the program gets a SIGBUS error when I just normally run it, so obviously I'm accesing memory that isn't mine. I can not find this error, and neither can my teacher, so now I'm turning to you guys for help
The link for the application is here: http://www.ghettointeractions.com/MMORPG.zip
When I run the Windows port of this code, the debugger seems to have problems deleting array of points called vertices[] in the ~shape destructor. When I put a breakpoint in the program when I debug it on my mac, is says that it doesn't like the point::setX() function, which I assume is because it's having problems with the vertices[] array. Either way, that seems to be where the problem lies, but it easily could be something else that is just causing it to act that way
Thanks in advance guys
-wyrmmage
I have no clue what it means, but the program gets a SIGBUS error when I just normally run it, so obviously I'm accesing memory that isn't mine. I can not find this error, and neither can my teacher, so now I'm turning to you guys for help

The link for the application is here: http://www.ghettointeractions.com/MMORPG.zip
When I run the Windows port of this code, the debugger seems to have problems deleting array of points called vertices[] in the ~shape destructor. When I put a breakpoint in the program when I debug it on my mac, is says that it doesn't like the point::setX() function, which I assume is because it's having problems with the vertices[] array. Either way, that seems to be where the problem lies, but it easily could be something else that is just causing it to act that way

Thanks in advance guys

-wyrmmage
Worlds at War (Current Project) - http://www.awkward-games.com/forum/
It *still* builds an application with a blank window...
If you want us to debug a crash, give us a program that crashes
If you want us to debug a crash, give us a program that crashes
You're dying during static initialization. I can't really see what the problem would be, but if you make line 6 in main.cpp:
game *theGame;
and then initializes it in main like so:
theGame = new game();
Then you will, if the problem doesn't solve itself, have a much better chance at hitting it with the debugger.
Ohwait, I just realized what it is:
In objectmanager's and in object's constructors, you're creating names. Look at the for loops: x <= 20. It should be <20, otherwise you'll trample memory, something that is exeptionally bad to do in constructors.
game *theGame;
and then initializes it in main like so:
theGame = new game();
Then you will, if the problem doesn't solve itself, have a much better chance at hitting it with the debugger.
Ohwait, I just realized what it is:
In objectmanager's and in object's constructors, you're creating names. Look at the for loops: x <= 20. It should be <20, otherwise you'll trample memory, something that is exeptionally bad to do in constructors.
Actually, the above goes for just about every for loop in your program.
OneSadCookie Wrote:It *still* builds an application with a blank window...
If you want us to debug a crash, give us a program that crashes
heh, it DOES crash
Or rather, it has a lot of SIGSEVs and a SIGBUS when I run it. It isn't supposed to display anything, it's an engine XD-wyrmmage
Fenris:
Why is it trampling memory? I'm rather lost on that fact. Should I also make it < 20 for the destructor? I tried changing the <= 20 to < 20 in the constructor in game and objectManager, but still does not seem to fix the problem, and the debugger does not pick it up (I'm actually testing this code on Windows currently, but I'm pretty sure that it does not matter.
Worlds at War (Current Project) - http://www.awkward-games.com/forum/
I tried changing it to game* theGame = new game(), but I still have problems when I delete it, like this: delete theGame;
seems a constructor is still deleting invalid memory.
seems a constructor is still deleting invalid memory.
Worlds at War (Current Project) - http://www.awkward-games.com/forum/
wyrmmage Wrote:heh, it DOES crashOr rather, it has a lot of SIGSEVs and a SIGBUS when I run it. It isn't supposed to display anything, it's an engine XD
It doesn't crash for me

And it can't possibly have more than one crash, the first one kills it dead
ok, after some modification to the constructor and destructor, I've gotten it working, it seems
When I get home, I'll try to transfer it on over to the mac...I'd still like to hear what exactly 'memory trampling' is, though 
Thanks guys,
-wyrmmage
When I get home, I'll try to transfer it on over to the mac...I'd still like to hear what exactly 'memory trampling' is, though 
Thanks guys,
-wyrmmage
Worlds at War (Current Project) - http://www.awkward-games.com/forum/
Memory trampling means that you create twenty pointers: objects[20];
Then, you create pointers between i=0 and i <= 20, which means that you're actually accessing element no 20. That isn't part of the array, and so you are overwriting whatever is just after the array in memory. Chances are that it's just random memory (which is what's happening to OSC) or that it overwrites some really important data in memory (which is happening to you and me).
The quick-fix in these cases is to turn on GuardMalloc in the Debug menu and debug the application. Go grab a cup of coffee and wait for it to die.
Then, you create pointers between i=0 and i <= 20, which means that you're actually accessing element no 20. That isn't part of the array, and so you are overwriting whatever is just after the array in memory. Chances are that it's just random memory (which is what's happening to OSC) or that it overwrites some really important data in memory (which is happening to you and me).
The quick-fix in these cases is to turn on GuardMalloc in the Debug menu and debug the application. Go grab a cup of coffee and wait for it to die.
I'll look up what GuardMalloc is, thanks 
That makes much more sense now that you explain it...I just assumed that when you said array[20], it meant that it was making 21 elements (since it normally starts at 0)...rather odd that is actually is making what I told it to XD
Anyway, thanks for the help guys...my mesh now works fine, and I can move on to texture mapping
.
Oh, speaking of texture-mapping, I really need some advice on texture-mapping meshes. I'm really not quite sure how it is normally done. Do you take a texture, slice it up, and then apply each triangle that I got from the texture onto the triangle on the texture map, or do you just load the texture and then cram it onto all of the triangles on the mesh?
Any links to this subject would be appreciated, and probably save you guys a lot of explaining ^_^
As I said, thanks
-wyrmmage

That makes much more sense now that you explain it...I just assumed that when you said array[20], it meant that it was making 21 elements (since it normally starts at 0)...rather odd that is actually is making what I told it to XD
Anyway, thanks for the help guys...my mesh now works fine, and I can move on to texture mapping
.Oh, speaking of texture-mapping, I really need some advice on texture-mapping meshes. I'm really not quite sure how it is normally done. Do you take a texture, slice it up, and then apply each triangle that I got from the texture onto the triangle on the texture map, or do you just load the texture and then cram it onto all of the triangles on the mesh?
Any links to this subject would be appreciated, and probably save you guys a lot of explaining ^_^
As I said, thanks

-wyrmmage
Worlds at War (Current Project) - http://www.awkward-games.com/forum/
Possibly Related Threads...
| Thread: | Author | Replies: | Views: | Last Post | |
| Frame Based Animation | Nick | 6 | 3,508 |
Jan 27, 2007 06:25 AM Last Post: 007gamer |
|
| NSWindow frame message not returning correct values after moving the window | Svarog | 6 | 4,175 |
Jan 7, 2007 06:41 PM Last Post: OneSadCookie |
|
| Trouble with stack implementation | ferum | 6 | 2,808 |
Oct 16, 2006 09:53 AM Last Post: akb825 |
|
| variable frame rate animation in Cocoa | Damian | 3 | 3,304 |
Jul 16, 2003 06:00 PM Last Post: macboy |
|
| Frame Rates | Iceman | 11 | 4,764 |
Jun 20, 2003 06:59 PM Last Post: Iceman |
|

