*** /tmp/gdb-7.2/gdb/source.c 2010-12-17 14:12:11.618336763 +0100 --- gdb-7.2/gdb/source.c 2010-12-17 14:13:02.347583097 +0100 *************** substitute_path_rule_matches (const stru *** 882,888 **** /* Make sure that the region in the path that matches the substitution rule is immediately followed by a directory separator (or the end of string character). */ ! if (path[from_len] != '\0' && !IS_DIR_SEPARATOR (path[from_len])) return 0; return 1; --- 882,888 ---- /* Make sure that the region in the path that matches the substitution rule is immediately followed by a directory separator (or the end of string character). */ ! if (path[from_len] != '\0' && (!IS_UNIX_DIR_SEPARATOR (path[from_len]) && !IS_DOS_DIR_SEPARATOR (path[from_len]))) return 0; return 1; *************** find_and_open_source (const char *filena *** 1015,1021 **** } } ! if (IS_ABSOLUTE_PATH (filename)) { /* If filename is absolute path, try the source path substitution on it. */ --- 1015,1021 ---- } } ! if (IS_UNIX_ABSOLUTE_PATH (filename) || IS_DOS_ABSOLUTE_PATH(filename)) { /* If filename is absolute path, try the source path substitution on it. */ *************** find_and_open_source (const char *filena *** 1023,1028 **** --- 1023,1046 ---- if (rewritten_filename != NULL) { + /* Especially for embedded systems, it may be the case that a + binary has been built on Windows but the embedded system is now + being debugged on a Unix machine (and vice versa). In order to + make path substitution work on such 'mixed' path styles, we need + to convert foreign dir separators to native ones. */ + #ifdef HAVE_DOS_BASED_FILE_SYSTEM + const char from = '/'; + const char to = '\\'; + #else + const char from = '\\'; + const char to = '/'; + #endif + unsigned int i=0; + for( i=0; i