program that ain't crash inside debugger

C

console kid

Hi all, I'm using GNU G++ for my development.
I have write a simple test case.The program runs and exited normally
inside
the debugger (GDB) but when I tries to run it without debugger it
crashes.
I can't pinpoint the error.

Any new idea how to overcome this problem? Any debugging tip is fine.
 
P

Puppet_Sock

Hi all, I'm using GNU G++ for my development.
I have write a simple test case.The program runs and exited normally
inside
the debugger (GDB) but when I tries to run it without debugger it
crashes.
I can't pinpoint the error.

Any new idea how to overcome this problem? Any debugging tip is fine.

Your issue is not directly a language question.
You would be likely to get more and better help
if you went to a news group that had to do with
your compiler, and maybe your operating system
and hardware.

However: Crashes of this sort have generic causes.
Look for things like:
- running off the end of an array or block of
allocated memory, front or back
- using an invalid pointer such as a pointer
to memory that has been deallocated
- bad casts, especially of pointers
- off-by-one errors where you reference the
next or previous item in a series when that
item does not exist or does not behave as you want
- referencing resources (of any kind) before they
are allocated and initialized, or after they
are deallocated
- using a variable's content before it is initialized

There are a few more, but I've only had one
cup of coffee this AM.

And there are generic solutions. For example,
reduce your use of arrays by switching to the
standard library container classes.

For long term improvement, get books like
Effective C++ by Scott Meyers.
Socks
 
D

Default User

console kid said:
Hi all, I'm using GNU G++ for my development.
I have write a simple test case.The program runs and exited normally
inside
the debugger (GDB) but when I tries to run it without debugger it
crashes.
I can't pinpoint the error.

Any new idea how to overcome this problem? Any debugging tip is fine.

Frequently, debugger runs will do things like initialize automatic
variables. I'd look for one that was used without intializing.



Brian
 
C

console kid

any idea how could I pinpoint the error?
It's silent inside the debugger and it crashes when I
laugh it independently.How can I debug this?

Any tools that I can use like ollydebug or something else?
 
V

Victor Bazarov

any idea how could I pinpoint the error?
It's silent inside the debugger and it crashes when I
laugh it independently.How can I debug this?

How about adding some debug printouts? In the old days that *was* the
debugger... And yes, that can mess up your program too by changing the
way the code is optimized.

V
 
D

Drew Lawson

any idea how could I pinpoint the error?

I seem to recall that some environments support ways to force any
crash to leave a core dump file. If you can do that, then you can
debug the post-crash state of the program.

Otherwise, the details of the crash could point somewhere. How do
you know it crashes? Are there any details (addresses, etc.) in
the message?

Still, all of this also would be more meaningful in a group specific
to your toolset and/or OS.
 
B

Balog Pal

console kid said:
any idea how could I pinpoint the error?
It's silent inside the debugger and it crashes when I
laugh it independently.How can I debug this?

Any tools that I can use like ollydebug or something else?

run it with valgrind
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Members online

No members online now.

Forum statistics

Threads
473,769
Messages
2,569,580
Members
45,054
Latest member
TrimKetoBoost

Latest Threads

Top