From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: (qmail 91008 invoked by alias); 26 Oct 2015 10:03:30 -0000 Mailing-List: contact gdb-patches-help@sourceware.org; run by ezmlm Precedence: bulk List-Id: List-Subscribe: List-Archive: List-Post: List-Help: , Sender: gdb-patches-owner@sourceware.org Received: (qmail 90904 invoked by uid 89); 26 Oct 2015 10:03:28 -0000 Authentication-Results: sourceware.org; auth=none X-Virus-Found: No X-Spam-SWARE-Status: No, score=-1.7 required=5.0 tests=AWL,BAYES_00,RCVD_IN_DNSWL_LOW autolearn=ham version=3.3.2 X-HELO: mail-wi0-f179.google.com Received: from mail-wi0-f179.google.com (HELO mail-wi0-f179.google.com) (209.85.212.179) by sourceware.org (qpsmtpd/0.93/v0.84-503-g423c35a) with (AES128-GCM-SHA256 encrypted) ESMTPS; Mon, 26 Oct 2015 10:03:24 +0000 Received: by wikq8 with SMTP id q8so156536565wik.1 for ; Mon, 26 Oct 2015 03:03:21 -0700 (PDT) X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20130820; h=x-gm-message-state:date:from:to:cc:subject:message-id:references :mime-version:content-type:content-disposition:in-reply-to :user-agent; bh=0TlmE+S0T3Kp6eP3NP0MYb1zucbfexuf/kjwJn5GB7g=; b=X7D5EvFULUzlsCIlysCgDENNwdJhGXczkPrsW7VfbJhM05v3SQp1QUqtWoct11J7QI 74eq6CZn9SDDIJVIl1w67D+R2MorJd79OblS/DKv+4kssxzrNQff+yx70t7l3fmgJ2wx RiJ1ylMcCmDJhnevYMipNYJ+IN0/i73c9pujhlFYlbdIGl7jl9jmqGUaXV4O/uQ0YqzL LBcUbfB6Axg44KNB4+qNFU53u2ULGW4Rva00wvkhDsUXUUXbEjWNXzY/wqmswywoKHpL DgTuCEKIvficX1SQSEA0SRQPe/gkqFI2Zmcx/rwVT3nEEGl+1IKioVF4vRF8DaYlBkwT d4xg== X-Gm-Message-State: ALoCoQmLjqNMcyQkhIZbNDAdNNM6h/fxPSo760CUQ/7f7auzeV76pz20TvB5FABYXa6RzPgco1YN X-Received: by 10.180.36.195 with SMTP id s3mr19481747wij.30.1445853801495; Mon, 26 Oct 2015 03:03:21 -0700 (PDT) Received: from localhost (host81-131-206-221.range81-131.btcentralplus.com. [81.131.206.221]) by smtp.gmail.com with ESMTPSA id q1sm38048498wjy.31.2015.10.26.03.03.19 (version=TLSv1.2 cipher=ECDHE-RSA-AES128-GCM-SHA256 bits=128/128); Mon, 26 Oct 2015 03:03:20 -0700 (PDT) Date: Mon, 26 Oct 2015 12:55:00 -0000 From: Andrew Burgess To: Doug Evans Cc: gdb-patches@sourceware.org Subject: Re: [PATCH] gdb: Handle multiple base address in debug_ranges data. Message-ID: <20151026100317.GC23628@embecosm.com> References: <81cb8e0b755217ed2ea2afdffb3a5c44421b72cd.1444985270.git.andrew.burgess@embecosm.com> <86d1w2cryj.fsf@sspiff.org> MIME-Version: 1.0 Content-Type: text/plain; charset=us-ascii Content-Disposition: inline In-Reply-To: <86d1w2cryj.fsf@sspiff.org> X-Editor: GNU Emacs [ http://www.gnu.org/software/emacs ] User-Agent: Mutt/1.5.24 (2015-08-30) X-IsSubscribed: yes X-SW-Source: 2015-10/txt/msg00551.txt.bz2 * Doug Evans [2015-10-26 01:57:08 +0000]: > Andrew Burgess writes: > > It is possible to use multiple base addresses within a single address > > range series, within the .debug_ranges section. The following is a > > simplified example for 32-bit addresses: > > > > .section ".debug_ranges" > > .4byte 0xffffffff > > .4byte BASE_1 > > .4byte START_OFFSET_1 > > .4byte END_OFFSET_1 > > .4byte START_OFFSET_2 > > .4byte END_OFFSET_2 > > .4byte 0xffffffff > > .4byte BASE_2 > > .4byte START_OFFSET_3 > > .4byte END_OFFSET_3 > > .4byte 0 > > .4byte 0 > > > > In this example START/END 1 and 2 are relative to BASE_1, while > > START/END 3 are relative to BASE_2. > > > > Currently gdb does not correctly parse this DWARF, resulting in > > corrupted address range information. This commit fixes this issue, and > > adds a new test to cover this case. > > > > gdb/ChangeLog: > > > > * dwarf2read.c (dwarf2_ranges_read): Unify and fix base address > > reading code. > > > > gdb/testsuite/ChangeLog: > > > > * gdb.arch/amd64-debug-ranges-base.c: New file. > > * gdb.arch/amd64-debug-ranges-base.exp: New file. > > * gdb.arch/amd64-debug-ranges-base.s: New file. > > Hi. > > The code patch is fine with me, nice find. > > IWBN to enhance the dwarf assembler (testsuite/lib/dwarf.exp) > to handle .debug_ranges. The more we get away from checking in > generated assembler the better. > Can do? > If not, I'll volunteer to take that on, but I can't promise to > get to it this week. .debug_ranges is pretty simple so I think(!) > this will be easy. This was absolutely my first thought too, and I even stated working on exactly this feature. I got the .debug_ranges table generation to a reasonable state, but then I needed more features from the .debug_line table generator, but I ran out of time.... Anyway, you can find the initial work I did here: https://github.com/T-J-Teru/binutils-gdb/commits/gdb-dwarf-ranges that branch doesn't contain the fix, just the initial work on writing a test to expose the bug. Feel free to take any code out of that branch if it is useful to you. > [Though if we go with the generated assembler, take out the 3 in -g3. > I mention this more for completeness sake though, as I'd really like > to see if we can do this with the dwarf assembler first.] I'd rather not push the fix without a test, and I don't think you're approving the current test, so... I'll hopefully get more time to work on this next month, if I don't get approval for the current patch before then I'll return to working on the dwarf assembler style testing. Thanks for the review, Andrew