aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorTom Tromey <tromey@redhat.com>2010-10-01 20:26:11 +0000
committerTom Tromey <tromey@redhat.com>2010-10-01 20:26:11 +0000
commit72b9f47f1ebefa7618abb0c142811af5b5b823e4 (patch)
treea08f5ac64dba94ee992f0b007c2e1581de7ec237
parent55e3947383a45ec03e48390775fbf2699e640ec5 (diff)
downloadgdb-72b9f47f1ebefa7618abb0c142811af5b5b823e4.zip
gdb-72b9f47f1ebefa7618abb0c142811af5b5b823e4.tar.gz
gdb-72b9f47f1ebefa7618abb0c142811af5b5b823e4.tar.bz2
* symfile.h (allocate_symtab): Update.
* symfile.c (allocate_symtab): Make 'filename' const. * psymtab.c (add_psymbol_to_bcache): Make 'name' const. (add_psymbol_to_list): Likewise. * psympriv.h (struct partial_symtab) <filename, dirname>: Now const. (add_psymbol_to_list): Update. * mdebugread.c (new_symtab): Make 'name' const. (psymtab_to_symtab_1): Make 'filename' const. * elfread.c (elfstab_offset_sections): Update. * dwarf2read.c (dwarf_decode_lines): Make 'comp_dir' const. (dwarf2_start_subfile): Make 'dirname' and 'comp_dir' const. (psymtab_include_file_name): Update. * dbxread.c (find_stab_function_addr): Make 'filename' const. * buildsym.h (start_subfile): Update. * buildsym.c (start_subfile): Make arguments const.
-rw-r--r--gdb/ChangeLog19
-rw-r--r--gdb/buildsym.c2
-rw-r--r--gdb/buildsym.h2
-rw-r--r--gdb/dbxread.c2
-rw-r--r--gdb/dwarf2read.c20
-rw-r--r--gdb/elfread.c2
-rw-r--r--gdb/mdebugread.c8
-rw-r--r--gdb/psympriv.h6
-rw-r--r--gdb/psymtab.c4
-rw-r--r--gdb/symfile.c2
-rw-r--r--gdb/symfile.h2
11 files changed, 45 insertions, 24 deletions
diff --git a/gdb/ChangeLog b/gdb/ChangeLog
index 081b642..1ef516d 100644
--- a/gdb/ChangeLog
+++ b/gdb/ChangeLog
@@ -1,3 +1,22 @@
+2010-10-01 Tom Tromey <tromey@redhat.com>
+
+ * symfile.h (allocate_symtab): Update.
+ * symfile.c (allocate_symtab): Make 'filename' const.
+ * psymtab.c (add_psymbol_to_bcache): Make 'name' const.
+ (add_psymbol_to_list): Likewise.
+ * psympriv.h (struct partial_symtab) <filename, dirname>: Now
+ const.
+ (add_psymbol_to_list): Update.
+ * mdebugread.c (new_symtab): Make 'name' const.
+ (psymtab_to_symtab_1): Make 'filename' const.
+ * elfread.c (elfstab_offset_sections): Update.
+ * dwarf2read.c (dwarf_decode_lines): Make 'comp_dir' const.
+ (dwarf2_start_subfile): Make 'dirname' and 'comp_dir' const.
+ (psymtab_include_file_name): Update.
+ * dbxread.c (find_stab_function_addr): Make 'filename' const.
+ * buildsym.h (start_subfile): Update.
+ * buildsym.c (start_subfile): Make arguments const.
+
2010-09-30 Ali Lakhia <lakhia@alumni.utexas.net>
* fork-child.c (breakup_args): Fix crash if shell forking is
diff --git a/gdb/buildsym.c b/gdb/buildsym.c
index e690a0c..4a76e3e 100644
--- a/gdb/buildsym.c
+++ b/gdb/buildsym.c
@@ -523,7 +523,7 @@ make_blockvector (struct objfile *objfile)
the directory in which the file was compiled (or NULL if not known). */
void
-start_subfile (char *name, char *dirname)
+start_subfile (const char *name, const char *dirname)
{
struct subfile *subfile;
diff --git a/gdb/buildsym.h b/gdb/buildsym.h
index f559b4b..99897fd 100644
--- a/gdb/buildsym.h
+++ b/gdb/buildsym.h
@@ -253,7 +253,7 @@ extern void record_block_range (struct block *,
extern void really_free_pendings (void *dummy);
-extern void start_subfile (char *name, char *dirname);
+extern void start_subfile (const char *name, const char *dirname);
extern void patch_subfile_names (struct subfile *subfile, char *name);
diff --git a/gdb/dbxread.c b/gdb/dbxread.c
index 05e9f2e..af94659 100644
--- a/gdb/dbxread.c
+++ b/gdb/dbxread.c
@@ -1125,7 +1125,7 @@ read_dbx_dynamic_symtab (struct objfile *objfile)
}
static CORE_ADDR
-find_stab_function_addr (char *namestring, char *filename,
+find_stab_function_addr (char *namestring, const char *filename,
struct objfile *objfile)
{
struct minimal_symbol *msym;
diff --git a/gdb/dwarf2read.c b/gdb/dwarf2read.c
index 743ba89..774f981 100644
--- a/gdb/dwarf2read.c
+++ b/gdb/dwarf2read.c
@@ -1007,10 +1007,10 @@ static struct line_header *(dwarf_decode_line_header
(unsigned int offset,
bfd *abfd, struct dwarf2_cu *cu));
-static void dwarf_decode_lines (struct line_header *, char *, bfd *,
+static void dwarf_decode_lines (struct line_header *, const char *, bfd *,
struct dwarf2_cu *, struct partial_symtab *);
-static void dwarf2_start_subfile (char *, char *, char *);
+static void dwarf2_start_subfile (char *, const char *, const char *);
static struct symbol *new_symbol (struct die_info *, struct type *,
struct dwarf2_cu *);
@@ -9994,7 +9994,8 @@ psymtab_include_file_name (const struct line_header *lh, int file_index,
char *include_name = fe.name;
char *include_name_to_compare = include_name;
char *dir_name = NULL;
- char *pst_filename;
+ const char *pst_filename;
+ char *copied_name = NULL;
int file_is_pst;
if (fe.dir_index)
@@ -10039,16 +10040,17 @@ psymtab_include_file_name (const struct line_header *lh, int file_index,
pst_filename = pst->filename;
if (!IS_ABSOLUTE_PATH (pst_filename) && pst->dirname != NULL)
{
- pst_filename = concat (pst->dirname, SLASH_STRING,
- pst_filename, (char *)NULL);
+ copied_name = concat (pst->dirname, SLASH_STRING,
+ pst_filename, (char *)NULL);
+ pst_filename = copied_name;
}
file_is_pst = strcmp (include_name_to_compare, pst_filename) == 0;
if (include_name_to_compare != include_name)
xfree (include_name_to_compare);
- if (pst_filename != pst->filename)
- xfree (pst_filename);
+ if (copied_name != NULL)
+ xfree (copied_name);
if (file_is_pst)
return NULL;
@@ -10078,7 +10080,7 @@ psymtab_include_file_name (const struct line_header *lh, int file_index,
A good testcase for this is mb-inline.exp. */
static void
-dwarf_decode_lines (struct line_header *lh, char *comp_dir, bfd *abfd,
+dwarf_decode_lines (struct line_header *lh, const char *comp_dir, bfd *abfd,
struct dwarf2_cu *cu, struct partial_symtab *pst)
{
gdb_byte *line_ptr, *extended_end;
@@ -10421,7 +10423,7 @@ dwarf_decode_lines (struct line_header *lh, char *comp_dir, bfd *abfd,
subfile's name. */
static void
-dwarf2_start_subfile (char *filename, char *dirname, char *comp_dir)
+dwarf2_start_subfile (char *filename, const char *dirname, const char *comp_dir)
{
char *fullname;
diff --git a/gdb/elfread.c b/gdb/elfread.c
index 4745f8e..270f93f 100644
--- a/gdb/elfread.c
+++ b/gdb/elfread.c
@@ -979,7 +979,7 @@ elf_symfile_init (struct objfile *objfile)
void
elfstab_offset_sections (struct objfile *objfile, struct partial_symtab *pst)
{
- char *filename = pst->filename;
+ const char *filename = pst->filename;
struct dbx_symfile_info *dbx = objfile->deprecated_sym_stab_info;
struct stab_section_info *maybe = dbx->stab_section_info;
struct stab_section_info *questionable = 0;
diff --git a/gdb/mdebugread.c b/gdb/mdebugread.c
index 0467816..5ce5db2 100644
--- a/gdb/mdebugread.c
+++ b/gdb/mdebugread.c
@@ -232,7 +232,7 @@ enum block_type { FUNCTION_BLOCK, NON_FUNCTION_BLOCK };
static struct block *new_block (enum block_type);
-static struct symtab *new_symtab (char *, int, struct objfile *);
+static struct symtab *new_symtab (const char *, int, struct objfile *);
static struct linetable *new_linetable (int);
@@ -248,7 +248,7 @@ static void sort_blocks (struct symtab *);
static struct partial_symtab *new_psymtab (char *, struct objfile *);
-static void psymtab_to_symtab_1 (struct partial_symtab *, char *);
+static void psymtab_to_symtab_1 (struct partial_symtab *, const char *);
static void add_block (struct block *, struct symtab *);
@@ -3888,7 +3888,7 @@ mdebug_next_symbol_text (struct objfile *objfile)
The flow of control and even the memory allocation differs. FIXME. */
static void
-psymtab_to_symtab_1 (struct partial_symtab *pst, char *filename)
+psymtab_to_symtab_1 (struct partial_symtab *pst, const char *filename)
{
bfd_size_type external_sym_size;
bfd_size_type external_pdr_size;
@@ -4671,7 +4671,7 @@ sort_blocks (struct symtab *s)
linenumbers MAXLINES we'll put in it */
static struct symtab *
-new_symtab (char *name, int maxlines, struct objfile *objfile)
+new_symtab (const char *name, int maxlines, struct objfile *objfile)
{
struct symtab *s = allocate_symtab (name, objfile);
diff --git a/gdb/psympriv.h b/gdb/psympriv.h
index e0ea839..b5205fd2 100644
--- a/gdb/psympriv.h
+++ b/gdb/psympriv.h
@@ -73,7 +73,7 @@ struct partial_symtab
/* Name of the source file which this partial_symtab defines */
- char *filename;
+ const char *filename;
/* Full path of the source file. NULL if not known. */
@@ -81,7 +81,7 @@ struct partial_symtab
/* Directory in which it was compiled, or NULL if we don't know. */
- char *dirname;
+ const char *dirname;
/* Information about the object file from which symbols should be read. */
@@ -156,7 +156,7 @@ extern void sort_pst_symbols (struct partial_symtab *);
/* Add any kind of symbol to a psymbol_allocation_list. */
extern const
-struct partial_symbol *add_psymbol_to_list (char *, int, int, domain_enum,
+struct partial_symbol *add_psymbol_to_list (const char *, int, int, domain_enum,
enum address_class,
struct psymbol_allocation_list *,
long, CORE_ADDR,
diff --git a/gdb/psymtab.c b/gdb/psymtab.c
index aa6dc17..4aec16e 100644
--- a/gdb/psymtab.c
+++ b/gdb/psymtab.c
@@ -1368,7 +1368,7 @@ psymbol_bcache_full (struct partial_symbol *sym,
different domain (or address) is possible and correct. */
static const struct partial_symbol *
-add_psymbol_to_bcache (char *name, int namelength, int copy_name,
+add_psymbol_to_bcache (const char *name, int namelength, int copy_name,
domain_enum domain,
enum address_class class,
long val, /* Value as a long */
@@ -1465,7 +1465,7 @@ append_psymbol_to_list (struct psymbol_allocation_list *list,
cache. */
const struct partial_symbol *
-add_psymbol_to_list (char *name, int namelength, int copy_name,
+add_psymbol_to_list (const char *name, int namelength, int copy_name,
domain_enum domain,
enum address_class class,
struct psymbol_allocation_list *list,
diff --git a/gdb/symfile.c b/gdb/symfile.c
index dbd1412..91f0765 100644
--- a/gdb/symfile.c
+++ b/gdb/symfile.c
@@ -2724,7 +2724,7 @@ deduce_language_from_filename (const char *filename)
*/
struct symtab *
-allocate_symtab (char *filename, struct objfile *objfile)
+allocate_symtab (const char *filename, struct objfile *objfile)
{
struct symtab *symtab;
diff --git a/gdb/symfile.h b/gdb/symfile.h
index afa92cd..ae0421d 100644
--- a/gdb/symfile.h
+++ b/gdb/symfile.h
@@ -374,7 +374,7 @@ extern struct symfile_segment_data *default_symfile_segments (bfd *abfd);
extern bfd_byte *default_symfile_relocate (struct objfile *objfile,
asection *sectp, bfd_byte *buf);
-extern struct symtab *allocate_symtab (char *, struct objfile *);
+extern struct symtab *allocate_symtab (const char *, struct objfile *);
extern void add_symtab_fns (const struct sym_fns *);