From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: (qmail 12301 invoked by alias); 29 Mar 2012 05:45:00 -0000 Mailing-List: contact archer-commits-help@sourceware.org; run by ezmlm Sender: Precedence: bulk List-Post: List-Help: List-Subscribe: Received: (qmail 12153 invoked by uid 9674); 29 Mar 2012 05:44:49 -0000 Date: Thu, 29 Mar 2012 05:45:00 -0000 Message-ID: <20120329054449.12138.qmail@sourceware.org> From: jkratoch@sourceware.org To: archer-commits@sourceware.org Subject: [SCM] archer-jankratochvil-autoload: Merge branch 'secmove-misc2-warn-safepath-debug' into secmove-misc2-warn-safepath-debug-warnlocal X-Git-Refname: refs/heads/archer-jankratochvil-autoload X-Git-Reftype: branch X-Git-Oldrev: 2d4d03691bfc2667c6e517ba10c3e66eb407f6bf X-Git-Newrev: 52f13c3140d7212cfe288e9ec3697f1040bdf3fe X-SW-Source: 2012-q1/txt/msg00099.txt.bz2 List-Id: The branch, archer-jankratochvil-autoload has been updated via 52f13c3140d7212cfe288e9ec3697f1040bdf3fe (commit) via 83354472f327767555adfd2b213be4bd738cfb79 (commit) via a8337b36480c3730f0dd2689946b050ebac35776 (commit) via c326f338d98727b8ca18c61574847d65c810ad1d (commit) via df99b4144d305c3091773ea6d425ffb9d3e9bedd (commit) via 6bbbba526f331b673805bc114b5c09bc6c88f272 (commit) via 7b6e3b8658c0f752e8609b65ff889eeac6ca3bb4 (commit) via 3f705b16c8fc6a2229e8a547c4a6bcfb5ed00e3b (commit) via 7017c190c9643de36ca22f5591aa3ddbafcf1661 (commit) via fbec43f10477e99fbc35dced60f8e2d744def318 (commit) via 0a2e1d3cc6e24662e81d199424fa162bbb3d4724 (commit) via b08a0c3476ee1a2dfa35893f3a5955a7b8e0ca28 (commit) via 3f7abee6f972f8fb37cf0ded16ef4ac5956d7f32 (commit) via 810fc7bf06e766f762bfafe71ae566395a54fcf4 (commit) via 7f0e7e8581446c677a376fecd11540533760a05e (commit) via e7a153ccfdac0bb45958b19293fa3fb509b9a9e5 (commit) via 3eec4be3d4f50a8ccfa2cfb26efd673b105008a4 (commit) via a7916980e89510b79f52f0bc9c58015318d81478 (commit) via 2d0291bf2118f556e2efda26662f23559eddd4ab (commit) via 6d7e224c93a0abf474b3a3a85cd0e8c68fec546d (commit) via 52c93ee1151eb1bdc576b9e100fae548d78433c4 (commit) via 655e820cf9a039ee55325d9e1f8423796d592b4b (commit) via 5eadef623d0ca84c44370864186ae85ac29f433d (commit) via a012ecd57f4c62e42a6fcd1454541ea209df03e0 (commit) via 2d3bed914eb219769399d4be7c95885b9f0956a3 (commit) via 33c618f861d9ad56df661bd5759e03d16114682a (commit) from 2d4d03691bfc2667c6e517ba10c3e66eb407f6bf (commit) Those revisions listed above that are new to this repository have not appeared on any other notification email. - Log ----------------------------------------------------------------- commit 52f13c3140d7212cfe288e9ec3697f1040bdf3fe Merge: 6bbbba5 8335447 Author: Jan Kratochvil Date: Thu Mar 29 07:44:10 2012 +0200 Merge branch 'secmove-misc2-warn-safepath-debug' into secmove-misc2-warn-safepath-debug-warnlocal commit 83354472f327767555adfd2b213be4bd738cfb79 Merge: 7b6e3b8 a8337b3 Author: Jan Kratochvil Date: Thu Mar 29 07:44:10 2012 +0200 Merge branch 'secmove-misc2-warn-safepath' into secmove-misc2-warn-safepath-debug commit a8337b36480c3730f0dd2689946b050ebac35776 Merge: 3f705b1 c326f33 Author: Jan Kratochvil Date: Thu Mar 29 07:44:10 2012 +0200 Merge branch 'secmove-misc2-warn' into secmove-misc2-warn-safepath commit c326f338d98727b8ca18c61574847d65c810ad1d Merge: 7017c19 df99b41 Author: Jan Kratochvil Date: Thu Mar 29 07:44:09 2012 +0200 Merge branch 'secmove-misc2' into secmove-misc2-warn commit df99b4144d305c3091773ea6d425ffb9d3e9bedd Author: Jan Kratochvil Date: Thu Mar 29 07:42:12 2012 +0200 . commit 6bbbba526f331b673805bc114b5c09bc6c88f272 Merge: 2d4d036 7b6e3b8 Author: Jan Kratochvil Date: Thu Mar 29 07:36:41 2012 +0200 Merge branch 'secmove-misc2-warn-safepath-debug' into secmove-misc2-warn-safepath-debug-warnlocal commit 7b6e3b8658c0f752e8609b65ff889eeac6ca3bb4 Merge: ef11444 3f705b1 Author: Jan Kratochvil Date: Thu Mar 29 07:36:41 2012 +0200 Merge branch 'secmove-misc2-warn-safepath' into secmove-misc2-warn-safepath-debug commit 3f705b16c8fc6a2229e8a547c4a6bcfb5ed00e3b Merge: 7942608 7017c19 Author: Jan Kratochvil Date: Thu Mar 29 07:36:40 2012 +0200 Merge branch 'secmove-misc2-warn' into secmove-misc2-warn-safepath commit 7017c190c9643de36ca22f5591aa3ddbafcf1661 Merge: e8bc56e fbec43f Author: Jan Kratochvil Date: Thu Mar 29 07:36:40 2012 +0200 Merge branch 'secmove-misc2' into secmove-misc2-warn commit fbec43f10477e99fbc35dced60f8e2d744def318 Merge: 51c6545 0a2e1d3 Author: Jan Kratochvil Date: Thu Mar 29 07:36:40 2012 +0200 Merge branch 'secmove' into secmove-misc2 commit 0a2e1d3cc6e24662e81d199424fa162bbb3d4724 Merge: f8b07b7 b08a0c3 Author: Jan Kratochvil Date: Thu Mar 29 07:36:37 2012 +0200 Merge remote-tracking branch 'gdb/master' into secmove Conflicts: gdb/Makefile.in commit b08a0c3476ee1a2dfa35893f3a5955a7b8e0ca28 Author: Kevin Buettner Date: Thu Mar 29 00:57:17 2012 +0000 Commit gdb and sim support for v850e2 and v850e2v3 on behalf of Rathish C . commit 3f7abee6f972f8fb37cf0ded16ef4ac5956d7f32 Author: gdbadmin Date: Thu Mar 29 00:00:03 2012 +0000 *** empty log message *** commit 810fc7bf06e766f762bfafe71ae566395a54fcf4 Author: Alan Modra Date: Wed Mar 28 23:00:04 2012 +0000 daily update commit 7f0e7e8581446c677a376fecd11540533760a05e Author: Joel Brobecker Date: Wed Mar 28 21:31:56 2012 +0000 [NEWS] Announce support for Ada varobj support. gdb/ChangeLog: * NEWS: Add entry for Ada varobj support. commit e7a153ccfdac0bb45958b19293fa3fb509b9a9e5 Author: Joel Brobecker Date: Wed Mar 28 21:31:45 2012 +0000 [doco] document the "type_changed" flag further. gdb/doc/ChangeLog: * gdb.texinfo (GDB/MI Variable Objects): Document what happens to the children of a varobj and its update range when -var-update returns that the varobj's type changed. commit 3eec4be3d4f50a8ccfa2cfb26efd673b105008a4 Author: Joel Brobecker Date: Wed Mar 28 21:31:29 2012 +0000 New varobj language callback: value_is_changeable_p. This patch introduces a new language-specific callback for varobj objects, allowing us to move the language-specific bits of the varobj_value_is_changeable_p routine to language-specific functions. This is more elegant than testing for the varobj's language... gdb/ChangeLog: * varobj.c (default_value_is_changeable_p): New function, extracted from varobj_value_is_changeable_p. Add declaration. (ada_value_is_changeable_p): New function, extracted from varobj_value_is_changeable_p. Add declaration. (struct language_specific): New field "value_is_changeable_p". (languages): Add entries for new field. (varobj_create): Set language before calling install_new_value. (varobj_value_is_changeable_p): Reimplement to call the varobj's "value_is_changeable_p" language callback. commit a7916980e89510b79f52f0bc9c58015318d81478 Author: Joel Brobecker Date: Wed Mar 28 21:31:17 2012 +0000 Varobj support for Ada. This patch adds varobj support for Ada variables. Most of the code is implemented in a separate Ada-specific file called ada-varobj.c. The only bits in varobj.c are the functions used as the hooks in the language-specific varobj's vector. gdb/ChangeLog: * ada-varobj.h, ada-varobj.c: New files. * Makefile.in (SFILES): Add ada-varobj.c. (HFILES_NO_SRCDIR): Add ada-varobj.h. (COMMON_OBS): Add ada-varobj.o. commit 2d0291bf2118f556e2efda26662f23559eddd4ab Author: Joel Brobecker Date: Wed Mar 28 21:31:04 2012 +0000 framework for varobj type mutation This patch introduces the framework necessary to support type mutations. The only language that currently provides a language-specific hook for that feature is Ada, but the hook remain unimplemented for now. The actual implementation is tied to the rest of the varobj code for Ada, and thus will be provided then. gdb/ChangeLog: * varobj.c (ada_value_has_mutated): Add declaration. New function. (struct language_specific): New field "value_has_mutated". (languages): Set field "value_has_mutated" in each entry of array. (varobj_value_has_mutated): New function. (varobj_udpdate): Add handling of type mutation. (value_of_root): Add handling of type mutation. (ada_value_has_mutated): New function. commit 6d7e224c93a0abf474b3a3a85cd0e8c68fec546d Author: Pedro Alves Date: Wed Mar 28 18:30:01 2012 +0000 2012-03-28 Pedro Alves * linux-ia64-low.c (ia64_regmap): Map IA64_EC_REGNUM to PT_AR_EC. (IA64_GR0_REGNUM, IA64_FR0_REGNUM) (IA64_FR1_REGNUM): New defines. (ia64_fetch_register): New. (the_low_target): Install it. * linux-low.h (struct linux_target_ops) : New field. * linux-low.c (linux_fetch_registers): Try the the_low_target.fetch_register hook first. * linux-arm-low.c (the_low_target): Adjust. * linux-bfin-low.c (the_low_target): Adjust. * linux-cris-low.c (the_low_target): Adjust. * linux-crisv32-low.c (the_low_target): Adjust. * linux-m32r-low.c (the_low_target): Adjust. * linux-m68k-low.c (the_low_target): Adjust. * linux-mips-low.c (the_low_target): Adjust. * linux-ppc-low.c (the_low_target): Adjust. * linux-s390-low.c (the_low_target): Adjust. * linux-sh-low.c (the_low_target): Adjust. * linux-sparc-low.c (the_low_target): Adjust. * linux-tic6x-low.c (the_low_target): Adjust. * linux-x86-low.c (the_low_target): Adjust. * linux-xtensa-low.c (the_low_target): Adjust. commit 52c93ee1151eb1bdc576b9e100fae548d78433c4 Author: Pedro Alves Date: Wed Mar 28 17:50:16 2012 +0000 2012-03-28 Pedro Alves * ia64-linux-nat.c (supply_fpregset, ia64_linux_fetch_register): Always supply $fr0 as 0.0 and $fr1 as 1.0. commit 655e820cf9a039ee55325d9e1f8423796d592b4b Author: Tom Tromey Date: Wed Mar 28 17:38:07 2012 +0000 * python/py-inferior.c (infpy_read_memory): Remove cleanups and explicitly free 'buffer' on exit paths. Decref 'membuf_object' before returning. commit 5eadef623d0ca84c44370864186ae85ac29f433d Author: Tom Tromey Date: Wed Mar 28 17:35:38 2012 +0000 * .dir-locals.el: New file. commit a012ecd57f4c62e42a6fcd1454541ea209df03e0 Author: Keith Seitz Date: Wed Mar 28 17:33:33 2012 +0000 * gdb.linespec/ls-dollar.cc: New file. * gdb.linespec/ls-dollar.exp: New test. commit 2d3bed914eb219769399d4be7c95885b9f0956a3 Author: Pedro Alves Date: Wed Mar 28 17:29:46 2012 +0000 2012-03-28 Pedro Alves * ia64-linux-nat.c (u_offsets): Map IA64_EC_REGNUM to PT_AR_EC. commit 33c618f861d9ad56df661bd5759e03d16114682a Author: Keith Seitz Date: Wed Mar 28 17:29:41 2012 +0000 * gdb.cp/namespace.exp: Add breakpoint tests for functions starting with the global namespace. ----------------------------------------------------------------------- Summary of changes: bfd/version.h | 2 +- gdb/.dir-locals.el | 24 + gdb/ChangeLog | 61 + gdb/Makefile.in | 5 +- gdb/NEWS | 2 + gdb/ada-varobj.c | 889 +++++++++++++ gdb/ada-varobj.h | 56 + gdb/doc/ChangeLog | 6 + gdb/doc/gdb.texinfo | 14 +- gdb/gdbserver/ChangeLog | 27 + gdb/gdbserver/linux-arm-low.c | 1 + gdb/gdbserver/linux-bfin-low.c | 1 + gdb/gdbserver/linux-cris-low.c | 1 + gdb/gdbserver/linux-crisv32-low.c | 1 + gdb/gdbserver/linux-ia64-low.c | 45 +- gdb/gdbserver/linux-low.c | 10 +- gdb/gdbserver/linux-low.h | 8 + gdb/gdbserver/linux-m32r-low.c | 1 + gdb/gdbserver/linux-m68k-low.c | 1 + gdb/gdbserver/linux-mips-low.c | 1 + gdb/gdbserver/linux-ppc-low.c | 1 + gdb/gdbserver/linux-s390-low.c | 1 + gdb/gdbserver/linux-sh-low.c | 1 + gdb/gdbserver/linux-sparc-low.c | 1 + gdb/gdbserver/linux-tic6x-low.c | 1 + gdb/gdbserver/linux-x86-low.c | 1 + gdb/gdbserver/linux-xtensa-low.c | 1 + gdb/ia64-linux-nat.c | 37 +- gdb/python/py-inferior.c | 20 +- gdb/testsuite/ChangeLog | 10 + gdb/testsuite/gdb.cp/namespace.exp | 10 + gdb/testsuite/gdb.linespec/ls-dollar.cc | 26 + gdb/testsuite/gdb.linespec/ls-dollar.exp | 38 + gdb/v850-tdep.c | 139 ++- gdb/varobj.c | 282 ++++- gdb/version.in | 2 +- sim/common/ChangeLog | 7 + sim/common/sim-trace.c | 13 +- sim/common/sim-trace.h | 17 + sim/v850/ChangeLog | 55 + sim/v850/sim-main.h | 298 +++++- sim/v850/simops.c | 716 ++++++++++- sim/v850/simops.h | 47 + sim/v850/v850-dc | 29 +- sim/v850/v850.igen | 2081 +++++++++++++++++++++++++++++- 45 files changed, 4892 insertions(+), 98 deletions(-) create mode 100644 gdb/.dir-locals.el create mode 100644 gdb/ada-varobj.c create mode 100644 gdb/ada-varobj.h create mode 100644 gdb/testsuite/gdb.linespec/ls-dollar.cc create mode 100644 gdb/testsuite/gdb.linespec/ls-dollar.exp First 500 lines of diff: diff --git a/bfd/version.h b/bfd/version.h index d9d8427..4481ecc 100644 --- a/bfd/version.h +++ b/bfd/version.h @@ -1,4 +1,4 @@ -#define BFD_VERSION_DATE 20120328 +#define BFD_VERSION_DATE 20120329 #define BFD_VERSION @bfd_version@ #define BFD_VERSION_STRING @bfd_version_package@ @bfd_version_string@ #define REPORT_BUGS_TO @report_bugs_to@ diff --git a/gdb/.dir-locals.el b/gdb/.dir-locals.el new file mode 100644 index 0000000..8eca9e0 --- /dev/null +++ b/gdb/.dir-locals.el @@ -0,0 +1,24 @@ +;; Emacs settings. +;; Copyright (C) 2012 Free Software Foundation, Inc. + +;; This program is free software; you can redistribute it and/or modify +;; it under the terms of the GNU General Public License as published by +;; the Free Software Foundation; either version 3 of the License, or +;; (at your option) any later version. + +;; This program is distributed in the hope that it will be useful, +;; but WITHOUT ANY WARRANTY; without even the implied warranty of +;; MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the +;; GNU General Public License for more details. + +;; You should have received a copy of the GNU General Public License +;; along with this program. If not, see . + +( + (tcl-mode . ((tcl-indent-level . 4) + (tcl-continued-indent-level . 4) + (indent-tabs-mode . t))) + (nil . ((bug-reference-url-format . "http://sourceware.org/bugzilla/show_bug.cgi?id=%s"))) + (c-mode . ((c-file-style . "GNU") + (indent-tabs-mode . t))) +) diff --git a/gdb/ChangeLog b/gdb/ChangeLog index 0b3f886..a334a06 100644 --- a/gdb/ChangeLog +++ b/gdb/ChangeLog @@ -1,3 +1,64 @@ +2012-03-28 Rathish C + + * v850-tdep.c: Add the enum values for mpu and fpu registers. + (v850_register_name): Add the mpu and fpu register names. + (v850e_register_name): Add the mpu and fpu register names. + (v850e2_register_name): New function. + (v850_gdbarch_init): Add case for bfd_mach_v850e2 and + bfd_mach_v850e2v3. + +2012-03-28 Joel Brobecker + + * NEWS: Add entry for Ada varobj support. + +2012-03-28 Joel Brobecker + + * varobj.c (default_value_is_changeable_p): New function, + extracted from varobj_value_is_changeable_p. Add declaration. + (ada_value_is_changeable_p): New function, extracted from + varobj_value_is_changeable_p. Add declaration. + (struct language_specific): New field "value_is_changeable_p". + (languages): Add entries for new field. + (varobj_create): Set language before calling install_new_value. + (varobj_value_is_changeable_p): Reimplement to call the varobj's + "value_is_changeable_p" language callback. + +2012-03-28 Joel Brobecker + + * ada-varobj.h, ada-varobj.c: New files. + * Makefile.in (SFILES): Add ada-varobj.c. + (HFILES_NO_SRCDIR): Add ada-varobj.h. + (COMMON_OBS): Add ada-varobj.o. + +2012-03-28 Joel Brobecker + + * varobj.c (ada_value_has_mutated): Add declaration. New function. + (struct language_specific): New field "value_has_mutated". + (languages): Set field "value_has_mutated" in each entry of array. + (varobj_value_has_mutated): New function. + (varobj_udpdate): Add handling of type mutation. + (value_of_root): Add handling of type mutation. + (ada_value_has_mutated): New function. + +2012-03-28 Pedro Alves + + * ia64-linux-nat.c (supply_fpregset, ia64_linux_fetch_register): + Always supply $fr0 as 0.0 and $fr1 as 1.0. + +2012-03-28 Tom Tromey + + * python/py-inferior.c (infpy_read_memory): Remove cleanups and + explicitly free 'buffer' on exit paths. Decref 'membuf_object' + before returning. + +2012-03-28 Tom Tromey + + * .dir-locals.el: New file. + +2012-03-28 Pedro Alves + + * ia64-linux-nat.c (u_offsets): Map IA64_EC_REGNUM to PT_AR_EC. + 2012-03-28 Joel Brobecker * ia64-linux-nat.c (ia64_linux_fetch_register): Add special diff --git a/gdb/Makefile.in b/gdb/Makefile.in index 9974ffd..1becf33 100644 --- a/gdb/Makefile.in +++ b/gdb/Makefile.in @@ -682,6 +682,7 @@ TARGET_FLAGS_TO_PASS = \ # SFILES is used in building the distribution archive. SFILES = ada-exp.y ada-lang.c ada-typeprint.c ada-valprint.c ada-tasks.c \ + ada-varobj.c \ addrmap.c auto-load.c \ auxv.c ax-general.c ax-gdb.c \ agent.c \ @@ -766,7 +767,7 @@ proc-utils.h arm-tdep.h ax-gdb.h ppcnbsd-tdep.h \ cli-out.h gdb_expat.h breakpoint.h infcall.h obsd-tdep.h \ exec.h m32r-tdep.h osabi.h gdbcore.h solib-som.h amd64bsd-nat.h \ i386bsd-nat.h xml-support.h xml-tdesc.h alphabsd-tdep.h gdb_obstack.h \ -ia64-tdep.h ada-lang.h varobj.h frv-tdep.h nto-tdep.h serial.h \ +ia64-tdep.h ada-lang.h ada-varobj.h varobj.h frv-tdep.h nto-tdep.h serial.h \ c-lang.h d-lang.h frame.h event-loop.h block.h cli/cli-setshow.h \ cli/cli-decode.h cli/cli-cmds.h cli/cli-dump.h cli/cli-utils.h \ cli/cli-script.h macrotab.h symtab.h version.h gnulib/wchar.in.h \ @@ -883,7 +884,7 @@ COMMON_OBS = $(DEPFILES) $(CONFIG_OBS) $(YYOBJ) \ dwarf2read.o mipsread.o stabsread.o corefile.o \ dwarf2expr.o dwarf2loc.o dwarf2-frame.o dwarf2-frame-tailcall.o \ ada-lang.o c-lang.o d-lang.o f-lang.o objc-lang.o \ - ada-tasks.o \ + ada-tasks.o ada-varobj.o \ ui-out.o cli-out.o \ varobj.o vec.o \ jv-lang.o jv-valprint.o jv-typeprint.o \ diff --git a/gdb/NEWS b/gdb/NEWS index 5e5d806..5132d19 100644 --- a/gdb/NEWS +++ b/gdb/NEWS @@ -80,6 +80,8 @@ the ability to set breakpoints on inlined functions will be lost in symbol files with older .gdb_index sections. +* Ada support for GDB/MI Variable Objects has been added. + * New commands ** "catch load" and "catch unload" can be used to stop when a shared diff --git a/gdb/ada-varobj.c b/gdb/ada-varobj.c new file mode 100644 index 0000000..31f80f5 --- /dev/null +++ b/gdb/ada-varobj.c @@ -0,0 +1,889 @@ +/* varobj support for Ada. + + Copyright (C) 2012 Free Software Foundation, Inc. + + This file is part of GDB. + + This program is free software; you can redistribute it and/or modify + it under the terms of the GNU General Public License as published by + the Free Software Foundation; either version 3 of the License, or + (at your option) any later version. + + This program is distributed in the hope that it will be useful, + but WITHOUT ANY WARRANTY; without even the implied warranty of + MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + GNU General Public License for more details. + + You should have received a copy of the GNU General Public License + along with this program. If not, see . */ + +#include "defs.h" +#include "ada-varobj.h" +#include "ada-lang.h" +#include "language.h" +#include "valprint.h" + +/* Implementation principle used in this unit: + + For our purposes, the meat of the varobj object is made of two + elements: The varobj's (struct) value, and the varobj's (struct) + type. In most situations, the varobj has a non-NULL value, and + the type becomes redundant, as it can be directly derived from + the value. In the initial implementation of this unit, most + routines would only take a value, and return a value. + + But there are many situations where it is possible for a varobj + to have a NULL value. For instance, if the varobj becomes out of + scope. Or better yet, when the varobj is the child of another + NULL pointer varobj. In that situation, we must rely on the type + instead of the value to create the child varobj. + + That's why most functions below work with a (value, type) pair. + The value may or may not be NULL. But the type is always expected + to be set. When the value is NULL, then we work with the type + alone, and keep the value NULL. But when the value is not NULL, + then we work using the value, because it provides more information. + But we still always set the type as well, even if that type could + easily be derived from the value. The reason behind this is that + it allows the code to use the type without having to worry about + it being set or not. It makes the code clearer. */ + +/* A convenience function that decodes the VALUE_PTR/TYPE_PTR couple: + If there is a value (*VALUE_PTR not NULL), then perform the decoding + using it, and compute the associated type from the resulting value. + Otherwise, compute a static approximation of *TYPE_PTR, leaving + *VALUE_PTR unchanged. + + The results are written in place. */ + +static void +ada_varobj_decode_var (struct value **value_ptr, struct type **type_ptr) +{ + if (*value_ptr) + { + *value_ptr = ada_get_decoded_value (*value_ptr); + *type_ptr = ada_check_typedef (value_type (*value_ptr)); + } + else + *type_ptr = ada_get_decoded_type (*type_ptr); +} + +/* Return a string containing an image of the given scalar value. + VAL is the numeric value, while TYPE is the value's type. + This is useful for plain integers, of course, but even more + so for enumerated types. + + The result should be deallocated by xfree after use. */ + +static char * +ada_varobj_scalar_image (struct type *type, LONGEST val) +{ + struct ui_file *buf = mem_fileopen (); + struct cleanup *cleanups = make_cleanup_ui_file_delete (buf); + char *result; + + ada_print_scalar (type, val, buf); + result = ui_file_xstrdup (buf, NULL); + do_cleanups (cleanups); + + return result; +} + +/* Assuming that the (PARENT_VALUE, PARENT_TYPE) pair designates + a struct or union, compute the (CHILD_VALUE, CHILD_TYPE) couple + corresponding to the field number FIELDNO. */ + +static void +ada_varobj_struct_elt (struct value *parent_value, + struct type *parent_type, + int fieldno, + struct value **child_value, + struct type **child_type) +{ + struct value *value = NULL; + struct type *type = NULL; + + if (parent_value) + { + value = value_field (parent_value, fieldno); + type = value_type (value); + } + else + type = TYPE_FIELD_TYPE (parent_type, fieldno); + + if (child_value) + *child_value = value; + if (child_type) + *child_type = type; +} + +/* Assuming that the (PARENT_VALUE, PARENT_TYPE) pair is a pointer or + reference, return a (CHILD_VALUE, CHILD_TYPE) couple corresponding + to the dereferenced value. */ + +static void +ada_varobj_ind (struct value *parent_value, + struct type *parent_type, + struct value **child_value, + struct type **child_type) +{ + struct value *value = NULL; + struct type *type = NULL; + + if (ada_is_array_descriptor_type (parent_type)) + { + /* This can only happen when PARENT_VALUE is NULL. Otherwise, + ada_get_decoded_value would have transformed our parent_type + into a simple array pointer type. */ + gdb_assert (parent_value == NULL); + gdb_assert (TYPE_CODE (parent_type) == TYPE_CODE_TYPEDEF); + + /* Decode parent_type by the equivalent pointer to (decoded) + array. */ + while (TYPE_CODE (parent_type) == TYPE_CODE_TYPEDEF) + parent_type = TYPE_TARGET_TYPE (parent_type); + parent_type = ada_coerce_to_simple_array_type (parent_type); + parent_type = lookup_pointer_type (parent_type); + } + + /* If parent_value is a null pointer, then only perform static + dereferencing. We cannot dereference null pointers. */ + if (parent_value && value_as_address (parent_value) == 0) + parent_value = NULL; + + if (parent_value) + { + value = ada_value_ind (parent_value); + type = value_type (value); + } + else + type = TYPE_TARGET_TYPE (parent_type); + + if (child_value) + *child_value = value; + if (child_type) + *child_type = type; +} + +/* Assuming that the (PARENT_VALUE, PARENT_TYPE) pair is a simple + array (TYPE_CODE_ARRAY), return the (CHILD_VALUE, CHILD_TYPE) + pair corresponding to the element at ELT_INDEX. */ + +static void +ada_varobj_simple_array_elt (struct value *parent_value, + struct type *parent_type, + int elt_index, + struct value **child_value, + struct type **child_type) +{ + struct value *value = NULL; + struct type *type = NULL; + + if (parent_value) + { + struct value *index_value = + value_from_longest (TYPE_INDEX_TYPE (parent_type), elt_index); + + value = ada_value_subscript (parent_value, 1, &index_value); + type = value_type (value); + } + else + type = TYPE_TARGET_TYPE (parent_type); + + if (child_value) + *child_value = value; + if (child_type) + *child_type = type; +} + +/* Given the decoded value and decoded type of a variable object, + adjust the value and type to those necessary for getting children + of the variable object. + + The replacement is performed in place. */ + +static void +ada_varobj_adjust_for_child_access (struct value **value, + struct type **type) +{ + /* Pointers to struct/union types are special: Instead of having + one child (the struct), their children are the components of + the struct/union type. We handle this situation by dereferencing + the (value, type) couple. */ + if (TYPE_CODE (*type) == TYPE_CODE_PTR + && (TYPE_CODE (TYPE_TARGET_TYPE (*type)) == TYPE_CODE_STRUCT + || TYPE_CODE (TYPE_TARGET_TYPE (*type)) == TYPE_CODE_UNION) + && !ada_is_array_descriptor_type (TYPE_TARGET_TYPE (*type)) + && !ada_is_constrained_packed_array_type (TYPE_TARGET_TYPE (*type))) + ada_varobj_ind (*value, *type, value, type); +} + +/* Assuming that the (PARENT_VALUE, PARENT_TYPE) pair is an array + (any type of array, "simple" or not), return the number of children + that this array contains. */ + +static int +ada_varobj_get_array_number_of_children (struct value *parent_value, + struct type *parent_type) +{ + LONGEST lo, hi; + int len; + + if (!get_array_bounds (parent_type, &lo, &hi)) + { + /* Could not get the array bounds. Pretend this is an empty array. */ + warning (_("unable to get bounds of array, assuming null array")); + return 0; + } + + /* Ada allows the upper bound to be less than the lower bound, + in order to specify empty arrays... */ + if (hi < lo) + return 0; + + return hi - lo + 1; +} + +/* Assuming that the (PARENT_VALUE, PARENT_TYPE) pair is a struct or + union, return the number of children this struct contains. */ + +static int +ada_varobj_get_struct_number_of_children (struct value *parent_value, + struct type *parent_type) +{ + int n_children = 0; + int i; + + gdb_assert (TYPE_CODE (parent_type) == TYPE_CODE_STRUCT + || TYPE_CODE (parent_type) == TYPE_CODE_UNION); + + for (i = 0; i < TYPE_NFIELDS (parent_type); i++) + { + if (ada_is_ignored_field (parent_type, i)) + continue; + + if (ada_is_wrapper_field (parent_type, i)) + { + struct value *elt_value; + struct type *elt_type; + + ada_varobj_struct_elt (parent_value, parent_type, i, + &elt_value, &elt_type); + if (ada_is_tagged_type (elt_type, 0)) + { + /* We must not use ada_varobj_get_number_of_children + to determine is element's number of children, because + this function first calls ada_varobj_decode_var, + which "fixes" the element. For tagged types, this + includes reading the object's tag to determine its + real type, which happens to be the parent_type, and + leads to an infinite loop (because the element gets + fixed back into the parent). */ + n_children += ada_varobj_get_struct_number_of_children + (elt_value, elt_type); + } + else + n_children += ada_varobj_get_number_of_children (elt_value, elt_type); + } + else if (ada_is_variant_part (parent_type, i)) + { + /* In normal situations, the variant part of the record should + have been "fixed". Or, in other words, it should have been + replaced by the branch of the variant part that is relevant + for our value. But there are still situations where this + can happen, however (Eg. when our parent is a NULL pointer). + We do not support showing this part of the record for now, + so just pretend this field does not exist. */ + } + else + n_children++; + } + + return n_children; +} + +/* Assuming that the (PARENT_VALUE, PARENT_TYPE) pair designates + a pointer, return the number of children this pointer has. */ + +static int +ada_varobj_get_ptr_number_of_children (struct value *parent_value, + struct type *parent_type) +{ + struct type *child_type = TYPE_TARGET_TYPE (parent_type); + + /* Pointer to functions and to void do not have a child, since + you cannot print what they point to. */ + if (TYPE_CODE (child_type) == TYPE_CODE_FUNC + || TYPE_CODE (child_type) == TYPE_CODE_VOID) + return 0; + + /* All other types have 1 child. */ + return 1; +} + +/* Return the number of children for the (PARENT_VALUE, PARENT_TYPE) + pair. */ + +int +ada_varobj_get_number_of_children (struct value *parent_value, + struct type *parent_type) +{ + ada_varobj_decode_var (&parent_value, &parent_type); + ada_varobj_adjust_for_child_access (&parent_value, &parent_type); + + /* A typedef to an array descriptor in fact represents a pointer + to an unconstrained array. These types always have one child + (the unconstrained array). */ + if (ada_is_array_descriptor_type (parent_type) + && TYPE_CODE (parent_type) == TYPE_CODE_TYPEDEF) + return 1; + + if (TYPE_CODE (parent_type) == TYPE_CODE_ARRAY) + return ada_varobj_get_array_number_of_children (parent_value, hooks/post-receive -- Repository for Project Archer.