diff options
author | Joel Brobecker <brobecker@gnat.com> | 2010-12-29 08:02:59 +0000 |
---|---|---|
committer | Joel Brobecker <brobecker@gnat.com> | 2010-12-29 08:02:59 +0000 |
commit | 9e87a40907128affbb3c7bbfe2bee68fdd34fa0a (patch) | |
tree | 8c57328ff8022d04aa7ed94bc254017b77951e5a /gdb/testsuite/gdb.ada/arrayptr/foo.adb | |
parent | 720d1a4025df48e7f8fd6426e4f518c02ad3208a (diff) | |
download | binutils-9e87a40907128affbb3c7bbfe2bee68fdd34fa0a.zip binutils-9e87a40907128affbb3c7bbfe2bee68fdd34fa0a.tar.gz binutils-9e87a40907128affbb3c7bbfe2bee68fdd34fa0a.tar.bz2 |
[Ada] print null array pointer as `0x0' rather than `(null)'
Trying to print a variable defined as an access to an unconstrained
array:
type String_Access is access String;
S1 : String_Access;
If that variable is null, then GDB prints its value in an odd way:
(gdb) print S1
$1 = (string_bug.string_access) (null)
^^^^^^
This patch changes the debugger behavior to print the pointer using
the same output we'd use for any null pointer:
(gdb) print S1
$1 = (string_bug.string_access) 0x0
It also adds an assert, helping us verify an assumption.
gdb/ChangeLog:
* ada-valprint.c (ada_val_print_1): Print null array pointers as
`0x0' rather than `(null)'. Add assertion.
gdb/testsuite/ChangeLog:
* gdb.ada/arrayptr/foo.adb: Add new local variable Null_String.
* gdb.ada/arrayptr.exp: Add test printing that new variable.
Diffstat (limited to 'gdb/testsuite/gdb.ada/arrayptr/foo.adb')
-rw-r--r-- | gdb/testsuite/gdb.ada/arrayptr/foo.adb | 2 |
1 files changed, 2 insertions, 0 deletions
diff --git a/gdb/testsuite/gdb.ada/arrayptr/foo.adb b/gdb/testsuite/gdb.ada/arrayptr/foo.adb index 8cedd87..c11ccfb 100644 --- a/gdb/testsuite/gdb.ada/arrayptr/foo.adb +++ b/gdb/testsuite/gdb.ada/arrayptr/foo.adb @@ -19,6 +19,8 @@ procedure Foo is type String_Access is access String; String_P : String_Access := new String'("Hello"); + Null_String : String_Access := null; begin Do_Nothing (String_P'Address); -- STOP + Do_Nothing (Null_String'Address); end Foo; |