Mail Archives: djgpp/2013/06/09/01:47:54
On 06/08/2013 07:57 PM, Juan Manuel Guerrero wrote:
> Please inspect the small program below:
>
> #include <stdio.h>
>
> void f(const int i)
> {
> printf("a=%d\n", i);
> }
>
> int main(void)
> {
> int a = 1;
> f(a);
> return a;
> }
>
>
> I have compiled it using gcc-4.8.1 with the following command:
> gcc -Wall -g2 -O0 a.c
> When I try to use gdb to step through the code I get
> the following error message:
>
> GNU gdb (GDB) 7.6
> Copyright (C) 2013 Free Software Foundation, Inc.
> License GPLv3+: GNU GPL version 3 or later <http://gnu.org/licenses/gpl.html>
> This is free software: you are free to change and redistribute it.
> There is NO WARRANTY, to the extent permitted by law. Type "show copying"
> and "show warranty" for details.
> This GDB was configured as "--host=i786-pc-msdosdjgpp --target=djgpp".
> For bug reporting instructions, please see:
> <http://www.gnu.org/software/gdb/bugs/>...
> Reading symbols from c:/tmp/a.exe...done.
> (gdb) b main
> Breakpoint 1 at 0x1eba: file 1.c, line 10.
> (gdb) r
> Starting program: c:/tmp/a.exe
>
> Breakpoint 1, main () at 1.c:10
> 10 int a = 1;
> (gdb) s
> 11 f(a);
> (gdb)
> f (i=<error reading variable: can't compute CFA for this frame>) at 1.c:5
> 5 printf("a=%d\n", i);
> (gdb) p i
> can't compute CFA for this frame
> (gdb)
>
>
> The important issue is to try to step into a function.
> As long as I do not step into a function every thing works OK.
> The same happens if I use gcc480. If I use gcc473 every thing
> works OK. The program itself runs flawlessly.
> Am I missing something? Is the coff/dwarf support in gcc-4.8.N
> brocken?
>
> If more info is needed, please tell.
>
I can reproduce the problem.
1) it depends on optimization level for DWARF4 and DWARF3. I have this
problem with -gdwarf-3 and -gdwarf-4 and -O0 and -O1,
but not with -O2 and -O3.
2) it does not seem to happen when -gdwarf-2 is being used
I do not know which additional optimization option present with -O2 but bit
-O1 causes the difference.
Noticed one more problem: .debug_macro section is not present in
binutils linker script. I tried to add by editing linker script and
specifying it with -Wl,-T,script_name . Check with additional -Wl,--verbose
shows that modified script is actually being used. I do not however see
.debug_macro section in resulting exe file even if it is present in .o file.
This second problem is perhaps however unrelated
This problem with handling DWARF debugging info seems to be fixed in current
development version of binutils by using same script fragment in all places
. $srcdir/scripttempl/DWARF.sc
Taking linker script from current development version of binutils is perhaps
the first thing to try
Andris
- Raw text -