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/go-lang.h | 88 +++++++++++++++++++++++++++++++++++++++++++++++++++++++++++ 1 file changed, 88 insertions(+) create mode 100644 gdb/go-lang.h (limited to 'gdb/go-lang.h') diff --git a/gdb/go-lang.h b/gdb/go-lang.h new file mode 100644 index 0000000..67b5d93 --- /dev/null +++ b/gdb/go-lang.h @@ -0,0 +1,88 @@ +/* Go language support definitions for GDB, the GNU debugger. + + Copyright (C) 2012 Free Software Foundation, Inc. + + This file is part of GDB. + + 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 . */ + +#if !defined (GO_LANG_H) +#define GO_LANG_H 1 + +#include "gdbtypes.h" +#include "symtab.h" +#include "value.h" + +struct builtin_go_type +{ + struct type *builtin_void; + struct type *builtin_char; + struct type *builtin_bool; + struct type *builtin_int; + struct type *builtin_uint; + struct type *builtin_uintptr; + struct type *builtin_int8; + struct type *builtin_int16; + struct type *builtin_int32; + struct type *builtin_int64; + struct type *builtin_uint8; + struct type *builtin_uint16; + struct type *builtin_uint32; + struct type *builtin_uint64; + struct type *builtin_float32; + struct type *builtin_float64; + struct type *builtin_complex64; + struct type *builtin_complex128; +}; + +enum go_type +{ + GO_TYPE_NONE, /* Not a Go object. */ + GO_TYPE_STRING +}; + +/* Defined in go-exp.y. */ + +extern int go_parse (void); + +extern void go_error (char *); + +/* Defined in go-lang.c. */ + +extern const char *go_main_name (void); + +extern enum go_type go_classify_struct_type (struct type *type); + +extern char *go_demangle (const char *mangled, int options); + +extern char *go_symbol_package_name (const struct symbol *sym); + +extern char *go_block_package_name (const struct block *block); + +extern const struct builtin_go_type *builtin_go_type (struct gdbarch *); + +/* Defined in go-typeprint.c. */ + +extern void go_print_type (struct type *type, const char *varstring, + struct ui_file *stream, int show, int level); + +/* Defined in go-valprint.c. */ + +extern void go_val_print (struct type *type, const gdb_byte *valaddr, + int embedded_offset, CORE_ADDR address, + struct ui_file *stream, int recurse, + const struct value *val, + const struct value_print_options *options); + +#endif /* !defined (GO_LANG_H) */ -- cgit v1.1