aboutsummaryrefslogtreecommitdiff
path: root/gdb/dwarf2read.c
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 /gdb/dwarf2read.c
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.
Diffstat (limited to 'gdb/dwarf2read.c')
-rw-r--r--gdb/dwarf2read.c20
1 files changed, 11 insertions, 9 deletions
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;