diff options
author | Tom Tromey <tromey@redhat.com> | 2011-04-04 14:29:27 +0000 |
---|---|---|
committer | Tom Tromey <tromey@redhat.com> | 2011-04-04 14:29:27 +0000 |
commit | 554d387d4cf36d63f004a5a10bee8d180a7af4e0 (patch) | |
tree | 5196960decc5f2be1f5c41a24836512e88641c0f | |
parent | d4d4db8a722f18a2abfa771a77689c5c1efae002 (diff) | |
download | gdb-554d387d4cf36d63f004a5a10bee8d180a7af4e0.zip gdb-554d387d4cf36d63f004a5a10bee8d180a7af4e0.tar.gz gdb-554d387d4cf36d63f004a5a10bee8d180a7af4e0.tar.bz2 |
* xcoffread.c (read_xcoff_symtab): Make `debugfmt' const.
* symtab.h (struct symtab) <producer, debugformat>: Now const.
* symmisc.c (free_symtab): Don't free debugformat.
* buildsym.h (struct subfile) <producer, debugformat>: Now const.
(record_debugformat, record_producer): Document.
* buildsym.c (end_symtab): Don't save debugformat and producer
names on obstack.
(end_symtab): Don't free debugformat and producer fields.
(record_debugformat): Don't call xstrdup.
(record_producer): Likewise.
-rw-r--r-- | gdb/ChangeLog | 13 | ||||
-rw-r--r-- | gdb/buildsym.c | 31 | ||||
-rw-r--r-- | gdb/buildsym.h | 14 | ||||
-rw-r--r-- | gdb/symmisc.c | 2 | ||||
-rw-r--r-- | gdb/symtab.h | 4 | ||||
-rw-r--r-- | gdb/xcoffread.c | 2 |
6 files changed, 30 insertions, 36 deletions
diff --git a/gdb/ChangeLog b/gdb/ChangeLog index ea5afef..2f41d96 100644 --- a/gdb/ChangeLog +++ b/gdb/ChangeLog @@ -1,5 +1,18 @@ 2011-04-04 Tom Tromey <tromey@redhat.com> + * xcoffread.c (read_xcoff_symtab): Make `debugfmt' const. + * symtab.h (struct symtab) <producer, debugformat>: Now const. + * symmisc.c (free_symtab): Don't free debugformat. + * buildsym.h (struct subfile) <producer, debugformat>: Now const. + (record_debugformat, record_producer): Document. + * buildsym.c (end_symtab): Don't save debugformat and producer + names on obstack. + (end_symtab): Don't free debugformat and producer fields. + (record_debugformat): Don't call xstrdup. + (record_producer): Likewise. + +2011-04-04 Tom Tromey <tromey@redhat.com> + * source.c (find_source_lines): Remove LSEEK_NOT_LINEAR code. (source_line_charpos, source_charpos_line): Remove. diff --git a/gdb/buildsym.c b/gdb/buildsym.c index cd159a7..3c90645 100644 --- a/gdb/buildsym.c +++ b/gdb/buildsym.c @@ -1111,20 +1111,6 @@ end_symtab (CORE_ADDR end_addr, struct objfile *objfile, int section) the symbols. */ symtab->language = subfile->language; - /* Save the debug format string (if any) in the symtab. */ - if (subfile->debugformat != NULL) - { - symtab->debugformat = obsavestring (subfile->debugformat, - strlen (subfile->debugformat), - &objfile->objfile_obstack); - } - - /* Similarly for the producer. */ - if (subfile->producer != NULL) - symtab->producer = obsavestring (subfile->producer, - strlen (subfile->producer), - &objfile->objfile_obstack); - /* All symtabs for the main file and the subfiles share a blockvector, so we need to clear primary for everything but the main file. */ @@ -1169,12 +1155,6 @@ end_symtab (CORE_ADDR end_addr, struct objfile *objfile, int section) { xfree ((void *) subfile->line_vector); } - if (subfile->debugformat != NULL) - { - xfree ((void *) subfile->debugformat); - } - if (subfile->producer != NULL) - xfree (subfile->producer); nextsub = subfile->next; xfree ((void *) subfile); @@ -1279,20 +1259,15 @@ hashname (char *name) void -record_debugformat (char *format) +record_debugformat (const char *format) { - current_subfile->debugformat = xstrdup (format); + current_subfile->debugformat = format; } void record_producer (const char *producer) { - /* The producer is not always provided in the debugging info. - Do nothing if PRODUCER is NULL. */ - if (producer == NULL) - return; - - current_subfile->producer = xstrdup (producer); + current_subfile->producer = producer; } /* Merge the first symbol list SRCLIST into the second symbol list diff --git a/gdb/buildsym.h b/gdb/buildsym.h index 37fe69c..ce1a9fc 100644 --- a/gdb/buildsym.h +++ b/gdb/buildsym.h @@ -70,8 +70,8 @@ struct subfile struct linetable *line_vector; int line_vector_length; enum language language; - char *producer; - char *debugformat; + const char *producer; + const char *debugformat; struct symtab *symtab; }; @@ -292,7 +292,15 @@ extern void record_pending_block (struct objfile *objfile, struct block *block, struct pending_block *opblock); -extern void record_debugformat (char *format); +/* Record the name of the debug format in the current pending symbol + table. FORMAT must be a string with a lifetime at least as long as + the symtab's objfile. */ + +extern void record_debugformat (const char *format); + +/* Record the name of the debuginfo producer (usually the compiler) in + the current pending symbol table. PRODUCER must be a string with a + lifetime at least as long as the symtab's objfile. */ extern void record_producer (const char *producer); diff --git a/gdb/symmisc.c b/gdb/symmisc.c index 66c2f05..79ff355 100644 --- a/gdb/symmisc.c +++ b/gdb/symmisc.c @@ -115,8 +115,6 @@ free_symtab (struct symtab *s) xfree (s->line_charpos); if (s->fullname != NULL) xfree (s->fullname); - if (s->debugformat != NULL) - xfree (s->debugformat); xfree (s); } diff --git a/gdb/symtab.h b/gdb/symtab.h index a1c61f0..1e3856e 100644 --- a/gdb/symtab.h +++ b/gdb/symtab.h @@ -817,11 +817,11 @@ struct symtab for automated testing of gdb but may also be information that is useful to the user. */ - char *debugformat; + const char *debugformat; /* String of producer version information. May be zero. */ - char *producer; + const char *producer; /* Full name of file as found by searching the source path. NULL if not yet known. */ diff --git a/gdb/xcoffread.c b/gdb/xcoffread.c index 081080c..fd60447 100644 --- a/gdb/xcoffread.c +++ b/gdb/xcoffread.c @@ -944,7 +944,7 @@ read_xcoff_symtab (struct partial_symtab *pst) ((struct coff_symfile_info *) objfile->deprecated_sym_private)->strtbl; char *debugsec = ((struct coff_symfile_info *) objfile->deprecated_sym_private)->debugsec; - char *debugfmt = bfd_xcoff_is_xcoff64 (abfd) ? "XCOFF64" : "XCOFF"; + const char *debugfmt = bfd_xcoff_is_xcoff64 (abfd) ? "XCOFF64" : "XCOFF"; struct internal_syment symbol[1]; union internal_auxent main_aux; |