🚀 go-pugleaf

RetroBBS NetNews Server

Inspired by RockSolid Light RIP Retro Guy

Article View: gnu.gdb.bug
Article #859

debugging programs from multiple source files

#859
From: Geoffrey D. Alexander
Date: Fri, 23 Feb 1990 15:45
68 lines
2414 bytes
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
Technical Details
Message-ID: <12215@thorin.cs.unc.edu>
Path: arc1-ca.pugleaf.net!utzoo!utgpu!jarvis.csri.toronto.edu!cs.utexas.edu!swrinde!zaphod.mps.ohio-state.edu!usc!elroy.jpl.nasa.gov!decwrl!shelby!mcnc!thorin!fillmore!alexande

Show Full Headers
Complete Article Headers
Path: arc1-ca.pugleaf.net!utzoo!utgpu!jarvis.csri.toronto.edu!cs.utexas.edu!swrinde!zaphod.mps.ohio-state.edu!usc!elroy.jpl.nasa.gov!decwrl!shelby!mcnc!thorin!fillmore!alexande
From: alexande@fillmore.cs.unc.edu (Geoffrey D. Alexander)
Newsgroups: gnu.gdb.bug
Subject: debugging programs from multiple source files
Message-ID: <12215@thorin.cs.unc.edu>
Date: 23 Feb 90 15:45:53 GMT
Sender: news@thorin.cs.unc.edu
Lines: 68