This is the mail archive of the gdb-patches@sourceware.org mailing list for the GDB project.


Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]
Other format: [Raw text]

[PATCH v6 00/15] Please have a final look


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


Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]