From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: (qmail 23489 invoked by alias); 10 Apr 2014 12:42:06 -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 23475 invoked by uid 89); 10 Apr 2014 12:42:05 -0000 Authentication-Results: sourceware.org; auth=none X-Virus-Found: No X-Spam-SWARE-Status: No, score=-1.8 required=5.0 tests=AWL,BAYES_00,RP_MATCHES_RCVD autolearn=ham version=3.3.2 X-HELO: mga01.intel.com Received: from mga01.intel.com (HELO mga01.intel.com) (192.55.52.88) by sourceware.org (qpsmtpd/0.93/v0.84-503-g423c35a) with ESMTP; Thu, 10 Apr 2014 12:42:03 +0000 Received: from fmsmga001.fm.intel.com ([10.253.24.23]) by fmsmga101.fm.intel.com with ESMTP; 10 Apr 2014 05:42:01 -0700 X-ExtLoop1: 1 Received: from irvmail001.ir.intel.com ([163.33.26.43]) by fmsmga001.fm.intel.com with ESMTP; 10 Apr 2014 05:41:31 -0700 Received: from ulliclel004.iul.intel.com (ulliclel004.iul.intel.com [172.28.50.125]) by irvmail001.ir.intel.com (8.14.3/8.13.6/MailSET/Hub) with ESMTP id s3ACfFNY009396; Thu, 10 Apr 2014 13:41:20 +0100 Received: from ulliclel004.iul.intel.com (ulliclel004.iul.intel.com [127.0.0.1]) by ulliclel004.iul.intel.com (8.13.8/8.12.8/MailSET/client) with ESMTP id s3ACeNsH026725; Thu, 10 Apr 2014 14:40:44 +0200 Received: (from sagovic@localhost) by ulliclel004.iul.intel.com (8.13.8/8.13.1/Submit) id s3ACeHf1026724; Thu, 10 Apr 2014 14:40:17 +0200 From: Sanimir Agovic To: brobecker@adacore.com Cc: gdb-patches@sourceware.org, tromey@redhat.com Subject: [PATCH v6 00/15] Please have a final look Date: Thu, 10 Apr 2014 12:42:00 -0000 Message-Id: <1397133617-26681-1-git-send-email-sanimir.agovic@intel.com> X-IsSubscribed: yes X-SW-Source: 2014-04/txt/msg00157.txt.bz2 Hello, this patch series (v6) add C99 variable length support to gdb. Current status ============== TYPE_CODE_PTR types are not considered as being dynamic, otherwise all issues are addressed mentioned by Joel: #03 | type: add c99 variable length array support Minor adjustments like usage of bitfields and dealing with LOC_CONST values: #09 | vla: resolve dynamic bounds if value contents is a constant byte-seq #08 | vla: support for DW_AT_count #10 | vla: evaluate operand of sizeof if its type is a vla Pre-approved with minor adjustments: #01 | refactoring: rename create_range_type to create_static_range_type #02 | vla: introduce new bound type abstraction adapt uses #04 | vla: enable sizeof operator to work with variable length arrays #05 | vla: enable sizeof operator for indirection #06 | vla: update type from newly created value #07 | vla: print "variable length" for unresolved dynamic bounds #11 | test: cover subranges with present DW_AT_count attribute #12 | test: multi-dimensional c99 vla #13 | test: evaluate pointers to C99 vla correctly #14 | test: basic c99 vla tests for C primitives #15 | test: add mi vla test Some technical background ========================= Dwarf allows certain attributes e.g upper/lower bound to be computed dynamically. To support this feature with the current gdb type-system types are "normalized". This means types with dynamic properties are converted to types with static properties. To convert a type with dynamic properties into one with static properties access to inferior memory is needed. Therefore we hooked into the following value constructors value_at/value_at_lazy/value_from_contents_and_address as they require an inferior address in addition to a type to instantiate a value. If the passed type has dynamic properties we resolve the bounds and thus the type is modified, not in place but rather by a new copy. Given the following code snippet: struct value *val = value_at (my_vla_type, at_address); Before this was always true: TYPE_LENGTH (value_type (val)) == TYPE_LENGTH (my_vla_type) This is not the case after applying this patch series. Type normalization is done in the mentioned value constructors and might change the value type. Some documentation, examples as well as a github branch with support for c99 and Fortran variable length arrays is availabel at http://intel-gdb.github.io/ -Sanimir & Keven Sanimir Agovic (15): refactoring: rename create_range_type to create_static_range_type vla: introduce new bound type abstraction adapt uses type: add c99 variable length array support vla: enable sizeof operator to work with variable length arrays vla: enable sizeof operator for indirection vla: update type from newly created value vla: print "variable length" for unresolved dynamic bounds vla: support for DW_AT_count vla: resolve dynamic bounds if value contents is a constant byte-sequence vla: evaluate operand of sizeof if its type is a vla test: cover subranges with present DW_AT_count attribute test: multi-dimensional c99 vla. test: evaluate pointers to C99 vla correctly. test: basic c99 vla tests for C primitives test: add mi vla test gdb/ada-lang.c | 44 ++++-- gdb/c-typeprint.c | 6 +- gdb/coffread.c | 6 +- gdb/cp-valprint.c | 2 + gdb/d-valprint.c | 1 + gdb/dwarf2loc.c | 119 ++++++++++++++ gdb/dwarf2loc.h | 28 ++++ gdb/dwarf2read.c | 159 +++++++++++++------ gdb/eval.c | 54 ++++++- gdb/f-exp.y | 9 +- gdb/findvar.c | 8 +- gdb/gdbtypes.c | 254 ++++++++++++++++++++++-------- gdb/gdbtypes.h | 76 +++++++-- gdb/jv-valprint.c | 1 + gdb/m2-valprint.c | 2 +- gdb/mdebugread.c | 4 +- gdb/parse.c | 3 +- gdb/stabsread.c | 11 +- gdb/testsuite/gdb.base/vla-datatypes.c | 86 ++++++++++ gdb/testsuite/gdb.base/vla-datatypes.exp | 139 ++++++++++++++++ gdb/testsuite/gdb.base/vla-multi.c | 48 ++++++ gdb/testsuite/gdb.base/vla-multi.exp | 41 +++++ gdb/testsuite/gdb.base/vla-ptr.c | 58 +++++++ gdb/testsuite/gdb.base/vla-ptr.exp | 41 +++++ gdb/testsuite/gdb.base/vla-sideeffect.c | 42 +++++ gdb/testsuite/gdb.base/vla-sideeffect.exp | 89 +++++++++++ gdb/testsuite/gdb.dwarf2/count.exp | 125 +++++++++++++++ gdb/testsuite/gdb.mi/mi-vla-c99.exp | 82 ++++++++++ gdb/testsuite/gdb.mi/vla.c | 37 +++++ gdb/valops.c | 35 ++-- gdb/valprint.c | 2 +- gdb/value.c | 20 ++- 32 files changed, 1447 insertions(+), 185 deletions(-) create mode 100644 gdb/testsuite/gdb.base/vla-datatypes.c create mode 100644 gdb/testsuite/gdb.base/vla-datatypes.exp create mode 100644 gdb/testsuite/gdb.base/vla-multi.c create mode 100644 gdb/testsuite/gdb.base/vla-multi.exp create mode 100644 gdb/testsuite/gdb.base/vla-ptr.c create mode 100644 gdb/testsuite/gdb.base/vla-ptr.exp create mode 100644 gdb/testsuite/gdb.base/vla-sideeffect.c create mode 100644 gdb/testsuite/gdb.base/vla-sideeffect.exp create mode 100644 gdb/testsuite/gdb.dwarf2/count.exp create mode 100644 gdb/testsuite/gdb.mi/mi-vla-c99.exp create mode 100644 gdb/testsuite/gdb.mi/vla.c -- 1.8.4.2