From patchwork Wed Jun 5 10:34:44 2013 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Will Newton X-Patchwork-Id: 17542 Return-Path: X-Original-To: linaro@patches.linaro.org Delivered-To: linaro@patches.linaro.org Received: from mail-qe0-f69.google.com (mail-qe0-f69.google.com [209.85.128.69]) by ip-10-151-82-157.ec2.internal (Postfix) with ESMTPS id C072520F5A for ; Wed, 5 Jun 2013 10:34:49 +0000 (UTC) Received: by mail-qe0-f69.google.com with SMTP id 6sf1666775qeb.4 for ; Wed, 05 Jun 2013 03:34:49 -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=pbuDrvuk5W9ZCJ1AbAKpLRESBdQD5sJ2n0kkFHnyQ2M=; b=UCvD8GMi02JAZ6s7r3xKISam45C2UhdbFsDhoN27nXzxMuFXvj8PDVUV7kmW1z6XEH YHanzfjwwOibXzy5HouThk0qtiqR44zelAi8o3iT5WHnb09QNeRk8eeXd2/JPabJ4AOL RYYYiJYY1cZXBwTJL6YKDi7314aQDmNuFGaXWV1YXXXXNKuxZx4Uf5wQ9/lFpmcwgZhG LGHe5t+phlbnwyq8caULBvh460qPALj+udOfGYeTVbuObEMTTZEJSWNf4lqUm1pIbkxb wp/UEn8cYJKxEdyo2OmQ9NE8tiw0PAjfraw0KUgnniuGTr4Yq8SYtLnQFpHNDoT6c0fY WUPg== X-Received: by 10.224.200.202 with SMTP id ex10mr18607727qab.8.1370428489374; Wed, 05 Jun 2013 03:34:49 -0700 (PDT) X-BeenThere: patchwork-forward@linaro.org Received: by 10.49.71.210 with SMTP id x18ls586085qeu.85.gmail; Wed, 05 Jun 2013 03:34:49 -0700 (PDT) X-Received: by 10.52.180.136 with SMTP id do8mr17166663vdc.105.1370428489108; Wed, 05 Jun 2013 03:34:49 -0700 (PDT) Received: from mail-vb0-x22e.google.com (mail-vb0-x22e.google.com [2607:f8b0:400c:c02::22e]) by mx.google.com with ESMTPS id wl5si39386523vec.16.2013.06.05.03.34.48 for (version=TLSv1 cipher=ECDHE-RSA-RC4-SHA bits=128/128); Wed, 05 Jun 2013 03:34:48 -0700 (PDT) Received-SPF: neutral (google.com: 2607:f8b0:400c:c02::22e 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::22e; Received: by mail-vb0-f46.google.com with SMTP id 10so947437vbe.19 for ; Wed, 05 Jun 2013 03:34:48 -0700 (PDT) X-Received: by 10.52.53.36 with SMTP id y4mr16759665vdo.51.1370428488684; Wed, 05 Jun 2013 03:34:48 -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 pb14csp12753vcb; Wed, 5 Jun 2013 03:34:48 -0700 (PDT) X-Received: by 10.204.66.133 with SMTP id n5mr1229587bki.38.1370428487585; Wed, 05 Jun 2013 03:34:47 -0700 (PDT) Received: from mail-bk0-x229.google.com (mail-bk0-x229.google.com [2a00:1450:4008:c01::229]) by mx.google.com with ESMTPS id ur3si19549619bkb.228.2013.06.05.03.34.47 for (version=TLSv1 cipher=ECDHE-RSA-RC4-SHA bits=128/128); Wed, 05 Jun 2013 03:34:47 -0700 (PDT) Received-SPF: neutral (google.com: 2a00:1450:4008:c01::229 is neither permitted nor denied by best guess record for domain of will.newton@linaro.org) client-ip=2a00:1450:4008:c01::229; Received: by mail-bk0-f41.google.com with SMTP id jc3so780608bkc.28 for ; Wed, 05 Jun 2013 03:34:47 -0700 (PDT) X-Received: by 10.204.246.194 with SMTP id lz2mr9120913bkb.98.1370428486882; Wed, 05 Jun 2013 03:34:46 -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 so13sm25360463bkb.15.2013.06.05.03.34.45 for (version=TLSv1 cipher=RC4-SHA bits=128/128); Wed, 05 Jun 2013 03:34:45 -0700 (PDT) Message-ID: <51AF1444.5080800@linaro.org> Date: Wed, 05 Jun 2013 11:34:44 +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 1/3] gdb/printcmd.c: Fix printing of Thumb minimal symbols. X-Gm-Message-State: ALoCoQnLofXVXtyN2CousxGju1zS2Gn8/QpIGuUkHrdsiGUld2XXB+NQ2Xqhc2fKXiXFmtKhlJVR X-Original-Sender: will.newton@linaro.org X-Original-Authentication-Results: mx.google.com; spf=neutral (google.com: 2607:f8b0:400c:c02::22e 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 | 10 ++++++++++ 1 file changed, 10 insertions(+) diff --git a/gdb/printcmd.c b/gdb/printcmd.c index 7beb334..619e684 100644 --- a/gdb/printcmd.c +++ b/gdb/printcmd.c @@ -689,6 +689,16 @@ 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) + addr = gdbarch_addr_bits_remove (gdbarch, addr); + /* The msymbol is closer to the address than the symbol; use the msymbol instead. */ symbol = 0;