public inbox for gdb@sourceware.org
 help / color / mirror / Atom feed
From: "D.Venkatasubramanian, Noida" <dvenkat@noida.hcltech.com>
To: Eli Zaretskii <eliz@elta.co.il>, 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	[thread overview]
Message-ID: <E04CF3F88ACBD5119EFE00508BBB212109262AB8@exch-01.noida.hcltech.com> (raw)



>-----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 <robertso@somerset.sps.mot.com>
>> > 
>> > 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.
>

             reply	other threads:[~2003-05-08  5:16 UTC|newest]

Thread overview: 7+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2003-05-08  5:16 D.Venkatasubramanian, Noida [this message]
  -- strict thread matches above, loose matches on Subject: below --
2003-05-08 16:07 Eli Zaretskii
2003-05-09 10:56 ` Felix Lee
2003-05-05 11:32 Huaxia Zhao
2003-05-06  8:56 ` D.Venkatasubramanian, Noida
2003-05-06 12:52   ` Jim Robertson
2003-05-06 17:17     ` Eli Zaretskii

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=E04CF3F88ACBD5119EFE00508BBB212109262AB8@exch-01.noida.hcltech.com \
    --to=dvenkat@noida.hcltech.com \
    --cc=delzhao_linux@yahoo.com \
    --cc=eliz@elta.co.il \
    --cc=gdb@sources.redhat.com \
    --cc=robertso@somerset.sps.mot.com \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for read-only IMAP folder(s) and NNTP newsgroup(s).