This is the mail archive of the mailing list for the GCC project.

Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]
Other format: [Raw text]

Re: Bizarre GCC problem - how do I debug it?

On 08/06/2010 10:19 AM, Bruce Korb wrote:
The problem seems to be that GDB thinks all the code belongs to a
single line of text.  At first, it was a file of mine, so I presumed
I had done something strange and passed it off.  I needed to do some
more debugging again and my "-g -O0" output still said all code
belonged to that one line.  So, I made a .i file and compiled that.
Different file, but the same problem.  The .i file contains the
correct preprocessor directives:

   # 309 "wrapup.c"
   static void

but under gdb:

   (gdb) b done_check
   Breakpoint 5 at 0x40af44: file /usr/include/gmp.h, line 1661.

the break point *is* on the entry to "done_check", but the
source code displayed is line 1661 of gmp.h.  Not helpful.
Further, I cannot set break points on line numbers because
all code belongs to the one line in gmp.h.

Yes, for now I can debug in assembly code, but it isn't very easy.....

$ gcc --version
gcc (SUSE Linux) 4.5.0 20100604 [gcc-4_5-branch revision 160292]
Copyright (C) 2010 Free Software Foundation, Inc.
This is free software; see the source for copying conditions.  There is NO

I've googled for:  gcc|gdb wrong source file
which only yields how to examine source files in gdb.

Which version of GDB?

IIRC with GCC-4.5 you need a very new version of GDB. This page:

indicates that GDB 7.0 or later would be good candidates.

David Daney.

Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]