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]

RE: Possible fix for mingw32 directory relocation problems



> -----Message d'origine-----
> De?: gdb-patches-owner@sourceware.org [mailto:gdb-patches-
> owner@sourceware.org] De la part de Doug Evans
> Envoyé?: mardi 17 janvier 2012 08:00
> À?: Pierre Muller
> Cc?: gdb-patches@sourceware.org; Eli Zaretskii; asmwarrior@gmail.com; Tom
> Tromey
> Objet?: Re: Possible fix for mingw32 directory relocation problems
> 
> On Mon, Jan 16, 2012 at 7:03 AM, Pierre Muller
> <pierre.muller@ics-cnrs.unistra.fr> wrote:
> > ?After some debugging,
> > we finally managed to find out that
> > mingw32 specific directory relocations are related
> > to msys -> mingw32 argument conversions.
> 
> Thanks for the detective work!

  I always liked to debug GDB with itself!
 
> > http://sourceware.org/ml/gdb-patches/2012-01/msg00537.html
> >
> > This is explained in:
> >
> > http://www.mingw.org/wiki/Posix_path_conversion
> >
> > This page also allows to understand why
> > using mingw32 style paths for prefix at configure
> > level works and avoid the troubles encountered.
> >
> > This conversion concerns defines passed by command line arguments
> > to gcc, which are specific to main.o
> > compilation, as found in gdb/Makefile.in
> > 1520-
> > 1521:# main.o needs an explicit build rule to get TARGET_SYSTEM_ROOT and
> > BINDIR.
> > 1522-main.o: $(srcdir)/main.c
> > 1523: ? $(COMPILE) $(TARGET_SYSTEM_ROOT_DEFINE) -DBINDIR=\"$(bindir)\"
> > $(srcdir)/main.c
> > 1524- ? $(POSTCOMPILE)
> > 1525-
> >
> > ?But this leads to a conversion:
> > ?-DBINDIR="/usr/local/bin\"
> > gets transformed into '-D' 'BINDIR="E:/msys/mingw32/msys/1.0/local/bin"'
> >
> > ?While other pates used in relocate_gdb_directory calls
> > are macros defined inside gdb/config.h
> >
> > config.h:#define DEBUGDIR "/usr/local/lib/debug"
> > config.h:#define GDB_DATADIR "/usr/local/share/gdb"
> > config.h:#define JIT_READER_DIR "/usr/local/lib/gdb"
> >
> > Those are of course not affected by msys command-line argument
conversion.
> >
> > ?The first question is:
> > Why do we need to pass BINDIR (and TARGET_SYSTEM_ROOT_DEFINE)
> > at the command line instead of inside config.h as for other
> > directories?
> 
> We don't need to pass them on the command line.
> 
> > ?If the answer to the first question is "we don't",
> > then I need help about how to convert those
> > Makefile.in variables into new entries of generated config.h file.
> 
> Possible patch is attached.
> Can you try it?  I don't know that it will fix things, but based on
> what you've said it seems reasonable to try.

  I tried it...
But got really into troubles to regenerate configure and config.in using
Cygwin
installation...
  I finally discovered gcc-tools-epoch2 cygwin package
that allowed me to successfully regenerate configure and config.in

  After that I did recompile and install gdb into e:\pas\fpc-2.7.1 directory
by specifying --prefix=/e/pas/fpc-2.7.1
(I tested with --preficx=e:/pas/fpc-2.4.4, which worked the same)

E:\pas\fpc-2.7.1\gdb>cd bin

E:\pas\fpc-2.7.1\gdb\bin>.\gdb ./gdb
GNU gdb (GDB) 7.4.50.20120117-cvs
Copyright (C) 2012 Free Software Foundation, Inc.
License GPLv3+: GNU GPL version 3 or later
<http://gnu.org/licenses/gpl.html>
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 "i686-pc-mingw32".
For bug reporting instructions, please see:
<http://www.gnu.org/software/gdb/bugs/>...
Reading symbols from E:\pas\fpc-2.7.1\gdb\bin\gdb.exe...done.
(gdb) py print gdb.PYTHONDIR
e:\pas\fpc-2.7.1\gdb\share\gdb/python
(gdb) py
>end
(gdb) q

E:\pas\fpc-2.7.1\gdb\bin>cd ..\..

E:\pas\fpc-2.7.1>cp -Rf gdb ..\fpc-2.6.0

E:\pas\fpc-2.7.1>cd ..\fpc-2.6.0\gdb\bin

E:\pas\fpc-2.6.0\gdb\bin>.\gdb ./gdb
GNU gdb (GDB) 7.4.50.20120117-cvs
Copyright (C) 2012 Free Software Foundation, Inc.
License GPLv3+: GNU GPL version 3 or later
<http://gnu.org/licenses/gpl.html>
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 "i686-pc-mingw32".
For bug reporting instructions, please see:
<http://www.gnu.org/software/gdb/bugs/>...
Reading symbols from E:\pas\fpc-2.6.0\gdb\bin\gdb.exe...done.
(gdb) py print gdb.PYTHONDIR
e:\pas\fpc-2.6.0\gdb\share\gdb/python
(gdb)

So the basic idea of rebasing gdb/python seems to work,
the next problem is that I never used python scripts
so that I didn't know what else to do to check that this directory is really
functional!
 
> There is an open issue that the current --with-sysroot relocatability
> computation is different than what GDB_AC_WITH_DIR does.  We should
> fix that regardless.  I've left that as a separate issue.  [We should
> resolve it before checkin, but at this point I'm willing to just
> experiment until we know what the right fix is.]

  I have really no idea about sysroot issue,
but the main point is the relocation flag is set to zero,
meaning that make_relative_prefix is not called there.

  From what I tested, I would say that this is an improvement for 
mingw32 GDB...

  Nevertheless, if you run gdb directly in the compilation directory,
you will notice the GDB_DATADIR macro set to  '/usr/local/share/gdb' in
config.h
into 'e:\usr\local\share\gdb'
due to a call to lrealpath which calls GetFullPathName if __WIN32 is
defined.

  Thus, I wonder if the correct solution should not be to
convert all the paths in config.h to mingw32 type at configure time.
But, once again, I don't really know how to do this....

  I went on to try to use this to test mingw64 Windows-64bit GDB debugger
using Cygwin cross-compiler x86_64-w64-mingw32 target, but
I couldn't get configure to accept the Windows 64-bit 2.7 python...
apparently because not libpython2.7.a is included in the distribution
(the library is, according to web search, non-functional...)
Does anyone know howto force python use for cygwin to mingw64 cross
compilation of GDB?


Pierre Muller



Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]