From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: (qmail 14823 invoked by alias); 4 May 2006 12:45:47 -0000 Received: (qmail 14812 invoked by uid 22791); 4 May 2006 12:45:45 -0000 X-Spam-Check-By: sourceware.org Received: from nevyn.them.org (HELO nevyn.them.org) (66.93.172.17) by sourceware.org (qpsmtpd/0.31.1) with ESMTP; Thu, 04 May 2006 12:45:34 +0000 Received: from drow by nevyn.them.org with local (Exim 4.54) id 1FbdD1-0007iY-VK; Thu, 04 May 2006 08:45:32 -0400 Date: Thu, 04 May 2006 12:45:00 -0000 From: Daniel Jacobowitz To: Ross Morley Cc: GDB List Subject: Re: Source info in discontiguous hand asm files Message-ID: <20060504124531.GA29440@nevyn.them.org> Mail-Followup-To: Ross Morley , GDB List References: <44595771.1070907@tensilica.com> <20060504015948.GA19834@nevyn.them.org> <4459C400.6040709@tensilica.com> Mime-Version: 1.0 Content-Type: text/plain; charset=us-ascii Content-Disposition: inline In-Reply-To: <4459C400.6040709@tensilica.com> User-Agent: Mutt/1.5.8i X-IsSubscribed: yes Mailing-List: contact gdb-help@sourceware.org; run by ezmlm Precedence: bulk List-Subscribe: List-Archive: List-Post: List-Help: , Sender: gdb-owner@sourceware.org X-SW-Source: 2006-05/txt/msg00018.txt.bz2 On Thu, May 04, 2006 at 02:06:08AM -0700, Ross Morley wrote: > Yes, it is correct, though not as extensive as it could be. > In the case where there are multiple ranges of text in a compilation > unit, DA_AT_{low,high}_pc is omitted from the CU per DWARF spec. > Where there is only one range of text, those are present and correct. > The assembler doesn't add function-specific info. > There is info in the aranges table to associate the ranges with the > compilation unit, so a scan of that table could provide it. The section .debug_info contains: Compilation Unit @ offset 0x0: Length: 52 Version: 2 Abbrev Offset: 0 Pointer Size: 8 <0>: Abbrev Number: 1 (DW_TAG_compile_unit) DW_AT_stmt_list : 0 DW_AT_name : text.S DW_AT_comp_dir : /home/drow/text DW_AT_producer : GNU AS 2.16.91 DW_AT_language : 32769 (MIPS assembler) >From the DWARF standard: Compilation unit entries may have the following attributes: 1. Either a DW_AT_low_pc and DW_AT_high_pc pair of attributes or a DW_AT_ranges attribute whose values encode the contiguous or non-contiguous address ranges, respectively, of the machine instructions generated for the compilation unit (see Section 2.16). A DW_AT_low_pc attribute may also be specified in combination with DW_AT_ranges to specify the default base address for use in location lists (see Section 2.5.4) and range lists (see Section 2.16.3). Now, there's a "may" there, so the compilation unit clearly isn't required to have either. But GDB definitely expects a compilation unit to have one or the other. It does not implement .debug_aranges support. So, your options are to use .debug_aranges to look up textlow/texthigh for compilation units that don't have a PC range, or to modify gas to emit DW_AT_ranges. The latter is likely to be easier. -- Daniel Jacobowitz CodeSourcery