From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: (qmail 16172 invoked by alias); 25 Apr 2003 08:56:01 -0000 Mailing-List: contact gcc-prs-help@gcc.gnu.org; run by ezmlm Precedence: bulk List-Archive: List-Post: List-Help: Sender: gcc-prs-owner@gcc.gnu.org Received: (qmail 16158 invoked by uid 71); 25 Apr 2003 08:56:00 -0000 Date: Fri, 25 Apr 2003 08:56:00 -0000 Message-ID: <20030425085600.16156.qmail@sources.redhat.com> To: nobody@gcc.gnu.org Cc: gcc-prs@gcc.gnu.org, From: Steve Evans Subject: Re: debug/10466: Can't debug the first function in a C file that is included in another C file Reply-To: Steve Evans X-SW-Source: 2003-04/txt/msg01083.txt.bz2 List-Id: The following reply was made to PR debug/10466; it has been noted by GNATS. From: Steve Evans To: drow@sources.redhat.com, chrisha@zuken.co.uk, gcc-bugs@gcc.gnu.org, gcc-prs@gcc.gnu.org, marcusb@zuken.co.uk, nobody@gcc.gnu.org, stevee@zuken.co.uk, gcc-gnats@gcc.gnu.org Cc: Subject: Re: debug/10466: Can't debug the first function in a C file that is included in another C file Date: 25 Apr 2003 09:53:43 +0100 --=-=-= -----BEGIN PGP SIGNED MESSAGE----- Hash: SHA1 On 25 Apr 2003, drow@sources.redhat.com wrote: >Synopsis: Can't debug the first function in a C file that is included >in another C file > >State-Changed-From-To: open->feedback >State-Changed-By: drow >State-Changed-When: Fri Apr 25 02:18:24 2003 >State-Changed-Why: >Please see the bug reporting instructions on gcc.gnu.org. >Could you supply a small testcase? > >http://gcc.gnu.org/cgi-bin/gnatsweb.pl?cmd=view%20audit-trail&database=gcc&pr=10466 Ok. Enclosed are two files, foo.c and bar.c. Compile foo.c, which #includes "bar.c" as: gcc -f -fPIC foo.c Note that since reporting the bug I have discovered that it only occurs when compiled with -fPIC. I attempted to add this information to the bug report, but can't edit a report when logged on as guest and there doesn't seem to be any way of creating a new login ID. The run the debugger on it and attempt to break in the function bar, which is the first function in bar.c: ,---- | stevee@gorbag:MY CLONE> gdb ./a.out | GNU gdb 5.3 | Copyright 2002 Free Software Foundation, Inc. | GDB is free software, covered by the GNU General Public License, and you are | welcome to change it and/or distribute copies of it under certain conditions. | Type "show copying" to see the conditions. | There is absolutely no warranty for GDB. Type "show warranty" for details. | This GDB was configured as "sparc-sun-solaris2.6"... | (gdb) b bar | Breakpoint 1 at 0x10aa8 | (gdb) b bar2 | Breakpoint 2 at 0x10aec: file bar.c, line 13. | (gdb) r | Starting program: /tmp/a.out | foo | | Breakpoint 1, 0x00010aa8 in bar () | (gdb) l | 1 #include | 2 | 3 extern void foo(void); | 4 extern int bar(void); | 5 extern int bar2(void); | 6 | 7 int main() | 8 { | 9 foo(); | 10 bar(); | (gdb) `---- Note that the function bar2 which exists in the same source file can have a break point added successfully. Thanks for any help with this problem. --=-=-= Content-Type: application/octet-stream Content-Disposition: attachment; filename=foo.c #include extern void foo(void); extern int bar(void); extern int bar2(void); int main() { foo(); bar(); bar2(); return 0; } void foo() { printf( "foo\n" ); } #include "bar.c" --=-=-= Content-Type: application/octet-stream Content-Disposition: attachment; filename=bar.c int bar() { printf( "bar\n" ); return 0; } int bar2() { printf( "bar2\n" ); return 2; } --=-=-= Steve - -- ____________________________________________________________________________ Steve Evans, Zuken Limited, TEL: +44 (0)1454 207800 ext 8607 1500 Aztec West, Fax: +44 (0)1454 207803 Almondsbury, mailto:stevee@zuken.co.uk Bristol, BS32 4RF, UK Web: http://www.zuken.com Registered Linux user #217906: http://counter.li.org Public Encryption Key: http://www.gorbag.com/public-key-work.html _____________________________________________________________________________ "We are all slaves to our histories. If there is to be a .. bright future, we must learn to break those chains." -- Delenn to Garibaldi in Babylon 5:"GROPOS" -----BEGIN PGP SIGNATURE----- Version: GnuPG v1.2.1 (SunOS) Comment: Processed by Mailcrypt 3.5.8 iD8DBQE+qPeT1a67iNP86GcRAqTuAJ44uyoY1zJr/2/cRSCjZYfjOHi1QQCfWltl Woad71WrkYk2iHuacIa4Twg= =NYKO -----END PGP SIGNATURE----- --=-=-=--