This is the mail archive of the
gdb-patches@sourceware.org
mailing list for the GDB project.
Re: [PATCH V2] dwarf.exp: Allow generating a stub .debug_line section
- From: Yao Qi <qiyaoltc at gmail dot com>
- To: Petr Machata <pmachata at redhat dot com>, gdb-patches at sourceware dot org
- Date: Mon, 23 Feb 2015 23:21:39 +0000
- Subject: Re: [PATCH V2] dwarf.exp: Allow generating a stub .debug_line section
- Authentication-results: sourceware.org; auth=none
- References: <87h9uc1y9o dot fsf at redhat dot 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