diff options
author | Daniel Jacobowitz <drow@false.org> | 2008-03-21 15:02:38 +0000 |
---|---|---|
committer | Daniel Jacobowitz <drow@false.org> | 2008-03-21 15:02:38 +0000 |
commit | 6309237547d076d68daaf8f4d0cd55c5964e1411 (patch) | |
tree | ff4100d106e01c43dd82f47a59d0071d99cae1c6 /gdb/testsuite/gdb.base/printcmds.exp | |
parent | b21991b00cf16b94e9646a054e786c1fa4d5501a (diff) | |
download | gdb-6309237547d076d68daaf8f4d0cd55c5964e1411.zip gdb-6309237547d076d68daaf8f4d0cd55c5964e1411.tar.gz gdb-6309237547d076d68daaf8f4d0cd55c5964e1411.tar.bz2 |
* eval.c (evaluate_subexp_for_address): Clarify error message.
Use value_must_coerce_to_target.
* infcall.c (value_arg_coerce): Call value_coerce_to_target.
* valops.c (value_assign): Call value_coerce_to_target when
assigning to anything but internalvars. Leave GDB-side arrays
as arrays when assigning to internalvars.
(value_must_coerce_to_target, value_coerce_to_target): New.
(value_coerce_array, value_addr): Call value_coerce_to_target.
(value_array): Create the array in GDB's memory instead of
the inferior's.
* value.h (value_must_coerce_to_target, value_coerce_to_target):
Declare.
* gdb.texinfo (Expressions): Update description of malloced arrays.
* gdb.base/printcmds.exp (test_print_array_constants): Do not expect
*& to work on created array elements.
(Top level): Test print $pc with a file. Test string operations
without a target.
* gdb.base/ptype.exp: Do not expect *& to work on created array
elements.
Diffstat (limited to 'gdb/testsuite/gdb.base/printcmds.exp')
-rw-r--r-- | gdb/testsuite/gdb.base/printcmds.exp | 14 |
1 files changed, 11 insertions, 3 deletions
diff --git a/gdb/testsuite/gdb.base/printcmds.exp b/gdb/testsuite/gdb.base/printcmds.exp index bad73be..0f1786e 100644 --- a/gdb/testsuite/gdb.base/printcmds.exp +++ b/gdb/testsuite/gdb.base/printcmds.exp @@ -651,7 +651,7 @@ proc test_print_array_constants {} { gdb_test_escape_braces "print {(long)0,(long)1,(long)2}" " = {0, 1, 2}" gdb_test_escape_braces "print {{0,1,2},{3,4,5}}" " = {{0, 1, 2}, {3, 4, 5}}" gdb_test "print {4,5,6}\[2\]" " = 6" - gdb_test "print *&{4,5,6}\[1\]" " = 5" + gdb_test "print *&{4,5,6}\[1\]" "Attempt to take address of value not located in memory." } proc test_printf {} { @@ -735,11 +735,19 @@ gdb_start gdb_reinitialize_dir $srcdir/$subdir gdb_test "print \$pc" "No registers\\." -# FIXME: should also test "print $pc" when there is an execfile but no -# remote debugging target, process or corefile. + +# Some simple operations on strings should work even without a target +# (and therefore without calling malloc). +gdb_test "print \"abc\"" " = \"abc\"" +gdb_test "print sizeof (\"abc\")" " = 4" +gdb_test "ptype \"abc\"" " = char \\\[4\\\]" +gdb_test "print \$cvar = \"abc\"" " = \"abc\"" +gdb_test "print sizeof (\$cvar)" " = 4" gdb_load ${binfile} +gdb_test "print \$pc" "No registers\\." "print \$pc (with file)" + gdb_test "set print sevenbit-strings" "" gdb_test "set print address off" "" gdb_test "set width 0" "" |