From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: (qmail 25307 invoked by alias); 6 Jun 2016 19:22:59 -0000 Mailing-List: contact gdb-patches-help@sourceware.org; run by ezmlm Precedence: bulk List-Id: List-Subscribe: List-Archive: List-Post: List-Help: , Sender: gdb-patches-owner@sourceware.org Received: (qmail 25273 invoked by uid 89); 6 Jun 2016 19:22:58 -0000 Authentication-Results: sourceware.org; auth=none X-Virus-Found: No X-Spam-SWARE-Status: No, score=-2.4 required=5.0 tests=AWL,BAYES_00,FREEMAIL_FROM,RCVD_IN_DNSWL_LOW,SPF_PASS autolearn=ham version=3.3.2 spammy=contemporary, additions, Hx-spam-relays-external:sk:broadba, H*RU:sk:broadba X-HELO: mail-lf0-f67.google.com Received: from mail-lf0-f67.google.com (HELO mail-lf0-f67.google.com) (209.85.215.67) by sourceware.org (qpsmtpd/0.93/v0.84-503-g423c35a) with (AES128-GCM-SHA256 encrypted) ESMTPS; Mon, 06 Jun 2016 19:22:48 +0000 Received: by mail-lf0-f67.google.com with SMTP id j198so78405lfe.0 for ; Mon, 06 Jun 2016 12:22:47 -0700 (PDT) X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20130820; h=x-gm-message-state:sender:from:to:cc:subject:date:message-id :in-reply-to:references; bh=YpwzjxVRx6kMgqKzPDTZTMNzQIEY4b1hBCedqzoyNsM=; b=RfsVzmUvG6NsXTJgi88PRmzzWJso+oLC84CxezqmIZ1w7qHRxacCGOJkxkQea4m8fX AYY6iQJUobNBiVVcFaLhQd1iSD0I9ebshHX4cNqed1ZApDg8S5UpQoj+A1y8ffJZ+BWH 4Vn7w3PgEBMbi5Sf/lQAr+UyyDVUXLc0oV7lGmuCEh5114AE7ba4p6E/B6Ll94gnuU25 izBMDZQXmeHZZ8k/xxEUEUon01cHyS92ZJsfJ3unsXTRv5ARwmCoR8avan0qESmBnPMU kXbStTO1b2IGd/6p5EW9D9ae/aYnEPYcN7qvSHa+RGSd+uNlghNcje+cwvlS7fviqFHQ S08Q== X-Gm-Message-State: ALyK8tLXVq8plENdFywtVgsaYCTDNyGdvBGAP+D+WV9oFANCqHnBL6M7tvrAG6W8UNH+Yw== X-Received: by 10.46.0.2 with SMTP id 2mr4974273lja.40.1465240964596; Mon, 06 Jun 2016 12:22:44 -0700 (PDT) Received: from localhost.localdomain (broadband-90-154-70-138.nationalcablenetworks.ru. [90.154.70.138]) by smtp.gmail.com with ESMTPSA id jv7sm1970253lbc.4.2016.06.06.12.22.43 (version=TLS1_2 cipher=ECDHE-RSA-AES128-GCM-SHA256 bits=128/128); Mon, 06 Jun 2016 12:22:43 -0700 (PDT) From: Artemiy Volkov To: gdb-patches@sourceware.org Cc: palves@redhat.com, keiths@redhat.com, Artemiy Volkov Subject: [PATCH v5 00/11] [PR gdb/14441] Support C++11 rvalue references in gdb Date: Mon, 06 Jun 2016 19:22:00 -0000 Message-Id: <20160606192225.12384-1-artemiyv@acm.org> In-Reply-To: <1458593958-25656-1-git-send-email-artemiyv@acm.org> References: <1458593958-25656-1-git-send-email-artemiyv@acm.org> X-IsSubscribed: yes X-SW-Source: 2016-06/txt/msg00104.txt.bz2 Hi all, this is my fifth take on fixing gdb/14441 which deals with C++11 rvalue references. The approach is rather straightforward and the work for the most part consisted of mimicking the behavior for regular references. In gdbtypes.c, several helper functions were introduced and some parameterized by the reference kind to simplify the access to reference type objects API. The only interesting part is the addition of overloading resolution rules with regard to rvalue references. All of the cases introduced in 13.3.3.1.4 and 13.3.3.2 were accounted for at the beginning of rank_one_type(). With this patch it is now also possible to fix the evaluation of decltype, which should return a plain type object, an lvalue reference or an rvalue reference depending on a type category of the type of its operand. However, this would require introduction of the type category notion to gdb, which I think only needs adding a new constant to lval_type and propagating the type category through different parts of an expression in gdb/valops.c. I'm willing to do this if this patchset turns out to be OK. Changes from v1 consist of dropping the libiberty part of 05/11 and the consequent testsuite changes. I have learned that introducing rvalue reference support to the demangler in cplus-dem.c is completely unnecessary, since virtually all contemporary compilers generate symbol names handled in cp-demangle.c. Therefore I have removed some of the testcases in gdb.cp/demangle.exp and switched the others to use the gnu-v3 demangling style. Changes from v2 are numerous coding style fixes, improvements and simplifications of the changelog, reorganization and reordering of the patchset, removal of redundant code in gdb/python/*, addition of a couple of python tests, and a few bugfixes. Changes from v3 are a few more coding style / English grammar fixes and code simplifications left over from v2. Changes from v4 consist for the most part of reorganizing the additions to the testsuite: instead of putting the newly created testcases next to the matching lvalue reference tests, we create new files in the testsuite to place them into; also a small bug in the python part of the patchset has been fixed and the whole thing rebased against the current master branch. I have also added the PR number to the Changelog entries in the commit messages. Artemiy Volkov (11): gdb: gdbtypes: add definitions for rvalue reference type gdb: gdbtypes: change {lookup,make}_reference_type() API gdb: valops: add ability to return rvalue reference values from value_ref() gdb: parse: support rvalue reference type gdb: demangle: implement demangling for rvalue reference typenames gdb: print: implement correct printing of rvalue reference types and values gdb: dwarf2read: support DW_TAG_rvalue_reference type gdb: python: support rvalue references in the gdb module gdb: convert lvalue reference type check to general reference type check gdb: gdbtypes: add rvalue references to overloading resolution gdb: testsuite: add rvalue reference tests gdb/aarch64-tdep.c | 5 +- gdb/ada-lang.c | 2 +- gdb/amd64-tdep.c | 2 +- gdb/amd64-windows-tdep.c | 1 + gdb/arm-tdep.c | 5 +- gdb/ax-gdb.c | 2 + gdb/c-exp.y | 6 +- gdb/c-typeprint.c | 10 +- gdb/c-valprint.c | 14 +- gdb/c-varobj.c | 10 +- gdb/compile/compile-c-symbols.c | 2 +- gdb/completer.c | 3 +- gdb/cp-name-parser.y | 4 + gdb/cp-support.c | 3 +- gdb/darwin-nat-info.c | 2 +- gdb/dwarf2loc.c | 4 +- gdb/dwarf2read.c | 15 +- gdb/eval.c | 16 +- gdb/f-exp.y | 2 +- gdb/findvar.c | 6 +- gdb/gdbtypes.c | 105 +++++++++++-- gdb/gdbtypes.h | 20 ++- gdb/guile/scm-type.c | 2 +- gdb/guile/scm-value.c | 2 +- gdb/hppa-tdep.c | 1 + gdb/infcall.c | 5 +- gdb/language.c | 3 +- gdb/m32c-tdep.c | 8 +- gdb/m88k-tdep.c | 1 + gdb/mn10300-tdep.c | 1 + gdb/msp430-tdep.c | 2 +- gdb/parse.c | 39 ++--- gdb/parser-defs.h | 1 + gdb/ppc-sysv-tdep.c | 7 +- gdb/printcmd.c | 2 +- gdb/python/lib/gdb/command/explore.py | 2 +- gdb/python/lib/gdb/types.py | 4 +- gdb/python/py-type.c | 14 +- gdb/python/py-value.c | 37 +++-- gdb/python/py-xmethods.c | 10 +- gdb/s390-linux-tdep.c | 2 +- gdb/sparc-tdep.c | 1 + gdb/sparc64-tdep.c | 1 + gdb/spu-tdep.c | 1 + gdb/stabsread.c | 3 +- gdb/symtab.c | 3 +- gdb/testsuite/gdb.cp/demangle.exp | 36 +++++ gdb/testsuite/gdb.cp/rvalue-ref-casts.cc | 56 +++++++ gdb/testsuite/gdb.cp/rvalue-ref-casts.exp | 76 ++++++++++ gdb/testsuite/gdb.cp/rvalue-ref-overload.cc | 39 +++++ gdb/testsuite/gdb.cp/rvalue-ref-overload.exp | 103 +++++++++++++ gdb/testsuite/gdb.cp/rvalue-ref-params.cc | 74 +++++++++ gdb/testsuite/gdb.cp/rvalue-ref-params.exp | 61 ++++++++ gdb/testsuite/gdb.cp/rvalue-ref-sizeof.cc | 73 +++++++++ gdb/testsuite/gdb.cp/rvalue-ref-sizeof.exp | 43 ++++++ gdb/testsuite/gdb.cp/rvalue-ref-types.cc | 73 +++++++++ gdb/testsuite/gdb.cp/rvalue-ref-types.exp | 165 +++++++++++++++++++++ gdb/testsuite/gdb.python/py-rvalue-ref-value-cc.cc | 55 +++++++ .../gdb.python/py-rvalue-ref-value-cc.exp | 56 +++++++ gdb/typeprint.c | 4 +- gdb/valarith.c | 6 +- gdb/valops.c | 70 ++++----- gdb/valprint.c | 5 +- gdb/value.c | 12 +- gdb/value.h | 2 +- gdb/varobj.c | 2 +- 66 files changed, 1235 insertions(+), 167 deletions(-) create mode 100644 gdb/testsuite/gdb.cp/rvalue-ref-casts.cc create mode 100644 gdb/testsuite/gdb.cp/rvalue-ref-casts.exp create mode 100644 gdb/testsuite/gdb.cp/rvalue-ref-overload.cc create mode 100644 gdb/testsuite/gdb.cp/rvalue-ref-overload.exp create mode 100644 gdb/testsuite/gdb.cp/rvalue-ref-params.cc create mode 100644 gdb/testsuite/gdb.cp/rvalue-ref-params.exp create mode 100644 gdb/testsuite/gdb.cp/rvalue-ref-sizeof.cc create mode 100644 gdb/testsuite/gdb.cp/rvalue-ref-sizeof.exp create mode 100644 gdb/testsuite/gdb.cp/rvalue-ref-types.cc create mode 100644 gdb/testsuite/gdb.cp/rvalue-ref-types.exp create mode 100644 gdb/testsuite/gdb.python/py-rvalue-ref-value-cc.cc create mode 100644 gdb/testsuite/gdb.python/py-rvalue-ref-value-cc.exp -- 2.8.3