diff options
author | Doug Evans <dje@google.com> | 2012-04-25 14:07:23 +0000 |
---|---|---|
committer | Doug Evans <dje@google.com> | 2012-04-25 14:07:23 +0000 |
commit | a766d390bb857383a5f9ae80a102e1f8705f4c2e (patch) | |
tree | 056e6d8d57aee5d234d9ed4619a27306dfec3dd7 /gdb/testsuite/lib/future.exp | |
parent | e65f9ffb8e49431537404712a5b1eed310964cb0 (diff) | |
download | gdb-a766d390bb857383a5f9ae80a102e1f8705f4c2e.zip gdb-a766d390bb857383a5f9ae80a102e1f8705f4c2e.tar.gz gdb-a766d390bb857383a5f9ae80a102e1f8705f4c2e.tar.bz2 |
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.
Diffstat (limited to 'gdb/testsuite/lib/future.exp')
-rw-r--r-- | gdb/testsuite/lib/future.exp | 94 |
1 files changed, 90 insertions, 4 deletions
diff --git a/gdb/testsuite/lib/future.exp b/gdb/testsuite/lib/future.exp index 4e26dcb..40456c0 100644 --- a/gdb/testsuite/lib/future.exp +++ b/gdb/testsuite/lib/future.exp @@ -60,6 +60,30 @@ proc gdb_find_gfortran {} { return $CC } +proc gdb_find_go {} { + global tool_root_dir + + set GO "" + + if {![is_remote host]} { + set file [lookfor_file $tool_root_dir gccgo] + if { $file != "" } { + set root [file dirname $file] + set GO "$file -B$root/gcc/" + } + } + + if { $GO == "" } { + set GO [transform gccgo] + } + + return $GO +} + +proc gdb_find_go_linker {} { + return [find_go] +} + proc gdb_default_target_compile {source destfile type options} { global target_triplet global tool_root_dir @@ -74,6 +98,11 @@ proc gdb_default_target_compile {source destfile type options} { set libs "" set compiler_type "c" set compiler "" + set linker "" + # linker_opts_order is one of "sources-then-flags", "flags-then-sources". + # The order shouldn't matter. It's done this way to preserve + # existing behavior. + set linker_opts_order "sources-then-flags" set ldflags "" set dest [target_info name] @@ -138,6 +167,26 @@ proc gdb_default_target_compile {source destfile type options} { } } + if { $i == "go" } { + set compiler_type "go" + if {[board_info $dest exists goflags]} { + append add_flags " [target_info goflags]" + } + if {[board_info $dest exists gocompiler]} { + set compiler [target_info gocompiler] + } else { + set compiler [find_go] + } + if {[board_info $dest exists golinker]} { + set linker [target_info golinker] + } else { + set linker [find_go_linker] + } + if {[board_info $dest exists golinker_opts_order]} { + set linker_opts_order [target_info golinker_opts_order] + } + } + if {[regexp "^dest=" $i]} { regsub "^dest=" $i "" tmp if {[board_info $tmp exists name]} { @@ -193,6 +242,8 @@ proc gdb_default_target_compile {source destfile type options} { global F77_FOR_TARGET global F90_FOR_TARGET global GNATMAKE_FOR_TARGET + global GO_FOR_TARGET + global GO_LD_FOR_TARGET if {[info exists GNATMAKE_FOR_TARGET]} { if { $compiler_type == "ada" } { @@ -224,6 +275,19 @@ proc gdb_default_target_compile {source destfile type options} { } } + if { $compiler_type == "go" } { + if {[info exists GO_FOR_TARGET]} { + set compiler $GO_FOR_TARGET + } + if {[info exists GO_LD_FOR_TARGET]} { + set linker $GO_LD_FOR_TARGET + } + } + + if { $type == "executable" && $linker != "" } { + set compiler $linker + } + if { $compiler == "" } { set compiler [board_info $dest compiler] if { $compiler == "" } { @@ -366,10 +430,26 @@ proc gdb_default_target_compile {source destfile type options} { # This is obscure: we put SOURCES at the end when building an # object, because otherwise, in some situations, libtool will # become confused about the name of the actual source file. - if {$type == "object"} { - set opts "$add_flags $sources" - } else { - set opts "$sources $add_flags" + switch $type { + "object" { + set opts "$add_flags $sources" + } + "executable" { + switch $linker_opts_order { + "flags-then-sources" { + set opts "$add_flags $sources" + } + "sources-then-flags" { + set opts "$sources $add_flags" + } + default { + error "Invalid value for board_info linker_opts_order" + } + } + } + default { + set opts "$sources $add_flags" + } } if {[is_remote host]} { @@ -431,6 +511,12 @@ if {[info procs find_gfortran] == ""} { set use_gdb_compile 1 } +if {[info procs find_go_linker] == ""} { + rename gdb_find_go find_go + rename gdb_find_go_linker find_go_linker + # No need to set use_gdb_compile. +} + if {$use_gdb_compile} { catch {rename default_target_compile {}} rename gdb_default_target_compile default_target_compile |