Use dwarf assembler in gdb.dwarf2/implptr-64bit.exp
authorYao Qi <yao.qi@linaro.org>
Wed, 25 Jan 2017 16:24:44 +0000 (16:24 +0000)
committerYao Qi <yao.qi@linaro.org>
Wed, 25 Jan 2017 16:24:44 +0000 (16:24 +0000)
commitf13a9a0cf7d13b9ea51b0df4b9fa469652f92338
treeacf1cdd98977228eb7d17153203a6317ed0859e8
parent5ac95241162bf4729ecaf3c880cdaa846a3aded4
Use dwarf assembler in gdb.dwarf2/implptr-64bit.exp

This patch adds a DW_OP_implicit_value in dwarf assembler, and uses
dwarf assembler in implptr-64bit.exp.  Using dwarf assembler in
implptr-64bit.exp exposes some limitations in dwarf assembler,

 - some variables are not evaluated in the caller's context, so we
   can not pass variable to assembler, like this

       Dwarf::assemble $asm_file {

cu {
    version $dwarf_version
    addr_size $addr_size
    is_64 $is_64
} {
}

and

{DW_AT_type :$struct_label "DW_FORM_ref$ref_addr_size"}

   this limitation is fixed by adding "uplevel" and "subst".

 - dwarf assembler doesn't emit DW_FORM_ref_addr for label referencing.
   this limitation is fixed by adding a new character "%",

{ type %$int_label }

   this means we want to emit DW_FORM_ref_addr for label referencing.

 - we can't set the form of label referencing offset in dwarf assembler.
   Nowadays, dwarf assembler guesses the form of labels, which is
   DW_FORM_ref4.  However, in implptr-64bit.exp, both DW_FORM_ref4
   and DW_FORM_ref8 is used (see REF_ADDR in implptr-64bit.S).  This
   patch adds the flexibility of setting the form of label reference.
   Both of them below are valid,

{DW_AT_type :$struct_label}
{DW_AT_type :$struct_label DW_FORM_ref8}

   the former form is the default DW_FORM_ref4.

I compared the .debug_info of objects without and with this patch
applied.  There is no changes except abbrev numbers.

gdb/testsuite:

2017-01-25  Andreas Arnez  <arnez@linux.vnet.ibm.com>
    Yao Qi  <yao.qi@linaro.org>

* gdb.dwarf2/implptr-64bit.exp: Use dwarf assembler.
* gdb.dwarf2/implptr-64bit.S: Remove.
* lib/dwarf.exp (Dwarf): Handle character "%".  Evaluate some
variables in caller's context.  Add DW_OP_implicit_value.
gdb/testsuite/ChangeLog
gdb/testsuite/gdb.dwarf2/implptr-64bit.S [deleted file]
gdb/testsuite/gdb.dwarf2/implptr-64bit.exp
gdb/testsuite/lib/dwarf.exp
This page took 0.027619 seconds and 4 git commands to generate.