summaryrefslogtreecommitdiff
path: root/gdb/testsuite/gdb.dwarf2/implptrconst.exp
diff options
context:
space:
mode:
authorTom Tromey <tromey@redhat.com>2013-05-06 19:44:04 +0000
committerTom Tromey <tromey@redhat.com>2013-05-06 19:44:04 +0000
commitb6807d988a28dc2718bae1abba1f28779bc0c3c3 (patch)
treebb4adece022138ab739318623eec8dce672a03b8 /gdb/testsuite/gdb.dwarf2/implptrconst.exp
parent3aef2284c6976e2b497d5e712cf0cedcc14bed58 (diff)
downloadbinutils-gdb-b6807d988a28dc2718bae1abba1f28779bc0c3c3.tar.gz
* dwarf2loc.c (invalid_synthetic_pointer): Move earlier.
(indirect_pieced_value): Call dwarf2_fetch_constant_bytes if needed. * dwarf2loc.h (dwarf2_fetch_constant_bytes): Declare. * dwarf2read.c (write_constant_as_bytes) (dwarf2_fetch_constant_bytes): New functions. gdb/testsuite * gdb.dwarf2/implptrconst.c: New file. * gdb.dwarf2/implptrconst.exp: New file. * lib/dwarf.exp (Dwarf::_nz_quote): New proc. (Dwarf::_handle_DW_FORM): Handle DW_FORM_block1. (Dwarf::_location): Handle DW_OP_GNU_implicit_pointer.
Diffstat (limited to 'gdb/testsuite/gdb.dwarf2/implptrconst.exp')
-rw-r--r--gdb/testsuite/gdb.dwarf2/implptrconst.exp103
1 files changed, 103 insertions, 0 deletions
diff --git a/gdb/testsuite/gdb.dwarf2/implptrconst.exp b/gdb/testsuite/gdb.dwarf2/implptrconst.exp
new file mode 100644
index 00000000000..4ce17135036
--- /dev/null
+++ b/gdb/testsuite/gdb.dwarf2/implptrconst.exp
@@ -0,0 +1,103 @@
+# Copyright 2013 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 <http://www.gnu.org/licenses/>.
+
+load_lib dwarf.exp
+
+# This test can only be run on targets which support DWARF-2 and use gas.
+if {![dwarf2_support]} {
+ return 0
+}
+
+if { [skip_cplus_tests] } { continue }
+
+standard_testfile .c implptrconst-dw.S
+
+# Make some DWARF for the test.
+set asm_file [standard_output_file $srcfile2]
+Dwarf::assemble $asm_file {
+ cu 0 2 8 {
+ compile_unit {} {
+ declare_labels byte_label size_type_label array_label
+ declare_labels var_label ptr_label
+
+ byte_label: base_type {
+ {name byte}
+ {encoding @DW_ATE_signed}
+ {byte_size 1 DW_FORM_sdata}
+ }
+
+ size_type_label: base_type {
+ {name sizetype}
+ {encoding @DW_ATE_unsigned}
+ {byte_size 8 DW_FORM_sdata}
+ }
+
+ array_label: array_type {
+ {type :$byte_label}
+ } {
+ subrange_type {
+ {type :$size_type_label}
+ {upper_bound 7 DW_FORM_data1}
+ }
+ }
+
+ var_label: DW_TAG_variable {
+ {name b}
+ {type :$array_label}
+ {const_value rstuvwxy DW_FORM_block1}
+ }
+
+ ptr_label: pointer_type {
+ {byte_size 8 DW_FORM_sdata}
+ {type :$byte_label}
+ }
+
+ DW_TAG_variable {
+ {name c}
+ {type :$ptr_label}
+ {location {
+ GNU_implicit_pointer $var_label 0
+ } SPECIAL_expr}
+ }
+ }
+ }
+}
+
+if {[gdb_compile ${srcdir}/${subdir}/${srcfile} ${binfile}1.o \
+ object {nodebug}] != ""} {
+ return -1
+}
+
+if {[gdb_compile $asm_file ${binfile}2.o object {nodebug}] != ""} {
+ return -1
+}
+
+if {[gdb_compile [list ${binfile}1.o ${binfile}2.o] \
+ "${binfile}" executable {}] != ""} {
+ return -1
+}
+
+# We need --readnow because otherwise we never read in the CU we
+# created above.
+set saved_gdbflags $GDBFLAGS
+set GDBFLAGS "$GDBFLAGS -readnow"
+clean_restart ${testfile}
+set GDBFLAGS $saved_gdbflags
+
+if ![runto_main] {
+ return -1
+}
+
+gdb_test "print *c" " = 114 'r'"