From patchwork Fri Apr 10 15:19:02 2015 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Yao Qi X-Patchwork-Id: 6138 Received: (qmail 31396 invoked by alias); 10 Apr 2015 15:19:10 -0000 Mailing-List: contact gdb-patches-help@sourceware.org; run by ezmlm Precedence: bulk List-Id: List-Unsubscribe: List-Subscribe: List-Archive: List-Post: List-Help: , Sender: gdb-patches-owner@sourceware.org Delivered-To: mailing list gdb-patches@sourceware.org Received: (qmail 31340 invoked by uid 89); 10 Apr 2015 15:19:10 -0000 Authentication-Results: sourceware.org; auth=none X-Virus-Found: No X-Spam-SWARE-Status: No, score=-0.9 required=5.0 tests=AWL, BAYES_00, FREEMAIL_FROM, RCVD_IN_DNSWL_LOW, SPF_PASS autolearn=ham version=3.3.2 X-HELO: mail-pd0-f176.google.com Received: from mail-pd0-f176.google.com (HELO mail-pd0-f176.google.com) (209.85.192.176) by sourceware.org (qpsmtpd/0.93/v0.84-503-g423c35a) with (AES128-GCM-SHA256 encrypted) ESMTPS; Fri, 10 Apr 2015 15:19:09 +0000 Received: by pdbnk13 with SMTP id nk13so25756716pdb.0 for ; Fri, 10 Apr 2015 08:19:07 -0700 (PDT) X-Received: by 10.68.110.37 with SMTP id hx5mr3566779pbb.46.1428679147604; Fri, 10 Apr 2015 08:19:07 -0700 (PDT) Received: from E107787-LIN.cambridge.arm.com (gcc1-power7.osuosl.org. [140.211.15.137]) by mx.google.com with ESMTPSA id fz1sm2594212pbb.12.2015.04.10.08.19.06 for (version=TLSv1.2 cipher=ECDHE-RSA-AES128-SHA bits=128/128); Fri, 10 Apr 2015 08:19:07 -0700 (PDT) From: Yao Qi To: gdb-patches@sourceware.org Subject: [PATCH] Fix fails in gdb.dwarf2/dynarr-ptr.exp Date: Fri, 10 Apr 2015 16:19:02 +0100 Message-Id: <1428679142-8236-1-git-send-email-qiyaoltc@gmail.com> X-IsSubscribed: yes From: Yao Qi 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-10 Yao Qi * gdb.dwarf2/dynarr-ptr.exp (assemble): Use $ptr_size instead of ":$ptr_size" and set its form explicitly. --- gdb/testsuite/gdb.dwarf2/dynarr-ptr.exp | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) 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 {