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 

How can i use Code Guard?

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





PostPosted: Fri Sep 19, 2003 11:07 am    Post subject: How can i use Code Guard? Reply with quote



How can i use Code Guard?



Back to top
Andrue Cope
Guest





PostPosted: Fri Sep 19, 2003 11:16 am    Post subject: Re: How can i use Code Guard? Reply with quote



Donald,

Quote:
How can i use Code Guard?


Enable it in the project options then run your application. If it
finds anything it will let you know and will also record it in a file
with the extension .CGL

--
Andrue Cope
[Bicester, UK]


Back to top
Donald
Guest





PostPosted: Fri Sep 19, 2003 12:11 pm    Post subject: Re: How can i use Code Guard? Reply with quote



but i get during the running of the program some Address of Memory error,
but i can't see that file.
Why?


Back to top
Andrue Cope
Guest





PostPosted: Fri Sep 19, 2003 1:09 pm    Post subject: Re: How can i use Code Guard? Reply with quote

Donald,

Quote:
but i get during the running of the program some Address of Memory error,
but i can't see that file.
Why?


The basic reason is that there is no debug information for that line. This
can be because:

* The code is not part of your project (OS code, RTL code)
* The code was not compiled with debug information.
* (BCB6) The code is part of a DLL and your application has unloaded it
(this also unloads the debug information, sadly).
* A fault in the debugger (rare - but try rebuilding).

Check the stack to see what functions are listed.
--
Andrue Cope
[Bicester, UK]


Back to top
Donald
Guest





PostPosted: Fri Sep 19, 2003 1:19 pm    Post subject: Re: How can i use Code Guard? Reply with quote

the Address memory error came from pointers in Form1.



Back to top
Chris Uzdavinis (TeamB)
Guest





PostPosted: Fri Sep 19, 2003 1:45 pm    Post subject: Re: How can i use Code Guard? Reply with quote

"Donald" <customize (AT) mpt (DOT) com> writes:

Quote:
the Address memory error came from pointers in Form1.

Well, CodeGuard is good at helping you track memory leaks and some
out-of-bounds conditions. If you're dereferencing an invalid pointer,
you probably need to do some good old fashioned debugging: find when
the pointer became invalid and work backward from there until you find
what went wrong.

Or, if you would like some help fixing bugs in your code, post some of
it and maybe someone will see a mistake in it and suggest a fix.

--
Chris (TeamB);


Back to top
Andrue Cope
Guest





PostPosted: Fri Sep 19, 2003 2:03 pm    Post subject: Re: How can i use Code Guard? Reply with quote

Donald,

Quote:
the Address memory error came from pointers in Form1.


Hmm. Well here's my boilerplate reply concerning AV problems - maybe
it'll be some help:

An access violation means that your application has tried (or caused
some other module to try) to access something it isn't allowed to.
Most likely you have a corrupt or invalid pointer.

Unfortunately there's not a lot more anyone can say on the basis of
your message as it's perhaps the programming equivalent of going to a
doctor and saying "Something hurts". The important point being that
an AV can be caused by almost anything and can occur almost anywhere
in your code..or indeed in someone else's code if you lead it astray.
Worse still the symptoms of the AV can occur a long way away from the
root cause.

Run your program under the debugger and look at the code surrounding
the line where the AV is reported (the debugger will take you to the
offending line of code).

It's possible that the AV is outside of your application. In this
case the debugger will only be able to show you the assembler code
and CPU registers. If this happens bring up the stack window and
follow it down until you find one of your functions listed. Press
[RETURN] to go to that line.

The actual problem may be earlier still - consider this code:

void a( char *b )
{
strlen( b );
}

void c( char *d )
{
a( d );
}

void e()
{
c( NULL );
}

In this case the topmost function on the call stack when the AV
occurs is a() but the cause of the AV is the call to c() in function
e().

Having determined which line is causing the AV post it here and
someone will probably try and help. Please note though that AVs are
amongst the hardest errors to find. Even the most experienced
programmers can spend several days trying to track the worst cases
down and that's in their own source code. I don't guarantee that
anyone'll be able to help but we can try <s>.

--
Andrue Cope
[Bicester, UK]



Back to top
Display posts from previous:   
Post new topic   Reply to topic    BorlandTalk.com Forum Index -> C++ Builder (IDE) 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.