GDB (xrefs)
Loading...
Searching...
No Matches
/tmp/gdb-13.1/gdb/go-lang.h
Go to the documentation of this file.
1/* Go language support definitions for GDB, the GNU debugger.
2
3 Copyright (C) 2012-2023 Free Software Foundation, Inc.
4
5 This file is part of GDB.
6
7 This program is free software; you can redistribute it and/or modify
8 it under the terms of the GNU General Public License as published by
9 the Free Software Foundation; either version 3 of the License, or
10 (at your option) any later version.
11
12 This program is distributed in the hope that it will be useful,
13 but WITHOUT ANY WARRANTY; without even the implied warranty of
14 MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
15 GNU General Public License for more details.
16
17 You should have received a copy of the GNU General Public License
18 along with this program. If not, see <http://www.gnu.org/licenses/>. */
19
20#if !defined (GO_LANG_H)
21#define GO_LANG_H 1
22
24
25#include "gdbtypes.h"
26#include "symtab.h"
27#include "value.h"
28
29struct parser_state;
30
32{
33 struct type *builtin_void = nullptr;
34 struct type *builtin_char = nullptr;
35 struct type *builtin_bool = nullptr;
36 struct type *builtin_int = nullptr;
37 struct type *builtin_uint = nullptr;
38 struct type *builtin_uintptr = nullptr;
39 struct type *builtin_int8 = nullptr;
40 struct type *builtin_int16 = nullptr;
41 struct type *builtin_int32 = nullptr;
42 struct type *builtin_int64 = nullptr;
43 struct type *builtin_uint8 = nullptr;
44 struct type *builtin_uint16 = nullptr;
45 struct type *builtin_uint32 = nullptr;
46 struct type *builtin_uint64 = nullptr;
47 struct type *builtin_float32 = nullptr;
48 struct type *builtin_float64 = nullptr;
49 struct type *builtin_complex64 = nullptr;
50 struct type *builtin_complex128 = nullptr;
51};
52
54{
55 GO_TYPE_NONE, /* Not a Go object. */
57};
58
59/* Defined in go-lang.c. */
60
61extern const char *go_main_name (void);
62
63extern enum go_type go_classify_struct_type (struct type *type);
64
65extern char *go_symbol_package_name (const struct symbol *sym);
66
67extern char *go_block_package_name (const struct block *block);
68
69extern const struct builtin_go_type *builtin_go_type (struct gdbarch *);
70
71/* Class representing the Go language. */
72
74{
75public:
78 { /* Nothing. */ }
79
80 /* See language.h. */
81
82 const char *name () const override
83 { return "go"; }
84
85 /* See language.h. */
86
87 const char *natural_name () const override
88 { return "Go"; }
89
90 /* See language.h. */
91
93 struct language_arch_info *lai) const override;
94
95 /* See language.h. */
96
98 (const char *mangled, gdb::unique_xmalloc_ptr<char> *demangled)
99 const override
100 {
101 *demangled = demangle_symbol (mangled, 0);
102 return *demangled != NULL;
103 }
104
105 /* See language.h. */
106
107 gdb::unique_xmalloc_ptr<char> demangle_symbol (const char *mangled,
108 int options) const override;
109
110 /* See language.h. */
111
112 void print_type (struct type *type, const char *varstring,
113 struct ui_file *stream, int show, int level,
114 const struct type_print_options *flags) const override;
115
116 /* See language.h. */
117
119 (struct value *val, struct ui_file *stream, int recurse,
120 const struct value_print_options *options) const override;
121
122 /* See language.h. */
123
124 int parser (struct parser_state *ps) const override;
125
126 /* See language.h. */
127
128 bool is_string_type_p (struct type *type) const override
129 {
131 return (type->code () == TYPE_CODE_STRUCT
133 }
134
135 /* See language.h. */
136
138 { return true; }
139};
140
141#endif /* !defined (GO_LANG_H) */
bool store_sym_names_in_linkage_form_p() const override
Definition: go-lang.h:137
bool sniff_from_mangled_name(const char *mangled, gdb::unique_xmalloc_ptr< char > *demangled) const override
Definition: go-lang.h:98
gdb::unique_xmalloc_ptr< char > demangle_symbol(const char *mangled, int options) const override
Definition: go-lang.c:337
int parser(struct parser_state *ps) const override
Definition: go-exp.c:3084
void value_print_inner(struct value *val, struct ui_file *stream, int recurse, const struct value_print_options *options) const override
Definition: go-valprint.c:90
go_language()
Definition: go-lang.h:76
void print_type(struct type *type, const char *varstring, struct ui_file *stream, int show, int level, const struct type_print_options *flags) const override
Definition: go-typeprint.c:45
const char * natural_name() const override
Definition: go-lang.h:87
bool is_string_type_p(struct type *type) const override
Definition: go-lang.h:128
const char * name() const override
Definition: go-lang.h:82
@ language_go
Definition: defs.h:218
struct type * check_typedef(struct type *type)
Definition: gdbtypes.c:3010
mach_port_t kern_return_t mach_port_t mach_msg_type_name_t msgportsPoly mach_port_t kern_return_t pid_t pid mach_port_t kern_return_t mach_port_t task mach_port_t kern_return_t int flags
Definition: gnu-nat.c:1862
enum go_type go_classify_struct_type(struct type *type)
Definition: go-lang.c:121
go_type
Definition: go-lang.h:54
@ GO_TYPE_STRING
Definition: go-lang.h:56
@ GO_TYPE_NONE
Definition: go-lang.h:55
char * go_block_package_name(const struct block *block)
Definition: go-lang.c:417
const char * go_main_name(void)
Definition: go-lang.c:56
char * go_symbol_package_name(const struct symbol *sym)
Definition: go-lang.c:388
Definition: block.h:109
struct type * builtin_uint
Definition: go-lang.h:37
struct type * builtin_complex64
Definition: go-lang.h:49
struct type * builtin_complex128
Definition: go-lang.h:50
struct type * builtin_int64
Definition: go-lang.h:42
struct type * builtin_int32
Definition: go-lang.h:41
struct type * builtin_char
Definition: go-lang.h:34
struct type * builtin_void
Definition: go-lang.h:33
struct type * builtin_int
Definition: go-lang.h:36
struct type * builtin_uint64
Definition: go-lang.h:46
struct type * builtin_uintptr
Definition: go-lang.h:38
struct type * builtin_float64
Definition: go-lang.h:48
struct type * builtin_int16
Definition: go-lang.h:40
struct type * builtin_bool
Definition: go-lang.h:35
struct type * builtin_float32
Definition: go-lang.h:47
struct type * builtin_uint32
Definition: go-lang.h:45
struct type * builtin_uint16
Definition: go-lang.h:44
struct type * builtin_int8
Definition: go-lang.h:39
struct type * builtin_uint8
Definition: go-lang.h:43
Definition: gdbtypes.h:922
type_code code() const
Definition: gdbtypes.h:927
Definition: value.c:181