Re: gdb (linux) "print" command clears memory corruption - so how do I find my bug?

From: Måns Rullgård (mru_at_kth.se)
Date: 12/04/03

  • Next message: David Schwartz: "Re: UDP socket close problem"
    Date: Thu, 04 Dec 2003 12:22:54 +0100
    
    

    kreuiter@netscape.net (Gavin Kreuiter) writes:

    > I am looking for some advice on how to debug a program when the
    > debugger "print" command actually clears the corruption. This is not
    > the usual non-initialised memory problem, because the program aborts
    > with a SIGBUS inside the debugger as well. But when I use the print
    > command inside the debugger, the program completes normally.

    You have a Schrödinger bug, i.e. one that changes when you observe it.
    Since you are running Linux, I'd suggest you try out valgrind,
    http://valgrind.kde.org/. It's a debugger that will usually catch
    most kinds of memory related bugs.

    > (I orignally posted this to comp.lang.c, but suspect that I might have
    > chosen the wrong newsgroup. Perhaps someone can also advise me how I
    > determine which group to post a query to; is there a FAQ on choosing
    > newsgroups?)

    Browse the list of groups and find those that look appropriate to you.
    Then fetch the FAQ for those groups, and see if it looks right. It
    might even answer your question.

    -- 
    Måns Rullgård
    mru@kth.se
    

  • Next message: David Schwartz: "Re: UDP socket close problem"