diff options
author | Yao Qi <yao.qi@linaro.org> | 2015-04-15 14:04:40 +0100 |
---|---|---|
committer | Yao Qi <yao.qi@linaro.org> | 2015-04-15 14:05:07 +0100 |
commit | 8cbc97c629061306efb30aa83440bec7380c584e (patch) | |
tree | 9ee8a4ad254cf8847ad927ce93068fef68e5b2ff | |
parent | ea556d2590ae9ffea09fdbaceb6abdbe4e921464 (diff) | |
download | gdb-8cbc97c629061306efb30aa83440bec7380c584e.zip gdb-8cbc97c629061306efb30aa83440bec7380c584e.tar.gz gdb-8cbc97c629061306efb30aa83440bec7380c584e.tar.bz2 |
Fix fails in gdb.dwarf2/dynarr-ptr.exp
I see many fails in gdb.dwarf2/dynarr-ptr.exp on arm-linux target,
started from this
print foo.three_ptr.all^M
Cannot access memory at address 0x107c8^M
(gdb) FAIL: gdb.dwarf2/dynarr-ptr.exp: print foo.three_ptr.all
print foo.three_ptr.all(1)^M
Cannot access memory at address 0x107c8
It turns out that ":$ptr_size" is used incorrectly.
array_ptr_label: DW_TAG_pointer_type {
{DW_AT_byte_size :$ptr_size }
^^^^^^^^^^
{DW_AT_type :$array_label}
}
Since the FORM isn't given, and it starts with the ":", it is regarded
as a label reference by dwarf assembler. The generated asm file on
x86_64 is
.uleb128 6 /* Abbrev (DW_TAG_pointer_type) */
.4byte 8 - .Lcu1_begin <----- WRONG
.4byte .Llabel2 - .Lcu1_begin
Looks .Lcu1_begin is 0 on x86_64 and that is why this test passes on
x86_64. On arm, .Lcu1_begin is an address somewhere, and the value
of DW_AT_byte_size is a very large number, so memory read request
of such large length failed.
This patch is to remove ":" and set the form explicitly. The generated
asm file on x86_64 becomes
.uleb128 6 /* Abbrev (DW_TAG_pointer_type) */
.byte 8
.4byte .Llabel2 - .Lcu1_begin
gdb/testsuite:
2015-04-15 Yao Qi <yao.qi@linaro.org>
* gdb.dwarf2/dynarr-ptr.exp (assemble): Use $ptr_size instead
of ":$ptr_size" and set its form explicitly.
-rw-r--r-- | gdb/testsuite/ChangeLog | 5 | ||||
-rw-r--r-- | gdb/testsuite/gdb.dwarf2/dynarr-ptr.exp | 2 |
2 files changed, 6 insertions, 1 deletions
diff --git a/gdb/testsuite/ChangeLog b/gdb/testsuite/ChangeLog index 6098a62..9fa680d 100644 --- a/gdb/testsuite/ChangeLog +++ b/gdb/testsuite/ChangeLog @@ -1,3 +1,8 @@ +2015-04-15 Yao Qi <yao.qi@linaro.org> + + * gdb.dwarf2/dynarr-ptr.exp (assemble): Use $ptr_size instead + of ":$ptr_size" and set its form explicitly. + 2015-04-15 Pedro Alves <palves@redhat.com> Yao Qi <yao.qi@linaro.org> diff --git a/gdb/testsuite/gdb.dwarf2/dynarr-ptr.exp b/gdb/testsuite/gdb.dwarf2/dynarr-ptr.exp index 544509b..3dcb3d7 100644 --- a/gdb/testsuite/gdb.dwarf2/dynarr-ptr.exp +++ b/gdb/testsuite/gdb.dwarf2/dynarr-ptr.exp @@ -74,7 +74,7 @@ Dwarf::assemble $asm_file { } } array_ptr_label: DW_TAG_pointer_type { - {DW_AT_byte_size :$ptr_size } + {DW_AT_byte_size $ptr_size DW_FORM_data1} {DW_AT_type :$array_label} } array_typedef_label: DW_TAG_typedef { |