This is the mail archive of the
gdb@sourceware.org
mailing list for the GDB project.
Re: Debugging gnugcc optimized code (O1 or O3) on ar,
- From: Paul Pluzhnikov <ppluzhnikov at google dot com>
- To: Naval Saini <navalnovel at gmail dot com>
- Cc: gdb at sourceware dot org
- Date: Wed, 7 Jan 2009 08:43:34 -0800
- Subject: Re: Debugging gnugcc optimized code (O1 or O3) on ar,
- References: <d8dd82df0901062243n28ee51e2wefb49c322f5ec948@mail.gmail.com>
On Tue, Jan 6, 2009 at 10:43 PM, Naval Saini <navalnovel@gmail.com> wrote:
> Hi:
>
> We have seen that a gdb issue when debugging an optimized code (-O1 or
> -O3), compiled by gnugcc toolchain.
So do you have a question, a suggestion, or are you just letting
us know that GDB doesn't work for you and therefore we should
refund the money you paid us for it? :-)
> Basically, gdb is unable to keep a track of local variables when the
> code is sufficiently complex (depth of function calls is decently
> big). At times, a variable can go out of scope without gdb knowing
> about it OR it can start displaying incorrect values of the variables
> (indicating it is unaware of which variable is present in which
> register).
Yes, debugging sufficiently optimized code is hard, and GCC
often doesn't put correct debug info out. There is some work
on GCC to fix some of these problems; you may get better results
with gcc-4.3. Then again, it may also get worse -- there are some
new optimizations, and new "incorrect debug info" bugs as well.
If you want the situation to improve, rebuild GDB with '-g' and
start hacking, or at least write small test cases, and file bug
reports.
> Our sw configuration is following :-
> 1. gnugcc 4.1.1 toolchain - cross-compiling code for arm V6 (or arm 11)
> 2. gdb-6.7.1
> 3. OS - Linux , Library used - uclibc
>
> Regards,
> Naval
>
Cheers,
--
Paul Pluzhnikov