program that ain't crash inside debugger

Discussion in 'C++' started by console kid, Mar 31, 2011.

  1. console kid

    console kid Guest

    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.
     
    console kid, Mar 31, 2011
    #1
    1. Advertising

  2. console kid

    Puppet_Sock Guest

    On Mar 31, 8:20 am, console kid <>
    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
     
    Puppet_Sock, Mar 31, 2011
    #2
    1. Advertising

  3. console kid

    Default User Guest

    "console kid" <> wrote in message
    news:...
    > 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
     
    Default User, Mar 31, 2011
    #3
  4. console kid

    console kid Guest

    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?
     
    console kid, Mar 31, 2011
    #4
  5. 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
     
    Victor Bazarov, Mar 31, 2011
    #5
  6. console kid

    Drew Lawson Guest

    In article <>
    console kid <> 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
     
    Drew Lawson, Mar 31, 2011
    #6
  7. console kid

    Balog Pal Guest

    "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?


    run it with valgrind
     
    Balog Pal, Mar 31, 2011
    #7
    1. Advertising

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

It takes just 2 minutes to sign up (and it's free!). Just click the sign up button to choose a username and then you can ask your own questions on the forum.
Similar Threads
  1. DeMarcus

    Ain't JDialog tricky?

    DeMarcus, Nov 24, 2004, in forum: Java
    Replies:
    5
    Views:
    4,066
    DeMarcus
    Nov 24, 2004
  2. Betty

    ain't java grand ?

    Betty, May 24, 2005, in forum: Java
    Replies:
    4
    Views:
    435
    Joona I Palaste
    May 26, 2005
  3. Bulba!

    Speed ain't bad

    Bulba!, Dec 31, 2004, in forum: Python
    Replies:
    14
    Views:
    588
    Anders J. Munch
    Jan 4, 2005
  4. Wiseman
    Replies:
    13
    Views:
    627
    John Machin
    May 8, 2007
  5. Trans
    Replies:
    3
    Views:
    135
    Trans
    Oct 29, 2007
Loading...

Share This Page