From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: (qmail 14927 invoked by alias); 6 Sep 2013 20:02:07 -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 14913 invoked by uid 89); 6 Sep 2013 20:02:06 -0000 Received: from mx-sanjose2.Cadence.COM (HELO mx-sanjose2.cadence.com) (158.140.2.61) by sourceware.org (qpsmtpd/0.93/v0.84-503-g423c35a) with (AES256-SHA encrypted) ESMTPS; Fri, 06 Sep 2013 20:02:06 +0000 Authentication-Results: sourceware.org; auth=none X-Virus-Found: No X-Spam-SWARE-Status: No, score=-5.1 required=5.0 tests=AWL,BAYES_00,RP_MATCHES_RCVD autolearn=ham version=3.3.2 X-HELO: mx-sanjose2.cadence.com Received: from exowa05sj.global.cadence.com (sjmail.Cadence.COM [158.140.32.174]) by mx-sanjose2.cadence.com (8.14.4/8.14.4) with ESMTP id r86JxFMf021394 (version=TLSv1/SSLv3 cipher=AES128-SHA bits=128 verify=FAIL) for ; Fri, 6 Sep 2013 12:59:16 -0700 (PDT) Received: from MAILSJ3.global.cadence.com ([158.140.128.126]) by exowa05sj.global.cadence.com ([158.140.32.66]) with mapi; Fri, 6 Sep 2013 13:01:35 -0700 From: Arnab Bhaduri To: "gdb@sourceware.org" Date: Fri, 06 Sep 2013 20:02:00 -0000 Subject: gdb not detecting function sections correctly for functions in overlays Message-ID: Content-Type: text/plain; charset="us-ascii" Content-Transfer-Encoding: quoted-printable MIME-Version: 1.0 X-Received: by mx-sanjose2.cadence.com as r86JxFMf021394 at Fri Sep 6 12:59:16 2013 X-SW-Source: 2013-09/txt/msg00005.txt.bz2 Hello, I'm working with the Xtensa version of gdb, based off version 7.5.91. There= are local patches applied, but as far as I can tell they do not affect the= problem here. While debugging overlays, I created an executable with two overlays, which = are each in their own section (say .overlay0 and .overlay1). The first, .ov= erlay0, has a function foo(), the second has a function bar(). Since the ov= erlays are mapped at the same VMA, both functions have the same start addre= ss. When I set a breakpoint on bar(), gdb sets the breakpoint at the correc= t address. It also (correctly) does not set the breakpoint to the target ri= ght away. When it detects the overlay being changed, it sets the breakpoint= s, but in the wrong overlay. As far as I can tell, it does this because it = looks up the function's address from its name, then uses the address to fin= d the function's section (fixup_section() in symtab.c). But, since all the = overlay sections share the same starting VMA address, this lookup finds the= first matching section which is not always the correct one. Since objdump --syms does show the section name for foo() and bar() correct= ly, I assume the information exists somewhere. It seems like gdb should be = using somewhat different logic to map a function in an overlay to the corre= ct section. Did I understand things correctly so far, or have I missed some= thing else that is supposed to handle this case ? I am not very familiar wi= th gdb sources so the latter is entirely possible. Any advice would be most= welcome. Thanks Arnab