This is the mail archive of the binutils@sourceware.org mailing list for the binutils 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] |
Hi, When using gdb as a cross-debugger from e.g. a linux development pc to a windows ce target (e.g. an embedded system), the source and target can have different filesystem naming standards. This causes gdb to have trouble locating the right file on the host, to match the DLL loaded on the target : a path such as \network\x86\libgcc_s_sjlj-1.dll doesn't get translated into /opt/x86mingw32ce/bin/libgcc_s_sjlj-1.dll so some of the functionality in gdb doesn't work. The cause lies in macros in include/filenames.h which gdb inherits from bfd. I'm including a proposed patch that has been created with guidance from the gdb maintainers. But obviously this is on your territory. The included patch is spread over three files. I am presenting only the gdb-diff-dos-3-bfd to you, the others are included for you to understand what this fits into. Is this the way to handle this type of change ? Please comment, I'm prepared to do the extra work necessary to make this fit into everyone's standards. Thanks, Danny -- Danny Backx ; danny.backx - at - scarlet.be ; http://danny.backx.info
Index: include/filenames.h =================================================================== RCS file: /cvs/src/src/include/filenames.h,v retrieving revision 1.5 diff -u -r1.5 filenames.h --- include/filenames.h 21 Mar 2008 23:40:18 -0000 1.5 +++ include/filenames.h 13 Sep 2009 19:35:10 -0000 @@ -5,7 +5,7 @@ use forward- and back-slash in path names interchangeably, and some of them have case-insensitive file names. - Copyright 2000, 2001, 2007 Free Software Foundation, Inc. + Copyright 2000, 2001, 2007, 2009 Free Software Foundation, Inc. This file is part of BFD, the Binary File Descriptor library. @@ -30,25 +30,34 @@ extern "C" { #endif -#if defined(__MSDOS__) || defined(_WIN32) || defined(__OS2__) || defined (__CYGWIN__) +/* Defined in gdb/top.c + + This determines whether we have + as a separator : / or \ + a prefix [a-z]: or not + Replaces HAVE_DOS_BASED_FILE_SYSTEM and FILENAME_PREFIX_LEN. + + Case sensitive/insensitive file name comparison is *not* influenced by this. */ + +extern int have_dos_based_file_system; + +#define _isalpha(c) (((c >= 'A') && (c <= 'Z')) || ((c >= 'a') && (c <= 'z'))) + +#define IS_DIR_SEPARATOR(c) \ + ((have_dos_based_file_system) ? \ + ((c == '/') || (c == '\\')) : \ + (c == '/')) -#ifndef HAVE_DOS_BASED_FILE_SYSTEM -#define HAVE_DOS_BASED_FILE_SYSTEM 1 +#ifndef FALSE +#define FALSE 0 +#endif +#ifndef TRUE +#define TRUE 1 #endif -#define IS_DIR_SEPARATOR(c) ((c) == '/' || (c) == '\\') -/* Note that IS_ABSOLUTE_PATH accepts d:foo as well, although it is - only semi-absolute. This is because the users of IS_ABSOLUTE_PATH - want to know whether to prepend the current working directory to - a file name, which should not be done with a name like d:foo. */ -#define IS_ABSOLUTE_PATH(f) (IS_DIR_SEPARATOR((f)[0]) || (((f)[0]) && ((f)[1] == ':'))) - -#else /* not DOSish */ - -#define IS_DIR_SEPARATOR(c) ((c) == '/') -#define IS_ABSOLUTE_PATH(f) (IS_DIR_SEPARATOR((f)[0])) - -#endif /* not DOSish */ +#define IS_ABSOLUTE_PATH(f) \ + ((IS_DIR_SEPARATOR(f[0])) ? TRUE : \ + (have_dos_based_file_system ? (_isalpha(f[0]) && (f[1] == ':')) : FALSE)) extern int filename_cmp (const char *s1, const char *s2); #define FILENAME_CMP(s1, s2) filename_cmp(s1, s2) Index: bfd/archive.c =================================================================== RCS file: /cvs/src/src/bfd/archive.c,v retrieving revision 1.58 diff -u -r1.58 archive.c --- bfd/archive.c 2 Sep 2009 07:18:35 -0000 1.58 +++ bfd/archive.c 13 Sep 2009 19:35:11 -0000 @@ -1295,7 +1295,7 @@ { const char *filename = strrchr (file, '/'); -#ifdef HAVE_DOS_BASED_FILE_SYSTEM + if (have_dos_based_file_system) { /* We could have foo/bar\\baz, or foo\\bar, or d:bar. */ char *bslash = strrchr (file, '\\'); @@ -1304,11 +1304,13 @@ if (filename == NULL && file[0] != '\0' && file[1] == ':') filename = file + 1; } -#endif - if (filename != NULL) - filename++; else - filename = file; + { + if (filename != NULL) + filename++; + else + filename = file; + } return filename; } #endif @@ -1820,7 +1822,7 @@ const char *filename = strrchr (pathname, '/'); size_t maxlen = ar_maxnamelen (abfd); -#ifdef HAVE_DOS_BASED_FILE_SYSTEM + if (have_dos_based_file_system) { /* We could have foo/bar\\baz, or foo\\bar, or d:bar. */ char *bslash = strrchr (pathname, '\\'); @@ -1829,7 +1831,6 @@ if (filename == NULL && pathname[0] != '\0' && pathname[1] == ':') filename = pathname + 1; } -#endif if (filename == NULL) filename = pathname; @@ -1868,7 +1869,7 @@ const char *filename = strrchr (pathname, '/'); size_t maxlen = ar_maxnamelen (abfd); -#ifdef HAVE_DOS_BASED_FILE_SYSTEM + if (have_dos_based_file_system) { /* We could have foo/bar\\baz, or foo\\bar, or d:bar. */ char *bslash = strrchr (pathname, '\\'); @@ -1878,7 +1879,6 @@ if (filename == NULL && pathname[0] != '\0' && pathname[1] == ':') filename = pathname + 1; } -#endif if (filename == NULL) filename = pathname; Index: bfd/init.c =================================================================== RCS file: /cvs/src/src/bfd/init.c,v retrieving revision 1.10 diff -u -r1.10 init.c --- bfd/init.c 2 Sep 2009 07:18:37 -0000 1.10 +++ bfd/init.c 13 Sep 2009 19:35:11 -0000 @@ -53,3 +53,14 @@ bfd_init (void) { } + +/* + + */ +#if defined(__MSDOS__) || defined(_WIN32) || defined(__OS2__) || defined (__CYGWIN__) +int have_dos_based_file_system = 1; +#else +int have_dos_based_file_system = 0; +#endif + +
Attachment:
gdb-diff-dos-3-gdb
Description: Text document
Attachment:
gdb-diff-dos-3-libiberty
Description: Text document
Index Nav: | [Date Index] [Subject Index] [Author Index] [Thread Index] | |
---|---|---|
Message Nav: | [Date Prev] [Date Next] | [Thread Prev] [Thread Next] |