From: Tom Tromey Date: Tue, 13 Jul 2010 20:52:52 +0000 (+0000) Subject: * symfile.c (set_initial_language): Update. X-Git-Url: https://git.libre-soc.org/?a=commitdiff_plain;h=dd78685836dcecb25b85b2166b2b5c04b54cdd14;p=binutils-gdb.git * symfile.c (set_initial_language): Update. (deduce_language_from_filename): Argument type now const. * symtab.h (find_main_filename): Update. (deduce_language_from_filename): Update. * symtab.c (find_main_filename): Make result const. * dwarf2read.c (dw2_find_symbol_file): Change return type. * psymtab.c (find_symbol_file_from_partial): Change return type. * symfile.h (struct quick_symbol_functions) : Make result const. --- diff --git a/gdb/ChangeLog b/gdb/ChangeLog index feb33a0a980..43de1d98ada 100644 --- a/gdb/ChangeLog +++ b/gdb/ChangeLog @@ -1,3 +1,15 @@ +2010-07-13 Tom Tromey + + * symfile.c (set_initial_language): Update. + (deduce_language_from_filename): Argument type now const. + * symtab.h (find_main_filename): Update. + (deduce_language_from_filename): Update. + * symtab.c (find_main_filename): Make result const. + * dwarf2read.c (dw2_find_symbol_file): Change return type. + * psymtab.c (find_symbol_file_from_partial): Change return type. + * symfile.h (struct quick_symbol_functions) : + Make result const. + 2010-07-13 Tom Tromey * breakpoint.c (save_cmdlist): No longer static. diff --git a/gdb/dwarf2read.c b/gdb/dwarf2read.c index f390ef54788..0a8190dfd04 100644 --- a/gdb/dwarf2read.c +++ b/gdb/dwarf2read.c @@ -2150,7 +2150,7 @@ dw2_expand_symtabs_with_filename (struct objfile *objfile, } } -static char * +static const char * dw2_find_symbol_file (struct objfile *objfile, const char *name) { struct dwarf2_per_cu_data *cu; @@ -2176,8 +2176,7 @@ dw2_find_symbol_file (struct objfile *objfile, const char *name) if (!cu->v.quick->lines) return NULL; - return (char *) cu->v.quick->file_names[cu->v.quick->lines->num_file_names - - 1]; + return cu->v.quick->file_names[cu->v.quick->lines->num_file_names - 1]; } static void diff --git a/gdb/psymtab.c b/gdb/psymtab.c index ca06130215d..c12089494bc 100644 --- a/gdb/psymtab.c +++ b/gdb/psymtab.c @@ -949,7 +949,7 @@ psymtab_to_fullname (struct partial_symtab *ps) return NULL; } -static char * +static const char * find_symbol_file_from_partial (struct objfile *objfile, const char *name) { struct partial_symtab *pst; diff --git a/gdb/symfile.c b/gdb/symfile.c index af1b42c587c..babe9cf578f 100644 --- a/gdb/symfile.c +++ b/gdb/symfile.c @@ -1538,7 +1538,7 @@ symbol_file_command (char *args, int from_tty) void set_initial_language (void) { - char *filename; + const char *filename; enum language lang = language_unknown; filename = find_main_filename (); @@ -2665,7 +2665,7 @@ init_filename_language_table (void) } enum language -deduce_language_from_filename (char *filename) +deduce_language_from_filename (const char *filename) { int i; char *cp; diff --git a/gdb/symfile.h b/gdb/symfile.h index d0fbb656f1d..58153542db0 100644 --- a/gdb/symfile.h +++ b/gdb/symfile.h @@ -210,7 +210,7 @@ struct quick_symbol_functions /* Return the file name of the file holding the symbol in OBJFILE named NAME. If no such symbol exists in OBJFILE, return NULL. */ - char *(*find_symbol_file) (struct objfile *objfile, const char *name); + const char *(*find_symbol_file) (struct objfile *objfile, const char *name); /* This method is specific to Ada. It walks the partial symbol tables of OBJFILE looking for a name match. WILD_MATCH and diff --git a/gdb/symtab.c b/gdb/symtab.c index 4e48e4804e6..07910dbe349 100644 --- a/gdb/symtab.c +++ b/gdb/symtab.c @@ -1617,14 +1617,16 @@ basic_lookup_transparent_type (const char *name) /* FIXME: What about languages without main() or specially linked executables that have no main() ? */ -char * +const char * find_main_filename (void) { struct objfile *objfile; - char *result, *name = main_name (); + char *name = main_name (); ALL_OBJFILES (objfile) { + const char *result; + if (!objfile->sf) continue; result = objfile->sf->qf->find_symbol_file (objfile, name); diff --git a/gdb/symtab.h b/gdb/symtab.h index 5f676bf3163..62e9ce45ebd 100644 --- a/gdb/symtab.h +++ b/gdb/symtab.h @@ -1136,7 +1136,7 @@ extern char **make_source_files_completion_list (char *, char *); int matching_obj_sections (struct obj_section *, struct obj_section *); -extern char *find_main_filename (void); +extern const char *find_main_filename (void); extern struct symtab *find_line_symtab (struct symtab *, int, int *, int *); @@ -1149,7 +1149,7 @@ extern void skip_prologue_sal (struct symtab_and_line *); extern void clear_symtab_users (void); -extern enum language deduce_language_from_filename (char *); +extern enum language deduce_language_from_filename (const char *); /* symtab.c */