Re: [PATCH] Fix gdb.dwarf2/dw2-dir-file-name.exp test for MIPS architectures

Doug Evans
2014-10-17T23:17:48Z

Kwok Cheung Yeung writes:
> Maciej has already reviewed this patch internally, and I can confirm
> that the test still passes cleanly on x86_64 Linux.
>
> If there are no objections I will go ahead and commit it tomorrow.
>
> Thanks,
>
> Kwok
>
> On 17/10/2014 1:07 PM, Pedro Alves wrote:
> > Looks fine to me, but I'd like to hear Maciej's OK on the MIPS specifics too.
> >
> > Please make sure x86_64 still works.
> >
> > I wonder if this test could be simplified using the testsuite's dwarf
> > assembler (Dwarf::assemble).
> >
> >>
> >> Kwok
> >>
> >> 2014-08-14 Kwok Cheung Yeung <kcy@codesourcery.com>
> >>
> >> gdb/testsuite/
> >> * gdb.dwarf2/dw2-dir-file-name.exp (addr_len): New.
> >> (out_cu): Use addr_len for the size of addresses.
> >> (out_line): Likewise. Size DW_LNE_set_address instruction
> >> according to addr_len.
> >> * gdb.dwarf2/dw2-dir-file-name.c (START_INSNS): New.
> >> (FUNC): Add START_INSNS to definition.

Hi.

One nit.

I'm guessing there's an attempt here to have the comments align
properly in the generated file.

@@ -54,8 +62,8 @@ proc out_cu { name cu_dir cu_name line_dir line_name } {
.ascii \"GNU C\\0\" /* DW_AT_producer */
.byte 2 /* DW_AT_language (DW_LANG_C) */
.4byte .Lline_${name}_begin /* DW_AT_stmt_list */
- .4byte ${name}_start /* DW_AT_low_pc */
- .4byte ${name}_end /* DW_AT_high_pc */
+ .${addr_len}byte ${name}_start /* DW_AT_low_pc */
+ .${addr_len}byte ${name}_end /* DW_AT_high_pc */
"
if { $cu_dir != "" } {
puts $f " .ascii $cu_dir /* DW_AT_comp_dir */"

I'd rather not go down this path, and just keep the source
reasonably clean in this regard.

E.g.,

@@ -54,8 +62,8 @@ proc out_cu { name cu_dir cu_name line_dir line_name } {
.ascii \"GNU C\\0\" /* DW_AT_producer */
.byte 2 /* DW_AT_language (DW_LANG_C) */
.4byte .Lline_${name}_begin /* DW_AT_stmt_list */
- .4byte ${name}_start /* DW_AT_low_pc */
- .4byte ${name}_end /* DW_AT_high_pc */
+ .${addr_len}byte ${name}_start /* DW_AT_low_pc */
+ .${addr_len}byte ${name}_end /* DW_AT_high_pc */
"
if { $cu_dir != "" } {
puts $f " .ascii $cu_dir /* DW_AT_comp_dir */"

Thanks.