From patchwork Thu Jun 6 09:13:45 2013 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Will Newton X-Patchwork-Id: 17583 Return-Path: X-Original-To: linaro@patches.linaro.org Delivered-To: linaro@patches.linaro.org Received: from mail-vb0-f70.google.com (mail-vb0-f70.google.com [209.85.212.70]) by ip-10-151-82-157.ec2.internal (Postfix) with ESMTPS id 5AAFE25DEA for ; Thu, 6 Jun 2013 09:13:51 +0000 (UTC) Received: by mail-vb0-f70.google.com with SMTP id f13sf2757261vbg.1 for ; Thu, 06 Jun 2013 02:13:51 -0700 (PDT) X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=20120113; h=x-beenthere:x-forwarded-to:x-forwarded-for:delivered-to:message-id :date:from:user-agent:mime-version:to:cc:subject:x-gm-message-state :x-original-sender:x-original-authentication-results:precedence :mailing-list:list-id:x-google-group-id:list-post:list-help :list-archive:list-unsubscribe:content-type :content-transfer-encoding; bh=WGjdJUwmDyLWMfs7ZJBQyiDMGUZJdmIUzVKANCjkVOE=; b=BWKT2YNzy8PTdr+T12jAWAtufPbb+bZPgGGIKVLMD70GCc0DslTt3bl4C6wqACo+RR nL6iiqWAvjEZ928xFSPb9LLLJUAan0CIXjvRvTCdcGozkW9RPFqAlE+xwB2b/gqUtfxH iraqSyNITyrzseNdEhwmiySd7OXzL0Psb7k5fVumT+Z6mXWOGqwoSheAl7+56SqVCsJg Rqt9RWC80pw0cZunNLM6aGRoww3rOTR6fOAqr/EPZQ3qQJrBSabwz8JoPmLnq7994YTZ rPY4s1JG04lHwwXMe8j+SQIHAlT8/tgb4SKdgFR9EFoLsPFW33jdbRd9JU5EQ6BLk1XN CKFg== X-Received: by 10.236.137.176 with SMTP id y36mr19861198yhi.6.1370510030730; Thu, 06 Jun 2013 02:13:50 -0700 (PDT) X-BeenThere: patchwork-forward@linaro.org Received: by 10.49.64.196 with SMTP id q4ls1241866qes.72.gmail; Thu, 06 Jun 2013 02:13:50 -0700 (PDT) X-Received: by 10.220.158.135 with SMTP id f7mr21683137vcx.34.1370510030246; Thu, 06 Jun 2013 02:13:50 -0700 (PDT) Received: from mail-vb0-x231.google.com (mail-vb0-x231.google.com [2607:f8b0:400c:c02::231]) by mx.google.com with ESMTPS id nw6si7282425vcb.11.2013.06.06.02.13.50 for (version=TLSv1 cipher=ECDHE-RSA-RC4-SHA bits=128/128); Thu, 06 Jun 2013 02:13:50 -0700 (PDT) Received-SPF: neutral (google.com: 2607:f8b0:400c:c02::231 is neither permitted nor denied by best guess record for domain of patch+caf_=patchwork-forward=linaro.org@linaro.org) client-ip=2607:f8b0:400c:c02::231; Received: by mail-vb0-f49.google.com with SMTP id q13so1780942vbe.36 for ; Thu, 06 Jun 2013 02:13:50 -0700 (PDT) X-Received: by 10.52.157.138 with SMTP id wm10mr18552656vdb.57.1370510030069; Thu, 06 Jun 2013 02:13:50 -0700 (PDT) X-Forwarded-To: patchwork-forward@linaro.org X-Forwarded-For: patch@linaro.org patchwork-forward@linaro.org Delivered-To: patches@linaro.org Received: by 10.221.10.206 with SMTP id pb14csp58887vcb; Thu, 6 Jun 2013 02:13:49 -0700 (PDT) X-Received: by 10.204.78.12 with SMTP id i12mr10836807bkk.105.1370510028690; Thu, 06 Jun 2013 02:13:48 -0700 (PDT) Received: from mail-bk0-x233.google.com (mail-bk0-x233.google.com [2a00:1450:4008:c01::233]) by mx.google.com with ESMTPS id tq10si17447818bkb.319.2013.06.06.02.13.48 for (version=TLSv1 cipher=ECDHE-RSA-RC4-SHA bits=128/128); Thu, 06 Jun 2013 02:13:48 -0700 (PDT) Received-SPF: neutral (google.com: 2a00:1450:4008:c01::233 is neither permitted nor denied by best guess record for domain of will.newton@linaro.org) client-ip=2a00:1450:4008:c01::233; Received: by mail-bk0-f51.google.com with SMTP id ji1so659687bkc.38 for ; Thu, 06 Jun 2013 02:13:48 -0700 (PDT) X-Received: by 10.205.46.4 with SMTP id um4mr10803944bkb.116.1370510027959; Thu, 06 Jun 2013 02:13:47 -0700 (PDT) Received: from localhost.localdomain (cpc11-seac20-2-0-cust84.7-2.cable.virginmedia.com. [81.108.156.85]) by mx.google.com with ESMTPSA id hh3sm14642240bkc.5.2013.06.06.02.13.46 for (version=TLSv1 cipher=RC4-SHA bits=128/128); Thu, 06 Jun 2013 02:13:47 -0700 (PDT) Message-ID: <51B052C9.4060703@linaro.org> Date: Thu, 06 Jun 2013 10:13:45 +0100 From: Will Newton User-Agent: Mozilla/5.0 (X11; Linux x86_64; rv:17.0) Gecko/20130514 Thunderbird/17.0.6 MIME-Version: 1.0 To: gdb-patches@sourceware.org CC: patches@linaro.org Subject: [PATCH, v2] gdb/printcmd.c: Fix printing of Thumb minimal symbols. X-Gm-Message-State: ALoCoQlR159Aw6fcxnYq1YCP5oJ3xmZpW7+65ViCb8olqXV/DC8z8AzBfw4odm6hWdDYNg+2JKBG X-Original-Sender: will.newton@linaro.org X-Original-Authentication-Results: mx.google.com; spf=neutral (google.com: 2607:f8b0:400c:c02::231 is neither permitted nor denied by best guess record for domain of patch+caf_=patchwork-forward=linaro.org@linaro.org) smtp.mail=patch+caf_=patchwork-forward=linaro.org@linaro.org Precedence: list Mailing-list: list patchwork-forward@linaro.org; contact patchwork-forward+owners@linaro.org List-ID: X-Google-Group-Id: 836684582541 List-Post: , List-Help: , List-Archive: List-Unsubscribe: , In build_address_symbolic we call gdbarch_addr_bits_remove for symbols in the symbol table but not for minimal symbols. This causes a failure in gdb.cp/virtfunc.exp on ARM, as the address of the virtual thunk is given an offset of 1 when in Thumb mode. gdb/ChangeLog: 2013-06-05 Will Newton * printcmd.c (build_address_symbolic): Call gdbarch_addr_bits_remove for text minimal symbols. --- gdb/printcmd.c | 11 +++++++++++ 1 file changed, 11 insertions(+) Changes since v1: - Also check for minimal symbols of type mst_solib_trampoline. diff --git a/gdb/printcmd.c b/gdb/printcmd.c index 7beb334..99d4dba 100644 --- a/gdb/printcmd.c +++ b/gdb/printcmd.c @@ -689,6 +689,17 @@ build_address_symbolic (struct gdbarch *gdbarch, { if (SYMBOL_VALUE_ADDRESS (msymbol) > name_location || symbol == NULL) { + /* If this is a function (i.e. a code address), strip out any + non-address bits. For instance, display a pointer to the + first instruction of a Thumb function as ; the + second instruction will be , even though the + pointer is . This matches the ISA behavior. */ + if (MSYMBOL_TYPE (msymbol) == mst_text + || MSYMBOL_TYPE (msymbol) == mst_text_gnu_ifunc + || MSYMBOL_TYPE (msymbol) == mst_file_text + || MSYMBOL_TYPE (msymbol) == mst_solib_trampoline) + addr = gdbarch_addr_bits_remove (gdbarch, addr); + /* The msymbol is closer to the address than the symbol; use the msymbol instead. */ symbol = 0;