From patchwork Tue Jan 24 09:42:24 2017 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Yao Qi X-Patchwork-Id: 19003 Received: (qmail 15455 invoked by alias); 24 Jan 2017 09:42:58 -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 15382 invoked by uid 89); 24 Jan 2017 09:42:57 -0000 Authentication-Results: sourceware.org; auth=none X-Virus-Found: No X-Spam-SWARE-Status: No, score=-1.9 required=5.0 tests=AWL, BAYES_00, FREEMAIL_FROM, RCVD_IN_DNSWL_NONE, SPF_PASS autolearn=ham version=3.3.2 spammy= X-HELO: mail-pg0-f68.google.com Received: from mail-pg0-f68.google.com (HELO mail-pg0-f68.google.com) (74.125.83.68) by sourceware.org (qpsmtpd/0.93/v0.84-503-g423c35a) with ESMTP; Tue, 24 Jan 2017 09:42:47 +0000 Received: by mail-pg0-f68.google.com with SMTP id t6so16255388pgt.1 for ; Tue, 24 Jan 2017 01:42:47 -0800 (PST) X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20161025; h=x-gm-message-state:from:to:cc:subject:date:message-id:in-reply-to :references; bh=TQrC8QwJXyjGsQpfBnHk9XrzfUILzUqeghQ51BZIbDY=; b=LqtkOrVogmYKAfMJ67JksoZGPPABymhkzOgTRNX7eiwHrR7asRBT1vdOa126eR2fcZ RAIavQ9OJVnQZ1tsPwOmsZq2zAYhxJKHQD1cFDpTqMuE5jvJnnbLuCbMi+wqbTIJ0S0A umvBsqOuHwzq4b9bV9vhV5cvN5GP3recqf/SajYRbm36Q6lHVrnim8760N/mVXXERseB BdelMFmYJjR8GjZbTTgZgOxO28KsebS3swPAKYP/ThCOpzGFHC/XS8Q7wGziPF4KDwLt KBrAZSjW+JvYbCNFf0Nkd1yA5GPZTqqoXyPkMKlsV4kejRq7srAzoRolh71xh69lb/Zq bkWw== X-Gm-Message-State: AIkVDXLElbYXwHU7vJ20DvqQgFHa6/oNvthObpbabIYs+YRf26uIk/EOYVmA9eXS+krzyw== X-Received: by 10.98.65.148 with SMTP id g20mr38133221pfd.44.1485250965974; Tue, 24 Jan 2017 01:42:45 -0800 (PST) Received: from E107787-LIN.cambridge.arm.com (gcc1-power7.osuosl.org. [140.211.15.137]) by smtp.gmail.com with ESMTPSA id f65sm43211760pfk.5.2017.01.24.01.42.44 (version=TLS1_2 cipher=ECDHE-RSA-AES128-SHA bits=128/128); Tue, 24 Jan 2017 01:42:45 -0800 (PST) From: Yao Qi X-Google-Original-From: Yao Qi To: gdb-patches@sourceware.org Cc: arnez@linux.vnet.ibm.com Subject: [PATCH 1/2] Handle DW_OP_GNU_implicit_pointer in dwarf assembler Date: Tue, 24 Jan 2017 09:42:24 +0000 Message-Id: <1485250945-17594-2-git-send-email-yao.qi@linaro.org> In-Reply-To: <1485250945-17594-1-git-send-email-yao.qi@linaro.org> References: <1485250945-17594-1-git-send-email-yao.qi@linaro.org> X-IsSubscribed: yes DW_OP_GNU_implicit_pointer refers to a DIE with an offset of different sizes in different dwarf versions. In v2, the size is the pointer size, while in v3 and above, it is the ref_addr size. This patch fixes dwarf assembler to emit the correct size of offset. We've already fixed this size issue in gdb, https://sourceware.org/ml/gdb-patches/2011-09/msg00451.html gdb/testsuite: 2017-01-24 Yao Qi * lib/dwarf.exp (Dwarf::_location): Handle DW_OP_GNU_implicit_pointer with proper size. --- gdb/testsuite/lib/dwarf.exp | 7 ++++++- 1 file changed, 6 insertions(+), 1 deletion(-) diff --git a/gdb/testsuite/lib/dwarf.exp b/gdb/testsuite/lib/dwarf.exp index f7e4236..1883c86 100644 --- a/gdb/testsuite/lib/dwarf.exp +++ b/gdb/testsuite/lib/dwarf.exp @@ -845,6 +845,7 @@ namespace eval Dwarf { proc _location {body} { variable _constants variable _cu_label + variable _cu_version variable _cu_addr_size variable _cu_offset_size @@ -918,7 +919,11 @@ namespace eval Dwarf { # Here label is a section offset. set label [lindex $line 1] - _op .${_cu_offset_size}byte $label + if { $_cu_version == 2 } { + _op .${_cu_addr_size}byte $label + } else { + _op .${_cu_offset_size}byte $label + } _op .sleb128 [lindex $line 2] }