This is the mail archive of the
gdb-cvs@sourceware.org
mailing list for the GDB project.
gdb and binutils branch master updated. 963349348e119396aa1a326922624aa78398e7e7
- From: brobecke at sourceware dot org
- To: gdb-cvs at sourceware dot org
- Date: 10 Sep 2014 13:34:19 -0000
- Subject: gdb and binutils branch master updated. 963349348e119396aa1a326922624aa78398e7e7
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 963349348e119396aa1a326922624aa78398e7e7 (commit)
via eb47903935f507a11b6367d4a997b8ac95068c4c (commit)
via deede10c775af571f72a37efa5b763b45334b19e (commit)
via 7828a5f5fab040cdc007ce235c4c534aa777067b (commit)
from 35782f1465dd014737fcf6c82bdf733598a5c9b8 (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=963349348e119396aa1a326922624aa78398e7e7
commit 963349348e119396aa1a326922624aa78398e7e7
Author: Joel Brobecker <brobecker@adacore.com>
Date: Mon Sep 1 18:42:52 2014 +0200
dynarr-ptr.exp: Add ptype tests.
This patch adds a number of "ptype" tests to gdb.dwarf2/dynarr-ptr.exp.
gdb/testsuite/ChangeLog:
* gdb.dwarf2/dynarr-ptr.exp: Add a few ptype tests.
https://sourceware.org/git/gitweb.cgi?p=binutils-gdb.git;h=eb47903935f507a11b6367d4a997b8ac95068c4c
commit eb47903935f507a11b6367d4a997b8ac95068c4c
Author: Joel Brobecker <brobecker@adacore.com>
Date: Fri Aug 29 19:56:25 2014 +0200
Ada: Print bounds/length of pointer to array with dynamic bounds
Trying to print the bounds or the length of a pointer to an array
whose bounds are dynamic results in the following error:
(gdb) p foo.three_ptr.all'first
Location address is not set.
(gdb) p foo.three_ptr.all'length
Location address is not set.
This is because, after having dereferenced our array pointer, we
use the type of the resulting array value, instead of the enclosing
type. The former is the original type where the bounds are unresolved,
whereas we need to get the actual array bounds.
Similarly, trying to apply those attributes to the array pointer
directly (without explicitly dereferencing it with the '.all'
operator) yields the same kind of error:
(gdb) p foo.three_ptr'first
Location address is not set.
(gdb) p foo.three_ptr'length
Location address is not set.
This is caused by the fact that the dereference was done implicitly
in this case, and perform at the type level only, which is not
sufficient in order to resolve the array type.
This patch fixes both issues, thus allowing us to get the expected output:
(gdb) p foo.three_ptr.all'first
$1 = 1
(gdb) p foo.three_ptr.all'length
$2 = 3
(gdb) p foo.three_ptr'first
$3 = 1
(gdb) p foo.three_ptr'length
$4 = 3
gdb/ChangeLog:
* ada-lang.c (ada_array_bound): If ARR is a TYPE_CODE_PTR,
dereference it first. Use value_enclosing_type instead of
value_type.
(ada_array_length): Likewise.
gdb/testsuite/ChangeLog:
* gdb.dwarf2/dynarr-ptr.exp: Add 'first, 'last and 'length tests.
https://sourceware.org/git/gitweb.cgi?p=binutils-gdb.git;h=deede10c775af571f72a37efa5b763b45334b19e
commit deede10c775af571f72a37efa5b763b45334b19e
Author: Joel Brobecker <brobecker@adacore.com>
Date: Fri Aug 29 19:50:03 2014 +0200
Ada subscripting of pointer to array with dynamic bounds
Consider a pointer to an array which dynamic bounds, described in
DWARF as follow:
<1><25>: Abbrev Number: 4 (DW_TAG_array_type)
<26> DW_AT_name : foo__array_type
[...]
<2><3b>: Abbrev Number: 5 (DW_TAG_subrange_type)
[...]
<40> DW_AT_lower_bound : 5 byte block: 97 38 1c 94 4
(DW_OP_push_object_address; DW_OP_lit8; DW_OP_minus;
DW_OP_deref_size: 4)
<46> DW_AT_upper_bound : 5 byte block: 97 34 1c 94 4
(DW_OP_push_object_address; DW_OP_lit4; DW_OP_minus;
DW_OP_deref_size: 4)
GDB is now able to correctly print the entire array, but not one
element of the array. Eg:
(gdb) p foo.three_ptr.all
$1 = (1, 2, 3)
(gdb) p foo.three_ptr.all(1)
Cannot access memory at address 0xfffffffff4123a0c
The problem occurs because we are missing a dynamic resolution of
the variable's array type when subscripting the array. What the current
code does is "fix"-ing the array type using the GNAT encodings, but
that operation ignores any of the array's dynamic properties.
This patch fixes the issue by using ada_value_ind to dereference
the array pointer, which takes care of the array type resolution.
It also continues to "fix" arrays described using GNAT encodings,
so backwards compatibility is preserved.
gdb/ChangeLog:
* ada-lang.c (ada_value_ptr_subscript): Remove parameter "type".
Adjust function implementation and documentation accordingly.
(ada_evaluate_subexp) <OP_FUNCALL>: Only assign "type" if
NOSIDE is EVAL_AVOID_SIDE_EFFECTS.
Update call to ada_value_ptr_subscript.
gdb/testsuite/ChangeLog:
* gdb.dwarf2/dynarr-ptr.exp: Add subscripting tests.
https://sourceware.org/git/gitweb.cgi?p=binutils-gdb.git;h=7828a5f5fab040cdc007ce235c4c534aa777067b
commit 7828a5f5fab040cdc007ce235c4c534aa777067b
Author: Joel Brobecker <brobecker@adacore.com>
Date: Fri Aug 29 17:50:13 2014 +0200
print PTR.all where PTR is an Ada thin pointer
Consider the following declaration:
type Array_Type is array (Natural range <>) of Integer;
type Array_Ptr is access all Array_Type;
for Array_Ptr'Size use 64;
Three_Ptr : Array_Ptr := new Array_Type'(1 => 1, 2 => 2, 3 => 3);
This creates a pointer to an array where the bounds are stored
in a memory region just before the array itself (aka a "thin pointer").
In DWARF, this is described as a the usual pointer type to an array
whose subrange has dynamic values for its bounds:
<1><25>: Abbrev Number: 4 (DW_TAG_array_type)
<26> DW_AT_name : foo__array_type
[...]
<2><3b>: Abbrev Number: 5 (DW_TAG_subrange_type)
[...]
<40> DW_AT_lower_bound : 5 byte block: 97 38 1c 94 4
(DW_OP_push_object_address; DW_OP_lit8; DW_OP_minus;
DW_OP_deref_size: 4)
<46> DW_AT_upper_bound : 5 byte block: 97 34 1c 94 4
(DW_OP_push_object_address; DW_OP_lit4; DW_OP_minus;
DW_OP_deref_size: 4)
GDB is currently printing the value of the array incorrectly:
(gdb) p foo.three_ptr.all
$1 = (26629472 => 1, 2,
value.c:819: internal-error: value_contents_bits_eq: [...]
The dereferencing (".all" operator) is done by calling ada_value_ind,
which itself calls value_ind. It first produces a new value where
the bounds of the array were correctly resolved to their actual value,
but then calls readjust_indirect_value_type which replaces the resolved
type by the original type.
The problem starts when ada_value_print does not take this situation
into account, and starts using the type of the resulting value, which
has unresolved array bounds, instead of using the value's enclosing
type.
After fixing this issue, the debugger now correctly prints:
(gdb) p foo.three_ptr.all
$1 = (1, 2, 3)
gdb/ChangeLog:
* ada-valprint.c (ada_value_print): Use VAL's enclosing type
instead of VAL's type.
gdb/testsuite/ChangeLog:
* gdb.dwarf2/dynarr-ptr.c: New file.
* gdb.dwarf2/dynarr-ptr.exp: New file.
-----------------------------------------------------------------------
Summary of changes:
gdb/ChangeLog | 20 ++
gdb/ada-lang.c | 29 ++-
gdb/ada-valprint.c | 2 +-
gdb/testsuite/ChangeLog | 17 ++
gdb/testsuite/gdb.dwarf2/dynarr-ptr.c | 30 +++
gdb/testsuite/gdb.dwarf2/dynarr-ptr.exp | 353 +++++++++++++++++++++++++++++++
6 files changed, 440 insertions(+), 11 deletions(-)
create mode 100644 gdb/testsuite/gdb.dwarf2/dynarr-ptr.c
create mode 100644 gdb/testsuite/gdb.dwarf2/dynarr-ptr.exp
hooks/post-receive
--
gdb and binutils