delorie.com/archives/browse.cgi   search  
Mail Archives: djgpp/2015/05/24/12:10:46

X-Authentication-Warning: delorie.com: mail set sender to djgpp-bounces using -f
X-Recipient: djgpp AT delorie DOT com
Date: Sun, 24 May 2015 19:10:25 +0300
From: "Eli Zaretskii (eliz AT gnu DOT org)" <djgpp AT delorie DOT com>
Subject: Re: New GDB versions and DJGPP (Was: ANNOUNCE: DJGPP 2.05 beta 1)
In-reply-to: <5561F262.2010001@gmx.de>
X-012-Sender: halo1 AT inter DOT net DOT il
To: djgpp AT delorie DOT com
Message-id: <83wpzyyn0u.fsf@gnu.org>
References: <201505042003 DOT t44K3odg011007 AT delorie DOT com> <555829A6 DOT 8010502 AT iki DOT fi> <CAA2C=vA73qPvoDFytp3FeW6bCD1-XuGsFFoDinoKn2KYY1fkow AT mail DOT gmail DOT com> <555870E8 DOT 7040302 AT iki DOT fi> <CAA2C=vDhD6BJj89o1i0FRd2U0H4bTpGGN4zH6qs7FJKxzqhuQg AT mail DOT gmail DOT com> <201505180114 DOT t4I1EiaX017288 AT envy DOT delorie DOT com> <CAA2C=vCyrQ_+Yq6XsRD-UO4r=j9WoGGiXoqQFrkbiEQpzX+=MA AT mail DOT gmail DOT com> <201505181216 DOT t4ICGaKO014123 AT envy DOT delorie DOT com> <CAA2C=vCk5MY74z+HNVzzdLByg71Y_9ObK-1jPxJ_KF8eqRDZMQ AT mail DOT gmail DOT com> <83zj52dkns DOT fsf AT gnu DOT org> <CAA2C=vAPcN+MKC_2tcZqVmo9gvF2Cxdo+K+-qfKaNrQuCkMnEw AT mail DOT gmail DOT com> <555A0DD5 DOT 1010607 AT iki DOT fi> <83r3qdemuj DOT fsf AT gnu DOT org> <555AADE6 DOT 3030905 AT iki DOT f> <83lhgkehn4 DOT fsf AT gnu DOT org> <201505191714 DOT t4JHEr0B010992 AT envy DOT delorie DOT com> <83vbfo7a74 DOT fsf AT gnu DOT org> <201505191729 DOT t4JHTIRe011541 AT envy DOT delorie DOT com> <83sias77km DOT fsf AT gnu DOT org> <555CFF9C DOT 1050301 AT gmx DOT de> <555D5E30 DOT 7020107 AT iki DOT fi> <83vbfl6hs9 DOT fsf AT gnu DOT org>
<55618917.7@[87.69.4.28]> <83d21q1g6n DOT fsf AT gnu DOT org> <5561C8A0 DOT 2010401 AT gmx DOT de> <5561F262 DOT 2010001 AT gmx DOT de>
Reply-To: djgpp AT delorie DOT com
Errors-To: nobody AT delorie DOT com
X-Mailing-List: djgpp AT delorie DOT com
X-Unsubscribes-To: listserv AT delorie DOT com

> Date: Sun, 24 May 2015 17:46:42 +0200
> From: "Juan Manuel Guerrero (juan DOT guerrero AT gmx DOT de)" <djgpp AT delorie DOT com>
> 
> The following test program has been compiled using -O0 -ggdb:

What does -ggdb mean with the DJGPP build of GCC 4.9.2?  It is better
to use an explicit debug info option (see below).

What does GDB say when you step into 'main' and type

 (gdb) info source

One of the things it should announce is the type of debug info it
found in the program.

In any case, I suggest to try this experiment with all 3 debug info
types, COFF, stabs, and DWARF.  To that end, instead of -ggdb, please
use "-gcoff -g3", "-gstabs -g3", and "-gdwarf-2 -g3", respectively.
(You could also try -gdwarf-3 and -gdwarf-4, not sure if the DJGPP
build of GCC supports that.)

> If I step into printf() and I issue the bt command I get the following
> output:
> 
> (gdb) r
> Starting program: c:/tmp/5/a.exe
> 
> Breakpoint 1, main () at a.c:15
> 15        int written = 0;
> (gdb) s
> 17        written = print("qwertz");
> (gdb)
> print (message=0x1f35 <print+33> "qwertz") at a.c:8
> 8         written = printf("%s\n", message);
> (gdb)
> printf (fmt=0x1f10 <_crt0_init_mcount+10> "%s\n") at printf.c:10
> 10      {
> (gdb)
> printf (fmt=0x1f10 <_crt0_init_mcount+10> "%s\n") at printf.c:14
> 14        va_start(args, fmt);
> (gdb) n
> 15        len = _doprnt(fmt, args, stdout);
> (gdb) bt
> #0  printf (fmt=0x1f10 <_crt0_init_mcount+10> "%s\n") at printf.c:15
> #1  0x00003316 in nofpsig () at npxsetup.c:51
> #2  0x00000006 in ?? ()
> #3  0x00001f2a in print (message=0x1f35 <print+33> "qwertz") at a.c:8
> #4  0x00001f61 in main () at a.c:17
> (gdb)
> 
> The remarkable issue is that although I used the n command to avoid stepping
> into _doprnt() gdb behaves as if the s command had been used.

This backtrace is obviously bogus: the 0x00000006 address cannot be an
address of any function, and nofpsig is not called by 'print'.

Can you try compiling the program with an older compiler, and try
debugging the program compiled by GCC 4.9.2 with a pre-7.7 version of
GDB?  It's important to understand if this is a GCC bug or GDB bug.

- Raw text -


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