This is the mail archive of the
gdb@sources.redhat.com
mailing list for the GDB project.
Re: bug disappears if compiled with -O0
- From: "Eli Zaretskii" <eliz at gnu dot org>
- To: Baurjan Ismagulov <ibr at ata dot cs dot hun dot edu dot tr>
- Cc: gdb at sources dot redhat dot com
- Date: Mon, 26 Jul 2004 06:53:39 +0200
- Subject: Re: bug disappears if compiled with -O0
- References: <20040725223832.GB8947@ata.cs.hun.edu.tr>
- Reply-to: Eli Zaretskii <eliz at gnu dot org>
> Date: Mon, 26 Jul 2004 00:38:33 +0200
> From: Baurjan Ismagulov <ibr@ata.cs.hun.edu.tr>
>
> 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)?
Just debug as usual, GDB can debug optimized code.
In fact, I suggest to do that always, since if you debug a program
compiled without optimizations, then ship a binary compiled with -O2,
you in effect debugged and tested a similar, but quite different code.