This is the mail archive of the gdb-cvs@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]

gdb and binutils branch master updated. f7c77d9323a3dcd6e52a8038d0cdab0748e5bc62


This is an automated email from the git hooks/post-receive script. It was
generated because a ref change was pushed to the repository containing
the project "gdb and binutils".

The branch, master has been updated
       via  f7c77d9323a3dcd6e52a8038d0cdab0748e5bc62 (commit)
       via  11aa919a07114ba99a99a7dcd43079440bbe5161 (commit)
      from  d4ccb5e05c99c4006fe43ab08ebe13b7a74fc111 (commit)

Those revisions listed above that are new to this repository have
not appeared on any other notification email; so we list those
revisions in full, below.

- Log -----------------------------------------------------------------
https://sourceware.org/git/gitweb.cgi?p=binutils-gdb.git;h=f7c77d9323a3dcd6e52a8038d0cdab0748e5bc62

commit f7c77d9323a3dcd6e52a8038d0cdab0748e5bc62
Author: Joel Brobecker <brobecker@adacore.com>
Date:   Mon Mar 17 08:41:48 2014 -0700

    [testsuite/Ada] New testcase for packed array renaming.
    
    gdb/testsuite/ChangeLog:
    
            * gdb.ada/pckd_arr_ren: New testcase.

https://sourceware.org/git/gitweb.cgi?p=binutils-gdb.git;h=11aa919a07114ba99a99a7dcd43079440bbe5161

commit 11aa919a07114ba99a99a7dcd43079440bbe5161
Author: Pierre-Marie de Rodat <derodat@adacore.com>
Date:   Fri Mar 14 14:55:42 2014 +0100

    [Ada] Crash with references to GNAT packed arrays handling
    
    Consider the following declarations:
    
      type Packed_Array is array (Natural range <>) of Boolean;
      pragma Pack (Packed_Array);
    
      function Make (H, L : Natural) return Packed_Array is
      begin
         return (H .. L => False);
      end Make;
    
      A1 : Packed_Array := Make (1, 2);
      A2 : Packed_Array renames A1;
    
    One possible DWARF translation for A2 is:
    
      <3><1e4>: Abbrev Number: 21 (DW_TAG_variable)
         <1e5>   DW_AT_name                 : a2
         <1ea>   DW_AT_type                 : <0x1d9>
    
      <3><1d9>: Abbrev Number: 22 (DW_TAG_const_type)
         <1da>   DW_AT_type                 : <0x1de>
      <3><1de>: Abbrev Number: 23 (DW_TAG_reference_type)
         <1e0>   DW_AT_type                 : <0x1a3>
      <3><1a3>: Abbrev Number: 17 (DW_TAG_array_type)
         <1a4>   DW_AT_name                 : foo__Ta1S___XP1
         <1a8>   DW_AT_GNAT_descriptive_type: <0x16b>
    
      <3><16b>: Abbrev Number: 6 (DW_TAG_typedef)
         <16c>   DW_AT_name                 : foo__Ta1S
         <172>   DW_AT_type                 : <0x176>
      <3><176>: Abbrev Number: 17 (DW_TAG_array_type)
         <177>   DW_AT_name                 : foo__Ta1S
         <17b>   DW_AT_GNAT_descriptive_type: <0x223>
    
    Here, foo__Ta1S___XP1 is the type used for the code generation while
    foo__Ta1S is the source-level type. Both form a valid GNAT encoding for
    a packed array type.
    
    Trying to print A2 (1) can make GDB crash. This is because A2 is defined
    as a reference to a GNAT encoding for a packed array. When decoding
    constrained packed arrays, the ada_coerce_ref subprogram follows
    references and returns a fixed type from the target type, peeling
    the GNAT encoding for packed arrays. The remaining code assumes that
    the resulting type is still such an encoding while we only have
    a standard GDB array type, hence the crash:
    
      arr = ada_coerce_ref (arr);
      [...]
      type = decode_constrained_packed_array_type (value_type (arr));
    
    decode_constrained_packed_array_type assumes that its argument is
    such an encoding. From its front comment:
    
      /* The array type encoded by TYPE, where
         ada_is_constrained_packed_array_type (TYPE).  */
    
    This patch simply replaces the call to ada_coerce_ref with a call
    to coerce_ref in order to avoid prematurely transforming
    the packed array type as a side-effect. This way, the remaining code
    will always work with a GNAT encoding.
    
    gdb/ChangeLog:
    
    	* ada-lang.c (decode_constrained_packed_array): Perform a
    	minimal coercion for reference with coerce_ref instead of
    	ada_coerce_ref.

-----------------------------------------------------------------------

Summary of changes:
 gdb/ChangeLog                              |    6 +++++
 gdb/ada-lang.c                             |   16 ++++++------
 gdb/testsuite/ChangeLog                    |    4 +++
 gdb/testsuite/gdb.ada/pckd_arr_ren.exp     |   33 ++++++++++++++++++++++++++++
 gdb/testsuite/gdb.ada/pckd_arr_ren/foo.adb |   24 ++++++++++++++++++++
 gdb/testsuite/gdb.ada/pckd_arr_ren/pck.adb |   26 ++++++++++++++++++++++
 gdb/testsuite/gdb.ada/pckd_arr_ren/pck.ads |   24 ++++++++++++++++++++
 7 files changed, 125 insertions(+), 8 deletions(-)
 create mode 100644 gdb/testsuite/gdb.ada/pckd_arr_ren.exp
 create mode 100644 gdb/testsuite/gdb.ada/pckd_arr_ren/foo.adb
 create mode 100644 gdb/testsuite/gdb.ada/pckd_arr_ren/pck.adb
 create mode 100644 gdb/testsuite/gdb.ada/pckd_arr_ren/pck.ads


hooks/post-receive
-- 
gdb and binutils


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