8sa1-binutils-gdb/gdb/testsuite
Joel Brobecker 0c3acc0923 Wrong value printed by info locals for dynamic object.
The problem is printing the wrong value for dynamic local variables
when using the "info locals" command. Consider the following code:

   procedure Print (I1 : Positive; I2 : Positive) is
      type My_String is array (I1 .. I2) of Character;
      I : My_String := (others => 'A');
      S : String (1 .. I2 + 3) := (others => ' ');
   begin
      S (I1 .. I2) := String (I); --  BREAK
      Put_Line (S);
   end Print;

After the debugger stopped at BREAK, we try printing all local variables.
Here is what we get:

        (gdb) info locals
        i = "["00"]["00"]"
        s = "["00"]["00"]["00"]["00"]["00"]["00"]["00"]["00"]"

Curiously, printing their value using the "print" command works:

        (gdb) print i
        $1 = "AA"
        (gdb) print s
        $2 = "        "

We traced the problem to trying to get the contents of a variable
(call to value_contents) before "fix'ing" it.  For those not familiar
with the Ada language support, "fixing" a value consists of swapping
the value's dynamic type with a static version that is appropriate
for our actual value.  As a result, the dynamic type was used to
determine the value size, which is zero, and thus the value contents
was empty.

gdb/ChangeLog:

        * valprint.c (common_val_print): Fix the value before extracting
        its contents.
        * ada-lang.c (ada_to_fixed_value): Make this function extern.
        * ada-lang.h (ada_to_fixed_value): New function declaration.
        * ada-valprint.c (ada_value_print): Use ada_to_fixed_value
        to avoid code duplication and fix a bug in the handling of
        fixed types contents.

gdb/testsuite/ChangeLog:

        * gdb.ada/dyn_loc: New testcase.
2010-04-20 22:26:57 +00:00
..
config Update copyright year in most headers. 2010-01-01 07:32:07 +00:00
gdb.ada Wrong value printed by info locals for dynamic object. 2010-04-20 22:26:57 +00:00
gdb.arch gdb/ 2010-04-17 18:53:46 +00:00
gdb.asm Update copyright year in most headers. 2010-01-01 07:32:07 +00:00
gdb.base * gdb.base/help.exp (help source): Update expected output. 2010-04-20 05:36:02 +00:00
gdb.cell Sync Libtool from GCC. 2010-01-09 21:11:44 +00:00
gdb.cp PR 10867 2010-04-20 20:22:12 +00:00
gdb.disasm Update copyright year in most headers. 2010-01-01 07:32:07 +00:00
gdb.dwarf2 gdb/ 2010-03-31 18:13:38 +00:00
gdb.fortran gdb/ChangeLog: 2010-04-20 17:22:19 +00:00
gdb.gdb Update copyright year in most headers. 2010-01-01 07:32:07 +00:00
gdb.hp Update copyright year in most headers. 2010-01-01 07:32:07 +00:00
gdb.java * gdb.java/jmisc.exp (ptype jmisc): Allow the constructor to 2010-03-31 00:47:23 +00:00
gdb.mi ChangeLog: 2010-03-18 13:25:20 +00:00
gdb.modula2 Update copyright year in most headers. 2010-01-01 07:32:07 +00:00
gdb.multi Update copyright year in most headers. 2010-01-01 07:32:07 +00:00
gdb.objc Update copyright year in most headers. 2010-01-01 07:32:07 +00:00
gdb.opt Update copyright year in most headers. 2010-01-01 07:32:07 +00:00
gdb.pascal Update copyright year in most headers. 2010-01-01 07:32:07 +00:00
gdb.python * NEWS: Add entry for python program space support. 2010-04-15 19:54:13 +00:00
gdb.reverse 2010-04-02 Hui Zhu <teawater@gmail.com> 2010-04-02 05:13:09 +00:00
gdb.server * lib/gdbserver-support.exp (gdbserver_download_current_prog): Rename 2010-01-12 00:50:26 +00:00
gdb.stabs * gdb/stabsread.c (define_symbol): Add support for char 2010-04-05 22:43:49 +00:00
gdb.threads * gdb.threads/pthreads.c (thread1, thread2, main): Fix printf 2010-03-23 23:50:22 +00:00
gdb.trace PR breakpoints/8554. 2010-04-19 00:48:44 +00:00
gdb.xml * gdbtypes.c (append_composite_type_field_raw): New. 2010-03-01 17:19:23 +00:00
lib * gdb.base/call-signal-resume.exp, gdb.base/unwindonsignal.exp: Skip 2010-03-24 21:20:39 +00:00
.gdbinit
aclocal.m4
ChangeLog Wrong value printed by info locals for dynamic object. 2010-04-20 22:26:57 +00:00
configure testsuite/ 2010-02-19 17:13:21 +00:00
configure.ac testsuite/ 2010-02-19 17:13:21 +00:00
dg-extract-results.sh gdb/testsuite/ 2010-03-22 20:38:58 +00:00
Makefile.in gdb/testsuite/ 2010-04-09 20:50:46 +00:00
TODO