Groups | Search | Server Info | Keyboard shortcuts | Login | Register [http] [https] [nntp] [nntps]


Groups > comp.lang.c++ > #2908 > unrolled thread

program that ain't crash inside debugger

Started byconsole kid <sandundhammikaperera@gmail.com>
First post2011-03-31 05:20 -0700
Last post2011-03-31 20:21 +0200
Articles 7 — 6 participants

Back to article view | Back to comp.lang.c++


Contents

  program that ain't crash inside debugger console kid <sandundhammikaperera@gmail.com> - 2011-03-31 05:20 -0700
    Re: program that ain't crash inside debugger Puppet_Sock <puppet_sock@hotmail.com> - 2011-03-31 07:10 -0700
    Re: program that ain't crash inside debugger "Default User" <defaultuserbr@yahoo.com> - 2011-03-31 12:26 -0500
    Re: program that ain't crash inside debugger console kid <sandundhammikaperera@gmail.com> - 2011-03-31 10:51 -0700
      Re: program that ain't crash inside debugger Victor Bazarov <v.bazarov@comcast.invalid> - 2011-03-31 14:04 -0400
      Re: program that ain't crash inside debugger drew@furrfu.invalid (Drew Lawson) - 2011-03-31 18:10 +0000
      Re: program that ain't crash inside debugger "Balog Pal" <pasa@lib.hu> - 2011-03-31 20:21 +0200

#2908 — program that ain't crash inside debugger

Fromconsole kid <sandundhammikaperera@gmail.com>
Date2011-03-31 05:20 -0700
Subjectprogram that ain't crash inside debugger
Message-ID<67b37922-93e3-45b9-bc88-0a5990041cc2@n2g2000prj.googlegroups.com>
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.

[toc] | [next] | [standalone]


#2918

FromPuppet_Sock <puppet_sock@hotmail.com>
Date2011-03-31 07:10 -0700
Message-ID<83619453-3270-4a40-969d-aa142e57c543@e9g2000vbk.googlegroups.com>
In reply to#2908
On Mar 31, 8:20 am, console kid <sandundhammikaper...@gmail.com>
wrote:
> 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

[toc] | [prev] | [next] | [standalone]


#2931

From"Default User" <defaultuserbr@yahoo.com>
Date2011-03-31 12:26 -0500
Message-ID<8vjrq8Fs1bU1@mid.individual.net>
In reply to#2908
"console kid" <sandundhammikaperera@gmail.com> wrote in message 
news:67b37922-93e3-45b9-bc88-0a5990041cc2@n2g2000prj.googlegroups.com...
> 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

[toc] | [prev] | [next] | [standalone]


#2935

Fromconsole kid <sandundhammikaperera@gmail.com>
Date2011-03-31 10:51 -0700
Message-ID<73ae9c50-8e26-4d71-9ca0-f825a6ea411e@a19g2000prj.googlegroups.com>
In reply to#2908
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?

[toc] | [prev] | [next] | [standalone]


#2936

FromVictor Bazarov <v.bazarov@comcast.invalid>
Date2011-03-31 14:04 -0400
Message-ID<in2fmi$rjp$1@dont-email.me>
In reply to#2935
On 3/31/2011 1:51 PM, console kid wrote:
> 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
-- 
I do not respond to top-posted replies, please don't ask

[toc] | [prev] | [next] | [standalone]


#2937

Fromdrew@furrfu.invalid (Drew Lawson)
Date2011-03-31 18:10 +0000
Message-ID<in2g3i$9cf$1@raid.furrfu.com>
In reply to#2935
In article <73ae9c50-8e26-4d71-9ca0-f825a6ea411e@a19g2000prj.googlegroups.com>
	console kid <sandundhammikaperera@gmail.com> writes:
>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.

-- 
Drew Lawson            |  It's not enough to be alive
                       |  when your future's been deferred

[toc] | [prev] | [next] | [standalone]


#2938

From"Balog Pal" <pasa@lib.hu>
Date2011-03-31 20:21 +0200
Message-ID<in2gma$2p43$1@news.ett.com.ua>
In reply to#2935
"console kid" <sandundhammikaperera@gmail.com>
> 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

[toc] | [prev] | [standalone]


Back to top | Article view | comp.lang.c++


csiph-web