From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: (qmail 29737 invoked by alias); 10 Oct 2013 18:03:10 -0000 Mailing-List: contact gdb-help@sourceware.org; run by ezmlm Precedence: bulk List-Id: List-Subscribe: List-Archive: List-Post: List-Help: , Sender: gdb-owner@sourceware.org Received: (qmail 29697 invoked by uid 89); 10 Oct 2013 18:03:09 -0000 Authentication-Results: sourceware.org; auth=none X-Virus-Found: No X-Spam-SWARE-Status: No, score=-3.6 required=5.0 tests=AWL,BAYES_00,RP_MATCHES_RCVD,SPF_HELO_PASS,SPF_PASS autolearn=ham version=3.3.2 X-HELO: mx1.redhat.com Received: from mx1.redhat.com (HELO mx1.redhat.com) (209.132.183.28) by sourceware.org (qpsmtpd/0.93/v0.84-503-g423c35a) with ESMTP; Thu, 10 Oct 2013 18:03:09 +0000 Received: from int-mx09.intmail.prod.int.phx2.redhat.com (int-mx09.intmail.prod.int.phx2.redhat.com [10.5.11.22]) by mx1.redhat.com (8.14.4/8.14.4) with ESMTP id r9AI34im001278 (version=TLSv1/SSLv3 cipher=DHE-RSA-AES256-SHA bits=256 verify=OK); Thu, 10 Oct 2013 14:03:05 -0400 Received: from barimba (ovpn-113-128.phx2.redhat.com [10.3.113.128]) by int-mx09.intmail.prod.int.phx2.redhat.com (8.14.4/8.14.4) with ESMTP id r9AI32DC029217 (version=TLSv1/SSLv3 cipher=DHE-RSA-AES128-SHA bits=128 verify=NO); Thu, 10 Oct 2013 14:03:02 -0400 From: Tom Tromey To: Arnab Bhaduri Cc: "gdb\@sourceware.org" Subject: Re: gdb not detecting function sections correctly for functions in overlays References: Date: Thu, 10 Oct 2013 18:03:00 -0000 In-Reply-To: (Arnab Bhaduri's message of "Fri, 6 Sep 2013 13:01:56 -0700") Message-ID: <8761t580mi.fsf@fleche.redhat.com> User-Agent: Gnus/5.13 (Gnus v5.13) Emacs/24.3 (gnu/linux) MIME-Version: 1.0 Content-Type: text/plain X-SW-Source: 2013-10/txt/msg00044.txt.bz2 >>>>> "Arnab" == Arnab Bhaduri writes: Arnab> When it detects the overlay being changed, it sets the Arnab> breakpoints, but in the wrong overlay. As far as I can tell, it Arnab> does this because it looks up the function's address from its Arnab> name, then uses the address to find the function's section Arnab> (fixup_section() in symtab.c). But, since all the overlay Arnab> sections share the same starting VMA address, this lookup finds Arnab> the first matching section which is not always the correct one. Arnab> Since objdump --syms does show the section name for foo() and bar() Arnab> correctly, I assume the information exists somewhere. It seems like Arnab> gdb should be using somewhat different logic to map a function in an Arnab> overlay to the correct section. Did I understand things correctly so Arnab> far, or have I missed something else that is supposed to handle this Arnab> case ? objdump --syms will show the ELF symbols, but not the DWARF symbols. But if you have debuginfo, gdb will generally prefer the DWARF. This may explain the discrepancy there. Maybe this is a regression from my patch series to change how symbol sections are represented. That would be my guess, anyway, if earlier versions of gdb worked. Anyway, there is no high road to fixing this -- just debugging gdb. I don't think there's a good way of associating a DWARF symbol with a particular overlay. That seems to be the root of the problem to me. Tom