This is the mail archive of the gdb-prs@sources.redhat.com mailing list for the GDB project.


Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]
Other format: [Raw text]

Re: gdb/346: gdb confused about line numbers


The following reply was made to PR gdb/346; it has been noted by GNATS.

From: Daniel Jacobowitz <drow@mvista.com>
To: robs@cruzio.com
Cc: gdb-gnats@sources.redhat.com
Subject: Re: gdb/346: gdb confused about line numbers
Date: Sat, 9 Feb 2002 21:42:35 -0500

 On Sun, Feb 10, 2002 at 12:48:12AM -0000, robs@cruzio.com wrote:
 > 
 > >Number:         346
 > >Category:       gdb
 > >Synopsis:       gdb confused about line numbers
 > >Confidential:   no
 > >Severity:       serious
 > >Priority:       medium
 > >Responsible:    unassigned
 > >State:          open
 > >Class:          sw-bug
 > >Submitter-Id:   net
 > >Arrival-Date:   Sat Feb 09 16:58:01 PST 2002
 > >Closed-Date:
 > >Last-Modified:
 > >Originator:     Rob Stevens
 > >Release:        unknown-1.0
 > >Organization:
 > >Environment:
 > RedHat 7.2
 > >Description:
 > The debugger seems to be hopeless confused about the line numbers in the source code.
 > Here is an example:
 > 
 > stepping with "next":
 > 
 > 149         int cktype=CHECKTIM,errors=0,i, mod, bangf, ownf, safef, 
 > diff, nsys;(gdb)
 > 159         lbl0();
 > (gdb)
 > 160         printf("setrecv: process received files ...\n");
 > (gdb)
 > 163         for(argv++; --argc > 0 && argv[0][0]=='-'; argv++) {
 > (gdb)
 > 160         printf("setrecv: process received files ...\n");
 > (gdb)
 > setrecv: process received files ...
 > 163         for(argv++; --argc > 0 && argv[0][0]=='-'; argv++) {
 > 
 > The printf statement at line 160 is hit twice (according 
 > to gdb) with no branch to make that happen. The first report at line 160
 > is bogus because the program being debugged doesn't print anything.
 > Only the second line160 trace is correct.
 > 
 > This behavior isn't confined to a single executable. I have replicated on others. It seems to be connected with the presence of an open brace, '{', which is not on a line by itself
 > 
 > Details:
 > gdb-5.1.1 build from sources:
 >         configure
 >     .    ...
 >         system reported as  i686-pc-linux-gnu
 > compiled with gcc-2.96
 > OS is RedHat Linux 7.2   (Linux kernel 2.4.7)
 > 
 > Also occurred on gdb-5.1.0 installed as binary.
 
 Was the binary you are debugging built with optimization?  From the
 trace, I'd guess -O2.  If so, this is nothing surprising.  The code for
 the for loop has been partly merged with the argument setup for the
 call to printf.
 
 -- 
 Daniel Jacobowitz                           Carnegie Mellon University
 MontaVista Software                         Debian GNU/Linux Developer


Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]