🚀 go-pugleaf

RetroBBS NetNews Server

Inspired by RockSolid Light RIP Retro Guy

Article View: gnu.gcc.bug
Article #2824

Problem with #line and dbx

#2824
From: Geoffrey D. Alexander
Date: Thu, 11 Jan 1990 17:53
89 lines
2829 bytes
I have hit a problem debugging a a muti-source file program under dbx.  I use
CWEB which can take multiple source file a create a single .c file.  It uses
#line to specify which file the code came from.  The problem can be illustrated
by the following short example.  First two CWEB files:

====test2.cweb ================================================================
@* TEST2.

This is a test.

@c
main() {
  int a;
  a=5;
@i test2a.cweb
  exit(0);
}
===============================================================================

====test2a.cweb================================================================
a=6;
===============================================================================

CWEB generates the following C code.

====test2.c====================================================================
/*1:*/
#line 5 "test2.cweb"

main(){
int a;
a= 5;
#line 1 "test2a.cweb"
a= 6;
#line 10 "test2.cweb"
exit(0);
}/*:1*/
===============================================================================

Now, I compile the code with cc by

  cc test2.c -g -o test2

and run dbx with the following input:

stop in main
run
step
where

I get the following output:

Reading symbolic information...
Read 42 symbols
(2) stop in main
Running: test2 
stopped in main at line 8 in file "/test2.cweb"
    8     a=5;
stopped in main at line 1 in file "/test2a.cweb"
    1   a=6;
main(0x1, 0xefffcb8, 0xefffcc0), line 1 in "test2a.cweb"

Note that where statement gives line 1 in "test2a.cweb" which is correct.  Now,
I compile the code with gcc by

  gcc test2.c -g -o test2

and run dbx with the following same input.  I get the following output:

Reading symbolic information...
Read 54 symbols
(2) stop in main
Running: test2 
stopped in main at line 8 in file "/test2.cweb"
    8     a=5;
stopped in main at line 1 in file "/test2.cweb"
    1   @* TEST2.
main(0x1, 0xefffcb8, 0xefffcc0), line 1 in "test2.cweb"

Note that the where statement gives line 1 in "test2.cweb" which is incorrect.
Further testing shows that gcc is not correctly picking up the file name in
the #line statement.

Note that I am running gcc version 1.36 under SunOS Release 4.0.3 on a
Sun-3/60N.  Is this a valid bug?  If so, how do I get a fix?  If more
information is needed, please let me know.

Thanks,
Geoff Alexander
Technical Details
Message-ID: <9001111753.AA12812@dopey.cs.unc.edu>
Path: arc1-ca.pugleaf.net!utzoo!utgpu!jarvis.csri.toronto.edu!clyde.concordia.ca!uunet!bu.edu!bu-cs!snorkelwacker!tut.cis.ohio-state.edu!CS.UNC.EDU!alexande

Show Full Headers
Complete Article Headers
Path: arc1-ca.pugleaf.net!utzoo!utgpu!jarvis.csri.toronto.edu!clyde.concordia.ca!uunet!bu.edu!bu-cs!snorkelwacker!tut.cis.ohio-state.edu!CS.UNC.EDU!alexande
From: alexande@CS.UNC.EDU (Geoffrey D. Alexander)
Newsgroups: gnu.gcc.bug
Subject: Problem with #line and dbx
Message-ID: <9001111753.AA12812@dopey.cs.unc.edu>
Date: 11 Jan 90 17:53:08 GMT
Sender: daemon@tut.cis.ohio-state.edu
Distribution: gnu
Organization: GNUs Not Usenet
Lines: 89