binutils-gdb/gdb/testsuite/gdb.go/basic-types.exp

119 lines
3.4 KiB
Plaintext
Raw Normal View History

Initial pass at Go language support. * NEWS: Mention Go. * Makefile.in (SFILES): Add go-exp.y, go-lang.c, go-typeprint.c, go-valprint.c. (COMMON_OBS): Add go-lang.o, go-val.print.o, go-typeprint.o. (YYFILES): Add go-exp.c. (YYOBJ): Add go-exp.o. (local-maintainer-clean): Delete go-exp.c. * defs.h (enum language): Add language_go. * dwarf2read.c: #include "go-lang.h". (fixup_go_packaging): New function. (process_full_comp_unit): Call it when processing Go CUs. (dwarf2_physname): Add Go support. (read_file_scope): Handle missing language spec for GNU Go. (set_cu_language): Handle DW_LANG_Go. * go-exp.y: New file. * go-lang.h: New file. * go-lang.c: New file. * go-typeprint.c: New file. * go-valprint.c: New file. * symtab.c: #include "go-lang.h". (symbol_set_language): Handle language_go. (symbol_find_demangled_name, symbol_set_names): Ditto. (symbol_natural_name, demangle_for_lookup, find_main_name): Ditto. testsuite/ * configure.ac: Create gdb.go/Makefile. * configure: Regenerate. * gdb.base/default.exp: Add "go" to "set language" testing. * gdb.go/Makefile.in: New file. * gdb.go/basic-types.exp: New file. * gdb.go/chan.exp: New file. * gdb.go/chan.go: New file. * gdb.go/handcall.exp: New file. * gdb.go/handcall.go: New file. * gdb.go/hello.exp: New file. * gdb.go/hello.go: New file. * gdb.go/integers.exp: New file. * gdb.go/integers.go: New file. * gdb.go/methods.exp: New file. * gdb.go/methods.go: New file. * gdb.go/package.exp: New file. * gdb.go/package1.go: New file. * gdb.go/package2.go: New file. * gdb.go/print.exp: New file. * gdb.go/strings.exp: New file. * gdb.go/strings.go: New file. * gdb.go/types.exp: New file. * gdb.go/types.go: New file. * gdb.go/unsafe.exp: New file. * gdb.go/unsafe.go: New file. * lib/future.exp: Add Go support. (gdb_find_go, gdb_find_go_linker): New procs. (gdb_default_target_compile): Add Go support. * lib/gdb.exp (skip_go_tests): New proc. * lib/go.exp: New file. doc/ * gdb.texinfo (Supported Languages): Add Go. (Go): New node.
2012-04-25 16:07:23 +02:00
# This testcase is part of GDB, the GNU debugger.
# Copyright 2012-2013 Free Software Foundation, Inc.
Initial pass at Go language support. * NEWS: Mention Go. * Makefile.in (SFILES): Add go-exp.y, go-lang.c, go-typeprint.c, go-valprint.c. (COMMON_OBS): Add go-lang.o, go-val.print.o, go-typeprint.o. (YYFILES): Add go-exp.c. (YYOBJ): Add go-exp.o. (local-maintainer-clean): Delete go-exp.c. * defs.h (enum language): Add language_go. * dwarf2read.c: #include "go-lang.h". (fixup_go_packaging): New function. (process_full_comp_unit): Call it when processing Go CUs. (dwarf2_physname): Add Go support. (read_file_scope): Handle missing language spec for GNU Go. (set_cu_language): Handle DW_LANG_Go. * go-exp.y: New file. * go-lang.h: New file. * go-lang.c: New file. * go-typeprint.c: New file. * go-valprint.c: New file. * symtab.c: #include "go-lang.h". (symbol_set_language): Handle language_go. (symbol_find_demangled_name, symbol_set_names): Ditto. (symbol_natural_name, demangle_for_lookup, find_main_name): Ditto. testsuite/ * configure.ac: Create gdb.go/Makefile. * configure: Regenerate. * gdb.base/default.exp: Add "go" to "set language" testing. * gdb.go/Makefile.in: New file. * gdb.go/basic-types.exp: New file. * gdb.go/chan.exp: New file. * gdb.go/chan.go: New file. * gdb.go/handcall.exp: New file. * gdb.go/handcall.go: New file. * gdb.go/hello.exp: New file. * gdb.go/hello.go: New file. * gdb.go/integers.exp: New file. * gdb.go/integers.go: New file. * gdb.go/methods.exp: New file. * gdb.go/methods.go: New file. * gdb.go/package.exp: New file. * gdb.go/package1.go: New file. * gdb.go/package2.go: New file. * gdb.go/print.exp: New file. * gdb.go/strings.exp: New file. * gdb.go/strings.go: New file. * gdb.go/types.exp: New file. * gdb.go/types.go: New file. * gdb.go/unsafe.exp: New file. * gdb.go/unsafe.go: New file. * lib/future.exp: Add Go support. (gdb_find_go, gdb_find_go_linker): New procs. (gdb_default_target_compile): Add Go support. * lib/gdb.exp (skip_go_tests): New proc. * lib/go.exp: New file. doc/ * gdb.texinfo (Supported Languages): Add Go. (Go): New node.
2012-04-25 16:07:23 +02:00
#
# 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/>.
# Test basic builtin types.
# NOTE: The tests here intentionally do not require a go compiler.
load_lib "go.exp"
if { [skip_go_tests] } { continue }
proc test_integer_literal_types_accepted {} {
# Test various decimal values.
gdb_test "pt 123" "type = int"
gdb_test "pt void(42)" "type = void"
gdb_test "pt byte(42)" "type = uint8"
gdb_test "pt int(42)" "type = int"
gdb_test "pt uint(42)" "type = uint"
gdb_test "pt uintptr(42)" "type = uintptr"
gdb_test "pt int8(42)" "type = int8"
gdb_test "pt int16(42)" "type = int16"
gdb_test "pt int32(42)" "type = int32"
gdb_test "pt int64(42)" "type = int64"
gdb_test "pt uint8(42)" "type = uint8"
gdb_test "pt uint16(42)" "type = uint16"
gdb_test "pt uint32(42)" "type = uint32"
gdb_test "pt uint64(42)" "type = uint64"
}
proc test_logical_literal_types_accepted {} {
# Test the only possible values for a logical, TRUE and FALSE.
gdb_test "pt true" "type = bool"
gdb_test "pt false" "type = bool"
gdb_test "pt bool(0)" "type = bool"
gdb_test "pt bool(1)" "type = bool"
}
proc test_character_literal_types_accepted {} {
# Test various character values.
gdb_test "pt 'a'" "type = char"
# FIXME: Need more.
}
proc test_string_literal_types_accepted {} {
# Test various string values.
gdb_test "pt \"a simple string\"" "type = string"
gdb_test "pt `a simple raw string`" "type = string"
# FIXME: Need more.
}
proc test_float_literal_types_accepted {} {
# Test various floating point formats.
gdb_test "pt .44" "type = float64"
gdb_test "pt 44.0" "type = float64"
gdb_test "pt 10e20" "type = float64"
gdb_test "pt 10E20" "type = float64"
gdb_test "pt float32(.42)" "type = float32"
gdb_test "pt float64(.42)" "type = float64"
}
proc test_complex_literal_types_accepted {} {
# Test various complex formats.
gdb_test "pt complex64(.42)" "type = complex64"
setup_xfail "*-*-*"
gdb_test "pt complex64(.42i1.0)" "type = complex64"
setup_xfail "*-*-*"
gdb_test "pt complex64(i1.0)" "type = complex64"
gdb_test "pt complex128(.42)" "type = complex128"
setup_xfail "*-*-*"
gdb_test "pt complex128(.42i1.0)" "type = complex128"
setup_xfail "*-*-*"
gdb_test "pt complex128(i1.0)" "type = complex128"
}
# Start with a fresh gdb.
gdb_exit
gdb_start
gdb_reinitialize_dir $srcdir/$subdir
if [set_lang_go] {
test_integer_literal_types_accepted
test_logical_literal_types_accepted
test_character_literal_types_accepted
test_string_literal_types_accepted
test_float_literal_types_accepted
test_complex_literal_types_accepted
} else {
warning "Go type tests suppressed."
}