[gnu.gdb.bug] debugging programs from multiple source files

alexande@fillmore.cs.unc.edu (Geoffrey D. Alexander) (02/23/90)

I am trying to debug a program compiled from multiple source files.  However, I
can't seem to make gdb trace any source file except the outermost.  This can
be illustrated by the following example.  Consider the following to source
files:

=== test5a.c ==================================================================
#line 1 "test5a.c"
main() {
  int a;
  int b;
  b=1;
#include "test5b.c"
  b=0;
  exit(0);
}
===============================================================================

=== test5b.c ==================================================================
#line 1 "test5b.c"
 a=999;
 b=999;
 a=998;
 b=998;
===============================================================================

I compiled the test5a with gcc 1.37 as "gcc test5a.c -g -o test5a".  I then ran
gdb 3.5 as "gdb test5a".  I get the following results:

=== test5a.gcc.out ============================================================
GDB 3.5, Copyright (C) 1989 Free Software Foundation, Inc.
There is ABSOLUTELY NO WARRANTY for GDB; type "info warranty" for details.
GDB is free software and you are welcome to distribute copies of it
 under certain conditions; type "info copying" to see the conditions.
Reading symbol data from /tmp_mnt/auto/phi/phi2/unc/alexande/gccbug/test5a...done.
Type "help" for a list of commands.
(gdb) list 1,20
Reading in symbols for test5a.c...done.
1	#line 1 "test5a.c"
2	main() {
3	  int a;
4	  int b;
5	  b=1;
6	#include "test5b.c"
7	  b=0;
8	  exit(0);
9	}
(gdb) break main
Breakpoint 1 at 0x22a4: file test5a.c, line 4.
(gdb) run
Starting program: /tmp_mnt/auto/phi/phi2/unc/alexande/gccbug/test5a 

Bpt 1, main () (test5a.c line 4)
4	  int b;
(gdb) step
6	#include "test5b.c"
(gdb) step
7	  b=0;
(gdb) step

Program exited normally.
(gdb) quit

===============================================================================

My question is how do I trace the execution of test5b.c.

Thanks,
Geoff Alexander