From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: (qmail 10788 invoked by alias); 8 May 2003 05:16:05 -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 10776 invoked from network); 8 May 2003 05:16:04 -0000 Received: from unknown (HELO ngate.noida.hcltech.com) (202.54.110.230) by sources.redhat.com with SMTP; 8 May 2003 05:16:04 -0000 Received: from exch-01.noida.hcltech.com (exch-01 [204.160.254.29]) by ngate.noida.hcltech.com (8.9.3/8.9.3) with ESMTP id KAA28870; Thu, 8 May 2003 10:41:18 +0530 Received: by exch-01.noida.hcltech.com with Internet Mail Service (5.5.2656.59) id ; Thu, 8 May 2003 10:37:28 +0530 Message-ID: From: "D.Venkatasubramanian, Noida" To: Eli Zaretskii , robertso@somerset.sps.mot.com Cc: delzhao_linux@yahoo.com, gdb@sources.redhat.com Subject: RE: Why GCC/ GDB ignore a normal C statement? Date: Thu, 08 May 2003 05:16:00 -0000 MIME-Version: 1.0 Content-Type: text/plain; charset="iso-8859-1" X-SW-Source: 2003-05/txt/msg00103.txt.bz2 >-----Original Message----- >From: Eli Zaretskii [mailto:eliz@elta.co.il] >Sent: Tuesday, May 06, 2003 10:43 PM >To: robertso@somerset.sps.mot.com >Cc: D.Venkatasubramanian, Noida; delzhao_linux@yahoo.com; >gdb@sources.redhat.com >Subject: Re: Why GCC/ GDB ignore a normal C statement? > > >> Date: Tue, 6 May 2003 07:51:59 -0500 >> From: Jim Robertson >> > >> > Optimization should be used only for the final >> > release. This is a common mistake made by new users. >> >> This may be getting (a little) off topic, but I disagree with the >> above. Only turning on optimizations for a "final release" can have >> unexpected consequences. Optimizations have a way of uncovering bugs >> that go undetected in non-optimized code. At a minimum, >testing should >> be done with optimizations. Preferably, all development is done with >> optimizations. > >I certainly second that. I do all my debugging builds with the full >set of optimizations options. Modern debuggers no longer require you >to choose between -g and -O; GDB certainly doesn't. > >A program compiled with and without optimizations are actually twio >very different programs. So all of your test runs actually test a >program that is different from what you are going to ship. > I never said that optimizations should not be turned on during testing, just that, during development, when you are uncovering logical errors and want to set breakpoints, it is easier without optimizations. Debugging with all optimizations can result in abnormal jumps, as is expected due to instruction scheduling. Definitely, thorough testing should be done with all optimizations turned on, before the product is released. >Someone wise once compared testing an unoptimized program, then >turning on optimization for the release to learning to swim in shallow >waters with all the safety gear on, then throwing away that gear when >you first plunge into the deep. >