From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: (qmail 8229 invoked by alias); 8 Sep 2009 20:13:48 -0000 Received: (qmail 8037 invoked by uid 22791); 8 Sep 2009 20:13:44 -0000 X-SWARE-Spam-Status: No, hits=1.5 required=5.0 tests=AWL,BAYES_50,EXECUTABLE_URI,J_CHICKENPOX_13,J_CHICKENPOX_55,RCVD_IN_DNSWL_LOW,RCVD_IN_JMF_BL,SPF_PASS X-Spam-Check-By: sourceware.org Received: from eir.is.scarlet.be (HELO eir.is.scarlet.be) (193.74.71.27) by sourceware.org (qpsmtpd/0.43rc1) with ESMTP; Tue, 08 Sep 2009 20:13:33 +0000 Received: from [172.17.1.10] (ip-81-11-242-151.dsl.scarlet.be [81.11.242.151]) by eir.is.scarlet.be (8.14.2/8.14.2) with ESMTP id n88KDP65001756; Tue, 8 Sep 2009 22:13:26 +0200 Subject: Re: Build question From: Danny Backx Reply-To: danny.backx@scarlet.be To: Eli Zaretskii Cc: gdb-patches@sourceware.org In-Reply-To: <83eiql4blw.fsf@gnu.org> References: <1250803105.11282.96.camel@pavilion> <83d46pgjkq.fsf@gnu.org> <1250877901.11282.116.camel@pavilion> <83ab1tgh9h.fsf@gnu.org> <1250880746.11282.128.camel@pavilion> <1250931899.11282.142.camel@pavilion> <83skfkfa4n.fsf@gnu.org> <1251095160.16357.352.camel@pavilion> <1251828295.6106.119.camel@pavilion> <83zl9e8nro.fsf@gnu.org> <1251835928.6106.124.camel@pavilion> <83vdk281xb.fsf@gnu.org> <1252143311.6106.252.camel@pavilion> <83eiql4blw.fsf@gnu.org> Content-Type: multipart/mixed; boundary="=-9EX51NoXcIh2e+s/HiCT" Date: Tue, 08 Sep 2009 20:13:00 -0000 Message-Id: <1252440932.6106.336.camel@pavilion> Mime-Version: 1.0 X-DCC-scarlet.be-Metrics: eir 20001; Body=3 Fuz1=3 Fuz2=3 Mailing-List: contact gdb-patches-help@sourceware.org; run by ezmlm Precedence: bulk List-Id: List-Subscribe: List-Archive: List-Post: List-Help: , Sender: gdb-patches-owner@sourceware.org X-SW-Source: 2009-09/txt/msg00223.txt.bz2 --=-9EX51NoXcIh2e+s/HiCT Content-Type: text/plain Content-Transfer-Encoding: 7bit Content-length: 6575 On Sat, 2009-09-05 at 19:09 +0300, Eli Zaretskii wrote: > > Otherwise, this code appears to work for me. I hardcoded the variable in > > gdb/main.c, set this to both 0 and 1 for testing, and saw the expected > > results. > > Later we should probably have a user option to control that. This, and the changes you requested, are now in this new patch. Unless I missed something :-) Two almost identical remote debugging sessions showing the functionality are below. It is a bit awkward, but this change influences the place where the DLL names are read, which is when connecting to the target. So changing the setting while in a debugging session won't affect the result of "info share". That's why there are two separate sessions in the output below. Please review. Danny -- Danny Backx ; danny.backx - at - scarlet.be ; http://danny.backx.info pavilion: {310} ./gdb ~/tmp/arm/test/remedy.nl/shlib/4.stdc ++/usedemo.exe warning: A handler for the OS ABI "Windows CE" is not built into this configuration of GDB. Attempting to continue with the default i386 settings. GNU gdb (GDB) 6.8.50.20090905-cvs Copyright (C) 2009 Free Software Foundation, Inc. License GPLv3+: GNU GPL version 3 or later This is free software: you are free to change and redistribute it. There is NO WARRANTY, to the extent permitted by law. Type "show copying" and "show warranty" for details. This GDB was configured as "--host=i686-pc-linux-gnu --target=i386-mingw32ce". For bug reporting instructions, please see: ... Reading symbols from /home/danny/tmp/arm/test/remedy.nl/shlib/4.stdc ++/usedemo.exe...done. (gdb) set solib-search-path /home/danny/tmp/arm/test/remedy.nl/shlib/4.stdc ++:/opt/x86mingw32ce/bin:/opt/x86mingw32ce/i386-mingw32ce/lib (gdb) info share No shared libraries loaded at this time. (gdb) target remote ebox:9999 Remote debugging using ebox:9999 Error while mapping shared library sections: \network\x86\libgcc_s_sjlj-1.dll: No such file or directory. Error while mapping shared library sections: \network\x86\libstdc++-6.dll: No such file or directory. Error while mapping shared library sections: \network\x86\libx.dll: No such file or directory. Error while mapping shared library sections: coredll.dll: No such file or directory. Symbol file not found for \network\x86\libgcc_s_sjlj-1.dll Symbol file not found for \network\x86\libstdc++-6.dll Symbol file not found for \network\x86\libx.dll Symbol file not found for coredll.dll WinMainCRTStartup (hInst=0x586000a, hPrevInst=0x0, lpCmdLine=0x2601fc70 L"", nCmdShow=5) at /home/danny/src/cegcc/svn.sf.net/cegcc/trunk/cegcc/src/mingw/crt3.c:35 35 { (gdb) info share >From To Syms Read Shared Object Library No \network\x86\libgcc_s_sjlj-1.dll No \network\x86\libstdc++-6.dll No \network\x86\libx.dll No coredll.dll (gdb) q A debugging session is active. Inferior 1 [Remote target] will be killed. Quit anyway? (y or n) n Not confirmed. (gdb) detach Ending remote debugging. (gdb) q pavilion: {311} ./gdb ~/tmp/arm/test/remedy.nl/shlib/4.stdc ++/usedemo.exe warning: A handler for the OS ABI "Windows CE" is not built into this configuration of GDB. Attempting to continue with the default i386 settings. GNU gdb (GDB) 6.8.50.20090905-cvs Copyright (C) 2009 Free Software Foundation, Inc. License GPLv3+: GNU GPL version 3 or later This is free software: you are free to change and redistribute it. There is NO WARRANTY, to the extent permitted by law. Type "show copying" and "show warranty" for details. This GDB was configured as "--host=i686-pc-linux-gnu --target=i386-mingw32ce". For bug reporting instructions, please see: ... Reading symbols from /home/danny/tmp/arm/test/remedy.nl/shlib/4.stdc ++/usedemo.exe...done. (gdb) q pavilion: {312} cat ~/xx gdbserver :9999 /network/x86/usedemo.exe ./gdb ~/tmp/arm/test/remedy.nl/shlib/4.stdc++/usedemo.exe set solib-search-path /home/danny/tmp/arm/test/remedy.nl/shlib/4.stdc ++:/opt/x86mingw32ce/bin:/opt/x86mingw32ce/i386-mingw32ce/lib target remote ebox:9999 info share pavilion: {313} ./gdb ~/tmp/arm/test/remedy.nl/shlib/4.stdc ++/usedemo.exe warning: A handler for the OS ABI "Windows CE" is not built into this configuration of GDB. Attempting to continue with the default i386 settings. GNU gdb (GDB) 6.8.50.20090905-cvs Copyright (C) 2009 Free Software Foundation, Inc. License GPLv3+: GNU GPL version 3 or later This is free software: you are free to change and redistribute it. There is NO WARRANTY, to the extent permitted by law. Type "show copying" and "show warranty" for details. This GDB was configured as "--host=i686-pc-linux-gnu --target=i386-mingw32ce". For bug reporting instructions, please see: ... Reading symbols from /home/danny/tmp/arm/test/remedy.nl/shlib/4.stdc ++/usedemo.exe...done. (gdb) set solib-search-path /home/danny/tmp/arm/test/remedy.nl/shlib/4.stdc ++:/opt/x86mingw32ce/bin:/opt/x86mingw32ce/i386-mingw32ce/lib (gdb) set dos_based_file_system on (gdb) target remote ebox:9999 Remote debugging using ebox:9999 Error while mapping shared library sections: coredll.dll: No such file or directory. Reading symbols from /opt/x86mingw32ce/bin/libgcc_s_sjlj-1.dll...done. Loaded symbols for /opt/x86mingw32ce/bin/libgcc_s_sjlj-1.dll Reading symbols from /opt/x86mingw32ce/i386-mingw32ce/lib/libstdc ++-6.dll...done. Loaded symbols for /opt/x86mingw32ce/i386-mingw32ce/lib/libstdc++-6.dll Reading symbols from /home/danny/tmp/arm/test/remedy.nl/shlib/4.stdc ++/libx.dll...done. Loaded symbols for /home/danny/tmp/arm/test/remedy.nl/shlib/4.stdc ++/libx.dll Symbol file not found for coredll.dll WinMainCRTStartup (hInst=0x41f000e, hPrevInst=0x0, lpCmdLine=0x2a01fc70 L"", nCmdShow=5) at /home/danny/src/cegcc/svn.sf.net/cegcc/trunk/cegcc/src/mingw/crt3.c:35 35 { (gdb) info share >From To Syms Read Shared Object Library 0x42371000 0x4237c1fc Yes /opt/x86mingw32ce/bin/libgcc_s_sjlj-1.dll 0x41f01000 0x41fd2988 Yes /opt/x86mingw32ce/i386-mingw32ce/lib/libstdc++-6.dll 0x41ee1000 0x41ee7068 Yes /home/danny/tmp/arm/test/remedy.nl/shlib/4.stdc++/libx.dll No coredll.dll (gdb) c Continuing. Program exited with code 017. (gdb) q pavilion: {314} --=-9EX51NoXcIh2e+s/HiCT Content-Disposition: attachment; filename="gdb-diff-dos-2" Content-Type: text/x-patch; name="gdb-diff-dos-2"; charset="UTF-8" Content-Transfer-Encoding: 7bit Content-length: 10775 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 8 Sep 2009 20:07:38 -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: gdb/completer.c =================================================================== RCS file: /cvs/src/src/gdb/completer.c,v retrieving revision 1.34 diff -u -r1.34 completer.c --- gdb/completer.c 25 Mar 2009 10:50:56 -0000 1.34 +++ gdb/completer.c 8 Sep 2009 20:07:45 -0000 @@ -232,13 +232,12 @@ else break; /* Hit the end of text. */ } -#if HAVE_DOS_BASED_FILE_SYSTEM /* If we have a DOS-style absolute file name at the beginning of TEXT, and the colon after the drive letter is the only colon we found, pretend the colon is not there. */ - else if (p < text + 3 && *p == ':' && p == text + 1 + quoted) + else if (have_dos_based_file_system + && p < text + 3 && *p == ':' && p == text + 1 + quoted) ; -#endif else if (*p == ':' && !colon) { colon = p; Index: gdb/source.c =================================================================== RCS file: /cvs/src/src/gdb/source.c,v retrieving revision 1.103 diff -u -r1.103 source.c --- gdb/source.c 23 Jul 2009 23:20:00 -0000 1.103 +++ gdb/source.c 8 Sep 2009 20:07:46 -0000 @@ -474,14 +474,20 @@ /* name is the start of the directory. p is the separator (or null) following the end. */ - while (!(IS_DIR_SEPARATOR (*name) && p <= name + 1) /* "/" */ -#ifdef HAVE_DOS_BASED_FILE_SYSTEM - /* On MS-DOS and MS-Windows, h:\ is different from h: */ - && !(p == name + 3 && name[1] == ':') /* "d:/" */ -#endif - && IS_DIR_SEPARATOR (p[-1])) - /* Sigh. "foo/" => "foo" */ - --p; + if (have_dos_based_file_system) { + while (!(IS_DIR_SEPARATOR (*name) && p <= name + 1) /* "/" */ + /* On MS-DOS and MS-Windows, h:\ is different from h: */ + && !(p == name + 3 && name[1] == ':') /* "d:/" */ + && IS_DIR_SEPARATOR (p[-1])) + /* Sigh. "foo/" => "foo" */ + --p; + } else { + while (!(IS_DIR_SEPARATOR (*name) && p <= name + 1) /* "/" */ + /* On MS-DOS and MS-Windows, h:\ is different from h: */ + && IS_DIR_SEPARATOR (p[-1])) + /* Sigh. "foo/" => "foo" */ + --p; + } *p = '\0'; while (p > name && p[-1] == '.') @@ -514,10 +520,9 @@ if (name[0] == '~') name = tilde_expand (name); -#ifdef HAVE_DOS_BASED_FILE_SYSTEM - else if (IS_ABSOLUTE_PATH (name) && p == name + 2) /* "d:" => "d:." */ + else if (have_dos_based_file_system + && IS_ABSOLUTE_PATH (name) && p == name + 2) /* "d:" => "d:." */ name = concat (name, ".", (char *)NULL); -#endif else if (!IS_ABSOLUTE_PATH (name) && name[0] != '$') name = concat (current_directory, SLASH_STRING, name, (char *)NULL); else Index: gdb/top.c =================================================================== RCS file: /cvs/src/src/gdb/top.c,v retrieving revision 1.170 diff -u -r1.170 top.c --- gdb/top.c 31 Aug 2009 20:18:45 -0000 1.170 +++ gdb/top.c 8 Sep 2009 20:07:47 -0000 @@ -184,6 +184,9 @@ char *lim_at_start; #endif +/* Filesystem type */ +int have_dos_based_file_system = 0; + /* Signal to catch ^Z typed while reading a command: SIGTSTP or SIGCONT. */ #ifndef STOP_SIGNAL @@ -676,6 +679,15 @@ value); } +static void +show_dos_based_file_system (struct ui_file *file, int from_tty, + struct cmd_list_element *c, const char *value) +{ + fprintf_filtered (file, _("\ +Whether the target has a DOS based file system is \"%s\".\n"), + value); +} + /* This is like readline(), but it has some gdb-specific behavior. gdb may want readline in both the synchronous and async modes during a single gdb invocation. At the ordinary top-level prompt we might @@ -1630,6 +1642,14 @@ show_history_filename, &sethistlist, &showhistlist); + add_setshow_boolean_cmd ("dos_based_file_system", class_support, + &have_dos_based_file_system, _("\ +Set whether the target has a DOS based file system"), _("\ +Show whether the target has a DOS based file system"), _("\ +whether the target has a DOS based file system"), NULL, + show_dos_based_file_system, + &setlist, &showlist); + add_setshow_boolean_cmd ("confirm", class_support, &caution, _("\ Set whether to confirm potentially dangerous operations."), _("\ Show whether to confirm potentially dangerous operations."), NULL, Index: gdb/utils.c =================================================================== RCS file: /cvs/src/src/gdb/utils.c,v retrieving revision 1.219 diff -u -r1.219 utils.c --- gdb/utils.c 18 Aug 2009 16:17:16 -0000 1.219 +++ gdb/utils.c 8 Sep 2009 20:07:49 -0000 @@ -3280,15 +3280,14 @@ strncpy (dir_name, filename, base_name - filename); dir_name[base_name - filename] = '\000'; -#ifdef HAVE_DOS_BASED_FILE_SYSTEM /* We need to be careful when filename is of the form 'd:foo', which is equivalent of d:./foo, which is totally different from d:/foo. */ - if (strlen (dir_name) == 2 && isalpha (dir_name[0]) && dir_name[1] == ':') + if (have_dos_based_file_system + && strlen (dir_name) == 2 && isalpha (dir_name[0]) && dir_name[1] == ':') { dir_name[2] = '.'; dir_name[3] = '\000'; } -#endif /* Canonicalize the directory prefix, and build the resulting filename. If the dirname realpath already contains an ending Index: gdb/cli/cli-cmds.c =================================================================== RCS file: /cvs/src/src/gdb/cli/cli-cmds.c,v retrieving revision 1.92 diff -u -r1.92 cli-cmds.c --- gdb/cli/cli-cmds.c 11 Jul 2009 14:04:23 -0000 1.92 +++ gdb/cli/cli-cmds.c 8 Sep 2009 20:07:50 -0000 @@ -357,24 +357,27 @@ if (chdir (dir) < 0) perror_with_name (dir); -#ifdef HAVE_DOS_BASED_FILE_SYSTEM /* There's too much mess with DOSish names like "d:", "d:.", "d:./foo" etc. Instead of having lots of special #ifdef'ed code, simply get the canonicalized name of the current directory. */ - dir = getcwd (gdb_dirbuf, sizeof (gdb_dirbuf)); -#endif + if (have_dos_based_file_system) + dir = getcwd (gdb_dirbuf, sizeof (gdb_dirbuf)); len = strlen (dir); if (IS_DIR_SEPARATOR (dir[len - 1])) { /* Remove the trailing slash unless this is a root directory (including a drive letter on non-Unix systems). */ - if (!(len == 1) /* "/" */ -#ifdef HAVE_DOS_BASED_FILE_SYSTEM - && !(len == 3 && dir[1] == ':') /* "d:/" */ -#endif - ) - len--; + if (have_dos_based_file_system) + { + if (!(len == 1) /* "/" */ && !(len == 3 && dir[1] == ':') /* "d:/" */) + len--; + } + else + { + if (!(len == 1)) /* "/" */ + len--; + } } dir = savestring (dir, len); 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 8 Sep 2009 20:07:52 -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,36 @@ 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])) +#define IS_ABSOLUTE_PATH(f) \ + ((IS_DIR_SEPARATOR(f[0])) ? TRUE : \ + (have_dos_based_file_system ? (_isalpha(f[0]) && (f[1] == ':')) : FALSE)) -#endif /* not DOSish */ +#endif /* static inline functions */ extern int filename_cmp (const char *s1, const char *s2); #define FILENAME_CMP(s1, s2) filename_cmp(s1, s2) --=-9EX51NoXcIh2e+s/HiCT--