This is the mail archive of the gdb-patches@sourceware.org mailing list for the GDB project.
Index Nav: | [Date Index] [Subject Index] [Author Index] [Thread Index] | |
---|---|---|
Message Nav: | [Date Prev] [Date Next] | [Thread Prev] [Thread Next] |
Other format: | [Raw text] |
2011/3/23 Pedro Alves <pedro@codesourcery.com>: > On Wednesday 23 March 2011 10:39:33, Kai Tietz wrote: >> --- gdb.orig/source.c ? 2011-03-23 10:30:42.614811600 +0100 >> +++ gdb/source.c ? ? ? ?2011-03-23 10:56:17.194745900 +0100 >> @@ -569,15 +569,10 @@ add_path (char *dirname, char **which_pa >> ? ? ? ? p = *which_path; >> ? ? ? ? while (1) >> ? ? ? ? ? { >> - ? ? ? ? ? /* FIXME: strncmp loses in interesting ways on MS-DOS and >> - ? ? ? ? ? ? ?MS-Windows because of case-insensitivity and two different >> - ? ? ? ? ? ? ?but functionally identical slash characters. ?We need a >> - ? ? ? ? ? ? ?special filesystem-dependent file-name comparison function. >> - >> - ? ? ? ? ? ? ?Actually, even on Unix I would use realpath() or its work- >> + ? ? ? ? ? /* Actually, even on Unix I would use realpath() or its work- >> ? ? ? ? ? ? ? ?alike before comparing. ?Then all the code above which >> ? ? ? ? ? ? ? ?removes excess slashes and dots could simply go away. ?*/ >> - ? ? ? ? ? if (!strncmp (p, name, len) >> + ? ? ? ? ? if (!filename_ncmp (p, name, len) >> ? ? ? ? ? ? ? ? && (p[len] == '\0' || p[len] == DIRNAME_SEPARATOR)) > > Without the previous paragraph, the comment left now doesn't make > sense on its own as is. ?The "Actually, even on Unix" appears out of > the blue. Ok, adjusted comment so that it doesn't seems to be falling out of heaven. >> --- gdb.orig/xml-support.c ? ? ?2011-03-23 10:30:42.620811600 +0100 >> +++ gdb/xml-support.c ? 2011-03-23 10:56:17.265754900 +0100 >> @@ -25,6 +25,7 @@ >> >> ?#include "gdb_string.h" >> ?#include "safe-ctype.h" >> +#include "filenames.h" >> >> ?/* Debugging flag. ?*/ >> ?static int debug_xml; >> @@ -946,7 +947,7 @@ fetch_xml_builtin (const char *filename) >> ? ?const char *(*p)[2]; >> >> ? ?for (p = xml_builtin; (*p)[0]; p++) >> - ? ?if (strcmp ((*p)[0], filename) == 0) >> + ? ?if (filename_cmp ((*p)[0], filename) == 0) >> ? ? ? ?return (*p)[1]; >> >> ? ?return NULL; > > I don't think this one makes sense to behave different depending > on host. ?These are files that are built into the GDB binary, with > filenames hardcoded, and always basenamed. ?No need to do case > insensitive, or path separator style sensitive match. Well, as the names are hard-coded it seems to be superflous to do here case-insensitive compare. I removed this part from patch. >> --- gdb.orig/dwarf2read.c ? ? ? 2011-03-23 10:32:00.336248300 +0100 >> +++ gdb/dwarf2read.c ? ?2011-03-23 10:56:17.285257400 +0100 >> @@ -5211,7 +5211,8 @@ find_file_and_directory (struct die_info >> ? ? ? ? ?directory, get rid of it. ?*/ >> ? ? ? ?char *cp = strchr (*comp_dir, ':'); >> >> - ? ? ?if (cp && cp != *comp_dir && cp[-1] == '.' && cp[1] == '/') >> + ? ? ?if (cp && cp != *comp_dir && cp[-1] == '.' >> + ? ? ? ? && IS_ABSOLUTE_PATH (&cp[1])) >> ? ? ? ? *comp_dir = cp + 1; >> ? ? ?} >> > > I've already told you in another thread that this one is wrong. > We do not want to match anything other than '/' here, even > on Windows. ?On a Windows x Irix gdb, we'd want to check for '/', > literally. ?The Irix native cc compiler is not going to > use '\' or drive names: > > ?if (*comp_dir != NULL) > ? ?{ > ? ? ?/* Irix 6.2 native cc prepends <machine>.: to the compilation > ? ? ? ? directory, get rid of it. ?*/ > ? ? ?char *cp = strchr (*comp_dir, ':'); > > ? ? ?if (cp && cp != *comp_dir && cp[-1] == '.' && cp[1] == '/') > ? ? ? ?*comp_dir = cp + 1; > ? ?} Ok, removed this part of the patch, too. 2011-03-23 Kai Tietz * breakpoint.c (clear_command): Use filename_cmp instead of strcmp for comparision. * buildsym.c (watch_main_source_file_lossage): Likewise. (patch_subfile_names): Use IS_DIR_SEPARATOR instead of checking just for slash. * dbxread.c (read_dbx_symtab): Use lbasename instead of strrchr and filename_cmp instead of strcmp for filenames. (add_old_header_file): Use filename_cmp instead of strcmp for comparision. * exec.c (exec_set_section_address): Likewise. * macrotab.c (macro_lookup_inclusion): Likewise. (macro_lookup_inclusion): Likewise. * elfread.c (_initialize_elfread): Likewise. (elfstab_offset_sections): Likewise. (elfstab_offset_sections): Use lbasename instead of strrchr. * mdebugread.c (parse_partial_symbols): Likewise. (arse_partial_symbols): Use filename_(n)cmp instead of str(n)cmp for comparision. * minsyms.c (lookup_minimal_symbol): Likewise. * psymtab.c (read_psymtabs_with_filename): Likewise. * solib.c (solib_read_symbols): Likewise. (reload_shared_libraries_1): Likewise. * symmisc.c (maintenance_print_symbols): Likewise. * symfile.c (separate_debug_file_exists): Likewise. (reread_symbols): Likewise. (find_separate_debug_file_by_debuglink): Likewise. * remote-fileio.c (remote_fileio_func_rename): Likewise. * source.c (add_path): Likewise. * symtab.c (filename_seen): Likewise. (file_matches): Likewise. (print_symbol_info): Likewise. (maybe_add_partial_symtab_filename): Likewise. (make_source_files_completion_list): Likewise. * xml-syscall.c (init_sysinfo): Likewise. * windows-nat.c (_initialize_check_for_gdb_ini): Use IS_DIR_SEPARATOR for checking for trailing path separator. Updated patch attached. Regards, Kai
Attachment:
gdb_filename.txt
Description: Text document
Index Nav: | [Date Index] [Subject Index] [Author Index] [Thread Index] | |
---|---|---|
Message Nav: | [Date Prev] [Date Next] | [Thread Prev] [Thread Next] |