diff options
Diffstat (limited to 'gdb')
-rw-r--r-- | gdb/ChangeLog | 6 | ||||
-rw-r--r-- | gdb/dwarf2read.c | 8 | ||||
-rw-r--r-- | gdb/gdbtypes.c | 11 |
3 files changed, 16 insertions, 9 deletions
diff --git a/gdb/ChangeLog b/gdb/ChangeLog index 941902b..b5fd8ee 100644 --- a/gdb/ChangeLog +++ b/gdb/ChangeLog @@ -1,5 +1,11 @@ 2013-01-21 Tom Tromey <tromey@redhat.com> + * dwarf2read.c (fixup_go_packaging): Save package name + on objfile obstack. + * gdbtypes.c (init_type): Don't copy name. + +2013-01-21 Tom Tromey <tromey@redhat.com> + * dwarf2read.c (struct partial_die_info) <name, scope>: Now const. (struct attribute) <u.str>: Now const. diff --git a/gdb/dwarf2read.c b/gdb/dwarf2read.c index 81d3cf9..76d469c 100644 --- a/gdb/dwarf2read.c +++ b/gdb/dwarf2read.c @@ -6803,15 +6803,19 @@ fixup_go_packaging (struct dwarf2_cu *cu) if (package_name != NULL) { struct objfile *objfile = cu->objfile; + const char *saved_package_name = obsavestring (package_name, + strlen (package_name), + &objfile->objfile_obstack); struct type *type = init_type (TYPE_CODE_MODULE, 0, 0, - package_name, objfile); + saved_package_name, objfile); struct symbol *sym; TYPE_TAG_NAME (type) = TYPE_NAME (type); sym = OBSTACK_ZALLOC (&objfile->objfile_obstack, struct symbol); SYMBOL_SET_LANGUAGE (sym, language_go); - SYMBOL_SET_NAMES (sym, package_name, strlen (package_name), 1, objfile); + SYMBOL_SET_NAMES (sym, saved_package_name, + strlen (saved_package_name), 0, objfile); /* This is not VAR_DOMAIN because we want a way to ensure a lookup of, e.g., "main" finds the "main" module and not C's main(). */ SYMBOL_DOMAIN (sym) = STRUCT_DOMAIN; diff --git a/gdb/gdbtypes.c b/gdb/gdbtypes.c index 6a4b152..12730d7 100644 --- a/gdb/gdbtypes.c +++ b/gdb/gdbtypes.c @@ -1950,10 +1950,9 @@ allocate_gnat_aux_type (struct type *type) /* Helper function to initialize the standard scalar types. - If NAME is non-NULL, then we make a copy of the string pointed - to by name in the objfile_obstack for that objfile, and initialize - the type name to that copy. There are places (mipsread.c in particular), - where init_type is called with a NULL value for NAME). */ + If NAME is non-NULL, then it is used to initialize the type name. + Note that NAME is not copied; it is required to have a lifetime at + least as long as OBJFILE. */ struct type * init_type (enum type_code code, int length, int flags, @@ -1991,9 +1990,7 @@ init_type (enum type_code code, int length, int flags, if (flags & TYPE_FLAG_GNU_IFUNC) TYPE_GNU_IFUNC (type) = 1; - if (name) - TYPE_NAME (type) = obsavestring (name, strlen (name), - &objfile->objfile_obstack); + TYPE_NAME (type) = name; /* C++ fancies. */ |