aboutsummaryrefslogtreecommitdiff
path: root/gdb/go-lang.c
diff options
context:
space:
mode:
Diffstat (limited to 'gdb/go-lang.c')
-rw-r--r--gdb/go-lang.c58
1 files changed, 22 insertions, 36 deletions
diff --git a/gdb/go-lang.c b/gdb/go-lang.c
index 7549f14..3943563 100644
--- a/gdb/go-lang.c
+++ b/gdb/go-lang.c
@@ -106,8 +106,7 @@ gccgo_string_p (struct type *type)
static int
sixg_string_p (struct type *type)
{
- if (type->num_fields () == 2
- && type->name () != NULL
+ if (type->num_fields () == 2 && type->name () != NULL
&& strcmp (type->name (), "string") == 0)
return 1;
@@ -124,8 +123,7 @@ go_classify_struct_type (struct type *type)
/* Recognize strings as they're useful to be able to print without
pretty-printers. */
- if (gccgo_string_p (type)
- || sixg_string_p (type))
+ if (gccgo_string_p (type) || sixg_string_p (type))
return GO_TYPE_STRING;
return GO_TYPE_NONE;
@@ -137,8 +135,8 @@ go_classify_struct_type (struct type *type)
The caller is responsible for memory management. */
static void
-unpack_package_and_object (char *buf,
- const char **packagep, const char **objectp)
+unpack_package_and_object (char *buf, const char **packagep,
+ const char **objectp)
{
char *last_dot;
@@ -181,8 +179,7 @@ unpack_package_and_object (char *buf,
for that too. */
static char *
-unpack_mangled_go_symbol (const char *mangled_name,
- const char **packagep,
+unpack_mangled_go_symbol (const char *mangled_name, const char **packagep,
const char **objectp,
const char **method_type_packagep,
const char **method_type_objectp,
@@ -255,7 +252,7 @@ unpack_mangled_go_symbol (const char *mangled_name,
return NULL;
/* More quick checks. */
- if (last_dot[1] == '\0' /* foo. */
+ if (last_dot[1] == '\0' /* foo. */
|| last_dot[-1] == '.') /* foo..bar */
return NULL;
@@ -310,8 +307,8 @@ unpack_mangled_go_symbol (const char *mangled_name,
/* Ensure not something like "..foo". */
&& (method_type > buf && method_type[-1] != '.'))
{
- unpack_package_and_object (saw_digit + 2,
- method_type_packagep, method_type_objectp);
+ unpack_package_and_object (saw_digit + 2, method_type_packagep,
+ method_type_objectp);
*method_type = '\0';
*method_type_is_pointerp = saw_pointer;
}
@@ -345,12 +342,9 @@ go_language::demangle_symbol (const char *mangled_name, int options) const
if (mangled_name == NULL)
return NULL;
- gdb::unique_xmalloc_ptr<char> name_buf
- (unpack_mangled_go_symbol (mangled_name,
- &package_name, &object_name,
- &method_type_package_name,
- &method_type_object_name,
- &method_type_is_pointer));
+ gdb::unique_xmalloc_ptr<char> name_buf (unpack_mangled_go_symbol (
+ mangled_name, &package_name, &object_name, &method_type_package_name,
+ &method_type_object_name, &method_type_is_pointer));
if (name_buf == NULL)
return NULL;
@@ -361,7 +355,7 @@ go_language::demangle_symbol (const char *mangled_name, int options) const
{
/* FIXME: Seems like we should include package_name here somewhere. */
if (method_type_is_pointer)
- obstack_grow_str (&tempbuf, "(*");
+ obstack_grow_str (&tempbuf, "(*");
obstack_grow_str (&tempbuf, method_type_package_name);
obstack_grow_str (&tempbuf, ".");
obstack_grow_str (&tempbuf, method_type_object_name);
@@ -397,9 +391,8 @@ go_symbol_package_name (const struct symbol *sym)
char *result;
gdb_assert (sym->language () == language_go);
- name_buf = unpack_mangled_go_symbol (mangled_name,
- &package_name, &object_name,
- &method_type_package_name,
+ name_buf = unpack_mangled_go_symbol (mangled_name, &package_name,
+ &object_name, &method_type_package_name,
&method_type_object_name,
&method_type_is_pointer);
/* Some Go symbols don't have mangled form we interpret (yet). */
@@ -448,7 +441,7 @@ go_language::language_arch_info (struct gdbarch *gdbarch,
const struct builtin_go_type *builtin = builtin_go_type (gdbarch);
/* Helper function to allow shorter lines below. */
- auto add = [&] (struct type * t) -> struct type *
+ auto add = [&](struct type * t) -> struct type *
{
lai->add_primitive_type (t);
return t;
@@ -488,26 +481,19 @@ build_go_types (struct gdbarch *gdbarch)
builtin_go_type->builtin_void
= arch_type (gdbarch, TYPE_CODE_VOID, TARGET_CHAR_BIT, "void");
- builtin_go_type->builtin_char
- = arch_character_type (gdbarch, 8, 1, "char");
- builtin_go_type->builtin_bool
- = arch_boolean_type (gdbarch, 8, 0, "bool");
+ builtin_go_type->builtin_char = arch_character_type (gdbarch, 8, 1, "char");
+ builtin_go_type->builtin_bool = arch_boolean_type (gdbarch, 8, 0, "bool");
builtin_go_type->builtin_int
= arch_integer_type (gdbarch, gdbarch_int_bit (gdbarch), 0, "int");
builtin_go_type->builtin_uint
= arch_integer_type (gdbarch, gdbarch_int_bit (gdbarch), 1, "uint");
builtin_go_type->builtin_uintptr
= arch_integer_type (gdbarch, gdbarch_ptr_bit (gdbarch), 1, "uintptr");
- builtin_go_type->builtin_int8
- = arch_integer_type (gdbarch, 8, 0, "int8");
- builtin_go_type->builtin_int16
- = arch_integer_type (gdbarch, 16, 0, "int16");
- builtin_go_type->builtin_int32
- = arch_integer_type (gdbarch, 32, 0, "int32");
- builtin_go_type->builtin_int64
- = arch_integer_type (gdbarch, 64, 0, "int64");
- builtin_go_type->builtin_uint8
- = arch_integer_type (gdbarch, 8, 1, "uint8");
+ builtin_go_type->builtin_int8 = arch_integer_type (gdbarch, 8, 0, "int8");
+ builtin_go_type->builtin_int16 = arch_integer_type (gdbarch, 16, 0, "int16");
+ builtin_go_type->builtin_int32 = arch_integer_type (gdbarch, 32, 0, "int32");
+ builtin_go_type->builtin_int64 = arch_integer_type (gdbarch, 64, 0, "int64");
+ builtin_go_type->builtin_uint8 = arch_integer_type (gdbarch, 8, 1, "uint8");
builtin_go_type->builtin_uint16
= arch_integer_type (gdbarch, 16, 1, "uint16");
builtin_go_type->builtin_uint32