cvs.gedasymbols.org/archives/browse.cgi   search  
Mail Archives: djgpp/2013/08/13/16:25:01

X-Authentication-Warning: delorie.com: mail set sender to djgpp-bounces using -f
X-Recipient: djgpp AT delorie DOT com
Message-ID: <520A965C.400@gmx.de>
Date: Tue, 13 Aug 2013 22:26:04 +0200
From: Juan Manuel Guerrero <juan DOT guerrero AT gmx DOT de>
User-Agent: Mozilla/5.0 (X11; Linux x86_64; rv:16.0) Gecko/20121025 Thunderbird/16.0.2
MIME-Version: 1.0
To: djgpp AT delorie DOT com
CC: Andris Pavenis <andris DOT pavenis AT iki DOT fi>
Subject: Re: Programs compiled with gcc481 cannot be debugged with gdb.
References: <51B36263 DOT 6080309 AT gmx DOT de> <51B41437 DOT 6070003 AT iki DOT fi> <52093221 DOT 9010206 AT iki DOT fi>
In-Reply-To: <52093221.9010206@iki.fi>
X-Provags-ID: V03:K0:iZtFYHdSbQ3xcoj/rigYSWPQyG1yO9S9nnK1eEYTs4D7EvgWFg9
TVoys75rnn8v8hpMI+iOOKFFAYL1Kr4HZI/UHPyjFlJwt+KC4cr0YXyaTvQsaIX3tZCIBx5
3MMmJY9oT2tLIhUQe9WdfzckDXu4WqRfIGHMJi8wydmt0GsLUAY+6DZJicGICPaSyWZlLn9
Fo5L4zcWI5JsDqc4DKdMw==
Reply-To: djgpp AT delorie DOT com

Am 12.08.2013 21:06, schrieb Andris Pavenis:
> On 06/09/2013 08:35 AM, Andris Pavenis wrote:
>> 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.
>
> The reason is perhaps broken DWARF3 and DWARF4 support for DJGPP. According to
> http://gcc.gnu.org/gcc-4.8/changes.html:
>
> DWARF4 is now the default when generating DWARF debug information. When -g is used on a platform that uses DWARF debugging information, GCC will now default to -gdwarf-4 -fno-debug-types-section.
> GDB 7.5, Valgrind 3.8.0 and elfutils 0.154 debug information consumers support DWARF4 by default. Before GCC 4.8 the default version used was DWARF2. To make GCC 4.8 generate an older DWARF version use -g together with -gdwarf-2 or -gdwarf-3. The default for Darwin and VxWorks is still -gdwarf-2 -gstrict-dwarf.
>
> Andris
>

Yes, this seems to be the reason.  I was able to step through the code compiled with
gcc481 if I use -gdwarf-2 flag.  Now , the question arises, shall djgpp also use DWARF4?
How much work it will be to implement this?

Regards,
Juan M. Guerrero

- Raw text -


  webmaster     delorie software   privacy  
  Copyright © 2019   by DJ Delorie     Updated Jul 2019