From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: (qmail 128047 invoked by alias); 23 Feb 2015 23:21:46 -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 128035 invoked by uid 89); 23 Feb 2015 23:21:46 -0000 Authentication-Results: sourceware.org; auth=none X-Virus-Found: No X-Spam-SWARE-Status: No, score=1.6 required=5.0 tests=AWL,BAYES_00,FREEMAIL_FROM,KAM_FROM_URIBL_PCCC,RCVD_IN_DNSWL_LOW,SPF_PASS autolearn=no version=3.3.2 X-HELO: mail-we0-f177.google.com Received: from mail-we0-f177.google.com (HELO mail-we0-f177.google.com) (74.125.82.177) by sourceware.org (qpsmtpd/0.93/v0.84-503-g423c35a) with (AES128-GCM-SHA256 encrypted) ESMTPS; Mon, 23 Feb 2015 23:21:44 +0000 Received: by wesq59 with SMTP id q59so21957153wes.1 for ; Mon, 23 Feb 2015 15:21:41 -0800 (PST) X-Received: by 10.194.75.193 with SMTP id e1mr26259880wjw.126.1424733701769; Mon, 23 Feb 2015 15:21:41 -0800 (PST) Received: from [192.168.1.134] (host-2-102-217-78.as13285.net. [2.102.217.78]) by mx.google.com with ESMTPSA id hs7sm17918624wib.4.2015.02.23.15.21.40 (version=TLSv1.2 cipher=ECDHE-RSA-AES128-GCM-SHA256 bits=128/128); Mon, 23 Feb 2015 15:21:41 -0800 (PST) Message-ID: <54EBB603.709@gmail.com> Date: Mon, 23 Feb 2015 23:21:00 -0000 From: Yao Qi User-Agent: Mozilla/5.0 (X11; Linux i686; rv:31.0) Gecko/20100101 Thunderbird/31.4.0 MIME-Version: 1.0 To: Petr Machata , gdb-patches@sourceware.org Subject: Re: [PATCH V2] dwarf.exp: Allow generating a stub .debug_line section References: <87h9uc1y9o.fsf@redhat.com> In-Reply-To: <87h9uc1y9o.fsf@redhat.com> Content-Type: text/plain; charset=utf-8 Content-Transfer-Encoding: 7bit X-IsSubscribed: yes X-SW-Source: 2015-02/txt/msg00684.txt.bz2 On 02/23/2015 02:46 PM, Petr Machata wrote: > This is what I wrote last week, and it all still holds: > > like GDB itself, dwgrep uses dwarf.exp to fabricate Dwarfs for its test > cases. For one test case, I need to create a stub .debug_line section > and reference files defined therein from DW_AT_decl_file. Hence this > patch, which implements generating barest minimum of .debug_line. > > I suspect this could be useful for GDB as well, git grep showed me some > .exp's creating .debug_line by hand, but I didn't really take a close > look. Yeah, it is useful to GDB. > > There were no regressions on x86_64. > but the new macro you added isn't used by any test cases. > Example of use: > > Dwarf::assemble "foo.s" { > build_id 0102030405060708 > > cu {is_64 0 version 4 addr_size 8} { > DW_TAG_compile_unit { > {MACRO_AT_stmt_list { Is there any reason you decide to implement this attribute as a macro attribute? DW_AT_stmt_list attribute itself is quite simple, whose value is a section offset to the .debug_line section, so we don't need to bother macro attribute, which doesn't exist in dwarf spec but are used to generate some dwarf attributes. I'd like DW_AT_stmt_list implemented in the same way as other attributes, for example, cu {is_64 0 version 4 addr_size 8} { compile_unit { { stmt_list $label1 sec_offset} } ... label1: line_number_info { line_number_program_header { } line_number_program { } } } what do you think? > {include "foo"} > {file_name "foo.c" 1} > }} > } { > DW_TAG_subprogram { > # We can now reference the source file. > {DW_AT_decl_file 1 DW_FORM_data1} > } > } > } > } > > I do not have commit rights, so if this patch is acceptable, I will need > someone to commit this for me. Why don't you apply for an account for you? It is easy to do so https://sourceware.org/cgi-bin/pdw/ps_form.cgi I (yao.qi@arm.com) could be the people to approve your request. > @@ -422,6 +435,11 @@ namespace eval Dwarf { > _op .${size}byte $value > } > > + DW_FORM_sec_offset { > + variable _cu_offset_size > + _op .${_cu_offset_size}byte $value > + } > + > DW_FORM_ref1 - > DW_FORM_flag - > DW_FORM_data1 { > @@ -494,7 +512,6 @@ namespace eval Dwarf { > > DW_FORM_ref2 - > DW_FORM_indirect - > - DW_FORM_sec_offset - > DW_FORM_exprloc - This part looks right to me, and DW_FORM_sec_offset can be used by other attributes too, such as DW_AT_ranges. -- Yao