Mirror of the gdb-patches mailing list
 help / color / mirror / Atom feed
From: Yao Qi <qiyaoltc@gmail.com>
To: Petr Machata <pmachata@redhat.com>, gdb-patches@sourceware.org
Subject: Re: [PATCH V2] dwarf.exp: Allow generating a stub .debug_line section
Date: Mon, 23 Feb 2015 23:21:00 -0000	[thread overview]
Message-ID: <54EBB603.709@gmail.com> (raw)
In-Reply-To: <87h9uc1y9o.fsf@redhat.com>

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


  reply	other threads:[~2015-02-23 23:21 UTC|newest]

Thread overview: 9+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2015-02-23 14:46 Petr Machata
2015-02-23 23:21 ` Yao Qi [this message]
2015-02-24  0:07   ` Petr Machata
2015-02-24 12:44     ` Yao Qi
2015-03-27 23:08 [PATCH][V2] " Petr Machata
2015-03-30 18:19 ` Doug Evans
2015-03-30 19:48   ` Petr Machata
2015-03-30 20:00     ` Doug Evans
2015-03-31 14:30   ` Petr Machata

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=54EBB603.709@gmail.com \
    --to=qiyaoltc@gmail.com \
    --cc=gdb-patches@sourceware.org \
    --cc=pmachata@redhat.com \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox