BorlandTalk.com Forum Index BorlandTalk.com
Borland discussion newsgroups
 
Archives   FAQFAQ   SearchSearch   MemberlistMemberlist   UsergroupsUsergroups   RegisterRegister 
 ProfileProfile   Log in to check your private messagesLog in to check your private messages   Log inLog in 

strange crash...or exit?

 
Post new topic   Reply to topic    BorlandTalk.com Forum Index -> C++ Builder (Language C++)
View previous topic :: View next topic  
Author Message
peter
Guest





PostPosted: Wed Apr 18, 2007 11:20 pm    Post subject: strange crash...or exit? Reply with quote



I'm not sure how to ask this question. its hard to ask because
i know how ludicrous it must sound.

Anyways, i have a program that is crashing upon returning from a
void method.

The code is too complicated to post. However, I can give these
details:
1-I call a certain function.
2-the function comes to an end. I have a printf that prints 'returning'
right before the return statement (its a void function, so the line
is just 'return;')
3-the first line after the function call is another printf that
prints 'exiting!'.
4-the stdout reports the 'returning', but not the 'exiting'.
5-this is NOT the first time I call the function in this program.
It has been called 30 times prior to this happening.
6-running it on 2 different machines it crashes this way on the 1,
but not on the other, though all the other dependent programs are
the same versions.
7-I can't look at it in the graphic BB5 debugger on my computer because it runs fine on my computer.


anybody have any suggestions of things to check? I know this sounds
completely crazy, but its really happening! I can't think of what
could be affecting it this way. Any ideas at all?
Back to top
Chris Uzdavinis (TeamB)
Guest





PostPosted: Wed Apr 18, 2007 11:20 pm    Post subject: Re: strange crash...or exit? Reply with quote



"peter" <peteandrus (AT) hotmail (DOT) com> writes:

Quote:
anybody have any suggestions of things to check? I know this sounds
completely crazy, but its really happening! I can't think of what
could be affecting it this way. Any ideas at all?

Perhaps you're corrupting your stack somehow. That's about as
specific as I can guess. Look for array bounds issues, use of
deleted/uninitialized pointers, or, since you're using printf, ensure
that all of the format flags are the correct types for your arguments,
and that you have arguments for all your format flags, etc.

--
Chris (TeamB);
Back to top
Alex Bakaev [TeamB]
Guest





PostPosted: Wed Apr 18, 2007 11:20 pm    Post subject: Re: strange crash...or exit? Reply with quote



Quote:
anybody have any suggestions of things to check? I know this sounds
completely crazy, but its really happening! I can't think of what
could be affecting it this way. Any ideas at all?

Use CodeGuard.
Back to top
Chris Uzdavinis (TeamB)
Guest





PostPosted: Wed Apr 18, 2007 11:20 pm    Post subject: Re: strange crash...or exit? Reply with quote

"peter" <peteandrus (AT) hotmail (DOT) com> writes:

Quote:
Chris,
I was thinking that might be a possibility, but would something like
that manifest itself by exiting on the return from a function where
no value is returned? I even removed the explicit return and let the
function just end, got the same result. The program just ends. No
crash, just ends. This is totally freaking me out.

The program has to jump back to the point from which it was called,
and if it scrambles that memory, it could be causing the shutdown, or
possibly corrupting your program in other ways (if it doesn't crash.)

Nothing can be certain without code that reproduces the problem, but
something is wrong and I'm just brainstorming for some possible
causes.

--
Chris (TeamB);
Back to top
peter
Guest





PostPosted: Wed Apr 18, 2007 11:43 pm    Post subject: Re: strange crash...or exit? Reply with quote

Chris Uzdavinis (TeamB) <chris (AT) uzdavinis (DOT) com> wrote:
Quote:
"peter" <peteandrus (AT) hotmail (DOT) com> writes:

anybody have any suggestions of things to check? I know this sounds
completely crazy, but its really happening! I can't think of what
could be affecting it this way. Any ideas at all?

Perhaps you're corrupting your stack somehow. That's about as
specific as I can guess. Look for array bounds issues, use of
deleted/uninitialized pointers, or, since you're using printf, ensure
that all of the format flags are the correct types for your arguments,
and that you have arguments for all your format flags, etc.

--
Chris (TeamB);

Chris,
I was thinking that might be a possibility, but would something
like that manifest itself by exiting on the return from a function
where no value is returned? I even removed the explicit return and
let the function just end, got the same result. The program just ends. No crash, just ends. This is totally freaking me out.
Back to top
David Ayre
Guest





PostPosted: Thu Apr 19, 2007 12:37 am    Post subject: Re: strange crash...or exit? Reply with quote

I had something similar happen some time ago and it turned out
that I had specified a char acString[100] and was trying to fit
more than 100 chars into the space. The rest went into unspecified
memory and could have overwritten anything. The programme just
closed as yours did.
Hope that helps,
Cheers,

David

Quote:
The program has to jump back to the point from which it was called,
and if it scrambles that memory, it could be causing the shutdown, or
possibly corrupting your program in other ways (if it doesn't crash.)

Nothing can be certain without code that reproduces the problem, but
something is wrong and I'm just brainstorming for some possible
causes.

--
Chris (TeamB);
Back to top
Display posts from previous:   
Post new topic   Reply to topic    BorlandTalk.com Forum Index -> C++ Builder (Language C++) All times are GMT
Page 1 of 1

 
Jump to:  
You cannot post new topics in this forum
You cannot reply to topics in this forum
You cannot edit your posts in this forum
You cannot delete your posts in this forum
You cannot vote in polls in this forum


Powered by phpBB © 2001, 2006 phpBB Group
SEO toolkit © 2004-2006 webmedic.