Project broken beyond repair

Whether you're a newbie or an experienced programmer, any questions, help, or just talk of any language will be welcomed here.

Moderator: Coders of Rage

User avatar
dandymcgee
ES Beta Backer
ES Beta Backer
Posts: 4709
Joined: Tue Apr 29, 2008 3:24 pm
Current Project: https://github.com/dbechrd/RicoTech
Favorite Gaming Platforms: NES, Sega Genesis, PS2, PC
Programming Language of Choice: C
Location: San Francisco
Contact:

Project broken beyond repair

Post by dandymcgee »

:oops: :cry:
My project is broken. Very very broken. I can't even isolate the error to post here for help.
Process terminated with status 3 (0 minutes, 6 seconds)
That is the message I've been looking at for the past 8 hours. I've been outputting line numbers to my debug text file to see exactly where it was crashing, because Code::Blocks' debugger no longer works, at all.

I would change something around to make it get past the line it crashes on (there are zero compile errors so I don't know what's wrong with what's already there), and then it would crash like 5 lines after that one. I'm pretty sure my only choice is to start over from the last backup I have, unless someone else can think of some other way I can attempt to debug the failure?
Falco Girgis wrote:It is imperative that I can broadcast my narcissistic commit strings to the Twitter! Tweet Tweet, bitches! :twisted:
bugmenot
Chaos Rift Cool Newbie
Chaos Rift Cool Newbie
Posts: 62
Joined: Sun Dec 07, 2008 7:05 pm

Re: Project broken beyond repair

Post by bugmenot »

Without code, it is a little difficult to help.

My guess is that it is due to a memory stump. Going beyond the bounds of an array, deleting something off the stack, uninitialised variables, double deleting, etc.

Are you building and running in Debug mode? Are you running the project with the debugger attached?

Are you using any form of source control?
User avatar
programmerinprogress
Chaos Rift Devotee
Chaos Rift Devotee
Posts: 632
Joined: Wed Oct 29, 2008 7:31 am
Current Project: some crazy stuff, i'll tell soon :-)
Favorite Gaming Platforms: PC
Programming Language of Choice: C++!
Location: The UK
Contact:

Re: Project broken beyond repair

Post by programmerinprogress »

yeah, when I get status 3's, It's usually due to something to do with pointers, if it's an SDL project your working on, check that all of your SDL_Surfaces are being created, initialised to NULL and are being freed properly, I swear I got a status 3 and something like that was wrong.

I don't know why, but I always hate getting status 3, I think it must be because i've gotten used to seeing it, and it normally means i've done something terrible :(

Nothing says "good job" like a nice clean status 0 :)
---------------------------------------------------------------------------------------
I think I can program pretty well, it's my compiler that needs convincing!
---------------------------------------------------------------------------------------
And now a joke to lighten to mood :D

I wander what programming language anakin skywalker used to program C3-PO's AI back on tatooine? my guess is Jawa :P
User avatar
dandymcgee
ES Beta Backer
ES Beta Backer
Posts: 4709
Joined: Tue Apr 29, 2008 3:24 pm
Current Project: https://github.com/dbechrd/RicoTech
Favorite Gaming Platforms: NES, Sega Genesis, PS2, PC
Programming Language of Choice: C
Location: San Francisco
Contact:

Re: Project broken beyond repair

Post by dandymcgee »

bugmenot wrote:Without code, it is a little difficult to help.
My guess is that it is due to a memory stump. Going beyond the bounds of an array, deleting something off the stack, uninitialised variables, double deleting, etc.
I'll check that out next time I feel like dealing with debugging my messy code (when vacation starts) :)
bugmenot wrote:Are you using any form of source control?
I'm not sure what you mean by source control? Do you have an example?
bugmenot wrote:Without code, it is a little difficult to help.
Well as I've said I can't even figure out what file the error is starting in, and the whole project is somewhere around 700 lines.
programmerinprogress wrote:Nothing says "good job" like a nice clean status 0 :)
Haha, that's for sure. I'll take a look at the things you mentioned.
Falco Girgis wrote:It is imperative that I can broadcast my narcissistic commit strings to the Twitter! Tweet Tweet, bitches! :twisted:
bugmenot
Chaos Rift Cool Newbie
Chaos Rift Cool Newbie
Posts: 62
Joined: Sun Dec 07, 2008 7:05 pm

Re: Project broken beyond repair

Post by bugmenot »

dandymcgee wrote:I'm not sure what you mean by source control? Do you have an example?
SVN, git, CVS, Perforce.
dandymcgee wrote: Well as I've said I can't even figure out what file the error is starting in, and the whole project is somewhere around 700 lines.
That is small enough. Post the whole project.
User avatar
Falco Girgis
Elysian Shadows Team
Elysian Shadows Team
Posts: 10294
Joined: Thu May 20, 2004 2:04 pm
Current Project: Elysian Shadows
Favorite Gaming Platforms: Dreamcast, SNES, NES
Programming Language of Choice: C/++
Location: Studio Vorbis, AL
Contact:

Re: Project broken beyond repair

Post by Falco Girgis »

Didn't you say that this happened when you rewrote string code to use character arrays? That would fit the array out-of-bounds theory...
bugmenot
Chaos Rift Cool Newbie
Chaos Rift Cool Newbie
Posts: 62
Joined: Sun Dec 07, 2008 7:05 pm

Re: Project broken beyond repair

Post by bugmenot »

GyroVorbis wrote:Didn't you say that this happened when you rewrote string code to use character arrays? That would fit the array out-of-bounds theory...
C++ strings FTW.
User avatar
dandymcgee
ES Beta Backer
ES Beta Backer
Posts: 4709
Joined: Tue Apr 29, 2008 3:24 pm
Current Project: https://github.com/dbechrd/RicoTech
Favorite Gaming Platforms: NES, Sega Genesis, PS2, PC
Programming Language of Choice: C
Location: San Francisco
Contact:

Re: Project broken beyond repair

Post by dandymcgee »

GyroVorbis wrote:Didn't you say that this happened when you rewrote string code to use character arrays? That would fit the array out-of-bounds theory...
Nope, I haven't rewritten any string code haha.
bugmenot wrote:
dandymcgee wrote: Well as I've said I can't even figure out what file the error is starting in, and the whole project is somewhere around 700 lines.
That is small enough. Post the whole project.
Alright, here ya go: http://www.freewebs.com/dandymcgee/Dand ... Broken.zip
Thanks for taking to time to look at this for me :mrgreen:

Btw, Merry Christmas everyone!
Falco Girgis wrote:It is imperative that I can broadcast my narcissistic commit strings to the Twitter! Tweet Tweet, bitches! :twisted:
User avatar
M_D_K
Chaos Rift Demigod
Chaos Rift Demigod
Posts: 1087
Joined: Tue Oct 28, 2008 10:33 am
Favorite Gaming Platforms: PC
Programming Language of Choice: C/++
Location: UK

Re: Project broken beyond repair

Post by M_D_K »

I might have something to do with this:

Code: Select all

Level *test;
test->Load( mapname, tilesheet );
test->Draw();
You need to do this(this means Level needs a constructor)

Code: Select all

Level *test = new Level();
And don't forget to delete it at the end.
Gyro Sheen wrote:you pour their inventory onto my life
IRC wrote: <sparda> The routine had a stack overflow, sorry.
<sparda> Apparently the stack was full of shit.
User avatar
dandymcgee
ES Beta Backer
ES Beta Backer
Posts: 4709
Joined: Tue Apr 29, 2008 3:24 pm
Current Project: https://github.com/dbechrd/RicoTech
Favorite Gaming Platforms: NES, Sega Genesis, PS2, PC
Programming Language of Choice: C
Location: San Francisco
Contact:

Re: Project broken beyond repair

Post by dandymcgee »

M_D_K wrote:I might have something to do with this:

Code: Select all

Level *test;
test->Load( mapname, tilesheet );
test->Draw();
You need to do this(this means Level needs a constructor)

Code: Select all

Level *test = new Level();
And don't forget to delete it at the end.
What should I put in the constructor? I can't get this to fix the problem.
Falco Girgis wrote:It is imperative that I can broadcast my narcissistic commit strings to the Twitter! Tweet Tweet, bitches! :twisted:
User avatar
M_D_K
Chaos Rift Demigod
Chaos Rift Demigod
Posts: 1087
Joined: Tue Oct 28, 2008 10:33 am
Favorite Gaming Platforms: PC
Programming Language of Choice: C/++
Location: UK

Re: Project broken beyond repair

Post by M_D_K »

Just leave the constructor blank for now.
Gyro Sheen wrote:you pour their inventory onto my life
IRC wrote: <sparda> The routine had a stack overflow, sorry.
<sparda> Apparently the stack was full of shit.
User avatar
dandymcgee
ES Beta Backer
ES Beta Backer
Posts: 4709
Joined: Tue Apr 29, 2008 3:24 pm
Current Project: https://github.com/dbechrd/RicoTech
Favorite Gaming Platforms: NES, Sega Genesis, PS2, PC
Programming Language of Choice: C
Location: San Francisco
Contact:

Re: Project broken beyond repair

Post by dandymcgee »

I tried it with a blank constructor and it returned status 3 just the same. :(
Falco Girgis wrote:It is imperative that I can broadcast my narcissistic commit strings to the Twitter! Tweet Tweet, bitches! :twisted:
User avatar
M_D_K
Chaos Rift Demigod
Chaos Rift Demigod
Posts: 1087
Joined: Tue Oct 28, 2008 10:33 am
Favorite Gaming Platforms: PC
Programming Language of Choice: C/++
Location: UK

Re: Project broken beyond repair

Post by M_D_K »

I noticed :/
Me thinks it has to do with you Image::Load function that seams to be where it dies still working it.
Gyro Sheen wrote:you pour their inventory onto my life
IRC wrote: <sparda> The routine had a stack overflow, sorry.
<sparda> Apparently the stack was full of shit.
User avatar
dandymcgee
ES Beta Backer
ES Beta Backer
Posts: 4709
Joined: Tue Apr 29, 2008 3:24 pm
Current Project: https://github.com/dbechrd/RicoTech
Favorite Gaming Platforms: NES, Sega Genesis, PS2, PC
Programming Language of Choice: C
Location: San Francisco
Contact:

Re: Project broken beyond repair

Post by dandymcgee »

Yeah.. but test.png exists in the images folder so I don't know why it wouldn't work? I've used that function before elsewhere I believe. Thanks for trying to help though, I really do appreciate it.
Falco Girgis wrote:It is imperative that I can broadcast my narcissistic commit strings to the Twitter! Tweet Tweet, bitches! :twisted:
bugmenot
Chaos Rift Cool Newbie
Chaos Rift Cool Newbie
Posts: 62
Joined: Sun Dec 07, 2008 7:05 pm

Re: Project broken beyond repair

Post by bugmenot »

From a very quick glance:

Code: Select all

    Level *test;
    test->Load( mapname, tilesheet );
    test->Draw();
Doesn't need to be a pointer:

Code: Select all

    Level test;
    test.Load( mapname, tilesheet );
    test.Draw();
In int Level::Load( std::string file_map, std::string file_tilesheet ):

Always pass objects as references and const whenever possible unless there is a design reason not to. It is cheaper and faster to pass by reference then by value for non-basic datatypes and the use of const is so you don't accidently overwrite the data:

Code: Select all

int Level::Load( const std::string & file_map, const std::string & file_tilesheet )

Code: Select all

    file_tilesheet = "images\\" + file_tilesheet;
    tileSheet->Load( file_tilesheet, TILE_WIDTH, TILE_HEIGHT, TILE_SPRITES );
tileSheet (which is currently a pointer) is not initialised or pointing to a valid memory address. Again it has no reason to be a pointer.

In short, most of your problems involve using pointers that are pointing to invalid memory.
Post Reply