public inbox for insight@sourceware.org
 help / color / mirror / Atom feed
From: David Daney <ddaney@caviumnetworks.com>
To: Bruce Korb <bruce.korb@gmail.com>
Cc: gcc@gcc.gnu.org, bug-gdb@gnu.org, insight@sourceware.org
Subject: Re: Bizarre GCC problem - how do I debug it?
Date: Fri, 06 Aug 2010 18:20:00 -0000	[thread overview]
Message-ID: <4C5C524B.6040904@caviumnetworks.com> (raw)
In-Reply-To: <4C5C4B8A.7090303@gmail.com>

On 08/06/2010 10:51 AM, Bruce Korb wrote:
> On 08/06/10 10:24, David Daney wrote:
>> 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
>>>     done_check(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
>>> warranty; not even for MERCHANTABILITY or FITNESS FOR A PARTICULAR
>>> PURPOSE.
>>>
>>> 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:
>>
>> http://gcc.gnu.org/gcc-4.5/changes.html
>>
>> indicates that GDB 7.0 or later would be good candidates.
>
> That seems to work.  There are one or two or three bugs then.
> Either gdb needs to recognize an out of sync object code

It cannot do this as it was released before GCC-4.5.

> , or else
> gcc needs to produce object code that forces gdb to object in a way
> more obvious than just deciding upon the wrong file and line --
> or both.  I simply installed the latest openSuSE and got whatever
> was supplied.  It isn't reasonable to expect folks to go traipsing
> through upstream web sites looking for "changes.html" files ....
>
> And, of course, the insight stuff needs to incorporate the latest
> and greatest gdb.  (I don't use ddd because it is _completely_ non-
> intuitive.)
>

My understanding is that whoever packages GCC and GDB for a particular 
distribution is responsible to make sure that they work together.

In your case it looks like that didn't happen.

David Daney


  reply	other threads:[~2010-08-06 18:20 UTC|newest]

Thread overview: 6+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
     [not found] <4C5C4433.60302@gmail.com>
     [not found] ` <4C5C453D.4090704@caviumnetworks.com>
2010-08-06 17:51   ` Bruce Korb
2010-08-06 18:20     ` David Daney [this message]
2010-08-06 18:31       ` Bruce Korb
2010-08-06 18:42     ` Tom Tromey
2010-08-06 18:43       ` Richard Guenther
2010-08-06 19:16         ` Bruce Korb

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=4C5C524B.6040904@caviumnetworks.com \
    --to=ddaney@caviumnetworks.com \
    --cc=bruce.korb@gmail.com \
    --cc=bug-gdb@gnu.org \
    --cc=gcc@gcc.gnu.org \
    --cc=insight@sourceware.org \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for read-only IMAP folder(s) and NNTP newsgroup(s).