GDB (API)
|
00001 /* Go language support routines for GDB, the GNU debugger. 00002 00003 Copyright (C) 2012-2013 Free Software Foundation, Inc. 00004 00005 This file is part of GDB. 00006 00007 This program is free software; you can redistribute it and/or modify 00008 it under the terms of the GNU General Public License as published by 00009 the Free Software Foundation; either version 3 of the License, or 00010 (at your option) any later version. 00011 00012 This program is distributed in the hope that it will be useful, 00013 but WITHOUT ANY WARRANTY; without even the implied warranty of 00014 MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the 00015 GNU General Public License for more details. 00016 00017 You should have received a copy of the GNU General Public License 00018 along with this program. If not, see <http://www.gnu.org/licenses/>. */ 00019 00020 /* TODO: 00021 - split stacks 00022 - printing of native types 00023 - goroutines 00024 - lots more 00025 - gccgo mangling needs redoing 00026 It's too hard, for example, to know whether one is looking at a mangled 00027 Go symbol or not, and their are ambiguities, e.g., the demangler may 00028 get passed *any* symbol, including symbols from other languages 00029 and including symbols that are already demangled. 00030 One thought is to at least add an _G prefix. 00031 - 6g mangling isn't supported yet 00032 */ 00033 00034 #include "defs.h" 00035 #include "gdb_assert.h" 00036 #include "gdb_obstack.h" 00037 #include "gdb_string.h" 00038 #include "block.h" 00039 #include "symtab.h" 00040 #include "language.h" 00041 #include "go-lang.h" 00042 #include "c-lang.h" 00043 #include "parser-defs.h" 00044 00045 #include <ctype.h> 00046 00047 /* The main function in the main package. */ 00048 static const char GO_MAIN_MAIN[] = "main.main"; 00049 00050 /* Function returning the special symbol name used by Go for the main 00051 procedure in the main program if it is found in minimal symbol list. 00052 This function tries to find minimal symbols so that it finds them even 00053 if the program was compiled without debugging information. */ 00054 00055 const char * 00056 go_main_name (void) 00057 { 00058 struct minimal_symbol *msym; 00059 00060 msym = lookup_minimal_symbol (GO_MAIN_MAIN, NULL, NULL); 00061 if (msym != NULL) 00062 return GO_MAIN_MAIN; 00063 00064 /* No known entry procedure found, the main program is probably not Go. */ 00065 return NULL; 00066 } 00067 00068 /* Return non-zero if TYPE is a gccgo string. 00069 We assume CHECK_TYPEDEF has already been done. */ 00070 00071 static int 00072 gccgo_string_p (struct type *type) 00073 { 00074 /* gccgo strings don't necessarily have a name we can use. */ 00075 00076 if (TYPE_NFIELDS (type) == 2) 00077 { 00078 struct type *type0 = TYPE_FIELD_TYPE (type, 0); 00079 struct type *type1 = TYPE_FIELD_TYPE (type, 1); 00080 00081 CHECK_TYPEDEF (type0); 00082 CHECK_TYPEDEF (type1); 00083 00084 if (TYPE_CODE (type0) == TYPE_CODE_PTR 00085 && strcmp (TYPE_FIELD_NAME (type, 0), "__data") == 0 00086 && TYPE_CODE (type1) == TYPE_CODE_INT 00087 && strcmp (TYPE_FIELD_NAME (type, 1), "__length") == 0) 00088 { 00089 struct type *target_type = TYPE_TARGET_TYPE (type0); 00090 00091 CHECK_TYPEDEF (target_type); 00092 00093 if (TYPE_CODE (target_type) == TYPE_CODE_INT 00094 && TYPE_LENGTH (target_type) == 1 00095 && strcmp (TYPE_NAME (target_type), "uint8") == 0) 00096 return 1; 00097 } 00098 } 00099 00100 return 0; 00101 } 00102 00103 /* Return non-zero if TYPE is a 6g string. 00104 We assume CHECK_TYPEDEF has already been done. */ 00105 00106 static int 00107 sixg_string_p (struct type *type) 00108 { 00109 if (TYPE_NFIELDS (type) == 2 00110 && TYPE_TAG_NAME (type) != NULL 00111 && strcmp (TYPE_TAG_NAME (type), "string") == 0) 00112 return 1; 00113 00114 return 0; 00115 } 00116 00117 /* Classify the kind of Go object that TYPE is. 00118 TYPE is a TYPE_CODE_STRUCT, used to represent a Go object. */ 00119 00120 enum go_type 00121 go_classify_struct_type (struct type *type) 00122 { 00123 CHECK_TYPEDEF (type); 00124 00125 /* Recognize strings as they're useful to be able to print without 00126 pretty-printers. */ 00127 if (gccgo_string_p (type) 00128 || sixg_string_p (type)) 00129 return GO_TYPE_STRING; 00130 00131 return GO_TYPE_NONE; 00132 } 00133 00134 /* Subroutine of unpack_mangled_go_symbol to simplify it. 00135 Given "[foo.]bar.baz", store "bar" in *PACKAGEP and "baz" in *OBJECTP. 00136 We stomp on the last '.' to nul-terminate "bar". 00137 The caller is responsible for memory management. */ 00138 00139 static void 00140 unpack_package_and_object (char *buf, 00141 const char **packagep, const char **objectp) 00142 { 00143 char *last_dot; 00144 00145 last_dot = strrchr (buf, '.'); 00146 gdb_assert (last_dot != NULL); 00147 *objectp = last_dot + 1; 00148 *last_dot = '\0'; 00149 last_dot = strrchr (buf, '.'); 00150 if (last_dot != NULL) 00151 *packagep = last_dot + 1; 00152 else 00153 *packagep = buf; 00154 } 00155 00156 /* Given a mangled Go symbol, find its package name, object name, and 00157 method type (if present). 00158 E.g., for "libgo_net.textproto.String.N33_libgo_net.textproto.ProtocolError" 00159 *PACKAGEP = "textproto" 00160 *OBJECTP = "String" 00161 *METHOD_TYPE_PACKAGEP = "textproto" 00162 *METHOD_TYPE_OBJECTP = "ProtocolError" 00163 00164 Space for the resulting strings is malloc'd in one buffer. 00165 PACKAGEP,OBJECTP,METHOD_TYPE* will (typically) point into this buffer. 00166 [There are a few exceptions, but the caller is still responsible for 00167 freeing the resulting pointer.] 00168 A pointer to this buffer is returned, or NULL if symbol isn't a 00169 mangled Go symbol. 00170 The caller is responsible for freeing the result. 00171 00172 *METHOD_TYPE_IS_POINTERP is set to a boolean indicating if 00173 the method type is a pointer. 00174 00175 There may be value in returning the outer container, 00176 i.e., "net" in the above example, but for now it's not needed. 00177 Plus it's currently not straightforward to compute, 00178 it comes from -fgo-prefix, and there's no algorithm to compute it. 00179 00180 If we ever need to unpack the method type, this routine should work 00181 for that too. */ 00182 00183 static char * 00184 unpack_mangled_go_symbol (const char *mangled_name, 00185 const char **packagep, 00186 const char **objectp, 00187 const char **method_type_packagep, 00188 const char **method_type_objectp, 00189 int *method_type_is_pointerp) 00190 { 00191 char *buf; 00192 char *p; 00193 int len = strlen (mangled_name); 00194 /* Pointer to last digit in "N<digit(s)>_". */ 00195 char *saw_digit; 00196 /* Pointer to "N" if valid "N<digit(s)>_" found. */ 00197 char *method_type; 00198 /* Pointer to the first '.'. */ 00199 char *first_dot; 00200 /* Pointer to the last '.'. */ 00201 char *last_dot; 00202 /* Non-zero if we saw a pointer indicator. */ 00203 int saw_pointer; 00204 00205 *packagep = *objectp = NULL; 00206 *method_type_packagep = *method_type_objectp = NULL; 00207 *method_type_is_pointerp = 0; 00208 00209 /* main.init is mangled specially. */ 00210 if (strcmp (mangled_name, "__go_init_main") == 0) 00211 { 00212 char *package = xstrdup ("main"); 00213 00214 *packagep = package; 00215 *objectp = "init"; 00216 return package; 00217 } 00218 00219 /* main.main is mangled specially (missing prefix). */ 00220 if (strcmp (mangled_name, "main.main") == 0) 00221 { 00222 char *package = xstrdup ("main"); 00223 00224 *packagep = package; 00225 *objectp = "main"; 00226 return package; 00227 } 00228 00229 /* We may get passed, e.g., "main.T.Foo", which is *not* mangled. 00230 Alas it looks exactly like "prefix.package.object." 00231 To cope for now we only recognize the following prefixes: 00232 00233 go: the default 00234 libgo_.*: used by gccgo's runtime 00235 00236 Thus we don't support -fgo-prefix (except as used by the runtime). */ 00237 if (strncmp (mangled_name, "go.", 3) != 0 00238 && strncmp (mangled_name, "libgo_", 6) != 0) 00239 return NULL; 00240 00241 /* Quick check for whether a search may be fruitful. */ 00242 /* Ignore anything with @plt, etc. in it. */ 00243 if (strchr (mangled_name, '@') != NULL) 00244 return NULL; 00245 /* It must have at least two dots. */ 00246 first_dot = strchr (mangled_name, '.'); 00247 if (first_dot == NULL) 00248 return NULL; 00249 /* Treat "foo.bar" as unmangled. It can collide with lots of other 00250 languages and it's not clear what the consequences are. 00251 And except for main.main, all gccgo symbols are at least 00252 prefix.package.object. */ 00253 last_dot = strrchr (mangled_name, '.'); 00254 if (last_dot == first_dot) 00255 return NULL; 00256 00257 /* More quick checks. */ 00258 if (last_dot[1] == '\0' /* foo. */ 00259 || last_dot[-1] == '.') /* foo..bar */ 00260 return NULL; 00261 00262 /* At this point we've decided we have a mangled Go symbol. */ 00263 00264 buf = xstrdup (mangled_name); 00265 00266 /* Search backwards looking for "N<digit(s)>". */ 00267 p = buf + len; 00268 saw_digit = method_type = NULL; 00269 saw_pointer = 0; 00270 while (p > buf) 00271 { 00272 int current = *(const unsigned char *) --p; 00273 int current_is_digit = isdigit (current); 00274 00275 if (saw_digit) 00276 { 00277 if (current_is_digit) 00278 continue; 00279 if (current == 'N' 00280 && ((p > buf && p[-1] == '.') 00281 || (p > buf + 1 && p[-1] == 'p' && p[-2] == '.'))) 00282 { 00283 if (atoi (p + 1) == strlen (saw_digit + 2)) 00284 { 00285 if (p[-1] == '.') 00286 method_type = p - 1; 00287 else 00288 { 00289 gdb_assert (p[-1] == 'p'); 00290 saw_pointer = 1; 00291 method_type = p - 2; 00292 } 00293 break; 00294 } 00295 } 00296 /* Not what we're looking for, reset and keep looking. */ 00297 saw_digit = NULL; 00298 saw_pointer = 0; 00299 continue; 00300 } 00301 if (current_is_digit && p[1] == '_') 00302 { 00303 /* Possible start of method "this" [sic] type. */ 00304 saw_digit = p; 00305 continue; 00306 } 00307 } 00308 00309 if (method_type != NULL 00310 /* Ensure not something like "..foo". */ 00311 && (method_type > buf && method_type[-1] != '.')) 00312 { 00313 unpack_package_and_object (saw_digit + 2, 00314 method_type_packagep, method_type_objectp); 00315 *method_type = '\0'; 00316 *method_type_is_pointerp = saw_pointer; 00317 } 00318 00319 unpack_package_and_object (buf, packagep, objectp); 00320 return buf; 00321 } 00322 00323 /* Implements the la_demangle language_defn routine for language Go. 00324 00325 N.B. This may get passed *any* symbol, including symbols from other 00326 languages and including symbols that are already demangled. 00327 Both of these situations are kinda unfortunate, but that's how things 00328 are today. 00329 00330 N.B. This currently only supports gccgo's mangling. 00331 00332 N.B. gccgo's mangling needs, I think, changing. 00333 This demangler can't work in all situations, 00334 thus not too much effort is currently put into it. */ 00335 00336 char * 00337 go_demangle (const char *mangled_name, int options) 00338 { 00339 struct obstack tempbuf; 00340 char *result; 00341 char *name_buf; 00342 const char *package_name; 00343 const char *object_name; 00344 const char *method_type_package_name; 00345 const char *method_type_object_name; 00346 int method_type_is_pointer; 00347 00348 if (mangled_name == NULL) 00349 return NULL; 00350 00351 name_buf = unpack_mangled_go_symbol (mangled_name, 00352 &package_name, &object_name, 00353 &method_type_package_name, 00354 &method_type_object_name, 00355 &method_type_is_pointer); 00356 if (name_buf == NULL) 00357 return NULL; 00358 00359 obstack_init (&tempbuf); 00360 00361 /* Print methods as they appear in "method expressions". */ 00362 if (method_type_package_name != NULL) 00363 { 00364 /* FIXME: Seems like we should include package_name here somewhere. */ 00365 if (method_type_is_pointer) 00366 obstack_grow_str (&tempbuf, "(*"); 00367 obstack_grow_str (&tempbuf, method_type_package_name); 00368 obstack_grow_str (&tempbuf, "."); 00369 obstack_grow_str (&tempbuf, method_type_object_name); 00370 if (method_type_is_pointer) 00371 obstack_grow_str (&tempbuf, ")"); 00372 obstack_grow_str (&tempbuf, "."); 00373 obstack_grow_str (&tempbuf, object_name); 00374 } 00375 else 00376 { 00377 obstack_grow_str (&tempbuf, package_name); 00378 obstack_grow_str (&tempbuf, "."); 00379 obstack_grow_str (&tempbuf, object_name); 00380 } 00381 obstack_grow_str0 (&tempbuf, ""); 00382 00383 result = xstrdup (obstack_finish (&tempbuf)); 00384 obstack_free (&tempbuf, NULL); 00385 xfree (name_buf); 00386 return result; 00387 } 00388 00389 /* Given a Go symbol, return its package or NULL if unknown. 00390 Space for the result is malloc'd, caller must free. */ 00391 00392 char * 00393 go_symbol_package_name (const struct symbol *sym) 00394 { 00395 const char *mangled_name = SYMBOL_LINKAGE_NAME (sym); 00396 const char *package_name; 00397 const char *object_name; 00398 const char *method_type_package_name; 00399 const char *method_type_object_name; 00400 int method_type_is_pointer; 00401 char *name_buf; 00402 char *result; 00403 00404 gdb_assert (SYMBOL_LANGUAGE (sym) == language_go); 00405 name_buf = unpack_mangled_go_symbol (mangled_name, 00406 &package_name, &object_name, 00407 &method_type_package_name, 00408 &method_type_object_name, 00409 &method_type_is_pointer); 00410 /* Some Go symbols don't have mangled form we interpret (yet). */ 00411 if (name_buf == NULL) 00412 return NULL; 00413 result = xstrdup (package_name); 00414 xfree (name_buf); 00415 return result; 00416 } 00417 00418 /* Return the package that BLOCK is in, or NULL if there isn't one. 00419 Space for the result is malloc'd, caller must free. */ 00420 00421 char * 00422 go_block_package_name (const struct block *block) 00423 { 00424 while (block != NULL) 00425 { 00426 struct symbol *function = BLOCK_FUNCTION (block); 00427 00428 if (function != NULL) 00429 { 00430 char *package_name = go_symbol_package_name (function); 00431 00432 if (package_name != NULL) 00433 return package_name; 00434 00435 /* Stop looking if we find a function without a package name. 00436 We're most likely outside of Go and thus the concept of the 00437 "current" package is gone. */ 00438 return NULL; 00439 } 00440 00441 block = BLOCK_SUPERBLOCK (block); 00442 } 00443 00444 return NULL; 00445 } 00446 00447 /* Table mapping opcodes into strings for printing operators 00448 and precedences of the operators. 00449 TODO(dje): &^ ? */ 00450 00451 static const struct op_print go_op_print_tab[] = 00452 { 00453 {",", BINOP_COMMA, PREC_COMMA, 0}, 00454 {"=", BINOP_ASSIGN, PREC_ASSIGN, 1}, 00455 {"||", BINOP_LOGICAL_OR, PREC_LOGICAL_OR, 0}, 00456 {"&&", BINOP_LOGICAL_AND, PREC_LOGICAL_AND, 0}, 00457 {"|", BINOP_BITWISE_IOR, PREC_BITWISE_IOR, 0}, 00458 {"^", BINOP_BITWISE_XOR, PREC_BITWISE_XOR, 0}, 00459 {"&", BINOP_BITWISE_AND, PREC_BITWISE_AND, 0}, 00460 {"==", BINOP_EQUAL, PREC_EQUAL, 0}, 00461 {"!=", BINOP_NOTEQUAL, PREC_EQUAL, 0}, 00462 {"<=", BINOP_LEQ, PREC_ORDER, 0}, 00463 {">=", BINOP_GEQ, PREC_ORDER, 0}, 00464 {">", BINOP_GTR, PREC_ORDER, 0}, 00465 {"<", BINOP_LESS, PREC_ORDER, 0}, 00466 {">>", BINOP_RSH, PREC_SHIFT, 0}, 00467 {"<<", BINOP_LSH, PREC_SHIFT, 0}, 00468 {"+", BINOP_ADD, PREC_ADD, 0}, 00469 {"-", BINOP_SUB, PREC_ADD, 0}, 00470 {"*", BINOP_MUL, PREC_MUL, 0}, 00471 {"/", BINOP_DIV, PREC_MUL, 0}, 00472 {"%", BINOP_REM, PREC_MUL, 0}, 00473 {"@", BINOP_REPEAT, PREC_REPEAT, 0}, 00474 {"-", UNOP_NEG, PREC_PREFIX, 0}, 00475 {"!", UNOP_LOGICAL_NOT, PREC_PREFIX, 0}, 00476 {"^", UNOP_COMPLEMENT, PREC_PREFIX, 0}, 00477 {"*", UNOP_IND, PREC_PREFIX, 0}, 00478 {"&", UNOP_ADDR, PREC_PREFIX, 0}, 00479 {"unsafe.Sizeof ", UNOP_SIZEOF, PREC_PREFIX, 0}, 00480 {"++", UNOP_POSTINCREMENT, PREC_SUFFIX, 0}, 00481 {"--", UNOP_POSTDECREMENT, PREC_SUFFIX, 0}, 00482 {NULL, 0, 0, 0} 00483 }; 00484 00485 enum go_primitive_types { 00486 go_primitive_type_void, 00487 go_primitive_type_char, 00488 go_primitive_type_bool, 00489 go_primitive_type_int, 00490 go_primitive_type_uint, 00491 go_primitive_type_uintptr, 00492 go_primitive_type_int8, 00493 go_primitive_type_int16, 00494 go_primitive_type_int32, 00495 go_primitive_type_int64, 00496 go_primitive_type_uint8, 00497 go_primitive_type_uint16, 00498 go_primitive_type_uint32, 00499 go_primitive_type_uint64, 00500 go_primitive_type_float32, 00501 go_primitive_type_float64, 00502 go_primitive_type_complex64, 00503 go_primitive_type_complex128, 00504 nr_go_primitive_types 00505 }; 00506 00507 static void 00508 go_language_arch_info (struct gdbarch *gdbarch, 00509 struct language_arch_info *lai) 00510 { 00511 const struct builtin_go_type *builtin = builtin_go_type (gdbarch); 00512 00513 lai->string_char_type = builtin->builtin_char; 00514 00515 lai->primitive_type_vector 00516 = GDBARCH_OBSTACK_CALLOC (gdbarch, nr_go_primitive_types + 1, 00517 struct type *); 00518 00519 lai->primitive_type_vector [go_primitive_type_void] 00520 = builtin->builtin_void; 00521 lai->primitive_type_vector [go_primitive_type_char] 00522 = builtin->builtin_char; 00523 lai->primitive_type_vector [go_primitive_type_bool] 00524 = builtin->builtin_bool; 00525 lai->primitive_type_vector [go_primitive_type_int] 00526 = builtin->builtin_int; 00527 lai->primitive_type_vector [go_primitive_type_uint] 00528 = builtin->builtin_uint; 00529 lai->primitive_type_vector [go_primitive_type_uintptr] 00530 = builtin->builtin_uintptr; 00531 lai->primitive_type_vector [go_primitive_type_int8] 00532 = builtin->builtin_int8; 00533 lai->primitive_type_vector [go_primitive_type_int16] 00534 = builtin->builtin_int16; 00535 lai->primitive_type_vector [go_primitive_type_int32] 00536 = builtin->builtin_int32; 00537 lai->primitive_type_vector [go_primitive_type_int64] 00538 = builtin->builtin_int64; 00539 lai->primitive_type_vector [go_primitive_type_uint8] 00540 = builtin->builtin_uint8; 00541 lai->primitive_type_vector [go_primitive_type_uint16] 00542 = builtin->builtin_uint16; 00543 lai->primitive_type_vector [go_primitive_type_uint32] 00544 = builtin->builtin_uint32; 00545 lai->primitive_type_vector [go_primitive_type_uint64] 00546 = builtin->builtin_uint64; 00547 lai->primitive_type_vector [go_primitive_type_float32] 00548 = builtin->builtin_float32; 00549 lai->primitive_type_vector [go_primitive_type_float64] 00550 = builtin->builtin_float64; 00551 lai->primitive_type_vector [go_primitive_type_complex64] 00552 = builtin->builtin_complex64; 00553 lai->primitive_type_vector [go_primitive_type_complex128] 00554 = builtin->builtin_complex128; 00555 00556 lai->bool_type_symbol = "bool"; 00557 lai->bool_type_default = builtin->builtin_bool; 00558 } 00559 00560 static const struct language_defn go_language_defn = 00561 { 00562 "go", 00563 language_go, 00564 range_check_off, 00565 case_sensitive_on, 00566 array_row_major, 00567 macro_expansion_no, 00568 &exp_descriptor_c, 00569 go_parse, 00570 go_error, 00571 null_post_parser, 00572 c_printchar, /* Print a character constant. */ 00573 c_printstr, /* Function to print string constant. */ 00574 c_emit_char, /* Print a single char. */ 00575 go_print_type, /* Print a type using appropriate syntax. */ 00576 c_print_typedef, /* Print a typedef using appropriate 00577 syntax. */ 00578 go_val_print, /* Print a value using appropriate syntax. */ 00579 c_value_print, /* Print a top-level value. */ 00580 default_read_var_value, /* la_read_var_value */ 00581 NULL, /* Language specific skip_trampoline. */ 00582 NULL, /* name_of_this */ 00583 basic_lookup_symbol_nonlocal, 00584 basic_lookup_transparent_type, 00585 go_demangle, /* Language specific symbol demangler. */ 00586 NULL, /* Language specific 00587 class_name_from_physname. */ 00588 go_op_print_tab, /* Expression operators for printing. */ 00589 1, /* C-style arrays. */ 00590 0, /* String lower bound. */ 00591 default_word_break_characters, 00592 default_make_symbol_completion_list, 00593 go_language_arch_info, 00594 default_print_array_index, 00595 default_pass_by_reference, 00596 c_get_string, 00597 NULL, 00598 iterate_over_symbols, 00599 LANG_MAGIC 00600 }; 00601 00602 static void * 00603 build_go_types (struct gdbarch *gdbarch) 00604 { 00605 struct builtin_go_type *builtin_go_type 00606 = GDBARCH_OBSTACK_ZALLOC (gdbarch, struct builtin_go_type); 00607 00608 builtin_go_type->builtin_void 00609 = arch_type (gdbarch, TYPE_CODE_VOID, 1, "void"); 00610 builtin_go_type->builtin_char 00611 = arch_character_type (gdbarch, 8, 1, "char"); 00612 builtin_go_type->builtin_bool 00613 = arch_boolean_type (gdbarch, 8, 0, "bool"); 00614 builtin_go_type->builtin_int 00615 = arch_integer_type (gdbarch, gdbarch_int_bit (gdbarch), 0, "int"); 00616 builtin_go_type->builtin_uint 00617 = arch_integer_type (gdbarch, gdbarch_int_bit (gdbarch), 1, "uint"); 00618 builtin_go_type->builtin_uintptr 00619 = arch_integer_type (gdbarch, gdbarch_ptr_bit (gdbarch), 1, "uintptr"); 00620 builtin_go_type->builtin_int8 00621 = arch_integer_type (gdbarch, 8, 0, "int8"); 00622 builtin_go_type->builtin_int16 00623 = arch_integer_type (gdbarch, 16, 0, "int16"); 00624 builtin_go_type->builtin_int32 00625 = arch_integer_type (gdbarch, 32, 0, "int32"); 00626 builtin_go_type->builtin_int64 00627 = arch_integer_type (gdbarch, 64, 0, "int64"); 00628 builtin_go_type->builtin_uint8 00629 = arch_integer_type (gdbarch, 8, 1, "uint8"); 00630 builtin_go_type->builtin_uint16 00631 = arch_integer_type (gdbarch, 16, 1, "uint16"); 00632 builtin_go_type->builtin_uint32 00633 = arch_integer_type (gdbarch, 32, 1, "uint32"); 00634 builtin_go_type->builtin_uint64 00635 = arch_integer_type (gdbarch, 64, 1, "uint64"); 00636 builtin_go_type->builtin_float32 00637 = arch_float_type (gdbarch, 32, "float32", NULL); 00638 builtin_go_type->builtin_float64 00639 = arch_float_type (gdbarch, 64, "float64", NULL); 00640 builtin_go_type->builtin_complex64 00641 = arch_complex_type (gdbarch, "complex64", 00642 builtin_go_type->builtin_float32); 00643 builtin_go_type->builtin_complex128 00644 = arch_complex_type (gdbarch, "complex128", 00645 builtin_go_type->builtin_float64); 00646 00647 return builtin_go_type; 00648 } 00649 00650 static struct gdbarch_data *go_type_data; 00651 00652 const struct builtin_go_type * 00653 builtin_go_type (struct gdbarch *gdbarch) 00654 { 00655 return gdbarch_data (gdbarch, go_type_data); 00656 } 00657 00658 extern initialize_file_ftype _initialize_go_language; 00659 00660 void 00661 _initialize_go_language (void) 00662 { 00663 go_type_data = gdbarch_data_register_post_init (build_go_types); 00664 00665 add_language (&go_language_defn); 00666 }