From a766d390bb857383a5f9ae80a102e1f8705f4c2e Mon Sep 17 00:00:00 2001 From: Doug Evans Date: Wed, 25 Apr 2012 14:07:23 +0000 Subject: 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. --- gdb/doc/ChangeLog | 5 +++++ gdb/doc/gdb.texinfo | 54 +++++++++++++++++++++++++++++++++++++++++++++++++++-- 2 files changed, 57 insertions(+), 2 deletions(-) (limited to 'gdb/doc') diff --git a/gdb/doc/ChangeLog b/gdb/doc/ChangeLog index 92085c9..0f41571 100644 --- a/gdb/doc/ChangeLog +++ b/gdb/doc/ChangeLog @@ -1,3 +1,8 @@ +2012-04-25 Doug Evans + + * gdb.texinfo (Supported Languages): Add Go. + (Go): New node. + 2012-04-25 Yao Qi * gdbint.texinfo (Testsuite): New section `Board settings'. diff --git a/gdb/doc/gdb.texinfo b/gdb/doc/gdb.texinfo index a2a4eb3..d4d2f60 100644 --- a/gdb/doc/gdb.texinfo +++ b/gdb/doc/gdb.texinfo @@ -12487,8 +12487,8 @@ being set automatically by @value{GDBN}. @node Supported Languages @section Supported Languages -@value{GDBN} supports C, C@t{++}, D, Objective-C, Fortran, Java, OpenCL C, Pascal, -assembly, Modula-2, and Ada. +@value{GDBN} supports C, C@t{++}, D, Go, Objective-C, Fortran, Java, +OpenCL C, Pascal, assembly, Modula-2, and Ada. @c This is false ... Some @value{GDBN} features may be used in expressions regardless of the language you use: the @value{GDBN} @code{@@} and @code{::} operators, @@ -12507,6 +12507,7 @@ language reference or tutorial. @menu * C:: C and C@t{++} * D:: D +* Go:: Go * Objective-C:: Objective-C * OpenCL C:: OpenCL C * Fortran:: Fortran @@ -13059,6 +13060,55 @@ See @ref{PowerPC,,PowerPC} for more details. GDC, LDC or DMD compilers. Currently @value{GDBN} supports only one D specific feature --- dynamic arrays. +@node Go +@subsection Go + +@cindex Go (programming language) +@value{GDBN} can be used to debug programs written in Go and compiled with +@file{gccgo} or @file{6g} compilers. + +Here is a summary of the Go-specific features and restrictions: + +@table @code +@cindex current Go package +@item The current Go package +The name of the current package does not need to be specified when +specifying global variables and functions. + +For example, given the program: + +@example +package main +var myglob = "Shall we?" +func main () @{ + // ... +@} +@end example + +When stopped inside @code{main} either of these work: + +@example +(gdb) p myglob +(gdb) p main.myglob +@end example + +@cindex builtin Go types +@item Builtin Go types +The @code{string} type is recognized by @value{GDBN} and is printed +as a string. + +@cindex builtin Go functions +@item Builtin Go functions +The @value{GDBN} expression parser recognizes the @code{unsafe.Sizeof} +function and handles it internally. +@end table + +@cindex restrictions on Go expressions +@item Restrictions on Go expressions +All Go operators are supported except @code{&^}. +The Go @code{_} ``blank identifier'' is not supported. +Automatic dereferencing of pointers is not supported. + @node Objective-C @subsection Objective-C -- cgit v1.1