From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: (qmail 9753 invoked by alias); 28 Jul 2006 21:12:01 -0000 Received: (qmail 9744 invoked by uid 22791); 28 Jul 2006 21:12:00 -0000 X-Spam-Check-By: sourceware.org Received: from hq.tensilica.com (HELO mailapp.tensilica.com) (65.205.227.29) by sourceware.org (qpsmtpd/0.31) with ESMTP; Fri, 28 Jul 2006 21:11:55 +0000 Received: from localhost ([127.0.0.1] ident=amavis) by mailapp.tensilica.com with esmtp (Exim 4.34) id 1G6Zcf-00024h-Tn for binutils@sourceware.org; Fri, 28 Jul 2006 14:11:54 -0700 Received: from mailapp.tensilica.com ([127.0.0.1]) by localhost (mailapp [127.0.0.1]) (amavisd-new, port 10024) with ESMTP id 06207-04 for ; Fri, 28 Jul 2006 14:11:53 -0700 (PDT) Received: from jaw.hq.tensilica.com ([192.168.11.132]) by mailapp.tensilica.com with esmtp (Exim 4.34) id 1G6Zcf-00023i-Dh for binutils@sourceware.org; Fri, 28 Jul 2006 14:11:53 -0700 Message-ID: <44CA7D99.6000002@tensilica.com> Date: Fri, 28 Jul 2006 21:12:00 -0000 From: Sterling Augustine User-Agent: Mozilla/5.0 (X11; U; Linux i686; en-US; rv:1.7.3) Gecko/20041020 MIME-Version: 1.0 To: binutils@sourceware.org Subject: Generate DW_AT_ranges for non-contiguous code Content-Type: multipart/mixed; boundary="------------000503070206060300040204" Mailing-List: contact binutils-help@sourceware.org; run by ezmlm Precedence: bulk List-Subscribe: List-Archive: List-Post: List-Help: , Sender: binutils-owner@sourceware.org X-SW-Source: 2006-07/txt/msg00358.txt.bz2 This is a multi-part message in MIME format. --------------000503070206060300040204 Content-Type: text/plain; charset=us-ascii; format=flowed Content-Transfer-Encoding: 7bit Content-length: 901 This enclosed patch adds support for DW_AT_ranges when assembly code is noncontiguous. See: http://sourceware.org/ml/gdb/2006-05/msg00015.html for a discussion of the problem this is addressing. I believe Tensilica's copyright assignment is already on file. One issue here is that this particular usage of DW_AT_ranges is dwarf 3, and gas emits 2 for the dwarf version number. Don't know the right thing to do there. Bumping the version number for this seems extreme. Let me know any issues... Sterling Augustine Member of Technical Staff Tensilica, Inc. gas/ 2006-07-28 Sterling Augustine * dwarf2dbg.c (out_debug_info): Add new parameter aranges_seg and emit DW_AT_ranges when code in compilation unit is not contiguous. (out_debug_abbrev): Emit DW_AT_ranges abbreviation if code in is not contiguous. (dwarf2_finish): Pass aranges_seg to out_debug_info. --------------000503070206060300040204 Content-Type: text/plain; name="discont.patch" Content-Transfer-Encoding: 7bit Content-Disposition: inline; filename="discont.patch" Content-length: 2439 --- binutils-060728/gas/dwarf2dbg.c 2006-06-07 04:27:57.000000000 -0700 +++ updated/gas/dwarf2dbg.c 2006-07-28 13:35:43.229267000 -0700 @@ -202,7 +202,7 @@ static void out_file_list (void); static void out_debug_line (segT); static void out_debug_aranges (segT, segT); static void out_debug_abbrev (segT); -static void out_debug_info (segT, segT, segT); +static void out_debug_info (segT, segT, segT, segT); #ifndef TC_DWARF2_EMIT_OFFSET # define TC_DWARF2_EMIT_OFFSET generic_dwarf2_emit_offset @@ -1382,6 +1382,9 @@ out_debug_abbrev (segT abbrev_seg) out_abbrev (DW_AT_low_pc, DW_FORM_addr); out_abbrev (DW_AT_high_pc, DW_FORM_addr); } + else + out_abbrev (DW_AT_ranges, DW_FORM_addr); + out_abbrev (DW_AT_name, DW_FORM_string); out_abbrev (DW_AT_comp_dir, DW_FORM_string); out_abbrev (DW_AT_producer, DW_FORM_string); @@ -1395,7 +1398,7 @@ out_debug_abbrev (segT abbrev_seg) /* Emit a description of this compilation unit for .debug_info. */ static void -out_debug_info (segT info_seg, segT abbrev_seg, segT line_seg) +out_debug_info (segT info_seg, segT abbrev_seg, segT line_seg, segT aranges_seg) { char producer[128]; char *comp_dir; @@ -1458,8 +1461,7 @@ out_debug_info (segT info_seg, segT abbr /* ??? sizeof_offset */ TC_DWARF2_EMIT_OFFSET (section_symbol (line_seg), 4); - /* These two attributes may only be emitted if all of the code is - contiguous. Multiple sections are not that. */ + /* These two attributes are emitted if all of the code is contiguous. */ if (all_segs->next == NULL) { /* DW_AT_low_pc */ @@ -1474,6 +1476,16 @@ out_debug_info (segT info_seg, segT abbr expr.X_add_number = 0; emit_expr (&expr, sizeof_address); } + else + { + /* Use a range attribute for non-contiguous code. */ + + /* DW_AT_ranges */ + expr.X_op = O_symbol; + expr.X_add_symbol = section_symbol (aranges_seg); + expr.X_add_number = 0; + emit_expr (&expr, sizeof_address); + } /* DW_AT_name. We don't have the actual file name that was present on the command line, so assume files[1] is the main input file. @@ -1582,6 +1594,6 @@ dwarf2_finish (void) out_debug_aranges (aranges_seg, info_seg); out_debug_abbrev (abbrev_seg); - out_debug_info (info_seg, abbrev_seg, line_seg); + out_debug_info (info_seg, abbrev_seg, line_seg, aranges_seg); } } --------------000503070206060300040204--