alexande@CS.UNC.EDU (Geoffrey D. Alexander) (01/12/90)
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