From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: (qmail 29323 invoked by alias); 26 Jul 2004 03:10:39 -0000 Mailing-List: contact gdb-help@sources.redhat.com; run by ezmlm Precedence: bulk List-Subscribe: List-Archive: List-Post: List-Help: , Sender: gdb-owner@sources.redhat.com Received: (qmail 29314 invoked from network); 26 Jul 2004 03:10:38 -0000 Received: from unknown (HELO granger.mail.mindspring.net) (207.69.200.148) by sourceware.org with SMTP; 26 Jul 2004 03:10:38 -0000 Received: from user-119a90a.biz.mindspring.com ([66.149.36.10] helo=berman.michael-chastain.com) by granger.mail.mindspring.net with esmtp (Exim 3.33 #1) id 1Bovsj-0003cH-00; Sun, 25 Jul 2004 23:10:29 -0400 Received: from mindspring.com (localhost [127.0.0.1]) by berman.michael-chastain.com (Postfix) with SMTP id 82D844B102; Sun, 25 Jul 2004 23:10:34 -0400 (EDT) Date: Mon, 26 Jul 2004 03:55:00 -0000 From: Michael Chastain To: ibr@ata.cs.hun.edu.tr Subject: Re: bug disappears if compiled with -O0 Cc: gdb@sources.redhat.com Message-ID: <41047629.nailSP1ZPLRF@mindspring.com> References: <20040725223832.GB8947@ata.cs.hun.edu.tr> In-Reply-To: <20040725223832.GB8947@ata.cs.hun.edu.tr> User-Agent: nail 10.8 6/28/04 MIME-Version: 1.0 Content-Type: text/plain; charset=us-ascii Content-Transfer-Encoding: 7bit X-SW-Source: 2004-07/txt/msg00315.txt.bz2 Baurjan Ismagulov wrote: > I'm trying to track down a problem in a dynamic library. However, the > bug doesn't show up if the code is compiled with -O0 (it is normally > compiled with -O2). Any pointers or tips on how to proceed (except > printf)? gdb can debug code generated with gcc -g -O2. However, when debugging optimized code, things like "next" appear to skip around, and variables sometimes don't contain the values that you think that they should. You could try gcc 3.4.1. Just use "--prefix" to build it and you can locate it in its own directory, so you can safely experiment with different compilers. You didn't mention what language your library is written in. If the bug truly is a code generation bug, then you will need to read assembly language to isolate the bug. Also, adding "printf" (or other function calls) in the middle of a function can make the bug disappear, because the results of optimization change when you invade with a function call. Michael C