Go to file
Joel Brobecker eb47903935 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.
2014-09-10 06:32:00 -07:00
bfd daily update 2014-09-10 09:31:19 +09:30
binutils Change pe/coff build-id section name to '.buildid' 2014-09-08 17:54:20 +01:00
config
cpu
elfcpp Make Elf_file::section_name() a const function, so that it can be used in 2014-09-02 15:44:58 -07:00
etc
gas [PATCH][ARM] Add Cortex-A17 support to gas 2014-09-09 10:10:00 +01:00
gdb Ada: Print bounds/length of pointer to array with dynamic bounds 2014-09-10 06:32:00 -07:00
gold Add NaCl (NativeClient) specific classes Target_mips_nacl and 2014-09-03 09:44:11 -07:00
gprof
include [PATCH/AArch64] Implement LSE feature 2014-09-03 14:53:53 +01:00
intl
ld Change pe/coff build-id section name to '.buildid' 2014-09-08 17:54:20 +01:00
libdecnumber
libiberty
opcodes [PATCH/AArch64] Generic support for all system registers using mrs and msr 2014-09-03 14:53:53 +01:00
readline
sim
texinfo
.cvsignore
.gitattributes
.gitignore
ChangeLog Disable gdb for nds32*-*-* until it is supported. 2014-09-10 09:34:33 +08:00
compile
config-ml.in
config.guess
config.rpath
config.sub
configure Disable gdb for nds32*-*-* until it is supported. 2014-09-10 09:34:33 +08:00
configure.ac Disable gdb for nds32*-*-* until it is supported. 2014-09-10 09:34:33 +08:00
COPYING
COPYING3
COPYING3.LIB
COPYING.LIB
COPYING.LIBGLOSS
COPYING.NEWLIB
depcomp
djunpack.bat
install-sh
libtool.m4
lt~obsolete.m4
ltgcc.m4
ltmain.sh
ltoptions.m4
ltsugar.m4
ltversion.m4
MAINTAINERS
Makefile.def
Makefile.in
Makefile.tpl
makefile.vms
missing
mkdep
mkinstalldirs
move-if-change
README
README-maintainer-mode
setup.com
src-release.sh
symlink-tree
ylwrap

		   README for GNU development tools

This directory contains various GNU compilers, assemblers, linkers, 
debuggers, etc., plus their support routines, definitions, and documentation.

If you are receiving this as part of a GDB release, see the file gdb/README.
If with a binutils release, see binutils/README;  if with a libg++ release,
see libg++/README, etc.  That'll give you info about this
package -- supported targets, how to use it, how to report bugs, etc.

It is now possible to automatically configure and build a variety of
tools with one command.  To build all of the tools contained herein,
run the ``configure'' script here, e.g.:

	./configure 
	make

To install them (by default in /usr/local/bin, /usr/local/lib, etc),
then do:
	make install

(If the configure script can't determine your type of computer, give it
the name as an argument, for instance ``./configure sun4''.  You can
use the script ``config.sub'' to test whether a name is recognized; if
it is, config.sub translates it to a triplet specifying CPU, vendor,
and OS.)

If you have more than one compiler on your system, it is often best to
explicitly set CC in the environment before running configure, and to
also set CC when running make.  For example (assuming sh/bash/ksh):

	CC=gcc ./configure
	make

A similar example using csh:

	setenv CC gcc
	./configure
	make

Much of the code and documentation enclosed is copyright by
the Free Software Foundation, Inc.  See the file COPYING or
COPYING.LIB in the various directories, for a description of the
GNU General Public License terms under which you can copy the files.

REPORTING BUGS: Again, see gdb/README, binutils/README, etc., for info
on where and how to report problems.