[fpc-devel] New Windows gdb-binary
Pierre Free Pascal
pierre at freepascal.org
Sat Oct 1 11:00:00 CEST 2011
Hi Joost,
Did you use the mingw 7.3 patch that handles
the windows style path containing ':'?
I recreated the patch below by doing a diff
from official GDB 7.3 release
and mingw7.3.2 sources.
Without this, debug information containing drive letters
are wrongly cut into parts at the ':' position...
Pierre
diff -r -u -p -N gdb-7.3/config.rpath gdb-7.3-mingw/config.rpath
--- gdb-7.3/config.rpath 2011-02-13 22:00:08.000000000 +0100
+++ gdb-7.3-mingw/config.rpath 2011-08-04 03:30:58.000000000 +0200
@@ -438,7 +438,7 @@ case "$host_os" in
bsdi4*)
;;
cygwin* | mingw* | pw32*)
- shrext=.dll
+ shrext=.dll.a
;;
darwin* | rhapsody*)
shrext=.dylib
diff -r -u -p -N gdb-7.3/gdb/linespec.c gdb-7.3-mingw/gdb/linespec.c
--- gdb-7.3/gdb/linespec.c 2011-07-04 16:19:14.000000000 +0200
+++ gdb-7.3-mingw/gdb/linespec.c 2011-08-04 03:30:58.000000000 +0200
@@ -1222,7 +1222,8 @@ locate_first_half (char **argptr, int *i
quotes we do not break on enclosed spaces. */
if (!*p
|| p[0] == '\t'
- || (p[0] == ':')
+ || ((p[0] == ':')
+ && ((p[1] == ':') || (strchr (p + 1, ':') == NULL)))
|| ((p[0] == ' ') && !*is_quote_enclosed))
break;
if (p[0] == '.' && strchr (p, ':') == NULL)
diff -r -u -p -N gdb-7.3/gdb/source.c gdb-7.3-mingw/gdb/source.c
--- gdb-7.3/gdb/source.c 2011-03-23 19:23:55.000000000 +0100
+++ gdb-7.3-mingw/gdb/source.c 2011-08-04 03:30:59.000000000 +0200
@@ -991,6 +991,7 @@ find_and_open_source (const char *filena
char *path = source_path;
const char *p;
int result;
+ char *lpath;
/* Quick way out if we already know its full name. */
@@ -1009,7 +1010,12 @@ find_and_open_source (const char *filena
result = open (*fullname, OPEN_MODE);
if (result >= 0)
- return result;
+ {
+ lpath = gdb_realpath(*fullname);
+ xfree(*fullname);
+ *fullname = lpath;
+ return result;
+ }
/* Didn't work -- free old one, try again. */
xfree (*fullname);
*fullname = NULL;
diff -r -u -p -N gdb-7.3/gdb/utils.c gdb-7.3-mingw/gdb/utils.c
--- gdb-7.3/gdb/utils.c 2011-05-17 23:26:28.000000000 +0200
+++ gdb-7.3-mingw/gdb/utils.c 2011-08-04 03:30:59.000000000 +0200
@@ -3634,6 +3634,30 @@ gdb_realpath (const char *filename)
}
#endif
+ /* The MS Windows method. If we don't have realpath, we assume we
+ don't have symlinks and just canonicalize to a Windows absolute
+ path. GetFullPath converts ../ and ./ in relative paths to
+ absolute paths, filling in current drive if one is not given
+ or using the current directory of a specified drive (eg, "E:foo").
+ It also converts all forward slashes to back slashes. */
+#if defined (_WIN32)
+ {
+ char buf[MAX_PATH];
+ char* basename;
+ DWORD len = GetFullPathName (filename, MAX_PATH, buf, &basename);
+ if (len == 0 || len > MAX_PATH - 1)
+ return xstrdup (filename);
+ else
+ {
+ /* The file system is case-preserving but case-insensitive,
+ Canonicalize to lowercase, using the codepage associated
+ with the process locale. */
+ CharLowerBuff (buf, len);
+ return xstrdup (buf);
+ }
+ }
+#endif
+
/* This system is a lost cause, just dup the buffer. */
return xstrdup (filename);
}
More information about the fpc-devel
mailing list